indicator-ui 0.0.44 → 0.0.46

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
@@ -10119,6 +10119,10 @@ __webpack_require__.r(__webpack_exports__);
10119
10119
  *
10120
10120
  * ```'exit-up'``` - производит анимацию скрытия сверху.
10121
10121
  *
10122
+ * ```'hide'``` - изначально скрывает элемент.
10123
+ *
10124
+ * ```'show'``` - изначально показывает элемент.
10125
+ *
10122
10126
  * ---
10123
10127
  * Учтите, что анимации **"снизу"** сужают компонент, поэтому он будет деформироваться.
10124
10128
  * При высокой (автор проводил тесты на 300ms) скорости анимации это незаметно (если вы не Флеш).
@@ -10126,6 +10130,16 @@ __webpack_require__.r(__webpack_exports__);
10126
10130
  function SlideTransition({ children, animation, additionStyles, animationOptions = { duration: 300, easing: 'ease-in-out', fill: 'forwards' } }) {
10127
10131
  const mainRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
10128
10132
  const animateDropWrapperRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
10133
+ const lastClientHeight = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(undefined);
10134
+ (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {
10135
+ lastClientHeight.current = mainRef.current.clientHeight;
10136
+ if (animation === 'hide') {
10137
+ animateDropWrapperRef.current.style.display = 'none';
10138
+ }
10139
+ else if (animation === 'show') {
10140
+ animateDropWrapperRef.current.style.display = 'block';
10141
+ }
10142
+ }, []);
10129
10143
  const getConfig = (type) => {
10130
10144
  if (type in animationOptions) {
10131
10145
  return animationOptions[type];
@@ -10134,29 +10148,39 @@ function SlideTransition({ children, animation, additionStyles, animationOptions
10134
10148
  };
10135
10149
  const animateExitDown = () => {
10136
10150
  const animateConfig = getConfig('exit-down');
10137
- animateDropWrapperRef.current.animate([
10151
+ animateDropWrapperRef.current.style.display = 'block';
10152
+ const animateDropWrapper = animateDropWrapperRef.current.animate([
10138
10153
  { transform: 'scaleY(1)', transformOrigin: 'bottom' },
10139
- { transform: 'scaleY(0)', transformOrigin: 'bottom', display: 'none' },
10154
+ { transform: 'scaleY(0)', transformOrigin: 'bottom' },
10140
10155
  ], animateConfig);
10141
10156
  mainRef.current.animate([
10142
10157
  { transform: 'translateY(0)' },
10143
10158
  { transform: 'translateY(100%)' },
10144
10159
  ], animateConfig);
10160
+ animateDropWrapper.finished.then(() => {
10161
+ animateDropWrapperRef.current.style.display = `none`;
10162
+ });
10145
10163
  };
10146
10164
  const animateExitUp = () => {
10147
10165
  const mainHeight = mainRef.current.clientHeight;
10166
+ animateDropWrapperRef.current.style.display = 'block';
10167
+ lastClientHeight.current = mainHeight;
10148
10168
  const animateConfig = getConfig('exit-up');
10149
- animateDropWrapperRef.current.animate([
10169
+ const animateDropWrapper = animateDropWrapperRef.current.animate([
10150
10170
  { height: `${mainHeight}px` },
10151
- { height: `0`, display: 'none' },
10171
+ { height: `0` },
10152
10172
  ], animateConfig);
10153
10173
  mainRef.current.animate([
10154
10174
  { transform: 'translateY(0)' },
10155
10175
  { transform: 'translateY(-100%)' },
10156
10176
  ], animateConfig);
10177
+ animateDropWrapper.finished.then(() => {
10178
+ animateDropWrapperRef.current.style.display = `none`;
10179
+ });
10157
10180
  };
10158
10181
  const animateEnterDown = () => {
10159
- const animateConfig = getConfig('exit-down');
10182
+ const animateConfig = getConfig('enter-down');
10183
+ animateDropWrapperRef.current.style.display = 'block';
10160
10184
  animateDropWrapperRef.current.animate([
10161
10185
  { transform: 'scaleY(0)', transformOrigin: 'bottom', display: 'block' },
10162
10186
  { transform: 'scaleY(1)', transformOrigin: 'bottom' },
@@ -10167,10 +10191,11 @@ function SlideTransition({ children, animation, additionStyles, animationOptions
10167
10191
  ], animateConfig);
10168
10192
  };
10169
10193
  const animateEnterUp = () => {
10170
- const mainHeight = mainRef.current.clientHeight;
10171
- const animateConfig = getConfig('exit-up');
10194
+ const animateConfig = getConfig('enter-up');
10195
+ animateDropWrapperRef.current.style.display = 'block';
10196
+ const mainHeight = mainRef.current.clientHeight || lastClientHeight.current;
10172
10197
  animateDropWrapperRef.current.animate([
10173
- { height: `0`, display: 'block' },
10198
+ { height: `0` },
10174
10199
  { height: `${mainHeight}px` },
10175
10200
  ], animateConfig);
10176
10201
  mainRef.current.animate([