lumen-foundation-apps
Version:
'React port of foundation-apps'
1,811 lines (1,516 loc) • 140 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"));
else if(typeof define === 'function' && define.amd)
define(["react"], factory);
else if(typeof exports === 'object')
exports["RFA"] = factory(require("react"));
else
root["RFA"] = factory(root["React"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_2__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
module.exports = {
Accordion: __webpack_require__(1),
ActionSheet: __webpack_require__(16),
Iconic: __webpack_require__(22),
Interchange: __webpack_require__(24),
Modal: __webpack_require__(30),
Notification: __webpack_require__(35),
OffCanvas: __webpack_require__(39),
Panel: __webpack_require__(40),
Popup: __webpack_require__(41),
Tabs: __webpack_require__(43),
Trigger: __webpack_require__(45),
};
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var React = __webpack_require__(2);
var cloneWithProps = __webpack_require__(3);
var Accordion = React.createClass({
displayName: 'Accordion',
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 });
},
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;
}
}
}).bind(this));
this.setState({ sections: sections });
},
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)
});
}).bind(this));
return React.createElement(
'div',
{ className: 'accordion' },
children
);
}
});
module.exports = Accordion;
Accordion.Item = __webpack_require__(14);
/***/ },
/* 2 */
/***/ function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_2__;
/***/ },
/* 3 */
/***/ 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 ReactElement = __webpack_require__(4);
var ReactPropTransferer = __webpack_require__(11);
var keyOf = __webpack_require__(13);
var warning = __webpack_require__(8);
var CHILDREN_PROP = keyOf({children: null});
/**
* 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);
}
var newProps = ReactPropTransferer.mergeProps(props, child.props);
// Use `child.props.children` if it is provided.
if (!newProps.hasOwnProperty(CHILDREN_PROP) &&
child.props.hasOwnProperty(CHILDREN_PROP)) {
newProps.children = child.props.children;
}
// The current API doesn't retain _owner and _context, which is why this
// doesn't use ReactElement.cloneAndReplaceProps.
return ReactElement.createElement(child.type, newProps);
}
module.exports = cloneWithProps;
/***/ },
/* 4 */
/***/ 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__(5);
var ReactCurrentOwner = __webpack_require__(10);
var assign = __webpack_require__(6);
var warning = __webpack_require__(8);
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
});
} 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;
}
}
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;
// Reserved names are extracted
var props = {};
var key = null;
var ref = null;
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];
}
}
}
// 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];
}
}
}
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. <Foo />.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];
}
}
}
// 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;
/***/ },
/* 5 */
/***/ 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__(6);
var emptyObject = __webpack_require__(7);
var warning = __webpack_require__(8);
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 <div>{children}</div>;
* }
*
* @param {object} newContext New context to merge into the existing context
* @param {function} scopedCallback Callback to run with the new context
* @return {ReactComponent|array<ReactComponent>}
*/
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 result;
var previousContext = ReactContext.current;
ReactContext.current = assign({}, previousContext, newContext);
try {
result = scopedCallback();
} finally {
ReactContext.current = previousContext;
}
return result;
}
};
module.exports = ReactContext;
/***/ },
/* 6 */
/***/ function(module, exports) {
/**
* 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;
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.
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
}
return to;
}
module.exports = assign;
/***/ },
/* 7 */
/***/ 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;
/***/ },
/* 8 */
/***/ 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__(9);
/**
* 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;
/***/ },
/* 9 */
/***/ 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 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() {}
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; };
module.exports = emptyFunction;
/***/ },
/* 10 */
/***/ 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 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;
/***/ },
/* 11 */
/***/ 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__(6);
var emptyFunction = __webpack_require__(9);
var joinClasses = __webpack_require__(12);
/**
* 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;
/***/ },
/* 12 */
/***/ 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 joinClasses
* @typechecks static-only
*/
'use strict';
/**
* 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;
}
}
}
return className;
}
module.exports = joinClasses;
/***/ },
/* 13 */
/***/ 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 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;
/***/ },
/* 14 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var React = __webpack_require__(2);
var cx = __webpack_require__(15);
var AccordionItem = React.createClass({
displayName: 'AccordionItem',
render: function render() {
var itemClasses = {
'accordion-item': true,
'is-active': this.props.active
};
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
)
);
}
});
module.exports = AccordionItem;
/***/ },
/* 15 */
/***/ 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 cx
*/
/**
* 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.
*/
'use strict';
var warning = __webpack_require__(8);
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;
}
if (typeof classNames == 'object') {
return Object.keys(classNames).filter(function(className) {
return classNames[className];
}).join(' ');
} else {
return Array.prototype.join.call(arguments, ' ');
}
}
module.exports = cx;
/***/ },
/* 16 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var React = __webpack_require__(2);
var cloneWithProps = __webpack_require__(3);
var foundationApi = __webpack_require__(17);
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__(20);
ActionSheet.Content = __webpack_require__(21);
/***/ },
/* 17 */
/***/ function(module, exports, __webpack_require__) {
//From https://github.com/zurb/foundation-apps/blob/master/js/angular/common/common.services.js
'use strict';
var PubSub = __webpack_require__(18);
var assign = __webpack_require__(19);
var listeners = [];
var settings = {};
var uniqueIds = [];
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 = '';
//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));
uniqueIds.push(uuid);
return uuid;
}
};
module.exports = foundationApi;
/***/ },
/* 18 */
/***/ 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;
}
if ( sync === true ){
deliver();
} else {
setTimeout( deliver, 0 );
}
return true;
}
/**
* 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 );
};
/**
* 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 );
};
/**
* 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;
}
// message is not registered yet
if ( !messages.hasOwnProperty( message ) ){
messages[message] = {};
}
// 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;
// return token for unsubscribing
return token;
};
/* Public: Clears all subscriptions
*/
PubSub.clearAllSubscriptions = function clearAllSubscriptions(){
messages = {};
};
/*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];
}
}
};
/* 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;
if (isTopic){
delete messages[value];
return;
}
for ( m in messages ){
if ( messages.hasOwnProperty( m ) ){
message = messages[m];
if ( isToken && message[value] ){
delete message[value];
result = value;
// tokens are unique, so we can just stop here
break;
}
if (isFunction) {
for ( t in message ){
if (message.hasOwnProperty(t) && message[t] === value){
delete message[t];
result = true;
}
}
}
}
}
return result;
};
}));
/***/ },
/* 19 */
/***/ function(module, exports) {
'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);
for (var s = 1; s < arguments.length; s++) {
from = arguments[s];
keys = Object.keys(Object(from));
for (var i = 0; i < keys.length; i++) {
to[keys[i]] = from[keys[i]];
}
}
return to;
};
/***/ },
/* 20 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var React = __webpack_require__(2);
var ActionSheetButton = React.createClass({
displayName: 'ActionSheetButton',
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
);
}
return React.createElement(
'div',
{ onClick: this.toggle },
Title,
React.createElement(
'div',
null,
this.props.children
)
);
}
});
module.exports = ActionSheetButton;
/***/ },
/* 21 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var React = __webpack_require__(2);
var cx = __webpack_require__(15);
var ActionSheetContent = React.createClass({
displayName: 'ActionSheetContent',
getDefaultProps: function getDefaultProps() {
return { position: 'bottom' };
},
render: function render() {
var classes = {
'action-sheet': true,
'is-active': this.props.active
};
return React.createElement(
'div',
{ className: cx(classes) },
this.props.children
);
}
});
module.exports = ActionSheetContent;
/***/ },
/* 22 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var React = __webpack_require__(2);
var ExecutionEnvironment = __webpack_require__(23);
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__(3);
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;
/***/ },
/* 23 */
/***/ 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
*/
/*jslint evil: true */
"use strict";
var canUseDOM = !!(
(typeof window !== 'undefined' &&
window.document && window.document.createElement)
);
/**
* 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 = {
canUseDOM: canUseDOM,
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;
/***/ },
/* 24 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var React = __webpack_require__(2);
var ResponsiveMixin = __webpack_require__(25);
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 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;
/***/ },
/* 25 */
/***/ function(module, exports, __webpack_require__) {
var canUseDOM = __webpack_require__(26);
var enquire = canUseDOM && __webpack_require__(27);
var json2mq = __webpack_require__(28);
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;
/***/ },
/* 26 */
/***/ function(module, exports) {
var canUseDOM = !!(
typeof window !== 'undefined' &&
window.document &&
window.document.createElement
);
module.exports = canUseDOM;
/***/ },
/* 27 */
/***/ 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(c