"use client";
type AdminInputProps = {
label?: string;
error?: string;
helpText?: string;
required?: boolean;
className?: string;
children: React.ReactNode;
};
export function AdminInput({
label,
error,
helpText,
required,
className = "",
children
}: AdminInputProps) {
return (
{label && (
)}
{children}
{helpText && !error &&
{helpText}
}
{error &&
{error}
}
);
}
// Styled text input wrapper
type AdminTextInputProps = Omit, 'onChange' | 'value' | 'type'> & {
value: string | number;
onChange: (e: React.ChangeEvent) => void;
type?: string;
};
export function AdminTextInput({
value,
onChange,
type = "text",
disabled,
className = "",
maxLength,
autoComplete,
step,
min,
max,
...rest
}: AdminTextInputProps) {
return (
);
}
// Styled textarea wrapper
type AdminTextareaProps = Omit, 'onChange' | 'value'> & {
value: string | number;
onChange: (e: React.ChangeEvent) => void;
};
export function AdminTextarea({
value,
onChange,
disabled,
className = "",
...rest
}: AdminTextareaProps) {
return (
);
}
// Styled select wrapper
type AdminSelectProps = Omit, 'onChange' | 'value'> & {
value: string | number;
onChange: (e: React.ChangeEvent) => void;
options: { value: string; label: string }[];
};
export function AdminSelect({
value,
onChange,
options,
disabled,
className = "",
...rest
}: AdminSelectProps) {
return (
);
}
// Styled checkbox wrapper
type AdminCheckboxProps = {
checked: boolean;
onChange: (e: React.ChangeEvent) => void;
label: string;
disabled?: boolean;
className?: string;
};
export function AdminCheckbox({
checked,
onChange,
label,
disabled,
className = ""
}: AdminCheckboxProps) {
return (
);
}
// Loading spinner
type AdminSpinnerProps = {
size?: "sm" | "md" | "lg";
className?: string;
};
export function AdminSpinner({ size = "md", className = "" }: AdminSpinnerProps) {
const sizeClasses = {
sm: "h-4 w-4 border-2",
md: "h-6 w-6 border-2",
lg: "h-8 w-8 border-3",
};
return (
);
}
// Loading overlay
type AdminLoadingOverlayProps = {
message?: string;
};
export function AdminLoadingOverlay({ message = "Loading..." }: AdminLoadingOverlayProps) {
return (
);
}