Get started

List segments and waypoints props

The generated props of every element on List segments and waypoints. The guide is where they are explained; this is the whole surface.

ItinerarySegmentTable

itineraryId

string

An itinerary to tabulate, resolved through the client on the provider.

One prop instead of a fetch and three mappings: the geometry, the server's own figures and the itinerary's own chain arrive in a single round trip, with each group collapsed to one leg. A profile given the same id shares that request.

surface

"published"

Reads the itinerary's published snapshot rather than its draft.

segments

readonly ItinerarySegmentInput[]

The legs to tabulate, for a caller already holding them.

A row is a segment. Each leg states its own name, its own colour and the figures the server computed for it, and its stretch of the sparkline is measured from its own geometry, so nothing here is projected, estimated or ordered by proximity. itinerarySegments on @mountaya/elements/data maps an API itinerary onto this shape; a caller with no Mountaya itinerary states the fields by hand.

Given alongside itineraryId, this wins: a chain a caller is already holding is never worth discarding in favour of a request.

A new array of the same legs, in the same order, is the same chain: the rows are built again only when a leg object changes.

columns

readonly ItinerarySegmentTableColumnSpec[]

Which columns the table carries, in the order given. [] drops the table.

A new list of the same columns is the same list. A custom column whose cell is a new function renders every row again: hold that column stable.

units

UnitFormatOptions

Units, slope notation and the locale to format in.

toolbar

ReactNode

Rendered above the table, in a strip of its own. No strip is drawn for a slot React draws nothing for (undefined, null, false).

highlighted

string | null

The row to light, in addition to whatever the pointer is over.

Takes over the map-to-row half. With a map in context the table already listens for the leg under the map's own cursor and lights that row; state an id here and the element stops listening and lights yours instead, the same controlled/uncontrolled pair range draws on the chart. Matches a row's own id or, on a collapsed group, any of its members'.

emphasisColor

string

Colour of the lit stretch on the map.

disabled

boolean

default: false

Renders the table non-interactive. No hover echo, no map marker, no press.

markerId

string

default: ITINERARY_SEGMENT_TABLE_MARKER_ID

The id the MAP's cursor marker is pinned under.

markerColor

string

Colour of the map's cursor marker.

strings

ItinerarySegmentTableStrings

Overrides the words this element renders, for this element only.

Folded onto whatever the provider resolved, so an override naming one key leaves the rest of the section alone. Scoped to the sections this element reads: a key it never renders is a type error rather than a silent no-op.

ItinerarySegmentTable.Row

row

ItinerarySegmentRow

required
columns

readonly ItinerarySegmentTableColumnSpec[]

required
units

UnitFormatOptions

required
polyline

string

required

The whole itinerary's curve, built once by the table and shared by every row.

area

string

required
totalDistance

number

required
hovered

boolean

required
disabled

boolean

Renders the row non-interactive: no hover, no press.

revealed

boolean

Whether this row is the highlighted one, scrolled into view as it becomes so.

Inside the nearest ancestor that scrolls (a panel, a sidebar, a table given a height) and by the least that shows the row. The page is never scrolled, so a row in no scrolling container stays where it is.

strings

ItinerarySegmentTableRowStrings

Overrides the words this element renders, for this element only.

Folded onto whatever the provider resolved, so an override naming one key leaves the rest of the section alone. Scoped to the sections this element reads: a key it never renders is a type error rather than a silent no-op.

ItinerarySegmentTable.Sparkline

polyline

string

required

The whole itinerary's curve, as an SVG points string. Built once by the table.

area

string

required

The whole itinerary's filled region, as an SVG path. Built once by the table.

totalDistance

number

required
range

ProfileRange

required

The stretch this row lights, in meters.

color

string

ItinerarySegmentTable.Toolbar

ItinerarySegmentTableToolbar is a styled strip above the table, and nothing else.

children

ReactNode

ItineraryWaypointTable

itineraryId

string

The itinerary to resolve through the client on the provider.

The same contract every resource-taking element in this package keeps: pass an id and the element fetches, pass waypoints and it draws what you gave it. Passed both, the caller's list wins, and the id still resolves the geometry where geojson is not given.

surface

"published"

Reads the published snapshot rather than the draft.

waypoints

readonly Waypoint[]

The places, stated directly.

A Waypoint rather than the wire's own record: the element's shape, which itineraryWaypoints on @mountaya/elements/data maps a stored itinerary onto. A new array of the same places is the same list.

geojson

ProfileInput | null

The geometry the places are projected onto.

columns

readonly ItineraryWaypointTableColumnSpec[]

Which columns appear, in the order they appear.

A new list of the same columns is the same list. A custom column whose cell is a new function renders every row again: hold that column stable.

units

UnitFormatOptions

Units, slope notation and the locale to format in.

toolbar

ReactNode

Rendered in the toolbar strip, beside the amenity filter. With no filter chips to draw, no strip is drawn for a slot React draws nothing for (undefined, null, false).

filter

readonly string[]

default: []

The amenities filtering the table. Empty, or unset, shows every place.

Controlled by the caller, with onFilterChange reporting a chip press. It is the shape the segment table's highlighted takes, for the same reason: an element that owned this state would fight an application that also wants to drive it from a URL.

formatCutoffAt

(iso: string) => string

Writes a cut-off's instant, an ISO 8601 string, in the cutoff column.

Without it the column is empty: an instant needs a locale and a time zone, which are the application's. <ItineraryProfile> and <WaypointCard> take the same function. A new function renders every row again: hold it stable.

disabled

boolean

default: false

markerId

string

default: ITINERARY_WAYPOINT_TABLE_MARKER_ID

The map marker id the hovered place is pinned under.

markerColor

string

strings

ItineraryWaypointTableStrings

Overrides the words this element renders, for this element only.

Folded onto whatever the provider resolved, so an override naming one key leaves the rest of the section alone. Scoped to the sections this element reads: a key it never renders is a type error rather than a silent no-op.

ItineraryWaypointTable.Row

row

ItineraryWaypointRow

required
columns

readonly ItineraryWaypointTableColumnSpec[]

required
units

UnitFormatOptions

required
polyline

string

required

The whole itinerary's curve, shared by every row rather than rebuilt per row.

area

string

required
totalDistance

number

required

The itinerary's full length, which the sparkline scales its lit stretch against.

hovered

boolean

required
disabled

boolean

Renders the row non-interactive: no hover.

formatCutoffAt

(iso: string) => string

Writes a cut-off's instant, an ISO 8601 string. Without it the cutoff cell is empty.

strings

ItineraryWaypointTableRowStrings

Overrides the words this element renders, for this element only.

Folded onto whatever the provider resolved, so an override naming one key leaves the rest of the section alone. Scoped to the sections this element reads: a key it never renders is a type error rather than a silent no-op.

ItineraryWaypointTable.Sparkline

polyline

string

required

The whole itinerary's curve, as an SVG points string. Built once by the table.

area

string

required

The whole itinerary's filled region, as an SVG path. Built once by the table.

totalDistance

number

required
range

ProfileRange

required

The stretch this row lights, in meters.

color

string

ItineraryWaypointTable.Toolbar

ItineraryWaypointTableToolbar is the strip above the table, with the amenity filter in it.

available

readonly string[]

default: []

The amenities this itinerary actually offers somewhere, ordered by the name a reader sees in the provider's locale.

Only the ones present. A legend of every amenity, greyed where absent, is a different design decision and belongs to the caller: this row is a FILTER, and a chip that can only ever empty the table is a control that lies about what it does.

selected

readonly string[]

default: []

The amenities currently filtering the table. Empty means no filter.

disabled

boolean

default: false

children

ReactNode

strings

ItineraryWaypointTableToolbarStrings

Overrides the words this element renders, for this element only.

Folded onto whatever the provider resolved, so an override naming one key leaves the rest of the section alone. Scoped to the sections this element reads: a key it never renders is a type error rather than a silent no-op.

WaypointCard

formatCutoffAt

(iso: string) => string

Writes a cut-off's instant, an ISO 8601 string, in the card's timing rows.

Without it no cut-off is shown: an instant needs a locale and a time zone, which are the application's. <ItineraryProfile> and <ItineraryWaypointTable> take the same function.

headingLevel

2 | 3 | 4 | 5 | 6

default: 3

The level of the heading the card's name is written in, so the card fits the outline of the page it is placed in: 2 under a page's <h1>, 4 inside an <h3> section. Any other value is read as the default.

name

string

The name shown in the header.

Taken as a prop rather than read off the waypoint, because an unnamed place is named by WHERE IT SITS among its siblings ("Water #2"), and only the list holding those siblings can resolve that.

withPhotos

boolean

default: true

Whether the card shows its photo grid. false hides it, for a card in a column too narrow to show one honestly.

strings

WaypointCardStrings

Overrides the words this element renders, for this element only.

units

UnitFormatOptions

Units, slope notation and the locale to format in.

waypoint

Waypoint

required

The place: a Waypoint, the element shape, not the wire's own record.

Handlers

An on* handler suppresses the element's own default. Left unset, the element acts; set, it becomes presentational and your handler decides. The two never both fire.

ItinerarySegmentTable

onHover

(row: ItinerarySegmentRow | null) => void

Takes over what a hover does.

Left unset, and with a map in context, the table drives the map itself: it lights the hovered leg on the route and pins a marker at its end, and it listens for what the map's own cursor is over so the two follow each other. Set, all of that is suppressed and the element becomes presentational: the handler receives the hovered row, or null on leave.

A table disabled over a pointed row reports null as well, once.

onSegmentClick

(id: string) => void

Called with a leg's id when its name is pressed. Unset leaves the name as text.

The id the caller gave, which for a collapsed group is the group's synthetic id rather than any one member's: the row stands for the run, so pressing it means the run.

onError

(error: Error) => void

Reports a failure resolving itineraryId. Additive; the element renders its empty state.

ItineraryWaypointTable

onFilterChange

(amenities: readonly string[]) => void

Called with the next filter when a chip is pressed. Unset leaves the chips out entirely.

onHover

(row: ItineraryWaypointRow | null) => void

Called as the pointer moves across rows, with null on leave and, once, when the table is disabled over a pointed row.

Set, the table stops driving the map: it pins no cursor marker and the caller decides. The one line that makes this element presentational rather than a map controller.

onError

(error: Error) => void