diff --git a/assets/tailwind.config.js b/assets/tailwind.config.js
index 534f12d2f..6ebacf305 100644
--- a/assets/tailwind.config.js
+++ b/assets/tailwind.config.js
@@ -136,9 +136,6 @@ module.exports = {
opacity: {
disabled: "var(--opacity--disabled)",
},
- boxShadow: {
- "border": "0 0 0 2px rgba(var(--color--piccolo-100)) inset"
- },
animation: {
loader: "loader 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite",
},
@@ -148,176 +145,194 @@ module.exports = {
"100%": { transform: "rotate(360deg)" },
},
},
- },
- fontWeight: {
- normal: 400,
- semibold: 500,
- },
- boxShadow: {
- sm: "var(--box-shadow--sm)",
- DEFAULT: "var(--box-shadow--default)",
- md: "var(--box-shadow--default)",
- lg: "var(--box-shadow--lg)",
- xl: "var(--box-shadow--xl)",
- },
- // borderRadius: {
- // sm: "var(--radius--small)",
- // DEFAULT: "var(--radius--default)",
- // lg: "var(--radius--large)",
- // xl: "var(--radius--xlarge)",
- // },
- colors: {
- transparent: "transparent",
- text: "var(--color-text)",
- background: "var(--color-background)",
- "krillin-10": {
- DEFAULT: withOpacityValue("--color--krillin-10"),
- },
- "krillin-60": {
- DEFAULT: withOpacityValue("--color--krillin-60")
- },
- "krillin-100": {
- DEFAULT: withOpacityValue("--color--krillin-100")
- },
- "chi-chi-10": {
- DEFAULT: withOpacityValue("--color--chi-chi-10")
- },
- "chi-chi-60": {
- DEFAULT: withOpacityValue("--color--chi-chi-60")
- },
- "chi-chi-100": {
- DEFAULT: withOpacityValue("--color--chi-chi-100")
- },
- "roshi-10": {
- DEFAULT: withOpacityValue("--color--roshi-10")
- },
- "roshi-60": {
- DEFAULT: withOpacityValue("--color--roshi-60")
- },
- "roshi-100": {
- DEFAULT: withOpacityValue("--color--roshi-100")
- },
- "dodoria-10": {
- DEFAULT: withOpacityValue("--color--dodoria-10")
- },
- "dodoria-60": {
- DEFAULT: withOpacityValue("--color--dodoria-60")
- },
- "dodoria-100": {
- DEFAULT: withOpacityValue("--color--dodoria-100")
- },
- "cell-10": {
- DEFAULT: withOpacityValue("--color--cell-10")
- },
- "cell-60": {
- DEFAULT: withOpacityValue("--color--cell-60")
- },
- "cell-100": {
- DEFAULT: withOpacityValue("--color--cell-100")
- },
- "raditz-10": {
- DEFAULT: withOpacityValue("--color--raditz-10")
- },
- "raditz-60": {
- DEFAULT: withOpacityValue("--color--raditz-60")
- },
- "raditz-100": {
- DEFAULT: withOpacityValue("--color--raditz-100")
- },
- "whis-10": {
- DEFAULT: withOpacityValue("--color--whis-10")
- },
- "whis-60": {
- DEFAULT: withOpacityValue("--color--whis-60")
- },
- "whis-100": {
- DEFAULT: withOpacityValue("--color--whis-100")
- },
- "frieza-10": {
- DEFAULT: withOpacityValue("--color--frieza-10")
- },
- "frieza-60": {
- DEFAULT: withOpacityValue("--color--frieza-60")
- },
- "frieza-100": {
- DEFAULT: withOpacityValue("--color--frieza-100")
- },
- "nappa-10": {
- DEFAULT: withOpacityValue("--color--nappa-10")
- },
- "nappa-60": {
- DEFAULT: withOpacityValue("--color--nappa-60")
- },
- "nappa-100": {
- DEFAULT: withOpacityValue("--color--nappa-100")
- },
- "piccolo-80": {
- DEFAULT: withOpacityValue("--color--piccolo-80")
- },
- "piccolo-100": {
- DEFAULT: withOpacityValue("--color--piccolo-100")
- },
- "piccolo-120": {
- DEFAULT: withOpacityValue("--color--piccolo-120")
- },
- "hit-80": {
- DEFAULT: withOpacityValue("--color--hit-80")
- },
- "hit-100": {
- DEFAULT: withOpacityValue("--color--hit-100")
- },
- "hit-120": {
- DEFAULT: withOpacityValue("--color--hit-120")
+ fontWeight: {
+ normal: 400,
+ semibold: 500,
},
- "goten-100": {
- DEFAULT: withOpacityValue("--color--goten-100")
- },
- "goku-10": {
- DEFAULT: withOpacityValue("--color--goku-10")
- },
- "goku-40": {
- DEFAULT: withOpacityValue("--color--goku-40")
- },
- "goku-80": {
- DEFAULT: withOpacityValue("--color--goku-80")
- },
- "goku-100": {
- DEFAULT: withOpacityValue("--color--goku-100")
- },
- "goku-120": {
- DEFAULT: withOpacityValue("--color--goku-120")
- },
- "gohan-10": {
- DEFAULT: withOpacityValue("--color--gohan-10")
- },
- "gohan-40": {
- DEFAULT: withOpacityValue("--color--gohan-40")
- },
- "gohan-80": {
- DEFAULT: withOpacityValue("--color--gohan-80")
- },
- "gohan-100": {
- DEFAULT: withOpacityValue("--color--gohan-100")
- },
- "gohan-120": {
- DEFAULT: withOpacityValue("--color--gohan-120")
- },
- "beerus-100": {
- DEFAULT: withOpacityValue("--color--beerus-100")
- },
- "bulma-100": {
- DEFAULT: withOpacityValue("--color--bulma-100")
- },
- "trunks-100": {
- DEFAULT: withOpacityValue("--color--trunks-100")
+ boxShadow: {
+ sm: "var(--box-shadow--sm)",
+ DEFAULT: "var(--box-shadow--default)",
+ md: "var(--box-shadow--default)",
+ lg: "var(--box-shadow--lg)",
+ xl: "var(--box-shadow--xl)",
+ border: "0 0 0 2px rgba(var(--color--piccolo-100)) inset",
+ inset: '0 0 0 1px rgb(var(--color--piccolo-100)) inset',
+ interactive: '0 0 0 2px rgb(var(--color--piccolo-100)) inset',
+ focus: `0 0 0 4px rgba(var(--color--piccolo-100), .13)`,
+ input: '0 0 0 var(--border-width) rgb(var(--color--beerus-100)) inset',
+ 'input-hov':
+ '0 0 0 var(--border-i-width) rgb(var(--color--bulma-100) / 7%) inset, 0 0 0 var(--border-i-width) rgb(var(--color--beerus-100)) inset',
+ 'input-err': '0 0 0 var(--border-i-width) rgb(var(--color--chi-chi-100)) inset',
+ 'input-focus': '0 0 0 var(--border-i-width) rgb(var(--color--piccolo-100)) inset',
+ 'moon-sm':
+ '0 6px 6px -6px rgba(0, 0, 0, 0.16), 0 0 1px rgba(0, 0, 0, 0.4)',
+ 'moon-md':
+ '0 12px 12px -6px rgba(0, 0, 0, 0.16), 0 0 1px rgba(0, 0, 0, 0.4)',
+ 'moon-lg':
+ '0 8px 24px -6px rgba(0, 0, 0, 0.16), 0 0 1px rgba(0, 0, 0, 0.4)',
+ 'moon-xl':
+ '0 32px 32px -8px rgba(0, 0, 0, 0.08), 0 0 32px -8px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0, 0, 0, 0.2)',
+ },
+ // borderRadius: {
+ // sm: "var(--radius--small)",
+ // DEFAULT: "var(--radius--default)",
+ // lg: "var(--radius--large)",
+ // xl: "var(--radius--xlarge)",
+ // },
+ colors: {
+ transparent: "transparent",
+ text: "var(--color-text)",
+ background: "var(--color-background)",
+ "krillin-10": {
+ DEFAULT: withOpacityValue("--color--krillin-10"),
+ },
+ "krillin-60": {
+ DEFAULT: withOpacityValue("--color--krillin-60")
+ },
+ "krillin-100": {
+ DEFAULT: withOpacityValue("--color--krillin-100")
+ },
+ "chi-chi-10": {
+ DEFAULT: withOpacityValue("--color--chi-chi-10")
+ },
+ "chi-chi-60": {
+ DEFAULT: withOpacityValue("--color--chi-chi-60")
+ },
+ "chi-chi-100": {
+ DEFAULT: withOpacityValue("--color--chi-chi-100")
+ },
+ "roshi-10": {
+ DEFAULT: withOpacityValue("--color--roshi-10")
+ },
+ "roshi-60": {
+ DEFAULT: withOpacityValue("--color--roshi-60")
+ },
+ "roshi-100": {
+ DEFAULT: withOpacityValue("--color--roshi-100")
+ },
+ "dodoria-10": {
+ DEFAULT: withOpacityValue("--color--dodoria-10")
+ },
+ "dodoria-60": {
+ DEFAULT: withOpacityValue("--color--dodoria-60")
+ },
+ "dodoria-100": {
+ DEFAULT: withOpacityValue("--color--dodoria-100")
+ },
+ "cell-10": {
+ DEFAULT: withOpacityValue("--color--cell-10")
+ },
+ "cell-60": {
+ DEFAULT: withOpacityValue("--color--cell-60")
+ },
+ "cell-100": {
+ DEFAULT: withOpacityValue("--color--cell-100")
+ },
+ "raditz-10": {
+ DEFAULT: withOpacityValue("--color--raditz-10")
+ },
+ "raditz-60": {
+ DEFAULT: withOpacityValue("--color--raditz-60")
+ },
+ "raditz-100": {
+ DEFAULT: withOpacityValue("--color--raditz-100")
+ },
+ "whis-10": {
+ DEFAULT: withOpacityValue("--color--whis-10")
+ },
+ "whis-60": {
+ DEFAULT: withOpacityValue("--color--whis-60")
+ },
+ "whis-100": {
+ DEFAULT: withOpacityValue("--color--whis-100")
+ },
+ "frieza-10": {
+ DEFAULT: withOpacityValue("--color--frieza-10")
+ },
+ "frieza-60": {
+ DEFAULT: withOpacityValue("--color--frieza-60")
+ },
+ "frieza-100": {
+ DEFAULT: withOpacityValue("--color--frieza-100")
+ },
+ "nappa-10": {
+ DEFAULT: withOpacityValue("--color--nappa-10")
+ },
+ "nappa-60": {
+ DEFAULT: withOpacityValue("--color--nappa-60")
+ },
+ "nappa-100": {
+ DEFAULT: withOpacityValue("--color--nappa-100")
+ },
+ "piccolo-80": {
+ DEFAULT: withOpacityValue("--color--piccolo-80")
+ },
+ "piccolo-100": {
+ DEFAULT: withOpacityValue("--color--piccolo-100")
+ },
+ "piccolo-120": {
+ DEFAULT: withOpacityValue("--color--piccolo-120")
+ },
+ "hit-80": {
+ DEFAULT: withOpacityValue("--color--hit-80")
+ },
+ "hit-100": {
+ DEFAULT: withOpacityValue("--color--hit-100")
+ },
+ "hit-120": {
+ DEFAULT: withOpacityValue("--color--hit-120")
+ },
+ "goten-100": {
+ DEFAULT: withOpacityValue("--color--goten-100")
+ },
+ "goku-10": {
+ DEFAULT: withOpacityValue("--color--goku-10")
+ },
+ "goku-40": {
+ DEFAULT: withOpacityValue("--color--goku-40")
+ },
+ "goku-80": {
+ DEFAULT: withOpacityValue("--color--goku-80")
+ },
+ "goku-100": {
+ DEFAULT: withOpacityValue("--color--goku-100")
+ },
+ "goku-120": {
+ DEFAULT: withOpacityValue("--color--goku-120")
+ },
+ "gohan-10": {
+ DEFAULT: withOpacityValue("--color--gohan-10")
+ },
+ "gohan-40": {
+ DEFAULT: withOpacityValue("--color--gohan-40")
+ },
+ "gohan-80": {
+ DEFAULT: withOpacityValue("--color--gohan-80")
+ },
+ "gohan-100": {
+ DEFAULT: withOpacityValue("--color--gohan-100")
+ },
+ "gohan-120": {
+ DEFAULT: withOpacityValue("--color--gohan-120")
+ },
+ "beerus-100": {
+ DEFAULT: withOpacityValue("--color--beerus-100")
+ },
+ "bulma-100": {
+ DEFAULT: withOpacityValue("--color--bulma-100")
+ },
+ "trunks-100": {
+ DEFAULT: withOpacityValue("--color--trunks-100")
+ },
+ black: "#000",
+ hover: "rgba(34, 34, 37, 0.12)",
+ "primary-hover": "rgba(0, 0, 0, 0.08)",
+ "slate-200": "rgb(226 232 240)",
+ "for-designers": "rgb(52 72 240)",
+ "for-developers": "rgb(149 241 213)"
},
- black: "#000",
- hover: "rgba(34, 34, 37, 0.12)",
- "primary-hover": "rgba(0, 0, 0, 0.08)",
- "slate-200": "rgb(226 232 240)",
- "for-designers": "rgb(52 72 240)",
- "for-developers": "rgb(149 241 213)"
},
+
},
plugins: [
require("@tailwindcss/aspect-ratio"),
@@ -325,5 +340,156 @@ module.exports = {
plugin(({ addUtilities }) => {
addUtilities({});
}),
+ plugin(({ addComponents }) => {
+ addComponents({
+ '.btn-primary': {
+ color: 'rgb(var(--color--goten-100))',
+ backgroundColor: `rgb(var(--color--piccolo-100))`,
+ },
+ '.btn-secondary': {
+ color: 'rgb(var(--color--bulma-100))',
+ background: 'none',
+ boxShadow: `inset 0 0 0 1px rgb(var(--color--trunks-100)/1)`,
+ '&:hover': {
+ boxShadow: `inset 0 0 0 1px rgb(var(--color--bulma-100))`,
+ },
+ },
+ '.btn-tertiary': {
+ color: 'rgb(var(--color--goten-100))',
+ backgroundColor: 'rgb(var(--color--hit-100))',
+ },
+ '.anim-error': {
+ transform: 'translate3d(0, 0, 0)',
+ backfaceVisibility: 'hidden',
+ perspective: '1000px',
+ },
+ '.anim-pulse': {
+ boxShadow: '0 0 0 0 rgb(var(--color--piccolo-100))',
+ },
+ '.input-number-clear': {
+ MozAppearance: 'textfield',
+ '&::-webkit-inner-spin-button, &::-webkit-outer-spin-button': {
+ opacity: 0,
+ },
+ },
+ '.input-xl': {
+ '&:not(:focus):not([disabled])::placeholder': {
+ opacity: 0,
+ },
+ '&:not(:focus):not([disabled]):placeholder-shown + label': {
+ top: '50%',
+ marginTop: '-0.438rem',
+ fontSize: '1rem',
+ lineHeight: '1rem',
+ },
+ },
+ '.input-dt-shared': {
+ '&::-webkit-datetime-edit, &::-webkit-date-and-time-value': {
+ display: 'block',
+ padding: 0,
+ height: '2.375rem',
+ lineHeight: '2.375rem',
+ },
+ '&::-webkit-date-and-time-value': {
+ paddingTop: '0.5rem',
+ },
+ '&::-webkit-calendar-picker-indicator': {
+ position: 'absolute',
+ },
+ },
+ '.input-lg-dt-shared': {
+ '&::-webkit-datetime-edit': {
+ height: '2.875rem',
+ lineHeight: '2.875rem',
+ },
+ '&::-webkit-date-and-time-value': {
+ paddingTop: '0.625rem',
+ },
+ },
+ '.input-xl-dt-shared': {
+ '&::-webkit-datetime-edit': {
+ height: '3.5rem',
+ lineHeight: '3.5rem',
+ },
+ '&::-webkit-date-and-time-value': {
+ paddingTop: '1rem',
+ },
+ },
+ '.input-xl-dt-label': {
+ '&::-webkit-datetime-edit': {
+ height: '2.25rem',
+ lineHeight: '2.125rem',
+ },
+ '&::-webkit-date-and-time-value': {
+ paddingTop: 0,
+ },
+ },
+ '.input-d': {
+ '&::-webkit-calendar-picker-indicator': {
+ right: '0.875rem',
+ },
+ },
+ '.input-t': {
+ '&::-webkit-calendar-picker-indicator': {
+ right: '0.875rem',
+ },
+ },
+ '.input-d-rtl': {
+ //type === 'date' rtl
+ '&::-webkit-datetime-edit, &::-webkit-date-and-time-value': {
+ position: 'absolute',
+ right: '0',
+ },
+ '&::-webkit-calendar-picker-indicator': {
+ left: '0.5rem',
+ },
+ },
+ '.input-t-rtl': {
+ //type === 'time' rtl
+ '&::-webkit-datetime-edit, &::-webkit-date-and-time-value': {
+ position: 'absolute',
+ right: '0.5rem',
+ },
+ '&::-webkit-calendar-picker-indicator': {
+ left: '0.5rem',
+ },
+ },
+ '.input-dt-local-rtl': {
+ //type === 'datetime-local' rtl
+ '&::-webkit-datetime-edit, &::-webkit-date-and-time-value': {
+ position: 'absolute',
+ right: '0',
+ },
+ '&::-webkit-calendar-picker-indicator': {
+ left: '0.5rem',
+ },
+ },
+ '.input-rsb-hidden': {
+ '&:not(:hover):not(:focus):not(:invalid)': {
+ clipPath: `inset(calc(var(--border-i-width) * -1) 0.125rem calc(var(--border-i-width) * -1) 0)`,
+ },
+ },
+ '.input-lsb-hidden': {
+ '&:not(:hover):not(:focus):not(:invalid)': {
+ clipPath: `inset(calc(var(--border-i-width) * -1) 0 calc(var(--border-i-width) * -1) 0.125rem)`,
+ },
+ },
+ '.input-tbb-hidden': {
+ '&:not(:hover):not(:focus):not(:invalid)': {
+ clipPath: `inset(0.125rem calc(var(--border-i-width) * -1) 0 calc(var(--border-i-width) * -1))`,
+ },
+ },
+ '.input-bbb-hidden': {
+ '&:not(:hover):not(:focus):not(:invalid)': {
+ clipPath: `inset(0 calc(var(--border-i-width) * -1) 0.125rem calc(var(--border-i-width) * -1))`,
+ },
+ },
+ '.brcrumb-li': {
+ '& a, & span': {
+ padding: '0.5rem',
+ },
+ },
+ });
+ }),
],
};
diff --git a/lib/moon/backoffice_components/dropdown_multi_filter.ex b/lib/moon/backoffice_components/dropdown_multi_filter.ex
index 81f81c773..02b88aedf 100644
--- a/lib/moon/backoffice_components/dropdown_multi_filter.ex
+++ b/lib/moon/backoffice_components/dropdown_multi_filter.ex
@@ -3,7 +3,8 @@ defmodule Moon.BackofficeComponents.DropdownMultiFilterView do
alias Moon.Assets.Icons.IconZoom
alias Moon.Autolayouts.{LeftToRight, TopToDown}
- alias Moon.Components.{Button, CheckboxMultiselect, Divider, Form, Popover, TextInput}
+ alias Moon.Components.{Button, CheckboxMultiselect, Divider, Form, Popover}
+ alias Moon.Components.Deprecated.TextInput
prop show_filter, :boolean, required: true
prop search_text, :string, required: true
diff --git a/lib/moon/components/text_input.ex b/lib/moon/components/deprecated/text_input.ex
similarity index 98%
rename from lib/moon/components/text_input.ex
rename to lib/moon/components/deprecated/text_input.ex
index 4a0935873..5eed5328c 100644
--- a/lib/moon/components/text_input.ex
+++ b/lib/moon/components/deprecated/text_input.ex
@@ -1,4 +1,4 @@
-defmodule Moon.Components.TextInput do
+defmodule Moon.Components.Deprecated.TextInput do
@moduledoc false
use Moon.StatelessComponent
diff --git a/lib/moon/components/dropdown.ex b/lib/moon/components/dropdown.ex
index cb4f8b3bc..025150f5d 100644
--- a/lib/moon/components/dropdown.ex
+++ b/lib/moon/components/dropdown.ex
@@ -5,7 +5,7 @@ defmodule Moon.Components.Dropdown do
alias Moon.Assets.Icons.IconZoom
alias Moon.Components.Form
- alias Moon.Components.TextInput
+ alias Moon.Components.Deprecated.TextInput
prop(on_search_change, :event)
prop(search_placeholder, :string)
diff --git a/lib/moon/components/password_input.ex b/lib/moon/components/password_input.ex
index d24000a73..97dd82b74 100644
--- a/lib/moon/components/password_input.ex
+++ b/lib/moon/components/password_input.ex
@@ -2,7 +2,7 @@ defmodule Moon.Components.PasswordInput do
@moduledoc false
use Moon.StatefulComponent
- alias Moon.Components.TextInput
+ alias Moon.Components.Deprecated.TextInput
data hidden, :boolean, default: true
diff --git a/lib/moon/components/text_input/styled/container.ex b/lib/moon/components/text_input/styled/container.ex
new file mode 100644
index 000000000..6588b852a
--- /dev/null
+++ b/lib/moon/components/text_input/styled/container.ex
@@ -0,0 +1,28 @@
+defmodule Moon.Components.TextInput.Container do
+ @moduledoc false
+
+ use Moon.StatelessComponent
+
+ alias Moon.Components.TextInput.Utils
+
+ prop id, :string
+ prop disabled, :boolean, default: false
+ prop size, :string, values: ["md", "lg", "xl"]
+
+ slot default
+
+ def render(assigns) do
+ ~F"""
+
+ <#slot />
+
+ """
+ end
+end
diff --git a/lib/moon/components/text_input/styled/hint_text.ex b/lib/moon/components/text_input/styled/hint_text.ex
new file mode 100644
index 000000000..7ff74f56c
--- /dev/null
+++ b/lib/moon/components/text_input/styled/hint_text.ex
@@ -0,0 +1,20 @@
+defmodule Moon.Components.TextInput.HintText do
+ @moduledoc false
+
+ use Moon.StatelessComponent
+
+ prop is_error, :boolean, default: false
+
+ slot default
+
+ def render(assigns) do
+ ~F"""
+
+ <#slot />
+
+ """
+ end
+end
diff --git a/lib/moon/components/text_input/styled/input.ex b/lib/moon/components/text_input/styled/input.ex
new file mode 100644
index 000000000..50946ced0
--- /dev/null
+++ b/lib/moon/components/text_input/styled/input.ex
@@ -0,0 +1,152 @@
+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 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
+ 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/password.ex b/lib/moon/components/text_input/styled/password.ex
new file mode 100644
index 000000000..1ac20c035
--- /dev/null
+++ b/lib/moon/components/text_input/styled/password.ex
@@ -0,0 +1,124 @@
+defmodule Moon.Components.TextInput.Password do
+ @moduledoc false
+
+ use Moon.StatelessComponent
+
+ alias Moon.Components.TextInput.Utils
+
+ prop type, :string,
+ values: [
+ "password",
+ "text"
+ ],
+ 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
new file mode 100644
index 000000000..60138736c
--- /dev/null
+++ b/lib/moon/components/text_input/styled/show_password.ex
@@ -0,0 +1,35 @@
+defmodule Moon.Components.TextInput.ShowPassword do
+ @moduledoc false
+
+ use Moon.StatelessComponent
+
+ prop input_password_id, :string
+ prop toggle, :string, default: "toggle_password_visibility"
+
+ prop is_rtl, :boolean, default: false
+
+ slot default
+
+ def render(assigns) do
+ ~F"""
+
+ <#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
new file mode 100644
index 000000000..1e41d3a50
--- /dev/null
+++ b/lib/moon/components/text_input/subcomponents/text_input_basic.ex
@@ -0,0 +1,92 @@
+defmodule Moon.Components.TextInput.TextInputBasic do
+ @moduledoc false
+
+ use Moon.StatelessComponent
+ alias Moon.Components.TextInput.Container
+ alias Moon.Components.TextInput.Input
+ alias Moon.Components.TextInput.HintText
+
+ 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
+
+ slot hint_text_slot
+
+ def render(assigns) do
+ ~F"""
+
+
+
+
+ <#slot name="hint_text_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
new file mode 100644
index 000000000..3521f1280
--- /dev/null
+++ b/lib/moon/components/text_input/subcomponents/text_input_inner_label.ex
@@ -0,0 +1,104 @@
+defmodule Moon.Components.TextInput.TextInputInnerLabel do
+ @moduledoc false
+
+ use Moon.StatelessComponent
+ alias Moon.Components.TextInput.Container
+ alias Moon.Components.TextInput.Input
+ alias Moon.Components.TextInput.HintText
+ 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 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
+
+ slot hint_text_slot
+
+ def render(assigns) do
+ ~F"""
+
+
+
+
+
+
+ <#slot name="hint_text_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
new file mode 100644
index 000000000..64c8c9a9a
--- /dev/null
+++ b/lib/moon/components/text_input/subcomponents/text_input_password.ex
@@ -0,0 +1,152 @@
+defmodule Moon.Components.TextInput.TextInputPassword do
+ @moduledoc false
+
+ 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
+
+ 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
+
+ data password_shown, :boolean, default: false
+ data password, :string, default: ""
+
+ slot hint_text_slot
+
+ def render(assigns) do
+ ~F"""
+
+ {#if @size == "xl"}
+
+
+
+
+ {@show_password_text}
+
+
+
+ <#slot name="hint_text_slot" />
+
+ {#else}
+
+
+
+
+
+ {@show_password_text}
+
+
+
+
+
+ <#slot name="hint_text_slot" />
+
+ {/if}
+
+ """
+ end
+
+ def handle_event("toggle_password_visibility", _, socket) do
+ {:noreply, assign(socket, password_shown: !socket.assigns.password_shown)}
+ end
+
+ def handle_event("on_keyup", params, socket) do
+ {:noreply, assign(socket, password: params["value"])}
+ end
+
+ defp get_type(password_shown) do
+ if password_shown do
+ "text"
+ else
+ "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
new file mode 100644
index 000000000..5deaa605b
--- /dev/null
+++ b/lib/moon/components/text_input/text_input.ex
@@ -0,0 +1,137 @@
+defmodule Moon.Components.TextInput do
+ @moduledoc false
+
+ use Moon.StatelessComponent
+ alias Moon.Components.TextInput.TextInputBasic
+ alias Moon.Components.TextInput.TextInputInnerLabel
+ alias Moon.Components.TextInput.TextInputPassword
+
+ prop id, :string
+ prop size, :string, values: ["md", "lg", "xl"]
+
+ prop type, :string,
+ values: [
+ "date",
+ "datetime-local",
+ "email",
+ "number",
+ "password",
+ "search",
+ "tel",
+ "text",
+ "time",
+ "url"
+ ],
+ default: "text"
+
+ 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 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 readonly, :boolean
+ prop value, :string
+
+ prop focus, :event
+ prop keydown, :event
+ prop keyup, :event
+ prop blur, :event
+
+ slot hint_text_slot
+ slot show_password_text
+
+ def render(assigns) do
+ ~F"""
+ {#if @size == "xl"}
+
+ <:hint_text_slot>
+ <#slot name="hint_text_slot" />
+
+
+ {#elseif @type == "password"}
+
+ <:hint_text_slot>
+ <#slot name="hint_text_slot" />
+
+
+ {#else}
+
+ <:hint_text_slot>
+ <#slot name="hint_text_slot" />
+
+
+ {/if}
+ """
+ end
+end
diff --git a/lib/moon/components/text_input/utils/utils.ex b/lib/moon/components/text_input/utils/utils.ex
new file mode 100644
index 000000000..28fc3d86e
--- /dev/null
+++ b/lib/moon/components/text_input/utils/utils.ex
@@ -0,0 +1,59 @@
+defmodule Moon.Components.TextInput.Utils do
+ @moduledoc false
+
+ def get_border_radius(size) do
+ case size do
+ "xl" -> "rounded-moon-i-md"
+ "lg" -> "rounded-moon-i-sm"
+ _ -> "rounded-moon-i-sm"
+ end
+ end
+
+ def get_size_styles(size) do
+ case size do
+ "xl" ->
+ "h-14 leading-[3.5rem] rounded-moon-i-md hover:rounded-moon-i-md focus:rounded-moon-i-md invalid:rounded-moon-i-md"
+
+ "lg" ->
+ "h-12 leading-[3rem] rounded-moon-i-sm hover:rounded-moon-i-sm focus:rounded-moon-i-sm invalid:rounded-moon-i-sm"
+
+ _ ->
+ "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/left_menu.ex b/lib/moon_web/components/left_menu.ex
index cfac1a7c9..73330a91f 100644
--- a/lib/moon_web/components/left_menu.ex
+++ b/lib/moon_web/components/left_menu.ex
@@ -160,27 +160,7 @@ defmodule MoonWeb.Components.LeftMenu do
Tabs
Table
-
+ Text input
Text input group
Toast
diff --git a/lib/moon_web/pages/components/deprecated/text_input/text_input_page.ex b/lib/moon_web/pages/components/deprecated/text_input/text_input_page.ex
new file mode 100644
index 000000000..ef848e9cc
--- /dev/null
+++ b/lib/moon_web/pages/components/deprecated/text_input/text_input_page.ex
@@ -0,0 +1,267 @@
+defmodule MoonWeb.Pages.Components.TextInput.Deprecated.TextInputPage do
+ @moduledoc false
+
+ use MoonWeb, :live_view
+
+ alias Moon.Assets.Icons.IconMail
+ alias Moon.Assets.Icons.IconUser
+ alias Moon.Autolayouts.TopToDown
+ alias Moon.Components.Button
+ alias Moon.Components.ErrorTag
+ alias Moon.Components.Field
+ alias Moon.Components.Form
+ alias Moon.Components.Heading
+ alias Moon.Components.Deprecated.TextInput
+ alias MoonWeb.Components.ExampleAndCode
+ alias MoonWeb.Components.Page
+ alias MoonWeb.Pages.Tutorials.AddDataUsingForm.User
+ alias MoonWeb.Components.Table.Table
+ alias MoonWeb.Components.Table.Column
+
+ data breadcrumbs, :any,
+ default: [
+ %{
+ to: "#",
+ name: "Components"
+ },
+ %{
+ to: "/components/text_input",
+ name: "Text Input"
+ }
+ ]
+
+ data props_info_array, :list,
+ default: [
+ %{
+ :name => 'type',
+ :type =>
+ 'date | datetime-local" | email | number | password | search | tel | text | url | time | url',
+ :required => 'false',
+ :default => 'text',
+ :description => 'Different types of input'
+ },
+ %{
+ :name => 'size',
+ :type => 'medium | large | xlarge',
+ :required => '-',
+ :default => 'medium',
+ :description =>
+ 'TODO - Size variant (currently only medium | large, with large as default)'
+ },
+ %{
+ :name => 'label',
+ :type => 'string',
+ :required => 'true',
+ :default => '-',
+ :description => 'TODO - Should be required for medium size only'
+ },
+ %{
+ :name => 'placeholder',
+ :type => 'string',
+ :required => 'false',
+ :default => '-',
+ :description => 'Placeholder for input'
+ },
+ %{
+ :name => 'field',
+ :type => 'atom',
+ :required => 'true',
+ :default => '-',
+ :description => 'Field value for underlying pheonix text input component'
+ },
+ %{
+ :name => 'hint_text',
+ :type => 'slot',
+ :required => 'false',
+ :default => '-',
+ :description => 'Informative or error message under input'
+ },
+ %{
+ :name => 'error',
+ :type => 'boolean',
+ :required => 'false',
+ :default => '-',
+ :description => 'Set error state for input'
+ },
+ %{
+ :name => 'show_password_text',
+ :type => '-',
+ :required => '-',
+ :default => '-',
+ :description =>
+ 'TODO - Only for input type password. Text for toggle button: show/hide password'
+ },
+ %{
+ :name => 'background_color',
+ :type => 'string',
+ :required => 'false',
+ :default => '-',
+ :description => 'Background color'
+ }
+ ]
+
+ def render(assigns) do
+ ~F"""
+
+
+ Text Input
+
+
+ The input component is used when you need to let users enter the text of some kind, such as their name or phone number etc.
+
+
+
+
+ <:example>
+
+
+
+ <:code>{example_1_code()}
+
+ <:state>{example_1_state(assigns)}
+
+
+
+
+
TabLink Props Tabs
+
+
+ {item.name}
+
+
+ {item.type}
+
+
+ {item.required}
+
+
+ {item.default}
+
+
+ {item.description}
+
+
+
+
+
+ """
+ end
+
+ 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 get_has_valid_username(user_changeset) do
+ !Keyword.has_key?(user_changeset.errors, :username)
+ 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 handle_event("clear_username", _, socket) do
+ user_changeset =
+ User.changeset(socket.assigns.user, %{
+ username: "",
+ email: socket.assigns.user_changeset.changes["email"]
+ })
+
+ {:noreply, assign(socket, user_changeset: user_changeset)}
+ end
+
+ def example_1_code do
+ """
+
+ """
+ end
+
+ def example_1_state(assigns) do
+ ~F"""
+ @user_changeset = {inspect(@user_changeset, pretty: true)}
+ @user = {inspect(@user, pretty: true)}
+ """
+ end
+end
diff --git a/lib/moon_web/pages/components/select/dropdown_page.ex b/lib/moon_web/pages/components/select/dropdown_page.ex
index b1e750a52..6af413945 100644
--- a/lib/moon_web/pages/components/select/dropdown_page.ex
+++ b/lib/moon_web/pages/components/select/dropdown_page.ex
@@ -16,7 +16,7 @@ defmodule MoonWeb.Pages.Components.Select.DropdownPage do
alias Moon.Components.ListItems.SingleLineItem
alias Moon.Components.Tabs
alias Moon.Components.Tabs.TabLink
- alias Moon.Components.TextInput
+ alias Moon.Components.Deprecated.TextInput
alias MoonWeb.Components.ExampleAndCode
alias MoonWeb.Components.Page
alias MoonWeb.Pages.Tutorials.AddDataUsingForm.User
diff --git a/lib/moon_web/pages/components/text_input/date_page.ex b/lib/moon_web/pages/components/text_input/date_page.ex
deleted file mode 100644
index 2cef13914..000000000
--- a/lib/moon_web/pages/components/text_input/date_page.ex
+++ /dev/null
@@ -1,40 +0,0 @@
-defmodule MoonWeb.Pages.Components.TextInput.DatePage do
- @moduledoc false
-
- use MoonWeb, :live_view
-
- alias Moon.Autolayouts.TopToDown
- alias Moon.Components.Heading
- alias MoonWeb.Components.Page
-
- data breadcrumbs, :any,
- default: [
- %{
- to: "#",
- name: "Components"
- },
- %{
- to: "/components/text-input/date",
- name: "Date"
- }
- ]
-
- 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"""
-
-
- Date
-
- Coming soon
-
- """
- end
-end
diff --git a/lib/moon_web/pages/components/text_input/date_time_page.ex b/lib/moon_web/pages/components/text_input/date_time_page.ex
deleted file mode 100644
index 9b780ddd1..000000000
--- a/lib/moon_web/pages/components/text_input/date_time_page.ex
+++ /dev/null
@@ -1,40 +0,0 @@
-defmodule MoonWeb.Pages.Components.TextInput.DateTimePage do
- @moduledoc false
-
- use MoonWeb, :live_view
-
- alias Moon.Autolayouts.TopToDown
- alias Moon.Components.Heading
- alias MoonWeb.Components.Page
-
- data breadcrumbs, :any,
- default: [
- %{
- to: "#",
- name: "Components"
- },
- %{
- to: "/components/text-input/date-time",
- name: "Date Time"
- }
- ]
-
- 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"""
-
-
- Date Time
-
- Coming soon
-
- """
- end
-end
diff --git a/lib/moon_web/pages/components/text_input/email_page.ex b/lib/moon_web/pages/components/text_input/email_page.ex
deleted file mode 100644
index def92094f..000000000
--- a/lib/moon_web/pages/components/text_input/email_page.ex
+++ /dev/null
@@ -1,40 +0,0 @@
-defmodule MoonWeb.Pages.Components.TextInput.EmailPage do
- @moduledoc false
-
- use MoonWeb, :live_view
-
- alias Moon.Autolayouts.TopToDown
- alias Moon.Components.Heading
- alias MoonWeb.Components.Page
-
- data breadcrumbs, :any,
- default: [
- %{
- to: "#",
- name: "Components"
- },
- %{
- to: "/components/text-input/date-time",
- name: "Date Time"
- }
- ]
-
- 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"""
-
-
- Date Time
-
- Coming soon
-
- """
- end
-end
diff --git a/lib/moon_web/pages/components/text_input/number_page.ex b/lib/moon_web/pages/components/text_input/number_page.ex
deleted file mode 100644
index 0a6385783..000000000
--- a/lib/moon_web/pages/components/text_input/number_page.ex
+++ /dev/null
@@ -1,40 +0,0 @@
-defmodule MoonWeb.Pages.Components.TextInput.NumberPage do
- @moduledoc false
-
- use MoonWeb, :live_view
-
- alias Moon.Autolayouts.TopToDown
- alias Moon.Components.Heading
- alias MoonWeb.Components.Page
-
- data breadcrumbs, :any,
- default: [
- %{
- to: "#",
- name: "Components"
- },
- %{
- to: "/components/text-input/number",
- name: "Number"
- }
- ]
-
- 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"""
-
-
- Number
-
- Coming soon
-
- """
- end
-end
diff --git a/lib/moon_web/pages/components/text_input/password_page.ex b/lib/moon_web/pages/components/text_input/password_page.ex
deleted file mode 100644
index 6e0f06a64..000000000
--- a/lib/moon_web/pages/components/text_input/password_page.ex
+++ /dev/null
@@ -1,137 +0,0 @@
-defmodule MoonWeb.Pages.Components.TextInput.PasswordPage do
- @moduledoc false
-
- use MoonWeb, :live_view
-
- alias Moon.Autolayouts.TopToDown
- alias Moon.Components.Button
- alias Moon.Components.ErrorTag
- alias Moon.Components.Field
- alias Moon.Components.Form
- alias Moon.Components.Heading
- alias Moon.Components.PasswordInput
- alias MoonWeb.Components.ExampleAndCode
- alias MoonWeb.Components.Page
- alias MoonWeb.Pages.Tutorials.AddDataUsingForm.User
-
- data breadcrumbs, :any,
- default: [
- %{
- to: "#",
- name: "Components"
- },
- %{
- to: "/components/text-input/password",
- name: "Password"
- }
- ]
-
- def mount(params, _session, socket) do
- user_changeset =
- User.changeset(%User{}, %{
- password: ""
- })
-
- {:ok,
- assign(socket,
- theme_name: params["theme_name"] || "moon-design-light",
- active_page: __MODULE__,
- user_changeset: user_changeset
- )}
- end
-
- def handle_params(_params, uri, socket) do
- {:noreply, assign(socket, uri: uri)}
- end
-
- def render(assigns) do
- ~F"""
-
-
- Password Input
-
-
-
- <:example>
-
-
-
- <:code>{example_1_code()}
-
- <:state>{example_1_state(assigns)}
-
-
-
-
- """
- end
-
- def handle_event(
- "login_form_update",
- %{
- "user" => %{
- "password" => password
- }
- },
- socket
- ) do
- user_changeset =
- User.changeset(%User{}, %{
- password: password
- })
-
- {:noreply, assign(socket, user_changeset: user_changeset)}
- end
-
- def handle_event("login_form_submit", _, socket) do
- user_changeset = Map.merge(socket.assigns.user_changeset, %{action: :insert})
-
- {:noreply, assign(socket, user_changeset: user_changeset)}
- end
-
- def example_1_code do
- """
-
- """
- end
-
- def example_1_state(assigns) do
- ~F"""
- @user_changeset = {inspect(@user_changeset, pretty: true)}
- """
- end
-end
diff --git a/lib/moon_web/pages/components/text_input/search_page.ex b/lib/moon_web/pages/components/text_input/search_page.ex
deleted file mode 100644
index 7b8cbca17..000000000
--- a/lib/moon_web/pages/components/text_input/search_page.ex
+++ /dev/null
@@ -1,40 +0,0 @@
-defmodule MoonWeb.Pages.Components.TextInput.SearchPage do
- @moduledoc false
-
- use MoonWeb, :live_view
-
- alias Moon.Autolayouts.TopToDown
- alias Moon.Components.Heading
- alias MoonWeb.Components.Page
-
- data breadcrumbs, :any,
- default: [
- %{
- to: "#",
- name: "Components"
- },
- %{
- to: "/components/text-input/search",
- name: "Search"
- }
- ]
-
- 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"""
-
-
- Search
-
- Coming soon
-
- """
- end
-end
diff --git a/lib/moon_web/pages/components/text_input/telephone_page.ex b/lib/moon_web/pages/components/text_input/telephone_page.ex
deleted file mode 100644
index 1d8c9b376..000000000
--- a/lib/moon_web/pages/components/text_input/telephone_page.ex
+++ /dev/null
@@ -1,40 +0,0 @@
-defmodule MoonWeb.Pages.Components.TextInput.TelephonePage do
- @moduledoc false
-
- use MoonWeb, :live_view
-
- alias Moon.Autolayouts.TopToDown
- alias Moon.Components.Heading
- alias MoonWeb.Components.Page
-
- data breadcrumbs, :any,
- default: [
- %{
- to: "#",
- name: "Components"
- },
- %{
- to: "/components/text-input/telephone",
- name: "Telephone"
- }
- ]
-
- 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"""
-
-
- Telephone
-
- Coming soon
-
- """
- 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 7276a367a..25162dd86 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
@@ -1,20 +1,19 @@
-defmodule MoonWeb.Pages.Components.TextInput.TextInputPage do
+defmodule MoonWeb.Pages.Components.TextInputPage do
@moduledoc false
use MoonWeb, :live_view
- alias Moon.Assets.Icons.IconMail
- alias Moon.Assets.Icons.IconUser
alias Moon.Autolayouts.TopToDown
- alias Moon.Components.Button
- alias Moon.Components.ErrorTag
- alias Moon.Components.Field
- alias Moon.Components.Form
- alias Moon.Components.Heading
- alias Moon.Components.TextInput
alias MoonWeb.Components.ExampleAndCode
alias MoonWeb.Components.Page
+ alias Moon.Components.TextInput
+ alias Moon.Components.Heading
+ alias Moon.Autolayouts.LeftToRight
+ alias Moon.Components.Form
+ alias Moon.Components.Button
alias MoonWeb.Pages.Tutorials.AddDataUsingForm.User
+ alias Moon.Components.Field
+ alias Moon.Components.ErrorTag
alias MoonWeb.Components.Table.Table
alias MoonWeb.Components.Table.Column
@@ -45,15 +44,14 @@ defmodule MoonWeb.Pages.Components.TextInput.TextInputPage do
:type => 'medium | large | xlarge',
:required => '-',
:default => 'medium',
- :description =>
- 'TODO - Size variant (currently only medium | large, with large as default)'
+ :description => 'Size variant (currently only medium | large, with large as default)'
},
%{
:name => 'label',
:type => 'string',
:required => 'true',
:default => '-',
- :description => 'TODO - Should be required for medium size only'
+ :description => 'Required for medium size only'
},
%{
:name => 'placeholder',
@@ -88,8 +86,7 @@ defmodule MoonWeb.Pages.Components.TextInput.TextInputPage do
:type => '-',
:required => '-',
:default => '-',
- :description =>
- 'TODO - Only for input type password. Text for toggle button: show/hide password'
+ :description => 'Only for input type password. Text for toggle button: show/hide password'
},
%{
:name => 'background_color',
@@ -97,6 +94,13 @@ defmodule MoonWeb.Pages.Components.TextInput.TextInputPage do
:required => 'false',
:default => '-',
:description => 'Background color'
+ },
+ %{
+ :name => 'id',
+ :type => 'string',
+ :required => 'false | required (for password type)',
+ :default => '-',
+ :description => 'Unique id'
}
]
@@ -106,54 +110,305 @@ defmodule MoonWeb.Pages.Components.TextInput.TextInputPage do
Text Input
-
- The input component is used when you need to let users enter the text of some kind, such as their name or phone number etc.
-
+
+ <:example>
+
+
+
+
+
+
+
+ <:code>{text_input_020_code()}
+
+
+ Text Input Types
+
+
+ <:example>
+
+
+
+
+
+
+
+ <:code>{text_input_010_code()}
+
+
+
+ <:example>
+
+
+
+
+
+
+
+ <:code>{text_input_009_code()}
+
+
+
+ <:example>
+
+
+
+
+
+
+
+ <:code>{text_input_008_code()}
+
+
+
+ <:example>
+
+
+
+
+
+
+
+ <:code>{text_input_007_code()}
+
+
+
+ <:example>
+
+
+
+
+
+
+
+ <:code>{text_input_006_code()}
+
+
+
+ <:example>
+
+
+
+
+
+
+
+ <:code>{text_input_005_code()}
+
+
+
+ <:example>
+
+
+
+
+
+
+
+ <:code>{text_input_004_code()}
+
+
+ Text input attributes
+
+
+ <:example>
+
+
+
+
+
+
+
+ <:code>{text_input_20_code()}
+
+
+
+ <:example>
+
+
+ <:hint_text_slot>Informative message holder
+
+
+ <:hint_text_slot>Informative message holder
+
+
+ <:hint_text_slot>Informative message holder
+
+
+
+
+ <:code>{text_input_30_code()}
+
-
-
- <:example>
-
-
-
- <:code>{example_1_code()}
-
- <:state>{example_1_state(assigns)}
-
-
+
+ <:example>
+
+
+
+
+
+
+
+ <:code>{text_input_40_code()}
+
+
+
+ <:example>
+
+
+
+
+
+
+
+ <:code>{text_input_50_code()}
+
+
+
+ <:example>
+
+
+
+
+
+
+
+ <:code>{text_input_60_code()}
+
+
+
+ <:example>
+
+
+ <:hint_text_slot>Informative message holder
+
+
+ <:hint_text_slot>Informative message holder
+
+
+ <:hint_text_slot>Informative message holder
+
+
+
+
+ <:code>{text_input_70_code()}
+
+
+
+ <:example>
+
+
+ <:hint_text_slot>Informative message holder
+
+
+ <:hint_text_slot>Informative message holder
+
+
+ <:hint_text_slot>Informative message holder
+
+
+
+
+ <:code>{text_input_70_code()}
+
+
+
+ <:example>
+
+
+
+ <:code>{text_input_90_code()}
+
+ <:state>{text_input_90_state(assigns)}
+
TabLink Props Tabs
@@ -180,51 +435,253 @@ defmodule MoonWeb.Pages.Components.TextInput.TextInputPage do
"""
end
- def mount(params, _session, socket) do
- user = %User{}
- user_changeset = User.changeset(user, %{})
+ def text_input_020_code do
+ """
+
+
+
+ """
+ end
- {:ok,
- assign(socket,
- theme_name: params["theme_name"] || "moon-design-light",
- active_page: __MODULE__,
- user: user,
- user_changeset: user_changeset
- )}
+ def text_input_010_code do
+ """
+
+
+
+ """
end
- def handle_params(_params, uri, socket) do
- {:noreply, assign(socket, uri: uri)}
+ def text_input_009_code do
+ """
+
+
+
+ """
end
- def get_has_valid_username(user_changeset) do
- !Keyword.has_key?(user_changeset.errors, :username)
+ def text_input_008_code do
+ """
+
+
+
+ """
end
- def handle_event("register_form_update", params, socket) do
- user_changeset = User.changeset(socket.assigns.user, params["user"])
+ def text_input_007_code do
+ """
+
+
+
+ """
+ end
- {:noreply, assign(socket, user_changeset: user_changeset)}
+ def text_input_006_code do
+ """
+
+
+
+ """
end
- def handle_event("register_form_submit", params, socket) do
- user_changeset =
- User.changeset(socket.assigns.user, params["user"]) |> Map.merge(%{action: :insert})
+ def text_input_005_code do
+ """
+
+
+
+ """
+ end
- {:noreply, assign(socket, user_changeset: user_changeset)}
+ def text_input_004_code do
+ """
+
+
+
+ """
end
- def handle_event("clear_username", _, socket) do
- user_changeset =
- User.changeset(socket.assigns.user, %{
- username: "",
- email: socket.assigns.user_changeset.changes["email"]
- })
+ def text_input_20_code do
+ """
+
+
+
+ """
+ end
- {:noreply, assign(socket, user_changeset: user_changeset)}
+ def text_input_30_code do
+ """
+
+ <:hint_text_slot>Informative message holder
+
+
+ <:hint_text_slot>Informative message holder
+
+
+ <:hint_text_slot>Informative message holder
+
+ """
+ end
+
+ def text_input_40_code do
+ """
+
+
+
+ """
end
- def example_1_code do
+ def text_input_50_code do
+ """
+
+
+
+ """
+ end
+
+ def text_input_60_code do
+ """
+
+
+
+ """
+ end
+
+ def text_input_70_code do
+ """
+
+ <:hint_text_slot>Informative message holder
+
+
+ <:hint_text_slot>Informative message holder
+
+
+ <:hint_text_slot>Informative message holder
+
+ """
+ end
+
+ def text_input_80_code do
+ """
+
+ <:hint_text_slot>Informative message holder
+
+
+ <:hint_text_slot>Informative message holder
+
+
+ <:hint_text_slot>Informative message holder
+
+ """
+ end
+
+ def text_input_90_code do
"""