@sanity/ui 1.8.2 → 1.9.0
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 +22 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +22 -8
- 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/select/styles.ts +1 -0
- package/src/primitives/tooltip/tooltip.test.tsx +67 -0
- package/src/primitives/tooltip/tooltip.tsx +25 -5
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;
|
|
@@ -6365,7 +6365,7 @@ var __template$j = (cooked, raw) => __freeze$j(__defProp$j(cooked, "raw", {
|
|
|
6365
6365
|
}));
|
|
6366
6366
|
var _a$j, _b$c, _c$7, _d$5;
|
|
6367
6367
|
function rootStyle() {
|
|
6368
|
-
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 "])));
|
|
6369
6369
|
}
|
|
6370
6370
|
function inputBaseStyle(props) {
|
|
6371
6371
|
const {
|
|
@@ -7027,19 +7027,21 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
|
|
|
7027
7027
|
const closeDelayProp = typeof delay === "number" ? delay : (delay == null ? void 0 : delay.close) || 0;
|
|
7028
7028
|
const openDelay = isInsideGroup ? delayGroupContext.openDelay : openDelayProp;
|
|
7029
7029
|
const closeDelay = isInsideGroup ? delayGroupContext.closeDelay : closeDelayProp;
|
|
7030
|
-
const handleIsOpenChange = useCallback(open => {
|
|
7030
|
+
const handleIsOpenChange = useCallback((open, immediate) => {
|
|
7031
7031
|
if (isInsideGroup) {
|
|
7032
7032
|
if (open) {
|
|
7033
|
-
|
|
7034
|
-
delayGroupContext.
|
|
7033
|
+
const groupedOpenDelay = immediate ? 0 : openDelay;
|
|
7034
|
+
delayGroupContext.setIsGroupActive(open, groupedOpenDelay);
|
|
7035
|
+
delayGroupContext.setOpenTooltipId(tooltipId, groupedOpenDelay);
|
|
7035
7036
|
} else {
|
|
7036
7037
|
const minimumGroupDeactivateDelay = 200;
|
|
7037
7038
|
const groupDeactivateDelay = closeDelay > minimumGroupDeactivateDelay ? closeDelay : minimumGroupDeactivateDelay;
|
|
7038
7039
|
delayGroupContext.setIsGroupActive(open, groupDeactivateDelay);
|
|
7039
|
-
delayGroupContext.setOpenTooltipId(null, closeDelay);
|
|
7040
|
+
delayGroupContext.setOpenTooltipId(null, immediate ? 0 : closeDelay);
|
|
7040
7041
|
}
|
|
7041
7042
|
} else {
|
|
7042
|
-
|
|
7043
|
+
const standaloneDelay = immediate ? 0 : open ? openDelay : closeDelay;
|
|
7044
|
+
setIsOpen(open, standaloneDelay);
|
|
7043
7045
|
}
|
|
7044
7046
|
}, [isInsideGroup, delayGroupContext, openDelay, tooltipId, closeDelay, setIsOpen]);
|
|
7045
7047
|
const handleBlur = useCallback(() => handleIsOpenChange(false), [handleIsOpenChange]);
|
|
@@ -7068,6 +7070,18 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
|
|
|
7068
7070
|
if (!content) handleIsOpenChange(false);
|
|
7069
7071
|
}, [content, handleIsOpenChange]);
|
|
7070
7072
|
useEffect(() => refs.setReference(referenceElement), [referenceElement, refs]);
|
|
7073
|
+
useEffect(() => {
|
|
7074
|
+
if (!showTooltip) return;
|
|
7075
|
+
function handleWindowKeyDown(event) {
|
|
7076
|
+
if (event.key === "Escape") {
|
|
7077
|
+
handleIsOpenChange(false, true);
|
|
7078
|
+
}
|
|
7079
|
+
}
|
|
7080
|
+
window.addEventListener("keydown", handleWindowKeyDown);
|
|
7081
|
+
return () => {
|
|
7082
|
+
window.removeEventListener("keydown", handleWindowKeyDown);
|
|
7083
|
+
};
|
|
7084
|
+
}, [handleIsOpenChange, showTooltip]);
|
|
7071
7085
|
const setArrow = useCallback(arrowEl => {
|
|
7072
7086
|
arrowRef.current = arrowEl;
|
|
7073
7087
|
update();
|
|
@@ -8516,7 +8530,7 @@ var __template$7 = (cooked, raw) => __freeze$7(__defProp$7(cooked, "raw", {
|
|
|
8516
8530
|
}));
|
|
8517
8531
|
var _a$7, _b$4;
|
|
8518
8532
|
function selectableBaseStyle() {
|
|
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: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n text-decoration: none;\n }\n "])));
|
|
8533
|
+
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 "])));
|
|
8520
8534
|
}
|
|
8521
8535
|
function selectableColorStyle(props) {
|
|
8522
8536
|
var _a2, _b2;
|