diff options
author | fat <fat@folders.local> | 2015-05-13 00:28:11 +0300 |
---|---|---|
committer | fat <fat@folders.local> | 2015-05-13 00:35:00 +0300 |
commit | a58febf71a5eac2161ce2db08c7d723755ed1163 (patch) | |
tree | 6c7356af40f579034ef6cc85976922a3de6ea457 /js | |
parent | 3452e8dc8336c7a4151bcccdb9d3d4202f06f294 (diff) |
popover passing as well
Diffstat (limited to 'js')
-rw-r--r-- | js/dist/popover.js | 189 | ||||
-rw-r--r-- | js/dist/popover.js.map | 1 | ||||
-rw-r--r-- | js/dist/scrollspy.js | 2 | ||||
-rw-r--r-- | js/dist/scrollspy.js.map | 2 | ||||
-rw-r--r-- | js/dist/tooltip.js | 221 | ||||
-rw-r--r-- | js/dist/tooltip.js.map | 2 | ||||
-rw-r--r-- | js/popover.js | 108 | ||||
-rw-r--r-- | js/src/popover.js | 178 | ||||
-rw-r--r-- | js/src/scrollspy.js | 2 | ||||
-rw-r--r-- | js/src/tooltip.js | 191 | ||||
-rw-r--r-- | js/tests/index.html | 10 | ||||
-rw-r--r-- | js/tests/unit/popover.js | 25 | ||||
-rw-r--r-- | js/tests/unit/tooltip.js | 16 | ||||
-rw-r--r-- | js/tests/visual/popover.html | 10 | ||||
-rw-r--r-- | js/tooltip.js | 514 |
15 files changed, 570 insertions, 901 deletions
diff --git a/js/dist/popover.js b/js/dist/popover.js new file mode 100644 index 0000000000..d6c3a3594a --- /dev/null +++ b/js/dist/popover.js @@ -0,0 +1,189 @@ +'use strict'; + +var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; } + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v4.0.0): popover.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * -------------------------------------------------------------------------- + */ + +var Popover = (function ($) { + + /** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + + var NAME = 'popover'; + var VERSION = '4.0.0'; + var DATA_KEY = 'bs.popover'; + var JQUERY_NO_CONFLICT = $.fn[NAME]; + + var Default = $.extend({}, Tooltip.Default, { + placement: 'right', + trigger: 'click', + content: '', + template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-title"></h3>' + '<div class="popover-content"></div></div>' + }); + + var ClassName = { + FADE: 'fade', + IN: 'in' + }; + + var Selector = { + TITLE: '.popover-title', + CONTENT: '.popover-content', + ARROW: '.popover-arrow' + }; + + var Event = { + HIDE: 'hide.bs.popover', + HIDDEN: 'hidden.bs.popover', + SHOW: 'show.bs.popover', + SHOWN: 'shown.bs.popover', + INSERTED: 'inserted.bs.popover', + CLICK: 'click.bs.popover', + FOCUSIN: 'focusin.bs.popover', + FOCUSOUT: 'focusout.bs.popover', + MOUSEENTER: 'mouseenter.bs.popover', + MOUSELEAVE: 'mouseleave.bs.popover' + }; + + /** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ + + var Popover = (function (_Tooltip) { + function Popover() { + _classCallCheck(this, Popover); + + if (_Tooltip != null) { + _Tooltip.apply(this, arguments); + } + } + + _inherits(Popover, _Tooltip); + + _createClass(Popover, [{ + key: 'isWithContent', + + // overrides + + value: function isWithContent() { + return this.getTitle() || this._getContent(); + } + }, { + key: 'getTipElement', + value: function getTipElement() { + return this.tip = this.tip || $(this.config['template'])[0]; + } + }, { + key: 'setContent', + value: function setContent() { + var tip = this.getTipElement(); + var title = this.getTitle(); + var content = this._getContent(); + var titleElement = $(tip).find(Selector.TITLE)[0]; + + if (titleElement) { + titleElement[this.config.html ? 'innerHTML' : 'innerText'] = title; + } + + // we use append for html objects to maintain js events + $(tip).find(Selector.CONTENT).children().detach().end()[this.config.html ? typeof content === 'string' ? 'html' : 'append' : 'text'](content); + + $(tip).removeClass(ClassName.FADE).removeClass(ClassName.IN); + + this.cleanupTether(); + } + }, { + key: '_getContent', + + // private + + value: function _getContent() { + return this.element.getAttribute('data-content') || (typeof this.config.content == 'function' ? this.config.content.call(this.element) : this.config.content); + } + }], [{ + key: 'VERSION', + + // getters + + get: function () { + return VERSION; + } + }, { + key: 'Default', + get: function () { + return Default; + } + }, { + key: 'NAME', + get: function () { + return NAME; + } + }, { + key: 'DATA_KEY', + get: function () { + return DATA_KEY; + } + }, { + key: 'Event', + get: function () { + return Event; + } + }, { + key: '_jQueryInterface', + + // static + + value: function _jQueryInterface(config) { + return this.each(function () { + var data = $(this).data(DATA_KEY); + var _config = typeof config === 'object' ? config : null; + + if (!data && /destroy|hide/.test(config)) { + return; + } + + if (!data) { + data = new Popover(this, _config); + $(this).data(DATA_KEY, data); + } + + if (typeof config === 'string') { + data[config](); + } + }); + } + }]); + + return Popover; + })(Tooltip); + + /** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + */ + + $.fn[NAME] = Popover._jQueryInterface; + $.fn[NAME].Constructor = Popover; + $.fn[NAME].noConflict = function () { + $.fn[NAME] = JQUERY_NO_CONFLICT; + return Popover._jQueryInterface; + }; + + return Popover; +})(jQuery); +//# sourceMappingURL=popover.js.map
\ No newline at end of file diff --git a/js/dist/popover.js.map b/js/dist/popover.js.map new file mode 100644 index 0000000000..c6865e239f --- /dev/null +++ b/js/dist/popover.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["js/src/popover.js"],"names":[],"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A;GAChC,CAAA;;AAED,SAAO,OAAO,CAAA;CAEf,CAAA,CAAE,MAAM,CAAC,CAAA","file":"js/src/popover.js","sourcesContent":["import Tooltip from './tooltip'\n\n\n/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.0.0): popover.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst Popover = (($) => {\n\n\n /**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\n const NAME = 'popover'\n const VERSION = '4.0.0'\n const DATA_KEY = 'bs.popover'\n const JQUERY_NO_CONFLICT = $.fn[NAME]\n\n const Default = $.extend({}, Tooltip.Default, {\n placement : 'right',\n trigger : 'click',\n content : '',\n template : '<div class=\"popover\" role=\"tooltip\">'\n + '<div class=\"popover-arrow\"></div>'\n + '<h3 class=\"popover-title\"></h3>'\n + '<div class=\"popover-content\"></div></div>'\n\t})\n\n const ClassName = {\n FADE : 'fade',\n IN : 'in'\n }\n\n const Selector = {\n TITLE : '.popover-title',\n CONTENT : '.popover-content',\n ARROW : '.popover-arrow'\n }\n\n const Event = {\n HIDE : 'hide.bs.popover',\n HIDDEN : 'hidden.bs.popover',\n SHOW : 'show.bs.popover',\n SHOWN : 'shown.bs.popover',\n INSERTED : 'inserted.bs.popover',\n CLICK : 'click.bs.popover',\n FOCUSIN : 'focusin.bs.popover',\n FOCUSOUT : 'focusout.bs.popover',\n MOUSEENTER : 'mouseenter.bs.popover',\n MOUSELEAVE : 'mouseleave.bs.popover'\n }\n\n\n /**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\n class Popover extends Tooltip {\n\n\n // getters\n\n static get VERSION() {\n return VERSION\n }\n\n static get Default() {\n return Default\n }\n\n static get NAME() {\n return NAME\n }\n\n static get DATA_KEY() {\n return DATA_KEY\n }\n\n static get Event() {\n return Event\n }\n\n\n // overrides\n\n isWithContent() {\n return this.getTitle() || this._getContent()\n }\n\n getTipElement() {\n return (this.tip = this.tip || $(this.config['template'])[0])\n }\n\n setContent() {\n let tip = this.getTipElement()\n let title = this.getTitle()\n let content = this._getContent()\n let titleElement = $(tip).find(Selector.TITLE)[0]\n\n if (titleElement) {\n titleElement[\n this.config.html ? 'innerHTML' : 'innerText'\n ] = title\n }\n\n // we use append for html objects to maintain js events\n $(tip).find(Selector.CONTENT).children().detach().end()[\n this.config.html ?\n (typeof content === 'string' ? 'html' : 'append') : 'text'\n ](content)\n\n $(tip)\n .removeClass(ClassName.FADE)\n .removeClass(ClassName.IN)\n\n this.cleanupTether()\n }\n\n // private\n\n _getContent() {\n return this.element.getAttribute('data-content')\n || (typeof this.config.content == 'function' ?\n this.config.content.call(this.element) :\n this.config.content)\n }\n\n\n // static\n\n static _jQueryInterface(config) {\n return this.each(function () {\n let data = $(this).data(DATA_KEY)\n let _config = typeof config === 'object' ? config : null\n\n if (!data && /destroy|hide/.test(config)) {\n return\n }\n\n if (!data) {\n data = new Popover(this, _config)\n $(this).data(DATA_KEY, data)\n }\n\n if (typeof config === 'string') {\n data[config]()\n }\n })\n }\n }\n\n\n /**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n */\n\n $.fn[NAME] = Popover._jQueryInterface\n $.fn[NAME].Constructor = Popover\n $.fn[NAME].noConflict = function () {\n $.fn[NAME] = JQUERY_NO_CONFLICT\n return Popover._jQueryInterface\n }\n\n return Popover\n\n})(jQuery)\n\nexport default Popover\n"]}
\ No newline at end of file diff --git a/js/dist/scrollspy.js b/js/dist/scrollspy.js index 6bcfe883cc..2c530b21b9 100644 --- a/js/dist/scrollspy.js +++ b/js/dist/scrollspy.js @@ -57,7 +57,7 @@ var ScrollSpy = (function ($) { _classCallCheck(this, ScrollSpy); this._scrollElement = element.tagName === 'BODY' ? window : element; - this._config = $.extend({}, Defaults, config); + this._config = $.extend({}, Default, config); this._selector = '' + (this._config.target || '') + ' .nav li > a'; this._offsets = []; this._targets = []; diff --git a/js/dist/scrollspy.js.map b/js/dist/scrollspy.js.map index cf1c3ce1a1..46c0410a0a 100644 --- a/js/dist/scrollspy.js.map +++ b/js/dist/scrollspy.js.map @@ -1 +1 @@ -{"version":3,"sources":["js/src/scrollspy.js"],"names":[],"mappings":";;;;;;;;;;;;;AAUA,IAAM,SAAS,GAAG,CAAC,UAAC,CAAC,EAAK;;;;;;;;AASxB,MAAM,IAAI,GAAiB,WAAW,CAAA;AACtC,MAAM,OAAO,GAAc,OAAO,CAAA;AAClC,MAAM,QAAQ,GAAa,cAAc,CAAA;AACzC,MAAM,kBAAkB,GAAG,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;;AAErC,MAAM,OAAO,GAAG;AACd,UAAM,EAAG,EAAE;GACZ,CAAA;;AAED,MAAM,KAAK,GAAG;AACZ,YAAQ,EAAG,uBAAuB;AAClC,UAAM,EAAK,qBAAqB;AAChC,QAAI,EAAO,4BAA4B;GACxC,CAAA;;AAED,MAAM,SAAS,GAAG;AAChB,iBAAa,EAAG,eAAe;AAC/B,UAAM,EAAU,QAAQ;GACzB,CAAA;;AAED,MAAM,QAAQ,GAAG;AACf,YAAQ,EAAM,qBAAqB;AACnC,UAAM,EAAQ,SAAS;AACvB,eAAW,EAAG,aAAa;AAC3B,MAAE,EAAY,IAAI;GACnB,CAAA;;;;;;;;MASK,SAAS;AAEF,aAFP,SAAS,CAED,OAAO,EAAE,MAAM,EAAE;4BAFzB,SAAS;;AAGX,UAAI,CAAC,cAAc,GAAG,OAAO,CAAC,OAAO,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AACnE,UAAI,CAAC,OAAO,GAAU,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;AACpD,UAAI,CAAC,SAAS,SAAW,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAA,iBAAc,CAAA;AAChE,UAAI,CAAC,QAAQ,GAAS,EAAE,CAAA;AACxB,UAAI,CAA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MAAM,CAAC,CAAA","file":"js/src/scrollspy.js","sourcesContent":["import Util from './util'\n\n\n/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.0.0): scrollspy.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst ScrollSpy = (($) => {\n\n\n /**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\n const NAME = 'scrollspy'\n const VERSION = '4.0.0'\n const DATA_KEY = 'bs.scrollspy'\n const JQUERY_NO_CONFLICT = $.fn[NAME]\n\n const Default = {\n offset : 10\n }\n\n const Event = {\n ACTIVATE : 'activate.bs.scrollspy',\n SCROLL : 'scroll.bs.scrollspy',\n LOAD : 'load.bs.scrollspy.data-api'\n }\n\n const ClassName = {\n DROPDOWN_MENU : 'dropdown-menu',\n ACTIVE : 'active'\n }\n\n const Selector = {\n DATA_SPY : '[data-spy=\"scroll\"]',\n ACTIVE : '.active',\n LI_DROPDOWN : 'li.dropdown',\n LI : 'li'\n }\n\n\n /**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\n class ScrollSpy {\n\n constructor(element, config) {\n this._scrollElement = element.tagName === 'BODY' ? window : element\n this._config = $.extend({}, Defaults, config)\n this._selector = `${this._config.target || ''} .nav li > a`\n this._offsets = []\n this._targets = []\n this._activeTarget = null\n this._scrollHeight = 0\n\n $(this._scrollElement).on(Event.SCROLL, this._process.bind(this))\n\n this.refresh()\n this._process()\n }\n\n\n // getters\n\n static get VERSION() {\n return VERSION\n }\n\n static get Default() {\n return Default\n }\n\n\n // public\n\n refresh() {\n let offsetMethod = 'offset'\n let offsetBase = 0\n\n if (this._scrollElement !== this._scrollElement.window) {\n offsetMethod = 'position'\n offsetBase = this._getScrollTop()\n }\n\n this._offsets = []\n this._targets = []\n\n this._scrollHeight = this._getScrollHeight()\n\n let targets = $.makeArray($(this._selector))\n\n targets\n .map((element) => {\n let target\n let targetSelector = Util.getSelectorFromElement(element)\n\n if (targetSelector) {\n target = $(targetSelector)[0]\n }\n\n if (target && (target.offsetWidth || target.offsetHeight)) {\n // todo (fat): remove sketch reliance on jQuery position/offset\n return [\n $(target)[offsetMethod]().top + offsetBase,\n targetSelector\n ]\n }\n })\n .filter((item) => item)\n .sort((a, b) => a[0] - b[0])\n .forEach((item) => {\n this._offsets.push(item[0])\n this._targets.push(item[1])\n })\n }\n\n\n // private\n\n _getScrollTop() {\n return this._scrollElement === window ?\n this._scrollElement.scrollY : this._scrollElement.scrollTop\n }\n\n _getScrollHeight() {\n return this._scrollElement.scrollHeight || Math.max(\n document.body.scrollHeight,\n document.documentElement.scrollHeight\n )\n }\n\n _process() {\n let scrollTop = this._getScrollTop() + this._config.offset\n let scrollHeight = this._getScrollHeight()\n let maxScroll = this._config.offset\n + scrollHeight\n - this._scrollElement.offsetHeight\n\n if (this._scrollHeight !== scrollHeight) {\n this.refresh()\n }\n\n if (scrollTop >= maxScroll) {\n let target = this._targets[this._targets.length - 1]\n\n if (this._activeTarget !== target) {\n this._activate(target)\n }\n }\n\n if (this._activeTarget && scrollTop < this._offsets[0]) {\n this._activeTarget = null\n this._clear()\n return\n }\n\n for (let i = this._offsets.length; i--;) {\n let isActiveTarget = this._activeTarget !== this._targets[i]\n && scrollTop >= this._offsets[i]\n && (this._offsets[i + 1] === undefined ||\n scrollTop < this._offsets[i + 1])\n\n if (isActiveTarget) {\n this._activate(this._targets[i])\n }\n }\n }\n\n _activate(target) {\n this._activeTarget = target\n\n this._clear()\n\n let selector =\n `${this._selector}[data-target=\"${target}\"],` +\n `${this._selector}[href=\"${target}\"]`\n\n // todo (fat): getting all the raw li's up the tree is not great.\n let parentListItems = $(selector).parents(Selector.LI)\n\n for (let i = parentListItems.length; i--;) {\n $(parentListItems[i]).addClass(ClassName.ACTIVE)\n\n let itemParent = parentListItems[i].parentNode\n\n if (itemParent && $(itemParent).hasClass(ClassName.DROPDOWN_MENU)) {\n let closestDropdown = $(itemParent)\n .closest(Selector.LI_DROPDOWN)[0]\n $(closestDropdown).addClass(ClassName.ACTIVE)\n }\n }\n\n $(this._scrollElement).trigger(Event.ACTIVATE, {\n relatedTarget: target\n })\n }\n\n _clear() {\n let activeParents = $(this._selector).parentsUntil(\n this._config.target,\n Selector.ACTIVE\n )\n\n for (let i = activeParents.length; i--;) {\n $(activeParents[i]).removeClass(ClassName.ACTIVE)\n }\n }\n\n\n // static\n\n static _jQueryInterface(config) {\n return this.each(function () {\n let data = $(this).data(DATA_KEY)\n let _config = typeof config === 'object' && config || null\n\n if (!data) {\n data = new ScrollSpy(this, _config)\n $(this).data(DATA_KEY, data)\n }\n\n if (typeof config === 'string') {\n data[config]()\n }\n })\n }\n\n\n }\n\n\n /**\n * ------------------------------------------------------------------------\n * Data Api implementation\n * ------------------------------------------------------------------------\n */\n\n $(window).on(Event.LOAD, function () {\n let scrollSpys = $.makeArray($(Selector.DATA_SPY))\n\n for (let i = scrollSpys.length; i--;) {\n let $spy = $(scrollSpys[i])\n ScrollSpy._jQueryInterface.call($spy, $spy.data())\n }\n })\n\n\n /**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n */\n\n $.fn[NAME] = ScrollSpy._jQueryInterface\n $.fn[NAME].Constructor = ScrollSpy\n $.fn[NAME].noConflict = function () {\n $.fn[NAME] = JQUERY_NO_CONFLICT\n return ScrollSpy._jQueryInterface\n }\n\n return ScrollSpy\n\n})(jQuery)\n\nexport default ScrollSpy\n"]}
\ No newline at end of file +{"version":3,"sources":["js/src/scrollspy.js"],"names":[],"mappings":";;;;;;;;;;;;;AAUA,IAAM,SAAS,GAAG,CAAC,UAAC,CAAC,EAAK;;;;;;;;AASxB,MAAM,IAAI,GAAiB,WAAW,CAAA;AACtC,MAAM,OAAO,GAAc,OAAO,CAAA;AAClC,MAAM,QAAQ,GAAa,cAAc,CAAA;AACzC,MAAM,kBAAkB,GAAG,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;;AAErC,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Mf,GAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,YAAY;AACnC,QAAI,UAAU,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAA;;AAElD,SAAK,IAAI,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,GAAG;AACpC,UAAI,IAAI,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;AAC3B,eAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;KACnD;GACF,CAAC,CAAA;;;;;;;;AASF,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAe,SAAS,CAAC,gBAAgB,CAAA;AACnD,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,GAAG,SAAS,CAAA;AAClC,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,GAAI,YAAY;AACnC,KAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAA;AAC/B,WAAO,SAAS,CAAC,gBAAgB,CAAA;GAClC,CAAA;;AAED,SAAO,SAAS,CAAA;CAEjB,CAAA,CAAE,MAAM,CAAC,CAAA","file":"js/src/scrollspy.js","sourcesContent":["import Util from './util'\n\n\n/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.0.0): scrollspy.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst ScrollSpy = (($) => {\n\n\n /**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\n const NAME = 'scrollspy'\n const VERSION = '4.0.0'\n const DATA_KEY = 'bs.scrollspy'\n const JQUERY_NO_CONFLICT = $.fn[NAME]\n\n const Default = {\n offset : 10\n }\n\n const Event = {\n ACTIVATE : 'activate.bs.scrollspy',\n SCROLL : 'scroll.bs.scrollspy',\n LOAD : 'load.bs.scrollspy.data-api'\n }\n\n const ClassName = {\n DROPDOWN_MENU : 'dropdown-menu',\n ACTIVE : 'active'\n }\n\n const Selector = {\n DATA_SPY : '[data-spy=\"scroll\"]',\n ACTIVE : '.active',\n LI_DROPDOWN : 'li.dropdown',\n LI : 'li'\n }\n\n\n /**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\n class ScrollSpy {\n\n constructor(element, config) {\n this._scrollElement = element.tagName === 'BODY' ? window : element\n this._config = $.extend({}, Default, config)\n this._selector = `${this._config.target || ''} .nav li > a`\n this._offsets = []\n this._targets = []\n this._activeTarget = null\n this._scrollHeight = 0\n\n $(this._scrollElement).on(Event.SCROLL, this._process.bind(this))\n\n this.refresh()\n this._process()\n }\n\n\n // getters\n\n static get VERSION() {\n return VERSION\n }\n\n static get Default() {\n return Default\n }\n\n\n // public\n\n refresh() {\n let offsetMethod = 'offset'\n let offsetBase = 0\n\n if (this._scrollElement !== this._scrollElement.window) {\n offsetMethod = 'position'\n offsetBase = this._getScrollTop()\n }\n\n this._offsets = []\n this._targets = []\n\n this._scrollHeight = this._getScrollHeight()\n\n let targets = $.makeArray($(this._selector))\n\n targets\n .map((element) => {\n let target\n let targetSelector = Util.getSelectorFromElement(element)\n\n if (targetSelector) {\n target = $(targetSelector)[0]\n }\n\n if (target && (target.offsetWidth || target.offsetHeight)) {\n // todo (fat): remove sketch reliance on jQuery position/offset\n return [\n $(target)[offsetMethod]().top + offsetBase,\n targetSelector\n ]\n }\n })\n .filter((item) => item)\n .sort((a, b) => a[0] - b[0])\n .forEach((item) => {\n this._offsets.push(item[0])\n this._targets.push(item[1])\n })\n }\n\n\n // private\n\n _getScrollTop() {\n return this._scrollElement === window ?\n this._scrollElement.scrollY : this._scrollElement.scrollTop\n }\n\n _getScrollHeight() {\n return this._scrollElement.scrollHeight || Math.max(\n document.body.scrollHeight,\n document.documentElement.scrollHeight\n )\n }\n\n _process() {\n let scrollTop = this._getScrollTop() + this._config.offset\n let scrollHeight = this._getScrollHeight()\n let maxScroll = this._config.offset\n + scrollHeight\n - this._scrollElement.offsetHeight\n\n if (this._scrollHeight !== scrollHeight) {\n this.refresh()\n }\n\n if (scrollTop >= maxScroll) {\n let target = this._targets[this._targets.length - 1]\n\n if (this._activeTarget !== target) {\n this._activate(target)\n }\n }\n\n if (this._activeTarget && scrollTop < this._offsets[0]) {\n this._activeTarget = null\n this._clear()\n return\n }\n\n for (let i = this._offsets.length; i--;) {\n let isActiveTarget = this._activeTarget !== this._targets[i]\n && scrollTop >= this._offsets[i]\n && (this._offsets[i + 1] === undefined ||\n scrollTop < this._offsets[i + 1])\n\n if (isActiveTarget) {\n this._activate(this._targets[i])\n }\n }\n }\n\n _activate(target) {\n this._activeTarget = target\n\n this._clear()\n\n let selector =\n `${this._selector}[data-target=\"${target}\"],` +\n `${this._selector}[href=\"${target}\"]`\n\n // todo (fat): getting all the raw li's up the tree is not great.\n let parentListItems = $(selector).parents(Selector.LI)\n\n for (let i = parentListItems.length; i--;) {\n $(parentListItems[i]).addClass(ClassName.ACTIVE)\n\n let itemParent = parentListItems[i].parentNode\n\n if (itemParent && $(itemParent).hasClass(ClassName.DROPDOWN_MENU)) {\n let closestDropdown = $(itemParent)\n .closest(Selector.LI_DROPDOWN)[0]\n $(closestDropdown).addClass(ClassName.ACTIVE)\n }\n }\n\n $(this._scrollElement).trigger(Event.ACTIVATE, {\n relatedTarget: target\n })\n }\n\n _clear() {\n let activeParents = $(this._selector).parentsUntil(\n this._config.target,\n Selector.ACTIVE\n )\n\n for (let i = activeParents.length; i--;) {\n $(activeParents[i]).removeClass(ClassName.ACTIVE)\n }\n }\n\n\n // static\n\n static _jQueryInterface(config) {\n return this.each(function () {\n let data = $(this).data(DATA_KEY)\n let _config = typeof config === 'object' && config || null\n\n if (!data) {\n data = new ScrollSpy(this, _config)\n $(this).data(DATA_KEY, data)\n }\n\n if (typeof config === 'string') {\n data[config]()\n }\n })\n }\n\n\n }\n\n\n /**\n * ------------------------------------------------------------------------\n * Data Api implementation\n * ------------------------------------------------------------------------\n */\n\n $(window).on(Event.LOAD, function () {\n let scrollSpys = $.makeArray($(Selector.DATA_SPY))\n\n for (let i = scrollSpys.length; i--;) {\n let $spy = $(scrollSpys[i])\n ScrollSpy._jQueryInterface.call($spy, $spy.data())\n }\n })\n\n\n /**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n */\n\n $.fn[NAME] = ScrollSpy._jQueryInterface\n $.fn[NAME].Constructor = ScrollSpy\n $.fn[NAME].noConflict = function () {\n $.fn[NAME] = JQUERY_NO_CONFLICT\n return ScrollSpy._jQueryInterface\n }\n\n return ScrollSpy\n\n})(jQuery)\n\nexport default ScrollSpy\n"]}
\ No newline at end of file diff --git a/js/dist/tooltip.js b/js/dist/tooltip.js index 0ff622018d..5e9fffcd62 100644 --- a/js/dist/tooltip.js +++ b/js/dist/tooltip.js @@ -6,12 +6,12 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons /** * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0): alert.js + * Bootstrap (v4.0.0): tooltip.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ -var ToolTip = (function ($) { +var Tooltip = (function ($) { /** * ------------------------------------------------------------------------ @@ -34,33 +34,16 @@ var ToolTip = (function ($) { delay: 0, html: false, selector: false, - attachment: 'top', + placement: 'top', offset: '0 0', constraints: null }; - var HorizontalMirror = { - LEFT: 'right', - CENTER: 'center', - RIGHT: 'left' - }; - - var VerticalMirror = { - TOP: 'bottom', - MIDDLE: 'middle', - BOTTOM: 'top' - }; - - var VerticalDefault = { - LEFT: 'middle', - CENTER: 'bottom', - RIGHT: 'middle' - }; - - var HorizontalDefault = { - TOP: 'center', - MIDDLE: 'left', - BOTTOM: 'center' + var AttachmentMap = { + TOP: 'bottom center', + RIGHT: 'middle left', + BOTTOM: 'top center', + LEFT: 'middle right' }; var HoverState = { @@ -88,13 +71,18 @@ var ToolTip = (function ($) { var Selector = { TOOLTIP: '.tooltip', - TOOLTIP_INNER: '.tooltip-inner', - TOOLTIP_ARROW: '.tooltip-arrow' - }; + TOOLTIP_INNER: '.tooltip-inner' }; var TetherClass = { - 'element': false, - 'enabled': false + element: false, + enabled: false + }; + + var Trigger = { + HOVER: 'hover', + FOCUS: 'focus', + CLICK: 'click', + MANUAL: 'manual' }; /** @@ -112,12 +100,12 @@ var ToolTip = (function ($) { this._timeout = 0; this._hoverState = ''; this._activeTrigger = {}; + this._tether = null; // protected this.element = element; this.config = this._getConfig(config); this.tip = null; - this.tether = null; this._setListeners(); } @@ -144,13 +132,14 @@ var ToolTip = (function ($) { key: 'toggle', value: function toggle(event) { var context = this; + var dataKey = this.constructor.DATA_KEY; if (event) { - context = $(event.currentTarget).data(DATA_KEY); + context = $(event.currentTarget).data(dataKey); if (!context) { context = new this.constructor(event.currentTarget, this._getDelegateConfig()); - $(event.currentTarget).data(DATA_KEY, context); + $(event.currentTarget).data(dataKey, context); } context._activeTrigger.click = !context._activeTrigger.click; @@ -171,7 +160,13 @@ var ToolTip = (function ($) { clearTimeout(this._timeout); this.hide(function () { - $(_this.element).off(Selector.TOOLTIP).removeData(DATA_KEY); + $(_this.element).off('.' + _this.constructor.NAME).removeData(_this.constructor.DATA_KEY); + + if (_this.tip) { + $(_this.tip).detach(); + } + + _this.tip = null; }); } }, { @@ -179,7 +174,7 @@ var ToolTip = (function ($) { value: function show() { var _this2 = this; - var showEvent = $.Event(Event.SHOW); + var showEvent = $.Event(this.constructor.Event.SHOW); if (this.isWithContent() && this._isEnabled) { $(this.element).trigger(showEvent); @@ -191,7 +186,7 @@ var ToolTip = (function ($) { } var tip = this.getTipElement(); - var tipId = Util.getUID(NAME); + var tipId = Util.getUID(this.constructor.NAME); tip.setAttribute('id', tipId); this.element.setAttribute('aria-describedby', tipId); @@ -202,17 +197,16 @@ var ToolTip = (function ($) { $(tip).addClass(ClassName.FADE); } - var attachment = typeof this.config.attachment === 'function' ? this.config.attachment.call(this, tip, this.element) : this.config.attachment; + var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement; - attachment = this.getAttachment(attachment); + var attachment = this._getAttachment(placement); - $(tip).data(DATA_KEY, this); + $(tip).data(this.constructor.DATA_KEY, this).appendTo(document.body); - this.element.parentNode.insertBefore(tip, this.element.nextSibling); - $(this.element).trigger(Event.INSERTED); + $(this.element).trigger(this.constructor.Event.INSERTED); - this.tether = new Tether({ - element: this.tip, + this._tether = new Tether({ + element: tip, target: this.element, attachment: attachment, classes: TetherClass, @@ -222,7 +216,7 @@ var ToolTip = (function ($) { }); Util.reflow(tip); - this.tether.position(); + this._tether.position(); $(tip).addClass(ClassName.IN); @@ -230,7 +224,7 @@ var ToolTip = (function ($) { var prevHoverState = _this2._hoverState; _this2._hoverState = null; - $(_this2.element).trigger(Event.SHOWN); + $(_this2.element).trigger(_this2.constructor.Event.SHOWN); if (prevHoverState === HoverState.OUT) { _this2._leave(null, _this2); @@ -246,14 +240,14 @@ var ToolTip = (function ($) { var _this3 = this; var tip = this.getTipElement(); - var hideEvent = $.Event(Event.HIDE); + var hideEvent = $.Event(this.constructor.Event.HIDE); var complete = function complete() { if (_this3._hoverState !== HoverState.IN && tip.parentNode) { tip.parentNode.removeChild(tip); } _this3.element.removeAttribute('aria-describedby'); - $(_this3.element).trigger(Event.HIDDEN); + $(_this3.element).trigger(_this3.constructor.Event.HIDDEN); _this3.cleanupTether(); if (callback) { @@ -292,63 +286,6 @@ var ToolTip = (function ($) { return this.tip = this.tip || $(this.config.template)[0]; } }, { - key: 'getAttachment', - value: function getAttachment(attachmentString) { - var attachmentArray = attachmentString.split(' '); - var normalizedAttachment = {}; - - if (!attachmentArray.length) { - throw new Error('Tooltip requires attachment'); - } - - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = attachmentArray[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var attachment = _step.value; - - attachment = attachment.toUpperCase(); - - if (HorizontalMirror[attachment]) { - normalizedAttachment.horizontal = HorizontalMirror[attachment]; - } - - if (VerticalMirror[attachment]) { - normalizedAttachment.vertical = VerticalMirror[attachment]; - } - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator['return']) { - _iterator['return'](); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - - if (!normalizedAttachment.horizontal && !normalizedAttachment.vertical) { - throw new Error('Tooltip requires valid attachment'); - } - - if (!normalizedAttachment.horizontal) { - normalizedAttachment.horizontal = HorizontalDefault[normalizedAttachment.vertical.toUpperCase()]; - } - - if (!normalizedAttachment.vertical) { - normalizedAttachment.vertical = VerticalDefault[normalizedAttachment.horizontal.toUpperCase()]; - } - - return [normalizedAttachment.vertical, normalizedAttachment.horizontal].join(' '); - } - }, { key: 'setContent', value: function setContent() { var tip = this.getTipElement(); @@ -373,28 +310,28 @@ var ToolTip = (function ($) { return title; } }, { - key: 'removeTetherClasses', - value: function removeTetherClasses(i, css) { - return ((css.baseVal || css).match(new RegExp('(^|\\s)' + CLASS_PREFIX + '-\\S+', 'g')) || []).join(' '); - } - }, { key: 'cleanupTether', value: function cleanupTether() { - if (this.tether) { - this.tether.destroy(); + if (this._tether) { + this._tether.destroy(); // clean up after tether's junk classes // remove after they fix issue // (https://github.com/HubSpot/tether/issues/36) - $(this.element).removeClass(this.removeTetherClasses); - $(this.tip).removeClass(this.removeTetherClasses); + $(this.element).removeClass(this._removeTetherClasses); + $(this.tip).removeClass(this._removeTetherClasses); } } }, { - key: '_setListeners', + key: '_getAttachment', // private + value: function _getAttachment(placement) { + return AttachmentMap[placement.toUpperCase()]; + } + }, { + key: '_setListeners', value: function _setListeners() { var _this4 = this; @@ -402,10 +339,10 @@ var ToolTip = (function ($) { triggers.forEach(function (trigger) { if (trigger === 'click') { - $(_this4.element).on(Event.CLICK, _this4.config.selector, _this4.toggle.bind(_this4)); - } else if (trigger !== 'manual') { - var eventIn = trigger == 'hover' ? Event.MOUSEENTER : Event.FOCUSIN; - var eventOut = trigger == 'hover' ? Event.MOUSELEAVE : Event.FOCUSOUT; + $(_this4.element).on(_this4.constructor.Event.CLICK, _this4.config.selector, _this4.toggle.bind(_this4)); + } else if (trigger !== Trigger.MANUAL) { + var eventIn = trigger == Trigger.HOVER ? _this4.constructor.Event.MOUSEENTER : _this4.constructor.Event.FOCUSIN; + var eventOut = trigger == Trigger.HOVER ? _this4.constructor.Event.MOUSELEAVE : _this4.constructor.Event.FOCUSOUT; $(_this4.element).on(eventIn, _this4.config.selector, _this4._enter.bind(_this4)).on(eventOut, _this4.config.selector, _this4._leave.bind(_this4)); } @@ -421,6 +358,11 @@ var ToolTip = (function ($) { } } }, { + key: '_removeTetherClasses', + value: function _removeTetherClasses(i, css) { + return ((css.baseVal || css).match(new RegExp('(^|\\s)' + CLASS_PREFIX + '-\\S+', 'g')) || []).join(' '); + } + }, { key: '_fixTitle', value: function _fixTitle() { var titleType = typeof this.element.getAttribute('data-original-title'); @@ -432,19 +374,21 @@ var ToolTip = (function ($) { }, { key: '_enter', value: function _enter(event, context) { - context = context || $(event.currentTarget).data(DATA_KEY); + var dataKey = this.constructor.DATA_KEY; + + context = context || $(event.currentTarget).data(dataKey); if (!context) { context = new this.constructor(event.currentTarget, this._getDelegateConfig()); - $(event.currentTarget).data(DATA_KEY, context); + $(event.currentTarget).data(dataKey, context); } if (event) { - context._activeTrigger[event.type == 'focusin' ? 'focus' : 'hover'] = true; + context._activeTrigger[event.type == 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true; } - if ($(context.getTipElement()).hasClass('in') || context._hoverState === 'in') { - context._hoverState = 'in'; + if ($(context.getTipElement()).hasClass(ClassName.IN) || context._hoverState === HoverState.IN) { + context._hoverState = HoverState.IN; return; } @@ -466,15 +410,17 @@ var ToolTip = (function ($) { }, { key: '_leave', value: function _leave(event, context) { - context = context || $(event.currentTarget).data(DATA_KEY); + var dataKey = this.constructor.DATA_KEY; + + context = context || $(event.currentTarget).data(dataKey); if (!context) { context = new this.constructor(event.currentTarget, this._getDelegateConfig()); - $(event.currentTarget).data(DATA_KEY, context); + $(event.currentTarget).data(dataKey, context); } if (event) { - context._activeTrigger[event.type == 'focusout' ? 'focus' : 'hover'] = false; + context._activeTrigger[event.type == 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false; } if (context._isWithActiveTrigger()) { @@ -510,12 +456,12 @@ var ToolTip = (function ($) { }, { key: '_getConfig', value: function _getConfig(config) { - config = $.extend({}, Default, $(this.element).data(), config); + config = $.extend({}, this.constructor.Default, $(this.element).data(), config); if (config.delay && typeof config.delay === 'number') { config.delay = { - 'show': config.delay, - 'hide': config.delay + show: config.delay, + hide: config.delay }; } @@ -529,7 +475,7 @@ var ToolTip = (function ($) { if (this.config) { for (var key in this.config) { var value = this.config[key]; - if (Default[key] !== value) { + if (this.constructor.Default[key] !== value) { config[key] = value; } } @@ -551,6 +497,21 @@ var ToolTip = (function ($) { return Default; } }, { + key: 'NAME', + get: function () { + return NAME; + } + }, { + key: 'DATA_KEY', + get: function () { + return DATA_KEY; + } + }, { + key: 'Event', + get: function () { + return Event; + } + }, { key: '_jQueryInterface', // static diff --git a/js/dist/tooltip.js.map b/js/dist/tooltip.js.map index b1ef80207a..089bef4ad9 100644 --- a/js/dist/tooltip.js.map +++ b/js/dist/tooltip.js.map @@ -1 +1 @@ -{"version":3,"sources":["js/src/tooltip.js"],"names":[],"mappings":";;;;;;;;;;;;;AAUA,IAAM,OAAO,GAAG,CAAC,UAAC,CAAC,EAAK;;;;;;;;AAStB,MAAM,IAAI,GAAkB,SAAS,CAAA;AACrC,MAAM,OAAO,GAAe,OAAO,CAAA;AACnC,MAAM,QAAQ,GAAc,YAAY,CAAA;AACxC,MAAM,kBAAkB,GAAI,CAAC,CAAC,EAAE,CAAC,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;OACf;;;WAEiB,YAAG;AACnB,eAAO,OAAO,CAAA;OACf;;;;;;aAmbsB,0BAAC,MAAM,EAAE;AAC9B,eAAO,IAAI,CAAC,IAAI,CAAC,YAAY;AAC3B,cAAI,IAAI,GAAK,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;AACnC,cAAI,OAAO,GAAG,OAAO,MAAM,KAAK,QAAQ,GACtC,MAAM,GAAG,IAAI,CAAA;;AAEf,cAAI,CAAC,IAAI,IAAI,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;AACxC,mBAAM;WACP;;AAED,cAAI,CAAC,IAAI,EAAE;AACT,gBAAI,GAAG,IAAI,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;AACjC,aAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;WAC7B;;AAED,cAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;AAC9B,gBAAI,CAAC,MAAM,CAAC,EAAE,CAAA;WACf;SACF,CAAC,CAAA;OACH;;;WAneG,OAAO;;;;;;;;;AA8eb,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAe,OAAO,CAAC,gBAAgB,CAAA;AACjD,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,GAAG,OAAO,CAAA;AAChC,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,GAAI,YAAY;AACnC,KAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAA;AAC/B,WAAO,OAAO,CAAC,gBAAgB,CAAA;GAChC,CAAA;;AAED,SAAO,OAAO,CAAA;CAEf,CAAA,CAAE,MAAM,CAAC,CAAA","file":"js/src/tooltip.js","sourcesContent":["import Util from './util'\n\n\n/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.0.0): alert.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst ToolTip = (($) => {\n\n\n /**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\n const NAME = 'tooltip'\n const VERSION = '4.0.0'\n const DATA_KEY = 'bs.tooltip'\n const JQUERY_NO_CONFLICT = $.fn[NAME]\n const TRANSITION_DURATION = 150\n const CLASS_PREFIX = 'bs-tether'\n\n const Default = {\n animation : true,\n template : '<div class=\"tooltip\" role=\"tooltip\">' +\n '<div class=\"tooltip-arrow\"></div>' +\n '<div class=\"tooltip-inner\"></div></div>',\n trigger : 'hover focus',\n title : '',\n delay : 0,\n html : false,\n selector : false,\n attachment : 'top',\n offset : '0 0',\n constraints : null\n }\n\n const HorizontalMirror = {\n LEFT : 'right',\n CENTER : 'center',\n RIGHT : 'left'\n }\n\n const VerticalMirror = {\n TOP : 'bottom',\n MIDDLE : 'middle',\n BOTTOM : 'top'\n }\n\n const VerticalDefault = {\n LEFT : 'middle',\n CENTER : 'bottom',\n RIGHT : 'middle'\n }\n\n const HorizontalDefault = {\n TOP : 'center',\n MIDDLE : 'left',\n BOTTOM : 'center'\n }\n\n const HoverState = {\n IN : 'in',\n OUT : 'out'\n }\n\n const Event = {\n HIDE : 'hide.bs.tooltip',\n HIDDEN : 'hidden.bs.tooltip',\n SHOW : 'show.bs.tooltip',\n SHOWN : 'shown.bs.tooltip',\n INSERTED : 'inserted.bs.tooltip',\n CLICK : 'click.bs.tooltip',\n FOCUSIN : 'focusin.bs.tooltip',\n FOCUSOUT : 'focusout.bs.tooltip',\n MOUSEENTER : 'mouseenter.bs.tooltip',\n MOUSELEAVE : 'mouseleave.bs.tooltip'\n }\n\n const ClassName = {\n FADE : 'fade',\n IN : 'in'\n }\n\n const Selector = {\n TOOLTIP : '.tooltip',\n TOOLTIP_INNER : '.tooltip-inner',\n TOOLTIP_ARROW : '.tooltip-arrow'\n }\n\n const TetherClass = {\n 'element' : false,\n 'enabled' : false\n }\n\n\n /**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\n class Tooltip {\n\n constructor(element, config) {\n\n // private\n this._isEnabled = true\n this._timeout = 0\n this._hoverState = ''\n this._activeTrigger = {}\n\n // protected\n this.element = element\n this.config = this._getConfig(config)\n this.tip = null\n this.tether = null\n\n this._setListeners()\n\n }\n\n\n // getters\n\n static get VERSION() {\n return VERSION\n }\n\n static get Default() {\n return Default\n }\n\n\n // public\n\n enable() {\n this._isEnabled = true\n }\n\n disable() {\n this._isEnabled = false\n }\n\n toggleEnabled() {\n this._isEnabled = !this._isEnabled\n }\n\n toggle(event) {\n let context = this\n\n if (event) {\n context = $(event.currentTarget).data(DATA_KEY)\n\n if (!context) {\n context = new this.constructor(\n event.currentTarget,\n this._getDelegateConfig()\n )\n $(event.currentTarget).data(DATA_KEY, context)\n }\n\n context._activeTrigger.click = !context._activeTrigger.click\n\n if (context._isWithActiveTrigger()) {\n context._enter(null, context)\n } else {\n context._leave(null, context)\n }\n\n } else {\n $(context.getTipElement()).hasClass(ClassName.IN) ?\n context._leave(null, context) :\n context._enter(null, context)\n }\n }\n\n destroy() {\n clearTimeout(this._timeout)\n this.hide(() => {\n $(this.element)\n .off(Selector.TOOLTIP)\n .removeData(DATA_KEY)\n })\n }\n\n show() {\n let showEvent = $.Event(Event.SHOW)\n\n if (this.isWithContent() && this._isEnabled) {\n $(this.element).trigger(showEvent)\n\n let isInTheDom = $.contains(\n this.element.ownerDocument.documentElement,\n this.element\n )\n\n if (showEvent.isDefaultPrevented() || !isInTheDom) {\n return\n }\n\n let tip = this.getTipElement()\n let tipId = Util.getUID(NAME)\n\n tip.setAttribute('id', tipId)\n this.element.setAttribute('aria-describedby', tipId)\n\n this.setContent()\n\n if (this.config.animation) {\n $(tip).addClass(ClassName.FADE)\n }\n\n let attachment = typeof this.config.attachment === 'function' ?\n this.config.attachment.call(this, tip, this.element) :\n this.config.attachment\n\n attachment = this.getAttachment(attachment)\n\n $(tip).data(DATA_KEY, this)\n\n this.element.parentNode.insertBefore(tip, this.element.nextSibling)\n $(this.element).trigger(Event.INSERTED)\n\n this.tether = new Tether({\n element : this.tip,\n target : this.element,\n attachment : attachment,\n classes : TetherClass,\n classPrefix : CLASS_PREFIX,\n offset : this.config.offset,\n constraints : this.config.constraints\n })\n\n Util.reflow(tip)\n this.tether.position()\n\n $(tip).addClass(ClassName.IN)\n\n let complete = () => {\n let prevHoverState = this._hoverState\n this._hoverState = null\n\n $(this.element).trigger(Event.SHOWN)\n\n if (prevHoverState === HoverState.OUT) {\n this._leave(null, this)\n }\n }\n\n Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE) ?\n $(this.tip)\n .one(Util.TRANSITION_END, complete)\n .emulateTransitionEnd(Tooltip._TRANSITION_DURATION) :\n complete()\n }\n }\n\n hide(callback) {\n let tip = this.getTipElement()\n let hideEvent = $.Event(Event.HIDE)\n let complete = () => {\n if (this._hoverState !== HoverState.IN && tip.parentNode) {\n tip.parentNode.removeChild(tip)\n }\n\n this.element.removeAttribute('aria-describedby')\n $(this.element).trigger(Event.HIDDEN)\n this.cleanupTether()\n\n if (callback) {\n callback()\n }\n }\n\n $(this.element).trigger(hideEvent)\n\n if (hideEvent.isDefaultPrevented()) {\n return\n }\n\n $(tip).removeClass(ClassName.IN)\n\n if (Util.supportsTransitionEnd() &&\n ($(this.tip).hasClass(ClassName.FADE))) {\n\n $(tip)\n .one(Util.TRANSITION_END, complete)\n .emulateTransitionEnd(TRANSITION_DURATION)\n\n } else {\n complete()\n }\n\n this._hoverState = ''\n }\n\n\n // protected\n\n isWithContent() {\n return !!this.getTitle()\n }\n\n getTipElement() {\n return (this.tip = this.tip || $(this.config.template)[0])\n }\n\n getAttachment(attachmentString) {\n let attachmentArray = attachmentString.split(' ')\n let normalizedAttachment = {}\n\n if (!attachmentArray.length) {\n throw new Error('Tooltip requires attachment')\n }\n\n for (let attachment of attachmentArray) {\n attachment = attachment.toUpperCase()\n\n if (HorizontalMirror[attachment]) {\n normalizedAttachment.horizontal = HorizontalMirror[attachment]\n }\n\n if (VerticalMirror[attachment]) {\n normalizedAttachment.vertical = VerticalMirror[attachment]\n }\n }\n\n if (!normalizedAttachment.horizontal &&\n (!normalizedAttachment.vertical)) {\n throw new Error('Tooltip requires valid attachment')\n }\n\n if (!normalizedAttachment.horizontal) {\n normalizedAttachment.horizontal =\n HorizontalDefault[normalizedAttachment.vertical.toUpperCase()]\n }\n\n if (!normalizedAttachment.vertical) {\n normalizedAttachment.vertical =\n VerticalDefault[normalizedAttachment.horizontal.toUpperCase()]\n }\n\n return [\n normalizedAttachment.vertical,\n normalizedAttachment.horizontal\n ].join(' ')\n }\n\n setContent() {\n let tip = this.getTipElement()\n let title = this.getTitle()\n let method = this.config.html ? 'innerHTML' : 'innerText'\n\n $(tip).find(Selector.TOOLTIP_INNER)[0][method] = title\n\n $(tip)\n .removeClass(ClassName.FADE)\n .removeClass(ClassName.IN)\n\n this.cleanupTether()\n }\n\n getTitle() {\n let title = this.element.getAttribute('data-original-title')\n\n if (!title) {\n title = typeof this.config.title === 'function' ?\n this.config.title.call(this.element) :\n this.config.title\n }\n\n return title\n }\n\n removeTetherClasses(i, css) {\n return ((css.baseVal || css).match(\n new RegExp(`(^|\\\\s)${CLASS_PREFIX}-\\\\S+`, 'g')) || []\n ).join(' ')\n }\n\n cleanupTether() {\n if (this.tether) {\n this.tether.destroy()\n\n // clean up after tether's junk classes\n // remove after they fix issue\n // (https://github.com/HubSpot/tether/issues/36)\n $(this.element).removeClass(this.removeTetherClasses)\n $(this.tip).removeClass(this.removeTetherClasses)\n }\n }\n\n\n // private\n\n _setListeners() {\n let triggers = this.config.trigger.split(' ')\n\n triggers.forEach((trigger) => {\n if (trigger === 'click') {\n $(this.element).on(\n Event.CLICK,\n this.config.selector,\n this.toggle.bind(this)\n )\n\n } else if (trigger !== 'manual') {\n let eventIn = trigger == 'hover' ?\n Event.MOUSEENTER : Event.FOCUSIN\n let eventOut = trigger == 'hover' ?\n Event.MOUSELEAVE : Event.FOCUSOUT\n\n $(this.element)\n .on(\n eventIn,\n this.config.selector,\n this._enter.bind(this)\n )\n .on(\n eventOut,\n this.config.selector,\n this._leave.bind(this)\n )\n }\n })\n\n if (this.config.selector) {\n this.config = $.extend({}, this.config, {\n trigger : 'manual',\n selector : ''\n })\n } else {\n this._fixTitle()\n }\n }\n\n _fixTitle() {\n let titleType = typeof this.element.getAttribute('data-original-title')\n if (this.element.getAttribute('title') ||\n (titleType !== 'string')) {\n this.element.setAttribute(\n 'data-original-title',\n this.element.getAttribute('title') || ''\n )\n this.element.setAttribute('title', '')\n }\n }\n\n _enter(event, context) {\n context = context || $(event.currentTarget).data(DATA_KEY)\n\n if (!context) {\n context = new this.constructor(\n event.currentTarget,\n this._getDelegateConfig()\n )\n $(event.currentTarget).data(DATA_KEY, context)\n }\n\n if (event) {\n context._activeTrigger[\n event.type == 'focusin' ? 'focus' : 'hover'\n ] = true\n }\n\n if ($(context.getTipElement()).hasClass('in') ||\n (context._hoverState === 'in')) {\n context._hoverState = 'in'\n return\n }\n\n clearTimeout(context._timeout)\n\n context._hoverState = HoverState.IN\n\n if (!context.config.delay || !context.config.delay.show) {\n context.show()\n return\n }\n\n context._timeout = setTimeout(() => {\n if (context._hoverState === HoverState.IN) {\n context.show()\n }\n }, context.config.delay.show)\n }\n\n _leave(event, context) {\n context = context || $(event.currentTarget).data(DATA_KEY)\n\n if (!context) {\n context = new this.constructor(\n event.currentTarget,\n this._getDelegateConfig()\n )\n $(event.currentTarget).data(DATA_KEY, context)\n }\n\n if (event) {\n context._activeTrigger[\n event.type == 'focusout' ? 'focus' : 'hover'\n ] = false\n }\n\n if (context._isWithActiveTrigger()) {\n return\n }\n\n clearTimeout(context._timeout)\n\n context._hoverState = HoverState.OUT\n\n if (!context.config.delay || !context.config.delay.hide) {\n context.hide()\n return\n }\n\n context._timeout = setTimeout(() => {\n if (context._hoverState === HoverState.OUT) {\n context.hide()\n }\n }, context.config.delay.hide)\n }\n\n _isWithActiveTrigger() {\n for (var trigger in this._activeTrigger) {\n if (this._activeTrigger[trigger]) {\n return true\n }\n }\n\n return false\n }\n\n _getConfig(config) {\n config = $.extend({}, Default, $(this.element).data(), config)\n\n if (config.delay && typeof config.delay === 'number') {\n config.delay = {\n 'show': config.delay,\n 'hide': config.delay\n }\n }\n\n return config\n }\n\n _getDelegateConfig() {\n let config = {}\n\n if (this.config) {\n for (let key in this.config) {\n let value = this.config[key]\n if (Default[key] !== value) {\n config[key] = value\n }\n }\n }\n\n return config\n }\n\n\n // static\n\n static _jQueryInterface(config) {\n return this.each(function () {\n let data = $(this).data(DATA_KEY)\n let _config = typeof config === 'object' ?\n config : null\n\n if (!data && /destroy|hide/.test(config)) {\n return\n }\n\n if (!data) {\n data = new Tooltip(this, _config)\n $(this).data(DATA_KEY, data)\n }\n\n if (typeof config === 'string') {\n data[config]()\n }\n })\n }\n\n }\n\n\n /**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n */\n\n $.fn[NAME] = Tooltip._jQueryInterface\n $.fn[NAME].Constructor = Tooltip\n $.fn[NAME].noConflict = function () {\n $.fn[NAME] = JQUERY_NO_CONFLICT\n return Tooltip._jQueryInterface\n }\n\n return Tooltip\n\n})(jQuery)\n\nexport default Tooltip\n"]}
\ No newline at end of file +{"version":3,"sources":["js/src/tooltip.js"],"names":[],"mappings":";;;;;;;;;;;;;AAUA,IAAM,OAAO,GAAG,CAAC,UAAC,CAAC,EAAK;;;;;;;;AAStB,MAAM,IAAI,GAAkB,SAAS,CAAA;AACrC,MAAM,OAAO,GAAe,OAAO,CAAA;AACnC,MAAM,QAAQ,GAAc,YAAY,CAAA;AACxC,MAAM,kBAAkB,GAAI,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;AACtC,MAAM,mBAAmB,GAAG,GAAG,CAAA;AAC/B,MAAM,YAAY,GAAU,WAAW,CAAA;;AAEvC,MAAM,OAAO,GAAG;AACd,aAAS,EAAK,IAAI;AAClB,YAAQ,EAAM,sC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AAC,MAAM,CAAC,EAAE,CAAA;WACf;SACF,CAAC,CAAA;OACH;;;WA9dG,OAAO;;;;;;;;;AAyeb,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAe,OAAO,CAAC,gBAAgB,CAAA;AACjD,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,GAAG,OAAO,CAAA;AAChC,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,GAAI,YAAY;AACnC,KAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAA;AAC/B,WAAO,OAAO,CAAC,gBAAgB,CAAA;GAChC,CAAA;;AAED,SAAO,OAAO,CAAA;CAEf,CAAA,CAAE,MAAM,CAAC,CAAA","file":"js/src/tooltip.js","sourcesContent":["import Util from './util'\n\n\n/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.0.0): tooltip.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst Tooltip = (($) => {\n\n\n /**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\n const NAME = 'tooltip'\n const VERSION = '4.0.0'\n const DATA_KEY = 'bs.tooltip'\n const JQUERY_NO_CONFLICT = $.fn[NAME]\n const TRANSITION_DURATION = 150\n const CLASS_PREFIX = 'bs-tether'\n\n const Default = {\n animation : true,\n template : '<div class=\"tooltip\" role=\"tooltip\">'\n + '<div class=\"tooltip-arrow\"></div>'\n + '<div class=\"tooltip-inner\"></div></div>',\n trigger : 'hover focus',\n title : '',\n delay : 0,\n html : false,\n selector : false,\n placement : 'top',\n offset : '0 0',\n constraints : null\n }\n\n const AttachmentMap = {\n TOP : 'bottom center',\n RIGHT : 'middle left',\n BOTTOM : 'top center',\n LEFT : 'middle right'\n }\n\n const HoverState = {\n IN : 'in',\n OUT : 'out'\n }\n\n const Event = {\n HIDE : 'hide.bs.tooltip',\n HIDDEN : 'hidden.bs.tooltip',\n SHOW : 'show.bs.tooltip',\n SHOWN : 'shown.bs.tooltip',\n INSERTED : 'inserted.bs.tooltip',\n CLICK : 'click.bs.tooltip',\n FOCUSIN : 'focusin.bs.tooltip',\n FOCUSOUT : 'focusout.bs.tooltip',\n MOUSEENTER : 'mouseenter.bs.tooltip',\n MOUSELEAVE : 'mouseleave.bs.tooltip'\n }\n\n const ClassName = {\n FADE : 'fade',\n IN : 'in'\n }\n\n const Selector = {\n TOOLTIP : '.tooltip',\n TOOLTIP_INNER : '.tooltip-inner',\n }\n\n const TetherClass = {\n element : false,\n enabled : false\n }\n\n const Trigger = {\n HOVER : 'hover',\n FOCUS : 'focus',\n CLICK : 'click',\n MANUAL : 'manual'\n }\n\n\n /**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\n class Tooltip {\n\n constructor(element, config) {\n\n // private\n this._isEnabled = true\n this._timeout = 0\n this._hoverState = ''\n this._activeTrigger = {}\n this._tether = null\n\n // protected\n this.element = element\n this.config = this._getConfig(config)\n this.tip = null\n\n this._setListeners()\n\n }\n\n\n // getters\n\n static get VERSION() {\n return VERSION\n }\n\n static get Default() {\n return Default\n }\n\n static get NAME() {\n return NAME\n }\n\n static get DATA_KEY() {\n return DATA_KEY\n }\n\n static get Event() {\n return Event\n }\n\n\n\n // public\n\n enable() {\n this._isEnabled = true\n }\n\n disable() {\n this._isEnabled = false\n }\n\n toggleEnabled() {\n this._isEnabled = !this._isEnabled\n }\n\n toggle(event) {\n let context = this\n let dataKey = this.constructor.DATA_KEY\n\n if (event) {\n context = $(event.currentTarget).data(dataKey)\n\n if (!context) {\n context = new this.constructor(\n event.currentTarget,\n this._getDelegateConfig()\n )\n $(event.currentTarget).data(dataKey, context)\n }\n\n context._activeTrigger.click = !context._activeTrigger.click\n\n if (context._isWithActiveTrigger()) {\n context._enter(null, context)\n } else {\n context._leave(null, context)\n }\n\n } else {\n $(context.getTipElement()).hasClass(ClassName.IN) ?\n context._leave(null, context) :\n context._enter(null, context)\n }\n }\n\n destroy() {\n clearTimeout(this._timeout)\n this.hide(() => {\n $(this.element)\n .off(`.${this.constructor.NAME}`)\n .removeData(this.constructor.DATA_KEY)\n\n if (this.tip) {\n $(this.tip).detach()\n }\n\n this.tip = null\n })\n }\n\n show() {\n let showEvent = $.Event(this.constructor.Event.SHOW)\n\n if (this.isWithContent() && this._isEnabled) {\n $(this.element).trigger(showEvent)\n\n let isInTheDom = $.contains(\n this.element.ownerDocument.documentElement,\n this.element\n )\n\n if (showEvent.isDefaultPrevented() || !isInTheDom) {\n return\n }\n\n let tip = this.getTipElement()\n let tipId = Util.getUID(this.constructor.NAME)\n\n tip.setAttribute('id', tipId)\n this.element.setAttribute('aria-describedby', tipId)\n\n this.setContent()\n\n if (this.config.animation) {\n $(tip).addClass(ClassName.FADE)\n }\n\n let placement = typeof this.config.placement === 'function' ?\n this.config.placement.call(this, tip, this.element) :\n this.config.placement\n\n let attachment = this._getAttachment(placement)\n\n $(tip)\n .data(this.constructor.DATA_KEY, this)\n .appendTo(document.body)\n\n $(this.element).trigger(this.constructor.Event.INSERTED)\n\n this._tether = new Tether({\n element : tip,\n target : this.element,\n attachment : attachment,\n classes : TetherClass,\n classPrefix : CLASS_PREFIX,\n offset : this.config.offset,\n constraints : this.config.constraints\n })\n\n Util.reflow(tip)\n this._tether.position()\n\n $(tip).addClass(ClassName.IN)\n\n let complete = () => {\n let prevHoverState = this._hoverState\n this._hoverState = null\n\n $(this.element).trigger(this.constructor.Event.SHOWN)\n\n if (prevHoverState === HoverState.OUT) {\n this._leave(null, this)\n }\n }\n\n Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE) ?\n $(this.tip)\n .one(Util.TRANSITION_END, complete)\n .emulateTransitionEnd(Tooltip._TRANSITION_DURATION) :\n complete()\n }\n }\n\n hide(callback) {\n let tip = this.getTipElement()\n let hideEvent = $.Event(this.constructor.Event.HIDE)\n let complete = () => {\n if (this._hoverState !== HoverState.IN && tip.parentNode) {\n tip.parentNode.removeChild(tip)\n }\n\n this.element.removeAttribute('aria-describedby')\n $(this.element).trigger(this.constructor.Event.HIDDEN)\n this.cleanupTether()\n\n if (callback) {\n callback()\n }\n }\n\n $(this.element).trigger(hideEvent)\n\n if (hideEvent.isDefaultPrevented()) {\n return\n }\n\n $(tip).removeClass(ClassName.IN)\n\n if (Util.supportsTransitionEnd() &&\n ($(this.tip).hasClass(ClassName.FADE))) {\n\n $(tip)\n .one(Util.TRANSITION_END, complete)\n .emulateTransitionEnd(TRANSITION_DURATION)\n\n } else {\n complete()\n }\n\n this._hoverState = ''\n }\n\n\n // protected\n\n isWithContent() {\n return !!this.getTitle()\n }\n\n getTipElement() {\n return (this.tip = this.tip || $(this.config.template)[0])\n }\n\n setContent() {\n let tip = this.getTipElement()\n let title = this.getTitle()\n let method = this.config.html ? 'innerHTML' : 'innerText'\n\n $(tip).find(Selector.TOOLTIP_INNER)[0][method] = title\n\n $(tip)\n .removeClass(ClassName.FADE)\n .removeClass(ClassName.IN)\n\n this.cleanupTether()\n }\n\n getTitle() {\n let title = this.element.getAttribute('data-original-title')\n\n if (!title) {\n title = typeof this.config.title === 'function' ?\n this.config.title.call(this.element) :\n this.config.title\n }\n\n return title\n }\n\n cleanupTether() {\n if (this._tether) {\n this._tether.destroy()\n\n // clean up after tether's junk classes\n // remove after they fix issue\n // (https://github.com/HubSpot/tether/issues/36)\n $(this.element).removeClass(this._removeTetherClasses)\n $(this.tip).removeClass(this._removeTetherClasses)\n }\n }\n\n\n // private\n\n _getAttachment(placement) {\n return AttachmentMap[placement.toUpperCase()]\n }\n\n _setListeners() {\n let triggers = this.config.trigger.split(' ')\n\n triggers.forEach((trigger) => {\n if (trigger === 'click') {\n $(this.element).on(\n this.constructor.Event.CLICK,\n this.config.selector,\n this.toggle.bind(this)\n )\n\n } else if (trigger !== Trigger.MANUAL) {\n let eventIn = trigger == Trigger.HOVER ?\n this.constructor.Event.MOUSEENTER :\n this.constructor.Event.FOCUSIN\n let eventOut = trigger == Trigger.HOVER ?\n this.constructor.Event.MOUSELEAVE :\n this.constructor.Event.FOCUSOUT\n\n $(this.element)\n .on(\n eventIn,\n this.config.selector,\n this._enter.bind(this)\n )\n .on(\n eventOut,\n this.config.selector,\n this._leave.bind(this)\n )\n }\n })\n\n if (this.config.selector) {\n this.config = $.extend({}, this.config, {\n trigger : 'manual',\n selector : ''\n })\n } else {\n this._fixTitle()\n }\n }\n\n _removeTetherClasses(i, css) {\n return ((css.baseVal || css).match(\n new RegExp(`(^|\\\\s)${CLASS_PREFIX}-\\\\S+`, 'g')) || []\n ).join(' ')\n }\n\n _fixTitle() {\n let titleType = typeof this.element.getAttribute('data-original-title')\n if (this.element.getAttribute('title') ||\n (titleType !== 'string')) {\n this.element.setAttribute(\n 'data-original-title',\n this.element.getAttribute('title') || ''\n )\n this.element.setAttribute('title', '')\n }\n }\n\n _enter(event, context) {\n let dataKey = this.constructor.DATA_KEY\n\n context = context || $(event.currentTarget).data(dataKey)\n\n if (!context) {\n context = new this.constructor(\n event.currentTarget,\n this._getDelegateConfig()\n )\n $(event.currentTarget).data(dataKey, context)\n }\n\n if (event) {\n context._activeTrigger[\n event.type == 'focusin' ? Trigger.FOCUS : Trigger.HOVER\n ] = true\n }\n\n if ($(context.getTipElement()).hasClass(ClassName.IN) ||\n (context._hoverState === HoverState.IN)) {\n context._hoverState = HoverState.IN\n return\n }\n\n clearTimeout(context._timeout)\n\n context._hoverState = HoverState.IN\n\n if (!context.config.delay || !context.config.delay.show) {\n context.show()\n return\n }\n\n context._timeout = setTimeout(() => {\n if (context._hoverState === HoverState.IN) {\n context.show()\n }\n }, context.config.delay.show)\n }\n\n _leave(event, context) {\n let dataKey = this.constructor.DATA_KEY\n\n context = context || $(event.currentTarget).data(dataKey)\n\n if (!context) {\n context = new this.constructor(\n event.currentTarget,\n this._getDelegateConfig()\n )\n $(event.currentTarget).data(dataKey, context)\n }\n\n if (event) {\n context._activeTrigger[\n event.type == 'focusout' ? Trigger.FOCUS : Trigger.HOVER\n ] = false\n }\n\n if (context._isWithActiveTrigger()) {\n return\n }\n\n clearTimeout(context._timeout)\n\n context._hoverState = HoverState.OUT\n\n if (!context.config.delay || !context.config.delay.hide) {\n context.hide()\n return\n }\n\n context._timeout = setTimeout(() => {\n if (context._hoverState === HoverState.OUT) {\n context.hide()\n }\n }, context.config.delay.hide)\n }\n\n _isWithActiveTrigger() {\n for (let trigger in this._activeTrigger) {\n if (this._activeTrigger[trigger]) {\n return true\n }\n }\n\n return false\n }\n\n _getConfig(config) {\n config = $.extend(\n {},\n this.constructor.Default,\n $(this.element).data(),\n config\n )\n\n if (config.delay && typeof config.delay === 'number') {\n config.delay = {\n show : config.delay,\n hide : config.delay\n }\n }\n\n return config\n }\n\n _getDelegateConfig() {\n let config = {}\n\n if (this.config) {\n for (let key in this.config) {\n let value = this.config[key]\n if (this.constructor.Default[key] !== value) {\n config[key] = value\n }\n }\n }\n\n return config\n }\n\n\n // static\n\n static _jQueryInterface(config) {\n return this.each(function () {\n let data = $(this).data(DATA_KEY)\n let _config = typeof config === 'object' ?\n config : null\n\n if (!data && /destroy|hide/.test(config)) {\n return\n }\n\n if (!data) {\n data = new Tooltip(this, _config)\n $(this).data(DATA_KEY, data)\n }\n\n if (typeof config === 'string') {\n data[config]()\n }\n })\n }\n\n }\n\n\n /**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n */\n\n $.fn[NAME] = Tooltip._jQueryInterface\n $.fn[NAME].Constructor = Tooltip\n $.fn[NAME].noConflict = function () {\n $.fn[NAME] = JQUERY_NO_CONFLICT\n return Tooltip._jQueryInterface\n }\n\n return Tooltip\n\n})(jQuery)\n\nexport default Tooltip\n"]}
\ No newline at end of file diff --git a/js/popover.js b/js/popover.js deleted file mode 100644 index 0b0755ee27..0000000000 --- a/js/popover.js +++ /dev/null @@ -1,108 +0,0 @@ -/* ======================================================================== - * Bootstrap: popover.js v3.3.4 - * http://getbootstrap.com/javascript/#popovers - * ======================================================================== - * Copyright 2011-2015 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // POPOVER PUBLIC CLASS DEFINITION - // =============================== - - var Popover = function (element, options) { - this.init('popover', element, options) - } - - if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js') - - Popover.VERSION = '3.3.4' - - Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, { - placement: 'right', - trigger: 'click', - content: '', - template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' - }) - - - // NOTE: POPOVER EXTENDS tooltip.js - // ================================ - - Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype) - - Popover.prototype.constructor = Popover - - Popover.prototype.getDefaults = function () { - return Popover.DEFAULTS - } - - Popover.prototype.setContent = function () { - var $tip = this.tip() - var title = this.getTitle() - var content = this.getContent() - - $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) - $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events - this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text' - ](content) - - $tip.removeClass('fade top bottom left right in') - - // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do - // this manually by checking the contents. - if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide() - } - - Popover.prototype.hasContent = function () { - return this.getTitle() || this.getContent() - } - - Popover.prototype.getContent = function () { - var $e = this.$element - var o = this.options - - return $e.attr('data-content') - || (typeof o.content == 'function' ? - o.content.call($e[0]) : - o.content) - } - - Popover.prototype.arrow = function () { - return (this.$arrow = this.$arrow || this.tip().find('.arrow')) - } - - - // POPOVER PLUGIN DEFINITION - // ========================= - - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.popover') - var options = typeof option == 'object' && option - - if (!data && /destroy|hide/.test(option)) return - if (!data) $this.data('bs.popover', (data = new Popover(this, options))) - if (typeof option == 'string') data[option]() - }) - } - - var old = $.fn.popover - - $.fn.popover = Plugin - $.fn.popover.Constructor = Popover - - - // POPOVER NO CONFLICT - // =================== - - $.fn.popover.noConflict = function () { - $.fn.popover = old - return this - } - -}(jQuery); diff --git a/js/src/popover.js b/js/src/popover.js new file mode 100644 index 0000000000..6b14a29835 --- /dev/null +++ b/js/src/popover.js @@ -0,0 +1,178 @@ +import Tooltip from './tooltip' + + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v4.0.0): popover.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * -------------------------------------------------------------------------- + */ + +const Popover = (($) => { + + + /** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + + const NAME = 'popover' + const VERSION = '4.0.0' + const DATA_KEY = 'bs.popover' + const JQUERY_NO_CONFLICT = $.fn[NAME] + + const Default = $.extend({}, Tooltip.Default, { + placement : 'right', + trigger : 'click', + content : '', + template : '<div class="popover" role="tooltip">' + + '<div class="popover-arrow"></div>' + + '<h3 class="popover-title"></h3>' + + '<div class="popover-content"></div></div>' + }) + + const ClassName = { + FADE : 'fade', + IN : 'in' + } + + const Selector = { + TITLE : '.popover-title', + CONTENT : '.popover-content', + ARROW : '.popover-arrow' + } + + const Event = { + HIDE : 'hide.bs.popover', + HIDDEN : 'hidden.bs.popover', + SHOW : 'show.bs.popover', + SHOWN : 'shown.bs.popover', + INSERTED : 'inserted.bs.popover', + CLICK : 'click.bs.popover', + FOCUSIN : 'focusin.bs.popover', + FOCUSOUT : 'focusout.bs.popover', + MOUSEENTER : 'mouseenter.bs.popover', + MOUSELEAVE : 'mouseleave.bs.popover' + } + + + /** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ + + class Popover extends Tooltip { + + + // getters + + static get VERSION() { + return VERSION + } + + static get Default() { + return Default + } + + static get NAME() { + return NAME + } + + static get DATA_KEY() { + return DATA_KEY + } + + static get Event() { + return Event + } + + + // overrides + + isWithContent() { + return this.getTitle() || this._getContent() + } + + getTipElement() { + return (this.tip = this.tip || $(this.config.template)[0]) + } + + setContent() { + let tip = this.getTipElement() + let title = this.getTitle() + let content = this._getContent() + let titleElement = $(tip).find(Selector.TITLE)[0] + + if (titleElement) { + titleElement[ + this.config.html ? 'innerHTML' : 'innerText' + ] = title + } + + // we use append for html objects to maintain js events + $(tip).find(Selector.CONTENT).children().detach().end()[ + this.config.html ? + (typeof content === 'string' ? 'html' : 'append') : 'text' + ](content) + + $(tip) + .removeClass(ClassName.FADE) + .removeClass(ClassName.IN) + + this.cleanupTether() + } + + // private + + _getContent() { + return this.element.getAttribute('data-content') + || (typeof this.config.content == 'function' ? + this.config.content.call(this.element) : + this.config.content) + } + + + // static + + static _jQueryInterface(config) { + return this.each(function () { + let data = $(this).data(DATA_KEY) + let _config = typeof config === 'object' ? config : null + + if (!data && /destroy|hide/.test(config)) { + return + } + + if (!data) { + data = new Popover(this, _config) + $(this).data(DATA_KEY, data) + } + + if (typeof config === 'string') { + data[config]() + } + }) + } + } + + + /** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + */ + + $.fn[NAME] = Popover._jQueryInterface + $.fn[NAME].Constructor = Popover + $.fn[NAME].noConflict = function () { + $.fn[NAME] = JQUERY_NO_CONFLICT + return Popover._jQueryInterface + } + + return Popover + +})(jQuery) + +export default Popover diff --git a/js/src/scrollspy.js b/js/src/scrollspy.js index 0ab8804c66..e41a3ae12c 100644 --- a/js/src/scrollspy.js +++ b/js/src/scrollspy.js @@ -55,7 +55,7 @@ const ScrollSpy = (($) => { constructor(element, config) { this._scrollElement = element.tagName === 'BODY' ? window : element - this._config = $.extend({}, Defaults, config) + this._config = $.extend({}, Default, config) this._selector = `${this._config.target || ''} .nav li > a` this._offsets = [] this._targets = [] diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 4c09a5bafd..a040851302 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -8,7 +8,7 @@ import Util from './util' * -------------------------------------------------------------------------- */ -const ToolTip = (($) => { +const Tooltip = (($) => { /** @@ -34,33 +34,16 @@ const ToolTip = (($) => { delay : 0, html : false, selector : false, - attachment : 'top', + placement : 'top', offset : '0 0', constraints : null } - const HorizontalMirror = { - LEFT : 'right', - CENTER : 'center', - RIGHT : 'left' - } - - const VerticalMirror = { - TOP : 'bottom', - MIDDLE : 'middle', - BOTTOM : 'top' - } - - const VerticalDefault = { - LEFT : 'middle', - CENTER : 'bottom', - RIGHT : 'middle' - } - - const HorizontalDefault = { - TOP : 'center', - MIDDLE : 'left', - BOTTOM : 'center' + const AttachmentMap = { + TOP : 'bottom center', + RIGHT : 'middle left', + BOTTOM : 'top center', + LEFT : 'middle right' } const HoverState = { @@ -88,8 +71,7 @@ const ToolTip = (($) => { const Selector = { TOOLTIP : '.tooltip', - TOOLTIP_INNER : '.tooltip-inner', - TOOLTIP_ARROW : '.tooltip-arrow' + TOOLTIP_INNER : '.tooltip-inner' } const TetherClass = { @@ -120,12 +102,12 @@ const ToolTip = (($) => { this._timeout = 0 this._hoverState = '' this._activeTrigger = {} + this._tether = null // protected this.element = element this.config = this._getConfig(config) this.tip = null - this.tether = null this._setListeners() @@ -142,6 +124,19 @@ const ToolTip = (($) => { return Default } + static get NAME() { + return NAME + } + + static get DATA_KEY() { + return DATA_KEY + } + + static get Event() { + return Event + } + + // public @@ -159,16 +154,17 @@ const ToolTip = (($) => { toggle(event) { let context = this + let dataKey = this.constructor.DATA_KEY if (event) { - context = $(event.currentTarget).data(DATA_KEY) + context = $(event.currentTarget).data(dataKey) if (!context) { context = new this.constructor( event.currentTarget, this._getDelegateConfig() ) - $(event.currentTarget).data(DATA_KEY, context) + $(event.currentTarget).data(dataKey, context) } context._activeTrigger.click = !context._activeTrigger.click @@ -190,13 +186,19 @@ const ToolTip = (($) => { clearTimeout(this._timeout) this.hide(() => { $(this.element) - .off(Selector.TOOLTIP) - .removeData(DATA_KEY) + .off(`.${this.constructor.NAME}`) + .removeData(this.constructor.DATA_KEY) + + if (this.tip) { + $(this.tip).detach() + } + + this.tip = null }) } show() { - let showEvent = $.Event(Event.SHOW) + let showEvent = $.Event(this.constructor.Event.SHOW) if (this.isWithContent() && this._isEnabled) { $(this.element).trigger(showEvent) @@ -211,7 +213,7 @@ const ToolTip = (($) => { } let tip = this.getTipElement() - let tipId = Util.getUID(NAME) + let tipId = Util.getUID(this.constructor.NAME) tip.setAttribute('id', tipId) this.element.setAttribute('aria-describedby', tipId) @@ -222,19 +224,20 @@ const ToolTip = (($) => { $(tip).addClass(ClassName.FADE) } - let attachment = typeof this.config.attachment === 'function' ? - this.config.attachment.call(this, tip, this.element) : - this.config.attachment + let placement = typeof this.config.placement === 'function' ? + this.config.placement.call(this, tip, this.element) : + this.config.placement - attachment = this.getAttachment(attachment) + let attachment = this._getAttachment(placement) - $(tip).data(DATA_KEY, this) + $(tip) + .data(this.constructor.DATA_KEY, this) + .appendTo(document.body) - this.element.parentNode.insertBefore(tip, this.element.nextSibling) - $(this.element).trigger(Event.INSERTED) + $(this.element).trigger(this.constructor.Event.INSERTED) - this.tether = new Tether({ - element : this.tip, + this._tether = new Tether({ + element : tip, target : this.element, attachment : attachment, classes : TetherClass, @@ -244,7 +247,7 @@ const ToolTip = (($) => { }) Util.reflow(tip) - this.tether.position() + this._tether.position() $(tip).addClass(ClassName.IN) @@ -252,7 +255,7 @@ const ToolTip = (($) => { let prevHoverState = this._hoverState this._hoverState = null - $(this.element).trigger(Event.SHOWN) + $(this.element).trigger(this.constructor.Event.SHOWN) if (prevHoverState === HoverState.OUT) { this._leave(null, this) @@ -269,14 +272,14 @@ const ToolTip = (($) => { hide(callback) { let tip = this.getTipElement() - let hideEvent = $.Event(Event.HIDE) + let hideEvent = $.Event(this.constructor.Event.HIDE) let complete = () => { if (this._hoverState !== HoverState.IN && tip.parentNode) { tip.parentNode.removeChild(tip) } this.element.removeAttribute('aria-describedby') - $(this.element).trigger(Event.HIDDEN) + $(this.element).trigger(this.constructor.Event.HIDDEN) this.cleanupTether() if (callback) { @@ -317,47 +320,6 @@ const ToolTip = (($) => { return (this.tip = this.tip || $(this.config.template)[0]) } - getAttachment(attachmentString) { - let attachmentArray = attachmentString.split(' ') - let normalizedAttachment = {} - - if (!attachmentArray.length) { - throw new Error('Tooltip requires attachment') - } - - for (let attachment of attachmentArray) { - attachment = attachment.toUpperCase() - - if (HorizontalMirror[attachment]) { - normalizedAttachment.horizontal = HorizontalMirror[attachment] - } - - if (VerticalMirror[attachment]) { - normalizedAttachment.vertical = VerticalMirror[attachment] - } - } - - if (!normalizedAttachment.horizontal && - (!normalizedAttachment.vertical)) { - throw new Error('Tooltip requires valid attachment') - } - - if (!normalizedAttachment.horizontal) { - normalizedAttachment.horizontal = - HorizontalDefault[normalizedAttachment.vertical.toUpperCase()] - } - - if (!normalizedAttachment.vertical) { - normalizedAttachment.vertical = - VerticalDefault[normalizedAttachment.horizontal.toUpperCase()] - } - - return [ - normalizedAttachment.vertical, - normalizedAttachment.horizontal - ].join(' ') - } - setContent() { let tip = this.getTipElement() let title = this.getTitle() @@ -384,43 +346,43 @@ const ToolTip = (($) => { return title } - removeTetherClasses(i, css) { - return ((css.baseVal || css).match( - new RegExp(`(^|\\s)${CLASS_PREFIX}-\\S+`, 'g')) || [] - ).join(' ') - } - cleanupTether() { - if (this.tether) { - this.tether.destroy() + if (this._tether) { + this._tether.destroy() // clean up after tether's junk classes // remove after they fix issue // (https://github.com/HubSpot/tether/issues/36) - $(this.element).removeClass(this.removeTetherClasses) - $(this.tip).removeClass(this.removeTetherClasses) + $(this.element).removeClass(this._removeTetherClasses) + $(this.tip).removeClass(this._removeTetherClasses) } } // private + _getAttachment(placement) { + return AttachmentMap[placement.toUpperCase()] + } + _setListeners() { let triggers = this.config.trigger.split(' ') triggers.forEach((trigger) => { if (trigger === 'click') { $(this.element).on( - Event.CLICK, + this.constructor.Event.CLICK, this.config.selector, this.toggle.bind(this) ) } else if (trigger !== Trigger.MANUAL) { let eventIn = trigger == Trigger.HOVER ? - Event.MOUSEENTER : Event.FOCUSIN + this.constructor.Event.MOUSEENTER : + this.constructor.Event.FOCUSIN let eventOut = trigger == Trigger.HOVER ? - Event.MOUSELEAVE : Event.FOCUSOUT + this.constructor.Event.MOUSELEAVE : + this.constructor.Event.FOCUSOUT $(this.element) .on( @@ -446,6 +408,12 @@ const ToolTip = (($) => { } } + _removeTetherClasses(i, css) { + return ((css.baseVal || css).match( + new RegExp(`(^|\\s)${CLASS_PREFIX}-\\S+`, 'g')) || [] + ).join(' ') + } + _fixTitle() { let titleType = typeof this.element.getAttribute('data-original-title') if (this.element.getAttribute('title') || @@ -459,14 +427,16 @@ const ToolTip = (($) => { } _enter(event, context) { - context = context || $(event.currentTarget).data(DATA_KEY) + let dataKey = this.constructor.DATA_KEY + + context = context || $(event.currentTarget).data(dataKey) if (!context) { context = new this.constructor( event.currentTarget, this._getDelegateConfig() ) - $(event.currentTarget).data(DATA_KEY, context) + $(event.currentTarget).data(dataKey, context) } if (event) { @@ -498,19 +468,21 @@ const ToolTip = (($) => { } _leave(event, context) { - context = context || $(event.currentTarget).data(DATA_KEY) + let dataKey = this.constructor.DATA_KEY + + context = context || $(event.currentTarget).data(dataKey) if (!context) { context = new this.constructor( event.currentTarget, this._getDelegateConfig() ) - $(event.currentTarget).data(DATA_KEY, context) + $(event.currentTarget).data(dataKey, context) } if (event) { context._activeTrigger[ - event.type == 'focusout' ? Triger.FOCUS : Trigger.HOVER + event.type == 'focusout' ? Trigger.FOCUS : Trigger.HOVER ] = false } @@ -545,7 +517,12 @@ const ToolTip = (($) => { } _getConfig(config) { - config = $.extend({}, Default, $(this.element).data(), config) + config = $.extend( + {}, + this.constructor.Default, + $(this.element).data(), + config + ) if (config.delay && typeof config.delay === 'number') { config.delay = { @@ -563,7 +540,7 @@ const ToolTip = (($) => { if (this.config) { for (let key in this.config) { let value = this.config[key] - if (Default[key] !== value) { + if (this.constructor.Default[key] !== value) { config[key] = value } } diff --git a/js/tests/index.html b/js/tests/index.html index 2491d8d865..0e2bdd012f 100644 --- a/js/tests/index.html +++ b/js/tests/index.html @@ -141,11 +141,9 @@ <script src="../../js/dist/scrollspy.js"></script> <script src="../../js/dist/tab.js"></script> <script src="../../js/dist/tooltip.js"></script> + <script src="../../js/dist/popover.js"></script> - <!-- Old Plugin sources --> - <!-- <script src="../../js/popover.js"></script> --> - - <!-- Unit tests + <!-- Unit tests --> <script src="unit/alert.js"></script> <script src="unit/button.js"></script> <script src="unit/carousel.js"></script> @@ -153,9 +151,9 @@ <script src="unit/dropdown.js"></script> <script src="unit/modal.js"></script> <script src="unit/scrollspy.js"></script> - <script src="unit/tab.js"></script> --> + <script src="unit/tab.js"></script> <script src="unit/tooltip.js"></script> - <!-- <script src="unit/popover.js"></script> --> + <script src="unit/popover.js"></script> </head> <body> diff --git a/js/tests/unit/popover.js b/js/tests/unit/popover.js index a25df3a58d..01c6a97cb5 100644 --- a/js/tests/unit/popover.js +++ b/js/tests/unit/popover.js @@ -16,6 +16,7 @@ $(function () { afterEach: function () { $.fn.popover = $.fn.bootstrapPopover delete $.fn.bootstrapPopover + $('.popover').remove() } }) @@ -81,6 +82,7 @@ $(function () { assert.strictEqual($('.popover .popover-content').text(), 'loves writing tests (╯°□°)╯︵ ┻━┻', 'content correctly inserted') $popover.bootstrapPopover('hide') + assert.strictEqual($('.popover').length, 0, 'popover was removed') }) @@ -91,6 +93,7 @@ $(function () { var $popover = $('<a href="#">@fat</a>') .appendTo('#qunit-fixture') .bootstrapPopover({ + html: true, content: function () { return $div } @@ -98,14 +101,14 @@ $(function () { $popover.bootstrapPopover('show') assert.notEqual($('.popover').length, 0, 'popover was inserted') - assert.equal($('.popover .popover-content').html(), $div, 'content correctly inserted') + assert.equal($('.popover .popover-content').html(), $div[0].outerHTML, 'content correctly inserted') $popover.bootstrapPopover('hide') assert.strictEqual($('.popover').length, 0, 'popover was removed') $popover.bootstrapPopover('show') assert.notEqual($('.popover').length, 0, 'popover was inserted') - assert.equal($('.popover .popover-content').html(), $div, 'content correctly inserted') + assert.equal($('.popover .popover-content').html(), $div[0].outerHTML, 'content correctly inserted') $popover.bootstrapPopover('hide') assert.strictEqual($('.popover').length, 0, 'popover was removed') @@ -126,7 +129,6 @@ $(function () { assert.strictEqual($('.popover').length, 0, 'popover was removed') }) - QUnit.test('should get title and content from attributes ignoring options passed via js', function (assert) { assert.expect(4) var $popover = $('<a href="#" title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>') @@ -240,13 +242,6 @@ $(function () { .bootstrapPopover('show') }) - QUnit.test('should throw an error when initializing popover on the document object without specifying a delegation selector', function (assert) { - assert.expect(1) - assert.throws(function () { - $(document).bootstrapPopover({ title: 'What am I on?', content: 'My selector is missing' }) - }, new Error('`selector` option must be specified when initializing popover on the window.document object!')) - }) - QUnit.test('should do nothing when an attempt is made to hide an uninitialized popover', function (assert) { assert.expect(1) @@ -259,16 +254,6 @@ $(function () { assert.strictEqual($popover.data('bs.popover'), undefined, 'should not initialize the popover') }) - QUnit.test('should throw an error when template contains multiple top-level elements', function (assert) { - assert.expect(1) - assert.throws(function () { - $('<span data-toggle="popover" data-title="some title" data-content="some content">some text</span>') - .appendTo('#qunit-fixture') - .bootstrapPopover({ template: '<div>Foo</div><div>Bar</div>' }) - .bootstrapPopover('show') - }, new Error('popover `template` option must consist of exactly 1 top-level element!')) - }) - QUnit.test('should fire inserted event', function (assert) { assert.expect(2) var done = assert.async() diff --git a/js/tests/unit/tooltip.js b/js/tests/unit/tooltip.js index 8f2cbc3e8e..f3df4d8287 100644 --- a/js/tests/unit/tooltip.js +++ b/js/tests/unit/tooltip.js @@ -89,11 +89,11 @@ $(function () { assert.strictEqual(id.indexOf('tooltip'), 0, 'tooltip id has prefix') }) - QUnit.test('should place tooltips relative to attachment option', function (assert) { + QUnit.test('should place tooltips relative to placement option', function (assert) { assert.expect(2) var $tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"/>') .appendTo('#qunit-fixture') - .bootstrapTooltip({ attachment: 'bottom' }) + .bootstrapTooltip({ placement: 'bottom' }) $tooltip.bootstrapTooltip('show') @@ -321,7 +321,7 @@ $(function () { var $target = $('<a href="#" rel="tooltip" title="very very very very very very very very long tooltip in one line"/>') .appendTo($container) .bootstrapTooltip({ - attachment: 'right', + placement: 'right', }) .bootstrapTooltip('show') @@ -389,7 +389,7 @@ $(function () { .one('show.bs.tooltip', function () { $(this).remove() }) - .bootstrapTooltip({ attachment: 'top' }) + .bootstrapTooltip({ placement: 'top' }) try { $tooltip.bootstrapTooltip('show') @@ -426,7 +426,7 @@ $(function () { .find('a') .css('margin-top', 200) .bootstrapTooltip({ - attachment: 'top', + placement: 'top', animate: false }) .bootstrapTooltip('show') @@ -609,7 +609,7 @@ $(function () { assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom') done() }) - .bootstrapTooltip({ attachment: 'top', trigger: 'manual' }) + .bootstrapTooltip({ placement: 'top', trigger: 'manual' }) $circle.bootstrapTooltip('show') }) @@ -621,7 +621,7 @@ $(function () { return '<p id="tt-content">' + uid + '</p><p>' + uid + '</p><p>' + uid + '</p>' } - var $tooltip = $('<span id="tt-outer" rel="tooltip" data-trigger="hover" data-attachment="top">some text</span>') + var $tooltip = $('<span id="tt-outer" rel="tooltip" data-trigger="hover" data-placement="top">some text</span>') .appendTo('#qunit-fixture') $tooltip.bootstrapTooltip({ @@ -649,7 +649,7 @@ $(function () { return '<p id="tt-content">' + uid + '</p><p>' + uid + '</p><p>' + uid + '</p>' } - var $tooltip = $('<span id="tt-outer" rel="tooltip" data-trigger="hover" data-attachment="top">some text</span>') + var $tooltip = $('<span id="tt-outer" rel="tooltip" data-trigger="hover" data-placement="top">some text</span>') .appendTo('#qunit-fixture') $tooltip.bootstrapTooltip({ diff --git a/js/tests/visual/popover.html b/js/tests/visual/popover.html index 0e84f5ceee..ac65572563 100644 --- a/js/tests/visual/popover.html +++ b/js/tests/visual/popover.html @@ -5,7 +5,7 @@ <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Popover</title> - <link rel="stylesheet" href="../../../dist/css/bootstrap.min.css"> + <link rel="stylesheet" href="../../../dist/css/bootstrap.css"> <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> @@ -39,9 +39,11 @@ <!-- JavaScript Includes --> <script src="../vendor/jquery.min.js"></script> -<script src="../../transition.js"></script> -<script src="../../tooltip.js"></script> -<script src="../../popover.js"></script> +<script src="../vendor/tether.min.js"></script> +<script src="../../dist/util.js"></script> +<script src="../../dist/tooltip.js"></script> +<script src="../../dist/popover.js"></script> + <!-- JavaScript Test --> <script> diff --git a/js/tooltip.js b/js/tooltip.js deleted file mode 100644 index 0779f139d6..0000000000 --- a/js/tooltip.js +++ /dev/null @@ -1,514 +0,0 @@ -/* ======================================================================== - * Bootstrap: tooltip.js v3.3.4 - * http://getbootstrap.com/javascript/#tooltip - * Inspired by the original jQuery.tipsy by Jason Frame - * ======================================================================== - * Copyright 2011-2015 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // TOOLTIP PUBLIC CLASS DEFINITION - // =============================== - - var Tooltip = function (element, options) { - this.type = null - this.options = null - this.enabled = null - this.timeout = null - this.hoverState = null - this.$element = null - this.inState = null - - this.init('tooltip', element, options) - } - - Tooltip.VERSION = '3.3.4' - - Tooltip.TRANSITION_DURATION = 150 - - Tooltip.DEFAULTS = { - animation: true, - placement: 'top', - selector: false, - template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>', - trigger: 'hover focus', - title: '', - delay: 0, - html: false, - container: false, - viewport: { - selector: 'body', - padding: 0 - } - } - - Tooltip.prototype.init = function (type, element, options) { - this.enabled = true - this.type = type - this.$element = $(element) - this.options = this.getOptions(options) - this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport)) - this.inState = { click: false, hover: false, focus: false } - - if (this.$element[0] instanceof document.constructor && !this.options.selector) { - throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!') - } - - var triggers = this.options.trigger.split(' ') - - for (var i = triggers.length; i--;) { - var trigger = triggers[i] - - if (trigger == 'click') { - this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) - } else if (trigger != 'manual') { - var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin' - var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout' - - this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) - this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) - } - } - - this.options.selector ? - (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : - this.fixTitle() - } - - Tooltip.prototype.getDefaults = function () { - return Tooltip.DEFAULTS - } - - Tooltip.prototype.getOptions = function (options) { - options = $.extend({}, this.getDefaults(), this.$element.data(), options) - - if (options.delay && typeof options.delay == 'number') { - options.delay = { - show: options.delay, - hide: options.delay - } - } - - return options - } - - Tooltip.prototype.getDelegateOptions = function () { - var options = {} - var defaults = this.getDefaults() - - this._options && $.each(this._options, function (key, value) { - if (defaults[key] != value) options[key] = value - }) - - return options - } - - Tooltip.prototype.enter = function (obj) { - var self = obj instanceof this.constructor ? - obj : $(obj.currentTarget).data('bs.' + this.type) - - if (!self) { - self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) - $(obj.currentTarget).data('bs.' + this.type, self) - } - - if (obj instanceof $.Event) { - self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true - } - - if (self.tip().hasClass('in') || self.hoverState == 'in') { - self.hoverState = 'in' - return - } - - clearTimeout(self.timeout) - - self.hoverState = 'in' - - if (!self.options.delay || !self.options.delay.show) return self.show() - - self.timeout = setTimeout(function () { - if (self.hoverState == 'in') self.show() - }, self.options.delay.show) - } - - Tooltip.prototype.isInStateTrue = function () { - for (var key in this.inState) { - if (this.inState[key]) return true - } - - return false - } - - Tooltip.prototype.leave = function (obj) { - var self = obj instanceof this.constructor ? - obj : $(obj.currentTarget).data('bs.' + this.type) - - if (!self) { - self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) - $(obj.currentTarget).data('bs.' + this.type, self) - } - - if (obj instanceof $.Event) { - self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false - } - - if (self.isInStateTrue()) return - - clearTimeout(self.timeout) - - self.hoverState = 'out' - - if (!self.options.delay || !self.options.delay.hide) return self.hide() - - self.timeout = setTimeout(function () { - if (self.hoverState == 'out') self.hide() - }, self.options.delay.hide) - } - - Tooltip.prototype.show = function () { - var e = $.Event('show.bs.' + this.type) - - if (this.hasContent() && this.enabled) { - this.$element.trigger(e) - - var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0]) - if (e.isDefaultPrevented() || !inDom) return - var that = this - - var $tip = this.tip() - - var tipId = this.getUID(this.type) - - this.setContent() - $tip.attr('id', tipId) - this.$element.attr('aria-describedby', tipId) - - if (this.options.animation) $tip.addClass('fade') - - var placement = typeof this.options.placement == 'function' ? - this.options.placement.call(this, $tip[0], this.$element[0]) : - this.options.placement - - var autoToken = /\s?auto?\s?/i - var autoPlace = autoToken.test(placement) - if (autoPlace) placement = placement.replace(autoToken, '') || 'top' - - $tip - .detach() - .css({ top: 0, left: 0, display: 'block' }) - .addClass(placement) - .data('bs.' + this.type, this) - - this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element) - this.$element.trigger('inserted.bs.' + this.type) - - var pos = this.getPosition() - var actualWidth = $tip[0].offsetWidth - var actualHeight = $tip[0].offsetHeight - - if (autoPlace) { - var orgPlacement = placement - var viewportDim = this.getPosition(this.$viewport) - - placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' : - placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' : - placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' : - placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' : - placement - - $tip - .removeClass(orgPlacement) - .addClass(placement) - } - - var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight) - - this.applyPlacement(calculatedOffset, placement) - - var complete = function () { - var prevHoverState = that.hoverState - that.$element.trigger('shown.bs.' + that.type) - that.hoverState = null - - if (prevHoverState == 'out') that.leave(that) - } - - $.support.transition && this.$tip.hasClass('fade') ? - $tip - .one('bsTransitionEnd', complete) - .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : - complete() - } - } - - Tooltip.prototype.applyPlacement = function (offset, placement) { - var $tip = this.tip() - var width = $tip[0].offsetWidth - var height = $tip[0].offsetHeight - - // manually read margins because getBoundingClientRect includes difference - var marginTop = parseInt($tip.css('margin-top'), 10) - var marginLeft = parseInt($tip.css('margin-left'), 10) - - // we must check for NaN for ie 8/9 - if (isNaN(marginTop)) marginTop = 0 - if (isNaN(marginLeft)) marginLeft = 0 - - offset.top += marginTop - offset.left += marginLeft - - // $.fn.offset doesn't round pixel values - // so we use setOffset directly with our own function B-0 - $.offset.setOffset($tip[0], $.extend({ - using: function (props) { - $tip.css({ - top: Math.round(props.top), - left: Math.round(props.left) - }) - } - }, offset), 0) - - $tip.addClass('in') - - // check to see if placing tip in new offset caused the tip to resize itself - var actualWidth = $tip[0].offsetWidth - var actualHeight = $tip[0].offsetHeight - - if (placement == 'top' && actualHeight != height) { - offset.top = offset.top + height - actualHeight - } - - var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight) - - if (delta.left) offset.left += delta.left - else offset.top += delta.top - - var isVertical = /top|bottom/.test(placement) - var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight - var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight' - - $tip.offset(offset) - this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical) - } - - Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) { - this.arrow() - .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%') - .css(isVertical ? 'top' : 'left', '') - } - - Tooltip.prototype.setContent = function () { - var $tip = this.tip() - var title = this.getTitle() - - $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) - $tip.removeClass('fade in top bottom left right') - } - - Tooltip.prototype.hide = function (callback) { - var that = this - var $tip = $(this.$tip) - var e = $.Event('hide.bs.' + this.type) - - function complete() { - if (that.hoverState != 'in') $tip.detach() - that.$element - .removeAttr('aria-describedby') - .trigger('hidden.bs.' + that.type) - callback && callback() - } - - this.$element.trigger(e) - - if (e.isDefaultPrevented()) return - - $tip.removeClass('in') - - $.support.transition && $tip.hasClass('fade') ? - $tip - .one('bsTransitionEnd', complete) - .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : - complete() - - this.hoverState = null - - return this - } - - Tooltip.prototype.fixTitle = function () { - var $e = this.$element - if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') { - $e.attr('data-original-title', $e.attr('title') || '').attr('title', '') - } - } - - Tooltip.prototype.hasContent = function () { - return this.getTitle() - } - - Tooltip.prototype.getPosition = function ($element) { - $element = $element || this.$element - - var el = $element[0] - var isBody = el.tagName == 'BODY' - - var elRect = el.getBoundingClientRect() - if (elRect.width == null) { - // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093 - elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top }) - } - var elOffset = isBody ? { top: 0, left: 0 } : $element.offset() - var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() } - var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null - - return $.extend({}, elRect, scroll, outerDims, elOffset) - } - - Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { - return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : - placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : - placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : - /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } - - } - - Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) { - var delta = { top: 0, left: 0 } - if (!this.$viewport) return delta - - var viewportPadding = this.options.viewport && this.options.viewport.padding || 0 - var viewportDimensions = this.getPosition(this.$viewport) - - if (/right|left/.test(placement)) { - var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll - var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight - if (topEdgeOffset < viewportDimensions.top) { // top overflow - delta.top = viewportDimensions.top - topEdgeOffset - } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow - delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset - } - } else { - var leftEdgeOffset = pos.left - viewportPadding - var rightEdgeOffset = pos.left + viewportPadding + actualWidth - if (leftEdgeOffset < viewportDimensions.left) { // left overflow - delta.left = viewportDimensions.left - leftEdgeOffset - } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow - delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset - } - } - - return delta - } - - Tooltip.prototype.getTitle = function () { - var title - var $e = this.$element - var o = this.options - - title = $e.attr('data-original-title') - || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) - - return title - } - - Tooltip.prototype.getUID = function (prefix) { - do prefix += ~~(Math.random() * 1000000) - while (document.getElementById(prefix)) - return prefix - } - - Tooltip.prototype.tip = function () { - if (!this.$tip) { - this.$tip = $(this.options.template) - if (this.$tip.length != 1) { - throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!') - } - } - return this.$tip - } - - Tooltip.prototype.arrow = function () { - return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')) - } - - Tooltip.prototype.enable = function () { - this.enabled = true - } - - Tooltip.prototype.disable = function () { - this.enabled = false - } - - Tooltip.prototype.toggleEnabled = function () { - this.enabled = !this.enabled - } - - Tooltip.prototype.toggle = function (e) { - var self = this - if (e) { - self = $(e.currentTarget).data('bs.' + this.type) - if (!self) { - self = new this.constructor(e.currentTarget, this.getDelegateOptions()) - $(e.currentTarget).data('bs.' + this.type, self) - } - } - - if (e) { - self.inState.click = !self.inState.click - if (self.isInStateTrue()) self.enter(self) - else self.leave(self) - } else { - self.tip().hasClass('in') ? self.leave(self) : self.enter(self) - } - } - - Tooltip.prototype.destroy = function () { - var that = this - clearTimeout(this.timeout) - this.hide(function () { - that.$element.off('.' + that.type).removeData('bs.' + that.type) - if (that.$tip) { - that.$tip.detach() - } - that.$tip = null - that.$arrow = null - that.$viewport = null - }) - } - - - // TOOLTIP PLUGIN DEFINITION - // ========================= - - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.tooltip') - var options = typeof option == 'object' && option - - if (!data && /destroy|hide/.test(option)) return - if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options))) - if (typeof option == 'string') data[option]() - }) - } - - var old = $.fn.tooltip - - $.fn.tooltip = Plugin - $.fn.tooltip.Constructor = Tooltip - - - // TOOLTIP NO CONFLICT - // =================== - - $.fn.tooltip.noConflict = function () { - $.fn.tooltip = old - return this - } - -}(jQuery); |