diff --git a/bower.json b/bower.json deleted file mode 100644 index 3e00ac4..0000000 --- a/bower.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "react-foundation-apps", - "version": "0.0.1", - "homepage": "https://github.com/akiran/react-foundation-apps", - "authors": [ - "Kiran Abburi" - ], - "description": "React port for foundation-apps", - "keywords": [ - "React", - "foundation-apps" - ], - "license": "MIT", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests" - ], - "dependencies": { - "foundation-apps": "~1.1.0" - } -} diff --git a/dist/react-foundation-apps.js b/dist/react-foundation-apps.js index 1655ab7..c881878 100644 --- a/dist/react-foundation-apps.js +++ b/dist/react-foundation-apps.js @@ -7,7 +7,7 @@ exports["RFA"] = factory(require("react")); else root["RFA"] = factory(root["React"]); -})(this, function(__WEBPACK_EXTERNAL_MODULE_12__) { +})(this, function(__WEBPACK_EXTERNAL_MODULE_2__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; @@ -55,17 +55,17 @@ return /******/ (function(modules) { // webpackBootstrap /***/ function(module, exports, __webpack_require__) { module.exports = { - Accordion: __webpack_require__(23), - ActionSheet: __webpack_require__(2), - Iconic: __webpack_require__(3), - Interchange: __webpack_require__(4), - Modal: __webpack_require__(5), - Notification: __webpack_require__(6), - OffCanvas: __webpack_require__(7), - Panel: __webpack_require__(8), - Popup: __webpack_require__(9), - Tabs: __webpack_require__(10), - Trigger: __webpack_require__(11), + Accordion: __webpack_require__(1), + ActionSheet: __webpack_require__(4), + Iconic: __webpack_require__(10), + Interchange: __webpack_require__(11), + Modal: __webpack_require__(17), + Notification: __webpack_require__(22), + OffCanvas: __webpack_require__(26), + Panel: __webpack_require__(27), + Popup: __webpack_require__(28), + Tabs: __webpack_require__(30), + Trigger: __webpack_require__(32), }; @@ -73,1774 +73,516 @@ return /******/ (function(modules) { // webpackBootstrap /* 1 */ /***/ function(module, exports, __webpack_require__) { - var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! tether 0.6.5 */ - + 'use strict'; - (function(root, factory) { - if (true) { - !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else if (typeof exports === 'object') { - module.exports = factory(require,exports,module); - } else { - root.Tether = factory(); - } - }(this, function(require,exports,module) { + var React = __webpack_require__(2); - (function() { - var Evented, addClass, defer, deferred, extend, flush, getBounds, getClassName, getOffsetParent, getOrigin, getScrollBarSize, getScrollParent, hasClass, node, removeClass, setClassName, uniqueId, updateClasses, zeroPosCache, - __hasProp = {}.hasOwnProperty, - __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, - __slice = [].slice; + var Accordion = React.createClass({ + displayName: 'Accordion', - if (this.Tether == null) { - this.Tether = { - modules: [] + getInitialState: function getInitialState() { + return { sections: [] }; + }, + getDefaultProps: function getDefaultProps() { + return { + autoOpen: true, + multiOpen: false, + collapsible: false }; - } - - getScrollParent = function(el) { - var parent, position, scrollParent, style, _ref; - position = getComputedStyle(el).position; - if (position === 'fixed') { - return el; + }, + componentWillMount: function componentWillMount() { + var sections = []; + React.Children.forEach(this.props.children, function (child, index) { + sections.push({ active: false }); + }); + if (this.props.autoOpen) { + sections[0].active = true; } - scrollParent = void 0; - parent = el; - while (parent = parent.parentNode) { - try { - style = getComputedStyle(parent); - } catch (_error) {} - if (style == null) { - return parent; - } - if (/(auto|scroll)/.test(style['overflow'] + style['overflowY'] + style['overflowX'])) { - if (position !== 'absolute' || ((_ref = style['position']) === 'relative' || _ref === 'absolute' || _ref === 'fixed')) { - return parent; + this.setState({ sections: sections }); + }, + select: function select(selectSection) { + var sections = this.state.sections; + sections.forEach((function (section, index) { + if (this.props.multiOpen) { + if (index === selectSection) { + section.active = !section.active; + } + } else { + if (index === selectSection) { + section.active = this.props.collapsible === true ? !section.active : true; + } else { + section.active = false; } } - } - return document.body; - }; + }).bind(this)); + this.setState({ sections: sections }); + }, + render: function render() { + var children = React.Children.map(this.props.children, (function (child, index) { + return React.cloneElement(child, { + active: this.state.sections[index] ? this.state.sections[index].active : false, + activate: this.select.bind(this, index) + }); + }).bind(this)); + return React.createElement( + 'div', + { className: 'accordion' }, + children + ); + } + }); - uniqueId = (function() { - var id; - id = 0; - return function() { - return id++; - }; - })(); + module.exports = Accordion; + Accordion.Item = __webpack_require__(3); - zeroPosCache = {}; +/***/ }, +/* 2 */ +/***/ function(module, exports) { - getOrigin = function(doc) { - var id, k, node, v, _ref; - node = doc._tetherZeroElement; - if (node == null) { - node = doc.createElement('div'); - node.setAttribute('data-tether-id', uniqueId()); - extend(node.style, { - top: 0, - left: 0, - position: 'absolute' - }); - doc.body.appendChild(node); - doc._tetherZeroElement = node; - } - id = node.getAttribute('data-tether-id'); - if (zeroPosCache[id] == null) { - zeroPosCache[id] = {}; - _ref = node.getBoundingClientRect(); - for (k in _ref) { - v = _ref[k]; - zeroPosCache[id][k] = v; - } - defer(function() { - return zeroPosCache[id] = void 0; - }); - } - return zeroPosCache[id]; - }; + module.exports = __WEBPACK_EXTERNAL_MODULE_2__; - node = null; +/***/ }, +/* 3 */ +/***/ function(module, exports, __webpack_require__) { - getBounds = function(el) { - var box, doc, docEl, k, origin, v, _ref; - if (el === document) { - doc = document; - el = document.documentElement; - } else { - doc = el.ownerDocument; - } - docEl = doc.documentElement; - box = {}; - _ref = el.getBoundingClientRect(); - for (k in _ref) { - v = _ref[k]; - box[k] = v; - } - origin = getOrigin(doc); - box.top -= origin.top; - box.left -= origin.left; - if (box.width == null) { - box.width = document.body.scrollWidth - box.left - box.right; - } - if (box.height == null) { - box.height = document.body.scrollHeight - box.top - box.bottom; - } - box.top = box.top - docEl.clientTop; - box.left = box.left - docEl.clientLeft; - box.right = doc.body.clientWidth - box.width - box.left; - box.bottom = doc.body.clientHeight - box.height - box.top; - return box; - }; + 'use strict'; - getOffsetParent = function(el) { - return el.offsetParent || document.documentElement; - }; + var React = __webpack_require__(2); + var classnames = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"classnames\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())); - getScrollBarSize = function() { - var inner, outer, width, widthContained, widthScroll; - inner = document.createElement('div'); - inner.style.width = '100%'; - inner.style.height = '200px'; - outer = document.createElement('div'); - extend(outer.style, { - position: 'absolute', - top: 0, - left: 0, - pointerEvents: 'none', - visibility: 'hidden', - width: '200px', - height: '150px', - overflow: 'hidden' - }); - outer.appendChild(inner); - document.body.appendChild(outer); - widthContained = inner.offsetWidth; - outer.style.overflow = 'scroll'; - widthScroll = inner.offsetWidth; - if (widthContained === widthScroll) { - widthScroll = outer.clientWidth; - } - document.body.removeChild(outer); - width = widthContained - widthScroll; - return { - width: width, - height: width + var AccordionItem = React.createClass({ + displayName: 'AccordionItem', + + render: function render() { + var itemClasses = { + 'accordion-item': true, + 'is-active': this.props.active }; - }; + return React.createElement( + 'div', + { className: classnames(itemClasses) }, + React.createElement( + 'div', + { className: 'accordion-title', onClick: this.props.activate }, + this.props.title + ), + React.createElement( + 'div', + { className: 'accordion-content' }, + this.props.children + ) + ); + } + }); - extend = function(out) { - var args, key, obj, val, _i, _len, _ref; - if (out == null) { - out = {}; - } - args = []; - Array.prototype.push.apply(args, arguments); - _ref = args.slice(1); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - obj = _ref[_i]; - if (obj) { - for (key in obj) { - if (!__hasProp.call(obj, key)) continue; - val = obj[key]; - out[key] = val; - } - } - } - return out; - }; + module.exports = AccordionItem; - removeClass = function(el, name) { - var className, cls, _i, _len, _ref, _results; - if (el.classList != null) { - _ref = name.split(' '); - _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - cls = _ref[_i]; - if (cls.trim()) { - _results.push(el.classList.remove(cls)); - } - } - return _results; - } else { - className = getClassName(el).replace(new RegExp("(^| )" + (name.split(' ').join('|')) + "( |$)", 'gi'), ' '); - return setClassName(el, className); - } - }; +/***/ }, +/* 4 */ +/***/ function(module, exports, __webpack_require__) { - addClass = function(el, name) { - var cls, _i, _len, _ref, _results; - if (el.classList != null) { - _ref = name.split(' '); - _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - cls = _ref[_i]; - if (cls.trim()) { - _results.push(el.classList.add(cls)); - } - } - return _results; - } else { - removeClass(el, name); - cls = getClassName(el) + (" " + name); - return setClassName(el, cls); - } - }; + 'use strict'; - hasClass = function(el, name) { - if (el.classList != null) { - return el.classList.contains(name); - } else { - return new RegExp("(^| )" + name + "( |$)", 'gi').test(getClassName(el)); - } - }; + var React = __webpack_require__(2); + var foundationApi = __webpack_require__(5); - getClassName = function(el) { - if (el.className instanceof SVGAnimatedString) { - return el.className.baseVal; - } else { - return el.className; - } - }; + var ActionSheet = React.createClass({ + displayName: 'ActionSheet', - setClassName = function(el, className) { - return el.setAttribute('class', className); - }; + getInitialState: function getInitialState() { + return { active: false }; + }, + setActiveState: function setActiveState(active) { + this.setState({ active: active }); + }, + onBodyClick: function onBodyClick(e) { + var el = e.target; + var insideActionSheet = false; - updateClasses = function(el, add, all) { - var cls, _i, _j, _len, _len1, _results; - for (_i = 0, _len = all.length; _i < _len; _i++) { - cls = all[_i]; - if (__indexOf.call(add, cls) < 0) { - if (hasClass(el, cls)) { - removeClass(el, cls); - } + do { + if (el.classList && el.classList.contains('action-sheet-container') && el.id === this.props.id) { + insideActionSheet = true; + break; } + } while (el = el.parentNode); + + if (!insideActionSheet) { + this.setActiveState(false); } - _results = []; - for (_j = 0, _len1 = add.length; _j < _len1; _j++) { - cls = add[_j]; - if (!hasClass(el, cls)) { - _results.push(addClass(el, cls)); - } else { - _results.push(void 0); - } + }, + componentDidMount: function componentDidMount() { + if (this.props.id) { + foundationApi.subscribe(this.props.id, (function (name, msg) { + if (msg === 'open') { + this.setState({ active: true }); + } else if (msg === 'close') { + this.setState({ active: false }); + } else if (msg === 'toggle') { + this.setState({ active: !this.state.active }); + } + }).bind(this)); } - return _results; - }; - - deferred = []; + document.body.addEventListener('click', this.onBodyClick); + }, + componentWillUnmount: function componentWillUnmount() { + if (this.props.id) foundationApi.unsubscribe(this.props.id); + document.body.removeEventListener('click', this.onBodyClick); + }, + render: function render() { + var children = React.Children.map(this.props.children, (function (child, index) { + var extraProps = { active: this.state.active }; + if (child.type.displayName === 'ActionSheetButton') { + extraProps.setActiveState = this.setActiveState; + } + return React.cloneElement(child, extraProps); + }).bind(this)); + return React.createElement( + 'div', + { id: this.props.id, 'data-closable': true, className: 'action-sheet-container' }, + children + ); + } + }); - defer = function(fn) { - return deferred.push(fn); - }; + module.exports = ActionSheet; + ActionSheet.Button = __webpack_require__(8); + ActionSheet.Content = __webpack_require__(9); - flush = function() { - var fn, _results; - _results = []; - while (fn = deferred.pop()) { - _results.push(fn()); - } - return _results; - }; +/***/ }, +/* 5 */ +/***/ function(module, exports, __webpack_require__) { - Evented = (function() { - function Evented() {} + //From https://github.com/zurb/foundation-apps/blob/master/js/angular/common/common.services.js + 'use strict'; - Evented.prototype.on = function(event, handler, ctx, once) { - var _base; - if (once == null) { - once = false; - } - if (this.bindings == null) { - this.bindings = {}; - } - if ((_base = this.bindings)[event] == null) { - _base[event] = []; - } - return this.bindings[event].push({ - handler: handler, - ctx: ctx, - once: once - }); - }; + var PubSub = __webpack_require__(6); + var assign = __webpack_require__(7); - Evented.prototype.once = function(event, handler, ctx) { - return this.on(event, handler, ctx, true); - }; + var listeners = []; + var settings = {}; + var uniqueIds = []; - Evented.prototype.off = function(event, handler) { - var i, _ref, _results; - if (((_ref = this.bindings) != null ? _ref[event] : void 0) == null) { - return; - } - if (handler == null) { - return delete this.bindings[event]; - } else { - i = 0; - _results = []; - while (i < this.bindings[event].length) { - if (this.bindings[event][i].handler === handler) { - _results.push(this.bindings[event].splice(i, 1)); - } else { - _results.push(i++); - } - } - return _results; + var foundationApi = { + subscribe: PubSub.subscribe, + publish: PubSub.publish, + unsubscribe: PubSub.unsubscribe, + closeActiveElements: function closeActiveElements(options) { + var self = this; + options = options || {}; + var activeElements = document.querySelectorAll('.is-active[data-closable]'); + Array.prototype.forEach.call(activeElements, function (el) { + if (options.exclude !== el.id) { + self.publish(el.id, 'close'); } - }; + }); + }, + getSettings: function getSettings() { + return settings; + }, + modifySettings: function modifySettings(tree) { + settings = assign(settings, tree); + return settings; + }, + generateUuid: function generateUuid() { + var uuid = ''; - Evented.prototype.trigger = function() { - var args, ctx, event, handler, i, once, _ref, _ref1, _results; - event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; - if ((_ref = this.bindings) != null ? _ref[event] : void 0) { - i = 0; - _results = []; - while (i < this.bindings[event].length) { - _ref1 = this.bindings[event][i], handler = _ref1.handler, ctx = _ref1.ctx, once = _ref1.once; - handler.apply(ctx != null ? ctx : this, args); - if (once) { - _results.push(this.bindings[event].splice(i, 1)); - } else { - _results.push(i++); - } - } - return _results; + //little trick to produce semi-random IDs + do { + uuid += 'zf-uuid-'; + for (var i = 0; i < 15; i++) { + uuid += Math.floor(Math.random() * 16).toString(16); } - }; - - return Evented; + } while (!uniqueIds.indexOf(uuid)); - })(); + uniqueIds.push(uuid); + return uuid; + } + }; - this.Tether.Utils = { - getScrollParent: getScrollParent, - getBounds: getBounds, - getOffsetParent: getOffsetParent, - extend: extend, - addClass: addClass, - removeClass: removeClass, - hasClass: hasClass, - updateClasses: updateClasses, - defer: defer, - flush: flush, - uniqueId: uniqueId, - Evented: Evented, - getScrollBarSize: getScrollBarSize - }; + module.exports = foundationApi; - }).call(this); +/***/ }, +/* 6 */ +/***/ function(module, exports, __webpack_require__) { - (function() { - var MIRROR_LR, MIRROR_TB, OFFSET_MAP, Tether, addClass, addOffset, attachmentToOffset, autoToFixedAttachment, defer, extend, flush, getBounds, getOffsetParent, getOuterSize, getScrollBarSize, getScrollParent, getSize, now, offsetToPx, parseAttachment, parseOffset, position, removeClass, tethers, transformKey, updateClasses, within, _Tether, _ref, - __slice = [].slice, - __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; + var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* + Copyright (c) 2010,2011,2012,2013,2014 Morgan Roderick http://roderick.dk + License: MIT - http://mrgnrdrck.mit-license.org - if (this.Tether == null) { - throw new Error("You must include the utils.js file before tether.js"); - } + https://github.com/mroderick/PubSubJS + */ + (function (root, factory){ + 'use strict'; - Tether = this.Tether; + if (true){ + // AMD. Register as an anonymous module. + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - _ref = Tether.Utils, getScrollParent = _ref.getScrollParent, getSize = _ref.getSize, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getOffsetParent = _ref.getOffsetParent, extend = _ref.extend, addClass = _ref.addClass, removeClass = _ref.removeClass, updateClasses = _ref.updateClasses, defer = _ref.defer, flush = _ref.flush, getScrollBarSize = _ref.getScrollBarSize; + } else if (typeof exports === 'object'){ + // CommonJS + factory(exports); - within = function(a, b, diff) { - if (diff == null) { - diff = 1; } - return (a + diff >= b && b >= a - diff); - }; - transformKey = (function() { - var el, key, _i, _len, _ref1; - el = document.createElement('div'); - _ref1 = ['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform']; - for (_i = 0, _len = _ref1.length; _i < _len; _i++) { - key = _ref1[_i]; - if (el.style[key] !== void 0) { - return key; - } - } - })(); + // Browser globals + var PubSub = {}; + root.PubSub = PubSub; + factory(PubSub); + + }(( typeof window === 'object' && window ) || this, function (PubSub){ + 'use strict'; - tethers = []; + var messages = {}, + lastUid = -1; - position = function() { - var tether, _i, _len; - for (_i = 0, _len = tethers.length; _i < _len; _i++) { - tether = tethers[_i]; - tether.position(false); - } - return flush(); - }; + function hasKeys(obj){ + var key; - now = function() { - var _ref1; - return (_ref1 = typeof performance !== "undefined" && performance !== null ? typeof performance.now === "function" ? performance.now() : void 0 : void 0) != null ? _ref1 : +(new Date); - }; + for (key in obj){ + if ( obj.hasOwnProperty(key) ){ + return true; + } + } + return false; + } - (function() { - var event, lastCall, lastDuration, pendingTimeout, tick, _i, _len, _ref1, _results; - lastCall = null; - lastDuration = null; - pendingTimeout = null; - tick = function() { - if ((lastDuration != null) && lastDuration > 16) { - lastDuration = Math.min(lastDuration - 16, 250); - pendingTimeout = setTimeout(tick, 250); - return; - } - if ((lastCall != null) && (now() - lastCall) < 10) { - return; - } - if (pendingTimeout != null) { - clearTimeout(pendingTimeout); - pendingTimeout = null; - } - lastCall = now(); - position(); - return lastDuration = now() - lastCall; - }; - _ref1 = ['resize', 'scroll', 'touchmove']; - _results = []; - for (_i = 0, _len = _ref1.length; _i < _len; _i++) { - event = _ref1[_i]; - _results.push(window.addEventListener(event, tick)); - } - return _results; - })(); + /** + * Returns a function that throws the passed exception, for use as argument for setTimeout + * @param { Object } ex An Error object + */ + function throwException( ex ){ + return function reThrowException(){ + throw ex; + }; + } - MIRROR_LR = { - center: 'center', - left: 'right', - right: 'left' - }; + function callSubscriberWithDelayedExceptions( subscriber, message, data ){ + try { + subscriber( message, data ); + } catch( ex ){ + setTimeout( throwException( ex ), 0); + } + } - MIRROR_TB = { - middle: 'middle', - top: 'bottom', - bottom: 'top' - }; + function callSubscriberWithImmediateExceptions( subscriber, message, data ){ + subscriber( message, data ); + } - OFFSET_MAP = { - top: 0, - left: 0, - middle: '50%', - center: '50%', - bottom: '100%', - right: '100%' - }; + function deliverMessage( originalMessage, matchedMessage, data, immediateExceptions ){ + var subscribers = messages[matchedMessage], + callSubscriber = immediateExceptions ? callSubscriberWithImmediateExceptions : callSubscriberWithDelayedExceptions, + s; - autoToFixedAttachment = function(attachment, relativeToAttachment) { - var left, top; - left = attachment.left, top = attachment.top; - if (left === 'auto') { - left = MIRROR_LR[relativeToAttachment.left]; - } - if (top === 'auto') { - top = MIRROR_TB[relativeToAttachment.top]; - } - return { - left: left, - top: top - }; - }; + if ( !messages.hasOwnProperty( matchedMessage ) ) { + return; + } - attachmentToOffset = function(attachment) { - var _ref1, _ref2; - return { - left: (_ref1 = OFFSET_MAP[attachment.left]) != null ? _ref1 : attachment.left, - top: (_ref2 = OFFSET_MAP[attachment.top]) != null ? _ref2 : attachment.top - }; - }; + for (s in subscribers){ + if ( subscribers.hasOwnProperty(s)){ + callSubscriber( subscribers[s], originalMessage, data ); + } + } + } - addOffset = function() { - var left, offsets, out, top, _i, _len, _ref1; - offsets = 1 <= arguments.length ? __slice.call(arguments, 0) : []; - out = { - top: 0, - left: 0 - }; - for (_i = 0, _len = offsets.length; _i < _len; _i++) { - _ref1 = offsets[_i], top = _ref1.top, left = _ref1.left; - if (typeof top === 'string') { - top = parseFloat(top, 10); - } - if (typeof left === 'string') { - left = parseFloat(left, 10); - } - out.top += top; - out.left += left; - } - return out; - }; + function createDeliveryFunction( message, data, immediateExceptions ){ + return function deliverNamespaced(){ + var topic = String( message ), + position = topic.lastIndexOf( '.' ); - offsetToPx = function(offset, size) { - if (typeof offset.left === 'string' && offset.left.indexOf('%') !== -1) { - offset.left = parseFloat(offset.left, 10) / 100 * size.width; - } - if (typeof offset.top === 'string' && offset.top.indexOf('%') !== -1) { - offset.top = parseFloat(offset.top, 10) / 100 * size.height; - } - return offset; - }; + // deliver the message as it is now + deliverMessage(message, message, data, immediateExceptions); - parseAttachment = parseOffset = function(value) { - var left, top, _ref1; - _ref1 = value.split(' '), top = _ref1[0], left = _ref1[1]; - return { - top: top, - left: left - }; - }; + // trim the hierarchy and deliver message to each level + while( position !== -1 ){ + topic = topic.substr( 0, position ); + position = topic.lastIndexOf('.'); + deliverMessage( message, topic, data, immediateExceptions ); + } + }; + } - _Tether = (function() { - _Tether.modules = []; + function messageHasSubscribers( message ){ + var topic = String( message ), + found = Boolean(messages.hasOwnProperty( topic ) && hasKeys(messages[topic])), + position = topic.lastIndexOf( '.' ); - function _Tether(options) { - this.position = __bind(this.position, this); - var module, _i, _len, _ref1, _ref2; - tethers.push(this); - this.history = []; - this.setOptions(options, false); - _ref1 = Tether.modules; - for (_i = 0, _len = _ref1.length; _i < _len; _i++) { - module = _ref1[_i]; - if ((_ref2 = module.initialize) != null) { - _ref2.call(this); - } - } - this.position(); - } + while ( !found && position !== -1 ){ + topic = topic.substr( 0, position ); + position = topic.lastIndexOf( '.' ); + found = Boolean(messages.hasOwnProperty( topic ) && hasKeys(messages[topic])); + } - _Tether.prototype.getClass = function(key) { - var _ref1, _ref2; - if ((_ref1 = this.options.classes) != null ? _ref1[key] : void 0) { - return this.options.classes[key]; - } else if (((_ref2 = this.options.classes) != null ? _ref2[key] : void 0) !== false) { - if (this.options.classPrefix) { - return "" + this.options.classPrefix + "-" + key; - } else { - return key; - } - } else { - return ''; - } - }; + return found; + } - _Tether.prototype.setOptions = function(options, position) { - var defaults, key, _i, _len, _ref1, _ref2; - this.options = options; - if (position == null) { - position = true; - } - defaults = { - offset: '0 0', - targetOffset: '0 0', - targetAttachment: 'auto auto', - classPrefix: 'tether' - }; - this.options = extend(defaults, this.options); - _ref1 = this.options, this.element = _ref1.element, this.target = _ref1.target, this.targetModifier = _ref1.targetModifier; - if (this.target === 'viewport') { - this.target = document.body; - this.targetModifier = 'visible'; - } else if (this.target === 'scroll-handle') { - this.target = document.body; - this.targetModifier = 'scroll-handle'; - } - _ref2 = ['element', 'target']; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - key = _ref2[_i]; - if (this[key] == null) { - throw new Error("Tether Error: Both element and target must be defined"); - } - if (this[key].jquery != null) { - this[key] = this[key][0]; - } else if (typeof this[key] === 'string') { - this[key] = document.querySelector(this[key]); - } - } - addClass(this.element, this.getClass('element')); - addClass(this.target, this.getClass('target')); - if (!this.options.attachment) { - throw new Error("Tether Error: You must provide an attachment"); - } - this.targetAttachment = parseAttachment(this.options.targetAttachment); - this.attachment = parseAttachment(this.options.attachment); - this.offset = parseOffset(this.options.offset); - this.targetOffset = parseOffset(this.options.targetOffset); - if (this.scrollParent != null) { - this.disable(); - } - if (this.targetModifier === 'scroll-handle') { - this.scrollParent = this.target; - } else { - this.scrollParent = getScrollParent(this.target); - } - if (this.options.enabled !== false) { - return this.enable(position); - } - }; + function publish( message, data, sync, immediateExceptions ){ + var deliver = createDeliveryFunction( message, data, immediateExceptions ), + hasSubscribers = messageHasSubscribers( message ); - _Tether.prototype.getTargetBounds = function() { - var bounds, fitAdj, hasBottomScroll, height, out, scrollBottom, scrollPercentage, style, target; - if (this.targetModifier != null) { - switch (this.targetModifier) { - case 'visible': - if (this.target === document.body) { - return { - top: pageYOffset, - left: pageXOffset, - height: innerHeight, - width: innerWidth - }; - } else { - bounds = getBounds(this.target); - out = { - height: bounds.height, - width: bounds.width, - top: bounds.top, - left: bounds.left - }; - out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top)); - out.height = Math.min(out.height, bounds.height - ((bounds.top + bounds.height) - (pageYOffset + innerHeight))); - out.height = Math.min(innerHeight, out.height); - out.height -= 2; - out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left)); - out.width = Math.min(out.width, bounds.width - ((bounds.left + bounds.width) - (pageXOffset + innerWidth))); - out.width = Math.min(innerWidth, out.width); - out.width -= 2; - if (out.top < pageYOffset) { - out.top = pageYOffset; - } - if (out.left < pageXOffset) { - out.left = pageXOffset; - } - return out; - } - break; - case 'scroll-handle': - target = this.target; - if (target === document.body) { - target = document.documentElement; - bounds = { - left: pageXOffset, - top: pageYOffset, - height: innerHeight, - width: innerWidth - }; - } else { - bounds = getBounds(target); - } - style = getComputedStyle(target); - hasBottomScroll = target.scrollWidth > target.clientWidth || 'scroll' === [style.overflow, style.overflowX] || this.target !== document.body; - scrollBottom = 0; - if (hasBottomScroll) { - scrollBottom = 15; - } - height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom; - out = { - width: 15, - height: height * 0.975 * (height / target.scrollHeight), - left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15 - }; - fitAdj = 0; - if (height < 408 && this.target === document.body) { - fitAdj = -0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58; - } - if (this.target !== document.body) { - out.height = Math.max(out.height, 24); - } - scrollPercentage = this.target.scrollTop / (target.scrollHeight - height); - out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth); - if (this.target === document.body) { - out.height = Math.max(out.height, 24); - } - return out; - } - } else { - return getBounds(this.target); - } - }; + if ( !hasSubscribers ){ + return false; + } - _Tether.prototype.clearCache = function() { - return this._cache = {}; - }; + if ( sync === true ){ + deliver(); + } else { + setTimeout( deliver, 0 ); + } + return true; + } - _Tether.prototype.cache = function(k, getter) { - if (this._cache == null) { - this._cache = {}; - } - if (this._cache[k] == null) { - this._cache[k] = getter.call(this); - } - return this._cache[k]; - }; + /** + * PubSub.publish( message[, data] ) -> Boolean + * - message (String): The message to publish + * - data: The data to pass to subscribers + * Publishes the the message, passing the data to it's subscribers + **/ + PubSub.publish = function( message, data ){ + return publish( message, data, false, PubSub.immediateExceptions ); + }; - _Tether.prototype.enable = function(position) { - if (position == null) { - position = true; - } - addClass(this.target, this.getClass('enabled')); - addClass(this.element, this.getClass('enabled')); - this.enabled = true; - if (this.scrollParent !== document) { - this.scrollParent.addEventListener('scroll', this.position); - } - if (position) { - return this.position(); - } - }; + /** + * PubSub.publishSync( message[, data] ) -> Boolean + * - message (String): The message to publish + * - data: The data to pass to subscribers + * Publishes the the message synchronously, passing the data to it's subscribers + **/ + PubSub.publishSync = function( message, data ){ + return publish( message, data, true, PubSub.immediateExceptions ); + }; - _Tether.prototype.disable = function() { - removeClass(this.target, this.getClass('enabled')); - removeClass(this.element, this.getClass('enabled')); - this.enabled = false; - if (this.scrollParent != null) { - return this.scrollParent.removeEventListener('scroll', this.position); - } - }; + /** + * PubSub.subscribe( message, func ) -> String + * - message (String): The message to subscribe to + * - func (Function): The function to call when a new message is published + * Subscribes the passed function to the passed message. Every returned token is unique and should be stored if + * you need to unsubscribe + **/ + PubSub.subscribe = function( message, func ){ + if ( typeof func !== 'function'){ + return false; + } - _Tether.prototype.destroy = function() { - var i, tether, _i, _len, _results; - this.disable(); - _results = []; - for (i = _i = 0, _len = tethers.length; _i < _len; i = ++_i) { - tether = tethers[i]; - if (tether === this) { - tethers.splice(i, 1); - break; - } else { - _results.push(void 0); - } - } - return _results; - }; + // message is not registered yet + if ( !messages.hasOwnProperty( message ) ){ + messages[message] = {}; + } - _Tether.prototype.updateAttachClasses = function(elementAttach, targetAttach) { - var add, all, side, sides, _i, _j, _len, _len1, _ref1, - _this = this; - if (elementAttach == null) { - elementAttach = this.attachment; - } - if (targetAttach == null) { - targetAttach = this.targetAttachment; - } - sides = ['left', 'top', 'bottom', 'right', 'middle', 'center']; - if ((_ref1 = this._addAttachClasses) != null ? _ref1.length : void 0) { - this._addAttachClasses.splice(0, this._addAttachClasses.length); - } - add = this._addAttachClasses != null ? this._addAttachClasses : this._addAttachClasses = []; - if (elementAttach.top) { - add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.top); - } - if (elementAttach.left) { - add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.left); - } - if (targetAttach.top) { - add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.top); - } - if (targetAttach.left) { - add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.left); - } - all = []; - for (_i = 0, _len = sides.length; _i < _len; _i++) { - side = sides[_i]; - all.push("" + (this.getClass('element-attached')) + "-" + side); - } - for (_j = 0, _len1 = sides.length; _j < _len1; _j++) { - side = sides[_j]; - all.push("" + (this.getClass('target-attached')) + "-" + side); - } - return defer(function() { - if (_this._addAttachClasses == null) { - return; - } - updateClasses(_this.element, _this._addAttachClasses, all); - updateClasses(_this.target, _this._addAttachClasses, all); - return _this._addAttachClasses = void 0; - }); - }; - - _Tether.prototype.position = function(flushChanges) { - var elementPos, elementStyle, height, left, manualOffset, manualTargetOffset, module, next, offset, offsetBorder, offsetParent, offsetParentSize, offsetParentStyle, offsetPosition, ret, scrollLeft, scrollTop, scrollbarSize, side, targetAttachment, targetOffset, targetPos, targetSize, top, width, _i, _j, _len, _len1, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, - _this = this; - if (flushChanges == null) { - flushChanges = true; - } - if (!this.enabled) { - return; - } - this.clearCache(); - targetAttachment = autoToFixedAttachment(this.targetAttachment, this.attachment); - this.updateAttachClasses(this.attachment, targetAttachment); - elementPos = this.cache('element-bounds', function() { - return getBounds(_this.element); - }); - width = elementPos.width, height = elementPos.height; - if (width === 0 && height === 0 && (this.lastSize != null)) { - _ref1 = this.lastSize, width = _ref1.width, height = _ref1.height; - } else { - this.lastSize = { - width: width, - height: height - }; - } - targetSize = targetPos = this.cache('target-bounds', function() { - return _this.getTargetBounds(); - }); - offset = offsetToPx(attachmentToOffset(this.attachment), { - width: width, - height: height - }); - targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize); - manualOffset = offsetToPx(this.offset, { - width: width, - height: height - }); - manualTargetOffset = offsetToPx(this.targetOffset, targetSize); - offset = addOffset(offset, manualOffset); - targetOffset = addOffset(targetOffset, manualTargetOffset); - left = targetPos.left + targetOffset.left - offset.left; - top = targetPos.top + targetOffset.top - offset.top; - _ref2 = Tether.modules; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - module = _ref2[_i]; - ret = module.position.call(this, { - left: left, - top: top, - targetAttachment: targetAttachment, - targetPos: targetPos, - attachment: this.attachment, - elementPos: elementPos, - offset: offset, - targetOffset: targetOffset, - manualOffset: manualOffset, - manualTargetOffset: manualTargetOffset, - scrollbarSize: scrollbarSize - }); - if ((ret == null) || typeof ret !== 'object') { - continue; - } else if (ret === false) { - return false; - } else { - top = ret.top, left = ret.left; - } - } - next = { - page: { - top: top, - left: left - }, - viewport: { - top: top - pageYOffset, - bottom: pageYOffset - top - height + innerHeight, - left: left - pageXOffset, - right: pageXOffset - left - width + innerWidth - } - }; - if (document.body.scrollWidth > window.innerWidth) { - scrollbarSize = this.cache('scrollbar-size', getScrollBarSize); - next.viewport.bottom -= scrollbarSize.height; - } - if (document.body.scrollHeight > window.innerHeight) { - scrollbarSize = this.cache('scrollbar-size', getScrollBarSize); - next.viewport.right -= scrollbarSize.width; - } - if (((_ref3 = document.body.style.position) !== '' && _ref3 !== 'static') || ((_ref4 = document.body.parentElement.style.position) !== '' && _ref4 !== 'static')) { - next.page.bottom = document.body.scrollHeight - top - height; - next.page.right = document.body.scrollWidth - left - width; - } - if (((_ref5 = this.options.optimizations) != null ? _ref5.moveElement : void 0) !== false && (this.targetModifier == null)) { - offsetParent = this.cache('target-offsetparent', function() { - return getOffsetParent(_this.target); - }); - offsetPosition = this.cache('target-offsetparent-bounds', function() { - return getBounds(offsetParent); - }); - offsetParentStyle = getComputedStyle(offsetParent); - elementStyle = getComputedStyle(this.element); - offsetParentSize = offsetPosition; - offsetBorder = {}; - _ref6 = ['Top', 'Left', 'Bottom', 'Right']; - for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) { - side = _ref6[_j]; - offsetBorder[side.toLowerCase()] = parseFloat(offsetParentStyle["border" + side + "Width"]); - } - offsetPosition.right = document.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right; - offsetPosition.bottom = document.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom; - if (next.page.top >= (offsetPosition.top + offsetBorder.top) && next.page.bottom >= offsetPosition.bottom) { - if (next.page.left >= (offsetPosition.left + offsetBorder.left) && next.page.right >= offsetPosition.right) { - scrollTop = offsetParent.scrollTop; - scrollLeft = offsetParent.scrollLeft; - next.offset = { - top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top, - left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left - }; - } - } - } - this.move(next); - this.history.unshift(next); - if (this.history.length > 3) { - this.history.pop(); - } - if (flushChanges) { - flush(); - } - return true; - }; - - _Tether.prototype.move = function(position) { - var css, elVal, found, key, moved, offsetParent, point, same, transcribe, type, val, write, writeCSS, _i, _len, _ref1, _ref2, - _this = this; - if (this.element.parentNode == null) { - return; - } - same = {}; - for (type in position) { - same[type] = {}; - for (key in position[type]) { - found = false; - _ref1 = this.history; - for (_i = 0, _len = _ref1.length; _i < _len; _i++) { - point = _ref1[_i]; - if (!within((_ref2 = point[type]) != null ? _ref2[key] : void 0, position[type][key])) { - found = true; - break; - } - } - if (!found) { - same[type][key] = true; - } - } - } - css = { - top: '', - left: '', - right: '', - bottom: '' - }; - transcribe = function(same, pos) { - var xPos, yPos, _ref3; - if (((_ref3 = _this.options.optimizations) != null ? _ref3.gpu : void 0) !== false) { - if (same.top) { - css.top = 0; - yPos = pos.top; - } else { - css.bottom = 0; - yPos = -pos.bottom; - } - if (same.left) { - css.left = 0; - xPos = pos.left; - } else { - css.right = 0; - xPos = -pos.right; - } - css[transformKey] = "translateX(" + (Math.round(xPos)) + "px) translateY(" + (Math.round(yPos)) + "px)"; - if (transformKey !== 'msTransform') { - return css[transformKey] += " translateZ(0)"; - } - } else { - if (same.top) { - css.top = "" + pos.top + "px"; - } else { - css.bottom = "" + pos.bottom + "px"; - } - if (same.left) { - return css.left = "" + pos.left + "px"; - } else { - return css.right = "" + pos.right + "px"; - } - } - }; - moved = false; - if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) { - css.position = 'absolute'; - transcribe(same.page, position.page); - } else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) { - css.position = 'fixed'; - transcribe(same.viewport, position.viewport); - } else if ((same.offset != null) && same.offset.top && same.offset.left) { - css.position = 'absolute'; - offsetParent = this.cache('target-offsetparent', function() { - return getOffsetParent(_this.target); - }); - if (getOffsetParent(this.element) !== offsetParent) { - defer(function() { - _this.element.parentNode.removeChild(_this.element); - return offsetParent.appendChild(_this.element); - }); - } - transcribe(same.offset, position.offset); - moved = true; - } else { - css.position = 'absolute'; - transcribe({ - top: true, - left: true - }, position.page); - } - if (!moved && this.element.parentNode.tagName !== 'BODY') { - this.element.parentNode.removeChild(this.element); - document.body.appendChild(this.element); - } - writeCSS = {}; - write = false; - for (key in css) { - val = css[key]; - elVal = this.element.style[key]; - if (elVal !== '' && val !== '' && (key === 'top' || key === 'left' || key === 'bottom' || key === 'right')) { - elVal = parseFloat(elVal); - val = parseFloat(val); - } - if (elVal !== val) { - write = true; - writeCSS[key] = css[key]; - } - } - if (write) { - return defer(function() { - return extend(_this.element.style, writeCSS); - }); - } - }; - - return _Tether; - - })(); - - Tether.position = position; - - this.Tether = extend(_Tether, Tether); - - }).call(this); - - (function() { - var BOUNDS_FORMAT, MIRROR_ATTACH, defer, extend, getBoundingRect, getBounds, getOuterSize, getSize, updateClasses, _ref, - __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; - - _ref = this.Tether.Utils, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getSize = _ref.getSize, extend = _ref.extend, updateClasses = _ref.updateClasses, defer = _ref.defer; - - MIRROR_ATTACH = { - left: 'right', - right: 'left', - top: 'bottom', - bottom: 'top', - middle: 'middle' - }; - - BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom']; - - getBoundingRect = function(tether, to) { - var i, pos, side, size, style, _i, _len; - if (to === 'scrollParent') { - to = tether.scrollParent; - } else if (to === 'window') { - to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset]; - } - if (to === document) { - to = to.documentElement; - } - if (to.nodeType != null) { - pos = size = getBounds(to); - style = getComputedStyle(to); - to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top]; - for (i = _i = 0, _len = BOUNDS_FORMAT.length; _i < _len; i = ++_i) { - side = BOUNDS_FORMAT[i]; - side = side[0].toUpperCase() + side.substr(1); - if (side === 'Top' || side === 'Left') { - to[i] += parseFloat(style["border" + side + "Width"]); - } else { - to[i] -= parseFloat(style["border" + side + "Width"]); - } - } - } - return to; - }; - - this.Tether.modules.push({ - position: function(_arg) { - var addClasses, allClasses, attachment, bounds, changeAttachX, changeAttachY, cls, constraint, eAttachment, height, left, oob, oobClass, p, pin, pinned, pinnedClass, removeClass, side, tAttachment, targetAttachment, targetHeight, targetSize, targetWidth, to, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _len5, _m, _n, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, - _this = this; - top = _arg.top, left = _arg.left, targetAttachment = _arg.targetAttachment; - if (!this.options.constraints) { - return true; - } - removeClass = function(prefix) { - var side, _i, _len, _results; - _this.removeClass(prefix); - _results = []; - for (_i = 0, _len = BOUNDS_FORMAT.length; _i < _len; _i++) { - side = BOUNDS_FORMAT[_i]; - _results.push(_this.removeClass("" + prefix + "-" + side)); - } - return _results; - }; - _ref1 = this.cache('element-bounds', function() { - return getBounds(_this.element); - }), height = _ref1.height, width = _ref1.width; - if (width === 0 && height === 0 && (this.lastSize != null)) { - _ref2 = this.lastSize, width = _ref2.width, height = _ref2.height; - } - targetSize = this.cache('target-bounds', function() { - return _this.getTargetBounds(); - }); - targetHeight = targetSize.height; - targetWidth = targetSize.width; - tAttachment = {}; - eAttachment = {}; - allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')]; - _ref3 = this.options.constraints; - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - constraint = _ref3[_i]; - if (constraint.outOfBoundsClass) { - allClasses.push(constraint.outOfBoundsClass); - } - if (constraint.pinnedClass) { - allClasses.push(constraint.pinnedClass); - } - } - for (_j = 0, _len1 = allClasses.length; _j < _len1; _j++) { - cls = allClasses[_j]; - _ref4 = ['left', 'top', 'right', 'bottom']; - for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) { - side = _ref4[_k]; - allClasses.push("" + cls + "-" + side); - } - } - addClasses = []; - tAttachment = extend({}, targetAttachment); - eAttachment = extend({}, this.attachment); - _ref5 = this.options.constraints; - for (_l = 0, _len3 = _ref5.length; _l < _len3; _l++) { - constraint = _ref5[_l]; - to = constraint.to, attachment = constraint.attachment, pin = constraint.pin; - if (attachment == null) { - attachment = ''; - } - if (__indexOf.call(attachment, ' ') >= 0) { - _ref6 = attachment.split(' '), changeAttachY = _ref6[0], changeAttachX = _ref6[1]; - } else { - changeAttachX = changeAttachY = attachment; - } - bounds = getBoundingRect(this, to); - if (changeAttachY === 'target' || changeAttachY === 'both') { - if (top < bounds[1] && tAttachment.top === 'top') { - top += targetHeight; - tAttachment.top = 'bottom'; - } - if (top + height > bounds[3] && tAttachment.top === 'bottom') { - top -= targetHeight; - tAttachment.top = 'top'; - } - } - if (changeAttachY === 'together') { - if (top < bounds[1] && tAttachment.top === 'top') { - if (eAttachment.top === 'bottom') { - top += targetHeight; - tAttachment.top = 'bottom'; - top += height; - eAttachment.top = 'top'; - } else if (eAttachment.top === 'top') { - top += targetHeight; - tAttachment.top = 'bottom'; - top -= height; - eAttachment.top = 'bottom'; - } - } - if (top + height > bounds[3] && tAttachment.top === 'bottom') { - if (eAttachment.top === 'top') { - top -= targetHeight; - tAttachment.top = 'top'; - top -= height; - eAttachment.top = 'bottom'; - } else if (eAttachment.top === 'bottom') { - top -= targetHeight; - tAttachment.top = 'top'; - top += height; - eAttachment.top = 'top'; - } - } - if (tAttachment.top === 'middle') { - if (top + height > bounds[3] && eAttachment.top === 'top') { - top -= height; - eAttachment.top = 'bottom'; - } else if (top < bounds[1] && eAttachment.top === 'bottom') { - top += height; - eAttachment.top = 'top'; - } - } - } - if (changeAttachX === 'target' || changeAttachX === 'both') { - if (left < bounds[0] && tAttachment.left === 'left') { - left += targetWidth; - tAttachment.left = 'right'; - } - if (left + width > bounds[2] && tAttachment.left === 'right') { - left -= targetWidth; - tAttachment.left = 'left'; - } - } - if (changeAttachX === 'together') { - if (left < bounds[0] && tAttachment.left === 'left') { - if (eAttachment.left === 'right') { - left += targetWidth; - tAttachment.left = 'right'; - left += width; - eAttachment.left = 'left'; - } else if (eAttachment.left === 'left') { - left += targetWidth; - tAttachment.left = 'right'; - left -= width; - eAttachment.left = 'right'; - } - } else if (left + width > bounds[2] && tAttachment.left === 'right') { - if (eAttachment.left === 'left') { - left -= targetWidth; - tAttachment.left = 'left'; - left -= width; - eAttachment.left = 'right'; - } else if (eAttachment.left === 'right') { - left -= targetWidth; - tAttachment.left = 'left'; - left += width; - eAttachment.left = 'left'; - } - } else if (tAttachment.left === 'center') { - if (left + width > bounds[2] && eAttachment.left === 'left') { - left -= width; - eAttachment.left = 'right'; - } else if (left < bounds[0] && eAttachment.left === 'right') { - left += width; - eAttachment.left = 'left'; - } - } - } - if (changeAttachY === 'element' || changeAttachY === 'both') { - if (top < bounds[1] && eAttachment.top === 'bottom') { - top += height; - eAttachment.top = 'top'; - } - if (top + height > bounds[3] && eAttachment.top === 'top') { - top -= height; - eAttachment.top = 'bottom'; - } - } - if (changeAttachX === 'element' || changeAttachX === 'both') { - if (left < bounds[0] && eAttachment.left === 'right') { - left += width; - eAttachment.left = 'left'; - } - if (left + width > bounds[2] && eAttachment.left === 'left') { - left -= width; - eAttachment.left = 'right'; - } - } - if (typeof pin === 'string') { - pin = (function() { - var _len4, _m, _ref7, _results; - _ref7 = pin.split(','); - _results = []; - for (_m = 0, _len4 = _ref7.length; _m < _len4; _m++) { - p = _ref7[_m]; - _results.push(p.trim()); - } - return _results; - })(); - } else if (pin === true) { - pin = ['top', 'left', 'right', 'bottom']; - } - pin || (pin = []); - pinned = []; - oob = []; - if (top < bounds[1]) { - if (__indexOf.call(pin, 'top') >= 0) { - top = bounds[1]; - pinned.push('top'); - } else { - oob.push('top'); - } - } - if (top + height > bounds[3]) { - if (__indexOf.call(pin, 'bottom') >= 0) { - top = bounds[3] - height; - pinned.push('bottom'); - } else { - oob.push('bottom'); - } - } - if (left < bounds[0]) { - if (__indexOf.call(pin, 'left') >= 0) { - left = bounds[0]; - pinned.push('left'); - } else { - oob.push('left'); - } - } - if (left + width > bounds[2]) { - if (__indexOf.call(pin, 'right') >= 0) { - left = bounds[2] - width; - pinned.push('right'); - } else { - oob.push('right'); - } - } - if (pinned.length) { - pinnedClass = (_ref7 = this.options.pinnedClass) != null ? _ref7 : this.getClass('pinned'); - addClasses.push(pinnedClass); - for (_m = 0, _len4 = pinned.length; _m < _len4; _m++) { - side = pinned[_m]; - addClasses.push("" + pinnedClass + "-" + side); - } - } - if (oob.length) { - oobClass = (_ref8 = this.options.outOfBoundsClass) != null ? _ref8 : this.getClass('out-of-bounds'); - addClasses.push(oobClass); - for (_n = 0, _len5 = oob.length; _n < _len5; _n++) { - side = oob[_n]; - addClasses.push("" + oobClass + "-" + side); - } - } - if (__indexOf.call(pinned, 'left') >= 0 || __indexOf.call(pinned, 'right') >= 0) { - eAttachment.left = tAttachment.left = false; - } - if (__indexOf.call(pinned, 'top') >= 0 || __indexOf.call(pinned, 'bottom') >= 0) { - eAttachment.top = tAttachment.top = false; - } - if (tAttachment.top !== targetAttachment.top || tAttachment.left !== targetAttachment.left || eAttachment.top !== this.attachment.top || eAttachment.left !== this.attachment.left) { - this.updateAttachClasses(eAttachment, tAttachment); - } - } - defer(function() { - updateClasses(_this.target, addClasses, allClasses); - return updateClasses(_this.element, addClasses, allClasses); - }); - return { - top: top, - left: left - }; - } - }); - - }).call(this); - - (function() { - var defer, getBounds, updateClasses, _ref; - - _ref = this.Tether.Utils, getBounds = _ref.getBounds, updateClasses = _ref.updateClasses, defer = _ref.defer; - - this.Tether.modules.push({ - position: function(_arg) { - var abutted, addClasses, allClasses, bottom, height, left, right, side, sides, targetPos, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref1, _ref2, _ref3, _ref4, _ref5, - _this = this; - top = _arg.top, left = _arg.left; - _ref1 = this.cache('element-bounds', function() { - return getBounds(_this.element); - }), height = _ref1.height, width = _ref1.width; - targetPos = this.getTargetBounds(); - bottom = top + height; - right = left + width; - abutted = []; - if (top <= targetPos.bottom && bottom >= targetPos.top) { - _ref2 = ['left', 'right']; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - side = _ref2[_i]; - if ((_ref3 = targetPos[side]) === left || _ref3 === right) { - abutted.push(side); - } - } - } - if (left <= targetPos.right && right >= targetPos.left) { - _ref4 = ['top', 'bottom']; - for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) { - side = _ref4[_j]; - if ((_ref5 = targetPos[side]) === top || _ref5 === bottom) { - abutted.push(side); - } - } - } - allClasses = []; - addClasses = []; - sides = ['left', 'top', 'right', 'bottom']; - allClasses.push(this.getClass('abutted')); - for (_k = 0, _len2 = sides.length; _k < _len2; _k++) { - side = sides[_k]; - allClasses.push("" + (this.getClass('abutted')) + "-" + side); - } - if (abutted.length) { - addClasses.push(this.getClass('abutted')); - } - for (_l = 0, _len3 = abutted.length; _l < _len3; _l++) { - side = abutted[_l]; - addClasses.push("" + (this.getClass('abutted')) + "-" + side); - } - defer(function() { - updateClasses(_this.target, addClasses, allClasses); - return updateClasses(_this.element, addClasses, allClasses); - }); - return true; - } - }); - - }).call(this); - - (function() { - this.Tether.modules.push({ - position: function(_arg) { - var left, result, shift, shiftLeft, shiftTop, top, _ref; - top = _arg.top, left = _arg.left; - if (!this.options.shift) { - return; - } - result = function(val) { - if (typeof val === 'function') { - return val.call(this, { - top: top, - left: left - }); - } else { - return val; - } - }; - shift = result(this.options.shift); - if (typeof shift === 'string') { - shift = shift.split(' '); - shift[1] || (shift[1] = shift[0]); - shiftTop = shift[0], shiftLeft = shift[1]; - shiftTop = parseFloat(shiftTop, 10); - shiftLeft = parseFloat(shiftLeft, 10); - } else { - _ref = [shift.top, shift.left], shiftTop = _ref[0], shiftLeft = _ref[1]; - } - top += shiftTop; - left += shiftLeft; - return { - top: top, - left: left - }; - } - }); - - }).call(this); - - return this.Tether; - - })); - - -/***/ }, -/* 2 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var React = __webpack_require__(12); - var cloneWithProps = __webpack_require__(27); - var foundationApi = __webpack_require__(14); - - var ActionSheet = React.createClass({ - displayName: 'ActionSheet', - - getInitialState: function getInitialState() { - return { active: false }; - }, - setActiveState: function setActiveState(active) { - this.setState({ active: active }); - }, - onBodyClick: function onBodyClick(e) { - var el = e.target; - var insideActionSheet = false; - - do { - if (el.classList && el.classList.contains('action-sheet-container')) { - insideActionSheet = true; - break; - } - } while (el = el.parentNode); - - if (!insideActionSheet) { - this.setActiveState(false); - } - }, - componentDidMount: function componentDidMount() { - if (this.props.id) { - foundationApi.subscribe(this.props.id, (function (name, msg) { - if (msg === 'open') { - this.setState({ active: true }); - } else if (msg === 'close') { - this.setState({ active: false }); - } else if (msg === 'toggle') { - this.setState({ active: !this.state.active }); - } - }).bind(this)); - } - document.body.addEventListener('click', this.onBodyClick); - }, - componentWillUnmount: function componentWillUnmount() { - if (this.props.id) foundationApi.unsubscribe(this.props.id); - document.body.removeEventListener('click', this.onBodyClick); - }, - render: function render() { - var children = React.Children.map(this.props.children, (function (child, index) { - var extraProps = { active: this.state.active }; - if (child.type.displayName === 'ActionSheetButton') { - extraProps.setActiveState = this.setActiveState; - } - return cloneWithProps(child, extraProps); - }).bind(this)); - return React.createElement( - 'div', - { id: this.props.id, 'data-closable': true, className: 'action-sheet-container' }, - children - ); - } - }); - - module.exports = ActionSheet; - ActionSheet.Button = __webpack_require__(15); - ActionSheet.Content = __webpack_require__(16); - -/***/ }, -/* 3 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var React = __webpack_require__(12); - var ExecutionEnvironment = __webpack_require__(28); - var IconicJs = ExecutionEnvironment.canUseDOM && __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"../vendor/iconic.min\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())); - var cloneWithProps = __webpack_require__(27); - - var Iconic = React.createClass({ - displayName: 'Iconic', - - inject: function inject() { - var ico = IconicJs(); - ico.inject(this.getDOMNode()); - }, - componentDidMount: function componentDidMount() { - this.inject(); - }, - componentDidUpdate: function componentDidUpdate() { - this.inject(); - }, - render: function render() { - return React.Children.only(this.props.children); - } - }); - - module.exports = Iconic; - -/***/ }, -/* 4 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var React = __webpack_require__(12); - var ResponsiveMixin = __webpack_require__(22); - - var namedQueries = {}; + // forcing token as String, to allow for future expansions without breaking usage + // and allow for easy use as key names for the 'messages' object + var token = 'uid_' + String(++lastUid); + messages[message][token] = func; - var Interchange = React.createClass({ - displayName: 'Interchange', + // return token for unsubscribing + return token; + }; - mixins: [ResponsiveMixin], - getInitialState: function getInitialState() { - return { matchedMedia: 'large' }; - }, - componentDidMount: function componentDidMount() { - // for (var name in namedQueries) { - // this.media(namedQueries[name], function () { - // this.setState({matchedMedia: name}); - // }.bind(this)); - // } - this.media({ minWidth: 0, maxWidth: 640 }, (function () { - this.setState({ matchedMedia: 'small' }); - }).bind(this)); - this.media({ minWidth: 641, maxWidth: 1200 }, (function () { - this.setState({ matchedMedia: 'medium' }); - }).bind(this)); - this.media({ minWidth: 1200, maxWidth: 1440 }, (function () { - this.setState({ matchedMedia: 'large' }); - }).bind(this)); - }, - render: function render() { - var matchedNode = null; - React.Children.forEach(this.props.children, (function (child) { - if (child.props.media === this.state.matchedMedia) { - matchedNode = child; - } - }).bind(this)); - return matchedNode; - } - }); + /* Public: Clears all subscriptions + */ + PubSub.clearAllSubscriptions = function clearAllSubscriptions(){ + messages = {}; + }; - module.exports = Interchange; + /*Public: Clear subscriptions by the topic + */ + PubSub.clearSubscriptions = function clearSubscriptions(topic){ + var m; + for (m in messages){ + if (messages.hasOwnProperty(m) && m.indexOf(topic) === 0){ + delete messages[m]; + } + } + }; - // small: '(min-width: 0) and (max-width: 640px)', - // medium: '(min-width: 641px) and (max-width: 1200px)', - // large: '(min-width: 1201px) and (max-width: 1440px)', - // 'default' : 'only screen', - // landscape : 'only screen and (orientation: landscape)', - // portrait : 'only screen and (orientation: portrait)', - // retina : 'only screen and (-webkit-min-device-pixel-ratio: 2),' + - // 'only screen and (min--moz-device-pixel-ratio: 2),' + - // 'only screen and (-o-min-device-pixel-ratio: 2/1),' + - // 'only screen and (min-device-pixel-ratio: 2),' + - // 'only screen and (min-resolution: 192dpi),' + - // 'only screen and (min-resolution: 2dppx)' + /* Public: removes subscriptions. + * When passed a token, removes a specific subscription. + * When passed a function, removes all subscriptions for that function + * When passed a topic, removes all subscriptions for that topic (hierarchy) + * + * value - A token, function or topic to unsubscribe. + * + * Examples + * + * // Example 1 - unsubscribing with a token + * var token = PubSub.subscribe('mytopic', myFunc); + * PubSub.unsubscribe(token); + * + * // Example 2 - unsubscribing with a function + * PubSub.unsubscribe(myFunc); + * + * // Example 3 - unsubscribing a topic + * PubSub.unsubscribe('mytopic'); + */ + PubSub.unsubscribe = function(value){ + var isTopic = typeof value === 'string' && messages.hasOwnProperty(value), + isToken = !isTopic && typeof value === 'string', + isFunction = typeof value === 'function', + result = false, + m, message, t; -/***/ }, -/* 5 */ -/***/ function(module, exports, __webpack_require__) { + if (isTopic){ + delete messages[value]; + return; + } - 'use strict'; + for ( m in messages ){ + if ( messages.hasOwnProperty( m ) ){ + message = messages[m]; - var React = __webpack_require__(12); - var cx = __webpack_require__(29); - var Animation = __webpack_require__(17); - var foundationApi = __webpack_require__(14); + if ( isToken && message[value] ){ + delete message[value]; + result = value; + // tokens are unique, so we can just stop here + break; + } - var Modal = React.createClass({ - displayName: 'Modal', + if (isFunction) { + for ( t in message ){ + if (message.hasOwnProperty(t) && message[t] === value){ + delete message[t]; + result = true; + } + } + } + } + } - getInitialState: function getInitialState() { - return { open: false }; - }, - getDefaultProps: function getDefaultProps() { - return { - overlay: true, - overlayClose: true, - animationIn: 'fadeIn', - animationOut: 'fadeOut' - }; - }, - componentDidMount: function componentDidMount() { - foundationApi.subscribe(this.props.id, (function (name, msg) { - if (msg === 'open') { - this.setState({ open: true }); - } else if (msg === 'close') { - this.setState({ open: false }); - } else if (msg === 'toggle') { - this.setState({ open: !this.state.open }); - } - }).bind(this)); - }, - componentWillUnmount: function componentWillUnmount() { - foundationApi.unsubscribe(this.props.id); - }, - hideOverlay: function hideOverlay(e) { - e.preventDefault(); - if (this.props.overlayClose) { - this.setState({ open: false }); - } - }, - stopClickPropagation: function stopClickPropagation(e) { - e.preventDefault(); - e.stopPropagation(); - }, - render: function render() { - var overlayStyle = {}; - if (!this.props.overlay) { - overlayStyle.background = 'transparent'; - } - return React.createElement( - Animation, - { active: this.state.open, animationIn: 'fadeIn', animationOut: 'fadeOut' }, - React.createElement( - 'div', - { className: 'modal-overlay', style: overlayStyle, onClick: this.hideOverlay }, - React.createElement( - Animation, - { - active: this.state.open, - animationIn: this.props.animationIn, - animationOut: this.props.animationOut - }, - React.createElement( - 'div', - { id: this.props.id, 'data-closable': true, className: 'modal', onClick: this.stopClickPropagation }, - this.props.children - ) - ) - ) - ); - } - }); + return result; + }; + })); - module.exports = Modal; /***/ }, -/* 6 */ -/***/ function(module, exports, __webpack_require__) { +/* 7 */ +/***/ function(module, exports) { 'use strict'; - module.exports = { - Set: __webpack_require__(18), - Static: __webpack_require__(19) - }; + function ToObject(val) { + if (val == null) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } -/***/ }, -/* 7 */ -/***/ function(module, exports, __webpack_require__) { + return Object(val); + } - 'use strict'; + module.exports = Object.assign || function (target, source) { + var from; + var keys; + var to = ToObject(target); - var React = __webpack_require__(12); - var cx = __webpack_require__(29); - // var LayerMixin = require('react-layer-mixin'); - var foundationApi = __webpack_require__(14); + for (var s = 1; s < arguments.length; s++) { + from = arguments[s]; + keys = Object.keys(Object(from)); - var Offcanvas = React.createClass({ - displayName: 'Offcanvas', + for (var i = 0; i < keys.length; i++) { + to[keys[i]] = from[keys[i]]; + } + } - // mixins: [LayerMixin], - getInitialState: function getInitialState() { - return { open: false }; - }, - getDefaultProps: function getDefaultProps() { - return { - position: 'left' - }; - }, - componentDidMount: function componentDidMount() { - foundationApi.subscribe(this.props.id, (function (name, msg) { - if (msg === 'open') { - this.setState({ open: true }); - } else if (msg === 'close') { - this.setState({ open: false }); - } else if (msg === 'toggle') { - this.setState({ open: !this.state.open }); - } - }).bind(this)); - }, - componentWillUnmount: function componentWillUnmount() { - foundationApi.unsubscribe(this.props.id); - }, - render: function render() { - var classes = { - 'off-canvas': true, - 'is-active': this.state.open - }; - classes[this.props.position] = true; - if (this.props.className) { - classes[this.props.className] = true; - } - return React.createElement( - 'div', - { id: this.props.id, 'data-closable': true, className: cx(classes) }, - this.props.children - ); - } - }); + return to; + }; - module.exports = Offcanvas; /***/ }, /* 8 */ @@ -1848,68 +590,37 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - var React = __webpack_require__(12); - var cx = __webpack_require__(29); - var Animation = __webpack_require__(17); - var foundationApi = __webpack_require__(14); + var React = __webpack_require__(2); - var Panel = React.createClass({ - displayName: 'Panel', + var ActionSheetButton = React.createClass({ + displayName: 'ActionSheetButton', - getInitialState: function getInitialState() { - return { open: false }; - }, - getDefaultProps: function getDefaultProps() { - return { - position: 'left' - }; - }, - componentDidMount: function componentDidMount() { - foundationApi.subscribe(this.props.id, (function (name, msg) { - if (msg === 'open') { - this.setState({ open: true }); - } else if (msg === 'close') { - this.setState({ open: false }); - } else if (msg === 'toggle') { - this.setState({ open: !this.state.open }); - } - }).bind(this)); - }, - componentWillUnmount: function componentWillUnmount() { - foundationApi.unsubscribe(this.props.id); + toggle: function toggle() { + this.props.setActiveState(!this.props.active); }, render: function render() { - var animationIn, animationOut; - var classes = 'panel panel-' + this.props.position; - if (this.props.className) { - classes += ' ' + this.props.className; - } - if (this.props.position === 'left') { - animationIn = this.props.animationIn || 'slideInRight'; - animationOut = this.props.animationOut || 'slideOutLeft'; - } else if (this.props.position === 'right') { - animationIn = this.props.animationIn || 'slideInLeft'; - animationOut = this.props.animationOut || 'slideOutRight'; - } else if (this.props.position === 'top') { - animationIn = this.props.animationIn || 'slideInDown'; - animationOut = this.props.animationOut || 'slideOutUp'; - } else if (this.props.position === 'bottom') { - animationIn = this.props.animationIn || 'slideInUp'; - animationOut = this.props.animationOut || 'slideOutBottom'; + var Title = null; + if (this.props.title.length > 0) { + Title = React.createElement( + 'a', + { className: 'button' }, + this.props.title + ); } return React.createElement( - Animation, - { active: this.state.open, animationIn: animationIn, animationOut: animationOut }, + 'div', + { onClick: this.toggle }, + Title, React.createElement( 'div', - { 'data-closable': true, id: this.props.id, className: classes }, + null, this.props.children ) ); } }); - module.exports = Panel; + module.exports = ActionSheetButton; /***/ }, /* 9 */ @@ -1917,68 +628,29 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - var React = __webpack_require__(12); - var cx = __webpack_require__(29); - var ExecutionEnvironment = __webpack_require__(28); - var foundationApi = __webpack_require__(14); - var Tether = ExecutionEnvironment.canUseDOM && __webpack_require__(1); - - var Popup = React.createClass({ - displayName: 'Popup', + var React = __webpack_require__(2); + var classnames = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"classnames\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())); - getInitialState: function getInitialState() { - return { - active: false, - tetherInit: false - }; - }, - getDefaultProps: function getDefaultProps() { - return { - pinTo: 'top center', - pinAt: '' - }; - }, - componentDidMount: function componentDidMount() { - this.tether = {}; - foundationApi.subscribe(this.props.id, (function (name, msg) { - if (msg[0] === 'toggle') { - this.toggle(msg[1]); - } - }).bind(this)); - }, - toggle: function toggle(target) { - var active = !this.state.active; - this.setState({ active: active }, (function () { - if (active) { - this.tetherElement(target); - } else { - this.tether.destroy(); - } - }).bind(this)); - }, - tetherElement: function tetherElement(target) { - var targetElement = document.getElementById(target); - var attachment = 'top center'; - this.tether = new Tether({ - element: this.getDOMNode(), - target: targetElement, - attachment: attachment - }); + var ActionSheetContent = React.createClass({ + displayName: 'ActionSheetContent', + + getDefaultProps: function getDefaultProps() { + return { position: 'bottom' }; }, render: function render() { var classes = { - popup: true, - 'is-active': this.state.active + 'action-sheet': true, + 'is-active': this.props.active }; return React.createElement( 'div', - { id: this.props.id, className: cx(classes), 'data-closable': 'popup' }, + { className: classnames(classes) }, this.props.children ); } }); - module.exports = Popup; + module.exports = ActionSheetContent; /***/ }, /* 10 */ @@ -1986,48 +658,30 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - var React = __webpack_require__(12); - var cloneWithProps = __webpack_require__(27); + var React = __webpack_require__(2); + var ReactDOM = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"react-dom\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())); + var ExecutionEnvironment = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"react/lib/ExecutionEnvironment\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())); + var IconicJs = ExecutionEnvironment.canUseDOM && __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"../vendor/iconic.min\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())); - var Tabs = React.createClass({ - displayName: 'Tabs', + var Iconic = React.createClass({ + displayName: 'Iconic', - getInitialState: function getInitialState() { - return { - selectedTab: 0, - content: null - }; + inject: function inject() { + var ico = IconicJs(); + ico.inject(ReactDOM.findDOMNode(this)); }, - selectTab: function selectTab(options) { - this.setState(options); + componentDidMount: function componentDidMount() { + this.inject(); + }, + componentDidUpdate: function componentDidUpdate() { + this.inject(); }, render: function render() { - var children = React.Children.map(this.props.children, (function (child, index) { - return cloneWithProps(child, { - active: index === this.state.selectedTab, - index: index, - selectTab: this.selectTab - }); - }).bind(this)); - return React.createElement( - 'div', - null, - React.createElement( - 'div', - { className: 'tabs' }, - children - ), - React.createElement( - 'div', - null, - this.state.content - ) - ); + return React.Children.only(this.props.children); } }); - module.exports = Tabs; - Tabs.Tab = __webpack_require__(20); + module.exports = Iconic; /***/ }, /* 11 */ @@ -2035,253 +689,576 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - var React = __webpack_require__(12); - var cloneWithProps = __webpack_require__(27); - var foundationApi = __webpack_require__(14); - var PopupToggle = __webpack_require__(21); + var React = __webpack_require__(2); + var ResponsiveMixin = __webpack_require__(12); + + var namedQueries = { + // small: '(min-width: 0) and (max-width: 640px)', + // medium: '(min-width: 641px) and (max-width: 1200px)', + // large: '(min-width: 1201px) and (max-width: 1440px)', + // 'default' : 'only screen', + // landscape : 'only screen and (orientation: landscape)', + // portrait : 'only screen and (orientation: portrait)', + // retina : 'only screen and (-webkit-min-device-pixel-ratio: 2),' + + // 'only screen and (min--moz-device-pixel-ratio: 2),' + + // 'only screen and (-o-min-device-pixel-ratio: 2/1),' + + // 'only screen and (min-device-pixel-ratio: 2),' + + // 'only screen and (min-resolution: 192dpi),' + + // 'only screen and (min-resolution: 2dppx)' + }; - var Trigger = React.createClass({ - displayName: 'Trigger', + var Interchange = React.createClass({ + displayName: 'Interchange', + + mixins: [ResponsiveMixin], + getInitialState: function getInitialState() { + return { matchedMedia: 'large' }; + }, + componentDidMount: function componentDidMount() { + // for (var name in namedQueries) { + // this.media(namedQueries[name], function () { + // this.setState({matchedMedia: name}); + // }.bind(this)); + // } + this.media({ minWidth: 0, maxWidth: 640 }, (function () { + this.setState({ matchedMedia: 'small' }); + }).bind(this)); + this.media({ minWidth: 641, maxWidth: 1200 }, (function () { + this.setState({ matchedMedia: 'medium' }); + }).bind(this)); + this.media({ minWidth: 1200, maxWidth: 1440 }, (function () { + this.setState({ matchedMedia: 'large' }); + }).bind(this)); + }, + render: function render() { + var matchedNode = null; + React.Children.forEach(this.props.children, (function (child) { + if (child.props.media === this.state.matchedMedia) { + matchedNode = child; + } + }).bind(this)); + return matchedNode; + } + }); + + module.exports = Interchange; + +/***/ }, +/* 12 */ +/***/ function(module, exports, __webpack_require__) { + + var canUseDOM = __webpack_require__(13); + var enquire = canUseDOM && __webpack_require__(14); + var json2mq = __webpack_require__(15); + + var ResponsiveMixin = { + media: function (query, handler) { + query = json2mq(query); + if (typeof handler === 'function') { + handler = { + match: handler + }; + } + enquire.register(query, handler); + + // Queue the handlers to unregister them at unmount + if (! this._responsiveMediaHandlers) { + this._responsiveMediaHandlers = []; + } + this._responsiveMediaHandlers.push({query: query, handler: handler}); + }, + componentWillUnmount: function () { + if (this._responsiveMediaHandlers) { + this._responsiveMediaHandlers.forEach(function(obj) { + enquire.unregister(obj.query, obj.handler); + }); + } + } + }; + + module.exports = ResponsiveMixin; + +/***/ }, +/* 13 */ +/***/ function(module, exports) { + + var canUseDOM = !!( + typeof window !== 'undefined' && + window.document && + window.document.createElement + ); + + module.exports = canUseDOM; + +/***/ }, +/* 14 */ +/***/ function(module, exports, __webpack_require__) { + + var __WEBPACK_AMD_DEFINE_RESULT__;/*! + * enquire.js v2.1.1 - Awesome Media Queries in JavaScript + * Copyright (c) 2014 Nick Williams - http://wicky.nillia.ms/enquire.js + * License: MIT (http://www.opensource.org/licenses/mit-license.php) + */ + + ;(function (name, context, factory) { + var matchMedia = window.matchMedia; + + if (typeof module !== 'undefined' && module.exports) { + module.exports = factory(matchMedia); + } + else if (true) { + !(__WEBPACK_AMD_DEFINE_RESULT__ = function() { + return (context[name] = factory(matchMedia)); + }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } + else { + context[name] = factory(matchMedia); + } + }('enquire', this, function (matchMedia) { + + 'use strict'; + + /*jshint unused:false */ + /** + * Helper function for iterating over a collection + * + * @param collection + * @param fn + */ + function each(collection, fn) { + var i = 0, + length = collection.length, + cont; + + for(i; i < length; i++) { + cont = fn(collection[i], i); + if(cont === false) { + break; //allow early exit + } + } + } + + /** + * Helper function for determining whether target object is an array + * + * @param target the object under test + * @return {Boolean} true if array, false otherwise + */ + function isArray(target) { + return Object.prototype.toString.apply(target) === '[object Array]'; + } + + /** + * Helper function for determining whether target object is a function + * + * @param target the object under test + * @return {Boolean} true if function, false otherwise + */ + function isFunction(target) { + return typeof target === 'function'; + } + + /** + * Delegate to handle a media query being matched and unmatched. + * + * @param {object} options + * @param {function} options.match callback for when the media query is matched + * @param {function} [options.unmatch] callback for when the media query is unmatched + * @param {function} [options.setup] one-time callback triggered the first time a query is matched + * @param {boolean} [options.deferSetup=false] should the setup callback be run immediately, rather than first time query is matched? + * @constructor + */ + function QueryHandler(options) { + this.options = options; + !options.deferSetup && this.setup(); + } + QueryHandler.prototype = { + + /** + * coordinates setup of the handler + * + * @function + */ + setup : function() { + if(this.options.setup) { + this.options.setup(); + } + this.initialised = true; + }, + + /** + * coordinates setup and triggering of the handler + * + * @function + */ + on : function() { + !this.initialised && this.setup(); + this.options.match && this.options.match(); + }, + + /** + * coordinates the unmatch event for the handler + * + * @function + */ + off : function() { + this.options.unmatch && this.options.unmatch(); + }, + + /** + * called when a handler is to be destroyed. + * delegates to the destroy or unmatch callbacks, depending on availability. + * + * @function + */ + destroy : function() { + this.options.destroy ? this.options.destroy() : this.off(); + }, + + /** + * determines equality by reference. + * if object is supplied compare options, if function, compare match callback + * + * @function + * @param {object || function} [target] the target for comparison + */ + equals : function(target) { + return this.options === target || this.options.match === target; + } - getDefaultProps: function getDefaultProps() { - return { - open: null, - close: null, - toggle: null, - hardToggle: null, - popupToggle: null, - notify: null }; - }, - getCloseId: function getCloseId() { - if (this.props.close) { - return this.props.close; - } else { - var parentElement = false; - var tempElement = this.getDOMNode().parentNode; - while (parentElement === false) { - if (tempElement.nodeName == 'BODY') { - parentElement = ''; - } - if (typeof tempElement.getAttribute('data-closable') !== 'undefined' && tempElement.getAttribute('data-closable') !== false) { - parentElement = tempElement; - } + /** + * Represents a single media query, manages it's state and registered handlers for this query + * + * @constructor + * @param {string} query the media query string + * @param {boolean} [isUnconditional=false] whether the media query should run regardless of whether the conditions are met. Primarily for helping older browsers deal with mobile-first design + */ + function MediaQuery(query, isUnconditional) { + this.query = query; + this.isUnconditional = isUnconditional; + this.handlers = []; + this.mql = matchMedia(query); - tempElement = tempElement.parentNode; - } - return parentElement.getAttribute('id'); - } - }, - clickHandler: function clickHandler(e) { - e.preventDefault(); - if (this.props.open) { - foundationApi.publish(this.props.open, 'open'); - } else if (this.props.close !== null) { - foundationApi.publish(this.getCloseId(), 'close'); - } else if (this.props.toggle) { - foundationApi.publish(this.props.toggle, 'toggle'); - } else if (this.props.hardToggle) { - foundationApi.closeActiveElements({ exclude: this.props.hardToggle }); - foundationApi.publish(this.props.hardToggle, 'toggle'); - } else if (this.props.notify) { - foundationApi.publish(this.props.notify, { - title: this.props.title, - content: this.props.content, - position: this.props.position, - color: this.props.color, - image: this.props.image - }); - } - }, - render: function render() { - if (this.props.popupToggle) { - return React.createElement(PopupToggle, this.props); - } else { - var child = React.Children.only(this.props.children); - return cloneWithProps(child, { - onClick: this.clickHandler - }); + var self = this; + this.listener = function(mql) { + self.mql = mql; + self.assess(); + }; + this.mql.addListener(this.listener); } - } - }); - - module.exports = Trigger; + MediaQuery.prototype = { -/***/ }, -/* 12 */ -/***/ function(module, exports, __webpack_require__) { + /** + * add a handler for this query, triggering if already active + * + * @param {object} handler + * @param {function} handler.match callback for when query is activated + * @param {function} [handler.unmatch] callback for when query is deactivated + * @param {function} [handler.setup] callback for immediate execution when a query handler is registered + * @param {boolean} [handler.deferSetup=false] should the setup callback be deferred until the first time the handler is matched? + */ + addHandler : function(handler) { + var qh = new QueryHandler(handler); + this.handlers.push(qh); - module.exports = __WEBPACK_EXTERNAL_MODULE_12__; + this.matches() && qh.on(); + }, -/***/ }, -/* 13 */ -/***/ function(module, exports, __webpack_require__) { + /** + * removes the given handler from the collection, and calls it's destroy methods + * + * @param {object || function} handler the handler to remove + */ + removeHandler : function(handler) { + var handlers = this.handlers; + each(handlers, function(h, i) { + if(h.equals(handler)) { + h.destroy(); + return !handlers.splice(i,1); //remove from array and exit each early + } + }); + }, - 'use strict'; + /** + * Determine whether the media query should be considered a match + * + * @return {Boolean} true if media query can be considered a match, false otherwise + */ + matches : function() { + return this.mql.matches || this.isUnconditional; + }, - var React = __webpack_require__(12); - var cx = __webpack_require__(29); + /** + * Clears all handlers and unbinds events + */ + clear : function() { + each(this.handlers, function(handler) { + handler.destroy(); + }); + this.mql.removeListener(this.listener); + this.handlers.length = 0; //clear array + }, - var AccordionItem = React.createClass({ - displayName: 'AccordionItem', + /* + * Assesses the query, turning on all handlers if it matches, turning them off if it doesn't match + */ + assess : function() { + var action = this.matches() ? 'on' : 'off'; - render: function render() { - var itemClasses = { - 'accordion-item': true, - 'is-active': this.props.active + each(this.handlers, function(handler) { + handler[action](); + }); + } }; - return React.createElement( - 'div', - { className: cx(itemClasses) }, - React.createElement( - 'div', - { className: 'accordion-title', onClick: this.props.activate }, - this.props.title - ), - React.createElement( - 'div', - { className: 'accordion-content' }, - this.props.children - ) - ); - } - }); + /** + * Allows for registration of query handlers. + * Manages the query handler's state and is responsible for wiring up browser events + * + * @constructor + */ + function MediaQueryDispatch () { + if(!matchMedia) { + throw new Error('matchMedia not present, legacy browsers require a polyfill'); + } - module.exports = AccordionItem; + this.queries = {}; + this.browserIsIncapable = !matchMedia('only all').matches; + } -/***/ }, -/* 14 */ -/***/ function(module, exports, __webpack_require__) { + MediaQueryDispatch.prototype = { - //From https://github.com/zurb/foundation-apps/blob/master/js/angular/common/common.services.js - 'use strict'; + /** + * Registers a handler for the given media query + * + * @param {string} q the media query + * @param {object || Array || Function} options either a single query handler object, a function, or an array of query handlers + * @param {function} options.match fired when query matched + * @param {function} [options.unmatch] fired when a query is no longer matched + * @param {function} [options.setup] fired when handler first triggered + * @param {boolean} [options.deferSetup=false] whether setup should be run immediately or deferred until query is first matched + * @param {boolean} [shouldDegrade=false] whether this particular media query should always run on incapable browsers + */ + register : function(q, options, shouldDegrade) { + var queries = this.queries, + isUnconditional = shouldDegrade && this.browserIsIncapable; - var PubSub = __webpack_require__(26); - var assign = __webpack_require__(25); + if(!queries[q]) { + queries[q] = new MediaQuery(q, isUnconditional); + } - var listeners = []; - var settings = {}; - var uniqueIds = []; + //normalise to object in an array + if(isFunction(options)) { + options = { match : options }; + } + if(!isArray(options)) { + options = [options]; + } + each(options, function(handler) { + queries[q].addHandler(handler); + }); - var foundationApi = { - subscribe: PubSub.subscribe, - publish: PubSub.publish, - unsubscribe: PubSub.unsubscribe, - closeActiveElements: function closeActiveElements(options) { - var self = this; - options = options || {}; - var activeElements = document.querySelectorAll('.is-active[data-closable]'); - Array.prototype.forEach.call(activeElements, function (el) { - if (options.exclude !== el.id) { - self.publish(el.id, 'close'); - } - }); - }, - getSettings: function getSettings() { - return settings; - }, - modifySettings: function modifySettings(tree) { - settings = angular.extend(settings, tree); - return settings; - }, - generateUuid: function generateUuid() { - var uuid = ''; + return this; + }, + + /** + * unregisters a query and all it's handlers, or a specific handler for a query + * + * @param {string} q the media query to target + * @param {object || function} [handler] specific handler to unregister + */ + unregister : function(q, handler) { + var query = this.queries[q]; + + if(query) { + if(handler) { + query.removeHandler(handler); + } + else { + query.clear(); + delete this.queries[q]; + } + } - //little trick to produce semi-random IDs - do { - uuid += 'zf-uuid-'; - for (var i = 0; i < 15; i++) { - uuid += Math.floor(Math.random() * 16).toString(16); - } - } while (!uniqueIds.indexOf(uuid)); + return this; + } + }; - uniqueIds.push(uuid); - return uuid; - } - }; + return new MediaQueryDispatch(); - module.exports = foundationApi; + })); /***/ }, /* 15 */ /***/ function(module, exports, __webpack_require__) { - 'use strict'; - - var React = __webpack_require__(12); + var camel2hyphen = __webpack_require__(16); - var ActionSheetButton = React.createClass({ - displayName: 'ActionSheetButton', + var isDimension = function (feature) { + var re = /[height|width]$/; + return re.test(feature); + }; - toggle: function toggle() { - this.props.setActiveState(!this.props.active); - }, - render: function render() { - var Title = null; - if (this.props.title.length > 0) { - Title = React.createElement( - 'a', - { className: 'button' }, - this.props.title - ); + var obj2mq = function (obj) { + var mq = ''; + var features = Object.keys(obj); + features.forEach(function (feature, index) { + var value = obj[feature]; + feature = camel2hyphen(feature); + // Add px to dimension features + if (isDimension(feature) && typeof value === 'number') { + value = value + 'px'; } - return React.createElement( - 'div', - { onClick: this.toggle }, - Title, - React.createElement( - 'div', - null, - this.props.children - ) - ); + if (value === true) { + mq += feature; + } else if (value === false) { + mq += 'not ' + feature; + } else { + mq += '(' + feature + ': ' + value + ')'; + } + if (index < features.length-1) { + mq += ' and ' + } + }); + return mq; + }; + + var json2mq = function (query) { + var mq = ''; + if (typeof query === 'string') { + return query; } - }); + // Handling array of media queries + if (query instanceof Array) { + query.forEach(function (q, index) { + mq += obj2mq(q); + if (index < query.length-1) { + mq += ', ' + } + }); + return mq; + } + // Handling single media query + return obj2mq(query); + }; - module.exports = ActionSheetButton; + module.exports = json2mq; /***/ }, /* 16 */ +/***/ function(module, exports) { + + var camel2hyphen = function (str) { + return str + .replace(/[A-Z]/g, function (match) { + return '-' + match.toLowerCase(); + }) + .toLowerCase(); + }; + + module.exports = camel2hyphen; + +/***/ }, +/* 17 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - var React = __webpack_require__(12); - var cx = __webpack_require__(29); + var React = __webpack_require__(2); + var Animation = __webpack_require__(18); + var foundationApi = __webpack_require__(5); - var ActionSheetContent = React.createClass({ - displayName: 'ActionSheetContent', + var Modal = React.createClass({ + displayName: 'Modal', + getInitialState: function getInitialState() { + return { open: false }; + }, getDefaultProps: function getDefaultProps() { - return { position: 'bottom' }; + return { + overlay: true, + overlayClose: true, + animationIn: 'fadeIn', + animationOut: 'fadeOut' + }; + }, + componentDidMount: function componentDidMount() { + this.subscribe(this.props.id); + }, + componentWillUnmount: function componentWillUnmount() { + foundationApi.unsubscribe(this.props.id); + }, + componentWillReceiveProps: function componentWillReceiveProps(nextProps) { + if (nextProps.id !== this.props.id) { + foundationApi.unsubscribe(this.props.id); + this.subscribe(nextProps.id); + } + }, + hideOverlay: function hideOverlay(e) { + e.preventDefault(); + if (this.props.overlayClose) { + this.setState({ open: false }); + } + }, + stopClickPropagation: function stopClickPropagation(e) { + e.preventDefault(); + e.stopPropagation(); + }, + subscribe: function subscribe(id) { + foundationApi.subscribe(id, (function (name, msg) { + if (msg === 'open') { + this.setState({ open: true }); + } else if (msg === 'close') { + this.setState({ open: false }); + } else if (msg === 'toggle') { + this.setState({ open: !this.state.open }); + } + }).bind(this)); }, render: function render() { - var classes = { - 'action-sheet': true, - 'is-active': this.props.active - }; + var overlayStyle = {}; + if (!this.props.overlay) { + overlayStyle.background = 'transparent'; + } return React.createElement( - 'div', - { className: cx(classes) }, - this.props.children + Animation, + { active: this.state.open, animationIn: 'fadeIn', animationOut: 'fadeOut' }, + React.createElement( + 'div', + { className: 'modal-overlay', style: overlayStyle, onClick: this.hideOverlay }, + React.createElement( + Animation, + { + active: this.state.open, + animationIn: this.props.animationIn, + animationOut: this.props.animationOut + }, + React.createElement( + 'div', + { id: this.props.id, 'data-closable': true, className: 'modal', onClick: this.stopClickPropagation }, + this.props.children + ) + ) + ) ); } }); - module.exports = ActionSheetContent; + module.exports = Modal; /***/ }, -/* 17 */ +/* 18 */ /***/ function(module, exports, __webpack_require__) { // some parts of code from react/lib/ReactCSSTransitionGroupChild.js 'use strict'; - var React = __webpack_require__(12); - var ReactTransitionEvents = __webpack_require__(30); - var CSSCore = __webpack_require__(31); - var cloneWithProps = __webpack_require__(27); - var cx = __webpack_require__(29); + var React = __webpack_require__(2); + var ReactDOM = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"react-dom\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())); + var ReactTransitionEvents = __webpack_require__(19); + var CSSCore = __webpack_require__(21); + + var classnames = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"classnames\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())); var TICK = 17; var Animation = React.createClass({ @@ -2310,14 +1287,14 @@ return /******/ (function(modules) { // webpackBootstrap CSSCore.removeClass(node, this.props.animationOut); }, finishAnimation: function finishAnimation() { - var node = this.getDOMNode(); + var node = ReactDOM.findDOMNode(this); this.reset(node); CSSCore.removeClass(node, this.props.active ? '' : 'is-active'); this.reflow(node); ReactTransitionEvents.removeEndEventListener(node, this.finishAnimation); }, animate: function animate(animationClass, animationType) { - var node = this.getDOMNode(); + var node = ReactDOM.findDOMNode(this); var initClass = 'ng-' + animationType; var activeClass = initClass + '-active'; @@ -2345,301 +1322,277 @@ return /******/ (function(modules) { // webpackBootstrap render: function render() { var child = React.Children.only(this.props.children); var extraProps = {}; - return cloneWithProps(child, extraProps); + return React.cloneElement(child, extraProps); } }); module.exports = Animation; /***/ }, -/* 18 */ +/* 19 */ /***/ function(module, exports, __webpack_require__) { - 'use strict'; - - var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + /** + * Copyright 2013-2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule ReactTransitionEvents + */ - var React = __webpack_require__(12); - var foundationApi = __webpack_require__(14); - var Notification = __webpack_require__(24); - var Animation = __webpack_require__(17); + 'use strict'; - var NotificationSet = React.createClass({ - displayName: 'NotificationSet', + var ExecutionEnvironment = __webpack_require__(20); - getInitialState: function getInitialState() { - return { notifications: [] }; - }, - componentDidMount: function componentDidMount() { - foundationApi.subscribe(this.props.id, (function (name, msg) { - if (msg === 'clearall') { - this.clearAll(); - } else { - this.addNotification(msg); - } - }).bind(this)); - }, - addNotification: function addNotification(notification) { - notification.id = foundationApi.generateUuid(); - var notifications = this.state.notifications.concat(notification); - this.setState({ - notifications: notifications - }); - }, - removeNotifcation: function removeNotifcation(id) { - return (function (e) { - var notifications = []; - this.state.notifications.forEach(function (notification) { - if (notification.id !== id) { - notifications.push(notification); - } - }); - this.setState({ - notifications: notifications - }); - e.preventDefault(); - }).bind(this); - }, - clearAll: function clearAll() { - this.setState({ notifications: [] }); - }, - render: function render() { - var notifications = this.state.notifications.map((function (notification) { - return React.createElement( - Notification, - _extends({ key: notification.id }, notification, { closeHandler: this.removeNotifcation(notification.id), className: 'is-active' }), - notification.content - ); - }).bind(this)); - return React.createElement( - 'div', - null, - notifications - ); + /** + * EVENT_NAME_MAP is used to determine which event fired when a + * transition/animation ends, based on the style property used to + * define that event. + */ + var EVENT_NAME_MAP = { + transitionend: { + 'transition': 'transitionend', + 'WebkitTransition': 'webkitTransitionEnd', + 'MozTransition': 'mozTransitionEnd', + 'OTransition': 'oTransitionEnd', + 'msTransition': 'MSTransitionEnd' + }, + + animationend: { + 'animation': 'animationend', + 'WebkitAnimation': 'webkitAnimationEnd', + 'MozAnimation': 'mozAnimationEnd', + 'OAnimation': 'oAnimationEnd', + 'msAnimation': 'MSAnimationEnd' } - }); + }; - module.exports = NotificationSet; + var endEvents = []; -/***/ }, -/* 19 */ -/***/ function(module, exports, __webpack_require__) { + function detectEvents() { + var testEl = document.createElement('div'); + var style = testEl.style; - 'use strict'; + // On some platforms, in particular some releases of Android 4.x, + // the un-prefixed "animation" and "transition" properties are defined on the + // style object but the events that fire will still be prefixed, so we need + // to check if the un-prefixed events are useable, and if not remove them + // from the map + if (!('AnimationEvent' in window)) { + delete EVENT_NAME_MAP.animationend.animation; + } - var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + if (!('TransitionEvent' in window)) { + delete EVENT_NAME_MAP.transitionend.transition; + } - var React = __webpack_require__(12); - var cx = __webpack_require__(29); - var foundationApi = __webpack_require__(14); - var Animation = __webpack_require__(17); - var Notification = __webpack_require__(24); + for (var baseEventName in EVENT_NAME_MAP) { + var baseEvents = EVENT_NAME_MAP[baseEventName]; + for (var styleName in baseEvents) { + if (styleName in style) { + endEvents.push(baseEvents[styleName]); + break; + } + } + } + } - var NotificationStatic = React.createClass({ - displayName: 'NotificationStatic', + if (ExecutionEnvironment.canUseDOM) { + detectEvents(); + } - getInitialState: function getInitialState() { - return { open: false }; - }, - componentDidMount: function componentDidMount() { - foundationApi.subscribe(this.props.id, (function (name, msg) { - if (msg === 'open') { - this.setState({ open: true }); - } else if (msg === 'close') { - this.setState({ open: false }); - } - }).bind(this)); - }, - componentWillUnmount: function componentWillUnmount() { - foundationApi.unsubscribe(this.props.id); - }, - closeHandler: function closeHandler(e) { - this.setState({ open: false }); - e.preventDefault(); - e.stopPropagation(); + // We use the raw {add|remove}EventListener() call because EventListener + // does not know how to remove event listeners and we really should + // clean up. Also, these events are not triggered in older browsers + // so we should be A-OK here. + + function addEventListener(node, eventName, eventListener) { + node.addEventListener(eventName, eventListener, false); + } + + function removeEventListener(node, eventName, eventListener) { + node.removeEventListener(eventName, eventListener, false); + } + + var ReactTransitionEvents = { + addEndEventListener: function (node, eventListener) { + if (endEvents.length === 0) { + // If CSS transitions are not supported, trigger an "end animation" + // event immediately. + window.setTimeout(eventListener, 0); + return; + } + endEvents.forEach(function (endEvent) { + addEventListener(node, endEvent, eventListener); + }); }, - render: function render() { - return React.createElement( - Animation, - { active: this.state.open, animationIn: 'fadeIn', animationOut: 'fadeOut' }, - React.createElement( - Notification, - _extends({}, this.props, { closeHandler: this.closeHandler }), - this.props.children - ) - ); + + removeEndEventListener: function (node, eventListener) { + if (endEvents.length === 0) { + return; + } + endEvents.forEach(function (endEvent) { + removeEventListener(node, endEvent, eventListener); + }); } - }); + }; - module.exports = NotificationStatic; + module.exports = ReactTransitionEvents; /***/ }, /* 20 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { + + /** + * Copyright 2013-2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule ExecutionEnvironment + */ 'use strict'; - var React = __webpack_require__(12); - var cx = __webpack_require__(29); + var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); - var Tab = React.createClass({ - displayName: 'Tab', + /** + * Simple, lightweight module assisting with the detection and context of + * Worker. Helps avoid circular dependencies and allows code to reason about + * whether or not they are in a Worker, even if they never include the main + * `ReactWorker` dependency. + */ + var ExecutionEnvironment = { - componentDidMount: function componentDidMount() { - if (this.props.active) { - this.select(); - } - }, - select: function select() { - var options = { - selectedTab: this.props.index, - content: this.props.children - }; - this.props.selectTab(options); - }, - render: function render() { - var classes = { - 'tab-item': true, - 'is-active': this.props.active - }; - return React.createElement( - 'div', - { className: cx(classes), onClick: this.select }, - this.props.title - ); - } - }); + canUseDOM: canUseDOM, - module.exports = Tab; + canUseWorkers: typeof Worker !== 'undefined', + + canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent), + + canUseViewport: canUseDOM && !!window.screen, + + isInWorker: !canUseDOM // For now, this is true - might change in the future. + + }; + + module.exports = ExecutionEnvironment; /***/ }, /* 21 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { 'use strict'; - var React = __webpack_require__(12); - var foundationApi = __webpack_require__(14); - var cloneWithProps = __webpack_require__(27); + var SPACE = ' '; + var RE_CLASS = /[\n\t\r]/g; - var PopupToggle = React.createClass({ - displayName: 'PopupToggle', + var norm = function norm(elemClass) { + return (SPACE + elemClass + SPACE).replace(RE_CLASS, SPACE); + }; - clickHandler: function clickHandler(id, e) { - e.preventDefault(); - foundationApi.publish(this.props.popupToggle, ['toggle', id]); + module.exports = { + addClass: function addClass(elem, className) { + elem.className += ' ' + className; }, - render: function render() { - var child = React.Children.only(this.props.children); - var id = this.props.id || foundationApi.generateUuid(); - return cloneWithProps(child, { - id: id, - onClick: this.clickHandler.bind(this, id) - }); - } - }); - module.exports = PopupToggle; + removeClass: function removeClass(elem, needle) { + var elemClass = elem.className.trim(); + var className = norm(elemClass); + needle = needle.trim(); + needle = SPACE + needle + SPACE; + while (className.indexOf(needle) >= 0) { + className = className.replace(needle, SPACE); + } + elem.className = className.trim(); + } + }; /***/ }, /* 22 */ /***/ function(module, exports, __webpack_require__) { - var canUseDOM = __webpack_require__(32); - var enquire = canUseDOM && __webpack_require__(34); - var json2mq = __webpack_require__(33); - - var ResponsiveMixin = { - media: function (query, handler) { - query = json2mq(query); - if (typeof handler === 'function') { - handler = { - match: handler - }; - } - enquire.register(query, handler); + 'use strict'; - // Queue the handlers to unregister them at unmount - if (! this._responsiveMediaHandlers) { - this._responsiveMediaHandlers = []; - } - this._responsiveMediaHandlers.push({query: query, handler: handler}); - }, - componentWillUnmount: function () { - this._responsiveMediaHandlers.forEach(function(obj) { - enquire.unregister(obj.query, obj.handler); - }); - } + module.exports = { + Set: __webpack_require__(23), + Static: __webpack_require__(25) }; - module.exports = ResponsiveMixin; - /***/ }, /* 23 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - var React = __webpack_require__(12); - var cloneWithProps = __webpack_require__(27); + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - var Accordion = React.createClass({ - displayName: 'Accordion', + var React = __webpack_require__(2); + var foundationApi = __webpack_require__(5); + var Notification = __webpack_require__(24); + var Animation = __webpack_require__(18); + + var NotificationSet = React.createClass({ + displayName: 'NotificationSet', getInitialState: function getInitialState() { - return { sections: [] }; - }, - getDefaultProps: function getDefaultProps() { - return { - autoOpen: true, - multiOpen: false, - collapsible: false - }; - }, - componentWillMount: function componentWillMount() { - var sections = []; - React.Children.forEach(this.props.children, function (child, index) { - sections.push({ active: false }); - }); - if (this.props.autoOpen) { - sections[0].active = true; - } - this.setState({ sections: sections }); + return { notifications: [] }; }, - select: function select(selectSection) { - var sections = this.state.sections; - sections.forEach((function (section, index) { - if (this.props.multiOpen) { - if (index === selectSection) { - section.active = !section.active; - } + componentDidMount: function componentDidMount() { + foundationApi.subscribe(this.props.id, (function (name, msg) { + if (msg === 'clearall') { + this.clearAll(); } else { - if (index === selectSection) { - section.active = this.props.collapsible === true ? !section.active : true; - } else { - section.active = false; + this.addNotification(msg); + } + }).bind(this)); + }, + addNotification: function addNotification(notification) { + notification.id = foundationApi.generateUuid(); + var notifications = this.state.notifications.concat(notification); + this.setState({ + notifications: notifications + }); + }, + removeNotifcation: function removeNotifcation(id) { + return (function (e) { + var notifications = []; + this.state.notifications.forEach(function (notification) { + if (notification.id !== id) { + notifications.push(notification); } - } - }).bind(this)); - this.setState({ sections: sections }); + }); + this.setState({ + notifications: notifications + }); + e.preventDefault(); + }).bind(this); + }, + clearAll: function clearAll() { + this.setState({ notifications: [] }); }, render: function render() { - var children = React.Children.map(this.props.children, (function (child, index) { - return cloneWithProps(child, { - active: this.state.sections[index] ? this.state.sections[index].active : false, - activate: this.select.bind(this, index) - }); + var notifications = this.state.notifications.map((function (notification) { + return React.createElement( + Notification, + _extends({ key: notification.id }, notification, { closeHandler: this.removeNotifcation(notification.id), className: 'is-active' }), + notification.content + ); }).bind(this)); return React.createElement( 'div', - { className: 'accordion' }, - children + null, + notifications ); } }); - module.exports = Accordion; - Accordion.Item = __webpack_require__(13); + module.exports = NotificationSet; /***/ }, /* 24 */ @@ -2647,7 +1600,7 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - var React = __webpack_require__(12); + var React = __webpack_require__(2); var Notification = React.createClass({ displayName: 'Notification', @@ -2658,7 +1611,8 @@ return /******/ (function(modules) { // webpackBootstrap color: 'success', title: null, image: null, - content: null + content: null, + wrapperElement: "p" }; }, render: function render() { @@ -2689,11 +1643,7 @@ return /******/ (function(modules) { // webpackBootstrap null, this.props.title ), - React.createElement( - 'p', - null, - this.props.children - ) + React.createElement(this.props.wrapperElement, null, this.props.children) ) ); } @@ -2707,1925 +1657,1897 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - function ToObject(val) { - if (val == null) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } - - return Object(val); - } - - module.exports = Object.assign || function (target, source) { - var from; - var keys; - var to = ToObject(target); + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - for (var s = 1; s < arguments.length; s++) { - from = arguments[s]; - keys = Object.keys(Object(from)); + var React = __webpack_require__(2); + var classnames = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"classnames\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())); + var foundationApi = __webpack_require__(5); + var Animation = __webpack_require__(18); + var Notification = __webpack_require__(24); - for (var i = 0; i < keys.length; i++) { - to[keys[i]] = from[keys[i]]; - } - } + var NotificationStatic = React.createClass({ + displayName: 'NotificationStatic', - return to; - }; + getInitialState: function getInitialState() { + return { open: false }; + }, + componentDidMount: function componentDidMount() { + foundationApi.subscribe(this.props.id, (function (name, msg) { + if (msg === 'open') { + this.setState({ open: true }); + } else if (msg === 'close') { + this.setState({ open: false }); + } + }).bind(this)); + }, + componentWillUnmount: function componentWillUnmount() { + foundationApi.unsubscribe(this.props.id); + }, + closeHandler: function closeHandler(e) { + this.setState({ open: false }); + e.preventDefault(); + e.stopPropagation(); + }, + render: function render() { + return React.createElement( + Animation, + { active: this.state.open, animationIn: 'fadeIn', animationOut: 'fadeOut' }, + React.createElement( + Notification, + _extends({}, this.props, { closeHandler: this.closeHandler }), + this.props.children + ) + ); + } + }); + module.exports = NotificationStatic; /***/ }, /* 26 */ /***/ function(module, exports, __webpack_require__) { - var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* - Copyright (c) 2010,2011,2012,2013,2014 Morgan Roderick http://roderick.dk - License: MIT - http://mrgnrdrck.mit-license.org - - https://github.com/mroderick/PubSubJS - */ - (function (root, factory){ - 'use strict'; - - if (true){ - // AMD. Register as an anonymous module. - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - - } else if (typeof exports === 'object'){ - // CommonJS - factory(exports); - - } else { - // Browser globals - var PubSub = {}; - root.PubSub = PubSub; - factory(PubSub); - } - }(( typeof window === 'object' && window ) || this, function (PubSub){ - 'use strict'; - - var messages = {}, - lastUid = -1; - - function hasKeys(obj){ - var key; - - for (key in obj){ - if ( obj.hasOwnProperty(key) ){ - return true; - } - } - return false; - } - - /** - * Returns a function that throws the passed exception, for use as argument for setTimeout - * @param { Object } ex An Error object - */ - function throwException( ex ){ - return function reThrowException(){ - throw ex; - }; - } - - function callSubscriberWithDelayedExceptions( subscriber, message, data ){ - try { - subscriber( message, data ); - } catch( ex ){ - setTimeout( throwException( ex ), 0); - } - } - - function callSubscriberWithImmediateExceptions( subscriber, message, data ){ - subscriber( message, data ); - } - - function deliverMessage( originalMessage, matchedMessage, data, immediateExceptions ){ - var subscribers = messages[matchedMessage], - callSubscriber = immediateExceptions ? callSubscriberWithImmediateExceptions : callSubscriberWithDelayedExceptions, - s; - - if ( !messages.hasOwnProperty( matchedMessage ) ) { - return; - } - - for (s in subscribers){ - if ( subscribers.hasOwnProperty(s)){ - callSubscriber( subscribers[s], originalMessage, data ); - } - } - } - - function createDeliveryFunction( message, data, immediateExceptions ){ - return function deliverNamespaced(){ - var topic = String( message ), - position = topic.lastIndexOf( '.' ); - - // deliver the message as it is now - deliverMessage(message, message, data, immediateExceptions); - - // trim the hierarchy and deliver message to each level - while( position !== -1 ){ - topic = topic.substr( 0, position ); - position = topic.lastIndexOf('.'); - deliverMessage( message, topic, data, immediateExceptions ); - } - }; - } - - function messageHasSubscribers( message ){ - var topic = String( message ), - found = Boolean(messages.hasOwnProperty( topic ) && hasKeys(messages[topic])), - position = topic.lastIndexOf( '.' ); - - while ( !found && position !== -1 ){ - topic = topic.substr( 0, position ); - position = topic.lastIndexOf( '.' ); - found = Boolean(messages.hasOwnProperty( topic ) && hasKeys(messages[topic])); - } - - return found; - } - - function publish( message, data, sync, immediateExceptions ){ - var deliver = createDeliveryFunction( message, data, immediateExceptions ), - hasSubscribers = messageHasSubscribers( message ); - - if ( !hasSubscribers ){ - return false; - } + 'use strict'; - if ( sync === true ){ - deliver(); - } else { - setTimeout( deliver, 0 ); - } - return true; - } + var React = __webpack_require__(2); + var classnames = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"classnames\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())); + // var LayerMixin = require('react-layer-mixin'); + var foundationApi = __webpack_require__(5); - /** - * PubSub.publish( message[, data] ) -> Boolean - * - message (String): The message to publish - * - data: The data to pass to subscribers - * Publishes the the message, passing the data to it's subscribers - **/ - PubSub.publish = function( message, data ){ - return publish( message, data, false, PubSub.immediateExceptions ); - }; + var Offcanvas = React.createClass({ + displayName: 'Offcanvas', - /** - * PubSub.publishSync( message[, data] ) -> Boolean - * - message (String): The message to publish - * - data: The data to pass to subscribers - * Publishes the the message synchronously, passing the data to it's subscribers - **/ - PubSub.publishSync = function( message, data ){ - return publish( message, data, true, PubSub.immediateExceptions ); - }; + // mixins: [LayerMixin], + getInitialState: function getInitialState() { + return { open: false }; + }, + getDefaultProps: function getDefaultProps() { + return { + position: 'left' + }; + }, + componentDidMount: function componentDidMount() { + foundationApi.subscribe(this.props.id, (function (name, msg) { + if (msg === 'open') { + this.setState({ open: true }); + } else if (msg === 'close') { + this.setState({ open: false }); + } else if (msg === 'toggle') { + this.setState({ open: !this.state.open }); + } + }).bind(this)); + }, + componentWillUnmount: function componentWillUnmount() { + foundationApi.unsubscribe(this.props.id); + }, + render: function render() { + var classes = { + 'off-canvas': true, + 'is-active': this.state.open + }; + classes[this.props.position] = true; + if (this.props.className) { + classes[this.props.className] = true; + } + return React.createElement( + 'div', + { id: this.props.id, 'data-closable': true, className: classnames(classes) }, + this.props.children + ); + } + }); - /** - * PubSub.subscribe( message, func ) -> String - * - message (String): The message to subscribe to - * - func (Function): The function to call when a new message is published - * Subscribes the passed function to the passed message. Every returned token is unique and should be stored if - * you need to unsubscribe - **/ - PubSub.subscribe = function( message, func ){ - if ( typeof func !== 'function'){ - return false; - } + module.exports = Offcanvas; - // message is not registered yet - if ( !messages.hasOwnProperty( message ) ){ - messages[message] = {}; - } +/***/ }, +/* 27 */ +/***/ function(module, exports, __webpack_require__) { - // forcing token as String, to allow for future expansions without breaking usage - // and allow for easy use as key names for the 'messages' object - var token = 'uid_' + String(++lastUid); - messages[message][token] = func; + 'use strict'; - // return token for unsubscribing - return token; - }; + var React = __webpack_require__(2); + var classnames = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"classnames\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())); + var Animation = __webpack_require__(18); + var foundationApi = __webpack_require__(5); - /* Public: Clears all subscriptions - */ - PubSub.clearAllSubscriptions = function clearAllSubscriptions(){ - messages = {}; - }; + var Panel = React.createClass({ + displayName: 'Panel', - /*Public: Clear subscriptions by the topic - */ - PubSub.clearSubscriptions = function clearSubscriptions(topic){ - var m; - for (m in messages){ - if (messages.hasOwnProperty(m) && m.indexOf(topic) === 0){ - delete messages[m]; - } - } - }; + getInitialState: function getInitialState() { + return { open: false }; + }, + getDefaultProps: function getDefaultProps() { + return { + position: 'left' + }; + }, + componentDidMount: function componentDidMount() { + foundationApi.subscribe(this.props.id, (function (name, msg) { + if (msg === 'open') { + this.setState({ open: true }); + } else if (msg === 'close') { + this.setState({ open: false }); + } else if (msg === 'toggle') { + this.setState({ open: !this.state.open }); + } + }).bind(this)); + }, + componentWillUnmount: function componentWillUnmount() { + foundationApi.unsubscribe(this.props.id); + }, + render: function render() { + var animationIn, animationOut; + var classes = 'panel panel-' + this.props.position; + if (this.props.className) { + classes += ' ' + this.props.className; + } + if (this.props.position === 'left') { + animationIn = this.props.animationIn || 'slideInRight'; + animationOut = this.props.animationOut || 'slideOutLeft'; + } else if (this.props.position === 'right') { + animationIn = this.props.animationIn || 'slideInLeft'; + animationOut = this.props.animationOut || 'slideOutRight'; + } else if (this.props.position === 'top') { + animationIn = this.props.animationIn || 'slideInDown'; + animationOut = this.props.animationOut || 'slideOutUp'; + } else if (this.props.position === 'bottom') { + animationIn = this.props.animationIn || 'slideInUp'; + animationOut = this.props.animationOut || 'slideOutBottom'; + } + return React.createElement( + Animation, + { active: this.state.open, animationIn: animationIn, animationOut: animationOut }, + React.createElement( + 'div', + { 'data-closable': true, id: this.props.id, className: classes }, + this.props.children + ) + ); + } + }); - /* Public: removes subscriptions. - * When passed a token, removes a specific subscription. - * When passed a function, removes all subscriptions for that function - * When passed a topic, removes all subscriptions for that topic (hierarchy) - * - * value - A token, function or topic to unsubscribe. - * - * Examples - * - * // Example 1 - unsubscribing with a token - * var token = PubSub.subscribe('mytopic', myFunc); - * PubSub.unsubscribe(token); - * - * // Example 2 - unsubscribing with a function - * PubSub.unsubscribe(myFunc); - * - * // Example 3 - unsubscribing a topic - * PubSub.unsubscribe('mytopic'); - */ - PubSub.unsubscribe = function(value){ - var isTopic = typeof value === 'string' && messages.hasOwnProperty(value), - isToken = !isTopic && typeof value === 'string', - isFunction = typeof value === 'function', - result = false, - m, message, t; + module.exports = Panel; - if (isTopic){ - delete messages[value]; - return; - } +/***/ }, +/* 28 */ +/***/ function(module, exports, __webpack_require__) { - for ( m in messages ){ - if ( messages.hasOwnProperty( m ) ){ - message = messages[m]; + 'use strict'; - if ( isToken && message[value] ){ - delete message[value]; - result = value; - // tokens are unique, so we can just stop here - break; - } + var React = __webpack_require__(2); + var ReactDOM = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"react-dom\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())); + var classnames = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"classnames\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())); + var ExecutionEnvironment = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"react/lib/ExecutionEnvironment\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())); + var foundationApi = __webpack_require__(5); + var Tether = ExecutionEnvironment.canUseDOM && __webpack_require__(29); - if (isFunction) { - for ( t in message ){ - if (message.hasOwnProperty(t) && message[t] === value){ - delete message[t]; - result = true; - } - } - } - } - } + var Popup = React.createClass({ + displayName: 'Popup', - return result; - }; - })); + getInitialState: function getInitialState() { + return { + active: false, + tetherInit: false + }; + }, + getDefaultProps: function getDefaultProps() { + return { + pinTo: 'top center', + pinAt: '' + }; + }, + componentDidMount: function componentDidMount() { + this.tether = {}; + foundationApi.subscribe(this.props.id, (function (name, msg) { + if (msg[0] === 'toggle') { + this.toggle(msg[1]); + } + }).bind(this)); + }, + toggle: function toggle(target) { + var active = !this.state.active; + this.setState({ active: active }, (function () { + if (active) { + this.tetherElement(target); + } else { + this.tether.destroy(); + } + }).bind(this)); + }, + tetherElement: function tetherElement(target) { + var targetElement = document.getElementById(target); + var attachment = 'top center'; + this.tether = new Tether({ + element: ReactDOM.findDOMNode(this), + target: targetElement, + attachment: attachment + }); + }, + render: function render() { + var classes = { + popup: true, + 'is-active': this.state.active + }; + return React.createElement( + 'div', + { id: this.props.id, className: classnames(classes), 'data-closable': 'popup' }, + this.props.children + ); + } + }); + module.exports = Popup; /***/ }, -/* 27 */ +/* 29 */ /***/ function(module, exports, __webpack_require__) { - /** - * Copyright 2013-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @typechecks static-only - * @providesModule cloneWithProps - */ - - 'use strict'; + var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! tether 0.6.5 */ - var ReactElement = __webpack_require__(36); - var ReactPropTransferer = __webpack_require__(37); - var keyOf = __webpack_require__(38); - var warning = __webpack_require__(35); + (function(root, factory) { + if (true) { + !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } else if (typeof exports === 'object') { + module.exports = factory(require,exports,module); + } else { + root.Tether = factory(); + } + }(this, function(require,exports,module) { - var CHILDREN_PROP = keyOf({children: null}); + (function() { + var Evented, addClass, defer, deferred, extend, flush, getBounds, getClassName, getOffsetParent, getOrigin, getScrollBarSize, getScrollParent, hasClass, node, removeClass, setClassName, uniqueId, updateClasses, zeroPosCache, + __hasProp = {}.hasOwnProperty, + __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, + __slice = [].slice; - /** - * Sometimes you want to change the props of a child passed to you. Usually - * this is to add a CSS class. - * - * @param {ReactElement} child child element you'd like to clone - * @param {object} props props you'd like to modify. className and style will be - * merged automatically. - * @return {ReactElement} a clone of child with props merged in. - */ - function cloneWithProps(child, props) { - if ("production" !== (undefined)) { - ("production" !== (undefined) ? warning( - !child.ref, - 'You are calling cloneWithProps() on a child with a ref. This is ' + - 'dangerous because you\'re creating a new child which will not be ' + - 'added as a ref to its parent.' - ) : null); + if (this.Tether == null) { + this.Tether = { + modules: [] + }; } - var newProps = ReactPropTransferer.mergeProps(props, child.props); + getScrollParent = function(el) { + var parent, position, scrollParent, style, _ref; + position = getComputedStyle(el).position; + if (position === 'fixed') { + return el; + } + scrollParent = void 0; + parent = el; + while (parent = parent.parentNode) { + try { + style = getComputedStyle(parent); + } catch (_error) {} + if (style == null) { + return parent; + } + if (/(auto|scroll)/.test(style['overflow'] + style['overflowY'] + style['overflowX'])) { + if (position !== 'absolute' || ((_ref = style['position']) === 'relative' || _ref === 'absolute' || _ref === 'fixed')) { + return parent; + } + } + } + return document.body; + }; - // Use `child.props.children` if it is provided. - if (!newProps.hasOwnProperty(CHILDREN_PROP) && - child.props.hasOwnProperty(CHILDREN_PROP)) { - newProps.children = child.props.children; - } + uniqueId = (function() { + var id; + id = 0; + return function() { + return id++; + }; + })(); - // The current API doesn't retain _owner and _context, which is why this - // doesn't use ReactElement.cloneAndReplaceProps. - return ReactElement.createElement(child.type, newProps); - } + zeroPosCache = {}; - module.exports = cloneWithProps; + getOrigin = function(doc) { + var id, k, node, v, _ref; + node = doc._tetherZeroElement; + if (node == null) { + node = doc.createElement('div'); + node.setAttribute('data-tether-id', uniqueId()); + extend(node.style, { + top: 0, + left: 0, + position: 'absolute' + }); + doc.body.appendChild(node); + doc._tetherZeroElement = node; + } + id = node.getAttribute('data-tether-id'); + if (zeroPosCache[id] == null) { + zeroPosCache[id] = {}; + _ref = node.getBoundingClientRect(); + for (k in _ref) { + v = _ref[k]; + zeroPosCache[id][k] = v; + } + defer(function() { + return zeroPosCache[id] = void 0; + }); + } + return zeroPosCache[id]; + }; + node = null; -/***/ }, -/* 28 */ -/***/ function(module, exports, __webpack_require__) { + getBounds = function(el) { + var box, doc, docEl, k, origin, v, _ref; + if (el === document) { + doc = document; + el = document.documentElement; + } else { + doc = el.ownerDocument; + } + docEl = doc.documentElement; + box = {}; + _ref = el.getBoundingClientRect(); + for (k in _ref) { + v = _ref[k]; + box[k] = v; + } + origin = getOrigin(doc); + box.top -= origin.top; + box.left -= origin.left; + if (box.width == null) { + box.width = document.body.scrollWidth - box.left - box.right; + } + if (box.height == null) { + box.height = document.body.scrollHeight - box.top - box.bottom; + } + box.top = box.top - docEl.clientTop; + box.left = box.left - docEl.clientLeft; + box.right = doc.body.clientWidth - box.width - box.left; + box.bottom = doc.body.clientHeight - box.height - box.top; + return box; + }; - /** - * Copyright 2013-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule ExecutionEnvironment - */ + getOffsetParent = function(el) { + return el.offsetParent || document.documentElement; + }; - /*jslint evil: true */ + getScrollBarSize = function() { + var inner, outer, width, widthContained, widthScroll; + inner = document.createElement('div'); + inner.style.width = '100%'; + inner.style.height = '200px'; + outer = document.createElement('div'); + extend(outer.style, { + position: 'absolute', + top: 0, + left: 0, + pointerEvents: 'none', + visibility: 'hidden', + width: '200px', + height: '150px', + overflow: 'hidden' + }); + outer.appendChild(inner); + document.body.appendChild(outer); + widthContained = inner.offsetWidth; + outer.style.overflow = 'scroll'; + widthScroll = inner.offsetWidth; + if (widthContained === widthScroll) { + widthScroll = outer.clientWidth; + } + document.body.removeChild(outer); + width = widthContained - widthScroll; + return { + width: width, + height: width + }; + }; - "use strict"; + extend = function(out) { + var args, key, obj, val, _i, _len, _ref; + if (out == null) { + out = {}; + } + args = []; + Array.prototype.push.apply(args, arguments); + _ref = args.slice(1); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + obj = _ref[_i]; + if (obj) { + for (key in obj) { + if (!__hasProp.call(obj, key)) continue; + val = obj[key]; + out[key] = val; + } + } + } + return out; + }; - var canUseDOM = !!( - (typeof window !== 'undefined' && - window.document && window.document.createElement) - ); + removeClass = function(el, name) { + var className, cls, _i, _len, _ref, _results; + if (el.classList != null) { + _ref = name.split(' '); + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + cls = _ref[_i]; + if (cls.trim()) { + _results.push(el.classList.remove(cls)); + } + } + return _results; + } else { + className = getClassName(el).replace(new RegExp("(^| )" + (name.split(' ').join('|')) + "( |$)", 'gi'), ' '); + return setClassName(el, className); + } + }; - /** - * Simple, lightweight module assisting with the detection and context of - * Worker. Helps avoid circular dependencies and allows code to reason about - * whether or not they are in a Worker, even if they never include the main - * `ReactWorker` dependency. - */ - var ExecutionEnvironment = { + addClass = function(el, name) { + var cls, _i, _len, _ref, _results; + if (el.classList != null) { + _ref = name.split(' '); + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + cls = _ref[_i]; + if (cls.trim()) { + _results.push(el.classList.add(cls)); + } + } + return _results; + } else { + removeClass(el, name); + cls = getClassName(el) + (" " + name); + return setClassName(el, cls); + } + }; - canUseDOM: canUseDOM, + hasClass = function(el, name) { + if (el.classList != null) { + return el.classList.contains(name); + } else { + return new RegExp("(^| )" + name + "( |$)", 'gi').test(getClassName(el)); + } + }; - canUseWorkers: typeof Worker !== 'undefined', + getClassName = function(el) { + if (el.className instanceof SVGAnimatedString) { + return el.className.baseVal; + } else { + return el.className; + } + }; - canUseEventListeners: - canUseDOM && !!(window.addEventListener || window.attachEvent), + setClassName = function(el, className) { + return el.setAttribute('class', className); + }; - canUseViewport: canUseDOM && !!window.screen, + updateClasses = function(el, add, all) { + var cls, _i, _j, _len, _len1, _results; + for (_i = 0, _len = all.length; _i < _len; _i++) { + cls = all[_i]; + if (__indexOf.call(add, cls) < 0) { + if (hasClass(el, cls)) { + removeClass(el, cls); + } + } + } + _results = []; + for (_j = 0, _len1 = add.length; _j < _len1; _j++) { + cls = add[_j]; + if (!hasClass(el, cls)) { + _results.push(addClass(el, cls)); + } else { + _results.push(void 0); + } + } + return _results; + }; - isInWorker: !canUseDOM // For now, this is true - might change in the future. + deferred = []; - }; + defer = function(fn) { + return deferred.push(fn); + }; - module.exports = ExecutionEnvironment; + flush = function() { + var fn, _results; + _results = []; + while (fn = deferred.pop()) { + _results.push(fn()); + } + return _results; + }; + Evented = (function() { + function Evented() {} -/***/ }, -/* 29 */ -/***/ function(module, exports, __webpack_require__) { + Evented.prototype.on = function(event, handler, ctx, once) { + var _base; + if (once == null) { + once = false; + } + if (this.bindings == null) { + this.bindings = {}; + } + if ((_base = this.bindings)[event] == null) { + _base[event] = []; + } + return this.bindings[event].push({ + handler: handler, + ctx: ctx, + once: once + }); + }; - /** - * Copyright 2013-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule cx - */ + Evented.prototype.once = function(event, handler, ctx) { + return this.on(event, handler, ctx, true); + }; - /** - * This function is used to mark string literals representing CSS class names - * so that they can be transformed statically. This allows for modularization - * and minification of CSS class names. - * - * In static_upstream, this function is actually implemented, but it should - * eventually be replaced with something more descriptive, and the transform - * that is used in the main stack should be ported for use elsewhere. - * - * @param string|object className to modularize, or an object of key/values. - * In the object case, the values are conditions that - * determine if the className keys should be included. - * @param [string ...] Variable list of classNames in the string case. - * @return string Renderable space-separated CSS className. - */ + Evented.prototype.off = function(event, handler) { + var i, _ref, _results; + if (((_ref = this.bindings) != null ? _ref[event] : void 0) == null) { + return; + } + if (handler == null) { + return delete this.bindings[event]; + } else { + i = 0; + _results = []; + while (i < this.bindings[event].length) { + if (this.bindings[event][i].handler === handler) { + _results.push(this.bindings[event].splice(i, 1)); + } else { + _results.push(i++); + } + } + return _results; + } + }; - 'use strict'; - var warning = __webpack_require__(35); - - var warned = false; - - function cx(classNames) { - if ("production" !== (undefined)) { - ("production" !== (undefined) ? warning( - warned, - 'React.addons.classSet will be deprecated in a future version. See ' + - 'http://fb.me/react-addons-classset' - ) : null); - warned = true; - } + Evented.prototype.trigger = function() { + var args, ctx, event, handler, i, once, _ref, _ref1, _results; + event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; + if ((_ref = this.bindings) != null ? _ref[event] : void 0) { + i = 0; + _results = []; + while (i < this.bindings[event].length) { + _ref1 = this.bindings[event][i], handler = _ref1.handler, ctx = _ref1.ctx, once = _ref1.once; + handler.apply(ctx != null ? ctx : this, args); + if (once) { + _results.push(this.bindings[event].splice(i, 1)); + } else { + _results.push(i++); + } + } + return _results; + } + }; - if (typeof classNames == 'object') { - return Object.keys(classNames).filter(function(className) { - return classNames[className]; - }).join(' '); - } else { - return Array.prototype.join.call(arguments, ' '); - } - } + return Evented; - module.exports = cx; + })(); + this.Tether.Utils = { + getScrollParent: getScrollParent, + getBounds: getBounds, + getOffsetParent: getOffsetParent, + extend: extend, + addClass: addClass, + removeClass: removeClass, + hasClass: hasClass, + updateClasses: updateClasses, + defer: defer, + flush: flush, + uniqueId: uniqueId, + Evented: Evented, + getScrollBarSize: getScrollBarSize + }; -/***/ }, -/* 30 */ -/***/ function(module, exports, __webpack_require__) { + }).call(this); - /** - * Copyright 2013-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule ReactTransitionEvents - */ + (function() { + var MIRROR_LR, MIRROR_TB, OFFSET_MAP, Tether, addClass, addOffset, attachmentToOffset, autoToFixedAttachment, defer, extend, flush, getBounds, getOffsetParent, getOuterSize, getScrollBarSize, getScrollParent, getSize, now, offsetToPx, parseAttachment, parseOffset, position, removeClass, tethers, transformKey, updateClasses, within, _Tether, _ref, + __slice = [].slice, + __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; - 'use strict'; + if (this.Tether == null) { + throw new Error("You must include the utils.js file before tether.js"); + } - var ExecutionEnvironment = __webpack_require__(28); + Tether = this.Tether; - /** - * EVENT_NAME_MAP is used to determine which event fired when a - * transition/animation ends, based on the style property used to - * define that event. - */ - var EVENT_NAME_MAP = { - transitionend: { - 'transition': 'transitionend', - 'WebkitTransition': 'webkitTransitionEnd', - 'MozTransition': 'mozTransitionEnd', - 'OTransition': 'oTransitionEnd', - 'msTransition': 'MSTransitionEnd' - }, + _ref = Tether.Utils, getScrollParent = _ref.getScrollParent, getSize = _ref.getSize, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getOffsetParent = _ref.getOffsetParent, extend = _ref.extend, addClass = _ref.addClass, removeClass = _ref.removeClass, updateClasses = _ref.updateClasses, defer = _ref.defer, flush = _ref.flush, getScrollBarSize = _ref.getScrollBarSize; - animationend: { - 'animation': 'animationend', - 'WebkitAnimation': 'webkitAnimationEnd', - 'MozAnimation': 'mozAnimationEnd', - 'OAnimation': 'oAnimationEnd', - 'msAnimation': 'MSAnimationEnd' - } - }; + within = function(a, b, diff) { + if (diff == null) { + diff = 1; + } + return (a + diff >= b && b >= a - diff); + }; - var endEvents = []; + transformKey = (function() { + var el, key, _i, _len, _ref1; + el = document.createElement('div'); + _ref1 = ['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform']; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + key = _ref1[_i]; + if (el.style[key] !== void 0) { + return key; + } + } + })(); - function detectEvents() { - var testEl = document.createElement('div'); - var style = testEl.style; + tethers = []; - // On some platforms, in particular some releases of Android 4.x, - // the un-prefixed "animation" and "transition" properties are defined on the - // style object but the events that fire will still be prefixed, so we need - // to check if the un-prefixed events are useable, and if not remove them - // from the map - if (!('AnimationEvent' in window)) { - delete EVENT_NAME_MAP.animationend.animation; - } + position = function() { + var tether, _i, _len; + for (_i = 0, _len = tethers.length; _i < _len; _i++) { + tether = tethers[_i]; + tether.position(false); + } + return flush(); + }; - if (!('TransitionEvent' in window)) { - delete EVENT_NAME_MAP.transitionend.transition; - } + now = function() { + var _ref1; + return (_ref1 = typeof performance !== "undefined" && performance !== null ? typeof performance.now === "function" ? performance.now() : void 0 : void 0) != null ? _ref1 : +(new Date); + }; - for (var baseEventName in EVENT_NAME_MAP) { - var baseEvents = EVENT_NAME_MAP[baseEventName]; - for (var styleName in baseEvents) { - if (styleName in style) { - endEvents.push(baseEvents[styleName]); - break; + (function() { + var event, lastCall, lastDuration, pendingTimeout, tick, _i, _len, _ref1, _results; + lastCall = null; + lastDuration = null; + pendingTimeout = null; + tick = function() { + if ((lastDuration != null) && lastDuration > 16) { + lastDuration = Math.min(lastDuration - 16, 250); + pendingTimeout = setTimeout(tick, 250); + return; + } + if ((lastCall != null) && (now() - lastCall) < 10) { + return; + } + if (pendingTimeout != null) { + clearTimeout(pendingTimeout); + pendingTimeout = null; } + lastCall = now(); + position(); + return lastDuration = now() - lastCall; + }; + _ref1 = ['resize', 'scroll', 'touchmove']; + _results = []; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + event = _ref1[_i]; + _results.push(window.addEventListener(event, tick)); } - } - } + return _results; + })(); - if (ExecutionEnvironment.canUseDOM) { - detectEvents(); - } + MIRROR_LR = { + center: 'center', + left: 'right', + right: 'left' + }; - // We use the raw {add|remove}EventListener() call because EventListener - // does not know how to remove event listeners and we really should - // clean up. Also, these events are not triggered in older browsers - // so we should be A-OK here. + MIRROR_TB = { + middle: 'middle', + top: 'bottom', + bottom: 'top' + }; + + OFFSET_MAP = { + top: 0, + left: 0, + middle: '50%', + center: '50%', + bottom: '100%', + right: '100%' + }; - function addEventListener(node, eventName, eventListener) { - node.addEventListener(eventName, eventListener, false); - } + autoToFixedAttachment = function(attachment, relativeToAttachment) { + var left, top; + left = attachment.left, top = attachment.top; + if (left === 'auto') { + left = MIRROR_LR[relativeToAttachment.left]; + } + if (top === 'auto') { + top = MIRROR_TB[relativeToAttachment.top]; + } + return { + left: left, + top: top + }; + }; - function removeEventListener(node, eventName, eventListener) { - node.removeEventListener(eventName, eventListener, false); - } + attachmentToOffset = function(attachment) { + var _ref1, _ref2; + return { + left: (_ref1 = OFFSET_MAP[attachment.left]) != null ? _ref1 : attachment.left, + top: (_ref2 = OFFSET_MAP[attachment.top]) != null ? _ref2 : attachment.top + }; + }; - var ReactTransitionEvents = { - addEndEventListener: function(node, eventListener) { - if (endEvents.length === 0) { - // If CSS transitions are not supported, trigger an "end animation" - // event immediately. - window.setTimeout(eventListener, 0); - return; + addOffset = function() { + var left, offsets, out, top, _i, _len, _ref1; + offsets = 1 <= arguments.length ? __slice.call(arguments, 0) : []; + out = { + top: 0, + left: 0 + }; + for (_i = 0, _len = offsets.length; _i < _len; _i++) { + _ref1 = offsets[_i], top = _ref1.top, left = _ref1.left; + if (typeof top === 'string') { + top = parseFloat(top, 10); + } + if (typeof left === 'string') { + left = parseFloat(left, 10); + } + out.top += top; + out.left += left; } - endEvents.forEach(function(endEvent) { - addEventListener(node, endEvent, eventListener); - }); - }, + return out; + }; - removeEndEventListener: function(node, eventListener) { - if (endEvents.length === 0) { - return; + offsetToPx = function(offset, size) { + if (typeof offset.left === 'string' && offset.left.indexOf('%') !== -1) { + offset.left = parseFloat(offset.left, 10) / 100 * size.width; } - endEvents.forEach(function(endEvent) { - removeEventListener(node, endEvent, eventListener); - }); - } - }; + if (typeof offset.top === 'string' && offset.top.indexOf('%') !== -1) { + offset.top = parseFloat(offset.top, 10) / 100 * size.height; + } + return offset; + }; - module.exports = ReactTransitionEvents; + parseAttachment = parseOffset = function(value) { + var left, top, _ref1; + _ref1 = value.split(' '), top = _ref1[0], left = _ref1[1]; + return { + top: top, + left: left + }; + }; + _Tether = (function() { + _Tether.modules = []; -/***/ }, -/* 31 */ -/***/ function(module, exports, __webpack_require__) { + function _Tether(options) { + this.position = __bind(this.position, this); + var module, _i, _len, _ref1, _ref2; + tethers.push(this); + this.history = []; + this.setOptions(options, false); + _ref1 = Tether.modules; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + module = _ref1[_i]; + if ((_ref2 = module.initialize) != null) { + _ref2.call(this); + } + } + this.position(); + } - /** - * Copyright 2013-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule CSSCore - * @typechecks - */ + _Tether.prototype.getClass = function(key) { + var _ref1, _ref2; + if ((_ref1 = this.options.classes) != null ? _ref1[key] : void 0) { + return this.options.classes[key]; + } else if (((_ref2 = this.options.classes) != null ? _ref2[key] : void 0) !== false) { + if (this.options.classPrefix) { + return "" + this.options.classPrefix + "-" + key; + } else { + return key; + } + } else { + return ''; + } + }; + + _Tether.prototype.setOptions = function(options, position) { + var defaults, key, _i, _len, _ref1, _ref2; + this.options = options; + if (position == null) { + position = true; + } + defaults = { + offset: '0 0', + targetOffset: '0 0', + targetAttachment: 'auto auto', + classPrefix: 'tether' + }; + this.options = extend(defaults, this.options); + _ref1 = this.options, this.element = _ref1.element, this.target = _ref1.target, this.targetModifier = _ref1.targetModifier; + if (this.target === 'viewport') { + this.target = document.body; + this.targetModifier = 'visible'; + } else if (this.target === 'scroll-handle') { + this.target = document.body; + this.targetModifier = 'scroll-handle'; + } + _ref2 = ['element', 'target']; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + key = _ref2[_i]; + if (this[key] == null) { + throw new Error("Tether Error: Both element and target must be defined"); + } + if (this[key].jquery != null) { + this[key] = this[key][0]; + } else if (typeof this[key] === 'string') { + this[key] = document.querySelector(this[key]); + } + } + addClass(this.element, this.getClass('element')); + addClass(this.target, this.getClass('target')); + if (!this.options.attachment) { + throw new Error("Tether Error: You must provide an attachment"); + } + this.targetAttachment = parseAttachment(this.options.targetAttachment); + this.attachment = parseAttachment(this.options.attachment); + this.offset = parseOffset(this.options.offset); + this.targetOffset = parseOffset(this.options.targetOffset); + if (this.scrollParent != null) { + this.disable(); + } + if (this.targetModifier === 'scroll-handle') { + this.scrollParent = this.target; + } else { + this.scrollParent = getScrollParent(this.target); + } + if (this.options.enabled !== false) { + return this.enable(position); + } + }; - var invariant = __webpack_require__(39); + _Tether.prototype.getTargetBounds = function() { + var bounds, fitAdj, hasBottomScroll, height, out, scrollBottom, scrollPercentage, style, target; + if (this.targetModifier != null) { + switch (this.targetModifier) { + case 'visible': + if (this.target === document.body) { + return { + top: pageYOffset, + left: pageXOffset, + height: innerHeight, + width: innerWidth + }; + } else { + bounds = getBounds(this.target); + out = { + height: bounds.height, + width: bounds.width, + top: bounds.top, + left: bounds.left + }; + out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top)); + out.height = Math.min(out.height, bounds.height - ((bounds.top + bounds.height) - (pageYOffset + innerHeight))); + out.height = Math.min(innerHeight, out.height); + out.height -= 2; + out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left)); + out.width = Math.min(out.width, bounds.width - ((bounds.left + bounds.width) - (pageXOffset + innerWidth))); + out.width = Math.min(innerWidth, out.width); + out.width -= 2; + if (out.top < pageYOffset) { + out.top = pageYOffset; + } + if (out.left < pageXOffset) { + out.left = pageXOffset; + } + return out; + } + break; + case 'scroll-handle': + target = this.target; + if (target === document.body) { + target = document.documentElement; + bounds = { + left: pageXOffset, + top: pageYOffset, + height: innerHeight, + width: innerWidth + }; + } else { + bounds = getBounds(target); + } + style = getComputedStyle(target); + hasBottomScroll = target.scrollWidth > target.clientWidth || 'scroll' === [style.overflow, style.overflowX] || this.target !== document.body; + scrollBottom = 0; + if (hasBottomScroll) { + scrollBottom = 15; + } + height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom; + out = { + width: 15, + height: height * 0.975 * (height / target.scrollHeight), + left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15 + }; + fitAdj = 0; + if (height < 408 && this.target === document.body) { + fitAdj = -0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58; + } + if (this.target !== document.body) { + out.height = Math.max(out.height, 24); + } + scrollPercentage = this.target.scrollTop / (target.scrollHeight - height); + out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth); + if (this.target === document.body) { + out.height = Math.max(out.height, 24); + } + return out; + } + } else { + return getBounds(this.target); + } + }; - /** - * The CSSCore module specifies the API (and implements most of the methods) - * that should be used when dealing with the display of elements (via their - * CSS classes and visibility on screen. It is an API focused on mutating the - * display and not reading it as no logical state should be encoded in the - * display of elements. - */ + _Tether.prototype.clearCache = function() { + return this._cache = {}; + }; - var CSSCore = { - - /** - * Adds the class passed in to the element if it doesn't already have it. - * - * @param {DOMElement} element the element to set the class on - * @param {string} className the CSS className - * @return {DOMElement} the element passed in - */ - addClass: function(element, className) { - ("production" !== (undefined) ? invariant( - !/\s/.test(className), - 'CSSCore.addClass takes only a single class name. "%s" contains ' + - 'multiple classes.', className - ) : invariant(!/\s/.test(className))); - - if (className) { - if (element.classList) { - element.classList.add(className); - } else if (!CSSCore.hasClass(element, className)) { - element.className = element.className + ' ' + className; + _Tether.prototype.cache = function(k, getter) { + if (this._cache == null) { + this._cache = {}; } - } - return element; - }, - - /** - * Removes the class passed in from the element - * - * @param {DOMElement} element the element to set the class on - * @param {string} className the CSS className - * @return {DOMElement} the element passed in - */ - removeClass: function(element, className) { - ("production" !== (undefined) ? invariant( - !/\s/.test(className), - 'CSSCore.removeClass takes only a single class name. "%s" contains ' + - 'multiple classes.', className - ) : invariant(!/\s/.test(className))); - - if (className) { - if (element.classList) { - element.classList.remove(className); - } else if (CSSCore.hasClass(element, className)) { - element.className = element.className - .replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)', 'g'), '$1') - .replace(/\s+/g, ' ') // multiple spaces to one - .replace(/^\s*|\s*$/g, ''); // trim the ends + if (this._cache[k] == null) { + this._cache[k] = getter.call(this); } - } - return element; - }, - - /** - * Helper to add or remove a class from an element based on a condition. - * - * @param {DOMElement} element the element to set the class on - * @param {string} className the CSS className - * @param {*} bool condition to whether to add or remove the class - * @return {DOMElement} the element passed in - */ - conditionClass: function(element, className, bool) { - return (bool ? CSSCore.addClass : CSSCore.removeClass)(element, className); - }, - - /** - * Tests whether the element has the class specified. - * - * @param {DOMNode|DOMWindow} element the element to set the class on - * @param {string} className the CSS className - * @return {boolean} true if the element has the class, false if not - */ - hasClass: function(element, className) { - ("production" !== (undefined) ? invariant( - !/\s/.test(className), - 'CSS.hasClass takes only a single class name.' - ) : invariant(!/\s/.test(className))); - if (element.classList) { - return !!className && element.classList.contains(className); - } - return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1; - } - - }; - - module.exports = CSSCore; - - -/***/ }, -/* 32 */ -/***/ function(module, exports, __webpack_require__) { - - var canUseDOM = !!( - typeof window !== 'undefined' && - window.document && - window.document.createElement - ); - - module.exports = canUseDOM; + return this._cache[k]; + }; -/***/ }, -/* 33 */ -/***/ function(module, exports, __webpack_require__) { + _Tether.prototype.enable = function(position) { + if (position == null) { + position = true; + } + addClass(this.target, this.getClass('enabled')); + addClass(this.element, this.getClass('enabled')); + this.enabled = true; + if (this.scrollParent !== document) { + this.scrollParent.addEventListener('scroll', this.position); + } + if (position) { + return this.position(); + } + }; - var camel2hyphen = __webpack_require__(46); + _Tether.prototype.disable = function() { + removeClass(this.target, this.getClass('enabled')); + removeClass(this.element, this.getClass('enabled')); + this.enabled = false; + if (this.scrollParent != null) { + return this.scrollParent.removeEventListener('scroll', this.position); + } + }; - var isDimension = function (feature) { - var re = /[height|width]$/; - return re.test(feature); - }; + _Tether.prototype.destroy = function() { + var i, tether, _i, _len, _results; + this.disable(); + _results = []; + for (i = _i = 0, _len = tethers.length; _i < _len; i = ++_i) { + tether = tethers[i]; + if (tether === this) { + tethers.splice(i, 1); + break; + } else { + _results.push(void 0); + } + } + return _results; + }; - var obj2mq = function (obj) { - var mq = ''; - var features = Object.keys(obj); - features.forEach(function (feature, index) { - var value = obj[feature]; - feature = camel2hyphen(feature); - // Add px to dimension features - if (isDimension(feature) && typeof value === 'number') { - value = value + 'px'; - } - if (value === true) { - mq += feature; - } else if (value === false) { - mq += 'not ' + feature; - } else { - mq += '(' + feature + ': ' + value + ')'; - } - if (index < features.length-1) { - mq += ' and ' - } - }); - return mq; - }; + _Tether.prototype.updateAttachClasses = function(elementAttach, targetAttach) { + var add, all, side, sides, _i, _j, _len, _len1, _ref1, + _this = this; + if (elementAttach == null) { + elementAttach = this.attachment; + } + if (targetAttach == null) { + targetAttach = this.targetAttachment; + } + sides = ['left', 'top', 'bottom', 'right', 'middle', 'center']; + if ((_ref1 = this._addAttachClasses) != null ? _ref1.length : void 0) { + this._addAttachClasses.splice(0, this._addAttachClasses.length); + } + add = this._addAttachClasses != null ? this._addAttachClasses : this._addAttachClasses = []; + if (elementAttach.top) { + add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.top); + } + if (elementAttach.left) { + add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.left); + } + if (targetAttach.top) { + add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.top); + } + if (targetAttach.left) { + add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.left); + } + all = []; + for (_i = 0, _len = sides.length; _i < _len; _i++) { + side = sides[_i]; + all.push("" + (this.getClass('element-attached')) + "-" + side); + } + for (_j = 0, _len1 = sides.length; _j < _len1; _j++) { + side = sides[_j]; + all.push("" + (this.getClass('target-attached')) + "-" + side); + } + return defer(function() { + if (_this._addAttachClasses == null) { + return; + } + updateClasses(_this.element, _this._addAttachClasses, all); + updateClasses(_this.target, _this._addAttachClasses, all); + return _this._addAttachClasses = void 0; + }); + }; - var json2mq = function (query) { - var mq = ''; - if (typeof query === 'string') { - return query; - } - // Handling array of media queries - if (query instanceof Array) { - query.forEach(function (q, index) { - mq += obj2mq(q); - if (index < query.length-1) { - mq += ', ' + _Tether.prototype.position = function(flushChanges) { + var elementPos, elementStyle, height, left, manualOffset, manualTargetOffset, module, next, offset, offsetBorder, offsetParent, offsetParentSize, offsetParentStyle, offsetPosition, ret, scrollLeft, scrollTop, scrollbarSize, side, targetAttachment, targetOffset, targetPos, targetSize, top, width, _i, _j, _len, _len1, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, + _this = this; + if (flushChanges == null) { + flushChanges = true; + } + if (!this.enabled) { + return; + } + this.clearCache(); + targetAttachment = autoToFixedAttachment(this.targetAttachment, this.attachment); + this.updateAttachClasses(this.attachment, targetAttachment); + elementPos = this.cache('element-bounds', function() { + return getBounds(_this.element); + }); + width = elementPos.width, height = elementPos.height; + if (width === 0 && height === 0 && (this.lastSize != null)) { + _ref1 = this.lastSize, width = _ref1.width, height = _ref1.height; + } else { + this.lastSize = { + width: width, + height: height + }; + } + targetSize = targetPos = this.cache('target-bounds', function() { + return _this.getTargetBounds(); + }); + offset = offsetToPx(attachmentToOffset(this.attachment), { + width: width, + height: height + }); + targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize); + manualOffset = offsetToPx(this.offset, { + width: width, + height: height + }); + manualTargetOffset = offsetToPx(this.targetOffset, targetSize); + offset = addOffset(offset, manualOffset); + targetOffset = addOffset(targetOffset, manualTargetOffset); + left = targetPos.left + targetOffset.left - offset.left; + top = targetPos.top + targetOffset.top - offset.top; + _ref2 = Tether.modules; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + module = _ref2[_i]; + ret = module.position.call(this, { + left: left, + top: top, + targetAttachment: targetAttachment, + targetPos: targetPos, + attachment: this.attachment, + elementPos: elementPos, + offset: offset, + targetOffset: targetOffset, + manualOffset: manualOffset, + manualTargetOffset: manualTargetOffset, + scrollbarSize: scrollbarSize + }); + if ((ret == null) || typeof ret !== 'object') { + continue; + } else if (ret === false) { + return false; + } else { + top = ret.top, left = ret.left; + } + } + next = { + page: { + top: top, + left: left + }, + viewport: { + top: top - pageYOffset, + bottom: pageYOffset - top - height + innerHeight, + left: left - pageXOffset, + right: pageXOffset - left - width + innerWidth + } + }; + if (document.body.scrollWidth > window.innerWidth) { + scrollbarSize = this.cache('scrollbar-size', getScrollBarSize); + next.viewport.bottom -= scrollbarSize.height; + } + if (document.body.scrollHeight > window.innerHeight) { + scrollbarSize = this.cache('scrollbar-size', getScrollBarSize); + next.viewport.right -= scrollbarSize.width; + } + if (((_ref3 = document.body.style.position) !== '' && _ref3 !== 'static') || ((_ref4 = document.body.parentElement.style.position) !== '' && _ref4 !== 'static')) { + next.page.bottom = document.body.scrollHeight - top - height; + next.page.right = document.body.scrollWidth - left - width; + } + if (((_ref5 = this.options.optimizations) != null ? _ref5.moveElement : void 0) !== false && (this.targetModifier == null)) { + offsetParent = this.cache('target-offsetparent', function() { + return getOffsetParent(_this.target); + }); + offsetPosition = this.cache('target-offsetparent-bounds', function() { + return getBounds(offsetParent); + }); + offsetParentStyle = getComputedStyle(offsetParent); + elementStyle = getComputedStyle(this.element); + offsetParentSize = offsetPosition; + offsetBorder = {}; + _ref6 = ['Top', 'Left', 'Bottom', 'Right']; + for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) { + side = _ref6[_j]; + offsetBorder[side.toLowerCase()] = parseFloat(offsetParentStyle["border" + side + "Width"]); + } + offsetPosition.right = document.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right; + offsetPosition.bottom = document.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom; + if (next.page.top >= (offsetPosition.top + offsetBorder.top) && next.page.bottom >= offsetPosition.bottom) { + if (next.page.left >= (offsetPosition.left + offsetBorder.left) && next.page.right >= offsetPosition.right) { + scrollTop = offsetParent.scrollTop; + scrollLeft = offsetParent.scrollLeft; + next.offset = { + top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top, + left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left + }; + } + } } - }); - return mq; - } - // Handling single media query - return obj2mq(query); - }; - - module.exports = json2mq; - -/***/ }, -/* 34 */ -/***/ function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_RESULT__;/*! - * enquire.js v2.1.1 - Awesome Media Queries in JavaScript - * Copyright (c) 2014 Nick Williams - http://wicky.nillia.ms/enquire.js - * License: MIT (http://www.opensource.org/licenses/mit-license.php) - */ - - ;(function (name, context, factory) { - var matchMedia = window.matchMedia; - - if (typeof module !== 'undefined' && module.exports) { - module.exports = factory(matchMedia); - } - else if (true) { - !(__WEBPACK_AMD_DEFINE_RESULT__ = function() { - return (context[name] = factory(matchMedia)); - }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } - else { - context[name] = factory(matchMedia); - } - }('enquire', this, function (matchMedia) { - - 'use strict'; - - /*jshint unused:false */ - /** - * Helper function for iterating over a collection - * - * @param collection - * @param fn - */ - function each(collection, fn) { - var i = 0, - length = collection.length, - cont; + this.move(next); + this.history.unshift(next); + if (this.history.length > 3) { + this.history.pop(); + } + if (flushChanges) { + flush(); + } + return true; + }; - for(i; i < length; i++) { - cont = fn(collection[i], i); - if(cont === false) { - break; //allow early exit + _Tether.prototype.move = function(position) { + var css, elVal, found, key, moved, offsetParent, point, same, transcribe, type, val, write, writeCSS, _i, _len, _ref1, _ref2, + _this = this; + if (this.element.parentNode == null) { + return; + } + same = {}; + for (type in position) { + same[type] = {}; + for (key in position[type]) { + found = false; + _ref1 = this.history; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + point = _ref1[_i]; + if (!within((_ref2 = point[type]) != null ? _ref2[key] : void 0, position[type][key])) { + found = true; + break; } + } + if (!found) { + same[type][key] = true; + } } - } - - /** - * Helper function for determining whether target object is an array - * - * @param target the object under test - * @return {Boolean} true if array, false otherwise - */ - function isArray(target) { - return Object.prototype.toString.apply(target) === '[object Array]'; - } - - /** - * Helper function for determining whether target object is a function - * - * @param target the object under test - * @return {Boolean} true if function, false otherwise - */ - function isFunction(target) { - return typeof target === 'function'; - } - - /** - * Delegate to handle a media query being matched and unmatched. - * - * @param {object} options - * @param {function} options.match callback for when the media query is matched - * @param {function} [options.unmatch] callback for when the media query is unmatched - * @param {function} [options.setup] one-time callback triggered the first time a query is matched - * @param {boolean} [options.deferSetup=false] should the setup callback be run immediately, rather than first time query is matched? - * @constructor - */ - function QueryHandler(options) { - this.options = options; - !options.deferSetup && this.setup(); - } - QueryHandler.prototype = { - - /** - * coordinates setup of the handler - * - * @function - */ - setup : function() { - if(this.options.setup) { - this.options.setup(); - } - this.initialised = true; - }, - - /** - * coordinates setup and triggering of the handler - * - * @function - */ - on : function() { - !this.initialised && this.setup(); - this.options.match && this.options.match(); - }, - - /** - * coordinates the unmatch event for the handler - * - * @function - */ - off : function() { - this.options.unmatch && this.options.unmatch(); - }, + } + css = { + top: '', + left: '', + right: '', + bottom: '' + }; + transcribe = function(same, pos) { + var xPos, yPos, _ref3; + if (((_ref3 = _this.options.optimizations) != null ? _ref3.gpu : void 0) !== false) { + if (same.top) { + css.top = 0; + yPos = pos.top; + } else { + css.bottom = 0; + yPos = -pos.bottom; + } + if (same.left) { + css.left = 0; + xPos = pos.left; + } else { + css.right = 0; + xPos = -pos.right; + } + css[transformKey] = "translateX(" + (Math.round(xPos)) + "px) translateY(" + (Math.round(yPos)) + "px)"; + if (transformKey !== 'msTransform') { + return css[transformKey] += " translateZ(0)"; + } + } else { + if (same.top) { + css.top = "" + pos.top + "px"; + } else { + css.bottom = "" + pos.bottom + "px"; + } + if (same.left) { + return css.left = "" + pos.left + "px"; + } else { + return css.right = "" + pos.right + "px"; + } + } + }; + moved = false; + if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) { + css.position = 'absolute'; + transcribe(same.page, position.page); + } else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) { + css.position = 'fixed'; + transcribe(same.viewport, position.viewport); + } else if ((same.offset != null) && same.offset.top && same.offset.left) { + css.position = 'absolute'; + offsetParent = this.cache('target-offsetparent', function() { + return getOffsetParent(_this.target); + }); + if (getOffsetParent(this.element) !== offsetParent) { + defer(function() { + _this.element.parentNode.removeChild(_this.element); + return offsetParent.appendChild(_this.element); + }); + } + transcribe(same.offset, position.offset); + moved = true; + } else { + css.position = 'absolute'; + transcribe({ + top: true, + left: true + }, position.page); + } + if (!moved && this.element.parentNode.tagName !== 'BODY') { + this.element.parentNode.removeChild(this.element); + document.body.appendChild(this.element); + } + writeCSS = {}; + write = false; + for (key in css) { + val = css[key]; + elVal = this.element.style[key]; + if (elVal !== '' && val !== '' && (key === 'top' || key === 'left' || key === 'bottom' || key === 'right')) { + elVal = parseFloat(elVal); + val = parseFloat(val); + } + if (elVal !== val) { + write = true; + writeCSS[key] = css[key]; + } + } + if (write) { + return defer(function() { + return extend(_this.element.style, writeCSS); + }); + } + }; - /** - * called when a handler is to be destroyed. - * delegates to the destroy or unmatch callbacks, depending on availability. - * - * @function - */ - destroy : function() { - this.options.destroy ? this.options.destroy() : this.off(); - }, + return _Tether; - /** - * determines equality by reference. - * if object is supplied compare options, if function, compare match callback - * - * @function - * @param {object || function} [target] the target for comparison - */ - equals : function(target) { - return this.options === target || this.options.match === target; - } + })(); - }; - /** - * Represents a single media query, manages it's state and registered handlers for this query - * - * @constructor - * @param {string} query the media query string - * @param {boolean} [isUnconditional=false] whether the media query should run regardless of whether the conditions are met. Primarily for helping older browsers deal with mobile-first design - */ - function MediaQuery(query, isUnconditional) { - this.query = query; - this.isUnconditional = isUnconditional; - this.handlers = []; - this.mql = matchMedia(query); + Tether.position = position; - var self = this; - this.listener = function(mql) { - self.mql = mql; - self.assess(); - }; - this.mql.addListener(this.listener); - } - MediaQuery.prototype = { + this.Tether = extend(_Tether, Tether); - /** - * add a handler for this query, triggering if already active - * - * @param {object} handler - * @param {function} handler.match callback for when query is activated - * @param {function} [handler.unmatch] callback for when query is deactivated - * @param {function} [handler.setup] callback for immediate execution when a query handler is registered - * @param {boolean} [handler.deferSetup=false] should the setup callback be deferred until the first time the handler is matched? - */ - addHandler : function(handler) { - var qh = new QueryHandler(handler); - this.handlers.push(qh); + }).call(this); - this.matches() && qh.on(); - }, + (function() { + var BOUNDS_FORMAT, MIRROR_ATTACH, defer, extend, getBoundingRect, getBounds, getOuterSize, getSize, updateClasses, _ref, + __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; - /** - * removes the given handler from the collection, and calls it's destroy methods - * - * @param {object || function} handler the handler to remove - */ - removeHandler : function(handler) { - var handlers = this.handlers; - each(handlers, function(h, i) { - if(h.equals(handler)) { - h.destroy(); - return !handlers.splice(i,1); //remove from array and exit each early - } - }); - }, + _ref = this.Tether.Utils, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getSize = _ref.getSize, extend = _ref.extend, updateClasses = _ref.updateClasses, defer = _ref.defer; - /** - * Determine whether the media query should be considered a match - * - * @return {Boolean} true if media query can be considered a match, false otherwise - */ - matches : function() { - return this.mql.matches || this.isUnconditional; - }, + MIRROR_ATTACH = { + left: 'right', + right: 'left', + top: 'bottom', + bottom: 'top', + middle: 'middle' + }; - /** - * Clears all handlers and unbinds events - */ - clear : function() { - each(this.handlers, function(handler) { - handler.destroy(); - }); - this.mql.removeListener(this.listener); - this.handlers.length = 0; //clear array - }, + BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom']; - /* - * Assesses the query, turning on all handlers if it matches, turning them off if it doesn't match - */ - assess : function() { - var action = this.matches() ? 'on' : 'off'; + getBoundingRect = function(tether, to) { + var i, pos, side, size, style, _i, _len; + if (to === 'scrollParent') { + to = tether.scrollParent; + } else if (to === 'window') { + to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset]; + } + if (to === document) { + to = to.documentElement; + } + if (to.nodeType != null) { + pos = size = getBounds(to); + style = getComputedStyle(to); + to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top]; + for (i = _i = 0, _len = BOUNDS_FORMAT.length; _i < _len; i = ++_i) { + side = BOUNDS_FORMAT[i]; + side = side[0].toUpperCase() + side.substr(1); + if (side === 'Top' || side === 'Left') { + to[i] += parseFloat(style["border" + side + "Width"]); + } else { + to[i] -= parseFloat(style["border" + side + "Width"]); + } + } + } + return to; + }; - each(this.handlers, function(handler) { - handler[action](); - }); + this.Tether.modules.push({ + position: function(_arg) { + var addClasses, allClasses, attachment, bounds, changeAttachX, changeAttachY, cls, constraint, eAttachment, height, left, oob, oobClass, p, pin, pinned, pinnedClass, removeClass, side, tAttachment, targetAttachment, targetHeight, targetSize, targetWidth, to, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _len5, _m, _n, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, + _this = this; + top = _arg.top, left = _arg.left, targetAttachment = _arg.targetAttachment; + if (!this.options.constraints) { + return true; + } + removeClass = function(prefix) { + var side, _i, _len, _results; + _this.removeClass(prefix); + _results = []; + for (_i = 0, _len = BOUNDS_FORMAT.length; _i < _len; _i++) { + side = BOUNDS_FORMAT[_i]; + _results.push(_this.removeClass("" + prefix + "-" + side)); + } + return _results; + }; + _ref1 = this.cache('element-bounds', function() { + return getBounds(_this.element); + }), height = _ref1.height, width = _ref1.width; + if (width === 0 && height === 0 && (this.lastSize != null)) { + _ref2 = this.lastSize, width = _ref2.width, height = _ref2.height; + } + targetSize = this.cache('target-bounds', function() { + return _this.getTargetBounds(); + }); + targetHeight = targetSize.height; + targetWidth = targetSize.width; + tAttachment = {}; + eAttachment = {}; + allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')]; + _ref3 = this.options.constraints; + for (_i = 0, _len = _ref3.length; _i < _len; _i++) { + constraint = _ref3[_i]; + if (constraint.outOfBoundsClass) { + allClasses.push(constraint.outOfBoundsClass); + } + if (constraint.pinnedClass) { + allClasses.push(constraint.pinnedClass); + } + } + for (_j = 0, _len1 = allClasses.length; _j < _len1; _j++) { + cls = allClasses[_j]; + _ref4 = ['left', 'top', 'right', 'bottom']; + for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) { + side = _ref4[_k]; + allClasses.push("" + cls + "-" + side); + } + } + addClasses = []; + tAttachment = extend({}, targetAttachment); + eAttachment = extend({}, this.attachment); + _ref5 = this.options.constraints; + for (_l = 0, _len3 = _ref5.length; _l < _len3; _l++) { + constraint = _ref5[_l]; + to = constraint.to, attachment = constraint.attachment, pin = constraint.pin; + if (attachment == null) { + attachment = ''; + } + if (__indexOf.call(attachment, ' ') >= 0) { + _ref6 = attachment.split(' '), changeAttachY = _ref6[0], changeAttachX = _ref6[1]; + } else { + changeAttachX = changeAttachY = attachment; + } + bounds = getBoundingRect(this, to); + if (changeAttachY === 'target' || changeAttachY === 'both') { + if (top < bounds[1] && tAttachment.top === 'top') { + top += targetHeight; + tAttachment.top = 'bottom'; + } + if (top + height > bounds[3] && tAttachment.top === 'bottom') { + top -= targetHeight; + tAttachment.top = 'top'; + } + } + if (changeAttachY === 'together') { + if (top < bounds[1] && tAttachment.top === 'top') { + if (eAttachment.top === 'bottom') { + top += targetHeight; + tAttachment.top = 'bottom'; + top += height; + eAttachment.top = 'top'; + } else if (eAttachment.top === 'top') { + top += targetHeight; + tAttachment.top = 'bottom'; + top -= height; + eAttachment.top = 'bottom'; + } + } + if (top + height > bounds[3] && tAttachment.top === 'bottom') { + if (eAttachment.top === 'top') { + top -= targetHeight; + tAttachment.top = 'top'; + top -= height; + eAttachment.top = 'bottom'; + } else if (eAttachment.top === 'bottom') { + top -= targetHeight; + tAttachment.top = 'top'; + top += height; + eAttachment.top = 'top'; + } + } + if (tAttachment.top === 'middle') { + if (top + height > bounds[3] && eAttachment.top === 'top') { + top -= height; + eAttachment.top = 'bottom'; + } else if (top < bounds[1] && eAttachment.top === 'bottom') { + top += height; + eAttachment.top = 'top'; + } + } } - }; - /** - * Allows for registration of query handlers. - * Manages the query handler's state and is responsible for wiring up browser events - * - * @constructor - */ - function MediaQueryDispatch () { - if(!matchMedia) { - throw new Error('matchMedia not present, legacy browsers require a polyfill'); + if (changeAttachX === 'target' || changeAttachX === 'both') { + if (left < bounds[0] && tAttachment.left === 'left') { + left += targetWidth; + tAttachment.left = 'right'; + } + if (left + width > bounds[2] && tAttachment.left === 'right') { + left -= targetWidth; + tAttachment.left = 'left'; + } } - - this.queries = {}; - this.browserIsIncapable = !matchMedia('only all').matches; - } - - MediaQueryDispatch.prototype = { - - /** - * Registers a handler for the given media query - * - * @param {string} q the media query - * @param {object || Array || Function} options either a single query handler object, a function, or an array of query handlers - * @param {function} options.match fired when query matched - * @param {function} [options.unmatch] fired when a query is no longer matched - * @param {function} [options.setup] fired when handler first triggered - * @param {boolean} [options.deferSetup=false] whether setup should be run immediately or deferred until query is first matched - * @param {boolean} [shouldDegrade=false] whether this particular media query should always run on incapable browsers - */ - register : function(q, options, shouldDegrade) { - var queries = this.queries, - isUnconditional = shouldDegrade && this.browserIsIncapable; - - if(!queries[q]) { - queries[q] = new MediaQuery(q, isUnconditional); + if (changeAttachX === 'together') { + if (left < bounds[0] && tAttachment.left === 'left') { + if (eAttachment.left === 'right') { + left += targetWidth; + tAttachment.left = 'right'; + left += width; + eAttachment.left = 'left'; + } else if (eAttachment.left === 'left') { + left += targetWidth; + tAttachment.left = 'right'; + left -= width; + eAttachment.left = 'right'; } - - //normalise to object in an array - if(isFunction(options)) { - options = { match : options }; + } else if (left + width > bounds[2] && tAttachment.left === 'right') { + if (eAttachment.left === 'left') { + left -= targetWidth; + tAttachment.left = 'left'; + left -= width; + eAttachment.left = 'right'; + } else if (eAttachment.left === 'right') { + left -= targetWidth; + tAttachment.left = 'left'; + left += width; + eAttachment.left = 'left'; } - if(!isArray(options)) { - options = [options]; + } else if (tAttachment.left === 'center') { + if (left + width > bounds[2] && eAttachment.left === 'left') { + left -= width; + eAttachment.left = 'right'; + } else if (left < bounds[0] && eAttachment.left === 'right') { + left += width; + eAttachment.left = 'left'; } - each(options, function(handler) { - queries[q].addHandler(handler); - }); - - return this; - }, - - /** - * unregisters a query and all it's handlers, or a specific handler for a query - * - * @param {string} q the media query to target - * @param {object || function} [handler] specific handler to unregister - */ - unregister : function(q, handler) { - var query = this.queries[q]; - - if(query) { - if(handler) { - query.removeHandler(handler); - } - else { - query.clear(); - delete this.queries[q]; - } + } + } + if (changeAttachY === 'element' || changeAttachY === 'both') { + if (top < bounds[1] && eAttachment.top === 'bottom') { + top += height; + eAttachment.top = 'top'; + } + if (top + height > bounds[3] && eAttachment.top === 'top') { + top -= height; + eAttachment.top = 'bottom'; + } + } + if (changeAttachX === 'element' || changeAttachX === 'both') { + if (left < bounds[0] && eAttachment.left === 'right') { + left += width; + eAttachment.left = 'left'; + } + if (left + width > bounds[2] && eAttachment.left === 'left') { + left -= width; + eAttachment.left = 'right'; + } + } + if (typeof pin === 'string') { + pin = (function() { + var _len4, _m, _ref7, _results; + _ref7 = pin.split(','); + _results = []; + for (_m = 0, _len4 = _ref7.length; _m < _len4; _m++) { + p = _ref7[_m]; + _results.push(p.trim()); } - - return this; + return _results; + })(); + } else if (pin === true) { + pin = ['top', 'left', 'right', 'bottom']; + } + pin || (pin = []); + pinned = []; + oob = []; + if (top < bounds[1]) { + if (__indexOf.call(pin, 'top') >= 0) { + top = bounds[1]; + pinned.push('top'); + } else { + oob.push('top'); + } + } + if (top + height > bounds[3]) { + if (__indexOf.call(pin, 'bottom') >= 0) { + top = bounds[3] - height; + pinned.push('bottom'); + } else { + oob.push('bottom'); + } + } + if (left < bounds[0]) { + if (__indexOf.call(pin, 'left') >= 0) { + left = bounds[0]; + pinned.push('left'); + } else { + oob.push('left'); + } + } + if (left + width > bounds[2]) { + if (__indexOf.call(pin, 'right') >= 0) { + left = bounds[2] - width; + pinned.push('right'); + } else { + oob.push('right'); + } + } + if (pinned.length) { + pinnedClass = (_ref7 = this.options.pinnedClass) != null ? _ref7 : this.getClass('pinned'); + addClasses.push(pinnedClass); + for (_m = 0, _len4 = pinned.length; _m < _len4; _m++) { + side = pinned[_m]; + addClasses.push("" + pinnedClass + "-" + side); + } + } + if (oob.length) { + oobClass = (_ref8 = this.options.outOfBoundsClass) != null ? _ref8 : this.getClass('out-of-bounds'); + addClasses.push(oobClass); + for (_n = 0, _len5 = oob.length; _n < _len5; _n++) { + side = oob[_n]; + addClasses.push("" + oobClass + "-" + side); + } + } + if (__indexOf.call(pinned, 'left') >= 0 || __indexOf.call(pinned, 'right') >= 0) { + eAttachment.left = tAttachment.left = false; + } + if (__indexOf.call(pinned, 'top') >= 0 || __indexOf.call(pinned, 'bottom') >= 0) { + eAttachment.top = tAttachment.top = false; + } + if (tAttachment.top !== targetAttachment.top || tAttachment.left !== targetAttachment.left || eAttachment.top !== this.attachment.top || eAttachment.left !== this.attachment.left) { + this.updateAttachClasses(eAttachment, tAttachment); } - }; - - return new MediaQueryDispatch(); - - })); - -/***/ }, -/* 35 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * Copyright 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule warning - */ - - "use strict"; - - var emptyFunction = __webpack_require__(40); - - /** - * Similar to invariant but only logs a warning if the condition is not met. - * This can be used to log issues in development environments in critical - * paths. Removing the logging code for production environments will keep the - * same logic and follow the same code paths. - */ - - var warning = emptyFunction; - - if ("production" !== (undefined)) { - warning = function(condition, format ) {for (var args=[],$__0=2,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]); - if (format === undefined) { - throw new Error( - '`warning(condition, format, ...args)` requires a warning ' + - 'message argument' - ); - } - - if (format.length < 10 || /^[s\W]*$/.test(format)) { - throw new Error( - 'The warning format should be able to uniquely identify this ' + - 'warning. Please, use a more descriptive format than: ' + format - ); - } - - if (format.indexOf('Failed Composite propType: ') === 0) { - return; // Ignore CompositeComponent proptype check. - } - - if (!condition) { - var argIndex = 0; - var message = 'Warning: ' + format.replace(/%s/g, function() {return args[argIndex++];}); - console.warn(message); - try { - // --- Welcome to debugging React --- - // This error was thrown as a convenience so that you can use this stack - // to find the callsite that caused this warning to fire. - throw new Error(message); - } catch(x) {} - } - }; - } - - module.exports = warning; - - -/***/ }, -/* 36 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * Copyright 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule ReactElement - */ - - 'use strict'; - - var ReactContext = __webpack_require__(41); - var ReactCurrentOwner = __webpack_require__(43); - - var assign = __webpack_require__(42); - var warning = __webpack_require__(35); - - var RESERVED_PROPS = { - key: true, - ref: true - }; - - /** - * Warn for mutations. - * - * @internal - * @param {object} object - * @param {string} key - */ - function defineWarningProperty(object, key) { - Object.defineProperty(object, key, { - - configurable: false, - enumerable: true, - - get: function() { - if (!this._store) { - return null; } - return this._store[key]; - }, - - set: function(value) { - ("production" !== (undefined) ? warning( - false, - 'Don\'t set the %s property of the React element. Instead, ' + - 'specify the correct value when initially creating the element.', - key - ) : null); - this._store[key] = value; - } - - }); - } - - /** - * This is updated to true if the membrane is successfully created. - */ - var useMutationMembrane = false; - - /** - * Warn for mutations. - * - * @internal - * @param {object} element - */ - function defineMutationMembrane(prototype) { - try { - var pseudoFrozenProperties = { - props: true - }; - for (var key in pseudoFrozenProperties) { - defineWarningProperty(prototype, key); - } - useMutationMembrane = true; - } catch (x) { - // IE will fail on defineProperty - } - } - - /** - * Base constructor for all React elements. This is only used to make this - * work with a dynamic instanceof check. Nothing should live on this prototype. - * - * @param {*} type - * @param {string|object} ref - * @param {*} key - * @param {*} props - * @internal - */ - var ReactElement = function(type, key, ref, owner, context, props) { - // Built-in properties that belong on the element - this.type = type; - this.key = key; - this.ref = ref; - - // Record the component responsible for creating this element. - this._owner = owner; - - // TODO: Deprecate withContext, and then the context becomes accessible - // through the owner. - this._context = context; - - if ("production" !== (undefined)) { - // The validation flag and props are currently mutative. We put them on - // an external backing store so that we can freeze the whole object. - // This can be replaced with a WeakMap once they are implemented in - // commonly used development environments. - this._store = {props: props, originalProps: assign({}, props)}; - - // To make comparing ReactElements easier for testing purposes, we make - // the validation flag non-enumerable (where possible, which should - // include every environment we run tests in), so the test framework - // ignores it. - try { - Object.defineProperty(this._store, 'validated', { - configurable: false, - enumerable: false, - writable: true + defer(function() { + updateClasses(_this.target, addClasses, allClasses); + return updateClasses(_this.element, addClasses, allClasses); }); - } catch (x) { - } - this._store.validated = false; - - // We're not allowed to set props directly on the object so we early - // return and rely on the prototype membrane to forward to the backing - // store. - if (useMutationMembrane) { - Object.freeze(this); - return; + return { + top: top, + left: left + }; } - } - - this.props = props; - }; - - // We intentionally don't expose the function on the constructor property. - // ReactElement should be indistinguishable from a plain object. - ReactElement.prototype = { - _isReactElement: true - }; - - if ("production" !== (undefined)) { - defineMutationMembrane(ReactElement.prototype); - } + }); - ReactElement.createElement = function(type, config, children) { - var propName; + }).call(this); - // Reserved names are extracted - var props = {}; + (function() { + var defer, getBounds, updateClasses, _ref; - var key = null; - var ref = null; + _ref = this.Tether.Utils, getBounds = _ref.getBounds, updateClasses = _ref.updateClasses, defer = _ref.defer; - if (config != null) { - ref = config.ref === undefined ? null : config.ref; - key = config.key === undefined ? null : '' + config.key; - // Remaining properties are added to a new props object - for (propName in config) { - if (config.hasOwnProperty(propName) && - !RESERVED_PROPS.hasOwnProperty(propName)) { - props[propName] = config[propName]; + this.Tether.modules.push({ + position: function(_arg) { + var abutted, addClasses, allClasses, bottom, height, left, right, side, sides, targetPos, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref1, _ref2, _ref3, _ref4, _ref5, + _this = this; + top = _arg.top, left = _arg.left; + _ref1 = this.cache('element-bounds', function() { + return getBounds(_this.element); + }), height = _ref1.height, width = _ref1.width; + targetPos = this.getTargetBounds(); + bottom = top + height; + right = left + width; + abutted = []; + if (top <= targetPos.bottom && bottom >= targetPos.top) { + _ref2 = ['left', 'right']; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + side = _ref2[_i]; + if ((_ref3 = targetPos[side]) === left || _ref3 === right) { + abutted.push(side); + } + } } - } - } - - // Children can be more than one argument, and those are transferred onto - // the newly allocated props object. - var childrenLength = arguments.length - 2; - if (childrenLength === 1) { - props.children = children; - } else if (childrenLength > 1) { - var childArray = Array(childrenLength); - for (var i = 0; i < childrenLength; i++) { - childArray[i] = arguments[i + 2]; - } - props.children = childArray; - } - - // Resolve default props - if (type && type.defaultProps) { - var defaultProps = type.defaultProps; - for (propName in defaultProps) { - if (typeof props[propName] === 'undefined') { - props[propName] = defaultProps[propName]; + if (left <= targetPos.right && right >= targetPos.left) { + _ref4 = ['top', 'bottom']; + for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) { + side = _ref4[_j]; + if ((_ref5 = targetPos[side]) === top || _ref5 === bottom) { + abutted.push(side); + } + } } - } - } - - return new ReactElement( - type, - key, - ref, - ReactCurrentOwner.current, - ReactContext.current, - props - ); - }; - - ReactElement.createFactory = function(type) { - var factory = ReactElement.createElement.bind(null, type); - // Expose the type on the factory and the prototype so that it can be - // easily accessed on elements. E.g. .type === Foo.type. - // This should not be named `constructor` since this may not be the function - // that created the element, and it may not even be a constructor. - // Legacy hook TODO: Warn if this is accessed - factory.type = type; - return factory; - }; - - ReactElement.cloneAndReplaceProps = function(oldElement, newProps) { - var newElement = new ReactElement( - oldElement.type, - oldElement.key, - oldElement.ref, - oldElement._owner, - oldElement._context, - newProps - ); - - if ("production" !== (undefined)) { - // If the key on the original is valid, then the clone is valid - newElement._store.validated = oldElement._store.validated; - } - return newElement; - }; - - ReactElement.cloneElement = function(element, config, children) { - var propName; - - // Original props are copied - var props = assign({}, element.props); - - // Reserved names are extracted - var key = element.key; - var ref = element.ref; - - // Owner will be preserved, unless ref is overridden - var owner = element._owner; - - if (config != null) { - if (config.ref !== undefined) { - // Silently steal the ref from the parent. - ref = config.ref; - owner = ReactCurrentOwner.current; - } - if (config.key !== undefined) { - key = '' + config.key; - } - // Remaining properties override existing props - for (propName in config) { - if (config.hasOwnProperty(propName) && - !RESERVED_PROPS.hasOwnProperty(propName)) { - props[propName] = config[propName]; + allClasses = []; + addClasses = []; + sides = ['left', 'top', 'right', 'bottom']; + allClasses.push(this.getClass('abutted')); + for (_k = 0, _len2 = sides.length; _k < _len2; _k++) { + side = sides[_k]; + allClasses.push("" + (this.getClass('abutted')) + "-" + side); } + if (abutted.length) { + addClasses.push(this.getClass('abutted')); + } + for (_l = 0, _len3 = abutted.length; _l < _len3; _l++) { + side = abutted[_l]; + addClasses.push("" + (this.getClass('abutted')) + "-" + side); + } + defer(function() { + updateClasses(_this.target, addClasses, allClasses); + return updateClasses(_this.element, addClasses, allClasses); + }); + return true; } - } - - // Children can be more than one argument, and those are transferred onto - // the newly allocated props object. - var childrenLength = arguments.length - 2; - if (childrenLength === 1) { - props.children = children; - } else if (childrenLength > 1) { - var childArray = Array(childrenLength); - for (var i = 0; i < childrenLength; i++) { - childArray[i] = arguments[i + 2]; - } - props.children = childArray; - } - - return new ReactElement( - element.type, - key, - ref, - owner, - element._context, - props - ); - }; - - /** - * @param {?object} object - * @return {boolean} True if `object` is a valid component. - * @final - */ - ReactElement.isValidElement = function(object) { - // ReactTestUtils is often used outside of beforeEach where as React is - // within it. This leads to two different instances of React on the same - // page. To identify a element from a different React instance we use - // a flag instead of an instanceof check. - var isElement = !!(object && object._isReactElement); - // if (isElement && !(object instanceof ReactElement)) { - // This is an indicator that you're using multiple versions of React at the - // same time. This will screw with ownership and stuff. Fix it, please. - // TODO: We could possibly warn here. - // } - return isElement; - }; - - module.exports = ReactElement; - - -/***/ }, -/* 37 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * Copyright 2013-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule ReactPropTransferer - */ - - 'use strict'; - - var assign = __webpack_require__(42); - var emptyFunction = __webpack_require__(40); - var joinClasses = __webpack_require__(44); - - /** - * Creates a transfer strategy that will merge prop values using the supplied - * `mergeStrategy`. If a prop was previously unset, this just sets it. - * - * @param {function} mergeStrategy - * @return {function} - */ - function createTransferStrategy(mergeStrategy) { - return function(props, key, value) { - if (!props.hasOwnProperty(key)) { - props[key] = value; - } else { - props[key] = mergeStrategy(props[key], value); - } - }; - } - - var transferStrategyMerge = createTransferStrategy(function(a, b) { - // `merge` overrides the first object's (`props[key]` above) keys using the - // second object's (`value`) keys. An object's style's existing `propA` would - // get overridden. Flip the order here. - return assign({}, b, a); - }); - - /** - * Transfer strategies dictate how props are transferred by `transferPropsTo`. - * NOTE: if you add any more exceptions to this list you should be sure to - * update `cloneWithProps()` accordingly. - */ - var TransferStrategies = { - /** - * Never transfer `children`. - */ - children: emptyFunction, - /** - * Transfer the `className` prop by merging them. - */ - className: createTransferStrategy(joinClasses), - /** - * Transfer the `style` prop (which is an object) by merging them. - */ - style: transferStrategyMerge - }; - - /** - * Mutates the first argument by transferring the properties from the second - * argument. - * - * @param {object} props - * @param {object} newProps - * @return {object} - */ - function transferInto(props, newProps) { - for (var thisKey in newProps) { - if (!newProps.hasOwnProperty(thisKey)) { - continue; - } - - var transferStrategy = TransferStrategies[thisKey]; - - if (transferStrategy && TransferStrategies.hasOwnProperty(thisKey)) { - transferStrategy(props, thisKey, newProps[thisKey]); - } else if (!props.hasOwnProperty(thisKey)) { - props[thisKey] = newProps[thisKey]; - } - } - return props; - } - - /** - * ReactPropTransferer are capable of transferring props to another component - * using a `transferPropsTo` method. - * - * @class ReactPropTransferer - */ - var ReactPropTransferer = { - - /** - * Merge two props objects using TransferStrategies. - * - * @param {object} oldProps original props (they take precedence) - * @param {object} newProps new props to merge in - * @return {object} a new object containing both sets of props merged. - */ - mergeProps: function(oldProps, newProps) { - return transferInto(assign({}, oldProps), newProps); - } - - }; - - module.exports = ReactPropTransferer; - - -/***/ }, -/* 38 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * Copyright 2013-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule keyOf - */ - - /** - * Allows extraction of a minified key. Let's the build system minify keys - * without loosing the ability to dynamically use key strings as values - * themselves. Pass in an object with a single key/val pair and it will return - * you the string key of that single record. Suppose you want to grab the - * value for a key 'className' inside of an object. Key/val minification may - * have aliased that key to be 'xa12'. keyOf({className: null}) will return - * 'xa12' in that case. Resolve keys you want to use once at startup time, then - * reuse those resolutions. - */ - var keyOf = function(oneKeyObj) { - var key; - for (key in oneKeyObj) { - if (!oneKeyObj.hasOwnProperty(key)) { - continue; - } - return key; - } - return null; - }; - - - module.exports = keyOf; - - -/***/ }, -/* 39 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * Copyright 2013-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule invariant - */ - - "use strict"; - - /** - * Use invariant() to assert state which your program assumes to be true. - * - * Provide sprintf-style format (only %s is supported) and arguments - * to provide information about what broke and what you were - * expecting. - * - * The invariant message will be stripped in production, but the invariant - * will remain to ensure logic does not differ in production. - */ + }); - var invariant = function(condition, format, a, b, c, d, e, f) { - if ("production" !== (undefined)) { - if (format === undefined) { - throw new Error('invariant requires an error message argument'); - } - } + }).call(this); - if (!condition) { - var error; - if (format === undefined) { - error = new Error( - 'Minified exception occurred; use the non-minified dev environment ' + - 'for the full error message and additional helpful warnings.' - ); - } else { - var args = [a, b, c, d, e, f]; - var argIndex = 0; - error = new Error( - 'Invariant Violation: ' + - format.replace(/%s/g, function() { return args[argIndex++]; }) - ); + (function() { + this.Tether.modules.push({ + position: function(_arg) { + var left, result, shift, shiftLeft, shiftTop, top, _ref; + top = _arg.top, left = _arg.left; + if (!this.options.shift) { + return; + } + result = function(val) { + if (typeof val === 'function') { + return val.call(this, { + top: top, + left: left + }); + } else { + return val; + } + }; + shift = result(this.options.shift); + if (typeof shift === 'string') { + shift = shift.split(' '); + shift[1] || (shift[1] = shift[0]); + shiftTop = shift[0], shiftLeft = shift[1]; + shiftTop = parseFloat(shiftTop, 10); + shiftLeft = parseFloat(shiftLeft, 10); + } else { + _ref = [shift.top, shift.left], shiftTop = _ref[0], shiftLeft = _ref[1]; + } + top += shiftTop; + left += shiftLeft; + return { + top: top, + left: left + }; } + }); - error.framesToPop = 1; // we don't care about invariant's own frame - throw error; - } - }; - - module.exports = invariant; - - -/***/ }, -/* 40 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * Copyright 2013-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule emptyFunction - */ - - function makeEmptyFunction(arg) { - return function() { - return arg; - }; - } - - /** - * This function accepts and discards inputs; it has no side effects. This is - * primarily useful idiomatically for overridable function endpoints which - * always need to be callable, since JS lacks a null-call idiom ala Cocoa. - */ - function emptyFunction() {} + }).call(this); - emptyFunction.thatReturns = makeEmptyFunction; - emptyFunction.thatReturnsFalse = makeEmptyFunction(false); - emptyFunction.thatReturnsTrue = makeEmptyFunction(true); - emptyFunction.thatReturnsNull = makeEmptyFunction(null); - emptyFunction.thatReturnsThis = function() { return this; }; - emptyFunction.thatReturnsArgument = function(arg) { return arg; }; + return this.Tether; - module.exports = emptyFunction; + })); /***/ }, -/* 41 */ +/* 30 */ /***/ function(module, exports, __webpack_require__) { - /** - * Copyright 2013-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule ReactContext - */ - 'use strict'; - var assign = __webpack_require__(42); - var emptyObject = __webpack_require__(45); - var warning = __webpack_require__(35); + var React = __webpack_require__(2); - var didWarn = false; - - /** - * Keeps track of the current context. - * - * The context is automatically passed down the component ownership hierarchy - * and is accessible via `this.context` on ReactCompositeComponents. - */ - var ReactContext = { - - /** - * @internal - * @type {object} - */ - current: emptyObject, - - /** - * Temporarily extends the current context while executing scopedCallback. - * - * A typical use case might look like - * - * render: function() { - * var children = ReactContext.withContext({foo: 'foo'}, () => ( - * - * )); - * return
{children}
; - * } - * - * @param {object} newContext New context to merge into the existing context - * @param {function} scopedCallback Callback to run with the new context - * @return {ReactComponent|array} - */ - withContext: function(newContext, scopedCallback) { - if ("production" !== (undefined)) { - ("production" !== (undefined) ? warning( - didWarn, - 'withContext is deprecated and will be removed in a future version. ' + - 'Use a wrapper component with getChildContext instead.' - ) : null); - - didWarn = true; - } + var Tabs = React.createClass({ + displayName: 'Tabs', - var result; - var previousContext = ReactContext.current; - ReactContext.current = assign({}, previousContext, newContext); - try { - result = scopedCallback(); - } finally { - ReactContext.current = previousContext; - } - return result; + getInitialState: function getInitialState() { + return { + selectedTab: 0 + }; + }, + selectTab: function selectTab(options) { + this.setState(options); + }, + render: function render() { + var content = null; + var children = React.Children.map(this.props.children, (function (child, index) { + if (index === this.state.selectedTab) content = child.props.children; + return React.cloneElement(child, { + active: index === this.state.selectedTab, + index: index, + selectTab: this.selectTab + }); + }).bind(this)); + return React.createElement( + 'div', + null, + React.createElement( + 'div', + { className: 'tabs' }, + children + ), + React.createElement( + 'div', + { className: 'content' }, + content + ) + ); } + }); - }; - - module.exports = ReactContext; - + module.exports = Tabs; + Tabs.Tab = __webpack_require__(31); /***/ }, -/* 42 */ +/* 31 */ /***/ function(module, exports, __webpack_require__) { - /** - * Copyright 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule Object.assign - */ - - // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign - 'use strict'; - function assign(target, sources) { - if (target == null) { - throw new TypeError('Object.assign target cannot be null or undefined'); - } - - var to = Object(target); - var hasOwnProperty = Object.prototype.hasOwnProperty; + var React = __webpack_require__(2); + var classnames = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"classnames\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())); - for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) { - var nextSource = arguments[nextIndex]; - if (nextSource == null) { - continue; - } - - var from = Object(nextSource); - - // We don't currently support accessors nor proxies. Therefore this - // copy cannot throw. If we ever supported this then we must handle - // exceptions and side-effects. We don't support symbols so they won't - // be transferred. + var Tab = React.createClass({ + displayName: 'Tab', - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } + select: function select() { + var options = { + selectedTab: this.props.index + }; + this.props.selectTab(options); + }, + render: function render() { + var classes = { + 'tab-item': true, + 'is-active': this.props.active + }; + return React.createElement( + 'div', + { className: classnames(classes), onClick: this.select }, + this.props.title + ); } + }); - return to; - } - - module.exports = assign; - + module.exports = Tab; /***/ }, -/* 43 */ +/* 32 */ /***/ function(module, exports, __webpack_require__) { - /** - * Copyright 2013-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule ReactCurrentOwner - */ - 'use strict'; - /** - * Keeps track of the current owner. - * - * The current owner is the component who should own any components that are - * currently being constructed. - * - * The depth indicate how many composite components are above this render level. - */ - var ReactCurrentOwner = { - - /** - * @internal - * @type {ReactComponent} - */ - current: null - - }; - - module.exports = ReactCurrentOwner; - - -/***/ }, -/* 44 */ -/***/ function(module, exports, __webpack_require__) { + var React = __webpack_require__(2); + var ReactDOM = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"react-dom\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())); + var foundationApi = __webpack_require__(5); + var PopupToggle = __webpack_require__(33); - /** - * Copyright 2013-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule joinClasses - * @typechecks static-only - */ + var Trigger = React.createClass({ + displayName: 'Trigger', - 'use strict'; + getDefaultProps: function getDefaultProps() { + return { + open: null, + close: null, + toggle: null, + hardToggle: null, + popupToggle: null, + notify: null + }; + }, + getCloseId: function getCloseId() { + if (this.props.close) { + return this.props.close; + } else { + var parentElement = false; + var tempElement = ReactDOM.findDOMNode(this).parentNode; + while (parentElement === false) { + if (tempElement.nodeName == 'BODY') { + parentElement = ''; + } + if (typeof tempElement.getAttribute('data-closable') !== 'undefined' && tempElement.getAttribute('data-closable') !== false) { + parentElement = tempElement; + } - /** - * Combines multiple className strings into one. - * http://jsperf.com/joinclasses-args-vs-array - * - * @param {...?string} classes - * @return {string} - */ - function joinClasses(className/*, ... */) { - if (!className) { - className = ''; - } - var nextClass; - var argLength = arguments.length; - if (argLength > 1) { - for (var ii = 1; ii < argLength; ii++) { - nextClass = arguments[ii]; - if (nextClass) { - className = (className ? className + ' ' : '') + nextClass; + tempElement = tempElement.parentNode; } + return parentElement.getAttribute('id'); + } + }, + clickHandler: function clickHandler(e) { + e.preventDefault(); + if (this.props.open) { + foundationApi.publish(this.props.open, 'open'); + } else if (this.props.close !== null) { + foundationApi.publish(this.getCloseId(), 'close'); + } else if (this.props.toggle) { + foundationApi.publish(this.props.toggle, 'toggle'); + } else if (this.props.hardToggle) { + foundationApi.closeActiveElements({ exclude: this.props.hardToggle }); + foundationApi.publish(this.props.hardToggle, 'toggle'); + } else if (this.props.notify) { + foundationApi.publish(this.props.notify, { + title: this.props.title, + content: this.props.content, + position: this.props.position, + color: this.props.color, + image: this.props.image + }); + } + }, + render: function render() { + if (this.props.popupToggle) { + return React.createElement(PopupToggle, this.props); + } else { + var child = React.Children.only(this.props.children); + return React.cloneElement(child, { + onClick: this.clickHandler + }); } } - return className; - } - - module.exports = joinClasses; + }); + module.exports = Trigger; /***/ }, -/* 45 */ +/* 33 */ /***/ function(module, exports, __webpack_require__) { - /** - * Copyright 2013-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule emptyObject - */ - - "use strict"; - - var emptyObject = {}; - - if ("production" !== (undefined)) { - Object.freeze(emptyObject); - } - - module.exports = emptyObject; + 'use strict'; + var React = __webpack_require__(2); + var foundationApi = __webpack_require__(5); -/***/ }, -/* 46 */ -/***/ function(module, exports, __webpack_require__) { + var PopupToggle = React.createClass({ + displayName: 'PopupToggle', - var camel2hyphen = function (str) { - return str - .replace(/[A-Z]/g, function (match) { - return '-' + match.toLowerCase(); - }) - .toLowerCase(); - }; + clickHandler: function clickHandler(id, e) { + e.preventDefault(); + foundationApi.publish(this.props.popupToggle, ['toggle', id]); + }, + render: function render() { + var child = React.Children.only(this.props.children); + var id = this.props.id || foundationApi.generateUuid(); + return React.cloneElement(child, { + id: id, + onClick: this.clickHandler.bind(this, id) + }); + } + }); - module.exports = camel2hyphen; + module.exports = PopupToggle; /***/ } /******/ ]) diff --git a/dist/react-foundation-apps.min.js b/dist/react-foundation-apps.min.js index bc6a42b..7b9840c 100644 --- a/dist/react-foundation-apps.min.js +++ b/dist/react-foundation-apps.min.js @@ -1,3 +1,2 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.RFA=e(require("react")):t.RFA=e(t.React)}(this,function(t){return function(t){function e(i){if(n[i])return n[i].exports;var o=n[i]={exports:{},id:i,loaded:!1};return t[i].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){t.exports={Accordion:n(23),ActionSheet:n(2),Iconic:n(3),Interchange:n(4),Modal:n(5),Notification:n(6),OffCanvas:n(7),Panel:n(8),Popup:n(9),Tabs:n(10),Trigger:n(11)}},function(t,e,n){var i,o;/*! tether 0.6.5 */ -!function(s,r){i=r,o="function"==typeof i?i.call(e,n,e,t):i,!(void 0!==o&&(t.exports=o))}(this,function(t,e,n){return function(){var t,e,n,i,o,s,r,a,l,c,h,u,p,f,d,m,g,v,b,y={}.hasOwnProperty,w=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},C=[].slice;null==this.Tether&&(this.Tether={modules:[]}),u=function(t){var e,n,i,o,s;if(n=getComputedStyle(t).position,"fixed"===n)return t;for(i=void 0,e=t;e=e.parentNode;){try{o=getComputedStyle(e)}catch(r){}if(null==o)return e;if(/(auto|scroll)/.test(o.overflow+o.overflowY+o.overflowX)&&("absolute"!==n||"relative"===(s=o.position)||"absolute"===s||"fixed"===s))return e}return document.body},g=function(){var t;return t=0,function(){return t++}}(),b={},c=function(t){var e,i,s,r,a;if(s=t._tetherZeroElement,null==s&&(s=t.createElement("div"),s.setAttribute("data-tether-id",g()),o(s.style,{top:0,left:0,position:"absolute"}),t.body.appendChild(s),t._tetherZeroElement=s),e=s.getAttribute("data-tether-id"),null==b[e]){b[e]={},a=s.getBoundingClientRect();for(i in a)r=a[i],b[e][i]=r;n(function(){return b[e]=void 0})}return b[e]},f=null,r=function(t){var e,n,i,o,s,r,a;t===document?(n=document,t=document.documentElement):n=t.ownerDocument,i=n.documentElement,e={},a=t.getBoundingClientRect();for(o in a)r=a[o],e[o]=r;return s=c(n),e.top-=s.top,e.left-=s.left,null==e.width&&(e.width=document.body.scrollWidth-e.left-e.right),null==e.height&&(e.height=document.body.scrollHeight-e.top-e.bottom),e.top=e.top-i.clientTop,e.left=e.left-i.clientLeft,e.right=n.body.clientWidth-e.width-e.left,e.bottom=n.body.clientHeight-e.height-e.top,e},l=function(t){return t.offsetParent||document.documentElement},h=function(){var t,e,n,i,s;return t=document.createElement("div"),t.style.width="100%",t.style.height="200px",e=document.createElement("div"),o(e.style,{position:"absolute",top:0,left:0,pointerEvents:"none",visibility:"hidden",width:"200px",height:"150px",overflow:"hidden"}),e.appendChild(t),document.body.appendChild(e),i=t.offsetWidth,e.style.overflow="scroll",s=t.offsetWidth,i===s&&(s=e.clientWidth),document.body.removeChild(e),n=i-s,{width:n,height:n}},o=function(t){var e,n,i,o,s,r,a;for(null==t&&(t={}),e=[],Array.prototype.push.apply(e,arguments),a=e.slice(1),s=0,r=a.length;r>s;s++)if(i=a[s])for(n in i)y.call(i,n)&&(o=i[n],t[n]=o);return t},d=function(t,e){var n,i,o,s,r,l;if(null!=t.classList){for(r=e.split(" "),l=[],o=0,s=r.length;s>o;o++)i=r[o],i.trim()&&l.push(t.classList.remove(i));return l}return n=a(t).replace(new RegExp("(^| )"+e.split(" ").join("|")+"( |$)","gi")," "),m(t,n)},e=function(t,e){var n,i,o,s,r;if(null!=t.classList){for(s=e.split(" "),r=[],i=0,o=s.length;o>i;i++)n=s[i],n.trim()&&r.push(t.classList.add(n));return r}return d(t,e),n=a(t)+(" "+e),m(t,n)},p=function(t,e){return null!=t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(a(t))},a=function(t){return t.className instanceof SVGAnimatedString?t.className.baseVal:t.className},m=function(t,e){return t.setAttribute("class",e)},v=function(t,n,i){var o,s,r,a,l,c;for(s=0,a=i.length;a>s;s++)o=i[s],w.call(n,o)<0&&p(t,o)&&d(t,o);for(c=[],r=0,l=n.length;l>r;r++)o=n[r],c.push(p(t,o)?void 0:e(t,o));return c},i=[],n=function(t){return i.push(t)},s=function(){var t,e;for(e=[];t=i.pop();)e.push(t());return e},t=function(){function t(){}return t.prototype.on=function(t,e,n,i){var o;return null==i&&(i=!1),null==this.bindings&&(this.bindings={}),null==(o=this.bindings)[t]&&(o[t]=[]),this.bindings[t].push({handler:e,ctx:n,once:i})},t.prototype.once=function(t,e,n){return this.on(t,e,n,!0)},t.prototype.off=function(t,e){var n,i,o;if(null!=(null!=(i=this.bindings)?i[t]:void 0)){if(null==e)return delete this.bindings[t];for(n=0,o=[];n=e&&e>=t-n},x=function(){var t,e,n,i,o;for(t=document.createElement("div"),o=["transform","webkitTransform","OTransform","MozTransform","msTransform"],n=0,i=o.length;i>n;n++)if(e=o[n],void 0!==t.style[e])return e}(),E=[],C=function(){var t,e,n;for(e=0,n=E.length;n>e;e++)t=E[e],t.position(!1);return h()},v=function(){var t;return null!=(t="undefined"!=typeof performance&&null!==performance&&"function"==typeof performance.now?performance.now():void 0)?t:+new Date},function(){var t,e,n,i,o,s,r,a,l;for(e=null,n=null,i=null,o=function(){if(null!=n&&n>16)return n=Math.min(n-16,250),void(i=setTimeout(o,250));if(!(null!=e&&v()-e<10))return null!=i&&(clearTimeout(i),i=null),e=v(),C(),n=v()-e},a=["resize","scroll","touchmove"],l=[],s=0,r=a.length;r>s;s++)t=a[s],l.push(window.addEventListener(t,o));return l}(),t={center:"center",left:"right",right:"left"},e={middle:"middle",top:"bottom",bottom:"top"},n={top:0,left:0,middle:"50%",center:"50%",bottom:"100%",right:"100%"},a=function(n,i){var o,s;return o=n.left,s=n.top,"auto"===o&&(o=t[i.left]),"auto"===s&&(s=e[i.top]),{left:o,top:s}},r=function(t){var e,i;return{left:null!=(e=n[t.left])?e:t.left,top:null!=(i=n[t.top])?i:t.top}},s=function(){var t,e,n,i,o,s,r;for(e=1<=arguments.length?A.call(arguments,0):[],n={top:0,left:0},o=0,s=e.length;s>o;o++)r=e[o],i=r.top,t=r.left,"string"==typeof i&&(i=parseFloat(i,10)),"string"==typeof t&&(t=parseFloat(t,10)),n.top+=i,n.left+=t;return n},b=function(t,e){return"string"==typeof t.left&&-1!==t.left.indexOf("%")&&(t.left=parseFloat(t.left,10)/100*e.width),"string"==typeof t.top&&-1!==t.top.indexOf("%")&&(t.top=parseFloat(t.top,10)/100*e.height),t},y=w=function(t){var e,n,i;return i=t.split(" "),n=i[0],e=i[1],{top:n,left:e}},T=function(){function t(t){this.position=M(this.position,this);var e,n,o,s,r;for(E.push(this),this.history=[],this.setOptions(t,!1),s=i.modules,n=0,o=s.length;o>n;n++)e=s[n],null!=(r=e.initialize)&&r.call(this);this.position()}return t.modules=[],t.prototype.getClass=function(t){var e,n;return(null!=(e=this.options.classes)?e[t]:void 0)?this.options.classes[t]:(null!=(n=this.options.classes)?n[t]:void 0)!==!1?this.options.classPrefix?""+this.options.classPrefix+"-"+t:t:""},t.prototype.setOptions=function(t,e){var n,i,s,r,a,l;for(this.options=t,null==e&&(e=!0),n={offset:"0 0",targetOffset:"0 0",targetAttachment:"auto auto",classPrefix:"tether"},this.options=c(n,this.options),a=this.options,this.element=a.element,this.target=a.target,this.targetModifier=a.targetModifier,"viewport"===this.target?(this.target=document.body,this.targetModifier="visible"):"scroll-handle"===this.target&&(this.target=document.body,this.targetModifier="scroll-handle"),l=["element","target"],s=0,r=l.length;r>s;s++){if(i=l[s],null==this[i])throw new Error("Tether Error: Both element and target must be defined");null!=this[i].jquery?this[i]=this[i][0]:"string"==typeof this[i]&&(this[i]=document.querySelector(this[i]))}if(o(this.element,this.getClass("element")),o(this.target,this.getClass("target")),!this.options.attachment)throw new Error("Tether Error: You must provide an attachment");return this.targetAttachment=y(this.options.targetAttachment),this.attachment=y(this.options.attachment),this.offset=w(this.options.offset),this.targetOffset=w(this.options.targetOffset),null!=this.scrollParent&&this.disable(),"scroll-handle"===this.targetModifier?this.scrollParent=this.target:this.scrollParent=m(this.target),this.options.enabled!==!1?this.enable(e):void 0},t.prototype.getTargetBounds=function(){var t,e,n,i,o,s,r,a,l;if(null==this.targetModifier)return u(this.target);switch(this.targetModifier){case"visible":return this.target===document.body?{top:pageYOffset,left:pageXOffset,height:innerHeight,width:innerWidth}:(t=u(this.target),o={height:t.height,width:t.width,top:t.top,left:t.left},o.height=Math.min(o.height,t.height-(pageYOffset-t.top)),o.height=Math.min(o.height,t.height-(t.top+t.height-(pageYOffset+innerHeight))),o.height=Math.min(innerHeight,o.height),o.height-=2,o.width=Math.min(o.width,t.width-(pageXOffset-t.left)),o.width=Math.min(o.width,t.width-(t.left+t.width-(pageXOffset+innerWidth))),o.width=Math.min(innerWidth,o.width),o.width-=2,o.topl.clientWidth||"scroll"===[a.overflow,a.overflowX]||this.target!==document.body,s=0,n&&(s=15),i=t.height-parseFloat(a.borderTopWidth)-parseFloat(a.borderBottomWidth)-s,o={width:15,height:.975*i*(i/l.scrollHeight),left:t.left+t.width-parseFloat(a.borderLeftWidth)-15},e=0,408>i&&this.target===document.body&&(e=-11e-5*Math.pow(i,2)-.00727*i+22.58),this.target!==document.body&&(o.height=Math.max(o.height,24)),r=this.target.scrollTop/(l.scrollHeight-i),o.top=r*(i-o.height-e)+t.top+parseFloat(a.borderTopWidth),this.target===document.body&&(o.height=Math.max(o.height,24)),o}},t.prototype.clearCache=function(){return this._cache={}},t.prototype.cache=function(t,e){return null==this._cache&&(this._cache={}),null==this._cache[t]&&(this._cache[t]=e.call(this)),this._cache[t]},t.prototype.enable=function(t){return null==t&&(t=!0),o(this.target,this.getClass("enabled")),o(this.element,this.getClass("enabled")),this.enabled=!0,this.scrollParent!==document&&this.scrollParent.addEventListener("scroll",this.position),t?this.position():void 0},t.prototype.disable=function(){return O(this.target,this.getClass("enabled")),O(this.element,this.getClass("enabled")),this.enabled=!1,null!=this.scrollParent?this.scrollParent.removeEventListener("scroll",this.position):void 0},t.prototype.destroy=function(){var t,e,n,i,o;for(this.disable(),o=[],t=n=0,i=E.length;i>n;t=++n){if(e=E[t],e===this){E.splice(t,1);break}o.push(void 0)}return o},t.prototype.updateAttachClasses=function(t,e){var n,i,o,s,r,a,c,h,u,p=this;for(null==t&&(t=this.attachment),null==e&&(e=this.targetAttachment),s=["left","top","bottom","right","middle","center"],(null!=(u=this._addAttachClasses)?u.length:void 0)&&this._addAttachClasses.splice(0,this._addAttachClasses.length),n=null!=this._addAttachClasses?this._addAttachClasses:this._addAttachClasses=[],t.top&&n.push(""+this.getClass("element-attached")+"-"+t.top),t.left&&n.push(""+this.getClass("element-attached")+"-"+t.left),e.top&&n.push(""+this.getClass("target-attached")+"-"+e.top),e.left&&n.push(""+this.getClass("target-attached")+"-"+e.left),i=[],r=0,c=s.length;c>r;r++)o=s[r],i.push(""+this.getClass("element-attached")+"-"+o);for(a=0,h=s.length;h>a;a++)o=s[a],i.push(""+this.getClass("target-attached")+"-"+o);return l(function(){return null!=p._addAttachClasses?(S(p.element,p._addAttachClasses,i),S(p.target,p._addAttachClasses,i),p._addAttachClasses=void 0):void 0})},t.prototype.position=function(t){var e,n,o,l,c,f,m,g,v,y,w,C,O,E,x,S,N,T,P,A,M,I,k,D,W,_,L,j,H,B,U,z,q,R,F,Y=this;if(null==t&&(t=!0),this.enabled){for(this.clearCache(),A=a(this.targetAttachment,this.attachment),this.updateAttachClasses(this.attachment,A),e=this.cache("element-bounds",function(){return u(Y.element)}),W=e.width,o=e.height,0===W&&0===o&&null!=this.lastSize?(B=this.lastSize,W=B.width,o=B.height):this.lastSize={width:W,height:o},k=I=this.cache("target-bounds",function(){return Y.getTargetBounds()}),v=b(r(this.attachment),{width:W,height:o}),M=b(r(A),k),c=b(this.offset,{width:W,height:o}),f=b(this.targetOffset,k),v=s(v,c),M=s(M,f),l=I.left+M.left-v.left,D=I.top+M.top-v.top,U=i.modules,_=0,j=U.length;j>_;_++)if(m=U[_],x=m.position.call(this,{left:l,top:D,targetAttachment:A,targetPos:I,attachment:this.attachment,elementPos:e,offset:v,targetOffset:M,manualOffset:c,manualTargetOffset:f,scrollbarSize:T}),null!=x&&"object"==typeof x){if(x===!1)return!1;D=x.top,l=x.left}if(g={page:{top:D,left:l},viewport:{top:D-pageYOffset,bottom:pageYOffset-D-o+innerHeight,left:l-pageXOffset,right:pageXOffset-l-W+innerWidth}},document.body.scrollWidth>window.innerWidth&&(T=this.cache("scrollbar-size",d),g.viewport.bottom-=T.height),document.body.scrollHeight>window.innerHeight&&(T=this.cache("scrollbar-size",d),g.viewport.right-=T.width),(""!==(z=document.body.style.position)&&"static"!==z||""!==(q=document.body.parentElement.style.position)&&"static"!==q)&&(g.page.bottom=document.body.scrollHeight-D-o,g.page.right=document.body.scrollWidth-l-W),(null!=(R=this.options.optimizations)?R.moveElement:void 0)!==!1&&null==this.targetModifier){for(w=this.cache("target-offsetparent",function(){return p(Y.target)}),E=this.cache("target-offsetparent-bounds",function(){return u(w)}),O=getComputedStyle(w),n=getComputedStyle(this.element),C=E,y={},F=["Top","Left","Bottom","Right"],L=0,H=F.length;H>L;L++)P=F[L],y[P.toLowerCase()]=parseFloat(O["border"+P+"Width"]);E.right=document.body.scrollWidth-E.left-C.width+y.right,E.bottom=document.body.scrollHeight-E.top-C.height+y.bottom,g.page.top>=E.top+y.top&&g.page.bottom>=E.bottom&&g.page.left>=E.left+y.left&&g.page.right>=E.right&&(N=w.scrollTop,S=w.scrollLeft,g.offset={top:g.page.top-E.top+N-y.top,left:g.page.left-E.left+S-y.left})}return this.move(g),this.history.unshift(g),this.history.length>3&&this.history.pop(),t&&h(),!0}},t.prototype.move=function(t){var e,n,i,o,s,r,a,h,u,f,d,m,g,v,b,y,w,C=this;if(null!=this.element.parentNode){h={};for(f in t){h[f]={};for(o in t[f]){for(i=!1,y=this.history,v=0,b=y.length;b>v;v++)if(a=y[v],!N(null!=(w=a[f])?w[o]:void 0,t[f][o])){i=!0;break}i||(h[f][o]=!0)}}e={top:"",left:"",right:"",bottom:""},u=function(t,n){var i,o,s;return(null!=(s=C.options.optimizations)?s.gpu:void 0)===!1?(t.top?e.top=""+n.top+"px":e.bottom=""+n.bottom+"px",t.left?e.left=""+n.left+"px":e.right=""+n.right+"px"):(t.top?(e.top=0,o=n.top):(e.bottom=0,o=-n.bottom),t.left?(e.left=0,i=n.left):(e.right=0,i=-n.right),e[x]="translateX("+Math.round(i)+"px) translateY("+Math.round(o)+"px)","msTransform"!==x?e[x]+=" translateZ(0)":void 0)},s=!1,(h.page.top||h.page.bottom)&&(h.page.left||h.page.right)?(e.position="absolute",u(h.page,t.page)):(h.viewport.top||h.viewport.bottom)&&(h.viewport.left||h.viewport.right)?(e.position="fixed",u(h.viewport,t.viewport)):null!=h.offset&&h.offset.top&&h.offset.left?(e.position="absolute",r=this.cache("target-offsetparent",function(){return p(C.target)}),p(this.element)!==r&&l(function(){return C.element.parentNode.removeChild(C.element),r.appendChild(C.element)}),u(h.offset,t.offset),s=!0):(e.position="absolute",u({top:!0,left:!0},t.page)),s||"BODY"===this.element.parentNode.tagName||(this.element.parentNode.removeChild(this.element),document.body.appendChild(this.element)),g={},m=!1;for(o in e)d=e[o],n=this.element.style[o],""===n||""===d||"top"!==o&&"left"!==o&&"bottom"!==o&&"right"!==o||(n=parseFloat(n),d=parseFloat(d)),n!==d&&(m=!0,g[o]=e[o]);return m?l(function(){return c(C.element.style,g)}):void 0}},t}(),i.position=C,this.Tether=c(T,i)}.call(this),function(){var t,e,n,i,o,s,r,a,l,c,h=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};c=this.Tether.Utils,r=c.getOuterSize,s=c.getBounds,a=c.getSize,i=c.extend,l=c.updateClasses,n=c.defer,e={left:"right",right:"left",top:"bottom",bottom:"top",middle:"middle"},t=["left","top","right","bottom"],o=function(e,n){var i,o,r,a,l,c,h;if("scrollParent"===n?n=e.scrollParent:"window"===n&&(n=[pageXOffset,pageYOffset,innerWidth+pageXOffset,innerHeight+pageYOffset]),n===document&&(n=n.documentElement),null!=n.nodeType)for(o=a=s(n),l=getComputedStyle(n),n=[o.left,o.top,a.width+o.left,a.height+o.top],i=c=0,h=t.length;h>c;i=++c)r=t[i],r=r[0].toUpperCase()+r.substr(1),"Top"===r||"Left"===r?n[i]+=parseFloat(l["border"+r+"Width"]):n[i]-=parseFloat(l["border"+r+"Width"]);return n},this.Tether.modules.push({position:function(e){var r,a,c,u,p,f,d,m,g,v,b,y,w,C,O,E,x,S,N,T,P,A,M,I,k,D,W,_,L,j,H,B,U,z,q,R,F,Y,X,$,V,Z,G,J,K,Q,tt,et=this;if(D=e.top,b=e.left,P=e.targetAttachment,!this.options.constraints)return!0;for(S=function(e){var n,i,o,s;for(et.removeClass(e),s=[],i=0,o=t.length;o>i;i++)n=t[i],s.push(et.removeClass(""+e+"-"+n));return s},$=this.cache("element-bounds",function(){return s(et.element)}),v=$.height,W=$.width,0===W&&0===v&&null!=this.lastSize&&(V=this.lastSize,W=V.width,v=V.height),M=this.cache("target-bounds",function(){return et.getTargetBounds()}),A=M.height,I=M.width,T={},g={},a=[this.getClass("pinned"),this.getClass("out-of-bounds")],Z=this.options.constraints,_=0,B=Z.length;B>_;_++)m=Z[_],m.outOfBoundsClass&&a.push(m.outOfBoundsClass),m.pinnedClass&&a.push(m.pinnedClass);for(L=0,U=a.length;U>L;L++)for(d=a[L],G=["left","top","right","bottom"],j=0,z=G.length;z>j;j++)N=G[j],a.push(""+d+"-"+N);for(r=[],T=i({},P),g=i({},this.attachment),J=this.options.constraints,H=0,q=J.length;q>H;H++){if(m=J[H],k=m.to,c=m.attachment,O=m.pin,null==c&&(c=""),h.call(c," ")>=0?(K=c.split(" "),f=K[0],p=K[1]):p=f=c,u=o(this,k),("target"===f||"both"===f)&&(Du[3]&&"bottom"===T.top&&(D-=A,T.top="top")),"together"===f&&(Du[3]&&"bottom"===T.top&&("top"===g.top?(D-=A,T.top="top",D-=v,g.top="bottom"):"bottom"===g.top&&(D-=A,T.top="top",D+=v,g.top="top")),"middle"===T.top&&(D+v>u[3]&&"top"===g.top?(D-=v,g.top="bottom"):Du[2]&&"right"===T.left&&(b-=I,T.left="left")),"together"===p&&(bu[2]&&"right"===T.left?"left"===g.left?(b-=I,T.left="left",b-=W,g.left="right"):"right"===g.left&&(b-=I,T.left="left",b+=W,g.left="left"):"center"===T.left&&(b+W>u[2]&&"left"===g.left?(b-=W,g.left="right"):bu[3]&&"top"===g.top&&(D-=v,g.top="bottom")),("element"===p||"both"===p)&&(bu[2]&&"left"===g.left&&(b-=W,g.left="right")),"string"==typeof O?O=function(){var t,e,n,i;for(n=O.split(","),i=[],e=0,t=n.length;t>e;e++)C=n[e],i.push(C.trim());return i}():O===!0&&(O=["top","left","right","bottom"]),O||(O=[]),E=[],y=[],D=0?(D=u[1],E.push("top")):y.push("top")),D+v>u[3]&&(h.call(O,"bottom")>=0?(D=u[3]-v,E.push("bottom")):y.push("bottom")),b=0?(b=u[0],E.push("left")):y.push("left")),b+W>u[2]&&(h.call(O,"right")>=0?(b=u[2]-W,E.push("right")):y.push("right")),E.length)for(x=null!=(Q=this.options.pinnedClass)?Q:this.getClass("pinned"),r.push(x),Y=0,R=E.length;R>Y;Y++)N=E[Y],r.push(""+x+"-"+N);if(y.length)for(w=null!=(tt=this.options.outOfBoundsClass)?tt:this.getClass("out-of-bounds"),r.push(w),X=0,F=y.length;F>X;X++)N=y[X],r.push(""+w+"-"+N);(h.call(E,"left")>=0||h.call(E,"right")>=0)&&(g.left=T.left=!1),(h.call(E,"top")>=0||h.call(E,"bottom")>=0)&&(g.top=T.top=!1),(T.top!==P.top||T.left!==P.left||g.top!==this.attachment.top||g.left!==this.attachment.left)&&this.updateAttachClasses(g,T)}return n(function(){return l(et.target,r,a),l(et.element,r,a)}),{top:D,left:b}}})}.call(this),function(){var t,e,n,i;i=this.Tether.Utils,e=i.getBounds,n=i.updateClasses,t=i.defer,this.Tether.modules.push({position:function(i){var o,s,r,a,l,c,h,u,p,f,d,m,g,v,b,y,w,C,O,E,x,S,N,T,P,A=this;if(d=i.top,c=i.left,x=this.cache("element-bounds",function(){return e(A.element)}),l=x.height,m=x.width,f=this.getTargetBounds(),a=d+l,h=c+m,o=[],d<=f.bottom&&a>=f.top)for(S=["left","right"],g=0,w=S.length;w>g;g++)u=S[g],((N=f[u])===c||N===h)&&o.push(u);if(c<=f.right&&h>=f.left)for(T=["top","bottom"],v=0,C=T.length;C>v;v++)u=T[v],((P=f[u])===d||P===a)&&o.push(u);for(r=[],s=[],p=["left","top","right","bottom"],r.push(this.getClass("abutted")),b=0,O=p.length;O>b;b++)u=p[b],r.push(""+this.getClass("abutted")+"-"+u);for(o.length&&s.push(this.getClass("abutted")),y=0,E=o.length;E>y;y++)u=o[y],s.push(""+this.getClass("abutted")+"-"+u);return t(function(){return n(A.target,s,r),n(A.element,s,r)}),!0}})}.call(this),function(){this.Tether.modules.push({position:function(t){var e,n,i,o,s,r,a;return r=t.top,e=t.left,this.options.shift?(n=function(t){return"function"==typeof t?t.call(this,{top:r,left:e}):t},i=n(this.options.shift),"string"==typeof i?(i=i.split(" "),i[1]||(i[1]=i[0]),s=i[0],o=i[1],s=parseFloat(s,10),o=parseFloat(o,10)):(a=[i.top,i.left],s=a[0],o=a[1]),r+=s,e+=o,{top:r,left:e}):void 0}})}.call(this),this.Tether})},function(t,e,n){"use strict";var i=n(12),o=n(24),s=n(14),r=i.createClass({displayName:"ActionSheet",getInitialState:function(){return{active:!1}},setActiveState:function(t){this.setState({active:t})},onBodyClick:function(t){var e=t.target,n=!1;do if(e.classList&&e.classList.contains("action-sheet-container")){n=!0;break}while(e=e.parentNode);n||this.setActiveState(!1)},componentDidMount:function(){this.props.id&&s.subscribe(this.props.id,function(t,e){"open"===e?this.setState({active:!0}):"close"===e?this.setState({active:!1}):"toggle"===e&&this.setState({active:!this.state.active})}.bind(this)),document.body.addEventListener("click",this.onBodyClick)},componentWillUnmount:function(){this.props.id&&s.unsubscribe(this.props.id),document.body.removeEventListener("click",this.onBodyClick)},render:function(){var t=i.Children.map(this.props.children,function(t,e){var n={active:this.state.active};return"ActionSheetButton"===t.type.displayName&&(n.setActiveState=this.setActiveState),o(t,n)}.bind(this));return i.createElement("div",{id:this.props.id,"data-closable":!0,className:"action-sheet-container"},t)}});t.exports=r,r.Button=n(15),r.Content=n(16)},function(t,e,n){"use strict";var i=n(12),o=n(25),s=o.canUseDOM&&n(!function(){var t=new Error('Cannot find module "../vendor/iconic.min"');throw t.code="MODULE_NOT_FOUND",t}()),r=(n(24),i.createClass({displayName:"Iconic",inject:function(){var t=s();t.inject(this.getDOMNode())},componentDidMount:function(){this.inject()},componentDidUpdate:function(){this.inject()},render:function(){return i.Children.only(this.props.children)}}));t.exports=r},function(t,e,n){"use strict";var i=n(12),o=n(22),s=i.createClass({displayName:"Interchange",mixins:[o],getInitialState:function(){return{matchedMedia:"large"}},componentDidMount:function(){this.media({minWidth:0,maxWidth:640},function(){this.setState({matchedMedia:"small"})}.bind(this)),this.media({minWidth:641,maxWidth:1200},function(){this.setState({matchedMedia:"medium"})}.bind(this)),this.media({minWidth:1200,maxWidth:1440},function(){this.setState({matchedMedia:"large"})}.bind(this))},render:function(){var t=null;return i.Children.forEach(this.props.children,function(e){e.props.media===this.state.matchedMedia&&(t=e)}.bind(this)),t}});t.exports=s},function(t,e,n){"use strict";var i=n(12),o=(n(26),n(17)),s=n(14),r=i.createClass({displayName:"Modal",getInitialState:function(){return{open:!1}},getDefaultProps:function(){return{overlay:!0,overlayClose:!0,animationIn:"fadeIn",animationOut:"fadeOut"}},componentDidMount:function(){s.subscribe(this.props.id,function(t,e){"open"===e?this.setState({open:!0}):"close"===e?this.setState({open:!1}):"toggle"===e&&this.setState({open:!this.state.open})}.bind(this))},componentWillUnmount:function(){s.unsubscribe(this.props.id)},hideOverlay:function(t){t.preventDefault(),this.props.overlayClose&&this.setState({open:!1})},stopClickPropagation:function(t){t.preventDefault(),t.stopPropagation()},render:function(){var t={};return this.props.overlay||(t.background="transparent"),i.createElement(o,{active:this.state.open,animationIn:"fadeIn",animationOut:"fadeOut"},i.createElement("div",{className:"modal-overlay",style:t,onClick:this.hideOverlay},i.createElement(o,{active:this.state.open,animationIn:this.props.animationIn,animationOut:this.props.animationOut},i.createElement("div",{id:this.props.id,"data-closable":!0,className:"modal",onClick:this.stopClickPropagation},this.props.children))))}});t.exports=r},function(t,e,n){"use strict";t.exports={Set:n(18),Static:n(19)}},function(t,e,n){"use strict";var i=n(12),o=n(26),s=n(14),r=i.createClass({displayName:"Offcanvas",getInitialState:function(){return{open:!1}},getDefaultProps:function(){return{position:"left"}},componentDidMount:function(){s.subscribe(this.props.id,function(t,e){"open"===e?this.setState({open:!0}):"close"===e?this.setState({open:!1}):"toggle"===e&&this.setState({open:!this.state.open})}.bind(this))},componentWillUnmount:function(){s.unsubscribe(this.props.id)},render:function(){var t={"off-canvas":!0,"is-active":this.state.open};return t[this.props.position]=!0,this.props.className&&(t[this.props.className]=!0),i.createElement("div",{id:this.props.id,"data-closable":!0,className:o(t)},this.props.children)}});t.exports=r},function(t,e,n){"use strict";var i=n(12),o=(n(26),n(17)),s=n(14),r=i.createClass({displayName:"Panel",getInitialState:function(){return{open:!1}},getDefaultProps:function(){return{position:"left"}},componentDidMount:function(){s.subscribe(this.props.id,function(t,e){"open"===e?this.setState({open:!0}):"close"===e?this.setState({open:!1}):"toggle"===e&&this.setState({open:!this.state.open})}.bind(this))},componentWillUnmount:function(){s.unsubscribe(this.props.id)},render:function(){var t,e,n="panel panel-"+this.props.position;return this.props.className&&(n+=" "+this.props.className),"left"===this.props.position?(t=this.props.animationIn||"slideInRight",e=this.props.animationOut||"slideOutLeft"):"right"===this.props.position?(t=this.props.animationIn||"slideInLeft",e=this.props.animationOut||"slideOutRight"):"top"===this.props.position?(t=this.props.animationIn||"slideInDown",e=this.props.animationOut||"slideOutUp"):"bottom"===this.props.position&&(t=this.props.animationIn||"slideInUp",e=this.props.animationOut||"slideOutBottom"),i.createElement(o,{active:this.state.open,animationIn:t,animationOut:e},i.createElement("div",{"data-closable":!0,id:this.props.id,className:n},this.props.children))}});t.exports=r},function(t,e,n){"use strict";var i=n(12),o=n(26),s=n(25),r=n(14),a=s.canUseDOM&&n(1),l=i.createClass({displayName:"Popup",getInitialState:function(){return{active:!1,tetherInit:!1}},getDefaultProps:function(){return{pinTo:"top center",pinAt:""}},componentDidMount:function(){this.tether={},r.subscribe(this.props.id,function(t,e){"toggle"===e[0]&&this.toggle(e[1])}.bind(this))},toggle:function(t){var e=!this.state.active;this.setState({active:e},function(){e?this.tetherElement(t):this.tether.destroy()}.bind(this))},tetherElement:function(t){var e=document.getElementById(t),n="top center";this.tether=new a({element:this.getDOMNode(),target:e,attachment:n})},render:function(){var t={popup:!0,"is-active":this.state.active};return i.createElement("div",{id:this.props.id,className:o(t),"data-closable":"popup"},this.props.children)}});t.exports=l},function(t,e,n){"use strict";var i=n(12),o=n(24),s=i.createClass({displayName:"Tabs",getInitialState:function(){return{selectedTab:0,content:null}},selectTab:function(t){this.setState(t)},render:function(){var t=i.Children.map(this.props.children,function(t,e){return o(t,{active:e===this.state.selectedTab,index:e,selectTab:this.selectTab})}.bind(this));return i.createElement("div",null,i.createElement("div",{className:"tabs"},t),i.createElement("div",null,this.state.content))}});t.exports=s,s.Tab=n(20)},function(t,e,n){"use strict";var i=n(12),o=n(24),s=n(14),r=n(21),a=i.createClass({displayName:"Trigger",getDefaultProps:function(){return{open:null,close:null,toggle:null,hardToggle:null,popupToggle:null,notify:null}},getCloseId:function(){if(this.props.close)return this.props.close;for(var t=!1,e=this.getDOMNode().parentNode;t===!1;)"BODY"==e.nodeName&&(t=""),"undefined"!=typeof e.getAttribute("data-closable")&&e.getAttribute("data-closable")!==!1&&(t=e),e=e.parentNode;return t.getAttribute("id")},clickHandler:function(t){t.preventDefault(),this.props.open?s.publish(this.props.open,"open"):null!==this.props.close?s.publish(this.getCloseId(),"close"):this.props.toggle?s.publish(this.props.toggle,"toggle"):this.props.hardToggle?(s.closeActiveElements({exclude:this.props.hardToggle}),s.publish(this.props.hardToggle,"toggle")):this.props.notify&&s.publish(this.props.notify,{title:this.props.title,content:this.props.content,position:this.props.position,color:this.props.color,image:this.props.image})},render:function(){if(this.props.popupToggle)return i.createElement(r,this.props);var t=i.Children.only(this.props.children);return o(t,{onClick:this.clickHandler})}});t.exports=a},function(e,n,i){e.exports=t},function(t,e,n){"use strict";var i=n(12),o=n(26),s=i.createClass({displayName:"AccordionItem",render:function(){var t={"accordion-item":!0,"is-active":this.props.active};return i.createElement("div",{className:o(t)},i.createElement("div",{className:"accordion-title",onClick:this.props.activate},this.props.title),i.createElement("div",{className:"accordion-content"},this.props.children))}});t.exports=s},function(t,e,n){"use strict";var i=n(31),o=(n(30),{}),s=[],r={subscribe:i.subscribe,publish:i.publish,unsubscribe:i.unsubscribe,closeActiveElements:function(t){var e=this;t=t||{};var n=document.querySelectorAll(".is-active[data-closable]");Array.prototype.forEach.call(n,function(n){t.exclude!==n.id&&e.publish(n.id,"close")})},getSettings:function(){return o},modifySettings:function(t){return o=angular.extend(o,t)},generateUuid:function(){var t="";do{t+="zf-uuid-";for(var e=0;15>e;e++)t+=Math.floor(16*Math.random()).toString(16)}while(!s.indexOf(t));return s.push(t),t}};t.exports=r},function(t,e,n){"use strict";var i=n(12),o=i.createClass({displayName:"ActionSheetButton",toggle:function(){this.props.setActiveState(!this.props.active)},render:function(){var t=null;return this.props.title.length>0&&(t=i.createElement("a",{className:"button"},this.props.title)),i.createElement("div",{onClick:this.toggle},t,i.createElement("div",null,this.props.children))}});t.exports=o},function(t,e,n){"use strict";var i=n(12),o=n(26),s=i.createClass({displayName:"ActionSheetContent",getDefaultProps:function(){return{position:"bottom"}},render:function(){var t={"action-sheet":!0,"is-active":this.props.active};return i.createElement("div",{className:o(t)},this.props.children)}});t.exports=s},function(t,e,n){"use strict";var i=n(12),o=n(27),s=n(28),r=n(24),a=(n(26),i.createClass({displayName:"Animation",getInitialState:function(){return{}},getDefaultProps:function(){return{active:!1,animationIn:"",animationOut:""}},reflow:function(t){return t.offsetWidth},reset:function(t){t.style.transitionDuration=0,s.removeClass(t,"ng-enter"),s.removeClass(t,"ng-leave"),s.removeClass(t,"ng-enter-active"),s.removeClass(t,"ng-leave-active"),s.removeClass(t,this.props.animationIn),s.removeClass(t,this.props.animationOut)},finishAnimation:function(){var t=this.getDOMNode();this.reset(t),s.removeClass(t,this.props.active?"":"is-active"), -this.reflow(t),o.removeEndEventListener(t,this.finishAnimation)},animate:function(t,e){var n=this.getDOMNode(),i="ng-"+e,r=i+"-active";this.reset(n),s.addClass(n,t),s.addClass(n,i),s.addClass(n,"is-active"),this.reflow(n),n.style.transitionDuration="",s.addClass(n,r),o.addEndEventListener(n,this.finishAnimation)},componentDidUpdate:function(t){if(t.active!==this.props.active){var e=this.props.active?this.props.animationIn:this.props.animationOut,n=this.props.active?"enter":"leave";this.animate(e,n)}},render:function(){var t=i.Children.only(this.props.children),e={};return r(t,e)}}));t.exports=a},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e-1}};t.exports=o},function(t,e,n){"use strict";var i=n(12),o=i.createClass({displayName:"Notification",getDefaultProps:function(){return{position:"top-right",color:"success",title:null,image:null,content:null}},render:function(){var t="notification "+this.props.position+" "+this.props.color;t+=" "+(this.props.className||"");var e=null;return this.props.image&&(e=i.createElement("div",{className:"notification-icon"},i.createElement("img",{src:"{{ image }}"}))),i.createElement("div",{id:this.props.id,"data-closable":!0,className:t},i.createElement("a",{href:"#",className:"close-button",onClick:this.props.closeHandler},"×"),e,i.createElement("div",{className:"notification-content"},i.createElement("h1",null,this.props.title),i.createElement("p",null,this.props.children)))}});t.exports=o},function(t,e,n){"use strict";function i(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=Object.assign||function(t,e){for(var n,o,s=i(t),r=1;r1){for(var p=Array(h),f=0;h>f;f++)p[f]=arguments[f+2];o.children=p}if(t&&t.defaultProps){var d=t.defaultProps;for(i in d)"undefined"==typeof o[i]&&(o[i]=d[i])}return new u(t,a,l,r.current,s.current,o)},u.createFactory=function(t){var e=u.createElement.bind(null,t);return e.type=t,e},u.cloneAndReplaceProps=function(t,e){var n=new u(t.type,t.key,t.ref,t._owner,t._context,e);return n._store.validated=t._store.validated,n},u.cloneElement=function(t,e,n){var i,o=a({},t.props),s=t.key,l=t.ref,h=t._owner;if(null!=e){void 0!==e.ref&&(l=e.ref,h=r.current),void 0!==e.key&&(s=""+e.key);for(i in e)e.hasOwnProperty(i)&&!c.hasOwnProperty(i)&&(o[i]=e[i])}var p=arguments.length-2;if(1===p)o.children=n;else if(p>1){for(var f=Array(p),d=0;p>d;d++)f[d]=arguments[d+2];o.children=f}return new u(t.type,s,l,h,t._context,o)},u.isValidElement=function(t){var e=!(!t||!t._isReactElement);return e},t.exports=u},function(t,e,n){"use strict";function i(t){return function(e,n,i){e.hasOwnProperty(n)?e[n]=t(e[n],i):e[n]=i}}function o(t,e){for(var n in e)if(e.hasOwnProperty(n)){var i=c[n];i&&c.hasOwnProperty(n)?i(t,n,e[n]):t.hasOwnProperty(n)||(t[n]=e[n])}return t}var s=n(42),r=n(43),a=n(44),l=i(function(t,e){return s({},e,t)}),c={children:r,className:i(a),style:l},h={mergeProps:function(t,e){return o(s({},t),e)}};t.exports=h},function(t,e,n){var i=function(t){var e;for(e in t)if(t.hasOwnProperty(e))return e;return null};t.exports=i},function(t,e,n){"use strict";var i=n(43),o=i;o=function(t,e){for(var n=[],i=2,o=arguments.length;o>i;i++)n.push(arguments[i]);if(void 0===e)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(e.length<10||/^[s\W]*$/.test(e))throw new Error("The warning format should be able to uniquely identify this warning. Please, use a more descriptive format than: "+e);if(0!==e.indexOf("Failed Composite propType: ")&&!t){var s=0,r="Warning: "+e.replace(/%s/g,function(){return n[s++]});console.warn(r);try{throw new Error(r)}catch(a){}}},t.exports=o},function(t,e,n){"use strict";var i=function(t,e,n,i,o,s,r,a){if(void 0===e)throw new Error("invariant requires an error message argument");if(!t){var l;if(void 0===e)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,i,o,s,r,a],h=0;l=new Error("Invariant Violation: "+e.replace(/%s/g,function(){return c[h++]}))}throw l.framesToPop=1,l}};t.exports=i},function(t,e,n){var i=!("undefined"==typeof window||!window.document||!window.document.createElement);t.exports=i},function(t,e,n){var i=n(46),o=function(t){var e=/[height|width]$/;return e.test(t)},s=function(t){var e="",n=Object.keys(t);return n.forEach(function(s,r){var a=t[s];s=i(s),o(s)&&"number"==typeof a&&(a+="px"),e+=a===!0?s:a===!1?"not "+s:"("+s+": "+a+")",ri&&(n=e(t[i],i),n!==!1);i++);}function n(t){return"[object Array]"===Object.prototype.toString.apply(t)}function i(t){return"function"==typeof t}function o(t){this.options=t,!t.deferSetup&&this.setup()}function s(e,n){this.query=e,this.isUnconditional=n,this.handlers=[],this.mql=t(e);var i=this;this.listener=function(t){i.mql=t,i.assess()},this.mql.addListener(this.listener)}function r(){if(!t)throw new Error("matchMedia not present, legacy browsers require a polyfill");this.queries={},this.browserIsIncapable=!t("only all").matches}return o.prototype={setup:function(){this.options.setup&&this.options.setup(),this.initialised=!0},on:function(){!this.initialised&&this.setup(),this.options.match&&this.options.match()},off:function(){this.options.unmatch&&this.options.unmatch()},destroy:function(){this.options.destroy?this.options.destroy():this.off()},equals:function(t){return this.options===t||this.options.match===t}},s.prototype={addHandler:function(t){var e=new o(t);this.handlers.push(e),this.matches()&&e.on()},removeHandler:function(t){var n=this.handlers;e(n,function(e,i){return e.equals(t)?(e.destroy(),!n.splice(i,1)):void 0})},matches:function(){return this.mql.matches||this.isUnconditional},clear:function(){e(this.handlers,function(t){t.destroy()}),this.mql.removeListener(this.listener),this.handlers.length=0},assess:function(){var t=this.matches()?"on":"off";e(this.handlers,function(e){e[t]()})}},r.prototype={register:function(t,o,r){var a=this.queries,l=r&&this.browserIsIncapable;return a[t]||(a[t]=new s(t,l)),i(o)&&(o={match:o}),n(o)||(o=[o]),e(o,function(e){a[t].addHandler(e)}),this},unregister:function(t,e){var n=this.queries[t];return n&&(e?n.removeHandler(e):(n.clear(),delete this.queries[t])),this}},new r})},function(t,e,n){"use strict";var i=n(42),o=n(45),s=n(35),r=!1,a={current:o,withContext:function(t,e){s(r,"withContext is deprecated and will be removed in a future version. Use a wrapper component with getChildContext instead."),r=!0;var n,o=a.current;a.current=i({},o,t);try{n=e()}finally{a.current=o}return n}};t.exports=a},function(t,e,n){"use strict";var i={current:null};t.exports=i},function(t,e,n){"use strict";function i(t,e){if(null==t)throw new TypeError("Object.assign target cannot be null or undefined");for(var n=Object(t),i=Object.prototype.hasOwnProperty,o=1;o1)for(var i=1;n>i;i++)e=arguments[i],e&&(t=(t?t+" ":"")+e);return t}t.exports=i},function(t,e,n){"use strict";var i={};Object.freeze(i),t.exports=i},function(t,e,n){var i=function(t){return t.replace(/[A-Z]/g,function(t){return"-"+t.toLowerCase()}).toLowerCase()};t.exports=i}])}); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.RFA=e(require("react")):t.RFA=e(t.React)}(this,function(t){return function(t){function e(i){if(n[i])return n[i].exports;var o=n[i]={exports:{},id:i,loaded:!1};return t[i].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){t.exports={Accordion:n(1),ActionSheet:n(4),Iconic:n(10),Interchange:n(11),Modal:n(17),Notification:n(22),OffCanvas:n(26),Panel:n(27),Popup:n(28),Tabs:n(30),Trigger:n(32)}},function(t,e,n){"use strict";var i=n(2),o=i.createClass({displayName:"Accordion",getInitialState:function(){return{sections:[]}},getDefaultProps:function(){return{autoOpen:!0,multiOpen:!1,collapsible:!1}},componentWillMount:function(){var t=[];i.Children.forEach(this.props.children,function(e,n){t.push({active:!1})}),this.props.autoOpen&&(t[0].active=!0),this.setState({sections:t})},select:function(t){var e=this.state.sections;e.forEach(function(e,n){this.props.multiOpen?n===t&&(e.active=!e.active):n===t?e.active=this.props.collapsible===!0?!e.active:!0:e.active=!1}.bind(this)),this.setState({sections:e})},render:function(){var t=i.Children.map(this.props.children,function(t,e){return i.cloneElement(t,{active:this.state.sections[e]?this.state.sections[e].active:!1,activate:this.select.bind(this,e)})}.bind(this));return i.createElement("div",{className:"accordion"},t)}});t.exports=o,o.Item=n(3)},function(e,n){e.exports=t},function(t,e,n){"use strict";var i=n(2),o=n(!function(){var t=new Error('Cannot find module "classnames"');throw t.code="MODULE_NOT_FOUND",t}()),s=i.createClass({displayName:"AccordionItem",render:function(){var t={"accordion-item":!0,"is-active":this.props.active};return i.createElement("div",{className:o(t)},i.createElement("div",{className:"accordion-title",onClick:this.props.activate},this.props.title),i.createElement("div",{className:"accordion-content"},this.props.children))}});t.exports=s},function(t,e,n){"use strict";var i=n(2),o=n(5),s=i.createClass({displayName:"ActionSheet",getInitialState:function(){return{active:!1}},setActiveState:function(t){this.setState({active:t})},onBodyClick:function(t){var e=t.target,n=!1;do if(e.classList&&e.classList.contains("action-sheet-container")&&e.id===this.props.id){n=!0;break}while(e=e.parentNode);n||this.setActiveState(!1)},componentDidMount:function(){this.props.id&&o.subscribe(this.props.id,function(t,e){"open"===e?this.setState({active:!0}):"close"===e?this.setState({active:!1}):"toggle"===e&&this.setState({active:!this.state.active})}.bind(this)),document.body.addEventListener("click",this.onBodyClick)},componentWillUnmount:function(){this.props.id&&o.unsubscribe(this.props.id),document.body.removeEventListener("click",this.onBodyClick)},render:function(){var t=i.Children.map(this.props.children,function(t,e){var n={active:this.state.active};return"ActionSheetButton"===t.type.displayName&&(n.setActiveState=this.setActiveState),i.cloneElement(t,n)}.bind(this));return i.createElement("div",{id:this.props.id,"data-closable":!0,className:"action-sheet-container"},t)}});t.exports=s,s.Button=n(8),s.Content=n(9)},function(t,e,n){"use strict";var i=n(6),o=n(7),s={},r=[],a={subscribe:i.subscribe,publish:i.publish,unsubscribe:i.unsubscribe,closeActiveElements:function(t){var e=this;t=t||{};var n=document.querySelectorAll(".is-active[data-closable]");Array.prototype.forEach.call(n,function(n){t.exclude!==n.id&&e.publish(n.id,"close")})},getSettings:function(){return s},modifySettings:function(t){return s=o(s,t)},generateUuid:function(){var t="";do{t+="zf-uuid-";for(var e=0;15>e;e++)t+=Math.floor(16*Math.random()).toString(16)}while(!r.indexOf(t));return r.push(t),t}};t.exports=a},function(t,e,n){var i,o,s;!function(n,r){"use strict";o=[e],i=r,s="function"==typeof i?i.apply(e,o):i,!(void 0!==s&&(t.exports=s));var a={};n.PubSub=a,r(a)}("object"==typeof window&&window||this,function(t){"use strict";function e(t){var e;for(e in t)if(t.hasOwnProperty(e))return!0;return!1}function n(t){return function(){throw t}}function i(t,e,i){try{t(e,i)}catch(o){setTimeout(n(o),0)}}function o(t,e,n){t(e,n)}function s(t,e,n,s){var r,a=c[e],l=s?o:i;if(c.hasOwnProperty(e))for(r in a)a.hasOwnProperty(r)&&l(a[r],t,n)}function r(t,e,n){return function(){var i=String(t),o=i.lastIndexOf(".");for(s(t,t,e,n);-1!==o;)i=i.substr(0,o),o=i.lastIndexOf("."),s(t,i,e,n)}}function a(t){for(var n=String(t),i=Boolean(c.hasOwnProperty(n)&&e(c[n])),o=n.lastIndexOf(".");!i&&-1!==o;)n=n.substr(0,o),o=n.lastIndexOf("."),i=Boolean(c.hasOwnProperty(n)&&e(c[n]));return i}function l(t,e,n,i){var o=r(t,e,i),s=a(t);return s?(n===!0?o():setTimeout(o,0),!0):!1}var c={},h=-1;t.publish=function(e,n){return l(e,n,!1,t.immediateExceptions)},t.publishSync=function(e,n){return l(e,n,!0,t.immediateExceptions)},t.subscribe=function(t,e){if("function"!=typeof e)return!1;c.hasOwnProperty(t)||(c[t]={});var n="uid_"+String(++h);return c[t][n]=e,n},t.clearAllSubscriptions=function(){c={}},t.clearSubscriptions=function(t){var e;for(e in c)c.hasOwnProperty(e)&&0===e.indexOf(t)&&delete c[e]},t.unsubscribe=function(t){var e,n,i,o="string"==typeof t&&c.hasOwnProperty(t),s=!o&&"string"==typeof t,r="function"==typeof t,a=!1;if(o)return void delete c[t];for(e in c)if(c.hasOwnProperty(e)){if(n=c[e],s&&n[t]){delete n[t],a=t;break}if(r)for(i in n)n.hasOwnProperty(i)&&n[i]===t&&(delete n[i],a=!0)}return a}})},function(t,e){"use strict";function n(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=Object.assign||function(t,e){for(var i,o,s=n(t),r=1;r0&&(t=i.createElement("a",{className:"button"},this.props.title)),i.createElement("div",{onClick:this.toggle},t,i.createElement("div",null,this.props.children))}});t.exports=o},function(t,e,n){"use strict";var i=n(2),o=n(!function(){var t=new Error('Cannot find module "classnames"');throw t.code="MODULE_NOT_FOUND",t}()),s=i.createClass({displayName:"ActionSheetContent",getDefaultProps:function(){return{position:"bottom"}},render:function(){var t={"action-sheet":!0,"is-active":this.props.active};return i.createElement("div",{className:o(t)},this.props.children)}});t.exports=s},function(t,e,n){"use strict";var i=n(2),o=n(!function(){var t=new Error('Cannot find module "react-dom"');throw t.code="MODULE_NOT_FOUND",t}()),s=n(!function(){var t=new Error('Cannot find module "react/lib/ExecutionEnvironment"');throw t.code="MODULE_NOT_FOUND",t}()),r=s.canUseDOM&&n(!function(){var t=new Error('Cannot find module "../vendor/iconic.min"');throw t.code="MODULE_NOT_FOUND",t}()),a=i.createClass({displayName:"Iconic",inject:function(){var t=r();t.inject(o.findDOMNode(this))},componentDidMount:function(){this.inject()},componentDidUpdate:function(){this.inject()},render:function(){return i.Children.only(this.props.children)}});t.exports=a},function(t,e,n){"use strict";var i=n(2),o=n(12),s=i.createClass({displayName:"Interchange",mixins:[o],getInitialState:function(){return{matchedMedia:"large"}},componentDidMount:function(){this.media({minWidth:0,maxWidth:640},function(){this.setState({matchedMedia:"small"})}.bind(this)),this.media({minWidth:641,maxWidth:1200},function(){this.setState({matchedMedia:"medium"})}.bind(this)),this.media({minWidth:1200,maxWidth:1440},function(){this.setState({matchedMedia:"large"})}.bind(this))},render:function(){var t=null;return i.Children.forEach(this.props.children,function(e){e.props.media===this.state.matchedMedia&&(t=e)}.bind(this)),t}});t.exports=s},function(t,e,n){var i=n(13),o=i&&n(14),s=n(15),r={media:function(t,e){t=s(t),"function"==typeof e&&(e={match:e}),o.register(t,e),this._responsiveMediaHandlers||(this._responsiveMediaHandlers=[]),this._responsiveMediaHandlers.push({query:t,handler:e})},componentWillUnmount:function(){this._responsiveMediaHandlers&&this._responsiveMediaHandlers.forEach(function(t){o.unregister(t.query,t.handler)})}};t.exports=r},function(t,e){var n=!("undefined"==typeof window||!window.document||!window.document.createElement);t.exports=n},function(t,e,n){var i;!function(o,s,r){var a=window.matchMedia;"undefined"!=typeof t&&t.exports?t.exports=r(a):(i=function(){return s[o]=r(a)}.call(e,n,e,t),!(void 0!==i&&(t.exports=i)))}("enquire",this,function(t){"use strict";function e(t,e){var n,i=0,o=t.length;for(i;o>i&&(n=e(t[i],i),n!==!1);i++);}function n(t){return"[object Array]"===Object.prototype.toString.apply(t)}function i(t){return"function"==typeof t}function o(t){this.options=t,!t.deferSetup&&this.setup()}function s(e,n){this.query=e,this.isUnconditional=n,this.handlers=[],this.mql=t(e);var i=this;this.listener=function(t){i.mql=t,i.assess()},this.mql.addListener(this.listener)}function r(){if(!t)throw new Error("matchMedia not present, legacy browsers require a polyfill");this.queries={},this.browserIsIncapable=!t("only all").matches}return o.prototype={setup:function(){this.options.setup&&this.options.setup(),this.initialised=!0},on:function(){!this.initialised&&this.setup(),this.options.match&&this.options.match()},off:function(){this.options.unmatch&&this.options.unmatch()},destroy:function(){this.options.destroy?this.options.destroy():this.off()},equals:function(t){return this.options===t||this.options.match===t}},s.prototype={addHandler:function(t){var e=new o(t);this.handlers.push(e),this.matches()&&e.on()},removeHandler:function(t){var n=this.handlers;e(n,function(e,i){return e.equals(t)?(e.destroy(),!n.splice(i,1)):void 0})},matches:function(){return this.mql.matches||this.isUnconditional},clear:function(){e(this.handlers,function(t){t.destroy()}),this.mql.removeListener(this.listener),this.handlers.length=0},assess:function(){var t=this.matches()?"on":"off";e(this.handlers,function(e){e[t]()})}},r.prototype={register:function(t,o,r){var a=this.queries,l=r&&this.browserIsIncapable;return a[t]||(a[t]=new s(t,l)),i(o)&&(o={match:o}),n(o)||(o=[o]),e(o,function(e){a[t].addHandler(e)}),this},unregister:function(t,e){var n=this.queries[t];return n&&(e?n.removeHandler(e):(n.clear(),delete this.queries[t])),this}},new r})},function(t,e,n){var i=n(16),o=function(t){var e=/[height|width]$/;return e.test(t)},s=function(t){var e="",n=Object.keys(t);return n.forEach(function(s,r){var a=t[s];s=i(s),o(s)&&"number"==typeof a&&(a+="px"),e+=a===!0?s:a===!1?"not "+s:"("+s+": "+a+")",r=0;)s=s.replace(e,n);t.className=s.trim()}}},function(t,e,n){"use strict";t.exports={Set:n(23),Static:n(25)}},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;ee;e++)if(e in this&&this[e]===t)return e;return-1},O=[].slice;null==this.Tether&&(this.Tether={modules:[]}),u=function(t){var e,n,i,o,s;if(n=getComputedStyle(t).position,"fixed"===n)return t;for(i=void 0,e=t;e=e.parentNode;){try{o=getComputedStyle(e)}catch(r){}if(null==o)return e;if(/(auto|scroll)/.test(o.overflow+o.overflowY+o.overflowX)&&("absolute"!==n||"relative"===(s=o.position)||"absolute"===s||"fixed"===s))return e}return document.body},g=function(){var t;return t=0,function(){return t++}}(),b={},c=function(t){var e,i,s,r,a;if(s=t._tetherZeroElement,null==s&&(s=t.createElement("div"),s.setAttribute("data-tether-id",g()),o(s.style,{top:0,left:0,position:"absolute"}),t.body.appendChild(s),t._tetherZeroElement=s),e=s.getAttribute("data-tether-id"),null==b[e]){b[e]={},a=s.getBoundingClientRect();for(i in a)r=a[i],b[e][i]=r;n(function(){return b[e]=void 0})}return b[e]},f=null,r=function(t){var e,n,i,o,s,r,a;t===document?(n=document,t=document.documentElement):n=t.ownerDocument,i=n.documentElement,e={},a=t.getBoundingClientRect();for(o in a)r=a[o],e[o]=r;return s=c(n),e.top-=s.top,e.left-=s.left,null==e.width&&(e.width=document.body.scrollWidth-e.left-e.right),null==e.height&&(e.height=document.body.scrollHeight-e.top-e.bottom),e.top=e.top-i.clientTop,e.left=e.left-i.clientLeft,e.right=n.body.clientWidth-e.width-e.left,e.bottom=n.body.clientHeight-e.height-e.top,e},l=function(t){return t.offsetParent||document.documentElement},h=function(){var t,e,n,i,s;return t=document.createElement("div"),t.style.width="100%",t.style.height="200px",e=document.createElement("div"),o(e.style,{position:"absolute",top:0,left:0,pointerEvents:"none",visibility:"hidden",width:"200px",height:"150px",overflow:"hidden"}),e.appendChild(t),document.body.appendChild(e),i=t.offsetWidth,e.style.overflow="scroll",s=t.offsetWidth,i===s&&(s=e.clientWidth),document.body.removeChild(e),n=i-s,{width:n,height:n}},o=function(t){var e,n,i,o,s,r,a;for(null==t&&(t={}),e=[],Array.prototype.push.apply(e,arguments),a=e.slice(1),s=0,r=a.length;r>s;s++)if(i=a[s])for(n in i)y.call(i,n)&&(o=i[n],t[n]=o);return t},d=function(t,e){var n,i,o,s,r,l;if(null!=t.classList){for(r=e.split(" "),l=[],o=0,s=r.length;s>o;o++)i=r[o],i.trim()&&l.push(t.classList.remove(i));return l}return n=a(t).replace(new RegExp("(^| )"+e.split(" ").join("|")+"( |$)","gi")," "),m(t,n)},e=function(t,e){var n,i,o,s,r;if(null!=t.classList){for(s=e.split(" "),r=[],i=0,o=s.length;o>i;i++)n=s[i],n.trim()&&r.push(t.classList.add(n));return r}return d(t,e),n=a(t)+(" "+e),m(t,n)},p=function(t,e){return null!=t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(a(t))},a=function(t){return t.className instanceof SVGAnimatedString?t.className.baseVal:t.className},m=function(t,e){return t.setAttribute("class",e)},v=function(t,n,i){var o,s,r,a,l,c;for(s=0,a=i.length;a>s;s++)o=i[s],w.call(n,o)<0&&p(t,o)&&d(t,o);for(c=[],r=0,l=n.length;l>r;r++)o=n[r],p(t,o)?c.push(void 0):c.push(e(t,o));return c},i=[],n=function(t){return i.push(t)},s=function(){var t,e;for(e=[];t=i.pop();)e.push(t());return e},t=function(){function t(){}return t.prototype.on=function(t,e,n,i){var o;return null==i&&(i=!1),null==this.bindings&&(this.bindings={}),null==(o=this.bindings)[t]&&(o[t]=[]),this.bindings[t].push({handler:e,ctx:n,once:i})},t.prototype.once=function(t,e,n){return this.on(t,e,n,!0)},t.prototype.off=function(t,e){var n,i,o;if(null!=(null!=(i=this.bindings)?i[t]:void 0)){if(null==e)return delete this.bindings[t];for(n=0,o=[];n=e&&e>=t-n},N=function(){var t,e,n,i,o;for(t=document.createElement("div"),o=["transform","webkitTransform","OTransform","MozTransform","msTransform"],n=0,i=o.length;i>n;n++)if(e=o[n],void 0!==t.style[e])return e}(),E=[],O=function(){var t,e,n;for(e=0,n=E.length;n>e;e++)t=E[e],t.position(!1);return h()},v=function(){var t;return null!=(t="undefined"!=typeof performance&&null!==performance&&"function"==typeof performance.now?performance.now():void 0)?t:+new Date},function(){var t,e,n,i,o,s,r,a,l;for(e=null,n=null,i=null,o=function(){if(null!=n&&n>16)return n=Math.min(n-16,250),void(i=setTimeout(o,250));if(!(null!=e&&v()-e<10))return null!=i&&(clearTimeout(i),i=null),e=v(),O(),n=v()-e},a=["resize","scroll","touchmove"],l=[],s=0,r=a.length;r>s;s++)t=a[s],l.push(window.addEventListener(t,o));return l}(),t={center:"center",left:"right",right:"left"},e={middle:"middle",top:"bottom",bottom:"top"},n={top:0,left:0,middle:"50%",center:"50%",bottom:"100%",right:"100%"},a=function(n,i){var o,s;return o=n.left,s=n.top,"auto"===o&&(o=t[i.left]),"auto"===s&&(s=e[i.top]),{left:o,top:s}},r=function(t){var e,i;return{left:null!=(e=n[t.left])?e:t.left,top:null!=(i=n[t.top])?i:t.top}},s=function(){var t,e,n,i,o,s,r;for(e=1<=arguments.length?D.call(arguments,0):[],n={top:0,left:0},o=0,s=e.length;s>o;o++)r=e[o],i=r.top,t=r.left,"string"==typeof i&&(i=parseFloat(i,10)),"string"==typeof t&&(t=parseFloat(t,10)),n.top+=i,n.left+=t;return n},b=function(t,e){return"string"==typeof t.left&&-1!==t.left.indexOf("%")&&(t.left=parseFloat(t.left,10)/100*e.width),"string"==typeof t.top&&-1!==t.top.indexOf("%")&&(t.top=parseFloat(t.top,10)/100*e.height),t},y=w=function(t){var e,n,i;return i=t.split(" "),n=i[0],e=i[1],{top:n,left:e}},T=function(){function t(t){this.position=A(this.position,this);var e,n,o,s,r;for(E.push(this),this.history=[],this.setOptions(t,!1),s=i.modules,n=0,o=s.length;o>n;n++)e=s[n],null!=(r=e.initialize)&&r.call(this);this.position()}return t.modules=[],t.prototype.getClass=function(t){var e,n;return(null!=(e=this.options.classes)?e[t]:void 0)?this.options.classes[t]:(null!=(n=this.options.classes)?n[t]:void 0)!==!1?this.options.classPrefix?""+this.options.classPrefix+"-"+t:t:""},t.prototype.setOptions=function(t,e){var n,i,s,r,a,l;for(this.options=t,null==e&&(e=!0),n={offset:"0 0",targetOffset:"0 0",targetAttachment:"auto auto",classPrefix:"tether"},this.options=c(n,this.options),a=this.options,this.element=a.element,this.target=a.target,this.targetModifier=a.targetModifier,"viewport"===this.target?(this.target=document.body,this.targetModifier="visible"):"scroll-handle"===this.target&&(this.target=document.body,this.targetModifier="scroll-handle"),l=["element","target"],s=0,r=l.length;r>s;s++){if(i=l[s],null==this[i])throw new Error("Tether Error: Both element and target must be defined");null!=this[i].jquery?this[i]=this[i][0]:"string"==typeof this[i]&&(this[i]=document.querySelector(this[i]))}if(o(this.element,this.getClass("element")),o(this.target,this.getClass("target")),!this.options.attachment)throw new Error("Tether Error: You must provide an attachment");return this.targetAttachment=y(this.options.targetAttachment),this.attachment=y(this.options.attachment),this.offset=w(this.options.offset),this.targetOffset=w(this.options.targetOffset),null!=this.scrollParent&&this.disable(),"scroll-handle"===this.targetModifier?this.scrollParent=this.target:this.scrollParent=m(this.target),this.options.enabled!==!1?this.enable(e):void 0},t.prototype.getTargetBounds=function(){var t,e,n,i,o,s,r,a,l;if(null==this.targetModifier)return u(this.target);switch(this.targetModifier){case"visible":return this.target===document.body?{top:pageYOffset,left:pageXOffset,height:innerHeight,width:innerWidth}:(t=u(this.target),o={height:t.height,width:t.width,top:t.top,left:t.left},o.height=Math.min(o.height,t.height-(pageYOffset-t.top)),o.height=Math.min(o.height,t.height-(t.top+t.height-(pageYOffset+innerHeight))),o.height=Math.min(innerHeight,o.height),o.height-=2,o.width=Math.min(o.width,t.width-(pageXOffset-t.left)),o.width=Math.min(o.width,t.width-(t.left+t.width-(pageXOffset+innerWidth))),o.width=Math.min(innerWidth,o.width),o.width-=2,o.topl.clientWidth||"scroll"===[a.overflow,a.overflowX]||this.target!==document.body,s=0,n&&(s=15),i=t.height-parseFloat(a.borderTopWidth)-parseFloat(a.borderBottomWidth)-s,o={width:15,height:.975*i*(i/l.scrollHeight),left:t.left+t.width-parseFloat(a.borderLeftWidth)-15},e=0,408>i&&this.target===document.body&&(e=-11e-5*Math.pow(i,2)-.00727*i+22.58),this.target!==document.body&&(o.height=Math.max(o.height,24)),r=this.target.scrollTop/(l.scrollHeight-i),o.top=r*(i-o.height-e)+t.top+parseFloat(a.borderTopWidth),this.target===document.body&&(o.height=Math.max(o.height,24)),o}},t.prototype.clearCache=function(){return this._cache={}},t.prototype.cache=function(t,e){return null==this._cache&&(this._cache={}),null==this._cache[t]&&(this._cache[t]=e.call(this)),this._cache[t]},t.prototype.enable=function(t){return null==t&&(t=!0),o(this.target,this.getClass("enabled")),o(this.element,this.getClass("enabled")),this.enabled=!0,this.scrollParent!==document&&this.scrollParent.addEventListener("scroll",this.position),t?this.position():void 0},t.prototype.disable=function(){return C(this.target,this.getClass("enabled")),C(this.element,this.getClass("enabled")),this.enabled=!1,null!=this.scrollParent?this.scrollParent.removeEventListener("scroll",this.position):void 0},t.prototype.destroy=function(){var t,e,n,i,o;for(this.disable(),o=[],t=n=0,i=E.length;i>n;t=++n){if(e=E[t],e===this){E.splice(t,1);break}o.push(void 0)}return o},t.prototype.updateAttachClasses=function(t,e){var n,i,o,s,r,a,c,h,u,p=this;for(null==t&&(t=this.attachment),null==e&&(e=this.targetAttachment),s=["left","top","bottom","right","middle","center"],(null!=(u=this._addAttachClasses)?u.length:void 0)&&this._addAttachClasses.splice(0,this._addAttachClasses.length),n=null!=this._addAttachClasses?this._addAttachClasses:this._addAttachClasses=[],t.top&&n.push(""+this.getClass("element-attached")+"-"+t.top),t.left&&n.push(""+this.getClass("element-attached")+"-"+t.left),e.top&&n.push(""+this.getClass("target-attached")+"-"+e.top),e.left&&n.push(""+this.getClass("target-attached")+"-"+e.left),i=[],r=0,c=s.length;c>r;r++)o=s[r],i.push(""+this.getClass("element-attached")+"-"+o);for(a=0,h=s.length;h>a;a++)o=s[a],i.push(""+this.getClass("target-attached")+"-"+o);return l(function(){return null!=p._addAttachClasses?(x(p.element,p._addAttachClasses,i),x(p.target,p._addAttachClasses,i),p._addAttachClasses=void 0):void 0})},t.prototype.position=function(t){var e,n,o,l,c,f,m,g,v,y,w,O,C,E,N,x,S,T,M,D,A,U,_,P,I,L,W,k,F,H,B,j,z,q,Y,X=this;if(null==t&&(t=!0),this.enabled){for(this.clearCache(),D=a(this.targetAttachment,this.attachment),this.updateAttachClasses(this.attachment,D),e=this.cache("element-bounds",function(){return u(X.element)}),I=e.width,o=e.height,0===I&&0===o&&null!=this.lastSize?(H=this.lastSize,I=H.width,o=H.height):this.lastSize={width:I,height:o},_=U=this.cache("target-bounds",function(){return X.getTargetBounds()}),v=b(r(this.attachment),{width:I,height:o}),A=b(r(D),_),c=b(this.offset,{width:I,height:o}),f=b(this.targetOffset,_),v=s(v,c),A=s(A,f),l=U.left+A.left-v.left,P=U.top+A.top-v.top,B=i.modules,L=0,k=B.length;k>L;L++)if(m=B[L],N=m.position.call(this,{left:l,top:P,targetAttachment:D,targetPos:U,attachment:this.attachment,elementPos:e,offset:v,targetOffset:A,manualOffset:c,manualTargetOffset:f,scrollbarSize:T}),null!=N&&"object"==typeof N){if(N===!1)return!1;P=N.top,l=N.left}if(g={page:{top:P,left:l},viewport:{top:P-pageYOffset,bottom:pageYOffset-P-o+innerHeight,left:l-pageXOffset,right:pageXOffset-l-I+innerWidth}},document.body.scrollWidth>window.innerWidth&&(T=this.cache("scrollbar-size",d),g.viewport.bottom-=T.height),document.body.scrollHeight>window.innerHeight&&(T=this.cache("scrollbar-size",d),g.viewport.right-=T.width),(""!==(j=document.body.style.position)&&"static"!==j||""!==(z=document.body.parentElement.style.position)&&"static"!==z)&&(g.page.bottom=document.body.scrollHeight-P-o,g.page.right=document.body.scrollWidth-l-I),(null!=(q=this.options.optimizations)?q.moveElement:void 0)!==!1&&null==this.targetModifier){for(w=this.cache("target-offsetparent",function(){return p(X.target)}),E=this.cache("target-offsetparent-bounds",function(){return u(w)}),C=getComputedStyle(w),n=getComputedStyle(this.element),O=E,y={},Y=["Top","Left","Bottom","Right"],W=0,F=Y.length;F>W;W++)M=Y[W],y[M.toLowerCase()]=parseFloat(C["border"+M+"Width"]);E.right=document.body.scrollWidth-E.left-O.width+y.right,E.bottom=document.body.scrollHeight-E.top-O.height+y.bottom,g.page.top>=E.top+y.top&&g.page.bottom>=E.bottom&&g.page.left>=E.left+y.left&&g.page.right>=E.right&&(S=w.scrollTop,x=w.scrollLeft,g.offset={top:g.page.top-E.top+S-y.top,left:g.page.left-E.left+x-y.left})}return this.move(g),this.history.unshift(g),this.history.length>3&&this.history.pop(),t&&h(),!0}},t.prototype.move=function(t){var e,n,i,o,s,r,a,h,u,f,d,m,g,v,b,y,w,O=this;if(null!=this.element.parentNode){h={};for(f in t){h[f]={};for(o in t[f]){for(i=!1,y=this.history,v=0,b=y.length;b>v;v++)if(a=y[v],!S(null!=(w=a[f])?w[o]:void 0,t[f][o])){i=!0;break}i||(h[f][o]=!0)}}e={top:"",left:"",right:"",bottom:""},u=function(t,n){var i,o,s;return(null!=(s=O.options.optimizations)?s.gpu:void 0)===!1?(t.top?e.top=""+n.top+"px":e.bottom=""+n.bottom+"px",t.left?e.left=""+n.left+"px":e.right=""+n.right+"px"):(t.top?(e.top=0,o=n.top):(e.bottom=0,o=-n.bottom),t.left?(e.left=0,i=n.left):(e.right=0,i=-n.right),e[N]="translateX("+Math.round(i)+"px) translateY("+Math.round(o)+"px)","msTransform"!==N?e[N]+=" translateZ(0)":void 0)},s=!1,(h.page.top||h.page.bottom)&&(h.page.left||h.page.right)?(e.position="absolute",u(h.page,t.page)):(h.viewport.top||h.viewport.bottom)&&(h.viewport.left||h.viewport.right)?(e.position="fixed",u(h.viewport,t.viewport)):null!=h.offset&&h.offset.top&&h.offset.left?(e.position="absolute",r=this.cache("target-offsetparent",function(){return p(O.target)}),p(this.element)!==r&&l(function(){return O.element.parentNode.removeChild(O.element),r.appendChild(O.element)}),u(h.offset,t.offset),s=!0):(e.position="absolute",u({top:!0,left:!0},t.page)),s||"BODY"===this.element.parentNode.tagName||(this.element.parentNode.removeChild(this.element),document.body.appendChild(this.element)),g={},m=!1;for(o in e)d=e[o],n=this.element.style[o],""===n||""===d||"top"!==o&&"left"!==o&&"bottom"!==o&&"right"!==o||(n=parseFloat(n),d=parseFloat(d)),n!==d&&(m=!0,g[o]=e[o]);return m?l(function(){return c(O.element.style,g)}):void 0}},t}(),i.position=O,this.Tether=c(T,i)}.call(this),function(){var t,e,n,i,o,s,r,a,l,c,h=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};c=this.Tether.Utils,r=c.getOuterSize,s=c.getBounds,a=c.getSize,i=c.extend,l=c.updateClasses,n=c.defer,e={left:"right",right:"left",top:"bottom",bottom:"top",middle:"middle"},t=["left","top","right","bottom"],o=function(e,n){var i,o,r,a,l,c,h;if("scrollParent"===n?n=e.scrollParent:"window"===n&&(n=[pageXOffset,pageYOffset,innerWidth+pageXOffset,innerHeight+pageYOffset]),n===document&&(n=n.documentElement),null!=n.nodeType)for(o=a=s(n),l=getComputedStyle(n),n=[o.left,o.top,a.width+o.left,a.height+o.top],i=c=0,h=t.length;h>c;i=++c)r=t[i],r=r[0].toUpperCase()+r.substr(1),"Top"===r||"Left"===r?n[i]+=parseFloat(l["border"+r+"Width"]):n[i]-=parseFloat(l["border"+r+"Width"]);return n},this.Tether.modules.push({position:function(e){var r,a,c,u,p,f,d,m,g,v,b,y,w,O,C,E,N,x,S,T,M,D,A,U,_,P,I,L,W,k,F,H,B,j,z,q,Y,X,R,Z,V,$,G,J,K,Q,tt,et=this;if(P=e.top,b=e.left,M=e.targetAttachment,!this.options.constraints)return!0;for(x=function(e){var n,i,o,s;for(et.removeClass(e),s=[],i=0,o=t.length;o>i;i++)n=t[i],s.push(et.removeClass(""+e+"-"+n));return s},Z=this.cache("element-bounds",function(){return s(et.element)}),v=Z.height,I=Z.width,0===I&&0===v&&null!=this.lastSize&&(V=this.lastSize,I=V.width,v=V.height),A=this.cache("target-bounds",function(){return et.getTargetBounds()}),D=A.height,U=A.width,T={},g={},a=[this.getClass("pinned"),this.getClass("out-of-bounds")],$=this.options.constraints,L=0,H=$.length;H>L;L++)m=$[L],m.outOfBoundsClass&&a.push(m.outOfBoundsClass),m.pinnedClass&&a.push(m.pinnedClass);for(W=0,B=a.length;B>W;W++)for(d=a[W],G=["left","top","right","bottom"],k=0,j=G.length;j>k;k++)S=G[k],a.push(""+d+"-"+S);for(r=[],T=i({},M),g=i({},this.attachment),J=this.options.constraints,F=0,z=J.length;z>F;F++){if(m=J[F],_=m.to,c=m.attachment,C=m.pin,null==c&&(c=""),h.call(c," ")>=0?(K=c.split(" "),f=K[0],p=K[1]):p=f=c,u=o(this,_),("target"===f||"both"===f)&&(Pu[3]&&"bottom"===T.top&&(P-=D,T.top="top")),"together"===f&&(Pu[3]&&"bottom"===T.top&&("top"===g.top?(P-=D,T.top="top",P-=v,g.top="bottom"):"bottom"===g.top&&(P-=D,T.top="top",P+=v,g.top="top")),"middle"===T.top&&(P+v>u[3]&&"top"===g.top?(P-=v,g.top="bottom"):Pu[2]&&"right"===T.left&&(b-=U,T.left="left")),"together"===p&&(bu[2]&&"right"===T.left?"left"===g.left?(b-=U,T.left="left",b-=I,g.left="right"):"right"===g.left&&(b-=U,T.left="left",b+=I,g.left="left"):"center"===T.left&&(b+I>u[2]&&"left"===g.left?(b-=I,g.left="right"):bu[3]&&"top"===g.top&&(P-=v,g.top="bottom")),("element"===p||"both"===p)&&(bu[2]&&"left"===g.left&&(b-=I,g.left="right")),"string"==typeof C?C=function(){var t,e,n,i;for(n=C.split(","),i=[],e=0,t=n.length;t>e;e++)O=n[e],i.push(O.trim());return i}():C===!0&&(C=["top","left","right","bottom"]),C||(C=[]),E=[],y=[],P=0?(P=u[1],E.push("top")):y.push("top")),P+v>u[3]&&(h.call(C,"bottom")>=0?(P=u[3]-v,E.push("bottom")):y.push("bottom")),b=0?(b=u[0],E.push("left")):y.push("left")),b+I>u[2]&&(h.call(C,"right")>=0?(b=u[2]-I,E.push("right")):y.push("right")),E.length)for(N=null!=(Q=this.options.pinnedClass)?Q:this.getClass("pinned"),r.push(N),X=0,q=E.length;q>X;X++)S=E[X],r.push(""+N+"-"+S);if(y.length)for(w=null!=(tt=this.options.outOfBoundsClass)?tt:this.getClass("out-of-bounds"),r.push(w),R=0,Y=y.length;Y>R;R++)S=y[R],r.push(""+w+"-"+S);(h.call(E,"left")>=0||h.call(E,"right")>=0)&&(g.left=T.left=!1),(h.call(E,"top")>=0||h.call(E,"bottom")>=0)&&(g.top=T.top=!1),(T.top!==M.top||T.left!==M.left||g.top!==this.attachment.top||g.left!==this.attachment.left)&&this.updateAttachClasses(g,T)}return n(function(){return l(et.target,r,a),l(et.element,r,a)}),{top:P,left:b}}})}.call(this),function(){var t,e,n,i;i=this.Tether.Utils,e=i.getBounds,n=i.updateClasses,t=i.defer,this.Tether.modules.push({position:function(i){var o,s,r,a,l,c,h,u,p,f,d,m,g,v,b,y,w,O,C,E,N,x,S,T,M,D=this;if(d=i.top,c=i.left,N=this.cache("element-bounds",function(){return e(D.element)}),l=N.height,m=N.width,f=this.getTargetBounds(),a=d+l,h=c+m,o=[],d<=f.bottom&&a>=f.top)for(x=["left","right"],g=0,w=x.length;w>g;g++)u=x[g],((S=f[u])===c||S===h)&&o.push(u);if(c<=f.right&&h>=f.left)for(T=["top","bottom"],v=0,O=T.length;O>v;v++)u=T[v],((M=f[u])===d||M===a)&&o.push(u);for(r=[],s=[],p=["left","top","right","bottom"],r.push(this.getClass("abutted")),b=0,C=p.length;C>b;b++)u=p[b],r.push(""+this.getClass("abutted")+"-"+u);for(o.length&&s.push(this.getClass("abutted")),y=0,E=o.length;E>y;y++)u=o[y],s.push(""+this.getClass("abutted")+"-"+u);return t(function(){return n(D.target,s,r),n(D.element,s,r)}),!0}})}.call(this),function(){this.Tether.modules.push({position:function(t){var e,n,i,o,s,r,a;return r=t.top,e=t.left,this.options.shift?(n=function(t){return"function"==typeof t?t.call(this,{top:r,left:e}):t},i=n(this.options.shift),"string"==typeof i?(i=i.split(" "),i[1]||(i[1]=i[0]),s=i[0],o=i[1],s=parseFloat(s,10),o=parseFloat(o,10)):(a=[i.top,i.left],s=a[0],o=a[1]),r+=s,e+=o,{top:r,left:e}):void 0}})}.call(this),this.Tether})},function(t,e,n){"use strict";var i=n(2),o=i.createClass({displayName:"Tabs",getInitialState:function(){return{selectedTab:0}},selectTab:function(t){this.setState(t)},render:function(){var t=null,e=i.Children.map(this.props.children,function(e,n){return n===this.state.selectedTab&&(t=e.props.children),i.cloneElement(e,{active:n===this.state.selectedTab,index:n,selectTab:this.selectTab})}.bind(this));return i.createElement("div",null,i.createElement("div",{className:"tabs"},e),i.createElement("div",{className:"content"},t))}});t.exports=o,o.Tab=n(31)},function(t,e,n){"use strict";var i=n(2),o=n(!function(){var t=new Error('Cannot find module "classnames"');throw t.code="MODULE_NOT_FOUND",t}()),s=i.createClass({displayName:"Tab",select:function(){var t={selectedTab:this.props.index};this.props.selectTab(t)},render:function(){var t={"tab-item":!0,"is-active":this.props.active};return i.createElement("div",{className:o(t),onClick:this.select},this.props.title)}});t.exports=s},function(t,e,n){"use strict";var i=n(2),o=n(!function(){var t=new Error('Cannot find module "react-dom"');throw t.code="MODULE_NOT_FOUND",t}()),s=n(5),r=n(33),a=i.createClass({displayName:"Trigger",getDefaultProps:function(){return{open:null,close:null,toggle:null,hardToggle:null,popupToggle:null,notify:null}},getCloseId:function(){if(this.props.close)return this.props.close;for(var t=!1,e=o.findDOMNode(this).parentNode;t===!1;)"BODY"==e.nodeName&&(t=""),"undefined"!=typeof e.getAttribute("data-closable")&&e.getAttribute("data-closable")!==!1&&(t=e),e=e.parentNode;return t.getAttribute("id")},clickHandler:function(t){t.preventDefault(),this.props.open?s.publish(this.props.open,"open"):null!==this.props.close?s.publish(this.getCloseId(),"close"):this.props.toggle?s.publish(this.props.toggle,"toggle"):this.props.hardToggle?(s.closeActiveElements({exclude:this.props.hardToggle}),s.publish(this.props.hardToggle,"toggle")):this.props.notify&&s.publish(this.props.notify,{title:this.props.title,content:this.props.content,position:this.props.position,color:this.props.color,image:this.props.image})},render:function(){if(this.props.popupToggle)return i.createElement(r,this.props);var t=i.Children.only(this.props.children);return i.cloneElement(t,{onClick:this.clickHandler})}});t.exports=a},function(t,e,n){"use strict";var i=n(2),o=n(5),s=i.createClass({displayName:"PopupToggle",clickHandler:function(t,e){e.preventDefault(),o.publish(this.props.popupToggle,["toggle",t])},render:function(){var t=i.Children.only(this.props.children),e=this.props.id||o.generateUuid();return i.cloneElement(t,{id:e,onClick:this.clickHandler.bind(this,e)})}});t.exports=s}])}); \ No newline at end of file diff --git a/package.json b/package.json index d2197fc..4b6878a 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "'React port of foundation-apps'", "main": "index.js", "scripts": { - "postinstall": "bower install", + "postinstall": "", "start": "./node_modules/.bin/gulp server", "prepublish": "./node_modules/.bin/babel ./src --out-dir ./lib --ignore *.min.js && ./node_modules/.bin/gulp dist" }, @@ -63,15 +63,17 @@ "webpack-dev-server": "^1.6.6" }, "peerDependencies": { - "react": "*", - "react-responsive-mixin": "*", - "pubsub-js": "^1.5.x", - "object-assign": "^2.0.*" + "react": ">=0.14.x", + "react-dom": ">=0.14.x", + "react-responsive-mixin": "*" }, "dependencies": { - "object-assign": "^2.0.0", - "pubsub-js": "^1.5.0", - "tether": "^0.6.5" + "classnames": "^2.2.1", + "foundation-apps": "git+https://github.com/zurb/foundation-apps.git", + "object-assign": "^4.0.0", + "tether": "^0.6.5", + "pubsub-js": "^1.5.x", + "object-assign": ">=4.0.*" }, "browserify": { "transform": [ diff --git a/src/accordion/index.jsx b/src/accordion/index.jsx index ec868c1..1ee6eed 100644 --- a/src/accordion/index.jsx +++ b/src/accordion/index.jsx @@ -1,5 +1,5 @@ var React = require('react'); -var cloneWithProps = require('react/lib/cloneWithProps'); + var Accordion = React.createClass({ getInitialState: function () { @@ -41,7 +41,7 @@ var Accordion = React.createClass({ }, render: function () { var children = React.Children.map(this.props.children, function (child, index) { - return cloneWithProps(child, { + return React.cloneElement(child, { active: this.state.sections[index]? this.state.sections[index].active: false, activate: this.select.bind(this, index) }); diff --git a/src/accordion/item.jsx b/src/accordion/item.jsx index 157ca9f..8d91724 100644 --- a/src/accordion/item.jsx +++ b/src/accordion/item.jsx @@ -1,5 +1,5 @@ var React = require('react'); -var cx = require('react/lib/cx'); +var classnames = require('classnames'); var AccordionItem = React.createClass({ render: function () { @@ -8,7 +8,7 @@ var AccordionItem = React.createClass({ 'is-active': this.props.active }; return ( -
+
{this.props.title}
diff --git a/src/action-sheet/button.jsx b/src/action-sheet/button.jsx index a53fc6f..8783742 100644 --- a/src/action-sheet/button.jsx +++ b/src/action-sheet/button.jsx @@ -1,6 +1,7 @@ var React = require('react'); var ActionSheetButton = React.createClass({ + displayName: "ActionSheetButton", toggle: function () { this.props.setActiveState(!this.props.active); }, @@ -18,4 +19,4 @@ var ActionSheetButton = React.createClass({ } }); -module.exports = ActionSheetButton; \ No newline at end of file +module.exports = ActionSheetButton; diff --git a/src/action-sheet/content.jsx b/src/action-sheet/content.jsx index 493d37a..df193cf 100644 --- a/src/action-sheet/content.jsx +++ b/src/action-sheet/content.jsx @@ -1,5 +1,5 @@ var React = require('react'); -var cx = require('react/lib/cx'); +var classnames = require('classnames'); var ActionSheetContent = React.createClass({ getDefaultProps: function () { @@ -11,7 +11,7 @@ var ActionSheetContent = React.createClass({ 'is-active': this.props.active }; return ( -
{this.props.children}
+
{this.props.children}
); } }); diff --git a/src/action-sheet/index.jsx b/src/action-sheet/index.jsx index 188dc8b..a984cd4 100644 --- a/src/action-sheet/index.jsx +++ b/src/action-sheet/index.jsx @@ -1,5 +1,4 @@ var React = require('react'); -var cloneWithProps = require('react/lib/cloneWithProps'); var foundationApi = require('../utils/foundation-api'); var ActionSheet = React.createClass({ @@ -14,7 +13,7 @@ var ActionSheet = React.createClass({ var insideActionSheet = false; do { - if(el.classList && el.classList.contains('action-sheet-container')) { + if(el.classList && el.classList.contains('action-sheet-container') && el.id === this.props.id) { insideActionSheet = true; break; } @@ -49,10 +48,10 @@ var ActionSheet = React.createClass({ if (child.type.displayName === 'ActionSheetButton') { extraProps.setActiveState = this.setActiveState; } - return cloneWithProps(child, extraProps); + return React.cloneElement(child, extraProps); }.bind(this)); return ( -
+
{children}
); diff --git a/src/iconic/index.jsx b/src/iconic/index.jsx index 24b0ba2..48abafd 100644 --- a/src/iconic/index.jsx +++ b/src/iconic/index.jsx @@ -1,12 +1,13 @@ var React = require('react'); +var ReactDOM = require('react-dom'); var ExecutionEnvironment = require('react/lib/ExecutionEnvironment'); var IconicJs = ExecutionEnvironment.canUseDOM && require('../vendor/iconic.min'); -var cloneWithProps = require('react/lib/cloneWithProps'); + var Iconic = React.createClass({ inject: function () { var ico = IconicJs(); - ico.inject(this.getDOMNode()); + ico.inject(ReactDOM.findDOMNode(this)); }, componentDidMount: function () { this.inject(); diff --git a/src/modal/index.jsx b/src/modal/index.jsx index 509fa9e..6bf8f65 100644 --- a/src/modal/index.jsx +++ b/src/modal/index.jsx @@ -1,5 +1,4 @@ var React = require('react'); -var cx = require('react/lib/cx'); var Animation = require('../utils/animation'); var foundationApi = require('../utils/foundation-api'); @@ -8,37 +7,50 @@ var Modal = React.createClass({ return { open: false }; }, getDefaultProps: function () { - return { + return { overlay: true, overlayClose: true, animationIn: 'fadeIn', - animationOut: 'fadeOut' + animationOut: 'fadeOut', + onClose: null }; }, componentDidMount: function () { - foundationApi.subscribe(this.props.id, function (name, msg) { - if (msg === 'open') { - this.setState({open: true}); - } else if (msg === 'close') { - this.setState({open: false}); - } else if (msg === 'toggle') { - this.setState({open: !this.state.open}); - } - }.bind(this)); + this.subscribe(this.props.id); }, componentWillUnmount: function () { foundationApi.unsubscribe(this.props.id); }, + componentWillReceiveProps: function (nextProps) { + if (nextProps.id !== this.props.id) { + foundationApi.unsubscribe(this.props.id); + this.subscribe(nextProps.id); + } + }, hideOverlay: function (e) { e.preventDefault(); if (this.props.overlayClose) { - this.setState({open: false}); + this.setState({open: false}); + if (this.props.onClose) this.props.onClose(); } }, stopClickPropagation: function (e) { e.preventDefault(); e.stopPropagation(); }, + subscribe: function (id) { + foundationApi.subscribe(id, function (name, msg) { + if (msg === 'open') { + this.setState({open: true}); + } else if (msg === 'close') { + this.setState({open: false}); + if (this.props.onClose) this.props.onClose(); + } else if (msg === 'toggle') { + this.setState({open: !this.state.open}); + if (!this.state.open && this.props.onClose) this.props.onClose(); + } + }.bind(this)); + }, render: function() { var overlayStyle = {}; if (!this.props.overlay) { diff --git a/src/notification/notification.jsx b/src/notification/notification.jsx index 23b89e6..8d3a1f9 100644 --- a/src/notification/notification.jsx +++ b/src/notification/notification.jsx @@ -7,7 +7,8 @@ var Notification = React.createClass({ color: 'success', title: null, image: null, - content: null + content: null, + wrapperElement: "p" }; }, render: function () { @@ -27,7 +28,7 @@ var Notification = React.createClass({ {imageNode}

{this.props.title}

-

{this.props.children}

+ {React.createElement(this.props.wrapperElement, null, this.props.children)}
); diff --git a/src/notification/static.jsx b/src/notification/static.jsx index 09c4c22..3733d09 100644 --- a/src/notification/static.jsx +++ b/src/notification/static.jsx @@ -1,5 +1,5 @@ var React = require('react'); -var cx = require('react/lib/cx'); +var classnames = require('classnames'); var foundationApi = require('../utils/foundation-api'); var Animation = require('../utils/animation'); var Notification = require('./notification'); diff --git a/src/offcanvas/index.jsx b/src/offcanvas/index.jsx index 4a1e77c..9a79b8d 100644 --- a/src/offcanvas/index.jsx +++ b/src/offcanvas/index.jsx @@ -1,5 +1,5 @@ var React = require('react'); -var cx = require('react/lib/cx'); +var classnames = require('classnames'); // var LayerMixin = require('react-layer-mixin'); var foundationApi = require('../utils/foundation-api'); @@ -37,7 +37,7 @@ var Offcanvas = React.createClass({ classes[this.props.className] = true; } return ( -
+
{this.props.children}
); diff --git a/src/panel/index.jsx b/src/panel/index.jsx index c4f0c10..37b7982 100644 --- a/src/panel/index.jsx +++ b/src/panel/index.jsx @@ -1,5 +1,5 @@ var React = require('react'); -var cx = require('react/lib/cx'); +var classnames = require('classnames'); var Animation = require('../utils/animation'); var foundationApi = require('../utils/foundation-api'); diff --git a/src/popup/index.jsx b/src/popup/index.jsx index 2f4ce88..9cc5c83 100644 --- a/src/popup/index.jsx +++ b/src/popup/index.jsx @@ -1,5 +1,6 @@ var React = require('react'); -var cx = require('react/lib/cx'); +var ReactDOM = require('react-dom'); +var classnames = require('classnames'); var ExecutionEnvironment = require('react/lib/ExecutionEnvironment'); var foundationApi = require('../utils/foundation-api'); var Tether = ExecutionEnvironment.canUseDOM && require('tether/tether'); @@ -39,7 +40,7 @@ var Popup = React.createClass({ var targetElement = document.getElementById(target); var attachment = 'top center'; this.tether = new Tether({ - element: this.getDOMNode(), + element: ReactDOM.findDOMNode(this), target: targetElement, attachment: attachment, }); @@ -50,7 +51,7 @@ var Popup = React.createClass({ 'is-active': this.state.active }; return ( -
+
{this.props.children}
); diff --git a/src/popup/toggle.jsx b/src/popup/toggle.jsx index f30af01..8cec909 100644 --- a/src/popup/toggle.jsx +++ b/src/popup/toggle.jsx @@ -1,6 +1,6 @@ var React = require('react'); var foundationApi = require('../utils/foundation-api'); -var cloneWithProps = require('react/lib/cloneWithProps'); + var PopupToggle = React.createClass({ clickHandler: function (id, e) { @@ -10,7 +10,7 @@ var PopupToggle = React.createClass({ render: function () { var child = React.Children.only(this.props.children); var id = this.props.id || foundationApi.generateUuid(); - return cloneWithProps(child, { + return React.cloneElement(child, { id: id, onClick: this.clickHandler.bind(this, id) }); diff --git a/src/tabs/index.jsx b/src/tabs/index.jsx index 14622c8..6f2d674 100644 --- a/src/tabs/index.jsx +++ b/src/tabs/index.jsx @@ -1,19 +1,20 @@ var React = require('react'); -var cloneWithProps = require('react/lib/cloneWithProps'); + var Tabs = React.createClass({ getInitialState: function () { return { - selectedTab: 0, - content: null + selectedTab: 0 }; }, selectTab: function (options) { this.setState(options); }, render: function () { + var content = null; var children = React.Children.map(this.props.children, function (child, index) { - return cloneWithProps(child, { + if(index === this.state.selectedTab) content = child.props.children; + return React.cloneElement(child, { active: (index === this.state.selectedTab), index: index, selectTab: this.selectTab @@ -22,11 +23,11 @@ var Tabs = React.createClass({ return (
{children}
-
{this.state.content}
+
{content}
); } }); module.exports = Tabs; -Tabs.Tab = require('./tab'); \ No newline at end of file +Tabs.Tab = require('./tab'); diff --git a/src/tabs/tab.jsx b/src/tabs/tab.jsx index 9e7f737..fbd5d08 100644 --- a/src/tabs/tab.jsx +++ b/src/tabs/tab.jsx @@ -1,16 +1,11 @@ var React = require('react'); -var cx = require('react/lib/cx'); +var classnames = require('classnames'); var Tab = React.createClass({ - componentDidMount: function () { - if (this.props.active) { - this.select(); - } - }, + select: function () { var options = { - selectedTab: this.props.index, - content: this.props.children + selectedTab: this.props.index }; this.props.selectTab(options); }, @@ -20,7 +15,7 @@ var Tab = React.createClass({ 'is-active': this.props.active }; return ( -
+
{this.props.title}
); diff --git a/src/trigger/index.jsx b/src/trigger/index.jsx index 5b698dc..b7ccc31 100644 --- a/src/trigger/index.jsx +++ b/src/trigger/index.jsx @@ -1,5 +1,5 @@ var React = require('react'); -var cloneWithProps = require('react/lib/cloneWithProps'); +var ReactDOM = require('react-dom'); var foundationApi = require('../utils/foundation-api'); var PopupToggle = require('../popup/toggle'); @@ -19,7 +19,7 @@ var Trigger = React.createClass({ return this.props.close; } else { var parentElement= false; - var tempElement = this.getDOMNode().parentNode; + var tempElement = ReactDOM.findDOMNode(this).parentNode; while(parentElement === false) { if(tempElement.nodeName == 'BODY') { parentElement = ''; @@ -59,7 +59,7 @@ var Trigger = React.createClass({ return ; } else { var child = React.Children.only(this.props.children); - return cloneWithProps(child, { + return React.cloneElement(child, { onClick: this.clickHandler }); } diff --git a/src/utils/animation.jsx b/src/utils/animation.jsx index 2275b5d..27358d2 100644 --- a/src/utils/animation.jsx +++ b/src/utils/animation.jsx @@ -1,9 +1,10 @@ // some parts of code from react/lib/ReactCSSTransitionGroupChild.js var React = require('react'); +var ReactDOM = require('react-dom'); var ReactTransitionEvents = require('react/lib/ReactTransitionEvents'); -var CSSCore = require('react/lib/CSSCore'); -var cloneWithProps = require('react/lib/cloneWithProps'); -var cx = require('react/lib/cx'); +var CSSCore = require('./csscore'); + +var classnames = require('classnames'); var TICK = 17; var Animation = React.createClass({ @@ -31,14 +32,14 @@ var Animation = React.createClass({ CSSCore.removeClass(node, this.props.animationOut); }, finishAnimation: function () { - var node = this.getDOMNode(); + var node = ReactDOM.findDOMNode(this); this.reset(node); CSSCore.removeClass(node, this.props.active? '' : 'is-active'); this.reflow(node); ReactTransitionEvents.removeEndEventListener(node, this.finishAnimation); }, animate: function(animationClass, animationType) { - var node = this.getDOMNode(); + var node = ReactDOM.findDOMNode(this); var initClass = 'ng-' + animationType; var activeClass = initClass + '-active'; @@ -67,7 +68,7 @@ var Animation = React.createClass({ render: function () { var child = React.Children.only(this.props.children); var extraProps = {}; - return cloneWithProps(child, extraProps); + return React.cloneElement(child, extraProps); } }); diff --git a/src/utils/csscore.jsx b/src/utils/csscore.jsx new file mode 100644 index 0000000..56ca51d --- /dev/null +++ b/src/utils/csscore.jsx @@ -0,0 +1,25 @@ +'use strict'; + +var SPACE = ' '; +var RE_CLASS = /[\n\t\r]/g; + +var norm = function (elemClass) { + return (SPACE + elemClass + SPACE).replace(RE_CLASS, SPACE); +}; + +module.exports = { + addClass(elem, className) { + elem.className += ' ' + className; + }, + + removeClass(elem, needle) { + var elemClass = elem.className.trim(); + var className = norm(elemClass); + needle = needle.trim(); + needle = SPACE + needle + SPACE; + while (className.indexOf(needle) >= 0) { + className = className.replace(needle, SPACE); + } + elem.className = className.trim(); + } +}; \ No newline at end of file diff --git a/src/utils/foundation-api.js b/src/utils/foundation-api.js index 4a588b3..d51d23f 100644 --- a/src/utils/foundation-api.js +++ b/src/utils/foundation-api.js @@ -24,7 +24,7 @@ var foundationApi = { return settings; }, modifySettings: function(tree) { - settings = angular.extend(settings, tree); + settings = assign(settings, tree); return settings; }, generateUuid: function() { @@ -43,4 +43,4 @@ var foundationApi = { }, }; -module.exports = foundationApi; \ No newline at end of file +module.exports = foundationApi; diff --git a/src/utils/mq-helpers.js b/src/utils/mq-helpers.js index 2ebca57..d32f481 100644 --- a/src/utils/mq-helpers.js +++ b/src/utils/mq-helpers.js @@ -2,10 +2,11 @@ function headerHelper(classArray) { var i = classArray.length; - var head = document.querySelectorAll('head'); while(i--) { - head.append(''); + var meta = document.createElement('meta'); + meta.className = classArray[i]; + document.head.appendChild(meta); } return; @@ -59,4 +60,4 @@ module.exports = { headerHelper: headerHelper, getStyle: getStyle, parseStyleToObject: parseStyleToObject -}; \ No newline at end of file +}; diff --git a/src/utils/mq-init.js b/src/utils/mq-init.js index 401db7a..4b087f9 100644 --- a/src/utils/mq-init.js +++ b/src/utils/mq-init.js @@ -1,11 +1,39 @@ var helpers = require('./mq-helpers'); var foundationApi = require('./foundation-api'); +var assign = require('object-assign'); + +function throttleUtil(func, delay) { + var timer = null; + + return function () { + var context = this, args = arguments; + + if (timer === null) { + timer = setTimeout(function () { + func.apply(context, args); + timer = null; + }, delay); + } + }; +} function init() { var mediaQueries; var extractedMedia; var mediaObject; + var namedQueries = { + 'default' : 'only screen', + landscape : 'only screen and (orientation: landscape)', + portrait : 'only screen and (orientation: portrait)', + retina : 'only screen and (-webkit-min-device-pixel-ratio: 2),' + + 'only screen and (min--moz-device-pixel-ratio: 2),' + + 'only screen and (-o-min-device-pixel-ratio: 2/1),' + + 'only screen and (min-device-pixel-ratio: 2),' + + 'only screen and (min-resolution: 192dpi),' + + 'only screen and (min-resolution: 2dppx)' + }; + helpers.headerHelper(['foundation-mq']); extractedMedia = helpers.getStyle('.foundation-mq', 'font-family'); @@ -16,10 +44,12 @@ function init() { } foundationApi.modifySettings({ - mediaQueries: mediaQueries + mediaQueries: assign(mediaQueries, namedQueries) }); - window.addEventListener('resize', u.throttle(function() { + window.addEventListener('resize', throttleUtil(function() { foundationApi.publish('resize', 'window resized'); }, 50)); } + +module.exports = init;