ywana-core8 0.1.56 → 0.1.57

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,8 +1,8 @@
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('framer-motion'), 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', 'framer-motion', '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, global.framerMotion, null, global.moment, global.momentRange, null, global.axios, global.deepEqual));
5
+ })(this, (function (exports, materialDesignIcons_css, React, ResumableJS, RSwitch, reactNotificationsComponent, framerMotion, theme_css, 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);
@@ -3357,6 +3357,8 @@
3357
3357
  var _useState2 = React.useState([]),
3358
3358
  history = _useState2[0],
3359
3359
  setHistory = _useState2[1];
3360
+ var _useState3 = React.useState("left"),
3361
+ setDirection = _useState3[1];
3360
3362
  var isFirstLoad = React.useRef(true);
3361
3363
  React.useEffect(function () {
3362
3364
  var handleHashChange = function handleHashChange() {
@@ -3375,12 +3377,16 @@
3375
3377
  return window.removeEventListener("hashchange", handleHashChange);
3376
3378
  };
3377
3379
  }, [page]);
3378
- var _goto = function _goto(id) {
3380
+ var _goto = function _goto(id, dir) {
3381
+ if (dir === void 0) {
3382
+ dir = "left";
3383
+ }
3379
3384
  if (page) {
3380
3385
  setHistory(function (prev) {
3381
3386
  return [].concat(prev, [page]);
3382
3387
  });
3383
3388
  }
3389
+ setDirection(dir);
3384
3390
  setPage(id);
3385
3391
  window.location.hash = id;
3386
3392
  };
@@ -3390,6 +3396,7 @@
3390
3396
  setHistory(function (prev) {
3391
3397
  return prev.slice(0, -1);
3392
3398
  });
3399
+ setDirection("right");
3393
3400
  setPage(lastPage);
3394
3401
  window.location.hash = lastPage;
3395
3402
  }
@@ -3704,7 +3711,8 @@
3704
3711
  var children = _ref8.children,
3705
3712
  init = _ref8.init;
3706
3713
  var context = React.useContext(SiteContext);
3707
- var page = context.page;
3714
+ var page = context.page,
3715
+ direction = context.direction;
3708
3716
  React.useEffect(function () {
3709
3717
  if (init) {
3710
3718
  context["goto"](init);
@@ -3712,9 +3720,32 @@
3712
3720
  context["goto"]("EMPTY");
3713
3721
  }
3714
3722
  }, []);
3715
- return /*#__PURE__*/React__default["default"].createElement("main", null, React__default["default"].Children.toArray(children).filter(function (child) {
3723
+ var currentPage = React__default["default"].Children.toArray(children).filter(function (child) {
3716
3724
  return child.props ? child.props.id === page : false;
3717
- }));
3725
+ });
3726
+ var xOffset = direction === "left" ? 40 : -40;
3727
+ return /*#__PURE__*/React__default["default"].createElement("main", {
3728
+ className: "site-page-container"
3729
+ }, /*#__PURE__*/React__default["default"].createElement(framerMotion.AnimatePresence, {
3730
+ exitBeforeEnter: true
3731
+ }, currentPage && /*#__PURE__*/React__default["default"].createElement(framerMotion.motion.div, {
3732
+ key: page,
3733
+ initial: {
3734
+ opacity: 0,
3735
+ x: xOffset
3736
+ },
3737
+ animate: {
3738
+ opacity: 1,
3739
+ x: 0
3740
+ },
3741
+ exit: {
3742
+ opacity: 0,
3743
+ x: -xOffset
3744
+ },
3745
+ transition: {
3746
+ duration: 0.3
3747
+ }
3748
+ }, currentPage)));
3718
3749
  };
3719
3750
 
3720
3751
  /**