@xsolla/xui-context-menu 0.209.1 → 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/README.md CHANGED
@@ -167,8 +167,9 @@ Every cell lays its slots out on a single centred row, which reads correctly whi
167
167
 
168
168
  | Prop | Type | Purpose |
169
169
  | --- | --- | --- |
170
- | `label` | `ReactNode` | Section title (uppercase styling). |
170
+ | `label` | `ReactNode` | Section title (uppercase styling by default). |
171
171
  | `description` | `ReactNode` | Optional helper line beneath. |
172
+ | `isUppercase` | `boolean` | Uppercase the label, with the tracking that pairs with it. Defaults to `true`; pass `false` for sentence-case labels. |
172
173
 
173
174
  ### `type="divider"`
174
175
 
@@ -193,11 +194,25 @@ A horizontal rule with `role="separator"`. No content props.
193
194
  | `closeOnSelect` | `boolean` | Override the per-preset default. |
194
195
  | `width` | `number` | Forces panel width (px). |
195
196
  | `maxHeight` | `number` | Caps panel height (px); body scrolls and search stays sticky. |
197
+ | `noPadding` | `boolean` | Drops the panel's own padding (`8px` by default) to `0` so cells and custom children sit flush to its edges. Cell padding is unaffected. Defaults to `false`. |
196
198
  | `onSelect` | `(item: ContextMenuOptionItemProps) => void` | Fires for the preset path on option activation. |
197
199
  | `aria-label` | `string` | Accessible name for the menu container. |
198
200
  | `testID` | `string` | Testing handle; forwarded as `data-testid` when `data-testid` is not provided. |
199
201
  | `data-testid` | `string` | Testing handle. |
200
202
 
203
+ ### Panel padding
204
+
205
+ The panel pads its own content by `8px` on every side at every `size`, so cells never touch the rounded border. Set `noPadding` when a child should be full-bleed — a banner, a sticky footer row, or a custom list that draws its own insets:
206
+
207
+ ```tsx
208
+ <ContextMenu noPadding trigger={<Button>Open</Button>} aria-label="Actions">
209
+ <FullBleedBanner />
210
+ <ContextMenuItem type="option" label="Edit" />
211
+ </ContextMenu>
212
+ ```
213
+
214
+ `noPadding` only zeroes the **panel** padding. Each `ContextMenuItem` keeps its own `itemPaddingHorizontal` / `itemPaddingVertical`, so rows stay readable.
215
+
201
216
  ## Behaviour & accessibility
202
217
 
203
218
  - The panel root is `role="menu"` (or hosts `role="menuitemcheckbox"` / `role="menuitemradio"` cells when `checked` is provided). Headings render as `role="presentation"`, dividers as `role="separator"`, and the search cell as `role="searchbox"`.
@@ -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/native/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/native/index.js CHANGED
@@ -846,6 +846,7 @@ var HeadingCell = ({
846
846
  size: propSize,
847
847
  label,
848
848
  description,
849
+ isUppercase = true,
849
850
  testID,
850
851
  themeMode,
851
852
  themeProductContext,
@@ -888,7 +889,7 @@ var HeadingCell = ({
888
889
  {
889
890
  variant: variants.headingAccent,
890
891
  color: theme.colors.content.secondary,
891
- style: { textTransform: "uppercase", letterSpacing: 0.5 },
892
+ style: isUppercase ? { textTransform: "uppercase", letterSpacing: 0.5 } : { textTransform: "none" },
892
893
  children: label
893
894
  }
894
895
  ),
@@ -1525,6 +1526,7 @@ var ContextMenuRoot = (0, import_react6.forwardRef)(
1525
1526
  width,
1526
1527
  maxHeight = 300,
1527
1528
  withArrow = false,
1529
+ noPadding = false,
1528
1530
  onSelect,
1529
1531
  closeOnSelect,
1530
1532
  "aria-label": ariaLabel,
@@ -1556,6 +1558,8 @@ var ContextMenuRoot = (0, import_react6.forwardRef)(
1556
1558
  const isOpen = propIsOpen !== void 0 ? propIsOpen : internalIsOpen;
1557
1559
  const sizeStyles = xuiTheme.sizing.contextMenu(size);
1558
1560
  const borderRadius = xuiTheme.shape?.contextMenu?.[size]?.borderRadius ?? 8;
1561
+ const panelPaddingVertical = noPadding ? 0 : sizeStyles.paddingVertical;
1562
+ const panelPaddingHorizontal = noPadding ? 0 : sizeStyles.paddingHorizontal;
1559
1563
  const shouldCloseOnSelect = closeOnSelect ?? (type === "checkbox" ? false : true);
1560
1564
  const positionOffset = withArrow ? offset + ARROW_TIP_PROTRUSION : offset;
1561
1565
  const positioned = useContextMenuPosition({
@@ -1929,8 +1933,8 @@ var ContextMenuRoot = (0, import_react6.forwardRef)(
1929
1933
  borderColor: xuiTheme.colors.border.secondary,
1930
1934
  borderWidth: 1,
1931
1935
  borderRadius,
1932
- paddingVertical: sizeStyles.paddingVertical,
1933
- paddingHorizontal: sizeStyles.paddingHorizontal,
1936
+ paddingVertical: panelPaddingVertical,
1937
+ paddingHorizontal: panelPaddingHorizontal,
1934
1938
  width,
1935
1939
  minWidth: sizeStyles.minWidth,
1936
1940
  tabIndex: -1,