@xsolla/xui-stepper 0.206.2 → 0.208.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.mjs CHANGED
@@ -1530,11 +1530,13 @@ Stepper.displayName = "Stepper";
1530
1530
 
1531
1531
  // src/ProgressStep.tsx
1532
1532
  import { useResolvedTheme as useResolvedTheme5 } from "@xsolla/xui-core";
1533
- import { ArrowLeft, ArrowRight } from "@xsolla/xui-icons";
1533
+ import { ChevronLeft, ChevronRight } from "@xsolla/xui-icons";
1534
1534
 
1535
1535
  // src/ProgressStepItem.tsx
1536
1536
  import { useResolvedTheme as useResolvedTheme4 } from "@xsolla/xui-core";
1537
1537
  import { jsx as jsx8 } from "react/jsx-runtime";
1538
+ var DEFAULT_OPACITY = 0.2;
1539
+ var HOVER_OPACITY = 0.5;
1538
1540
  var ProgressStepItem = ({
1539
1541
  state = "default",
1540
1542
  size = "md",
@@ -1557,8 +1559,9 @@ var ProgressStepItem = ({
1557
1559
  let opacity = 1;
1558
1560
  if (!isActive) {
1559
1561
  backgroundColor = theme.colors.content.tertiary || "rgba(0, 0, 0, 0.6)";
1560
- opacity = isHover ? 0.5 : 0.2;
1562
+ opacity = isHover ? HOVER_OPACITY : DEFAULT_OPACITY;
1561
1563
  }
1564
+ const hoverStyle = onPress && !isActive && !isHover ? { opacity: HOVER_OPACITY } : void 0;
1562
1565
  return /* @__PURE__ */ jsx8(
1563
1566
  Box,
1564
1567
  {
@@ -1569,6 +1572,7 @@ var ProgressStepItem = ({
1569
1572
  borderRadius,
1570
1573
  backgroundColor,
1571
1574
  opacity,
1575
+ hoverStyle,
1572
1576
  onPress,
1573
1577
  onMouseEnter,
1574
1578
  onMouseLeave,
@@ -1601,10 +1605,11 @@ var ProgressStep = ({
1601
1605
  onStepPress(activeStep + 1);
1602
1606
  }
1603
1607
  };
1604
- const arrowSize = size === "md" ? 24 : 18;
1608
+ const controlSize = size === "md" ? 24 : 18;
1605
1609
  const iconSize = size === "md" ? 18 : 14;
1606
- const isFirst = activeStep <= 0;
1607
- const isLast = activeStep >= count - 1;
1610
+ const isPrevDisabled = activeStep <= 0 || !onStepPress;
1611
+ const isNextDisabled = activeStep >= count - 1 || !onStepPress;
1612
+ const hoverBackground = theme.colors.overlay?.mono || "rgba(127, 127, 127, 0.16)";
1608
1613
  return /* @__PURE__ */ jsxs2(
1609
1614
  Box,
1610
1615
  {
@@ -1614,20 +1619,25 @@ var ProgressStep = ({
1614
1619
  alignItems: "center",
1615
1620
  justifyContent: "center",
1616
1621
  gap: 4,
1617
- height: size === "md" ? 24 : 18,
1622
+ height: controlSize,
1618
1623
  children: [
1619
1624
  arrows && /* @__PURE__ */ jsx9(
1620
1625
  Box,
1621
1626
  {
1622
- onPress: handlePrev,
1623
- width: arrowSize,
1624
- height: arrowSize,
1627
+ onPress: isPrevDisabled ? void 0 : handlePrev,
1628
+ width: controlSize,
1629
+ height: controlSize,
1625
1630
  alignItems: "center",
1626
1631
  justifyContent: "center",
1627
1632
  borderRadius: 4,
1628
- opacity: isFirst ? 0.2 : 1,
1629
- cursor: isFirst ? "default" : "pointer",
1630
- children: /* @__PURE__ */ jsx9(ArrowLeft, { size: iconSize, color: theme.colors.content.primary })
1633
+ opacity: isPrevDisabled ? 0.6 : 1,
1634
+ cursor: isPrevDisabled ? "not-allowed" : "pointer",
1635
+ hoverStyle: isPrevDisabled ? void 0 : { backgroundColor: hoverBackground },
1636
+ role: "button",
1637
+ "aria-label": "Previous step",
1638
+ "aria-disabled": isPrevDisabled,
1639
+ testID: testID ? `${testID}-prev` : void 0,
1640
+ children: /* @__PURE__ */ jsx9(ChevronLeft, { size: iconSize, color: theme.colors.content.primary })
1631
1641
  }
1632
1642
  ),
1633
1643
  /* @__PURE__ */ jsx9(Box, { flexDirection: "row", alignItems: "center", gap: 4, children: Array.from({ length: count }).map((_, i) => /* @__PURE__ */ jsx9(
@@ -1642,15 +1652,20 @@ var ProgressStep = ({
1642
1652
  arrows && /* @__PURE__ */ jsx9(
1643
1653
  Box,
1644
1654
  {
1645
- onPress: handleNext,
1646
- width: arrowSize,
1647
- height: arrowSize,
1655
+ onPress: isNextDisabled ? void 0 : handleNext,
1656
+ width: controlSize,
1657
+ height: controlSize,
1648
1658
  alignItems: "center",
1649
1659
  justifyContent: "center",
1650
1660
  borderRadius: 4,
1651
- opacity: isLast ? 0.2 : 1,
1652
- cursor: isLast ? "default" : "pointer",
1653
- children: /* @__PURE__ */ jsx9(ArrowRight, { size: iconSize, color: theme.colors.content.primary })
1661
+ opacity: isNextDisabled ? 0.6 : 1,
1662
+ cursor: isNextDisabled ? "not-allowed" : "pointer",
1663
+ hoverStyle: isNextDisabled ? void 0 : { backgroundColor: hoverBackground },
1664
+ role: "button",
1665
+ "aria-label": "Next step",
1666
+ "aria-disabled": isNextDisabled,
1667
+ testID: testID ? `${testID}-next` : void 0,
1668
+ children: /* @__PURE__ */ jsx9(ChevronRight, { size: iconSize, color: theme.colors.content.primary })
1654
1669
  }
1655
1670
  )
1656
1671
  ]