@shoplflow/base 0.24.26 → 0.24.27

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.js CHANGED
@@ -1837,27 +1837,16 @@ var getBorderColorByStatus = ({ isFocused, isError, isHovered, disabled }) => {
1837
1837
  var InputWrapper = styled5.label`
1838
1838
  display: flex;
1839
1839
  align-items: center;
1840
- width: ${({ width }) => {
1841
- var _a;
1842
- return (_a = `calc(${width} - 2px)`) != null ? _a : "calc(100% - 2px)";
1843
- }};
1844
- min-width: ${({ minWidth }) => {
1845
- var _a;
1846
- return (_a = `calc(${minWidth} - 2px)`) != null ? _a : "fit-content";
1847
- }};
1848
- height: ${({ height }) => {
1849
- var _a;
1850
- return (_a = `calc(${height} - 2px)`) != null ? _a : "fit-content";
1851
- }};
1852
1840
  flex-direction: ${({ direction }) => direction || "row"};
1841
+ width: ${({ width }) => width != null ? width : "100%"};
1842
+ min-width: ${({ minWidth }) => minWidth != null ? minWidth : "initial"};
1843
+ max-width: ${({ maxWidth }) => maxWidth != null ? maxWidth : "initial"};
1844
+ min-height: ${({ minHeight }) => minHeight != null ? minHeight : "initial"};
1845
+ max-height: ${({ maxHeight }) => maxHeight != null ? maxHeight : "initial"};
1846
+ height: ${({ height }) => height != null ? height : "initial"};
1853
1847
  justify-content: space-between;
1854
- min-height: ${({ minHeight }) => {
1855
- var _a;
1856
- return (_a = `calc(${minHeight} - 2px)`) != null ? _a : "fit-content";
1857
- }};
1858
- margin: 1px;
1859
1848
  gap: 8px;
1860
- box-shadow: 0 0 0 1px ${(props) => getBorderColorByStatus(props)};
1849
+ border: 1px solid ${(props) => getBorderColorByStatus(props)};
1861
1850
  border-radius: 6px;
1862
1851
  background-color: ${colorTokens.neutral0};
1863
1852
  overflow: hidden;
@@ -2645,6 +2634,17 @@ var assetFunction = (iconName, domainProps) => {
2645
2634
  const ShoplIcon = ShoplAssets[iconName];
2646
2635
  return domain === "hada" ? HadaIcon : ShoplIcon;
2647
2636
  };
2637
+
2638
+ // src/components/Inputs/Input/utils/getNumberLimiteRange.ts
2639
+ var getNumberLimitRange = (value, min, max) => {
2640
+ if (min && value < min) {
2641
+ return String(min);
2642
+ }
2643
+ if (max && value > max) {
2644
+ return String(max);
2645
+ }
2646
+ return String(value);
2647
+ };
2648
2648
  var Input = forwardRef(
2649
2649
  (_a, ref) => {
2650
2650
  var _b = _a, {
@@ -2700,18 +2700,6 @@ var Input = forwardRef(
2700
2700
  },
2701
2701
  [maxLength]
2702
2702
  );
2703
- const limitRange = useCallback(
2704
- (value2) => {
2705
- if (min && Number(value2) < Number(min)) {
2706
- return String(min);
2707
- }
2708
- if (max && Number(value2) > Number(max)) {
2709
- return String(max);
2710
- }
2711
- return value2;
2712
- },
2713
- [max, min]
2714
- );
2715
2703
  const handleOnMouseEnter = () => {
2716
2704
  setIsHovered(true);
2717
2705
  };
@@ -2730,7 +2718,10 @@ var Input = forwardRef(
2730
2718
  onChange && onChange(event);
2731
2719
  const slicedText = sliceText(event.target.value);
2732
2720
  if (type === "number") {
2733
- const limitedText = limitRange(slicedText);
2721
+ const numberValue = Number(slicedText);
2722
+ const numberMin = Number(min);
2723
+ const numberMax = Number(max);
2724
+ const limitedText = getNumberLimitRange(numberValue, numberMin, numberMax);
2734
2725
  setText(limitedText);
2735
2726
  return;
2736
2727
  }
@@ -2788,6 +2779,7 @@ var Input = forwardRef(
2788
2779
  onMouseLeave: handleOnMouseLeave,
2789
2780
  width: getWidth(),
2790
2781
  height: type === "number" ? "32px" : "40px",
2782
+ maxHeight: type === "number" ? "32px" : "40px",
2791
2783
  "data-shoplflow": "input",
2792
2784
  children: [
2793
2785
  /* @__PURE__ */ jsx(
@@ -2927,6 +2919,7 @@ var InputButton = forwardRef(
2927
2919
  isFocused: isSelected,
2928
2920
  disabled,
2929
2921
  minHeight: "40px",
2922
+ maxHeight: "40px",
2930
2923
  width,
2931
2924
  children: /* @__PURE__ */ jsxs(StyledInputButton, { onClick: handleOnClick, disabled, children: [
2932
2925
  /* @__PURE__ */ jsx(StyledInputButtonContent, __spreadValues({ className: "body1_400", defaultValue: text, ref }, rest)),