1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//! Border style utilities for interactive widgets.
//!
//! Provides helper functions for calculating border styles based on
//! widget state such as hover, selection, and drag interactions.
use crateAppTheme;
use Style;
/// Get the border style based on selection, hover, and drag states.
///
/// This helper function provides a consistent way to determine border
/// styling for interactive widgets that support these states.
///
/// # Arguments
///
/// * `theme` - The application theme (required for colored borders).
/// * `selection_active` - Whether text/item selection is active.
/// * `is_hovering` - Whether the mouse is hovering over the element.
/// * `is_dragging` - Whether the element is being dragged.
///
/// # Returns
///
/// The appropriate `Style` for the border based on the provided states.
///
/// # Example
///
/// ```rust
/// use ratatui_toolkit::primitives::border_style_helper;
///
/// let style = border_style_helper::get_border_style(
/// &theme,
/// false, // selection not active
/// true, // hovering
/// false, // not dragging
/// );
/// ```
/// Get a simple border style without theme support.
///
/// Use this function when theming is not enabled or when a neutral
/// border style is preferred.
///
/// # Arguments
///
/// * `selection_active` - Whether text/item selection is active.
/// * `is_hovering` - Whether the mouse is hovering over the element.
/// * `is_dragging` - Whether the element is being dragged.
///
/// # Returns
///
/// A highlighted `Style` when any state is active, default style otherwise.