Mixins / foldkit-mixins-ui

Tooltip

namespace · packages/mixins-ui/src/tooltip.ts:1

export * as Tooltip from './tooltip.js'

In the guides

Members

Tooltip.anchor

function · packages/mixins-ui/src/tooltip.ts:37

function anchor(config?: AnchorConfig): AnchorConfig

The tooltip's placement, for the view's anchor: above its trigger and centred on it, 8px off, kept 8px inside the viewport, flipping below and shifting along rather than leave it. Kept in place for layer. config overrides any of it.

Tooltip.resolve

function · packages/mixins-ui/src/tooltip.ts:54

function resolve<Input, Message>(
  render: RenderInfo,
  mixins: MixinList<Message>,
  context: TooltipContext<Input, Message>,
): ResolvedTooltip<Message>

Resolves the tooltip's render groups; isVisible passes through unchanged.

Tooltip.ResolvedTooltip

type · packages/mixins-ui/src/tooltip.ts:51

type ResolvedTooltip<Message> = Resolved<
  RenderInfo,
  typeof TooltipSlots,
  Message
>

The tooltip's bundles with the attached Mixins applied.

Tooltip.TooltipContext

interface · packages/mixins-ui/src/tooltip.ts:45

interface TooltipContext<Input, Message> extends ResolveContext<
  Input,
  Message
> {
  readonly id: string
}

Tooltip.TooltipSlots

const · packages/mixins-ui/src/tooltip.ts:20

const TooltipSlots: Slots.Contract<{
  readonly trigger: Slot.UnnamedSlot<
    Capability.Capability<
      'Interactive',
      readonly [Capability.Capability<'Base', readonly []>]
    >,
    readonly [
      Event.EventToken<'focus'>,
      Event.EventToken<'blur'>,
      Event.EventToken<'pointerdown'>,
    ],
    readonly [
      Attr.AttrToken<'role'>,
      Attr.AttrToken<'aria-disabled'>,
      Attr.AttrToken<'disabled'>,
    ],
    readonly Slot.RequirementName[],
    boolean
  >
  readonly layer: Slot.UnnamedSlot<
    Capability.Capability<
      'Container',
      readonly [
        Capability.Capability<
          'Interactive',
          readonly [Capability.Capability<'Base', readonly []>]
        >,
      ]
    >,
    readonly Slot.EventName[],
    readonly Slot.AttributeName[],
    readonly Slot.RequirementName[],
    boolean
  >
  readonly panel: Slot.UnnamedSlot<
    Capability.Capability<
      'Container',
      readonly [
        Capability.Capability<
          'Interactive',
          readonly [Capability.Capability<'Base', readonly []>]
        >,
      ]
    >,
    readonly Slot.EventName[],
    readonly [Attr.AttrToken<'role'>],
    readonly Slot.RequirementName[],
    boolean
  >
  readonly arrow: Slot.UnnamedSlot<
    Capability.Capability<
      'Container',
      readonly [
        Capability.Capability<
          'Interactive',
          readonly [Capability.Capability<'Base', readonly []>]
        >,
      ]
    >,
    readonly Slot.EventName[],
    readonly Slot.AttributeName[],
    readonly Slot.RequirementName[],
    boolean
  >
}>

Tooltip is a Submodel; both upstream bundles are ChildAttribute groups. trigger owns focus, blur and pointerdown (the hover/keyboard entry points); panel carries the anchor Mount. resolve preserves each group by identity.

layer and arrow are this package's. layer, drawn around the panel, shows it in the browser's top layer (Anchor.layer); draw the panel without a portal (portal: false, as anchor gives). arrow, drawn as the panel's child, points at the trigger: upstream's tooltip anchor computes no arrow, so Anchor.PlaceArrow places it.

Tooltip.toView

function · packages/mixins-ui/src/tooltip.ts:73

function toView<Message>(
  mixins: MixinList<Message>,
  context: TooltipContext<unknown, Message>,
  draw: (resolved: ResolvedTooltip<Message>) => Html,
): (render: RenderInfo) => Html

The tooltip's toView: draw receives its bundles with mixins applied.