sanity 3.93.1-next.38.730d143834 → 3.93.1-next.40.6377c06e67

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.
@@ -5657,6 +5657,50 @@ function _temp$c(s) {
5657
5657
  function _temp2$4(action) {
5658
5658
  return !isRestoreAction(action);
5659
5659
  }
5660
+ function useChipScrollPosition(containerRef) {
5661
+ const $ = reactCompilerRuntime.c(4), [showGradient, setShowGradient] = React.useState(!1);
5662
+ let t0;
5663
+ $[0] !== containerRef.current ? (t0 = () => {
5664
+ const checkOverflow = () => {
5665
+ const container = containerRef.current;
5666
+ if (!container)
5667
+ return;
5668
+ const {
5669
+ scrollWidth,
5670
+ clientWidth
5671
+ } = container;
5672
+ if (!(scrollWidth > clientWidth)) {
5673
+ setShowGradient(!1);
5674
+ return;
5675
+ }
5676
+ const {
5677
+ scrollLeft
5678
+ } = container, isAtEnd = scrollLeft + clientWidth >= scrollWidth;
5679
+ setShowGradient(!isAtEnd);
5680
+ }, setupObservers = function() {
5681
+ checkOverflow();
5682
+ const container_0 = containerRef.current;
5683
+ if (!container_0)
5684
+ return {
5685
+ observer: null
5686
+ };
5687
+ const observer = new IntersectionObserver((entries) => {
5688
+ const entry = entries[0];
5689
+ entry && setShowGradient(entry.isIntersecting);
5690
+ }), lastChip = container_0.children[container_0.children.length - 1];
5691
+ return observer.observe(lastChip), {
5692
+ observer
5693
+ };
5694
+ }, {
5695
+ observer: observer_0
5696
+ } = setupObservers();
5697
+ return () => {
5698
+ observer_0?.disconnect();
5699
+ };
5700
+ }, $[0] = containerRef.current, $[1] = t0) : t0 = $[1];
5701
+ let t1;
5702
+ return $[2] !== containerRef ? (t1 = [containerRef], $[2] = containerRef, $[3] = t1) : t1 = $[3], React.useEffect(t0, t1), showGradient;
5703
+ }
5660
5704
  const TooltipContent$1 = (t0) => {
5661
5705
  const $ = reactCompilerRuntime.c(16), {
5662
5706
  release
@@ -5800,16 +5844,19 @@ const TooltipContent$1 = (t0) => {
5800
5844
  }
5801
5845
  }
5802
5846
 
5803
- &::after {
5804
- content: '';
5805
- display: block;
5806
- position: absolute;
5807
- top: 0;
5808
- right: 0;
5809
- bottom: 0;
5810
- width: ${theme$1.space[3]}px;
5811
- background: linear-gradient(to right, ${theme.rgba(theme$1.color.bg, 0)}, var(--card-bg-color));
5812
- }
5847
+ ${props.$showGradient && styledComponents.css`
5848
+ &::after {
5849
+ content: '';
5850
+ display: block;
5851
+ position: absolute;
5852
+ top: 0;
5853
+ right: 0;
5854
+ bottom: 0;
5855
+ width: 150px;
5856
+ background: linear-gradient(to right, ${theme.rgba(theme$1.color.bg, 0)}, var(--card-bg-color));
5857
+ transition: 'opacity 300ms ease-out';
5858
+ }
5859
+ `}
5813
5860
  `;
5814
5861
  }), DocumentPanelHeader = React.memo(React.forwardRef(function(_props, ref) {
5815
5862
  const {
@@ -5834,7 +5881,7 @@ const TooltipContent$1 = (t0) => {
5834
5881
  hasGroupSiblings
5835
5882
  } = usePaneRouter(), {
5836
5883
  actions: fieldActions
5837
- } = sanity.useFieldActions(), [referenceElement, setReferenceElement] = React.useState(null), actions = React.useMemo(() => (allActions ?? []).filter((action) => !isRestoreAction(action)), [allActions]), menuNodes = React.useMemo(() => resolveMenuNodes({
5884
+ } = sanity.useFieldActions(), [referenceElement, setReferenceElement] = React.useState(null), scrollContainerRef = React.useRef(null), showGradient = useChipScrollPosition(scrollContainerRef), actions = React.useMemo(() => (allActions ?? []).filter((action) => !isRestoreAction(action)), [allActions]), menuNodes = React.useMemo(() => resolveMenuNodes({
5838
5885
  actionHandler: onMenuAction,
5839
5886
  fieldActions,
5840
5887
  menuItems,
@@ -5874,7 +5921,7 @@ const TooltipContent$1 = (t0) => {
5874
5921
  return /* @__PURE__ */ jsxRuntime.jsx(TooltipDelayGroupProvider.TooltipDelayGroupProvider, { children: collapsed ? /* @__PURE__ */ jsxRuntime.jsx(PaneHeader$1, { border: !0, ref, loading: connectionState === "connecting" && !editState?.draft && !editState?.published, title, tabIndex, backButton }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { hidden: collapsed, style: {
5875
5922
  lineHeight: 0
5876
5923
  }, borderBottom: !0, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 3, paddingY: 3, children: [
5877
- /* @__PURE__ */ jsxRuntime.jsx(HorizontalScroller, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { flex: 1, gap: 1, overflow: "auto", paddingX: 3, "data-testid": "document-perspective-list", children: /* @__PURE__ */ jsxRuntime.jsx(DocumentPerspectiveList, {}) }) }),
5924
+ /* @__PURE__ */ jsxRuntime.jsx(HorizontalScroller, { $showGradient: showGradient, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { flex: 1, gap: 1, overflow: "auto", paddingX: 3, "data-testid": "document-perspective-list", ref: scrollContainerRef, children: /* @__PURE__ */ jsxRuntime.jsx(DocumentPerspectiveList, {}) }) }),
5878
5925
  /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: "none", paddingRight: 3, children: renderedActions })
5879
5926
  ] }) }) });
5880
5927
  })), DocumentPanelHeaderActionDialogDeferred = React.memo(function(props) {