Manta Developers
GitHub
Menu

@manta-eu/horns-kit/view

Reference for @manta-eu/horns-kit/view in @manta-eu/horns-kit 0.2.3.

Type Aliases

ExplainedFact

ExplainedFact = object

The fact a mark explains, as the host’s explainer will ask for it.

Properties

data?

optional data?: unknown

The explanation, opaque here: only the host reads it. Without it the host would have to fetch one.

object

object: string

predicate?

optional predicate?: string

subject

subject: string

title?

optional title?: string

What to call the explanation when it opens.


ExplainPlacement

ExplainPlacement = object

Properties

open?

optional open?: (fact) => void

Opens the explanation. Absent on a server render and in a capture, where the mark is not drawn at all.

Parameters
fact

ExplainedFact

Returns

void

palette

palette: ChartPalette


HornFilter

HornFilter = object

Properties

is

is: (value) => boolean

True when value is what the Horn is narrowed to.

Parameters
value

unknown

Returns

boolean

live

live: boolean

Whether narrowing is possible at all. A view checks this before drawing something that looks clickable.

toggle

toggle: (value) => void

Narrows to value, or clears it when it is already that.

Parameters
value

unknown

Returns

void

value

value: unknown

What the Horn is narrowed to now, or undefined.


HornFilters

HornFilters = object

Properties

onChange?

optional onChange?: (id, value) => void

Narrows the Horn to a value, or clears it with undefined. Absent where nothing can re-query — a capture, a server render — and then a view draws its marks as plain text rather than as controls.

Parameters
id

string

value

unknown

Returns

void

variables

variables: HornSnapshot["variables"]

The Horn’s variables as the snapshot was built with them.


NothingProps

NothingProps = object

Properties

hint?

optional hint?: string

What would put something here, or why there is nothing.

title

title: string

What is not here: “No tier 1 suppliers”, not “No data”.


WhyThisProps

WhyThisProps = ExplainedFact & object

Type Declaration

children

children: ReactNode

The value being claimed: a number, a badge, a word. Drawn as it is, with the mark beside it.

Variables

ExplainPlacementProvider

const ExplainPlacementProvider: Provider


HornFiltersProvider

const HornFiltersProvider: Provider

Functions

Nothing()

Nothing(__namedParameters): Element

A view with no rows. EmptyState needs an icon component a written view cannot supply.

Parameters

__namedParameters

NothingProps

Returns

Element


useHornFilter()

useHornFilter(id): HornFilter

One of the Horn’s variables, as a filter a view can set.

Setting it re-runs every binding taking it as a parameter: the tile and the list answer to the variable, not to each other. A variable the Horn does not declare gives a dead filter, not an error.

Parameters

id

string

Returns

HornFilter


WhyThis()

WhyThis(__namedParameters): Element

Draws its child with a mark beside it. No placement — a server render, a capture — draws it alone.

Parameters

__namedParameters

WhyThisProps

Returns

Element