import React from "react"; import { Input } from "../ui/input"; import { Label } from "../ui/label"; import { Checkbox } from "../ui/checkbox"; import type { NutritionManualFieldSpec } from "../../lib/nutritionManualEntry"; function isTruthyNutritionFlag(raw: string): boolean { const v = String(raw ?? "").trim().toLowerCase(); return v === "true" || v === "1" || v === "yes" || v === "on"; } export function NutritionManualFieldControl({ spec, value, onChange, inputClassName, showLabel = true, }: { spec: NutritionManualFieldSpec; value: string; onChange: (next: string) => void; inputClassName?: string; showLabel?: boolean; }) { if (spec.inputType === "checkbox") { return (