@shoplflow/base 0.24.1 → 0.24.2

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/dist/index.cjs CHANGED
@@ -1460,23 +1460,23 @@ var getWidthAndHeightFromSizeVar = (sizeVar) => {
1460
1460
  `;
1461
1461
  }
1462
1462
  };
1463
- var getStyleByStyleVar2 = (styleVar, color) => {
1463
+ var getStyleByStyleVar2 = (styleVar, color, isHovered) => {
1464
1464
  switch (styleVar) {
1465
1465
  case "PRIMARY":
1466
1466
  return react$1.css`
1467
1467
  background: ${exports.colorTokens.primary300};
1468
1468
  border: 1px solid ${exports.colorTokens.primary400};
1469
- &:hover {
1469
+ ${isHovered && react$1.css`
1470
1470
  background: ${exports.colorTokens.primary400};
1471
- }
1471
+ `}
1472
1472
  `;
1473
1473
  case "SECONDARY":
1474
1474
  return react$1.css`
1475
1475
  background: ${exports.colorTokens.neutral0};
1476
1476
  border: 1px solid ${exports.colorTokens.neutral350};
1477
- &:hover {
1477
+ ${isHovered && react$1.css`
1478
1478
  background: ${exports.colorTokens.neutral100};
1479
- }
1479
+ `}
1480
1480
  `;
1481
1481
  case "SOLID":
1482
1482
  if (!color) {
@@ -1485,24 +1485,25 @@ var getStyleByStyleVar2 = (styleVar, color) => {
1485
1485
  return react$1.css`
1486
1486
  border: 1px solid ${exports.colorTokens[getNextColor(color)]};
1487
1487
  background: ${exports.colorTokens[color]};
1488
- &:hover {
1488
+
1489
+ ${isHovered && react$1.css`
1489
1490
  background: ${exports.colorTokens[getNextColor(color)]};
1490
- }
1491
+ `}
1491
1492
  `;
1492
1493
  case "GHOST":
1493
1494
  return react$1.css`
1494
1495
  border: 1px solid transparent;
1495
1496
  background: transparent;
1496
- &:hover {
1497
+ ${isHovered && react$1.css`
1497
1498
  background: ${exports.colorTokens.neutral400_5};
1498
- }
1499
+ `}
1499
1500
  `;
1500
1501
  default:
1501
1502
  return react$1.css`
1502
1503
  border: 1px solid ${exports.colorTokens.neutral200};
1503
- &:hover {
1504
+ ${isHovered && react$1.css`
1504
1505
  background: ${exports.colorTokens.neutral100};
1505
- }
1506
+ `}
1506
1507
  `;
1507
1508
  }
1508
1509
  };
@@ -1514,7 +1515,7 @@ var StyledIconButton = styled6__default.default.button`
1514
1515
  align-items: center;
1515
1516
  background: ${exports.colorTokens.neutral0};
1516
1517
  cursor: pointer;
1517
- ${({ styleVar, color }) => getStyleByStyleVar2(styleVar, color)};
1518
+ ${({ styleVar, color, isHovered }) => getStyleByStyleVar2(styleVar, color, isHovered)};
1518
1519
  ${({ sizeVar }) => getWidthAndHeightFromSizeVar(sizeVar)};
1519
1520
  ${({ disabled }) => getDisabledStyle(disabled)};
1520
1521
  & > svg {
@@ -1524,7 +1525,16 @@ var StyledIconButton = styled6__default.default.button`
1524
1525
  `;
1525
1526
  var IconButton = React3.forwardRef(
1526
1527
  (_a, ref) => {
1527
- var _b = _a, { styleVar, sizeVar, disabled, children, color } = _b, rest = __objRest(_b, ["styleVar", "sizeVar", "disabled", "children", "color"]);
1528
+ var _b = _a, { styleVar, sizeVar, disabled, children, color, onMouseEnter, onMouseLeave } = _b, rest = __objRest(_b, ["styleVar", "sizeVar", "disabled", "children", "color", "onMouseEnter", "onMouseLeave"]);
1529
+ const [isHovered, setIsHovered] = React3.useState(false);
1530
+ const handleOnMouseEnter = (e) => {
1531
+ setIsHovered(true);
1532
+ onMouseEnter && onMouseEnter(e);
1533
+ };
1534
+ const handleOnMouseLeave = (e) => {
1535
+ setIsHovered(false);
1536
+ onMouseLeave && onMouseLeave(e);
1537
+ };
1528
1538
  return /* @__PURE__ */ jsxRuntime.jsx(
1529
1539
  StyledIconButton,
1530
1540
  __spreadProps(__spreadValues({
@@ -1532,7 +1542,10 @@ var IconButton = React3.forwardRef(
1532
1542
  sizeVar,
1533
1543
  disabled,
1534
1544
  color,
1535
- ref
1545
+ ref,
1546
+ onMouseEnter: handleOnMouseEnter,
1547
+ onMouseLeave: handleOnMouseLeave,
1548
+ isHovered
1536
1549
  }, rest), {
1537
1550
  "data-shoplflow": "IconButton",
1538
1551
  children
@@ -2784,11 +2797,13 @@ var SelectInputButton = (_a) => {
2784
2797
  const [isHovered, setIsHovered] = React3.useState(false);
2785
2798
  const handleOnClick = (e) => {
2786
2799
  e.preventDefault();
2800
+ e.stopPropagation();
2787
2801
  if (!disabled) {
2788
2802
  onClick && onClick(e);
2789
2803
  }
2790
2804
  };
2791
2805
  const handleOnClear = (e) => {
2806
+ e.preventDefault();
2792
2807
  e.stopPropagation();
2793
2808
  if (!disabled) {
2794
2809
  onClear && onClear(e);
@@ -2816,13 +2831,15 @@ var SelectInputButton = (_a) => {
2816
2831
  "data-shoplflow": "SelectInputButton",
2817
2832
  children: /* @__PURE__ */ jsxRuntime.jsxs(StyledSelectInputButton, { children: [
2818
2833
  value && value.length > 0 && label ? /* @__PURE__ */ jsxRuntime.jsx(exports.Text, { typography: "body1_400", children: value[0][label] }) : /* @__PURE__ */ jsxRuntime.jsx(exports.Text, { typography: "body1_400", color: "neutral350", children: placeholder }),
2819
- /* @__PURE__ */ jsxRuntime.jsxs(exports.Stack.Horizontal, { align: "center", children: [
2834
+ /* @__PURE__ */ jsxRuntime.jsxs(exports.Stack.Horizontal, { align: "center", spacing: "spacing04", children: [
2820
2835
  value && value.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs(exports.Text, { typography: "body1_400", color: "neutral700", children: [
2821
2836
  "+",
2822
2837
  value.length - 1
2823
2838
  ] }),
2824
- value && value.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(exports.IconButton, { sizeVar: "S", onClick: handleOnClear, styleVar: "GHOST", disabled, children: /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { iconSource: assetFunction("DeleteIcon"), color: "neutral350" }) }),
2825
- rightSource
2839
+ /* @__PURE__ */ jsxRuntime.jsxs(exports.Stack.Horizontal, { align: "center", children: [
2840
+ value && value.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(exports.IconButton, { sizeVar: "S", onClick: handleOnClear, styleVar: "GHOST", disabled, children: /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { iconSource: assetFunction("DeleteIcon"), color: "neutral350" }) }),
2841
+ rightSource
2842
+ ] })
2826
2843
  ] })
2827
2844
  ] })
2828
2845
  })