@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.js CHANGED
@@ -1834,16 +1834,42 @@ var getBorderColorByStatus = ({ isFocused, isError, isHovered, disabled }) => {
1834
1834
  }
1835
1835
  return colorTokens.neutral300;
1836
1836
  };
1837
+ var getStyleByType = ({
1838
+ type,
1839
+ height,
1840
+ minHeight,
1841
+ maxHeight,
1842
+ width,
1843
+ minWidth,
1844
+ maxWidth
1845
+ }) => {
1846
+ if (type === "number") {
1847
+ return css`
1848
+ width: 64px;
1849
+ height: 32px;
1850
+ `;
1851
+ }
1852
+ if (type === "text" || type === "password") {
1853
+ return css`
1854
+ width: ${width != null ? width : "100%"};
1855
+ min-width: ${minWidth != null ? minWidth : "initial"};
1856
+ max-width: ${maxWidth != null ? maxWidth : "initial"};
1857
+ height: ${height != null ? height : "initial"};
1858
+ min-height: ${minHeight != null ? minHeight : "initial"};
1859
+ max-height: ${maxHeight != null ? maxHeight : "initial"};
1860
+ `;
1861
+ }
1862
+ return css`
1863
+ width: 64px;
1864
+ height: 32px;
1865
+ `;
1866
+ };
1837
1867
  var InputWrapper = styled5.label`
1868
+ position: relative;
1838
1869
  display: flex;
1839
1870
  align-items: center;
1840
1871
  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"};
1872
+ ${({ type, height, minHeight, maxHeight, width, maxWidth, minWidth }) => getStyleByType({ type, height, minHeight, maxHeight, width, maxWidth, minWidth })};
1847
1873
  justify-content: space-between;
1848
1874
  gap: 8px;
1849
1875
  border: 1px solid ${(props) => getBorderColorByStatus(props)};
@@ -2578,7 +2604,8 @@ var TagSizeVariants = {
2578
2604
  var StyledInput = styled5.input`
2579
2605
  padding: 4px 0 4px 12px;
2580
2606
  background-color: transparent;
2581
- width: 100%;
2607
+ display: flex;
2608
+ min-width: 64px;
2582
2609
  border: none;
2583
2610
  box-sizing: border-box;
2584
2611
  &::placeholder {
@@ -2599,6 +2626,12 @@ var StyledInput = styled5.input`
2599
2626
  text-align: center;
2600
2627
  -moz-appearance: textfield;
2601
2628
  }
2629
+
2630
+ *,
2631
+ *:before,
2632
+ *:after {
2633
+ box-sizing: inherit;
2634
+ }
2602
2635
  `;
2603
2636
  var RightElementWrapper = styled5.div`
2604
2637
  display: flex;
@@ -2661,7 +2694,7 @@ var Input = forwardRef(
2661
2694
  min,
2662
2695
  max,
2663
2696
  className,
2664
- width = "100%"
2697
+ width
2665
2698
  } = _b, rest = __objRest(_b, [
2666
2699
  "onFocus",
2667
2700
  "onBlur",
@@ -2680,7 +2713,7 @@ var Input = forwardRef(
2680
2713
  ]);
2681
2714
  const [text, setText] = useState("");
2682
2715
  const [isFocused, setIsFocused] = useState(false);
2683
- const [type, setType] = useState("text");
2716
+ const [type, setType] = useState(void 0);
2684
2717
  const [isHovered, setIsHovered] = useState(false);
2685
2718
  const uniqueId = useId();
2686
2719
  const inputRef = React2__default.useRef(null);
@@ -2727,13 +2760,6 @@ var Input = forwardRef(
2727
2760
  }
2728
2761
  setText(slicedText);
2729
2762
  };
2730
- const getWidth = () => {
2731
- if (type === "number") {
2732
- return "64px";
2733
- } else {
2734
- return width;
2735
- }
2736
- };
2737
2763
  const handleOnClear = () => {
2738
2764
  onClear && onClear();
2739
2765
  if (inputRef.current) {
@@ -2777,9 +2803,10 @@ var Input = forwardRef(
2777
2803
  isHovered,
2778
2804
  onMouseEnter: handleOnMouseEnter,
2779
2805
  onMouseLeave: handleOnMouseLeave,
2780
- width: getWidth(),
2781
- height: type === "number" ? "32px" : "40px",
2782
- maxHeight: type === "number" ? "32px" : "40px",
2806
+ type,
2807
+ width,
2808
+ height: "40px",
2809
+ maxHeight: "40px",
2783
2810
  "data-shoplflow": "input",
2784
2811
  children: [
2785
2812
  /* @__PURE__ */ jsx(