d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
'use client'
|
|
|
|
import { useState } from 'react'
|
|
import { ChipInput, type ChipInputProps, cn } from '@sim/emcn'
|
|
import { Eye, EyeOff } from 'lucide-react'
|
|
import { AUTH_CONTROL_HEIGHT } from '@/app/(auth)/components/constants'
|
|
|
|
type PasswordInputProps = Omit<ChipInputProps, 'type' | 'icon' | 'endAdornment'>
|
|
|
|
/**
|
|
* A {@link ChipInput} that owns the password reveal toggle — the eye button is
|
|
* driven through the canonical `endAdornment` slot and the field's invalid state
|
|
* through the `error` prop, so no consumer hand-rolls the relative wrapper +
|
|
* absolutely positioned button the auth forms previously duplicated four times.
|
|
*/
|
|
export function PasswordInput({ error, className, ...props }: PasswordInputProps) {
|
|
const [visible, setVisible] = useState(false)
|
|
|
|
return (
|
|
<ChipInput
|
|
{...props}
|
|
className={cn(AUTH_CONTROL_HEIGHT, className)}
|
|
type={visible ? 'text' : 'password'}
|
|
error={error}
|
|
endAdornment={
|
|
<button
|
|
type='button'
|
|
onClick={() => setVisible((v) => !v)}
|
|
aria-label={visible ? 'Hide password' : 'Show password'}
|
|
className='flex shrink-0 text-[var(--text-icon)] transition-colors hover:text-[var(--text-primary)]'
|
|
>
|
|
{visible ? <EyeOff className='size-[14px]' /> : <Eye className='size-[14px]' />}
|
|
</button>
|
|
}
|
|
/>
|
|
)
|
|
}
|