cfa29ad5cb
Mirror to GitHub / mirror (push) Successful in 19s
Test and Lint / backend-test (push) Successful in 1m12s
continuous-integration/drone/push Build is passing
Test and Lint / frontend-test (push) Successful in 2m6s
Version and Release / version-bump (push) Successful in 33s
Version and Release / trigger-drone (push) Successful in 2s
- Enable JSON module imports in TypeScript config to fix frontend version display - Fix archive page showing '00' instead of '0' for empty photo counts - Add null safety to archive photo count calculation - Update email processor to reinitialize on config changes - Add auto-retry for failed email transporter initialization 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
81 lines
2.1 KiB
TypeScript
81 lines
2.1 KiB
TypeScript
import React from 'react';
|
|
import { clsx } from 'clsx';
|
|
|
|
interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
label?: string;
|
|
error?: string;
|
|
helperText?: string;
|
|
leftIcon?: React.ReactNode;
|
|
rightIcon?: React.ReactNode;
|
|
}
|
|
|
|
export const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
(
|
|
{
|
|
className,
|
|
label,
|
|
error,
|
|
helperText,
|
|
leftIcon,
|
|
rightIcon,
|
|
id,
|
|
...props
|
|
},
|
|
ref
|
|
) => {
|
|
const inputId = id || `input-${Math.random().toString(36).substr(2, 9)}`;
|
|
|
|
return (
|
|
<div className="w-full">
|
|
{label && (
|
|
<label
|
|
htmlFor={inputId}
|
|
className="block text-sm font-medium text-neutral-700 mb-1.5"
|
|
>
|
|
{label}
|
|
</label>
|
|
)}
|
|
<div className="relative">
|
|
{leftIcon && (
|
|
<div className="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
|
<span className="text-neutral-500">{leftIcon}</span>
|
|
</div>
|
|
)}
|
|
<input
|
|
ref={ref}
|
|
id={inputId}
|
|
className={clsx(
|
|
'input',
|
|
leftIcon && 'pl-10',
|
|
rightIcon && 'pr-10',
|
|
error && 'border-red-500 focus-visible:ring-red-500',
|
|
className
|
|
)}
|
|
aria-invalid={error ? 'true' : 'false'}
|
|
aria-describedby={
|
|
error ? `${inputId}-error` : helperText ? `${inputId}-helper` : undefined
|
|
}
|
|
{...props}
|
|
/>
|
|
{rightIcon && (
|
|
<div className="absolute inset-y-0 right-0 pr-3 flex items-center">
|
|
<span className="text-neutral-500">{rightIcon}</span>
|
|
</div>
|
|
)}
|
|
</div>
|
|
{error && (
|
|
<p id={`${inputId}-error`} className="mt-1.5 text-sm text-red-600">
|
|
{error}
|
|
</p>
|
|
)}
|
|
{helperText && !error && (
|
|
<p id={`${inputId}-helper`} className="mt-1.5 text-sm text-neutral-500">
|
|
{helperText}
|
|
</p>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|
|
);
|
|
|
|
Input.displayName = 'Input'; |