30 lines
111 KiB
JavaScript
30 lines
111 KiB
JavaScript
|
(function(L,P){typeof exports=="object"&&typeof module<"u"?P(exports):typeof define=="function"&&define.amd?define(["exports"],P):(L=typeof globalThis<"u"?globalThis:L||self,P(L.twe={}))})(this,function(L){"use strict";var jl=Object.defineProperty;var Ul=(L,P,R)=>P in L?jl(L,P,{enumerable:!0,configurable:!0,writable:!0,value:R}):L[P]=R;var $i=(L,P,R)=>(Ul(L,typeof P!="symbol"?P+"":P,R),R);/*!
|
||
|
* TW Elements
|
||
|
* Version: FREE 2.0.0
|
||
|
*
|
||
|
* Copyright: Material Design for Bootstrap
|
||
|
* https://mdbootstrap.com/
|
||
|
*
|
||
|
* Read the license: https://tw-elements.com/license/
|
||
|
*
|
||
|
*
|
||
|
* Documentation: https://tw-elements.com/
|
||
|
*
|
||
|
* Support: https://mdbootstrap.com/support/cat/twe
|
||
|
*
|
||
|
* Contact: tailwind@mdbootstrap.com
|
||
|
*
|
||
|
*/const P=(()=>{const i={};let t=1;return{set(e,s,n){typeof e[s]>"u"&&(e[s]={key:s,id:t},t++),i[e[s].id]=n},get(e,s){if(!e||typeof e[s]>"u")return null;const n=e[s];return n.key===s?i[n.id]:null},delete(e,s){if(typeof e[s]>"u")return;const n=e[s];n.key===s&&(delete i[n.id],delete e[s])}}})(),R={setData(i,t,e){P.set(i,t,e)},getData(i,t){return P.get(i,t)},removeData(i,t){P.delete(i,t)}},Bn=1e6,jn=1e3,Ie="transitionend",Un=i=>i==null?`${i}`:{}.toString.call(i).match(/\s([a-z]+)/i)[1].toLowerCase(),Yn=i=>{do i+=Math.floor(Math.random()*Bn);while(document.getElementById(i));return i},Ii=i=>{let t=i.getAttribute("data-twe-target");if(!t||t==="#"){let e=i.getAttribute("href");if(!e||!e.includes("#")&&!e.startsWith("."))return null;e.includes("#")&&!e.startsWith("#")&&(e=`#${e.split("#")[1]}`),t=e&&e!=="#"?e.trim():null}return t},Re=i=>{const t=Ii(i);return t&&document.querySelector(t)?t:null},st=i=>{const t=Ii(i);return t?document.querySelector(t):null},ke=i=>{if(!i)return 0;let{transitionDuration:t,transitionDelay:e}=window.getComputedStyle(i);const s=Number.parseFloat(t),n=Number.parseFloat(e);return!s&&!n?0:(t=t.split(",")[0],e=e.split(",")[0],(Number.parseFloat(t)+Number.parseFloat(e))*jn)},Ri=i=>{i.dispatchEvent(new Event(Ie))},yt=i=>!i||typeof i!="object"?!1:(typeof i.jquery<"u"&&(i=i[0]),typeof i.nodeType<"u"),nt=i=>yt(i)?i.jquery?i[0]:i:typeof i=="string"&&i.length>0?document.querySelector(i):null,x=(i,t,e)=>{Object.keys(e).forEach(s=>{const n=e[s],r=t[s],o=r&&yt(r)?"element":Un(r);if(!new RegExp(n).test(o))throw new Error(`${i.toUpperCase()}: Option "${s}" provided type "${o}" but expected type "${n}".`)})},Ct=i=>{if(!i)return!1;if(i.style&&i.parentNode&&i.parentNode.style){const t=getComputedStyle(i),e=getComputedStyle(i.parentNode);return t.display!=="none"&&e.display!=="none"&&t.visibility!=="hidden"}return!1},ct=i=>!i||i.nodeType!==Node.ELEMENT_NODE||i.classList.contains("disabled")?!0:typeof i.disabled<"u"?i.disabled:i.hasAttribute("disabled")&&i.getAttribute("disabled")!=="false",ki=i=>{if(!document.documentElement.attachShadow)return null;if(typeof i.getRootNode=="function"){const t=i.getRootNode();return t instanceof ShadowRoot?t:null}return i instanceof ShadowRoot?i:i.parentNode?ki(i.parentNode):null},se=()=>function(){},Ut=i=>{i.offsetHeight},xi=()=>{const{jQuery:i}=window;return i&&!document.body.hasAttribute("data-twe-no-jquery")?i:null},xe=[],Pi=i=>{document.readyState==="loading"?(xe.length||document.addEventListener("DOMContentLoaded",()=>{xe.forEach(t=>t())}),xe.push(i)):i()},W=()=>document.documentElement.dir==="rtl",Yt=i=>document.createElement(i),dt=i=>{typeof i=="function"&&i()},Mi=(i,t,e=!0)=>{if(!e){dt(i);return}const s=5,n=ke(t)+s;let r=!1;const o=({target:a})=>{a===t&&(r=!0,t.removeEventListener(Ie,o),dt(i))};t.addEventListener(Ie,o),setTimeout(()=>{r||Ri(t)},n)},Hi=(i,t,e,s)=>{let n=i.indexOf(t);if(n===-1)return i[!e&&s?i.length-1:0];const r=i.length;return n+=e?1:-1,s&&(n=(n+r)%r),i[Math.max(0,Math.min(n,r-1))]},Kn=/[^.]*(?=\..*)\.|.*/,Fn=/\..*/,zn=/::\d+$/,Pe={};let Vi=1;const qn={mouseenter:"mouseover",mouseleave:"mouseout"},Xn=/^(mouseenter|mouseleave)/i,Wi=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function Bi(i,t){return t&&`${t}::${Vi++}`||i.uidEvent||Vi++}function ji(i){const t=Bi(i);return i.uidEvent=t,Pe[t]=Pe[t]||{},Pe[t]}function Gn(i,t){return function e(s){return s.delegateTarget=i,e.oneOff&&d.off(i,s.type,t),t.apply(i,[s])}}function Qn(i,t,e){return function s(n){const r=i.querySelectorAll(t);for(let{target:o}=n;o&&o!==this;o=o.parentNode)for(let a=r.length;a--;"")if(r[a]===o)re
|
||
|
<div class="opacity-0 transition-opacity duration-300 ease-in-out absolute z-[1080] block m-0 text-sm not-italic font-normal text-left no-underline underline-offset-auto normal-case leading-6 tracking-normal break-normal whitespace-normal" role="tooltip">
|
||
|
<div data-twe-tooltip-inner-ref class="max-w-[200px] text-sm py-1.5 px-4 text-white text-center bg-[#6d6d6d] rounded"></div>
|
||
|
</div>
|
||
|
`,trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:[0,0],container:!1,fallbackPlacements:["top","right","bottom","left"],boundary:"clippingParents",customClass:"",sanitize:!0,sanitizeFn:null,allowList:Ea,popperConfig:{hide:!0}},ya={HIDE:`hide${J}`,HIDDEN:`hidden${J}`,SHOW:`show${J}`,SHOWN:`shown${J}`,INSERTED:`inserted${J}`,CLICK:`click${J}`,FOCUSIN:`focusin${J}`,FOCUSOUT:`focusout${J}`,MOUSEENTER:`mouseenter${J}`,MOUSELEAVE:`mouseleave${J}`},Ca="fade",Oa="modal",pi="show",Gt="show",_i="out",tn="[data-twe-tooltip-inner-ref]",en=`.${Oa}`,sn="hide.twe.modal",Qt="hover",gi="focus",Da="click",Na="manual";class Et extends et{constructor(t,e){if(typeof Cs>"u")throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)");super(t),this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this._config=this._getConfig(e),this.tip=null,this._setListeners()}static get Default(){return Aa}static get NAME(){return Js}static get Event(){return ya}static get DefaultType(){return wa}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}toggleEnabled(){this._isEnabled=!this._isEnabled}toggle(t){if(this._isEnabled)if(t){const e=this._initializeOnDelegatedTarget(t);e._activeTrigger.click=!e._activeTrigger.click,e._isWithActiveTrigger()?e._enter(null,e):e._leave(null,e)}else{if(this.getTipElement().classList.contains(pi)){this._leave(null,this);return}this._enter(null,this)}}dispose(){clearTimeout(this._timeout),d.off(this._element.closest(en),sn,this._hideModalHandler),this.tip&&this.tip.remove(),this._disposePopper(),super.dispose()}show(){if(this._element.style.display==="none")throw new Error("Please use show on visible elements");if(!(this.isWithContent()&&this._isEnabled))return;const t=d.trigger(this._element,this.constructor.Event.SHOW),e=ki(this._element),s=e===null?this._element.ownerDocument.documentElement.contains(this._element):e.contains(this._element);if(t.defaultPrevented||!s)return;this.constructor.NAME==="tooltip"&&this.tip&&this.getTitle()!==this.tip.querySelector(tn).innerHTML&&(this._disposePopper(),this.tip.remove(),this.tip=null);const n=this.getTipElement(),r=Yn(this.constructor.NAME);n.setAttribute("id",r),this._element.setAttribute("aria-describedby",r),this._config.animation&&setTimeout(()=>{this.tip.classList.add("opacity-100"),this.tip.classList.remove("opacity-0")},100);const o=typeof this._config.placement=="function"?this._config.placement.call(this,n,this._element):this._config.placement,a=this._getAttachment(o);this._addAttachmentClass(a);const{container:l}=this._config;if(R.setData(n,this.constructor.DATA_KEY,this),this._element.ownerDocument.documentElement.contains(this.tip)||(l.append(n),d.trigger(this._element,this.constructor.Event.INSERTED)),this._popper?this._popper.update():this._popper=Je(this._element,n,this._getPopperConfig(a)),n.getAttribute("id").includes("tooltip"))switch(o){case"bottom":n.classList.add("py-[0.4rem]");break;case"left":n.classList.add("px-[0.4rem]");break;case"right":n.classList.add("px-[0.4rem]");break;default:n.classList.add("py-[0.4rem]");break}const c=this._resolvePossibleFunction(this._config.customClass);c&&n.classList.add(...c.split(" ")),"ontouchstart"in document.documentElement&&[].concat(...document.body.children).forEach(g=>{d.on(g,"mouseover",se)});const f=()=>{const g=this._hoverState;this._hoverState=null,d.trigger(this._element,this.constructor.Event.SHOWN),g===_i&&this._leave(null,this)},v=this.tip.classList.contains("transition-opacity");this._queueCallback(f,this.tip,v)}hide(){if(!this._popper)return;const t=this.getTipElement(),e=()=>{this._isWithActiveTrigger()||(this._hoverState!==Gt&&t.remove(),this._cleanTipClass(),this._element.removeAttribute("aria-describedby"),d.trigger(this._element,this.constructor.Event.HIDDEN),this._disposePopper())};if(d.trigger(this._element,this.constructor.Event.HIDE).defaultPrevented)return;t.classList.add("opacity-0"),t.classList.remove("opacity-100"),"ontouchstart"in document.documentElement&&[].concat(...document.body.child
|
||
|
<div class="opacity-0 transition-opacity duration-150 ease-in-out absolute top-0 left-0 z-[1070] block max-w-[267px] break-words bg-white bg-clip-padding border border-neutral-100 rounded-lg shadow-2 text-sm not-italic font-normal text-left no-underline underline-offset-auto normal-case leading-6 tracking-normal break-normal whitespace-normal dark:border-white/10 dark:bg-surface-dark dark:text-white data-[popper-reference-hidden]:hidden" role="tooltip">
|
||
|
<h3 data-twe-popover-header-ref class="py-2 px-4 mb-0 border-b-2 border-neutral-100 rounded-t-lg font-medium empty:hidden dark:border-white/10"></h3>
|
||
|
<div data-twe-popover-body-ref class="p-4 text-surface dark:text-white"></div>
|
||
|
</div>
|
||
|
`},Ia={...Et.DefaultType,content:"(string|element|function)"},Ra={HIDE:`hide${tt}`,HIDDEN:`hidden${tt}`,SHOW:`show${tt}`,SHOWN:`shown${tt}`,INSERTED:`inserted${tt}`,CLICK:`click${tt}`,FOCUSIN:`focusin${tt}`,FOCUSOUT:`focusout${tt}`,MOUSEENTER:`mouseenter${tt}`,MOUSELEAVE:`mouseleave${tt}`},ka="[data-twe-popover-header-ref]",xa="[data-twe-popover-body-ref]";class ge extends Et{static get Default(){return $a}static get NAME(){return Sa}static get Event(){return Ra}static get DefaultType(){return Ia}isWithContent(){return this.getTitle()||this._getContent()}setContent(t){this._sanitizeAndSetContent(t,this.getTitle(),ka),this._sanitizeAndSetContent(t,this._getContent(),xa)}_getContent(){return this._resolvePossibleFunction(this._config.content)}_getBasicClassPrefix(){return La}static jQueryInterface(t){return this.each(function(){const e=ge.getOrCreateInstance(this,t);if(typeof t=="string"){if(typeof e[t]>"u")throw new TypeError(`No method named "${t}"`);e[t]()}})}}const mi="scrollspy",Ei=".twe.scrollspy",nn={offset:10,method:"auto",target:""},Pa={offset:"number",method:"string",target:"(string|element)"},Ma={active:"!text-primary font-semibold border-s-[0.125rem] border-solid border-primary"},Ha={active:"string"},vi=`activate${Ei}`,Va=`scroll${Ei}`,Zt="data-twe-nav-link-active",rn="data-twe-collapsible-scrollspy-ref",on="[data-twe-dropdown-item-ref]",Wa="[data-twe-nav-list-ref]",bi="[data-twe-nav-link-ref]",Ba="[data-twe-nav-item-ref]",an="[data-twe-list-group-item-ref]",wi=`${bi}, ${an}, ${on}`,ja="[data-twe-dropdown-ref]",Ua="[data-twe-dropdown-toggle-ref]",ln=`[${rn}]`,Ya=`[${Zt}]`,Ti="ul",Ka="maxOffset",cn="position";class me extends et{constructor(t,e,s){super(t),this._scrollElement=this._element.tagName==="BODY"?window:this._element,this._config=this._getConfig(e),this._classes=this._getClasses(s),this._offsets=[],this._targets=[],this._collapsibles=[],this._activeTarget=null,this._scrollHeight=0,d.on(this._scrollElement,Va,()=>this._process()),this.refresh(),this._process(),this._bindActivateEvent(),this._getCollapsibles(),this._collapsibles.length!==0&&(this._showSubsection(),this._hideSubsection())}static get Default(){return nn}static get NAME(){return mi}refresh(){const t=this._scrollElement===this._scrollElement.window?Ka:cn,e=this._config.method==="auto"?t:this._config.method,s=e===cn?this._getScrollTop():0;this._offsets=[],this._targets=[],this._scrollHeight=this._getScrollHeight(),h.find(wi,this._config.target).map(r=>{const o=Re(r),a=o?h.findOne(o):null;if(a){const l=a.getBoundingClientRect();if(l.width||l.height)return[E[e](a).top+s,o]}return null}).filter(r=>r).sort((r,o)=>r[0]-o[0]).forEach(r=>{this._offsets.push(r[0]),this._targets.push(r[1])})}dispose(){d.off(this._scrollElement,Ei),d.off(this._scrollElement,vi),super.dispose()}_getConfig(t){return t={...nn,...E.getDataAttributes(this._element),...typeof t=="object"&&t?t:{}},t.target=nt(t.target)||document.documentElement,x(mi,t,Pa),t}_getClasses(t){const e=E.getDataClassAttributes(this._element);return t={...Ma,...e,...t},x(mi,t,Ha),t}_getScrollTop(){return this._scrollElement===window?this._scrollElement.pageYOffset:this._scrollElement.scrollTop}_getScrollHeight(){return this._scrollElement.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}_getOffsetHeight(){return this._scrollElement===window?window.innerHeight:this._scrollElement.getBoundingClientRect().height}_process(){const t=this._getScrollTop()+this._config.offset,e=this._getScrollHeight(),s=this._config.offset+e-this._getOffsetHeight();if(this._scrollHeight!==e&&this.refresh(),t>=s){const n=this._targets[this._targets.length-1];this._activeTarget!==n&&this._activate(n);return}if(this._activeTarget&&t<this._offsets[0]&&this._offsets[0]>0){this._activeTarget=null,this._clear();return}for(let n=this._offsets.length;n--;)this._activeTarget!==this._targets[n]&&t>=this._offsets[n]&&(typeof this._offsets[n+1]>"u"||t<this._offsets[n+1])&&this._activate(this._targets[n])}_activate(t){this._activeTarget=t,this._clear();const e=wi.split(",").map(n=>`${n}[data-t
|
||
|
`)});function O(m,p,_,b){var w=_?"":b.media?"@media ".concat(b.media," {").concat(b.css,"}"):b.css;if(m.styleSheet)m.styleSheet.cssText=g(p,w);else{var C=document.createTextNode(w),A=m.childNodes;A[p]&&m.removeChild(A[p]),A.length?m.insertBefore(C,A[p]):m.appendChild(C)}}function T(m,p,_){var b=_.css,w=_.media,C=_.sourceMap;if(w?m.setAttribute("media",w):m.removeAttribute("media"),C&&typeof btoa<"u"&&(b+=`
|
||
|
/*# sourceMappingURL=data:application/json;base64,`.concat(btoa(unescape(encodeURIComponent(JSON.stringify(C))))," */")),m.styleSheet)m.styleSheet.cssText=b;else{for(;m.firstChild;)m.removeChild(m.firstChild);m.appendChild(document.createTextNode(b))}}var y=null,D=0;function I(m,p){var _,b,w;if(p.singleton){var C=D++;_=y||(y=f(p)),b=O.bind(null,_,C,!1),w=O.bind(null,_,C,!0)}else _=f(p),b=T.bind(null,_,p),w=function(){(function(A){if(A.parentNode===null)return!1;A.parentNode.removeChild(A)})(_)};return b(m),function(A){if(A){if(A.css===m.css&&A.media===m.media&&A.sourceMap===m.sourceMap)return;b(m=A)}else w()}}s.exports=function(m,p){(p=p||{}).singleton||typeof p.singleton=="boolean"||(p.singleton=(o===void 0&&(o=!!(window&&document&&document.all&&!window.atob)),o));var _=c(m=m||[],p);return function(b){if(b=b||[],Object.prototype.toString.call(b)==="[object Array]"){for(var w=0;w<_.length;w++){var C=u(_[w]);l[C].references--}for(var A=c(b,p),N=0;N<_.length;N++){var $=u(_[N]);l[$].references===0&&(l[$].updater(),l.splice($,1))}_=A}}}}},t={};function e(s){var n=t[s];if(n!==void 0)return n.exports;var r=t[s]={id:s,exports:{}};return i[s](r,r.exports,e),r.exports}e.n=s=>{var n=s&&s.__esModule?()=>s.default:()=>s;return e.d(n,{a:n}),n},e.d=(s,n)=>{for(var r in n)e.o(n,r)&&!e.o(s,r)&&Object.defineProperty(s,r,{enumerable:!0,get:n[r]})},e.o=(s,n)=>Object.prototype.hasOwnProperty.call(s,n),(()=>{var s=e(379),n=e.n(s),r=e(454);function o(l){if(!l.hasAttribute("autocompleted")){l.setAttribute("autocompleted","");var u=new window.CustomEvent("onautocomplete",{bubbles:!0,cancelable:!0,detail:null});l.dispatchEvent(u)||(l.value="")}}function a(l){l.hasAttribute("autocompleted")&&(l.removeAttribute("autocompleted"),l.dispatchEvent(new window.CustomEvent("onautocomplete",{bubbles:!0,cancelable:!1,detail:null})))}n()(r.Z,{insert:"head",singleton:!1}),r.Z.locals,e(810),document.addEventListener("animationstart",function(l){l.animationName==="onautofillstart"?o(l.target):a(l.target)},!0),document.addEventListener("input",function(l){l.inputType!=="insertReplacementText"&&"data"in l?a(l.target):o(l.target)},!0)})()})();const Ai="input",we="twe.input",fn="data-twe-input-wrapper-init",pn="data-twe-input-notch-ref",_n="data-twe-input-notch-leading-ref",gn="data-twe-input-notch-middle-ref",nl="data-twe-input-notch-trailing-ref",rl="data-twe-input-helper-ref",ol="data-twe-input-placeholder-active",at="data-twe-input-state-active",mn="data-twe-input-focused",En="data-twe-input-form-counter",Te=`[${fn}] input`,Ae=`[${fn}] textarea`,Vt=`[${pn}]`,vn=`[${_n}]`,bn=`[${gn}]`,al=`[${rl}]`,ll={inputFormWhite:!1},cl={inputFormWhite:"(boolean)"},dl={notch:"group flex absolute left-0 top-0 w-full max-w-full h-full text-left pointer-events-none",notchLeading:"pointer-events-none border border-solid box-border bg-transparent transition-all duration-200 ease-linear motion-reduce:transition-none left-0 top-0 h-full w-2 border-e-0 rounded-s-[0.25rem] group-data-[twe-input-focused]:border-e-0 group-data-[twe-input-state-active]:border-e-0",notchLeadingNormal:"border-secondary-500 dark:border-neutral-400 group-data-[twe-input-focused]:shadow-notch-1 group-data-[twe-input-focused]:border-primary",notchLeadingWhite:"border-neutral-200 group-data-[twe-input-focused]:shadow-notch-1 group-data-[twe-input-focused]:shadow-white group-data-[twe-input-focused]:border-white",notchMiddle:"pointer-events-none border border-solid box-border bg-transparent transition-all duration-200 ease-linear motion-reduce:transition-none grow-0 shrink-0 basis-auto w-auto max-w-[calc(100%-1rem)] h-full border-e-0 border-s-0 group-data-[twe-input-focused]:border-x-0 group-data-[twe-input-state-active]:border-x-0 group-data-[twe-input-focused]:border-t group-data-[twe-input-state-active]:border-t group-data-[twe-input-focused]:border-solid group-data-[twe-input-state-active]:border-solid group-data-[twe-input-focused]:border-t-transparent group-data-[twe-input-state-active]:border-t-transparent",notchMiddleNormal:"border-secondary-500 dark:border-neutral-400 group-data-[twe-input-focused]:sh
|
||
|
//# sourceMappingURL=tw-elements.umd.min.js.map
|