// MIT License // Copyright (c) 2026 Koncreate // See LICENSE for details import lustre/attribute.{type Attribute, attribute, class} import lustre/element.{type Element} import lustre/element/html import ui/size as size_helpers pub type Variant { Default Muted } pub type Size { Small Medium Large } pub fn virtualizer( attributes: List(Attribute(a)), children: List(Element(a)), ) -> Element(a) { html.div( [ class( "relative overflow-auto rounded-md border border-input bg-background", ), attribute("role", "listbox"), attribute("aria-activedescendant", ""), ..attributes ], children, ) } pub fn item( attributes: List(Attribute(a)), children: List(Element(a)), ) -> Element(a) { html.div( [class("px-2 py-1.5 text-sm"), attribute("role", "option"), ..attributes], children, ) } pub fn variant(v: Variant) -> Attribute(a) { case v { Default -> class("bg-background text-foreground") Muted -> class("bg-muted text-muted-foreground") } } pub fn size(s: Size) -> Attribute(a) { case s { Small -> class(size_helpers.text_class(size_helpers.Small)) Medium -> class(size_helpers.text_class(size_helpers.Medium)) Large -> class(size_helpers.text_class(size_helpers.Large)) } } pub fn aria_label(label: String) -> Attribute(a) { attribute("aria-label", label) } pub fn activedescendant(id: String) -> Attribute(a) { attribute("aria-activedescendant", id) }