@material/tab-indicator
Version:
The Material Components for the web tab indicator component
1 lines • 9.87 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("@material/tab-indicator",[],e):"object"==typeof exports?exports["tab-indicator"]=e():(t.mdc=t.mdc||{},t.mdc["tab-indicator"]=e())}(this,function(){return o={},r.m=n={0:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MDCFoundation=void 0;var o=(Object.defineProperty(r,"cssClasses",{get:function(){return{}},enumerable:!1,configurable:!0}),Object.defineProperty(r,"strings",{get:function(){return{}},enumerable:!1,configurable:!0}),Object.defineProperty(r,"numbers",{get:function(){return{}},enumerable:!1,configurable:!0}),Object.defineProperty(r,"defaultAdapter",{get:function(){return{}},enumerable:!1,configurable:!0}),r.prototype.init=function(){},r.prototype.destroy=function(){},r);function r(t){void 0===t&&(t={}),this.adapter=t}e.MDCFoundation=o,e.default=o},1:function(t,e,n){"use strict";var r=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,r,i=n.call(t),a=[];try{for(;(void 0===e||0<e--)&&!(o=i.next()).done;)a.push(o.value)}catch(t){r={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return a},i=this&&this.__spreadArray||function(t,e){for(var n=0,o=e.length,r=t.length;n<o;n++,r++)t[r]=e[n];return t};Object.defineProperty(e,"__esModule",{value:!0}),e.MDCComponent=void 0;var o=n(0),a=(u.attachTo=function(t){return new u(t,new o.MDCFoundation({}))},u.prototype.initialize=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]},u.prototype.getDefaultFoundation=function(){throw new Error("Subclasses must override getDefaultFoundation to return a properly configured foundation class")},u.prototype.initialSyncWithDOM=function(){},u.prototype.destroy=function(){this.foundation.destroy()},u.prototype.listen=function(t,e,n){this.root.addEventListener(t,e,n)},u.prototype.unlisten=function(t,e,n){this.root.removeEventListener(t,e,n)},u.prototype.emit=function(t,e,n){var o;void 0===n&&(n=!1),"function"==typeof CustomEvent?o=new CustomEvent(t,{bubbles:n,detail:e}):(o=document.createEvent("CustomEvent")).initCustomEvent(t,n,!1,e),this.root.dispatchEvent(o)},u);function u(t,e){for(var n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];this.root=t,this.initialize.apply(this,i([],r(n))),this.foundation=void 0===e?this.getDefaultFoundation():e,this.foundation.init(),this.initialSyncWithDOM()}e.MDCComponent=a,e.default=a},12:function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.MDCTabIndicatorFoundation=void 0;var a,u=n(0),s=n(31),c=(a=u.MDCFoundation,r(l,a),Object.defineProperty(l,"cssClasses",{get:function(){return s.cssClasses},enumerable:!1,configurable:!0}),Object.defineProperty(l,"strings",{get:function(){return s.strings},enumerable:!1,configurable:!0}),Object.defineProperty(l,"defaultAdapter",{get:function(){return{addClass:function(){},removeClass:function(){},computeContentClientRect:function(){return{top:0,right:0,bottom:0,left:0,width:0,height:0}},setContentStyleProperty:function(){}}},enumerable:!1,configurable:!0}),l.prototype.computeContentClientRect=function(){return this.adapter.computeContentClientRect()},l);function l(t){return a.call(this,i(i({},l.defaultAdapter),t))||this}e.MDCTabIndicatorFoundation=c,e.default=c},251:function(t,e,n){"use strict";var o=this&&this.__createBinding||(Object.create?function(t,e,n,o){void 0===o&&(o=n),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,o){void 0===o&&(o=n),t[o]=e[n]}),r=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||o(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),r(n(252),e),r(n(39),e),r(n(31),e),r(n(12),e),r(n(30),e),r(n(32),e)},252:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},30:function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0}),e.MDCFadingTabIndicatorFoundation=void 0;var i,a=n(12),u=(i=a.MDCTabIndicatorFoundation,r(s,i),s.prototype.activate=function(){this.adapter.addClass(a.MDCTabIndicatorFoundation.cssClasses.ACTIVE)},s.prototype.deactivate=function(){this.adapter.removeClass(a.MDCTabIndicatorFoundation.cssClasses.ACTIVE)},s);function s(){return null!==i&&i.apply(this,arguments)||this}e.MDCFadingTabIndicatorFoundation=u,e.default=u},31:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.strings=e.cssClasses=void 0;e.cssClasses={ACTIVE:"mdc-tab-indicator--active",FADE:"mdc-tab-indicator--fade",NO_TRANSITION:"mdc-tab-indicator--no-transition"};e.strings={CONTENT_SELECTOR:".mdc-tab-indicator__content"}},32:function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0}),e.MDCSlidingTabIndicatorFoundation=void 0;var i,a=n(12),u=(i=a.MDCTabIndicatorFoundation,r(s,i),s.prototype.activate=function(t){if(t){var e=this.computeContentClientRect(),n=t.width/e.width,o=t.left-e.left;this.adapter.addClass(a.MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION),this.adapter.setContentStyleProperty("transform","translateX("+o+"px) scaleX("+n+")"),this.computeContentClientRect(),this.adapter.removeClass(a.MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION),this.adapter.addClass(a.MDCTabIndicatorFoundation.cssClasses.ACTIVE),this.adapter.setContentStyleProperty("transform","")}else this.adapter.addClass(a.MDCTabIndicatorFoundation.cssClasses.ACTIVE)},s.prototype.deactivate=function(){this.adapter.removeClass(a.MDCTabIndicatorFoundation.cssClasses.ACTIVE)},s);function s(){return null!==i&&i.apply(this,arguments)||this}e.MDCSlidingTabIndicatorFoundation=u,e.default=u},39:function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0}),e.MDCTabIndicator=void 0;var i,a=n(1),u=n(30),s=n(12),c=n(32),l=(i=a.MDCComponent,r(d,i),d.attachTo=function(t){return new d(t)},d.prototype.initialize=function(){this.content=this.root.querySelector(s.MDCTabIndicatorFoundation.strings.CONTENT_SELECTOR)},d.prototype.computeContentClientRect=function(){return this.foundation.computeContentClientRect()},d.prototype.getDefaultFoundation=function(){var n=this,t={addClass:function(t){return n.root.classList.add(t)},removeClass:function(t){return n.root.classList.remove(t)},computeContentClientRect:function(){return n.content.getBoundingClientRect()},setContentStyleProperty:function(t,e){n.content.style.setProperty(t,e)}};return this.root.classList.contains(s.MDCTabIndicatorFoundation.cssClasses.FADE)?new u.MDCFadingTabIndicatorFoundation(t):new c.MDCSlidingTabIndicatorFoundation(t)},d.prototype.activate=function(t){this.foundation.activate(t)},d.prototype.deactivate=function(){this.foundation.deactivate()},d);function d(){return null!==i&&i.apply(this,arguments)||this}e.MDCTabIndicator=l}},r.c=o,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=251);function r(t){if(o[t])return o[t].exports;var e=o[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,r),e.l=!0,e.exports}var n,o});