Scoop API

scoop:scoop.ui.component:0.1.0

src/overlays/hover_values.scoop

Selected production source · src/overlays/hover_values.scoop

1package scoop.ui.component
3import scoop.graphics.text.FontCollection
4import scoop.surface.AnimationSpec
5import scoop.time.Duration
6import scoop.ui.*
7import scoop.ui.style.*
9internal enum HoverPopupKind {
10 Tooltip, Card
13/** Immutable shared input; constructing it neither reads a binding nor registers resources. */
14internal class HoverPopupInput(
15 val kind: HoverPopupKind,
16 val trigger: View,
17 val content: PanelContent,
18 val open: Binding<Boolean>?,
19 val side: OverlaySide,
20 val alignment: OverlayAlignment,
21 val gap: Double,
22 val viewportPadding: Double,
23 val width: Double,
24 val hover: HoverOptions,
25 val arrow: PopupArrow?,
26 val handle: OverlayHandle?,
27 val transition: StyleValue<AnimationSpec?>,
28 val onOpenChange: (Boolean) -> Unit,
29 val onClosed: (OverlayCloseReason) -> Unit,
30 val fonts: FontCollection?,
31 val theme: ThemeSource?,
32 val style: StyleOverride,
33 val semantics: ComponentSemantics
34) {
35 init {
36 nonnegative(width, "invalid hover popup width")
37 nonnegative(gap, "invalid hover popup gap")
38 nonnegative(viewportPadding, "invalid hover popup viewport padding")
39 }
42public class TooltipProps public constructor(
43 public val trigger: View,
44 public val content: PanelContent,
45 public val open: Binding<Boolean>? = None,
46 public val side: OverlaySide = OverlaySide.Top,
47 public val alignment: OverlayAlignment = OverlayAlignment.Center,
48 public val gap: Double = 4.0,
49 public val viewportPadding: Double = 8.0,
50 public val maxWidth: Double = 320.0,
51 public val openDelay: Duration = Duration.ZERO,
52 public val closeDelay: Duration = Duration.ZERO,
53 public val transitDelay: Duration = Duration.milliseconds(350L),
54 public val corridorPadding: Double = 6.0,
55 public val focus: Boolean = true,
56 public val enabled: Boolean = true,
57 public val arrow: PopupArrow? = Some(PopupArrow()),
58 public val handle: OverlayHandle? = None,
59 public val transition: StyleValue<AnimationSpec?> = StyleValue.Inherit,
60 public val onOpenChange: (Boolean) -> Unit = {},
61 public val onClosed: (OverlayCloseReason) -> Unit = {},
62 public val fonts: FontCollection? = None,
63 public val theme: ThemeSource? = None,
64 public val style: StyleOverride = styleOverride(),
65 public val semantics: ComponentSemantics = ComponentSemantics(),
66 public val longPress: LongPressOptions = LongPressOptions()
67) {
68 internal val input =
69 HoverPopupInput(
70 HoverPopupKind.Tooltip,
71 trigger,
72 content,
73 open,
74 side,
75 alignment,
76 gap,
77 viewportPadding,
78 maxWidth,
79 HoverOptions(
80 openDelay,
81 closeDelay,
82 transitDelay,
83 corridorPadding,
84 focus,
85 enabled,
86 longPress
87 ),
88 arrow,
89 handle,
90 transition,
91 onOpenChange,
92 onClosed,
93 fonts,
94 theme,
95 style,
96 semantics
97 )
100public class HoverCardProps public constructor(
101 public val trigger: View,
102 public val content: View,
103 public val open: Binding<Boolean>? = None,
104 public val side: OverlaySide = OverlaySide.Bottom,
105 public val alignment: OverlayAlignment = OverlayAlignment.Center,
106 public val gap: Double = 4.0,
107 public val viewportPadding: Double = 8.0,
108 public val width: Double = 256.0,
109 public val openDelay: Duration = Duration.milliseconds(600L),
110 public val closeDelay: Duration = Duration.milliseconds(300L),
111 public val transitDelay: Duration = Duration.milliseconds(350L),
112 public val corridorPadding: Double = 6.0,
113 public val focus: Boolean = true,
114 public val enabled: Boolean = true,
115 public val arrow: PopupArrow? = None,
116 public val handle: OverlayHandle? = None,
117 public val transition: StyleValue<AnimationSpec?> = StyleValue.Inherit,
118 public val onOpenChange: (Boolean) -> Unit = {},
119 public val onClosed: (OverlayCloseReason) -> Unit = {},
120 public val fonts: FontCollection? = None,
121 public val theme: ThemeSource? = None,
122 public val style: StyleOverride = styleOverride(),
123 public val semantics: ComponentSemantics = ComponentSemantics(),
124 public val longPress: LongPressOptions = LongPressOptions()
125) {
126 internal val input =
127 HoverPopupInput(
128 HoverPopupKind.Card,
129 trigger,
130 PanelContent.Custom(content),
131 open,
132 side,
133 alignment,
134 gap,
135 viewportPadding,
136 width,
137 HoverOptions(
138 openDelay,
139 closeDelay,
140 transitDelay,
141 corridorPadding,
142 focus,
143 enabled,
144 longPress
145 ),
146 arrow,
147 handle,
148 transition,
149 onOpenChange,
150 onClosed,
151 fonts,
152 theme,
153 style,
154 semantics
155 )