@xsolla/xui-context-menu 0.211.1 → 0.212.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/README.md +30 -0
- package/native/index.d.mts +11 -0
- package/native/index.d.ts +11 -0
- package/native/index.js +5 -3
- package/native/index.js.map +1 -1
- package/native/index.mjs +5 -3
- package/native/index.mjs.map +1 -1
- package/package.json +10 -10
- package/web/index.d.mts +11 -0
- package/web/index.d.ts +11 -0
- package/web/index.js +5 -3
- package/web/index.js.map +1 -1
- package/web/index.mjs +5 -3
- package/web/index.mjs.map +1 -1
package/web/index.d.mts
CHANGED
|
@@ -112,6 +112,17 @@ interface ContextMenuProps extends ThemeOverrideProps {
|
|
|
112
112
|
withArrow?: boolean;
|
|
113
113
|
/** Drops the panel's own padding to `0` so cells and custom children sit flush to its edges. Cell padding is unaffected. Defaults to `false`. */
|
|
114
114
|
noPadding?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Panel surface colour. Any CSS colour value.
|
|
117
|
+
*
|
|
118
|
+
* Applies to the panel background, the sticky search header and the
|
|
119
|
+
* `withArrow` arrow together, so the arrow can never be left on the theme
|
|
120
|
+
* token while the panel is tinted. Prefer this over `style.backgroundColor`,
|
|
121
|
+
* which reaches the panel only.
|
|
122
|
+
*
|
|
123
|
+
* Defaults to the `layer.float` theme token.
|
|
124
|
+
*/
|
|
125
|
+
background?: string;
|
|
115
126
|
onSelect?: (item: ContextMenuOptionItemProps) => void;
|
|
116
127
|
"aria-label"?: string;
|
|
117
128
|
testID?: string;
|
package/web/index.d.ts
CHANGED
|
@@ -112,6 +112,17 @@ interface ContextMenuProps extends ThemeOverrideProps {
|
|
|
112
112
|
withArrow?: boolean;
|
|
113
113
|
/** Drops the panel's own padding to `0` so cells and custom children sit flush to its edges. Cell padding is unaffected. Defaults to `false`. */
|
|
114
114
|
noPadding?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Panel surface colour. Any CSS colour value.
|
|
117
|
+
*
|
|
118
|
+
* Applies to the panel background, the sticky search header and the
|
|
119
|
+
* `withArrow` arrow together, so the arrow can never be left on the theme
|
|
120
|
+
* token while the panel is tinted. Prefer this over `style.backgroundColor`,
|
|
121
|
+
* which reaches the panel only.
|
|
122
|
+
*
|
|
123
|
+
* Defaults to the `layer.float` theme token.
|
|
124
|
+
*/
|
|
125
|
+
background?: string;
|
|
115
126
|
onSelect?: (item: ContextMenuOptionItemProps) => void;
|
|
116
127
|
"aria-label"?: string;
|
|
117
128
|
testID?: string;
|
package/web/index.js
CHANGED
|
@@ -1556,6 +1556,7 @@ var ContextMenuRoot = (0, import_react8.forwardRef)(
|
|
|
1556
1556
|
maxHeight = 300,
|
|
1557
1557
|
withArrow = false,
|
|
1558
1558
|
noPadding = false,
|
|
1559
|
+
background,
|
|
1559
1560
|
onSelect,
|
|
1560
1561
|
closeOnSelect,
|
|
1561
1562
|
"aria-label": ariaLabel,
|
|
@@ -1590,6 +1591,7 @@ var ContextMenuRoot = (0, import_react8.forwardRef)(
|
|
|
1590
1591
|
const panelPaddingVertical = noPadding ? 0 : sizeStyles.paddingVertical;
|
|
1591
1592
|
const panelPaddingHorizontal = noPadding ? 0 : sizeStyles.paddingHorizontal;
|
|
1592
1593
|
const shouldCloseOnSelect = closeOnSelect ?? (type === "checkbox" ? false : true);
|
|
1594
|
+
const surfaceColor = background ?? xuiTheme.colors.layer.float;
|
|
1593
1595
|
const positionOffset = withArrow ? offset + ARROW_TIP_PROTRUSION : offset;
|
|
1594
1596
|
const positioned = useContextMenuPosition({
|
|
1595
1597
|
triggerRef,
|
|
@@ -1605,7 +1607,7 @@ var ContextMenuRoot = (0, import_react8.forwardRef)(
|
|
|
1605
1607
|
position: "absolute",
|
|
1606
1608
|
width: ARROW_SIZE,
|
|
1607
1609
|
height: ARROW_SIZE,
|
|
1608
|
-
backgroundColor:
|
|
1610
|
+
backgroundColor: surfaceColor,
|
|
1609
1611
|
borderStyle: "solid",
|
|
1610
1612
|
borderColor: xuiTheme.colors.border.secondary,
|
|
1611
1613
|
// 1px outline only on the two outward-facing edges of the rotated square
|
|
@@ -1816,7 +1818,7 @@ var ContextMenuRoot = (0, import_react8.forwardRef)(
|
|
|
1816
1818
|
position: "sticky",
|
|
1817
1819
|
top: 0,
|
|
1818
1820
|
zIndex: 1,
|
|
1819
|
-
backgroundColor:
|
|
1821
|
+
backgroundColor: surfaceColor
|
|
1820
1822
|
},
|
|
1821
1823
|
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1822
1824
|
ContextMenuItem,
|
|
@@ -1958,7 +1960,7 @@ var ContextMenuRoot = (0, import_react8.forwardRef)(
|
|
|
1958
1960
|
"data-testid": dataTestId ?? testID ?? "context-menu",
|
|
1959
1961
|
"data-xui-context-menu-portal": trigger || position ? menuId : void 0,
|
|
1960
1962
|
"data-placement": resolvedPlacement,
|
|
1961
|
-
backgroundColor:
|
|
1963
|
+
backgroundColor: surfaceColor,
|
|
1962
1964
|
borderColor: xuiTheme.colors.border.secondary,
|
|
1963
1965
|
borderWidth: 1,
|
|
1964
1966
|
borderRadius,
|