-module(glaze@basecoat@tooltip). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/glaze/basecoat/tooltip.gleam"). -export([tooltip/2, trigger/2, trigger_with_id/3, content/2, content_with_id/3, side/1, align/1, side_top/0, side_bottom/0, side_left/0, side_right/0, align_start/0, align_center/0, align_end/0]). -if(?OTP_RELEASE >= 27). -define(MODULEDOC(Str), -moduledoc(Str)). -define(DOC(Str), -doc(Str)). -else. -define(MODULEDOC(Str), -compile([])). -define(DOC(Str), -compile([])). -endif. ?MODULEDOC( " Basecoat documentation: \n" "\n" " Tooltip helpers for short helper text on interactive elements.\n" "\n" " **Note**: This component requires JavaScript from Basecoat.\n" "\n" " ## Anatomy\n" "\n" " A tooltip setup usually includes a `trigger` element and a `content` panel.\n" "\n" " ## Recipe\n" "\n" " ```gleam\n" " import glaze/basecoat/tooltip\n" " import lustre/element/html\n" "\n" " fn my_tooltip() {\n" " tooltip.tooltip(\"my-tooltip\", [\n" " tooltip.trigger([], [html.text(\"Hover me\")]),\n" " tooltip.content([], [html.text(\"Tooltip text\")]),\n" " ])\n" " }\n" " ```\n" "\n" " ## References\n" "\n" " - MDN ARIA `tooltip` role: \n" " - MDN Popover API: \n" ). -file("src/glaze/basecoat/tooltip.gleam", 35). -spec tooltip(binary(), list(lustre@vdom@vnode:element(UMS))) -> lustre@vdom@vnode:element(UMS). tooltip(Id, Children) -> lustre@element@html:'div'( [lustre@attribute:class(<<"tooltip"/utf8>>), lustre@attribute:id(Id)], Children ). -file("src/glaze/basecoat/tooltip.gleam", 39). -spec trigger( list(lustre@vdom@vattr:attribute(UMW)), list(lustre@vdom@vnode:element(UMW)) ) -> lustre@vdom@vnode:element(UMW). trigger(Attrs, Children) -> Tooltip_id = <<"tooltip"/utf8>>, lustre@element@html:button( lists:append( [lustre@attribute:type_(<<"button"/utf8>>), lustre@attribute:aria_describedby(Tooltip_id)], Attrs ), Children ). -file("src/glaze/basecoat/tooltip.gleam", 56). -spec trigger_with_id( binary(), list(lustre@vdom@vattr:attribute(UNC)), list(lustre@vdom@vnode:element(UNC)) ) -> lustre@vdom@vnode:element(UNC). trigger_with_id(Tooltip_id, Attrs, Children) -> lustre@element@html:button( lists:append( [lustre@attribute:type_(<<"button"/utf8>>), lustre@attribute:aria_describedby(Tooltip_id)], Attrs ), Children ). -file("src/glaze/basecoat/tooltip.gleam", 73). -spec content( list(lustre@vdom@vattr:attribute(UNI)), list(lustre@vdom@vnode:element(UNI)) ) -> lustre@vdom@vnode:element(UNI). content(Attrs, Children) -> Tooltip_id = <<"tooltip"/utf8>>, lustre@element@html:'div'( lists:append( [lustre@attribute:id(Tooltip_id), lustre@attribute:role(<<"tooltip"/utf8>>), lustre@attribute:data(<<"popover"/utf8>>, <<""/utf8>>), lustre@attribute:aria_hidden(true)], Attrs ), Children ). -file("src/glaze/basecoat/tooltip.gleam", 92). -spec content_with_id( binary(), list(lustre@vdom@vattr:attribute(UNO)), list(lustre@vdom@vnode:element(UNO)) ) -> lustre@vdom@vnode:element(UNO). content_with_id(Tooltip_id, Attrs, Children) -> lustre@element@html:'div'( lists:append( [lustre@attribute:id(Tooltip_id), lustre@attribute:role(<<"tooltip"/utf8>>), lustre@attribute:data(<<"popover"/utf8>>, <<""/utf8>>), lustre@attribute:aria_hidden(true)], Attrs ), Children ). -file("src/glaze/basecoat/tooltip.gleam", 111). -spec side(binary()) -> lustre@vdom@vattr:attribute(any()). side(S) -> lustre@attribute:data(<<"side"/utf8>>, S). -file("src/glaze/basecoat/tooltip.gleam", 115). -spec align(binary()) -> lustre@vdom@vattr:attribute(any()). align(A) -> lustre@attribute:data(<<"align"/utf8>>, A). -file("src/glaze/basecoat/tooltip.gleam", 119). -spec side_top() -> lustre@vdom@vattr:attribute(any()). side_top() -> side(<<"top"/utf8>>). -file("src/glaze/basecoat/tooltip.gleam", 123). -spec side_bottom() -> lustre@vdom@vattr:attribute(any()). side_bottom() -> side(<<"bottom"/utf8>>). -file("src/glaze/basecoat/tooltip.gleam", 127). -spec side_left() -> lustre@vdom@vattr:attribute(any()). side_left() -> side(<<"left"/utf8>>). -file("src/glaze/basecoat/tooltip.gleam", 131). -spec side_right() -> lustre@vdom@vattr:attribute(any()). side_right() -> side(<<"right"/utf8>>). -file("src/glaze/basecoat/tooltip.gleam", 135). -spec align_start() -> lustre@vdom@vattr:attribute(any()). align_start() -> align(<<"start"/utf8>>). -file("src/glaze/basecoat/tooltip.gleam", 139). -spec align_center() -> lustre@vdom@vattr:attribute(any()). align_center() -> align(<<"center"/utf8>>). -file("src/glaze/basecoat/tooltip.gleam", 143). -spec align_end() -> lustre@vdom@vattr:attribute(any()). align_end() -> align(<<"end"/utf8>>).