This commit is contained in:
2026-04-28 01:54:09 +02:00
parent b6f48103e7
commit 9cd56b6ae0
2 changed files with 50 additions and 22 deletions
+41 -18
View File
@@ -1,20 +1,38 @@
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_primitives::select::{ use dioxus_primitives::select::{
self, SelectGroupLabelProps, SelectGroupProps, SelectListProps, SelectOptionProps, SelectProps, self, SelectGroupLabelProps, SelectGroupProps, SelectListProps, SelectMultiProps,
SelectTriggerProps, SelectValueProps, SelectOptionProps, SelectProps, SelectTriggerProps, SelectValueProps,
}; };
use dioxus_primitives::icon;
#[component] #[component]
pub fn Select<T: Clone + PartialEq + 'static>(props: SelectProps<T>) -> Element { pub fn Select<T: Clone + PartialEq + 'static>(props: SelectProps<T>) -> Element {
rsx! { rsx! {
select::Select { select::Select {
class: "select", class: "dx-select",
value: props.value, value: props.value,
default_value: props.default_value, default_value: props.default_value,
on_value_change: props.on_value_change, on_value_change: props.on_value_change,
disabled: props.disabled, disabled: props.disabled,
name: props.name, name: props.name,
placeholder: props.placeholder, roving_loop: props.roving_loop,
typeahead_timeout: props.typeahead_timeout,
attributes: props.attributes,
{props.children}
}
}
}
#[component]
pub fn SelectMulti<T: Clone + PartialEq + 'static>(props: SelectMultiProps<T>) -> Element {
rsx! {
select::SelectMulti {
class: "dx-select",
values: props.values,
default_values: props.default_values,
on_values_change: props.on_values_change,
disabled: props.disabled,
name: props.name,
roving_loop: props.roving_loop, roving_loop: props.roving_loop,
typeahead_timeout: props.typeahead_timeout, typeahead_timeout: props.typeahead_timeout,
attributes: props.attributes, attributes: props.attributes,
@@ -26,12 +44,13 @@ pub fn Select<T: Clone + PartialEq + 'static>(props: SelectProps<T>) -> Element
#[component] #[component]
pub fn SelectTrigger(props: SelectTriggerProps) -> Element { pub fn SelectTrigger(props: SelectTriggerProps) -> Element {
rsx! { rsx! {
select::SelectTrigger { attributes: props.attributes, select::SelectTrigger { class: "dx-select-trigger", attributes: props.attributes,
{props.children} {props.children}
svg { icon::Icon {
class: "select-expand-icon", class: "dx-select-expand-icon",
view_box: "0 0 24 24", width: "20px",
xmlns: "http://www.w3.org/2000/svg", height: "20px",
stroke: "var(--primary-color-7)",
polyline { points: "6 9 12 15 18 9" } polyline { points: "6 9 12 15 18 9" }
} }
} }
@@ -41,7 +60,10 @@ pub fn SelectTrigger(props: SelectTriggerProps) -> Element {
#[component] #[component]
pub fn SelectValue(props: SelectValueProps) -> Element { pub fn SelectValue(props: SelectValueProps) -> Element {
rsx! { rsx! {
select::SelectValue { attributes: props.attributes } select::SelectValue {
placeholder: props.placeholder,
attributes: props.attributes,
}
} }
} }
@@ -49,7 +71,7 @@ pub fn SelectValue(props: SelectValueProps) -> Element {
pub fn SelectList(props: SelectListProps) -> Element { pub fn SelectList(props: SelectListProps) -> Element {
rsx! { rsx! {
select::SelectList { select::SelectList {
class: "select-list", class: "dx-select-list",
id: props.id, id: props.id,
attributes: props.attributes, attributes: props.attributes,
{props.children} {props.children}
@@ -61,7 +83,7 @@ pub fn SelectList(props: SelectListProps) -> Element {
pub fn SelectGroup(props: SelectGroupProps) -> Element { pub fn SelectGroup(props: SelectGroupProps) -> Element {
rsx! { rsx! {
select::SelectGroup { select::SelectGroup {
class: "select-group", class: "dx-select-group",
disabled: props.disabled, disabled: props.disabled,
id: props.id, id: props.id,
attributes: props.attributes, attributes: props.attributes,
@@ -74,7 +96,7 @@ pub fn SelectGroup(props: SelectGroupProps) -> Element {
pub fn SelectGroupLabel(props: SelectGroupLabelProps) -> Element { pub fn SelectGroupLabel(props: SelectGroupLabelProps) -> Element {
rsx! { rsx! {
select::SelectGroupLabel { select::SelectGroupLabel {
class: "select-group-label", class: "dx-select-group-label",
id: props.id, id: props.id,
attributes: props.attributes, attributes: props.attributes,
{props.children} {props.children}
@@ -86,7 +108,7 @@ pub fn SelectGroupLabel(props: SelectGroupLabelProps) -> Element {
pub fn SelectOption<T: Clone + PartialEq + 'static>(props: SelectOptionProps<T>) -> Element { pub fn SelectOption<T: Clone + PartialEq + 'static>(props: SelectOptionProps<T>) -> Element {
rsx! { rsx! {
select::SelectOption::<T> { select::SelectOption::<T> {
class: "select-option", class: "dx-select-option",
value: props.value, value: props.value,
text_value: props.text_value, text_value: props.text_value,
disabled: props.disabled, disabled: props.disabled,
@@ -104,10 +126,11 @@ pub fn SelectOption<T: Clone + PartialEq + 'static>(props: SelectOptionProps<T>)
pub fn SelectItemIndicator() -> Element { pub fn SelectItemIndicator() -> Element {
rsx! { rsx! {
select::SelectItemIndicator { select::SelectItemIndicator {
svg { icon::Icon {
class: "select-check-icon", class: "dx-select-check-icon",
view_box: "0 0 24 24", width: "1rem",
xmlns: "http://www.w3.org/2000/svg", height: "1rem",
stroke: "var(--secondary-color-5)",
path { d: "M5 13l4 4L19 7" } path { d: "M5 13l4 4L19 7" }
} }
} }
+9 -4
View File
@@ -149,11 +149,14 @@ fn LandingPlaceholder() -> Element {
"Duration (H:M:S.MS)" "Duration (H:M:S.MS)"
} }
th { class: "uppercase bold whitespace-nowrap py-2 px-3", th { class: "uppercase bold whitespace-nowrap py-2 px-3",
Select::<Option<TestStatus>> { placeholder: "STATUS", Select::<Option<TestStatus>> {
SelectTrigger { SelectTrigger {
class: "select-trigger mx-auto w-fit !bg-transparent !shadow-none !text-gray-400 cursor-pointer uppercase", class: "select-trigger mx-auto w-fit !bg-transparent !shadow-none !text-gray-400 cursor-pointer uppercase",
aria_label: "Select Trigger", aria_label: "Select Trigger",
SelectValue { class: "!bg-transparent !shadow-none !text-gray-400" } SelectValue {
class: "!bg-transparent !shadow-none !text-gray-400",
placeholder: "STATUS",
}
} }
SelectList { aria_label: "Select status", SelectList { aria_label: "Select status",
SelectGroup { SelectGroup {
@@ -445,12 +448,14 @@ pub fn Landing() -> Element {
} }
th { class: "uppercase bold whitespace-nowrap py-2 px-3", th { class: "uppercase bold whitespace-nowrap py-2 px-3",
Select::<Option<TestStatus>> { Select::<Option<TestStatus>> {
placeholder: "STATUS",
on_value_change: move |value: Option<Option<TestStatus>>| filter.set(value.unwrap_or(None)), on_value_change: move |value: Option<Option<TestStatus>>| filter.set(value.unwrap_or(None)),
SelectTrigger { SelectTrigger {
class: "select-trigger mx-auto w-fit !bg-transparent !shadow-none !text-gray-400 cursor-pointer uppercase", class: "select-trigger mx-auto w-fit !bg-transparent !shadow-none !text-gray-400 cursor-pointer uppercase",
aria_label: "Select Trigger", aria_label: "Select Trigger",
SelectValue { class: "!bg-transparent !shadow-none !text-gray-400" } SelectValue {
class: "!bg-transparent !shadow-none !text-gray-400",
placeholder: "STATUS",
}
} }
SelectList { aria_label: "Select status", SelectList { aria_label: "Select status",
SelectGroup { SelectGroup {