@shoplflow/base 0.24.0 → 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
@@ -1873,12 +1886,8 @@ exports.StyledIcon = styled6__default.default.svg`
1873
1886
  }
1874
1887
  `;
1875
1888
  var Icon = React3.forwardRef((_a, ref) => {
1876
- var _b = _a, { iconSource, dangerouslySetInnerHTML } = _b, rest = __objRest(_b, ["iconSource", "dangerouslySetInnerHTML"]);
1877
- const htmlContent = dangerouslySetInnerHTML ? { __html: dangerouslySetInnerHTML } : void 0;
1878
- if (htmlContent && iconSource) {
1879
- throw new Error("Icon: iconSource\uC640 dangerouslySetInnerHTML\uC740 \uB3D9\uC2DC\uC5D0 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");
1880
- }
1881
- return /* @__PURE__ */ jsxRuntime.jsx(exports.StyledIcon, __spreadProps(__spreadValues({ as: iconSource, ref }, rest), { "data-shoplflow": "Icon", dangerouslySetInnerHTML: htmlContent }));
1889
+ var _b = _a, { iconSource } = _b, rest = __objRest(_b, ["iconSource"]);
1890
+ return /* @__PURE__ */ jsxRuntime.jsx(exports.StyledIcon, __spreadProps(__spreadValues({ as: iconSource, ref }, rest), { "data-shoplflow": "Icon" }));
1882
1891
  });
1883
1892
  exports.Icon = Icon;
1884
1893
  var DropdownButton = React3.forwardRef(
@@ -2788,11 +2797,13 @@ var SelectInputButton = (_a) => {
2788
2797
  const [isHovered, setIsHovered] = React3.useState(false);
2789
2798
  const handleOnClick = (e) => {
2790
2799
  e.preventDefault();
2800
+ e.stopPropagation();
2791
2801
  if (!disabled) {
2792
2802
  onClick && onClick(e);
2793
2803
  }
2794
2804
  };
2795
2805
  const handleOnClear = (e) => {
2806
+ e.preventDefault();
2796
2807
  e.stopPropagation();
2797
2808
  if (!disabled) {
2798
2809
  onClear && onClear(e);
@@ -2820,13 +2831,15 @@ var SelectInputButton = (_a) => {
2820
2831
  "data-shoplflow": "SelectInputButton",
2821
2832
  children: /* @__PURE__ */ jsxRuntime.jsxs(StyledSelectInputButton, { children: [
2822
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 }),
2823
- /* @__PURE__ */ jsxRuntime.jsxs(exports.Stack.Horizontal, { align: "center", children: [
2834
+ /* @__PURE__ */ jsxRuntime.jsxs(exports.Stack.Horizontal, { align: "center", spacing: "spacing04", children: [
2824
2835
  value && value.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs(exports.Text, { typography: "body1_400", color: "neutral700", children: [
2825
2836
  "+",
2826
2837
  value.length - 1
2827
2838
  ] }),
2828
- 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" }) }),
2829
- 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
+ ] })
2830
2843
  ] })
2831
2844
  ] })
2832
2845
  })