Comparing version 1.8.6 to 1.8.7
@@ -1,11 +0,41 @@ | ||
var _templateObject = /*#__PURE__*/ _taggedTemplateLiteral(["\n font-size: 12px;\n line-height: 1;\n"]), | ||
_templateObject2 = /*#__PURE__*/ _taggedTemplateLiteral(["\n color: ", ";\n\n ", ";\n ", ";\n\n &:hover {\n color: ", ";\n }\n"]); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _styledComponents = _interopRequireDefault(require("styled-components")); | ||
var _SvgButton = _interopRequireDefault(require("./SvgButton")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _templateObject2() { | ||
var data = _taggedTemplateLiteral(["\n color: ", ";\n\n ", ";\n ", ";\n\n &:hover {\n color: ", ";\n }\n"]); | ||
_templateObject2 = function _templateObject2() { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _templateObject() { | ||
var data = _taggedTemplateLiteral(["\n font-size: 12px;\n line-height: 1;\n"]); | ||
_templateObject = function _templateObject() { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import SvgButton from './SvgButton'; | ||
import PropTypes from 'prop-types'; | ||
var Label = styled.span(_templateObject); | ||
var Label = _styledComponents.default.span(_templateObject()); | ||
@@ -18,3 +48,3 @@ function Arrow(_ref) { | ||
disabled = _ref.disabled; | ||
return React.createElement(SvgButton, { | ||
return _react.default.createElement(_SvgButton.default, { | ||
className: className, | ||
@@ -24,5 +54,5 @@ onClick: onClick, | ||
disabled: disabled | ||
}, label ? React.createElement(Label, null, label) : React.createElement("svg", { | ||
}, label ? _react.default.createElement(Label, null, label) : _react.default.createElement("svg", { | ||
viewBox: "0 0 18.4 14.4" | ||
}, React.createElement("path", { | ||
}, _react.default.createElement("path", { | ||
d: inverted ? 'M17 7.2H1M10.8 1L17 7.2l-6.2 6.2' : 'M1.4 7.2h16M7.6 1L1.4 7.2l6.2 6.2', | ||
@@ -38,9 +68,10 @@ fill: "none", | ||
Arrow.propTypes = { | ||
className: PropTypes.string.isRequired, | ||
onClick: PropTypes.func.isRequired, | ||
inverted: PropTypes.bool, | ||
label: PropTypes.node, | ||
disabled: PropTypes.bool | ||
className: _propTypes.default.string.isRequired, | ||
onClick: _propTypes.default.func.isRequired, | ||
inverted: _propTypes.default.bool, | ||
label: _propTypes.default.node, | ||
disabled: _propTypes.default.bool | ||
}; | ||
export default styled(Arrow)(_templateObject2, function (props) { | ||
var _default = (0, _styledComponents.default)(Arrow)(_templateObject2(), function (props) { | ||
return props.disabled ? '#caccce' : '#646464'; | ||
@@ -53,2 +84,4 @@ }, function (props) { | ||
return props.disabled ? '#caccce' : '#000'; | ||
}); | ||
}); | ||
exports.default = _default; |
@@ -1,7 +0,27 @@ | ||
var _templateObject = /*#__PURE__*/ _taggedTemplateLiteral(["\n position: absolute;\n font-family: monospace;\n background-color: var(--reactour-accent);\n height: 1.875em;\n line-height: 2;\n padding-left: 0.8125em;\n padding-right: 0.8125em;\n font-size: 1em;\n border-radius: 1.625em;\n color: white;\n text-align: center;\n box-shadow: 0 0.25em 0.5em rgba(0, 0, 0, 0.3);\n top: -0.8125em;\n left: -0.8125em;\n"]); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _styledComponents = _interopRequireDefault(require("styled-components")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _templateObject() { | ||
var data = _taggedTemplateLiteral(["\n position: absolute;\n font-family: monospace;\n background-color: var(--reactour-accent);\n height: 1.875em;\n line-height: 2;\n padding-left: 0.8125em;\n padding-right: 0.8125em;\n font-size: 1em;\n border-radius: 1.625em;\n color: white;\n text-align: center;\n box-shadow: 0 0.25em 0.5em rgba(0, 0, 0, 0.3);\n top: -0.8125em;\n left: -0.8125em;\n"]); | ||
_templateObject = function _templateObject() { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } | ||
import styled from 'styled-components'; | ||
var Badge = styled.span(_templateObject); | ||
export default Badge; | ||
var Badge = _styledComponents.default.span(_templateObject()); | ||
var _default = Badge; | ||
exports.default = _default; |
@@ -1,19 +0,39 @@ | ||
var _templateObject = /*#__PURE__*/ _taggedTemplateLiteral(["\n position: absolute;\n top: 22px;\n right: 22px;\n width: 9px;\n height: 9px;\n color: #5e5e5e;\n &:hover {\n color: #000;\n }\n"]); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _styledComponents = _interopRequireDefault(require("styled-components")); | ||
var _SvgButton = _interopRequireDefault(require("./SvgButton")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _templateObject() { | ||
var data = _taggedTemplateLiteral(["\n position: absolute;\n top: 22px;\n right: 22px;\n width: 9px;\n height: 9px;\n color: #5e5e5e;\n &:hover {\n color: #000;\n }\n"]); | ||
_templateObject = function _templateObject() { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import SvgButton from './SvgButton'; | ||
import PropTypes from 'prop-types'; | ||
function Close(_ref) { | ||
var className = _ref.className, | ||
onClick = _ref.onClick; | ||
return React.createElement(SvgButton, { | ||
return _react.default.createElement(_SvgButton.default, { | ||
className: className, | ||
onClick: onClick | ||
}, React.createElement("svg", { | ||
}, _react.default.createElement("svg", { | ||
viewBox: "0 0 9.1 9.1" | ||
}, React.createElement("path", { | ||
}, _react.default.createElement("path", { | ||
fill: "currentColor", | ||
@@ -25,6 +45,7 @@ d: "M5.9 4.5l2.8-2.8c.4-.4.4-1 0-1.4-.4-.4-1-.4-1.4 0L4.5 3.1 1.7.3C1.3-.1.7-.1.3.3c-.4.4-.4 1 0 1.4l2.8 2.8L.3 7.4c-.4.4-.4 1 0 1.4.2.2.4.3.7.3s.5-.1.7-.3L4.5 6l2.8 2.8c.3.2.5.3.8.3s.5-.1.7-.3c.4-.4.4-1 0-1.4L5.9 4.5z" | ||
Close.propTypes = { | ||
className: PropTypes.string.isRequired, | ||
onClick: PropTypes.func.isRequired | ||
className: _propTypes.default.string.isRequired, | ||
onClick: _propTypes.default.func.isRequired | ||
}; | ||
var StyledClose = styled(Close)(_templateObject); | ||
export default StyledClose; | ||
var StyledClose = (0, _styledComponents.default)(Close)(_templateObject()); | ||
var _default = StyledClose; | ||
exports.default = _default; |
@@ -1,7 +0,27 @@ | ||
var _templateObject = /*#__PURE__*/ _taggedTemplateLiteral(["\n display: flex;\n margin-top: 24px;\n align-items: center;\n"]); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _styledComponents = _interopRequireDefault(require("styled-components")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _templateObject() { | ||
var data = _taggedTemplateLiteral(["\n display: flex;\n margin-top: 24px;\n align-items: center;\n"]); | ||
_templateObject = function _templateObject() { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } | ||
import styled from 'styled-components'; | ||
var Controls = styled.div(_templateObject); | ||
export default Controls; | ||
var Controls = _styledComponents.default.div(_templateObject()); | ||
var _default = Controls; | ||
exports.default = _default; |
@@ -1,7 +0,25 @@ | ||
var _templateObject = /*#__PURE__*/ _taggedTemplateLiteral(["\n counter-increment: dot;\n width: 8px;\n height: 8px;\n border: 1px solid;\n border-radius: 100%;\n padding: 0;\n display: block;\n margin: 4px;\n outline: 0;\n transition: opacity 0.3s, transform 0.3s;\n cursor: ", ";\n transform: scale(", ");\n color: ", ";\n background-color: ", ";\n\n &:before {\n content: counter(dot);\n position: absolute;\n bottom: calc(100% + 0.25em);\n left: 50%;\n opacity: 0;\n transform: translate(-50%, 1em);\n transition: 0.3s;\n display: ", ";\n }\n\n &:hover {\n background-color: currentColor;\n\n &:before {\n opacity: 0.5;\n transform: translate(-50%, -2px);\n }\n }\n"]); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _styledComponents = _interopRequireDefault(require("styled-components")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _templateObject() { | ||
var data = _taggedTemplateLiteral(["\n counter-increment: dot;\n width: 8px;\n height: 8px;\n border: 1px solid;\n border-radius: 100%;\n padding: 0;\n display: block;\n margin: 4px;\n outline: 0;\n transition: opacity 0.3s, transform 0.3s;\n cursor: ", ";\n transform: scale(", ");\n color: ", ";\n background-color: ", ";\n\n &:before {\n content: counter(dot);\n position: absolute;\n bottom: calc(100% + 0.25em);\n left: 50%;\n opacity: 0;\n transform: translate(-50%, 1em);\n transition: 0.3s;\n display: ", ";\n }\n\n &:hover {\n background-color: currentColor;\n\n &:before {\n opacity: 0.5;\n transform: translate(-50%, -2px);\n }\n }\n"]); | ||
_templateObject = function _templateObject() { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } | ||
import styled from 'styled-components'; | ||
var Dot = styled.button(_templateObject, function (props) { | ||
var Dot = _styledComponents.default.button(_templateObject(), function (props) { | ||
return props.disabled ? 'not-allowed' : 'pointer'; | ||
@@ -17,2 +35,4 @@ }, function (props) { | ||
}); | ||
export default Dot; | ||
var _default = Dot; | ||
exports.default = _default; |
@@ -1,8 +0,29 @@ | ||
var _templateObject = /*#__PURE__*/ _taggedTemplateLiteral(["\n --reactour-accent: ", ";\n position: fixed;\n background-color: #fff;\n transition: transform 0.3s;\n padding: 24px 30px;\n box-shadow: 0 0.5em 3em rgba(0, 0, 0, 0.3);\n top: 0;\n left: 0;\n color: inherit;\n z-index: 1000000;\n max-width: 331px;\n min-width: 150px;\n outline: 0;\n padding-right: 40px;\n border-radius: ", "px;\n\n transform: ", ";\n"]); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _styledComponents = _interopRequireDefault(require("styled-components")); | ||
var hx = _interopRequireWildcard(require("../helpers")); | ||
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)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _templateObject() { | ||
var data = _taggedTemplateLiteral(["\n --reactour-accent: ", ";\n position: fixed;\n background-color: #fff;\n transition: transform 0.3s;\n padding: 24px 30px;\n box-shadow: 0 0.5em 3em rgba(0, 0, 0, 0.3);\n top: 0;\n left: 0;\n color: inherit;\n z-index: 1000000;\n max-width: 331px;\n min-width: 150px;\n outline: 0;\n padding-right: 40px;\n border-radius: ", "px;\n\n transform: ", ";\n"]); | ||
_templateObject = function _templateObject() { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } | ||
import styled from 'styled-components'; | ||
import * as hx from '../helpers'; | ||
var Guide = styled.div(_templateObject, function (props) { | ||
var Guide = _styledComponents.default.div(_templateObject(), function (props) { | ||
return props.accentColor; | ||
@@ -68,2 +89,4 @@ }, function (props) { | ||
}); | ||
export default Guide; | ||
var _default = Guide; | ||
exports.default = _default; |
@@ -1,8 +0,71 @@ | ||
export { default as Arrow } from './Arrow'; | ||
export { default as Close } from './Close'; | ||
export { default as Guide } from './Guide'; | ||
export { default as Badge } from './Badge'; | ||
export { default as Controls } from './Controls'; | ||
export { default as Navigation } from './Navigation'; | ||
export { default as Dot } from './Dot'; | ||
export { default as SvgMask } from './SvgMask'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(exports, "Arrow", { | ||
enumerable: true, | ||
get: function get() { | ||
return _Arrow.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "Close", { | ||
enumerable: true, | ||
get: function get() { | ||
return _Close.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "Guide", { | ||
enumerable: true, | ||
get: function get() { | ||
return _Guide.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "Badge", { | ||
enumerable: true, | ||
get: function get() { | ||
return _Badge.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "Controls", { | ||
enumerable: true, | ||
get: function get() { | ||
return _Controls.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "Navigation", { | ||
enumerable: true, | ||
get: function get() { | ||
return _Navigation.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "Dot", { | ||
enumerable: true, | ||
get: function get() { | ||
return _Dot.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "SvgMask", { | ||
enumerable: true, | ||
get: function get() { | ||
return _SvgMask.default; | ||
} | ||
}); | ||
var _Arrow = _interopRequireDefault(require("./Arrow")); | ||
var _Close = _interopRequireDefault(require("./Close")); | ||
var _Guide = _interopRequireDefault(require("./Guide")); | ||
var _Badge = _interopRequireDefault(require("./Badge")); | ||
var _Controls = _interopRequireDefault(require("./Controls")); | ||
var _Navigation = _interopRequireDefault(require("./Navigation")); | ||
var _Dot = _interopRequireDefault(require("./Dot")); | ||
var _SvgMask = _interopRequireDefault(require("./SvgMask")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -1,7 +0,27 @@ | ||
var _templateObject = /*#__PURE__*/ _taggedTemplateLiteral(["\n counter-reset: dot;\n display: flex;\n justify-content: center;\n align-items: center;\n"]); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _styledComponents = _interopRequireDefault(require("styled-components")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _templateObject() { | ||
var data = _taggedTemplateLiteral(["\n counter-reset: dot;\n display: flex;\n justify-content: center;\n align-items: center;\n"]); | ||
_templateObject = function _templateObject() { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } | ||
import styled from 'styled-components'; | ||
var Navigation = styled.nav(_templateObject); | ||
export default Navigation; | ||
var Navigation = _styledComponents.default.nav(_templateObject()); | ||
var _default = Navigation; | ||
exports.default = _default; |
@@ -1,8 +0,28 @@ | ||
var _templateObject = /*#__PURE__*/ _taggedTemplateLiteral(["\n display: block;\n padding: 0;\n outline: 0;\n border: 0;\n background: none;\n font-size: 0;\n cursor: ", ";\n "]); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _styledComponents = _interopRequireDefault(require("styled-components")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _templateObject() { | ||
var data = _taggedTemplateLiteral(["\n display: block;\n padding: 0;\n outline: 0;\n border: 0;\n background: none;\n font-size: 0;\n cursor: ", ";\n "]); | ||
_templateObject = function _templateObject() { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } | ||
import styled from 'styled-components'; | ||
export default styled.button(_templateObject, function (props) { | ||
var _default = _styledComponents.default.button(_templateObject(), function (props) { | ||
return props.disabled ? 'not-allowed' : 'pointer'; | ||
}); | ||
}); | ||
exports.default = _default; |
@@ -1,11 +0,35 @@ | ||
var _templateObject = /*#__PURE__*/ _taggedTemplateLiteral(["\n opacity: 0.7;\n width: 100%;\n left: 0;\n top: 0;\n height: 100%;\n position: fixed;\n z-index: 99999;\n pointer-events: none;\n"]); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = SvgMask; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _styledComponents = _interopRequireDefault(require("styled-components")); | ||
var hx = _interopRequireWildcard(require("../helpers")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
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)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _templateObject() { | ||
var data = _taggedTemplateLiteral(["\n opacity: 0.7;\n width: 100%;\n left: 0;\n top: 0;\n height: 100%;\n position: fixed;\n z-index: 99999;\n pointer-events: none;\n"]); | ||
_templateObject = function _templateObject() { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import * as hx from '../helpers'; | ||
import PropTypes from 'prop-types'; | ||
var SvgMaskWrapper = styled.div(_templateObject); | ||
export default function SvgMask(_ref) { | ||
var SvgMaskWrapper = _styledComponents.default.div(_templateObject()); | ||
function SvgMask(_ref) { | ||
var windowWidth = _ref.windowWidth, | ||
@@ -26,3 +50,3 @@ windowHeight = _ref.windowHeight, | ||
var left = hx.safe(targetLeft - padding); | ||
return React.createElement(SvgMaskWrapper, null, React.createElement("svg", { | ||
return _react.default.createElement(SvgMaskWrapper, null, _react.default.createElement("svg", { | ||
width: windowWidth, | ||
@@ -32,5 +56,5 @@ height: windowHeight, | ||
className: className | ||
}, React.createElement("defs", null, React.createElement("mask", { | ||
}, _react.default.createElement("defs", null, _react.default.createElement("mask", { | ||
id: "mask-main" | ||
}, React.createElement("rect", { | ||
}, _react.default.createElement("rect", { | ||
x: 0, | ||
@@ -41,3 +65,3 @@ y: 0, | ||
fill: "white" | ||
}), React.createElement("rect", { | ||
}), _react.default.createElement("rect", { | ||
x: left, | ||
@@ -48,3 +72,3 @@ y: top, | ||
fill: "black" | ||
}), React.createElement("rect", { | ||
}), _react.default.createElement("rect", { | ||
x: left - 1, | ||
@@ -55,3 +79,3 @@ y: top - 1, | ||
fill: "white" | ||
}), React.createElement("circle", { | ||
}), _react.default.createElement("circle", { | ||
cx: left + rounded, | ||
@@ -61,3 +85,3 @@ cy: top + rounded, | ||
fill: "black" | ||
}), React.createElement("rect", { | ||
}), _react.default.createElement("rect", { | ||
x: left + width - rounded + 1, | ||
@@ -68,3 +92,3 @@ y: top - 1, | ||
fill: "white" | ||
}), React.createElement("circle", { | ||
}), _react.default.createElement("circle", { | ||
cx: left + width - rounded, | ||
@@ -74,3 +98,3 @@ cy: top + rounded, | ||
fill: "black" | ||
}), React.createElement("rect", { | ||
}), _react.default.createElement("rect", { | ||
x: left - 1, | ||
@@ -81,3 +105,3 @@ y: top + height - rounded + 1, | ||
fill: "white" | ||
}), React.createElement("circle", { | ||
}), _react.default.createElement("circle", { | ||
cx: left + rounded, | ||
@@ -87,3 +111,3 @@ cy: top + height - rounded, | ||
fill: "black" | ||
}), React.createElement("rect", { | ||
}), _react.default.createElement("rect", { | ||
x: left + width - rounded + 1, | ||
@@ -94,3 +118,3 @@ y: top + height - rounded + 1, | ||
fill: "white" | ||
}), React.createElement("circle", { | ||
}), _react.default.createElement("circle", { | ||
cx: left + width - rounded, | ||
@@ -100,5 +124,5 @@ cy: top + height - rounded, | ||
fill: "black " | ||
})), React.createElement("clipPath", { | ||
})), _react.default.createElement("clipPath", { | ||
id: "clip-path" | ||
}, React.createElement("rect", { | ||
}, _react.default.createElement("rect", { | ||
x: 0, | ||
@@ -108,3 +132,3 @@ y: 0, | ||
height: top | ||
}), React.createElement("rect", { | ||
}), _react.default.createElement("rect", { | ||
x: 0, | ||
@@ -114,3 +138,3 @@ y: top, | ||
height: height | ||
}), React.createElement("rect", { | ||
}), _react.default.createElement("rect", { | ||
x: targetLeft + targetWidth + padding, | ||
@@ -120,3 +144,3 @@ y: top, | ||
height: height | ||
}), React.createElement("rect", { | ||
}), _react.default.createElement("rect", { | ||
x: 0, | ||
@@ -126,3 +150,3 @@ y: targetTop + targetHeight + padding, | ||
height: hx.safe(windowHeight - targetHeight - top) | ||
}))), React.createElement("rect", { | ||
}))), _react.default.createElement("rect", { | ||
x: 0, | ||
@@ -134,3 +158,3 @@ y: 0, | ||
mask: "url(#mask-main)" | ||
}), React.createElement("rect", { | ||
}), _react.default.createElement("rect", { | ||
x: 0, | ||
@@ -143,3 +167,3 @@ y: 0, | ||
pointerEvents: "auto" | ||
}), React.createElement("rect", { | ||
}), _react.default.createElement("rect", { | ||
x: left, | ||
@@ -155,13 +179,14 @@ y: top, | ||
} | ||
SvgMask.propTypes = { | ||
windowWidth: PropTypes.number.isRequired, | ||
windowHeight: PropTypes.number.isRequired, | ||
targetWidth: PropTypes.number.isRequired, | ||
targetHeight: PropTypes.number.isRequired, | ||
targetTop: PropTypes.number.isRequired, | ||
targetLeft: PropTypes.number.isRequired, | ||
padding: PropTypes.number.isRequired, | ||
rounded: PropTypes.number.isRequired, | ||
disableInteraction: PropTypes.bool.isRequired, | ||
disableInteractionClassName: PropTypes.string.isRequired | ||
windowWidth: _propTypes.default.number.isRequired, | ||
windowHeight: _propTypes.default.number.isRequired, | ||
targetWidth: _propTypes.default.number.isRequired, | ||
targetHeight: _propTypes.default.number.isRequired, | ||
targetTop: _propTypes.default.number.isRequired, | ||
targetLeft: _propTypes.default.number.isRequired, | ||
padding: _propTypes.default.number.isRequired, | ||
rounded: _propTypes.default.number.isRequired, | ||
disableInteraction: _propTypes.default.bool.isRequired, | ||
disableInteractionClassName: _propTypes.default.string.isRequired | ||
}; |
@@ -1,6 +0,19 @@ | ||
import pick from 'lodash.pick'; | ||
export var getNodeRect = function getNodeRect(node) { | ||
return pick(node.getBoundingClientRect(), ['top', 'right', 'bottom', 'left', 'width', 'height']); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.bestPositionOf = exports.safe = exports.isOutsideY = exports.isOutsideX = exports.isHoriz = exports.isBody = exports.inView = exports.getNodeRect = void 0; | ||
var _lodash = _interopRequireDefault(require("lodash.pick")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var getNodeRect = function getNodeRect(node) { | ||
return (0, _lodash.default)(node.getBoundingClientRect(), ['top', 'right', 'bottom', 'left', 'width', 'height']); | ||
}; | ||
export var inView = function inView(_ref) { | ||
exports.getNodeRect = getNodeRect; | ||
var inView = function inView(_ref) { | ||
var top = _ref.top, | ||
@@ -16,18 +29,36 @@ right = _ref.right, | ||
}; | ||
export var isBody = function isBody(node) { | ||
exports.inView = inView; | ||
var isBody = function isBody(node) { | ||
return node === document.querySelector('body') || node === document.querySelector('html'); | ||
}; | ||
export var isHoriz = function isHoriz(pos) { | ||
exports.isBody = isBody; | ||
var isHoriz = function isHoriz(pos) { | ||
return /(left|right)/.test(pos); | ||
}; | ||
export var isOutsideX = function isOutsideX(val, windowWidth) { | ||
exports.isHoriz = isHoriz; | ||
var isOutsideX = function isOutsideX(val, windowWidth) { | ||
return val > windowWidth; | ||
}; | ||
export var isOutsideY = function isOutsideY(val, windowHeight) { | ||
exports.isOutsideX = isOutsideX; | ||
var isOutsideY = function isOutsideY(val, windowHeight) { | ||
return val > windowHeight; | ||
}; | ||
export var safe = function safe(sum) { | ||
exports.isOutsideY = isOutsideY; | ||
var safe = function safe(sum) { | ||
return sum < 0 ? 0 : sum; | ||
}; | ||
export var bestPositionOf = function bestPositionOf(positions) { | ||
exports.safe = safe; | ||
var bestPositionOf = function bestPositionOf(positions) { | ||
return Object.keys(positions).map(function (p) { | ||
@@ -43,2 +74,4 @@ return { | ||
}); | ||
}; | ||
}; | ||
exports.bestPositionOf = bestPositionOf; |
@@ -1,2 +0,13 @@ | ||
import Tour from './Tour'; | ||
export default Tour; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _Tour = _interopRequireDefault(require("./Tour")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _default = _Tour.default; | ||
exports.default = _default; |
@@ -0,1 +1,22 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _reactDom = _interopRequireDefault(require("react-dom")); | ||
var _exenv = _interopRequireDefault(require("exenv")); | ||
var _TourPortal = _interopRequireDefault(require("./TourPortal")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
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)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
@@ -13,12 +34,13 @@ | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } 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; } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import ReactDOM from 'react-dom'; | ||
import ExecutionEnvironment from 'exenv'; | ||
import TourPortal from './TourPortal'; | ||
var renderSubtreeIntoContainer = ReactDOM.unstable_renderSubtreeIntoContainer; | ||
var SafeHTMLElement = ExecutionEnvironment.canUseDOM ? window.HTMLElement : {}; | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var renderSubtreeIntoContainer = _reactDom.default.unstable_renderSubtreeIntoContainer; | ||
var SafeHTMLElement = _exenv.default.canUseDOM ? window.HTMLElement : {}; | ||
function getParentElement(parentSelector) { | ||
@@ -36,3 +58,3 @@ return parentSelector(); | ||
return _possibleConstructorReturn(this, (Tour.__proto__ || Object.getPrototypeOf(Tour)).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _getPrototypeOf(Tour).apply(this, arguments)); | ||
} | ||
@@ -76,3 +98,3 @@ | ||
this.portal = renderSubtreeIntoContainer(this, React.createElement(TourPortal, props), this.node); | ||
this.portal = renderSubtreeIntoContainer(this, _react.default.createElement(_TourPortal.default, props), this.node); | ||
} | ||
@@ -82,3 +104,4 @@ }, { | ||
value: function removePortal() { | ||
ReactDOM.unmountComponentAtNode(this.node); | ||
_reactDom.default.unmountComponentAtNode(this.node); | ||
var parent = getParentElement(this.props.parentSelector); | ||
@@ -96,31 +119,24 @@ parent.removeChild(this.node); | ||
return Tour; | ||
}(Component); | ||
}(_react.Component); | ||
Object.defineProperty(Tour, "propTypes", { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
value: { | ||
isOpen: PropTypes.bool.isRequired, | ||
portalClassName: PropTypes.string, | ||
appElement: PropTypes.instanceOf(SafeHTMLElement), | ||
onAfterOpen: PropTypes.func, | ||
onRequestClose: PropTypes.func, | ||
closeWithMask: PropTypes.bool, | ||
parentSelector: PropTypes.func | ||
} | ||
_defineProperty(Tour, "propTypes", { | ||
isOpen: _propTypes.default.bool.isRequired, | ||
portalClassName: _propTypes.default.string, | ||
appElement: _propTypes.default.instanceOf(SafeHTMLElement), | ||
onAfterOpen: _propTypes.default.func, | ||
onRequestClose: _propTypes.default.func, | ||
closeWithMask: _propTypes.default.bool, | ||
parentSelector: _propTypes.default.func | ||
}); | ||
Object.defineProperty(Tour, "defaultProps", { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
value: { | ||
isOpen: false, | ||
portalClassName: 'reactour-portal', | ||
closeWithMask: true, | ||
parentSelector: function parentSelector() { | ||
return document.body; | ||
} | ||
_defineProperty(Tour, "defaultProps", { | ||
isOpen: false, | ||
portalClassName: 'reactour-portal', | ||
closeWithMask: true, | ||
parentSelector: function parentSelector() { | ||
return document.body; | ||
} | ||
}); | ||
export default Tour; | ||
var _default = Tour; | ||
exports.default = _default; |
@@ -0,1 +1,26 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _classnames = _interopRequireDefault(require("classnames")); | ||
var _scrollSmooth = _interopRequireDefault(require("scroll-smooth")); | ||
var _scrollparent = _interopRequireDefault(require("scrollparent")); | ||
var _index = require("./components/index"); | ||
var hx = _interopRequireWildcard(require("./helpers")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
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)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
@@ -5,4 +30,2 @@ | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -16,13 +39,11 @@ | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } 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; } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import cn from 'classnames'; | ||
import scrollSmooth from 'scroll-smooth'; | ||
import Scrollparent from 'scrollparent'; | ||
import { Arrow, Close, Guide, Badge, Controls, Navigation, Dot, SvgMask } from './components/index'; | ||
import * as hx from './helpers'; | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
@@ -39,226 +60,200 @@ var TourPortal = | ||
_this = _possibleConstructorReturn(this, (TourPortal.__proto__ || Object.getPrototypeOf(TourPortal)).call(this)); | ||
Object.defineProperty(_assertThisInitialized(_this), "showStep", { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
value: function value() { | ||
var steps = _this.props.steps; | ||
var current = _this.state.current; | ||
var step = steps[current]; | ||
var node = step.selector ? document.querySelector(step.selector) : null; | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(TourPortal).call(this)); | ||
var stepCallback = function stepCallback(o) { | ||
if (step.action && typeof step.action === 'function') { | ||
step.action(o); | ||
} | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "showStep", function () { | ||
var steps = _this.props.steps; | ||
var current = _this.state.current; | ||
var step = steps[current]; | ||
var node = step.selector ? document.querySelector(step.selector) : null; | ||
var stepCallback = function stepCallback(o) { | ||
if (step.action && typeof step.action === 'function') { | ||
step.action(o); | ||
} | ||
}; | ||
if (step.observe) { | ||
var target = document.querySelector(step.observe); | ||
var config = { | ||
attributes: true, | ||
childList: true, | ||
characterData: true | ||
}; | ||
if (step.observe) { | ||
var target = document.querySelector(step.observe); | ||
var config = { | ||
attributes: true, | ||
childList: true, | ||
characterData: true | ||
}; | ||
_this.setState(function (prevState) { | ||
if (prevState.observer) { | ||
setTimeout(function () { | ||
prevState.observer.disconnect(); | ||
}, 0); | ||
} | ||
_this.setState(function (prevState) { | ||
if (prevState.observer) { | ||
setTimeout(function () { | ||
prevState.observer.disconnect(); | ||
}, 0); | ||
} | ||
return { | ||
observer: new MutationObserver(function (mutations) { | ||
mutations.forEach(function (mutation) { | ||
if (mutation.type === 'childList' && mutation.addedNodes.length > 0) { | ||
var cb = function cb() { | ||
return stepCallback(mutation.addedNodes[0]); | ||
}; | ||
return { | ||
observer: new MutationObserver(function (mutations) { | ||
mutations.forEach(function (mutation) { | ||
if (mutation.type === 'childList' && mutation.addedNodes.length > 0) { | ||
var cb = function cb() { | ||
return stepCallback(mutation.addedNodes[0]); | ||
}; | ||
setTimeout(function () { | ||
return _this.calculateNode(mutation.addedNodes[0], step.position, cb); | ||
}, 100); | ||
} else if (mutation.type === 'childList' && mutation.removedNodes.length > 0) { | ||
var _cb = function _cb() { | ||
return stepCallback(node); | ||
}; | ||
setTimeout(function () { | ||
return _this.calculateNode(mutation.addedNodes[0], step.position, cb); | ||
}, 100); | ||
} else if (mutation.type === 'childList' && mutation.removedNodes.length > 0) { | ||
var _cb = function _cb() { | ||
return stepCallback(node); | ||
}; | ||
_this.calculateNode(node, step.position, _cb); | ||
} | ||
}); | ||
}) | ||
}; | ||
}, function () { | ||
return _this.state.observer.observe(target, config); | ||
}); | ||
} else { | ||
if (_this.state.observer) { | ||
_this.state.observer.disconnect(); | ||
_this.calculateNode(node, step.position, _cb); | ||
} | ||
}); | ||
}) | ||
}; | ||
}, function () { | ||
return _this.state.observer.observe(target, config); | ||
_this.setState({ | ||
observer: null | ||
}); | ||
} else { | ||
if (_this.state.observer) { | ||
_this.state.observer.disconnect(); | ||
_this.setState({ | ||
observer: null | ||
}); | ||
} | ||
} | ||
} | ||
if (node) { | ||
var cb = function cb() { | ||
return stepCallback(node); | ||
}; | ||
if (node) { | ||
var cb = function cb() { | ||
return stepCallback(node); | ||
}; | ||
_this.calculateNode(node, step.position, cb); | ||
} else { | ||
_this.setState(setNodeState(null, _this.helper, step.position), stepCallback); | ||
_this.calculateNode(node, step.position, cb); | ||
} else { | ||
_this.setState(setNodeState(null, _this.helper, step.position), stepCallback); | ||
step.selector && console.warn("Doesn't find a DOM node '".concat(step.selector, "'.\n Please check the 'steps' Tour prop Array at position: ").concat(current + 1, ".")); | ||
} | ||
step.selector && console.warn("Doesn't find a DOM node '".concat(step.selector, "'.\n Please check the 'steps' Tour prop Array at position: ").concat(current + 1, ".")); | ||
} | ||
}); | ||
Object.defineProperty(_assertThisInitialized(_this), "calculateNode", { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
value: function value(node, stepPosition, cb) { | ||
var _this$props = _this.props, | ||
scrollDuration = _this$props.scrollDuration, | ||
inViewThreshold = _this$props.inViewThreshold, | ||
scrollOffset = _this$props.scrollOffset; | ||
var attrs = hx.getNodeRect(node); | ||
var w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); | ||
var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); | ||
if (!hx.inView(_objectSpread({}, attrs, { | ||
w: w, | ||
h: h, | ||
threshold: inViewThreshold | ||
}))) { | ||
var parentScroll = Scrollparent(node); | ||
scrollSmooth.to(node, { | ||
context: hx.isBody(parentScroll) ? window : parentScroll, | ||
duration: scrollDuration, | ||
offset: scrollOffset || -(h / 2), | ||
callback: function callback(nd) { | ||
_this.setState(setNodeState(nd, _this.helper, stepPosition), cb); | ||
} | ||
}); | ||
} else { | ||
_this.setState(setNodeState(node, _this.helper, stepPosition), cb); | ||
} | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "calculateNode", function (node, stepPosition, cb) { | ||
var _this$props = _this.props, | ||
scrollDuration = _this$props.scrollDuration, | ||
inViewThreshold = _this$props.inViewThreshold, | ||
scrollOffset = _this$props.scrollOffset; | ||
var attrs = hx.getNodeRect(node); | ||
var w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); | ||
var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); | ||
if (!hx.inView(_objectSpread({}, attrs, { | ||
w: w, | ||
h: h, | ||
threshold: inViewThreshold | ||
}))) { | ||
var parentScroll = (0, _scrollparent.default)(node); | ||
_scrollSmooth.default.to(node, { | ||
context: hx.isBody(parentScroll) ? window : parentScroll, | ||
duration: scrollDuration, | ||
offset: scrollOffset || -(h / 2), | ||
callback: function callback(nd) { | ||
_this.setState(setNodeState(nd, _this.helper, stepPosition), cb); | ||
} | ||
}); | ||
} else { | ||
_this.setState(setNodeState(node, _this.helper, stepPosition), cb); | ||
} | ||
}); | ||
Object.defineProperty(_assertThisInitialized(_this), "maskClickHandler", { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
value: function value(e) { | ||
var _this$props2 = _this.props, | ||
closeWithMask = _this$props2.closeWithMask, | ||
onRequestClose = _this$props2.onRequestClose; | ||
if (closeWithMask && !e.target.classList.contains(CN.mask.disableInteraction)) { | ||
onRequestClose(e); | ||
} | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "maskClickHandler", function (e) { | ||
var _this$props2 = _this.props, | ||
closeWithMask = _this$props2.closeWithMask, | ||
onRequestClose = _this$props2.onRequestClose; | ||
if (closeWithMask && !e.target.classList.contains(CN.mask.disableInteraction)) { | ||
onRequestClose(e); | ||
} | ||
}); | ||
Object.defineProperty(_assertThisInitialized(_this), "nextStep", { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
value: function value() { | ||
var _this$props3 = _this.props, | ||
steps = _this$props3.steps, | ||
getCurrentStep = _this$props3.getCurrentStep; | ||
_this.setState(function (prevState) { | ||
var nextStep = prevState.current < steps.length - 1 ? prevState.current + 1 : prevState.current; | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "nextStep", function () { | ||
var _this$props3 = _this.props, | ||
steps = _this$props3.steps, | ||
getCurrentStep = _this$props3.getCurrentStep; | ||
if (typeof getCurrentStep === 'function') { | ||
getCurrentStep(nextStep); | ||
} | ||
_this.setState(function (prevState) { | ||
var nextStep = prevState.current < steps.length - 1 ? prevState.current + 1 : prevState.current; | ||
return { | ||
current: nextStep | ||
}; | ||
}, _this.showStep); | ||
} | ||
if (typeof getCurrentStep === 'function') { | ||
getCurrentStep(nextStep); | ||
} | ||
return { | ||
current: nextStep | ||
}; | ||
}, _this.showStep); | ||
}); | ||
Object.defineProperty(_assertThisInitialized(_this), "prevStep", { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
value: function value() { | ||
var getCurrentStep = _this.props.getCurrentStep; | ||
_this.setState(function (prevState) { | ||
var nextStep = prevState.current > 0 ? prevState.current - 1 : prevState.current; | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "prevStep", function () { | ||
var getCurrentStep = _this.props.getCurrentStep; | ||
if (typeof getCurrentStep === 'function') { | ||
getCurrentStep(nextStep); | ||
} | ||
_this.setState(function (prevState) { | ||
var nextStep = prevState.current > 0 ? prevState.current - 1 : prevState.current; | ||
return { | ||
current: nextStep | ||
}; | ||
}, _this.showStep); | ||
} | ||
if (typeof getCurrentStep === 'function') { | ||
getCurrentStep(nextStep); | ||
} | ||
return { | ||
current: nextStep | ||
}; | ||
}, _this.showStep); | ||
}); | ||
Object.defineProperty(_assertThisInitialized(_this), "gotoStep", { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
value: function value(n) { | ||
var _this$props4 = _this.props, | ||
steps = _this$props4.steps, | ||
getCurrentStep = _this$props4.getCurrentStep; | ||
_this.setState(function (prevState) { | ||
var nextStep = steps[n] ? n : prevState.current; | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "gotoStep", function (n) { | ||
var _this$props4 = _this.props, | ||
steps = _this$props4.steps, | ||
getCurrentStep = _this$props4.getCurrentStep; | ||
if (typeof getCurrentStep === 'function') { | ||
getCurrentStep(nextStep); | ||
} | ||
_this.setState(function (prevState) { | ||
var nextStep = steps[n] ? n : prevState.current; | ||
return { | ||
current: nextStep | ||
}; | ||
}, _this.showStep); | ||
} | ||
if (typeof getCurrentStep === 'function') { | ||
getCurrentStep(nextStep); | ||
} | ||
return { | ||
current: nextStep | ||
}; | ||
}, _this.showStep); | ||
}); | ||
Object.defineProperty(_assertThisInitialized(_this), "keyDownHandler", { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
value: function value(e) { | ||
var _this$props5 = _this.props, | ||
onRequestClose = _this$props5.onRequestClose, | ||
nextStep = _this$props5.nextStep, | ||
prevStep = _this$props5.prevStep, | ||
disableKeyboardNavigation = _this$props5.disableKeyboardNavigation; | ||
e.stopPropagation(); | ||
if (disableKeyboardNavigation) { | ||
return; | ||
} | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "keyDownHandler", function (e) { | ||
var _this$props5 = _this.props, | ||
onRequestClose = _this$props5.onRequestClose, | ||
nextStep = _this$props5.nextStep, | ||
prevStep = _this$props5.prevStep, | ||
disableKeyboardNavigation = _this$props5.disableKeyboardNavigation; | ||
e.stopPropagation(); | ||
if (e.keyCode === 27) { | ||
// esc | ||
e.preventDefault(); | ||
onRequestClose(); | ||
} | ||
if (disableKeyboardNavigation) { | ||
return; | ||
} | ||
if (e.keyCode === 39) { | ||
// right | ||
e.preventDefault(); | ||
typeof nextStep === 'function' ? nextStep() : _this.nextStep(); | ||
} | ||
if (e.keyCode === 27) { | ||
// esc | ||
e.preventDefault(); | ||
onRequestClose(); | ||
} | ||
if (e.keyCode === 37) { | ||
// left | ||
e.preventDefault(); | ||
typeof prevStep === 'function' ? prevStep() : _this.prevStep(); | ||
} | ||
if (e.keyCode === 39) { | ||
// right | ||
e.preventDefault(); | ||
typeof nextStep === 'function' ? nextStep() : _this.nextStep(); | ||
} | ||
if (e.keyCode === 37) { | ||
// left | ||
e.preventDefault(); | ||
typeof prevStep === 'function' ? prevStep() : _this.prevStep(); | ||
} | ||
}); | ||
_this.state = { | ||
@@ -284,5 +279,5 @@ isOpen: false, | ||
value: function componentDidMount() { | ||
var _props = this.props, | ||
isOpen = _props.isOpen, | ||
startAt = _props.startAt; | ||
var _this$props6 = this.props, | ||
isOpen = _this$props6.isOpen, | ||
startAt = _this$props6.startAt; | ||
@@ -296,6 +291,6 @@ if (isOpen) { | ||
value: function componentWillReceiveProps(nextProps) { | ||
var _props2 = this.props, | ||
isOpen = _props2.isOpen, | ||
update = _props2.update, | ||
updateDelay = _props2.updateDelay; | ||
var _this$props7 = this.props, | ||
isOpen = _this$props7.isOpen, | ||
update = _this$props7.update, | ||
updateDelay = _this$props7.updateDelay; | ||
@@ -387,41 +382,41 @@ if (!isOpen && nextProps.isOpen) { | ||
var _props3 = this.props, | ||
className = _props3.className, | ||
steps = _props3.steps, | ||
maskClassName = _props3.maskClassName, | ||
showButtons = _props3.showButtons, | ||
showNavigation = _props3.showNavigation, | ||
showNavigationNumber = _props3.showNavigationNumber, | ||
showNumber = _props3.showNumber, | ||
onRequestClose = _props3.onRequestClose, | ||
maskSpace = _props3.maskSpace, | ||
lastStepNextButton = _props3.lastStepNextButton, | ||
nextButton = _props3.nextButton, | ||
prevButton = _props3.prevButton, | ||
badgeContent = _props3.badgeContent, | ||
highlightedMaskClassName = _props3.highlightedMaskClassName, | ||
disableInteraction = _props3.disableInteraction, | ||
disableDotsNavigation = _props3.disableDotsNavigation, | ||
nextStep = _props3.nextStep, | ||
prevStep = _props3.prevStep, | ||
rounded = _props3.rounded, | ||
accentColor = _props3.accentColor; | ||
var _state = this.state, | ||
isOpen = _state.isOpen, | ||
current = _state.current, | ||
inDOM = _state.inDOM, | ||
targetTop = _state.top, | ||
targetRight = _state.right, | ||
targetBottom = _state.bottom, | ||
targetLeft = _state.left, | ||
targetWidth = _state.width, | ||
targetHeight = _state.height, | ||
windowWidth = _state.w, | ||
windowHeight = _state.h, | ||
helperWidth = _state.helperWidth, | ||
helperHeight = _state.helperHeight, | ||
helperPosition = _state.helperPosition; | ||
var _this$props8 = this.props, | ||
className = _this$props8.className, | ||
steps = _this$props8.steps, | ||
maskClassName = _this$props8.maskClassName, | ||
showButtons = _this$props8.showButtons, | ||
showNavigation = _this$props8.showNavigation, | ||
showNavigationNumber = _this$props8.showNavigationNumber, | ||
showNumber = _this$props8.showNumber, | ||
onRequestClose = _this$props8.onRequestClose, | ||
maskSpace = _this$props8.maskSpace, | ||
lastStepNextButton = _this$props8.lastStepNextButton, | ||
nextButton = _this$props8.nextButton, | ||
prevButton = _this$props8.prevButton, | ||
badgeContent = _this$props8.badgeContent, | ||
highlightedMaskClassName = _this$props8.highlightedMaskClassName, | ||
disableInteraction = _this$props8.disableInteraction, | ||
disableDotsNavigation = _this$props8.disableDotsNavigation, | ||
nextStep = _this$props8.nextStep, | ||
prevStep = _this$props8.prevStep, | ||
rounded = _this$props8.rounded, | ||
accentColor = _this$props8.accentColor; | ||
var _this$state = this.state, | ||
isOpen = _this$state.isOpen, | ||
current = _this$state.current, | ||
inDOM = _this$state.inDOM, | ||
targetTop = _this$state.top, | ||
targetRight = _this$state.right, | ||
targetBottom = _this$state.bottom, | ||
targetLeft = _this$state.left, | ||
targetWidth = _this$state.width, | ||
targetHeight = _this$state.height, | ||
windowWidth = _this$state.w, | ||
windowHeight = _this$state.h, | ||
helperWidth = _this$state.helperWidth, | ||
helperHeight = _this$state.helperHeight, | ||
helperPosition = _this$state.helperPosition; | ||
if (isOpen) { | ||
return React.createElement("div", null, React.createElement("div", { | ||
return _react.default.createElement("div", null, _react.default.createElement("div", { | ||
ref: function ref(c) { | ||
@@ -431,4 +426,4 @@ return _this3.mask = c; | ||
onClick: this.maskClickHandler, | ||
className: cn(CN.mask.base, _defineProperty({}, CN.mask.isOpen, isOpen)) | ||
}, React.createElement(SvgMask, { | ||
className: (0, _classnames.default)(CN.mask.base, _defineProperty({}, CN.mask.isOpen, isOpen)) | ||
}, _react.default.createElement(_index.SvgMask, { | ||
windowWidth: windowWidth, | ||
@@ -445,3 +440,3 @@ windowHeight: windowHeight, | ||
disableInteractionClassName: "".concat(CN.mask.disableInteraction, " ").concat(highlightedMaskClassName) | ||
})), React.createElement(Guide, { | ||
})), _react.default.createElement(_index.Guide, { | ||
innerRef: function innerRef(c) { | ||
@@ -466,3 +461,3 @@ return _this3.helper = c; | ||
rounded: rounded, | ||
className: cn(CN.helper.base, className, _defineProperty({}, CN.helper.isOpen, isOpen)), | ||
className: (0, _classnames.default)(CN.helper.base, className, _defineProperty({}, CN.helper.isOpen, isOpen)), | ||
accentColor: accentColor | ||
@@ -473,14 +468,14 @@ }, steps[current] && (typeof steps[current].content === 'function' ? steps[current].content({ | ||
step: current + 1 | ||
}) : steps[current].content), showNumber && React.createElement(Badge, { | ||
}) : steps[current].content), showNumber && _react.default.createElement(_index.Badge, { | ||
"data-tour-elem": "badge" | ||
}, typeof badgeContent === 'function' ? badgeContent(current + 1, steps.length) : current + 1), (showButtons || showNavigation) && React.createElement(Controls, { | ||
}, typeof badgeContent === 'function' ? badgeContent(current + 1, steps.length) : current + 1), (showButtons || showNavigation) && _react.default.createElement(_index.Controls, { | ||
"data-tour-elem": "controls" | ||
}, showButtons && React.createElement(Arrow, { | ||
}, showButtons && _react.default.createElement(_index.Arrow, { | ||
onClick: typeof prevStep === 'function' ? prevStep : this.prevStep, | ||
disabled: current === 0, | ||
label: prevButton ? prevButton : null | ||
}), showNavigation && React.createElement(Navigation, { | ||
}), showNavigation && _react.default.createElement(_index.Navigation, { | ||
"data-tour-elem": "navigation" | ||
}, steps.map(function (s, i) { | ||
return React.createElement(Dot, { | ||
return _react.default.createElement(_index.Dot, { | ||
key: "".concat(s.selector ? s.selector : 'undef', "_").concat(i), | ||
@@ -496,3 +491,3 @@ onClick: function onClick() { | ||
}); | ||
})), showButtons && React.createElement(Arrow, { | ||
})), showButtons && _react.default.createElement(_index.Arrow, { | ||
onClick: current === steps.length - 1 ? lastStepNextButton ? onRequestClose : function () {} : typeof nextStep === 'function' ? nextStep : this.nextStep, | ||
@@ -502,3 +497,3 @@ disabled: !lastStepNextButton && current === steps.length - 1, | ||
label: lastStepNextButton && current === steps.length - 1 ? lastStepNextButton : nextButton ? nextButton : null | ||
})), React.createElement(Close, { | ||
})), _react.default.createElement(_index.Close, { | ||
onClick: onRequestClose | ||
@@ -508,3 +503,3 @@ }))); | ||
return React.createElement("div", null); | ||
return _react.default.createElement("div", null); | ||
} | ||
@@ -514,74 +509,66 @@ }]); | ||
return TourPortal; | ||
}(Component); | ||
}(_react.Component); | ||
Object.defineProperty(TourPortal, "propTypes", { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
value: { | ||
badgeContent: PropTypes.func, | ||
highlightedMaskClassName: PropTypes.string, | ||
className: PropTypes.string, | ||
closeWithMask: PropTypes.bool, | ||
inViewThreshold: PropTypes.number, | ||
isOpen: PropTypes.bool.isRequired, | ||
lastStepNextButton: PropTypes.node, | ||
maskClassName: PropTypes.string, | ||
maskSpace: PropTypes.number, | ||
nextButton: PropTypes.node, | ||
onAfterOpen: PropTypes.func, | ||
onBeforeClose: PropTypes.func, | ||
onRequestClose: PropTypes.func, | ||
prevButton: PropTypes.node, | ||
scrollDuration: PropTypes.number, | ||
scrollOffset: PropTypes.number, | ||
showButtons: PropTypes.bool, | ||
showNavigation: PropTypes.bool, | ||
showNavigationNumber: PropTypes.bool, | ||
showNumber: PropTypes.bool, | ||
startAt: PropTypes.number, | ||
goToStep: PropTypes.number, | ||
getCurrentStep: PropTypes.func, | ||
nextStep: PropTypes.func, | ||
prevStep: PropTypes.func, | ||
steps: PropTypes.arrayOf(PropTypes.shape({ | ||
selector: PropTypes.string, | ||
content: PropTypes.oneOfType([PropTypes.node, PropTypes.element, PropTypes.func]).isRequired, | ||
position: PropTypes.oneOf(['top', 'right', 'bottom', 'left', 'center']), | ||
action: PropTypes.func, | ||
style: PropTypes.object, | ||
stepInteraction: PropTypes.bool | ||
})), | ||
update: PropTypes.string, | ||
updateDelay: PropTypes.number, | ||
disableInteraction: PropTypes.bool, | ||
disableDotsNavigation: PropTypes.bool, | ||
disableKeyboardNavigation: PropTypes.bool, | ||
rounded: PropTypes.number, | ||
accentColor: PropTypes.string | ||
} | ||
_defineProperty(TourPortal, "propTypes", { | ||
badgeContent: _propTypes.default.func, | ||
highlightedMaskClassName: _propTypes.default.string, | ||
className: _propTypes.default.string, | ||
closeWithMask: _propTypes.default.bool, | ||
inViewThreshold: _propTypes.default.number, | ||
isOpen: _propTypes.default.bool.isRequired, | ||
lastStepNextButton: _propTypes.default.node, | ||
maskClassName: _propTypes.default.string, | ||
maskSpace: _propTypes.default.number, | ||
nextButton: _propTypes.default.node, | ||
onAfterOpen: _propTypes.default.func, | ||
onBeforeClose: _propTypes.default.func, | ||
onRequestClose: _propTypes.default.func, | ||
prevButton: _propTypes.default.node, | ||
scrollDuration: _propTypes.default.number, | ||
scrollOffset: _propTypes.default.number, | ||
showButtons: _propTypes.default.bool, | ||
showNavigation: _propTypes.default.bool, | ||
showNavigationNumber: _propTypes.default.bool, | ||
showNumber: _propTypes.default.bool, | ||
startAt: _propTypes.default.number, | ||
goToStep: _propTypes.default.number, | ||
getCurrentStep: _propTypes.default.func, | ||
nextStep: _propTypes.default.func, | ||
prevStep: _propTypes.default.func, | ||
steps: _propTypes.default.arrayOf(_propTypes.default.shape({ | ||
selector: _propTypes.default.string, | ||
content: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.element, _propTypes.default.func]).isRequired, | ||
position: _propTypes.default.oneOf(['top', 'right', 'bottom', 'left', 'center']), | ||
action: _propTypes.default.func, | ||
style: _propTypes.default.object, | ||
stepInteraction: _propTypes.default.bool | ||
})), | ||
update: _propTypes.default.string, | ||
updateDelay: _propTypes.default.number, | ||
disableInteraction: _propTypes.default.bool, | ||
disableDotsNavigation: _propTypes.default.bool, | ||
disableKeyboardNavigation: _propTypes.default.bool, | ||
rounded: _propTypes.default.number, | ||
accentColor: _propTypes.default.string | ||
}); | ||
Object.defineProperty(TourPortal, "defaultProps", { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
value: { | ||
onAfterOpen: function onAfterOpen() { | ||
document.body.style.overflowY = 'hidden'; | ||
}, | ||
onBeforeClose: function onBeforeClose() { | ||
document.body.style.overflowY = 'auto'; | ||
}, | ||
showNavigation: true, | ||
showNavigationNumber: true, | ||
showButtons: true, | ||
showNumber: true, | ||
scrollDuration: 1, | ||
maskSpace: 10, | ||
updateDelay: 1, | ||
disableInteraction: false, | ||
rounded: 0, | ||
accentColor: '#007aff' | ||
} | ||
_defineProperty(TourPortal, "defaultProps", { | ||
onAfterOpen: function onAfterOpen() { | ||
document.body.style.overflowY = 'hidden'; | ||
}, | ||
onBeforeClose: function onBeforeClose() { | ||
document.body.style.overflowY = 'auto'; | ||
}, | ||
showNavigation: true, | ||
showNavigationNumber: true, | ||
showButtons: true, | ||
showNumber: true, | ||
scrollDuration: 1, | ||
maskSpace: 10, | ||
updateDelay: 1, | ||
disableInteraction: false, | ||
rounded: 0, | ||
accentColor: '#007aff' | ||
}); | ||
var CN = { | ||
@@ -631,2 +618,3 @@ mask: { | ||
export default TourPortal; | ||
var _default = TourPortal; | ||
exports.default = _default; |
{ | ||
"name": "reactour", | ||
"version": "1.8.6", | ||
"version": "1.8.7", | ||
"description": "Tourist Guide into your React Components", | ||
@@ -44,9 +44,9 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@babel/cli": "7.0.0-beta.44", | ||
"@babel/core": "7.0.0-beta.44", | ||
"@babel/preset-env": "7.0.0-beta.44", | ||
"@babel/preset-react": "7.0.0-beta.44", | ||
"@babel/preset-stage-2": "7.0.0-beta.44", | ||
"babel-eslint": "8.2.6", | ||
"babel-loader": "8.0.0-beta.6", | ||
"@babel/cli": "7.0.0", | ||
"@babel/core": "7.0.0", | ||
"@babel/plugin-proposal-class-properties": "7.0.0", | ||
"@babel/preset-env": "7.0.0", | ||
"@babel/preset-react": "7.0.0", | ||
"babel-eslint": "9.0.0", | ||
"babel-loader": "8.0.0", | ||
"css-loader": "1.0.0", | ||
@@ -61,9 +61,9 @@ "eslint": "5.4.0", | ||
"react-dom": "16.4.2", | ||
"reshake": "1.1.4", | ||
"reshake": "1.1.5", | ||
"rimraf": "2.6.2", | ||
"style-loader": "0.22.1", | ||
"styled-components": "3.4.4", | ||
"style-loader": "0.23.0", | ||
"styled-components": "3.4.5", | ||
"webpack": "4.17.1", | ||
"webpack-cli": "3.1.0", | ||
"webpack-dev-server": "3.1.5" | ||
"webpack-dev-server": "3.1.6" | ||
}, | ||
@@ -70,0 +70,0 @@ "peerDependencies": { |
@@ -19,9 +19,11 @@ <p align="center"> | ||
``` | ||
npm i --save reactour | ||
npm i --save reactour styled-components | ||
``` | ||
``` | ||
yarn add reactour | ||
yarn add reactour styled-components | ||
``` | ||
<small>From `v1.8.6` [styled-components](https://www.styled-components.com/) it isn't bundled into the package.</small> | ||
### Initialize | ||
@@ -28,0 +30,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
64635
1189
136