@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/native/index.mjs CHANGED
@@ -1807,20 +1807,33 @@ var ContextMenuRoot = forwardRef(
1807
1807
  );
1808
1808
  };
1809
1809
  const renderedItems = searchable ? filterItems(items, debouncedQuery) : [...items];
1810
- const renderStickySearch = (node, key) => /* @__PURE__ */ jsx4(
1811
- "div",
1812
- {
1813
- "data-sticky": "top",
1814
- style: {
1815
- position: "sticky",
1816
- top: 0,
1817
- zIndex: 1,
1818
- backgroundColor: surfaceColor
1810
+ const stickyBleedHorizontal = withArrow ? 0 : panelPaddingHorizontal;
1811
+ const stickyBleedTop = withArrow ? 0 : panelPaddingVertical;
1812
+ const renderStickySearch = (node, key, isFirst = true) => {
1813
+ const bleedTop = isFirst ? stickyBleedTop : 0;
1814
+ return /* @__PURE__ */ jsx4(
1815
+ "div",
1816
+ {
1817
+ "data-sticky": "top",
1818
+ style: {
1819
+ position: "sticky",
1820
+ // Sticks to the scrollport edge, not the content edge; the
1821
+ // padding below keeps the panel's breathing room above the cell.
1822
+ top: 0,
1823
+ zIndex: 1,
1824
+ backgroundColor: surfaceColor,
1825
+ marginTop: -bleedTop,
1826
+ marginLeft: -stickyBleedHorizontal,
1827
+ marginRight: -stickyBleedHorizontal,
1828
+ paddingTop: bleedTop,
1829
+ paddingLeft: stickyBleedHorizontal,
1830
+ paddingRight: stickyBleedHorizontal
1831
+ },
1832
+ children: node
1819
1833
  },
1820
- children: node
1821
- },
1822
- key
1823
- );
1834
+ key
1835
+ );
1836
+ };
1824
1837
  const searchHeader = searchable ? renderStickySearch(
1825
1838
  /* @__PURE__ */ jsx4(
1826
1839
  ContextMenuItem,
@@ -1840,10 +1853,13 @@ var ContextMenuRoot = forwardRef(
1840
1853
  if (!React3.Children.toArray(children).some(isSearchCellElement)) {
1841
1854
  return children;
1842
1855
  }
1843
- return React3.Children.map(
1844
- children,
1845
- (child, index) => isSearchCellElement(child) ? renderStickySearch(child, `context-menu-search-${index}`) : child
1846
- );
1856
+ let renderedBefore = false;
1857
+ return React3.Children.map(children, (child, index) => {
1858
+ const isFirst = !renderedBefore;
1859
+ if (child !== null && child !== void 0 && typeof child !== "boolean")
1860
+ renderedBefore = true;
1861
+ return isSearchCellElement(child) ? renderStickySearch(child, `context-menu-search-${index}`, isFirst) : child;
1862
+ });
1847
1863
  };
1848
1864
  const renderContent = () => {
1849
1865
  if (loading || isLoading || type === "loading") {