Extract input logic into separate InputItem element