@react-aria/tooltip 3.1.5 → 3.1.8
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/dist/main.js +25 -25
- package/dist/module.js +24 -24
- package/package.json +8 -8
package/dist/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
3
|
-
var $
|
|
4
|
-
var $
|
|
1
|
+
var $aGFp5$reactariautils = require("@react-aria/utils");
|
|
2
|
+
var $aGFp5$reactariainteractions = require("@react-aria/interactions");
|
|
3
|
+
var $aGFp5$react = require("react");
|
|
4
|
+
var $aGFp5$reactariafocus = require("@react-aria/focus");
|
|
5
5
|
|
|
6
6
|
function $parcel$exportWildcard(dest, source) {
|
|
7
7
|
Object.keys(source).forEach(function(key) {
|
|
@@ -22,16 +22,16 @@ function $parcel$exportWildcard(dest, source) {
|
|
|
22
22
|
function $parcel$export(e, n, v, s) {
|
|
23
23
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
24
24
|
}
|
|
25
|
-
var $
|
|
25
|
+
var $199fa2aaa84f20b7$exports = {};
|
|
26
26
|
|
|
27
|
-
$parcel$export($
|
|
27
|
+
$parcel$export($199fa2aaa84f20b7$exports, "useTooltip", () => $199fa2aaa84f20b7$export$1c4b08e0eca38426);
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
function $
|
|
31
|
-
let domProps = $
|
|
30
|
+
function $199fa2aaa84f20b7$export$1c4b08e0eca38426(props, state) {
|
|
31
|
+
let domProps = $aGFp5$reactariautils.filterDOMProps(props, {
|
|
32
32
|
labelable: true
|
|
33
33
|
});
|
|
34
|
-
let { hoverProps: hoverProps } = $
|
|
34
|
+
let { hoverProps: hoverProps } = $aGFp5$reactariainteractions.useHover({
|
|
35
35
|
onHoverStart: ()=>{
|
|
36
36
|
return state === null || state === void 0 ? void 0 : state.open(true);
|
|
37
37
|
},
|
|
@@ -40,33 +40,33 @@ function $ae71bab4cac89edc$export$1c4b08e0eca38426(props, state) {
|
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
return {
|
|
43
|
-
tooltipProps: $
|
|
43
|
+
tooltipProps: $aGFp5$reactariautils.mergeProps(domProps, hoverProps, {
|
|
44
44
|
role: 'tooltip'
|
|
45
45
|
})
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
var $
|
|
50
|
+
var $f017bbc46d58d42a$exports = {};
|
|
51
51
|
|
|
52
|
-
$parcel$export($
|
|
52
|
+
$parcel$export($f017bbc46d58d42a$exports, "useTooltipTrigger", () => $f017bbc46d58d42a$export$a6da6c504e4bba8b);
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
function $
|
|
58
|
+
function $f017bbc46d58d42a$export$a6da6c504e4bba8b(props, state, ref) {
|
|
59
59
|
let { isDisabled: isDisabled , trigger: trigger } = props;
|
|
60
|
-
let tooltipId = $
|
|
61
|
-
let isHovered = $
|
|
62
|
-
let isFocused = $
|
|
60
|
+
let tooltipId = $aGFp5$reactariautils.useId();
|
|
61
|
+
let isHovered = $aGFp5$react.useRef(false);
|
|
62
|
+
let isFocused = $aGFp5$react.useRef(false);
|
|
63
63
|
let handleShow = ()=>{
|
|
64
64
|
if (isHovered.current || isFocused.current) state.open(isFocused.current);
|
|
65
65
|
};
|
|
66
66
|
let handleHide = (immediate)=>{
|
|
67
67
|
if (!isHovered.current && !isFocused.current) state.close(immediate);
|
|
68
68
|
};
|
|
69
|
-
$
|
|
69
|
+
$aGFp5$react.useEffect(()=>{
|
|
70
70
|
let onKeyDown = (e)=>{
|
|
71
71
|
if (ref && ref.current) // Escape after clicking something can give it keyboard focus
|
|
72
72
|
// dismiss tooltip on esc key press
|
|
@@ -90,7 +90,7 @@ function $9005d7c173b7d1c7$export$a6da6c504e4bba8b(props, state, ref) {
|
|
|
90
90
|
// interactions for example, hover will end. When hover is restored after that element disappears,
|
|
91
91
|
// focus moves on for example, then the tooltip will reopen. We check the modality to know if the hover
|
|
92
92
|
// is the result of moving the mouse.
|
|
93
|
-
if ($
|
|
93
|
+
if ($aGFp5$reactariainteractions.getInteractionModality() === 'pointer') isHovered.current = true;
|
|
94
94
|
else isHovered.current = false;
|
|
95
95
|
handleShow();
|
|
96
96
|
};
|
|
@@ -108,7 +108,7 @@ function $9005d7c173b7d1c7$export$a6da6c504e4bba8b(props, state, ref) {
|
|
|
108
108
|
handleHide(true);
|
|
109
109
|
};
|
|
110
110
|
let onFocus = ()=>{
|
|
111
|
-
let isVisible = $
|
|
111
|
+
let isVisible = $aGFp5$reactariainteractions.isFocusVisible();
|
|
112
112
|
if (isVisible) {
|
|
113
113
|
isFocused.current = true;
|
|
114
114
|
handleShow();
|
|
@@ -119,15 +119,15 @@ function $9005d7c173b7d1c7$export$a6da6c504e4bba8b(props, state, ref) {
|
|
|
119
119
|
isHovered.current = false;
|
|
120
120
|
handleHide(true);
|
|
121
121
|
};
|
|
122
|
-
let { hoverProps: hoverProps } = $
|
|
122
|
+
let { hoverProps: hoverProps } = $aGFp5$reactariainteractions.useHover({
|
|
123
123
|
isDisabled: isDisabled,
|
|
124
124
|
onHoverStart: onHoverStart,
|
|
125
125
|
onHoverEnd: onHoverEnd
|
|
126
126
|
});
|
|
127
|
-
let { pressProps: pressProps } = $
|
|
127
|
+
let { pressProps: pressProps } = $aGFp5$reactariainteractions.usePress({
|
|
128
128
|
onPressStart: onPressStart
|
|
129
129
|
});
|
|
130
|
-
let { focusableProps: focusableProps } = $
|
|
130
|
+
let { focusableProps: focusableProps } = $aGFp5$reactariafocus.useFocusable({
|
|
131
131
|
isDisabled: isDisabled,
|
|
132
132
|
onFocus: onFocus,
|
|
133
133
|
onBlur: onBlur
|
|
@@ -135,7 +135,7 @@ function $9005d7c173b7d1c7$export$a6da6c504e4bba8b(props, state, ref) {
|
|
|
135
135
|
return {
|
|
136
136
|
triggerProps: {
|
|
137
137
|
'aria-describedby': state.isOpen ? tooltipId : undefined,
|
|
138
|
-
...$
|
|
138
|
+
...$aGFp5$reactariautils.mergeProps(focusableProps, hoverProps, pressProps)
|
|
139
139
|
},
|
|
140
140
|
tooltipProps: {
|
|
141
141
|
id: tooltipId
|
|
@@ -144,8 +144,8 @@ function $9005d7c173b7d1c7$export$a6da6c504e4bba8b(props, state, ref) {
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
|
|
147
|
-
$parcel$exportWildcard(module.exports, $
|
|
148
|
-
$parcel$exportWildcard(module.exports, $
|
|
147
|
+
$parcel$exportWildcard(module.exports, $199fa2aaa84f20b7$exports);
|
|
148
|
+
$parcel$exportWildcard(module.exports, $f017bbc46d58d42a$exports);
|
|
149
149
|
|
|
150
150
|
|
|
151
151
|
//# sourceMappingURL=main.js.map
|
package/dist/module.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {filterDOMProps as $
|
|
2
|
-
import {useHover as $
|
|
3
|
-
import {useRef as $
|
|
4
|
-
import {useFocusable as $
|
|
1
|
+
import {filterDOMProps as $kgVYN$filterDOMProps, mergeProps as $kgVYN$mergeProps, useId as $kgVYN$useId} from "@react-aria/utils";
|
|
2
|
+
import {useHover as $kgVYN$useHover, getInteractionModality as $kgVYN$getInteractionModality, isFocusVisible as $kgVYN$isFocusVisible, usePress as $kgVYN$usePress} from "@react-aria/interactions";
|
|
3
|
+
import {useRef as $kgVYN$useRef, useEffect as $kgVYN$useEffect} from "react";
|
|
4
|
+
import {useFocusable as $kgVYN$useFocusable} from "@react-aria/focus";
|
|
5
5
|
|
|
6
6
|
function $parcel$export(e, n, v, s) {
|
|
7
7
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
8
8
|
}
|
|
9
|
-
var $
|
|
9
|
+
var $326e436e94273fe1$exports = {};
|
|
10
10
|
|
|
11
|
-
$parcel$export($
|
|
11
|
+
$parcel$export($326e436e94273fe1$exports, "useTooltip", () => $326e436e94273fe1$export$1c4b08e0eca38426);
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
function $
|
|
15
|
-
let domProps = $
|
|
14
|
+
function $326e436e94273fe1$export$1c4b08e0eca38426(props, state) {
|
|
15
|
+
let domProps = $kgVYN$filterDOMProps(props, {
|
|
16
16
|
labelable: true
|
|
17
17
|
});
|
|
18
|
-
let { hoverProps: hoverProps } = $
|
|
18
|
+
let { hoverProps: hoverProps } = $kgVYN$useHover({
|
|
19
19
|
onHoverStart: ()=>{
|
|
20
20
|
return state === null || state === void 0 ? void 0 : state.open(true);
|
|
21
21
|
},
|
|
@@ -24,33 +24,33 @@ function $d9a216fc29ad9bb6$export$1c4b08e0eca38426(props, state) {
|
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
return {
|
|
27
|
-
tooltipProps: $
|
|
27
|
+
tooltipProps: $kgVYN$mergeProps(domProps, hoverProps, {
|
|
28
28
|
role: 'tooltip'
|
|
29
29
|
})
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
var $
|
|
34
|
+
var $4e1b34546679e357$exports = {};
|
|
35
35
|
|
|
36
|
-
$parcel$export($
|
|
36
|
+
$parcel$export($4e1b34546679e357$exports, "useTooltipTrigger", () => $4e1b34546679e357$export$a6da6c504e4bba8b);
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
function $
|
|
42
|
+
function $4e1b34546679e357$export$a6da6c504e4bba8b(props, state, ref) {
|
|
43
43
|
let { isDisabled: isDisabled , trigger: trigger } = props;
|
|
44
|
-
let tooltipId = $
|
|
45
|
-
let isHovered = $
|
|
46
|
-
let isFocused = $
|
|
44
|
+
let tooltipId = $kgVYN$useId();
|
|
45
|
+
let isHovered = $kgVYN$useRef(false);
|
|
46
|
+
let isFocused = $kgVYN$useRef(false);
|
|
47
47
|
let handleShow = ()=>{
|
|
48
48
|
if (isHovered.current || isFocused.current) state.open(isFocused.current);
|
|
49
49
|
};
|
|
50
50
|
let handleHide = (immediate)=>{
|
|
51
51
|
if (!isHovered.current && !isFocused.current) state.close(immediate);
|
|
52
52
|
};
|
|
53
|
-
$
|
|
53
|
+
$kgVYN$useEffect(()=>{
|
|
54
54
|
let onKeyDown = (e)=>{
|
|
55
55
|
if (ref && ref.current) // Escape after clicking something can give it keyboard focus
|
|
56
56
|
// dismiss tooltip on esc key press
|
|
@@ -74,7 +74,7 @@ function $7203085f153208e4$export$a6da6c504e4bba8b(props, state, ref) {
|
|
|
74
74
|
// interactions for example, hover will end. When hover is restored after that element disappears,
|
|
75
75
|
// focus moves on for example, then the tooltip will reopen. We check the modality to know if the hover
|
|
76
76
|
// is the result of moving the mouse.
|
|
77
|
-
if ($
|
|
77
|
+
if ($kgVYN$getInteractionModality() === 'pointer') isHovered.current = true;
|
|
78
78
|
else isHovered.current = false;
|
|
79
79
|
handleShow();
|
|
80
80
|
};
|
|
@@ -92,7 +92,7 @@ function $7203085f153208e4$export$a6da6c504e4bba8b(props, state, ref) {
|
|
|
92
92
|
handleHide(true);
|
|
93
93
|
};
|
|
94
94
|
let onFocus = ()=>{
|
|
95
|
-
let isVisible = $
|
|
95
|
+
let isVisible = $kgVYN$isFocusVisible();
|
|
96
96
|
if (isVisible) {
|
|
97
97
|
isFocused.current = true;
|
|
98
98
|
handleShow();
|
|
@@ -103,15 +103,15 @@ function $7203085f153208e4$export$a6da6c504e4bba8b(props, state, ref) {
|
|
|
103
103
|
isHovered.current = false;
|
|
104
104
|
handleHide(true);
|
|
105
105
|
};
|
|
106
|
-
let { hoverProps: hoverProps } = $
|
|
106
|
+
let { hoverProps: hoverProps } = $kgVYN$useHover({
|
|
107
107
|
isDisabled: isDisabled,
|
|
108
108
|
onHoverStart: onHoverStart,
|
|
109
109
|
onHoverEnd: onHoverEnd
|
|
110
110
|
});
|
|
111
|
-
let { pressProps: pressProps } = $
|
|
111
|
+
let { pressProps: pressProps } = $kgVYN$usePress({
|
|
112
112
|
onPressStart: onPressStart
|
|
113
113
|
});
|
|
114
|
-
let { focusableProps: focusableProps } = $
|
|
114
|
+
let { focusableProps: focusableProps } = $kgVYN$useFocusable({
|
|
115
115
|
isDisabled: isDisabled,
|
|
116
116
|
onFocus: onFocus,
|
|
117
117
|
onBlur: onBlur
|
|
@@ -119,7 +119,7 @@ function $7203085f153208e4$export$a6da6c504e4bba8b(props, state, ref) {
|
|
|
119
119
|
return {
|
|
120
120
|
triggerProps: {
|
|
121
121
|
'aria-describedby': state.isOpen ? tooltipId : undefined,
|
|
122
|
-
...$
|
|
122
|
+
...$kgVYN$mergeProps(focusableProps, hoverProps, pressProps)
|
|
123
123
|
},
|
|
124
124
|
tooltipProps: {
|
|
125
125
|
id: tooltipId
|
|
@@ -130,5 +130,5 @@ function $7203085f153208e4$export$a6da6c504e4bba8b(props, state, ref) {
|
|
|
130
130
|
|
|
131
131
|
|
|
132
132
|
|
|
133
|
-
export {$
|
|
133
|
+
export {$326e436e94273fe1$export$1c4b08e0eca38426 as useTooltip, $4e1b34546679e357$export$a6da6c504e4bba8b as useTooltipTrigger};
|
|
134
134
|
//# sourceMappingURL=module.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/tooltip",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.8",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@babel/runtime": "^7.6.2",
|
|
21
|
-
"@react-aria/focus": "^3.5.
|
|
22
|
-
"@react-aria/interactions": "^3.8.
|
|
23
|
-
"@react-aria/utils": "^3.
|
|
24
|
-
"@react-stately/tooltip": "^3.0.
|
|
25
|
-
"@react-types/shared": "^3.
|
|
26
|
-
"@react-types/tooltip": "^3.1.
|
|
21
|
+
"@react-aria/focus": "^3.5.5",
|
|
22
|
+
"@react-aria/interactions": "^3.8.4",
|
|
23
|
+
"@react-aria/utils": "^3.12.0",
|
|
24
|
+
"@react-stately/tooltip": "^3.0.9",
|
|
25
|
+
"@react-types/shared": "^3.12.0",
|
|
26
|
+
"@react-types/tooltip": "^3.1.6"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"react": "^16.8.0 || ^17.0.0-rc.1"
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "6a503b715e0dbbf92038cd7f08b1bcdde4c78e82"
|
|
35
35
|
}
|