@atlaskit/smart-card 26.6.2 → 26.6.3

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
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 26.6.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`fc0fa5ca4e7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fc0fa5ca4e7) - [ux] Fix for a hover card issue introduced in 25.6.17
8
+
3
9
  ## 26.6.2
4
10
 
5
11
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.6.2",
3
+ "version": "26.6.3",
4
4
  "sideEffects": false
5
5
  }
@@ -71,9 +71,15 @@ var HoverCardComponent = function HoverCardComponent(_ref) {
71
71
  var initHideCard = (0, _react2.useCallback)(function () {
72
72
  if (fadeInTimeoutId.current) {
73
73
  clearTimeout(fadeInTimeoutId.current);
74
+ // because fadeInTimeoutId.current is set by mouseOver which triggers multiple times in a hover,
75
+ // we want to clear out the reference to signify that there's no in-progress fade in event
76
+ fadeInTimeoutId.current = undefined;
74
77
  }
75
78
  if (resolveTimeOutId.current) {
76
79
  clearTimeout(resolveTimeOutId.current);
80
+ // because resolveTimeOutId.current is set by mouseOver which triggers multiple times in a hover,
81
+ // we want to clear out the reference to signify that there's no in-progress resolve event
82
+ resolveTimeOutId.current = undefined;
77
83
  }
78
84
  fadeOutTimeoutId.current = setTimeout(function () {
79
85
  return hideCard();
@@ -89,9 +95,15 @@ var HoverCardComponent = function HoverCardComponent(_ref) {
89
95
  }
90
96
  if (fadeInTimeoutId.current) {
91
97
  clearTimeout(fadeInTimeoutId.current);
98
+ // because fadeInTimeoutId.current is set by mouseOver which triggers multiple times in a hover,
99
+ // we want to clear out the reference to signify that there's no in-progress fade in event
100
+ fadeInTimeoutId.current = undefined;
92
101
  }
93
102
  if (resolveTimeOutId.current) {
94
103
  clearTimeout(resolveTimeOutId.current);
104
+ // because resolveTimeOutId.current is set by mouseOver which triggers multiple times in a hover,
105
+ // we want to clear out the reference to signify that there's no in-progress resolve event
106
+ resolveTimeOutId.current = undefined;
95
107
  }
96
108
  };
97
109
  }, []);
@@ -108,13 +120,18 @@ var HoverCardComponent = function HoverCardComponent(_ref) {
108
120
  }
109
121
  }, [linkState, loadMetadata]);
110
122
  var initShowCard = (0, _react2.useCallback)(function (event) {
123
+ // clearing out fadeOutTimeoutId in case it's already counting down to hide the card
111
124
  if (fadeOutTimeoutId.current) {
112
125
  clearTimeout(fadeOutTimeoutId.current);
113
126
  }
127
+
128
+ // starting to resolve the hover card if the store doesn't have data about the link yet
114
129
  initResolve();
130
+
115
131
  //Set mouse position in the case it's not already set by onMouseMove, as in the case of scrolling
116
132
  setMousePosition(event);
117
- if (!isOpen) {
133
+ if (!isOpen && !fadeInTimeoutId.current) {
134
+ // setting a timeout to show a Hover Card after delay runs out
118
135
  fadeInTimeoutId.current = setTimeout(function () {
119
136
  //If these are undefined then popupOffset is undefined and we fallback to default bottom-start placement
120
137
  if (parentSpan.current && mousePos.current) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.6.2",
3
+ "version": "26.6.3",
4
4
  "sideEffects": false
5
5
  }
@@ -53,9 +53,15 @@ export const HoverCardComponent = ({
53
53
  const initHideCard = useCallback(() => {
54
54
  if (fadeInTimeoutId.current) {
55
55
  clearTimeout(fadeInTimeoutId.current);
56
+ // because fadeInTimeoutId.current is set by mouseOver which triggers multiple times in a hover,
57
+ // we want to clear out the reference to signify that there's no in-progress fade in event
58
+ fadeInTimeoutId.current = undefined;
56
59
  }
57
60
  if (resolveTimeOutId.current) {
58
61
  clearTimeout(resolveTimeOutId.current);
62
+ // because resolveTimeOutId.current is set by mouseOver which triggers multiple times in a hover,
63
+ // we want to clear out the reference to signify that there's no in-progress resolve event
64
+ resolveTimeOutId.current = undefined;
59
65
  }
60
66
  fadeOutTimeoutId.current = setTimeout(() => hideCard(), delay);
61
67
  }, [hideCard]);
@@ -69,9 +75,15 @@ export const HoverCardComponent = ({
69
75
  }
70
76
  if (fadeInTimeoutId.current) {
71
77
  clearTimeout(fadeInTimeoutId.current);
78
+ // because fadeInTimeoutId.current is set by mouseOver which triggers multiple times in a hover,
79
+ // we want to clear out the reference to signify that there's no in-progress fade in event
80
+ fadeInTimeoutId.current = undefined;
72
81
  }
73
82
  if (resolveTimeOutId.current) {
74
83
  clearTimeout(resolveTimeOutId.current);
84
+ // because resolveTimeOutId.current is set by mouseOver which triggers multiple times in a hover,
85
+ // we want to clear out the reference to signify that there's no in-progress resolve event
86
+ resolveTimeOutId.current = undefined;
75
87
  }
76
88
  };
77
89
  }, []);
@@ -88,13 +100,18 @@ export const HoverCardComponent = ({
88
100
  }
89
101
  }, [linkState, loadMetadata]);
90
102
  const initShowCard = useCallback(event => {
103
+ // clearing out fadeOutTimeoutId in case it's already counting down to hide the card
91
104
  if (fadeOutTimeoutId.current) {
92
105
  clearTimeout(fadeOutTimeoutId.current);
93
106
  }
107
+
108
+ // starting to resolve the hover card if the store doesn't have data about the link yet
94
109
  initResolve();
110
+
95
111
  //Set mouse position in the case it's not already set by onMouseMove, as in the case of scrolling
96
112
  setMousePosition(event);
97
- if (!isOpen) {
113
+ if (!isOpen && !fadeInTimeoutId.current) {
114
+ // setting a timeout to show a Hover Card after delay runs out
98
115
  fadeInTimeoutId.current = setTimeout(() => {
99
116
  //If these are undefined then popupOffset is undefined and we fallback to default bottom-start placement
100
117
  if (parentSpan.current && mousePos.current) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.6.2",
3
+ "version": "26.6.3",
4
4
  "sideEffects": false
5
5
  }
@@ -60,9 +60,15 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
60
60
  var initHideCard = useCallback(function () {
61
61
  if (fadeInTimeoutId.current) {
62
62
  clearTimeout(fadeInTimeoutId.current);
63
+ // because fadeInTimeoutId.current is set by mouseOver which triggers multiple times in a hover,
64
+ // we want to clear out the reference to signify that there's no in-progress fade in event
65
+ fadeInTimeoutId.current = undefined;
63
66
  }
64
67
  if (resolveTimeOutId.current) {
65
68
  clearTimeout(resolveTimeOutId.current);
69
+ // because resolveTimeOutId.current is set by mouseOver which triggers multiple times in a hover,
70
+ // we want to clear out the reference to signify that there's no in-progress resolve event
71
+ resolveTimeOutId.current = undefined;
66
72
  }
67
73
  fadeOutTimeoutId.current = setTimeout(function () {
68
74
  return hideCard();
@@ -78,9 +84,15 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
78
84
  }
79
85
  if (fadeInTimeoutId.current) {
80
86
  clearTimeout(fadeInTimeoutId.current);
87
+ // because fadeInTimeoutId.current is set by mouseOver which triggers multiple times in a hover,
88
+ // we want to clear out the reference to signify that there's no in-progress fade in event
89
+ fadeInTimeoutId.current = undefined;
81
90
  }
82
91
  if (resolveTimeOutId.current) {
83
92
  clearTimeout(resolveTimeOutId.current);
93
+ // because resolveTimeOutId.current is set by mouseOver which triggers multiple times in a hover,
94
+ // we want to clear out the reference to signify that there's no in-progress resolve event
95
+ resolveTimeOutId.current = undefined;
84
96
  }
85
97
  };
86
98
  }, []);
@@ -97,13 +109,18 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
97
109
  }
98
110
  }, [linkState, loadMetadata]);
99
111
  var initShowCard = useCallback(function (event) {
112
+ // clearing out fadeOutTimeoutId in case it's already counting down to hide the card
100
113
  if (fadeOutTimeoutId.current) {
101
114
  clearTimeout(fadeOutTimeoutId.current);
102
115
  }
116
+
117
+ // starting to resolve the hover card if the store doesn't have data about the link yet
103
118
  initResolve();
119
+
104
120
  //Set mouse position in the case it's not already set by onMouseMove, as in the case of scrolling
105
121
  setMousePosition(event);
106
- if (!isOpen) {
122
+ if (!isOpen && !fadeInTimeoutId.current) {
123
+ // setting a timeout to show a Hover Card after delay runs out
107
124
  fadeInTimeoutId.current = setTimeout(function () {
108
125
  //If these are undefined then popupOffset is undefined and we fallback to default bottom-start placement
109
126
  if (parentSpan.current && mousePos.current) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.6.2",
3
+ "version": "26.6.3",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"