@xsolla/xui-context-menu 0.209.0 → 0.210.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.d.ts CHANGED
@@ -78,6 +78,8 @@ interface ContextMenuHeadingItemProps extends ContextMenuItemBaseProps {
78
78
  type: "heading";
79
79
  label: ReactNode;
80
80
  description?: ReactNode;
81
+ /** Uppercase the label (with the tracking that pairs with it). Defaults to `true`. */
82
+ isUppercase?: boolean;
81
83
  }
82
84
  interface ContextMenuDividerItemProps extends ContextMenuItemBaseProps {
83
85
  type: "divider";
@@ -108,6 +110,8 @@ interface ContextMenuProps extends ThemeOverrideProps {
108
110
  maxHeight?: number;
109
111
  /** Arrow on the panel edge pointing at the trigger. Defaults to `false`. */
110
112
  withArrow?: boolean;
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
+ noPadding?: boolean;
111
115
  onSelect?: (item: ContextMenuOptionItemProps) => void;
112
116
  "aria-label"?: string;
113
117
  testID?: string;
package/web/index.js CHANGED
@@ -207,12 +207,18 @@ var StyledBox = (0, import_styled_components.default)(FilteredDiv)`
207
207
  opacity: ${(props) => props.opacity != null ? props.opacity : props.disabled ? 0.5 : 1};
208
208
  pointer-events: ${(props) => props.disabled ? "none" : "auto"};
209
209
 
210
+ /* \`background\` is emitted before \`background-color\` so a caller passing
211
+ both still gets backgroundColor as the winner. Use the shorthand for a
212
+ layered fill (e.g. an overlay tint over a resting surface colour), which
213
+ a single background-color cannot express. */
210
214
  &:hover {
215
+ ${(props) => props.hoverStyle?.background && `background: ${props.hoverStyle.background};`}
211
216
  ${(props) => props.hoverStyle?.backgroundColor && `background-color: ${props.hoverStyle.backgroundColor};`}
212
217
  ${(props) => props.hoverStyle?.borderColor && `border-color: ${props.hoverStyle.borderColor};`}
213
218
  }
214
219
 
215
220
  &:active {
221
+ ${(props) => props.pressStyle?.background && `background: ${props.pressStyle.background};`}
216
222
  ${(props) => props.pressStyle?.backgroundColor && `background-color: ${props.pressStyle.backgroundColor};`}
217
223
  }
218
224
  `;
@@ -869,6 +875,7 @@ var HeadingCell = ({
869
875
  size: propSize,
870
876
  label,
871
877
  description,
878
+ isUppercase = true,
872
879
  testID,
873
880
  themeMode,
874
881
  themeProductContext,
@@ -911,7 +918,7 @@ var HeadingCell = ({
911
918
  {
912
919
  variant: variants.headingAccent,
913
920
  color: theme.colors.content.secondary,
914
- style: { textTransform: "uppercase", letterSpacing: 0.5 },
921
+ style: isUppercase ? { textTransform: "uppercase", letterSpacing: 0.5 } : { textTransform: "none" },
915
922
  children: label
916
923
  }
917
924
  ),
@@ -1548,6 +1555,7 @@ var ContextMenuRoot = (0, import_react8.forwardRef)(
1548
1555
  width,
1549
1556
  maxHeight = 300,
1550
1557
  withArrow = false,
1558
+ noPadding = false,
1551
1559
  onSelect,
1552
1560
  closeOnSelect,
1553
1561
  "aria-label": ariaLabel,
@@ -1579,6 +1587,8 @@ var ContextMenuRoot = (0, import_react8.forwardRef)(
1579
1587
  const isOpen = propIsOpen !== void 0 ? propIsOpen : internalIsOpen;
1580
1588
  const sizeStyles = xuiTheme.sizing.contextMenu(size);
1581
1589
  const borderRadius = xuiTheme.shape?.contextMenu?.[size]?.borderRadius ?? 8;
1590
+ const panelPaddingVertical = noPadding ? 0 : sizeStyles.paddingVertical;
1591
+ const panelPaddingHorizontal = noPadding ? 0 : sizeStyles.paddingHorizontal;
1582
1592
  const shouldCloseOnSelect = closeOnSelect ?? (type === "checkbox" ? false : true);
1583
1593
  const positionOffset = withArrow ? offset + ARROW_TIP_PROTRUSION : offset;
1584
1594
  const positioned = useContextMenuPosition({
@@ -1952,8 +1962,8 @@ var ContextMenuRoot = (0, import_react8.forwardRef)(
1952
1962
  borderColor: xuiTheme.colors.border.secondary,
1953
1963
  borderWidth: 1,
1954
1964
  borderRadius,
1955
- paddingVertical: sizeStyles.paddingVertical,
1956
- paddingHorizontal: sizeStyles.paddingHorizontal,
1965
+ paddingVertical: panelPaddingVertical,
1966
+ paddingHorizontal: panelPaddingHorizontal,
1957
1967
  width,
1958
1968
  minWidth: sizeStyles.minWidth,
1959
1969
  tabIndex: -1,