@sanity/ui 0.37.14 → 0.37.15
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/lib/dts/src/primitives/popover/popover.d.ts.map +1 -1
- package/lib/dts/src/primitives/tooltip/tooltip.d.ts.map +1 -1
- package/lib/sanity-ui.js +27 -11
- package/lib/sanity-ui.js.map +1 -1
- package/lib/sanity-ui.modern.mjs +27 -11
- package/lib/sanity-ui.modern.mjs.map +1 -1
- package/lib/sanity-ui.module.js +27 -11
- package/lib/sanity-ui.module.js.map +1 -1
- package/package.json +2 -2
- package/src/primitives/popover/popover.tsx +25 -8
- package/src/primitives/tooltip/__workshop__/props.tsx +3 -2
- package/src/primitives/tooltip/tooltip.tsx +16 -7
package/lib/sanity-ui.module.js
CHANGED
|
@@ -6143,7 +6143,7 @@ var Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
|
|
|
6143
6143
|
setArrowElement = _useState3[1];
|
|
6144
6144
|
|
|
6145
6145
|
var popperReferenceElement = referenceElementProp || referenceElement;
|
|
6146
|
-
var width = useArrayProp(widthProp);
|
|
6146
|
+
var width = useArrayProp(matchReferenceWidth ? 'auto' : widthProp);
|
|
6147
6147
|
var modifiers = usePopoverModifiers({
|
|
6148
6148
|
allowedAutoPlacements: allowedAutoPlacements,
|
|
6149
6149
|
arrow: arrow,
|
|
@@ -6184,13 +6184,21 @@ var Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
|
|
|
6184
6184
|
var popoverStyle = useMemo(function () {
|
|
6185
6185
|
return _extends({}, style, styles.popper);
|
|
6186
6186
|
}, [style, styles]);
|
|
6187
|
+
var updateTimeoutRef = useRef(null);
|
|
6187
6188
|
useEffect(function () {
|
|
6188
|
-
if (
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
} catch (_) {// ignore caught error
|
|
6192
|
-
}
|
|
6189
|
+
if (updateTimeoutRef.current) {
|
|
6190
|
+
clearTimeout(updateTimeoutRef.current);
|
|
6191
|
+
updateTimeoutRef.current = null;
|
|
6193
6192
|
}
|
|
6193
|
+
|
|
6194
|
+
updateTimeoutRef.current = setTimeout(function () {
|
|
6195
|
+
if (forceUpdate) {
|
|
6196
|
+
try {
|
|
6197
|
+
forceUpdate();
|
|
6198
|
+
} catch (_) {// ignore caught error
|
|
6199
|
+
}
|
|
6200
|
+
}
|
|
6201
|
+
}, 0);
|
|
6194
6202
|
}, [content, forceUpdate, open, popperReferenceElement]);
|
|
6195
6203
|
|
|
6196
6204
|
if (disabled) {
|
|
@@ -6894,13 +6902,21 @@ var Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
|
|
|
6894
6902
|
window.removeEventListener('mousemove', handleWindowMouseMove);
|
|
6895
6903
|
};
|
|
6896
6904
|
}, [isOpen, referenceElement]);
|
|
6905
|
+
var updateTimeoutRef = useRef(null);
|
|
6897
6906
|
useEffect(function () {
|
|
6898
|
-
if (
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
} catch (_) {// ignore caught error
|
|
6902
|
-
}
|
|
6907
|
+
if (updateTimeoutRef.current) {
|
|
6908
|
+
clearTimeout(updateTimeoutRef.current);
|
|
6909
|
+
updateTimeoutRef.current = null;
|
|
6903
6910
|
}
|
|
6911
|
+
|
|
6912
|
+
updateTimeoutRef.current = setTimeout(function () {
|
|
6913
|
+
if (forceUpdate) {
|
|
6914
|
+
try {
|
|
6915
|
+
forceUpdate();
|
|
6916
|
+
} catch (_) {// ignore caught error
|
|
6917
|
+
}
|
|
6918
|
+
}
|
|
6919
|
+
}, 0);
|
|
6904
6920
|
}, [forceUpdate, content]); // Close when `disabled` changes to `true`
|
|
6905
6921
|
|
|
6906
6922
|
useEffect(function () {
|