indicator-ui 0.0.45 → 0.0.47

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) скорости анимации это незаметно (если вы не Флеш).
@@ -10129,6 +10133,12 @@ function SlideTransition({ children, animation, additionStyles, animationOptions
10129
10133
  const lastClientHeight = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(undefined);
10130
10134
  (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {
10131
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
+ }
10132
10142
  }, []);
10133
10143
  const getConfig = (type) => {
10134
10144
  if (type in animationOptions) {
@@ -10138,58 +10148,68 @@ function SlideTransition({ children, animation, additionStyles, animationOptions
10138
10148
  };
10139
10149
  const animateExitDown = () => {
10140
10150
  const animateConfig = getConfig('exit-down');
10141
- const animateDropWrapper = animateDropWrapperRef.current.animate([
10142
- { transform: 'scaleY(1)', transformOrigin: 'bottom' },
10143
- { transform: 'scaleY(0)', transformOrigin: 'bottom' },
10144
- ], animateConfig);
10145
- mainRef.current.animate([
10146
- { transform: 'translateY(0)' },
10147
- { transform: 'translateY(100%)' },
10148
- ], animateConfig);
10149
- animateDropWrapper.finished.then(() => {
10150
- animateDropWrapperRef.current.style.display = `none`;
10151
- });
10151
+ if (animateDropWrapperRef.current && mainRef.current) {
10152
+ animateDropWrapperRef.current.style.display = 'block';
10153
+ const animateDropWrapper = animateDropWrapperRef.current.animate([
10154
+ { transform: 'scaleY(1)', transformOrigin: 'bottom' },
10155
+ { transform: 'scaleY(0)', transformOrigin: 'bottom' },
10156
+ ], animateConfig);
10157
+ mainRef.current.animate([
10158
+ { transform: 'translateY(0)' },
10159
+ { transform: 'translateY(100%)' },
10160
+ ], animateConfig);
10161
+ animateDropWrapper.finished.then(() => {
10162
+ animateDropWrapperRef.current.style.display = `none`;
10163
+ });
10164
+ }
10152
10165
  };
10153
10166
  const animateExitUp = () => {
10154
- const mainHeight = mainRef.current.clientHeight;
10155
- lastClientHeight.current = mainHeight;
10156
10167
  const animateConfig = getConfig('exit-up');
10157
- const animateDropWrapper = animateDropWrapperRef.current.animate([
10158
- { height: `${mainHeight}px` },
10159
- { height: `0` },
10160
- ], animateConfig);
10161
- mainRef.current.animate([
10162
- { transform: 'translateY(0)' },
10163
- { transform: 'translateY(-100%)' },
10164
- ], animateConfig);
10165
- animateDropWrapper.finished.then(() => {
10166
- animateDropWrapperRef.current.style.display = `none`;
10167
- });
10168
+ if (animateDropWrapperRef.current && mainRef.current) {
10169
+ const mainHeight = mainRef.current.clientHeight;
10170
+ animateDropWrapperRef.current.style.display = 'block';
10171
+ lastClientHeight.current = mainHeight;
10172
+ const animateDropWrapper = animateDropWrapperRef.current.animate([
10173
+ { height: `${mainHeight}px` },
10174
+ { height: `0` },
10175
+ ], animateConfig);
10176
+ mainRef.current.animate([
10177
+ { transform: 'translateY(0)' },
10178
+ { transform: 'translateY(-100%)' },
10179
+ ], animateConfig);
10180
+ animateDropWrapper.finished.then(() => {
10181
+ animateDropWrapperRef.current.style.display = `none`;
10182
+ });
10183
+ }
10168
10184
  };
10169
10185
  const animateEnterDown = () => {
10170
10186
  const animateConfig = getConfig('enter-down');
10171
- animateDropWrapperRef.current.style.display = 'block';
10172
- animateDropWrapperRef.current.animate([
10173
- { transform: 'scaleY(0)', transformOrigin: 'bottom', display: 'block' },
10174
- { transform: 'scaleY(1)', transformOrigin: 'bottom' },
10175
- ], animateConfig);
10176
- mainRef.current.animate([
10177
- { transform: 'translateY(100%)' },
10178
- { transform: 'translateY(0)' },
10179
- ], animateConfig);
10187
+ if (animateDropWrapperRef.current && mainRef.current) {
10188
+ animateDropWrapperRef.current.style.display = 'block';
10189
+ animateDropWrapperRef.current.animate([
10190
+ { transform: 'scaleY(0)', transformOrigin: 'bottom', display: 'block' },
10191
+ { transform: 'scaleY(1)', transformOrigin: 'bottom' },
10192
+ ], animateConfig);
10193
+ mainRef.current.animate([
10194
+ { transform: 'translateY(100%)' },
10195
+ { transform: 'translateY(0)' },
10196
+ ], animateConfig);
10197
+ }
10180
10198
  };
10181
10199
  const animateEnterUp = () => {
10182
10200
  const animateConfig = getConfig('enter-up');
10183
- animateDropWrapperRef.current.style.display = 'block';
10184
- const mainHeight = mainRef.current.clientHeight || lastClientHeight.current;
10185
- animateDropWrapperRef.current.animate([
10186
- { height: `0` },
10187
- { height: `${mainHeight}px` },
10188
- ], animateConfig);
10189
- mainRef.current.animate([
10190
- { transform: 'translateY(-100%)' },
10191
- { transform: 'translateY(0)' },
10192
- ], animateConfig);
10201
+ if (animateDropWrapperRef.current && mainRef.current) {
10202
+ animateDropWrapperRef.current.style.display = 'block';
10203
+ const mainHeight = mainRef.current.clientHeight || lastClientHeight.current;
10204
+ animateDropWrapperRef.current.animate([
10205
+ { height: `0` },
10206
+ { height: `${mainHeight}px` },
10207
+ ], animateConfig);
10208
+ mainRef.current.animate([
10209
+ { transform: 'translateY(-100%)' },
10210
+ { transform: 'translateY(0)' },
10211
+ ], animateConfig);
10212
+ }
10193
10213
  };
10194
10214
  (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {
10195
10215
  switch (animation) {