crisol-ui-kit 1.14.0

Crisol UI kit: themes, style tokens, icon caches, fonts, localization, base components, and widgets.
Documentation
//! The base component layer: buttons, inputs, selects, badges, cards, labels,
//! separators, segmented controls, steppers, tabs, menus, dialogs, toasts, feedback, and
//! status bars.
//!
//! Components never own application state. Interactive components take `&mut` state and
//! return the change in the same frame (`bool`, `Option<T>`, or `egui::Response`); the
//! caller owns the model.

use egui::Ui;

use crate::Icons;

mod badge;
mod button;
mod card;
mod checkbox;
mod data_grid;
mod dialog;
mod feedback;
mod input;
mod label;
mod menu;
mod segmented;
mod select;
mod separator;
pub mod settings_schema;
mod status;
mod stepper;
pub mod style;
mod switch;
mod tabs;
mod toast;

pub use badge::Badge;
pub use button::{Button, CloseButton, IconButton};
pub use card::Card;
pub use checkbox::Checkbox;
pub use data_grid::{DataGrid, DataGridEvent, DataGridState, SortDirection};
pub use dialog::{ConfirmDialog, Dialog, NameDialog, ProgressDialog, PromptAction};
pub use feedback::{Banner, Popover};
pub use input::{TextArea, TextField};
pub use label::Label;
pub use menu::{Menu, MenuButton, MenuIconButton, MenuItem, MenuToggle};
pub use segmented::SegmentedControl;
pub use select::Select;
pub use separator::{Orientation, Separator};
pub use settings_schema::{Setting, SettingKind, SettingValue, SettingsSchema};
pub use status::StatusBar;
pub use stepper::Stepper;
pub use style::{ButtonVariant, IconButtonSize, Size, Tone};
pub use switch::Switch;
pub use tabs::{TabEvent, TabIcon, TabItem, TabStrip};
pub use toast::{Toast, ToastEvent, ToastId, ToastKind, ToastPosition, Toasts};

/// A component that takes only a [`Ui`] and returns a value.
///
/// Implement it for builders that can be rendered with `Component::show`. Components
/// that need the icon cache implement [`IconComponent`] instead. Dialogs take a
/// [`egui::Context`] and are called directly; they are composition, not a `Ui` child.
pub trait Component {
    /// What the component returns after painting.
    type Output;

    /// Paint the component.
    fn show(self, ui: &mut Ui) -> Self::Output;
}

/// A component that paints glyphs from the shared [`Icons`] cache.
pub trait IconComponent {
    /// What the component returns after painting.
    type Output;

    /// Paint the component with the application's icon cache.
    fn show(self, ui: &mut Ui, icons: &mut Icons) -> Self::Output;
}

/// The names the kit's base components export.
pub mod prelude {
    pub use super::{
        Badge, Banner, Button, ButtonVariant, Card, Checkbox, CloseButton, Component, ConfirmDialog, DataGrid,
        DataGridEvent, DataGridState, Dialog, IconButton, IconButtonSize, IconComponent, Label, Menu, MenuButton,
        MenuIconButton, MenuItem, MenuToggle, NameDialog, Orientation, Popover, ProgressDialog, PromptAction,
        SegmentedControl, Select, Separator, Size, SortDirection, StatusBar, Stepper, Switch, TabEvent, TabIcon,
        TabItem, TabStrip, TextArea, TextField, Toast, ToastEvent, ToastKind, ToastPosition, Toasts, Tone,
    };
}