@antscorp/antsomi-ui 1.3.5-beta.911 → 1.3.5-beta.912
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.
|
@@ -7,6 +7,7 @@ import Icon from '@antscorp/icons';
|
|
|
7
7
|
import { useInView } from 'react-intersection-observer';
|
|
8
8
|
import { Spin } from '../../atoms';
|
|
9
9
|
import { EditIcon } from '../../icons';
|
|
10
|
+
import { translate, translations } from '@antscorp/antsomi-locales';
|
|
10
11
|
export const EditableName = React.forwardRef((props, ref) => {
|
|
11
12
|
const { className, isLoading, required, error, value, style, readonly, maxLength = 255, editIcon, onBlur, onChange, } = props;
|
|
12
13
|
const defaultValue = useRef(props.defaultValue);
|
|
@@ -15,7 +16,7 @@ export const EditableName = React.forwardRef((props, ref) => {
|
|
|
15
16
|
const { ref: componentInViewRef, inView: componentInView } = useInView();
|
|
16
17
|
const requiredError = useMemo(() => {
|
|
17
18
|
const newValue = value ? value.trim() : internalValue.trim();
|
|
18
|
-
return required && newValue.length === 0 ?
|
|
19
|
+
return required && newValue.length === 0 ? translate(translations._NOTI_EMPTY_NAME) : '';
|
|
19
20
|
}, [required, internalValue, value]);
|
|
20
21
|
const spanRef = useRef(null);
|
|
21
22
|
const inputRef = useRef(null);
|