@clayui/tooltip 3.106.1 → 3.108.0

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
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.108.0](https://github.com/liferay/clay/compare/v3.107.1...v3.108.0) (2023-12-12)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **@clayui/tooltip:** Fix close tooltip when pressing Escape key ([6f40c16](https://github.com/liferay/clay/commit/6f40c16ad2556a99c839822c1486a2e0b2ee710c))
11
+
12
+ # [3.107.0](https://github.com/liferay/clay/compare/v3.106.1...v3.107.0) (2023-11-27)
13
+
14
+ **Note:** Version bump only for package @clayui/tooltip
15
+
6
16
  ## [3.106.1](https://github.com/liferay/clay/compare/v3.106.0...v3.106.1) (2023-10-26)
7
17
 
8
18
  **Note:** Version bump only for package @clayui/tooltip
@@ -120,6 +120,12 @@ var TooltipProvider = function TooltipProvider(_ref2) {
120
120
  open = _useTooltipState.open;
121
121
 
122
122
  var _useClosestTitle = (0, _useClosestTitle2.useClosestTitle)({
123
+ forceHide: (0, _react.useCallback)(function () {
124
+ dispatch({
125
+ type: 'reset'
126
+ });
127
+ close();
128
+ }, []),
123
129
  onClick: (0, _react.useCallback)(function () {
124
130
  isFocused.current = false;
125
131
  isHovered.current = false;
@@ -134,6 +140,7 @@ var TooltipProvider = function TooltipProvider(_ref2) {
134
140
  }, []),
135
141
  tooltipRef: tooltipRef
136
142
  }),
143
+ forceHide = _useClosestTitle.forceHide,
137
144
  getProps = _useClosestTitle.getProps,
138
145
  onHide = _useClosestTitle.onHide,
139
146
  target = _useClosestTitle.target,
@@ -176,7 +183,7 @@ var TooltipProvider = function TooltipProvider(_ref2) {
176
183
  var handleEsc = function handleEsc(event) {
177
184
  if (isOpen && event.key === _shared.Keys.Esc) {
178
185
  event.stopImmediatePropagation();
179
- onHide();
186
+ forceHide();
180
187
  }
181
188
  };
182
189
 
@@ -4,11 +4,13 @@
4
4
  */
5
5
  import React from 'react';
6
6
  declare type Props = {
7
+ forceHide: () => void;
7
8
  onHide: () => void;
8
9
  onClick: () => void;
9
10
  tooltipRef: React.MutableRefObject<HTMLElement | null>;
10
11
  };
11
12
  export declare function useClosestTitle(props: Props): {
13
+ forceHide: () => void;
12
14
  getProps: (event: React.MouseEvent<HTMLElement, MouseEvent>, hideBrowserTitle: boolean) => {
13
15
  align: string | null;
14
16
  delay: string | null;
@@ -111,6 +111,19 @@ function useClosestTitle(props) {
111
111
  targetRef.current = null;
112
112
  }
113
113
  }, []);
114
+ var forceHide = (0, _react.useCallback)(function () {
115
+ props.forceHide();
116
+
117
+ if (titleNodeRef.current) {
118
+ restoreTitle(titleNodeRef.current);
119
+ titleNodeRef.current = null;
120
+ }
121
+
122
+ if (targetRef.current) {
123
+ targetRef.current.removeEventListener('click', onClick);
124
+ targetRef.current = null;
125
+ }
126
+ }, []);
114
127
  var getProps = (0, _react.useCallback)(function (event, hideBrowserTitle) {
115
128
  if (targetRef.current) {
116
129
  props.onClick();
@@ -145,6 +158,7 @@ function useClosestTitle(props) {
145
158
  }
146
159
  }, []);
147
160
  return {
161
+ forceHide: forceHide,
148
162
  getProps: getProps,
149
163
  onHide: onHide,
150
164
  target: targetRef,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clayui/tooltip",
3
- "version": "3.106.1",
3
+ "version": "3.108.0",
4
4
  "description": "ClayTooltip component",
5
5
  "license": "BSD-3-Clause",
6
6
  "repository": "https://github.com/liferay/clay",
@@ -25,7 +25,7 @@
25
25
  "react"
26
26
  ],
27
27
  "dependencies": {
28
- "@clayui/shared": "^3.106.1",
28
+ "@clayui/shared": "^3.107.0",
29
29
  "classnames": "^2.2.6",
30
30
  "dom-align": "^1.12.2",
31
31
  "warning": "^4.0.3"
@@ -38,5 +38,5 @@
38
38
  "browserslist": [
39
39
  "extends browserslist-config-clay"
40
40
  ],
41
- "gitHead": "b5345687d03988ed7d2409305d394434b9800b34"
41
+ "gitHead": "411bce66d4ea2f3cb1c62428d5347cb18219a051"
42
42
  }