@react-spectrum/tooltip 3.0.0-alpha.0 → 3.0.0-nightly-641446f65-240905
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/Tooltip.main.js +81 -0
- package/dist/Tooltip.main.js.map +1 -0
- package/dist/Tooltip.mjs +76 -0
- package/dist/Tooltip.module.js +76 -0
- package/dist/Tooltip.module.js.map +1 -0
- package/dist/TooltipTrigger.main.js +123 -0
- package/dist/TooltipTrigger.main.js.map +1 -0
- package/dist/TooltipTrigger.mjs +114 -0
- package/dist/TooltipTrigger.module.js +114 -0
- package/dist/TooltipTrigger.module.js.map +1 -0
- package/dist/context.main.js +27 -0
- package/dist/context.main.js.map +1 -0
- package/dist/context.mjs +18 -0
- package/dist/context.module.js +18 -0
- package/dist/context.module.js.map +1 -0
- package/dist/import.mjs +20 -0
- package/dist/main.js +17 -186
- package/dist/main.js.map +1 -1
- package/dist/module.js +14 -146
- package/dist/module.js.map +1 -1
- package/dist/tooltip_vars_css.main.js +107 -0
- package/dist/tooltip_vars_css.main.js.map +1 -0
- package/dist/tooltip_vars_css.mjs +109 -0
- package/dist/tooltip_vars_css.module.js +109 -0
- package/dist/tooltip_vars_css.module.js.map +1 -0
- package/dist/types.d.ts +9 -13
- package/dist/types.d.ts.map +1 -1
- package/dist/vars.80858477.css +321 -0
- package/dist/vars.80858477.css.map +1 -0
- package/package.json +24 -20
- package/src/Tooltip.tsx +16 -15
- package/src/TooltipTrigger.tsx +73 -31
- package/src/context.ts +26 -0
- package/src/index.ts +3 -2
- package/LICENSE +0 -201
- package/dist/main.css +0 -2
- package/dist/main.css.map +0 -1
@@ -0,0 +1,27 @@
|
|
1
|
+
var $aZ3Gf$react = require("react");
|
2
|
+
|
3
|
+
|
4
|
+
function $parcel$interopDefault(a) {
|
5
|
+
return a && a.__esModule ? a.default : a;
|
6
|
+
}
|
7
|
+
|
8
|
+
function $parcel$export(e, n, v, s) {
|
9
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
10
|
+
}
|
11
|
+
|
12
|
+
$parcel$export(module.exports, "TooltipContext", () => $ed2e56c8503433b4$export$39ae08fa83328b12);
|
13
|
+
/*
|
14
|
+
* Copyright 2020 Adobe. All rights reserved.
|
15
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
16
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
17
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
18
|
+
*
|
19
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
20
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
21
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
22
|
+
* governing permissions and limitations under the License.
|
23
|
+
*/
|
24
|
+
const $ed2e56c8503433b4$export$39ae08fa83328b12 = (0, ($parcel$interopDefault($aZ3Gf$react))).createContext({});
|
25
|
+
|
26
|
+
|
27
|
+
//# sourceMappingURL=context.main.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAeM,MAAM,4CAAiB,CAAA,GAAA,sCAAI,EAAE,aAAa,CAAsB,CAAC","sources":["packages/@react-spectrum/tooltip/src/context.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\nimport {PlacementAxis} from '@react-types/overlays';\nimport React, {HTMLAttributes} from 'react';\nimport {RefObject, StyleProps} from '@react-types/shared';\nimport {TooltipTriggerState} from '@react-stately/tooltip';\n\ninterface TooltipContextProps extends StyleProps {\n state?: TooltipTriggerState,\n ref?: RefObject<HTMLDivElement | null>,\n placement?: PlacementAxis,\n arrowProps?: HTMLAttributes<HTMLElement>,\n arrowRef?: RefObject<HTMLElement | null>\n}\n\nexport const TooltipContext = React.createContext<TooltipContextProps>({});\n"],"names":[],"version":3,"file":"context.main.js.map"}
|
package/dist/context.mjs
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
import $kNnxj$react from "react";
|
2
|
+
|
3
|
+
/*
|
4
|
+
* Copyright 2020 Adobe. All rights reserved.
|
5
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
6
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
7
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
*
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
11
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
12
|
+
* governing permissions and limitations under the License.
|
13
|
+
*/
|
14
|
+
const $b8c00169fae46ac7$export$39ae08fa83328b12 = (0, $kNnxj$react).createContext({});
|
15
|
+
|
16
|
+
|
17
|
+
export {$b8c00169fae46ac7$export$39ae08fa83328b12 as TooltipContext};
|
18
|
+
//# sourceMappingURL=context.module.js.map
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import $kNnxj$react from "react";
|
2
|
+
|
3
|
+
/*
|
4
|
+
* Copyright 2020 Adobe. All rights reserved.
|
5
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
6
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
7
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
*
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
11
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
12
|
+
* governing permissions and limitations under the License.
|
13
|
+
*/
|
14
|
+
const $b8c00169fae46ac7$export$39ae08fa83328b12 = (0, $kNnxj$react).createContext({});
|
15
|
+
|
16
|
+
|
17
|
+
export {$b8c00169fae46ac7$export$39ae08fa83328b12 as TooltipContext};
|
18
|
+
//# sourceMappingURL=context.module.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAeM,MAAM,4CAAiB,CAAA,GAAA,YAAI,EAAE,aAAa,CAAsB,CAAC","sources":["packages/@react-spectrum/tooltip/src/context.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\nimport {PlacementAxis} from '@react-types/overlays';\nimport React, {HTMLAttributes} from 'react';\nimport {RefObject, StyleProps} from '@react-types/shared';\nimport {TooltipTriggerState} from '@react-stately/tooltip';\n\ninterface TooltipContextProps extends StyleProps {\n state?: TooltipTriggerState,\n ref?: RefObject<HTMLDivElement | null>,\n placement?: PlacementAxis,\n arrowProps?: HTMLAttributes<HTMLElement>,\n arrowRef?: RefObject<HTMLElement | null>\n}\n\nexport const TooltipContext = React.createContext<TooltipContextProps>({});\n"],"names":[],"version":3,"file":"context.module.js.map"}
|
package/dist/import.mjs
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
import {Tooltip as $dc9e2a6f9971fb04$export$28c660c63b792dea} from "./Tooltip.mjs";
|
2
|
+
import {TooltipTrigger as $019364e6919ef1db$export$8c610744efcf8a1d} from "./TooltipTrigger.mjs";
|
3
|
+
|
4
|
+
/*
|
5
|
+
* Copyright 2020 Adobe. All rights reserved.
|
6
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
7
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
8
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
11
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
12
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
13
|
+
* governing permissions and limitations under the License.
|
14
|
+
*/ /// <reference types="css-module-types" />
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
export {$dc9e2a6f9971fb04$export$28c660c63b792dea as Tooltip, $019364e6919ef1db$export$8c610744efcf8a1d as TooltipTrigger};
|
20
|
+
//# sourceMappingURL=module.js.map
|
package/dist/main.js
CHANGED
@@ -1,195 +1,26 @@
|
|
1
|
-
var
|
2
|
-
|
3
|
-
} = require("@react-stately/tooltip");
|
1
|
+
var $55bd11986fcffc6f$exports = require("./Tooltip.main.js");
|
2
|
+
var $19f06480c1c1a932$exports = require("./TooltipTrigger.main.js");
|
4
3
|
|
5
|
-
var {
|
6
|
-
useOverlayPosition
|
7
|
-
} = require("@react-aria/overlays");
|
8
4
|
|
9
|
-
|
10
|
-
|
11
|
-
} = require("@react-spectrum/overlays");
|
12
|
-
|
13
|
-
var {
|
14
|
-
FocusableProvider
|
15
|
-
} = require("@react-aria/focus");
|
16
|
-
|
17
|
-
var {
|
18
|
-
useTooltip,
|
19
|
-
useTooltipTrigger
|
20
|
-
} = require("@react-aria/tooltip");
|
21
|
-
|
22
|
-
var _spectrumIconsUiSuccessSmall = $parcel$interopDefault(require("@spectrum-icons/ui/SuccessSmall"));
|
23
|
-
|
24
|
-
var _react2 = require("react");
|
25
|
-
|
26
|
-
var _react = $parcel$interopDefault(_react2);
|
27
|
-
|
28
|
-
var {
|
29
|
-
useRef,
|
30
|
-
useContext
|
31
|
-
} = _react2;
|
32
|
-
|
33
|
-
var {
|
34
|
-
mergeProps
|
35
|
-
} = require("@react-aria/utils");
|
36
|
-
|
37
|
-
var _spectrumIconsUiInfoSmall = $parcel$interopDefault(require("@spectrum-icons/ui/InfoSmall"));
|
38
|
-
|
39
|
-
var {
|
40
|
-
classNames,
|
41
|
-
useStyleProps,
|
42
|
-
useDOMRef
|
43
|
-
} = require("@react-spectrum/utils");
|
44
|
-
|
45
|
-
var _spectrumIconsUiAlertSmall = $parcel$interopDefault(require("@spectrum-icons/ui/AlertSmall"));
|
46
|
-
|
47
|
-
var _babelRuntimeHelpersObjectWithoutPropertiesLoose = $parcel$interopDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
48
|
-
|
49
|
-
var _babelRuntimeHelpersExtends = $parcel$interopDefault(require("@babel/runtime/helpers/extends"));
|
50
|
-
|
51
|
-
require("./main.css");
|
52
|
-
|
53
|
-
function $parcel$interopDefault(a) {
|
54
|
-
return a && a.__esModule ? a.default : a;
|
55
|
-
}
|
56
|
-
|
57
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/node_modules/@adobe/spectrum-css-temp/components/tooltip/vars.css
|
58
|
-
var $e02064c879d8df5d7c99552d96e8391$exports = {};
|
59
|
-
$e02064c879d8df5d7c99552d96e8391$exports = {
|
60
|
-
"spectrum-Tooltip": "_spectrum-Tooltip_23042",
|
61
|
-
"is-open": "_is-open_23042",
|
62
|
-
"spectrum-Tooltip--bottom": "_spectrum-Tooltip--bottom_23042",
|
63
|
-
"spectrum-Tooltip--top": "_spectrum-Tooltip--top_23042",
|
64
|
-
"spectrum-Tooltip--right": "_spectrum-Tooltip--right_23042",
|
65
|
-
"spectrum-Tooltip--left": "_spectrum-Tooltip--left_23042",
|
66
|
-
"spectrum-Tooltip-tip": "_spectrum-Tooltip-tip_23042",
|
67
|
-
"spectrum-Tooltip-typeIcon": "_spectrum-Tooltip-typeIcon_23042",
|
68
|
-
"spectrum-Tooltip-label": "_spectrum-Tooltip-label_23042",
|
69
|
-
"u-tooltip-showOnHover": "_u-tooltip-showOnHover_23042",
|
70
|
-
"is-hovered": "_is-hovered_23042",
|
71
|
-
"is-focused": "_is-focused_23042",
|
72
|
-
"spectrum-Tooltip--negative": "_spectrum-Tooltip--negative_23042",
|
73
|
-
"spectrum-Tooltip--error": "_spectrum-Tooltip--error_23042",
|
74
|
-
"spectrum-Tooltip--info": "_spectrum-Tooltip--info_23042",
|
75
|
-
"spectrum-Tooltip--help": "_spectrum-Tooltip--help_23042",
|
76
|
-
"spectrum-Tooltip--positive": "_spectrum-Tooltip--positive_23042",
|
77
|
-
"spectrum-Tooltip--success": "_spectrum-Tooltip--success_23042"
|
78
|
-
};
|
79
|
-
|
80
|
-
const $b29140c6a34ca04560623b3e2e0d4c0b$var$TooltipContext = _react.createContext({});
|
81
|
-
|
82
|
-
function useTooltipProvider() {
|
83
|
-
return useContext($b29140c6a34ca04560623b3e2e0d4c0b$var$TooltipContext) || {};
|
84
|
-
}
|
85
|
-
|
86
|
-
exports.useTooltipProvider = useTooltipProvider;
|
87
|
-
|
88
|
-
function $b29140c6a34ca04560623b3e2e0d4c0b$var$TooltipTrigger(props, ref) {
|
89
|
-
let {
|
90
|
-
children,
|
91
|
-
isDisabled
|
92
|
-
} = props;
|
93
|
-
|
94
|
-
let [trigger, tooltip] = _react.Children.toArray(children);
|
95
|
-
|
96
|
-
let state = useTooltipTriggerState(props);
|
97
|
-
let domRef = useDOMRef(ref);
|
98
|
-
let triggerRef = useRef();
|
99
|
-
let tooltipTriggerRef = domRef || triggerRef;
|
100
|
-
let overlayRef = useRef();
|
101
|
-
let {
|
102
|
-
triggerProps,
|
103
|
-
tooltipProps
|
104
|
-
} = useTooltipTrigger({
|
105
|
-
isDisabled
|
106
|
-
}, state, tooltipTriggerRef);
|
107
|
-
let {
|
108
|
-
overlayProps,
|
109
|
-
placement
|
110
|
-
} = useOverlayPosition({
|
111
|
-
placement: props.placement || 'right',
|
112
|
-
targetRef: tooltipTriggerRef,
|
113
|
-
overlayRef,
|
114
|
-
isOpen: state.isOpen
|
115
|
-
});
|
116
|
-
return /*#__PURE__*/_react.createElement(FocusableProvider, _babelRuntimeHelpersExtends({}, triggerProps, {
|
117
|
-
ref: tooltipTriggerRef
|
118
|
-
}), trigger, /*#__PURE__*/_react.createElement($b29140c6a34ca04560623b3e2e0d4c0b$var$TooltipContext.Provider, {
|
119
|
-
value: _babelRuntimeHelpersExtends({
|
120
|
-
placement,
|
121
|
-
ref: overlayRef,
|
122
|
-
UNSAFE_style: overlayProps.style
|
123
|
-
}, tooltipProps)
|
124
|
-
}, /*#__PURE__*/_react.createElement(Overlay, {
|
125
|
-
isOpen: state.isOpen
|
126
|
-
}, tooltip)));
|
5
|
+
function $parcel$export(e, n, v, s) {
|
6
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
127
7
|
}
|
128
|
-
/**
|
129
|
-
* Display container for Tooltip content. Has a directional arrow dependent on its placement.
|
130
|
-
*/
|
131
|
-
|
132
8
|
|
133
|
-
|
9
|
+
$parcel$export(module.exports, "Tooltip", () => $55bd11986fcffc6f$exports.Tooltip);
|
10
|
+
$parcel$export(module.exports, "TooltipTrigger", () => $19f06480c1c1a932$exports.TooltipTrigger);
|
11
|
+
/*
|
12
|
+
* Copyright 2020 Adobe. All rights reserved.
|
13
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
14
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
15
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
16
|
+
*
|
17
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
18
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
19
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
20
|
+
* governing permissions and limitations under the License.
|
21
|
+
*/ /// <reference types="css-module-types" />
|
134
22
|
|
135
|
-
exports.TooltipTrigger = TooltipTrigger;
|
136
|
-
let $ff273912ab399ba4f2bd386cbddf33$var$iconMap = {
|
137
|
-
neutral: '',
|
138
|
-
info: _spectrumIconsUiInfoSmall,
|
139
|
-
positive: _spectrumIconsUiSuccessSmall,
|
140
|
-
negative: _spectrumIconsUiAlertSmall
|
141
|
-
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
142
|
-
|
143
|
-
var $e02064c879d8df5d7c99552d96e8391$$interop$default = $parcel$interopDefault($e02064c879d8df5d7c99552d96e8391$exports);
|
144
|
-
|
145
|
-
function $ff273912ab399ba4f2bd386cbddf33$var$Tooltip(props, ref) {
|
146
|
-
let defaultRef = useRef(); // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
147
|
-
|
148
|
-
ref = ref || defaultRef; // need to figure out how to merge?
|
149
|
-
|
150
|
-
let _useTooltipProvider = useTooltipProvider(),
|
151
|
-
{
|
152
|
-
ref: overlayRef
|
153
|
-
} = _useTooltipProvider,
|
154
|
-
tooltipProviderProps = _babelRuntimeHelpersObjectWithoutPropertiesLoose(_useTooltipProvider, ["ref"]);
|
155
|
-
|
156
|
-
props = mergeProps(props, tooltipProviderProps);
|
157
|
-
|
158
|
-
let {
|
159
|
-
variant = 'neutral',
|
160
|
-
placement = 'right',
|
161
|
-
isOpen,
|
162
|
-
showIcon
|
163
|
-
} = props,
|
164
|
-
otherProps = _babelRuntimeHelpersObjectWithoutPropertiesLoose(props, ["variant", "placement", "isOpen", "showIcon"]);
|
165
|
-
|
166
|
-
let {
|
167
|
-
styleProps
|
168
|
-
} = useStyleProps(otherProps);
|
169
|
-
let {
|
170
|
-
tooltipProps
|
171
|
-
} = useTooltip(props);
|
172
|
-
let Icon = $ff273912ab399ba4f2bd386cbddf33$var$iconMap[variant];
|
173
|
-
return /*#__PURE__*/_react.createElement("div", _babelRuntimeHelpersExtends({}, styleProps, tooltipProps, {
|
174
|
-
className: classNames($e02064c879d8df5d7c99552d96e8391$$interop$default, 'spectrum-Tooltip', "spectrum-Tooltip--" + variant, "spectrum-Tooltip--" + placement, {
|
175
|
-
'is-open': isOpen
|
176
|
-
}, styleProps.className),
|
177
|
-
ref: overlayRef
|
178
|
-
}), showIcon && variant !== 'neutral' && /*#__PURE__*/_react.createElement(Icon, {
|
179
|
-
UNSAFE_className: classNames($e02064c879d8df5d7c99552d96e8391$$interop$default, 'spectrum-Tooltip-typeIcon'),
|
180
|
-
"aria-hidden": true
|
181
|
-
}), props.children && /*#__PURE__*/_react.createElement("span", {
|
182
|
-
className: classNames($e02064c879d8df5d7c99552d96e8391$$interop$default, 'spectrum-Tooltip-label')
|
183
|
-
}, props.children), /*#__PURE__*/_react.createElement("span", {
|
184
|
-
className: classNames($e02064c879d8df5d7c99552d96e8391$$interop$default, 'spectrum-Tooltip-tip')
|
185
|
-
}));
|
186
|
-
}
|
187
|
-
/**
|
188
|
-
* Display container for Tooltip content. Has a directional arrow dependent on its placement.
|
189
|
-
*/
|
190
23
|
|
191
24
|
|
192
|
-
let Tooltip = _react.forwardRef($ff273912ab399ba4f2bd386cbddf33$var$Tooltip);
|
193
25
|
|
194
|
-
exports.Tooltip = Tooltip;
|
195
26
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,sBAAT,CAAgCC,CAAhC,EAAmC;AACjC,SAAOA,CAAC,IAAIA,CAAC,CAACC,UAAP,GAAoBD,CAAC,CAACE,OAAtB,GAAgCF,CAAvC;AACD;;;;ACFD,2CAAiB;AACf,sBAAoB,yBADL;AAEf,aAAW,gBAFI;AAGf,8BAA4B,iCAHb;AAIf,2BAAyB,8BAJV;AAKf,6BAA2B,gCALZ;AAMf,4BAA0B,+BANX;AAOf,0BAAwB,6BAPT;AAQf,+BAA6B,kCARd;AASf,4BAA0B,+BATX;AAUf,2BAAyB,8BAVV;AAWf,gBAAc,mBAXC;AAYf,gBAAc,mBAZC;AAaf,gCAA8B,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D,CAAlB;AAEA,sBACE,4DACMG,UADN,EAEM1B,YAFN;AAGE,IAAA,SAAS,EAAE8B,UAAU,oDAEnB,kBAFmB,yBAGEP,OAHF,yBAIEpB,SAJF,EAKnB;AACE,iBAAWG;AADb,KALmB,EAQnBoB,UAAU,CAACK,SARQ,CAHvB;AAaE,IAAA,GAAG,EAAEjC;AAbP,MAcG0B,QAAQ,IAAID,OAAO,KAAK,SAAxB,iBAAqC,qBAAC,IAAD;AAAM,IAAA,gBAAgB,EAAEO,UAAU,oDAAS,2BAAT,CAAlC;AAAyE;AAAzE,IAdxC,EAeG/C,KAAK,CAACE,QAAN,iBACC;AAAM,IAAA,SAAS,EAAE6C,UAAU,oDAAS,wBAAT;AAA3B,KACG/C,KAAK,CAACE,QADT,CAhBJ,eAoBE;AAAM,IAAA,SAAS,EAAE6C,UAAU,oDAAS,sBAAT;AAA3B,IApBF,CADF;AAwBD;AAGD;;;;;AAGA,IAAIE,OAAQ,GAAGtD,MAAK,CAACgC,UAAN,CAAiBS,2CAAjB,CAAf","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./node_modules/@adobe/spectrum-css-temp/components/tooltip/vars.css","./packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx","./packages/@react-spectrum/tooltip/src/Tooltip.tsx"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n","/*\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@import './index.css';\n@import './skin.css';\n","/*\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 {DOMRef, StyleProps} from '@react-types/shared';\nimport {FocusableProvider} from '@react-aria/focus';\nimport {Overlay} from '@react-spectrum/overlays';\nimport {PlacementAxis} from '@react-types/overlays';\nimport React, {RefObject, useContext, useRef} from 'react';\nimport {TooltipTriggerProps} from '@react-types/tooltip';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useOverlayPosition} from '@react-aria/overlays';\nimport {useTooltipTrigger} from '@react-aria/tooltip';\nimport {useTooltipTriggerState} from '@react-stately/tooltip';\n\ninterface TooltipContextProps extends StyleProps {\n ref?: RefObject<HTMLDivElement>,\n placement?: PlacementAxis,\n isOpen?: boolean\n}\n\nconst TooltipContext = React.createContext<TooltipContextProps>({});\n\nexport function useTooltipProvider(): TooltipContextProps {\n return useContext(TooltipContext) || {};\n}\n\nfunction TooltipTrigger(props: TooltipTriggerProps, ref: DOMRef<HTMLElement>) {\n let {\n children,\n isDisabled\n } = props;\n\n let [trigger, tooltip] = React.Children.toArray(children);\n\n let state = useTooltipTriggerState(props);\n\n let domRef = useDOMRef(ref);\n let triggerRef = useRef<HTMLElement>();\n let tooltipTriggerRef = domRef || triggerRef;\n let overlayRef = useRef<HTMLDivElement>();\n\n let {triggerProps, tooltipProps} = useTooltipTrigger({\n isDisabled\n }, state, tooltipTriggerRef);\n\n let {overlayProps, placement} = useOverlayPosition({\n placement: props.placement || 'right',\n targetRef: tooltipTriggerRef,\n overlayRef,\n isOpen: state.isOpen\n });\n\n return (\n <FocusableProvider\n {...triggerProps}\n ref={tooltipTriggerRef}>\n {trigger}\n <TooltipContext.Provider\n value={{\n placement,\n ref: overlayRef,\n UNSAFE_style: overlayProps.style,\n ...tooltipProps\n }}>\n <Overlay isOpen={state.isOpen}>\n {tooltip}\n </Overlay>\n </TooltipContext.Provider>\n </FocusableProvider>\n );\n}\n\n/**\n * Display container for Tooltip content. Has a directional arrow dependent on its placement.\n */\nlet _TooltipTrigger = React.forwardRef(TooltipTrigger);\nexport {_TooltipTrigger as TooltipTrigger};\n","/*\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, useStyleProps} from '@react-spectrum/utils';\nimport InfoSmall from '@spectrum-icons/ui/InfoSmall';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {RefObject, 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 {useTooltip} from '@react-aria/tooltip';\nimport {useTooltipProvider} from './TooltipTrigger';\n\nlet iconMap = {\n neutral: '',\n info: InfoSmall,\n positive: SuccessSmall,\n negative: AlertSmall\n};\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction Tooltip(props: SpectrumTooltipProps, ref: RefObject<HTMLDivElement>) {\n let defaultRef = useRef();\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n ref = ref || defaultRef; // need to figure out how to merge?\n let {ref: overlayRef, ...tooltipProviderProps} = useTooltipProvider();\n props = mergeProps(props, tooltipProviderProps);\n let {\n variant = 'neutral',\n placement = 'right',\n isOpen,\n showIcon,\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps);\n let {tooltipProps} = useTooltip(props);\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 },\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 className={classNames(styles, 'spectrum-Tooltip-tip')} />\n </div>\n );\n}\n\n\n/**\n * Display container for Tooltip content. Has a directional arrow dependent on its placement.\n */\nlet _Tooltip = React.forwardRef(Tooltip);\nexport {_Tooltip as Tooltip};\n"],"names":["$parcel$interopDefault","a","__esModule","default","TooltipContext","React","createContext","useTooltipProvider","useContext","TooltipTrigger","props","ref","children","isDisabled","trigger","tooltip","Children","toArray","state","useTooltipTriggerState","domRef","useDOMRef","triggerRef","useRef","tooltipTriggerRef","overlayRef","triggerProps","tooltipProps","useTooltipTrigger","overlayProps","placement","useOverlayPosition","targetRef","isOpen","UNSAFE_style","style","_TooltipTrigger","forwardRef","iconMap","neutral","info","InfoSmall","positive","SuccessSmall","negative","AlertSmall","Tooltip","defaultRef","tooltipProviderProps","mergeProps","variant","showIcon","otherProps","styleProps","useStyleProps","useTooltip","Icon","classNames","className","_Tooltip"],"version":3,"file":"main.js.map"}
|
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} from './Tooltip';\nexport {TooltipTrigger} from './TooltipTrigger';\nexport type {SpectrumTooltipProps, SpectrumTooltipTriggerProps} from '@react-types/tooltip';\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
@@ -1,152 +1,20 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import { Overlay } from "@react-spectrum/overlays";
|
4
|
-
import { FocusableProvider } from "@react-aria/focus";
|
5
|
-
import { useTooltip, useTooltipTrigger } from "@react-aria/tooltip";
|
6
|
-
import _spectrumIconsUiSuccessSmall from "@spectrum-icons/ui/SuccessSmall";
|
7
|
-
import _react, { useRef, useContext } from "react";
|
8
|
-
import { mergeProps } from "@react-aria/utils";
|
9
|
-
import _spectrumIconsUiInfoSmall from "@spectrum-icons/ui/InfoSmall";
|
10
|
-
import { classNames, useStyleProps, useDOMRef } from "@react-spectrum/utils";
|
11
|
-
import _spectrumIconsUiAlertSmall from "@spectrum-icons/ui/AlertSmall";
|
12
|
-
import _babelRuntimeHelpersEsmObjectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
13
|
-
import _babelRuntimeHelpersEsmExtends from "@babel/runtime/helpers/esm/extends";
|
14
|
-
import "./main.css";
|
1
|
+
import {Tooltip as $dc9e2a6f9971fb04$export$28c660c63b792dea} from "./Tooltip.module.js";
|
2
|
+
import {TooltipTrigger as $019364e6919ef1db$export$8c610744efcf8a1d} from "./TooltipTrigger.module.js";
|
15
3
|
|
16
|
-
|
17
|
-
|
18
|
-
|
4
|
+
/*
|
5
|
+
* Copyright 2020 Adobe. All rights reserved.
|
6
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
7
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
8
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
11
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
12
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
13
|
+
* governing permissions and limitations under the License.
|
14
|
+
*/ /// <reference types="css-module-types" />
|
19
15
|
|
20
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/node_modules/@adobe/spectrum-css-temp/components/tooltip/vars.css
|
21
|
-
var $fce0adf931fbcb6e5bbc907c5444$exports = {};
|
22
|
-
$fce0adf931fbcb6e5bbc907c5444$exports = {
|
23
|
-
"spectrum-Tooltip": "_spectrum-Tooltip_23042",
|
24
|
-
"is-open": "_is-open_23042",
|
25
|
-
"spectrum-Tooltip--bottom": "_spectrum-Tooltip--bottom_23042",
|
26
|
-
"spectrum-Tooltip--top": "_spectrum-Tooltip--top_23042",
|
27
|
-
"spectrum-Tooltip--right": "_spectrum-Tooltip--right_23042",
|
28
|
-
"spectrum-Tooltip--left": "_spectrum-Tooltip--left_23042",
|
29
|
-
"spectrum-Tooltip-tip": "_spectrum-Tooltip-tip_23042",
|
30
|
-
"spectrum-Tooltip-typeIcon": "_spectrum-Tooltip-typeIcon_23042",
|
31
|
-
"spectrum-Tooltip-label": "_spectrum-Tooltip-label_23042",
|
32
|
-
"u-tooltip-showOnHover": "_u-tooltip-showOnHover_23042",
|
33
|
-
"is-hovered": "_is-hovered_23042",
|
34
|
-
"is-focused": "_is-focused_23042",
|
35
|
-
"spectrum-Tooltip--negative": "_spectrum-Tooltip--negative_23042",
|
36
|
-
"spectrum-Tooltip--error": "_spectrum-Tooltip--error_23042",
|
37
|
-
"spectrum-Tooltip--info": "_spectrum-Tooltip--info_23042",
|
38
|
-
"spectrum-Tooltip--help": "_spectrum-Tooltip--help_23042",
|
39
|
-
"spectrum-Tooltip--positive": "_spectrum-Tooltip--positive_23042",
|
40
|
-
"spectrum-Tooltip--success": "_spectrum-Tooltip--success_23042"
|
41
|
-
};
|
42
16
|
|
43
|
-
const $af9462b3a75853dd6b5cae0d0c0ce5a$var$TooltipContext = _react.createContext({});
|
44
17
|
|
45
|
-
export function useTooltipProvider() {
|
46
|
-
return useContext($af9462b3a75853dd6b5cae0d0c0ce5a$var$TooltipContext) || {};
|
47
|
-
}
|
48
18
|
|
49
|
-
|
50
|
-
let {
|
51
|
-
children,
|
52
|
-
isDisabled
|
53
|
-
} = props;
|
54
|
-
|
55
|
-
let [trigger, tooltip] = _react.Children.toArray(children);
|
56
|
-
|
57
|
-
let state = useTooltipTriggerState(props);
|
58
|
-
let domRef = useDOMRef(ref);
|
59
|
-
let triggerRef = useRef();
|
60
|
-
let tooltipTriggerRef = domRef || triggerRef;
|
61
|
-
let overlayRef = useRef();
|
62
|
-
let {
|
63
|
-
triggerProps,
|
64
|
-
tooltipProps
|
65
|
-
} = useTooltipTrigger({
|
66
|
-
isDisabled
|
67
|
-
}, state, tooltipTriggerRef);
|
68
|
-
let {
|
69
|
-
overlayProps,
|
70
|
-
placement
|
71
|
-
} = useOverlayPosition({
|
72
|
-
placement: props.placement || 'right',
|
73
|
-
targetRef: tooltipTriggerRef,
|
74
|
-
overlayRef,
|
75
|
-
isOpen: state.isOpen
|
76
|
-
});
|
77
|
-
return /*#__PURE__*/_react.createElement(FocusableProvider, _babelRuntimeHelpersEsmExtends({}, triggerProps, {
|
78
|
-
ref: tooltipTriggerRef
|
79
|
-
}), trigger, /*#__PURE__*/_react.createElement($af9462b3a75853dd6b5cae0d0c0ce5a$var$TooltipContext.Provider, {
|
80
|
-
value: _babelRuntimeHelpersEsmExtends({
|
81
|
-
placement,
|
82
|
-
ref: overlayRef,
|
83
|
-
UNSAFE_style: overlayProps.style
|
84
|
-
}, tooltipProps)
|
85
|
-
}, /*#__PURE__*/_react.createElement(Overlay, {
|
86
|
-
isOpen: state.isOpen
|
87
|
-
}, tooltip)));
|
88
|
-
}
|
89
|
-
/**
|
90
|
-
* Display container for Tooltip content. Has a directional arrow dependent on its placement.
|
91
|
-
*/
|
92
|
-
|
93
|
-
|
94
|
-
export let TooltipTrigger = _react.forwardRef($af9462b3a75853dd6b5cae0d0c0ce5a$var$TooltipTrigger);
|
95
|
-
let $bbf06d7c74e4575391edac06758d45$var$iconMap = {
|
96
|
-
neutral: '',
|
97
|
-
info: _spectrumIconsUiInfoSmall,
|
98
|
-
positive: _spectrumIconsUiSuccessSmall,
|
99
|
-
negative: _spectrumIconsUiAlertSmall
|
100
|
-
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
101
|
-
|
102
|
-
var $fce0adf931fbcb6e5bbc907c5444$$interop$default = $parcel$interopDefault($fce0adf931fbcb6e5bbc907c5444$exports);
|
103
|
-
|
104
|
-
function $bbf06d7c74e4575391edac06758d45$var$Tooltip(props, ref) {
|
105
|
-
let defaultRef = useRef(); // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
106
|
-
|
107
|
-
ref = ref || defaultRef; // need to figure out how to merge?
|
108
|
-
|
109
|
-
let _useTooltipProvider = useTooltipProvider(),
|
110
|
-
{
|
111
|
-
ref: overlayRef
|
112
|
-
} = _useTooltipProvider,
|
113
|
-
tooltipProviderProps = _babelRuntimeHelpersEsmObjectWithoutPropertiesLoose(_useTooltipProvider, ["ref"]);
|
114
|
-
|
115
|
-
props = mergeProps(props, tooltipProviderProps);
|
116
|
-
|
117
|
-
let {
|
118
|
-
variant = 'neutral',
|
119
|
-
placement = 'right',
|
120
|
-
isOpen,
|
121
|
-
showIcon
|
122
|
-
} = props,
|
123
|
-
otherProps = _babelRuntimeHelpersEsmObjectWithoutPropertiesLoose(props, ["variant", "placement", "isOpen", "showIcon"]);
|
124
|
-
|
125
|
-
let {
|
126
|
-
styleProps
|
127
|
-
} = useStyleProps(otherProps);
|
128
|
-
let {
|
129
|
-
tooltipProps
|
130
|
-
} = useTooltip(props);
|
131
|
-
let Icon = $bbf06d7c74e4575391edac06758d45$var$iconMap[variant];
|
132
|
-
return /*#__PURE__*/_react.createElement("div", _babelRuntimeHelpersEsmExtends({}, styleProps, tooltipProps, {
|
133
|
-
className: classNames($fce0adf931fbcb6e5bbc907c5444$$interop$default, 'spectrum-Tooltip', "spectrum-Tooltip--" + variant, "spectrum-Tooltip--" + placement, {
|
134
|
-
'is-open': isOpen
|
135
|
-
}, styleProps.className),
|
136
|
-
ref: overlayRef
|
137
|
-
}), showIcon && variant !== 'neutral' && /*#__PURE__*/_react.createElement(Icon, {
|
138
|
-
UNSAFE_className: classNames($fce0adf931fbcb6e5bbc907c5444$$interop$default, 'spectrum-Tooltip-typeIcon'),
|
139
|
-
"aria-hidden": true
|
140
|
-
}), props.children && /*#__PURE__*/_react.createElement("span", {
|
141
|
-
className: classNames($fce0adf931fbcb6e5bbc907c5444$$interop$default, 'spectrum-Tooltip-label')
|
142
|
-
}, props.children), /*#__PURE__*/_react.createElement("span", {
|
143
|
-
className: classNames($fce0adf931fbcb6e5bbc907c5444$$interop$default, 'spectrum-Tooltip-tip')
|
144
|
-
}));
|
145
|
-
}
|
146
|
-
/**
|
147
|
-
* Display container for Tooltip content. Has a directional arrow dependent on its placement.
|
148
|
-
*/
|
149
|
-
|
150
|
-
|
151
|
-
export let Tooltip = _react.forwardRef($bbf06d7c74e4575391edac06758d45$var$Tooltip);
|
19
|
+
export {$dc9e2a6f9971fb04$export$28c660c63b792dea as Tooltip, $019364e6919ef1db$export$8c610744efcf8a1d as TooltipTrigger};
|
152
20
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;AAAA,SAASA,sBAAT,CAAgCC,CAAhC,EAAmC;AACjC,SAAOA,CAAC,IAAIA,CAAC,CAACC,UAAP,GAAoBD,CAAC,CAACE,OAAtB,GAAgCF,CAAvC;AACD;;;;ACFD,wCAAiB;AACf,sBAAoB,yBADL;AAEf,aAAW,gBAFI;AAGf,8BAA4B,iCAHb;AAIf,2BAAyB,8BAJV;AAKf,6BAA2B,gCALZ;AAMf,4BAA0B,+BANX;AAOf,0BAAwB,6BAPT;AAQf,+BAA6B,kCARd;AASf,4BAA0B,+BATX;AAUf,2BAAyB,8BAVV;AAWf,gBAAc,mBAXC;AAYf,gBAAc,mBAZC;AAaf,gCAA8B,mCAbf;AAcf,6BAA2B,gCAdZ;AAef,4BAA0B,+BAfX;AAgBf,4BAA0B,+BAhBX;AAiBf,gCAA8B,mCAjBf;AAkBf,+BAA6B;AAlBd,CAAjB;;AC6BA,MAAMG,mDAAc,GAAGC,MAAK,CAACC,aAAN,CAAyC,EAAzC,CAAvB;;OAEO,SAASC,kBAAT,GAAmD;AACxD,SAAOC,UAAU,CAACJ,mDAAD,CAAV,IAA8B,EAArC;AACD;;AAED,SAASK,mDAAT,CAAwBC,KAAxB,EAAoDC,GAApD,EAA8E;AAC5E,MAAI;AACFC,IAAAA,QADE;AAEFC,IAAAA;AAFE,MAGAH,KAHJ;;AAKA,MAAI,CAACI,OAAD,EAAUC,OAAV,IAAqBV,MAAK,CAACW,QAAN,CAAeC,OAAf,CAAuBL,QAAvB,CAAzB;;AAEA,MAAIM,KAAK,GAAGC,sBAAsB,CAACT,KAAD,CAAlC;AAEA,MAAIU,MAAM,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,OAAQ,GAAGtD,MAAK,CAACgC,UAAN,CAAiBS,2CAAjB,CAAf","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./node_modules/@adobe/spectrum-css-temp/components/tooltip/vars.css","./packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx","./packages/@react-spectrum/tooltip/src/Tooltip.tsx"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n","/*\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@import './index.css';\n@import './skin.css';\n","/*\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 {DOMRef, StyleProps} from '@react-types/shared';\nimport {FocusableProvider} from '@react-aria/focus';\nimport {Overlay} from '@react-spectrum/overlays';\nimport {PlacementAxis} from '@react-types/overlays';\nimport React, {RefObject, useContext, useRef} from 'react';\nimport {TooltipTriggerProps} from '@react-types/tooltip';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useOverlayPosition} from '@react-aria/overlays';\nimport {useTooltipTrigger} from '@react-aria/tooltip';\nimport {useTooltipTriggerState} from '@react-stately/tooltip';\n\ninterface TooltipContextProps extends StyleProps {\n ref?: RefObject<HTMLDivElement>,\n placement?: PlacementAxis,\n isOpen?: boolean\n}\n\nconst TooltipContext = React.createContext<TooltipContextProps>({});\n\nexport function useTooltipProvider(): TooltipContextProps {\n return useContext(TooltipContext) || {};\n}\n\nfunction TooltipTrigger(props: TooltipTriggerProps, ref: DOMRef<HTMLElement>) {\n let {\n children,\n isDisabled\n } = props;\n\n let [trigger, tooltip] = React.Children.toArray(children);\n\n let state = useTooltipTriggerState(props);\n\n let domRef = useDOMRef(ref);\n let triggerRef = useRef<HTMLElement>();\n let tooltipTriggerRef = domRef || triggerRef;\n let overlayRef = useRef<HTMLDivElement>();\n\n let {triggerProps, tooltipProps} = useTooltipTrigger({\n isDisabled\n }, state, tooltipTriggerRef);\n\n let {overlayProps, placement} = useOverlayPosition({\n placement: props.placement || 'right',\n targetRef: tooltipTriggerRef,\n overlayRef,\n isOpen: state.isOpen\n });\n\n return (\n <FocusableProvider\n {...triggerProps}\n ref={tooltipTriggerRef}>\n {trigger}\n <TooltipContext.Provider\n value={{\n placement,\n ref: overlayRef,\n UNSAFE_style: overlayProps.style,\n ...tooltipProps\n }}>\n <Overlay isOpen={state.isOpen}>\n {tooltip}\n </Overlay>\n </TooltipContext.Provider>\n </FocusableProvider>\n );\n}\n\n/**\n * Display container for Tooltip content. Has a directional arrow dependent on its placement.\n */\nlet _TooltipTrigger = React.forwardRef(TooltipTrigger);\nexport {_TooltipTrigger as TooltipTrigger};\n","/*\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, useStyleProps} from '@react-spectrum/utils';\nimport InfoSmall from '@spectrum-icons/ui/InfoSmall';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {RefObject, 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 {useTooltip} from '@react-aria/tooltip';\nimport {useTooltipProvider} from './TooltipTrigger';\n\nlet iconMap = {\n neutral: '',\n info: InfoSmall,\n positive: SuccessSmall,\n negative: AlertSmall\n};\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction Tooltip(props: SpectrumTooltipProps, ref: RefObject<HTMLDivElement>) {\n let defaultRef = useRef();\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n ref = ref || defaultRef; // need to figure out how to merge?\n let {ref: overlayRef, ...tooltipProviderProps} = useTooltipProvider();\n props = mergeProps(props, tooltipProviderProps);\n let {\n variant = 'neutral',\n placement = 'right',\n isOpen,\n showIcon,\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps);\n let {tooltipProps} = useTooltip(props);\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 },\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 className={classNames(styles, 'spectrum-Tooltip-tip')} />\n </div>\n );\n}\n\n\n/**\n * Display container for Tooltip content. Has a directional arrow dependent on its placement.\n */\nlet _Tooltip = React.forwardRef(Tooltip);\nexport {_Tooltip as Tooltip};\n"],"names":["$parcel$interopDefault","a","__esModule","default","TooltipContext","React","createContext","useTooltipProvider","useContext","TooltipTrigger","props","ref","children","isDisabled","trigger","tooltip","Children","toArray","state","useTooltipTriggerState","domRef","useDOMRef","triggerRef","useRef","tooltipTriggerRef","overlayRef","triggerProps","tooltipProps","useTooltipTrigger","overlayProps","placement","useOverlayPosition","targetRef","isOpen","UNSAFE_style","style","_TooltipTrigger","forwardRef","iconMap","neutral","info","InfoSmall","positive","SuccessSmall","negative","AlertSmall","Tooltip","defaultRef","tooltipProviderProps","mergeProps","variant","showIcon","otherProps","styleProps","useStyleProps","useTooltip","Icon","classNames","className","_Tooltip"],"version":3,"file":"module.js.map"}
|
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} from './Tooltip';\nexport {TooltipTrigger} from './TooltipTrigger';\nexport type {SpectrumTooltipProps, SpectrumTooltipTriggerProps} from '@react-types/tooltip';\n"],"names":[],"version":3,"file":"module.js.map"}
|