@trafilea/afrodita-components 6.39.3 → 6.39.4
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/build/index.d.ts +2 -1
- package/build/index.esm.js +3 -2
- package/build/index.esm.js.map +1 -1
- package/build/index.js +3 -2
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -2910,6 +2910,7 @@ interface BaseInputCommonProps {
|
|
|
2910
2910
|
name?: string;
|
|
2911
2911
|
autoFocus?: boolean;
|
|
2912
2912
|
requiredPlaceholder?: string;
|
|
2913
|
+
customErrorMessage?: string;
|
|
2913
2914
|
}
|
|
2914
2915
|
declare type BaseInputProps = BaseInputCommonProps;
|
|
2915
2916
|
|
|
@@ -2959,7 +2960,7 @@ declare type CustomProps = BaseInputProps & {
|
|
|
2959
2960
|
};
|
|
2960
2961
|
|
|
2961
2962
|
declare const Input: {
|
|
2962
|
-
Simple: ({ value, onChange, label, children, required, onValidation, size, placeholder, inlinePlaceholder, hasError, inputType, hideClear, innerRef, requiredPlaceholder, ...rest }: BaseInputCommonProps) => JSX.Element;
|
|
2963
|
+
Simple: ({ value, onChange, label, children, required, onValidation, size, placeholder, inlinePlaceholder, hasError, inputType, hideClear, innerRef, requiredPlaceholder, customErrorMessage, ...rest }: BaseInputCommonProps) => JSX.Element;
|
|
2963
2964
|
Custom: ({ onClick, text, variant, defaultRounded, ...rest }: CustomProps) => JSX.Element;
|
|
2964
2965
|
SimplePlusButton: ({ onClick, onClickEdit, text, success, editText, successText, ...rest }: BasePlusButtonProps) => JSX.Element;
|
|
2965
2966
|
SimplePlusIcon: ({ Icon, ...rest }: BasePlusIconProps) => JSX.Element;
|
package/build/index.esm.js
CHANGED
|
@@ -14237,7 +14237,7 @@ var ClearInput = newStyled.div(templateObject_6$p || (templateObject_6$p = __mak
|
|
|
14237
14237
|
var templateObject_1$16, templateObject_2$S, templateObject_3$J, templateObject_4$z, templateObject_5$r, templateObject_6$p;
|
|
14238
14238
|
|
|
14239
14239
|
var BaseInput = function (_a) {
|
|
14240
|
-
var value = _a.value, _b = _a.onChange, onChange = _b === void 0 ? function () { } : _b, label = _a.label, children = _a.children, required = _a.required, onValidation = _a.onValidation, size = _a.size, placeholder = _a.placeholder, inlinePlaceholder = _a.inlinePlaceholder, hasError = _a.hasError, _c = _a.inputType, inputType = _c === void 0 ? 'text' : _c, hideClear = _a.hideClear, innerRef = _a.innerRef, requiredPlaceholder = _a.requiredPlaceholder, rest = __rest(_a, ["value", "onChange", "label", "children", "required", "onValidation", "size", "placeholder", "inlinePlaceholder", "hasError", "inputType", "hideClear", "innerRef", "requiredPlaceholder"]);
|
|
14240
|
+
var value = _a.value, _b = _a.onChange, onChange = _b === void 0 ? function () { } : _b, label = _a.label, children = _a.children, required = _a.required, onValidation = _a.onValidation, size = _a.size, placeholder = _a.placeholder, inlinePlaceholder = _a.inlinePlaceholder, hasError = _a.hasError, _c = _a.inputType, inputType = _c === void 0 ? 'text' : _c, hideClear = _a.hideClear, innerRef = _a.innerRef, requiredPlaceholder = _a.requiredPlaceholder, customErrorMessage = _a.customErrorMessage, rest = __rest(_a, ["value", "onChange", "label", "children", "required", "onValidation", "size", "placeholder", "inlinePlaceholder", "hasError", "inputType", "hideClear", "innerRef", "requiredPlaceholder", "customErrorMessage"]);
|
|
14241
14241
|
var theme = useTheme();
|
|
14242
14242
|
var _d = useState(InputValidationType.Empty), status = _d[0], setStatus = _d[1];
|
|
14243
14243
|
var onBlur = function (_a) {
|
|
@@ -14257,11 +14257,12 @@ var BaseInput = function (_a) {
|
|
|
14257
14257
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
14258
14258
|
}, [status]);
|
|
14259
14259
|
var hasValue = Boolean(value);
|
|
14260
|
+
var errorMessage = customErrorMessage || (status === InputValidationType.Error && required);
|
|
14260
14261
|
return (jsxs$1(Container$Q, __assign$1({ status: status, hasError: hasError }, { children: [label && (jsx$1(InputLabel, { label: label, isDisabled: rest.disabled, isRequired: Boolean(required) }, void 0)), jsxs$1(InputWrapper, __assign$1({ className: "inputWrapper", size: size, inlinePlaceholder: inlinePlaceholder }, { children: [jsx$1(StyledInput, __assign$1({ id: requiredPlaceholder ? 'requiredPlaceholder' : undefined, hasValue: hasValue, inlinePlaceholder: inlinePlaceholder, hasError: hasError, ref: innerRef, "data-testid": "base-input", type: inputType, onChange: function (event) {
|
|
14261
14262
|
onChange(event.target.value, event);
|
|
14262
14263
|
}, onBlur: onBlur, required: Boolean(required), value: value, placeholder: inlinePlaceholder ? '' : placeholder }, rest), void 0), !!requiredPlaceholder && (jsx$1(StyledLabel$2, __assign$1({ htmlFor: "requiredPlaceholder" }, { children: requiredPlaceholder }), void 0)), inlinePlaceholder && (jsx$1(AnimatedPlaceholder, __assign$1({ "data-testid": "input-placeholder" }, { children: placeholder }), void 0)), children] }), void 0), !hideClear && !rest.disabled && inlinePlaceholder && hasValue && (jsx$1(ClearInput, __assign$1({ onClick: function () {
|
|
14263
14264
|
onChange('', { target: { value: '' } });
|
|
14264
|
-
}, "data-testid": "clear-value" }, { children: jsx$1(Icon.Actions.ClearLight, { width: 0.75, height: 0.75, fill: theme.colors.shades[550].color }, void 0) }), void 0)),
|
|
14265
|
+
}, "data-testid": "clear-value" }, { children: jsx$1(Icon.Actions.ClearLight, { width: 0.75, height: 0.75, fill: theme.colors.shades[550].color }, void 0) }), void 0)), errorMessage && jsx$1(Error$1, { error: errorMessage }, void 0)] }), void 0));
|
|
14265
14266
|
};
|
|
14266
14267
|
|
|
14267
14268
|
var Button$6 = function (_a) {
|