diff --git a/src/Nri/Ui/Tooltip/V2.elm b/src/Nri/Ui/Tooltip/V2.elm index 72dccee0..208a971b 100644 --- a/src/Nri/Ui/Tooltip/V2.elm +++ b/src/Nri/Ui/Tooltip/V2.elm @@ -26,6 +26,7 @@ Post-release patches: - mark customTriggerAttributes as deprecated - add containerCss - adds `nriDescription` and `testId` + - fix Changes from V1: @@ -106,6 +107,7 @@ type Attribute msg type alias Tooltip msg = { direction : Direction + , alignment : Alignment , tail : Tail , content : List (Html msg) , attributes : List (Html.Attribute Never) @@ -126,7 +128,8 @@ buildAttributes = defaultTooltip : Tooltip msg defaultTooltip = { direction = OnTop - , tail = WithTail Middle + , alignment = Middle + , tail = WithTail , content = [] , attributes = [] , containerStyles = @@ -160,7 +163,7 @@ html content = type Tail - = WithTail Alignment + = WithTail | WithoutTail @@ -173,10 +176,6 @@ type Alignment {-| Makes it so that the tooltip does not have a tail! - -This will center the tooltip relative to the trigger content, superseding any -custom alignment set by `alignStart` and `alignEnd`. - -} withoutTail : Attribute msg withoutTail = @@ -185,17 +184,7 @@ withoutTail = withAligment : Alignment -> Attribute msg withAligment alignment = - Attribute (\config -> { config | tail = WithTail alignment }) - - -tailAlignment : Tail -> Alignment -tailAlignment tail = - case tail of - WithTail alignment -> - alignment - - WithoutTail -> - Middle + Attribute (\config -> { config | alignment = alignment }) {-| Put the tail at the "start" of the tooltip. @@ -664,7 +653,7 @@ viewOpenTooltip tooltipId config = Html.div [ Attributes.css [ Css.position Css.absolute - , positionTooltip config.direction (tailAlignment config.tail) + , positionTooltip config.direction config.alignment , Css.boxSizing Css.borderBox ] ] @@ -684,7 +673,7 @@ viewOpenTooltip tooltipId config = ] ++ config.tooltipStyleOverrides ) - , pointerBox config.tail config.direction (tailAlignment config.tail) + , pointerBox config.tail config.direction config.alignment -- We need to keep this animation in tests to make it pass: check out -- the NoAnimations middleware. So if you change the name here, please @@ -771,7 +760,7 @@ pointerBox tail direction alignment = , Css.border3 (Css.px 1) Css.solid Colors.navy , positioning direction alignment , case tail of - WithTail _ -> + WithTail -> tailForDirection direction WithoutTail ->