From 9dd2faf1772ed69a53416abdb86b49fbb31daf91 Mon Sep 17 00:00:00 2001 From: geoffreygarrett Date: Wed, 8 Jan 2025 16:39:43 +0200 Subject: [PATCH 1/2] Update Visually Hidden to Leptos 0.7 --- .../primitives/utilities/visually-hidden.md | 58 ++++++++---- .../leptos/visually-hidden/Cargo.toml | 3 +- .../leptos/visually-hidden/README.md | 2 +- .../visually-hidden/src/visually_hidden.rs | 88 +++++++++---------- 4 files changed, 88 insertions(+), 63 deletions(-) diff --git a/book/src/primitives/utilities/visually-hidden.md b/book/src/primitives/utilities/visually-hidden.md index f420d132..467d5eb4 100644 --- a/book/src/primitives/utilities/visually-hidden.md +++ b/book/src/primitives/utilities/visually-hidden.md @@ -4,7 +4,7 @@ Hides content from the screen in an accessible way. ## Features -- Visually hides content while preserving it for assistive technology. +- Visually hides content while preserving it for assistive technology. ## Installation @@ -17,9 +17,9 @@ Install the component from your command line. cargo add radix-leptos-visually-hidden ``` -- [View on crates.io](https://crates.io/crates/radix-leptos-visually-hidden) -- [View on docs.rs](https://docs.rs/radix-leptos-visually-hidden/latest/radix_leptos_visually_hidden/) -- [View source](https://github.com/RustForWeb/radix/tree/main/packages/primitives/leptos/visually-hidden) +- [View on crates.io](https://crates.io/crates/radix-leptos-visually-hidden) +- [View on docs.rs](https://docs.rs/radix-leptos-visually-hidden/latest/radix_leptos_visually_hidden/) +- [View source](https://github.com/RustForWeb/radix/tree/main/packages/primitives/leptos/visually-hidden) {{#endtab }} {{#tab name="Yew" }} @@ -28,9 +28,9 @@ cargo add radix-leptos-visually-hidden cargo add radix-yew-visually-hidden ``` -- [View on crates.io](https://crates.io/crates/radix-yew-visually-hidden) -- [View on docs.rs](https://docs.rs/radix-yew-visually-hidden/latest/radix_yew_visually_hidden/) -- [View source](https://github.com/RustForWeb/radix/tree/main/packages/primitives/yew/visually-hidden) +- [View on crates.io](https://crates.io/crates/radix-yew-visually-hidden) +- [View on docs.rs](https://docs.rs/radix-yew-visually-hidden/latest/radix_yew_visually_hidden/) +- [View source](https://github.com/RustForWeb/radix/tree/main/packages/primitives/yew/visually-hidden) {{#endtab }} {{#endtabs }} @@ -49,7 +49,7 @@ use radix_leptos_visually_hidden::*; #[component] fn Anatomy() -> impl IntoView { view! { - + "Your hidden content here" } } ``` @@ -81,14 +81,19 @@ Anything you put inside this component will be hidden from the screen but will b {{#tabs global="framework" }} {{#tab name="Leptos" }} -No props. +| Prop | Type | Default | Description | +|------------|--------------------------------------------|---------|---------------------------------------------------------------------------------| +| `children` | `TypedChildrenFn` | - | The content to be visually hidden but still accessible to screen readers | +| `as_child` | `MaybeProp` | `false` | If `true`, the `Primitive` is rendered as the child element rather than wrapped | +| `node_ref` | `AnyNodeRef` | - | A reference to the underlying DOM node | {{#endtab }} {{#tab name="Yew" }} -| Prop | Type | Default | -| ---------- | -------------------------------------------------- | ------- | -| `as_child` | `Option>` | - | +| Prop | Type | Default | Description | +|------------|----------------------------------------------------|---------|-------------| +| `as_child` | `Option>` | - | - | +| `children` | `TODO` | - | TODO | {{#endtab }} {{#endtabs }} @@ -124,9 +129,9 @@ use radix_yew_icons::GearIcon; use radix_yew_visually_hidden::*; use yew::prelude::*; -#[component] -fn Example() -> impl IntoView { - view! { +#[function_component] +fn Example() -> Html { + html! {