@shoplflow/base 0.24.27 → 0.24.28

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
@@ -1859,16 +1859,42 @@ var getBorderColorByStatus = ({ isFocused, isError, isHovered, disabled }) => {
1859
1859
  }
1860
1860
  return exports.colorTokens.neutral300;
1861
1861
  };
1862
+ var getStyleByType = ({
1863
+ type,
1864
+ height,
1865
+ minHeight,
1866
+ maxHeight,
1867
+ width,
1868
+ minWidth,
1869
+ maxWidth
1870
+ }) => {
1871
+ if (type === "number") {
1872
+ return react$1.css`
1873
+ width: 64px;
1874
+ height: 32px;
1875
+ `;
1876
+ }
1877
+ if (type === "text" || type === "password") {
1878
+ return react$1.css`
1879
+ width: ${width != null ? width : "100%"};
1880
+ min-width: ${minWidth != null ? minWidth : "initial"};
1881
+ max-width: ${maxWidth != null ? maxWidth : "initial"};
1882
+ height: ${height != null ? height : "initial"};
1883
+ min-height: ${minHeight != null ? minHeight : "initial"};
1884
+ max-height: ${maxHeight != null ? maxHeight : "initial"};
1885
+ `;
1886
+ }
1887
+ return react$1.css`
1888
+ width: 64px;
1889
+ height: 32px;
1890
+ `;
1891
+ };
1862
1892
  var InputWrapper = styled5__default.default.label`
1893
+ position: relative;
1863
1894
  display: flex;
1864
1895
  align-items: center;
1865
1896
  flex-direction: ${({ direction }) => direction || "row"};
1866
- width: ${({ width }) => width != null ? width : "100%"};
1867
- min-width: ${({ minWidth }) => minWidth != null ? minWidth : "initial"};
1868
- max-width: ${({ maxWidth }) => maxWidth != null ? maxWidth : "initial"};
1869
- min-height: ${({ minHeight }) => minHeight != null ? minHeight : "initial"};
1870
- max-height: ${({ maxHeight }) => maxHeight != null ? maxHeight : "initial"};
1871
- height: ${({ height }) => height != null ? height : "initial"};
1897
+ ${({ type, height, minHeight, maxHeight, width, maxWidth, minWidth }) => getStyleByType({ type, height, minHeight, maxHeight, width, maxWidth, minWidth })};
1872
1898
  justify-content: space-between;
1873
1899
  gap: 8px;
1874
1900
  border: 1px solid ${(props) => getBorderColorByStatus(props)};
@@ -2603,7 +2629,8 @@ exports.TagSizeVariants = {
2603
2629
  var StyledInput = styled5__default.default.input`
2604
2630
  padding: 4px 0 4px 12px;
2605
2631
  background-color: transparent;
2606
- width: 100%;
2632
+ display: flex;
2633
+ min-width: 64px;
2607
2634
  border: none;
2608
2635
  box-sizing: border-box;
2609
2636
  &::placeholder {
@@ -2624,6 +2651,12 @@ var StyledInput = styled5__default.default.input`
2624
2651
  text-align: center;
2625
2652
  -moz-appearance: textfield;
2626
2653
  }
2654
+
2655
+ *,
2656
+ *:before,
2657
+ *:after {
2658
+ box-sizing: inherit;
2659
+ }
2627
2660
  `;
2628
2661
  var RightElementWrapper = styled5__default.default.div`
2629
2662
  display: flex;
@@ -2686,7 +2719,7 @@ var Input = React2.forwardRef(
2686
2719
  min,
2687
2720
  max,
2688
2721
  className,
2689
- width = "100%"
2722
+ width
2690
2723
  } = _b, rest = __objRest(_b, [
2691
2724
  "onFocus",
2692
2725
  "onBlur",
@@ -2705,7 +2738,7 @@ var Input = React2.forwardRef(
2705
2738
  ]);
2706
2739
  const [text, setText] = React2.useState("");
2707
2740
  const [isFocused, setIsFocused] = React2.useState(false);
2708
- const [type, setType] = React2.useState("text");
2741
+ const [type, setType] = React2.useState(void 0);
2709
2742
  const [isHovered, setIsHovered] = React2.useState(false);
2710
2743
  const uniqueId = React2.useId();
2711
2744
  const inputRef = React2__namespace.default.useRef(null);
@@ -2752,13 +2785,6 @@ var Input = React2.forwardRef(
2752
2785
  }
2753
2786
  setText(slicedText);
2754
2787
  };
2755
- const getWidth = () => {
2756
- if (type === "number") {
2757
- return "64px";
2758
- } else {
2759
- return width;
2760
- }
2761
- };
2762
2788
  const handleOnClear = () => {
2763
2789
  onClear && onClear();
2764
2790
  if (inputRef.current) {
@@ -2802,9 +2828,10 @@ var Input = React2.forwardRef(
2802
2828
  isHovered,
2803
2829
  onMouseEnter: handleOnMouseEnter,
2804
2830
  onMouseLeave: handleOnMouseLeave,
2805
- width: getWidth(),
2806
- height: type === "number" ? "32px" : "40px",
2807
- maxHeight: type === "number" ? "32px" : "40px",
2831
+ type,
2832
+ width,
2833
+ height: "40px",
2834
+ maxHeight: "40px",
2808
2835
  "data-shoplflow": "input",
2809
2836
  children: [
2810
2837
  /* @__PURE__ */ jsxRuntime.jsx(