react-artasys-ui 0.1.1 → 0.1.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-artasys-ui",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -25,7 +25,7 @@ const Element = ({children, beforeElement, afterElement, error, placeholder, dis
25
25
  setCurrentError(error ?? '');
26
26
  },[error]);
27
27
 
28
- const classes = ['ui-form-element'];
28
+ const classes = ['ui-form-element-container'];
29
29
 
30
30
  classes.push(styles['container']);
31
31
  if (currentError) classes.push(styles['error']);
@@ -39,13 +39,13 @@ const Element = ({children, beforeElement, afterElement, error, placeholder, dis
39
39
  style={styleContainer}
40
40
  >
41
41
  {beforeElement}
42
- <div className={styles['element']}>
42
+ <div className={'ui-form-element ' + styles['element']}>
43
43
  {typeof children === 'function' ? children(props) : null}
44
- {placeholder && <span className={styles['placeholder']}>{placeholder}</span>}
44
+ {placeholder && <span className={'ui-form-element-placeholder ' + styles['placeholder']}>{placeholder}</span>}
45
45
  </div>
46
46
  {afterElement}
47
47
  </label>
48
- {currentError && <div className={styles['error']}>{currentError}</div>}
48
+ {currentError && <div className={'ui-form-error ' + styles['error']}>{currentError}</div>}
49
49
  </>);
50
50
  }
51
51
 
@@ -14,7 +14,7 @@ interface IInput extends IElement<HTMLInputElement> {
14
14
  }
15
15
 
16
16
  const Input = forwardRef<HTMLInputElement, IInput>(({onChange, onInput, onChangeText, ...props}, ref) => {
17
- const [currentValue, setCurrentValue] = useState(props.value);
17
+ const [currentValue, setCurrentValue] = useState<string | undefined>('');
18
18
 
19
19
  const handleChange = (e: ChangeEvent<HTMLInputElement>) => {
20
20
  if (typeof onChange === 'function') {
@@ -34,7 +34,8 @@ const Input = forwardRef<HTMLInputElement, IInput>(({onChange, onInput, onChange
34
34
  };
35
35
 
36
36
  useEffect(() => {
37
- setCurrentValue(props.value);
37
+ if (!props.value) return;
38
+ setCurrentValue(String(props.value));
38
39
  }, [props.value]);
39
40
 
40
41
  return(<Element {...props}>