@canonical/react-components 0.51.5 → 0.51.7

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.
@@ -16,6 +16,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
16
16
  */
17
17
 
18
18
  const Textarea = _ref => {
19
+ var _props$value;
19
20
  let {
20
21
  caution,
21
22
  className,
@@ -92,7 +93,7 @@ const Textarea = _ref => {
92
93
  ...style
93
94
  } || style
94
95
  }, props, {
95
- value: props.value || innerValue
96
+ value: (_props$value = props.value) !== null && _props$value !== void 0 ? _props$value : innerValue
96
97
  })));
97
98
  };
98
99
  var _default = exports.default = Textarea;
@@ -73,6 +73,7 @@ export declare const adjustForWindow: (position: Position, fitsWindow: WindowFit
73
73
  * @param positionElementClassName An optional class to apply to the element that wraps the children.
74
74
  * @param tooltipClassName An optional class to apply to the tooltip message element.
75
75
  * @param zIndex The z-index value of the tooltip message element.
76
+ * @param delay Delay in ms after which Tooltip will appear (defaults to 350ms).
76
77
  */
77
78
  declare const Tooltip: ({ autoAdjust, children, className, followMouse, message, position, positionElementClassName, tooltipClassName, zIndex, delay, }: Props) => JSX.Element;
78
79
  export default Tooltip;
@@ -115,6 +115,7 @@ const adjustForWindow = (position, fitsWindow) => {
115
115
  * @param positionElementClassName An optional class to apply to the element that wraps the children.
116
116
  * @param tooltipClassName An optional class to apply to the tooltip message element.
117
117
  * @param zIndex The z-index value of the tooltip message element.
118
+ * @param delay Delay in ms after which Tooltip will appear (defaults to 350ms).
118
119
  */
119
120
  exports.adjustForWindow = adjustForWindow;
120
121
  const Tooltip = _ref => {
@@ -210,9 +211,15 @@ const Tooltip = _ref => {
210
211
  openPortal(e);
211
212
  };
212
213
  const delayedOpenPortal = (0, _react.useCallback)(() => {
214
+ if (isOpen) {
215
+ return;
216
+ }
217
+ if (timer) {
218
+ clearTimeout(timer);
219
+ }
213
220
  const timeout = setTimeout(() => openPortal(), delay);
214
221
  setTimer(timeout);
215
- }, [delay, openPortal]);
222
+ }, [delay, openPortal, timer, isOpen]);
216
223
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, message ? /*#__PURE__*/_react.default.createElement("span", {
217
224
  className: className,
218
225
  onBlur: handleBlur,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonical/react-components",
3
- "version": "0.51.5",
3
+ "version": "0.51.7",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "Huw Wilkins <huw.wilkins@canonical.com>",