Skip to main content

dioxus_ui_system/
lib.rs

1//! Dioxus UI System
2//!
3//! A pure Rust design system for Dioxus with Atomic Design principles.
4//! 
5//! ## Features
6//!
7//! - **Atomic Design Architecture**: Components organized as Atoms, Molecules, and Organisms
8//! - **Type-Safe Theming**: Comprehensive theme system with light/dark/brand modes
9//! - **Pure Rust Styling**: No CSS files - all styles generated in Rust
10//! - **Tailwind-like API**: Fluent style builder for rapid UI development
11//! - **Multi-Platform**: Works on Web (WASM), Desktop, and Mobile
12//!
13//! ## Quick Start
14//!
15//! ```rust,ignore
16//! use dioxus_ui_system::prelude::*;
17//!
18//! fn App() -> Element {
19//!     rsx! {
20//!         ThemeProvider {
21//!             Card {
22//!                 CardHeader { title: "Welcome" }
23//!                 CardContent {
24//!                     Button {
25//!                         variant: ButtonVariant::Primary,
26//!                         "Click me"
27//!                     }
28//!                 }
29//!             }
30//!         }
31//!     }
32//! }
33//! ```
34
35pub mod theme;
36pub mod styles;
37pub mod config;
38pub mod atoms;
39pub mod molecules;
40pub mod organisms;
41
42/// Prelude module for convenient imports
43pub mod prelude {
44    //! Convenient re-exports for common types
45    
46    // Config
47    pub use crate::config::{Config, ConfigBuilder, ComponentConfig, global_config, set_global_config};
48    
49    // Theme
50    pub use crate::theme::{
51        ThemeTokens, ThemeMode, ColorScale, Color, 
52        SpacingScale, RadiusScale, TypographyScale, Typography,
53        ThemeContext, ThemeProvider, use_theme, use_style, ThemeToggle, ThemeSelector,
54    };
55    
56    // Styles
57    pub use crate::styles::Style;
58    pub use crate::{cx, style_if};
59    
60    // Atoms
61    pub use crate::atoms::{
62        Button, ButtonProps, ButtonVariant, ButtonSize, ButtonType, IconButton,
63        Input, InputProps, InputType,
64        Label, LabelProps, TextSize, TextWeight, TextColor, LabelElement, Heading, HeadingLevel, MutedText,
65        Icon, IconProps, IconSize, IconColor, IconBtn as IconButton2,
66        Checkbox, CheckboxProps,
67        Radio, RadioProps, RadioGroup, RadioGroupProps, RadioDirection,
68        Switch, SwitchProps, SwitchSize,
69        Select, SelectProps, SelectOption, MultiSelect, MultiSelectProps,
70        TextArea, TextAreaProps, AutoResizeTextArea, AutoResizeTextAreaProps,
71        Box, BoxProps, BoxDisplay, FlexDirection, FlexWrap, JustifyContent, AlignItems,
72        SpacingSize, RadiusSize, ShadowSize, BackgroundColor, BorderWidth, Overflow, Position,
73        VStack, HStack, Center,
74        // New atoms
75        Divider, DividerProps, DividerOrientation, DividerVariant,
76        Progress, ProgressProps, ProgressVariant, ProgressSize,
77        Spinner, SpinnerProps, SpinnerVariant, SpinnerSize,
78        Skeleton, SkeletonProps, SkeletonShape, SkeletonAnimation, SkeletonText as AtomSkeletonText, SkeletonTextProps as AtomSkeletonTextProps, SkeletonCard as AtomSkeletonCard, SkeletonCardProps as AtomSkeletonCardProps,
79        Rating, RatingProps,
80        DatePicker, DatePickerProps,
81        Slider, SliderProps, SliderMark,
82        Tag, TagProps, TagVariant, TagSize, InputTag, InputTagProps, TagGroup, TagData,
83    };
84    
85    // Molecules
86    pub use crate::molecules::{
87        InputGroup,
88        Card, CardProps, CardVariant, CardHeader, CardHeaderProps, 
89        CardContent, CardContentProps, CardFooter, CardFooterProps, CardFooterJustify,
90        Badge, BadgeProps, BadgeVariant, BadgeSize, StatusBadge, StatusBadgeProps, StatusType,
91        Alert, AlertProps, AlertVariant,
92        Avatar, AvatarProps, AvatarSize, AvatarGroup, AvatarGroupProps,
93        Breadcrumb, BreadcrumbProps, BreadcrumbItem,
94        Dialog, DialogProps, DialogFooter, DialogFooterProps, DialogFooterAlign, AlertDialog, AlertDialogProps,
95        DropdownMenu, DropdownMenuProps, DropdownMenuItem, DropdownAlign, DropdownMenuSeparator, DropdownMenuLabel, DropdownMenuLabelProps,
96        Popover, PopoverProps, PopoverPlacement, PopoverHeader, PopoverHeaderProps, PopoverFooter, PopoverFooterProps,
97        Separator, SeparatorProps, SeparatorOrientation,
98        SkeletonMolecule, SkeletonMoleculeProps, SkeletonCircle, SkeletonCircleProps, SkeletonText, SkeletonTextProps, SkeletonCard, SkeletonCardProps,
99        Tooltip, TooltipProps, TooltipPlacement, SimpleTooltip, SimpleTooltipProps,
100        // New molecules
101        Toast, ToastProps, ToastVariant, ToastManager, use_toast, ToastProvider, ToastProviderProps,
102        Combobox, ComboboxProps, ComboboxOption, MultiCombobox, MultiComboboxProps,
103        MediaObject, MediaObjectProps, MediaContent, MediaContentProps, Comment, CommentProps,
104        Pagination, PaginationProps, PaginationSize, PageSizeSelector, PageSizeSelectorProps, PaginationInfo, PaginationInfoProps,
105        ListItem, ListItemProps, ListItemVariant, ListGroup, ListGroupProps, ActionListItem, ActionListItemProps, ExpandableListItem, ExpandableListItemProps,
106        // Command palette
107        Command, CommandProps, CommandInput, CommandInputProps, CommandList, CommandListProps, CommandGroup, CommandGroupProps, CommandItem, CommandItemProps, CommandSeparator, CommandEmpty, CommandEmptyProps, CommandShortcut, CommandShortcutProps, CommandLoading,
108        // Sheet
109        Sheet, SheetProps, SheetSide, SheetFooter, SheetFooterProps, SheetFooterAlign,
110        // OTP Input
111        OtpInput, OtpInputProps,
112        // Time Picker
113        TimePicker, TimePickerProps, TimeInput, TimeInputProps,
114        // Context Menu
115        ContextMenu, ContextMenuProps, ContextMenuTrigger, ContextMenuTriggerProps, ContextMenuContent, ContextMenuContentProps, ContextMenuItem, ContextMenuItemProps, ContextMenuSeparator, ContextMenuLabel, ContextMenuLabelProps, ContextMenuCheckboxItem, ContextMenuCheckboxItemProps, ContextMenuSub, ContextMenuSubProps, ContextMenuSubTrigger, ContextMenuSubTriggerProps,
116    };
117    
118    // Organisms
119    pub use crate::organisms::{
120        Header, HeaderProps, NavItem, HeaderNavLink, MobileMenuToggle,
121        UserMenu, UserMenuProps, UserMenuItem,
122        DataTable, DataTableProps, TableColumn, ColumnAlign, TablePagination, TablePaginationProps, TableFilter, FilterOption,
123        Tabs, TabsProps, TabItem, TabsVariant, TabPanel, TabPanelProps, VerticalTabs, VerticalTabsProps,
124        Accordion, AccordionProps, AccordionItem, AccordionItem2, AccordionItem2Props,
125        Layout, LayoutProps, LayoutType, LayoutNavItem,
126        Calendar, CalendarProps, CalendarMode,
127        RichTextEditor, RichTextEditorProps, RichTextFeatures,
128        SimpleRichText, SimpleRichTextProps,
129        MinimalRichText, MinimalRichTextProps,
130        FullRichText, FullRichTextProps,
131    };
132    
133    // Charts
134    pub use crate::organisms::charts::{
135        BarChart, BarChartProps, BarChartVariant,
136        LineChart, LineChartProps, LineChartVariant,
137        PieChart, PieChartProps, PieChartVariant, DonutChart, GaugeChart,
138        Sparkline, SparklineProps, SparklineVariant, TrendIndicator,
139        ChartDataPoint, ChartSeries, ChartMargin, ChartAxis, 
140        LegendPosition, ChartTooltip, ChartAnimation, AnimationEasing,
141        calculate_nice_ticks, format_compact_number, format_currency, format_percentage,
142        palettes, utils,
143    };
144}
145
146// Re-export at crate root for convenience
147pub use theme::*;
148pub use styles::*;
149pub use config::*;