Current section
41 Versions
Jump to
Current section
41 Versions
Compare versions
3
files changed
+32
additions
-6
deletions
| @@ -1,7 +1,7 @@ | |
| 1 1 | {<<"links">>, |
| 2 2 | [{<<"GitHub">>,<<"https://github.com/phcurado/daisy_ui_components">>}]}. |
| 3 3 | {<<"name">>,<<"daisy_ui_components">>}. |
| 4 | - {<<"version">>,<<"0.4.2">>}. |
| 4 | + {<<"version">>,<<"0.4.3">>}. |
| 5 5 | {<<"description">>,<<"DaisyUI component library for LiveView">>}. |
| 6 6 | {<<"elixir">>,<<"~> 1.14">>}. |
| 7 7 | {<<"app">>,<<"daisy_ui_components">>}. |
| @@ -20,7 +20,7 @@ defmodule DaisyUIComponents.Input do | |
| 20 20 | <.input name="my-input" type="checkbox" value="false" /> |
| 21 21 | """ |
| 22 22 | attr :id, :any, default: nil |
| 23 | - # attr :name, :any |
| 23 | + attr :name, :any |
| 24 24 | attr :label, :string |
| 25 25 | attr :value, :any |
| 26 26 | |
| @@ -43,7 +43,7 @@ defmodule DaisyUIComponents.Input do | |
| 43 43 | attr :multiple, :boolean, default: false, doc: "the multiple flag for select inputs" |
| 44 44 | |
| 45 45 | attr :rest, :global, |
| 46 | - include: ~w(name autocomplete cols disabled form list max maxlength min minlength |
| 46 | + include: ~w(autocomplete cols disabled form list max maxlength min minlength |
| 47 47 | pattern placeholder readonly required rows size step) |
| 48 48 | |
| 49 49 | slot :inner_block |
| @@ -70,22 +70,40 @@ defmodule DaisyUIComponents.Input do | |
| 70 70 | assigns = |
| 71 71 | assigns |
| 72 72 | |> assign_new(:value, fn -> nil end) |
| 73 | + |> assign_new(:name, fn -> nil end) |
| 73 74 | |> assign_new(:checked, fn -> |
| 74 75 | Phoenix.HTML.Form.normalize_value("checkbox", assigns[:value]) |
| 75 76 | end) |
| 76 77 | |
| 77 78 | ~H""" |
| 78 | - <.checkbox id={@id} class={@class} color={@color} checked={@checked} value={@value} {@rest} /> |
| 79 | + <.checkbox |
| 80 | + id={@id} |
| 81 | + name={@name} |
| 82 | + class={@class} |
| 83 | + color={@color} |
| 84 | + checked={@checked} |
| 85 | + value={@value} |
| 86 | + {@rest} |
| 87 | + /> |
| 79 88 | """ |
| 80 89 | end |
| 81 90 | |
| 82 91 | def input(%{type: "select"} = assigns) do |
| 83 92 | assigns = |
| 84 93 | assigns |
| 94 | + |> assign_new(:name, fn -> nil end) |
| 85 95 | |> assign_new(:value, fn -> nil end) |
| 86 96 | |
| 87 97 | ~H""" |
| 88 | - <.select id={@id} class={@class} color={@color} bordered={@bordered} multiple={@multiple} {@rest}> |
| 98 | + <.select |
| 99 | + id={@id} |
| 100 | + name={@name} |
| 101 | + class={@class} |
| 102 | + color={@color} |
| 103 | + bordered={@bordered} |
| 104 | + multiple={@multiple} |
| 105 | + {@rest} |
| 106 | + > |
| 89 107 | <option :if={@prompt} value="">{@prompt}</option> |
| 90 108 | {Phoenix.HTML.Form.options_for_select(@options, @value)} |
| 91 109 | </.select> |
| @@ -93,9 +111,14 @@ defmodule DaisyUIComponents.Input do | |
| 93 111 | end |
| 94 112 | |
| 95 113 | def input(%{type: "textarea"} = assigns) do |
| 114 | + assigns = |
| 115 | + assigns |
| 116 | + |> assign_new(:name, fn -> nil end) |
| 117 | + |
| 96 118 | ~H""" |
| 97 119 | <.textarea |
| 98 120 | id={@id} |
| 121 | + name={@name} |
| 99 122 | class={@class} |
| 100 123 | color={@color} |
| 101 124 | bordered={@bordered} |
| @@ -113,6 +136,7 @@ defmodule DaisyUIComponents.Input do | |
| 113 136 | ~H""" |
| 114 137 | <.range |
| 115 138 | id={@id} |
| 139 | + name={@name} |
| 116 140 | class={@class} |
| 117 141 | color={@color} |
| 118 142 | value={Phoenix.HTML.Form.normalize_value(@type, @value)} |
| @@ -125,11 +149,13 @@ defmodule DaisyUIComponents.Input do | |
| 125 149 | def input(assigns) do |
| 126 150 | assigns = |
| 127 151 | assigns |
| 152 | + |> assign_new(:name, fn -> nil end) |
| 128 153 | |> assign_new(:value, fn -> nil end) |
| 129 154 | |
| 130 155 | ~H""" |
| 131 156 | <.text_input |
| 132 157 | id={@id} |
| 158 | + name={@name} |
| 133 159 | class={@class} |
| 134 160 | color={@color} |
| 135 161 | bordered={@bordered} |
| @@ -2,7 +2,7 @@ defmodule DaisyUIComponents.MixProject do | |
| 2 2 | use Mix.Project |
| 3 3 | |
| 4 4 | @source_url "https://github.com/phcurado/daisy_ui_components" |
| 5 | - @version "0.4.2" |
| 5 | + @version "0.4.3" |
| 6 6 | |
| 7 7 | def project do |
| 8 8 | [ |