-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
33862ab
commit d082180
Showing
4 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[package] | ||
name = "radix-leptos-collection" | ||
description = "Leptos port of Radix Collection." | ||
|
||
authors.workspace = true | ||
edition.workspace = true | ||
license.workspace = true | ||
repository.workspace = true | ||
version.workspace = true | ||
|
||
[dependencies] | ||
leptos.workspace = true | ||
radix-leptos-compose-refs = { path = "../compose-refs", version = "0.0.1" } | ||
radix-leptos-primitive = { path = "../primitive", version = "0.0.1" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<p align="center"> | ||
<a href="../../../../logo.svg" alt="Rust Radix logo"> | ||
<img src="../../../../logo.svg" width="300" height="200"> | ||
</a> | ||
</p> | ||
|
||
<h1 align="center">radix-leptos-roving-focus</h1> | ||
|
||
This is an internal utility, not intended for public usage. | ||
|
||
## Rust Radix | ||
|
||
[Rust Radix](https://github.com/NixySoftware/radix) is a Rust port of [Radix](https://www.radix-ui.com/primitives). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// TODO: remove | ||
#![allow(dead_code, unused_variables)] | ||
|
||
use std::collections::HashMap; | ||
|
||
use leptos::{ | ||
html::{AnyElement, ElementDescriptor}, | ||
*, | ||
}; | ||
|
||
#[derive(Clone)] | ||
struct CollectionContextValue<ItemElement: ElementDescriptor + 'static, ItemData: 'static> { | ||
collection_ref: NodeRef<AnyElement>, | ||
item_map: RwSignal<HashMap<String, (NodeRef<ItemElement>, ItemData)>>, | ||
} | ||
|
||
#[component] | ||
pub fn CollectionProvider(children: ChildrenFn) -> impl IntoView { | ||
// TODO: generics | ||
let context_value = CollectionContextValue::<AnyElement, ()> { | ||
collection_ref: create_node_ref(), | ||
item_map: create_rw_signal(HashMap::new()), | ||
}; | ||
|
||
view! { | ||
<Provider value=context_value> | ||
{children()} | ||
</Provider> | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//! Leptos port of [Radix Collection](https://www.radix-ui.com/primitives). | ||
//! | ||
//! This is an internal utility, not intended for public usage. | ||
//! | ||
//! See [`@radix-ui/react-collection`](https://www.npmjs.com/package/@radix-ui/react-collection) for the original package. | ||
|
||
mod collection; | ||
|
||
pub use collection::*; |