-
-
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
90ddc9f
commit d1cf14b
Showing
12 changed files
with
109 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1 +1,5 @@ | ||
|
||
//! Rust port of [Radix Core Number](https://www.radix-ui.com/primitives). | ||
//! | ||
//! This is an internal utility, not intended for public usage. | ||
//! | ||
//! See [`@radix-ui/number`](https://www.npmjs.com/package/@radix-ui/number) for the original package. |
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 |
---|---|---|
@@ -1 +1,5 @@ | ||
|
||
//! Rust port of [Radix Core Primitive](https://www.radix-ui.com/primitives). | ||
//! | ||
//! This is an internal utility, not intended for public usage. | ||
//! | ||
//! See [`@radix-ui/primitive`](https://www.npmjs.com/package/@radix-ui/primitive) for the original package. |
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 |
---|---|---|
@@ -1,3 +1,9 @@ | ||
//! Rust port of [Radix Core Rect](https://www.radix-ui.com/primitives). | ||
//! | ||
//! This is an internal utility, not intended for public usage. | ||
//! | ||
//! See [`@radix-ui/rect`](https://www.npmjs.com/package/@radix-ui/rect) for the original package. | ||
|
||
mod observe_element_rect; | ||
|
||
pub use observe_element_rect::*; |
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 |
---|---|---|
@@ -1,3 +1,9 @@ | ||
//! Leptos port of [Radix Arrow](https://www.radix-ui.com/primitives). | ||
//! | ||
//! This is an internal utility, not intended for public usage. | ||
//! | ||
//! See [`@radix-ui/react-arrow`](https://www.npmjs.com/package/@radix-ui/react-arrow) for the original package. | ||
|
||
mod arrow; | ||
|
||
pub use arrow::*; |
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,12 @@ | ||
[package] | ||
name = "radix-leptos-direction" | ||
description = "Leptos port of Radix Direction." | ||
|
||
authors.workspace = true | ||
edition.workspace = true | ||
license.workspace = true | ||
repository.workspace = true | ||
version.workspace = true | ||
|
||
[dependencies] | ||
leptos.workspace = true |
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-direction</h1> | ||
|
||
Wraps your app to provide global reading direction. | ||
|
||
## 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,29 @@ | ||
use leptos::*; | ||
|
||
#[derive(Copy, Clone, Debug, PartialEq)] | ||
pub enum Direction { | ||
Ltr, | ||
Rtl, | ||
} | ||
|
||
type DirectionContextValue = MaybeSignal<Direction>; | ||
|
||
#[component] | ||
pub fn DirectionProvider( | ||
#[prop(into)] direction: DirectionContextValue, | ||
children: Children, | ||
) -> impl IntoView { | ||
view! { | ||
<Provider value={direction}>{children()}</Provider> | ||
} | ||
} | ||
|
||
pub fn use_direction(local_dir: MaybeProp<Direction>) -> Signal<Direction> { | ||
let global_dir = use_context::<DirectionContextValue>(); | ||
|
||
Signal::derive(move || { | ||
local_dir() | ||
.or(global_dir.map(|global_dir| global_dir())) | ||
.unwrap_or(Direction::Ltr) | ||
}) | ||
} |
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,11 @@ | ||
//! Leptos port of [Radix Direction](https://www.radix-ui.com/primitives/docs/utilities/direction-provider). | ||
//! | ||
//! Wraps your app to provide global reading direction. | ||
//! | ||
//! See <https://www.radix-ui.com/primitives/docs/utilities/direction-provider> for the original documentation. | ||
//! | ||
//! See [`@radix-ui/react-direction`](https://www.npmjs.com/package/@radix-ui/react-direction) for the original package. | ||
|
||
mod direction; | ||
|
||
pub use direction::*; |
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 |
---|---|---|
@@ -1,3 +1,9 @@ | ||
//! Leptos port of [Radix Popper](https://www.radix-ui.com/primitives). | ||
//! | ||
//! This is an internal utility, not intended for public usage. | ||
//! | ||
//! See [`@radix-ui/react-popper`](https://www.npmjs.com/package/@radix-ui/react-popper) for the original package. | ||
|
||
mod popper; | ||
|
||
pub use popper::*; |
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 |
---|---|---|
@@ -1,3 +1,9 @@ | ||
//! Leptos port of [Radix Use Size](https://www.radix-ui.com/primitives). | ||
//! | ||
//! This is an internal utility, not intended for public usage. | ||
//! | ||
//! See [`@radix-ui/react-use-size`](https://www.npmjs.com/package/@radix-ui/react-use-size) for the original package. | ||
|
||
mod use_size; | ||
|
||
pub use use_size::*; |