@shoplflow/base 0.24.1 → 0.24.3

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
@@ -295,7 +295,8 @@ var PopperPortal = () => {
295
295
  {
296
296
  id: "popper-portal-key",
297
297
  style: {
298
- zIndex: 20001
298
+ zIndex: 20001,
299
+ position: "relative"
299
300
  }
300
301
  }
301
302
  ),
@@ -1460,23 +1461,23 @@ var getWidthAndHeightFromSizeVar = (sizeVar) => {
1460
1461
  `;
1461
1462
  }
1462
1463
  };
1463
- var getStyleByStyleVar2 = (styleVar, color) => {
1464
+ var getStyleByStyleVar2 = (styleVar, color, isHovered) => {
1464
1465
  switch (styleVar) {
1465
1466
  case "PRIMARY":
1466
1467
  return react$1.css`
1467
1468
  background: ${exports.colorTokens.primary300};
1468
1469
  border: 1px solid ${exports.colorTokens.primary400};
1469
- &:hover {
1470
+ ${isHovered && react$1.css`
1470
1471
  background: ${exports.colorTokens.primary400};
1471
- }
1472
+ `}
1472
1473
  `;
1473
1474
  case "SECONDARY":
1474
1475
  return react$1.css`
1475
1476
  background: ${exports.colorTokens.neutral0};
1476
1477
  border: 1px solid ${exports.colorTokens.neutral350};
1477
- &:hover {
1478
+ ${isHovered && react$1.css`
1478
1479
  background: ${exports.colorTokens.neutral100};
1479
- }
1480
+ `}
1480
1481
  `;
1481
1482
  case "SOLID":
1482
1483
  if (!color) {
@@ -1485,24 +1486,25 @@ var getStyleByStyleVar2 = (styleVar, color) => {
1485
1486
  return react$1.css`
1486
1487
  border: 1px solid ${exports.colorTokens[getNextColor(color)]};
1487
1488
  background: ${exports.colorTokens[color]};
1488
- &:hover {
1489
+
1490
+ ${isHovered && react$1.css`
1489
1491
  background: ${exports.colorTokens[getNextColor(color)]};
1490
- }
1492
+ `}
1491
1493
  `;
1492
1494
  case "GHOST":
1493
1495
  return react$1.css`
1494
1496
  border: 1px solid transparent;
1495
1497
  background: transparent;
1496
- &:hover {
1498
+ ${isHovered && react$1.css`
1497
1499
  background: ${exports.colorTokens.neutral400_5};
1498
- }
1500
+ `}
1499
1501
  `;
1500
1502
  default:
1501
1503
  return react$1.css`
1502
1504
  border: 1px solid ${exports.colorTokens.neutral200};
1503
- &:hover {
1505
+ ${isHovered && react$1.css`
1504
1506
  background: ${exports.colorTokens.neutral100};
1505
- }
1507
+ `}
1506
1508
  `;
1507
1509
  }
1508
1510
  };
@@ -1514,7 +1516,7 @@ var StyledIconButton = styled6__default.default.button`
1514
1516
  align-items: center;
1515
1517
  background: ${exports.colorTokens.neutral0};
1516
1518
  cursor: pointer;
1517
- ${({ styleVar, color }) => getStyleByStyleVar2(styleVar, color)};
1519
+ ${({ styleVar, color, isHovered }) => getStyleByStyleVar2(styleVar, color, isHovered)};
1518
1520
  ${({ sizeVar }) => getWidthAndHeightFromSizeVar(sizeVar)};
1519
1521
  ${({ disabled }) => getDisabledStyle(disabled)};
1520
1522
  & > svg {
@@ -1524,7 +1526,16 @@ var StyledIconButton = styled6__default.default.button`
1524
1526
  `;
1525
1527
  var IconButton = React3.forwardRef(
1526
1528
  (_a, ref) => {
1527
- var _b = _a, { styleVar, sizeVar, disabled, children, color } = _b, rest = __objRest(_b, ["styleVar", "sizeVar", "disabled", "children", "color"]);
1529
+ var _b = _a, { styleVar, sizeVar, disabled, children, color, onMouseEnter, onMouseLeave } = _b, rest = __objRest(_b, ["styleVar", "sizeVar", "disabled", "children", "color", "onMouseEnter", "onMouseLeave"]);
1530
+ const [isHovered, setIsHovered] = React3.useState(false);
1531
+ const handleOnMouseEnter = (e) => {
1532
+ setIsHovered(true);
1533
+ onMouseEnter && onMouseEnter(e);
1534
+ };
1535
+ const handleOnMouseLeave = (e) => {
1536
+ setIsHovered(false);
1537
+ onMouseLeave && onMouseLeave(e);
1538
+ };
1528
1539
  return /* @__PURE__ */ jsxRuntime.jsx(
1529
1540
  StyledIconButton,
1530
1541
  __spreadProps(__spreadValues({
@@ -1532,7 +1543,10 @@ var IconButton = React3.forwardRef(
1532
1543
  sizeVar,
1533
1544
  disabled,
1534
1545
  color,
1535
- ref
1546
+ ref,
1547
+ onMouseEnter: handleOnMouseEnter,
1548
+ onMouseLeave: handleOnMouseLeave,
1549
+ isHovered
1536
1550
  }, rest), {
1537
1551
  "data-shoplflow": "IconButton",
1538
1552
  children
@@ -1685,7 +1699,7 @@ exports.PopperPortal = React3.forwardRef(
1685
1699
  const { floatingStyles, setFloating, isOpen } = usePopper();
1686
1700
  const animation = initialAnimation != null ? initialAnimation : fadeInOut;
1687
1701
  const refs = useMergeRefs(ref, setFloating);
1688
- return /* @__PURE__ */ jsxRuntime.jsx(react.FloatingPortal, { id: "popper-portal-key", children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: isOpen && /* @__PURE__ */ jsxRuntime.jsx(
1702
+ return /* @__PURE__ */ jsxRuntime.jsx(react.FloatingPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: isOpen && /* @__PURE__ */ jsxRuntime.jsx(
1689
1703
  framerMotion.motion.div,
1690
1704
  {
1691
1705
  initial: animation.initial,
@@ -1783,6 +1797,7 @@ exports.StyledDropdownButton = styled6__default.default.button`
1783
1797
  height: 100%;
1784
1798
  gap: 8px;
1785
1799
  cursor: pointer;
1800
+ background-color: ${exports.colorTokens.neutral0};
1786
1801
  ${({ sizeVar }) => sizeVar && exports.getDropdownStyleBySizeVar(sizeVar)};
1787
1802
  ${({ disabled }) => disabled && react$1.css`
1788
1803
  cursor: not-allowed;
@@ -2784,11 +2799,13 @@ var SelectInputButton = (_a) => {
2784
2799
  const [isHovered, setIsHovered] = React3.useState(false);
2785
2800
  const handleOnClick = (e) => {
2786
2801
  e.preventDefault();
2802
+ e.stopPropagation();
2787
2803
  if (!disabled) {
2788
2804
  onClick && onClick(e);
2789
2805
  }
2790
2806
  };
2791
2807
  const handleOnClear = (e) => {
2808
+ e.preventDefault();
2792
2809
  e.stopPropagation();
2793
2810
  if (!disabled) {
2794
2811
  onClear && onClear(e);
@@ -2816,13 +2833,15 @@ var SelectInputButton = (_a) => {
2816
2833
  "data-shoplflow": "SelectInputButton",
2817
2834
  children: /* @__PURE__ */ jsxRuntime.jsxs(StyledSelectInputButton, { children: [
2818
2835
  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: [
2836
+ /* @__PURE__ */ jsxRuntime.jsxs(exports.Stack.Horizontal, { align: "center", spacing: "spacing04", children: [
2820
2837
  value && value.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs(exports.Text, { typography: "body1_400", color: "neutral700", children: [
2821
2838
  "+",
2822
2839
  value.length - 1
2823
2840
  ] }),
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
2841
+ /* @__PURE__ */ jsxRuntime.jsxs(exports.Stack.Horizontal, { align: "center", children: [
2842
+ 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" }) }),
2843
+ rightSource
2844
+ ] })
2826
2845
  ] })
2827
2846
  ] })
2828
2847
  })