+ }
+}
+
+fn main() {
+ console_error_panic_hook::set_once();
+ wasm_logger::init(wasm_logger::Config::default());
+ leptos::mount::mount_to_body(|| view! { })
+}
diff --git a/src/leptos.rs b/src/leptos.rs
new file mode 100644
index 0000000..21e85e2
--- /dev/null
+++ b/src/leptos.rs
@@ -0,0 +1,515 @@
+#![allow(unused)]
+
+use crate::countries::COUNTRY_CODES;
+use leptos::{prelude::*, *};
+
+/// A custom input component that handles user input and validation.
+///
+/// # Arguments
+/// * `props` - The properties of the component.
+/// - `valid_handle` - A state hook to track the validity of the input.
+/// - `aria_invalid` - A string representing the 'aria-invalid' attribute value for accessibility. Defaults to "true".
+/// - `aria_required` - A string representing the 'aria-required' attribute value for accessibility. Defaults to "true".
+/// - `r#type` - The type of the input element. Defaults to "text".
+/// - `handle` - A state hook to set the value of the input.
+/// - `validate_function` - A function to validate the input value.
+///
+/// # Returns
+/// (IntoView): A Leptos element representation of the input component.
+///
+/// # Examples
+/// ```rust
+/// use leptos::{prelude::*, *};
+/// use regex::Regex;
+/// use serde::{Deserialize, Serialize};
+/// use input_rs::leptos::Input;
+///
+///
+/// #[derive(Debug, Default, Clone, Serialize, Deserialize)]
+/// struct LoginUserSchema {
+/// email: String,
+/// password: String,
+/// }
+///
+/// fn validate_email(email: String) -> bool {
+/// let pattern = Regex::new(r"^[^ ]+@[^ ]+\.[a-z]{2,3}$").unwrap();
+/// pattern.is_match(&email)
+/// }
+///
+/// fn validate_password(password: String) -> bool {
+/// !&password.is_empty()
+/// }
+///
+/// #[component]
+/// fn LoginForm() -> impl IntoView {
+/// let error_handle = signal(String::default());
+/// let error = error_handle.0.get();
+///
+/// let email_valid_handle = signal(true);
+/// let email_valid = email_valid_handle.0.get();
+///
+/// let password_valid_handle = signal(true);
+/// let password_valid = password_valid_handle.0.get();
+///
+/// let email_handle = signal(String::default());
+/// let email = email_handle.0.get();
+///
+/// let password_handle = signal(String::default());
+/// let password = password_handle.0.get();
+///
+/// let onsubmit = move |ev: leptos::ev::SubmitEvent| {
+/// ev.prevent_default();
+///
+/// let email_ref = email.clone();
+/// let password_ref = password.clone();
+/// let error_handle = error_handle.clone();
+///
+/// // Custom logic for your endpoint goes here
+/// };
+///
+/// view! {
+///
+///
+///
{"Sign In"}
+/// { move || if !error.is_empty() {
+/// Some(view! {
error
})
+/// }
+/// else {None}
+/// }
+///
+///
+///
+/// }
+/// }
+/// ```
+#[component]
+pub fn Input(
+ /// Props for a custom input component.
+ /// This struct includes all possible attributes for an HTML `` element.
+ /// See [MDN docs](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) for more details.
+ ///
+ /// The type of the input, e.g., "text", "password", etc.
+ #[prop(default = "text")]
+ r#type: &'static str,
+
+ /// The label to be displayed for the input field.
+ #[prop(default = "")]
+ label: &'static str,
+
+ /// The name of the input field, used for form submission and accessibility.
+ #[prop(default = "")]
+ name: &'static str,
+
+ /// Indicates whether the input is required or not.
+ #[prop(default = false)]
+ required: bool,
+
+ /// The error message to display when there is a validation error.
+ #[prop(default = "")]
+ error_message: &'static str,
+
+ /// The CSS class to be applied to all inner elements.
+ #[prop(default = "")]
+ input_class: &'static str,
+
+ /// The CSS class to be applied to the inner input element and icon.
+ #[prop(default = "")]
+ field_class: &'static str,
+
+ /// The CSS class to be applied to the label for the input element.
+ #[prop(default = "")]
+ label_class: &'static str,
+
+ /// The CSS class to be applied to the input element.
+ #[prop(default = "")]
+ class: &'static str,
+
+ /// The CSS class to be applied to the error div element.
+ #[prop(default = "")]
+ error_class: &'static str,
+
+ /// The CSS class to be applied to the icon element.
+ #[prop(default = "")]
+ icon_class: &'static str,
+
+ /// The state handle for managing the value of the input.
+ handle: (ReadSignal, WriteSignal),
+
+ /// The state handle for managing the validity state of the input.
+ valid_handle: (ReadSignal, WriteSignal),
+
+ /// A callback function to validate the input value. It takes a `String` as input and returns a `bool`.
+ validate_function: fn(String) -> bool,
+
+ /// The icon when the password is visible. Assuming fontawesome icons are used by default.
+ #[prop(
+ default = "cursor-pointer right-4 top-1 text-2xl text-gray-600 toggle-button fa fa-eye"
+ )]
+ eye_active: &'static str,
+
+ /// The icon when the password is not visible. Assuming fontawesome icons are used by default.
+ #[prop(
+ default = "cursor-pointer right-4 top-1 text-2xl text-gray-600 toggle-button fa fa-eye-slash"
+ )]
+ eye_disabled: &'static str,
+
+ // Accessibility and SEO-related attributes:
+ /// The ID attribute of the input element.
+ #[prop(default = "")]
+ id: &'static str,
+
+ /// The placeholder text to be displayed in the input element.
+ #[prop(default = "")]
+ placeholder: &'static str,
+
+ /// The aria-label attribute for screen readers, providing a label for accessibility.
+ #[prop(default = "")]
+ aria_label: &'static str,
+
+ /// The aria-required attribute for screen readers, indicating whether the input is required.
+ #[prop(default = "true")]
+ aria_required: &'static str,
+
+ /// The aria-invalid attribute for screen readers, indicating whether the input value is invalid.
+ #[prop(default = "true")]
+ aria_invalid: &'static str,
+
+ /// The aria-describedby attribute for screen readers, describing the input element's error message.
+ #[prop(default = "")]
+ aria_describedby: &'static str,
+
+ // Newly added attributes from MDN:
+ /// Hint for expected file type in file upload controls.
+ #[prop(default = "")]
+ accept: &'static str,
+
+ /// The alternative text for ``. Required for accessibility.
+ #[prop(default = "")]
+ alt: &'static str,
+
+ /// Controls automatic capitalization in inputted text.
+ #[prop(default = "")]
+ autocapitalize: &'static str,
+
+ /// Hint for the browser's autofill feature.
+ #[prop(default = "")]
+ autocomplete: &'static str,
+
+ /// Media capture input method in file upload controls.
+ #[prop(default = "")]
+ capture: &'static str,
+
+ /// Whether the control is checked (for checkboxes or radio buttons).
+ #[prop(default = false)]
+ checked: bool,
+
+ /// Name of the form field to use for sending the element's directionality in form submission.
+ #[prop(default = "")]
+ dirname: &'static str,
+
+ /// Whether the form control is disabled.
+ #[prop(default = false)]
+ disabled: bool,
+
+ /// Associates the input with a specific form element.
+ #[prop(default = "")]
+ form: &'static str,
+
+ /// URL to use for form submission (for ``).
+ #[prop(default = "")]
+ formaction: &'static str,
+
+ /// Form data set encoding type for submission (for ``).
+ #[prop(default = "")]
+ formenctype: &'static str,
+
+ /// HTTP method to use for form submission (for ``).
+ #[prop(default = "")]
+ formmethod: &'static str,
+
+ /// Bypass form validation for submission (for ``).
+ #[prop(default = false)]
+ formnovalidate: bool,
+
+ /// Browsing context for form submission (for ``).
+ #[prop(default = "")]
+ formtarget: &'static str,
+
+ /// Same as the `height` attribute for `` elements.
+ #[prop(default = None)]
+ height: Option,
+
+ /// ID of the `