emoji-mart-lazyload/dist/emoji-picker.js

2145 lines
572 KiB
JavaScript
Raw Normal View History

2016-07-06 14:32:52 +00:00
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
2016-07-11 19:21:13 +00:00
module.exports = factory(require("React"));
2016-07-06 14:32:52 +00:00
else if(typeof define === 'function' && define.amd)
2016-07-11 19:21:13 +00:00
define(["React"], factory);
2016-07-06 14:32:52 +00:00
else if(typeof exports === 'object')
2016-07-11 19:21:13 +00:00
exports["EmojiPicker"] = factory(require("React"));
2016-07-06 14:32:52 +00:00
else
2016-07-11 19:21:13 +00:00
root["EmojiPicker"] = factory(root["React"]);
2016-07-06 14:32:52 +00:00
})(this, function(__WEBPACK_EXTERNAL_MODULE_3__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
/******/ // Flag the module as loaded
/******/ module.loaded = true;
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Object.defineProperty(exports, "__esModule", {
value: true
});
2016-07-26 19:39:50 +00:00
exports.frequently = exports.store = exports.emojiIndex = exports.Emoji = exports.Picker = undefined;
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _components = __webpack_require__(1);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Object.defineProperty(exports, 'Picker', {
enumerable: true,
get: function get() {
return _components.Picker;
}
});
Object.defineProperty(exports, 'Emoji', {
enumerable: true,
get: function get() {
return _components.Emoji;
}
});
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _emojiIndex = __webpack_require__(25);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _emojiIndex2 = _interopRequireDefault(_emojiIndex);
var _store = __webpack_require__(17);
var _store2 = _interopRequireDefault(_store);
2016-07-26 19:39:50 +00:00
var _frequently = __webpack_require__(16);
var _frequently2 = _interopRequireDefault(_frequently);
2016-07-20 18:51:41 +00:00
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.emojiIndex = _emojiIndex2.default;
exports.store = _store2.default;
2016-07-26 19:39:50 +00:00
exports.frequently = _frequently2.default;
2016-07-06 14:32:52 +00:00
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Object.defineProperty(exports, "__esModule", {
value: true
});
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _anchors = __webpack_require__(2);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Object.defineProperty(exports, 'Anchors', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_anchors).default;
}
});
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _category = __webpack_require__(15);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Object.defineProperty(exports, 'Category', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_category).default;
}
});
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _emoji = __webpack_require__(18);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Object.defineProperty(exports, 'Emoji', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_emoji).default;
}
});
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _picker = __webpack_require__(21);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Object.defineProperty(exports, 'Picker', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_picker).default;
}
});
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _preview = __webpack_require__(23);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Object.defineProperty(exports, 'Preview', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_preview).default;
}
});
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _search = __webpack_require__(24);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Object.defineProperty(exports, 'Search', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_search).default;
}
});
2016-07-11 19:04:58 +00:00
2016-07-22 20:30:55 +00:00
var _skins = __webpack_require__(26);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Object.defineProperty(exports, 'Skins', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_skins).default;
}
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Object.defineProperty(exports, "__esModule", {
value: true
});
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _react = __webpack_require__(3);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _react2 = _interopRequireDefault(_react);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _svgInlineReact = __webpack_require__(4);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _svgInlineReact2 = _interopRequireDefault(_svgInlineReact);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _svgs = __webpack_require__(5);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var SVGs = _interopRequireWildcard(_svgs);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var Anchors = function (_React$Component) {
_inherits(Anchors, _React$Component);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
function Anchors(props) {
_classCallCheck(this, Anchors);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Anchors).call(this, props));
2016-07-11 19:04:58 +00:00
2016-07-11 18:22:39 +00:00
var defaultCategory = props.categories[0];
if (defaultCategory.anchor) {
defaultCategory = defaultCategory.anchor;
}
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
_this.state = {
2016-07-11 18:22:39 +00:00
selected: defaultCategory.name
2016-07-06 14:32:52 +00:00
};
return _this;
}
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
_createClass(Anchors, [{
key: 'render',
value: function render() {
var _props = this.props;
var categories = _props.categories;
var onAnchorClick = _props.onAnchorClick;
2016-07-22 20:30:55 +00:00
var color = _props.color;
2016-07-06 14:32:52 +00:00
var selected = this.state.selected;
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
return _react2.default.createElement(
'div',
{ className: 'emoji-picker-anchors' },
categories.map(function (category, i) {
var name = category.name;
2016-07-11 18:22:39 +00:00
var anchor = category.anchor;
2016-07-22 20:30:55 +00:00
var isSelected = name == selected;
2016-07-11 19:04:58 +00:00
2016-07-11 18:22:39 +00:00
if (anchor) {
return null;
}
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
return _react2.default.createElement(
'span',
{
key: name,
title: name,
onClick: function onClick() {
return onAnchorClick(category, i);
},
2016-07-22 20:30:55 +00:00
className: 'emoji-picker-anchor ' + (isSelected ? 'emoji-picker-anchor-selected' : ''),
style: { color: isSelected ? color : null }
2016-07-06 14:32:52 +00:00
},
_react2.default.createElement(_svgInlineReact2.default, { src: SVGs[name] }),
2016-07-22 20:30:55 +00:00
_react2.default.createElement('span', { className: 'emoji-picker-anchor-bar', style: { backgroundColor: color } })
2016-07-06 14:32:52 +00:00
);
})
);
}
}]);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
return Anchors;
}(_react2.default.Component);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
exports.default = Anchors;
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Anchors.propTypes = {
categories: _react2.default.PropTypes.array,
onAnchorClick: _react2.default.PropTypes.func
};
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Anchors.defaultProps = {
categories: [],
onAnchorClick: function onAnchorClick() {}
};
/***/ },
/* 3 */
/***/ function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_3__;
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Object.defineProperty(exports, '__esModule', {
value: true
});
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
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; };
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _react = __webpack_require__(3);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _react2 = _interopRequireDefault(_react);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var DOMParser = typeof window !== 'undefined' && window.DOMParser;
var process = process || {};
process.env = process.env || {};
var parserAvailable = typeof DOMParser !== 'undefined' && DOMParser.prototype != null && DOMParser.prototype.parseFromString != null;
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
if ("production" !== process.env.NODE_ENV && !parserAvailable) {
console.info('<InlineSVG />: `raw` prop works only when `window.DOMParser` exists.');
}
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
function isParsable(src) {
// kinda naive but meh, ain't gonna use full-blown parser for this
return parserAvailable && typeof src === 'string' && src.trim().substr(0, 4) === '<svg';
}
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
// parse SVG string using `DOMParser`
function parseFromSVGString(src) {
var parser = new DOMParser();
return parser.parseFromString(src, "image/svg+xml");
}
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
// Transform DOM prop/attr names applicable to `<svg>` element but react-limited
function switchSVGAttrToReactProp(propName) {
switch (propName) {
case 'class':
return 'className';
default:
return propName;
}
}
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var InlineSVG = (function (_React$Component) {
_inherits(InlineSVG, _React$Component);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
_createClass(InlineSVG, null, [{
key: 'defaultProps',
value: {
element: 'i',
raw: false,
src: ''
},
enumerable: true
}, {
key: 'propTypes',
value: {
src: _react2['default'].PropTypes.string.isRequired,
element: _react2['default'].PropTypes.string,
raw: _react2['default'].PropTypes.bool
},
enumerable: true
}]);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
function InlineSVG(props) {
_classCallCheck(this, InlineSVG);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
_get(Object.getPrototypeOf(InlineSVG.prototype), 'constructor', this).call(this, props);
this._extractSVGProps = this._extractSVGProps.bind(this);
}
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
// Serialize `Attr` objects in `NamedNodeMap`
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
_createClass(InlineSVG, [{
key: '_serializeAttrs',
value: function _serializeAttrs(map) {
var ret = {};
var prop = undefined;
for (var i = 0; i < map.length; i++) {
prop = switchSVGAttrToReactProp(map[i].name);
ret[prop] = map[i].value;
}
return ret;
}
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
// get <svg /> element props
}, {
key: '_extractSVGProps',
value: function _extractSVGProps(src) {
var map = parseFromSVGString(src).documentElement.attributes;
return map.length > 0 ? this._serializeAttrs(map) : null;
}
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
// get content inside <svg> element.
}, {
key: '_stripSVG',
value: function _stripSVG(src) {
return parseFromSVGString(src).documentElement.innerHTML;
}
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(_ref) {
var children = _ref.children;
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
if ("production" !== process.env.NODE_ENV && children != null) {
console.info('<InlineSVG />: `children` prop will be ignored.');
}
}
}, {
key: 'render',
value: function render() {
var Element = undefined,
__html = undefined,
svgProps = undefined;
var _props = this.props;
var element = _props.element;
var raw = _props.raw;
var src = _props.src;
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
if (raw === true && isParsable(src)) {
Element = 'svg';
svgProps = this._extractSVGProps(src);
__html = this._stripSVG(src);
}
__html = __html || src;
Element = Element || element;
svgProps = svgProps || {};
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
return _react2['default'].createElement(Element, _extends({}, svgProps, this.props, { src: null, children: null,
dangerouslySetInnerHTML: { __html: __html } }));
}
}]);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
return InlineSVG;
})(_react2['default'].Component);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
exports['default'] = InlineSVG;
module.exports = exports['default'];
/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Object.defineProperty(exports, "__esModule", {
value: true
});
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _activity = __webpack_require__(6);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Object.defineProperty(exports, 'Activity', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_activity).default;
}
});
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _flags = __webpack_require__(7);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Object.defineProperty(exports, 'Flags', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_flags).default;
}
});
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _foods = __webpack_require__(8);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Object.defineProperty(exports, 'Foods', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_foods).default;
}
});
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _nature = __webpack_require__(9);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Object.defineProperty(exports, 'Nature', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_nature).default;
}
});
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _objects = __webpack_require__(10);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Object.defineProperty(exports, 'Objects', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_objects).default;
}
});
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _people = __webpack_require__(11);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Object.defineProperty(exports, 'People', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_people).default;
}
});
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _places = __webpack_require__(12);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Object.defineProperty(exports, 'Places', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_places).default;
}
});
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _recent = __webpack_require__(13);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Object.defineProperty(exports, 'Recent', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_recent).default;
}
});
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _symbols = __webpack_require__(14);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Object.defineProperty(exports, 'Symbols', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_symbols).default;
}
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/***/ },
/* 6 */
/***/ function(module, exports) {
module.exports = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M12 0C5.373 0 0 5.372 0 12c0 6.627 5.373 12 12 12 6.628 0 12-5.373 12-12 0-6.628-5.372-12-12-12m9.949 11H17.05c.224-2.527 1.232-4.773 1.968-6.113A9.966 9.966 0 0 1 21.949 11M13 11V2.051a9.945 9.945 0 0 1 4.432 1.564c-.858 1.491-2.156 4.22-2.392 7.385H13zm-2 0H8.961c-.238-3.165-1.536-5.894-2.393-7.385A9.95 9.95 0 0 1 11 2.051V11zm0 2v8.949a9.937 9.937 0 0 1-4.432-1.564c.857-1.492 2.155-4.221 2.393-7.385H11zm4.04 0c.236 3.164 1.534 5.893 2.392 7.385A9.92 9.92 0 0 1 13 21.949V13h2.04zM4.982 4.887C5.718 6.227 6.726 8.473 6.951 11h-4.9a9.977 9.977 0 0 1 2.931-6.113M2.051 13h4.9c-.226 2.527-1.233 4.771-1.969 6.113A9.972 9.972 0 0 1 2.051 13m16.967 6.113c-.735-1.342-1.744-3.586-1.968-6.113h4.899a9.961 9.961 0 0 1-2.931 6.113\"></path></svg>"
/***/ },
/* 7 */
/***/ function(module, exports) {
module.exports = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M0 0l6.084 24H8L1.916 0zM21 5h-4l-1-4H4l3 12h3l1 4h13L21 5zM6.563 3h7.875l2 8H8.563l-2-8zm8.832 10l-2.856 1.904L12.063 13h3.332zM19 13l-1.5-6h1.938l2 8H16l3-2z\"></path></svg>"
/***/ },
/* 8 */
/***/ function(module, exports) {
module.exports = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M17 4.978c-1.838 0-2.876.396-3.68.934.513-1.172 1.768-2.934 4.68-2.934a1 1 0 0 0 0-2c-2.921 0-4.629 1.365-5.547 2.512-.064.078-.119.162-.18.244C11.73 1.838 10.798.023 9.207.023 8.579.022 7.85.306 7 .978 5.027 2.54 5.329 3.902 6.492 4.999 3.609 5.222 0 7.352 0 12.969c0 4.582 4.961 11.009 9 11.009 1.975 0 2.371-.486 3-1 .629.514 1.025 1 3 1 4.039 0 9-6.418 9-11 0-5.953-4.055-8-7-8M8.242 2.546c.641-.508.943-.523.965-.523.426.169.975 1.405 1.357 3.055-1.527-.629-2.741-1.352-2.98-1.846.059-.112.241-.356.658-.686M15 21.978c-1.08 0-1.21-.109-1.559-.402l-.176-.146c-.367-.302-.816-.452-1.266-.452s-.898.15-1.266.452l-.176.146c-.347.292-.477.402-1.557.402-2.813 0-7-5.389-7-9.009 0-5.823 4.488-5.991 5-5.991 1.939 0 2.484.471 3.387 1.251l.323.276a1.995 1.995 0 0 0 2.58 0l.323-.276c.902-.78 1.447-1.251 3.387-1.251.512 0 5 .168 5 6 0 3.617-4.187 9-7 9\"></path></svg>"
/***/ },
/* 9 */
/***/ function(module, exports) {
module.exports = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M15.5 8a1.5 1.5 0 1 0 .001 3.001A1.5 1.5 0 0 0 15.5 8M8.5 8a1.5 1.5 0 1 0 .001 3.001A1.5 1.5 0 0 0 8.5 8\"></path><path d=\"M18.933 0h-.027c-.97 0-2.138.787-3.018 1.497-1.274-.374-2.612-.51-3.887-.51-1.285 0-2.616.133-3.874.517C7.245.79 6.069 0 5.093 0h-.027C3.352 0 .07 2.67.002 7.026c-.039 2.479.276 4.238 1.04 5.013.254.258.882.677 1.295.882.191 3.177.922 5.238 2.536 6.38.897.637 2.187.949 3.2 1.102C8.04 20.6 8 20.795 8 21c0 1.773 2.35 3 4 3 1.648 0 4-1.227 4-3 0-.201-.038-.393-.072-.586 2.573-.385 5.435-1.877 5.925-7.587.396-.22.887-.568 1.104-.788.763-.774 1.079-2.534 1.04-5.013C23.929 2.67 20.646 0 18.933 0M3.223 9.135c-.237.281-.837 1.155-.884 1.238-.15-.41-.368-1.349-.337-3.291.051-3.281 2.478-4.972 3.091-5.031.256.015.731.27 1.265.646-1.11 1.171-2.275 2.915-2.352 5.125-.133.546-.398.858-.783 1.313M12 22c-.901 0-1.954-.693-2-1 0-.654.475-1.236 1-1.602V20a1 1 0 1 0 2 0v-.602c.524.365 1 .947 1 1.602-.046.307-1.099 1-2 1m3-3.48v.02a4.752 4.752 0 0 0-1.262-1.02c1.092-.516 2.239-1.334 2.239-2.217 0-1.842-1.781-2.195-3.977-2.195-2.196 0-3.978.354-3.978 2.195 0 .883 1.148 1.701 2.238 2.217A4.8 4.8 0 0 0 9 18.539v-.025c-1-.076-2.182-.281-2.973-.842-1.301-.92-1.838-3.045-1.853-6.478l.023-.041c.496-.826 1.49-1.45 1.804-3.102 0-2.047 1.357-3.631 2.362-4.522C9.37 3.178 10.555 3 11.948 3c1.447 0 2.685.192 3.733.57 1 .9 2.316 2.465 2.316 4.48.313 1.651 1.307 2.275 1.803 3.102.035.058.068.117.102.178-.059 5.967-1.949 7.01-4.902 7.19m6.628-8.202c-.037-.065-.074-.13-.113-.195a7.587 7.587 0 0 0-.739-.987c-.385-.455-.648-.768-.782-1.313-.076-2.209-1.241-3.954-2.353-5.124.531-.376 1.004-.63 1.261-.647.636.071 3.044 1.764 3.096 5.031.027 1.81-.347 3.218-.37 3.235\"></path></svg>"
/***/ },
/* 10 */
/***/ function(module, exports) {
module.exports = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M12 0a9 9 0 0 0-5 16.482V21s2.035 3 5 3 5-3 5-3v-4.518A9 9 0 0 0 12 0zm0 2c3.86 0 7 3.141 7 7s-3.14 7-7 7-7-3.141-7-7 3.14-7 7-7zM9 17.477c.94.332 1.946.523 3 .523s2.06-.19 3-.523v.834c-.91.436-1.925.689-3 .689a6.924 6.924 0 0 1-3-.69v-.833zm.236 3.07A8.854 8.854 0 0 0 12 21c.965 0 1.888-.167 2.758-.451C14.155 21.173 13.153 22 12 22c-1.102 0-2.117-.789-2.764-1.453z\"></path><path d=\"M14.745 12.449h-.004c-.852-.024-1.188-.858-1.577-1.824-.421-1.061-.703-1.561-1.182-1.566h-.009c-.481 0-.783.497-1.235 1.537-.436.982-.801 1.811-1.636 1.791l-.276-.043c-.565-.171-.853-.691-1.284-1.794-.125-.313-.202-.632-.27-.913-.051-.213-.127-.53-.195-.634C7.067 9.004 7.039 9 6.99 9A1 1 0 0 1 7 7h.01c1.662.017 2.015 1.373 2.198 2.134.486-.981 1.304-2.058 2.797-2.075 1.531.018 2.28 1.153 2.731 2.141l.002-.008C14.944 8.424 15.327 7 16.979 7h.032A1 1 0 1 1 17 9h-.011c-.149.076-.256.474-.319.709a6.484 6.484 0 0 1-.311.951c-.429.973-.79 1.789-1.614 1.789\"></path></svg>"
/***/ },
/* 11 */
/***/ function(module, exports) {
module.exports = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0m0 22C6.486 22 2 17.514 2 12S6.486 2 12 2s10 4.486 10 10-4.486 10-10 10\"></path><path d=\"M8 7a2 2 0 1 0-.001 3.999A2 2 0 0 0 8 7M16 7a2 2 0 1 0-.001 3.999A2 2 0 0 0 16 7M15.232 15c-.693 1.195-1.87 2-3.349 2-1.477 0-2.655-.805-3.347-2H15m3-2H6a6 6 0 1 0 12 0\"></path></svg>"
/***/ },
/* 12 */
/***/ function(module, exports) {
module.exports = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M6.5 12C5.122 12 4 13.121 4 14.5S5.122 17 6.5 17 9 15.879 9 14.5 7.878 12 6.5 12m0 3c-.275 0-.5-.225-.5-.5s.225-.5.5-.5.5.225.5.5-.225.5-.5.5M17.5 12c-1.378 0-2.5 1.121-2.5 2.5s1.122 2.5 2.5 2.5 2.5-1.121 2.5-2.5-1.122-2.5-2.5-2.5m0 3c-.275 0-.5-.225-.5-.5s.225-.5.5-.5.5.225.5.5-.225.5-.5.5\"></path><path d=\"M22.482 9.494l-1.039-.346L21.4 9h.6c.552 0 1-.439 1-.992 0-.006-.003-.008-.003-.008H23c0-1-.889-2-1.984-2h-.642l-.731-1.717C19.262 3.012 18.091 2 16.764 2H7.236C5.909 2 4.738 3.012 4.357 4.283L3.626 6h-.642C1.889 6 1 7 1 8h.003S1 8.002 1 8.008C1 8.561 1.448 9 2 9h.6l-.043.148-1.039.346a2.001 2.001 0 0 0-1.359 2.097l.751 7.508a1 1 0 0 0 .994.901H3v1c0 1.103.896 2 2 2h2c1.104 0 2-.897 2-2v-1h6v1c0 1.103.896 2 2 2h2c1.104 0 2-.897 2-2v-1h1.096a.999.999 0 0 0 .994-.901l.751-7.508a2.001 2.001 0 0 0-1.359-2.097M6.273 4.857C6.402 4.43 6.788 4 7.236 4h9.527c.448 0 .834.43.963.857L19.313 9H4.688l1.585-4.143zM7 21H5v-1h2v1zm12 0h-2v-1h2v1zm2.189-3H2.811l-.662-6.607L3 11h18l.852.393L21.189 18z\"></path></svg>"
/***/ },
/* 13 */
/***/ function(module, exports) {
module.exports = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M13 4h-2l-.001 7H9v2h2v2h2v-2h4v-2h-4z\"></path><path d=\"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0m0 22C6.486 22 2 17.514 2 12S6.486 2 12 2s10 4.486 10 10-4.486 10-10 10\"></path></svg>"
/***/ },
/* 14 */
/***/ function(module, exports) {
module.exports = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M0 0h11v2H0zM4 11h3V6h4V4H0v2h4zM15.5 17c1.381 0 2.5-1.116 2.5-2.493s-1.119-2.493-2.5-2.493S13 13.13 13 14.507 14.119 17 15.5 17m0-2.986c.276 0 .5.222.5.493 0 .272-.224.493-.5.493s-.5-.221-.5-.493.224-.493.5-.493M21.5 19.014c-1.381 0-2.5 1.116-2.5 2.493S20.119 24 21.5 24s2.5-1.116 2.5-2.493-1.119-2.493-2.5-2.493m0 2.986a.497.497 0 0 1-.5-.493c0-.271.224-.493.5-.493s.5.222.5.493a.497.497 0 0 1-.5.493M22 13l-9 9 1.513 1.5 8.99-9.009zM17 11c2.209 0 4-1.119 4-2.5V2s.985-.161 1.498.949C23.01 4.055 23 6 23 6s1-1.119 1-3.135C24-.02 21 0 21 0h-2v6.347A5.853 5.853 0 0 0 17 6c-2.209 0-4 1.119-4 2.5s1.791 2.5 4 2.5M10.297 20.482l-1.475-1.585a47.54 47.54 0 0 1-1.442 1.129c-.307-.288-.989-1.016-2.045-2.183.902-.836 1.479-1.466 1.729-1.892s.376-.871.376-1.336c0-.592-.273-1.178-.818-1.759-.546-.581-1.329-.871-2.349-.871-1.008 0-1.79.293-2.344.879-.556.587-.832 1.181-.832 1.784 0 .813.419 1.748 1.256 2.805-.847.614-1.444 1.208-1.794 1.784a3.465 3.465 0 0 0-.523 1.833c0 .857.308 1.56.924 2.107.616.549 1.423.823 2.42.823 1.173 0 2.444-.379 3.813-1.137L8.235 24h2.819l-2.09-2.383 1.333-1.135zm-6.736-6.389a1.02 1.02 0 0 1 .73-.286c.31 0 .559.085.747.254a.849.849 0 0 1 .283.659c0 .518-.419 1.112-1.257 1.784-.536-.651-.805-1.231-.805-1.742a.901.901 0 0 1 .302-.669M3.74 22c-.427 0-.778-.116-1.057-.349-.279-.232-.418-.487-.418-.766 0-.594.509-1.288 1.527-2.083.968 1.134 1.717 1.946 2.248 2.438-.921.507-1.686.76-2.3.76\"></path></svg>"
/***/ },
/* 15 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Object.defineProperty(exports, "__esModule", {
value: true
});
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
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; };
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _react = __webpack_require__(3);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _react2 = _interopRequireDefault(_react);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _frequently = __webpack_require__(16);
var _frequently2 = _interopRequireDefault(_frequently);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _ = __webpack_require__(1);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2016-07-11 19:04:58 +00:00
2016-07-11 18:22:39 +00:00
var LABELS = {
'Search': 'Search Results',
'Recent': 'Frequently Used',
'People': 'Smileys & People',
'Nature': 'Animals & Nature',
'Foods': 'Food & Drink',
'Activity': 'Activity',
'Places': 'Travel & Places',
'Objects': 'Objects',
'Symbols': 'Symbols',
'Flags': 'Flags'
};
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var Category = function (_React$Component) {
_inherits(Category, _React$Component);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
function Category() {
_classCallCheck(this, Category);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
return _possibleConstructorReturn(this, Object.getPrototypeOf(Category).apply(this, arguments));
}
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
_createClass(Category, [{
key: 'componentDidMount',
value: function componentDidMount() {
this.container = this.refs.container;
this.label = this.refs.label;
this.parent = this.container.parentNode;
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
this.margin = 0;
this.minMargin = 0;
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
this.memoizeSize();
}
}, {
2016-07-11 18:22:39 +00:00
key: 'shouldComponentUpdate',
value: function shouldComponentUpdate(nextProps, nextState) {
var _props = this.props;
var name = _props.name;
var perLine = _props.perLine;
var emojis = _props.emojis;
var emojiProps = _props.emojiProps;
var skin = emojiProps.skin;
var size = emojiProps.size;
var sheetURL = emojiProps.sheetURL;
var nextPerLine = nextProps.perLine;
var nextEmojis = nextProps.emojis;
var nextEmojiProps = nextProps.emojiProps;
var nextSkin = nextEmojiProps.skin;
var nextSize = nextEmojiProps.size;
var nextSheetURL = nextEmojiProps.sheetURL;
var shouldUpdate = false;
2016-07-11 19:04:58 +00:00
2016-07-11 18:22:39 +00:00
if (name == 'Recent' && perLine != nextPerLine) {
shouldUpdate = true;
}
2016-07-11 19:04:58 +00:00
2016-07-11 18:22:39 +00:00
if (name == 'Search') {
shouldUpdate = !(emojis == nextEmojis);
}
2016-07-11 19:04:58 +00:00
2016-07-11 18:22:39 +00:00
if (skin != nextSkin || size != nextSize || sheetURL != nextSheetURL) {
shouldUpdate = true;
}
2016-07-11 19:04:58 +00:00
2016-07-11 18:22:39 +00:00
return shouldUpdate;
2016-07-06 14:32:52 +00:00
}
}, {
key: 'memoizeSize',
value: function memoizeSize() {
var _container$getBoundin = this.container.getBoundingClientRect();
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var top = _container$getBoundin.top;
var height = _container$getBoundin.height;
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _parent$getBoundingCl = this.parent.getBoundingClientRect();
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var parentTop = _parent$getBoundingCl.top;
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _label$getBoundingCli = this.label.getBoundingClientRect();
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var labelHeight = _label$getBoundingCli.height;
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
this.top = top - parentTop + this.parent.scrollTop;
2016-07-11 19:04:58 +00:00
2016-07-11 18:22:39 +00:00
if (height == 0) {
this.maxMargin = 0;
2016-07-06 14:32:52 +00:00
} else {
2016-07-11 18:22:39 +00:00
this.maxMargin = height - labelHeight;
2016-07-06 14:32:52 +00:00
}
}
}, {
key: 'handleScroll',
value: function handleScroll(scrollTop) {
var margin = scrollTop - this.top;
margin = margin < this.minMargin ? this.minMargin : margin;
margin = margin > this.maxMargin ? this.maxMargin : margin;
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
if (margin == this.margin) return;
var name = this.props.name;
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
if (!this.props.hasStickyPosition) {
this.label.style.top = margin + 'px';
}
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
this.margin = margin;
return true;
}
2016-07-11 18:22:39 +00:00
}, {
key: 'getEmojis',
value: function getEmojis() {
var _props2 = this.props;
var name = _props2.name;
var emojis = _props2.emojis;
var perLine = _props2.perLine;
2016-07-11 19:04:58 +00:00
2016-07-11 18:22:39 +00:00
if (name == 'Recent') {
2016-07-20 18:51:41 +00:00
var frequentlyUsed = _frequently2.default.get(perLine * 4);
2016-07-11 19:04:58 +00:00
2016-07-11 18:22:39 +00:00
if (frequentlyUsed.length) {
emojis = frequentlyUsed;
}
}
2016-07-11 19:04:58 +00:00
2016-07-11 18:22:39 +00:00
if (emojis) {
emojis = emojis.slice(0);
}
2016-07-11 19:04:58 +00:00
2016-07-11 18:22:39 +00:00
return emojis;
}
}, {
key: 'updateDisplay',
value: function updateDisplay(display) {
var emojis = this.getEmojis();
2016-07-11 19:04:58 +00:00
2016-07-11 18:22:39 +00:00
if (!display && !emojis) {
return;
}
2016-07-11 19:04:58 +00:00
2016-07-11 18:22:39 +00:00
this.container.style.display = display;
}
2016-07-06 14:32:52 +00:00
}, {
key: 'render',
value: function render() {
2016-07-11 18:22:39 +00:00
var _props3 = this.props;
var name = _props3.name;
var hasStickyPosition = _props3.hasStickyPosition;
var emojiProps = _props3.emojiProps;
var emojis = this.getEmojis();
2016-07-06 14:32:52 +00:00
var labelStyles = {};
var labelSpanStyles = {};
var containerStyles = {};
2016-07-11 19:04:58 +00:00
2016-07-11 18:22:39 +00:00
if (!emojis) {
containerStyles = {
display: 'none'
};
}
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
if (!hasStickyPosition) {
labelStyles = {
height: 28
};
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
labelSpanStyles = {
position: 'absolute'
};
}
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
return _react2.default.createElement(
'div',
{ ref: 'container', className: 'emoji-picker-category', style: containerStyles },
_react2.default.createElement(
'div',
{ style: labelStyles, 'data-name': name, className: 'emoji-picker-category-label' },
_react2.default.createElement(
'span',
{ style: labelSpanStyles, ref: 'label' },
2016-07-11 18:22:39 +00:00
LABELS[name]
2016-07-06 14:32:52 +00:00
)
),
emojis && emojis.map(function (emoji) {
return _react2.default.createElement(_.Emoji, _extends({
2016-07-20 18:51:41 +00:00
key: emoji.id || emoji,
2016-07-06 14:32:52 +00:00
emoji: emoji
}, emojiProps));
}),
emojis && !emojis.length && _react2.default.createElement(
'div',
{ className: 'emoji-picker-no-results' },
_react2.default.createElement(_.Emoji, _extends({}, emojiProps, {
size: 22,
emoji: 'sleuth_or_spy'
})),
_react2.default.createElement(
'span',
{ className: 'emoji-picker-no-results-label' },
'No emoji found'
)
)
);
}
}]);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
return Category;
}(_react2.default.Component);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
exports.default = Category;
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Category.propTypes = {
emojis: _react2.default.PropTypes.array,
hasStickyPosition: _react2.default.PropTypes.bool,
name: _react2.default.PropTypes.string.isRequired,
2016-07-11 18:22:39 +00:00
perLine: _react2.default.PropTypes.number.isRequired,
2016-07-06 14:32:52 +00:00
emojiProps: _react2.default.PropTypes.object.isRequired
};
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Category.defaultProps = {
emojis: [],
hasStickyPosition: true
};
/***/ },
/* 16 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Object.defineProperty(exports, "__esModule", {
value: true
});
2016-07-11 19:04:58 +00:00
2016-07-11 18:22:39 +00:00
var _store = __webpack_require__(17);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _store2 = _interopRequireDefault(_store);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var frequently = _store2.default.get('frequently') || {};
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
function add(emoji) {
var id = emoji.id;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
frequently[id] || (frequently[id] = 0);
frequently[id] += 1;
_store2.default.set('last', id);
_store2.default.set('frequently', frequently);
}
function get(quantity) {
var sorted = Object.keys(frequently).sort(function (a, b) {
return frequently[a] - frequently[b];
}).reverse(),
sliced = sorted.slice(0, quantity),
last = _store2.default.get('last');
if (last && sliced.indexOf(last) == -1) {
sliced.pop();
sliced.push(last);
2016-07-11 18:22:39 +00:00
}
2016-07-20 18:51:41 +00:00
return sliced;
}
exports.default = { add: add, get: get };
2016-07-11 18:22:39 +00:00
/***/ },
/* 17 */
/***/ function(module, exports) {
'use strict';
2016-07-11 19:04:58 +00:00
2016-07-11 18:22:39 +00:00
Object.defineProperty(exports, "__esModule", {
value: true
});
var NAMESPACE = 'emoji-picker';
2016-07-11 19:04:58 +00:00
2016-07-11 18:22:39 +00:00
function update(state) {
for (var key in state) {
var value = state[key];
set(key, value);
}
}
2016-07-11 19:04:58 +00:00
2016-07-11 18:22:39 +00:00
function set(key, value) {
if (!('localStorage' in window)) return;
window.localStorage[NAMESPACE + '.' + key] = JSON.stringify(value);
}
2016-07-11 19:04:58 +00:00
2016-07-11 18:22:39 +00:00
function get(key) {
if (!('localStorage' in window)) return;
2016-07-11 19:04:58 +00:00
2016-07-11 18:22:39 +00:00
var value = window.localStorage[NAMESPACE + '.' + key];
2016-07-11 19:04:58 +00:00
2016-07-11 18:22:39 +00:00
if (value) {
return JSON.parse(value);
}
}
2016-07-11 19:04:58 +00:00
2016-07-11 18:22:39 +00:00
exports.default = { update: update, set: set, get: get };
/***/ },
/* 18 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
2016-07-11 19:04:58 +00:00
2016-07-11 18:22:39 +00:00
Object.defineProperty(exports, "__esModule", {
value: true
});
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _react = __webpack_require__(3);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _react2 = _interopRequireDefault(_react);
var _data = __webpack_require__(19);
2016-07-11 19:04:58 +00:00
2016-07-11 18:22:39 +00:00
var _data2 = _interopRequireDefault(_data);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _utils = __webpack_require__(20);
2016-07-11 18:22:39 +00:00
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var SHEET_COLUMNS = 41;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var Emoji = function (_React$Component) {
_inherits(Emoji, _React$Component);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
function Emoji(props) {
_classCallCheck(this, Emoji);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Emoji).call(this, props));
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
_this.hasSkinVariations = !!_this.getData().skin_variations;
return _this;
}
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
_createClass(Emoji, [{
key: 'shouldComponentUpdate',
value: function shouldComponentUpdate(nextProps) {
return this.hasSkinVariations && nextProps.skin != this.props.skin || nextProps.size != this.props.size || nextProps.sheetURL != this.props.sheetURL;
}
}, {
key: 'getPosition',
value: function getPosition() {
var _getData2 = this.getData();
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var sheet_x = _getData2.sheet_x;
var sheet_y = _getData2.sheet_y;
var multiply = 100 / (SHEET_COLUMNS - 1);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
return multiply * sheet_x + '% ' + multiply * sheet_y + '%';
}
}, {
key: 'getData',
value: function getData() {
var _props = this.props;
var emoji = _props.emoji;
var skin = _props.skin;
var sheetURL = _props.sheetURL;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
return (0, _utils.getData)(emoji, skin, sheetURL);
}
}, {
key: 'getSanitizedData',
value: function getSanitizedData() {
var _props2 = this.props;
var emoji = _props2.emoji;
var skin = _props2.skin;
var sheetURL = _props2.sheetURL;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
return (0, _utils.getSanitizedData)(emoji, skin, sheetURL);
}
}, {
key: 'handleClick',
2016-07-22 20:30:55 +00:00
value: function handleClick(e) {
2016-07-20 18:51:41 +00:00
var onClick = this.props.onClick;
var emoji = this.getSanitizedData();
2016-07-11 19:04:58 +00:00
2016-07-22 20:30:55 +00:00
onClick(emoji, e);
2016-07-20 18:51:41 +00:00
}
}, {
key: 'handleOver',
2016-07-22 20:30:55 +00:00
value: function handleOver(e) {
2016-07-20 18:51:41 +00:00
var onOver = this.props.onOver;
var emoji = this.getSanitizedData();
2016-07-22 20:30:55 +00:00
onOver(emoji, e);
2016-07-20 18:51:41 +00:00
}
}, {
key: 'handleLeave',
2016-07-22 20:30:55 +00:00
value: function handleLeave(e) {
2016-07-20 18:51:41 +00:00
var onLeave = this.props.onLeave;
var emoji = this.getSanitizedData();
2016-07-22 20:30:55 +00:00
onLeave(emoji, e);
2016-07-20 18:51:41 +00:00
}
}, {
key: 'render',
value: function render() {
var _props3 = this.props;
var sheetURL = _props3.sheetURL;
var size = _props3.size;
var onOver = _props3.onOver;
var onLeave = _props3.onLeave;
return _react2.default.createElement(
'span',
{
onClick: this.handleClick.bind(this),
onMouseEnter: this.handleOver.bind(this),
onMouseLeave: this.handleLeave.bind(this),
className: 'emoji-picker-emoji' },
_react2.default.createElement('span', { style: {
width: size,
height: size,
display: 'inline-block',
backgroundImage: 'url(' + sheetURL + ')',
backgroundSize: 100 * SHEET_COLUMNS + '%',
backgroundPosition: this.getPosition()
} })
);
}
}]);
return Emoji;
}(_react2.default.Component);
exports.default = Emoji;
Emoji.propTypes = {
skin: _react2.default.PropTypes.number,
onOver: _react2.default.PropTypes.func,
onLeave: _react2.default.PropTypes.func,
onClick: _react2.default.PropTypes.func,
size: _react2.default.PropTypes.number.isRequired,
sheetURL: _react2.default.PropTypes.string.isRequired,
emoji: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.object]).isRequired
};
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
Emoji.defaultProps = {
skin: 1,
onOver: function onOver() {},
onLeave: function onLeave() {},
onClick: function onClick() {}
};
2016-07-06 14:32:52 +00:00
/***/ },
2016-07-11 18:22:39 +00:00
/* 19 */
2016-07-20 18:51:41 +00:00
/***/ function(module, exports) {
2016-07-26 19:39:50 +00:00
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default={"categories":[{"name":"People","emojis":["grinning","grimacing","grin","joy","smiley","smile","sweat_smile","laughing","innocent","wink","blush","slightly_smiling_face","upside_down_face","relaxed","yum","relieved","heart_eyes","kissing_heart","kissing","kissing_smiling_eyes","kissing_closed_eyes","stuck_out_tongue_winking_eye","stuck_out_tongue_closed_eyes","stuck_out_tongue","money_mouth_face","nerd_face","sunglasses","hugging_face","smirk","no_mouth","neutral_face","expressionless","unamused","face_with_rolling_eyes","thinking_face","flushed","disappointed","worried","angry","rage","pensive","confused","slightly_frowning_face","white_frowning_face","persevere","confounded","tired_face","weary","triumph","open_mouth","scream","fearful","cold_sweat","hushed","frowning","anguished","cry","disappointed_relieved","sleepy","sweat","sob","dizzy_face","astonished","zipper_mouth_face","mask","face_with_thermometer","face_with_head_bandage","sleeping","zzz","hankey","smiling_imp","imp","japanese_ogre","japanese_goblin","skull","ghost","alien","robot_face","smiley_cat","smile_cat","joy_cat","heart_eyes_cat","smirk_cat","kissing_cat","scream_cat","crying_cat_face","pouting_cat","raised_hands","clap","wave","+1","-1","facepunch","fist","v","ok_hand","hand","open_hands","muscle","pray","point_up","point_up_2","point_down","point_left","point_right","middle_finger","raised_hand_with_fingers_splayed","the_horns","spock-hand","writing_hand","nail_care","lips","tongue","ear","nose","eye","eyes","bust_in_silhouette","busts_in_silhouette","speaking_head_in_silhouette","baby","boy","girl","man","woman","person_with_blond_hair","older_man","older_woman","man_with_gua_pi_mao","man_with_turban","cop","construction_worker","guardsman","sleuth_or_spy","santa","angel","princess","bride_with_veil","walking","runner","dancer","dancers","couple","two_men_holding_hands","two_women_holding_hands","bow","information_desk_person","no_good","ok_woman","raising_hand","person_with_pouting_face","person_frowning","haircut","massage","couple_with_heart","woman-heart-woman","man-heart-man","couplekiss","woman-kiss-woman","man-kiss-man","family","man-woman-girl","man-woman-girl-boy","man-woman-boy-boy","man-woman-girl-girl","woman-woman-boy","woman-woman-girl","woman-woman-girl-boy","woman-woman-boy-boy","woman-woman-girl-girl","man-man-boy","man-man-girl","man-man-girl-boy","man-man-boy-boy","man-man-girl-girl","womans_clothes","shirt","jeans","necktie","dress","bikini","kimono","lipstick","kiss","footprints","high_heel","sandal","boot","mans_shoe","athletic_shoe","womans_hat","tophat","helmet_with_white_cross","mortar_board","crown","school_satchel","pouch","purse","handbag","briefcase","eyeglasses","dark_sunglasses","ring","closed_umbrella"]},{"name":"Nature","emojis":["dog","cat","mouse","hamster","rabbit","bear","panda_face","koala","tiger","lion_face","cow","pig","pig_nose","frog","octopus","monkey_face","see_no_evil","hear_no_evil","speak_no_evil","monkey","chicken","penguin","bird","baby_chick","hatching_chick","hatched_chick","wolf","boar","horse","unicorn_face","bee","bug","snail","beetle","ant","spider","scorpion","crab","snake","turtle","tropical_fish","fish","blowfish","dolphin","whale","whale2","crocodile","leopard","tiger2","water_buffalo","ox","cow2","dromedary_camel","camel","elephant","goat","ram","sheep","racehorse","pig2","rat","mouse2","rooster","turkey","dove_of_peace","dog2","poodle","cat2","rabbit2","chipmunk","feet","dragon","dragon_face","cactus","christmas_tree","evergreen_tree","deciduous_tree","palm_tree","seedling","herb","shamrock","four_leaf_clover","bamboo","tanabata_tree","leaves","fallen_leaf","maple_leaf","ear_of_rice","hibiscus","sunflower","rose","tulip","blossom","cherry_blossom","bouquet","mushroom","chestnut","jack_o_lantern","shell","spider_web","earth_americas","earth_africa","earth_asia","full_moon","waning_gibbous_moon","last_quarter_moon","waning_crescent_moon","new_moon","waxing_crescent_moon","first_quarter_moon","moon","ne
2016-07-20 18:51:41 +00:00
/***/ },
/* 20 */
2016-07-11 18:22:39 +00:00
/***/ function(module, exports, __webpack_require__) {
2016-07-06 14:32:52 +00:00
2016-07-20 18:51:41 +00:00
'use strict';
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
Object.defineProperty(exports, "__esModule", {
value: true
});
2016-07-22 20:30:55 +00:00
exports.intersect = exports.getSanitizedData = exports.getData = undefined;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _data = __webpack_require__(19);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _data2 = _interopRequireDefault(_data);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var SKINS = ['1F3FA', '1F3FB', '1F3FC', '1F3FD', '1F3FE', '1F3FF'];
function unifiedToNative(unified) {
var unicodes = unified.split('-'),
codePoints = unicodes.map(function (u) {
return '0x' + u;
});
return String.fromCodePoint.apply(String, _toConsumableArray(codePoints));
2016-07-11 18:22:39 +00:00
}
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
function sanitize(emoji) {
var name = emoji.name;
var short_names = emoji.short_names;
var skin_tone = emoji.skin_tone;
var skin_variations = emoji.skin_variations;
var emoticons = emoji.emoticons;
var unified = emoji.unified;
var id = short_names[0];
var colons = ':' + id + ':';
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
if (skin_tone) {
colons += ':skin-tone-' + skin_tone + ':';
}
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
return {
id: id,
name: name,
colons: colons,
emoticons: emoticons,
skin: skin_tone || skin_variations ? 1 : null,
native: unifiedToNative(unified)
};
2016-07-11 18:22:39 +00:00
}
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
function getSanitizedData() {
return sanitize(getData.apply(undefined, arguments));
2016-07-11 18:22:39 +00:00
}
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
function getData(emoji, skin, sheetURL) {
var emojiData = {};
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
if (typeof emoji == 'string') {
emojiData = _data2.default.emojis[emoji];
} else if (emoji.id) {
emojiData = _data2.default.emojis[emoji.id];
skin || (skin = emoji.skin);
}
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
if (emojiData.skin_variations && skin > 1 && sheetURL) {
emojiData = JSON.parse(JSON.stringify(emojiData));
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var skinKey = SKINS[skin - 1],
variationKey = emojiData.unified + '-' + skinKey,
variationData = emojiData.skin_variations[variationKey],
kitMatches = sheetURL.match(/(apple|google|twitter|emojione)/),
kit = kitMatches[0];
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
if (variationData['has_img_' + kit]) {
emojiData.skin_tone = skin;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
for (var k in variationData) {
var v = variationData[k];
emojiData[k] = v;
}
}
}
return emojiData;
2016-07-11 18:22:39 +00:00
}
2016-07-11 19:04:58 +00:00
2016-07-22 20:30:55 +00:00
function intersect(a, b) {
var aSet = new Set(a),
bSet = new Set(b),
intersection = null;
intersection = new Set([].concat(_toConsumableArray(aSet)).filter(function (x) {
return bSet.has(x);
}));
return Array.from(intersection);
}
2016-07-20 18:51:41 +00:00
exports.getData = getData;
exports.getSanitizedData = getSanitizedData;
2016-07-22 20:30:55 +00:00
exports.intersect = intersect;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
/***/ },
/* 21 */
/***/ function(module, exports, __webpack_require__) {
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
'use strict';
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
Object.defineProperty(exports, "__esModule", {
value: true
});
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
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; };
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
__webpack_require__(22);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _react = __webpack_require__(3);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _react2 = _interopRequireDefault(_react);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _data = __webpack_require__(19);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _data2 = _interopRequireDefault(_data);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _store = __webpack_require__(17);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _store2 = _interopRequireDefault(_store);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _frequently = __webpack_require__(16);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _frequently2 = _interopRequireDefault(_frequently);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _ = __webpack_require__(1);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var RECENT_CATEGORY = { name: 'Recent', emojis: null };
var SEARCH_CATEGORY = { name: 'Search', emojis: null, anchor: RECENT_CATEGORY };
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var CATEGORIES = [SEARCH_CATEGORY, RECENT_CATEGORY].concat(_data2.default.categories);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var Picker = function (_React$Component) {
_inherits(Picker, _React$Component);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
function Picker(props) {
_classCallCheck(this, Picker);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Picker).call(this, props));
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
_this.testStickyPosition();
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
_this.state = {
skin: _store2.default.get('skin') || props.skin,
firstRender: true
};
return _this;
}
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
_createClass(Picker, [{
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(props) {
if (props.skin && !_store2.default.get('skin')) {
this.setState({ skin: props.skin });
}
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
var _this2 = this;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
if (this.state.firstRender) {
this.firstRenderTimeout = setTimeout(function () {
_this2.setState({ firstRender: false });
}, 60);
}
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate() {
this.updateCategoriesSize();
this.handleScroll();
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
SEARCH_CATEGORY.emojis = null;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
clearTimeout(this.leaveTimeout);
clearTimeout(this.firstRenderTimeout);
}
}, {
key: 'testStickyPosition',
value: function testStickyPosition() {
var stickyTestElement = document.createElement('div');
var _arr = ['', '-webkit-', '-ms-', '-moz-', '-o-'];
for (var _i = 0; _i < _arr.length; _i++) {
var prefix = _arr[_i];
stickyTestElement.style.position = prefix + 'sticky';
}
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
this.hasStickyPosition = !!stickyTestElement.style.position.length;
}
}, {
key: 'handleEmojiOver',
value: function handleEmojiOver(emoji) {
var preview = this.refs.preview;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
preview.setState({ emoji: emoji });
clearTimeout(this.leaveTimeout);
}
}, {
key: 'handleEmojiLeave',
value: function handleEmojiLeave(emoji) {
var _this3 = this;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
this.leaveTimeout = setTimeout(function () {
var preview = _this3.refs.preview;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
preview.setState({ emoji: null });
}, 16);
}
}, {
key: 'handleEmojiClick',
2016-07-22 20:30:55 +00:00
value: function handleEmojiClick(emoji, e) {
2016-07-20 18:51:41 +00:00
var _this4 = this;
2016-07-11 19:04:58 +00:00
2016-07-22 20:30:55 +00:00
this.props.onClick(emoji, e);
2016-07-20 18:51:41 +00:00
_frequently2.default.add(emoji);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var component = this.refs['category-1'];
if (component) {
(function () {
var maxMargin = component.maxMargin;
component.forceUpdate();
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
window.requestAnimationFrame(function () {
component.memoizeSize();
if (maxMargin == component.maxMargin) return;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
_this4.updateCategoriesSize();
_this4.handleScrollPaint();
});
})();
}
}
}, {
key: 'handleScroll',
value: function handleScroll() {
if (!this.waitingForPaint) {
this.waitingForPaint = true;
window.requestAnimationFrame(this.handleScrollPaint.bind(this));
}
}
}, {
key: 'handleScrollPaint',
value: function handleScrollPaint() {
this.waitingForPaint = false;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
if (!this.refs.scroll) {
return;
}
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var target = this.refs.scroll,
scrollTop = target.scrollTop,
scrollingDown = scrollTop > (this.scrollTop || 0),
activeCategory = null,
minTop = 0;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
for (var i = 0, l = CATEGORIES.length; i < l; i++) {
var ii = scrollingDown ? CATEGORIES.length - 1 - i : i,
category = CATEGORIES[ii],
component = this.refs['category-' + ii];
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
if (component) {
var active = component.handleScroll(scrollTop);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
if (!minTop || component.top < minTop) {
if (component.top > 0) {
minTop = component.top;
}
}
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
if (active && !activeCategory) {
if (category.anchor) category = category.anchor;
activeCategory = category;
}
}
}
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
if (scrollTop < minTop) {
activeCategory = RECENT_CATEGORY;
}
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
if (activeCategory) {
var anchors = this.refs.anchors;
var _activeCategory = activeCategory;
var categoryName = _activeCategory.name;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
if (anchors.state.selected != categoryName) {
anchors.setState({ selected: categoryName });
}
}
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
this.scrollTop = scrollTop;
2016-07-06 14:32:52 +00:00
}
2016-07-20 18:51:41 +00:00
}, {
key: 'handleSearch',
value: function handleSearch(emojis) {
SEARCH_CATEGORY.emojis = emojis;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
for (var i = 0, l = CATEGORIES.length; i < l; i++) {
var component = this.refs['category-' + i];
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
if (component && component.props.name != 'Search') {
var display = emojis ? 'none' : null;
component.updateDisplay(display);
}
}
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
this.forceUpdate();
2016-07-11 18:22:39 +00:00
}
2016-07-20 18:51:41 +00:00
}, {
key: 'handleAnchorClick',
value: function handleAnchorClick(category, i) {
var component = this.refs['category-' + i];
var _refs = this.refs;
var scroll = _refs.scroll;
var anchors = _refs.anchors;
var scrollToComponent = null;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
scrollToComponent = function scrollToComponent() {
if (component) {
var top = component.top;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
if (category.name == 'Recent') {
top = 0;
} else {
top += 1;
}
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
scroll.scrollTop = top;
}
};
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
if (SEARCH_CATEGORY.emojis) {
this.handleSearch(null);
this.refs.search.clear();
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
window.requestAnimationFrame(scrollToComponent);
} else {
scrollToComponent();
}
}
}, {
key: 'handleSkinChange',
value: function handleSkinChange(skin) {
var newState = { skin: skin };
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
this.setState(newState);
_store2.default.update(newState);
}
}, {
key: 'updateCategoriesSize',
value: function updateCategoriesSize() {
for (var i = 0, l = CATEGORIES.length; i < l; i++) {
var component = this.refs['category-' + i];
if (component) component.memoizeSize();
}
}
}, {
key: 'getCategories',
value: function getCategories() {
var categories = CATEGORIES;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
return this.state.firstRender ? categories.slice(0, 3) : categories;
}
}, {
key: 'render',
value: function render() {
var _this5 = this;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _props = this.props;
var perLine = _props.perLine;
var emojiSize = _props.emojiSize;
var sheetURL = _props.sheetURL;
var style = _props.style;
var title = _props.title;
var emoji = _props.emoji;
2016-07-22 20:30:55 +00:00
var color = _props.color;
2016-07-20 18:51:41 +00:00
var skin = this.state.skin;
var width = perLine * (emojiSize + 12) + 12 + 2;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
return _react2.default.createElement(
'div',
{ style: _extends({}, style, { width: width }), className: 'emoji-picker' },
_react2.default.createElement(
'div',
{ className: 'emoji-picker-bar' },
_react2.default.createElement(_.Anchors, {
ref: 'anchors',
2016-07-22 20:30:55 +00:00
color: color,
2016-07-20 18:51:41 +00:00
categories: CATEGORIES,
onAnchorClick: this.handleAnchorClick.bind(this)
})
),
_react2.default.createElement(
'div',
{ ref: 'scroll', className: 'emoji-picker-scroll', onScroll: this.handleScroll.bind(this) },
_react2.default.createElement(_.Search, {
ref: 'search',
onSearch: this.handleSearch.bind(this)
}),
this.getCategories().map(function (category, i) {
return _react2.default.createElement(_.Category, {
ref: 'category-' + i,
key: category.name,
name: category.name,
emojis: category.emojis,
perLine: perLine,
hasStickyPosition: _this5.hasStickyPosition,
emojiProps: {
skin: skin,
size: emojiSize,
sheetURL: sheetURL,
onOver: _this5.handleEmojiOver.bind(_this5),
onLeave: _this5.handleEmojiLeave.bind(_this5),
onClick: _this5.handleEmojiClick.bind(_this5)
}
});
})
),
_react2.default.createElement(
'div',
{ className: 'emoji-picker-bar' },
_react2.default.createElement(_.Preview, {
ref: 'preview',
title: title,
emoji: emoji,
emojiProps: {
size: 38,
skin: skin,
sheetURL: sheetURL
},
skinsProps: {
skin: skin,
onChange: this.handleSkinChange.bind(this)
}
})
)
);
}
}]);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
return Picker;
}(_react2.default.Component);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
exports.default = Picker;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
Picker.propTypes = {
onClick: _react2.default.PropTypes.func,
skin: _react2.default.PropTypes.number,
perLine: _react2.default.PropTypes.number,
emojiSize: _react2.default.PropTypes.number,
style: _react2.default.PropTypes.object,
title: _react2.default.PropTypes.string,
emoji: _react2.default.PropTypes.string,
2016-07-22 20:30:55 +00:00
color: _react2.default.PropTypes.string,
2016-07-20 18:51:41 +00:00
sheetURL: _react2.default.PropTypes.string.isRequired
};
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
Picker.defaultProps = {
onClick: function onClick() {},
emojiSize: 24,
perLine: 9,
style: {},
skin: 1,
title: 'EmojiPicker',
2016-07-22 20:30:55 +00:00
emoji: 'tophat',
color: '#ae65c5'
2016-07-20 18:51:41 +00:00
};
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
/***/ },
/* 22 */
/***/ function(module, exports) {
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
'use strict';
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
// MIT license
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
(function () {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame'];
}
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
if (!window.requestAnimationFrame) window.requestAnimationFrame = function (callback, element) {
var currTime = new Date().getTime();
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
var id = window.setTimeout(function () {
callback(currTime + timeToCall);
}, timeToCall);
lastTime = currTime + timeToCall;
return id;
};
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
if (!window.cancelAnimationFrame) window.cancelAnimationFrame = function (id) {
clearTimeout(id);
};
})();
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
/***/ },
/* 23 */
/***/ function(module, exports, __webpack_require__) {
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
'use strict';
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
Object.defineProperty(exports, "__esModule", {
value: true
});
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
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; };
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _react = __webpack_require__(3);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _react2 = _interopRequireDefault(_react);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _ = __webpack_require__(1);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _utils = __webpack_require__(20);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Preview = function (_React$Component) {
_inherits(Preview, _React$Component);
function Preview(props) {
_classCallCheck(this, Preview);
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Preview).call(this, props));
_this.state = { emoji: null };
return _this;
2016-07-06 14:32:52 +00:00
}
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
_createClass(Preview, [{
key: 'render',
value: function render() {
var emoji = this.state.emoji;
var _props = this.props;
var emojiProps = _props.emojiProps;
var skinsProps = _props.skinsProps;
var title = _props.title;
var idleEmoji = _props.emoji;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
if (emoji) {
var emojiData = (0, _utils.getData)(emoji);
var emoticons = emojiData.emoticons;
var knownEmoticons = [];
var listedEmoticons = [];
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
try {
for (var _iterator = emoticons[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var emoticon = _step.value;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
if (knownEmoticons.indexOf(emoticon.toLowerCase()) == -1) {
knownEmoticons.push(emoticon.toLowerCase());
listedEmoticons.push(emoticon);
}
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
return _react2.default.createElement(
'div',
{ className: 'emoji-picker-preview' },
_react2.default.createElement(
'div',
{ className: 'emoji-picker-preview-emoji' },
_react2.default.createElement(_.Emoji, _extends({
key: emoji.id,
emoji: emoji
}, emojiProps))
),
_react2.default.createElement(
'div',
{ className: 'emoji-picker-preview-data' },
_react2.default.createElement(
'div',
{ className: 'emoji-picker-preview-name' },
emoji.name
),
_react2.default.createElement(
'div',
{ className: 'emoji-picker-preview-shortnames' },
emojiData.short_names.map(function (short_name) {
return _react2.default.createElement(
'span',
{ key: short_name, className: 'emoji-picker-preview-shortname' },
':',
short_name,
':'
);
})
),
_react2.default.createElement(
'div',
{ className: 'emoji-picker-preview-emoticons' },
listedEmoticons.map(function (emoticon) {
return _react2.default.createElement(
'span',
{ key: emoticon, className: 'emoji-picker-preview-emoticon' },
emoticon
);
})
)
)
);
} else {
return _react2.default.createElement(
'div',
{ className: 'emoji-picker-preview' },
_react2.default.createElement(
'div',
{ className: 'emoji-picker-preview-emoji' },
_react2.default.createElement(_.Emoji, _extends({
emoji: idleEmoji
}, emojiProps))
),
_react2.default.createElement(
'div',
{ className: 'emoji-picker-preview-data' },
_react2.default.createElement(
'span',
{ className: 'emoji-picker-title-label' },
title
)
),
_react2.default.createElement(
'div',
{ className: 'emoji-picker-preview-skins' },
_react2.default.createElement(_.Skins, skinsProps)
)
);
}
}
}]);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
return Preview;
}(_react2.default.Component);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
exports.default = Preview;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
Preview.propTypes = {
title: _react2.default.PropTypes.string.isRequired,
emoji: _react2.default.PropTypes.string.isRequired,
emojiProps: _react2.default.PropTypes.object.isRequired,
skinsProps: _react2.default.PropTypes.object.isRequired
};
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
/***/ },
/* 24 */
/***/ function(module, exports, __webpack_require__) {
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
'use strict';
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
Object.defineProperty(exports, "__esModule", {
value: true
});
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _react = __webpack_require__(3);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _react2 = _interopRequireDefault(_react);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _emojiIndex = __webpack_require__(25);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _emojiIndex2 = _interopRequireDefault(_emojiIndex);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var Search = function (_React$Component) {
_inherits(Search, _React$Component);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
function Search() {
_classCallCheck(this, Search);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
return _possibleConstructorReturn(this, Object.getPrototypeOf(Search).apply(this, arguments));
}
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
_createClass(Search, [{
key: 'handleChange',
value: function handleChange() {
var input = this.refs.input;
var value = input.value;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
this.props.onSearch(_emojiIndex2.default.search(value));
}
}, {
key: 'clear',
value: function clear() {
this.refs.input.value = '';
}
}, {
key: 'render',
value: function render() {
return _react2.default.createElement('input', {
ref: 'input',
type: 'text',
onChange: this.handleChange.bind(this),
placeholder: 'Search',
className: 'emoji-picker-search'
});
2016-07-11 18:22:39 +00:00
}
2016-07-20 18:51:41 +00:00
}]);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
return Search;
}(_react2.default.Component);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
exports.default = Search;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
Search.propTypes = {
onSearch: _react2.default.PropTypes.func,
maxResults: _react2.default.PropTypes.number
};
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
Search.defaultProps = {
onSearch: function onSearch() {},
maxResults: 75
};
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
/***/ },
/* 25 */
/***/ function(module, exports, __webpack_require__) {
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
'use strict';
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
Object.defineProperty(exports, "__esModule", {
value: true
});
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _data = __webpack_require__(19);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _data2 = _interopRequireDefault(_data);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var _ = __webpack_require__(20);
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2016-07-11 19:04:58 +00:00
2016-07-22 20:30:55 +00:00
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var index = {};
2016-07-20 18:51:41 +00:00
var emojisList = {};
var emoticonsList = {};
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
for (var emoji in _data2.default.emojis) {
var emojiData = _data2.default.emojis[emoji];
2016-07-22 20:30:55 +00:00
var short_names = emojiData.short_names;
2016-07-20 18:51:41 +00:00
var emoticons = emojiData.emoticons;
2016-07-22 20:30:55 +00:00
var id = short_names[0];
2016-07-20 18:51:41 +00:00
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
try {
for (var _iterator = emoticons[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var emoticon = _step.value;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
if (!emoticonsList[emoticon]) {
2016-07-22 20:30:55 +00:00
emoticonsList[emoticon] = id;
2016-07-20 18:51:41 +00:00
}
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
2016-07-11 19:04:58 +00:00
2016-07-22 20:30:55 +00:00
emojisList[id] = (0, _.getSanitizedData)(id);
2016-07-20 18:51:41 +00:00
}
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
function search(value) {
var maxResults = arguments.length <= 1 || arguments[1] === undefined ? 75 : arguments[1];
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
var results = null;
2016-07-11 19:04:58 +00:00
2016-07-20 18:51:41 +00:00
if (value.length) {
2016-07-22 20:30:55 +00:00
var values = value.toLowerCase().split(/[\s|,]+/),
allResults = [];
2016-07-11 18:22:39 +00:00
2016-07-22 20:30:55 +00:00
if (values.length > 2) {
values = [values[0], values[1]];
2016-07-20 18:51:41 +00:00
}
2016-07-11 18:22:39 +00:00
2016-07-22 20:30:55 +00:00
allResults = values.map(function (value) {
var aPool = _data2.default.emojis,
aIndex = index,
length = 0;
2016-07-11 19:04:58 +00:00
2016-07-22 20:30:55 +00:00
if (value == '-') {
return [emojisList['-1']];
2016-07-20 18:51:41 +00:00
}
2016-07-11 19:04:58 +00:00
2016-07-22 20:30:55 +00:00
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
2016-07-11 19:04:58 +00:00
2016-07-22 20:30:55 +00:00
try {
for (var _iterator2 = value.split('')[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var char = _step2.value;
2016-07-11 19:04:58 +00:00
2016-07-22 20:30:55 +00:00
length++;
2016-07-11 19:04:58 +00:00
2016-07-22 20:30:55 +00:00
aIndex[char] || (aIndex[char] = {});
aIndex = aIndex[char];
2016-07-11 19:04:58 +00:00
2016-07-22 20:30:55 +00:00
if (!aIndex.results) {
2016-07-26 19:39:50 +00:00
(function () {
var scores = {};
aIndex.results = [];
aIndex.pool = {};
2016-07-11 19:04:58 +00:00
2016-07-26 19:39:50 +00:00
for (var id in aPool) {
var _emoji = aPool[id];
var _search = _emoji.search;
var sub = value.substr(0, length);
var subIndex = _search.indexOf(sub);
2016-07-11 19:04:58 +00:00
2016-07-26 19:39:50 +00:00
if (subIndex != -1) {
var score = subIndex + 1;
if (sub == id) score = 0;
2016-07-11 19:04:58 +00:00
2016-07-26 19:39:50 +00:00
aIndex.results.push(emojisList[id]);
aIndex.pool[id] = _emoji;
scores[id] = score;
}
2016-07-22 20:30:55 +00:00
}
2016-07-26 19:39:50 +00:00
aIndex.results.sort(function (a, b) {
var aScore = scores[a.id],
bScore = scores[b.id];
return aScore - bScore;
});
})();
2016-07-22 20:30:55 +00:00
}
2016-07-11 19:04:58 +00:00
2016-07-22 20:30:55 +00:00
aPool = aIndex.pool;
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2.return) {
_iterator2.return();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
2016-07-11 18:22:39 +00:00
}
2016-07-20 18:51:41 +00:00
}
2016-07-11 19:04:58 +00:00
2016-07-22 20:30:55 +00:00
return aIndex.results;
}).filter(function (a) {
return a;
});
2016-07-11 19:04:58 +00:00
2016-07-22 20:30:55 +00:00
if (allResults.length > 1) {
results = _.intersect.apply(undefined, _toConsumableArray(allResults));
} else if (allResults.length) {
results = allResults[0];
} else {
results = [];
2016-07-11 18:22:39 +00:00
}
2016-07-20 18:51:41 +00:00
}
2016-07-11 19:04:58 +00:00
2016-07-26 19:39:50 +00:00
if (results && results.length) {
2016-07-22 20:30:55 +00:00
results = results.slice(0, maxResults);
2016-07-06 14:32:52 +00:00
}
2016-07-11 19:04:58 +00:00
2016-07-22 20:30:55 +00:00
return results;
2016-07-20 18:51:41 +00:00
}
2016-07-22 20:30:55 +00:00
exports.default = { search: search, emojis: emojisList, emoticons: emoticonsList };
2016-07-06 14:32:52 +00:00
/***/ },
2016-07-22 20:30:55 +00:00
/* 26 */
2016-07-06 14:32:52 +00:00
/***/ function(module, exports, __webpack_require__) {
'use strict';
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Object.defineProperty(exports, "__esModule", {
value: true
});
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _react = __webpack_require__(3);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _react2 = _interopRequireDefault(_react);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var Skins = function (_React$Component) {
_inherits(Skins, _React$Component);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
function Skins(props) {
_classCallCheck(this, Skins);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Skins).call(this, props));
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
_this.state = {
opened: false
};
return _this;
}
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
_createClass(Skins, [{
key: 'handleClick',
value: function handleClick(skin) {
var onChange = this.props.onChange;
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
if (!this.state.opened) {
this.setState({ opened: true });
} else {
onChange(skin);
this.setState({ opened: false });
}
}
}, {
key: 'render',
value: function render() {
var _this2 = this;
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
var skin = this.props.skin;
var opened = this.state.opened;
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
return _react2.default.createElement(
'div',
null,
_react2.default.createElement(
'div',
{ className: 'emoji-picker-skin-swatches ' + (opened ? 'emoji-picker-skin-swatches-opened' : '') },
Array(6).fill().map(function (_, i) {
var skinTone = i + 1,
selected = skinTone == skin;
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
return _react2.default.createElement(
'span',
{ key: 'skin-tone-' + skinTone, className: 'emoji-picker-skin-swatch ' + (selected ? 'emoji-picker-skin-swatch-selected' : '') },
_react2.default.createElement('span', {
onClick: function onClick() {
return _this2.handleClick(skinTone);
},
className: 'emoji-picker-skin emoji-picker-skin-tone-' + skinTone })
);
})
)
);
}
}]);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
return Skins;
}(_react2.default.Component);
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
exports.default = Skins;
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Skins.propTypes = {
onChange: _react2.default.PropTypes.func,
skin: _react2.default.PropTypes.number.isRequired
};
2016-07-11 19:04:58 +00:00
2016-07-06 14:32:52 +00:00
Skins.defaultProps = {
onChange: function onChange() {}
};
/***/ }
/******/ ])
});
2016-07-11 19:04:58 +00:00
;