@sanity/ui 2.0.0-alpha.29 → 2.0.0-alpha.30

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 CHANGED
@@ -715,7 +715,7 @@ var ResizeObserverController = function () {
715
715
  };
716
716
  return ResizeObserverController;
717
717
  }();
718
- var ResizeObserver$1 = function () {
718
+ var ResizeObserver = function () {
719
719
  function ResizeObserver(callback) {
720
720
  if (arguments.length === 0) {
721
721
  throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");
@@ -751,7 +751,7 @@ var ResizeObserver$1 = function () {
751
751
  };
752
752
  return ResizeObserver;
753
753
  }();
754
- const _ResizeObserver = typeof document !== "undefined" && typeof window !== "undefined" && window.ResizeObserver ? window.ResizeObserver : ResizeObserver$1;
754
+ const _ResizeObserver = typeof document !== "undefined" && typeof window !== "undefined" && window.ResizeObserver ? window.ResizeObserver : ResizeObserver;
755
755
  const _elementSizeObserver = _createElementSizeObserver();
756
756
  function _createElementRectValueListener() {
757
757
  return {
@@ -5750,7 +5750,6 @@ const Breadcrumbs = forwardRef(function Breadcrumbs2(props, ref) {
5750
5750
  }, itemIndex))
5751
5751
  });
5752
5752
  });
5753
- const BORDER_OFFSET_X = 12;
5754
5753
  var __freeze$c = Object.freeze;
5755
5754
  var __defProp$c = Object.defineProperty;
5756
5755
  var __template$c = (cooked, raw) => __freeze$c(__defProp$c(cooked, "raw", {
@@ -5815,9 +5814,9 @@ const Root$7 = styled(Layer)(responsivePaddingStyle, dialogStyle, responsiveDial
5815
5814
  const DialogContainer = styled(Container)(_a$b || (_a$b = __template$b(["\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n height: 100%;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n"])));
5816
5815
  const DialogCardRoot = styled(Card)(_b$6 || (_b$6 = __template$b(["\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n min-height: 0;\n max-height: 100%;\n overflow: hidden;\n overflow: clip;\n"])));
5817
5816
  const DialogLayout = styled(Flex)(_c$2 || (_c$2 = __template$b(["\n flex: 1;\n min-height: 0;\n width: 100%;\n"])));
5818
- const DialogHeader = styled(Box)(_d$1 || (_d$1 = __template$b(["\n position: relative;\n z-index: 2;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n left: ", "px;\n right: ", "px;\n bottom: -1px;\n border-bottom: 1px solid var(--card-border-color);\n width: auto;\n opacity: ", ";\n transition: opacity 200ms ease-in;\n }\n"])), BORDER_OFFSET_X, BORDER_OFFSET_X, props => props.$isContentScrollable && props.$hasScrolledFromTop ? 1 : 0);
5817
+ const DialogHeader = styled(Box)(_d$1 || (_d$1 = __template$b(["\n position: relative;\n z-index: 2;\n"])));
5819
5818
  const DialogContent = styled(Box)(_e || (_e = __template$b(["\n position: relative;\n z-index: 1;\n overflow: auto;\n outline: none;\n"])));
5820
- const DialogFooter = styled(Box)(_f || (_f = __template$b(["\n position: relative;\n z-index: 3;\n\n &:before {\n content: '';\n display: block;\n position: absolute;\n left: ", "px;\n right: ", "px;\n top: -1px;\n border-top: 1px solid var(--card-border-color);\n width: auto;\n opacity: ", ";\n transition: opacity 200ms ease-in;\n }\n"])), BORDER_OFFSET_X, BORDER_OFFSET_X, props => props.$isContentScrollable && !props.$hasScrolledToBottom ? 1 : 0);
5819
+ const DialogFooter = styled(Box)(_f || (_f = __template$b(["\n position: relative;\n z-index: 3;\n"])));
5821
5820
  const DialogCard = forwardRef(function DialogCard2(props, ref) {
5822
5821
  var _a2;
5823
5822
  const {
@@ -5852,9 +5851,6 @@ const DialogCard = forwardRef(function DialogCard2(props, ref) {
5852
5851
  const labelId = "".concat(id, "_label");
5853
5852
  const showCloseButton = Boolean(onClose) && hideCloseButton === false;
5854
5853
  const showHeader = Boolean(header) || showCloseButton;
5855
- const [isContentScrollable, setIsContentScrollable] = useState(false);
5856
- const [hasScrolledFromTop, setHasScrolledFromTop] = useState(false);
5857
- const [hasScrolledToBottom, setHasScrolledToBottom] = useState(false);
5858
5854
  useEffect(() => {
5859
5855
  if (!autoFocus) return;
5860
5856
  if (forwardedRef.current) {
@@ -5889,22 +5885,6 @@ const DialogCard = forwardRef(function DialogCard2(props, ref) {
5889
5885
  localContentRef.current = el;
5890
5886
  if (typeof contentRef === "function") contentRef(el);else if (contentRef) contentRef.current = el;
5891
5887
  }, [contentRef]);
5892
- const handleContentUpdate = useCallback(() => {
5893
- if (localContentRef.current) {
5894
- setIsContentScrollable(localContentRef.current.clientHeight < localContentRef.current.scrollHeight);
5895
- setHasScrolledFromTop(localContentRef.current.scrollTop > 0);
5896
- setHasScrolledToBottom(localContentRef.current.scrollTop >= localContentRef.current.scrollHeight - localContentRef.current.clientHeight);
5897
- }
5898
- }, []);
5899
- useEffect(() => {
5900
- const resizeObserver = new ResizeObserver(handleContentUpdate);
5901
- if (localContentRef.current) {
5902
- resizeObserver.observe(localContentRef.current);
5903
- }
5904
- return () => {
5905
- resizeObserver.disconnect();
5906
- };
5907
- }, [contentRef, handleContentUpdate]);
5908
5888
  return /* @__PURE__ */jsx(DialogContainer, {
5909
5889
  "data-ui": "DialogCard",
5910
5890
  width,
@@ -5916,8 +5896,6 @@ const DialogCard = forwardRef(function DialogCard2(props, ref) {
5916
5896
  children: /* @__PURE__ */jsxs(DialogLayout, {
5917
5897
  direction: "column",
5918
5898
  children: [showHeader && /* @__PURE__ */jsx(DialogHeader, {
5919
- $isContentScrollable: isContentScrollable,
5920
- $hasScrolledFromTop: hasScrolledFromTop,
5921
5899
  children: /* @__PURE__ */jsxs(Flex, {
5922
5900
  align: "center",
5923
5901
  padding: 3,
@@ -5946,11 +5924,8 @@ const DialogCard = forwardRef(function DialogCard2(props, ref) {
5946
5924
  flex: 1,
5947
5925
  ref: setContentRef,
5948
5926
  tabIndex: -1,
5949
- onScroll: handleContentUpdate,
5950
5927
  children
5951
5928
  }), footer && /* @__PURE__ */jsx(DialogFooter, {
5952
- $isContentScrollable: isContentScrollable,
5953
- $hasScrolledToBottom: hasScrolledToBottom,
5954
5929
  children: footer
5955
5930
  })]
5956
5931
  })