@seeqdev/qomponents 0.0.96 → 0.0.97
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/TextField/TextField.types.d.ts +2 -0
- package/dist/index.esm.js +7 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4708,7 +4708,7 @@ const sizeClasses = {
|
|
|
4708
4708
|
* Textfield.
|
|
4709
4709
|
*/
|
|
4710
4710
|
const TextField = React.forwardRef((props, ref) => {
|
|
4711
|
-
const { readonly = false, disabled = false, onChange, onKeyUp, onFocus, onBlur, onKeyDown, id, name, size = 'sm', value, placeholder, extraClassNames, testId, type = 'text', inputGroup, step, showError, errorText, maxLength, minLength, required = false, autoComplete = 'off', inputWidth = undefined, inputHeight = undefined, autoFocus = false, } = props;
|
|
4711
|
+
const { readonly = false, disabled = false, onChange, onKeyUp, onFocus, onBlur, onKeyDown, id, name, size = 'sm', value, placeholder, extraClassNames, testId, type = 'text', inputGroup, step, showError, errorText, min, max, maxLength, minLength, required = false, autoComplete = 'off', inputWidth = undefined, inputHeight = undefined, autoFocus = false, } = props;
|
|
4712
4712
|
const internalRef = React.useRef(null);
|
|
4713
4713
|
const [cursor, setCursor] = React.useState(null);
|
|
4714
4714
|
const setAllRefs = (receivedRef) => {
|
|
@@ -4743,7 +4743,11 @@ const TextField = React.forwardRef((props, ref) => {
|
|
|
4743
4743
|
else if (inputGroup === 'right') {
|
|
4744
4744
|
borderRadius = 'tw-rounded-r-sm tw-border-l-0 focus:tw-border-l active:tw-border-l';
|
|
4745
4745
|
}
|
|
4746
|
-
|
|
4746
|
+
let hasError = showError;
|
|
4747
|
+
if ((min && Number(value) < min) || (max && Number(value) > max)) {
|
|
4748
|
+
hasError = true;
|
|
4749
|
+
}
|
|
4750
|
+
const appliedClasses = `${baseClasses$3} ${sizeClasses[size]} ${extraClassNames} ${lightTheme$1} ${darkTheme$1} ${borderRadius} ${hasError ? errorClasses$2 : borderColorClasses$2} `;
|
|
4747
4751
|
const inputProp = setValidInputDimension(inputWidth, inputHeight)
|
|
4748
4752
|
? {
|
|
4749
4753
|
style: setValidInputDimension(inputWidth, inputHeight),
|
|
@@ -4755,7 +4759,7 @@ const TextField = React.forwardRef((props, ref) => {
|
|
|
4755
4759
|
if (minLength)
|
|
4756
4760
|
inputLenghtProp.minLength = minLength;
|
|
4757
4761
|
return (React.createElement(React.Fragment, null,
|
|
4758
|
-
React.createElement("input", { ref: setAllRefs, "data-testid": testId, name: name, id: id, type: type, value: value, className: appliedClasses, placeholder: placeholder, disabled: disabled, readOnly: readonly, autoComplete: autoComplete, onChange: handleChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, onKeyUp: onKeyUp, step: step, required: required, autoFocus: autoFocus, ...inputLenghtProp, ...inputProp }),
|
|
4762
|
+
React.createElement("input", { ref: setAllRefs, "data-testid": testId, name: name, id: id, type: type, value: value, className: appliedClasses, placeholder: placeholder, disabled: disabled, readOnly: readonly, autoComplete: autoComplete, onChange: handleChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, onKeyUp: onKeyUp, step: step, required: required, autoFocus: autoFocus, min: min, max: max, ...inputLenghtProp, ...inputProp }),
|
|
4759
4763
|
errorText && showError && React.createElement("div", { className: "tw-text-sq-danger-color tw-text-xs tw-mt-1" }, errorText)));
|
|
4760
4764
|
});
|
|
4761
4765
|
|