diff --git a/components/form/field/TypeInput.tsx b/components/form/field/TypeInput.tsx index ced55ac..09d5a14 100644 --- a/components/form/field/TypeInput.tsx +++ b/components/form/field/TypeInput.tsx @@ -100,8 +100,17 @@ export const TypeInput: React.FC = ({ <> { - console.log(value); + if (disabled) return; fm.data[name] = value; fm.render(); if (typeof onChange === "function") { diff --git a/components/ui/MaskedInput.tsx b/components/ui/MaskedInput.tsx index c173d17..1083d7e 100644 --- a/components/ui/MaskedInput.tsx +++ b/components/ui/MaskedInput.tsx @@ -3,13 +3,21 @@ import React, { useRef, useState } from "react"; interface MaskedInputProps { value: string; onChange: (value: any) => void; + disabled?: boolean; + className?: string; } -const MaskedInput: React.FC = ({ value, onChange }) => { +const MaskedInput: React.FC = ({ + value, + onChange, + disabled = false, + className, +}) => { const inputRef = useRef(null); // Referensi ke elemen input const [localValue, setLocalValue] = useState(value); // State lokal untuk kontrol input const handleInputChange = (e: React.ChangeEvent) => { + if (disabled) return; let input = e.target.value; // Hapus semua karakter non-digit @@ -61,9 +69,13 @@ const MaskedInput: React.FC = ({ value, onChange }) => { id="time" type="text" value={localValue} + disabled={disabled} onChange={handleInputChange} - placeholder="__:__" - className="w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring focus:ring-blue-300 focus:border-blue-500" + placeholder={disabled ? "" : "__:__"} + className={cx( + "w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring focus:ring-blue-300 focus:border-blue-500", + className + )} /> ); };