@react-spectrum/tooltip 3.3.3 → 3.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.css +1 -1
- package/dist/main.js +80 -41
- package/dist/main.js.map +1 -1
- package/dist/module.js +80 -41
- package/dist/module.js.map +1 -1
- package/package.json +13 -13
package/dist/main.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
.spectrum-Tooltip_22ae94{visibility:hidden;opacity:0;transition:transform var(--spectrum-global-animation-duration-100,130ms)ease-in-out,opacity var(--spectrum-global-animation-duration-100,130ms)ease-in-out,visibility 0ms linear var(--spectrum-global-animation-duration-100,130ms);pointer-events:none}.spectrum-Tooltip_22ae94.is-open_22ae94{visibility:visible;opacity:.9999;pointer-events:auto;transition-delay:0s}.spectrum-Tooltip--bottom_22ae94.is-open_22ae94{transform:translateY(var(--spectrum-overlay-positive-transform-distance))}.spectrum-Tooltip--top_22ae94.is-open_22ae94{transform:translateY(var(--spectrum-overlay-negative-transform-distance))}.spectrum-Tooltip--right_22ae94.is-open_22ae94{transform:translateX(var(--spectrum-overlay-positive-transform-distance))}.spectrum-Tooltip--left_22ae94.is-open_22ae94{transform:translateX(var(--spectrum-overlay-negative-transform-distance))}.spectrum-Tooltip_22ae94{box-sizing:border-box;vertical-align:top;width:auto;padding:var(--spectrum-tooltip-padding-top,var(--spectrum-global-dimension-size-50))var(--spectrum-tooltip-padding-x,var(--spectrum-global-dimension-size-125));border-radius:var(--spectrum-alias-border-radius-regular,var(--spectrum-global-dimension-size-50));min-height:var(--spectrum-tooltip-min-height,var(--spectrum-global-dimension-size-300));font-size:var(--spectrum-tooltip-text-size,var(--spectrum-global-dimension-font-size-75));font-weight:var(--spectrum-tooltip-text-font-weight,var(--spectrum-global-font-weight-regular));line-height:var(--spectrum-tooltip-text-line-height,var(--spectrum-global-dimension-font-size-200));word-break:break-word;-webkit-font-smoothing:antialiased;cursor:default;-webkit-user-select:none;user-select:none;flex-direction:row;align-items:center;display:inline-flex;position:relative}.spectrum-Tooltip_22ae94 p{margin:0}.spectrum-Tooltip-tip_22ae94{height:0;width:0;border-width:var(--spectrum-tooltip-tip-height,var(--spectrum-global-dimension-size-50));border-style:solid;border-bottom-color:#0000;border-left-color:#0000;border-right-color:#0000;position:absolute}.spectrum-Tooltip--right_22ae94 .spectrum-Tooltip-tip_22ae94,.spectrum-Tooltip--left_22ae94 .spectrum-Tooltip-tip_22ae94{margin-top:calc(var(--spectrum-tooltip-tip-height,var(--spectrum-global-dimension-size-50))*-1);top:50%}.spectrum-Tooltip--right_22ae94{margin-left:var(--spectrum-global-dimension-size-40)}.spectrum-Tooltip--right_22ae94 .spectrum-Tooltip-tip_22ae94{right:100%;transform:rotate(90deg)}.spectrum-Tooltip--left_22ae94{margin-right:var(--spectrum-global-dimension-size-40)}.spectrum-Tooltip--left_22ae94 .spectrum-Tooltip-tip_22ae94{left:100%;transform:rotate(-90deg)}.spectrum-Tooltip--top_22ae94{margin-bottom:var(--spectrum-global-dimension-size-40)}.spectrum-Tooltip--top_22ae94 .spectrum-Tooltip-tip_22ae94{top:100%}.spectrum-Tooltip--bottom_22ae94{margin-top:var(--spectrum-global-dimension-size-40)}.spectrum-Tooltip--bottom_22ae94 .spectrum-Tooltip-tip_22ae94{bottom:100%;transform:rotate(180deg)}.spectrum-Tooltip--bottom_22ae94 .spectrum-Tooltip-tip_22ae94,.spectrum-Tooltip--top_22ae94 .spectrum-Tooltip-tip_22ae94{margin-left:calc(var(--spectrum-tooltip-tip-height,var(--spectrum-global-dimension-size-50))*-1);left:50%}[dir=ltr] .spectrum-Tooltip-typeIcon_22ae94{margin-left:calc(var(--spectrum-tooltip-icon-margin-x,var(--spectrum-global-dimension-size-100)) - var(--spectrum-tooltip-padding-x,var(--spectrum-global-dimension-size-125)))}[dir=rtl] .spectrum-Tooltip-typeIcon_22ae94{margin-right:calc(var(--spectrum-tooltip-icon-margin-x,var(--spectrum-global-dimension-size-100)) - var(--spectrum-tooltip-padding-x,var(--spectrum-global-dimension-size-125)))}[dir=ltr] .spectrum-Tooltip-typeIcon_22ae94{margin-right:var(--spectrum-tooltip-icon-margin-x,var(--spectrum-global-dimension-size-100))}[dir=rtl] .spectrum-Tooltip-typeIcon_22ae94{margin-left:var(--spectrum-tooltip-icon-margin-x,var(--spectrum-global-dimension-size-100))}.spectrum-Tooltip-typeIcon_22ae94{width:var(--spectrum-tooltip-icon-size,var(--spectrum-global-dimension-size-175));height:var(--spectrum-tooltip-icon-size,var(--spectrum-global-dimension-size-175));align-self:flex-start;margin-top:1px}.spectrum-Tooltip-label_22ae94{max-width:var(--spectrum-tooltip-content-max-width);line-height:var(--spectrum-tooltip-text-line-height,var(--spectrum-global-dimension-font-size-200))}.u-tooltip-showOnHover_22ae94{display:inline-block;position:relative}.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip_22ae94{white-space:nowrap;transition:transform var(--spectrum-global-animation-duration-100,130ms)ease-in-out;position:absolute;top:-100%;visibility:visible!important}.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip-label_22ae94{max-width:none}.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip--right_22ae94,.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip--left_22ae94,.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip--right_22ae94 .spectrum-Tooltip-tip_22ae94,.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip--left_22ae94 .spectrum-Tooltip-tip_22ae94{top:50%}.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip--right_22ae94{left:100%;transform:translateY(-50%)}.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip--left_22ae94{transform:translate(-100%,-50%)}.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip--bottom_22ae94,.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip--top_22ae94,.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip--bottom_22ae94 .spectrum-Tooltip-tip_22ae94,.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip--top_22ae94 .spectrum-Tooltip-tip_22ae94{left:50%}.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip--bottom_22ae94{transform:translate(-50%,calc(var(--spectrum-tooltip-tip-margin,var(--spectrum-global-dimension-size-50))*-1));top:100%}.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip--top_22ae94{transform:translate(-50%,var(--spectrum-tooltip-tip-margin,var(--spectrum-global-dimension-size-50)))}.u-tooltip-showOnHover_22ae94.is-hovered_22ae94 .spectrum-Tooltip_22ae94,.u-tooltip-showOnHover_22ae94:focus .spectrum-Tooltip_22ae94,.u-tooltip-showOnHover_22ae94.is-focused_22ae94 .spectrum-Tooltip_22ae94,.u-tooltip-showOnHover_22ae94 :focus .spectrum-Tooltip_22ae94{opacity:1}.u-tooltip-showOnHover_22ae94.is-hovered_22ae94 .spectrum-Tooltip_22ae94.spectrum-Tooltip--bottom_22ae94,.u-tooltip-showOnHover_22ae94:focus .spectrum-Tooltip_22ae94.spectrum-Tooltip--bottom_22ae94,.u-tooltip-showOnHover_22ae94.is-focused_22ae94 .spectrum-Tooltip_22ae94.spectrum-Tooltip--bottom_22ae94,.u-tooltip-showOnHover_22ae94 :focus .spectrum-Tooltip_22ae94.spectrum-Tooltip--bottom_22ae94{transform:translate(-50%)}.u-tooltip-showOnHover_22ae94.is-hovered_22ae94 .spectrum-Tooltip_22ae94.spectrum-Tooltip--top_22ae94,.u-tooltip-showOnHover_22ae94:focus .spectrum-Tooltip_22ae94.spectrum-Tooltip--top_22ae94,.u-tooltip-showOnHover_22ae94.is-focused_22ae94 .spectrum-Tooltip_22ae94.spectrum-Tooltip--top_22ae94,.u-tooltip-showOnHover_22ae94 :focus .spectrum-Tooltip_22ae94.spectrum-Tooltip--top_22ae94{transform:translate(-50%,calc(var(--spectrum-tooltip-tip-margin,var(--spectrum-global-dimension-size-50))*-1))}.u-tooltip-showOnHover_22ae94.is-hovered_22ae94 .spectrum-Tooltip_22ae94.spectrum-Tooltip--left_22ae94,.u-tooltip-showOnHover_22ae94:focus .spectrum-Tooltip_22ae94.spectrum-Tooltip--left_22ae94,.u-tooltip-showOnHover_22ae94.is-focused_22ae94 .spectrum-Tooltip_22ae94.spectrum-Tooltip--left_22ae94,.u-tooltip-showOnHover_22ae94 :focus .spectrum-Tooltip_22ae94.spectrum-Tooltip--left_22ae94{transform:translate(calc(-100% - var(--spectrum-tooltip-tip-margin,var(--spectrum-global-dimension-size-50))),-50%)}.u-tooltip-showOnHover_22ae94.is-hovered_22ae94 .spectrum-Tooltip_22ae94.spectrum-Tooltip--right_22ae94,.u-tooltip-showOnHover_22ae94:focus .spectrum-Tooltip_22ae94.spectrum-Tooltip--right_22ae94,.u-tooltip-showOnHover_22ae94.is-focused_22ae94 .spectrum-Tooltip_22ae94.spectrum-Tooltip--right_22ae94,.u-tooltip-showOnHover_22ae94 :focus .spectrum-Tooltip_22ae94.spectrum-Tooltip--right_22ae94{transform:translate(var(--spectrum-tooltip-tip-margin,var(--spectrum-global-dimension-size-50)),-50%)}.spectrum-Tooltip_22ae94{--spectrum-tooltip-negative-background-color:var(--spectrum-negative-background-color-default);--spectrum-tooltip-positive-background-color:var(--spectrum-positive-background-color-default);--spectrum-tooltip-info-background-color:var(--spectrum-informative-background-color-default);background-color:var(--spectrum-tooltip-background-color,var(--spectrum-global-color-static-gray-700));color:var(--spectrum-tooltip-text-color,var(--spectrum-global-color-static-white));filter:var(--spectrum-tooltip-dropshadow);-webkit-filter:var(--spectrum-tooltip-dropshadow);will-change:filter}.spectrum-Tooltip-tip_22ae94{border-top-color:var(--spectrum-tooltip-background-color,var(--spectrum-global-color-static-gray-700))}.spectrum-Tooltip--negative_22ae94,.spectrum-Tooltip--error_22ae94{background-color:var(--spectrum-tooltip-negative-background-color,var(--spectrum-global-color-static-red-700))}.spectrum-Tooltip--negative_22ae94 .spectrum-Tooltip-tip_22ae94,.spectrum-Tooltip--error_22ae94 .spectrum-Tooltip-tip_22ae94{border-top-color:var(--spectrum-tooltip-negative-background-color,var(--spectrum-global-color-static-red-700))}.spectrum-Tooltip--info_22ae94,.spectrum-Tooltip--help_22ae94{background-color:var(--spectrum-tooltip-info-background-color,var(--spectrum-global-color-static-blue-700))}.spectrum-Tooltip--info_22ae94 .spectrum-Tooltip-tip_22ae94,.spectrum-Tooltip--help_22ae94 .spectrum-Tooltip-tip_22ae94{border-top-color:var(--spectrum-tooltip-info-background-color,var(--spectrum-global-color-static-blue-700))}.spectrum-Tooltip--positive_22ae94,.spectrum-Tooltip--success_22ae94{background-color:var(--spectrum-tooltip-positive-background-color,var(--spectrum-global-color-static-green-700))}.spectrum-Tooltip--positive_22ae94 .spectrum-Tooltip-tip_22ae94,.spectrum-Tooltip--success_22ae94 .spectrum-Tooltip-tip_22ae94{border-top-color:var(--spectrum-tooltip-positive-background-color,var(--spectrum-global-color-static-green-700))}@media (forced-colors:active){.spectrum-Tooltip_22ae94{border:1px solid #0000}.spectrum-Tooltip-tip_22ae94{forced-color-adjust:none;--spectrum-tooltip-background-color:CanvasText;--spectrum-tooltip-negative-background-color:Highlight;--spectrum-tooltip-info-background-color:Highlight;--spectrum-tooltip-positive-background-color:Highlight}}
|
1
|
+
.spectrum-Tooltip_22ae94{visibility:hidden;opacity:0;transition:transform var(--spectrum-global-animation-duration-100,.13s)ease-in-out,opacity var(--spectrum-global-animation-duration-100,.13s)ease-in-out,visibility 0s linear var(--spectrum-global-animation-duration-100,.13s);pointer-events:none}.spectrum-Tooltip_22ae94.is-open_22ae94{visibility:visible;opacity:.9999;pointer-events:auto;transition-delay:0s}.spectrum-Tooltip--bottom_22ae94.is-open_22ae94{transform:translateY(var(--spectrum-overlay-positive-transform-distance))}.spectrum-Tooltip--top_22ae94.is-open_22ae94{transform:translateY(var(--spectrum-overlay-negative-transform-distance))}.spectrum-Tooltip--right_22ae94.is-open_22ae94{transform:translateX(var(--spectrum-overlay-positive-transform-distance))}.spectrum-Tooltip--left_22ae94.is-open_22ae94{transform:translateX(var(--spectrum-overlay-negative-transform-distance))}.spectrum-Tooltip_22ae94{box-sizing:border-box;vertical-align:top;width:auto;padding:var(--spectrum-tooltip-padding-top,var(--spectrum-global-dimension-size-50))var(--spectrum-tooltip-padding-x,var(--spectrum-global-dimension-size-125));border-radius:var(--spectrum-alias-border-radius-regular,var(--spectrum-global-dimension-size-50));min-height:var(--spectrum-tooltip-min-height,var(--spectrum-global-dimension-size-300));font-size:var(--spectrum-tooltip-text-size,var(--spectrum-global-dimension-font-size-75));font-weight:var(--spectrum-tooltip-text-font-weight,var(--spectrum-global-font-weight-regular));line-height:var(--spectrum-tooltip-text-line-height,var(--spectrum-global-dimension-font-size-200));word-break:break-word;-webkit-font-smoothing:antialiased;cursor:default;-webkit-user-select:none;user-select:none;flex-direction:row;align-items:center;display:inline-flex;position:relative}.spectrum-Tooltip_22ae94 p{margin:0}.spectrum-Tooltip-tip_22ae94{height:0;width:0;border-width:var(--spectrum-tooltip-tip-height,var(--spectrum-global-dimension-size-50));border-style:solid;border-bottom-color:#0000;border-left-color:#0000;border-right-color:#0000;position:absolute}.spectrum-Tooltip--right_22ae94 .spectrum-Tooltip-tip_22ae94,.spectrum-Tooltip--left_22ae94 .spectrum-Tooltip-tip_22ae94{margin-top:calc(var(--spectrum-tooltip-tip-height,var(--spectrum-global-dimension-size-50))*-1);top:50%}.spectrum-Tooltip--right_22ae94{margin-left:var(--spectrum-global-dimension-size-40)}.spectrum-Tooltip--right_22ae94 .spectrum-Tooltip-tip_22ae94{right:100%;transform:rotate(90deg)}.spectrum-Tooltip--left_22ae94{margin-right:var(--spectrum-global-dimension-size-40)}.spectrum-Tooltip--left_22ae94 .spectrum-Tooltip-tip_22ae94{left:100%;transform:rotate(-90deg)}.spectrum-Tooltip--top_22ae94{margin-bottom:var(--spectrum-global-dimension-size-40)}.spectrum-Tooltip--top_22ae94 .spectrum-Tooltip-tip_22ae94{top:100%}.spectrum-Tooltip--bottom_22ae94{margin-top:var(--spectrum-global-dimension-size-40)}.spectrum-Tooltip--bottom_22ae94 .spectrum-Tooltip-tip_22ae94{bottom:100%;transform:rotate(-180deg)}.spectrum-Tooltip--bottom_22ae94 .spectrum-Tooltip-tip_22ae94,.spectrum-Tooltip--top_22ae94 .spectrum-Tooltip-tip_22ae94{margin-left:calc(var(--spectrum-tooltip-tip-height,var(--spectrum-global-dimension-size-50))*-1);left:50%}[dir=ltr] .spectrum-Tooltip-typeIcon_22ae94{margin-left:calc(var(--spectrum-tooltip-icon-margin-x,var(--spectrum-global-dimension-size-100)) - var(--spectrum-tooltip-padding-x,var(--spectrum-global-dimension-size-125)))}[dir=rtl] .spectrum-Tooltip-typeIcon_22ae94{margin-right:calc(var(--spectrum-tooltip-icon-margin-x,var(--spectrum-global-dimension-size-100)) - var(--spectrum-tooltip-padding-x,var(--spectrum-global-dimension-size-125)))}[dir=ltr] .spectrum-Tooltip-typeIcon_22ae94{margin-right:var(--spectrum-tooltip-icon-margin-x,var(--spectrum-global-dimension-size-100))}[dir=rtl] .spectrum-Tooltip-typeIcon_22ae94{margin-left:var(--spectrum-tooltip-icon-margin-x,var(--spectrum-global-dimension-size-100))}.spectrum-Tooltip-typeIcon_22ae94{width:var(--spectrum-tooltip-icon-size,var(--spectrum-global-dimension-size-175));height:var(--spectrum-tooltip-icon-size,var(--spectrum-global-dimension-size-175));align-self:flex-start;margin-top:1px}.spectrum-Tooltip-label_22ae94{max-width:var(--spectrum-tooltip-content-max-width);line-height:var(--spectrum-tooltip-text-line-height,var(--spectrum-global-dimension-font-size-200))}.u-tooltip-showOnHover_22ae94{display:inline-block;position:relative}.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip_22ae94{white-space:nowrap;transition:transform var(--spectrum-global-animation-duration-100,.13s)ease-in-out;position:absolute;top:-100%;visibility:visible!important}.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip-label_22ae94{max-width:none}.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip--right_22ae94,.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip--left_22ae94,.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip--right_22ae94 .spectrum-Tooltip-tip_22ae94,.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip--left_22ae94 .spectrum-Tooltip-tip_22ae94{top:50%}.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip--right_22ae94{left:100%;transform:translateY(-50%)}.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip--left_22ae94{transform:translate(-100%,-50%)}.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip--bottom_22ae94,.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip--top_22ae94,.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip--bottom_22ae94 .spectrum-Tooltip-tip_22ae94,.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip--top_22ae94 .spectrum-Tooltip-tip_22ae94{left:50%}.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip--bottom_22ae94{transform:translate(-50%,calc(var(--spectrum-tooltip-tip-margin,var(--spectrum-global-dimension-size-50))*-1));top:100%}.u-tooltip-showOnHover_22ae94 .spectrum-Tooltip--top_22ae94{transform:translate(-50%,var(--spectrum-tooltip-tip-margin,var(--spectrum-global-dimension-size-50)))}.u-tooltip-showOnHover_22ae94.is-hovered_22ae94 .spectrum-Tooltip_22ae94,.u-tooltip-showOnHover_22ae94:focus .spectrum-Tooltip_22ae94,.u-tooltip-showOnHover_22ae94.is-focused_22ae94 .spectrum-Tooltip_22ae94,.u-tooltip-showOnHover_22ae94 :focus .spectrum-Tooltip_22ae94{opacity:1}.u-tooltip-showOnHover_22ae94.is-hovered_22ae94 .spectrum-Tooltip_22ae94.spectrum-Tooltip--bottom_22ae94,.u-tooltip-showOnHover_22ae94:focus .spectrum-Tooltip_22ae94.spectrum-Tooltip--bottom_22ae94,.u-tooltip-showOnHover_22ae94.is-focused_22ae94 .spectrum-Tooltip_22ae94.spectrum-Tooltip--bottom_22ae94,.u-tooltip-showOnHover_22ae94 :focus .spectrum-Tooltip_22ae94.spectrum-Tooltip--bottom_22ae94{transform:translate(-50%)}.u-tooltip-showOnHover_22ae94.is-hovered_22ae94 .spectrum-Tooltip_22ae94.spectrum-Tooltip--top_22ae94,.u-tooltip-showOnHover_22ae94:focus .spectrum-Tooltip_22ae94.spectrum-Tooltip--top_22ae94,.u-tooltip-showOnHover_22ae94.is-focused_22ae94 .spectrum-Tooltip_22ae94.spectrum-Tooltip--top_22ae94,.u-tooltip-showOnHover_22ae94 :focus .spectrum-Tooltip_22ae94.spectrum-Tooltip--top_22ae94{transform:translate(-50%,calc(var(--spectrum-tooltip-tip-margin,var(--spectrum-global-dimension-size-50))*-1))}.u-tooltip-showOnHover_22ae94.is-hovered_22ae94 .spectrum-Tooltip_22ae94.spectrum-Tooltip--left_22ae94,.u-tooltip-showOnHover_22ae94:focus .spectrum-Tooltip_22ae94.spectrum-Tooltip--left_22ae94,.u-tooltip-showOnHover_22ae94.is-focused_22ae94 .spectrum-Tooltip_22ae94.spectrum-Tooltip--left_22ae94,.u-tooltip-showOnHover_22ae94 :focus .spectrum-Tooltip_22ae94.spectrum-Tooltip--left_22ae94{transform:translate(calc(-100% - var(--spectrum-tooltip-tip-margin,var(--spectrum-global-dimension-size-50))),-50%)}.u-tooltip-showOnHover_22ae94.is-hovered_22ae94 .spectrum-Tooltip_22ae94.spectrum-Tooltip--right_22ae94,.u-tooltip-showOnHover_22ae94:focus .spectrum-Tooltip_22ae94.spectrum-Tooltip--right_22ae94,.u-tooltip-showOnHover_22ae94.is-focused_22ae94 .spectrum-Tooltip_22ae94.spectrum-Tooltip--right_22ae94,.u-tooltip-showOnHover_22ae94 :focus .spectrum-Tooltip_22ae94.spectrum-Tooltip--right_22ae94{transform:translate(var(--spectrum-tooltip-tip-margin,var(--spectrum-global-dimension-size-50)),-50%)}.spectrum-Tooltip_22ae94{--spectrum-tooltip-negative-background-color:var(--spectrum-negative-background-color-default);--spectrum-tooltip-positive-background-color:var(--spectrum-positive-background-color-default);--spectrum-tooltip-info-background-color:var(--spectrum-informative-background-color-default);background-color:var(--spectrum-tooltip-background-color,var(--spectrum-global-color-static-gray-700));color:var(--spectrum-tooltip-text-color,var(--spectrum-global-color-static-white));filter:var(--spectrum-tooltip-dropshadow);-webkit-filter:var(--spectrum-tooltip-dropshadow);will-change:filter}.spectrum-Tooltip-tip_22ae94{border-top-color:var(--spectrum-tooltip-background-color,var(--spectrum-global-color-static-gray-700))}.spectrum-Tooltip--negative_22ae94,.spectrum-Tooltip--error_22ae94{background-color:var(--spectrum-tooltip-negative-background-color,var(--spectrum-global-color-static-red-700))}.spectrum-Tooltip--negative_22ae94 .spectrum-Tooltip-tip_22ae94,.spectrum-Tooltip--error_22ae94 .spectrum-Tooltip-tip_22ae94{border-top-color:var(--spectrum-tooltip-negative-background-color,var(--spectrum-global-color-static-red-700))}.spectrum-Tooltip--info_22ae94,.spectrum-Tooltip--help_22ae94{background-color:var(--spectrum-tooltip-info-background-color,var(--spectrum-global-color-static-blue-700))}.spectrum-Tooltip--info_22ae94 .spectrum-Tooltip-tip_22ae94,.spectrum-Tooltip--help_22ae94 .spectrum-Tooltip-tip_22ae94{border-top-color:var(--spectrum-tooltip-info-background-color,var(--spectrum-global-color-static-blue-700))}.spectrum-Tooltip--positive_22ae94,.spectrum-Tooltip--success_22ae94{background-color:var(--spectrum-tooltip-positive-background-color,var(--spectrum-global-color-static-green-700))}.spectrum-Tooltip--positive_22ae94 .spectrum-Tooltip-tip_22ae94,.spectrum-Tooltip--success_22ae94 .spectrum-Tooltip-tip_22ae94{border-top-color:var(--spectrum-tooltip-positive-background-color,var(--spectrum-global-color-static-green-700))}@media (forced-colors:active){.spectrum-Tooltip_22ae94{border:1px solid #0000}.spectrum-Tooltip-tip_22ae94{forced-color-adjust:none;--spectrum-tooltip-background-color:CanvasText;--spectrum-tooltip-negative-background-color:Highlight;--spectrum-tooltip-info-background-color:Highlight;--spectrum-tooltip-positive-background-color:Highlight}}
|
package/dist/main.js
CHANGED
@@ -20,7 +20,28 @@ function $parcel$interopDefault(a) {
|
|
20
20
|
|
21
21
|
$parcel$export(module.exports, "Tooltip", () => $55bd11986fcffc6f$export$28c660c63b792dea);
|
22
22
|
$parcel$export(module.exports, "TooltipTrigger", () => $19f06480c1c1a932$export$8c610744efcf8a1d);
|
23
|
-
|
23
|
+
/*
|
24
|
+
* Copyright 2020 Adobe. All rights reserved.
|
25
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
26
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
27
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
28
|
+
*
|
29
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
30
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
31
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
32
|
+
* governing permissions and limitations under the License.
|
33
|
+
*/ /// <reference types="css-module-types" />
|
34
|
+
/*
|
35
|
+
* Copyright 2020 Adobe. All rights reserved.
|
36
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
37
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
38
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
39
|
+
*
|
40
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
41
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
42
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
43
|
+
* governing permissions and limitations under the License.
|
44
|
+
*/
|
24
45
|
|
25
46
|
|
26
47
|
|
@@ -84,52 +105,70 @@ $ba73465d6d9b6556$export$4eae622bc9b08cac = "spectrum-Tooltip--success_22ae94";
|
|
84
105
|
|
85
106
|
|
86
107
|
|
87
|
-
|
88
|
-
|
89
|
-
|
108
|
+
/*
|
109
|
+
* Copyright 2020 Adobe. All rights reserved.
|
110
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
111
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
112
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
113
|
+
*
|
114
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
115
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
116
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
117
|
+
* governing permissions and limitations under the License.
|
118
|
+
*/
|
119
|
+
const $ed2e56c8503433b4$export$39ae08fa83328b12 = (0, ($parcel$interopDefault($kAvU8$react))).createContext({});
|
90
120
|
|
91
121
|
|
92
122
|
|
93
123
|
let $55bd11986fcffc6f$var$iconMap = {
|
94
|
-
info: ($parcel$interopDefault($kAvU8$spectrumiconsuiInfoSmall)),
|
95
|
-
positive: ($parcel$interopDefault($kAvU8$spectrumiconsuiSuccessSmall)),
|
96
|
-
negative: ($parcel$interopDefault($kAvU8$spectrumiconsuiAlertSmall))
|
124
|
+
info: (0, ($parcel$interopDefault($kAvU8$spectrumiconsuiInfoSmall))),
|
125
|
+
positive: (0, ($parcel$interopDefault($kAvU8$spectrumiconsuiSuccessSmall))),
|
126
|
+
negative: (0, ($parcel$interopDefault($kAvU8$spectrumiconsuiAlertSmall)))
|
97
127
|
};
|
98
128
|
function $55bd11986fcffc6f$var$Tooltip(props, ref) {
|
99
|
-
let { ref: overlayRef , arrowProps: arrowProps , state: state , ...tooltipProviderProps } = $kAvU8$react.useContext($ed2e56c8503433b4$export$39ae08fa83328b12);
|
100
|
-
let defaultRef = $kAvU8$react.useRef();
|
129
|
+
let { ref: overlayRef , arrowProps: arrowProps , state: state , ...tooltipProviderProps } = (0, $kAvU8$react.useContext)((0, $ed2e56c8503433b4$export$39ae08fa83328b12));
|
130
|
+
let defaultRef = (0, $kAvU8$react.useRef)();
|
101
131
|
overlayRef = overlayRef || defaultRef;
|
102
|
-
props = $kAvU8$reactariautils.mergeProps(props, tooltipProviderProps);
|
103
|
-
let { variant: variant =
|
104
|
-
let { styleProps: styleProps } = $kAvU8$reactspectrumutils.useStyleProps(otherProps);
|
105
|
-
let { tooltipProps: tooltipProps } = $kAvU8$reactariatooltip.useTooltip(props, state);
|
132
|
+
props = (0, $kAvU8$reactariautils.mergeProps)(props, tooltipProviderProps);
|
133
|
+
let { variant: variant = "neutral" , placement: placement = "top" , isOpen: isOpen , showIcon: showIcon , ...otherProps } = props;
|
134
|
+
let { styleProps: styleProps } = (0, $kAvU8$reactspectrumutils.useStyleProps)(otherProps);
|
135
|
+
let { tooltipProps: tooltipProps } = (0, $kAvU8$reactariatooltip.useTooltip)(props, state);
|
106
136
|
// Sync ref with overlayRef from context.
|
107
|
-
$kAvU8$react.useImperativeHandle(ref, ()
|
108
|
-
);
|
137
|
+
(0, $kAvU8$react.useImperativeHandle)(ref, ()=>(0, $kAvU8$reactspectrumutils.createDOMRef)(overlayRef));
|
109
138
|
let Icon = $55bd11986fcffc6f$var$iconMap[variant];
|
110
|
-
return
|
139
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($kAvU8$react))).createElement("div", {
|
111
140
|
...styleProps,
|
112
141
|
...tooltipProps,
|
113
|
-
className: $kAvU8$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($ba73465d6d9b6556$exports)),
|
114
|
-
|
142
|
+
className: (0, $kAvU8$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($ba73465d6d9b6556$exports))), "spectrum-Tooltip", `spectrum-Tooltip--${variant}`, `spectrum-Tooltip--${placement}`, {
|
143
|
+
"is-open": isOpen
|
115
144
|
}, styleProps.className),
|
116
145
|
ref: overlayRef
|
117
|
-
}, showIcon && variant !==
|
118
|
-
UNSAFE_className: $kAvU8$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($ba73465d6d9b6556$exports)),
|
146
|
+
}, showIcon && variant !== "neutral" && /*#__PURE__*/ (0, ($parcel$interopDefault($kAvU8$react))).createElement(Icon, {
|
147
|
+
UNSAFE_className: (0, $kAvU8$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($ba73465d6d9b6556$exports))), "spectrum-Tooltip-typeIcon"),
|
119
148
|
"aria-hidden": true
|
120
|
-
}), props.children && /*#__PURE__*/ ($parcel$interopDefault($kAvU8$react)).createElement("span", {
|
121
|
-
className: $kAvU8$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($ba73465d6d9b6556$exports)),
|
122
|
-
}, props.children), /*#__PURE__*/ ($parcel$interopDefault($kAvU8$react)).createElement("span", {
|
149
|
+
}), props.children && /*#__PURE__*/ (0, ($parcel$interopDefault($kAvU8$react))).createElement("span", {
|
150
|
+
className: (0, $kAvU8$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($ba73465d6d9b6556$exports))), "spectrum-Tooltip-label")
|
151
|
+
}, props.children), /*#__PURE__*/ (0, ($parcel$interopDefault($kAvU8$react))).createElement("span", {
|
123
152
|
...arrowProps,
|
124
|
-
className: $kAvU8$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($ba73465d6d9b6556$exports)),
|
125
|
-
}))
|
153
|
+
className: (0, $kAvU8$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($ba73465d6d9b6556$exports))), "spectrum-Tooltip-tip")
|
154
|
+
}));
|
126
155
|
}
|
127
156
|
/**
|
128
157
|
* Display container for Tooltip content. Has a directional arrow dependent on its placement.
|
129
|
-
*/ let $55bd11986fcffc6f$export$28c660c63b792dea = /*#__PURE__*/ ($parcel$interopDefault($kAvU8$react)).forwardRef($55bd11986fcffc6f$var$Tooltip);
|
130
|
-
|
158
|
+
*/ let $55bd11986fcffc6f$export$28c660c63b792dea = /*#__PURE__*/ (0, ($parcel$interopDefault($kAvU8$react))).forwardRef($55bd11986fcffc6f$var$Tooltip);
|
131
159
|
|
132
160
|
|
161
|
+
/*
|
162
|
+
* Copyright 2020 Adobe. All rights reserved.
|
163
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
164
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
165
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
166
|
+
*
|
167
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
168
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
169
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
170
|
+
* governing permissions and limitations under the License.
|
171
|
+
*/
|
133
172
|
|
134
173
|
|
135
174
|
|
@@ -140,16 +179,16 @@ const $19f06480c1c1a932$var$DEFAULT_OFFSET = -1; // Offset needed to reach 4px/5
|
|
140
179
|
const $19f06480c1c1a932$var$DEFAULT_CROSS_OFFSET = 0;
|
141
180
|
function $19f06480c1c1a932$var$TooltipTrigger(props) {
|
142
181
|
let { children: children , crossOffset: crossOffset = $19f06480c1c1a932$var$DEFAULT_CROSS_OFFSET , isDisabled: isDisabled , offset: offset = $19f06480c1c1a932$var$DEFAULT_OFFSET , trigger: triggerAction } = props;
|
143
|
-
let [trigger, tooltip] = ($parcel$interopDefault($kAvU8$react)).Children.toArray(children);
|
144
|
-
let state = $kAvU8$reactstatelytooltip.useTooltipTriggerState(props);
|
145
|
-
let tooltipTriggerRef = $kAvU8$react.useRef();
|
146
|
-
let overlayRef = $kAvU8$react.useRef();
|
147
|
-
let { triggerProps: triggerProps , tooltipProps: tooltipProps } = $kAvU8$reactariatooltip.useTooltipTrigger({
|
182
|
+
let [trigger, tooltip] = (0, ($parcel$interopDefault($kAvU8$react))).Children.toArray(children);
|
183
|
+
let state = (0, $kAvU8$reactstatelytooltip.useTooltipTriggerState)(props);
|
184
|
+
let tooltipTriggerRef = (0, $kAvU8$react.useRef)();
|
185
|
+
let overlayRef = (0, $kAvU8$react.useRef)();
|
186
|
+
let { triggerProps: triggerProps , tooltipProps: tooltipProps } = (0, $kAvU8$reactariatooltip.useTooltipTrigger)({
|
148
187
|
isDisabled: isDisabled,
|
149
188
|
trigger: triggerAction
|
150
189
|
}, state, tooltipTriggerRef);
|
151
|
-
let { overlayProps: overlayProps , arrowProps: arrowProps , placement: placement } = $kAvU8$reactariaoverlays.useOverlayPosition({
|
152
|
-
placement: props.placement ||
|
190
|
+
let { overlayProps: overlayProps , arrowProps: arrowProps , placement: placement } = (0, $kAvU8$reactariaoverlays.useOverlayPosition)({
|
191
|
+
placement: props.placement || "top",
|
153
192
|
targetRef: tooltipTriggerRef,
|
154
193
|
overlayRef: overlayRef,
|
155
194
|
offset: offset,
|
@@ -158,10 +197,10 @@ function $19f06480c1c1a932$var$TooltipTrigger(props) {
|
|
158
197
|
shouldFlip: props.shouldFlip,
|
159
198
|
containerPadding: props.containerPadding
|
160
199
|
});
|
161
|
-
return
|
200
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($kAvU8$react))).createElement((0, $kAvU8$reactariafocus.FocusableProvider), {
|
162
201
|
...triggerProps,
|
163
202
|
ref: tooltipTriggerRef
|
164
|
-
}, trigger, /*#__PURE__*/ ($parcel$interopDefault($kAvU8$react)).createElement($ed2e56c8503433b4$export$39ae08fa83328b12.Provider, {
|
203
|
+
}, trigger, /*#__PURE__*/ (0, ($parcel$interopDefault($kAvU8$react))).createElement((0, $ed2e56c8503433b4$export$39ae08fa83328b12).Provider, {
|
165
204
|
value: {
|
166
205
|
state: state,
|
167
206
|
placement: placement,
|
@@ -170,21 +209,21 @@ function $19f06480c1c1a932$var$TooltipTrigger(props) {
|
|
170
209
|
arrowProps: arrowProps,
|
171
210
|
...tooltipProps
|
172
211
|
}
|
173
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($kAvU8$react)).createElement($kAvU8$reactspectrumoverlays.Overlay, {
|
212
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($kAvU8$react))).createElement((0, $kAvU8$reactspectrumoverlays.Overlay), {
|
174
213
|
isOpen: state.isOpen
|
175
|
-
}, tooltip)))
|
214
|
+
}, tooltip)));
|
176
215
|
}
|
177
216
|
// Support TooltipTrigger inside components using CollectionBuilder.
|
178
217
|
$19f06480c1c1a932$var$TooltipTrigger.getCollectionNode = function*(props) {
|
179
218
|
// Replaced the use of React.Childern.toArray because it mutates the key prop.
|
180
219
|
let childArray = [];
|
181
|
-
($parcel$interopDefault($kAvU8$react)).Children.forEach(props.children, (child)=>{
|
182
|
-
if (/*#__PURE__*/ ($parcel$interopDefault($kAvU8$react)).isValidElement(child)) childArray.push(child);
|
220
|
+
(0, ($parcel$interopDefault($kAvU8$react))).Children.forEach(props.children, (child)=>{
|
221
|
+
if (/*#__PURE__*/ (0, ($parcel$interopDefault($kAvU8$react))).isValidElement(child)) childArray.push(child);
|
183
222
|
});
|
184
223
|
let [trigger, tooltip] = childArray;
|
185
224
|
yield {
|
186
225
|
element: trigger,
|
187
|
-
wrapper: (element)=>/*#__PURE__*/ ($parcel$interopDefault($kAvU8$react)).createElement($19f06480c1c1a932$var$TooltipTrigger, {
|
226
|
+
wrapper: (element)=>/*#__PURE__*/ (0, ($parcel$interopDefault($kAvU8$react))).createElement($19f06480c1c1a932$var$TooltipTrigger, {
|
188
227
|
key: element.key,
|
189
228
|
...props
|
190
229
|
}, element, tooltip)
|
package/dist/main.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEAA,GAAkC;AAClC,GAAyB;AACzB,GAA0C;AAC1C,GAAuC;AACvC,GAAyC;AACzC,GAAwC;AACxC,GAAsC;AACtC,GAA2C;AAC3C,GAAwC;AACxC,GAAuC;AACvC,GAA4B;AAC5B,GAA4B;AAC5B,GAA4C;AAC5C,GAAyC;AACzC,GAAwC;AACxC,GAAwC;AACxC,GAA4C;AAC5C,GAA2C;AAjB3C,yCAAkC,GAAG,CAAyB;AAC9D,yCAAyB,GAAG,CAAgB;AAC5C,yCAA0C,GAAG,CAAiC;AAC9E,yCAAuC,GAAG,CAA8B;AACxE,yCAAyC,GAAG,CAAgC;AAC5E,yCAAwC,GAAG,CAA+B;AAC1E,wCAAsC,GAAG,CAA6B;AACtE,yCAA2C,GAAG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OAAO,EAAE,OAAO;QAChB,OAAO,GAAG,OAAO,sEACd,oCAAc;gBAAC,GAAG,EAAE,OAAO,CAAC,GAAG;mBAAM,KAAK;eACxC,OAAO,EACP,OAAO;IAGd,CAAC;AACH,CAAC;AAED,EAIG,AAJH;;;;CAIG,AAJH,EAIG,CACH,EAAoE,AAApE,kEAAoE;AACpE,GAAG,CAAC,yCAAe,GAAG,oCAAc;;","sources":["packages/@react-spectrum/tooltip/src/index.ts","packages/@react-spectrum/tooltip/src/Tooltip.tsx","packages/@adobe/spectrum-css-temp/components/tooltip/vars.css","packages/@react-spectrum/tooltip/src/context.ts","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\n/// <reference types=\"css-module-types\" />\n\nexport {Tooltip} from './Tooltip';\nexport {TooltipTrigger} from './TooltipTrigger';\nexport type {SpectrumTooltipProps, SpectrumTooltipTriggerProps} from '@react-types/tooltip';\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, 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\nfunction Tooltip(props: SpectrumTooltipProps, ref: DOMRef) {\n let {ref: overlayRef, arrowProps, state, ...tooltipProviderProps} = useContext(TooltipContext);\n let defaultRef = useRef();\n overlayRef = overlayRef || defaultRef;\n props = mergeProps(props, tooltipProviderProps);\n let {\n variant = 'neutral',\n placement = 'top',\n isOpen,\n showIcon,\n ...otherProps\n } = props;\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 },\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} className={classNames(styles, 'spectrum-Tooltip-tip')} />\n </div>\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","/*\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 {PlacementAxis} from '@react-types/overlays';\nimport React, {HTMLAttributes, RefObject} from 'react';\nimport {StyleProps} from '@react-types/shared';\nimport {TooltipTriggerState} from '@react-stately/tooltip';\n\ninterface TooltipContextProps extends StyleProps {\n state?: TooltipTriggerState,\n ref?: RefObject<HTMLDivElement>,\n placement?: PlacementAxis,\n arrowProps?: HTMLAttributes<HTMLElement>\n}\n\nexport const TooltipContext = React.createContext<TooltipContextProps>({});\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 {FocusableProvider} from '@react-aria/focus';\nimport {Overlay} from '@react-spectrum/overlays';\nimport React, {ReactElement, useRef} from 'react';\nimport {SpectrumTooltipTriggerProps} from '@react-types/tooltip';\nimport {TooltipContext} from './context';\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;\n\nfunction TooltipTrigger(props: SpectrumTooltipTriggerProps) {\n let {\n children,\n crossOffset = DEFAULT_CROSS_OFFSET,\n isDisabled,\n offset = DEFAULT_OFFSET,\n trigger: triggerAction\n } = props;\n\n let [trigger, tooltip] = React.Children.toArray(children);\n\n let state = useTooltipTriggerState(props);\n\n let tooltipTriggerRef = useRef<HTMLElement>();\n let overlayRef = useRef<HTMLDivElement>();\n\n let {triggerProps, tooltipProps} = useTooltipTrigger({\n isDisabled,\n trigger: triggerAction\n }, state, tooltipTriggerRef);\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 });\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 ...tooltipProps\n }}>\n <Overlay isOpen={state.isOpen}>\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.Childern.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":"main.js.map"}
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,0CAA0C;ACZ1C;;;;;;;;;;CAUC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;ACZA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AAjBA,4CAAqC;AACrC,4CAA4B;AAC5B,4CAA6C;AAC7C,4CAA0C;AAC1C,4CAA4C;AAC5C,4CAA2C;AAC3C,2CAAyC;AACzC,4CAA8C;AAC9C,4CAA2C;AAC3C,4CAA0C;AAC1C,4CAA+B;AAC/B,4CAA+B;AAC/B,4CAA+C;AAC/C,4CAA4C;AAC5C,4CAA2C;AAC3C,4CAA2C;AAC3C,4CAA+C;AAC/C,4CAA8C;;;;ACjB9C;;;;;;;;;;CAUC,GAED;AAYO,MAAM,4CAAiB,CAAA,GAAA,sCAAK,AAAD,EAAE,aAAa,CAAsB,CAAC;;;;AFAxE,IAAI,gCAAU;IACZ,MAAM,CAAA,GAAA,yDAAS,AAAD;IACd,UAAU,CAAA,GAAA,yDAAY,GAAD;IACrB,UAAU,CAAA,GAAA,yDAAU,CAAD;AACrB;AAEA,SAAS,8BAAQ,KAA2B,EAAE,GAAW,EAAE;IACzD,IAAI,EAAC,KAAK,WAAU,cAAE,WAAU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,QAAQ,CAAC,OAAO,CAAC,MAAM,QAAQ,EAAE,CAAA,QAAS;QAC9C,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/index.ts","packages/@react-spectrum/tooltip/src/Tooltip.tsx","packages/@adobe/spectrum-css-temp/components/tooltip/vars.css","packages/@react-spectrum/tooltip/src/context.ts","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\n/// <reference types=\"css-module-types\" />\n\nexport {Tooltip} from './Tooltip';\nexport {TooltipTrigger} from './TooltipTrigger';\nexport type {SpectrumTooltipProps, SpectrumTooltipTriggerProps} from '@react-types/tooltip';\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, 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\nfunction Tooltip(props: SpectrumTooltipProps, ref: DOMRef) {\n let {ref: overlayRef, arrowProps, state, ...tooltipProviderProps} = useContext(TooltipContext);\n let defaultRef = useRef();\n overlayRef = overlayRef || defaultRef;\n props = mergeProps(props, tooltipProviderProps);\n let {\n variant = 'neutral',\n placement = 'top',\n isOpen,\n showIcon,\n ...otherProps\n } = props;\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 },\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} className={classNames(styles, 'spectrum-Tooltip-tip')} />\n </div>\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","/*\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 {PlacementAxis} from '@react-types/overlays';\nimport React, {HTMLAttributes, RefObject} from 'react';\nimport {StyleProps} from '@react-types/shared';\nimport {TooltipTriggerState} from '@react-stately/tooltip';\n\ninterface TooltipContextProps extends StyleProps {\n state?: TooltipTriggerState,\n ref?: RefObject<HTMLDivElement>,\n placement?: PlacementAxis,\n arrowProps?: HTMLAttributes<HTMLElement>\n}\n\nexport const TooltipContext = React.createContext<TooltipContextProps>({});\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 {FocusableProvider} from '@react-aria/focus';\nimport {Overlay} from '@react-spectrum/overlays';\nimport React, {ReactElement, useRef} from 'react';\nimport {SpectrumTooltipTriggerProps} from '@react-types/tooltip';\nimport {TooltipContext} from './context';\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;\n\nfunction TooltipTrigger(props: SpectrumTooltipTriggerProps) {\n let {\n children,\n crossOffset = DEFAULT_CROSS_OFFSET,\n isDisabled,\n offset = DEFAULT_OFFSET,\n trigger: triggerAction\n } = props;\n\n let [trigger, tooltip] = React.Children.toArray(children);\n\n let state = useTooltipTriggerState(props);\n\n let tooltipTriggerRef = useRef<HTMLElement>();\n let overlayRef = useRef<HTMLDivElement>();\n\n let {triggerProps, tooltipProps} = useTooltipTrigger({\n isDisabled,\n trigger: triggerAction\n }, state, tooltipTriggerRef);\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 });\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 ...tooltipProps\n }}>\n <Overlay isOpen={state.isOpen}>\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.Childern.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":"main.js.map"}
|
package/dist/module.js
CHANGED
@@ -17,7 +17,28 @@ function $parcel$interopDefault(a) {
|
|
17
17
|
function $parcel$export(e, n, v, s) {
|
18
18
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
19
19
|
}
|
20
|
-
|
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
|
+
*/
|
21
42
|
|
22
43
|
|
23
44
|
|
@@ -81,52 +102,70 @@ $1e9110aec8886b85$export$4eae622bc9b08cac = "spectrum-Tooltip--success_22ae94";
|
|
81
102
|
|
82
103
|
|
83
104
|
|
84
|
-
|
85
|
-
|
86
|
-
|
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({});
|
87
117
|
|
88
118
|
|
89
119
|
|
90
120
|
let $dc9e2a6f9971fb04$var$iconMap = {
|
91
|
-
info: $lbkGW$spectrumiconsuiInfoSmall,
|
92
|
-
positive: $lbkGW$spectrumiconsuiSuccessSmall,
|
93
|
-
negative: $lbkGW$spectrumiconsuiAlertSmall
|
121
|
+
info: (0, $lbkGW$spectrumiconsuiInfoSmall),
|
122
|
+
positive: (0, $lbkGW$spectrumiconsuiSuccessSmall),
|
123
|
+
negative: (0, $lbkGW$spectrumiconsuiAlertSmall)
|
94
124
|
};
|
95
125
|
function $dc9e2a6f9971fb04$var$Tooltip(props, ref) {
|
96
|
-
let { ref: overlayRef , arrowProps: arrowProps , state: state , ...tooltipProviderProps } = $lbkGW$useContext($b8c00169fae46ac7$export$39ae08fa83328b12);
|
97
|
-
let defaultRef = $lbkGW$useRef();
|
126
|
+
let { ref: overlayRef , arrowProps: arrowProps , state: state , ...tooltipProviderProps } = (0, $lbkGW$useContext)((0, $b8c00169fae46ac7$export$39ae08fa83328b12));
|
127
|
+
let defaultRef = (0, $lbkGW$useRef)();
|
98
128
|
overlayRef = overlayRef || defaultRef;
|
99
|
-
props = $lbkGW$mergeProps(props, tooltipProviderProps);
|
100
|
-
let { variant: variant =
|
101
|
-
let { styleProps: styleProps } = $lbkGW$useStyleProps(otherProps);
|
102
|
-
let { tooltipProps: tooltipProps } = $lbkGW$useTooltip(props, state);
|
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);
|
103
133
|
// Sync ref with overlayRef from context.
|
104
|
-
$lbkGW$useImperativeHandle(ref, ()
|
105
|
-
);
|
134
|
+
(0, $lbkGW$useImperativeHandle)(ref, ()=>(0, $lbkGW$createDOMRef)(overlayRef));
|
106
135
|
let Icon = $dc9e2a6f9971fb04$var$iconMap[variant];
|
107
|
-
return
|
136
|
+
return /*#__PURE__*/ (0, $lbkGW$react).createElement("div", {
|
108
137
|
...styleProps,
|
109
138
|
...tooltipProps,
|
110
|
-
className: $lbkGW$classNames((/*@__PURE__*/$parcel$interopDefault($1e9110aec8886b85$exports)),
|
111
|
-
|
139
|
+
className: (0, $lbkGW$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($1e9110aec8886b85$exports))), "spectrum-Tooltip", `spectrum-Tooltip--${variant}`, `spectrum-Tooltip--${placement}`, {
|
140
|
+
"is-open": isOpen
|
112
141
|
}, styleProps.className),
|
113
142
|
ref: overlayRef
|
114
|
-
}, showIcon && variant !==
|
115
|
-
UNSAFE_className: $lbkGW$classNames((/*@__PURE__*/$parcel$interopDefault($1e9110aec8886b85$exports)),
|
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"),
|
116
145
|
"aria-hidden": true
|
117
|
-
}), props.children && /*#__PURE__*/ $lbkGW$react.createElement("span", {
|
118
|
-
className: $lbkGW$classNames((/*@__PURE__*/$parcel$interopDefault($1e9110aec8886b85$exports)),
|
119
|
-
}, props.children), /*#__PURE__*/ $lbkGW$react.createElement("span", {
|
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", {
|
120
149
|
...arrowProps,
|
121
|
-
className: $lbkGW$classNames((/*@__PURE__*/$parcel$interopDefault($1e9110aec8886b85$exports)),
|
122
|
-
}))
|
150
|
+
className: (0, $lbkGW$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($1e9110aec8886b85$exports))), "spectrum-Tooltip-tip")
|
151
|
+
}));
|
123
152
|
}
|
124
153
|
/**
|
125
154
|
* Display container for Tooltip content. Has a directional arrow dependent on its placement.
|
126
|
-
*/ let $dc9e2a6f9971fb04$export$28c660c63b792dea = /*#__PURE__*/ $lbkGW$react.forwardRef($dc9e2a6f9971fb04$var$Tooltip);
|
127
|
-
|
155
|
+
*/ let $dc9e2a6f9971fb04$export$28c660c63b792dea = /*#__PURE__*/ (0, $lbkGW$react).forwardRef($dc9e2a6f9971fb04$var$Tooltip);
|
128
156
|
|
129
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
|
+
*/
|
130
169
|
|
131
170
|
|
132
171
|
|
@@ -137,16 +176,16 @@ const $019364e6919ef1db$var$DEFAULT_OFFSET = -1; // Offset needed to reach 4px/5
|
|
137
176
|
const $019364e6919ef1db$var$DEFAULT_CROSS_OFFSET = 0;
|
138
177
|
function $019364e6919ef1db$var$TooltipTrigger(props) {
|
139
178
|
let { children: children , crossOffset: crossOffset = $019364e6919ef1db$var$DEFAULT_CROSS_OFFSET , isDisabled: isDisabled , offset: offset = $019364e6919ef1db$var$DEFAULT_OFFSET , trigger: triggerAction } = props;
|
140
|
-
let [trigger, tooltip] = $lbkGW$react.Children.toArray(children);
|
141
|
-
let state = $lbkGW$useTooltipTriggerState(props);
|
142
|
-
let tooltipTriggerRef = $lbkGW$useRef();
|
143
|
-
let overlayRef = $lbkGW$useRef();
|
144
|
-
let { triggerProps: triggerProps , tooltipProps: tooltipProps } = $lbkGW$useTooltipTrigger({
|
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)({
|
145
184
|
isDisabled: isDisabled,
|
146
185
|
trigger: triggerAction
|
147
186
|
}, state, tooltipTriggerRef);
|
148
|
-
let { overlayProps: overlayProps , arrowProps: arrowProps , placement: placement } = $lbkGW$useOverlayPosition({
|
149
|
-
placement: props.placement ||
|
187
|
+
let { overlayProps: overlayProps , arrowProps: arrowProps , placement: placement } = (0, $lbkGW$useOverlayPosition)({
|
188
|
+
placement: props.placement || "top",
|
150
189
|
targetRef: tooltipTriggerRef,
|
151
190
|
overlayRef: overlayRef,
|
152
191
|
offset: offset,
|
@@ -155,10 +194,10 @@ function $019364e6919ef1db$var$TooltipTrigger(props) {
|
|
155
194
|
shouldFlip: props.shouldFlip,
|
156
195
|
containerPadding: props.containerPadding
|
157
196
|
});
|
158
|
-
return
|
197
|
+
return /*#__PURE__*/ (0, $lbkGW$react).createElement((0, $lbkGW$FocusableProvider), {
|
159
198
|
...triggerProps,
|
160
199
|
ref: tooltipTriggerRef
|
161
|
-
}, trigger, /*#__PURE__*/ $lbkGW$react.createElement($b8c00169fae46ac7$export$39ae08fa83328b12.Provider, {
|
200
|
+
}, trigger, /*#__PURE__*/ (0, $lbkGW$react).createElement((0, $b8c00169fae46ac7$export$39ae08fa83328b12).Provider, {
|
162
201
|
value: {
|
163
202
|
state: state,
|
164
203
|
placement: placement,
|
@@ -167,21 +206,21 @@ function $019364e6919ef1db$var$TooltipTrigger(props) {
|
|
167
206
|
arrowProps: arrowProps,
|
168
207
|
...tooltipProps
|
169
208
|
}
|
170
|
-
}, /*#__PURE__*/ $lbkGW$react.createElement($lbkGW$Overlay, {
|
209
|
+
}, /*#__PURE__*/ (0, $lbkGW$react).createElement((0, $lbkGW$Overlay), {
|
171
210
|
isOpen: state.isOpen
|
172
|
-
}, tooltip)))
|
211
|
+
}, tooltip)));
|
173
212
|
}
|
174
213
|
// Support TooltipTrigger inside components using CollectionBuilder.
|
175
214
|
$019364e6919ef1db$var$TooltipTrigger.getCollectionNode = function*(props) {
|
176
215
|
// Replaced the use of React.Childern.toArray because it mutates the key prop.
|
177
216
|
let childArray = [];
|
178
|
-
$lbkGW$react.Children.forEach(props.children, (child)=>{
|
179
|
-
if (/*#__PURE__*/ $lbkGW$react.isValidElement(child)) childArray.push(child);
|
217
|
+
(0, $lbkGW$react).Children.forEach(props.children, (child)=>{
|
218
|
+
if (/*#__PURE__*/ (0, $lbkGW$react).isValidElement(child)) childArray.push(child);
|
180
219
|
});
|
181
220
|
let [trigger, tooltip] = childArray;
|
182
221
|
yield {
|
183
222
|
element: trigger,
|
184
|
-
wrapper: (element)=>/*#__PURE__*/ $lbkGW$react.createElement($019364e6919ef1db$var$TooltipTrigger, {
|
223
|
+
wrapper: (element)=>/*#__PURE__*/ (0, $lbkGW$react).createElement($019364e6919ef1db$var$TooltipTrigger, {
|
185
224
|
key: element.key,
|
186
225
|
...props
|
187
226
|
}, element, tooltip)
|
package/dist/module.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEAA,GAAkC;AAClC,GAAyB;AACzB,GAA0C;AAC1C,GAAuC;AACvC,GAAyC;AACzC,GAAwC;AACxC,GAAsC;AACtC,GAA2C;AAC3C,GAAwC;AACxC,GAAuC;AACvC,GAA4B;AAC5B,GAA4B;AAC5B,GAA4C;AAC5C,GAAyC;AACzC,GAAwC;AACxC,GAAwC;AACxC,GAA4C;AAC5C,GAA2C;AAjB3C,yCAAkC,GAAG,CAAyB;AAC9D,yCAAyB,GAAG,CAAgB;AAC5C,yCAA0C,GAAG,CAAiC;AAC9E,yCAAuC,GAAG,CAA8B;AACxE,yCAAyC,GAAG,CAAgC;AAC5E,yCAAwC,GAAG,CAA+B;AAC1E,wCAAsC,GAAG,CAA6B;AACtE,yCAA2C,GAAG,CAAkC;AAChF,yCAAwC,GAAG,CAA+B;AAC1E,yCAAuC,GAAG,CAA8B;AACxE,yCAA4B,GAAG,CAAmB;AAClD,yCAA4B,GAAG,CAAmB;AAClD,yCAA4C,GAAG,CAAmC;AAClF,yCAAyC,GAAG,CAAgC;AAC5E,yCAAwC,GAAG,CAA+B;AAC1E,yCAAwC,GAAG,CAA+B;AAC1E,yCAA4C,GAAG,CAAmC;AAClF,yCAA2C,GAAG,CAAkC;;;;;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ltip/src/Tooltip.tsx","packages/@adobe/spectrum-css-temp/components/tooltip/vars.css","packages/@react-spectrum/tooltip/src/context.ts","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\n/// <reference types=\"css-module-types\" />\n\nexport {Tooltip} from './Tooltip';\nexport {TooltipTrigger} from './TooltipTrigger';\nexport type {SpectrumTooltipProps, SpectrumTooltipTriggerProps} from '@react-types/tooltip';\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, 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\nfunction Tooltip(props: SpectrumTooltipProps, ref: DOMRef) {\n let {ref: overlayRef, arrowProps, state, ...tooltipProviderProps} = useContext(TooltipContext);\n let defaultRef = useRef();\n overlayRef = overlayRef || defaultRef;\n props = mergeProps(props, tooltipProviderProps);\n let {\n variant = 'neutral',\n placement = 'top',\n isOpen,\n showIcon,\n ...otherProps\n } = props;\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 },\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} className={classNames(styles, 'spectrum-Tooltip-tip')} />\n </div>\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","/*\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 {PlacementAxis} from '@react-types/overlays';\nimport React, {HTMLAttributes, RefObject} from 'react';\nimport {StyleProps} from '@react-types/shared';\nimport {TooltipTriggerState} from '@react-stately/tooltip';\n\ninterface TooltipContextProps extends StyleProps {\n state?: TooltipTriggerState,\n ref?: RefObject<HTMLDivElement>,\n placement?: PlacementAxis,\n arrowProps?: HTMLAttributes<HTMLElement>\n}\n\nexport const TooltipContext = React.createContext<TooltipContextProps>({});\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 {FocusableProvider} from '@react-aria/focus';\nimport {Overlay} from '@react-spectrum/overlays';\nimport React, {ReactElement, useRef} from 'react';\nimport {SpectrumTooltipTriggerProps} from '@react-types/tooltip';\nimport {TooltipContext} from './context';\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;\n\nfunction TooltipTrigger(props: SpectrumTooltipTriggerProps) {\n let {\n children,\n crossOffset = DEFAULT_CROSS_OFFSET,\n isDisabled,\n offset = DEFAULT_OFFSET,\n trigger: triggerAction\n } = props;\n\n let [trigger, tooltip] = React.Children.toArray(children);\n\n let state = useTooltipTriggerState(props);\n\n let tooltipTriggerRef = useRef<HTMLElement>();\n let overlayRef = useRef<HTMLDivElement>();\n\n let {triggerProps, tooltipProps} = useTooltipTrigger({\n isDisabled,\n trigger: triggerAction\n }, state, tooltipTriggerRef);\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 });\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 ...tooltipProps\n }}>\n <Overlay isOpen={state.isOpen}>\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.Childern.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":"module.js.map"}
|
1
|
+
{"mappings":";;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I,4CAAkB;","sources":["packages/@react-spectrum/tooltip/src/index.ts","packages/@react-spectrum/tooltip/src/Tooltip.tsx","packages/@adobe/spectrum-css-temp/components/tooltip/vars.css","packages/@react-spectrum/tooltip/src/context.ts","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\n/// <reference types=\"css-module-types\" />\n\nexport {Tooltip} from './Tooltip';\nexport {TooltipTrigger} from './TooltipTrigger';\nexport type {SpectrumTooltipProps, SpectrumTooltipTriggerProps} from '@react-types/tooltip';\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, 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\nfunction Tooltip(props: SpectrumTooltipProps, ref: DOMRef) {\n let {ref: overlayRef, arrowProps, state, ...tooltipProviderProps} = useContext(TooltipContext);\n let defaultRef = useRef();\n overlayRef = overlayRef || defaultRef;\n props = mergeProps(props, tooltipProviderProps);\n let {\n variant = 'neutral',\n placement = 'top',\n isOpen,\n showIcon,\n ...otherProps\n } = props;\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 },\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} className={classNames(styles, 'spectrum-Tooltip-tip')} />\n </div>\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","/*\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 {PlacementAxis} from '@react-types/overlays';\nimport React, {HTMLAttributes, RefObject} from 'react';\nimport {StyleProps} from '@react-types/shared';\nimport {TooltipTriggerState} from '@react-stately/tooltip';\n\ninterface TooltipContextProps extends StyleProps {\n state?: TooltipTriggerState,\n ref?: RefObject<HTMLDivElement>,\n placement?: PlacementAxis,\n arrowProps?: HTMLAttributes<HTMLElement>\n}\n\nexport const TooltipContext = React.createContext<TooltipContextProps>({});\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 {FocusableProvider} from '@react-aria/focus';\nimport {Overlay} from '@react-spectrum/overlays';\nimport React, {ReactElement, useRef} from 'react';\nimport {SpectrumTooltipTriggerProps} from '@react-types/tooltip';\nimport {TooltipContext} from './context';\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;\n\nfunction TooltipTrigger(props: SpectrumTooltipTriggerProps) {\n let {\n children,\n crossOffset = DEFAULT_CROSS_OFFSET,\n isDisabled,\n offset = DEFAULT_OFFSET,\n trigger: triggerAction\n } = props;\n\n let [trigger, tooltip] = React.Children.toArray(children);\n\n let state = useTooltipTriggerState(props);\n\n let tooltipTriggerRef = useRef<HTMLElement>();\n let overlayRef = useRef<HTMLDivElement>();\n\n let {triggerProps, tooltipProps} = useTooltipTrigger({\n isDisabled,\n trigger: triggerAction\n }, state, tooltipTriggerRef);\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 });\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 ...tooltipProps\n }}>\n <Overlay isOpen={state.isOpen}>\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.Childern.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":"module.js.map"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-spectrum/tooltip",
|
3
|
-
"version": "3.3.
|
3
|
+
"version": "3.3.4",
|
4
4
|
"description": "Spectrum UI components in React",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "dist/main.js",
|
@@ -31,20 +31,20 @@
|
|
31
31
|
"url": "https://github.com/adobe/react-spectrum"
|
32
32
|
},
|
33
33
|
"dependencies": {
|
34
|
-
"@
|
35
|
-
"@react-aria/
|
36
|
-
"@react-aria/
|
37
|
-
"@react-aria/
|
38
|
-
"@react-aria/
|
39
|
-
"@react-
|
40
|
-
"@react-spectrum/
|
41
|
-
"@react-
|
42
|
-
"@react-stately/
|
43
|
-
"@react-stately/utils": "^3.5.1",
|
34
|
+
"@react-aria/focus": "^3.10.1",
|
35
|
+
"@react-aria/interactions": "^3.13.1",
|
36
|
+
"@react-aria/overlays": "^3.12.1",
|
37
|
+
"@react-aria/tooltip": "^3.3.4",
|
38
|
+
"@react-aria/utils": "^3.14.2",
|
39
|
+
"@react-spectrum/overlays": "^4.1.0",
|
40
|
+
"@react-spectrum/utils": "^3.8.1",
|
41
|
+
"@react-stately/tooltip": "^3.2.4",
|
42
|
+
"@react-stately/utils": "^3.5.2",
|
44
43
|
"@react-types/overlays": "^3.6.5",
|
45
44
|
"@react-types/shared": "^3.16.0",
|
46
45
|
"@react-types/tooltip": "^3.2.5",
|
47
|
-
"@spectrum-icons/ui": "^3.4.
|
46
|
+
"@spectrum-icons/ui": "^3.4.1",
|
47
|
+
"@swc/helpers": "^0.4.14"
|
48
48
|
},
|
49
49
|
"devDependencies": {
|
50
50
|
"@adobe/spectrum-css-temp": "3.0.0-alpha.1"
|
@@ -57,5 +57,5 @@
|
|
57
57
|
"publishConfig": {
|
58
58
|
"access": "public"
|
59
59
|
},
|
60
|
-
"gitHead": "
|
60
|
+
"gitHead": "5480d76bd815e239366f92852c76b6831ad2a4fd"
|
61
61
|
}
|