@react-spectrum/tooltip 3.8.1 → 3.9.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/dist/import.mjs +2 -4
- package/dist/main.js +3 -5
- package/dist/main.js.map +1 -1
- package/dist/module.js +2 -4
- package/dist/module.js.map +1 -1
- package/dist/types/src/index.d.ts +2 -0
- package/package.json +12 -35
- package/src/index.ts +3 -3
- package/dist/Tooltip.main.js +0 -80
- package/dist/Tooltip.main.js.map +0 -1
- package/dist/Tooltip.mjs +0 -75
- package/dist/Tooltip.module.js +0 -75
- package/dist/Tooltip.module.js.map +0 -1
- package/dist/TooltipTrigger.main.js +0 -125
- package/dist/TooltipTrigger.main.js.map +0 -1
- package/dist/TooltipTrigger.mjs +0 -116
- package/dist/TooltipTrigger.module.js +0 -116
- package/dist/TooltipTrigger.module.js.map +0 -1
- package/dist/context.main.js +0 -29
- package/dist/context.main.js.map +0 -1
- package/dist/context.mjs +0 -20
- package/dist/context.module.js +0 -20
- package/dist/context.module.js.map +0 -1
- package/dist/tooltip.3b6f471c.css +0 -321
- package/dist/tooltip.3b6f471c.css.map +0 -1
- package/dist/tooltip_vars_css.main.js +0 -107
- package/dist/tooltip_vars_css.main.js.map +0 -1
- package/dist/tooltip_vars_css.mjs +0 -109
- package/dist/tooltip_vars_css.module.js +0 -109
- package/dist/tooltip_vars_css.module.js.map +0 -1
- package/dist/types.d.ts +0 -16
- package/dist/types.d.ts.map +0 -1
- package/src/Tooltip.tsx +0 -83
- package/src/TooltipTrigger.tsx +0 -131
- package/src/context.ts +0 -26
package/dist/import.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {Tooltip as $
|
|
2
|
-
import {TooltipTrigger as $019364e6919ef1db$export$8c610744efcf8a1d} from "./TooltipTrigger.mjs";
|
|
1
|
+
import {Tooltip as $66ac4065204003ff$re_export$Tooltip, TooltipTrigger as $66ac4065204003ff$re_export$TooltipTrigger} from "@adobe/react-spectrum/Tooltip";
|
|
3
2
|
|
|
4
3
|
/*
|
|
5
4
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -15,6 +14,5 @@ import {TooltipTrigger as $019364e6919ef1db$export$8c610744efcf8a1d} from "./Too
|
|
|
15
14
|
|
|
16
15
|
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
export {$dc9e2a6f9971fb04$export$28c660c63b792dea as Tooltip, $019364e6919ef1db$export$8c610744efcf8a1d as TooltipTrigger};
|
|
17
|
+
export {$66ac4065204003ff$re_export$Tooltip as Tooltip, $66ac4065204003ff$re_export$TooltipTrigger as TooltipTrigger};
|
|
20
18
|
//# sourceMappingURL=module.js.map
|
package/dist/main.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $19f06480c1c1a932$exports = require("./TooltipTrigger.main.js");
|
|
1
|
+
var $kdCyC$adobereactspectrumTooltip = require("@adobe/react-spectrum/Tooltip");
|
|
3
2
|
|
|
4
3
|
|
|
5
4
|
function $parcel$export(e, n, v, s) {
|
|
6
5
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
7
6
|
}
|
|
8
7
|
|
|
9
|
-
$parcel$export(module.exports, "Tooltip", ()
|
|
10
|
-
$parcel$export(module.exports, "TooltipTrigger", ()
|
|
8
|
+
$parcel$export(module.exports, "Tooltip", function () { return $kdCyC$adobereactspectrumTooltip.Tooltip; });
|
|
9
|
+
$parcel$export(module.exports, "TooltipTrigger", function () { return $kdCyC$adobereactspectrumTooltip.TooltipTrigger; });
|
|
11
10
|
/*
|
|
12
11
|
* Copyright 2020 Adobe. All rights reserved.
|
|
13
12
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -22,5 +21,4 @@ $parcel$export(module.exports, "TooltipTrigger", () => $19f06480c1c1a932$exports
|
|
|
22
21
|
|
|
23
22
|
|
|
24
23
|
|
|
25
|
-
|
|
26
24
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,0CAA0C","sources":["packages/@react-spectrum/tooltip/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport {Tooltip, TooltipTrigger} from '@adobe/react-spectrum/Tooltip';\n\nexport type {SpectrumTooltipProps, SpectrumTooltipTriggerProps} from '@adobe/react-spectrum/Tooltip';\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {Tooltip as $
|
|
2
|
-
import {TooltipTrigger as $019364e6919ef1db$export$8c610744efcf8a1d} from "./TooltipTrigger.module.js";
|
|
1
|
+
import {Tooltip as $66ac4065204003ff$re_export$Tooltip, TooltipTrigger as $66ac4065204003ff$re_export$TooltipTrigger} from "@adobe/react-spectrum/Tooltip";
|
|
3
2
|
|
|
4
3
|
/*
|
|
5
4
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -15,6 +14,5 @@ import {TooltipTrigger as $019364e6919ef1db$export$8c610744efcf8a1d} from "./Too
|
|
|
15
14
|
|
|
16
15
|
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
export {$dc9e2a6f9971fb04$export$28c660c63b792dea as Tooltip, $019364e6919ef1db$export$8c610744efcf8a1d as TooltipTrigger};
|
|
17
|
+
export {$66ac4065204003ff$re_export$Tooltip as Tooltip, $66ac4065204003ff$re_export$TooltipTrigger as TooltipTrigger};
|
|
20
18
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;CAUC,GAED,0CAA0C","sources":["packages/@react-spectrum/tooltip/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport {Tooltip, TooltipTrigger} from '@adobe/react-spectrum/Tooltip';\n\nexport type {SpectrumTooltipProps, SpectrumTooltipTriggerProps} from '@adobe/react-spectrum/Tooltip';\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/tooltip",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"module": "dist/module.js",
|
|
8
8
|
"exports": {
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
"./dist/types.d.ts",
|
|
12
|
-
"./
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
9
|
+
".": {
|
|
10
|
+
"source": "./src/index.ts",
|
|
11
|
+
"types": "./dist/types/src/index.d.ts",
|
|
12
|
+
"import": "./dist/import.mjs",
|
|
13
|
+
"require": "./dist/main.js"
|
|
14
|
+
},
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
16
|
},
|
|
17
|
-
"types": "dist/types.d.ts",
|
|
17
|
+
"types": "dist/types/src/index.d.ts",
|
|
18
18
|
"source": "src/index.ts",
|
|
19
19
|
"files": [
|
|
20
20
|
"dist",
|
|
@@ -24,45 +24,22 @@
|
|
|
24
24
|
"*.css"
|
|
25
25
|
],
|
|
26
26
|
"targets": {
|
|
27
|
-
"
|
|
28
|
-
"includeNodeModules": [
|
|
29
|
-
"@adobe/spectrum-css-temp"
|
|
30
|
-
]
|
|
31
|
-
},
|
|
32
|
-
"module": {
|
|
33
|
-
"includeNodeModules": [
|
|
34
|
-
"@adobe/spectrum-css-temp"
|
|
35
|
-
]
|
|
36
|
-
}
|
|
27
|
+
"types": false
|
|
37
28
|
},
|
|
38
29
|
"repository": {
|
|
39
30
|
"type": "git",
|
|
40
31
|
"url": "https://github.com/adobe/react-spectrum"
|
|
41
32
|
},
|
|
42
33
|
"dependencies": {
|
|
43
|
-
"@react-
|
|
44
|
-
"@react-aria/overlays": "^3.31.1",
|
|
45
|
-
"@react-aria/tooltip": "^3.9.1",
|
|
46
|
-
"@react-aria/utils": "^3.33.0",
|
|
47
|
-
"@react-spectrum/overlays": "^5.9.2",
|
|
48
|
-
"@react-spectrum/utils": "^3.12.11",
|
|
49
|
-
"@react-stately/tooltip": "^3.5.10",
|
|
50
|
-
"@react-types/overlays": "^3.9.3",
|
|
51
|
-
"@react-types/shared": "^3.33.0",
|
|
52
|
-
"@react-types/tooltip": "^3.5.1",
|
|
53
|
-
"@spectrum-icons/ui": "^3.6.22",
|
|
34
|
+
"@adobe/react-spectrum": "3.47.0",
|
|
54
35
|
"@swc/helpers": "^0.5.0"
|
|
55
36
|
},
|
|
56
|
-
"devDependencies": {
|
|
57
|
-
"@adobe/spectrum-css-temp": "3.0.0-alpha.1"
|
|
58
|
-
},
|
|
59
37
|
"peerDependencies": {
|
|
60
|
-
"@react-spectrum/provider": "^3.0.0",
|
|
61
38
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
|
|
62
39
|
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
|
|
63
40
|
},
|
|
64
41
|
"publishConfig": {
|
|
65
42
|
"access": "public"
|
|
66
43
|
},
|
|
67
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "a6999bdf494a2e9c0381a5881908328bdd22ddae"
|
|
68
45
|
}
|
package/src/index.ts
CHANGED
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
|
|
13
13
|
/// <reference types="css-module-types" />
|
|
14
14
|
|
|
15
|
-
export {Tooltip} from '
|
|
16
|
-
|
|
17
|
-
export type {SpectrumTooltipProps, SpectrumTooltipTriggerProps} from '@react-
|
|
15
|
+
export {Tooltip, TooltipTrigger} from '@adobe/react-spectrum/Tooltip';
|
|
16
|
+
|
|
17
|
+
export type {SpectrumTooltipProps, SpectrumTooltipTriggerProps} from '@adobe/react-spectrum/Tooltip';
|
package/dist/Tooltip.main.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
require("./tooltip.3b6f471c.css");
|
|
2
|
-
var $ba73465d6d9b6556$exports = require("./tooltip_vars_css.main.js");
|
|
3
|
-
var $ed2e56c8503433b4$exports = require("./context.main.js");
|
|
4
|
-
var $l0Ry0$spectrumiconsuiAlertSmall = require("@spectrum-icons/ui/AlertSmall");
|
|
5
|
-
var $l0Ry0$reactspectrumutils = require("@react-spectrum/utils");
|
|
6
|
-
var $l0Ry0$spectrumiconsuiInfoSmall = require("@spectrum-icons/ui/InfoSmall");
|
|
7
|
-
var $l0Ry0$reactariautils = require("@react-aria/utils");
|
|
8
|
-
var $l0Ry0$react = require("react");
|
|
9
|
-
var $l0Ry0$spectrumiconsuiSuccessSmall = require("@spectrum-icons/ui/SuccessSmall");
|
|
10
|
-
var $l0Ry0$reactariatooltip = require("@react-aria/tooltip");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function $parcel$interopDefault(a) {
|
|
14
|
-
return a && a.__esModule ? a.default : a;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function $parcel$export(e, n, v, s) {
|
|
18
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
$parcel$export(module.exports, "Tooltip", () => $55bd11986fcffc6f$export$28c660c63b792dea);
|
|
22
|
-
/*
|
|
23
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
24
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
25
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
26
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
27
|
-
*
|
|
28
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
29
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
30
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
31
|
-
* governing permissions and limitations under the License.
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
let $55bd11986fcffc6f$var$iconMap = {
|
|
42
|
-
info: (0, ($parcel$interopDefault($l0Ry0$spectrumiconsuiInfoSmall))),
|
|
43
|
-
positive: (0, ($parcel$interopDefault($l0Ry0$spectrumiconsuiSuccessSmall))),
|
|
44
|
-
negative: (0, ($parcel$interopDefault($l0Ry0$spectrumiconsuiAlertSmall)))
|
|
45
|
-
};
|
|
46
|
-
const $55bd11986fcffc6f$export$28c660c63b792dea = /*#__PURE__*/ (0, ($parcel$interopDefault($l0Ry0$react))).forwardRef(function Tooltip(props, ref) {
|
|
47
|
-
let { ref: overlayRef, arrowProps: arrowProps, state: state, arrowRef: arrowRef, ...tooltipProviderProps } = (0, $l0Ry0$react.useContext)((0, $ed2e56c8503433b4$exports.TooltipContext));
|
|
48
|
-
let defaultRef = (0, $l0Ry0$react.useRef)(null);
|
|
49
|
-
overlayRef = overlayRef || defaultRef;
|
|
50
|
-
let backupPlacement = props.placement;
|
|
51
|
-
props = (0, $l0Ry0$reactariautils.mergeProps)(props, tooltipProviderProps);
|
|
52
|
-
let { variant: variant = 'neutral', placement: placement, isOpen: isOpen, showIcon: showIcon, ...otherProps } = props;
|
|
53
|
-
if (placement == null) placement = backupPlacement !== null && backupPlacement !== void 0 ? backupPlacement : 'top';
|
|
54
|
-
let { styleProps: styleProps } = (0, $l0Ry0$reactspectrumutils.useStyleProps)(otherProps);
|
|
55
|
-
let { tooltipProps: tooltipProps } = (0, $l0Ry0$reactariatooltip.useTooltip)(props, state);
|
|
56
|
-
// Sync ref with overlayRef from context.
|
|
57
|
-
(0, $l0Ry0$react.useImperativeHandle)(ref, ()=>(0, $l0Ry0$reactspectrumutils.createDOMRef)(overlayRef));
|
|
58
|
-
let Icon = $55bd11986fcffc6f$var$iconMap[variant];
|
|
59
|
-
return /*#__PURE__*/ (0, ($parcel$interopDefault($l0Ry0$react))).createElement("div", {
|
|
60
|
-
...styleProps,
|
|
61
|
-
...tooltipProps,
|
|
62
|
-
className: (0, $l0Ry0$reactspectrumutils.classNames)((0, ($parcel$interopDefault($ba73465d6d9b6556$exports))), 'spectrum-Tooltip', `spectrum-Tooltip--${variant}`, `spectrum-Tooltip--${placement}`, {
|
|
63
|
-
'is-open': isOpen,
|
|
64
|
-
[`is-open--${placement}`]: isOpen
|
|
65
|
-
}, styleProps.className),
|
|
66
|
-
ref: overlayRef
|
|
67
|
-
}, showIcon && variant !== 'neutral' && /*#__PURE__*/ (0, ($parcel$interopDefault($l0Ry0$react))).createElement(Icon, {
|
|
68
|
-
UNSAFE_className: (0, $l0Ry0$reactspectrumutils.classNames)((0, ($parcel$interopDefault($ba73465d6d9b6556$exports))), 'spectrum-Tooltip-typeIcon'),
|
|
69
|
-
"aria-hidden": true
|
|
70
|
-
}), props.children && /*#__PURE__*/ (0, ($parcel$interopDefault($l0Ry0$react))).createElement("span", {
|
|
71
|
-
className: (0, $l0Ry0$reactspectrumutils.classNames)((0, ($parcel$interopDefault($ba73465d6d9b6556$exports))), 'spectrum-Tooltip-label')
|
|
72
|
-
}, props.children), /*#__PURE__*/ (0, ($parcel$interopDefault($l0Ry0$react))).createElement("span", {
|
|
73
|
-
...arrowProps,
|
|
74
|
-
ref: arrowRef,
|
|
75
|
-
className: (0, $l0Ry0$reactspectrumutils.classNames)((0, ($parcel$interopDefault($ba73465d6d9b6556$exports))), 'spectrum-Tooltip-tip')
|
|
76
|
-
}));
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
//# sourceMappingURL=Tooltip.main.js.map
|
package/dist/Tooltip.main.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AAcD,IAAI,gCAAU;IACZ,MAAM,CAAA,GAAA,yDAAQ;IACd,UAAU,CAAA,GAAA,4DAAW;IACrB,UAAU,CAAA,GAAA,0DAAS;AACrB;AAKO,MAAM,0DAAU,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,SAAS,QAAQ,KAA2B,EAAE,GAAW;IAC/F,IAAI,EAAC,KAAK,UAAU,cAAE,UAAU,SAAE,KAAK,YAAE,QAAQ,EAAE,GAAG,sBAAqB,GAAG,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,wCAAa;IACtG,IAAI,aAAa,CAAA,GAAA,mBAAK,EAAE;IACxB,aAAa,cAAc;IAC3B,IAAI,kBAAkB,MAAM,SAAS;IACrC,QAAQ,CAAA,GAAA,gCAAS,EAAE,OAAO;IAC1B,IAAI,WACF,UAAU,sBACV,SAAS,UACT,MAAM,YACN,QAAQ,EACR,GAAG,YACJ,GAAG;IACJ,IAAI,aAAa,MACf,YAAY,4BAAA,6BAAA,kBAAmB;IAEjC,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAY,EAAE;IACjC,IAAI,gBAAC,YAAY,EAAC,GAAG,CAAA,GAAA,kCAAS,EAAE,OAAO;IAEvC,yCAAyC;IACzC,CAAA,GAAA,gCAAkB,EAAE,KAAK,IAAM,CAAA,GAAA,sCAAW,EAAE;IAE5C,IAAI,OAAO,6BAAO,CAAC,QAAQ;IAE3B,qBACE,0DAAC;QACE,GAAG,UAAU;QACb,GAAG,YAAY;QAChB,WAAW,CAAA,GAAA,oCAAS,EAClB,CAAA,GAAA,mDAAK,GACL,oBACA,CAAC,kBAAkB,EAAE,SAAS,EAC9B,CAAC,kBAAkB,EAAE,WAAW,EAChC;YACE,WAAW;YACX,CAAC,CAAC,SAAS,EAAE,WAAW,CAAC,EAAE;QAC7B,GACA,WAAW,SAAS;QAEtB,KAAK;OACJ,YAAY,YAAY,2BAAa,0DAAC;QAAK,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QAA8B,eAAA;QAC9G,MAAM,QAAQ,kBACb,0DAAC;QAAK,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OACjC,MAAM,QAAQ,iBAGnB,0DAAC;QAAM,GAAG,UAAU;QAAE,KAAK;QAAU,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;;AAGzE","sources":["packages/@react-spectrum/tooltip/src/Tooltip.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport AlertSmall from '@spectrum-icons/ui/AlertSmall';\nimport {classNames, createDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef} from '@react-types/shared';\nimport InfoSmall from '@spectrum-icons/ui/InfoSmall';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {useContext, useImperativeHandle, useRef} from 'react';\nimport {SpectrumTooltipProps} from '@react-types/tooltip';\nimport styles from '@adobe/spectrum-css-temp/components/tooltip/vars.css';\nimport SuccessSmall from '@spectrum-icons/ui/SuccessSmall';\nimport {TooltipContext} from './context';\nimport {useTooltip} from '@react-aria/tooltip';\n\nlet iconMap = {\n info: InfoSmall,\n positive: SuccessSmall,\n negative: AlertSmall\n};\n\n/**\n * Display container for Tooltip content. Has a directional arrow dependent on its placement.\n */\nexport const Tooltip = React.forwardRef(function Tooltip(props: SpectrumTooltipProps, ref: DOMRef) {\n let {ref: overlayRef, arrowProps, state, arrowRef, ...tooltipProviderProps} = useContext(TooltipContext);\n let defaultRef = useRef(null);\n overlayRef = overlayRef || defaultRef;\n let backupPlacement = props.placement;\n props = mergeProps(props, tooltipProviderProps);\n let {\n variant = 'neutral',\n placement,\n isOpen,\n showIcon,\n ...otherProps\n } = props;\n if (placement == null) {\n placement = backupPlacement ?? 'top';\n }\n let {styleProps} = useStyleProps(otherProps);\n let {tooltipProps} = useTooltip(props, state);\n\n // Sync ref with overlayRef from context.\n useImperativeHandle(ref, () => createDOMRef(overlayRef));\n\n let Icon = iconMap[variant];\n\n return (\n <div\n {...styleProps}\n {...tooltipProps}\n className={classNames(\n styles,\n 'spectrum-Tooltip',\n `spectrum-Tooltip--${variant}`,\n `spectrum-Tooltip--${placement}`,\n {\n 'is-open': isOpen,\n [`is-open--${placement}`]: isOpen\n },\n styleProps.className\n )}\n ref={overlayRef}>\n {showIcon && variant !== 'neutral' && <Icon UNSAFE_className={classNames(styles, 'spectrum-Tooltip-typeIcon')} aria-hidden />}\n {props.children && (\n <span className={classNames(styles, 'spectrum-Tooltip-label')}>\n {props.children}\n </span>\n )}\n <span {...arrowProps} ref={arrowRef} className={classNames(styles, 'spectrum-Tooltip-tip')} />\n </div>\n );\n});\n"],"names":[],"version":3,"file":"Tooltip.main.js.map"}
|
package/dist/Tooltip.mjs
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import "./tooltip.3b6f471c.css";
|
|
2
|
-
import $dcNtB$tooltip_vars_cssmodulejs from "./tooltip_vars_css.mjs";
|
|
3
|
-
import {TooltipContext as $b8c00169fae46ac7$export$39ae08fa83328b12} from "./context.mjs";
|
|
4
|
-
import $dcNtB$spectrumiconsuiAlertSmall from "@spectrum-icons/ui/AlertSmall";
|
|
5
|
-
import {useStyleProps as $dcNtB$useStyleProps, createDOMRef as $dcNtB$createDOMRef, classNames as $dcNtB$classNames} from "@react-spectrum/utils";
|
|
6
|
-
import $dcNtB$spectrumiconsuiInfoSmall from "@spectrum-icons/ui/InfoSmall";
|
|
7
|
-
import {mergeProps as $dcNtB$mergeProps} from "@react-aria/utils";
|
|
8
|
-
import $dcNtB$react, {useContext as $dcNtB$useContext, useRef as $dcNtB$useRef, useImperativeHandle as $dcNtB$useImperativeHandle} from "react";
|
|
9
|
-
import $dcNtB$spectrumiconsuiSuccessSmall from "@spectrum-icons/ui/SuccessSmall";
|
|
10
|
-
import {useTooltip as $dcNtB$useTooltip} from "@react-aria/tooltip";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function $parcel$interopDefault(a) {
|
|
14
|
-
return a && a.__esModule ? a.default : a;
|
|
15
|
-
}
|
|
16
|
-
/*
|
|
17
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
18
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
19
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
20
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
-
*
|
|
22
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
23
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
24
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
25
|
-
* governing permissions and limitations under the License.
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
let $dc9e2a6f9971fb04$var$iconMap = {
|
|
36
|
-
info: (0, $dcNtB$spectrumiconsuiInfoSmall),
|
|
37
|
-
positive: (0, $dcNtB$spectrumiconsuiSuccessSmall),
|
|
38
|
-
negative: (0, $dcNtB$spectrumiconsuiAlertSmall)
|
|
39
|
-
};
|
|
40
|
-
const $dc9e2a6f9971fb04$export$28c660c63b792dea = /*#__PURE__*/ (0, $dcNtB$react).forwardRef(function Tooltip(props, ref) {
|
|
41
|
-
let { ref: overlayRef, arrowProps: arrowProps, state: state, arrowRef: arrowRef, ...tooltipProviderProps } = (0, $dcNtB$useContext)((0, $b8c00169fae46ac7$export$39ae08fa83328b12));
|
|
42
|
-
let defaultRef = (0, $dcNtB$useRef)(null);
|
|
43
|
-
overlayRef = overlayRef || defaultRef;
|
|
44
|
-
let backupPlacement = props.placement;
|
|
45
|
-
props = (0, $dcNtB$mergeProps)(props, tooltipProviderProps);
|
|
46
|
-
let { variant: variant = 'neutral', placement: placement, isOpen: isOpen, showIcon: showIcon, ...otherProps } = props;
|
|
47
|
-
if (placement == null) placement = backupPlacement !== null && backupPlacement !== void 0 ? backupPlacement : 'top';
|
|
48
|
-
let { styleProps: styleProps } = (0, $dcNtB$useStyleProps)(otherProps);
|
|
49
|
-
let { tooltipProps: tooltipProps } = (0, $dcNtB$useTooltip)(props, state);
|
|
50
|
-
// Sync ref with overlayRef from context.
|
|
51
|
-
(0, $dcNtB$useImperativeHandle)(ref, ()=>(0, $dcNtB$createDOMRef)(overlayRef));
|
|
52
|
-
let Icon = $dc9e2a6f9971fb04$var$iconMap[variant];
|
|
53
|
-
return /*#__PURE__*/ (0, $dcNtB$react).createElement("div", {
|
|
54
|
-
...styleProps,
|
|
55
|
-
...tooltipProps,
|
|
56
|
-
className: (0, $dcNtB$classNames)((0, ($parcel$interopDefault($dcNtB$tooltip_vars_cssmodulejs))), 'spectrum-Tooltip', `spectrum-Tooltip--${variant}`, `spectrum-Tooltip--${placement}`, {
|
|
57
|
-
'is-open': isOpen,
|
|
58
|
-
[`is-open--${placement}`]: isOpen
|
|
59
|
-
}, styleProps.className),
|
|
60
|
-
ref: overlayRef
|
|
61
|
-
}, showIcon && variant !== 'neutral' && /*#__PURE__*/ (0, $dcNtB$react).createElement(Icon, {
|
|
62
|
-
UNSAFE_className: (0, $dcNtB$classNames)((0, ($parcel$interopDefault($dcNtB$tooltip_vars_cssmodulejs))), 'spectrum-Tooltip-typeIcon'),
|
|
63
|
-
"aria-hidden": true
|
|
64
|
-
}), props.children && /*#__PURE__*/ (0, $dcNtB$react).createElement("span", {
|
|
65
|
-
className: (0, $dcNtB$classNames)((0, ($parcel$interopDefault($dcNtB$tooltip_vars_cssmodulejs))), 'spectrum-Tooltip-label')
|
|
66
|
-
}, props.children), /*#__PURE__*/ (0, $dcNtB$react).createElement("span", {
|
|
67
|
-
...arrowProps,
|
|
68
|
-
ref: arrowRef,
|
|
69
|
-
className: (0, $dcNtB$classNames)((0, ($parcel$interopDefault($dcNtB$tooltip_vars_cssmodulejs))), 'spectrum-Tooltip-tip')
|
|
70
|
-
}));
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
export {$dc9e2a6f9971fb04$export$28c660c63b792dea as Tooltip};
|
|
75
|
-
//# sourceMappingURL=Tooltip.module.js.map
|
package/dist/Tooltip.module.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import "./tooltip.3b6f471c.css";
|
|
2
|
-
import $dcNtB$tooltip_vars_cssmodulejs from "./tooltip_vars_css.module.js";
|
|
3
|
-
import {TooltipContext as $b8c00169fae46ac7$export$39ae08fa83328b12} from "./context.module.js";
|
|
4
|
-
import $dcNtB$spectrumiconsuiAlertSmall from "@spectrum-icons/ui/AlertSmall";
|
|
5
|
-
import {useStyleProps as $dcNtB$useStyleProps, createDOMRef as $dcNtB$createDOMRef, classNames as $dcNtB$classNames} from "@react-spectrum/utils";
|
|
6
|
-
import $dcNtB$spectrumiconsuiInfoSmall from "@spectrum-icons/ui/InfoSmall";
|
|
7
|
-
import {mergeProps as $dcNtB$mergeProps} from "@react-aria/utils";
|
|
8
|
-
import $dcNtB$react, {useContext as $dcNtB$useContext, useRef as $dcNtB$useRef, useImperativeHandle as $dcNtB$useImperativeHandle} from "react";
|
|
9
|
-
import $dcNtB$spectrumiconsuiSuccessSmall from "@spectrum-icons/ui/SuccessSmall";
|
|
10
|
-
import {useTooltip as $dcNtB$useTooltip} from "@react-aria/tooltip";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function $parcel$interopDefault(a) {
|
|
14
|
-
return a && a.__esModule ? a.default : a;
|
|
15
|
-
}
|
|
16
|
-
/*
|
|
17
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
18
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
19
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
20
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
-
*
|
|
22
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
23
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
24
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
25
|
-
* governing permissions and limitations under the License.
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
let $dc9e2a6f9971fb04$var$iconMap = {
|
|
36
|
-
info: (0, $dcNtB$spectrumiconsuiInfoSmall),
|
|
37
|
-
positive: (0, $dcNtB$spectrumiconsuiSuccessSmall),
|
|
38
|
-
negative: (0, $dcNtB$spectrumiconsuiAlertSmall)
|
|
39
|
-
};
|
|
40
|
-
const $dc9e2a6f9971fb04$export$28c660c63b792dea = /*#__PURE__*/ (0, $dcNtB$react).forwardRef(function Tooltip(props, ref) {
|
|
41
|
-
let { ref: overlayRef, arrowProps: arrowProps, state: state, arrowRef: arrowRef, ...tooltipProviderProps } = (0, $dcNtB$useContext)((0, $b8c00169fae46ac7$export$39ae08fa83328b12));
|
|
42
|
-
let defaultRef = (0, $dcNtB$useRef)(null);
|
|
43
|
-
overlayRef = overlayRef || defaultRef;
|
|
44
|
-
let backupPlacement = props.placement;
|
|
45
|
-
props = (0, $dcNtB$mergeProps)(props, tooltipProviderProps);
|
|
46
|
-
let { variant: variant = 'neutral', placement: placement, isOpen: isOpen, showIcon: showIcon, ...otherProps } = props;
|
|
47
|
-
if (placement == null) placement = backupPlacement !== null && backupPlacement !== void 0 ? backupPlacement : 'top';
|
|
48
|
-
let { styleProps: styleProps } = (0, $dcNtB$useStyleProps)(otherProps);
|
|
49
|
-
let { tooltipProps: tooltipProps } = (0, $dcNtB$useTooltip)(props, state);
|
|
50
|
-
// Sync ref with overlayRef from context.
|
|
51
|
-
(0, $dcNtB$useImperativeHandle)(ref, ()=>(0, $dcNtB$createDOMRef)(overlayRef));
|
|
52
|
-
let Icon = $dc9e2a6f9971fb04$var$iconMap[variant];
|
|
53
|
-
return /*#__PURE__*/ (0, $dcNtB$react).createElement("div", {
|
|
54
|
-
...styleProps,
|
|
55
|
-
...tooltipProps,
|
|
56
|
-
className: (0, $dcNtB$classNames)((0, ($parcel$interopDefault($dcNtB$tooltip_vars_cssmodulejs))), 'spectrum-Tooltip', `spectrum-Tooltip--${variant}`, `spectrum-Tooltip--${placement}`, {
|
|
57
|
-
'is-open': isOpen,
|
|
58
|
-
[`is-open--${placement}`]: isOpen
|
|
59
|
-
}, styleProps.className),
|
|
60
|
-
ref: overlayRef
|
|
61
|
-
}, showIcon && variant !== 'neutral' && /*#__PURE__*/ (0, $dcNtB$react).createElement(Icon, {
|
|
62
|
-
UNSAFE_className: (0, $dcNtB$classNames)((0, ($parcel$interopDefault($dcNtB$tooltip_vars_cssmodulejs))), 'spectrum-Tooltip-typeIcon'),
|
|
63
|
-
"aria-hidden": true
|
|
64
|
-
}), props.children && /*#__PURE__*/ (0, $dcNtB$react).createElement("span", {
|
|
65
|
-
className: (0, $dcNtB$classNames)((0, ($parcel$interopDefault($dcNtB$tooltip_vars_cssmodulejs))), 'spectrum-Tooltip-label')
|
|
66
|
-
}, props.children), /*#__PURE__*/ (0, $dcNtB$react).createElement("span", {
|
|
67
|
-
...arrowProps,
|
|
68
|
-
ref: arrowRef,
|
|
69
|
-
className: (0, $dcNtB$classNames)((0, ($parcel$interopDefault($dcNtB$tooltip_vars_cssmodulejs))), 'spectrum-Tooltip-tip')
|
|
70
|
-
}));
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
export {$dc9e2a6f9971fb04$export$28c660c63b792dea as Tooltip};
|
|
75
|
-
//# sourceMappingURL=Tooltip.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AAcD,IAAI,gCAAU;IACZ,MAAM,CAAA,GAAA,+BAAQ;IACd,UAAU,CAAA,GAAA,kCAAW;IACrB,UAAU,CAAA,GAAA,gCAAS;AACrB;AAKO,MAAM,0DAAU,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,QAAQ,KAA2B,EAAE,GAAW;IAC/F,IAAI,EAAC,KAAK,UAAU,cAAE,UAAU,SAAE,KAAK,YAAE,QAAQ,EAAE,GAAG,sBAAqB,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAa;IACtG,IAAI,aAAa,CAAA,GAAA,aAAK,EAAE;IACxB,aAAa,cAAc;IAC3B,IAAI,kBAAkB,MAAM,SAAS;IACrC,QAAQ,CAAA,GAAA,iBAAS,EAAE,OAAO;IAC1B,IAAI,WACF,UAAU,sBACV,SAAS,UACT,MAAM,YACN,QAAQ,EACR,GAAG,YACJ,GAAG;IACJ,IAAI,aAAa,MACf,YAAY,4BAAA,6BAAA,kBAAmB;IAEjC,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,oBAAY,EAAE;IACjC,IAAI,gBAAC,YAAY,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE,OAAO;IAEvC,yCAAyC;IACzC,CAAA,GAAA,0BAAkB,EAAE,KAAK,IAAM,CAAA,GAAA,mBAAW,EAAE;IAE5C,IAAI,OAAO,6BAAO,CAAC,QAAQ;IAE3B,qBACE,gCAAC;QACE,GAAG,UAAU;QACb,GAAG,YAAY;QAChB,WAAW,CAAA,GAAA,iBAAS,EAClB,CAAA,GAAA,yDAAK,GACL,oBACA,CAAC,kBAAkB,EAAE,SAAS,EAC9B,CAAC,kBAAkB,EAAE,WAAW,EAChC;YACE,WAAW;YACX,CAAC,CAAC,SAAS,EAAE,WAAW,CAAC,EAAE;QAC7B,GACA,WAAW,SAAS;QAEtB,KAAK;OACJ,YAAY,YAAY,2BAAa,gCAAC;QAAK,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yDAAK,GAAG;QAA8B,eAAA;QAC9G,MAAM,QAAQ,kBACb,gCAAC;QAAK,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yDAAK,GAAG;OACjC,MAAM,QAAQ,iBAGnB,gCAAC;QAAM,GAAG,UAAU;QAAE,KAAK;QAAU,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yDAAK,GAAG;;AAGzE","sources":["packages/@react-spectrum/tooltip/src/Tooltip.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport AlertSmall from '@spectrum-icons/ui/AlertSmall';\nimport {classNames, createDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef} from '@react-types/shared';\nimport InfoSmall from '@spectrum-icons/ui/InfoSmall';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {useContext, useImperativeHandle, useRef} from 'react';\nimport {SpectrumTooltipProps} from '@react-types/tooltip';\nimport styles from '@adobe/spectrum-css-temp/components/tooltip/vars.css';\nimport SuccessSmall from '@spectrum-icons/ui/SuccessSmall';\nimport {TooltipContext} from './context';\nimport {useTooltip} from '@react-aria/tooltip';\n\nlet iconMap = {\n info: InfoSmall,\n positive: SuccessSmall,\n negative: AlertSmall\n};\n\n/**\n * Display container for Tooltip content. Has a directional arrow dependent on its placement.\n */\nexport const Tooltip = React.forwardRef(function Tooltip(props: SpectrumTooltipProps, ref: DOMRef) {\n let {ref: overlayRef, arrowProps, state, arrowRef, ...tooltipProviderProps} = useContext(TooltipContext);\n let defaultRef = useRef(null);\n overlayRef = overlayRef || defaultRef;\n let backupPlacement = props.placement;\n props = mergeProps(props, tooltipProviderProps);\n let {\n variant = 'neutral',\n placement,\n isOpen,\n showIcon,\n ...otherProps\n } = props;\n if (placement == null) {\n placement = backupPlacement ?? 'top';\n }\n let {styleProps} = useStyleProps(otherProps);\n let {tooltipProps} = useTooltip(props, state);\n\n // Sync ref with overlayRef from context.\n useImperativeHandle(ref, () => createDOMRef(overlayRef));\n\n let Icon = iconMap[variant];\n\n return (\n <div\n {...styleProps}\n {...tooltipProps}\n className={classNames(\n styles,\n 'spectrum-Tooltip',\n `spectrum-Tooltip--${variant}`,\n `spectrum-Tooltip--${placement}`,\n {\n 'is-open': isOpen,\n [`is-open--${placement}`]: isOpen\n },\n styleProps.className\n )}\n ref={overlayRef}>\n {showIcon && variant !== 'neutral' && <Icon UNSAFE_className={classNames(styles, 'spectrum-Tooltip-typeIcon')} aria-hidden />}\n {props.children && (\n <span className={classNames(styles, 'spectrum-Tooltip-label')}>\n {props.children}\n </span>\n )}\n <span {...arrowProps} ref={arrowRef} className={classNames(styles, 'spectrum-Tooltip-tip')} />\n </div>\n );\n});\n"],"names":[],"version":3,"file":"Tooltip.module.js.map"}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
var $ed2e56c8503433b4$exports = require("./context.main.js");
|
|
2
|
-
var $1fBML$reactariafocus = require("@react-aria/focus");
|
|
3
|
-
var $1fBML$reactspectrumoverlays = require("@react-spectrum/overlays");
|
|
4
|
-
var $1fBML$react = require("react");
|
|
5
|
-
var $1fBML$reactariautils = require("@react-aria/utils");
|
|
6
|
-
var $1fBML$reactariaoverlays = require("@react-aria/overlays");
|
|
7
|
-
var $1fBML$reactariatooltip = require("@react-aria/tooltip");
|
|
8
|
-
var $1fBML$reactstatelytooltip = require("@react-stately/tooltip");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function $parcel$interopDefault(a) {
|
|
12
|
-
return a && a.__esModule ? a.default : a;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function $parcel$export(e, n, v, s) {
|
|
16
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
$parcel$export(module.exports, "TooltipTrigger", () => $19f06480c1c1a932$export$8c610744efcf8a1d);
|
|
20
|
-
/*
|
|
21
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
22
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
23
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
24
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
25
|
-
*
|
|
26
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
27
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
28
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
29
|
-
* governing permissions and limitations under the License.
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const $19f06480c1c1a932$var$DEFAULT_OFFSET = -1; // Offset needed to reach 4px/5px (med/large) distance between tooltip and trigger button
|
|
39
|
-
const $19f06480c1c1a932$var$DEFAULT_CROSS_OFFSET = 0;
|
|
40
|
-
const $19f06480c1c1a932$var$DEFAULT_SHOULD_CLOSE_ON_PRESS = true; // Whether the tooltip should close when the trigger is pressed
|
|
41
|
-
function $19f06480c1c1a932$var$TooltipTrigger(props) {
|
|
42
|
-
let { children: children, crossOffset: crossOffset = $19f06480c1c1a932$var$DEFAULT_CROSS_OFFSET, isDisabled: isDisabled, offset: offset = $19f06480c1c1a932$var$DEFAULT_OFFSET, trigger: triggerAction, shouldCloseOnPress: shouldCloseOnPress = $19f06480c1c1a932$var$DEFAULT_SHOULD_CLOSE_ON_PRESS } = props;
|
|
43
|
-
let [trigger, tooltip] = (0, ($parcel$interopDefault($1fBML$react))).Children.toArray(children);
|
|
44
|
-
let state = (0, $1fBML$reactstatelytooltip.useTooltipTriggerState)(props);
|
|
45
|
-
let tooltipTriggerRef = (0, $1fBML$react.useRef)(null);
|
|
46
|
-
let overlayRef = (0, $1fBML$react.useRef)(null);
|
|
47
|
-
let { triggerProps: triggerProps, tooltipProps: tooltipProps } = (0, $1fBML$reactariatooltip.useTooltipTrigger)({
|
|
48
|
-
isDisabled: isDisabled,
|
|
49
|
-
trigger: triggerAction,
|
|
50
|
-
shouldCloseOnPress: shouldCloseOnPress
|
|
51
|
-
}, state, tooltipTriggerRef);
|
|
52
|
-
let [borderRadius, setBorderRadius] = (0, $1fBML$react.useState)(0);
|
|
53
|
-
(0, $1fBML$reactariautils.useLayoutEffect)(()=>{
|
|
54
|
-
if (overlayRef.current && state.isOpen) {
|
|
55
|
-
let spectrumBorderRadius = window.getComputedStyle(overlayRef.current).borderRadius;
|
|
56
|
-
if (spectrumBorderRadius !== '') setBorderRadius(parseInt(spectrumBorderRadius, 10));
|
|
57
|
-
}
|
|
58
|
-
}, [
|
|
59
|
-
state.isOpen,
|
|
60
|
-
overlayRef
|
|
61
|
-
]);
|
|
62
|
-
let arrowRef = (0, $1fBML$react.useRef)(null);
|
|
63
|
-
let [arrowWidth, setArrowWidth] = (0, $1fBML$react.useState)(0);
|
|
64
|
-
(0, $1fBML$reactariautils.useLayoutEffect)(()=>{
|
|
65
|
-
if (arrowRef.current && state.isOpen) setArrowWidth(arrowRef.current.getBoundingClientRect().width);
|
|
66
|
-
}, [
|
|
67
|
-
state.isOpen,
|
|
68
|
-
arrowRef
|
|
69
|
-
]);
|
|
70
|
-
let { overlayProps: overlayProps, arrowProps: arrowProps, placement: placement } = (0, $1fBML$reactariaoverlays.useOverlayPosition)({
|
|
71
|
-
placement: props.placement || 'top',
|
|
72
|
-
targetRef: tooltipTriggerRef,
|
|
73
|
-
overlayRef: overlayRef,
|
|
74
|
-
offset: offset,
|
|
75
|
-
crossOffset: crossOffset,
|
|
76
|
-
isOpen: state.isOpen,
|
|
77
|
-
shouldFlip: props.shouldFlip,
|
|
78
|
-
containerPadding: props.containerPadding,
|
|
79
|
-
arrowSize: arrowWidth,
|
|
80
|
-
arrowBoundaryOffset: borderRadius,
|
|
81
|
-
onClose: ()=>state.close(true)
|
|
82
|
-
});
|
|
83
|
-
return /*#__PURE__*/ (0, ($parcel$interopDefault($1fBML$react))).createElement((0, $1fBML$reactariafocus.FocusableProvider), {
|
|
84
|
-
...triggerProps,
|
|
85
|
-
ref: tooltipTriggerRef
|
|
86
|
-
}, trigger, /*#__PURE__*/ (0, ($parcel$interopDefault($1fBML$react))).createElement((0, $ed2e56c8503433b4$exports.TooltipContext).Provider, {
|
|
87
|
-
value: {
|
|
88
|
-
state: state,
|
|
89
|
-
placement: placement,
|
|
90
|
-
ref: overlayRef,
|
|
91
|
-
UNSAFE_style: overlayProps.style,
|
|
92
|
-
arrowProps: arrowProps,
|
|
93
|
-
arrowRef: arrowRef,
|
|
94
|
-
...tooltipProps
|
|
95
|
-
}
|
|
96
|
-
}, /*#__PURE__*/ (0, ($parcel$interopDefault($1fBML$react))).createElement((0, $1fBML$reactspectrumoverlays.Overlay), {
|
|
97
|
-
isOpen: state.isOpen,
|
|
98
|
-
nodeRef: overlayRef
|
|
99
|
-
}, tooltip)));
|
|
100
|
-
}
|
|
101
|
-
// Support TooltipTrigger inside components using CollectionBuilder.
|
|
102
|
-
$19f06480c1c1a932$var$TooltipTrigger.getCollectionNode = function*(props) {
|
|
103
|
-
// Replaced the use of React.Children.toArray because it mutates the key prop.
|
|
104
|
-
let childArray = [];
|
|
105
|
-
(0, ($parcel$interopDefault($1fBML$react))).Children.forEach(props.children, (child)=>{
|
|
106
|
-
if (/*#__PURE__*/ (0, ($parcel$interopDefault($1fBML$react))).isValidElement(child)) childArray.push(child);
|
|
107
|
-
});
|
|
108
|
-
let [trigger, tooltip] = childArray;
|
|
109
|
-
yield {
|
|
110
|
-
element: trigger,
|
|
111
|
-
wrapper: (element)=>/*#__PURE__*/ (0, ($parcel$interopDefault($1fBML$react))).createElement($19f06480c1c1a932$var$TooltipTrigger, {
|
|
112
|
-
key: element.key,
|
|
113
|
-
...props
|
|
114
|
-
}, element, tooltip)
|
|
115
|
-
};
|
|
116
|
-
};
|
|
117
|
-
/**
|
|
118
|
-
* TooltipTrigger wraps around a trigger element and a Tooltip. It handles opening and closing
|
|
119
|
-
* the Tooltip when the user hovers over or focuses the trigger, and positioning the Tooltip
|
|
120
|
-
* relative to the trigger.
|
|
121
|
-
*/ // We don't want getCollectionNode to show up in the type definition
|
|
122
|
-
let $19f06480c1c1a932$export$8c610744efcf8a1d = $19f06480c1c1a932$var$TooltipTrigger;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
//# sourceMappingURL=TooltipTrigger.main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAYD,MAAM,uCAAiB,IAAI,yFAAyF;AACpH,MAAM,6CAAuB;AAC7B,MAAM,sDAAgC,MAAM,+DAA+D;AAE3G,SAAS,qCAAe,KAAkC;IACxD,IAAI,YACF,QAAQ,eACR,cAAc,wDACd,UAAU,UACV,SAAS,sCACT,SAAS,aAAa,sBACtB,qBAAqB,qDACtB,GAAG;IAEJ,IAAI,CAAC,SAAS,QAAQ,GAAG,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,OAAO,CAAC;IAChD,IAAI,QAAQ,CAAA,GAAA,iDAAqB,EAAE;IAEnC,IAAI,oBAAoB,CAAA,GAAA,mBAAK,EAAe;IAC5C,IAAI,aAAa,CAAA,GAAA,mBAAK,EAAkB;IAExC,IAAI,gBAAC,YAAY,gBAAE,YAAY,EAAC,GAAG,CAAA,GAAA,yCAAgB,EAAE;oBACnD;QACA,SAAS;4BACT;IACF,GAAG,OAAO;IAEV,IAAI,CAAC,cAAc,gBAAgB,GAAG,CAAA,GAAA,qBAAO,EAAE;IAC/C,CAAA,GAAA,qCAAc,EAAE;QACd,IAAI,WAAW,OAAO,IAAI,MAAM,MAAM,EAAE;YACtC,IAAI,uBAAuB,OAAO,gBAAgB,CAAC,WAAW,OAAO,EAAE,YAAY;YACnF,IAAI,yBAAyB,IAC3B,gBAAgB,SAAS,sBAAsB;QAEnD;IACF,GAAG;QAAC,MAAM,MAAM;QAAE;KAAW;IAC7B,IAAI,WAAW,CAAA,GAAA,mBAAK,EAAe;IACnC,IAAI,CAAC,YAAY,cAAc,GAAG,CAAA,GAAA,qBAAO,EAAE;IAC3C,CAAA,GAAA,qCAAc,EAAE;QACd,IAAI,SAAS,OAAO,IAAI,MAAM,MAAM,EAClC,cAAc,SAAS,OAAO,CAAC,qBAAqB,GAAG,KAAK;IAEhE,GAAG;QAAC,MAAM,MAAM;QAAE;KAAS;IAE3B,IAAI,gBAAC,YAAY,cAAE,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,2CAAiB,EAAE;QAC7D,WAAW,MAAM,SAAS,IAAI;QAC9B,WAAW;oBACX;gBACA;qBACA;QACA,QAAQ,MAAM,MAAM;QACpB,YAAY,MAAM,UAAU;QAC5B,kBAAkB,MAAM,gBAAgB;QACxC,WAAW;QACX,qBAAqB;QACrB,SAAS,IAAM,MAAM,KAAK,CAAC;IAC7B;IAEA,qBACE,0DAAC,CAAA,GAAA,uCAAgB;QACd,GAAG,YAAY;QAChB,KAAK;OACJ,uBACD,0DAAC,CAAA,GAAA,wCAAa,EAAE,QAAQ;QACtB,OAAO;mBACL;uBACA;YACA,KAAK;YACL,cAAc,aAAa,KAAK;wBAChC;YACA,UAAU;YACV,GAAG,YAAY;QACjB;qBACA,0DAAC,CAAA,GAAA,oCAAM;QAAE,QAAQ,MAAM,MAAM;QAAE,SAAS;OACrC;AAKX;AAEA,oEAAoE;AACpE,qCAAe,iBAAiB,GAAG,UAAW,KAAkC;IAC9E,8EAA8E;IAC9E,IAAI,aAA6B,EAAE;IACnC,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,QAAQ,EAAE,CAAA;QACrC,kBAAI,CAAA,GAAA,sCAAI,EAAE,cAAc,CAAC,QACvB,WAAW,IAAI,CAAC;IAEpB;IACA,IAAI,CAAC,SAAS,QAAQ,GAAG;IACzB,MAAM;QACJ,SAAS;QACT,SAAS,CAAC,wBACR,0DAAC;gBAAe,KAAK,QAAQ,GAAG;gBAAG,GAAG,KAAK;eACxC,SACA;IAGP;AACF;AAEA;;;;CAIC,GACD,oEAAoE;AACpE,IAAI,4CAAkB","sources":["packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {FocusableProvider} from '@react-aria/focus';\nimport {Overlay} from '@react-spectrum/overlays';\nimport React, {JSX, ReactElement, useRef, useState} from 'react';\nimport {SpectrumTooltipTriggerProps} from '@react-types/tooltip';\nimport {TooltipContext} from './context';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useOverlayPosition} from '@react-aria/overlays';\nimport {useTooltipTrigger} from '@react-aria/tooltip';\nimport {useTooltipTriggerState} from '@react-stately/tooltip';\n\nconst DEFAULT_OFFSET = -1; // Offset needed to reach 4px/5px (med/large) distance between tooltip and trigger button\nconst DEFAULT_CROSS_OFFSET = 0;\nconst DEFAULT_SHOULD_CLOSE_ON_PRESS = true; // Whether the tooltip should close when the trigger is pressed\n\nfunction TooltipTrigger(props: SpectrumTooltipTriggerProps) {\n let {\n children,\n crossOffset = DEFAULT_CROSS_OFFSET,\n isDisabled,\n offset = DEFAULT_OFFSET,\n trigger: triggerAction,\n shouldCloseOnPress = DEFAULT_SHOULD_CLOSE_ON_PRESS\n } = props;\n\n let [trigger, tooltip] = React.Children.toArray(children) as [ReactElement, ReactElement];\n let state = useTooltipTriggerState(props);\n\n let tooltipTriggerRef = useRef<HTMLElement>(null);\n let overlayRef = useRef<HTMLDivElement>(null);\n\n let {triggerProps, tooltipProps} = useTooltipTrigger({\n isDisabled,\n trigger: triggerAction,\n shouldCloseOnPress\n }, state, tooltipTriggerRef);\n\n let [borderRadius, setBorderRadius] = useState(0);\n useLayoutEffect(() => {\n if (overlayRef.current && state.isOpen) {\n let spectrumBorderRadius = window.getComputedStyle(overlayRef.current).borderRadius;\n if (spectrumBorderRadius !== '') {\n setBorderRadius(parseInt(spectrumBorderRadius, 10));\n }\n }\n }, [state.isOpen, overlayRef]);\n let arrowRef = useRef<HTMLElement>(null);\n let [arrowWidth, setArrowWidth] = useState(0);\n useLayoutEffect(() => {\n if (arrowRef.current && state.isOpen) {\n setArrowWidth(arrowRef.current.getBoundingClientRect().width);\n }\n }, [state.isOpen, arrowRef]);\n\n let {overlayProps, arrowProps, placement} = useOverlayPosition({\n placement: props.placement || 'top',\n targetRef: tooltipTriggerRef,\n overlayRef,\n offset,\n crossOffset,\n isOpen: state.isOpen,\n shouldFlip: props.shouldFlip,\n containerPadding: props.containerPadding,\n arrowSize: arrowWidth,\n arrowBoundaryOffset: borderRadius,\n onClose: () => state.close(true)\n });\n\n return (\n <FocusableProvider\n {...triggerProps}\n ref={tooltipTriggerRef}>\n {trigger}\n <TooltipContext.Provider\n value={{\n state,\n placement,\n ref: overlayRef,\n UNSAFE_style: overlayProps.style,\n arrowProps,\n arrowRef: arrowRef,\n ...tooltipProps\n }}>\n <Overlay isOpen={state.isOpen} nodeRef={overlayRef}>\n {tooltip}\n </Overlay>\n </TooltipContext.Provider>\n </FocusableProvider>\n );\n}\n\n// Support TooltipTrigger inside components using CollectionBuilder.\nTooltipTrigger.getCollectionNode = function* (props: SpectrumTooltipTriggerProps) {\n // Replaced the use of React.Children.toArray because it mutates the key prop.\n let childArray: ReactElement[] = [];\n React.Children.forEach(props.children, child => {\n if (React.isValidElement(child)) {\n childArray.push(child);\n }\n });\n let [trigger, tooltip] = childArray;\n yield {\n element: trigger,\n wrapper: (element) => (\n <TooltipTrigger key={element.key} {...props}>\n {element}\n {tooltip}\n </TooltipTrigger>\n )\n };\n};\n\n/**\n * TooltipTrigger wraps around a trigger element and a Tooltip. It handles opening and closing\n * the Tooltip when the user hovers over or focuses the trigger, and positioning the Tooltip\n * relative to the trigger.\n */\n// We don't want getCollectionNode to show up in the type definition\nlet _TooltipTrigger = TooltipTrigger as (props: SpectrumTooltipTriggerProps) => JSX.Element;\nexport {_TooltipTrigger as TooltipTrigger};\n"],"names":[],"version":3,"file":"TooltipTrigger.main.js.map"}
|