From 4f4b2f830fd820d154ff400d07899888487c12cb Mon Sep 17 00:00:00 2001 From: mndewitt Date: Tue, 12 Jul 2016 16:38:33 -0400 Subject: [PATCH 1/2] ability to access classPrefix from Tooltip constructor --- dist/css/tooltip-theme-arrows.css | 30 +++++++++++++++++++++++++++++- dist/css/tooltip-theme-twipsy.css | 30 +++++++++++++++++++++++++++++- dist/js/tooltip.js | 10 +++++----- dist/js/tooltip.min.js | 2 +- src/js/tooltip.js | 8 ++++---- 5 files changed, 68 insertions(+), 12 deletions(-) diff --git a/dist/css/tooltip-theme-arrows.css b/dist/css/tooltip-theme-arrows.css index 28965ab..5504930 100644 --- a/dist/css/tooltip-theme-arrows.css +++ b/dist/css/tooltip-theme-arrows.css @@ -56,6 +56,34 @@ top: 50%; margin-top: -8px; border-right-color: #000; } + .tooltip-element.tooltip-theme-arrows.tooltip-element-attached-left.tooltip-target-attached-center .tooltip-content { + left: -16px; } + .tooltip-element.tooltip-theme-arrows.tooltip-element-attached-right.tooltip-target-attached-center .tooltip-content { + left: 16px; } + .tooltip-element.tooltip-theme-arrows.tooltip-element-attached-top.tooltip-element-attached-left.tooltip-target-attached-middle .tooltip-content { + margin-top: 8px; } + .tooltip-element.tooltip-theme-arrows.tooltip-element-attached-top.tooltip-element-attached-left.tooltip-target-attached-middle .tooltip-content:before { + bottom: 100%; + left: 8px; + border-bottom-color: #000; } + .tooltip-element.tooltip-theme-arrows.tooltip-element-attached-top.tooltip-element-attached-right.tooltip-target-attached-middle .tooltip-content { + margin-top: 8px; } + .tooltip-element.tooltip-theme-arrows.tooltip-element-attached-top.tooltip-element-attached-right.tooltip-target-attached-middle .tooltip-content:before { + bottom: 100%; + right: 8px; + border-bottom-color: #000; } + .tooltip-element.tooltip-theme-arrows.tooltip-element-attached-bottom.tooltip-element-attached-left.tooltip-target-attached-middle .tooltip-content { + margin-bottom: 8px; } + .tooltip-element.tooltip-theme-arrows.tooltip-element-attached-bottom.tooltip-element-attached-left.tooltip-target-attached-middle .tooltip-content:before { + top: 100%; + left: 8px; + border-top-color: #000; } + .tooltip-element.tooltip-theme-arrows.tooltip-element-attached-bottom.tooltip-element-attached-right.tooltip-target-attached-middle .tooltip-content { + margin-bottom: 8px; } + .tooltip-element.tooltip-theme-arrows.tooltip-element-attached-bottom.tooltip-element-attached-right.tooltip-target-attached-middle .tooltip-content:before { + top: 100%; + right: 8px; + border-top-color: #000; } .tooltip-element.tooltip-theme-arrows.tooltip-element-attached-top.tooltip-element-attached-left.tooltip-target-attached-bottom .tooltip-content { margin-top: 8px; } .tooltip-element.tooltip-theme-arrows.tooltip-element-attached-top.tooltip-element-attached-left.tooltip-target-attached-bottom .tooltip-content:before { @@ -108,4 +136,4 @@ .tooltip-element.tooltip-theme-arrows { pointer-events: none; } .tooltip-element.tooltip-theme-arrows .tooltip-content { - padding: 0.5em 1em; } + padding: .5em 1em; } diff --git a/dist/css/tooltip-theme-twipsy.css b/dist/css/tooltip-theme-twipsy.css index 76cb3f6..b51d0b8 100644 --- a/dist/css/tooltip-theme-twipsy.css +++ b/dist/css/tooltip-theme-twipsy.css @@ -56,6 +56,34 @@ top: 50%; margin-top: -10px; border-right-color: #414141; } + .tooltip-element.tooltip-theme-twipsy.tooltip-element-attached-left.tooltip-target-attached-center .tooltip-content { + left: -20px; } + .tooltip-element.tooltip-theme-twipsy.tooltip-element-attached-right.tooltip-target-attached-center .tooltip-content { + left: 20px; } + .tooltip-element.tooltip-theme-twipsy.tooltip-element-attached-top.tooltip-element-attached-left.tooltip-target-attached-middle .tooltip-content { + margin-top: 10px; } + .tooltip-element.tooltip-theme-twipsy.tooltip-element-attached-top.tooltip-element-attached-left.tooltip-target-attached-middle .tooltip-content:before { + bottom: 100%; + left: 10px; + border-bottom-color: #414141; } + .tooltip-element.tooltip-theme-twipsy.tooltip-element-attached-top.tooltip-element-attached-right.tooltip-target-attached-middle .tooltip-content { + margin-top: 10px; } + .tooltip-element.tooltip-theme-twipsy.tooltip-element-attached-top.tooltip-element-attached-right.tooltip-target-attached-middle .tooltip-content:before { + bottom: 100%; + right: 10px; + border-bottom-color: #414141; } + .tooltip-element.tooltip-theme-twipsy.tooltip-element-attached-bottom.tooltip-element-attached-left.tooltip-target-attached-middle .tooltip-content { + margin-bottom: 10px; } + .tooltip-element.tooltip-theme-twipsy.tooltip-element-attached-bottom.tooltip-element-attached-left.tooltip-target-attached-middle .tooltip-content:before { + top: 100%; + left: 10px; + border-top-color: #414141; } + .tooltip-element.tooltip-theme-twipsy.tooltip-element-attached-bottom.tooltip-element-attached-right.tooltip-target-attached-middle .tooltip-content { + margin-bottom: 10px; } + .tooltip-element.tooltip-theme-twipsy.tooltip-element-attached-bottom.tooltip-element-attached-right.tooltip-target-attached-middle .tooltip-content:before { + top: 100%; + right: 10px; + border-top-color: #414141; } .tooltip-element.tooltip-theme-twipsy.tooltip-element-attached-top.tooltip-element-attached-left.tooltip-target-attached-bottom .tooltip-content { margin-top: 10px; } .tooltip-element.tooltip-theme-twipsy.tooltip-element-attached-top.tooltip-element-attached-left.tooltip-target-attached-bottom .tooltip-content:before { @@ -111,7 +139,7 @@ transition: opacity 150ms; pointer-events: none; } .tooltip-element.tooltip-theme-twipsy .tooltip-content { - padding: 0.5em 1em; } + padding: .5em 1em; } .tooltip-element.tooltip-theme-twipsy .tooltip-content { box-shadow: 0 3px 7px rgba(0, 0, 0, 0.2); border-radius: 2px; diff --git a/dist/js/tooltip.js b/dist/js/tooltip.js index 8b232b3..64c0008 100644 --- a/dist/js/tooltip.js +++ b/dist/js/tooltip.js @@ -1,4 +1,4 @@ -/*! tether-tooltip 1.1.0 */ +/*! tether-tooltip 1.2.0 */ (function(root, factory) { if (typeof define === 'function' && define.amd) { @@ -20,10 +20,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons var extend = Tether.Utils.extend; -var _Drop = Drop.createContext({ - classPrefix: 'tooltip' -}); - var defaults = { position: 'top center', openOn: 'hover', @@ -40,6 +36,10 @@ var Tooltip = (function () { this.options = options; + var _Drop = Drop.createContext({ + classPrefix: this.options.classPrefix || 'tooltip' + }); + if (!this.options.target) { throw new Error('Tooltip Error: You must provide a target for Tooltip to attach to'); } diff --git a/dist/js/tooltip.min.js b/dist/js/tooltip.min.js index cf6f923..dd6c515 100644 --- a/dist/js/tooltip.min.js +++ b/dist/js/tooltip.min.js @@ -1 +1 @@ -!function(t,o){"function"==typeof define&&define.amd?define(["tether-drop","tether"],o):"object"==typeof exports?module.exports=o(require("tether-drop"),require("tether")):t.Tooltip=o(t.Drop,t.Tether)}(this,function(t,o){"use strict";function e(t,o){if(!(t instanceof o))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,o){for(var e=0;ee;++e){var i=t[e];-1===u.indexOf(i)&&(new a({target:i}),u.push(i))}},document.addEventListener("DOMContentLoaded",function(){a.autoinit!==!1&&a.init()}),a}); \ No newline at end of file +!function(t,o){"function"==typeof define&&define.amd?define(["tether-drop","tether"],o):"object"==typeof exports?module.exports=o(require("tether-drop"),require("tether")):t.Tooltip=o(t.Drop,t.Tether)}(this,function(t,o){"use strict";function e(t,o){if(!(t instanceof o))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,o){for(var e=0;e Date: Tue, 12 Jul 2016 16:47:47 -0400 Subject: [PATCH 2/2] bump version --- bower.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bower.json b/bower.json index f832acd..d06c0eb 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "tether-tooltip", - "version": "1.2.0", + "version": "1.2.1", "homepage": "https://github.hubspot.com/tooltip", "authors": [ "Zack Bloom ", diff --git a/package.json b/package.json index 70e46ae..fb8afa8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tether-tooltip", - "version": "1.2.0", + "version": "1.2.1", "description": "CSS tooltips built on Tether", "authors": [ "Adam Schwartz ",