Merge pull request #57 from utopia-os/textarea-required-option

feat(source): textarea required option
This commit is contained in:
antontranelis 2024-11-29 18:10:53 +01:00 committed by GitHub
commit bbaaa93ef2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 4 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "utopia-ui",
"version": "3.0.30",
"version": "3.0.32",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "utopia-ui",
"version": "3.0.30",
"version": "3.0.32",
"license": "GPL-3.0-only",
"dependencies": {
"@heroicons/react": "^2.0.17",

View File

@ -1,6 +1,6 @@
{
"name": "utopia-ui",
"version": "3.0.30",
"version": "3.0.32",
"description": "Reuseable React Components to build mapping apps for real life communities and networks",
"repository": "https://github.com/utopia-os/utopia-ui",
"homepage:": "https://utopia-os.org/",

View File

@ -15,6 +15,7 @@ type TextAreaProps = {
inputStyle?: string
defaultValue: string
placeholder?: string
required?: boolean
updateFormValue?: (value: string) => void
}
@ -30,6 +31,7 @@ export function TextAreaInput({
inputStyle,
defaultValue,
placeholder,
required = true,
updateFormValue,
}: TextAreaProps) {
const ref = useRef<HTMLTextAreaElement>(null)
@ -90,7 +92,7 @@ export function TextAreaInput({
</label>
) : null}
<textarea
required
required={required}
ref={ref}
value={inputValue}
name={dataField}

View File

@ -18,6 +18,7 @@ export const ProfileTextForm = ({
heading,
size,
hideInputLabel,
required,
}: {
state: FormState
setState: React.Dispatch<React.SetStateAction<any>>
@ -25,6 +26,7 @@ export const ProfileTextForm = ({
heading: string
size: string
hideInputLabel: boolean
required?: boolean
}) => {
const [field, setField] = useState<string>(dataField || 'text')
@ -57,6 +59,7 @@ export const ProfileTextForm = ({
labelStyle={hideInputLabel ? 'tw-hidden' : ''}
containerStyle={size === 'full' ? 'tw-grow tw-h-full' : ''}
inputStyle={size === 'full' ? 'tw-h-full' : 'tw-h-24'}
required={required}
/>
</div>
)