@sanity/ui 1.8.1 → 1.8.3
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 +45 -17
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +45 -17
- package/dist/index.js.map +1 -1
- package/package.json +15 -15
- package/src/primitives/_selectable/style.ts +1 -0
- package/src/primitives/button/__workshop__/sanityUploadButton.tsx +2 -1
- package/src/primitives/card/styles.ts +1 -0
- package/src/primitives/popover/constants.ts +15 -1
- package/src/primitives/popover/popover.tsx +3 -1
- package/src/primitives/select/styles.ts +1 -0
- package/src/primitives/tooltip/constants.ts +16 -0
- package/src/primitives/tooltip/tooltip.tsx +3 -1
package/dist/index.esm.js
CHANGED
|
@@ -4748,7 +4748,7 @@ function cardBaseStyle(props) {
|
|
|
4748
4748
|
theme
|
|
4749
4749
|
} = props;
|
|
4750
4750
|
const space = theme.sanity.space;
|
|
4751
|
-
return css(_b$i || (_b$i = __template$t(["\n ", "\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n outline: none;\n text-decoration: none;\n }\n\n /* &:is(pre) */\n &[data-as='pre'] {\n font: inherit;\n }\n "])), $checkered && css(_a$t || (_a$t = __template$t(["\n background-size: ", "px ", "px;\n background-position: 50% 50%;\n background-image: var(--card-bg-image);\n "])), space[3], space[3]));
|
|
4751
|
+
return css(_b$i || (_b$i = __template$t(["\n ", "\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: -webkit-fill-available;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n outline: none;\n text-decoration: none;\n }\n\n /* &:is(pre) */\n &[data-as='pre'] {\n font: inherit;\n }\n "])), $checkered && css(_a$t || (_a$t = __template$t(["\n background-size: ", "px ", "px;\n background-position: 50% 50%;\n background-image: var(--card-bg-image);\n "])), space[3], space[3]));
|
|
4752
4752
|
}
|
|
4753
4753
|
function cardColorStyle(props) {
|
|
4754
4754
|
var _a2, _b2;
|
|
@@ -5860,6 +5860,20 @@ const DEFAULT_POPOVER_PADDING = 4;
|
|
|
5860
5860
|
const DEFAULT_POPOVER_ARROW_WIDTH = 27;
|
|
5861
5861
|
const DEFAULT_POPOVER_ARROW_HEIGHT = 11;
|
|
5862
5862
|
const DEFAULT_POPOVER_MARGINS = [0, 0, 0, 0];
|
|
5863
|
+
const DEFAULT_FALLBACK_PLACEMENTS$1 = {
|
|
5864
|
+
top: ["bottom", "left", "right"],
|
|
5865
|
+
"top-start": ["bottom-start", "left-start", "right-start"],
|
|
5866
|
+
"top-end": ["bottom-end", "left-end", "right-end"],
|
|
5867
|
+
bottom: ["top", "left", "right"],
|
|
5868
|
+
"bottom-start": ["top-start", "left-start", "right-start"],
|
|
5869
|
+
"bottom-end": ["top-end", "left-end", "right-end"],
|
|
5870
|
+
left: ["right", "top", "bottom"],
|
|
5871
|
+
"left-start": ["right-start", "top-start", "bottom-start"],
|
|
5872
|
+
"left-end": ["right-end", "top-end", "bottom-end"],
|
|
5873
|
+
right: ["left", "top", "bottom"],
|
|
5874
|
+
"right-start": ["left-start", "top-start", "bottom-start"],
|
|
5875
|
+
"right-end": ["left-end", "top-end", "bottom-end"]
|
|
5876
|
+
};
|
|
5863
5877
|
function size(options) {
|
|
5864
5878
|
const {
|
|
5865
5879
|
apply,
|
|
@@ -6059,7 +6073,7 @@ const PopoverCard = memo(forwardRef(function PopoverCard2(props, ref) {
|
|
|
6059
6073
|
}));
|
|
6060
6074
|
PopoverCard.displayName = "PopoverCard";
|
|
6061
6075
|
const Popover = memo(forwardRef(function Popover2(props, ref) {
|
|
6062
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
6076
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
6063
6077
|
const theme = useTheme();
|
|
6064
6078
|
const boundaryElementContext = useBoundaryElement();
|
|
6065
6079
|
const {
|
|
@@ -6070,9 +6084,9 @@ const Popover = memo(forwardRef(function Popover2(props, ref) {
|
|
|
6070
6084
|
constrainSize = false,
|
|
6071
6085
|
content,
|
|
6072
6086
|
disabled,
|
|
6073
|
-
fallbackPlacements,
|
|
6087
|
+
fallbackPlacements = (_b = props.fallbackPlacements) != null ? _b : DEFAULT_FALLBACK_PLACEMENTS$1[(_a = props.placement) != null ? _a : "bottom"],
|
|
6074
6088
|
matchReferenceWidth,
|
|
6075
|
-
floatingBoundary = (
|
|
6089
|
+
floatingBoundary = (_c = props.boundaryElement) != null ? _c : boundaryElementContext.element,
|
|
6076
6090
|
open,
|
|
6077
6091
|
overflow = "hidden",
|
|
6078
6092
|
padding: paddingProp,
|
|
@@ -6080,17 +6094,17 @@ const Popover = memo(forwardRef(function Popover2(props, ref) {
|
|
|
6080
6094
|
portal,
|
|
6081
6095
|
preventOverflow = true,
|
|
6082
6096
|
radius: radiusProp = 3,
|
|
6083
|
-
referenceBoundary = (
|
|
6097
|
+
referenceBoundary = (_d = props.boundaryElement) != null ? _d : boundaryElementContext.element,
|
|
6084
6098
|
referenceElement,
|
|
6085
6099
|
scheme,
|
|
6086
6100
|
shadow: shadowProp = 3,
|
|
6087
6101
|
tone = "inherit",
|
|
6088
6102
|
width: widthProp = "auto",
|
|
6089
|
-
zOffset: zOffsetProp = (
|
|
6103
|
+
zOffset: zOffsetProp = (_e = theme.sanity.layer) == null ? void 0 : _e.popover.zOffset,
|
|
6090
6104
|
updateRef,
|
|
6091
6105
|
...restProps
|
|
6092
6106
|
} = props;
|
|
6093
|
-
const boundarySize = (
|
|
6107
|
+
const boundarySize = (_f = useElementSize(boundaryElement)) == null ? void 0 : _f.border;
|
|
6094
6108
|
const padding = useArrayProp(paddingProp);
|
|
6095
6109
|
const radius = useArrayProp(radiusProp);
|
|
6096
6110
|
const shadow = useArrayProp(shadowProp);
|
|
@@ -6209,9 +6223,9 @@ const Popover = memo(forwardRef(function Popover2(props, ref) {
|
|
|
6209
6223
|
placement: placementProp,
|
|
6210
6224
|
whileElementsMounted: autoUpdate
|
|
6211
6225
|
});
|
|
6212
|
-
const referenceHidden = (
|
|
6213
|
-
const arrowX = (
|
|
6214
|
-
const arrowY = (
|
|
6226
|
+
const referenceHidden = (_g = middlewareData.hide) == null ? void 0 : _g.referenceHidden;
|
|
6227
|
+
const arrowX = (_h = middlewareData.arrow) == null ? void 0 : _h.x;
|
|
6228
|
+
const arrowY = (_i = middlewareData.arrow) == null ? void 0 : _i.y;
|
|
6215
6229
|
const setArrow = useCallback(arrowEl => {
|
|
6216
6230
|
arrowRef.current = arrowEl;
|
|
6217
6231
|
}, []);
|
|
@@ -6351,7 +6365,7 @@ var __template$j = (cooked, raw) => __freeze$j(__defProp$j(cooked, "raw", {
|
|
|
6351
6365
|
}));
|
|
6352
6366
|
var _a$j, _b$c, _c$7, _d$5;
|
|
6353
6367
|
function rootStyle() {
|
|
6354
|
-
return css(_a$j || (_a$j = __template$j(["\n position: relative;\n width: stretch;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
|
|
6368
|
+
return css(_a$j || (_a$j = __template$j(["\n position: relative;\n width: -webkit-fill-available;\n width: stretch;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
|
|
6355
6369
|
}
|
|
6356
6370
|
function inputBaseStyle(props) {
|
|
6357
6371
|
const {
|
|
@@ -6833,6 +6847,20 @@ function useDelayedState(initialState) {
|
|
|
6833
6847
|
}, []);
|
|
6834
6848
|
return [state, onStateChange];
|
|
6835
6849
|
}
|
|
6850
|
+
const DEFAULT_FALLBACK_PLACEMENTS = {
|
|
6851
|
+
top: ["bottom", "left", "right"],
|
|
6852
|
+
"top-start": ["bottom-start", "left-start", "right-start"],
|
|
6853
|
+
"top-end": ["bottom-end", "left-end", "right-end"],
|
|
6854
|
+
bottom: ["top", "left", "right"],
|
|
6855
|
+
"bottom-start": ["top-start", "left-start", "right-start"],
|
|
6856
|
+
"bottom-end": ["top-end", "left-end", "right-end"],
|
|
6857
|
+
left: ["right", "top", "bottom"],
|
|
6858
|
+
"left-start": ["right-start", "top-start", "bottom-start"],
|
|
6859
|
+
"left-end": ["right-end", "top-end", "bottom-end"],
|
|
6860
|
+
right: ["left", "top", "bottom"],
|
|
6861
|
+
"right-start": ["left-start", "top-start", "bottom-start"],
|
|
6862
|
+
"right-end": ["left-end", "top-end", "bottom-end"]
|
|
6863
|
+
};
|
|
6836
6864
|
var __freeze$f = Object.freeze;
|
|
6837
6865
|
var __defProp$f = Object.defineProperty;
|
|
6838
6866
|
var __template$f = (cooked, raw) => __freeze$f(__defProp$f(cooked, "raw", {
|
|
@@ -6904,7 +6932,7 @@ var __template$e = (cooked, raw) => __freeze$e(__defProp$e(cooked, "raw", {
|
|
|
6904
6932
|
var _a$e;
|
|
6905
6933
|
const Root$a = styled(Layer)(_a$e || (_a$e = __template$e(["\n pointer-events: none;\n"])));
|
|
6906
6934
|
const Tooltip = forwardRef(function Tooltip2(props, ref) {
|
|
6907
|
-
var _a2, _b, _c;
|
|
6935
|
+
var _a2, _b, _c, _d, _e;
|
|
6908
6936
|
const boundaryElementContext = useBoundaryElement();
|
|
6909
6937
|
const theme = useTheme();
|
|
6910
6938
|
const {
|
|
@@ -6912,13 +6940,13 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
|
|
|
6912
6940
|
children: childProp,
|
|
6913
6941
|
content,
|
|
6914
6942
|
disabled,
|
|
6915
|
-
fallbackPlacements: fallbackPlacementsProp,
|
|
6943
|
+
fallbackPlacements: fallbackPlacementsProp = (_b = props.fallbackPlacements) != null ? _b : DEFAULT_FALLBACK_PLACEMENTS[(_a2 = props.placement) != null ? _a2 : "bottom"],
|
|
6916
6944
|
padding,
|
|
6917
6945
|
placement: placementProp = "bottom",
|
|
6918
6946
|
portal,
|
|
6919
6947
|
scheme,
|
|
6920
6948
|
shadow = 2,
|
|
6921
|
-
zOffset = (
|
|
6949
|
+
zOffset = (_c = theme.sanity.layer) == null ? void 0 : _c.tooltip.zOffset,
|
|
6922
6950
|
delay,
|
|
6923
6951
|
...restProps
|
|
6924
6952
|
} = props;
|
|
@@ -6978,8 +7006,8 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
|
|
|
6978
7006
|
whileElementsMounted: autoUpdate
|
|
6979
7007
|
});
|
|
6980
7008
|
const staticSide = placement && FLOATING_STATIC_SIDES[placement.split("-")[0]];
|
|
6981
|
-
const arrowX = (
|
|
6982
|
-
const arrowY = (
|
|
7009
|
+
const arrowX = (_d = middlewareData.arrow) == null ? void 0 : _d.x;
|
|
7010
|
+
const arrowY = (_e = middlewareData.arrow) == null ? void 0 : _e.y;
|
|
6983
7011
|
const arrowStyle = useMemo(() => {
|
|
6984
7012
|
const style = {
|
|
6985
7013
|
left: arrowX !== null ? arrowX : void 0,
|
|
@@ -8488,7 +8516,7 @@ var __template$7 = (cooked, raw) => __freeze$7(__defProp$7(cooked, "raw", {
|
|
|
8488
8516
|
}));
|
|
8489
8517
|
var _a$7, _b$4;
|
|
8490
8518
|
function selectableBaseStyle() {
|
|
8491
|
-
return css(_a$7 || (_a$7 = __template$7(["\n background-color: inherit;\n color: inherit;\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n text-decoration: none;\n }\n "])));
|
|
8519
|
+
return css(_a$7 || (_a$7 = __template$7(["\n background-color: inherit;\n color: inherit;\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: -webkit-fill-available;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n text-decoration: none;\n }\n "])));
|
|
8492
8520
|
}
|
|
8493
8521
|
function selectableColorStyle(props) {
|
|
8494
8522
|
var _a2, _b2;
|