@xsolla/xui-context-menu 0.237.0 → 0.239.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/web/index.mjs CHANGED
@@ -1833,20 +1833,33 @@ var ContextMenuRoot = forwardRef(
1833
1833
  );
1834
1834
  };
1835
1835
  const renderedItems = searchable ? filterItems(items, debouncedQuery) : [...items];
1836
- const renderStickySearch = (node, key) => /* @__PURE__ */ jsx4(
1837
- "div",
1838
- {
1839
- "data-sticky": "top",
1840
- style: {
1841
- position: "sticky",
1842
- top: 0,
1843
- zIndex: 1,
1844
- backgroundColor: surfaceColor
1836
+ const stickyBleedHorizontal = withArrow ? 0 : panelPaddingHorizontal;
1837
+ const stickyBleedTop = withArrow ? 0 : panelPaddingVertical;
1838
+ const renderStickySearch = (node, key, isFirst = true) => {
1839
+ const bleedTop = isFirst ? stickyBleedTop : 0;
1840
+ return /* @__PURE__ */ jsx4(
1841
+ "div",
1842
+ {
1843
+ "data-sticky": "top",
1844
+ style: {
1845
+ position: "sticky",
1846
+ // Sticks to the scrollport edge, not the content edge; the
1847
+ // padding below keeps the panel's breathing room above the cell.
1848
+ top: 0,
1849
+ zIndex: 1,
1850
+ backgroundColor: surfaceColor,
1851
+ marginTop: -bleedTop,
1852
+ marginLeft: -stickyBleedHorizontal,
1853
+ marginRight: -stickyBleedHorizontal,
1854
+ paddingTop: bleedTop,
1855
+ paddingLeft: stickyBleedHorizontal,
1856
+ paddingRight: stickyBleedHorizontal
1857
+ },
1858
+ children: node
1845
1859
  },
1846
- children: node
1847
- },
1848
- key
1849
- );
1860
+ key
1861
+ );
1862
+ };
1850
1863
  const searchHeader = searchable ? renderStickySearch(
1851
1864
  /* @__PURE__ */ jsx4(
1852
1865
  ContextMenuItem,
@@ -1866,10 +1879,13 @@ var ContextMenuRoot = forwardRef(
1866
1879
  if (!React5.Children.toArray(children).some(isSearchCellElement)) {
1867
1880
  return children;
1868
1881
  }
1869
- return React5.Children.map(
1870
- children,
1871
- (child, index2) => isSearchCellElement(child) ? renderStickySearch(child, `context-menu-search-${index2}`) : child
1872
- );
1882
+ let renderedBefore = false;
1883
+ return React5.Children.map(children, (child, index2) => {
1884
+ const isFirst = !renderedBefore;
1885
+ if (child !== null && child !== void 0 && typeof child !== "boolean")
1886
+ renderedBefore = true;
1887
+ return isSearchCellElement(child) ? renderStickySearch(child, `context-menu-search-${index2}`, isFirst) : child;
1888
+ });
1873
1889
  };
1874
1890
  const renderContent = () => {
1875
1891
  if (loading || isLoading || type === "loading") {