optimizations
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React, { forwardRef } from 'react'
|
||||
import React, { forwardRef, useId } from 'react'
|
||||
|
||||
/**
|
||||
* Nova TextInput
|
||||
@@ -26,7 +26,11 @@ const TextInput = forwardRef(function TextInput(
|
||||
},
|
||||
ref,
|
||||
) {
|
||||
const inputId = id ?? (label ? label.toLowerCase().replace(/\s+/g, '-') : undefined)
|
||||
const generatedId = useId()
|
||||
const labelSlug = typeof label === 'string'
|
||||
? label.toLowerCase().replace(/\s+/g, '-')
|
||||
: null
|
||||
const inputId = id ?? labelSlug ?? `text-input-${generatedId.replace(/[:]/g, '')}`
|
||||
|
||||
const sizeClass = {
|
||||
sm: 'py-1.5 text-xs',
|
||||
|
||||
Reference in New Issue
Block a user