diff --git a/.formatter.exs b/.formatter.exs index 371af6a..8e4ccbe 100644 --- a/.formatter.exs +++ b/.formatter.exs @@ -3,5 +3,6 @@ Phoenix.LiveView.HTMLFormatter ], import_deps: [:phoenix], - inputs: ["*.{ex,exs}", "{config,lib,test}/**/*.{heex,ex,exs}"] + inputs: ["*.{ex,exs}", "{config,lib,test}/**/*.{heex,ex,exs}"], + migrate_eex_to_curly_interpolation: false ] diff --git a/lib/support/live_select_web/components/layouts/app.html.heex b/lib/support/live_select_web/components/layouts/app.html.heex index b1878d3..58b9764 100644 --- a/lib/support/live_select_web/components/layouts/app.html.heex +++ b/lib/support/live_select_web/components/layouts/app.html.heex @@ -1,15 +1,15 @@
- <%= if live_flash(@flash, :info) do %> + <%= if Phoenix.Flash.get(@flash, :info) do %> <% end %> - <%= if live_flash(@flash, :error) do %> + <%= if Phoenix.Flash.get(@flash, :error) do %> <% end %> - <%= @inner_content %> + {@inner_content}
diff --git a/lib/support/live_select_web/components/layouts/root.html.heex b/lib/support/live_select_web/components/layouts/root.html.heex index a75ce76..10a8687 100644 --- a/lib/support/live_select_web/components/layouts/root.html.heex +++ b/lib/support/live_select_web/components/layouts/root.html.heex @@ -6,13 +6,13 @@ <.live_title suffix=" ยท Showcase"> - <%= assigns[:page_title] || "LiveSelect" %> + {assigns[:page_title] || "LiveSelect"} - <%= @inner_content %> + {@inner_content} diff --git a/lib/support/live_select_web/live/live_component_form.ex b/lib/support/live_select_web/live/live_component_form.ex index a15f104..a2cd67c 100644 --- a/lib/support/live_select_web/live/live_component_form.ex +++ b/lib/support/live_select_web/live/live_component_form.ex @@ -21,10 +21,10 @@ defmodule LiveSelectWeb.LiveComponentForm do <.form for={@form} phx-submit="submit" phx-change="change" phx-target={@myself}> <.live_select field={@form[:city_search]} mode={:tags} phx-target={@myself}> <:option :let={option}> - with custom slot: <%= option.label %> + with custom slot: {option.label} <:tag :let={option}> - with custom slot: <%= option.label %> + with custom slot: {option.label} <.live_select field={@form[:city_search_custom_clear_single]} phx-target={@myself} allow_clear> @@ -42,7 +42,7 @@ defmodule LiveSelectWeb.LiveComponentForm do custom clear button - <%= submit("Submit", class: "btn btn-primary") %> + {submit("Submit", class: "btn btn-primary")} """ diff --git a/lib/support/live_select_web/live/showcase_live.ex b/lib/support/live_select_web/live/showcase_live.ex index 30a44c5..c31b186 100644 --- a/lib/support/live_select_web/live/showcase_live.ex +++ b/lib/support/live_select_web/live/showcase_live.ex @@ -226,6 +226,7 @@ defmodule LiveSelectWeb.ShowcaseLive do end end + @spec live_select(nil | maybe_improper_list() | map()) :: Phoenix.LiveView.Rendered.t() def live_select(assigns) do opts = assigns[:opts] @@ -241,10 +242,10 @@ defmodule LiveSelectWeb.ShowcaseLive do ~H"""
<.live_select -
   field={my_form[:city_search]} +
   field={my_form[:city_search]} <%= for {key, value} <- @opts, !is_nil(value) do %> <%= if value == true do %> -
   <%= key %> +
   {key} <% else %>
   <%= key %>=<%= @format_value.(value) %> <% end %> diff --git a/lib/support/live_select_web/live/showcase_live.html.heex b/lib/support/live_select_web/live/showcase_live.html.heex index c0a36e8..bbeb267 100644 --- a/lib/support/live_select_web/live/showcase_live.html.heex +++ b/lib/support/live_select_web/live/showcase_live.html.heex @@ -39,126 +39,126 @@ <.form for={@settings_form} phx-change="update-settings" id="settings-form">
- <%= label(@settings_form, :mode, "Mode:", class: "label label-text font-semibold") %> - <%= select(@settings_form, :mode, [:single, :tags], + {label(@settings_form, :mode, "Mode:", class: "label label-text font-semibold")} + {select(@settings_form, :mode, [:single, :tags], class: "select select-sm select-bordered text-xs" - ) %> + )}
- <%= label(@settings_form, :max_selectable, "Max selectable:", + {label(@settings_form, :max_selectable, "Max selectable:", class: "label label-text font-semibold" - ) %> - <%= number_input(@settings_form, :max_selectable, + )} + {number_input(@settings_form, :max_selectable, min: 0, class: "input input-sm input-bordered", disabled: to_string(@settings_form[:mode].value) == "single" - ) %> - <%= error_tag(@settings_form, :max_selectable) %> + )} + {error_tag(@settings_form, :max_selectable)}
<%= label class: "label cursor-pointer" do %> Disabled:  - <%= checkbox(@settings_form, :disabled, class: "toggle") %> + {checkbox(@settings_form, :disabled, class: "toggle")} <% end %>
- <%= label(@settings_form, :search_delay, "Search delay in ms:", + {label(@settings_form, :search_delay, "Search delay in ms:", class: "label label-text font-semibold" - ) %> - <%= number_input(@settings_form, :search_delay, + )} + {number_input(@settings_form, :search_delay, min: 0, class: "input input-sm input-bordered", spellcheck: "false" - ) %> - <%= error_tag(@settings_form, :search_delay) %> + )} + {error_tag(@settings_form, :search_delay)}
- <%= label(@settings_form, :placeholder, "placeholder:", + {label(@settings_form, :placeholder, "placeholder:", class: "label label-text font-semibold" - ) %> - <%= text_input(@settings_form, :placeholder, + )} + {text_input(@settings_form, :placeholder, class: "input input-sm input-bordered", spellcheck: "false" - ) %> - <%= label(@settings_form, :placeholder, default_value_descr(:placeholder), + )} + {label(@settings_form, :placeholder, default_value_descr(:placeholder), class: "label label-text" - ) %> - <%= error_tag(@settings_form, :placeholder) %> + )} + {error_tag(@settings_form, :placeholder)}
- <%= label(@settings_form, :update_min_len, "update_min_len:", + {label(@settings_form, :update_min_len, "update_min_len:", class: "label label-text font-semibold" - ) %> - <%= number_input(@settings_form, :update_min_len, + )} + {number_input(@settings_form, :update_min_len, min: 0, class: "input input-sm input-bordered", spellcheck: "false" - ) %> + )} - <%= error_tag(@settings_form, :update_min_len) %> + {error_tag(@settings_form, :update_min_len)}
- <%= label(@settings_form, :debounce, "debounce:", + {label(@settings_form, :debounce, "debounce:", class: "label label-text font-semibold" - ) %> - <%= number_input(@settings_form, :debounce, + )} + {number_input(@settings_form, :debounce, min: 0, class: "input input-sm input-bordered", spellcheck: "false" - ) %> + )} - <%= error_tag(@settings_form, :debounce) %> + {error_tag(@settings_form, :debounce)}
- <%= label(@settings_form, :"phx-focus", "focus event:", + {label(@settings_form, :"phx-focus", "focus event:", class: "label label-text font-semibold" - ) %> - <%= text_input(@settings_form, :"phx-focus", + )} + {text_input(@settings_form, :"phx-focus", class: "input input-sm input-bordered", spellcheck: "false" - ) %> + )} - <%= error_tag(@settings_form, :"phx-focus") %> + {error_tag(@settings_form, :"phx-focus")}
- <%= label(@settings_form, :"phx-blur", "blur event:", + {label(@settings_form, :"phx-blur", "blur event:", class: "label label-text font-semibold" - ) %> - <%= text_input(@settings_form, :"phx-blur", + )} + {text_input(@settings_form, :"phx-blur", class: "input input-sm input-bordered", spellcheck: "false" - ) %> + )} - <%= error_tag(@settings_form, :"phx-blur") %> + {error_tag(@settings_form, :"phx-blur")}
<%= label class: "label cursor-pointer" do %> style:  - <%= select(@settings_form, :style, [:tailwind, :daisyui, :none], + {select(@settings_form, :style, [:tailwind, :daisyui, :none], class: "select select-sm select-bordered text-xs" - ) %> + )} <% end %>
@@ -169,13 +169,13 @@ border-base-300 bg-base-100 rounded-box" } > - <%= checkbox(@settings_form, :show_styles, + {checkbox(@settings_form, :show_styles, phx_change: "toggle-styles", class: "w-full", value: @show_styles - ) %> + )}
- <%= if @show_styles, do: "Hide styling options", else: "Show styling options" %>   + {if @show_styles, do: "Hide styling options", else: "Show styling options"}