diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..4940b76 --- /dev/null +++ b/.envrc @@ -0,0 +1,3 @@ +export PATH="$HOME/.cargo/bin:$PATH" + +use flake \ No newline at end of file diff --git a/.gitignore b/.gitignore index 9ce0fac..00249a0 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ /target package-lock.json + +.direnv diff --git a/crates/leptos/src/avatar.rs b/crates/leptos/src/avatar.rs index f859b6f..d161072 100644 --- a/crates/leptos/src/avatar.rs +++ b/crates/leptos/src/avatar.rs @@ -11,12 +11,8 @@ pub fn Avatar( let class = crate::tw!(concat!(BASE_CLASS, "-avatar"), class); view! { -
- {alt} +
+ alt
} } diff --git a/crates/leptos/src/badge.rs b/crates/leptos/src/badge.rs index 9d098e3..d025b68 100644 --- a/crates/leptos/src/badge.rs +++ b/crates/leptos/src/badge.rs @@ -59,11 +59,9 @@ pub fn Badge( }; view! { -
-
- {display_value} +
+
+ {display_value}
} } diff --git a/crates/leptos/src/button.rs b/crates/leptos/src/button.rs index 76a3aad..ea85b0e 100644 --- a/crates/leptos/src/button.rs +++ b/crates/leptos/src/button.rs @@ -26,7 +26,7 @@ pub fn Button( let class = crate::tw!("text-button", var, concat!(BASE_CLASS, "-button"), class); view! { - diff --git a/crates/leptos/src/card.rs b/crates/leptos/src/card.rs index 0fa237a..7fd7934 100644 --- a/crates/leptos/src/card.rs +++ b/crates/leptos/src/card.rs @@ -27,21 +27,23 @@ pub fn Card( class = format!("{}-card--resource relative", BASE_CLASS); return view! { -
- - +
+ + -
- {children()} -
+
{children()}
}.into_any(); } - view! { -
- {children()} -
- } - .into_any() + view! {
{children()}
}.into_any() } diff --git a/crates/leptos/src/flap.rs b/crates/leptos/src/flap.rs index 9e21d4c..20aa3ad 100644 --- a/crates/leptos/src/flap.rs +++ b/crates/leptos/src/flap.rs @@ -24,12 +24,12 @@ pub fn Flap( let class = crate::tw!(concat!(BASE_CLASS, "-flap"), class); view! { -
+
- + )> {(variant == Variant::Highlight).then_some(view! { })} - - {label.clone()} - + {label.clone()}
} diff --git a/crates/leptos/src/icons/alert.rs b/crates/leptos/src/icons/alert.rs index d290a61..e7f0834 100644 --- a/crates/leptos/src/icons/alert.rs +++ b/crates/leptos/src/icons/alert.rs @@ -7,8 +7,8 @@ pub fn Alert( ) -> impl IntoView { view! { impl IntoView { view! { - + } } diff --git a/crates/leptos/src/icons/arrow_left.rs b/crates/leptos/src/icons/arrow_left.rs index a309451..34933e5 100644 --- a/crates/leptos/src/icons/arrow_left.rs +++ b/crates/leptos/src/icons/arrow_left.rs @@ -7,16 +7,13 @@ pub fn ArrowLeft( ) -> impl IntoView { view! { - + } } diff --git a/crates/leptos/src/icons/arrow_right.rs b/crates/leptos/src/icons/arrow_right.rs index 332bed4..31a367f 100644 --- a/crates/leptos/src/icons/arrow_right.rs +++ b/crates/leptos/src/icons/arrow_right.rs @@ -7,16 +7,13 @@ pub fn ArrowRight( ) -> impl IntoView { view! { - + } } diff --git a/crates/leptos/src/icons/arrow_up.rs b/crates/leptos/src/icons/arrow_up.rs index 2b44724..9eaf451 100644 --- a/crates/leptos/src/icons/arrow_up.rs +++ b/crates/leptos/src/icons/arrow_up.rs @@ -7,8 +7,8 @@ pub fn ArrowUp( ) -> impl IntoView { view! { impl IntoView { view! { impl IntoView { view! { - + } } diff --git a/crates/leptos/src/icons/discord.rs b/crates/leptos/src/icons/discord.rs index a2b89db..f70f13b 100644 --- a/crates/leptos/src/icons/discord.rs +++ b/crates/leptos/src/icons/discord.rs @@ -7,8 +7,8 @@ pub fn Discord( ) -> impl IntoView { view! { impl IntoView { view! { impl IntoView { view! { impl IntoView { view! { impl IntoView { view! { impl IntoView { view! { impl IntoView { view! { impl IntoView { view! { impl IntoView { view! { impl IntoView { view! { impl IntoView { view! { impl IntoView { view! { impl IntoView { view! { impl IntoView { view! { impl IntoView { view! { impl IntoView { view! { impl IntoView { view! { - + } } diff --git a/crates/leptos/src/icons/telegram.rs b/crates/leptos/src/icons/telegram.rs index 1c6bfb2..8565067 100644 --- a/crates/leptos/src/icons/telegram.rs +++ b/crates/leptos/src/icons/telegram.rs @@ -7,8 +7,8 @@ pub fn Telegram( ) -> impl IntoView { view! { impl IntoView { view! { impl IntoView { view! { +
- {icon.map(|icon| view! { {icon()} })} - + {icon + .map(|icon| { + view! { {icon()} } + })}
- {has_error.get().then_some( - view! { {error_message} } - )} + {has_error + .get() + .then_some( + view! { + {error_message} + }, + )}
} } diff --git a/crates/leptos/src/input/search.rs b/crates/leptos/src/input/search.rs index 26f40e3..e7f6642 100644 --- a/crates/leptos/src/input/search.rs +++ b/crates/leptos/src/input/search.rs @@ -47,12 +47,10 @@ pub fn InputSearch( view! {
- -
- {has_filter.then(|| view! { - - })} -
+ {has_filter + .then(|| { + view! { + + } + })} +
- {filter_modal.get().then(|| { - view! { -
    - {filters.map(|filters| filters.iter().map(|filter| { - let is_selected = active_filters.iter().any(|f| f.value == filter.value); - let filter = filter.clone(); - let handle_select_filter = handle_select_filter.clone(); - view! { -
  • - -
  • - } - }).collect::>()).unwrap_or_default()} -
- }})} + )> + {filter_modal + .get() + .then(|| { + view! { +
    + {filters + .map(|filters| { + filters + .iter() + .map(|filter| { + let is_selected = active_filters + .iter() + .any(|f| f.value == filter.value); + let filter = filter.clone(); + let handle_select_filter = handle_select_filter.clone(); + view! { +
  • + +
  • + } + }) + .collect::>() + }) + .unwrap_or_default()} +
+ } + })}
diff --git a/crates/leptos/src/level.rs b/crates/leptos/src/level.rs index cd44329..d18036e 100644 --- a/crates/leptos/src/level.rs +++ b/crates/leptos/src/level.rs @@ -34,9 +34,5 @@ pub fn Level( class ); - view! { -
- {variant} -
- } + view! {
{variant}
} } diff --git a/crates/leptos/src/progress_bar.rs b/crates/leptos/src/progress_bar.rs index 9c88c29..681d3fa 100644 --- a/crates/leptos/src/progress_bar.rs +++ b/crates/leptos/src/progress_bar.rs @@ -29,20 +29,21 @@ pub fn ProgressBar(#[prop(into)] percentage: ReadSignal) -> impl IntoView let percentage_str = format!("{percentage}%"); view! { -
-
+
+
{percentage_str.clone()} -
+
} diff --git a/crates/leptos/src/radio.rs b/crates/leptos/src/radio.rs index 9e0c0c1..f1d84b8 100644 --- a/crates/leptos/src/radio.rs +++ b/crates/leptos/src/radio.rs @@ -6,7 +6,5 @@ use leptos::{IntoView, component, view}; pub fn Radio(#[prop(into, optional)] class: String) -> impl IntoView { let class = crate::tw!(concat!(BASE_CLASS, "-radio"), class); - view! { - - } + view! { } } diff --git a/crates/leptos/src/tag.rs b/crates/leptos/src/tag.rs index 2aea522..dab331f 100644 --- a/crates/leptos/src/tag.rs +++ b/crates/leptos/src/tag.rs @@ -16,9 +16,5 @@ pub fn Tag( class ); - view! { -
- {label} -
- } + view! {
{label}
} } diff --git a/flake.lock b/flake.lock index bb6144f..707e68a 100644 --- a/flake.lock +++ b/flake.lock @@ -1,23 +1,93 @@ { "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1748720369, - "narHash": "sha256-w+UTzecfeHGGWEhpSRPfLIvqdld7LTwxJ72TOEBLayg=", + "lastModified": 1786106723, + "narHash": "sha256-zDSUbpoeo/9ZmD2+wXnzxoo1+uhL8vxc0b8yuYMKYq0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "47ea0dddda8364b3028d8b77ab2be43982ecb281", + "rev": "f13ff45afd1bb73e640eaa08a7066dbed07e3238", "type": "github" }, "original": { "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1744536153, + "narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1786247265, + "narHash": "sha256-cVTcTqAhzSNMOVddtBhFpuv+Vx6/SgrhgZWJiI61H24=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "6df7076ea0f5697e3242719a4c71211f00411cf5", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 402f3c0..0e8d037 100644 --- a/flake.nix +++ b/flake.nix @@ -1,16 +1,48 @@ { - inputs.nixpkgs.url = "github:nixos/nixpkgs"; - - outputs = {nixpkgs, ...}: let - system = "x86_64-linux"; - pkgs = import nixpkgs { inherit system; }; - in { - devShells.${system}.default = pkgs.mkShell { - buildInputs = with pkgs; [ - # js - nodejs_22 - pnpm_10 - ]; - }; + description = "Design systems components for RustLangEs web flake"; + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + rust-overlay.url = "github:oxalica/rust-overlay"; }; -} + + outputs = + { + nixpkgs, + flake-utils, + rust-overlay, + ... + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + overlays = [ (import rust-overlay) ]; + pkgs = import nixpkgs { + inherit system overlays; + }; + rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; + in + { + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + # Rust toolchain with wasm target + rustToolchain + + # WASM tools + tailwindcss_4 + wasm-bindgen-cli_0_2_126 + + # Leptos specific tools + leptosfmt + cargo-leptos + + # Additional development tools + pkg-config + openssl + pnpm + nodejs_24 + ]; + }; + } + ); +} \ No newline at end of file diff --git a/js/react/eslint.config.ts b/js/react/eslint.config.ts index d81e65c..85d15f4 100644 --- a/js/react/eslint.config.ts +++ b/js/react/eslint.config.ts @@ -4,23 +4,27 @@ import reactRefresh from "eslint-plugin-react-refresh"; import reactHooks from "eslint-plugin-react-hooks"; import js from "@eslint/js"; import ts from "typescript-eslint"; - export default ts.config([ js.configs.recommended, ts.configs.recommended, - reactHooks.configs["recommended-latest"], { languageOptions: { + parserOptions: { + projectService: true, + tsconfigRootDir: import.meta.dirname, + }, globals: { ...globals.browser, }, }, plugins: { + "react-hooks": reactHooks, "react-refresh": reactRefresh, }, rules: { + ...reactHooks.configs["recommended-latest"].rules, "no-sparse-arrays": "off", "@typescript-eslint/no-unsafe-function-type": "off", "react-refresh/only-export-components": [ diff --git a/js/react/lib/components/calendar/calendar.component.tsx b/js/react/lib/components/calendar/calendar.component.tsx index 76b3dbf..56c8a04 100644 --- a/js/react/lib/components/calendar/calendar.component.tsx +++ b/js/react/lib/components/calendar/calendar.component.tsx @@ -59,7 +59,7 @@ export const Calendar = ({ return (
-
+
@@ -148,7 +148,7 @@ export function ContactForm() {
@@ -214,7 +214,7 @@ export function ShowcaseFieldFunction(): MiniUI.Node { [ - "border-1 shadow-brutal", + "shadow-brutal border-1", "h-[1.7rem] min-w-[150px] px-1", "rounded-sm text-center text-base", (valueSignal() as boolean) && "bg-green-400", @@ -284,7 +284,7 @@ export function ShowcaseFieldNumber({ return ( { createEffect(() => { ref.valueAsNumber = valueSignal() as number; @@ -334,8 +334,8 @@ export function ShowcaseFieldString({ ) : (