@spaced-out/ui-design-system 0.1.45 → 0.1.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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.1.46](https://github.com/spaced-out/ui-design-system/compare/v0.1.45...v0.1.46) (2023-08-29)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * add delay to clear extras data in use modal ([#140](https://github.com/spaced-out/ui-design-system/issues/140)) ([030c841](https://github.com/spaced-out/ui-design-system/commit/030c84138f2582b8769a8bd249ea1f8a9a125e51))
11
+
5
12
  ### [0.1.45](https://github.com/spaced-out/ui-design-system/compare/v0.1.44...v0.1.45) (2023-08-29)
6
13
 
7
14
 
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.useModal = void 0;
7
7
  var _react = require("react");
8
+ var _motion = require("../../styles/variables/_motion");
8
9
 
9
10
  const useModal = () => {
10
11
  const [isOpen, setIsOpen] = (0, _react.useState)(false);
@@ -16,7 +17,10 @@ const useModal = () => {
16
17
  }, []);
17
18
  const closeModal = () => {
18
19
  setIsOpen(false);
19
- setExtras({});
20
+ // Since the Dialog close uses animation and its duration is motionDurationNormal, we should clear the data after the animation duration for better user experience
21
+ setTimeout(() => {
22
+ setExtras({});
23
+ }, parseInt(_motion.motionDurationNormal));
20
24
  };
21
25
  return {
22
26
  isOpen,
@@ -2,6 +2,8 @@
2
2
 
3
3
  import {useCallback, useState} from 'react';
4
4
 
5
+ import {motionDurationNormal} from '../../styles/variables/_motion';
6
+
5
7
 
6
8
  export type UseModalExtras = {
7
9
  // TODO(Ashwini): Add type for extras
@@ -27,7 +29,10 @@ export const useModal = (): UseModalReturnType => {
27
29
 
28
30
  const closeModal = () => {
29
31
  setIsOpen(false);
30
- setExtras({});
32
+ // Since the Dialog close uses animation and its duration is motionDurationNormal, we should clear the data after the animation duration for better user experience
33
+ setTimeout(() => {
34
+ setExtras({});
35
+ }, parseInt(motionDurationNormal));
31
36
  };
32
37
 
33
38
  return {isOpen, openModal, closeModal, extras};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.1.45",
3
+ "version": "0.1.46",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {