import { useState } from 'react' import { useFormContext } from 'react-hook-form' import { FormControl, FormField } from 'ui' import { Input } from 'ui-patterns/DataInputs/Input' import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' import { InlineLinkClassName } from '@/components/ui/InlineLink' import { generateStrongPassword } from '@/lib/project' interface RolePasswordFieldProps { /** Whether leaving the field empty is allowed. Defaults to true. */ isOptional?: boolean /** Whether the role already exists, so it may already have a password. Defaults to false. */ isExistingRole?: boolean layout?: 'horizontal' | 'vertical' } /** * Password field for a role form. Render it inside a `