diff --git a/components/checkbox/Checkbox.js b/components/checkbox/Checkbox.js
index a17a2ac64..ebd6e9be0 100644
--- a/components/checkbox/Checkbox.js
+++ b/components/checkbox/Checkbox.js
@@ -10,6 +10,7 @@ import checkFactory from './Check';
const factory = (Check) => {
class Checkbox extends Component {
+
static propTypes = {
checked: PropTypes.bool,
children: PropTypes.node,
@@ -38,6 +39,11 @@ const factory = (Check) => {
disabled: false,
};
+ constructor(props) {
+ super(props);
+ this._id = uuidv4();
+ }
+
handleToggle = (event) => {
if (event.pageX !== 0 && event.pageY !== 0) this.blur();
if (!this.props.disabled && this.props.onChange) {
@@ -63,8 +69,8 @@ const factory = (Check) => {
const className = classnames(theme.field, {
[theme.disabled]: this.props.disabled,
}, this.props.className);
- const inputId = `input_${uuidv4()}`;
- const labelId = `label_${uuidv4()}`;
+ const inputId = `input_${this._id}`;
+ const labelId = `label_${this._id}`;
return (
: null}
{hint ? {hint} : null}
- {error ? {error} : null}
+
{maxLength ? {length}/{maxLength} : null}
+ {error
+ ?
+ {error}
+
+ : null}
+ {description
+ ?
+ {description}
+
+ : null}
{children}
);
diff --git a/components/input/theme.css b/components/input/theme.css
index a39cb8741..a4f3b0f4a 100644
--- a/components/input/theme.css
+++ b/components/input/theme.css
@@ -144,11 +144,20 @@
}
.error,
+.description,
.counter {
- color: var(--input-text-error-color);
font-size: var(--input-label-font-size);
line-height: var(--input-underline-height);
- margin-bottom: calc(-1 * var(--input-underline-height));
+}
+
+.error {
+ color: var(--input-text-error-color);
+ display: block;
+}
+
+.description {
+ color: var(--input-text-label-color);
+ display: block;
}
.counter {
@@ -157,6 +166,10 @@
right: 0;
}
+.withCounter {
+ padding-right: 3.125rem;
+}
+
.disabled > .inputElement {
border-bottom-style: dotted;
color: var(--input-text-disabled-text-color);
diff --git a/components/radio/RadioButton.js b/components/radio/RadioButton.js
index 4ae64ead4..7e765df97 100644
--- a/components/radio/RadioButton.js
+++ b/components/radio/RadioButton.js
@@ -9,6 +9,7 @@ import radioFactory from './Radio';
const factory = (Radio) => {
class RadioButton extends Component {
+
static propTypes = {
checked: PropTypes.bool,
children: PropTypes.node,
@@ -39,6 +40,11 @@ const factory = (Radio) => {
disabled: false,
};
+ constructor(props) {
+ super(props);
+ this._id = uuidv4();
+ }
+
handleClick = (event) => {
const { checked, disabled, onChange } = this.props;
if (event.pageX !== 0 && event.pageY !== 0) this.blur();
@@ -72,8 +78,8 @@ const factory = (Radio) => {
...others
} = this.props;
const _className = classnames(theme[this.props.disabled ? 'disabled' : 'field'], className);
- const inputId = `input_${uuidv4()}`;
- const labelId = `label_${uuidv4()}`;
+ const inputId = `input_${this._id}`;
+ const labelId = `label_${this._id}`;
return (