@carbon/ibm-products 2.43.0 → 2.43.1-canary.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -118,6 +118,7 @@ var OptionsTile = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
118
118
  paddingTop = _getComputedStyle2.paddingTop,
119
119
  paddingBottom = _getComputedStyle2.paddingBottom,
120
120
  height = _getComputedStyle2.height;
121
+ var animationDuration = Number(carbonMotion.moderate01.replace('ms', ''));
121
122
  var animation = contentRef.current.animate([{
122
123
  paddingTop: paddingTop,
123
124
  paddingBottom: paddingBottom,
@@ -129,14 +130,22 @@ var OptionsTile = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
129
130
  height: 0,
130
131
  opacity: 0
131
132
  }], {
132
- duration: Number(carbonMotion.moderate01.replace('ms', '')),
133
+ duration: animationDuration,
133
134
  easing: carbonMotion.easings.entrance.productive
134
135
  });
135
136
  var callback = function callback() {
136
137
  setIsOpen(false);
137
138
  setClosing(false);
138
139
  };
139
- animation.onfinish = callback;
140
+
141
+ //This is to fix the flicking issue while collapsing.
142
+ //root cause : after the animation is finished , isOpen is still true until onFinish callback is triggered.For that minute duration , collapsed content will again show.
143
+ // To avoid this , isOpen is set to false after the 90% of animation duration.
144
+ setTimeout(function () {
145
+ callback();
146
+ }, animationDuration * 0.9);
147
+
148
+ // animation.onfinish = callback;
140
149
  animation.oncancel = callback;
141
150
  } else {
142
151
  // in case the ref is not set or the user prefers reduced motion, skip the animation
@@ -146,6 +146,7 @@ exports.OptionsTile = /*#__PURE__*/React__default["default"].forwardRef(function
146
146
  paddingTop = _getComputedStyle2.paddingTop,
147
147
  paddingBottom = _getComputedStyle2.paddingBottom,
148
148
  height = _getComputedStyle2.height;
149
+ var animationDuration = Number(carbonMotion__namespace.moderate01.replace('ms', ''));
149
150
  var animation = contentRef.current.animate([{
150
151
  paddingTop: paddingTop,
151
152
  paddingBottom: paddingBottom,
@@ -157,14 +158,22 @@ exports.OptionsTile = /*#__PURE__*/React__default["default"].forwardRef(function
157
158
  height: 0,
158
159
  opacity: 0
159
160
  }], {
160
- duration: Number(carbonMotion__namespace.moderate01.replace('ms', '')),
161
+ duration: animationDuration,
161
162
  easing: carbonMotion__namespace.easings.entrance.productive
162
163
  });
163
164
  var callback = function callback() {
164
165
  setIsOpen(false);
165
166
  setClosing(false);
166
167
  };
167
- animation.onfinish = callback;
168
+
169
+ //This is to fix the flicking issue while collapsing.
170
+ //root cause : after the animation is finished , isOpen is still true until onFinish callback is triggered.For that minute duration , collapsed content will again show.
171
+ // To avoid this , isOpen is set to false after the 90% of animation duration.
172
+ setTimeout(function () {
173
+ callback();
174
+ }, animationDuration * 0.9);
175
+
176
+ // animation.onfinish = callback;
168
177
  animation.oncancel = callback;
169
178
  } else {
170
179
  // in case the ref is not set or the user prefers reduced motion, skip the animation
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/ibm-products",
3
3
  "description": "Carbon for IBM Products",
4
- "version": "2.43.0",
4
+ "version": "2.43.1-canary.0+0be8378ce",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -121,5 +121,5 @@
121
121
  "react": "^16.8.6 || ^17.0.1 || ^18.2.0",
122
122
  "react-dom": "^16.8.6 || ^17.0.1 || ^18.2.0"
123
123
  },
124
- "gitHead": "4deacf2fbc44a543db6141a63a0f4d988900a0c5"
124
+ "gitHead": "0be8378ceeec3aa2c9af5495dbb8f9fa636bc237"
125
125
  }