ywana-core8 0.1.56 → 0.1.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,13 +1,14 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('material-design-icons-iconfont/dist/material-design-icons.css'), require('react'), require('resumablejs'), require('react-switch'), require('react-notifications-component'), require('react-notifications-component/dist/theme.css'), require('moment'), require('moment-range'), require('moment/locale/es'), require('axios'), require('deep-equal')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'material-design-icons-iconfont/dist/material-design-icons.css', 'react', 'resumablejs', 'react-switch', 'react-notifications-component', 'react-notifications-component/dist/theme.css', 'moment', 'moment-range', 'moment/locale/es', 'axios', 'deep-equal'], factory) :
4
- (global = global || self, factory(global.ywanaCore8 = {}, null, global.react, global.resumablejs, global.reactSwitch, global.reactNotificationsComponent, null, global.moment, global.momentRange, null, global.axios, global.deepEqual));
5
- })(this, (function (exports, materialDesignIcons_css, React, ResumableJS, RSwitch, reactNotificationsComponent, theme_css, moment$1, momentRange, es, axios, equal) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('material-design-icons-iconfont/dist/material-design-icons.css'), require('react'), require('resumablejs'), require('react-switch'), require('react-notifications-component'), require('react-notifications-component/dist/theme.css'), require('framer-motion/dist/framer-motion.cjs'), require('moment'), require('moment-range'), require('moment/locale/es'), require('axios'), require('deep-equal')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'material-design-icons-iconfont/dist/material-design-icons.css', 'react', 'resumablejs', 'react-switch', 'react-notifications-component', 'react-notifications-component/dist/theme.css', 'framer-motion/dist/framer-motion.cjs', 'moment', 'moment-range', 'moment/locale/es', 'axios', 'deep-equal'], factory) :
4
+ (global = global || self, factory(global.ywanaCore8 = {}, null, global.react, global.resumablejs, global.reactSwitch, global.reactNotificationsComponent, null, global.motion, global.moment, global.momentRange, null, global.axios, global.deepEqual));
5
+ })(this, (function (exports, materialDesignIcons_css, React, ResumableJS, RSwitch, reactNotificationsComponent, theme_css, motion, moment$1, momentRange, es, axios, equal) {
6
6
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
7
7
 
8
8
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
9
9
  var ResumableJS__default = /*#__PURE__*/_interopDefaultLegacy(ResumableJS);
10
10
  var RSwitch__default = /*#__PURE__*/_interopDefaultLegacy(RSwitch);
11
+ var motion__default = /*#__PURE__*/_interopDefaultLegacy(motion);
11
12
  var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment$1);
12
13
  var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
13
14
  var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
@@ -3357,6 +3358,8 @@
3357
3358
  var _useState2 = React.useState([]),
3358
3359
  history = _useState2[0],
3359
3360
  setHistory = _useState2[1];
3361
+ var _useState3 = React.useState("left"),
3362
+ setDirection = _useState3[1];
3360
3363
  var isFirstLoad = React.useRef(true);
3361
3364
  React.useEffect(function () {
3362
3365
  var handleHashChange = function handleHashChange() {
@@ -3375,12 +3378,16 @@
3375
3378
  return window.removeEventListener("hashchange", handleHashChange);
3376
3379
  };
3377
3380
  }, [page]);
3378
- var _goto = function _goto(id) {
3381
+ var _goto = function _goto(id, dir) {
3382
+ if (dir === void 0) {
3383
+ dir = "left";
3384
+ }
3379
3385
  if (page) {
3380
3386
  setHistory(function (prev) {
3381
3387
  return [].concat(prev, [page]);
3382
3388
  });
3383
3389
  }
3390
+ setDirection(dir);
3384
3391
  setPage(id);
3385
3392
  window.location.hash = id;
3386
3393
  };
@@ -3390,6 +3397,7 @@
3390
3397
  setHistory(function (prev) {
3391
3398
  return prev.slice(0, -1);
3392
3399
  });
3400
+ setDirection("right");
3393
3401
  setPage(lastPage);
3394
3402
  window.location.hash = lastPage;
3395
3403
  }
@@ -3402,6 +3410,9 @@
3402
3410
  };
3403
3411
  }
3404
3412
 
3413
+ var AnimatePresence = motion__default["default"].AnimatePresence,
3414
+ MotionDiv = motion__default["default"].motion;
3415
+
3405
3416
  /**
3406
3417
  * Site Provider
3407
3418
  */
@@ -3704,7 +3715,8 @@
3704
3715
  var children = _ref8.children,
3705
3716
  init = _ref8.init;
3706
3717
  var context = React.useContext(SiteContext);
3707
- var page = context.page;
3718
+ var page = context.page,
3719
+ direction = context.direction;
3708
3720
  React.useEffect(function () {
3709
3721
  if (init) {
3710
3722
  context["goto"](init);
@@ -3712,9 +3724,32 @@
3712
3724
  context["goto"]("EMPTY");
3713
3725
  }
3714
3726
  }, []);
3715
- return /*#__PURE__*/React__default["default"].createElement("main", null, React__default["default"].Children.toArray(children).filter(function (child) {
3727
+ var currentPage = React__default["default"].Children.toArray(children).filter(function (child) {
3716
3728
  return child.props ? child.props.id === page : false;
3717
- }));
3729
+ });
3730
+ var xOffset = direction === "left" ? 40 : -40;
3731
+ return /*#__PURE__*/React__default["default"].createElement("main", {
3732
+ className: "site-page-container"
3733
+ }, /*#__PURE__*/React__default["default"].createElement(AnimatePresence, {
3734
+ exitBeforeEnter: true
3735
+ }, currentPage && /*#__PURE__*/React__default["default"].createElement(MotionDiv, {
3736
+ key: page,
3737
+ initial: {
3738
+ opacity: 0,
3739
+ x: xOffset
3740
+ },
3741
+ animate: {
3742
+ opacity: 1,
3743
+ x: 0
3744
+ },
3745
+ exit: {
3746
+ opacity: 0,
3747
+ x: -xOffset
3748
+ },
3749
+ transition: {
3750
+ duration: 0.3
3751
+ }
3752
+ }, currentPage)));
3718
3753
  };
3719
3754
 
3720
3755
  /**