indicator-ui 0.1.35 → 0.1.37

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.js CHANGED
@@ -55469,12 +55469,99 @@ var FADE_IN_ANIMATION = function FADE_IN_ANIMATION() {
55469
55469
  disappearMain: disappearMain
55470
55470
  };
55471
55471
  };
55472
+ var FADE_IN_FROM_TARGET_ANIMATION = function FADE_IN_FROM_TARGET_ANIMATION() {
55473
+ var appear = function appear(props, timeline) {
55474
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
55475
+ var modal = props.modal,
55476
+ targetCenter = props.targetCenter,
55477
+ backdrop = props.backdrop,
55478
+ predictPos = props.predictPos,
55479
+ modalSize = props.modalSize;
55480
+ var _options$backdropColo4 = options.backdropColor,
55481
+ backdropColor = _options$backdropColo4 === void 0 ? BACKDROP_BACKGROUND_COLOR : _options$backdropColo4,
55482
+ _options$zIndex4 = options.zIndex,
55483
+ zIndex = _options$zIndex4 === void 0 ? {} : _options$zIndex4;
55484
+ var _zIndex$modal4 = zIndex.modal,
55485
+ modalZIndex = _zIndex$modal4 === void 0 ? Z_INDEX_MODAL_DEFAULT : _zIndex$modal4,
55486
+ _zIndex$backdrop4 = zIndex.backdrop,
55487
+ backdropZIndex = _zIndex$backdrop4 === void 0 ? Z_INDEX_BACKDROP_DEFAULT : _zIndex$backdrop4;
55488
+ var startPositionX = targetCenter[0] - predictPos[0] - modalSize[0] / 2;
55489
+ var startPositionY = targetCenter[1] - predictPos[1] - modalSize[1] / 2;
55490
+ timeline.set(modal, {
55491
+ visibility: 'visible',
55492
+ left: predictPos[0],
55493
+ top: predictPos[1],
55494
+ x: startPositionX,
55495
+ y: startPositionY,
55496
+ zIndex: modalZIndex,
55497
+ opacity: 0,
55498
+ scale: 0.1
55499
+ }).set(backdrop, {
55500
+ visibility: 'visible',
55501
+ backgroundColor: backdropColor,
55502
+ opacity: 0,
55503
+ zIndex: backdropZIndex
55504
+ }).to(modal, {
55505
+ opacity: 1,
55506
+ scale: 1,
55507
+ duration: 0.3,
55508
+ x: 0,
55509
+ y: 0,
55510
+ ease: 'power2.out'
55511
+ }).to(backdrop, {
55512
+ opacity: 1,
55513
+ duration: 0.3,
55514
+ ease: 'power2.out'
55515
+ }, '<').set(modal, {
55516
+ transform: 'none'
55517
+ });
55518
+ return timeline;
55519
+ };
55520
+ var disappear = function disappear(props, timeline) {
55521
+ var modal = props.modal,
55522
+ backdrop = props.backdrop;
55523
+ timeline.to(modal, {
55524
+ opacity: 0,
55525
+ scale: 0.97,
55526
+ duration: 0.2,
55527
+ ease: 'power2.in'
55528
+ }).to(backdrop, {
55529
+ opacity: 0,
55530
+ duration: 0.2,
55531
+ ease: 'power2.in'
55532
+ }, '<').set(modal, {
55533
+ visibility: 'hidden'
55534
+ }).set(backdrop, {
55535
+ visibility: 'hidden'
55536
+ });
55537
+ return timeline;
55538
+ };
55539
+ var getInitStyle = function getInitStyle() {
55540
+ return {
55541
+ visibility: 'hidden',
55542
+ position: 'fixed'
55543
+ };
55544
+ };
55545
+ var getBackdropInitStyle = function getBackdropInitStyle() {
55546
+ return {
55547
+ position: 'fixed',
55548
+ visibility: 'hidden'
55549
+ };
55550
+ };
55551
+ return {
55552
+ appear: appear,
55553
+ disappear: disappear,
55554
+ getInitStyle: getInitStyle,
55555
+ getBackdropInitStyle: getBackdropInitStyle
55556
+ };
55557
+ };
55472
55558
  var BACKDROP_MODAL_ANIMATIONS = function BACKDROP_MODAL_ANIMATIONS() {
55473
55559
  return {
55474
55560
  'fade-in-scale-up': FADE_IN_SCALE_UP_ANIMATION(),
55475
55561
  'slide-up-fade-in': SLIDE_UP_FADE_IN_ANIMATION(),
55476
55562
  'slide-down-fade-in': SLIDE_DOWN_FADE_IN_ANIMATION(),
55477
- 'fade-in': FADE_IN_ANIMATION()
55563
+ 'fade-in': FADE_IN_ANIMATION(),
55564
+ 'fade-in-from-target': FADE_IN_FROM_TARGET_ANIMATION()
55478
55565
  };
55479
55566
  };
55480
55567
 
@@ -55830,7 +55917,7 @@ __webpack_require__.r(__webpack_exports__);
55830
55917
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
55831
55918
  /* harmony export */ MOVING_ANIMATIONS: () => (/* binding */ MOVING_ANIMATIONS)
55832
55919
  /* harmony export */ });
55833
- var MOVING_DURATION = 0.05;
55920
+ var MOVING_DURATION = 0.1;
55834
55921
  var DEFAULT_ANIMATION = function DEFAULT_ANIMATION() {
55835
55922
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
55836
55923
  args[_key] = arguments[_key];
@@ -55847,7 +55934,7 @@ var DEFAULT_ANIMATION = function DEFAULT_ANIMATION() {
55847
55934
  top: top,
55848
55935
  left: left,
55849
55936
  duration: duration,
55850
- ease: "power2.out"
55937
+ ease: "power3.out"
55851
55938
  });
55852
55939
  return timeline;
55853
55940
  };
@@ -68740,9 +68827,9 @@ __webpack_require__.r(__webpack_exports__);
68740
68827
  /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
68741
68828
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
68742
68829
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
68743
- /* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components */ "./src/ui/MediaViewer/ui/components/index.ts");
68744
- /* harmony import */ var _ui_MediaViewer_styles__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/ui/MediaViewer/styles */ "./src/ui/MediaViewer/styles/index.ts");
68745
- /* harmony import */ var _ui__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/ui */ "./src/ui/index.ts");
68830
+ /* harmony import */ var _ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/ui */ "./src/ui/index.ts");
68831
+ /* harmony import */ var _styles__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../styles */ "./src/ui/MediaViewer/styles/index.ts");
68832
+ /* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components */ "./src/ui/MediaViewer/ui/components/index.ts");
68746
68833
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
68747
68834
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
68748
68835
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
@@ -68754,15 +68841,15 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
68754
68841
 
68755
68842
 
68756
68843
 
68757
- function MediaViewer(_ref) {
68844
+ var MediaViewer = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_1__.forwardRef)(function (props, ref) {
68758
68845
  var _media$curMediaIndex, _media$curMediaIndex2;
68759
- var _ref$media = _ref.media,
68760
- media = _ref$media === void 0 ? [] : _ref$media,
68761
- mediaIndex = _ref.mediaIndex,
68762
- _ref$nearestElementsO = _ref.nearestElementsOnly,
68763
- nearestElementsOnly = _ref$nearestElementsO === void 0 ? true : _ref$nearestElementsO,
68764
- onClose = _ref.onClose;
68765
- var _useState = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(0),
68846
+ var _props$media = props.media,
68847
+ media = _props$media === void 0 ? [] : _props$media,
68848
+ mediaIndex = props.mediaIndex,
68849
+ _props$nearestElement = props.nearestElementsOnly,
68850
+ nearestElementsOnly = _props$nearestElement === void 0 ? true : _props$nearestElement,
68851
+ onClose = props.onClose;
68852
+ var _useState = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(mediaIndex || 0),
68766
68853
  _useState2 = _slicedToArray(_useState, 2),
68767
68854
  curMediaIndex = _useState2[0],
68768
68855
  setCurMediaIndex = _useState2[1];
@@ -68774,15 +68861,15 @@ function MediaViewer(_ref) {
68774
68861
  _useState6 = _slicedToArray(_useState5, 2),
68775
68862
  play = _useState6[0],
68776
68863
  setPlay = _useState6[1];
68777
- var getPrevIndex = function getPrevIndex(curIndex) {
68778
- return curIndex > 0 ? curIndex - 1 : undefined;
68864
+ var hasPrevIndex = function hasPrevIndex(curIndex) {
68865
+ return curIndex > 0;
68779
68866
  };
68780
- var getNextIndex = function getNextIndex(curIndex) {
68781
- return curIndex < media.length - 1 ? curIndex + 1 : undefined;
68867
+ var hasNextIndex = function hasNextIndex(curIndex) {
68868
+ return curIndex < media.length - 1;
68782
68869
  };
68783
68870
  (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () {
68784
68871
  var isValid = mediaIndex != null && mediaIndex >= 0 && mediaIndex < media.length;
68785
- if (mediaIndex !== curMediaIndex && isValid) {
68872
+ if (isValid) {
68786
68873
  setCurMediaIndex(mediaIndex);
68787
68874
  }
68788
68875
  }, [mediaIndex]);
@@ -68821,7 +68908,7 @@ function MediaViewer(_ref) {
68821
68908
  if (item == null || nearestElementsOnly && !isNearestElement(curMediaIndex, idx)) return undefined;
68822
68909
  switch (item.type) {
68823
68910
  case 'video':
68824
- return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components__WEBPACK_IMPORTED_MODULE_2__.VideoViewer, {
68911
+ return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components__WEBPACK_IMPORTED_MODULE_4__.VideoViewer, {
68825
68912
  src: item.src,
68826
68913
  muted: curMediaIndex === idx ? muted : undefined,
68827
68914
  play: curMediaIndex === idx ? play : undefined,
@@ -68830,7 +68917,7 @@ function MediaViewer(_ref) {
68830
68917
  } : undefined
68831
68918
  }, idx);
68832
68919
  case 'image':
68833
- return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components__WEBPACK_IMPORTED_MODULE_2__.ImageViewer, {
68920
+ return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components__WEBPACK_IMPORTED_MODULE_4__.ImageViewer, {
68834
68921
  src: item.src
68835
68922
  }, idx);
68836
68923
  default:
@@ -68838,30 +68925,30 @@ function MediaViewer(_ref) {
68838
68925
  }
68839
68926
  };
68840
68927
  return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
68841
- className: _ui_MediaViewer_styles__WEBPACK_IMPORTED_MODULE_3__.MediaViewerStyle.MediaViewer,
68842
- children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_ui__WEBPACK_IMPORTED_MODULE_4__.Carousel, {
68928
+ className: _styles__WEBPACK_IMPORTED_MODULE_3__.MediaViewerStyle.MediaViewer,
68929
+ children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_ui__WEBPACK_IMPORTED_MODULE_2__.Carousel, {
68843
68930
  activeIndex: curMediaIndex,
68844
68931
  setActiveIndex: setCurMediaIndex,
68845
68932
  children: media.map(function (item, idx) {
68846
68933
  return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", {
68847
- className: _ui_MediaViewer_styles__WEBPACK_IMPORTED_MODULE_3__.MediaViewerStyle.content,
68934
+ className: _styles__WEBPACK_IMPORTED_MODULE_3__.MediaViewerStyle.content,
68848
68935
  children: getContent(item, idx)
68849
68936
  }, idx);
68850
68937
  })
68851
68938
  }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", {
68852
- className: _ui_MediaViewer_styles__WEBPACK_IMPORTED_MODULE_3__.MediaViewerStyle.control,
68853
- children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components__WEBPACK_IMPORTED_MODULE_2__.ControlBar, {
68939
+ className: _styles__WEBPACK_IMPORTED_MODULE_3__.MediaViewerStyle.control,
68940
+ children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components__WEBPACK_IMPORTED_MODULE_4__.ControlBar, {
68854
68941
  muted: muted,
68855
68942
  play: play,
68856
68943
  onPlay: ((_media$curMediaIndex = media[curMediaIndex]) === null || _media$curMediaIndex === void 0 ? void 0 : _media$curMediaIndex.type) === 'video' ? _play : undefined,
68857
68944
  onMute: ((_media$curMediaIndex2 = media[curMediaIndex]) === null || _media$curMediaIndex2 === void 0 ? void 0 : _media$curMediaIndex2.type) === 'video' ? mute : undefined,
68858
- onNext: getNextIndex(curMediaIndex) ? next : undefined,
68859
- onPrev: getPrevIndex(curMediaIndex) ? prev : undefined,
68945
+ onNext: hasNextIndex(curMediaIndex) ? next : undefined,
68946
+ onPrev: hasPrevIndex(curMediaIndex) ? prev : undefined,
68860
68947
  onClose: onClose
68861
68948
  })
68862
68949
  })]
68863
68950
  });
68864
- }
68951
+ });
68865
68952
 
68866
68953
  /***/ }),
68867
68954