Solidtype_heroui.InteractionThe state of an interaction with an element, kept as React Aria keeps it on HeroUI's components in React, for a port to declare as the attributes HeroUI's styles read: data-hovered, data-pressed, data-focused, data-focus-visible and data-disabled, each "true" or absent.
Kobalte gives its parts their behaviour and their ARIA state, but none of these. A port makes the state, has it listen to the element Kobalte renders, and declares each attribute, which Solid then writes, on the server as in the browser:
let i = Interaction.create ~disabled:(fun[@u] () -> disabled ()) () in
<Kobalte.Root
ref=(fun b -> Interaction.watch i b)
data_hovered=(fun () -> Jsx.flag (Interaction.hovered i))
data_pressed=(fun () -> Jsx.flag (Interaction.pressed i))
data_focused=(fun () -> Jsx.flag (Interaction.focused i))
data_focus_visible=(fun () -> Jsx.flag (Interaction.focus_visible i))
data_disabled=(fun () -> Jsx.flag (Interaction.disabled i))>val create :
?disabled:bool Solidtype.Solid.accessor ->
?no_hover:bool Solidtype.Solid.accessor ->
?no_pointer_press:bool Solidtype.Solid.accessor ->
?keys:[ `target | `element ] ->
unit ->
tA state with nothing hovered, pressed or focused, disabled while disabled holds. While no_hover holds it is not hovered, and while no_pointer_press holds no pointer presses it, though a key still does: React Aria's read-only checkbox and switch are neither, its read-only radio only not hovered. A key presses as keys says React Aria judges it: by what it went to, `target, the default; or by the element watched, `element, as React Aria's radio judges a key on its label, which the input's key reaches as it bubbles, so Enter presses a radio's content as Space does.
val watch : t -> _ Dom.element_like -> unitwatch i element keeps i as React Aria keeps an element's state:
keys says;It is called once, as the element is made: from its ref.
val hovered : t -> boolWhether it is hovered, and not disabled; a read Solid tracks, as are the others.
val pressed : t -> boolWhether it is pressed, and not disabled.
val focused : t -> boolWhether it has the focus, and is not disabled.
val focus_visible : t -> boolWhether the page's last input was a key, a key typed into a text included: what an option shows its ring by while the focus it has is a combo box's, which stays in the combo box's input, as React Aria's does.