@xsolla/xui-button 0.206.2 → 0.207.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
@@ -318,6 +318,23 @@ interface ButtonGroupProps extends ThemeOverrideProps {
318
318
  * @default 'horizontal'
319
319
  */
320
320
  orientation?: "horizontal" | "vertical";
321
+ /**
322
+ * Force or suppress the split ("space-between") layout, in which the first
323
+ * button is pinned to the left edge and the remaining buttons are grouped
324
+ * on the right.
325
+ *
326
+ * When omitted, the layout is chosen by child count: horizontal groups with
327
+ * 3 or more buttons split, smaller groups do not. Set `split` to override
328
+ * that heuristic in either direction:
329
+ *
330
+ * - `split` — split a 2-button group (buttons keep their natural width
331
+ * instead of stretching to fill the row)
332
+ * - `split={false}` — opt a 3+ button group out of the split layout
333
+ *
334
+ * Has no effect when `orientation="vertical"` or when the group has fewer
335
+ * than 2 children.
336
+ */
337
+ split?: boolean;
321
338
  /**
322
339
  * Size of the button group, determines default gap between buttons
323
340
  * @default 'md'
package/web/index.js CHANGED
@@ -1522,6 +1522,7 @@ var import_xui_core5 = require("@xsolla/xui-core");
1522
1522
  var import_jsx_runtime9 = require("react/jsx-runtime");
1523
1523
  var ButtonGroup = ({
1524
1524
  orientation = "horizontal",
1525
+ split,
1525
1526
  size = "md",
1526
1527
  children,
1527
1528
  description,
@@ -1549,7 +1550,7 @@ var ButtonGroup = ({
1549
1550
  };
1550
1551
  const flatChildren = flattenChildren(children);
1551
1552
  const childCount = flatChildren.length;
1552
- const useSpaceBetween = orientation === "horizontal" && childCount > 2;
1553
+ const useSpaceBetween = orientation === "horizontal" && childCount > 1 && (split ?? childCount > 2);
1553
1554
  const verticalGapMap = {
1554
1555
  xl: 16,
1555
1556
  lg: 16,
@@ -1572,7 +1573,7 @@ var ButtonGroup = ({
1572
1573
  error && errorId ? errorId : void 0,
1573
1574
  description && descriptionId ? descriptionId : void 0
1574
1575
  ].filter(Boolean).join(" ") || void 0;
1575
- const stretchChildren = orientation === "vertical" || orientation === "horizontal" && childCount <= 2;
1576
+ const stretchChildren = orientation === "vertical" || orientation === "horizontal" && childCount <= 2 && !useSpaceBetween;
1576
1577
  const processChildren = (childrenToProcess) => {
1577
1578
  if (stretchChildren) {
1578
1579
  return childrenToProcess.map((child, index2) => {