@react-spectrum/tooltip 3.6.11 → 3.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Tooltip.main.js +7 -8
- package/dist/Tooltip.main.js.map +1 -1
- package/dist/Tooltip.mjs +7 -8
- package/dist/Tooltip.module.js +7 -8
- package/dist/Tooltip.module.js.map +1 -1
- package/dist/TooltipTrigger.main.js +2 -2
- package/dist/TooltipTrigger.main.js.map +1 -1
- package/dist/TooltipTrigger.mjs +2 -2
- package/dist/TooltipTrigger.module.js +2 -2
- package/dist/TooltipTrigger.module.js.map +1 -1
- package/dist/context.main.js +3 -1
- package/dist/context.main.js.map +1 -1
- package/dist/context.mjs +3 -1
- package/dist/context.module.js +3 -1
- package/dist/context.module.js.map +1 -1
- package/dist/tooltip_vars_css.main.js.map +1 -1
- package/dist/tooltip_vars_css.module.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/{vars.e2a76556.css → vars.adff832d.css} +2 -2
- package/dist/{vars.e2a76556.css.map → vars.adff832d.css.map} +1 -1
- package/package.json +15 -15
- package/src/Tooltip.tsx +11 -10
- package/src/TooltipTrigger.tsx +3 -3
- package/src/context.ts +2 -2
package/dist/Tooltip.main.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require("./vars.
|
1
|
+
require("./vars.adff832d.css");
|
2
2
|
var $ba73465d6d9b6556$exports = require("./tooltip_vars_css.main.js");
|
3
3
|
var $ed2e56c8503433b4$exports = require("./context.main.js");
|
4
4
|
var $l0Ry0$spectrumiconsuiAlertSmall = require("@spectrum-icons/ui/AlertSmall");
|
@@ -43,12 +43,14 @@ let $55bd11986fcffc6f$var$iconMap = {
|
|
43
43
|
positive: (0, ($parcel$interopDefault($l0Ry0$spectrumiconsuiSuccessSmall))),
|
44
44
|
negative: (0, ($parcel$interopDefault($l0Ry0$spectrumiconsuiAlertSmall)))
|
45
45
|
};
|
46
|
-
|
46
|
+
const $55bd11986fcffc6f$export$28c660c63b792dea = /*#__PURE__*/ (0, ($parcel$interopDefault($l0Ry0$react))).forwardRef(function Tooltip(props, ref) {
|
47
47
|
let { ref: overlayRef, arrowProps: arrowProps, state: state, arrowRef: arrowRef, ...tooltipProviderProps } = (0, $l0Ry0$react.useContext)((0, $ed2e56c8503433b4$exports.TooltipContext));
|
48
|
-
let defaultRef = (0, $l0Ry0$react.useRef)(
|
48
|
+
let defaultRef = (0, $l0Ry0$react.useRef)(null);
|
49
49
|
overlayRef = overlayRef || defaultRef;
|
50
|
+
let backupPlacement = props.placement;
|
50
51
|
props = (0, $l0Ry0$reactariautils.mergeProps)(props, tooltipProviderProps);
|
51
|
-
let { variant: variant = 'neutral', placement: placement
|
52
|
+
let { variant: variant = 'neutral', placement: placement, isOpen: isOpen, showIcon: showIcon, ...otherProps } = props;
|
53
|
+
if (placement == null) placement = backupPlacement !== null && backupPlacement !== void 0 ? backupPlacement : 'top';
|
52
54
|
let { styleProps: styleProps } = (0, $l0Ry0$reactspectrumutils.useStyleProps)(otherProps);
|
53
55
|
let { tooltipProps: tooltipProps } = (0, $l0Ry0$reactariatooltip.useTooltip)(props, state);
|
54
56
|
// Sync ref with overlayRef from context.
|
@@ -72,10 +74,7 @@ function $55bd11986fcffc6f$var$Tooltip(props, ref) {
|
|
72
74
|
ref: arrowRef,
|
73
75
|
className: (0, $l0Ry0$reactspectrumutils.classNames)((0, ($parcel$interopDefault($ba73465d6d9b6556$exports))), 'spectrum-Tooltip-tip')
|
74
76
|
}));
|
75
|
-
}
|
76
|
-
/**
|
77
|
-
* Display container for Tooltip content. Has a directional arrow dependent on its placement.
|
78
|
-
*/ let $55bd11986fcffc6f$export$28c660c63b792dea = /*#__PURE__*/ (0, ($parcel$interopDefault($l0Ry0$react))).forwardRef($55bd11986fcffc6f$var$Tooltip);
|
77
|
+
});
|
79
78
|
|
80
79
|
|
81
80
|
//# sourceMappingURL=Tooltip.main.js.map
|
package/dist/Tooltip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;QAChB,WAAW,CAAA,GAAA,oCAAS,EAClB,CAAA,GAAA,mDAAK,GACL,oBACA,CAAC,kBAAkB,EAAE,SAAS,EAC9B,CAAC,kBAAkB,EAAE,WAAW,EAChC;YACE,WAAW;YACX,CAAC,CAAC,SAAS,EAAE,WAAW,CAAC,EAAE;QAC7B,GACA,WAAW,SAAS;QAEtB,KAAK;OACJ,YAAY,YAAY,2BAAa,0DAAC;QAAK,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QAA8B,eAAA;QAC9G,MAAM,QAAQ,kBACb,0DAAC;QAAK,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OACjC,MAAM,QAAQ,iBAGnB,0DAAC;QAAM,GAAG,UAAU;QAAE,KAAK;QAAU,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;;AAGzE","sources":["packages/@react-spectrum/tooltip/src/Tooltip.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport AlertSmall from '@spectrum-icons/ui/AlertSmall';\nimport {classNames, createDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef} from '@react-types/shared';\nimport InfoSmall from '@spectrum-icons/ui/InfoSmall';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {useContext, useImperativeHandle, useRef} from 'react';\nimport {SpectrumTooltipProps} from '@react-types/tooltip';\nimport styles from '@adobe/spectrum-css-temp/components/tooltip/vars.css';\nimport SuccessSmall from '@spectrum-icons/ui/SuccessSmall';\nimport {TooltipContext} from './context';\nimport {useTooltip} from '@react-aria/tooltip';\n\nlet iconMap = {\n info: InfoSmall,\n positive: SuccessSmall,\n negative: AlertSmall\n};\n\n/**\n * Display container for Tooltip content. Has a directional arrow dependent on its placement.\n */\nexport const Tooltip = React.forwardRef(function Tooltip(props: SpectrumTooltipProps, ref: DOMRef) {\n let {ref: overlayRef, arrowProps, state, arrowRef, ...tooltipProviderProps} = useContext(TooltipContext);\n let defaultRef = useRef(null);\n overlayRef = overlayRef || defaultRef;\n let backupPlacement = props.placement;\n props = mergeProps(props, tooltipProviderProps);\n let {\n variant = 'neutral',\n placement,\n isOpen,\n showIcon,\n ...otherProps\n } = props;\n if (placement == null) {\n placement = backupPlacement ?? 'top';\n }\n let {styleProps} = useStyleProps(otherProps);\n let {tooltipProps} = useTooltip(props, state);\n\n // Sync ref with overlayRef from context.\n useImperativeHandle(ref, () => createDOMRef(overlayRef));\n\n let Icon = iconMap[variant];\n\n return (\n <div\n {...styleProps}\n {...tooltipProps}\n className={classNames(\n styles,\n 'spectrum-Tooltip',\n `spectrum-Tooltip--${variant}`,\n `spectrum-Tooltip--${placement}`,\n {\n 'is-open': isOpen,\n [`is-open--${placement}`]: isOpen\n },\n styleProps.className\n )}\n ref={overlayRef}>\n {showIcon && variant !== 'neutral' && <Icon UNSAFE_className={classNames(styles, 'spectrum-Tooltip-typeIcon')} aria-hidden />}\n {props.children && (\n <span className={classNames(styles, 'spectrum-Tooltip-label')}>\n {props.children}\n </span>\n )}\n <span {...arrowProps} ref={arrowRef} className={classNames(styles, 'spectrum-Tooltip-tip')} />\n </div>\n );\n});\n"],"names":[],"version":3,"file":"Tooltip.main.js.map"}
|
package/dist/Tooltip.mjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import "./vars.
|
1
|
+
import "./vars.adff832d.css";
|
2
2
|
import $dcNtB$tooltip_vars_cssmodulejs from "./tooltip_vars_css.mjs";
|
3
3
|
import {TooltipContext as $b8c00169fae46ac7$export$39ae08fa83328b12} from "./context.mjs";
|
4
4
|
import $dcNtB$spectrumiconsuiAlertSmall from "@spectrum-icons/ui/AlertSmall";
|
@@ -37,12 +37,14 @@ let $dc9e2a6f9971fb04$var$iconMap = {
|
|
37
37
|
positive: (0, $dcNtB$spectrumiconsuiSuccessSmall),
|
38
38
|
negative: (0, $dcNtB$spectrumiconsuiAlertSmall)
|
39
39
|
};
|
40
|
-
|
40
|
+
const $dc9e2a6f9971fb04$export$28c660c63b792dea = /*#__PURE__*/ (0, $dcNtB$react).forwardRef(function Tooltip(props, ref) {
|
41
41
|
let { ref: overlayRef, arrowProps: arrowProps, state: state, arrowRef: arrowRef, ...tooltipProviderProps } = (0, $dcNtB$useContext)((0, $b8c00169fae46ac7$export$39ae08fa83328b12));
|
42
|
-
let defaultRef = (0, $dcNtB$useRef)(
|
42
|
+
let defaultRef = (0, $dcNtB$useRef)(null);
|
43
43
|
overlayRef = overlayRef || defaultRef;
|
44
|
+
let backupPlacement = props.placement;
|
44
45
|
props = (0, $dcNtB$mergeProps)(props, tooltipProviderProps);
|
45
|
-
let { variant: variant = 'neutral', placement: placement
|
46
|
+
let { variant: variant = 'neutral', placement: placement, isOpen: isOpen, showIcon: showIcon, ...otherProps } = props;
|
47
|
+
if (placement == null) placement = backupPlacement !== null && backupPlacement !== void 0 ? backupPlacement : 'top';
|
46
48
|
let { styleProps: styleProps } = (0, $dcNtB$useStyleProps)(otherProps);
|
47
49
|
let { tooltipProps: tooltipProps } = (0, $dcNtB$useTooltip)(props, state);
|
48
50
|
// Sync ref with overlayRef from context.
|
@@ -66,10 +68,7 @@ function $dc9e2a6f9971fb04$var$Tooltip(props, ref) {
|
|
66
68
|
ref: arrowRef,
|
67
69
|
className: (0, $dcNtB$classNames)((0, ($parcel$interopDefault($dcNtB$tooltip_vars_cssmodulejs))), 'spectrum-Tooltip-tip')
|
68
70
|
}));
|
69
|
-
}
|
70
|
-
/**
|
71
|
-
* Display container for Tooltip content. Has a directional arrow dependent on its placement.
|
72
|
-
*/ let $dc9e2a6f9971fb04$export$28c660c63b792dea = /*#__PURE__*/ (0, $dcNtB$react).forwardRef($dc9e2a6f9971fb04$var$Tooltip);
|
71
|
+
});
|
73
72
|
|
74
73
|
|
75
74
|
export {$dc9e2a6f9971fb04$export$28c660c63b792dea as Tooltip};
|
package/dist/Tooltip.module.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import "./vars.
|
1
|
+
import "./vars.adff832d.css";
|
2
2
|
import $dcNtB$tooltip_vars_cssmodulejs from "./tooltip_vars_css.module.js";
|
3
3
|
import {TooltipContext as $b8c00169fae46ac7$export$39ae08fa83328b12} from "./context.module.js";
|
4
4
|
import $dcNtB$spectrumiconsuiAlertSmall from "@spectrum-icons/ui/AlertSmall";
|
@@ -37,12 +37,14 @@ let $dc9e2a6f9971fb04$var$iconMap = {
|
|
37
37
|
positive: (0, $dcNtB$spectrumiconsuiSuccessSmall),
|
38
38
|
negative: (0, $dcNtB$spectrumiconsuiAlertSmall)
|
39
39
|
};
|
40
|
-
|
40
|
+
const $dc9e2a6f9971fb04$export$28c660c63b792dea = /*#__PURE__*/ (0, $dcNtB$react).forwardRef(function Tooltip(props, ref) {
|
41
41
|
let { ref: overlayRef, arrowProps: arrowProps, state: state, arrowRef: arrowRef, ...tooltipProviderProps } = (0, $dcNtB$useContext)((0, $b8c00169fae46ac7$export$39ae08fa83328b12));
|
42
|
-
let defaultRef = (0, $dcNtB$useRef)(
|
42
|
+
let defaultRef = (0, $dcNtB$useRef)(null);
|
43
43
|
overlayRef = overlayRef || defaultRef;
|
44
|
+
let backupPlacement = props.placement;
|
44
45
|
props = (0, $dcNtB$mergeProps)(props, tooltipProviderProps);
|
45
|
-
let { variant: variant = 'neutral', placement: placement
|
46
|
+
let { variant: variant = 'neutral', placement: placement, isOpen: isOpen, showIcon: showIcon, ...otherProps } = props;
|
47
|
+
if (placement == null) placement = backupPlacement !== null && backupPlacement !== void 0 ? backupPlacement : 'top';
|
46
48
|
let { styleProps: styleProps } = (0, $dcNtB$useStyleProps)(otherProps);
|
47
49
|
let { tooltipProps: tooltipProps } = (0, $dcNtB$useTooltip)(props, state);
|
48
50
|
// Sync ref with overlayRef from context.
|
@@ -66,10 +68,7 @@ function $dc9e2a6f9971fb04$var$Tooltip(props, ref) {
|
|
66
68
|
ref: arrowRef,
|
67
69
|
className: (0, $dcNtB$classNames)((0, ($parcel$interopDefault($dcNtB$tooltip_vars_cssmodulejs))), 'spectrum-Tooltip-tip')
|
68
70
|
}));
|
69
|
-
}
|
70
|
-
/**
|
71
|
-
* Display container for Tooltip content. Has a directional arrow dependent on its placement.
|
72
|
-
*/ let $dc9e2a6f9971fb04$export$28c660c63b792dea = /*#__PURE__*/ (0, $dcNtB$react).forwardRef($dc9e2a6f9971fb04$var$Tooltip);
|
71
|
+
});
|
73
72
|
|
74
73
|
|
75
74
|
export {$dc9e2a6f9971fb04$export$28c660c63b792dea as Tooltip};
|
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AAcD,IAAI,gCAAU;IACZ,MAAM,CAAA,GAAA,+BAAQ;IACd,UAAU,CAAA,GAAA,kCAAW;IACrB,UAAU,CAAA,GAAA,gCAAS;AACrB;
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AAcD,IAAI,gCAAU;IACZ,MAAM,CAAA,GAAA,+BAAQ;IACd,UAAU,CAAA,GAAA,kCAAW;IACrB,UAAU,CAAA,GAAA,gCAAS;AACrB;AAKO,MAAM,0DAAU,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,QAAQ,KAA2B,EAAE,GAAW;IAC/F,IAAI,EAAC,KAAK,UAAU,cAAE,UAAU,SAAE,KAAK,YAAE,QAAQ,EAAE,GAAG,sBAAqB,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAa;IACtG,IAAI,aAAa,CAAA,GAAA,aAAK,EAAE;IACxB,aAAa,cAAc;IAC3B,IAAI,kBAAkB,MAAM,SAAS;IACrC,QAAQ,CAAA,GAAA,iBAAS,EAAE,OAAO;IAC1B,IAAI,WACF,UAAU,sBACV,SAAS,UACT,MAAM,YACN,QAAQ,EACR,GAAG,YACJ,GAAG;IACJ,IAAI,aAAa,MACf,YAAY,4BAAA,6BAAA,kBAAmB;IAEjC,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,oBAAY,EAAE;IACjC,IAAI,gBAAC,YAAY,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE,OAAO;IAEvC,yCAAyC;IACzC,CAAA,GAAA,0BAAkB,EAAE,KAAK,IAAM,CAAA,GAAA,mBAAW,EAAE;IAE5C,IAAI,OAAO,6BAAO,CAAC,QAAQ;IAE3B,qBACE,gCAAC;QACE,GAAG,UAAU;QACb,GAAG,YAAY;QAChB,WAAW,CAAA,GAAA,iBAAS,EAClB,CAAA,GAAA,yDAAK,GACL,oBACA,CAAC,kBAAkB,EAAE,SAAS,EAC9B,CAAC,kBAAkB,EAAE,WAAW,EAChC;YACE,WAAW;YACX,CAAC,CAAC,SAAS,EAAE,WAAW,CAAC,EAAE;QAC7B,GACA,WAAW,SAAS;QAEtB,KAAK;OACJ,YAAY,YAAY,2BAAa,gCAAC;QAAK,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yDAAK,GAAG;QAA8B,eAAA;QAC9G,MAAM,QAAQ,kBACb,gCAAC;QAAK,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yDAAK,GAAG;OACjC,MAAM,QAAQ,iBAGnB,gCAAC;QAAM,GAAG,UAAU;QAAE,KAAK;QAAU,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yDAAK,GAAG;;AAGzE","sources":["packages/@react-spectrum/tooltip/src/Tooltip.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport AlertSmall from '@spectrum-icons/ui/AlertSmall';\nimport {classNames, createDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef} from '@react-types/shared';\nimport InfoSmall from '@spectrum-icons/ui/InfoSmall';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {useContext, useImperativeHandle, useRef} from 'react';\nimport {SpectrumTooltipProps} from '@react-types/tooltip';\nimport styles from '@adobe/spectrum-css-temp/components/tooltip/vars.css';\nimport SuccessSmall from '@spectrum-icons/ui/SuccessSmall';\nimport {TooltipContext} from './context';\nimport {useTooltip} from '@react-aria/tooltip';\n\nlet iconMap = {\n info: InfoSmall,\n positive: SuccessSmall,\n negative: AlertSmall\n};\n\n/**\n * Display container for Tooltip content. Has a directional arrow dependent on its placement.\n */\nexport const Tooltip = React.forwardRef(function Tooltip(props: SpectrumTooltipProps, ref: DOMRef) {\n let {ref: overlayRef, arrowProps, state, arrowRef, ...tooltipProviderProps} = useContext(TooltipContext);\n let defaultRef = useRef(null);\n overlayRef = overlayRef || defaultRef;\n let backupPlacement = props.placement;\n props = mergeProps(props, tooltipProviderProps);\n let {\n variant = 'neutral',\n placement,\n isOpen,\n showIcon,\n ...otherProps\n } = props;\n if (placement == null) {\n placement = backupPlacement ?? 'top';\n }\n let {styleProps} = useStyleProps(otherProps);\n let {tooltipProps} = useTooltip(props, state);\n\n // Sync ref with overlayRef from context.\n useImperativeHandle(ref, () => createDOMRef(overlayRef));\n\n let Icon = iconMap[variant];\n\n return (\n <div\n {...styleProps}\n {...tooltipProps}\n className={classNames(\n styles,\n 'spectrum-Tooltip',\n `spectrum-Tooltip--${variant}`,\n `spectrum-Tooltip--${placement}`,\n {\n 'is-open': isOpen,\n [`is-open--${placement}`]: isOpen\n },\n styleProps.className\n )}\n ref={overlayRef}>\n {showIcon && variant !== 'neutral' && <Icon UNSAFE_className={classNames(styles, 'spectrum-Tooltip-typeIcon')} aria-hidden />}\n {props.children && (\n <span className={classNames(styles, 'spectrum-Tooltip-label')}>\n {props.children}\n </span>\n )}\n <span {...arrowProps} ref={arrowRef} className={classNames(styles, 'spectrum-Tooltip-tip')} />\n </div>\n );\n});\n"],"names":[],"version":3,"file":"Tooltip.module.js.map"}
|
@@ -41,8 +41,8 @@ function $19f06480c1c1a932$var$TooltipTrigger(props) {
|
|
41
41
|
let { children: children, crossOffset: crossOffset = $19f06480c1c1a932$var$DEFAULT_CROSS_OFFSET, isDisabled: isDisabled, offset: offset = $19f06480c1c1a932$var$DEFAULT_OFFSET, trigger: triggerAction } = props;
|
42
42
|
let [trigger, tooltip] = (0, ($parcel$interopDefault($1fBML$react))).Children.toArray(children);
|
43
43
|
let state = (0, $1fBML$reactstatelytooltip.useTooltipTriggerState)(props);
|
44
|
-
let tooltipTriggerRef = (0, $1fBML$react.useRef)(
|
45
|
-
let overlayRef = (0, $1fBML$react.useRef)(
|
44
|
+
let tooltipTriggerRef = (0, $1fBML$react.useRef)(null);
|
45
|
+
let overlayRef = (0, $1fBML$react.useRef)(null);
|
46
46
|
let { triggerProps: triggerProps, tooltipProps: tooltipProps } = (0, $1fBML$reactariatooltip.useTooltipTrigger)({
|
47
47
|
isDisabled: isDisabled,
|
48
48
|
trigger: triggerAction
|
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAYD,MAAM,uCAAiB,IAAI,yFAAyF;AACpH,MAAM,6CAAuB;AAE7B,SAAS,qCAAe,KAAkC;IACxD,IAAI,YACF,QAAQ,eACR,cAAc,wDACd,UAAU,UACV,SAAS,sCACT,SAAS,aAAa,EACvB,GAAG;IAEJ,IAAI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AAiB,GAAG,UAAW,KAAkC;IAC9E,8EAA8E;IAC9E,IAAI,aAA6B,EAAE;IACnC,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,QAAQ,EAAE,CAAA;QACrC,kBAAI,CAAA,GAAA,sCAAI,EAAE,cAAc,CAAC,QACvB,WAAW,IAAI,CAAC;IAEpB;IACA,IAAI,CAAC,SAAS,QAAQ,GAAG;IACzB,MAAM;QACJ,SAAS;QACT,SAAS,CAAC,wBACR,0DAAC;gBAAe,KAAK,QAAQ,GAAG;gBAAG,GAAG,KAAK;eACxC,SACA;IAGP;AACF;AAEA;;;;CAIC,GACD,oEAAoE;AACpE,IAAI,4CAAkB","sources":["packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {FocusableProvider} from '@react-aria/focus';\nimport {Overlay} from '@react-spectrum/overlays';\nimport React, {JSX, ReactElement, useRef, useState} from 'react';\nimport {SpectrumTooltipTriggerProps} from '@react-types/tooltip';\nimport {TooltipContext} from './context';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useOverlayPosition} from '@react-aria/overlays';\nimport {useTooltipTrigger} from '@react-aria/tooltip';\nimport {useTooltipTriggerState} from '@react-stately/tooltip';\n\nconst DEFAULT_OFFSET = -1; // Offset needed to reach 4px/5px (med/large) distance between tooltip and trigger button\nconst DEFAULT_CROSS_OFFSET = 0;\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) as [ReactElement, ReactElement];\n let state = useTooltipTriggerState(props);\n\n let tooltipTriggerRef = useRef<HTMLElement>(null);\n let overlayRef = useRef<HTMLDivElement>(null);\n\n let {triggerProps, tooltipProps} = useTooltipTrigger({\n isDisabled,\n trigger: triggerAction\n }, state, tooltipTriggerRef);\n\n let [borderRadius, setBorderRadius] = useState(0);\n useLayoutEffect(() => {\n if (overlayRef.current && state.isOpen) {\n let spectrumBorderRadius = window.getComputedStyle(overlayRef.current).borderRadius;\n if (spectrumBorderRadius !== '') {\n setBorderRadius(parseInt(spectrumBorderRadius, 10));\n }\n }\n }, [state.isOpen, overlayRef]);\n let arrowRef = useRef<HTMLElement>(null);\n let [arrowWidth, setArrowWidth] = useState(0);\n useLayoutEffect(() => {\n if (arrowRef.current && state.isOpen) {\n setArrowWidth(arrowRef.current.getBoundingClientRect().width);\n }\n }, [state.isOpen, arrowRef]);\n\n let {overlayProps, arrowProps, placement} = useOverlayPosition({\n placement: props.placement || 'top',\n targetRef: tooltipTriggerRef,\n overlayRef,\n offset,\n crossOffset,\n isOpen: state.isOpen,\n shouldFlip: props.shouldFlip,\n containerPadding: props.containerPadding,\n arrowSize: arrowWidth,\n arrowBoundaryOffset: borderRadius,\n onClose: () => state.close(true)\n });\n\n return (\n <FocusableProvider\n {...triggerProps}\n ref={tooltipTriggerRef}>\n {trigger}\n <TooltipContext.Provider\n value={{\n state,\n placement,\n ref: overlayRef,\n UNSAFE_style: overlayProps.style,\n arrowProps,\n arrowRef: arrowRef,\n ...tooltipProps\n }}>\n <Overlay isOpen={state.isOpen} nodeRef={overlayRef}>\n {tooltip}\n </Overlay>\n </TooltipContext.Provider>\n </FocusableProvider>\n );\n}\n\n// Support TooltipTrigger inside components using CollectionBuilder.\nTooltipTrigger.getCollectionNode = function* (props: SpectrumTooltipTriggerProps) {\n // Replaced the use of React.Children.toArray because it mutates the key prop.\n let childArray: ReactElement[] = [];\n React.Children.forEach(props.children, child => {\n if (React.isValidElement(child)) {\n childArray.push(child);\n }\n });\n let [trigger, tooltip] = childArray;\n yield {\n element: trigger,\n wrapper: (element) => (\n <TooltipTrigger key={element.key} {...props}>\n {element}\n {tooltip}\n </TooltipTrigger>\n )\n };\n};\n\n/**\n * TooltipTrigger wraps around a trigger element and a Tooltip. It handles opening and closing\n * the Tooltip when the user hovers over or focuses the trigger, and positioning the Tooltip\n * relative to the trigger.\n */\n// We don't want getCollectionNode to show up in the type definition\nlet _TooltipTrigger = TooltipTrigger as (props: SpectrumTooltipTriggerProps) => JSX.Element;\nexport {_TooltipTrigger as TooltipTrigger};\n"],"names":[],"version":3,"file":"TooltipTrigger.main.js.map"}
|
package/dist/TooltipTrigger.mjs
CHANGED
@@ -31,8 +31,8 @@ function $019364e6919ef1db$var$TooltipTrigger(props) {
|
|
31
31
|
let { children: children, crossOffset: crossOffset = $019364e6919ef1db$var$DEFAULT_CROSS_OFFSET, isDisabled: isDisabled, offset: offset = $019364e6919ef1db$var$DEFAULT_OFFSET, trigger: triggerAction } = props;
|
32
32
|
let [trigger, tooltip] = (0, $cQFGy$react).Children.toArray(children);
|
33
33
|
let state = (0, $cQFGy$useTooltipTriggerState)(props);
|
34
|
-
let tooltipTriggerRef = (0, $cQFGy$useRef)(
|
35
|
-
let overlayRef = (0, $cQFGy$useRef)(
|
34
|
+
let tooltipTriggerRef = (0, $cQFGy$useRef)(null);
|
35
|
+
let overlayRef = (0, $cQFGy$useRef)(null);
|
36
36
|
let { triggerProps: triggerProps, tooltipProps: tooltipProps } = (0, $cQFGy$useTooltipTrigger)({
|
37
37
|
isDisabled: isDisabled,
|
38
38
|
trigger: triggerAction
|
@@ -31,8 +31,8 @@ function $019364e6919ef1db$var$TooltipTrigger(props) {
|
|
31
31
|
let { children: children, crossOffset: crossOffset = $019364e6919ef1db$var$DEFAULT_CROSS_OFFSET, isDisabled: isDisabled, offset: offset = $019364e6919ef1db$var$DEFAULT_OFFSET, trigger: triggerAction } = props;
|
32
32
|
let [trigger, tooltip] = (0, $cQFGy$react).Children.toArray(children);
|
33
33
|
let state = (0, $cQFGy$useTooltipTriggerState)(props);
|
34
|
-
let tooltipTriggerRef = (0, $cQFGy$useRef)(
|
35
|
-
let overlayRef = (0, $cQFGy$useRef)(
|
34
|
+
let tooltipTriggerRef = (0, $cQFGy$useRef)(null);
|
35
|
+
let overlayRef = (0, $cQFGy$useRef)(null);
|
36
36
|
let { triggerProps: triggerProps, tooltipProps: tooltipProps } = (0, $cQFGy$useTooltipTrigger)({
|
37
37
|
isDisabled: isDisabled,
|
38
38
|
trigger: triggerAction
|
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAYD,MAAM,uCAAiB,IAAI,yFAAyF;AACpH,MAAM,6CAAuB;AAE7B,SAAS,qCAAe,KAAkC;IACxD,IAAI,YACF,QAAQ,eACR,cAAc,wDACd,UAAU,UACV,SAAS,sCACT,SAAS,aAAa,EACvB,GAAG;IAEJ,IAAI,CAAC,SAAS,QAAQ,GAAG,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,OAAO,CAAC;IAChD,IAAI,QAAQ,CAAA,GAAA,6BAAqB,EAAE;IAEnC,IAAI,oBAAoB,CAAA,GAAA,aAAK,EAAe;IAC5C,IAAI,aAAa,CAAA,GAAA,aAAK,EAAkB;IAExC,IAAI,gBAAC,YAAY,gBAAE,YAAY,EAAC,GAAG,CAAA,GAAA,wBAAgB,EAAE;oBACnD;QACA,SAAS;IACX,GAAG,OAAO;IAEV,IAAI,CAAC,cAAc,gBAAgB,GAAG,CAAA,GAAA,eAAO,EAAE;IAC/C,CAAA,GAAA,sBAAc,EAAE;QACd,IAAI,WAAW,OAAO,IAAI,MAAM,MAAM,EAAE;YACtC,IAAI,uBAAuB,OAAO,gBAAgB,CAAC,WAAW,OAAO,EAAE,YAAY;YACnF,IAAI,yBAA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QAAC,MAAM,MAAM;QAAE;KAAS;IAE3B,IAAI,gBAAC,YAAY,cAAE,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,yBAAiB,EAAE;QAC7D,WAAW,MAAM,SAAS,IAAI;QAC9B,WAAW;oBACX;gBACA;qBACA;QACA,QAAQ,MAAM,MAAM;QACpB,YAAY,MAAM,UAAU;QAC5B,kBAAkB,MAAM,gBAAgB;QACxC,WAAW;QACX,qBAAqB;QACrB,SAAS,IAAM,MAAM,KAAK,CAAC;IAC7B;IAEA,qBACE,gCAAC,CAAA,GAAA,wBAAgB;QACd,GAAG,YAAY;QAChB,KAAK;OACJ,uBACD,gCAAC,CAAA,GAAA,yCAAa,EAAE,QAAQ;QACtB,OAAO;mBACL;uBACA;YACA,KAAK;YACL,cAAc,aAAa,KAAK;wBAChC;YACA,UAAU;YACV,GAAG,YAAY;QACjB;qBACA,gCAAC,CAAA,GAAA,cAAM;QAAE,QAAQ,MAAM,MAAM;QAAE,SAAS;OACrC;AAKX;AAEA,oEAAoE;AACpE,qCAAe,iBAAiB,GAAG,UAAW,KAAkC;IAC9E,8EAA8E;IAC9E,IAAI,aAA6B,EAAE;IACnC,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,QAAQ,EAAE,CAAA;QACrC,kBAAI,CAAA,GAAA,YAAI,EAAE,cAAc,CAAC,QACvB,WAAW,IAAI,CAAC;IAEpB;IACA,IAAI,CAAC,SAAS,QAAQ,GAAG;IACzB,MAAM;QACJ,SAAS;QACT,SAAS,CAAC,wBACR,gCAAC;gBAAe,KAAK,QAAQ,GAAG;gBAAG,GAAG,KAAK;eACxC,SACA;IAGP;AACF;AAEA;;;;CAIC,GACD,oEAAoE;AACpE,IAAI,4CAAkB","sources":["packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {FocusableProvider} from '@react-aria/focus';\nimport {Overlay} from '@react-spectrum/overlays';\nimport React, {JSX, ReactElement, useRef, useState} from 'react';\nimport {SpectrumTooltipTriggerProps} from '@react-types/tooltip';\nimport {TooltipContext} from './context';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useOverlayPosition} from '@react-aria/overlays';\nimport {useTooltipTrigger} from '@react-aria/tooltip';\nimport {useTooltipTriggerState} from '@react-stately/tooltip';\n\nconst DEFAULT_OFFSET = -1; // Offset needed to reach 4px/5px (med/large) distance between tooltip and trigger button\nconst DEFAULT_CROSS_OFFSET = 0;\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) as [ReactElement, ReactElement];\n let state = useTooltipTriggerState(props);\n\n let tooltipTriggerRef = useRef<HTMLElement>(null);\n let overlayRef = useRef<HTMLDivElement>(null);\n\n let {triggerProps, tooltipProps} = useTooltipTrigger({\n isDisabled,\n trigger: triggerAction\n }, state, tooltipTriggerRef);\n\n let [borderRadius, setBorderRadius] = useState(0);\n useLayoutEffect(() => {\n if (overlayRef.current && state.isOpen) {\n let spectrumBorderRadius = window.getComputedStyle(overlayRef.current).borderRadius;\n if (spectrumBorderRadius !== '') {\n setBorderRadius(parseInt(spectrumBorderRadius, 10));\n }\n }\n }, [state.isOpen, overlayRef]);\n let arrowRef = useRef<HTMLElement>(null);\n let [arrowWidth, setArrowWidth] = useState(0);\n useLayoutEffect(() => {\n if (arrowRef.current && state.isOpen) {\n setArrowWidth(arrowRef.current.getBoundingClientRect().width);\n }\n }, [state.isOpen, arrowRef]);\n\n let {overlayProps, arrowProps, placement} = useOverlayPosition({\n placement: props.placement || 'top',\n targetRef: tooltipTriggerRef,\n overlayRef,\n offset,\n crossOffset,\n isOpen: state.isOpen,\n shouldFlip: props.shouldFlip,\n containerPadding: props.containerPadding,\n arrowSize: arrowWidth,\n arrowBoundaryOffset: borderRadius,\n onClose: () => state.close(true)\n });\n\n return (\n <FocusableProvider\n {...triggerProps}\n ref={tooltipTriggerRef}>\n {trigger}\n <TooltipContext.Provider\n value={{\n state,\n placement,\n ref: overlayRef,\n UNSAFE_style: overlayProps.style,\n arrowProps,\n arrowRef: arrowRef,\n ...tooltipProps\n }}>\n <Overlay isOpen={state.isOpen} nodeRef={overlayRef}>\n {tooltip}\n </Overlay>\n </TooltipContext.Provider>\n </FocusableProvider>\n );\n}\n\n// Support TooltipTrigger inside components using CollectionBuilder.\nTooltipTrigger.getCollectionNode = function* (props: SpectrumTooltipTriggerProps) {\n // Replaced the use of React.Children.toArray because it mutates the key prop.\n let childArray: ReactElement[] = [];\n React.Children.forEach(props.children, child => {\n if (React.isValidElement(child)) {\n childArray.push(child);\n }\n });\n let [trigger, tooltip] = childArray;\n yield {\n element: trigger,\n wrapper: (element) => (\n <TooltipTrigger key={element.key} {...props}>\n {element}\n {tooltip}\n </TooltipTrigger>\n )\n };\n};\n\n/**\n * TooltipTrigger wraps around a trigger element and a Tooltip. It handles opening and closing\n * the Tooltip when the user hovers over or focuses the trigger, and positioning the Tooltip\n * relative to the trigger.\n */\n// We don't want getCollectionNode to show up in the type definition\nlet _TooltipTrigger = TooltipTrigger as (props: SpectrumTooltipTriggerProps) => JSX.Element;\nexport {_TooltipTrigger as TooltipTrigger};\n"],"names":[],"version":3,"file":"TooltipTrigger.module.js.map"}
|
package/dist/context.main.js
CHANGED
@@ -21,7 +21,9 @@ $parcel$export(module.exports, "TooltipContext", () => $ed2e56c8503433b4$export$
|
|
21
21
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
22
22
|
* governing permissions and limitations under the License.
|
23
23
|
*/
|
24
|
-
const $ed2e56c8503433b4$export$39ae08fa83328b12 = (0, ($parcel$interopDefault($aZ3Gf$react))).createContext({
|
24
|
+
const $ed2e56c8503433b4$export$39ae08fa83328b12 = (0, ($parcel$interopDefault($aZ3Gf$react))).createContext({
|
25
|
+
placement: null
|
26
|
+
});
|
25
27
|
|
26
28
|
|
27
29
|
//# sourceMappingURL=context.main.js.map
|
package/dist/context.main.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAeM,MAAM,4CAAiB,CAAA,GAAA,sCAAI,EAAE,aAAa,CAAsB,
|
1
|
+
{"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAeM,MAAM,4CAAiB,CAAA,GAAA,sCAAI,EAAE,aAAa,CAAsB;IAAC,WAAW;AAAI","sources":["packages/@react-spectrum/tooltip/src/context.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {PlacementAxis} from '@react-types/overlays';\nimport React, {HTMLAttributes} from 'react';\nimport {RefObject, StyleProps} from '@react-types/shared';\nimport {TooltipTriggerState} from '@react-stately/tooltip';\n\ninterface TooltipContextProps extends StyleProps {\n state?: TooltipTriggerState,\n ref?: RefObject<HTMLDivElement | null>,\n placement: PlacementAxis | null,\n arrowProps?: HTMLAttributes<HTMLElement>,\n arrowRef?: RefObject<HTMLElement | null>\n}\n\nexport const TooltipContext = React.createContext<TooltipContextProps>({placement: null});\n"],"names":[],"version":3,"file":"context.main.js.map"}
|
package/dist/context.mjs
CHANGED
@@ -11,7 +11,9 @@ import $kNnxj$react from "react";
|
|
11
11
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
12
12
|
* governing permissions and limitations under the License.
|
13
13
|
*/
|
14
|
-
const $b8c00169fae46ac7$export$39ae08fa83328b12 = (0, $kNnxj$react).createContext({
|
14
|
+
const $b8c00169fae46ac7$export$39ae08fa83328b12 = (0, $kNnxj$react).createContext({
|
15
|
+
placement: null
|
16
|
+
});
|
15
17
|
|
16
18
|
|
17
19
|
export {$b8c00169fae46ac7$export$39ae08fa83328b12 as TooltipContext};
|
package/dist/context.module.js
CHANGED
@@ -11,7 +11,9 @@ import $kNnxj$react from "react";
|
|
11
11
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
12
12
|
* governing permissions and limitations under the License.
|
13
13
|
*/
|
14
|
-
const $b8c00169fae46ac7$export$39ae08fa83328b12 = (0, $kNnxj$react).createContext({
|
14
|
+
const $b8c00169fae46ac7$export$39ae08fa83328b12 = (0, $kNnxj$react).createContext({
|
15
|
+
placement: null
|
16
|
+
});
|
15
17
|
|
16
18
|
|
17
19
|
export {$b8c00169fae46ac7$export$39ae08fa83328b12 as TooltipContext};
|
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAeM,MAAM,4CAAiB,CAAA,GAAA,YAAI,EAAE,aAAa,CAAsB,
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAeM,MAAM,4CAAiB,CAAA,GAAA,YAAI,EAAE,aAAa,CAAsB;IAAC,WAAW;AAAI","sources":["packages/@react-spectrum/tooltip/src/context.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {PlacementAxis} from '@react-types/overlays';\nimport React, {HTMLAttributes} from 'react';\nimport {RefObject, StyleProps} from '@react-types/shared';\nimport {TooltipTriggerState} from '@react-stately/tooltip';\n\ninterface TooltipContextProps extends StyleProps {\n state?: TooltipTriggerState,\n ref?: RefObject<HTMLDivElement | null>,\n placement: PlacementAxis | null,\n arrowProps?: HTMLAttributes<HTMLElement>,\n arrowRef?: RefObject<HTMLElement | null>\n}\n\nexport const TooltipContext = React.createContext<TooltipContextProps>({placement: null});\n"],"names":[],"version":3,"file":"context.module.js.map"}
|
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,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;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;AAhCA,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAAmC,CAAC,qBAAqB,CAAC;AAC1D,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAA2C,CAAC,6BAA6B,CAAC;AAC1E,4CAA4B,CAAC,eAAe,EAAE,
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IA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E,4CAA+C,CAAC,iCAAiC,CAAC;AAClF,4CAA+C,CAAC,iCAAiC,CAAC;AAClF,4CAA4C,CAAC,8BAA8B,CAAC;AAC5E,4CAA8C,CAAC,gCAAgC,CAAC;AAChF,4CAA0C,CAAC,4BAA4B,CAAC;AACxE,4CAA2C,CAAC,6BAA6B,CAAC;AAC1E,2CAAyC,CAAC,2BAA2B,CAAC;AACtE,4CAA8C,CAAC,gCAAgC,CAAC;AAChF,4CAA0C,CAAC,4BAA4B,CAAC","sources":["packages/@adobe/spectrum-css-temp/components/tooltip/vars.css"],"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@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"tooltip_vars_css.main.js.map"}
|
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,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;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;AAhCA,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAAmC,CAAC,qBAAqB,CAAC;AA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uBAAuB,CAAC;AAC9D,4CAAqC,CAAC,wBAAwB,EAAE,2CAAoC;AACpG,4CAA6C,CAAC,+BAA+B,CAAC;AAC9E,4CAA4C,CAAC,8BAA8B,CAAC;AAC5E,4CAA2C,CAAC,6BAA6B,CAAC;AAC1E,4CAA2C,CAAC,6BAA6B,CAAC;AAC1E,4CAA2C,CAAC,6BAA6B,CAAC;AAC1E,4CAA+C,CAAC,iCAAiC,CAAC;AAClF,4CAA+C,CAAC,iCAAiC,CAAC;AAClF,4CAA4C,CAAC,8BAA8B,CAAC;AAC5E,4CAA8C,CAAC,gCAAgC,CAAC;AAChF,4CAA0C,CAAC,4BAA4B,CAAC;AACxE,4CAA2C,CAAC,6BAA6B,CAAC;AAC1E,2CAAyC,CAAC,2BAA2B,CAAC;AACtE,4CAA8C,CAAC,gCAAgC,CAAC;AAChF,4CAA0C,CAAC,4BAA4B,CAAC","sources":["packages/@adobe/spectrum-css-temp/components/tooltip/vars.css"],"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@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"tooltip_vars_css.module.js.map"}
|
package/dist/types.d.ts
CHANGED
@@ -4,7 +4,7 @@ import { DOMRefValue } from "@react-types/shared";
|
|
4
4
|
/**
|
5
5
|
* Display container for Tooltip content. Has a directional arrow dependent on its placement.
|
6
6
|
*/
|
7
|
-
export
|
7
|
+
export const Tooltip: React.ForwardRefExoticComponent<SpectrumTooltipProps & React.RefAttributes<DOMRefValue<HTMLElement>>>;
|
8
8
|
/**
|
9
9
|
* TooltipTrigger wraps around a trigger element and a Tooltip. It handles opening and closing
|
10
10
|
* the Tooltip when the user hovers over or focuses the trigger, and positioning the Tooltip
|
package/dist/types.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;
|
1
|
+
{"mappings":";;;AC8BA;;GAEG;AACH,OAAO,MAAM,8GAiDX,CAAC;ACsCH;;;;GAIG;AAEH,OAAA,IAAI,gBAAoC,CAAC,KAAK,EAAE,2BAA2B,KAAK,IAAI,OAAO,CAAC;AC9G5F,YAAY,EAAC,oBAAoB,EAAE,2BAA2B,EAAC,MAAM,sBAAsB,CAAC","sources":["packages/@react-spectrum/tooltip/src/packages/@react-spectrum/tooltip/src/context.ts","packages/@react-spectrum/tooltip/src/packages/@react-spectrum/tooltip/src/Tooltip.tsx","packages/@react-spectrum/tooltip/src/packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx","packages/@react-spectrum/tooltip/src/packages/@react-spectrum/tooltip/src/index.ts","packages/@react-spectrum/tooltip/src/index.ts"],"sourcesContent":[null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport {Tooltip} from './Tooltip';\nexport {TooltipTrigger} from './TooltipTrigger';\nexport type {SpectrumTooltipProps, SpectrumTooltipTriggerProps} from '@react-types/tooltip';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
@@ -111,6 +111,7 @@
|
|
111
111
|
.uv8yQW_spectrum-Tooltip {
|
112
112
|
box-sizing: border-box;
|
113
113
|
vertical-align: top;
|
114
|
+
inline-size: auto;
|
114
115
|
padding: var(--spectrum-tooltip-padding-top, var(--spectrum-global-dimension-size-50)) var(--spectrum-tooltip-padding-x, var(--spectrum-global-dimension-size-125));
|
115
116
|
border-radius: var(--spectrum-alias-border-radius-regular, var(--spectrum-global-dimension-size-50));
|
116
117
|
min-block-size: var(--spectrum-tooltip-min-height, var(--spectrum-global-dimension-size-300));
|
@@ -124,7 +125,6 @@
|
|
124
125
|
user-select: none;
|
125
126
|
flex-direction: row;
|
126
127
|
align-items: center;
|
127
|
-
inline-size: auto;
|
128
128
|
display: inline-flex;
|
129
129
|
position: relative;
|
130
130
|
}
|
@@ -318,4 +318,4 @@
|
|
318
318
|
--spectrum-tooltip-positive-background-color: Highlight;
|
319
319
|
}
|
320
320
|
}
|
321
|
-
/*# sourceMappingURL=vars.
|
321
|
+
/*# sourceMappingURL=vars.adff832d.css.map */
|
@@ -1 +1 @@
|
|
1
|
-
{"mappings":"AA4DA;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAQA;;;;AAIA;;;;AAKF;;;;;;;;AAOE;;;;;;;;;;;AAqBE;;;;;AAQF;;;;AAKE;;;;;AAOJ;EACE;;;;EAIE;;;;;AAkBJ;;;;;;;AAYA;;;;;;;AAWA;;;;AAIA;;;;AAUA;;;;AAIA;;;;AAIA;;;;;;;;;;;;;;;;;;;;;AA+BE;;;;AASF;;;;;;;;;;;AAeE;;;;;AAMF;;;;AAEE;;;;;AAUF;;;;AAEE;;;;;AAUF;;;;AAEE;;;;AASF;;;;AAEE;;;;;AAYA;;;;;AAMF;;;;;;;;;AAWA;;;;;AAOA;;;;;AAIE;;;;;;;;AASA;;;;AAKA;;;;AAQA;;;;;AAKA;;;;AAIA;;;;AAQA;;;;;AAKA;;;;AAIA;;;;AAOA;;;;AAOA;;;;AAOA;;;;AAOA;;;;AAoBF;;;;;;;;;;;AAgBA;;;;AAIA;;;;AAIE;;;;AAKF;;;;AAIE;;;;AAKF;;;;AAIE;;;;AAKF;EACE;;;;EAGA","sources":["packages/@adobe/spectrum-css-temp/components/tooltip/vars.css"],"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@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"vars.
|
1
|
+
{"mappings":"AA4DA;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAQA;;;;AAIA;;;;AAKF;;;;;;;;AAOE;;;;;;;;;;;AAqBE;;;;;AAQF;;;;AAKE;;;;;AAOJ;EACE;;;;EAIE;;;;;AAkBJ;;;;;;;AAYA;;;;;;;AAWA;;;;AAIA;;;;AAUA;;;;AAIA;;;;AAIA;;;;;;;;;;;;;;;;;;;;;AA+BE;;;;AASF;;;;;;;;;;;AAeE;;;;;AAMF;;;;AAEE;;;;;AAUF;;;;AAEE;;;;;AAUF;;;;AAEE;;;;AASF;;;;AAEE;;;;;AAYA;;;;;AAMF;;;;;;;;;AAWA;;;;;AAOA;;;;;AAIE;;;;;;;;AASA;;;;AAKA;;;;AAQA;;;;;AAKA;;;;AAIA;;;;AAQA;;;;;AAKA;;;;AAIA;;;;AAOA;;;;AAOA;;;;AAOA;;;;AAOA;;;;AAoBF;;;;;;;;;;;AAgBA;;;;AAIA;;;;AAIE;;;;AAKF;;;;AAIE;;;;AAKF;;;;AAIE;;;;AAKF;EACE;;;;EAGA","sources":["packages/@adobe/spectrum-css-temp/components/tooltip/vars.css"],"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@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"vars.adff832d.css.map"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-spectrum/tooltip",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.7.1",
|
4
4
|
"description": "Spectrum UI components in React",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "dist/main.js",
|
@@ -36,17 +36,17 @@
|
|
36
36
|
"url": "https://github.com/adobe/react-spectrum"
|
37
37
|
},
|
38
38
|
"dependencies": {
|
39
|
-
"@react-aria/focus": "^3.
|
40
|
-
"@react-aria/overlays": "^3.
|
41
|
-
"@react-aria/tooltip": "^3.7.
|
42
|
-
"@react-aria/utils": "^3.
|
43
|
-
"@react-spectrum/overlays": "^5.
|
44
|
-
"@react-spectrum/utils": "^3.
|
45
|
-
"@react-stately/tooltip": "^3.
|
46
|
-
"@react-types/overlays": "^3.8.
|
47
|
-
"@react-types/shared": "^3.
|
48
|
-
"@react-types/tooltip": "^3.4.
|
49
|
-
"@spectrum-icons/ui": "^3.6.
|
39
|
+
"@react-aria/focus": "^3.19.1",
|
40
|
+
"@react-aria/overlays": "^3.25.0",
|
41
|
+
"@react-aria/tooltip": "^3.7.11",
|
42
|
+
"@react-aria/utils": "^3.27.0",
|
43
|
+
"@react-spectrum/overlays": "^5.7.1",
|
44
|
+
"@react-spectrum/utils": "^3.12.1",
|
45
|
+
"@react-stately/tooltip": "^3.5.1",
|
46
|
+
"@react-types/overlays": "^3.8.12",
|
47
|
+
"@react-types/shared": "^3.27.0",
|
48
|
+
"@react-types/tooltip": "^3.4.14",
|
49
|
+
"@spectrum-icons/ui": "^3.6.12",
|
50
50
|
"@swc/helpers": "^0.5.0"
|
51
51
|
},
|
52
52
|
"devDependencies": {
|
@@ -54,11 +54,11 @@
|
|
54
54
|
},
|
55
55
|
"peerDependencies": {
|
56
56
|
"@react-spectrum/provider": "^3.0.0",
|
57
|
-
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0",
|
58
|
-
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
|
57
|
+
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
|
58
|
+
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
|
59
59
|
},
|
60
60
|
"publishConfig": {
|
61
61
|
"access": "public"
|
62
62
|
},
|
63
|
-
"gitHead": "
|
63
|
+
"gitHead": "09e7f44bebdc9d89122926b2b439a0a38a2814ea"
|
64
64
|
}
|
package/src/Tooltip.tsx
CHANGED
@@ -28,18 +28,25 @@ let iconMap = {
|
|
28
28
|
negative: AlertSmall
|
29
29
|
};
|
30
30
|
|
31
|
-
|
31
|
+
/**
|
32
|
+
* Display container for Tooltip content. Has a directional arrow dependent on its placement.
|
33
|
+
*/
|
34
|
+
export const Tooltip = React.forwardRef(function Tooltip(props: SpectrumTooltipProps, ref: DOMRef) {
|
32
35
|
let {ref: overlayRef, arrowProps, state, arrowRef, ...tooltipProviderProps} = useContext(TooltipContext);
|
33
|
-
let defaultRef = useRef(
|
36
|
+
let defaultRef = useRef(null);
|
34
37
|
overlayRef = overlayRef || defaultRef;
|
38
|
+
let backupPlacement = props.placement;
|
35
39
|
props = mergeProps(props, tooltipProviderProps);
|
36
40
|
let {
|
37
41
|
variant = 'neutral',
|
38
|
-
placement
|
42
|
+
placement,
|
39
43
|
isOpen,
|
40
44
|
showIcon,
|
41
45
|
...otherProps
|
42
46
|
} = props;
|
47
|
+
if (placement == null) {
|
48
|
+
placement = backupPlacement ?? 'top';
|
49
|
+
}
|
43
50
|
let {styleProps} = useStyleProps(otherProps);
|
44
51
|
let {tooltipProps} = useTooltip(props, state);
|
45
52
|
|
@@ -73,10 +80,4 @@ function Tooltip(props: SpectrumTooltipProps, ref: DOMRef) {
|
|
73
80
|
<span {...arrowProps} ref={arrowRef} className={classNames(styles, 'spectrum-Tooltip-tip')} />
|
74
81
|
</div>
|
75
82
|
);
|
76
|
-
}
|
77
|
-
|
78
|
-
/**
|
79
|
-
* Display container for Tooltip content. Has a directional arrow dependent on its placement.
|
80
|
-
*/
|
81
|
-
let _Tooltip = React.forwardRef(Tooltip);
|
82
|
-
export {_Tooltip as Tooltip};
|
83
|
+
});
|
package/src/TooltipTrigger.tsx
CHANGED
@@ -35,8 +35,8 @@ function TooltipTrigger(props: SpectrumTooltipTriggerProps) {
|
|
35
35
|
let [trigger, tooltip] = React.Children.toArray(children) as [ReactElement, ReactElement];
|
36
36
|
let state = useTooltipTriggerState(props);
|
37
37
|
|
38
|
-
let tooltipTriggerRef = useRef<HTMLElement>(
|
39
|
-
let overlayRef = useRef<HTMLDivElement>(
|
38
|
+
let tooltipTriggerRef = useRef<HTMLElement>(null);
|
39
|
+
let overlayRef = useRef<HTMLDivElement>(null);
|
40
40
|
|
41
41
|
let {triggerProps, tooltipProps} = useTooltipTrigger({
|
42
42
|
isDisabled,
|
@@ -52,7 +52,7 @@ function TooltipTrigger(props: SpectrumTooltipTriggerProps) {
|
|
52
52
|
}
|
53
53
|
}
|
54
54
|
}, [state.isOpen, overlayRef]);
|
55
|
-
let arrowRef = useRef(null);
|
55
|
+
let arrowRef = useRef<HTMLElement>(null);
|
56
56
|
let [arrowWidth, setArrowWidth] = useState(0);
|
57
57
|
useLayoutEffect(() => {
|
58
58
|
if (arrowRef.current && state.isOpen) {
|
package/src/context.ts
CHANGED
@@ -18,9 +18,9 @@ import {TooltipTriggerState} from '@react-stately/tooltip';
|
|
18
18
|
interface TooltipContextProps extends StyleProps {
|
19
19
|
state?: TooltipTriggerState,
|
20
20
|
ref?: RefObject<HTMLDivElement | null>,
|
21
|
-
placement
|
21
|
+
placement: PlacementAxis | null,
|
22
22
|
arrowProps?: HTMLAttributes<HTMLElement>,
|
23
23
|
arrowRef?: RefObject<HTMLElement | null>
|
24
24
|
}
|
25
25
|
|
26
|
-
export const TooltipContext = React.createContext<TooltipContextProps>({});
|
26
|
+
export const TooltipContext = React.createContext<TooltipContextProps>({placement: null});
|