@true-engineering/true-react-common-ui-kit 4.0.0-alpha20 → 4.0.0-alpha21
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/components/IncrementInput/IncrementInput.styles.d.ts +1 -3
- package/dist/components/Input/InputBase.d.ts +1 -1
- package/dist/true-react-common-ui-kit.js +78 -84
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +78 -84
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/components/ControlWrapper/ControlWrapper.stories.tsx +1 -1
- package/src/components/IncrementInput/IncrementInput.stories.tsx +2 -0
- package/src/components/IncrementInput/IncrementInput.styles.ts +31 -39
- package/src/components/IncrementInput/IncrementInput.tsx +28 -25
- package/src/components/Input/InputBase.tsx +3 -1
- package/src/components/WithMessages/WithMessages.stories.tsx +1 -1
|
@@ -10472,7 +10472,7 @@
|
|
|
10472
10472
|
}
|
|
10473
10473
|
}
|
|
10474
10474
|
var InputBase = /* @__PURE__ */ React.forwardRef(function(_param, ref) {
|
|
10475
|
-
var _param_value = _param.value, value = _param_value === void 0 ? "" : _param_value, placeholder = _param.placeholder, label = _param.label, _param_type = _param.type, type = _param_type === void 0 ? "text" : _param_type, isDisabled = _param.isDisabled, autoComplete = _param.autoComplete, initialInputMode = _param.inputMode, isReadonly = _param.isReadonly, isInvalid = _param.isInvalid, isActive = _param.isActive, isClearable = _param.isClearable, isAutoSized = _param.isAutoSized, name = _param.name, tweakStyles = _param.tweakStyles, maxLength = _param.maxLength, shouldFocusOnMount = _param.shouldFocusOnMount, units = _param.units, testId = _param.testId, tabIndex = _param.tabIndex, shouldAlwaysShowPlaceholder = _param.shouldAlwaysShowPlaceholder, onChange = _param.onChange, onPaste = _param.onPaste, onFocus = _param.onFocus, onBlur = _param.onBlur, onKeyDown = _param.onKeyDown, mask = _param.mask, maskPlaceholder = _param.maskPlaceholder, alwaysShowMask = _param.alwaysShowMask, beforeMaskedStateChange = _param.beforeMaskedStateChange, data = _param.data, groupPlacement = _param.groupPlacement, icon = _param.icon, isLoading = _param.isLoading, isRequired = _param.isRequired, size = _param.size, onIconClick = _param.onIconClick, inputProps = _object_without_properties$i(_param, [
|
|
10475
|
+
var _param_value = _param.value, value = _param_value === void 0 ? "" : _param_value, placeholder = _param.placeholder, label = _param.label, _param_type = _param.type, type = _param_type === void 0 ? "text" : _param_type, isDisabled = _param.isDisabled, autoComplete = _param.autoComplete, initialInputMode = _param.inputMode, isReadonly = _param.isReadonly, isInvalid = _param.isInvalid, isActive = _param.isActive, isClearable = _param.isClearable, isAutoSized = _param.isAutoSized, name = _param.name, tweakStyles = _param.tweakStyles, maxLength = _param.maxLength, shouldFocusOnMount = _param.shouldFocusOnMount, units = _param.units, testId = _param.testId, tabIndex = _param.tabIndex, shouldAlwaysShowPlaceholder = _param.shouldAlwaysShowPlaceholder, onChange = _param.onChange, onPaste = _param.onPaste, onFocus = _param.onFocus, onBlur = _param.onBlur, onKeyDown = _param.onKeyDown, mask = _param.mask, maskPlaceholder = _param.maskPlaceholder, alwaysShowMask = _param.alwaysShowMask, beforeMaskedStateChange = _param.beforeMaskedStateChange, data = _param.data, groupPlacement = _param.groupPlacement, icon = _param.icon, isLoading = _param.isLoading, isRequired = _param.isRequired, size = _param.size, onIconClick = _param.onIconClick, children = _param.children, inputProps = _object_without_properties$i(_param, [
|
|
10476
10476
|
"value",
|
|
10477
10477
|
"placeholder",
|
|
10478
10478
|
"label",
|
|
@@ -10508,7 +10508,8 @@
|
|
|
10508
10508
|
"isLoading",
|
|
10509
10509
|
"isRequired",
|
|
10510
10510
|
"size",
|
|
10511
|
-
"onIconClick"
|
|
10511
|
+
"onIconClick",
|
|
10512
|
+
"children"
|
|
10512
10513
|
]);
|
|
10513
10514
|
var classes = useStyles$G({
|
|
10514
10515
|
theme: tweakStyles
|
|
@@ -10623,7 +10624,7 @@
|
|
|
10623
10624
|
})
|
|
10624
10625
|
]
|
|
10625
10626
|
});
|
|
10626
|
-
return /* @__PURE__ */
|
|
10627
|
+
return /* @__PURE__ */ jsxs(ControlWrapper, {
|
|
10627
10628
|
label,
|
|
10628
10629
|
isDisabled,
|
|
10629
10630
|
isFocused: hasFocus,
|
|
@@ -10639,10 +10640,13 @@
|
|
|
10639
10640
|
isRequired,
|
|
10640
10641
|
onIconClick,
|
|
10641
10642
|
size,
|
|
10642
|
-
children:
|
|
10643
|
-
|
|
10644
|
-
|
|
10645
|
-
|
|
10643
|
+
children: [
|
|
10644
|
+
hasUnits || isAutoSized ? /* @__PURE__ */ jsx("div", {
|
|
10645
|
+
className: classes.autoSizeWrapper,
|
|
10646
|
+
children: inputContent
|
|
10647
|
+
}) : inputContent,
|
|
10648
|
+
children
|
|
10649
|
+
]
|
|
10646
10650
|
});
|
|
10647
10651
|
});
|
|
10648
10652
|
function _define_property$S(obj, key, value) {
|
|
@@ -27879,71 +27883,62 @@
|
|
|
27879
27883
|
}))
|
|
27880
27884
|
});
|
|
27881
27885
|
}
|
|
27882
|
-
var
|
|
27883
|
-
|
|
27886
|
+
var inputStyles$2 = {
|
|
27887
|
+
tweakControlWrapper: {
|
|
27888
|
+
controlWrapper: {
|
|
27889
|
+
"--increment-buttons-width": "36px",
|
|
27890
|
+
"--increment-buttons-gap": "1px",
|
|
27891
|
+
"--increment-buttons-margin": "1px",
|
|
27892
|
+
"--increment-button-icon-size": "16px"
|
|
27893
|
+
}
|
|
27894
|
+
}
|
|
27895
|
+
};
|
|
27884
27896
|
var useStyles$g = createThemedStyles("IncrementInput", {
|
|
27885
|
-
root: {
|
|
27886
|
-
display: "flex",
|
|
27887
|
-
alignItems: "center",
|
|
27888
|
-
position: "relative"
|
|
27889
|
-
},
|
|
27890
27897
|
buttons: {
|
|
27891
27898
|
display: "flex",
|
|
27892
27899
|
flexDirection: "column",
|
|
27893
|
-
|
|
27894
|
-
|
|
27895
|
-
|
|
27896
|
-
|
|
27897
|
-
|
|
27900
|
+
height: "calc(100% - var(--increment-buttons-margin) * 2)",
|
|
27901
|
+
margin: "var(--increment-buttons-margin)",
|
|
27902
|
+
gap: "var(--increment-buttons-gap)",
|
|
27903
|
+
flexShrink: 0,
|
|
27904
|
+
order: 1e3,
|
|
27905
|
+
// сдвигаем кнопки на самый конец
|
|
27898
27906
|
zIndex: dimensions.Z_INDEX.CONTROL_FOCUS + 1
|
|
27899
27907
|
},
|
|
27900
27908
|
button: {
|
|
27901
|
-
|
|
27902
|
-
|
|
27909
|
+
display: "flex",
|
|
27910
|
+
alignItems: "center",
|
|
27911
|
+
justifyContent: "center",
|
|
27912
|
+
width: "var(--increment-buttons-width)",
|
|
27913
|
+
flexGrow: 1,
|
|
27914
|
+
cursor: "pointer",
|
|
27903
27915
|
border: "none",
|
|
27904
27916
|
outline: "none",
|
|
27917
|
+
color: colors.FONT_MEDIUM,
|
|
27905
27918
|
backgroundColor: colors.GREY_BACKGROUND,
|
|
27906
27919
|
transition: animations.defaultTransition,
|
|
27907
|
-
transitionProperty: "background-color",
|
|
27908
|
-
color: colors.FONT_MEDIUM,
|
|
27909
|
-
cursor: "pointer",
|
|
27910
|
-
display: "flex",
|
|
27911
|
-
alignItems: "center",
|
|
27912
|
-
justifyContent: "center",
|
|
27913
|
-
padding: [
|
|
27914
|
-
0,
|
|
27915
|
-
10
|
|
27916
|
-
],
|
|
27920
|
+
transitionProperty: "background-color, color",
|
|
27917
27921
|
"&:hover, &:focus": {
|
|
27918
27922
|
backgroundColor: colors.GREY_HOVER
|
|
27919
27923
|
},
|
|
27920
27924
|
"&:active": {
|
|
27921
27925
|
backgroundColor: colors.GREY_ACTIVE
|
|
27922
|
-
},
|
|
27923
|
-
"&:first-child": {
|
|
27924
|
-
marginBottom: 1
|
|
27925
27926
|
}
|
|
27926
27927
|
},
|
|
27927
27928
|
disabledButton: {
|
|
27928
|
-
backgroundColor: colors.CLASSIC_WHITE,
|
|
27929
|
-
color: colors.FONT_DISABLED,
|
|
27930
27929
|
cursor: "default",
|
|
27930
|
+
color: colors.FONT_DISABLED,
|
|
27931
|
+
backgroundColor: colors.CLASSIC_WHITE,
|
|
27931
27932
|
"&:hover": {
|
|
27932
27933
|
backgroundColor: colors.CLASSIC_WHITE
|
|
27933
27934
|
}
|
|
27934
27935
|
},
|
|
27935
|
-
errorButton: {}
|
|
27936
|
-
|
|
27937
|
-
|
|
27938
|
-
|
|
27939
|
-
paddingRight: BUTTONS_WIDTH + BUTTONS_GAP
|
|
27940
|
-
},
|
|
27941
|
-
tweakControlWrapper: {
|
|
27942
|
-
controls: {
|
|
27943
|
-
paddingRight: BUTTONS_WIDTH + BUTTONS_GAP
|
|
27944
|
-
}
|
|
27936
|
+
errorButton: {},
|
|
27937
|
+
icon: {
|
|
27938
|
+
width: "var(--increment-button-icon-size)",
|
|
27939
|
+
height: "var(--increment-button-icon-size)"
|
|
27945
27940
|
}
|
|
27946
|
-
};
|
|
27941
|
+
});
|
|
27947
27942
|
function _define_property$k(obj, key, value) {
|
|
27948
27943
|
if (key in obj) {
|
|
27949
27944
|
Object.defineProperty(obj, key, {
|
|
@@ -28029,15 +28024,13 @@
|
|
|
28029
28024
|
return target;
|
|
28030
28025
|
}
|
|
28031
28026
|
var IncrementInput = function(_param) {
|
|
28032
|
-
var value = _param.value, onChange = _param.onChange, min2 = _param.min, max2 = _param.max, _param_step = _param.step, step = _param_step === void 0 ? 1 : _param_step, intPartPrecision = _param.intPartPrecision,
|
|
28027
|
+
var value = _param.value, onChange = _param.onChange, min2 = _param.min, max2 = _param.max, _param_step = _param.step, step = _param_step === void 0 ? 1 : _param_step, intPartPrecision = _param.intPartPrecision, tweakStyles = _param.tweakStyles, isDisabled = _param.isDisabled, isReadonly = _param.isReadonly, isInvalid = _param.isInvalid, props = _object_without_properties$7(_param, [
|
|
28033
28028
|
"value",
|
|
28034
28029
|
"onChange",
|
|
28035
28030
|
"min",
|
|
28036
28031
|
"max",
|
|
28037
28032
|
"step",
|
|
28038
28033
|
"intPartPrecision",
|
|
28039
|
-
"data",
|
|
28040
|
-
"testId",
|
|
28041
28034
|
"tweakStyles",
|
|
28042
28035
|
"isDisabled",
|
|
28043
28036
|
"isReadonly",
|
|
@@ -28052,8 +28045,9 @@
|
|
|
28052
28045
|
var classes = useStyles$g({
|
|
28053
28046
|
theme: tweakStyles
|
|
28054
28047
|
});
|
|
28055
|
-
var
|
|
28056
|
-
var
|
|
28048
|
+
var isEditDisabled = isDisabled || isReadonly;
|
|
28049
|
+
var isIncreaseDisabled = isEditDisabled || trueReactPlatformHelpers.isNotEmpty(intPartPrecision) && getNumberLength((value !== null && value !== void 0 ? value : 0) + step) > intPartPrecision || trueReactPlatformHelpers.isNotEmpty(max2) && trueReactPlatformHelpers.isNotEmpty(value) && value >= max2;
|
|
28050
|
+
var isDecreaseDisabled = isEditDisabled || trueReactPlatformHelpers.isNotEmpty(min2) && trueReactPlatformHelpers.isNotEmpty(value) && value <= min2;
|
|
28057
28051
|
var increment = function() {
|
|
28058
28052
|
onChange(getNumberInRange((value !== null && value !== void 0 ? value : 0) + step, min2, max2));
|
|
28059
28053
|
};
|
|
@@ -28068,45 +28062,45 @@
|
|
|
28068
28062
|
step
|
|
28069
28063
|
]);
|
|
28070
28064
|
var _obj2, _obj1;
|
|
28071
|
-
return /* @__PURE__ */
|
|
28072
|
-
|
|
28073
|
-
|
|
28074
|
-
|
|
28075
|
-
|
|
28076
|
-
|
|
28077
|
-
|
|
28078
|
-
|
|
28079
|
-
|
|
28080
|
-
|
|
28081
|
-
|
|
28082
|
-
|
|
28083
|
-
|
|
28084
|
-
|
|
28085
|
-
|
|
28086
|
-
|
|
28087
|
-
|
|
28088
|
-
|
|
28089
|
-
/* @__PURE__ */ jsx("
|
|
28090
|
-
className:
|
|
28091
|
-
type: "button",
|
|
28092
|
-
disabled: isIncreaseDisabled,
|
|
28093
|
-
onClick: increment,
|
|
28065
|
+
return /* @__PURE__ */ jsx(NumberInput, _object_spread_props$i(_object_spread$j({}, props), {
|
|
28066
|
+
isInvalid,
|
|
28067
|
+
isDisabled,
|
|
28068
|
+
isReadonly,
|
|
28069
|
+
min: min2,
|
|
28070
|
+
max: max2,
|
|
28071
|
+
intPartPrecision,
|
|
28072
|
+
onChange,
|
|
28073
|
+
value,
|
|
28074
|
+
tweakStyles: tweakInputStyles,
|
|
28075
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
28076
|
+
className: classes.buttons,
|
|
28077
|
+
children: [
|
|
28078
|
+
/* @__PURE__ */ jsx("button", {
|
|
28079
|
+
className: clsx(classes.button, (_obj2 = {}, _define_property$k(_obj2, classes.disabledButton, isIncreaseDisabled), _define_property$k(_obj2, classes.errorButton, isInvalid), _obj2)),
|
|
28080
|
+
type: "button",
|
|
28081
|
+
disabled: isIncreaseDisabled,
|
|
28082
|
+
onClick: increment,
|
|
28083
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
28084
|
+
className: classes.icon,
|
|
28094
28085
|
children: /* @__PURE__ */ jsx(Icon, {
|
|
28095
28086
|
type: "plus"
|
|
28096
28087
|
})
|
|
28097
|
-
})
|
|
28098
|
-
|
|
28099
|
-
|
|
28100
|
-
|
|
28101
|
-
|
|
28102
|
-
|
|
28088
|
+
})
|
|
28089
|
+
}),
|
|
28090
|
+
/* @__PURE__ */ jsx("button", {
|
|
28091
|
+
className: clsx(classes.button, (_obj1 = {}, _define_property$k(_obj1, classes.disabledButton, isDecreaseDisabled), _define_property$k(_obj1, classes.errorButton, isInvalid), _obj1)),
|
|
28092
|
+
type: "button",
|
|
28093
|
+
disabled: isDecreaseDisabled,
|
|
28094
|
+
onClick: decrement,
|
|
28095
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
28096
|
+
className: classes.icon,
|
|
28103
28097
|
children: /* @__PURE__ */ jsx(Icon, {
|
|
28104
28098
|
type: "minus"
|
|
28105
28099
|
})
|
|
28106
28100
|
})
|
|
28107
|
-
|
|
28108
|
-
|
|
28109
|
-
|
|
28101
|
+
})
|
|
28102
|
+
]
|
|
28103
|
+
})
|
|
28110
28104
|
}));
|
|
28111
28105
|
};
|
|
28112
28106
|
var VERTICAL_OVERLAY_PADDING = 50;
|