use leptos::prelude::*;
use super::checkbox_ui::Checkbox as CheckboxUi;
pub use canonrs_core::primitives::CheckboxState;
use canonrs_core::meta::DisabledState;
#[component]
pub fn Checkbox(
children: Children,
#[prop(default = false)] checked: bool,
#[prop(default = false)] disabled: bool,
#[prop(into, default = String::new())] name: String,
#[prop(into, default = String::new())] class: String,
) -> impl IntoView {
let checked_state = if checked { CheckboxState::Checked } else { CheckboxState::Unchecked };
let disabled_state = if disabled { DisabledState::Disabled } else { DisabledState::Enabled };
view! {
<CheckboxUi checked=checked_state disabled=disabled_state name=name class=class>
{children()}
</CheckboxUi>
}
}