@sanity/ui 2.0.0-alpha.23 → 2.0.0-alpha.25
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/index.esm.js +18 -22
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +18 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/primitives/tooltip/constants.ts +12 -12
- package/src/primitives/tooltip/tooltip.test.tsx +0 -20
- package/src/primitives/tooltip/tooltip.tsx +6 -6
- package/src/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +1 -9
package/dist/index.js
CHANGED
|
@@ -7827,18 +7827,18 @@ function useDelayedState(initialState) {
|
|
|
7827
7827
|
const DEFAULT_TOOLTIP_DISTANCE = 4;
|
|
7828
7828
|
const DEFAULT_TOOLTIP_PADDING = 4;
|
|
7829
7829
|
const DEFAULT_FALLBACK_PLACEMENTS = {
|
|
7830
|
-
top: ["bottom", "left", "right"],
|
|
7831
|
-
"top-start": ["bottom-start", "left-start", "right-start"],
|
|
7832
|
-
"top-end": ["bottom-end", "left-end", "right-end"],
|
|
7833
|
-
bottom: ["top", "left", "right"],
|
|
7834
|
-
"bottom-start": ["top-start", "left-start", "right-start"],
|
|
7835
|
-
"bottom-end": ["top-end", "left-end", "right-end"],
|
|
7836
|
-
left: ["right", "top", "bottom"],
|
|
7837
|
-
"left-start": ["right-start", "top-start", "bottom-start"],
|
|
7838
|
-
"left-end": ["right-end", "top-end", "bottom-end"],
|
|
7839
|
-
right: ["left", "top", "bottom"],
|
|
7840
|
-
"right-start": ["left-start", "top-start", "bottom-start"],
|
|
7841
|
-
"right-end": ["left-end", "top-end", "bottom-end"]
|
|
7830
|
+
top: ["top-end", "top-start", "bottom", "left", "right"],
|
|
7831
|
+
"top-start": ["top", "top-end", "bottom-start", "left-start", "right-start"],
|
|
7832
|
+
"top-end": ["top", "top-start", "bottom-end", "left-end", "right-end"],
|
|
7833
|
+
bottom: ["bottom-end", "bottom-start", "top", "left", "right"],
|
|
7834
|
+
"bottom-start": ["bottom", "bottom-end", "top-start", "left-start", "right-start"],
|
|
7835
|
+
"bottom-end": ["bottom", "bottom-start", "top-end", "left-end", "right-end"],
|
|
7836
|
+
left: ["left-end", "left-start", "right", "top", "bottom"],
|
|
7837
|
+
"left-start": ["left", "left-end", "right-start", "top-start", "bottom-start"],
|
|
7838
|
+
"left-end": ["left", "left-start", "right-end", "top-end", "bottom-end"],
|
|
7839
|
+
right: ["right-end", "right-start", "left", "top", "bottom"],
|
|
7840
|
+
"right-start": ["right", "right-end", "left-start", "top-start", "bottom-start"],
|
|
7841
|
+
"right-end": ["right", "right-start", "left-end", "top-end", "bottom-end"]
|
|
7842
7842
|
};
|
|
7843
7843
|
var __freeze$f = Object.freeze;
|
|
7844
7844
|
var __defProp$f = Object.defineProperty;
|
|
@@ -7883,10 +7883,6 @@ function TooltipDelayGroupProvider(props) {
|
|
|
7883
7883
|
} = props;
|
|
7884
7884
|
const [isGroupActive, setIsGroupActive] = useDelayedState(false);
|
|
7885
7885
|
const [openTooltipId, setOpenTooltipId] = useDelayedState(null);
|
|
7886
|
-
const isInsideContext = useTooltipDelayGroup();
|
|
7887
|
-
if (isInsideContext) {
|
|
7888
|
-
throw new Error("TooltipDelayGroupProvider cannot be nested inside another TooltipDelayGroupProvider");
|
|
7889
|
-
}
|
|
7890
7886
|
const openDelay = typeof delay === "number" ? delay : (delay == null ? void 0 : delay.open) || 0;
|
|
7891
7887
|
const closeDelay = typeof delay === "number" ? delay : (delay == null ? void 0 : delay.close) || 0;
|
|
7892
7888
|
const value = react.useMemo(() => ({
|
|
@@ -8051,7 +8047,7 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
|
|
|
8051
8047
|
(_b2 = (_a3 = childProp == null ? void 0 : childProp.props) == null ? void 0 : _a3.onMouseLeave) == null ? void 0 : _b2.call(_a3, e);
|
|
8052
8048
|
}, [childProp == null ? void 0 : childProp.props, handleIsOpenChange]);
|
|
8053
8049
|
react.useEffect(() => {
|
|
8054
|
-
if (!
|
|
8050
|
+
if (!showTooltip) return;
|
|
8055
8051
|
function handleWindowMouseMove(event) {
|
|
8056
8052
|
if (!referenceElement) return;
|
|
8057
8053
|
const isHoveringReference = referenceElement === event.target || event.target instanceof Node && referenceElement.contains(event.target);
|
|
@@ -8064,13 +8060,13 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
|
|
|
8064
8060
|
return () => {
|
|
8065
8061
|
window.removeEventListener("mousemove", handleWindowMouseMove);
|
|
8066
8062
|
};
|
|
8067
|
-
}, [
|
|
8063
|
+
}, [showTooltip, referenceElement, handleIsOpenChange]);
|
|
8068
8064
|
react.useEffect(() => {
|
|
8069
|
-
if (disabled) handleIsOpenChange(false);
|
|
8070
|
-
}, [disabled, handleIsOpenChange]);
|
|
8065
|
+
if (disabled && showTooltip) handleIsOpenChange(false);
|
|
8066
|
+
}, [disabled, handleIsOpenChange, showTooltip]);
|
|
8071
8067
|
react.useEffect(() => {
|
|
8072
|
-
if (!content) handleIsOpenChange(false);
|
|
8073
|
-
}, [content, handleIsOpenChange]);
|
|
8068
|
+
if (!content && showTooltip) handleIsOpenChange(false);
|
|
8069
|
+
}, [content, handleIsOpenChange, showTooltip]);
|
|
8074
8070
|
react.useEffect(() => refs.setReference(referenceElement), [referenceElement, refs]);
|
|
8075
8071
|
react.useEffect(() => {
|
|
8076
8072
|
if (!showTooltip) return;
|