TorbatYar/frontend/components/ds/FormControls.tsx
Mortezakoohjani 12c8615615 Ship enterprise Accounting FE/API with CRUD parity and production wiring.
Adds accounting-service PATCH/archive, fiscal helpers, COA templates and setup status, plus SuperApp Accounting UI (DS, scoreboard, masters, vouchers, ledger, ops modules) with session refresh and HTTPS public API URLs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-24 15:26:43 +03:30

82 lines
2.1 KiB
TypeScript

"use client";
import * as React from "react";
import { cn } from "@/lib/utils";
export function Select({
className,
children,
...props
}: React.SelectHTMLAttributes<HTMLSelectElement>) {
return (
<select
className={cn(
"flex h-10 w-full rounded-xl border border-[var(--border)] bg-[var(--surface)] px-3 text-sm text-secondary",
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",
"disabled:cursor-not-allowed disabled:opacity-50",
className
)}
{...props}
>
{children}
</select>
);
}
export function FormField({
label,
error,
children,
className,
}: {
label?: string;
error?: string;
children: React.ReactNode;
className?: string;
}) {
return (
<div className={cn("space-y-1.5", className)}>
{label ? <label className="block text-sm font-medium text-secondary">{label}</label> : null}
{children}
{error ? <p className="text-xs text-red-600">{error}</p> : null}
</div>
);
}
export function Checkbox({
label,
className,
...props
}: React.InputHTMLAttributes<HTMLInputElement> & { label?: string }) {
return (
<label className={cn("flex items-center gap-2 text-sm text-secondary", className)}>
<input
type="checkbox"
className="h-4 w-4 rounded border-[var(--border)] text-primary focus:ring-primary/30"
{...props}
/>
{label}
</label>
);
}
export function MoneyInput({
className,
...props
}: Omit<React.InputHTMLAttributes<HTMLInputElement>, "type">) {
return (
<input
type="text"
inputMode="decimal"
dir="ltr"
className={cn(
"flex h-10 w-full rounded-xl border border-[var(--border)] bg-[var(--surface)] px-3 py-2 text-sm tabular-nums text-secondary",
"placeholder:text-[var(--muted)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",
"disabled:cursor-not-allowed disabled:opacity-50",
className
)}
{...props}
/>
);
}