react-artasys-ui 0.1.0 → 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
package/src/Button/Button.tsx
CHANGED
|
@@ -19,7 +19,7 @@ const Button = ({children, className, classNameContainer, styleContainer, spinne
|
|
|
19
19
|
if (classNameContainer) classes.push(classNameContainer);
|
|
20
20
|
|
|
21
21
|
return(<div className={classes.join(' ')} style={styleContainer}>
|
|
22
|
-
<button {...props} className={'ui-button' + className ? ' ' + className : ''}>{children}</button>
|
|
22
|
+
<button {...props} className={'ui-button' + (className ? ' ' + className : '')}>{children}</button>
|
|
23
23
|
<div className={'ui-button-spinner ' + styles['wait-indicator'] + (wait ? ' ' + styles['active'] : '')}>
|
|
24
24
|
<Spinner size="small" color={spinnerColor}/>
|
|
25
25
|
</div>
|
|
@@ -12,7 +12,7 @@ const Checkbox = forwardRef<HTMLInputElement, ICheckbox>(({type = 'checkbox', hi
|
|
|
12
12
|
|
|
13
13
|
return(<Element {...props} hiddenContainer={hiddenContainer}>
|
|
14
14
|
{(props) => <div className={'ui-checkbox-container ' + styles['container']}>
|
|
15
|
-
<input {...props} className={'ui-checkbox' + props.className ? ' ' + props.className : ''} type={type} ref={ref}/>
|
|
15
|
+
<input {...props} className={'ui-checkbox' + (props.className ? ' ' + props.className : '')} type={type} ref={ref}/>
|
|
16
16
|
<span className={'ui-checkbox-indicator ' + styles['indicator']}/>
|
|
17
17
|
<span className={'ui-checkbox-text ' + styles['text']}>{placeholder}</span>
|
|
18
18
|
</div>}
|
|
@@ -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
|
|
|
@@ -17,13 +17,12 @@
|
|
|
17
17
|
.element {
|
|
18
18
|
align-self: stretch;
|
|
19
19
|
width: 100%;
|
|
20
|
-
min-height: 45px;
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
.element > input, .element > textarea {
|
|
24
23
|
width: 100%;
|
|
25
24
|
height: 100%;
|
|
26
|
-
min-height:
|
|
25
|
+
min-height: 45px;
|
|
27
26
|
max-height: 500px;
|
|
28
27
|
max-height: 50dvh;
|
|
29
28
|
margin: 0;
|
package/src/Input/Input.tsx
CHANGED
|
@@ -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(
|
|
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
|
-
|
|
37
|
+
if (!props.value) return;
|
|
38
|
+
setCurrentValue(String(props.value));
|
|
38
39
|
}, [props.value]);
|
|
39
40
|
|
|
40
41
|
return(<Element {...props}>
|