@react-aria/tooltip 3.0.0-nightly.1393 → 3.0.0-nightly.1400
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 $i8XfT$reactariautils = require("@react-aria/utils");
|
|
2
|
+
var $i8XfT$reactariainteractions = require("@react-aria/interactions");
|
|
3
|
+
var $i8XfT$react = require("react");
|
|
4
|
+
var $i8XfT$reactariafocus = require("@react-aria/focus");
|
|
5
5
|
|
|
6
6
|
function $parcel$exportWildcard(dest, source) {
|
|
7
7
|
Object.keys(source).forEach(function(key) {
|
|
@@ -22,48 +22,48 @@ 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 $ee9e5c4a26dbd5fe$exports = {};
|
|
26
26
|
|
|
27
|
-
$parcel$export($
|
|
27
|
+
$parcel$export($ee9e5c4a26dbd5fe$exports, "useTooltip", () => $ee9e5c4a26dbd5fe$export$1c4b08e0eca38426);
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
function $
|
|
31
|
-
let domProps = $
|
|
30
|
+
function $ee9e5c4a26dbd5fe$export$1c4b08e0eca38426(props, state) {
|
|
31
|
+
let domProps = $i8XfT$reactariautils.filterDOMProps(props, {
|
|
32
32
|
labelable: true
|
|
33
33
|
});
|
|
34
|
-
let { hoverProps: hoverProps } = $
|
|
34
|
+
let { hoverProps: hoverProps } = $i8XfT$reactariainteractions.useHover({
|
|
35
35
|
onHoverStart: ()=>state?.open(true)
|
|
36
36
|
,
|
|
37
37
|
onHoverEnd: ()=>state?.close()
|
|
38
38
|
});
|
|
39
39
|
return {
|
|
40
|
-
tooltipProps: $
|
|
40
|
+
tooltipProps: $i8XfT$reactariautils.mergeProps(domProps, hoverProps, {
|
|
41
41
|
role: 'tooltip'
|
|
42
42
|
})
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
var $
|
|
47
|
+
var $2dec65ceb6e1926a$exports = {};
|
|
48
48
|
|
|
49
|
-
$parcel$export($
|
|
49
|
+
$parcel$export($2dec65ceb6e1926a$exports, "useTooltipTrigger", () => $2dec65ceb6e1926a$export$a6da6c504e4bba8b);
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
|
|
55
|
-
function $
|
|
55
|
+
function $2dec65ceb6e1926a$export$a6da6c504e4bba8b(props, state, ref) {
|
|
56
56
|
let { isDisabled: isDisabled , trigger: trigger } = props;
|
|
57
|
-
let tooltipId = $
|
|
58
|
-
let isHovered = $
|
|
59
|
-
let isFocused = $
|
|
57
|
+
let tooltipId = $i8XfT$reactariautils.useId();
|
|
58
|
+
let isHovered = $i8XfT$react.useRef(false);
|
|
59
|
+
let isFocused = $i8XfT$react.useRef(false);
|
|
60
60
|
let handleShow = ()=>{
|
|
61
61
|
if (isHovered.current || isFocused.current) state.open(isFocused.current);
|
|
62
62
|
};
|
|
63
63
|
let handleHide = (immediate)=>{
|
|
64
64
|
if (!isHovered.current && !isFocused.current) state.close(immediate);
|
|
65
65
|
};
|
|
66
|
-
$
|
|
66
|
+
$i8XfT$react.useEffect(()=>{
|
|
67
67
|
let onKeyDown = (e)=>{
|
|
68
68
|
if (ref && ref.current) // Escape after clicking something can give it keyboard focus
|
|
69
69
|
// dismiss tooltip on esc key press
|
|
@@ -87,7 +87,7 @@ function $00f8d3b0502bc716$export$a6da6c504e4bba8b(props, state, ref) {
|
|
|
87
87
|
// interactions for example, hover will end. When hover is restored after that element disappears,
|
|
88
88
|
// focus moves on for example, then the tooltip will reopen. We check the modality to know if the hover
|
|
89
89
|
// is the result of moving the mouse.
|
|
90
|
-
if ($
|
|
90
|
+
if ($i8XfT$reactariainteractions.getInteractionModality() === 'pointer') isHovered.current = true;
|
|
91
91
|
else isHovered.current = false;
|
|
92
92
|
handleShow();
|
|
93
93
|
};
|
|
@@ -105,7 +105,7 @@ function $00f8d3b0502bc716$export$a6da6c504e4bba8b(props, state, ref) {
|
|
|
105
105
|
handleHide(true);
|
|
106
106
|
};
|
|
107
107
|
let onFocus = ()=>{
|
|
108
|
-
let isVisible = $
|
|
108
|
+
let isVisible = $i8XfT$reactariainteractions.isFocusVisible();
|
|
109
109
|
if (isVisible) {
|
|
110
110
|
isFocused.current = true;
|
|
111
111
|
handleShow();
|
|
@@ -116,15 +116,15 @@ function $00f8d3b0502bc716$export$a6da6c504e4bba8b(props, state, ref) {
|
|
|
116
116
|
isHovered.current = false;
|
|
117
117
|
handleHide(true);
|
|
118
118
|
};
|
|
119
|
-
let { hoverProps: hoverProps } = $
|
|
119
|
+
let { hoverProps: hoverProps } = $i8XfT$reactariainteractions.useHover({
|
|
120
120
|
isDisabled: isDisabled,
|
|
121
121
|
onHoverStart: onHoverStart,
|
|
122
122
|
onHoverEnd: onHoverEnd
|
|
123
123
|
});
|
|
124
|
-
let { pressProps: pressProps } = $
|
|
124
|
+
let { pressProps: pressProps } = $i8XfT$reactariainteractions.usePress({
|
|
125
125
|
onPressStart: onPressStart
|
|
126
126
|
});
|
|
127
|
-
let { focusableProps: focusableProps } = $
|
|
127
|
+
let { focusableProps: focusableProps } = $i8XfT$reactariafocus.useFocusable({
|
|
128
128
|
isDisabled: isDisabled,
|
|
129
129
|
onFocus: onFocus,
|
|
130
130
|
onBlur: onBlur
|
|
@@ -132,7 +132,7 @@ function $00f8d3b0502bc716$export$a6da6c504e4bba8b(props, state, ref) {
|
|
|
132
132
|
return {
|
|
133
133
|
triggerProps: {
|
|
134
134
|
'aria-describedby': state.isOpen ? tooltipId : undefined,
|
|
135
|
-
...$
|
|
135
|
+
...$i8XfT$reactariautils.mergeProps(focusableProps, hoverProps, pressProps)
|
|
136
136
|
},
|
|
137
137
|
tooltipProps: {
|
|
138
138
|
id: tooltipId
|
|
@@ -141,8 +141,8 @@ function $00f8d3b0502bc716$export$a6da6c504e4bba8b(props, state, ref) {
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
|
|
144
|
-
$parcel$exportWildcard(module.exports, $
|
|
145
|
-
$parcel$exportWildcard(module.exports, $
|
|
144
|
+
$parcel$exportWildcard(module.exports, $ee9e5c4a26dbd5fe$exports);
|
|
145
|
+
$parcel$exportWildcard(module.exports, $2dec65ceb6e1926a$exports);
|
|
146
146
|
|
|
147
147
|
|
|
148
148
|
//# sourceMappingURL=main.js.map
|
package/dist/module.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import {filterDOMProps as $
|
|
2
|
-
import {useHover as $
|
|
3
|
-
import {useRef as $
|
|
4
|
-
import {useFocusable as $
|
|
1
|
+
import {filterDOMProps as $f5fb1$filterDOMProps, mergeProps as $f5fb1$mergeProps, useId as $f5fb1$useId} from "@react-aria/utils";
|
|
2
|
+
import {useHover as $f5fb1$useHover, getInteractionModality as $f5fb1$getInteractionModality, isFocusVisible as $f5fb1$isFocusVisible, usePress as $f5fb1$usePress} from "@react-aria/interactions";
|
|
3
|
+
import {useRef as $f5fb1$useRef, useEffect as $f5fb1$useEffect} from "react";
|
|
4
|
+
import {useFocusable as $f5fb1$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 $a3378f049123a239$exports = {};
|
|
10
10
|
|
|
11
|
-
$parcel$export($
|
|
11
|
+
$parcel$export($a3378f049123a239$exports, "useTooltip", () => $a3378f049123a239$export$1c4b08e0eca38426);
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
function $
|
|
15
|
-
let domProps = $
|
|
14
|
+
function $a3378f049123a239$export$1c4b08e0eca38426(props, state) {
|
|
15
|
+
let domProps = $f5fb1$filterDOMProps(props, {
|
|
16
16
|
labelable: true
|
|
17
17
|
});
|
|
18
|
-
let { hoverProps: hoverProps } = $
|
|
18
|
+
let { hoverProps: hoverProps } = $f5fb1$useHover({
|
|
19
19
|
onHoverStart: ()=>state?.open(true)
|
|
20
20
|
,
|
|
21
21
|
onHoverEnd: ()=>state?.close()
|
|
22
22
|
});
|
|
23
23
|
return {
|
|
24
|
-
tooltipProps: $
|
|
24
|
+
tooltipProps: $f5fb1$mergeProps(domProps, hoverProps, {
|
|
25
25
|
role: 'tooltip'
|
|
26
26
|
})
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
var $
|
|
31
|
+
var $c2d8fb326b9f06da$exports = {};
|
|
32
32
|
|
|
33
|
-
$parcel$export($
|
|
33
|
+
$parcel$export($c2d8fb326b9f06da$exports, "useTooltipTrigger", () => $c2d8fb326b9f06da$export$a6da6c504e4bba8b);
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
function $
|
|
39
|
+
function $c2d8fb326b9f06da$export$a6da6c504e4bba8b(props, state, ref) {
|
|
40
40
|
let { isDisabled: isDisabled , trigger: trigger } = props;
|
|
41
|
-
let tooltipId = $
|
|
42
|
-
let isHovered = $
|
|
43
|
-
let isFocused = $
|
|
41
|
+
let tooltipId = $f5fb1$useId();
|
|
42
|
+
let isHovered = $f5fb1$useRef(false);
|
|
43
|
+
let isFocused = $f5fb1$useRef(false);
|
|
44
44
|
let handleShow = ()=>{
|
|
45
45
|
if (isHovered.current || isFocused.current) state.open(isFocused.current);
|
|
46
46
|
};
|
|
47
47
|
let handleHide = (immediate)=>{
|
|
48
48
|
if (!isHovered.current && !isFocused.current) state.close(immediate);
|
|
49
49
|
};
|
|
50
|
-
$
|
|
50
|
+
$f5fb1$useEffect(()=>{
|
|
51
51
|
let onKeyDown = (e)=>{
|
|
52
52
|
if (ref && ref.current) // Escape after clicking something can give it keyboard focus
|
|
53
53
|
// dismiss tooltip on esc key press
|
|
@@ -71,7 +71,7 @@ function $02108e8ead3ca17c$export$a6da6c504e4bba8b(props, state, ref) {
|
|
|
71
71
|
// interactions for example, hover will end. When hover is restored after that element disappears,
|
|
72
72
|
// focus moves on for example, then the tooltip will reopen. We check the modality to know if the hover
|
|
73
73
|
// is the result of moving the mouse.
|
|
74
|
-
if ($
|
|
74
|
+
if ($f5fb1$getInteractionModality() === 'pointer') isHovered.current = true;
|
|
75
75
|
else isHovered.current = false;
|
|
76
76
|
handleShow();
|
|
77
77
|
};
|
|
@@ -89,7 +89,7 @@ function $02108e8ead3ca17c$export$a6da6c504e4bba8b(props, state, ref) {
|
|
|
89
89
|
handleHide(true);
|
|
90
90
|
};
|
|
91
91
|
let onFocus = ()=>{
|
|
92
|
-
let isVisible = $
|
|
92
|
+
let isVisible = $f5fb1$isFocusVisible();
|
|
93
93
|
if (isVisible) {
|
|
94
94
|
isFocused.current = true;
|
|
95
95
|
handleShow();
|
|
@@ -100,15 +100,15 @@ function $02108e8ead3ca17c$export$a6da6c504e4bba8b(props, state, ref) {
|
|
|
100
100
|
isHovered.current = false;
|
|
101
101
|
handleHide(true);
|
|
102
102
|
};
|
|
103
|
-
let { hoverProps: hoverProps } = $
|
|
103
|
+
let { hoverProps: hoverProps } = $f5fb1$useHover({
|
|
104
104
|
isDisabled: isDisabled,
|
|
105
105
|
onHoverStart: onHoverStart,
|
|
106
106
|
onHoverEnd: onHoverEnd
|
|
107
107
|
});
|
|
108
|
-
let { pressProps: pressProps } = $
|
|
108
|
+
let { pressProps: pressProps } = $f5fb1$usePress({
|
|
109
109
|
onPressStart: onPressStart
|
|
110
110
|
});
|
|
111
|
-
let { focusableProps: focusableProps } = $
|
|
111
|
+
let { focusableProps: focusableProps } = $f5fb1$useFocusable({
|
|
112
112
|
isDisabled: isDisabled,
|
|
113
113
|
onFocus: onFocus,
|
|
114
114
|
onBlur: onBlur
|
|
@@ -116,7 +116,7 @@ function $02108e8ead3ca17c$export$a6da6c504e4bba8b(props, state, ref) {
|
|
|
116
116
|
return {
|
|
117
117
|
triggerProps: {
|
|
118
118
|
'aria-describedby': state.isOpen ? tooltipId : undefined,
|
|
119
|
-
...$
|
|
119
|
+
...$f5fb1$mergeProps(focusableProps, hoverProps, pressProps)
|
|
120
120
|
},
|
|
121
121
|
tooltipProps: {
|
|
122
122
|
id: tooltipId
|
|
@@ -127,5 +127,5 @@ function $02108e8ead3ca17c$export$a6da6c504e4bba8b(props, state, ref) {
|
|
|
127
127
|
|
|
128
128
|
|
|
129
129
|
|
|
130
|
-
export {$
|
|
130
|
+
export {$a3378f049123a239$export$1c4b08e0eca38426 as useTooltip, $c2d8fb326b9f06da$export$a6da6c504e4bba8b as useTooltipTrigger};
|
|
131
131
|
//# sourceMappingURL=module.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/tooltip",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.1400+2815eea07",
|
|
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.0.0-nightly.
|
|
22
|
-
"@react-aria/interactions": "3.0.0-nightly.
|
|
23
|
-
"@react-aria/utils": "3.0.0-nightly.
|
|
24
|
-
"@react-stately/tooltip": "3.0.6-nightly.
|
|
25
|
-
"@react-types/shared": "3.0.0-nightly.
|
|
26
|
-
"@react-types/tooltip": "3.1.3-nightly.
|
|
21
|
+
"@react-aria/focus": "3.0.0-nightly.1400+2815eea07",
|
|
22
|
+
"@react-aria/interactions": "3.0.0-nightly.1400+2815eea07",
|
|
23
|
+
"@react-aria/utils": "3.0.0-nightly.1400+2815eea07",
|
|
24
|
+
"@react-stately/tooltip": "3.0.6-nightly.3091+2815eea07",
|
|
25
|
+
"@react-types/shared": "3.0.0-nightly.1400+2815eea07",
|
|
26
|
+
"@react-types/tooltip": "3.1.3-nightly.3091+2815eea07"
|
|
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": "2815eea077010e5490ff9df3c5d79fa1588ca689"
|
|
35
35
|
}
|