@shoplflow/base 0.24.25 → 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.cjs +28 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -31
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1862,27 +1862,16 @@ var getBorderColorByStatus = ({ isFocused, isError, isHovered, disabled }) => {
|
|
|
1862
1862
|
var InputWrapper = styled5__default.default.label`
|
|
1863
1863
|
display: flex;
|
|
1864
1864
|
align-items: center;
|
|
1865
|
-
width: ${({ width }) => {
|
|
1866
|
-
var _a;
|
|
1867
|
-
return (_a = `calc(${width} - 2px)`) != null ? _a : "calc(100% - 2px)";
|
|
1868
|
-
}};
|
|
1869
|
-
min-width: ${({ minWidth }) => {
|
|
1870
|
-
var _a;
|
|
1871
|
-
return (_a = `calc(${minWidth} - 2px)`) != null ? _a : "fit-content";
|
|
1872
|
-
}};
|
|
1873
|
-
height: ${({ height }) => {
|
|
1874
|
-
var _a;
|
|
1875
|
-
return (_a = `calc(${height} - 2px)`) != null ? _a : "fit-content";
|
|
1876
|
-
}};
|
|
1877
1865
|
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"};
|
|
1878
1872
|
justify-content: space-between;
|
|
1879
|
-
min-height: ${({ minHeight }) => {
|
|
1880
|
-
var _a;
|
|
1881
|
-
return (_a = `calc(${minHeight} - 2px)`) != null ? _a : "fit-content";
|
|
1882
|
-
}};
|
|
1883
|
-
margin: 1px;
|
|
1884
1873
|
gap: 8px;
|
|
1885
|
-
|
|
1874
|
+
border: 1px solid ${(props) => getBorderColorByStatus(props)};
|
|
1886
1875
|
border-radius: 6px;
|
|
1887
1876
|
background-color: ${exports.colorTokens.neutral0};
|
|
1888
1877
|
overflow: hidden;
|
|
@@ -2625,6 +2614,10 @@ var StyledInput = styled5__default.default.input`
|
|
|
2625
2614
|
-webkit-appearance: none;
|
|
2626
2615
|
margin: 0;
|
|
2627
2616
|
}
|
|
2617
|
+
${({ disabled }) => disabled && react$1.css`
|
|
2618
|
+
color: ${exports.colorTokens.neutral350};
|
|
2619
|
+
cursor: not-allowed;
|
|
2620
|
+
`};
|
|
2628
2621
|
/* Firefox */
|
|
2629
2622
|
&[type='number'] {
|
|
2630
2623
|
padding: 4px 8px;
|
|
@@ -2666,6 +2659,17 @@ var assetFunction = (iconName, domainProps) => {
|
|
|
2666
2659
|
const ShoplIcon = ShoplAssets__namespace[iconName];
|
|
2667
2660
|
return domain === "hada" ? HadaIcon : ShoplIcon;
|
|
2668
2661
|
};
|
|
2662
|
+
|
|
2663
|
+
// src/components/Inputs/Input/utils/getNumberLimiteRange.ts
|
|
2664
|
+
var getNumberLimitRange = (value, min, max) => {
|
|
2665
|
+
if (min && value < min) {
|
|
2666
|
+
return String(min);
|
|
2667
|
+
}
|
|
2668
|
+
if (max && value > max) {
|
|
2669
|
+
return String(max);
|
|
2670
|
+
}
|
|
2671
|
+
return String(value);
|
|
2672
|
+
};
|
|
2669
2673
|
var Input = React2.forwardRef(
|
|
2670
2674
|
(_a, ref) => {
|
|
2671
2675
|
var _b = _a, {
|
|
@@ -2721,18 +2725,6 @@ var Input = React2.forwardRef(
|
|
|
2721
2725
|
},
|
|
2722
2726
|
[maxLength]
|
|
2723
2727
|
);
|
|
2724
|
-
const limitRange = React2.useCallback(
|
|
2725
|
-
(value2) => {
|
|
2726
|
-
if (min && Number(value2) < Number(min)) {
|
|
2727
|
-
return String(min);
|
|
2728
|
-
}
|
|
2729
|
-
if (max && Number(value2) > Number(max)) {
|
|
2730
|
-
return String(max);
|
|
2731
|
-
}
|
|
2732
|
-
return value2;
|
|
2733
|
-
},
|
|
2734
|
-
[max, min]
|
|
2735
|
-
);
|
|
2736
2728
|
const handleOnMouseEnter = () => {
|
|
2737
2729
|
setIsHovered(true);
|
|
2738
2730
|
};
|
|
@@ -2751,7 +2743,10 @@ var Input = React2.forwardRef(
|
|
|
2751
2743
|
onChange && onChange(event);
|
|
2752
2744
|
const slicedText = sliceText(event.target.value);
|
|
2753
2745
|
if (type === "number") {
|
|
2754
|
-
const
|
|
2746
|
+
const numberValue = Number(slicedText);
|
|
2747
|
+
const numberMin = Number(min);
|
|
2748
|
+
const numberMax = Number(max);
|
|
2749
|
+
const limitedText = getNumberLimitRange(numberValue, numberMin, numberMax);
|
|
2755
2750
|
setText(limitedText);
|
|
2756
2751
|
return;
|
|
2757
2752
|
}
|
|
@@ -2809,6 +2804,7 @@ var Input = React2.forwardRef(
|
|
|
2809
2804
|
onMouseLeave: handleOnMouseLeave,
|
|
2810
2805
|
width: getWidth(),
|
|
2811
2806
|
height: type === "number" ? "32px" : "40px",
|
|
2807
|
+
maxHeight: type === "number" ? "32px" : "40px",
|
|
2812
2808
|
"data-shoplflow": "input",
|
|
2813
2809
|
children: [
|
|
2814
2810
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2948,6 +2944,7 @@ var InputButton = React2.forwardRef(
|
|
|
2948
2944
|
isFocused: isSelected,
|
|
2949
2945
|
disabled,
|
|
2950
2946
|
minHeight: "40px",
|
|
2947
|
+
maxHeight: "40px",
|
|
2951
2948
|
width,
|
|
2952
2949
|
children: /* @__PURE__ */ jsxRuntime.jsxs(exports.StyledInputButton, { onClick: handleOnClick, disabled, children: [
|
|
2953
2950
|
/* @__PURE__ */ jsxRuntime.jsx(exports.StyledInputButtonContent, __spreadValues({ className: "body1_400", defaultValue: text, ref }, rest)),
|