@sanity/ui 1.9.0 → 1.9.1
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 +21 -37
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +20 -36
- package/dist/index.js.map +1 -1
- package/package.json +4 -6
- package/src/primitives/tooltip/__workshop__/index.ts +10 -0
- package/src/primitives/tooltip/__workshop__/overflowingBoundary.tsx +53 -0
- package/src/primitives/tooltip/__workshop__/resizableBoundary.tsx +85 -0
- package/src/primitives/tooltip/constants.ts +1 -0
- package/src/primitives/tooltip/tooltip.tsx +10 -21
package/dist/index.esm.js
CHANGED
|
@@ -5,7 +5,7 @@ import styled, { ThemeProvider as ThemeProvider$1, useTheme as useTheme$1, css,
|
|
|
5
5
|
import { white as white$1, black as black$1, hues } from '@sanity/color';
|
|
6
6
|
import { SpinnerIcon, CheckmarkIcon, RemoveIcon, SelectIcon, CloseIcon, ChevronDownIcon, ChevronRightIcon, ToggleArrowRightIcon } from '@sanity/icons';
|
|
7
7
|
import Refractor from 'react-refractor';
|
|
8
|
-
import { detectOverflow, flip, offset, shift, arrow, hide, useFloating, autoUpdate
|
|
8
|
+
import { detectOverflow, flip, offset, shift, arrow, hide, useFloating, autoUpdate } from '@floating-ui/react-dom';
|
|
9
9
|
import { createPortal } from 'react-dom';
|
|
10
10
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
11
11
|
const EMPTY_ARRAY = [];
|
|
@@ -6847,6 +6847,7 @@ function useDelayedState(initialState) {
|
|
|
6847
6847
|
}, []);
|
|
6848
6848
|
return [state, onStateChange];
|
|
6849
6849
|
}
|
|
6850
|
+
const DEFAULT_TOOLTIP_PADDING = 4;
|
|
6850
6851
|
const DEFAULT_FALLBACK_PLACEMENTS = {
|
|
6851
6852
|
top: ["bottom", "left", "right"],
|
|
6852
6853
|
"top-start": ["bottom-start", "left-start", "right-start"],
|
|
@@ -6930,7 +6931,7 @@ var __template$e = (cooked, raw) => __freeze$e(__defProp$e(cooked, "raw", {
|
|
|
6930
6931
|
value: __freeze$e(raw || cooked.slice())
|
|
6931
6932
|
}));
|
|
6932
6933
|
var _a$e;
|
|
6933
|
-
const Root$a = styled(Layer)(_a$e || (_a$e = __template$e(["\n pointer-events: none;\n"])));
|
|
6934
|
+
const Root$a = styled(Layer)(_a$e || (_a$e = __template$e(["\n pointer-events: none;\n // Note that 100vw doesn't exclude system scrollbars.\n // This should be sufficiently small enough to not trigger overflow-x scrollbars when portalled.\n max-width: calc(100vw - ", "px);\n"])), DEFAULT_TOOLTIP_PADDING * 10);
|
|
6934
6935
|
const Tooltip = forwardRef(function Tooltip2(props, ref) {
|
|
6935
6936
|
var _a2, _b, _c, _d, _e;
|
|
6936
6937
|
const boundaryElementContext = useBoundaryElement();
|
|
@@ -6958,42 +6959,25 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
|
|
|
6958
6959
|
const middleware = useMemo(() => {
|
|
6959
6960
|
const ret = [];
|
|
6960
6961
|
ret.push(flip({
|
|
6961
|
-
boundary: boundaryElement || void 0,
|
|
6962
|
+
boundary: portal ? void 0 : boundaryElement || void 0,
|
|
6962
6963
|
fallbackPlacements,
|
|
6963
|
-
padding:
|
|
6964
|
-
rootBoundary
|
|
6965
|
-
mainAxis: false
|
|
6964
|
+
padding: DEFAULT_TOOLTIP_PADDING,
|
|
6965
|
+
rootBoundary
|
|
6966
6966
|
}));
|
|
6967
6967
|
ret.push(offset({
|
|
6968
6968
|
mainAxis: 3
|
|
6969
6969
|
}));
|
|
6970
|
-
ret.push(size$2({
|
|
6971
|
-
apply(_ref22) {
|
|
6972
|
-
let {
|
|
6973
|
-
availableWidth,
|
|
6974
|
-
availableHeight,
|
|
6975
|
-
elements
|
|
6976
|
-
} = _ref22;
|
|
6977
|
-
Object.assign(elements.floating.style, {
|
|
6978
|
-
maxWidth: "".concat(availableWidth - 4 * 2, "px"),
|
|
6979
|
-
// the padding is `4px`
|
|
6980
|
-
maxHeight: "".concat(availableHeight - 4 * 2, "px")
|
|
6981
|
-
// the padding is `4px`
|
|
6982
|
-
});
|
|
6983
|
-
}
|
|
6984
|
-
}));
|
|
6985
|
-
|
|
6986
6970
|
ret.push(shift({
|
|
6987
|
-
boundary: boundaryElement || void 0,
|
|
6971
|
+
boundary: portal ? void 0 : boundaryElement || void 0,
|
|
6988
6972
|
rootBoundary,
|
|
6989
|
-
padding:
|
|
6973
|
+
padding: DEFAULT_TOOLTIP_PADDING
|
|
6990
6974
|
}));
|
|
6991
6975
|
ret.push(arrow({
|
|
6992
6976
|
element: arrowRef,
|
|
6993
6977
|
padding: 2
|
|
6994
6978
|
}));
|
|
6995
6979
|
return ret;
|
|
6996
|
-
}, [boundaryElement, fallbackPlacements]);
|
|
6980
|
+
}, [boundaryElement, fallbackPlacements, portal]);
|
|
6997
6981
|
const {
|
|
6998
6982
|
floatingStyles,
|
|
6999
6983
|
placement,
|
|
@@ -7293,10 +7277,10 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete2(props, ref) {
|
|
|
7293
7277
|
query,
|
|
7294
7278
|
value
|
|
7295
7279
|
} = state;
|
|
7296
|
-
const defaultRenderOption = useCallback(
|
|
7280
|
+
const defaultRenderOption = useCallback(_ref22 => {
|
|
7297
7281
|
let {
|
|
7298
7282
|
value: value2
|
|
7299
|
-
} =
|
|
7283
|
+
} = _ref22;
|
|
7300
7284
|
return /* @__PURE__ */jsx(Card, {
|
|
7301
7285
|
"data-as": "button",
|
|
7302
7286
|
padding: paddingProp,
|
|
@@ -7749,10 +7733,10 @@ const Breadcrumbs = forwardRef(function Breadcrumbs2(props, ref) {
|
|
|
7749
7733
|
}, itemIndex))
|
|
7750
7734
|
});
|
|
7751
7735
|
});
|
|
7752
|
-
function dialogStyle(
|
|
7736
|
+
function dialogStyle(_ref23) {
|
|
7753
7737
|
let {
|
|
7754
7738
|
theme
|
|
7755
|
-
} =
|
|
7739
|
+
} = _ref23;
|
|
7756
7740
|
const color = theme.sanity.color.base;
|
|
7757
7741
|
return {
|
|
7758
7742
|
"&:not([hidden])": {
|
|
@@ -8814,15 +8798,15 @@ var __template$6 = (cooked, raw) => __freeze$6(__defProp$6(cooked, "raw", {
|
|
|
8814
8798
|
var _a$6, _b$3, _c$1, _d;
|
|
8815
8799
|
const keyframe = keyframes(_a$6 || (_a$6 = __template$6(["\n 0% {\n background-position: 100%;\n }\n 100% {\n background-position: -100%;\n }\n"])));
|
|
8816
8800
|
const animation = css(_b$3 || (_b$3 = __template$6(["\n background-image: linear-gradient(\n to right,\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-to),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from)\n );\n background-position: 100%;\n background-size: 200% 100%;\n background-attachment: fixed;\n animation-name: ", ";\n animation-timing-function: ease-in-out;\n animation-iteration-count: infinite;\n animation-duration: 2000ms;\n"])), keyframe);
|
|
8817
|
-
const skeletonStyle = css(_d || (_d = __template$6(["\n opacity: ", ";\n transition: opacity 200ms ease-in;\n\n @media screen and (prefers-reduced-motion: no-preference) {\n ", "\n }\n\n @media screen and (prefers-reduced-motion: reduce) {\n background-color: var(--card-skeleton-color-from);\n }\n"])),
|
|
8801
|
+
const skeletonStyle = css(_d || (_d = __template$6(["\n opacity: ", ";\n transition: opacity 200ms ease-in;\n\n @media screen and (prefers-reduced-motion: no-preference) {\n ", "\n }\n\n @media screen and (prefers-reduced-motion: reduce) {\n background-color: var(--card-skeleton-color-from);\n }\n"])), _ref24 => {
|
|
8818
8802
|
let {
|
|
8819
8803
|
$visible
|
|
8820
|
-
} =
|
|
8804
|
+
} = _ref24;
|
|
8821
8805
|
return $visible ? 1 : 0;
|
|
8822
|
-
},
|
|
8806
|
+
}, _ref25 => {
|
|
8823
8807
|
let {
|
|
8824
8808
|
$animated
|
|
8825
|
-
} =
|
|
8809
|
+
} = _ref25;
|
|
8826
8810
|
return $animated ? animation : css(_c$1 || (_c$1 = __template$6(["\n background-color: var(--card-skeleton-color-from);\n "])));
|
|
8827
8811
|
});
|
|
8828
8812
|
const Root$4 = styled(Box)(responsiveRadiusStyle, skeletonStyle);
|
|
@@ -8853,12 +8837,12 @@ const Skeleton = forwardRef(function Skeleton2(props, ref) {
|
|
|
8853
8837
|
ref
|
|
8854
8838
|
});
|
|
8855
8839
|
});
|
|
8856
|
-
const Root$3 = styled(Skeleton)(
|
|
8840
|
+
const Root$3 = styled(Skeleton)(_ref26 => {
|
|
8857
8841
|
let {
|
|
8858
8842
|
$size,
|
|
8859
8843
|
$style,
|
|
8860
8844
|
theme
|
|
8861
|
-
} =
|
|
8845
|
+
} = _ref26;
|
|
8862
8846
|
const {
|
|
8863
8847
|
media
|
|
8864
8848
|
} = theme.sanity;
|
|
@@ -9205,12 +9189,12 @@ function ToastProvider(props) {
|
|
|
9205
9189
|
paddingY,
|
|
9206
9190
|
children: /* @__PURE__ */jsx(AnimatePresence, {
|
|
9207
9191
|
initial: false,
|
|
9208
|
-
children: state.map(
|
|
9192
|
+
children: state.map(_ref27 => {
|
|
9209
9193
|
let {
|
|
9210
9194
|
dismiss,
|
|
9211
9195
|
id,
|
|
9212
9196
|
params
|
|
9213
|
-
} =
|
|
9197
|
+
} = _ref27;
|
|
9214
9198
|
return /* @__PURE__ */jsx(motion.div, {
|
|
9215
9199
|
animate: {
|
|
9216
9200
|
opacity: 1,
|