use super::*;
#[component]
pub fn euv_sheet(node: VirtualNode<EuvSheetProps>) -> VirtualNode {
let EuvSheetProps {
open: _open,
side: _side,
}: EuvSheetProps = node.try_get_props().unwrap_or_default();
let children: VirtualNode = node.get_children().into();
html! {
div {
"data-slot": "sheet"
class: c_euv_sheet()
children
}
}
}
#[component]
pub fn euv_sheet_trigger(node: VirtualNode<EuvSheetTriggerProps>) -> VirtualNode {
let EuvSheetTriggerProps { open, label }: EuvSheetTriggerProps =
node.try_get_props().unwrap_or_default();
let on_click: Option<Rc<dyn Fn(Event)>> = Some(Rc::new(move |_: Event| {
open.set(true);
}));
let shadcn_class: Css = if cfg!(feature = "theme-shadcn") {
c_euv_sheet_trigger_shadcn().clone()
} else {
Css::default()
};
html! {
button {
type: "button"
"data-slot": "sheet-trigger"
"aria-expanded": if { open.get() } {
"true"
} else {
"false"
}
class: c_euv_sheet_trigger()
class: shadcn_class
onclick: on_click
{
label
}
}
}
}
#[component]
pub fn euv_sheet_overlay(node: VirtualNode<EuvSheetOverlayProps>) -> VirtualNode {
let EuvSheetOverlayProps { open }: EuvSheetOverlayProps =
node.try_get_props().unwrap_or_default();
html! {
div {
"data-slot": "sheet-overlay"
class: c_euv_sheet_overlay()
class: if { open } {
c_euv_sheet_overlay_open()
} else {
c_euv_sheet_overlay_closed()
}
}
}
}
#[component]
pub fn euv_sheet_content(node: VirtualNode<EuvSheetContentProps>) -> VirtualNode {
let EuvSheetContentProps { open, side }: EuvSheetContentProps =
node.try_get_props().unwrap_or_default();
let side_class: fn() -> &'static Css = match side {
EuvSheetSide::Top => c_euv_sheet_content_top,
EuvSheetSide::Bottom => c_euv_sheet_content_bottom,
EuvSheetSide::Left => c_euv_sheet_content_left,
EuvSheetSide::Right => c_euv_sheet_content_right,
};
let children: VirtualNode = node.get_children().into();
html! {
div {
role: "dialog"
"aria-modal": "true"
"data-slot": "sheet-content"
class: c_euv_sheet_content()
class: side_class()
class: if { open } {
c_euv_sheet_content_open()
} else {
c_euv_sheet_content_closed()
}
children
}
}
}
#[component]
pub fn euv_sheet_header(node: VirtualNode<EuvSheetHeaderProps>) -> VirtualNode {
let EuvSheetHeaderProps { label }: EuvSheetHeaderProps =
node.try_get_props().unwrap_or_default();
let children: VirtualNode = node.get_children().into();
html! {
div {
"aria-label": label
"data-slot": "sheet-header"
class: c_euv_sheet_header()
children
}
}
}
#[component]
pub fn euv_sheet_footer(node: VirtualNode<EuvSheetFooterProps>) -> VirtualNode {
let EuvSheetFooterProps { label }: EuvSheetFooterProps =
node.try_get_props().unwrap_or_default();
let children: VirtualNode = node.get_children().into();
html! {
div {
"aria-label": label
"data-slot": "sheet-footer"
class: c_euv_sheet_footer()
children
}
}
}
#[component]
pub fn euv_sheet_title(node: VirtualNode<EuvSheetTitleProps>) -> VirtualNode {
let EuvSheetTitleProps { text }: EuvSheetTitleProps = node.try_get_props().unwrap_or_default();
html! {
h2 {
"data-slot": "sheet-title"
class: c_euv_sheet_title()
{
text
}
}
}
}
#[component]
pub fn euv_sheet_description(node: VirtualNode<EuvSheetDescriptionProps>) -> VirtualNode {
let EuvSheetDescriptionProps { text }: EuvSheetDescriptionProps =
node.try_get_props().unwrap_or_default();
html! {
p {
"data-slot": "sheet-description"
class: c_euv_sheet_description()
{
text
}
}
}
}
#[component]
pub fn euv_sheet_close(node: VirtualNode<EuvSheetCloseProps>) -> VirtualNode {
let EuvSheetCloseProps { label }: EuvSheetCloseProps = node.try_get_props().unwrap_or_default();
html! {
button {
type: "button"
"aria-label": label
"data-slot": "sheet-close"
class: c_euv_sheet_close()
}
}
}