@react-spectrum/tooltip 3.0.0-nightly.1998 → 3.0.0-nightly.2009

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.
Files changed (2) hide show
  1. package/dist/import.mjs +241 -0
  2. package/package.json +21 -16
@@ -0,0 +1,241 @@
1
+ import "./main.css";
2
+ import $lbkGW$spectrumiconsuiAlertSmall from "@spectrum-icons/ui/AlertSmall";
3
+ import {useStyleProps as $lbkGW$useStyleProps, createDOMRef as $lbkGW$createDOMRef, classNames as $lbkGW$classNames} from "@react-spectrum/utils";
4
+ import $lbkGW$spectrumiconsuiInfoSmall from "@spectrum-icons/ui/InfoSmall";
5
+ import {mergeProps as $lbkGW$mergeProps} from "@react-aria/utils";
6
+ import $lbkGW$react, {useContext as $lbkGW$useContext, useRef as $lbkGW$useRef, useImperativeHandle as $lbkGW$useImperativeHandle} from "react";
7
+ import $lbkGW$spectrumiconsuiSuccessSmall from "@spectrum-icons/ui/SuccessSmall";
8
+ import {useTooltip as $lbkGW$useTooltip, useTooltipTrigger as $lbkGW$useTooltipTrigger} from "@react-aria/tooltip";
9
+ import {FocusableProvider as $lbkGW$FocusableProvider} from "@react-aria/focus";
10
+ import {Overlay as $lbkGW$Overlay} from "@react-spectrum/overlays";
11
+ import {useOverlayPosition as $lbkGW$useOverlayPosition} from "@react-aria/overlays";
12
+ import {useTooltipTriggerState as $lbkGW$useTooltipTriggerState} from "@react-stately/tooltip";
13
+
14
+ function $parcel$interopDefault(a) {
15
+ return a && a.__esModule ? a.default : a;
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
+ * 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
+ */ /// <reference types="css-module-types" />
31
+ /*
32
+ * Copyright 2020 Adobe. All rights reserved.
33
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
34
+ * you may not use this file except in compliance with the License. You may obtain a copy
35
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
36
+ *
37
+ * Unless required by applicable law or agreed to in writing, software distributed under
38
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
39
+ * OF ANY KIND, either express or implied. See the License for the specific language
40
+ * governing permissions and limitations under the License.
41
+ */
42
+
43
+
44
+
45
+
46
+ var $1e9110aec8886b85$exports = {};
47
+
48
+ $parcel$export($1e9110aec8886b85$exports, "spectrum-Tooltip", () => $1e9110aec8886b85$export$f7bf7078d3d03f05, (v) => $1e9110aec8886b85$export$f7bf7078d3d03f05 = v);
49
+ $parcel$export($1e9110aec8886b85$exports, "is-open", () => $1e9110aec8886b85$export$a9781837241c946d, (v) => $1e9110aec8886b85$export$a9781837241c946d = v);
50
+ $parcel$export($1e9110aec8886b85$exports, "spectrum-Tooltip--bottom", () => $1e9110aec8886b85$export$4f420a9bbb442953, (v) => $1e9110aec8886b85$export$4f420a9bbb442953 = v);
51
+ $parcel$export($1e9110aec8886b85$exports, "spectrum-Tooltip--top", () => $1e9110aec8886b85$export$d7516df59e198fc7, (v) => $1e9110aec8886b85$export$d7516df59e198fc7 = v);
52
+ $parcel$export($1e9110aec8886b85$exports, "spectrum-Tooltip--right", () => $1e9110aec8886b85$export$c094187772823b2e, (v) => $1e9110aec8886b85$export$c094187772823b2e = v);
53
+ $parcel$export($1e9110aec8886b85$exports, "spectrum-Tooltip--left", () => $1e9110aec8886b85$export$47f060b68b4cab2c, (v) => $1e9110aec8886b85$export$47f060b68b4cab2c = v);
54
+ $parcel$export($1e9110aec8886b85$exports, "spectrum-Tooltip-tip", () => $1e9110aec8886b85$export$9deb89a7a91de30, (v) => $1e9110aec8886b85$export$9deb89a7a91de30 = v);
55
+ $parcel$export($1e9110aec8886b85$exports, "spectrum-Tooltip-typeIcon", () => $1e9110aec8886b85$export$ff23d46fee8272e4, (v) => $1e9110aec8886b85$export$ff23d46fee8272e4 = v);
56
+ $parcel$export($1e9110aec8886b85$exports, "spectrum-Tooltip-label", () => $1e9110aec8886b85$export$f4096e0dc445b255, (v) => $1e9110aec8886b85$export$f4096e0dc445b255 = v);
57
+ $parcel$export($1e9110aec8886b85$exports, "u-tooltip-showOnHover", () => $1e9110aec8886b85$export$6ea3237f62800d00, (v) => $1e9110aec8886b85$export$6ea3237f62800d00 = v);
58
+ $parcel$export($1e9110aec8886b85$exports, "is-hovered", () => $1e9110aec8886b85$export$b8813cd5d7824ce7, (v) => $1e9110aec8886b85$export$b8813cd5d7824ce7 = v);
59
+ $parcel$export($1e9110aec8886b85$exports, "is-focused", () => $1e9110aec8886b85$export$e7dc768d35940237, (v) => $1e9110aec8886b85$export$e7dc768d35940237 = v);
60
+ $parcel$export($1e9110aec8886b85$exports, "spectrum-Tooltip--negative", () => $1e9110aec8886b85$export$92fe45b4260594f6, (v) => $1e9110aec8886b85$export$92fe45b4260594f6 = v);
61
+ $parcel$export($1e9110aec8886b85$exports, "spectrum-Tooltip--error", () => $1e9110aec8886b85$export$2b291890a5577893, (v) => $1e9110aec8886b85$export$2b291890a5577893 = v);
62
+ $parcel$export($1e9110aec8886b85$exports, "spectrum-Tooltip--info", () => $1e9110aec8886b85$export$e995d5780591d0a8, (v) => $1e9110aec8886b85$export$e995d5780591d0a8 = v);
63
+ $parcel$export($1e9110aec8886b85$exports, "spectrum-Tooltip--help", () => $1e9110aec8886b85$export$d33ca445ae528241, (v) => $1e9110aec8886b85$export$d33ca445ae528241 = v);
64
+ $parcel$export($1e9110aec8886b85$exports, "spectrum-Tooltip--positive", () => $1e9110aec8886b85$export$11cbf31e1b6e51ac, (v) => $1e9110aec8886b85$export$11cbf31e1b6e51ac = v);
65
+ $parcel$export($1e9110aec8886b85$exports, "spectrum-Tooltip--success", () => $1e9110aec8886b85$export$4eae622bc9b08cac, (v) => $1e9110aec8886b85$export$4eae622bc9b08cac = v);
66
+ var $1e9110aec8886b85$export$f7bf7078d3d03f05;
67
+ var $1e9110aec8886b85$export$a9781837241c946d;
68
+ var $1e9110aec8886b85$export$4f420a9bbb442953;
69
+ var $1e9110aec8886b85$export$d7516df59e198fc7;
70
+ var $1e9110aec8886b85$export$c094187772823b2e;
71
+ var $1e9110aec8886b85$export$47f060b68b4cab2c;
72
+ var $1e9110aec8886b85$export$9deb89a7a91de30;
73
+ var $1e9110aec8886b85$export$ff23d46fee8272e4;
74
+ var $1e9110aec8886b85$export$f4096e0dc445b255;
75
+ var $1e9110aec8886b85$export$6ea3237f62800d00;
76
+ var $1e9110aec8886b85$export$b8813cd5d7824ce7;
77
+ var $1e9110aec8886b85$export$e7dc768d35940237;
78
+ var $1e9110aec8886b85$export$92fe45b4260594f6;
79
+ var $1e9110aec8886b85$export$2b291890a5577893;
80
+ var $1e9110aec8886b85$export$e995d5780591d0a8;
81
+ var $1e9110aec8886b85$export$d33ca445ae528241;
82
+ var $1e9110aec8886b85$export$11cbf31e1b6e51ac;
83
+ var $1e9110aec8886b85$export$4eae622bc9b08cac;
84
+ $1e9110aec8886b85$export$f7bf7078d3d03f05 = "spectrum-Tooltip_22ae94";
85
+ $1e9110aec8886b85$export$a9781837241c946d = "is-open_22ae94";
86
+ $1e9110aec8886b85$export$4f420a9bbb442953 = "spectrum-Tooltip--bottom_22ae94";
87
+ $1e9110aec8886b85$export$d7516df59e198fc7 = "spectrum-Tooltip--top_22ae94";
88
+ $1e9110aec8886b85$export$c094187772823b2e = "spectrum-Tooltip--right_22ae94";
89
+ $1e9110aec8886b85$export$47f060b68b4cab2c = "spectrum-Tooltip--left_22ae94";
90
+ $1e9110aec8886b85$export$9deb89a7a91de30 = "spectrum-Tooltip-tip_22ae94";
91
+ $1e9110aec8886b85$export$ff23d46fee8272e4 = "spectrum-Tooltip-typeIcon_22ae94";
92
+ $1e9110aec8886b85$export$f4096e0dc445b255 = "spectrum-Tooltip-label_22ae94";
93
+ $1e9110aec8886b85$export$6ea3237f62800d00 = "u-tooltip-showOnHover_22ae94";
94
+ $1e9110aec8886b85$export$b8813cd5d7824ce7 = "is-hovered_22ae94";
95
+ $1e9110aec8886b85$export$e7dc768d35940237 = "is-focused_22ae94";
96
+ $1e9110aec8886b85$export$92fe45b4260594f6 = "spectrum-Tooltip--negative_22ae94";
97
+ $1e9110aec8886b85$export$2b291890a5577893 = "spectrum-Tooltip--error_22ae94";
98
+ $1e9110aec8886b85$export$e995d5780591d0a8 = "spectrum-Tooltip--info_22ae94";
99
+ $1e9110aec8886b85$export$d33ca445ae528241 = "spectrum-Tooltip--help_22ae94";
100
+ $1e9110aec8886b85$export$11cbf31e1b6e51ac = "spectrum-Tooltip--positive_22ae94";
101
+ $1e9110aec8886b85$export$4eae622bc9b08cac = "spectrum-Tooltip--success_22ae94";
102
+
103
+
104
+
105
+ /*
106
+ * Copyright 2020 Adobe. All rights reserved.
107
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
108
+ * you may not use this file except in compliance with the License. You may obtain a copy
109
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
110
+ *
111
+ * Unless required by applicable law or agreed to in writing, software distributed under
112
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
113
+ * OF ANY KIND, either express or implied. See the License for the specific language
114
+ * governing permissions and limitations under the License.
115
+ */
116
+ const $b8c00169fae46ac7$export$39ae08fa83328b12 = (0, $lbkGW$react).createContext({});
117
+
118
+
119
+
120
+ let $dc9e2a6f9971fb04$var$iconMap = {
121
+ info: (0, $lbkGW$spectrumiconsuiInfoSmall),
122
+ positive: (0, $lbkGW$spectrumiconsuiSuccessSmall),
123
+ negative: (0, $lbkGW$spectrumiconsuiAlertSmall)
124
+ };
125
+ function $dc9e2a6f9971fb04$var$Tooltip(props, ref) {
126
+ let { ref: overlayRef , arrowProps: arrowProps , state: state , ...tooltipProviderProps } = (0, $lbkGW$useContext)((0, $b8c00169fae46ac7$export$39ae08fa83328b12));
127
+ let defaultRef = (0, $lbkGW$useRef)();
128
+ overlayRef = overlayRef || defaultRef;
129
+ props = (0, $lbkGW$mergeProps)(props, tooltipProviderProps);
130
+ let { variant: variant = "neutral" , placement: placement = "top" , isOpen: isOpen , showIcon: showIcon , ...otherProps } = props;
131
+ let { styleProps: styleProps } = (0, $lbkGW$useStyleProps)(otherProps);
132
+ let { tooltipProps: tooltipProps } = (0, $lbkGW$useTooltip)(props, state);
133
+ // Sync ref with overlayRef from context.
134
+ (0, $lbkGW$useImperativeHandle)(ref, ()=>(0, $lbkGW$createDOMRef)(overlayRef));
135
+ let Icon = $dc9e2a6f9971fb04$var$iconMap[variant];
136
+ return /*#__PURE__*/ (0, $lbkGW$react).createElement("div", {
137
+ ...styleProps,
138
+ ...tooltipProps,
139
+ className: (0, $lbkGW$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($1e9110aec8886b85$exports))), "spectrum-Tooltip", `spectrum-Tooltip--${variant}`, `spectrum-Tooltip--${placement}`, {
140
+ "is-open": isOpen
141
+ }, styleProps.className),
142
+ ref: overlayRef
143
+ }, showIcon && variant !== "neutral" && /*#__PURE__*/ (0, $lbkGW$react).createElement(Icon, {
144
+ UNSAFE_className: (0, $lbkGW$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($1e9110aec8886b85$exports))), "spectrum-Tooltip-typeIcon"),
145
+ "aria-hidden": true
146
+ }), props.children && /*#__PURE__*/ (0, $lbkGW$react).createElement("span", {
147
+ className: (0, $lbkGW$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($1e9110aec8886b85$exports))), "spectrum-Tooltip-label")
148
+ }, props.children), /*#__PURE__*/ (0, $lbkGW$react).createElement("span", {
149
+ ...arrowProps,
150
+ className: (0, $lbkGW$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($1e9110aec8886b85$exports))), "spectrum-Tooltip-tip")
151
+ }));
152
+ }
153
+ /**
154
+ * Display container for Tooltip content. Has a directional arrow dependent on its placement.
155
+ */ let $dc9e2a6f9971fb04$export$28c660c63b792dea = /*#__PURE__*/ (0, $lbkGW$react).forwardRef($dc9e2a6f9971fb04$var$Tooltip);
156
+
157
+
158
+ /*
159
+ * Copyright 2020 Adobe. All rights reserved.
160
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
161
+ * you may not use this file except in compliance with the License. You may obtain a copy
162
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
163
+ *
164
+ * Unless required by applicable law or agreed to in writing, software distributed under
165
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
166
+ * OF ANY KIND, either express or implied. See the License for the specific language
167
+ * governing permissions and limitations under the License.
168
+ */
169
+
170
+
171
+
172
+
173
+
174
+
175
+ const $019364e6919ef1db$var$DEFAULT_OFFSET = -1; // Offset needed to reach 4px/5px (med/large) distance between tooltip and trigger button
176
+ const $019364e6919ef1db$var$DEFAULT_CROSS_OFFSET = 0;
177
+ function $019364e6919ef1db$var$TooltipTrigger(props) {
178
+ let { children: children , crossOffset: crossOffset = $019364e6919ef1db$var$DEFAULT_CROSS_OFFSET , isDisabled: isDisabled , offset: offset = $019364e6919ef1db$var$DEFAULT_OFFSET , trigger: triggerAction } = props;
179
+ let [trigger, tooltip] = (0, $lbkGW$react).Children.toArray(children);
180
+ let state = (0, $lbkGW$useTooltipTriggerState)(props);
181
+ let tooltipTriggerRef = (0, $lbkGW$useRef)();
182
+ let overlayRef = (0, $lbkGW$useRef)();
183
+ let { triggerProps: triggerProps , tooltipProps: tooltipProps } = (0, $lbkGW$useTooltipTrigger)({
184
+ isDisabled: isDisabled,
185
+ trigger: triggerAction
186
+ }, state, tooltipTriggerRef);
187
+ let { overlayProps: overlayProps , arrowProps: arrowProps , placement: placement } = (0, $lbkGW$useOverlayPosition)({
188
+ placement: props.placement || "top",
189
+ targetRef: tooltipTriggerRef,
190
+ overlayRef: overlayRef,
191
+ offset: offset,
192
+ crossOffset: crossOffset,
193
+ isOpen: state.isOpen,
194
+ shouldFlip: props.shouldFlip,
195
+ containerPadding: props.containerPadding
196
+ });
197
+ return /*#__PURE__*/ (0, $lbkGW$react).createElement((0, $lbkGW$FocusableProvider), {
198
+ ...triggerProps,
199
+ ref: tooltipTriggerRef
200
+ }, trigger, /*#__PURE__*/ (0, $lbkGW$react).createElement((0, $b8c00169fae46ac7$export$39ae08fa83328b12).Provider, {
201
+ value: {
202
+ state: state,
203
+ placement: placement,
204
+ ref: overlayRef,
205
+ UNSAFE_style: overlayProps.style,
206
+ arrowProps: arrowProps,
207
+ ...tooltipProps
208
+ }
209
+ }, /*#__PURE__*/ (0, $lbkGW$react).createElement((0, $lbkGW$Overlay), {
210
+ isOpen: state.isOpen,
211
+ nodeRef: overlayRef
212
+ }, tooltip)));
213
+ }
214
+ // Support TooltipTrigger inside components using CollectionBuilder.
215
+ $019364e6919ef1db$var$TooltipTrigger.getCollectionNode = function*(props) {
216
+ // Replaced the use of React.Childern.toArray because it mutates the key prop.
217
+ let childArray = [];
218
+ (0, $lbkGW$react).Children.forEach(props.children, (child)=>{
219
+ if (/*#__PURE__*/ (0, $lbkGW$react).isValidElement(child)) childArray.push(child);
220
+ });
221
+ let [trigger, tooltip] = childArray;
222
+ yield {
223
+ element: trigger,
224
+ wrapper: (element)=>/*#__PURE__*/ (0, $lbkGW$react).createElement($019364e6919ef1db$var$TooltipTrigger, {
225
+ key: element.key,
226
+ ...props
227
+ }, element, tooltip)
228
+ };
229
+ };
230
+ /**
231
+ * TooltipTrigger wraps around a trigger element and a Tooltip. It handles opening and closing
232
+ * the Tooltip when the user hovers over or focuses the trigger, and positioning the Tooltip
233
+ * relative to the trigger.
234
+ */ // We don't want getCollectionNode to show up in the type definition
235
+ let $019364e6919ef1db$export$8c610744efcf8a1d = $019364e6919ef1db$var$TooltipTrigger;
236
+
237
+
238
+
239
+
240
+ export {$dc9e2a6f9971fb04$export$28c660c63b792dea as Tooltip, $019364e6919ef1db$export$8c610744efcf8a1d as TooltipTrigger};
241
+ //# sourceMappingURL=module.js.map
package/package.json CHANGED
@@ -1,10 +1,15 @@
1
1
  {
2
2
  "name": "@react-spectrum/tooltip",
3
- "version": "3.0.0-nightly.1998+72ee92f6d",
3
+ "version": "3.0.0-nightly.2009+0f953cac8",
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
+ "exports": {
9
+ "types": "./dist/types.d.ts",
10
+ "import": "./dist/import.mjs",
11
+ "require": "./dist/main.js"
12
+ },
8
13
  "types": "dist/types.d.ts",
9
14
  "source": "src/index.ts",
10
15
  "files": [
@@ -31,23 +36,23 @@
31
36
  "url": "https://github.com/adobe/react-spectrum"
32
37
  },
33
38
  "dependencies": {
34
- "@react-aria/focus": "3.0.0-nightly.1998+72ee92f6d",
35
- "@react-aria/interactions": "3.0.0-nightly.1998+72ee92f6d",
36
- "@react-aria/overlays": "3.0.0-nightly.1998+72ee92f6d",
37
- "@react-aria/tooltip": "3.0.0-nightly.1998+72ee92f6d",
38
- "@react-aria/utils": "3.0.0-nightly.1998+72ee92f6d",
39
- "@react-spectrum/overlays": "3.0.0-nightly.1998+72ee92f6d",
40
- "@react-spectrum/utils": "3.0.0-nightly.1998+72ee92f6d",
41
- "@react-stately/tooltip": "3.2.5-nightly.3698+72ee92f6d",
42
- "@react-stately/utils": "3.0.0-nightly.1998+72ee92f6d",
43
- "@react-types/overlays": "3.6.6-nightly.3698+72ee92f6d",
44
- "@react-types/shared": "3.0.0-nightly.1998+72ee92f6d",
45
- "@react-types/tooltip": "3.2.6-nightly.3698+72ee92f6d",
46
- "@spectrum-icons/ui": "3.0.0-nightly.1998+72ee92f6d",
39
+ "@react-aria/focus": "3.0.0-nightly.2009+0f953cac8",
40
+ "@react-aria/interactions": "3.0.0-nightly.2009+0f953cac8",
41
+ "@react-aria/overlays": "3.0.0-nightly.2009+0f953cac8",
42
+ "@react-aria/tooltip": "3.0.0-nightly.2009+0f953cac8",
43
+ "@react-aria/utils": "3.0.0-nightly.2009+0f953cac8",
44
+ "@react-spectrum/overlays": "3.0.0-nightly.2009+0f953cac8",
45
+ "@react-spectrum/utils": "3.0.0-nightly.2009+0f953cac8",
46
+ "@react-stately/tooltip": "3.2.5-nightly.3709+0f953cac8",
47
+ "@react-stately/utils": "3.0.0-nightly.2009+0f953cac8",
48
+ "@react-types/overlays": "3.6.6-nightly.3709+0f953cac8",
49
+ "@react-types/shared": "3.0.0-nightly.2009+0f953cac8",
50
+ "@react-types/tooltip": "3.2.6-nightly.3709+0f953cac8",
51
+ "@spectrum-icons/ui": "3.0.0-nightly.2009+0f953cac8",
47
52
  "@swc/helpers": "^0.4.14"
48
53
  },
49
54
  "devDependencies": {
50
- "@adobe/spectrum-css-temp": "3.0.0-nightly.1998+72ee92f6d"
55
+ "@adobe/spectrum-css-temp": "3.0.0-nightly.2009+0f953cac8"
51
56
  },
52
57
  "peerDependencies": {
53
58
  "@react-spectrum/provider": "^3.0.0",
@@ -57,5 +62,5 @@
57
62
  "publishConfig": {
58
63
  "access": "public"
59
64
  },
60
- "gitHead": "72ee92f6d497163468a80642ccb96576f822f365"
65
+ "gitHead": "0f953cac84f98cdff29f2348c120ce541ebb6da8"
61
66
  }