From 5cef6aefa9c5072b3bc1a0008c7a8f649cc32198 Mon Sep 17 00:00:00 2001 From: geoffreygarrett Date: Wed, 8 Jan 2025 17:06:47 +0200 Subject: [PATCH 1/2] Update Label to Leptos 0.7 --- book/src/primitives/components/label.md | 91 +++++++++--------- packages/primitives/leptos/label/Cargo.toml | 3 + packages/primitives/leptos/label/src/label.rs | 93 +++++++++---------- stories/leptos/src/app.rs | 10 +- stories/leptos/src/primitives/label.rs | 86 ++++++++++------- 5 files changed, 153 insertions(+), 130 deletions(-) diff --git a/book/src/primitives/components/label.md b/book/src/primitives/components/label.md index f4e8786..f637f48 100644 --- a/book/src/primitives/components/label.md +++ b/book/src/primitives/components/label.md @@ -2,31 +2,12 @@ Renders an accessible label associated with controls. -{{#tabs global="framework" }} -{{#tab name="Leptos" }} - -```toml,trunk -package = "radix-leptos-book-primitives" -features = ["label"] -files = ["src/label.rs"] -``` - -{{#endtab }} -{{#tab name="Yew" }} - -```toml,trunk -package = "radix-yew-book-primitives" -features = ["label"] -files = ["src/label.rs"] -``` - -{{#endtab }} -{{#endtabs }} - ## Features -- Text selection is prevented when double clicking label. -- Supports nested controls. +- Text selection is prevented when double-clicking label +- Supports nested controls +- Composable with other elements using `as_child` +- Handles mouse events with proper focus management ## Installation @@ -39,9 +20,9 @@ Install the component from your command line. cargo add radix-leptos-label ``` -- [View on crates.io](https://crates.io/crates/radix-leptos-label) -- [View on docs.rs](https://docs.rs/radix-leptos-label/latest/radix_leptos_label/) -- [View source](https://github.com/RustForWeb/radix/tree/main/packages/primitives/leptos/label) +- [View on crates.io](https://crates.io/crates/radix-leptos-label) +- [View on docs.rs](https://docs.rs/radix-leptos-label/latest/radix_leptos_label/) +- [View source](https://github.com/RustForWeb/radix/tree/main/packages/primitives/leptos/label) {{#endtab }} {{#tab name="Yew" }} @@ -50,9 +31,9 @@ cargo add radix-leptos-label cargo add radix-yew-label ``` -- [View on crates.io](https://crates.io/crates/radix-yew-label) -- [View on docs.rs](https://docs.rs/radix-yew-label/latest/radix_yew_label/) -- [View source](https://github.com/RustForWeb/radix/tree/main/packages/primitives/yew/label) +- [View on crates.io](https://crates.io/crates/radix-yew-label) +- [View on docs.rs](https://docs.rs/radix-yew-label/latest/radix_yew_label/) +- [View source](https://github.com/RustForWeb/radix/tree/main/packages/primitives/yew/label) {{#endtab }} {{#endtabs }} @@ -71,7 +52,9 @@ use radix_leptos_label::*; #[component] fn Anatomy() -> impl IntoView { view! { -