Skip to content

Commit

Permalink
Bump 0.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
kuy committed Nov 9, 2016
1 parent 04da280 commit d5cc117
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 52 deletions.
7 changes: 3 additions & 4 deletions lib/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ var place = exports.place = (0, _reduxActions.createAction)(PLACE);
var DELAY = exports.DELAY = prefix('delay');
var DURATION = 1500;
function delay(action) {
var _ref = arguments.length <= 1 || arguments[1] === undefined ? { duration: DURATION } : arguments[1];

var duration = _ref.duration;
var callback = _ref.callback;
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { duration: DURATION },
duration = _ref.duration,
callback = _ref.callback;

if (!action.meta) {
action.meta = {};
Expand Down
6 changes: 3 additions & 3 deletions lib/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ function middleware(store) {
}

// Setup timeout
var _action$meta$DELAY = action.meta[_actions.DELAY];
var duration = _action$meta$DELAY.duration;
var callback = _action$meta$DELAY.callback;
var _action$meta$DELAY = action.meta[_actions.DELAY],
duration = _action$meta$DELAY.duration,
callback = _action$meta$DELAY.callback;

names.forEach(function (name) {
var newToken = setTimeout(function () {
Expand Down
8 changes: 4 additions & 4 deletions lib/origin.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ var Origin = function (_Component) {
}, {
key: 'createWithDelay',
value: function createWithDelay(creator) {
var extras = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var _props = this.props;
var duration = _props.delay;
var callback = _props.onTimeout;
var extras = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var _props = this.props,
duration = _props.delay,
callback = _props.onTimeout;

var action = creator(_extends({}, this.props, extras));
if (duration || callback) {
Expand Down
4 changes: 2 additions & 2 deletions lib/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var handlers = (_handlers = {}, _defineProperty(_handlers, _actions.SHOW, functi
}), _handlers);

function tooltip() {
var state = arguments.length <= 0 || arguments[0] === undefined ? initial : arguments[0];
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initial;
var action = arguments[1];

// Check usage of deprecated props
Expand All @@ -66,7 +66,7 @@ function tooltip() {
}

function reducer() {
var state = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var action = arguments[1];

var newState = _extends({}, state);
Expand Down
32 changes: 19 additions & 13 deletions lib/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.border = exports.arrow = exports.content = exports.base = undefined;

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _themes = require('./themes');

var themes = _interopRequireWildcard(_themes);

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; } }

var theme = themes.simple;

var base = exports.base = {
padding: 0,
fontSize: 0,
Expand Down Expand Up @@ -49,30 +58,27 @@ var border = exports.border = {
display: 'block',
width: 0,
height: 0,
position: 'absolute'
position: 'absolute',
borderStyle: 'solid'
},
top: _extends({
borderLeft: '9px solid transparent !important',
borderRight: '9px solid transparent !important',
borderTop: '9px solid',
borderColor: theme.border.borderColor + ' transparent transparent transparent',
borderWidth: '9px 9px 0px 9px',
bottom: '-7px'
}, vertical),
right: _extends({
borderTop: '9px solid transparent !important',
borderBottom: '9px solid transparent !important',
borderRight: '9px solid',
borderColor: 'transparent ' + theme.border.borderColor + ' transparent transparent',
borderWidth: '9px 9px 9px 0px',
left: '-7px'
}, horizontal),
bottom: _extends({
borderLeft: '9px solid transparent !important',
borderRight: '9px solid transparent !important',
borderBottom: '9px solid',
borderColor: 'transparent transparent ' + theme.border.borderColor + ' transparent',
borderWidth: '0px 9px 9px 9px',
top: '-7px'
}, vertical),
left: _extends({
borderTop: '9px solid transparent !important',
borderBottom: '9px solid transparent !important',
borderLeft: '9px solid',
borderColor: 'transparent transparent transparent ' + theme.border.borderColor,
borderWidth: '9px 0px 9px 9px',
right: '-7px'
}, horizontal)
};
24 changes: 12 additions & 12 deletions lib/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ var Tooltip = function (_Component) {
_createClass(Tooltip, [{
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
var place = nextProps.place;
var content = nextProps.content;
var children = nextProps.children;
var place = nextProps.place,
content = nextProps.content,
children = nextProps.children;

var origin = (0, _utils.originOrEl)(nextProps);
if (origin && ((0, _utils.originOrEl)(this.props) != origin || this.props.place !== place || this.props.content !== content || this.props.children !== children)) {
Expand All @@ -118,7 +118,7 @@ var Tooltip = function (_Component) {
}, {
key: 'children',
value: function children() {
var props = arguments.length <= 0 || arguments[0] === undefined ? this.props : arguments[0];
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props;
var content = props.content;

if (typeof content === 'string') {
Expand All @@ -129,23 +129,23 @@ var Tooltip = function (_Component) {
}, {
key: 'render',
value: function render() {
var _props = this.props;
var show = _props.show;
var onHover = _props.onHover;
var onLeave = _props.onLeave;
var _props = this.props,
show = _props.show,
onHover = _props.onHover,
onLeave = _props.onLeave;

var origin = (0, _utils.originOrEl)(this.props);
var _state = this.state;
var place = _state.place;
var offset = _state.offset;
var _state = this.state,
place = _state.place,
offset = _state.offset;

var content = this.children();
var visibility = origin && show ? 'visible' : 'hidden';
var style = {
base: _extends({}, styles.base, themes.simple.base, { visibility: visibility }, offset),
content: _extends({}, styles.content, themes.simple.content),
arrow: _extends({}, styles.arrow),
border: _extends({}, styles.border.base, styles.border[place], themes.simple.border)
border: _extends({}, themes.simple.border, styles.border.base, styles.border[place])
};
style.shadow = _extends({}, style.content, { visibility: 'hidden', position: 'absolute' });

Expand Down
26 changes: 13 additions & 13 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
value: true
});

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

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; };

Expand Down Expand Up @@ -47,14 +47,14 @@ function dimension(el) {
*/
function position(el) {
var pos = el.getBoundingClientRect();
var _window = window;
var pageYOffset = _window.pageYOffset;
var pageXOffset = _window.pageXOffset;
var _document$documentEle = document.documentElement;
var scrollTop = _document$documentEle.scrollTop;
var clientTop = _document$documentEle.clientTop;
var scrollLeft = _document$documentEle.scrollLeft;
var clientLeft = _document$documentEle.clientLeft;
var _window = window,
pageYOffset = _window.pageYOffset,
pageXOffset = _window.pageXOffset;
var _document$documentEle = document.documentElement,
scrollTop = _document$documentEle.scrollTop,
clientTop = _document$documentEle.clientTop,
scrollLeft = _document$documentEle.scrollLeft,
clientLeft = _document$documentEle.clientLeft;

var winTop = (pageYOffset || scrollTop) - clientTop;
var winLeft = (pageXOffset || scrollLeft) - clientLeft;
Expand Down Expand Up @@ -235,8 +235,8 @@ function overDirs(tip, el) {
* @return {Object} 'offset': style data to locate, 'place': final direction of the tooltip
*/
function adjust(content, props) {
var auto = props.auto;
var within = props.within;
var auto = props.auto,
within = props.within;

var origin = originOrEl(props);
var place = props.place;
Expand Down Expand Up @@ -298,8 +298,8 @@ var actionTypes = Object.keys(actions).map(function (k) {
return typeof e === 'string';
});
function deprecatedWarning(action) {
var type = action.type;
var payload = action.payload;
var type = action.type,
payload = action.payload;

if (actionTypes.indexOf(action.type) === -1) {
return; // Ignore non-related actions
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "redux-tooltip",
"version": "0.6.1",
"version": "0.6.2",
"description": "A tooltip React component for Redux",
"main": "./lib/index.js",
"repository": {
Expand Down

0 comments on commit d5cc117

Please sign in to comment.