@ws-serenity/text-inputs
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -16,13 +16,13 @@ import { v4 } from 'uuid'; | ||
const TextBox = forwardRef((props, ref) => { | ||
const { error, reserveSpaceForError } = props; | ||
const { error, reserveSpaceForError, label, topLabel, showRequired, className, title, ...rest } = props; | ||
const id = useRef(v4()); | ||
const errorStyles = getErrorStyles(error, reserveSpaceForError); | ||
return (React.createElement("div", { className: clsx('ws-text-box', props.className, { | ||
'ws-text-box--top-label': props.topLabel, | ||
}), title: props.title }, | ||
return (React.createElement("div", { className: clsx('ws-text-box', className, { | ||
'ws-text-box--top-label': topLabel, | ||
}), title: title }, | ||
React.createElement("label", { htmlFor: id.current, className: 'ws-text-box__label' }, | ||
props.label, | ||
props.showRequired && | ||
label, | ||
showRequired && | ||
React.createElement("span", { className: 'ws-text-box__label--required' }, ' *')), | ||
React.createElement("input", { id: id.current, ref: ref, ...props, className: clsx('ws-text-box__field', { | ||
React.createElement("input", { id: id.current, ref: ref, ...rest, className: clsx('ws-text-box__field', { | ||
'ws-text-box__field--error': error !== undefined, | ||
@@ -34,16 +34,16 @@ }) }), | ||
const TextArea = forwardRef((props, ref) => { | ||
const { error, reserveSpaceForError } = props; | ||
const { error, reserveSpaceForError, label, topLabel, showRequired, className, title, ...rest } = props; | ||
const id = useRef(v4()); | ||
const errorStyles = getErrorStyles(error, reserveSpaceForError); | ||
return (React.createElement("div", { className: clsx('ws-textarea', props.className, { | ||
'ws-textarea--top-label': props.topLabel, | ||
}), title: props.title }, | ||
props.label && | ||
return (React.createElement("div", { className: clsx('ws-textarea', className, { | ||
'ws-textarea--top-label': topLabel, | ||
}), title: title }, | ||
label && | ||
React.createElement("label", { htmlFor: id.current, className: 'ws-textarea__label' }, | ||
props.label, | ||
props.showRequired && | ||
label, | ||
showRequired && | ||
React.createElement("span", { className: 'ws-textarea__label--required' }, ' *')), | ||
React.createElement("textarea", { id: id.current, ref: ref, className: clsx('ws-textarea__field', { | ||
React.createElement("textarea", { id: id.current, ref: ref, ...rest, className: clsx('ws-textarea__field', { | ||
'ws-textarea__field--error': error !== undefined, | ||
}), ...props }), | ||
}) }), | ||
React.createElement("p", { className: 'ws-textarea__error', style: errorStyles }, !!error ? error : NO_BREAK_SPACE))); | ||
@@ -50,0 +50,0 @@ }); |
{ | ||
"name": "@ws-serenity/text-inputs", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "engines": { |
Sorry, the diff of this file is not supported yet
8224