@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xsolla/xui-context-menu",
3
- "version": "0.237.0",
3
+ "version": "0.239.0",
4
4
  "main": "./web/index.js",
5
5
  "module": "./web/index.mjs",
6
6
  "types": "./web/index.d.ts",
@@ -13,15 +13,15 @@
13
13
  "test:coverage": "vitest run --coverage"
14
14
  },
15
15
  "dependencies": {
16
- "@xsolla/xui-checkbox": "0.237.0",
17
- "@xsolla/xui-core": "0.237.0",
18
- "@xsolla/xui-divider": "0.237.0",
19
- "@xsolla/xui-icons": "0.237.0",
20
- "@xsolla/xui-icons-base": "0.237.0",
21
- "@xsolla/xui-primitives-core": "0.237.0",
22
- "@xsolla/xui-radio": "0.237.0",
23
- "@xsolla/xui-spinner": "0.237.0",
24
- "@xsolla/xui-typography": "0.237.0"
16
+ "@xsolla/xui-checkbox": "0.239.0",
17
+ "@xsolla/xui-core": "0.239.0",
18
+ "@xsolla/xui-divider": "0.239.0",
19
+ "@xsolla/xui-icons": "0.239.0",
20
+ "@xsolla/xui-icons-base": "0.239.0",
21
+ "@xsolla/xui-primitives-core": "0.239.0",
22
+ "@xsolla/xui-radio": "0.239.0",
23
+ "@xsolla/xui-spinner": "0.239.0",
24
+ "@xsolla/xui-typography": "0.239.0"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "react": ">=16.8.0",
package/web/index.js CHANGED
@@ -1845,20 +1845,33 @@ var ContextMenuRoot = (0, import_react8.forwardRef)(
1845
1845
  );
1846
1846
  };
1847
1847
  const renderedItems = searchable ? filterItems(items, debouncedQuery) : [...items];
1848
- const renderStickySearch = (node, key) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1849
- "div",
1850
- {
1851
- "data-sticky": "top",
1852
- style: {
1853
- position: "sticky",
1854
- top: 0,
1855
- zIndex: 1,
1856
- backgroundColor: surfaceColor
1848
+ const stickyBleedHorizontal = withArrow ? 0 : panelPaddingHorizontal;
1849
+ const stickyBleedTop = withArrow ? 0 : panelPaddingVertical;
1850
+ const renderStickySearch = (node, key, isFirst = true) => {
1851
+ const bleedTop = isFirst ? stickyBleedTop : 0;
1852
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1853
+ "div",
1854
+ {
1855
+ "data-sticky": "top",
1856
+ style: {
1857
+ position: "sticky",
1858
+ // Sticks to the scrollport edge, not the content edge; the
1859
+ // padding below keeps the panel's breathing room above the cell.
1860
+ top: 0,
1861
+ zIndex: 1,
1862
+ backgroundColor: surfaceColor,
1863
+ marginTop: -bleedTop,
1864
+ marginLeft: -stickyBleedHorizontal,
1865
+ marginRight: -stickyBleedHorizontal,
1866
+ paddingTop: bleedTop,
1867
+ paddingLeft: stickyBleedHorizontal,
1868
+ paddingRight: stickyBleedHorizontal
1869
+ },
1870
+ children: node
1857
1871
  },
1858
- children: node
1859
- },
1860
- key
1861
- );
1872
+ key
1873
+ );
1874
+ };
1862
1875
  const searchHeader = searchable ? renderStickySearch(
1863
1876
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1864
1877
  ContextMenuItem,
@@ -1878,10 +1891,13 @@ var ContextMenuRoot = (0, import_react8.forwardRef)(
1878
1891
  if (!import_react8.default.Children.toArray(children).some(isSearchCellElement)) {
1879
1892
  return children;
1880
1893
  }
1881
- return import_react8.default.Children.map(
1882
- children,
1883
- (child, index2) => isSearchCellElement(child) ? renderStickySearch(child, `context-menu-search-${index2}`) : child
1884
- );
1894
+ let renderedBefore = false;
1895
+ return import_react8.default.Children.map(children, (child, index2) => {
1896
+ const isFirst = !renderedBefore;
1897
+ if (child !== null && child !== void 0 && typeof child !== "boolean")
1898
+ renderedBefore = true;
1899
+ return isSearchCellElement(child) ? renderStickySearch(child, `context-menu-search-${index2}`, isFirst) : child;
1900
+ });
1885
1901
  };
1886
1902
  const renderContent = () => {
1887
1903
  if (loading || isLoading || type === "loading") {