@sanity/ui 1.8.1 → 1.8.2
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 +42 -14
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +42 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/primitives/popover/constants.ts +15 -1
- package/src/primitives/popover/popover.tsx +3 -1
- package/src/primitives/tooltip/constants.ts +16 -0
- package/src/primitives/tooltip/tooltip.tsx +3 -1
package/dist/index.js
CHANGED
|
@@ -5873,6 +5873,20 @@ const DEFAULT_POPOVER_PADDING = 4;
|
|
|
5873
5873
|
const DEFAULT_POPOVER_ARROW_WIDTH = 27;
|
|
5874
5874
|
const DEFAULT_POPOVER_ARROW_HEIGHT = 11;
|
|
5875
5875
|
const DEFAULT_POPOVER_MARGINS = [0, 0, 0, 0];
|
|
5876
|
+
const DEFAULT_FALLBACK_PLACEMENTS$1 = {
|
|
5877
|
+
top: ["bottom", "left", "right"],
|
|
5878
|
+
"top-start": ["bottom-start", "left-start", "right-start"],
|
|
5879
|
+
"top-end": ["bottom-end", "left-end", "right-end"],
|
|
5880
|
+
bottom: ["top", "left", "right"],
|
|
5881
|
+
"bottom-start": ["top-start", "left-start", "right-start"],
|
|
5882
|
+
"bottom-end": ["top-end", "left-end", "right-end"],
|
|
5883
|
+
left: ["right", "top", "bottom"],
|
|
5884
|
+
"left-start": ["right-start", "top-start", "bottom-start"],
|
|
5885
|
+
"left-end": ["right-end", "top-end", "bottom-end"],
|
|
5886
|
+
right: ["left", "top", "bottom"],
|
|
5887
|
+
"right-start": ["left-start", "top-start", "bottom-start"],
|
|
5888
|
+
"right-end": ["left-end", "top-end", "bottom-end"]
|
|
5889
|
+
};
|
|
5876
5890
|
function size(options) {
|
|
5877
5891
|
const {
|
|
5878
5892
|
apply,
|
|
@@ -6072,7 +6086,7 @@ const PopoverCard = react.memo(react.forwardRef(function PopoverCard2(props, ref
|
|
|
6072
6086
|
}));
|
|
6073
6087
|
PopoverCard.displayName = "PopoverCard";
|
|
6074
6088
|
const Popover = react.memo(react.forwardRef(function Popover2(props, ref) {
|
|
6075
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
6089
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
6076
6090
|
const theme = useTheme();
|
|
6077
6091
|
const boundaryElementContext = useBoundaryElement();
|
|
6078
6092
|
const {
|
|
@@ -6083,9 +6097,9 @@ const Popover = react.memo(react.forwardRef(function Popover2(props, ref) {
|
|
|
6083
6097
|
constrainSize = false,
|
|
6084
6098
|
content,
|
|
6085
6099
|
disabled,
|
|
6086
|
-
fallbackPlacements,
|
|
6100
|
+
fallbackPlacements = (_b = props.fallbackPlacements) != null ? _b : DEFAULT_FALLBACK_PLACEMENTS$1[(_a = props.placement) != null ? _a : "bottom"],
|
|
6087
6101
|
matchReferenceWidth,
|
|
6088
|
-
floatingBoundary = (
|
|
6102
|
+
floatingBoundary = (_c = props.boundaryElement) != null ? _c : boundaryElementContext.element,
|
|
6089
6103
|
open,
|
|
6090
6104
|
overflow = "hidden",
|
|
6091
6105
|
padding: paddingProp,
|
|
@@ -6093,17 +6107,17 @@ const Popover = react.memo(react.forwardRef(function Popover2(props, ref) {
|
|
|
6093
6107
|
portal,
|
|
6094
6108
|
preventOverflow = true,
|
|
6095
6109
|
radius: radiusProp = 3,
|
|
6096
|
-
referenceBoundary = (
|
|
6110
|
+
referenceBoundary = (_d = props.boundaryElement) != null ? _d : boundaryElementContext.element,
|
|
6097
6111
|
referenceElement,
|
|
6098
6112
|
scheme,
|
|
6099
6113
|
shadow: shadowProp = 3,
|
|
6100
6114
|
tone = "inherit",
|
|
6101
6115
|
width: widthProp = "auto",
|
|
6102
|
-
zOffset: zOffsetProp = (
|
|
6116
|
+
zOffset: zOffsetProp = (_e = theme.sanity.layer) == null ? void 0 : _e.popover.zOffset,
|
|
6103
6117
|
updateRef,
|
|
6104
6118
|
...restProps
|
|
6105
6119
|
} = props;
|
|
6106
|
-
const boundarySize = (
|
|
6120
|
+
const boundarySize = (_f = useElementSize(boundaryElement)) == null ? void 0 : _f.border;
|
|
6107
6121
|
const padding = useArrayProp(paddingProp);
|
|
6108
6122
|
const radius = useArrayProp(radiusProp);
|
|
6109
6123
|
const shadow = useArrayProp(shadowProp);
|
|
@@ -6222,9 +6236,9 @@ const Popover = react.memo(react.forwardRef(function Popover2(props, ref) {
|
|
|
6222
6236
|
placement: placementProp,
|
|
6223
6237
|
whileElementsMounted: reactDom$1.autoUpdate
|
|
6224
6238
|
});
|
|
6225
|
-
const referenceHidden = (
|
|
6226
|
-
const arrowX = (
|
|
6227
|
-
const arrowY = (
|
|
6239
|
+
const referenceHidden = (_g = middlewareData.hide) == null ? void 0 : _g.referenceHidden;
|
|
6240
|
+
const arrowX = (_h = middlewareData.arrow) == null ? void 0 : _h.x;
|
|
6241
|
+
const arrowY = (_i = middlewareData.arrow) == null ? void 0 : _i.y;
|
|
6228
6242
|
const setArrow = react.useCallback(arrowEl => {
|
|
6229
6243
|
arrowRef.current = arrowEl;
|
|
6230
6244
|
}, []);
|
|
@@ -6846,6 +6860,20 @@ function useDelayedState(initialState) {
|
|
|
6846
6860
|
}, []);
|
|
6847
6861
|
return [state, onStateChange];
|
|
6848
6862
|
}
|
|
6863
|
+
const DEFAULT_FALLBACK_PLACEMENTS = {
|
|
6864
|
+
top: ["bottom", "left", "right"],
|
|
6865
|
+
"top-start": ["bottom-start", "left-start", "right-start"],
|
|
6866
|
+
"top-end": ["bottom-end", "left-end", "right-end"],
|
|
6867
|
+
bottom: ["top", "left", "right"],
|
|
6868
|
+
"bottom-start": ["top-start", "left-start", "right-start"],
|
|
6869
|
+
"bottom-end": ["top-end", "left-end", "right-end"],
|
|
6870
|
+
left: ["right", "top", "bottom"],
|
|
6871
|
+
"left-start": ["right-start", "top-start", "bottom-start"],
|
|
6872
|
+
"left-end": ["right-end", "top-end", "bottom-end"],
|
|
6873
|
+
right: ["left", "top", "bottom"],
|
|
6874
|
+
"right-start": ["left-start", "top-start", "bottom-start"],
|
|
6875
|
+
"right-end": ["left-end", "top-end", "bottom-end"]
|
|
6876
|
+
};
|
|
6849
6877
|
var __freeze$f = Object.freeze;
|
|
6850
6878
|
var __defProp$f = Object.defineProperty;
|
|
6851
6879
|
var __template$f = (cooked, raw) => __freeze$f(__defProp$f(cooked, "raw", {
|
|
@@ -6917,7 +6945,7 @@ var __template$e = (cooked, raw) => __freeze$e(__defProp$e(cooked, "raw", {
|
|
|
6917
6945
|
var _a$e;
|
|
6918
6946
|
const Root$a = styled__default.default(Layer)(_a$e || (_a$e = __template$e(["\n pointer-events: none;\n"])));
|
|
6919
6947
|
const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
|
|
6920
|
-
var _a2, _b, _c;
|
|
6948
|
+
var _a2, _b, _c, _d, _e;
|
|
6921
6949
|
const boundaryElementContext = useBoundaryElement();
|
|
6922
6950
|
const theme = useTheme();
|
|
6923
6951
|
const {
|
|
@@ -6925,13 +6953,13 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
|
|
|
6925
6953
|
children: childProp,
|
|
6926
6954
|
content,
|
|
6927
6955
|
disabled,
|
|
6928
|
-
fallbackPlacements: fallbackPlacementsProp,
|
|
6956
|
+
fallbackPlacements: fallbackPlacementsProp = (_b = props.fallbackPlacements) != null ? _b : DEFAULT_FALLBACK_PLACEMENTS[(_a2 = props.placement) != null ? _a2 : "bottom"],
|
|
6929
6957
|
padding,
|
|
6930
6958
|
placement: placementProp = "bottom",
|
|
6931
6959
|
portal,
|
|
6932
6960
|
scheme,
|
|
6933
6961
|
shadow = 2,
|
|
6934
|
-
zOffset = (
|
|
6962
|
+
zOffset = (_c = theme.sanity.layer) == null ? void 0 : _c.tooltip.zOffset,
|
|
6935
6963
|
delay,
|
|
6936
6964
|
...restProps
|
|
6937
6965
|
} = props;
|
|
@@ -6991,8 +7019,8 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
|
|
|
6991
7019
|
whileElementsMounted: reactDom$1.autoUpdate
|
|
6992
7020
|
});
|
|
6993
7021
|
const staticSide = placement && FLOATING_STATIC_SIDES[placement.split("-")[0]];
|
|
6994
|
-
const arrowX = (
|
|
6995
|
-
const arrowY = (
|
|
7022
|
+
const arrowX = (_d = middlewareData.arrow) == null ? void 0 : _d.x;
|
|
7023
|
+
const arrowY = (_e = middlewareData.arrow) == null ? void 0 : _e.y;
|
|
6996
7024
|
const arrowStyle = react.useMemo(() => {
|
|
6997
7025
|
const style = {
|
|
6998
7026
|
left: arrowX !== null ? arrowX : void 0,
|