Make sure output inputs have unique ids

This commit is contained in:
Jonatan Kłosko 2024-03-25 20:07:16 +07:00
parent e892d9dea0
commit c67095bbe1

View file

@ -154,6 +154,7 @@ defmodule LivebookWeb.Output.InputComponent do
~H""" ~H"""
<div class="w-60"> <div class="w-60">
<.select_field <.select_field
id={@id}
name="html_value" name="html_value"
value={Enum.find_index(@attrs.options, fn {key, _label} -> key == @value end)} value={Enum.find_index(@attrs.options, fn {key, _label} -> key == @value end)}
options={Enum.with_index(@attrs.options, fn {_key, label}, idx -> {label, idx} end)} options={Enum.with_index(@attrs.options, fn {_key, label}, idx -> {label, idx} end)}
@ -179,6 +180,7 @@ defmodule LivebookWeb.Output.InputComponent do
type="range" type="range"
data-el-input data-el-input
class="range-input" class="range-input"
id={@id}
name="html_value" name="html_value"
value={@value} value={@value}
phx-debounce={@attrs.debounce} phx-debounce={@attrs.debounce}
@ -234,6 +236,7 @@ defmodule LivebookWeb.Output.InputComponent do
<.text_field <.text_field
type="date" type="date"
data-el-input data-el-input
id={@id}
name="html_value" name="html_value"
value={@value} value={@value}
phx-debounce="blur" phx-debounce="blur"
@ -253,6 +256,7 @@ defmodule LivebookWeb.Output.InputComponent do
type="color" type="color"
class="h-12" class="h-12"
data-el-input data-el-input
id={@id}
name="html_value" name="html_value"
value={to_string(@value)} value={to_string(@value)}
phx-debounce={@attrs.debounce} phx-debounce={@attrs.debounce}
@ -271,6 +275,7 @@ defmodule LivebookWeb.Output.InputComponent do
<.text_field <.text_field
type={html_input_type(@attrs.type)} type={html_input_type(@attrs.type)}
data-el-input data-el-input
id={@id}
name="html_value" name="html_value"
value={to_string(@value)} value={to_string(@value)}
phx-debounce={@attrs.debounce} phx-debounce={@attrs.debounce}