diff --git a/assets/css/app.css b/assets/css/app.css index 0dbd7dc6c..6ebab5689 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -20,6 +20,45 @@ body { } @layer components { + .moon-input-group.horizontal > div:first-child input { + @apply ltr:rounded-tr-none ltr:rounded-br-none ltr:input-rsb-hidden ; + } + .moon-input-group.horizontal > div:first-child input:hover { + @apply ltr:rounded-moon-i-md ltr:rounded-moon-i-md; + } + .moon-input-group.horizontal > div:last-child input { + @apply ltr:rounded-tl-none ltr:rounded-bl-none ltr:input-lsb-hidden ; + } + .moon-input-group.horizontal > div:last-child input:hover { + @apply ltr:rounded-moon-i-md ltr:rounded-moon-i-md; + } + + .moon-input-group.horizontal.rtl-aware > div:first-child input { + @apply rtl:rounded-tl-none rtl:rounded-bl-none rtl:input-lsb-hidden; + } + .moon-input-group.horizontal.rtl-aware > div:first-child input:hover { + @apply rtl:rounded-moon-i-md rtl:rounded-moon-i-md; + } + .moon-input-group.horizontal.rtl-aware > div:last-child input { + @apply rtl:rounded-tr-none rtl:rounded-br-none rtl:input-rsb-hidden; + } + .moon-input-group.horizontal.rtl-aware > div:last-child input:hover { + @apply rtl:rounded-moon-i-md rtl:rounded-moon-i-md; + } + + + .moon-input-group.vertical > div:first-child input { + @apply rounded-bl-none rounded-br-none input-bbb-hidden; + } + .moon-input-group.vertical > div:first-child input:hover { + @apply rounded-moon-i-md; + } + .moon-input-group.vertical > div:last-child input { + @apply rounded-tl-none rounded-tr-none input-tbb-hidden; + } + .moon-input-group.vertical > div:last-child input:hover { + @apply rounded-moon-i-md; + } .carousel-item { scroll-snap-type: x; scroll-snap-align: start; diff --git a/assets/tailwind.config.js b/assets/tailwind.config.js index 24b31aaf0..be0da589a 100644 --- a/assets/tailwind.config.js +++ b/assets/tailwind.config.js @@ -325,7 +325,7 @@ module.exports = { "& a, & span": { padding: "0.5rem", }, - }, + } }); }), ], diff --git a/lib/moon/autolayouts/left_to_right.ex b/lib/moon/autolayouts/left_to_right.ex index b93002392..5227d4c39 100644 --- a/lib/moon/autolayouts/left_to_right.ex +++ b/lib/moon/autolayouts/left_to_right.ex @@ -7,10 +7,11 @@ defmodule Moon.Autolayouts.LeftToRight do prop class, :string, default: nil prop gap, :any, default: "gap-2" prop centered, :boolean, default: false + prop dir, :string, values: ["ltr", "rtl"], default: "ltr" def render(assigns) do ~F""" -
+
<#slot />
""" diff --git a/lib/moon/components/input_group/input_group.ex b/lib/moon/components/input_group/input_group.ex new file mode 100644 index 000000000..11eb6c997 --- /dev/null +++ b/lib/moon/components/input_group/input_group.ex @@ -0,0 +1,22 @@ +defmodule Moon.Components.InputGroup do + @moduledoc false + + use Moon.StatelessComponent + alias Moon.Components.InputGroup.Container + + prop orientation, :string, + default: "horizontal", + values: ["horizontal", "vertical"] + + prop has_fields, :boolean, default: false + + slot default, required: true, args: [:group_class_fields] + + def render(assigns) do + ~F""" + + <#slot /> + + """ + end +end diff --git a/lib/moon/components/input_group/styled/container.ex b/lib/moon/components/input_group/styled/container.ex new file mode 100644 index 000000000..3c0ad6edc --- /dev/null +++ b/lib/moon/components/input_group/styled/container.ex @@ -0,0 +1,46 @@ +defmodule Moon.Components.InputGroup.Container do + @moduledoc false + + use Moon.StatelessComponent + + prop orientation, :string + prop background_color, :string, default: "gohan-100", values: Moon.colors() + prop is_error, :boolean + slot default + + def render(assigns) do + ~F""" +
+ <#slot /> +
+ """ + end + + defp get_class_for_orientation(orientation, is_error) do + cond do + orientation == "horizontal" && !is_error -> + " + flex + after:content-[''] after:z-20 after:absolute after:top-0 after:bottom-0 after:w-px + after:left-1/2 after:translate-x-[-50%] after:bg-beerus-100 after:x-[3] + hover:after:hidden focus-within:after:hidden + " + + !is_error -> + " + after:content-[''] after:z-20 after:absolute after:top-1/2 after:bottom-0 after:w-full after:h-px + after:left-0 after:translate-y-[-50%] after:bg-beerus-100 after:x-[3] + hover:after:hidden focus-within:after:hidden + " + + true -> + "" + end + end +end diff --git a/lib/moon/components/text_input/styled/container.ex b/lib/moon/components/text_input/styled/container.ex index 6588b852a..432a32de6 100644 --- a/lib/moon/components/text_input/styled/container.ex +++ b/lib/moon/components/text_input/styled/container.ex @@ -8,6 +8,7 @@ defmodule Moon.Components.TextInput.Container do prop id, :string prop disabled, :boolean, default: false prop size, :string, values: ["md", "lg", "xl"] + prop class, :string slot default @@ -16,13 +17,12 @@ defmodule Moon.Components.TextInput.Container do
- <#slot /> -
+ ><#slot />
""" end end diff --git a/lib/moon/components/text_input/styled/input.ex b/lib/moon/components/text_input/styled/input.ex index 50946ced0..b1272294d 100644 --- a/lib/moon/components/text_input/styled/input.ex +++ b/lib/moon/components/text_input/styled/input.ex @@ -2,150 +2,78 @@ defmodule Moon.Components.TextInput.Input do @moduledoc false use Moon.StatelessComponent - alias Moon.Components.TextInput.Utils - prop type, :string, - values: [ - "date", - "datetime-local", - "email", - "number", - "password", - "search", - "tel", - "text", - "time", - "url" - ], - default: "text" - + prop id, :string prop field, :atom - prop is_error, :boolean, default: false - prop background_color, :string, values: Moon.colors() - prop size, :string, values: ["md", "lg", "xl"] - prop dir, :string, values: ["ltr", "rtl"], default: "ltr" - prop with_label, :boolean, default: false - prop disabled, :boolean - prop placeholder, :string - prop required, :boolean - prop step, :string, default: "1" - prop is_first, :boolean - prop readonly, :boolean - prop value, :string - - prop is_sharp_left_side, :boolean - prop is_sharp_right_side, :boolean - prop is_sharp_top_side, :boolean - prop is_sharp_bottom_side, :boolean - prop is_top_bottom_border_hidden, :boolean - prop is_side_border_hidden, :boolean - - prop focus, :event - prop keydown, :event - prop keyup, :event - prop blur, :event def render(assigns) do ~F""" - + + + """ end - defp get_class_for_date_type(type, is_rtl) do - cond do - type == "date" || type == "datetime-local" -> "input-d" - type == "date" && is_rtl -> "input-d-rtl" - type == "datetime-local" && is_rtl -> "input-dt-local-rtl" - true -> "" - end - end - - defp get_class_for_time_type(type, is_rtl) do - cond do - type == "time" -> "input-t" - type == "time" && is_rtl -> "input-t-rtl" - true -> "" - end - end - - defp get_class_left( - is_sharp_left_side, - is_sharp_top_side, - is_sharp_bottom_side - ) do - cond do - is_sharp_left_side || is_sharp_top_side -> "rounded-tl-none" - is_sharp_left_side || is_sharp_bottom_side -> "rounded-bl-none" - true -> "" - end - end - - defp get_class_right( - is_sharp_right_side, - is_sharp_top_side, - is_sharp_bottom_side - ) do + defp get_class_for_date_type(type) do cond do - is_sharp_right_side || is_sharp_top_side -> "rounded-tr-none" - is_sharp_right_side || is_sharp_bottom_side -> "rounded-br-none" + type == "date" -> "ltr:input-d rtl:input-d-rtl" + type == "datetime-local" -> "ltr:input-d rtl:input-dt-local-rtl" true -> "" end end diff --git a/lib/moon/components/text_input/styled/password.ex b/lib/moon/components/text_input/styled/password.ex index 1ac20c035..bc8739f78 100644 --- a/lib/moon/components/text_input/styled/password.ex +++ b/lib/moon/components/text_input/styled/password.ex @@ -2,9 +2,14 @@ defmodule Moon.Components.TextInput.Password do @moduledoc false use Moon.StatelessComponent - alias Moon.Components.TextInput.Utils + prop id, :string + prop field, :atom + prop value, :string + prop on_keyup, :string + prop input_password_id, :string + prop type, :string, values: [ "password", @@ -12,113 +17,58 @@ defmodule Moon.Components.TextInput.Password do ], default: "text" - prop field, :atom - prop is_error, :boolean, default: false - prop background_color, :string, values: Moon.colors() - prop size, :string, values: ["md", "lg", "xl"] - prop dir, :string, values: ["ltr", "rtl"], default: "ltr" - prop with_label, :boolean, default: false - prop disabled, :boolean - prop placeholder, :string - prop required, :boolean - prop step, :string, default: "1" - prop is_first, :boolean - prop readonly, :boolean - prop value, :string - prop id, :string - prop on_keyup, :string - prop input_password_id, :string - - prop is_sharp_left_side, :boolean - prop is_sharp_right_side, :boolean - prop is_sharp_top_side, :boolean - prop is_sharp_bottom_side, :boolean - prop is_top_bottom_border_hidden, :boolean - prop is_side_border_hidden, :boolean - - prop focus, :event - prop keydown, :event - prop keyup, :event - prop blur, :event - def render(assigns) do ~F""" - + + + """ end - - defp get_class_left( - is_sharp_left_side, - is_sharp_top_side, - is_sharp_bottom_side - ) do - cond do - is_sharp_left_side || is_sharp_top_side -> "rounded-tl-none" - is_sharp_left_side || is_sharp_bottom_side -> "rounded-bl-none" - true -> "" - end - end - - defp get_class_right( - is_sharp_right_side, - is_sharp_top_side, - is_sharp_bottom_side - ) do - cond do - is_sharp_right_side || is_sharp_top_side -> "rounded-tr-none" - is_sharp_right_side || is_sharp_bottom_side -> "rounded-br-none" - true -> "" - end - end end diff --git a/lib/moon/components/text_input/styled/show_password.ex b/lib/moon/components/text_input/styled/show_password.ex index 60138736c..7c405dc55 100644 --- a/lib/moon/components/text_input/styled/show_password.ex +++ b/lib/moon/components/text_input/styled/show_password.ex @@ -6,10 +6,9 @@ defmodule Moon.Components.TextInput.ShowPassword do prop input_password_id, :string prop toggle, :string, default: "toggle_password_visibility" - prop is_rtl, :boolean, default: false - slot default + # TODO def render(assigns) do ~F"""
is broken) + "rtl:left-[0.938rem]", + # buggy on beta TW, rtl: and ltr: (Show password when using is broken) + "ltr:right-[0.938rem]", + "right-[0.938rem]" } > <#slot />
""" end - - defp get_direction_style(is_rtl) do - if is_rtl do - "left-[0.938rem]" - else - "right-[0.938rem]" - end - end end diff --git a/lib/moon/components/text_input/subcomponents/text_input_basic.ex b/lib/moon/components/text_input/subcomponents/text_input_basic.ex index f3b4055f9..af8adacfa 100644 --- a/lib/moon/components/text_input/subcomponents/text_input_basic.ex +++ b/lib/moon/components/text_input/subcomponents/text_input_basic.ex @@ -4,95 +4,36 @@ defmodule Moon.Components.TextInput.TextInputBasic do use Moon.StatelessComponent alias Moon.Components.TextInput.Container alias Moon.Components.TextInput.Input - alias Moon.Components.TextInput.HintText alias Moon.Components.ErrorTag - prop type, :string, - values: [ - "date", - "datetime-local", - "email", - "number", - "password", - "search", - "tel", - "text", - "time", - "url" - ], - default: "text" - prop id, :string - prop size, :string, values: ["md", "lg", "xl"] - prop placeholder, :string - prop is_error, :boolean - prop dir, :string, values: ["ltr", "rtl"], default: "ltr" - prop background_color, :string, values: Moon.colors(), default: "gohan-100" - prop is_first, :boolean - prop disabled, :boolean - prop label, :string - prop required, :boolean - prop step, :string, default: "1" - prop readonly, :boolean - prop value, :string - - prop is_sharp_left_side, :boolean - prop is_sharp_right_side, :boolean - prop is_sharp_top_side, :boolean - prop is_sharp_bottom_side, :boolean - prop is_top_bottom_border_hidden, :boolean - prop is_side_border_hidden, :boolean - - prop focus, :event - prop keydown, :event - prop keyup, :event - prop blur, :event - - prop use_error_tag, :boolean - - slot hint_text_slot + prop field, :atom + prop class, :string, default: "" + slot default def render(assigns) do ~F""" - - - - - <#slot name="hint_text_slot" /> - -
- -
-
+ + + + + <#slot /> +
+ +
+
+
""" end end diff --git a/lib/moon/components/text_input/subcomponents/text_input_inner_label.ex b/lib/moon/components/text_input/subcomponents/text_input_inner_label.ex index 35e5ae207..50c73051d 100644 --- a/lib/moon/components/text_input/subcomponents/text_input_inner_label.ex +++ b/lib/moon/components/text_input/subcomponents/text_input_inner_label.ex @@ -4,107 +4,50 @@ defmodule Moon.Components.TextInput.TextInputInnerLabel do use Moon.StatelessComponent alias Moon.Components.TextInput.Container alias Moon.Components.TextInput.Input - alias Moon.Components.TextInput.HintText alias Moon.Components.TextInput.Utils alias Moon.Components.ErrorTag - prop type, :string, - values: [ - "date", - "datetime-local", - "email", - "number", - "password", - "search", - "tel", - "text", - "time", - "url" - ], - default: "text" - + prop class, :string, default: "" prop id, :string - prop size, :string, values: ["md", "lg", "xl"] - prop placeholder, :string - prop is_error, :boolean - prop dir, :string, values: ["ltr", "rtl"], default: "ltr" - prop background_color, :string, values: Moon.colors(), default: "gohan-100" - prop is_first, :boolean - prop disabled, :boolean - prop label, :string - prop required, :boolean - prop step, :string, default: "1" - prop readonly, :boolean - prop value, :string - - prop is_sharp_left_side, :boolean - prop is_sharp_right_side, :boolean - prop is_sharp_top_side, :boolean - prop is_sharp_bottom_side, :boolean - prop is_top_bottom_border_hidden, :boolean - prop is_side_border_hidden, :boolean - - prop focus, :event - prop keydown, :event - prop keyup, :event - prop blur, :event - - prop use_error_tag, :boolean - - slot hint_text_slot + prop field, :atom + slot default def render(assigns) do ~F""" - -
- - -
- - <#slot name="hint_text_slot" /> - -
- -
-
+ + +
+ + +
+ <#slot /> +
+ +
+
+
""" end end diff --git a/lib/moon/components/text_input/subcomponents/text_input_password.ex b/lib/moon/components/text_input/subcomponents/text_input_password.ex index b0c0c757e..398df3fa8 100644 --- a/lib/moon/components/text_input/subcomponents/text_input_password.ex +++ b/lib/moon/components/text_input/subcomponents/text_input_password.ex @@ -4,138 +4,101 @@ defmodule Moon.Components.TextInput.TextInputPassword do use Moon.StatefulComponent alias Moon.Components.TextInput.Container alias Moon.Components.TextInput.Password - alias Moon.Components.TextInput.HintText alias Moon.Components.TextInput.Utils alias Moon.Components.TextInput.ShowPassword alias Moon.Components.ErrorTag - prop size, :string, values: ["md", "lg", "xl"] - prop placeholder, :string - prop is_error, :boolean - prop dir, :string, values: ["ltr", "rtl"], default: "ltr" - prop background_color, :string, values: Moon.colors(), default: "gohan-100" - prop is_first, :boolean - prop disabled, :boolean - prop label, :string - prop required, :boolean - prop step, :string, default: "1" - prop readonly, :boolean - prop value, :string - - prop is_sharp_left_side, :boolean - prop is_sharp_right_side, :boolean - prop is_sharp_top_side, :boolean - prop is_sharp_bottom_side, :boolean - prop is_top_bottom_border_hidden, :boolean - prop is_side_border_hidden, :boolean - prop show_password_text, :string, default: "Show" - - prop focus, :event - prop keydown, :event - prop blur, :event - - prop use_error_tag, :boolean - data password_shown, :boolean, default: false data password, :string, default: "" - slot hint_text_slot + prop field, :atom + prop class, :string, default: "" + slot default def render(assigns) do ~F""" - - {#if @size == "xl"} -
- -
- - <#slot name="hint_text_slot" /> - -
- -
- {#else} - -
- + - - {@show_password_text} - -
-
-
- - <#slot name="hint_text_slot" /> - -
- -
- {/if} -
+ + {show_password_text} + + + <#slot /> +
+ +
+ {/if} + + """ end @@ -154,8 +117,4 @@ defmodule Moon.Components.TextInput.TextInputPassword do "password" end end - - defp is_rtl(dir) do - dir == "rtl" - end end diff --git a/lib/moon/components/text_input/text_input.ex b/lib/moon/components/text_input/text_input.ex index 89aaec891..ac668c89b 100644 --- a/lib/moon/components/text_input/text_input.ex +++ b/lib/moon/components/text_input/text_input.ex @@ -6,9 +6,11 @@ defmodule Moon.Components.TextInput do alias Moon.Components.TextInput.TextInputInnerLabel alias Moon.Components.TextInput.TextInputPassword alias Surface.Components.Form.Input.InputContext + alias Moon.Components.TextInput.HintText prop id, :string - prop size, :string, values: ["md", "lg", "xl"] + prop field, :atom + prop size, :string, values: ["md", "lg", "xl"], default: "md" prop type, :string, values: [ @@ -27,7 +29,6 @@ defmodule Moon.Components.TextInput do prop placeholder, :string prop is_error, :boolean - prop dir, :string, values: ["ltr", "rtl"], default: "ltr" prop background_color, :string, values: Moon.colors(), default: "gohan-100" prop is_first, :boolean prop disabled, :boolean @@ -41,6 +42,7 @@ defmodule Moon.Components.TextInput do prop is_sharp_bottom_side, :boolean prop is_top_bottom_border_hidden, :boolean prop is_side_border_hidden, :boolean + prop readonly, :boolean prop value, :string @@ -49,100 +51,85 @@ defmodule Moon.Components.TextInput do prop keyup, :event prop blur, :event + prop show_password_text, :string, default: "Show" + prop use_error_tag, :boolean slot hint_text_slot - slot show_password_text + + prop class, :string, default: "" def render(assigns) do ~F""" - {#if @type == "password"} - - <:hint_text_slot> - <#slot name="hint_text_slot" /> - - - {#elseif @size == "xl"} - - <:hint_text_slot> - <#slot name="hint_text_slot" /> - - - {#else} - - <:hint_text_slot> - <#slot name="hint_text_slot" /> - - - {/if} + + {#if @type == "password"} + + + <#slot name="hint_text_slot" /> + + + {#elseif @size == "xl"} + + + <#slot name="hint_text_slot" /> + + + {#else} + + + <#slot name="hint_text_slot" /> + + + {/if} + """ end + defp get_combined_class(is_in_input_group, class, field, group_class_plain) do + if is_in_input_group && !field do + group_class_plain <> " " <> class + else + class + end + end + defp has_error(is_error, form, field) do is_error || (field && form && Keyword.has_key?(form.errors, field)) end diff --git a/lib/moon/components/text_input/utils/utils.ex b/lib/moon/components/text_input/utils/utils.ex index 28fc3d86e..d77220fcd 100644 --- a/lib/moon/components/text_input/utils/utils.ex +++ b/lib/moon/components/text_input/utils/utils.ex @@ -21,39 +21,4 @@ defmodule Moon.Components.TextInput.Utils do "h-10 leading-10 rounded-moon-i-sm hover:rounded-moon-i-sm focus:rounded-moon-i-sm invalid:rounded-moon-i-sm" end end - - def make_border_left( - is_side_border_hidden, - is_first, - is_rtl - ) do - cond do - is_side_border_hidden && is_rtl && is_first -> "input-lsb-hidden" - is_side_border_hidden -> "input-lsb-hidden" - true -> "" - end - end - - def make_border_right( - is_side_border_hidden, - is_first, - is_rtl - ) do - cond do - is_side_border_hidden && is_rtl -> "input-rsb-hidden" - is_side_border_hidden && is_first -> "input-rsb-hidden" - true -> "" - end - end - - def make_border_top_bottom( - is_top_bottom_border_hidden, - is_first - ) do - cond do - is_top_bottom_border_hidden && is_first -> "input-bbb-hidden" - is_top_bottom_border_hidden -> "input-tbb-hidden" - true -> "" - end - end end diff --git a/lib/moon_web/components/example_and_code.ex b/lib/moon_web/components/example_and_code.ex index a5c693c93..3db646a4c 100644 --- a/lib/moon_web/components/example_and_code.ex +++ b/lib/moon_web/components/example_and_code.ex @@ -47,10 +47,10 @@ defmodule MoonWeb.Components.ExampleAndCode do
-
+
<#slot name="state" />
diff --git a/lib/moon_web/components/left_menu.ex b/lib/moon_web/components/left_menu.ex index 60c8ee18e..1c62203cc 100644 --- a/lib/moon_web/components/left_menu.ex +++ b/lib/moon_web/components/left_menu.ex @@ -154,7 +154,7 @@ defmodule MoonWeb.Components.LeftMenu do Tabs Table Text input - Text input group + Input group Toast Tooltip 'orientation', + :type => 'vertical | horizontal', + :required => 'false', + :default => 'horizontal', + :description => '' + }, + %{ + :name => 'slot', + :type => 'slot', + :required => 'true', + :default => '-', + :description => 'Default slot' + } + ] + + def mount(params, _session, socket) do + user = %User{} + user_changeset = User.changeset(user, %{}) + + {:ok, + assign(socket, + theme_name: params["theme_name"] || "moon-design-light", + active_page: __MODULE__, + user: user, + user_changeset: user_changeset + )} + end + + def handle_params(_params, uri, socket) do + {:noreply, assign(socket, uri: uri)} + end + + def handle_event("register_form_update", params, socket) do + user_changeset = User.changeset(socket.assigns.user, params["user"]) + + {:noreply, assign(socket, user_changeset: user_changeset)} + end + + def handle_event("register_form_submit", params, socket) do + user_changeset = + User.changeset(socket.assigns.user, params["user"]) |> Map.merge(%{action: :insert}) + + {:noreply, assign(socket, user_changeset: user_changeset)} + end + + def input_group_1000_state(assigns) do + ~F""" + {inspect(@user_changeset.changes, pretty: true)} + """ + end + + def render(assigns) do + ~F""" + + + Input Group + +

+ !!! Input Group is supported only in size `xlarge`. +

+
+ + + + <:example> + +
+ + + + +
+ +
+ + + + +
+
+ + + <:code>{input_group_1_code()} + + <:state>{input_group_1000_state(assigns)} +
+ + + <:example> + +
+ + + + +
+ +
+ + + + +
+
+ + + <:code>{input_group_10_code()} + + <:state>{input_group_1000_state(assigns)} +
+ + + <:example> + +
+ + + + +
+ +
+ + + + +
+
+ + + <:code>{input_group_100_code()} + + <:state>{input_group_1000_state(assigns)} +
+
+ + +
+
+ """ + end + + defp input_group_1_code() do + """ + +
+ + + + +
+ +
+ + + + +
+
+ """ + end + + defp input_group_10_code() do + """ + +
+ + + + +
+ +
+ + + + +
+
+ """ + end + + defp input_group_100_code() do + """ + +
+ + + + +
+ +
+ + + + +
+
+ """ + end +end diff --git a/lib/moon_web/pages/components/text_input/text_input_page.ex b/lib/moon_web/pages/components/text_input/text_input_page.ex index 91507bca0..f4a30ad87 100644 --- a/lib/moon_web/pages/components/text_input/text_input_page.ex +++ b/lib/moon_web/pages/components/text_input/text_input_page.ex @@ -34,7 +34,7 @@ defmodule MoonWeb.Pages.Components.TextInputPage do %{ :name => 'type', :type => - 'date | datetime-local" | email | number | password | search | tel | text | url | time | url', + 'date | datetime-local | email | number | password | search | tel | text | url | time | url', :required => 'false', :default => 'text', :description => 'Different types of input' @@ -323,10 +323,10 @@ defmodule MoonWeb.Pages.Components.TextInputPage do <:example> - - - - + + + + @@ -335,10 +335,10 @@ defmodule MoonWeb.Pages.Components.TextInputPage do <:example> - - - - + + + + @@ -406,7 +406,7 @@ defmodule MoonWeb.Pages.Components.TextInputPage do -
+
@@ -420,7 +420,7 @@ defmodule MoonWeb.Pages.Components.TextInputPage do
-
TabLink Props Tabs
+
Text Input Props
{item.name} @@ -715,7 +715,7 @@ defmodule MoonWeb.Pages.Components.TextInputPage do -
+
diff --git a/lib/moon_web/pages/components/text_input_group_page.ex b/lib/moon_web/pages/components/text_input_group_page.ex deleted file mode 100644 index a7dd9c173..000000000 --- a/lib/moon_web/pages/components/text_input_group_page.ex +++ /dev/null @@ -1,40 +0,0 @@ -defmodule MoonWeb.Pages.Components.TextInputGroupPage do - @moduledoc false - - use MoonWeb, :live_view - - alias MoonWeb.Components.ComponentPageDescription - alias MoonWeb.Components.Page - - data breadcrumbs, :any, - default: [ - %{ - to: "#", - name: "Components" - }, - %{ - to: "/components/text-input-group", - name: "Text Input Group" - } - ] - - def mount(params, _session, socket) do - {:ok, - assign(socket, - theme_name: params["theme_name"] || "moon-design-light", - active_page: __MODULE__ - )} - end - - def render(assigns) do - ~F""" - - -

- Coming soon... -

-
-
- """ - end -end diff --git a/lib/moon_web/pages/tutorials/add_data_using_form/user.ex b/lib/moon_web/pages/tutorials/add_data_using_form/user.ex index 00556b83c..a0081169c 100644 --- a/lib/moon_web/pages/tutorials/add_data_using_form/user.ex +++ b/lib/moon_web/pages/tutorials/add_data_using_form/user.ex @@ -7,13 +7,15 @@ defmodule MoonWeb.Pages.Tutorials.AddDataUsingForm.User do alias MoonWeb.Pages.Tutorials.AddDataUsingForm.User @required_fields ~w(name email gender username password)a - @optional_fields ~w(document_filename agrees_to_marketing_emails agrees_to_terms_of_service permissions role)a + @optional_fields ~w(document_filename agrees_to_marketing_emails agrees_to_terms_of_service permissions role phone country)a schema "users" do field(:username, :string, default: "johndoe") field(:password, :string, default: "verysecret123") field(:name, :string, default: "First Last") field(:email, :string, default: "joe@doe.com") + field(:phone, :string) + field(:country, :string) field(:gender, :string, default: "male") field(:document_filename) field(:agrees_to_terms_of_service, :boolean, default: true) diff --git a/lib/moon_web/router.ex b/lib/moon_web/router.ex index 167f360e3..e3c0e2cf6 100644 --- a/lib/moon_web/router.ex +++ b/lib/moon_web/router.ex @@ -118,7 +118,7 @@ defmodule MoonWeb.Router do live "/components/text-input", MoonWeb.Pages.Components.TextInputPage - live "/components/text-input-group", MoonWeb.Pages.Components.TextInputGroupPage + live "/components/input-group", MoonWeb.Pages.Components.InputGroupPage live "/components/toast", MoonWeb.Pages.Components.ToastPage live "/components/tooltip", MoonWeb.Pages.Components.TooltipPage