Viewport: - Add `viewport` export with `viewport-fit=cover` (enables CSS safe-area-inset-* on bezel-less iOS/Android) and `interactive-widget=resizes-content` (prevents layout jumps from virtual keyboard open/close) iOS zoom prevention: - input.tsx, textarea.tsx: change text-sm (14px) → text-base sm:text-sm (16px) on mobile; iOS Safari auto-zooms any input with font-size < 16px Touch targets: - button.tsx: default h-10 → h-11 (44px), sm h-8 → h-9 (36px), icon h-10→h-11 matching the 44×44px iOS HIG and WCAG 2.5.5 minimum - Add touch-manipulation to buttons, inputs, textarea to eliminate 300ms tap delay Dialog → mobile bottom sheet: - On mobile (< 640px): anchored to bottom with full width, rounded top corners, slide-in-from-bottom / slide-out-to-bottom animation, drag handle affordance, max-h-[90svh] + overflow-y-auto to prevent viewport overflow - Safe area padding: pb-[max(1.25rem,env(safe-area-inset-bottom))] - On desktop (sm+): unchanged centered modal with zoom animation - Close button gets a 32×32 tap area on mobile Mobile navigation: - New bottom-nav.tsx: persistent 3-tab bottom bar (مسیر/مرکز/لیگ) shown below md: breakpoint, hidden on desktop; 56px height + safe-area-inset-bottom; active tab gets heavier stroke and scale - Only shown for authenticated non-admin users - app-shell.tsx: injects BottomNav; main content gets dynamic padding-bottom to clear the bar (56px + safe area) on mobile, reverts to py-10 on md: - Footer: safe-area-inset-bottom padding so content clears iPhone home indicator Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
50 lines
1.8 KiB
TypeScript
50 lines
1.8 KiB
TypeScript
import * as React from "react";
|
|
import { cn } from "@/lib/utils";
|
|
|
|
const LATIN_INPUT_TYPES = new Set(["password", "email", "url", "tel"]);
|
|
|
|
function wantsLatinDigits(props: React.InputHTMLAttributes<HTMLInputElement>): boolean {
|
|
const type = props.type ?? "text";
|
|
if (LATIN_INPUT_TYPES.has(type)) return true;
|
|
if (props.dir === "ltr") return true;
|
|
const ac = (props.autoComplete ?? "").toLowerCase();
|
|
if (
|
|
ac === "username" ||
|
|
ac === "email" ||
|
|
ac.includes("password") ||
|
|
ac === "one-time-code" ||
|
|
ac === "tel" ||
|
|
ac === "url"
|
|
) {
|
|
return true;
|
|
}
|
|
const id = `${props.id ?? ""} ${props.name ?? ""}`.toLowerCase();
|
|
if (id.includes("captcha") || id.includes("password") || id.includes("username") || id.includes("email")) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
const Input = React.forwardRef<HTMLInputElement, React.InputHTMLAttributes<HTMLInputElement>>(
|
|
({ className, type, ...props }, ref) => {
|
|
const latin = wantsLatinDigits({ type, ...props });
|
|
return (
|
|
<input
|
|
type={type}
|
|
className={cn(
|
|
// Fixed height + symmetric vertical padding; avoid clipping Vazirmatn descenders.
|
|
// text-base (16px) prevents iOS Safari auto-zoom on focus; sm: downsizes on desktop
|
|
"box-border h-11 w-full rounded-lg border border-input bg-card px-3.5 py-0 font-sans text-base sm:text-sm font-medium leading-none outline-none transition-colors touch-manipulation placeholder:font-sans placeholder:font-medium placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
latin && "font-latin placeholder:font-latin",
|
|
className
|
|
)}
|
|
ref={ref}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
);
|
|
Input.displayName = "Input";
|
|
|
|
export { Input };
|