@sdxc/ui 2026.11.18 → 2026.11.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +133 -1
- package/dist/app/index.d.ts +1 -0
- package/dist/app/index.js +1 -0
- package/dist/app/mixins/command-palette.js +10 -2
- package/dist/app/mixins/log-viewer.js +17 -14
- package/dist/app/mixins/route-dialog.d.ts +17 -0
- package/dist/app/mixins/route-dialog.js +53 -0
- package/dist/app/optimistic-toggle.js +6 -0
- package/dist/app/route-dialog.d.ts +38 -0
- package/dist/app/route-dialog.js +49 -0
- package/dist/audio/equalizer.d.ts +24 -0
- package/dist/audio/equalizer.js +57 -0
- package/dist/audio/index.d.ts +16 -0
- package/dist/audio/index.js +16 -0
- package/dist/audio/media-tile.d.ts +38 -0
- package/dist/audio/media-tile.js +98 -0
- package/dist/audio/player-bar.d.ts +108 -0
- package/dist/audio/player-bar.js +338 -0
- package/dist/audio/queue-list.d.ts +56 -0
- package/dist/audio/queue-list.js +102 -0
- package/dist/audio/track-list.d.ts +91 -0
- package/dist/audio/track-list.js +226 -0
- package/dist/audio/utils/media-session.d.ts +44 -0
- package/dist/audio/utils/media-session.js +87 -0
- package/dist/audio/utils/play-queue.d.ts +98 -0
- package/dist/audio/utils/play-queue.js +149 -0
- package/dist/audio/utils/track-time.d.ts +28 -0
- package/dist/audio/utils/track-time.js +36 -0
- package/dist/chat/composer-format.d.ts +35 -0
- package/dist/chat/composer-format.js +84 -0
- package/dist/chat/index.d.ts +6 -0
- package/dist/chat/index.js +6 -0
- package/dist/chat/mention-menu.d.ts +43 -0
- package/dist/chat/mention-menu.js +70 -0
- package/dist/chat/message-group.d.ts +92 -0
- package/dist/chat/message-group.js +222 -0
- package/dist/chat/mixins/composer-format.d.ts +28 -0
- package/dist/chat/mixins/composer-format.js +80 -0
- package/dist/chat/mixins/composer-send.d.ts +2 -2
- package/dist/chat/mixins/composer-send.js +4 -2
- package/dist/chat/mixins/mention-menu.d.ts +41 -0
- package/dist/chat/mixins/mention-menu.js +213 -0
- package/dist/chat/mixins/reaction-sync.d.ts +47 -0
- package/dist/chat/mixins/reaction-sync.js +172 -0
- package/dist/chat/reaction-bar.d.ts +70 -0
- package/dist/chat/reaction-bar.js +108 -0
- package/dist/chat/typing-indicator.d.ts +42 -0
- package/dist/chat/typing-indicator.js +68 -0
- package/dist/chat/utils/composer-text.d.ts +38 -0
- package/dist/chat/utils/composer-text.js +86 -0
- package/dist/chat/utils/markdown-format.d.ts +30 -0
- package/dist/chat/utils/markdown-format.js +158 -0
- package/dist/chat/utils/mention-query.d.ts +55 -0
- package/dist/chat/utils/mention-query.js +60 -0
- package/dist/commerce/cart-drawer.d.ts +69 -0
- package/dist/commerce/cart-drawer.js +163 -0
- package/dist/commerce/cart-line.d.ts +32 -0
- package/dist/commerce/cart-line.js +43 -0
- package/dist/commerce/checkout-layout.d.ts +32 -0
- package/dist/commerce/checkout-layout.js +51 -0
- package/dist/commerce/facet-filters.d.ts +121 -0
- package/dist/commerce/facet-filters.js +318 -0
- package/dist/commerce/fulfilment-note.d.ts +28 -0
- package/dist/commerce/fulfilment-note.js +26 -0
- package/dist/commerce/index.d.ts +27 -0
- package/dist/commerce/index.js +27 -0
- package/dist/commerce/item-options-dialog.d.ts +67 -0
- package/dist/commerce/item-options-dialog.js +150 -0
- package/dist/commerce/menu-item-card.d.ts +37 -0
- package/dist/commerce/menu-item-card.js +96 -0
- package/dist/commerce/option-group.d.ts +62 -0
- package/dist/commerce/option-group.js +121 -0
- package/dist/commerce/order-summary.d.ts +42 -0
- package/dist/commerce/order-summary.js +76 -0
- package/dist/commerce/order-tracker.d.ts +80 -0
- package/dist/commerce/order-tracker.js +178 -0
- package/dist/commerce/price.d.ts +52 -0
- package/dist/commerce/price.js +108 -0
- package/dist/commerce/product-card.d.ts +53 -0
- package/dist/commerce/product-card.js +127 -0
- package/dist/commerce/product-gallery.d.ts +70 -0
- package/dist/commerce/product-gallery.js +186 -0
- package/dist/commerce/promo-code.d.ts +56 -0
- package/dist/commerce/promo-code.js +101 -0
- package/dist/commerce/quantity-stepper.d.ts +42 -0
- package/dist/commerce/quantity-stepper.js +53 -0
- package/dist/commerce/question-list.d.ts +53 -0
- package/dist/commerce/question-list.js +92 -0
- package/dist/commerce/shipping-estimate.d.ts +53 -0
- package/dist/commerce/shipping-estimate.js +39 -0
- package/dist/commerce/sort-select.d.ts +38 -0
- package/dist/commerce/sort-select.js +38 -0
- package/dist/commerce/variant-picker.d.ts +75 -0
- package/dist/commerce/variant-picker.js +135 -0
- package/dist/components/amount.d.ts +46 -0
- package/dist/components/amount.js +34 -0
- package/dist/components/autocomplete.d.ts +82 -0
- package/dist/components/autocomplete.js +114 -0
- package/dist/components/carousel.d.ts +31 -1
- package/dist/components/carousel.js +66 -3
- package/dist/components/index.d.ts +11 -0
- package/dist/components/index.js +11 -0
- package/dist/components/letterbox.d.ts +47 -0
- package/dist/components/letterbox.js +56 -0
- package/dist/components/lightbox.d.ts +88 -0
- package/dist/components/lightbox.js +224 -0
- package/dist/components/media-grid.d.ts +53 -0
- package/dist/components/media-grid.js +89 -0
- package/dist/components/range-months.d.ts +100 -0
- package/dist/components/range-months.js +274 -0
- package/dist/components/rating-input.d.ts +33 -0
- package/dist/components/rating-input.js +63 -0
- package/dist/components/rating.d.ts +38 -0
- package/dist/components/rating.js +66 -0
- package/dist/components/review-card.d.ts +39 -0
- package/dist/components/review-card.js +59 -0
- package/dist/components/section-bar.d.ts +57 -0
- package/dist/components/section-bar.js +140 -0
- package/dist/components/slider.js +7 -0
- package/dist/components/step-indicator.d.ts +46 -0
- package/dist/components/step-indicator.js +96 -0
- package/dist/finance/index.d.ts +10 -0
- package/dist/finance/index.js +10 -0
- package/dist/finance/ledger.d.ts +60 -0
- package/dist/finance/ledger.js +93 -0
- package/dist/finance/payment-card.d.ts +49 -0
- package/dist/finance/payment-card.js +115 -0
- package/dist/map/engine.d.ts +49 -0
- package/dist/map/engine.js +591 -0
- package/dist/map/index.d.ts +12 -0
- package/dist/map/index.js +12 -0
- package/dist/map/map-canvas.d.ts +101 -0
- package/dist/map/map-canvas.js +275 -0
- package/dist/map/map.d.ts +217 -0
- package/dist/map/map.js +598 -0
- package/dist/map/mixins/map-link.d.ts +30 -0
- package/dist/map/mixins/map-link.js +116 -0
- package/dist/map/utils/basemap.d.ts +88 -0
- package/dist/map/utils/basemap.js +84 -0
- package/dist/map/utils/cluster.d.ts +43 -0
- package/dist/map/utils/cluster.js +80 -0
- package/dist/map/utils/mercator.d.ts +66 -0
- package/dist/map/utils/mercator.js +92 -0
- package/dist/map/utils/stage.d.ts +24 -0
- package/dist/map/utils/stage.js +49 -0
- package/dist/mixins/autocomplete.d.ts +28 -0
- package/dist/mixins/autocomplete.js +283 -0
- package/dist/mixins/carousel-controls.d.ts +14 -3
- package/dist/mixins/carousel-controls.js +89 -30
- package/dist/mixins/index.d.ts +2 -0
- package/dist/mixins/index.js +2 -0
- package/dist/mixins/lightbox-controls.d.ts +34 -0
- package/dist/mixins/lightbox-controls.js +176 -0
- package/dist/schedule/agenda.d.ts +63 -0
- package/dist/schedule/agenda.js +221 -0
- package/dist/schedule/day-strip.d.ts +50 -0
- package/dist/schedule/day-strip.js +136 -0
- package/dist/schedule/free-busy.d.ts +96 -0
- package/dist/schedule/free-busy.js +285 -0
- package/dist/schedule/index.d.ts +15 -0
- package/dist/schedule/index.js +15 -0
- package/dist/schedule/mixins/day-strip-scroll.d.ts +16 -0
- package/dist/schedule/mixins/day-strip-scroll.js +40 -0
- package/dist/schedule/mixins/time-grid-drag.d.ts +24 -0
- package/dist/schedule/mixins/time-grid-drag.js +532 -0
- package/dist/schedule/month-view.d.ts +68 -0
- package/dist/schedule/month-view.js +301 -0
- package/dist/schedule/time-grid.d.ts +168 -0
- package/dist/schedule/time-grid.js +417 -0
- package/dist/schedule/utils/time-grid-layout.d.ts +50 -0
- package/dist/schedule/utils/time-grid-layout.js +93 -0
- package/dist/schedule/year-view.d.ts +46 -0
- package/dist/schedule/year-view.js +142 -0
- package/dist/styles/index.d.ts +1 -0
- package/dist/styles/index.js +1 -0
- package/dist/styles/typewriter-text.d.ts +20 -0
- package/dist/styles/typewriter-text.js +23 -0
- package/dist/test/map.d.ts +18 -0
- package/dist/test/map.js +96 -0
- package/dist/test/reels.d.ts +30 -0
- package/dist/test/reels.js +41 -0
- package/dist/test/stories.d.ts +31 -0
- package/dist/test/stories.js +66 -0
- package/dist/travel/boarding-pass.d.ts +107 -0
- package/dist/travel/boarding-pass.js +293 -0
- package/dist/travel/car-offer.d.ts +70 -0
- package/dist/travel/car-offer.js +127 -0
- package/dist/travel/fare-calendar.d.ts +85 -0
- package/dist/travel/fare-calendar.js +233 -0
- package/dist/travel/fare-options.d.ts +84 -0
- package/dist/travel/fare-options.js +142 -0
- package/dist/travel/flight-itinerary.d.ts +84 -0
- package/dist/travel/flight-itinerary.js +112 -0
- package/dist/travel/flight-option.d.ts +58 -0
- package/dist/travel/flight-option.js +111 -0
- package/dist/travel/flight-segment.d.ts +105 -0
- package/dist/travel/flight-segment.js +174 -0
- package/dist/travel/index.d.ts +20 -0
- package/dist/travel/index.js +20 -0
- package/dist/travel/package-savings.d.ts +74 -0
- package/dist/travel/package-savings.js +128 -0
- package/dist/travel/price-breakdown.d.ts +66 -0
- package/dist/travel/price-breakdown.js +102 -0
- package/dist/travel/rating-breakdown.d.ts +81 -0
- package/dist/travel/rating-breakdown.js +132 -0
- package/dist/travel/seat-map.d.ts +108 -0
- package/dist/travel/seat-map.js +371 -0
- package/dist/travel/trip-timeline.d.ts +84 -0
- package/dist/travel/trip-timeline.js +212 -0
- package/dist/utils/gamepad-presses.d.ts +21 -0
- package/dist/utils/gamepad-presses.js +28 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.js +5 -0
- package/dist/utils/move-focus.d.ts +20 -0
- package/dist/utils/move-focus.js +28 -0
- package/dist/utils/range-months.d.ts +54 -0
- package/dist/utils/range-months.js +98 -0
- package/dist/utils/swipe-direction.d.ts +23 -0
- package/dist/utils/swipe-direction.js +27 -0
- package/dist/utils/typewriter.d.ts +49 -0
- package/dist/utils/typewriter.js +171 -0
- package/dist/video/index.d.ts +6 -2
- package/dist/video/index.js +6 -2
- package/dist/video/mixins/reel-feed-sync.d.ts +41 -0
- package/dist/video/mixins/reel-feed-sync.js +430 -0
- package/dist/video/mixins/story-viewer-sync.d.ts +31 -0
- package/dist/video/mixins/story-viewer-sync.js +391 -0
- package/dist/video/reel-feed.d.ts +95 -0
- package/dist/video/reel-feed.js +124 -0
- package/dist/video/story-ring.d.ts +32 -0
- package/dist/video/story-ring.js +42 -0
- package/dist/video/story-viewer.d.ts +85 -0
- package/dist/video/story-viewer.js +250 -0
- package/package.json +21 -2
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "remix/component/jsx-runtime";
|
|
2
|
+
import { ChevronLeftIcon, ChevronRightIcon } from "@sdxc/icons";
|
|
3
|
+
import { visuallyHidden } from "@sdxc/u/a11y";
|
|
4
|
+
import { mergeMix, raw } from "@sdxc/u/general";
|
|
5
|
+
import { mbe } from "@sdxc/u/size";
|
|
6
|
+
import { Calendar } from "../components/calendar.js";
|
|
7
|
+
import { dayTime, monthWeeks, weekdayTime } from "../utils/range-months.js";
|
|
8
|
+
/** The first weekday column when `weekStartsOn` is unset: Sunday. */
|
|
9
|
+
const DEFAULT_WEEK_STARTS_ON = 0;
|
|
10
|
+
/** A day cell's height: 48px, or the touch target on a coarse pointer when that is larger. */
|
|
11
|
+
const DAY_HEIGHT = "max(3rem, var(--ui-target-size, 0px))";
|
|
12
|
+
/** The previous and next links' size: 32px, or the touch target on a coarse pointer. */
|
|
13
|
+
const NAV_SIZE = "max(2rem, var(--ui-target-size, 0px))";
|
|
14
|
+
/**
|
|
15
|
+
* Renders a month `<table>` with previous and next links, or, as `"strip"`, a `<nav>` named by
|
|
16
|
+
* `label` around a scrolling row of day cards. A day with a fare links to `href(day)`, named by
|
|
17
|
+
* its full date, fare and, at the `"low"` level, `labels.cheapest`; a day without one is text.
|
|
18
|
+
*
|
|
19
|
+
* @param handle Runtime handle carrying the calendar's props.
|
|
20
|
+
* @returns The render function producing the calendar's markup.
|
|
21
|
+
* @example
|
|
22
|
+
* <FareCalendar
|
|
23
|
+
* month="2026-03"
|
|
24
|
+
* fares={fares}
|
|
25
|
+
* selected="2026-03-14"
|
|
26
|
+
* href={(day) => `?depart=${day}`}
|
|
27
|
+
* prevHref="?month=2026-02"
|
|
28
|
+
* nextHref="?month=2026-04"
|
|
29
|
+
* locale="en-US"
|
|
30
|
+
* label="Departure dates"
|
|
31
|
+
* labels={{ previous: "Previous month", next: "Next month", cheapest: "cheapest", noFlights: "no flights" }}
|
|
32
|
+
* />
|
|
33
|
+
* @example
|
|
34
|
+
* <FareCalendar variant="strip" days={week} fares={fares} selected={day} href={href} locale={locale} label="Nearby dates" labels={labels} />
|
|
35
|
+
*/
|
|
36
|
+
export function FareCalendar(handle) {
|
|
37
|
+
return () => {
|
|
38
|
+
let { variant, month, days, fares, selected, href, prevHref, nextHref, today, weekStartsOn, locale, label, headingLevel, labels, mix, ...rest } = handle.props;
|
|
39
|
+
let formats = {
|
|
40
|
+
full: new Intl.DateTimeFormat(locale, { dateStyle: "full", timeZone: "UTC" }),
|
|
41
|
+
weekday: new Intl.DateTimeFormat(locale, { weekday: "short", timeZone: "UTC" }),
|
|
42
|
+
short: new Intl.DateTimeFormat(locale, { month: "short", day: "numeric", timeZone: "UTC" }),
|
|
43
|
+
};
|
|
44
|
+
/** One day's cell content, shared by the grid and the strip. */
|
|
45
|
+
function day(date, strip) {
|
|
46
|
+
return (_jsx(FareCalendarDay, { date: date, fare: fares[date], strip: strip, href: href, selected: date === selected, today: date === today, formats: formats, labels: labels }));
|
|
47
|
+
}
|
|
48
|
+
if (variant === "strip") {
|
|
49
|
+
return (_jsx("div", { "data-slot": "fare-calendar", "data-variant": "strip", ...rest, mix: mergeMix([raw({ minInlineSize: "0", fontVariantNumeric: "tabular-nums" })], mix), children: _jsxs("nav", { "aria-label": label, mix: [
|
|
50
|
+
raw({
|
|
51
|
+
display: "grid",
|
|
52
|
+
gridTemplateColumns: "auto minmax(0, 1fr) auto",
|
|
53
|
+
alignItems: "center",
|
|
54
|
+
gap: "0.25rem",
|
|
55
|
+
}),
|
|
56
|
+
], children: [_jsx(FareCalendarNav, { href: prevHref, label: labels.previous, side: "start" }), _jsx("ul", { "data-slot": "fare-calendar-strip", mix: [
|
|
57
|
+
raw({
|
|
58
|
+
display: "flex",
|
|
59
|
+
gap: "0.375rem",
|
|
60
|
+
margin: "0",
|
|
61
|
+
padding: "0.25rem",
|
|
62
|
+
listStyle: "none",
|
|
63
|
+
overflowX: "auto",
|
|
64
|
+
overscrollBehaviorInline: "contain",
|
|
65
|
+
scrollSnapType: "x proximity",
|
|
66
|
+
scrollbarWidth: "thin",
|
|
67
|
+
}),
|
|
68
|
+
], children: (days ?? []).map((date) => (_jsx("li", { "data-selected": date === selected ? "" : undefined, mix: [
|
|
69
|
+
raw({
|
|
70
|
+
flex: "0 0 auto",
|
|
71
|
+
minInlineSize: "4.75rem",
|
|
72
|
+
scrollSnapAlign: "center",
|
|
73
|
+
"&[data-selected]": { scrollInitialTarget: "nearest" },
|
|
74
|
+
}),
|
|
75
|
+
], children: day(date, true) }, date))) }), _jsx(FareCalendarNav, { href: nextHref, label: labels.next, side: "end" })] }) }));
|
|
76
|
+
}
|
|
77
|
+
let shown = month ?? (selected ?? today ?? "").slice(0, 7);
|
|
78
|
+
let firstWeekday = weekStartsOn ?? DEFAULT_WEEK_STARTS_ON;
|
|
79
|
+
let monthLabel = new Intl.DateTimeFormat(locale, {
|
|
80
|
+
month: "long",
|
|
81
|
+
year: "numeric",
|
|
82
|
+
timeZone: "UTC",
|
|
83
|
+
}).format(dayTime(shown));
|
|
84
|
+
let weekdays = Array.from({ length: 7 }, (_, index) => formats.weekday.format(weekdayTime(firstWeekday, index)));
|
|
85
|
+
return (_jsxs("div", { role: "group", "aria-label": label, "data-slot": "fare-calendar", "data-variant": "month", "data-month": shown, ...rest, mix: mergeMix([raw({ minInlineSize: "0", fontVariantNumeric: "tabular-nums" })], mix), children: [_jsxs(Calendar.Header, { mix: [mbe(2), raw({ minBlockSize: NAV_SIZE })], children: [_jsx(FareCalendarNav, { href: prevHref, label: labels.previous, side: "start" }), _jsx(Calendar.Heading, { level: headingLevel, children: monthLabel }), _jsx(FareCalendarNav, { href: nextHref, label: labels.next, side: "end" })] }), _jsxs(Calendar.Grid, { "aria-label": monthLabel, mix: [raw({ inlineSize: "100%", tableLayout: "fixed", borderSpacing: "0.125rem" })], children: [_jsx(Calendar.GridHeader, { children: _jsx(Calendar.Row, { children: weekdays.map((weekday) => (_jsx(Calendar.HeaderCell, { children: weekday }, weekday))) }) }), _jsx(Calendar.GridBody, { children: monthWeeks(shown, firstWeekday).map((week, row) => (_jsx(Calendar.Row, { children: week.map((date, column) => (_jsx("td", { "data-slot": date === null ? "fare-calendar-blank" : "fare-calendar-cell", mix: [raw({ padding: "0", verticalAlign: "top" })], children: date === null ? null : day(date, false) }, date ?? `${shown}-${row}-${column}`))) }, `${shown}-${row}`))) })] })] }));
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* A previous or next link drawn as a round chevron button, mirrored for right-to-left pages.
|
|
90
|
+
* An unset `href` keeps the slot empty, so the heading stays centred.
|
|
91
|
+
*/
|
|
92
|
+
function FareCalendarNav(handle) {
|
|
93
|
+
return () => {
|
|
94
|
+
let { href, label, side } = handle.props;
|
|
95
|
+
if (href === undefined) {
|
|
96
|
+
return _jsx("span", { "aria-hidden": "true", mix: [raw({ inlineSize: NAV_SIZE, flex: "none" })] });
|
|
97
|
+
}
|
|
98
|
+
return (_jsx("a", { href: href, "aria-label": label, "data-slot": side === "start" ? "fare-calendar-previous" : "fare-calendar-next", mix: [
|
|
99
|
+
raw({
|
|
100
|
+
display: "grid",
|
|
101
|
+
placeItems: "center",
|
|
102
|
+
flex: "none",
|
|
103
|
+
inlineSize: NAV_SIZE,
|
|
104
|
+
blockSize: NAV_SIZE,
|
|
105
|
+
borderRadius: "9999px",
|
|
106
|
+
color: "var(--ui-neutral-fg)",
|
|
107
|
+
"&:hover": { backgroundColor: "var(--ui-neutral-bg-tint-hover)" },
|
|
108
|
+
"&:focus-visible": { outline: "2px solid var(--ui-brand-ring)", outlineOffset: "2px" },
|
|
109
|
+
"& svg": { inlineSize: "1rem", blockSize: "1rem" },
|
|
110
|
+
"&:dir(rtl) svg": { scale: "-1 1" },
|
|
111
|
+
}),
|
|
112
|
+
], children: side === "start" ? (_jsx(ChevronLeftIcon, { "aria-hidden": "true" })) : (_jsx(ChevronRightIcon, { "aria-hidden": "true" })) }));
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* One day: a link when it has a fare, plain text when it has none. The drawn date is hidden from
|
|
117
|
+
* assistive technology, which hears the full date, the fare and "cheapest" instead.
|
|
118
|
+
*/
|
|
119
|
+
function FareCalendarDay(handle) {
|
|
120
|
+
return () => {
|
|
121
|
+
let { date, fare, strip, href, selected, today, formats, labels } = handle.props;
|
|
122
|
+
let time = dayTime(date);
|
|
123
|
+
let face = strip ? (_jsxs("span", { "aria-hidden": "true", "data-slot": "fare-calendar-date", mix: [raw({ display: "grid" })], children: [_jsx("span", { "data-slot": "fare-calendar-weekday", children: formats.weekday.format(time) }), _jsx("span", { "data-slot": "fare-calendar-number", children: formats.short.format(time) })] })) : (_jsx("span", { "aria-hidden": "true", "data-slot": "fare-calendar-number", children: Number(date.slice(8, 10)) }));
|
|
124
|
+
let spoken = formats.full.format(time);
|
|
125
|
+
let common = {
|
|
126
|
+
"data-slot": "fare-calendar-day",
|
|
127
|
+
"data-date": date,
|
|
128
|
+
"data-level": fare?.level,
|
|
129
|
+
"data-today": today ? "" : undefined,
|
|
130
|
+
"data-strip": strip ? "" : undefined,
|
|
131
|
+
};
|
|
132
|
+
if (fare === undefined) {
|
|
133
|
+
return (_jsxs("span", { ...common, "data-empty": "", mix: [dayStyle()], children: [face, _jsx("span", { "aria-hidden": "true", "data-slot": "fare-calendar-amount", children: "\u2013" }), _jsx("span", { mix: [visuallyHidden()], children: `${spoken}, ${labels.noFlights}` })] }));
|
|
134
|
+
}
|
|
135
|
+
let cheapest = fare.level === "low";
|
|
136
|
+
return (_jsxs("a", { ...common, href: href(date), "aria-current": currentToken(selected, today), mix: [dayStyle()], children: [face, _jsx("span", { mix: [visuallyHidden()], children: `${spoken}, ` }), _jsx("span", { "data-slot": "fare-calendar-amount", children: fare.amount }), cheapest ? (_jsxs(_Fragment, { children: [_jsx("span", { mix: [visuallyHidden()], children: `, ${labels.cheapest}` }), _jsx("span", { "aria-hidden": "true", "data-slot": "fare-calendar-marker" })] })) : null] }));
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* The `aria-current` token of a day link: the chosen day is the page the link leads to, and
|
|
141
|
+
* today is marked as the current date only when it is not also the chosen one.
|
|
142
|
+
*/
|
|
143
|
+
function currentToken(selected, today) {
|
|
144
|
+
if (selected)
|
|
145
|
+
return "page";
|
|
146
|
+
return today ? "date" : undefined;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* A day's look: the cheapest tinted in the success tone with a dot in the corner and a bold fare,
|
|
150
|
+
* the dearest fare muted, the chosen day filled with the brand colour, and today underlined. A
|
|
151
|
+
* strip card is a wider rounded tile carrying the weekday over the date.
|
|
152
|
+
*/
|
|
153
|
+
function dayStyle() {
|
|
154
|
+
return raw({
|
|
155
|
+
position: "relative",
|
|
156
|
+
display: "grid",
|
|
157
|
+
alignContent: "center",
|
|
158
|
+
justifyItems: "center",
|
|
159
|
+
gap: "0.125rem",
|
|
160
|
+
minBlockSize: DAY_HEIGHT,
|
|
161
|
+
paddingBlock: "0.25rem",
|
|
162
|
+
paddingInline: "0.125rem",
|
|
163
|
+
boxSizing: "border-box",
|
|
164
|
+
border: "1px solid transparent",
|
|
165
|
+
borderRadius: "0.5rem",
|
|
166
|
+
color: "var(--ui-neutral-fg-emphasis)",
|
|
167
|
+
fontSize: "0.875rem",
|
|
168
|
+
lineHeight: "1.1",
|
|
169
|
+
textAlign: "center",
|
|
170
|
+
textDecoration: "none",
|
|
171
|
+
"&[data-strip]": {
|
|
172
|
+
minBlockSize: "max(4rem, var(--ui-target-size, 0px))",
|
|
173
|
+
paddingInline: "0.5rem",
|
|
174
|
+
borderColor: "var(--ui-neutral-border)",
|
|
175
|
+
borderRadius: "0.75rem",
|
|
176
|
+
},
|
|
177
|
+
"& [data-slot=fare-calendar-amount]": {
|
|
178
|
+
maxInlineSize: "100%",
|
|
179
|
+
overflow: "hidden",
|
|
180
|
+
textOverflow: "ellipsis",
|
|
181
|
+
whiteSpace: "nowrap",
|
|
182
|
+
fontSize: "0.625rem",
|
|
183
|
+
fontWeight: "500",
|
|
184
|
+
color: "var(--ui-neutral-fg)",
|
|
185
|
+
},
|
|
186
|
+
"&[data-strip] [data-slot=fare-calendar-amount]": { fontSize: "0.75rem" },
|
|
187
|
+
"& [data-slot=fare-calendar-weekday]": {
|
|
188
|
+
fontSize: "0.6875rem",
|
|
189
|
+
color: "var(--ui-neutral-fg-muted)",
|
|
190
|
+
},
|
|
191
|
+
"&:is(a):hover": { backgroundColor: "var(--ui-neutral-bg-tint-hover)" },
|
|
192
|
+
"&:is(a):focus-visible": { outline: "2px solid var(--ui-brand-ring)", outlineOffset: "1px" },
|
|
193
|
+
"&[data-level=low]": {
|
|
194
|
+
backgroundColor: "var(--ui-success-bg-tint)",
|
|
195
|
+
borderColor: "var(--ui-success-border)",
|
|
196
|
+
},
|
|
197
|
+
"&[data-level=low]:hover": { backgroundColor: "var(--ui-success-bg-tint-hover)" },
|
|
198
|
+
"&[data-level=low] [data-slot=fare-calendar-amount]": {
|
|
199
|
+
fontWeight: "700",
|
|
200
|
+
color: "var(--ui-success-fg-emphasis)",
|
|
201
|
+
},
|
|
202
|
+
"&[data-level=high] [data-slot=fare-calendar-amount]": { color: "var(--ui-neutral-fg-muted)" },
|
|
203
|
+
"& [data-slot=fare-calendar-marker]": {
|
|
204
|
+
position: "absolute",
|
|
205
|
+
insetBlockStart: "0.25rem",
|
|
206
|
+
insetInlineEnd: "0.25rem",
|
|
207
|
+
inlineSize: "0.375rem",
|
|
208
|
+
blockSize: "0.375rem",
|
|
209
|
+
borderRadius: "9999px",
|
|
210
|
+
backgroundColor: "var(--ui-success-bg-solid)",
|
|
211
|
+
},
|
|
212
|
+
"&[data-empty]": { color: "var(--ui-neutral-fg-muted)" },
|
|
213
|
+
"&[data-empty] [data-slot=fare-calendar-amount]": { color: "var(--ui-neutral-fg-muted)" },
|
|
214
|
+
"&[data-today] [data-slot=fare-calendar-number]": {
|
|
215
|
+
fontWeight: "700",
|
|
216
|
+
textDecorationLine: "underline",
|
|
217
|
+
textDecorationThickness: "2px",
|
|
218
|
+
textUnderlineOffset: "3px",
|
|
219
|
+
},
|
|
220
|
+
"&[aria-current=page]": {
|
|
221
|
+
backgroundColor: "var(--ui-brand-bg-solid)",
|
|
222
|
+
borderColor: "var(--ui-brand-border-strong)",
|
|
223
|
+
color: "var(--ui-brand-fg-on-solid)",
|
|
224
|
+
boxShadow: "inset 0 0 0 1px var(--ui-brand-fg-on-solid)",
|
|
225
|
+
},
|
|
226
|
+
"&[aria-current=page] :is([data-slot=fare-calendar-amount], [data-slot=fare-calendar-weekday])": {
|
|
227
|
+
color: "inherit",
|
|
228
|
+
},
|
|
229
|
+
"&[aria-current=page] [data-slot=fare-calendar-marker]": {
|
|
230
|
+
backgroundColor: "var(--ui-brand-fg-on-solid)",
|
|
231
|
+
},
|
|
232
|
+
});
|
|
233
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fare classes as cards in a `<fieldset>`, each a native radio sharing one `name`, so the
|
|
3
|
+
* choice posts with its form and needs no script. Each card lists what the fare includes with
|
|
4
|
+
* a check, cross or coin, and the cards sit side by side once their container is wide.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
import type { Handle, Props as TagProps, RemixNode } from "remix/component";
|
|
10
|
+
/**
|
|
11
|
+
* Prop types for {@link FareOptions} and its compound parts.
|
|
12
|
+
*/
|
|
13
|
+
export declare namespace FareOptions {
|
|
14
|
+
/** Whether a fare includes a feature, leaves it out, or offers it for a fee. */
|
|
15
|
+
type Included = "yes" | "no" | "fee";
|
|
16
|
+
/** One line of a fare's feature list. */
|
|
17
|
+
interface Feature {
|
|
18
|
+
/** What the feature is, such as "Carry-on bag" or "Free changes". */
|
|
19
|
+
label: RemixNode;
|
|
20
|
+
included: Included;
|
|
21
|
+
}
|
|
22
|
+
/** The words a screen reader hears before each feature in place of its icon. */
|
|
23
|
+
interface StatusLabels {
|
|
24
|
+
/** Such as "Included". */
|
|
25
|
+
yes: string;
|
|
26
|
+
/** Such as "Not included". */
|
|
27
|
+
no: string;
|
|
28
|
+
/** Such as "Available for a fee". */
|
|
29
|
+
fee: string;
|
|
30
|
+
}
|
|
31
|
+
/** What {@link FareOptions} shares with its cards. */
|
|
32
|
+
interface Context {
|
|
33
|
+
name: string;
|
|
34
|
+
statusLabels: StatusLabels;
|
|
35
|
+
}
|
|
36
|
+
/** Every native `<fieldset>` attribute, plus the group's legend, name and status words. */
|
|
37
|
+
interface Props extends TagProps<"fieldset"> {
|
|
38
|
+
/** What the choice is, such as "Choose your fare"; it names the group. */
|
|
39
|
+
legend: RemixNode;
|
|
40
|
+
/** Hides the legend visually while it still names the group. */
|
|
41
|
+
hideLegend?: boolean;
|
|
42
|
+
/** The radio name every card shares; the chosen card's `value` posts under it. */
|
|
43
|
+
name: string;
|
|
44
|
+
statusLabels: StatusLabels;
|
|
45
|
+
/** The {@link FareOptions.Option} cards. */
|
|
46
|
+
children: RemixNode;
|
|
47
|
+
}
|
|
48
|
+
/** Every native `<label>` attribute, plus the fare's value, title, price and features. */
|
|
49
|
+
interface OptionProps extends Omit<TagProps<"label">, "children" | "title"> {
|
|
50
|
+
/** What the form posts when this fare is chosen, such as "standard". */
|
|
51
|
+
value: string;
|
|
52
|
+
/** The fare's name, such as "Standard"; it names the radio. */
|
|
53
|
+
title: RemixNode;
|
|
54
|
+
/** The fare's price, formatted by the caller, such as "$468". */
|
|
55
|
+
price: RemixNode;
|
|
56
|
+
/** What the price covers, or the difference from the cheapest fare, such as "+$56". */
|
|
57
|
+
priceDetail?: RemixNode;
|
|
58
|
+
features?: Feature[];
|
|
59
|
+
/** A ribbon over the card, such as "Recommended". */
|
|
60
|
+
ribbon?: RemixNode;
|
|
61
|
+
/** Starts chosen. */
|
|
62
|
+
checked?: boolean;
|
|
63
|
+
disabled?: boolean;
|
|
64
|
+
/** Makes a choice required before the form submits; set it on one card of the group. */
|
|
65
|
+
required?: boolean;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Renders the group: a `<fieldset>` named by its `<legend>`, with its cards stacked under 36rem
|
|
70
|
+
* and side by side, equal width, from there. Arrow keys move between the cards and the chosen
|
|
71
|
+
* one posts its `value` under `name`, both native radio behaviour.
|
|
72
|
+
*
|
|
73
|
+
* @param handle Runtime handle carrying the fieldset's props and providing name and words to the cards.
|
|
74
|
+
* @returns The render function producing the group's markup.
|
|
75
|
+
* @example
|
|
76
|
+
* <FareOptions legend="Choose your fare" name="fare" statusLabels={{ yes: "Included", no: "Not included", fee: "For a fee" }}>
|
|
77
|
+
* <FareOptions.Option value="basic" title="Basic" price="$412" features={[{ label: "Carry-on bag", included: "fee" }]} />
|
|
78
|
+
* <FareOptions.Option value="standard" title="Standard" price="$468" ribbon="Recommended" checked />
|
|
79
|
+
* </FareOptions>
|
|
80
|
+
*/
|
|
81
|
+
export declare function FareOptions(handle: Handle<FareOptions.Props, FareOptions.Context>): () => import("remix/component").RemixElement;
|
|
82
|
+
export declare namespace FareOptions {
|
|
83
|
+
var Option: (handle: Handle<FareOptions.OptionProps>) => () => import("remix/component").RemixElement;
|
|
84
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
|
|
2
|
+
import { CheckIcon, CoinsIcon, XIcon } from "@sdxc/icons";
|
|
3
|
+
import { visuallyHidden } from "@sdxc/u/a11y";
|
|
4
|
+
import { bg, border, fg, outline } from "@sdxc/u/color";
|
|
5
|
+
import { rounded } from "@sdxc/u/effects";
|
|
6
|
+
import { cursor, listStyle, raw, mergeMix } from "@sdxc/u/general";
|
|
7
|
+
import { container, flex, gap, grid, inlineFlex, items, relative, vstack } from "@sdxc/u/layout";
|
|
8
|
+
import { at } from "@sdxc/u/responsive";
|
|
9
|
+
import { m, minIs, p } from "@sdxc/u/size";
|
|
10
|
+
import { when } from "@sdxc/u/state";
|
|
11
|
+
import { leading, tabularNums, text, weight } from "@sdxc/u/typography";
|
|
12
|
+
/** Container the fieldset names, so the cards follow the width they are given. */
|
|
13
|
+
const CONTAINER_NAME = "ui-fare-options";
|
|
14
|
+
/** Fieldset width from which the cards sit side by side. */
|
|
15
|
+
const ROW_WIDTH = "36rem";
|
|
16
|
+
/**
|
|
17
|
+
* Renders the group: a `<fieldset>` named by its `<legend>`, with its cards stacked under 36rem
|
|
18
|
+
* and side by side, equal width, from there. Arrow keys move between the cards and the chosen
|
|
19
|
+
* one posts its `value` under `name`, both native radio behaviour.
|
|
20
|
+
*
|
|
21
|
+
* @param handle Runtime handle carrying the fieldset's props and providing name and words to the cards.
|
|
22
|
+
* @returns The render function producing the group's markup.
|
|
23
|
+
* @example
|
|
24
|
+
* <FareOptions legend="Choose your fare" name="fare" statusLabels={{ yes: "Included", no: "Not included", fee: "For a fee" }}>
|
|
25
|
+
* <FareOptions.Option value="basic" title="Basic" price="$412" features={[{ label: "Carry-on bag", included: "fee" }]} />
|
|
26
|
+
* <FareOptions.Option value="standard" title="Standard" price="$468" ribbon="Recommended" checked />
|
|
27
|
+
* </FareOptions>
|
|
28
|
+
*/
|
|
29
|
+
export function FareOptions(handle) {
|
|
30
|
+
return () => {
|
|
31
|
+
let { legend, hideLegend, name, statusLabels, children, mix, ...rest } = handle.props;
|
|
32
|
+
handle.context.set({ name, statusLabels });
|
|
33
|
+
return (_jsxs("fieldset", { "data-slot": "fare-options", ...rest, mix: mergeMix([
|
|
34
|
+
container(CONTAINER_NAME, "inline-size"),
|
|
35
|
+
m(0),
|
|
36
|
+
p(0),
|
|
37
|
+
raw({ border: 0, minInlineSize: 0 }),
|
|
38
|
+
text("sm"),
|
|
39
|
+
], mix), children: [_jsx("legend", { "data-slot": "fare-options-legend", mix: [
|
|
40
|
+
p(0),
|
|
41
|
+
hideLegend
|
|
42
|
+
? visuallyHidden()
|
|
43
|
+
: [weight("semibold"), fg("neutral.emphasis"), raw({ marginBlockEnd: "0.75rem" })],
|
|
44
|
+
], children: legend }), _jsx("div", { "data-slot": "fare-options-list", mix: [
|
|
45
|
+
grid(),
|
|
46
|
+
gap(3),
|
|
47
|
+
raw({ paddingBlockStart: "0.75rem" }),
|
|
48
|
+
at(ROW_WIDTH, CONTAINER_NAME, raw({ gridAutoFlow: "column", gridAutoColumns: "minmax(0, 1fr)" })),
|
|
49
|
+
], children: children })] }));
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Renders one fare as a `<label>` card around its radio: the title and the radio, the price,
|
|
54
|
+
* then the feature list. A chosen card gains a brand border twice as thick, and a ribbon sits
|
|
55
|
+
* across its top edge; the radio is named by the title and described by price and features.
|
|
56
|
+
*
|
|
57
|
+
* @param handle Runtime handle carrying the card's props.
|
|
58
|
+
* @returns The render function producing the card's markup.
|
|
59
|
+
* @example
|
|
60
|
+
* <FareOptions.Option value="flex" title="Flex" price="$544" priceDetail="+$132" features={[
|
|
61
|
+
* { label: "Free changes", included: "yes" },
|
|
62
|
+
* { label: "Refund", included: "fee" },
|
|
63
|
+
* ]} />
|
|
64
|
+
*/
|
|
65
|
+
FareOptions.Option = function FareOptionsOption(handle) {
|
|
66
|
+
return () => {
|
|
67
|
+
let { value, title, price, priceDetail, features, ribbon, checked, disabled, required, mix, ...rest } = handle.props;
|
|
68
|
+
let { name, statusLabels } = handle.context.get(FareOptions);
|
|
69
|
+
let titleId = `${handle.id}-title`;
|
|
70
|
+
let detailId = `${handle.id}-detail`;
|
|
71
|
+
return (_jsxs("label", { "data-slot": "fare-option", "data-ribbon": ribbon === undefined ? undefined : "", ...rest, mix: mergeMix([
|
|
72
|
+
relative(),
|
|
73
|
+
vstack({ gap: 3 }),
|
|
74
|
+
minIs(0),
|
|
75
|
+
p(4),
|
|
76
|
+
rounded("lg"),
|
|
77
|
+
bg("var(--ui-surface-raised, var(--ui-bg, Canvas))"),
|
|
78
|
+
border({ color: "neutral.border", width: 1 }),
|
|
79
|
+
raw({ boxShadow: "inset 0 0 0 1px transparent" }),
|
|
80
|
+
cursor("pointer"),
|
|
81
|
+
when("&:has(input:checked)", [
|
|
82
|
+
border({ color: "brand.strong", width: 1 }),
|
|
83
|
+
raw({ boxShadow: "inset 0 0 0 1px var(--ui-brand-border-strong)" }),
|
|
84
|
+
bg("brand.tint"),
|
|
85
|
+
]),
|
|
86
|
+
when("&:has(input:focus-visible)", outline({ color: "brand.ring", width: 2, offset: 2 })),
|
|
87
|
+
when("&:has(input:disabled)", raw({ cursor: "not-allowed", opacity: 0.55 })),
|
|
88
|
+
when("&:hover:not(:has(input:disabled, input:checked))", border({ color: "neutral.strong", width: 1 })),
|
|
89
|
+
], mix), children: [ribbon === undefined ? null : (_jsx("span", { "data-slot": "fare-option-ribbon", mix: [
|
|
90
|
+
raw({
|
|
91
|
+
position: "absolute",
|
|
92
|
+
insetBlockStart: 0,
|
|
93
|
+
insetInlineStart: "1rem",
|
|
94
|
+
translate: "0 -50%",
|
|
95
|
+
paddingInline: "0.5rem",
|
|
96
|
+
paddingBlock: "0.125rem",
|
|
97
|
+
}),
|
|
98
|
+
rounded("full"),
|
|
99
|
+
bg("brand.solid"),
|
|
100
|
+
fg("brand.onSolid"),
|
|
101
|
+
text("xs"),
|
|
102
|
+
weight("semibold"),
|
|
103
|
+
leading(1.4),
|
|
104
|
+
], children: ribbon })), _jsxs("span", { mix: [flex(), items("start"), raw({ justifyContent: "space-between" }), gap(3)], children: [_jsx("span", { id: titleId, "data-slot": "fare-option-title", mix: [text("base"), weight("semibold"), fg("neutral.emphasis"), minIs(0)], children: title }), _jsx("input", { type: "radio", name: name, value: value, checked: checked, disabled: disabled, required: required, "aria-labelledby": titleId, "aria-describedby": detailId, mix: [
|
|
105
|
+
m(0),
|
|
106
|
+
raw({ inlineSize: "1.125rem", blockSize: "1.125rem", flexShrink: 0 }),
|
|
107
|
+
raw({ accentColor: "var(--ui-brand-bg-solid)", outline: "none" }),
|
|
108
|
+
] })] }), _jsxs("span", { id: detailId, mix: [vstack({ gap: 3 })], children: [_jsxs("span", { mix: [vstack({ gap: 0.5 })], children: [_jsx("span", { "data-slot": "fare-option-price", mix: [
|
|
109
|
+
text("2xl"),
|
|
110
|
+
weight("semibold"),
|
|
111
|
+
leading(1.1),
|
|
112
|
+
tabularNums(),
|
|
113
|
+
fg("neutral.emphasis"),
|
|
114
|
+
], children: price }), priceDetail === undefined ? null : (_jsx("span", { "data-slot": "fare-option-price-detail", mix: [text("xs"), fg("neutral.muted")], children: priceDetail }))] }), features === undefined || features.length === 0 ? null : (_jsx("ul", { "data-slot": "fare-option-features", mix: [m(0), p(0), listStyle("none"), vstack({ gap: 2 })], children: features.map((feature) => (_jsx(FeatureLine, { feature: feature, statusLabels: statusLabels }))) }))] })] }));
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* One feature: a check, cross or coin in its tone, the status words for a screen reader, and
|
|
119
|
+
* the label. A left-out feature is muted and struck through, so its status reads by shape too.
|
|
120
|
+
*
|
|
121
|
+
* @param handle Runtime handle carrying the feature and the status words.
|
|
122
|
+
* @returns The render function producing the feature's list item.
|
|
123
|
+
*/
|
|
124
|
+
function FeatureLine(handle) {
|
|
125
|
+
return () => {
|
|
126
|
+
let { feature, statusLabels } = handle.props;
|
|
127
|
+
let status = feature.included;
|
|
128
|
+
return (_jsxs("li", { "data-slot": "fare-option-feature", "data-included": status, mix: [
|
|
129
|
+
flex(),
|
|
130
|
+
items("start"),
|
|
131
|
+
gap(2),
|
|
132
|
+
leading(1.35),
|
|
133
|
+
status === "no" ? fg("neutral.muted") : fg("neutral.emphasis"),
|
|
134
|
+
], children: [_jsxs("span", { "aria-hidden": "true", mix: [
|
|
135
|
+
inlineFlex(),
|
|
136
|
+
raw({ flexShrink: 0, marginBlockStart: "0.0625rem" }),
|
|
137
|
+
status === "yes" ? fg("success") : null,
|
|
138
|
+
status === "fee" ? fg("warning.emphasis") : null,
|
|
139
|
+
when("& > svg", raw({ inlineSize: "1rem", blockSize: "1rem" })),
|
|
140
|
+
], children: [status === "yes" ? _jsx(CheckIcon, { size: 16 }) : null, status === "no" ? _jsx(XIcon, { size: 16 }) : null, status === "fee" ? _jsx(CoinsIcon, { size: 16 }) : null] }), _jsxs("span", { mix: [minIs(0), status === "no" ? raw({ textDecorationLine: "line-through" }) : null], children: [_jsx("span", { mix: [visuallyHidden()], children: `${statusLabels[status]}: ` }), feature.label] })] }));
|
|
141
|
+
};
|
|
142
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A journey of one or more legs: the title, stop count and total duration over the whole trip
|
|
3
|
+
* on one line, then a native `<details>` whose toggle lists every leg with the layovers
|
|
4
|
+
* between them. It opens and closes with no script.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
import type { Handle, Props as TagProps, RemixNode } from "remix/component";
|
|
10
|
+
import { FlightRoute, FlightSegment } from "./flight-segment.js";
|
|
11
|
+
/**
|
|
12
|
+
* Prop types for {@link FlightItinerary} and its compound parts.
|
|
13
|
+
*/
|
|
14
|
+
export declare namespace FlightItinerary {
|
|
15
|
+
/** `"warning"` flags a connection worth a second look: a short one, an overnight one. */
|
|
16
|
+
type LayoverTone = "default" | "warning";
|
|
17
|
+
/** Every native `<section>` attribute, plus the journey's summary and its legs. */
|
|
18
|
+
interface Props extends Omit<TagProps<"section">, "title"> {
|
|
19
|
+
/** What the journey is, such as "Outbound · Fri 14 Mar", over the summary line. */
|
|
20
|
+
title?: RemixNode;
|
|
21
|
+
/** Who flies it, such as "Larkwing Air" or "Larkwing Air, Fenwick Connect". */
|
|
22
|
+
airline?: RemixNode;
|
|
23
|
+
/** Where the whole journey starts. */
|
|
24
|
+
departure: FlightRoute.Endpoint;
|
|
25
|
+
/** Where the whole journey ends. */
|
|
26
|
+
arrival: FlightRoute.Endpoint;
|
|
27
|
+
/** The whole journey's duration, layovers included, such as "9h 40m". */
|
|
28
|
+
duration: RemixNode;
|
|
29
|
+
/**
|
|
30
|
+
* How many stops the summary line draws.
|
|
31
|
+
*
|
|
32
|
+
* @default 0
|
|
33
|
+
*/
|
|
34
|
+
stops?: number;
|
|
35
|
+
/** The stop count as words, such as "Nonstop" or "1 stop". */
|
|
36
|
+
stopsLabel?: RemixNode;
|
|
37
|
+
/** The badge after the final arrival time, such as "+1". */
|
|
38
|
+
dayOffset?: string;
|
|
39
|
+
/** What the day badge means, read in its place. */
|
|
40
|
+
dayOffsetLabel?: string;
|
|
41
|
+
/** Hidden words that make the summary line a sentence; see {@link FlightRoute.Labels}. */
|
|
42
|
+
labels?: FlightRoute.Labels;
|
|
43
|
+
/** The words on the disclosure's toggle, such as "Flight details". */
|
|
44
|
+
toggleLabel: RemixNode;
|
|
45
|
+
/** Starts with every leg showing. */
|
|
46
|
+
open?: boolean;
|
|
47
|
+
/** The {@link FlightItinerary.Segment} and {@link FlightItinerary.Layover} items, in order. */
|
|
48
|
+
children: RemixNode;
|
|
49
|
+
}
|
|
50
|
+
/** Every {@link FlightSegment} prop, for one leg of the journey. */
|
|
51
|
+
interface SegmentProps extends FlightSegment.Props {
|
|
52
|
+
}
|
|
53
|
+
/** Every native `<li>` attribute, plus what the connection is. */
|
|
54
|
+
interface LayoverProps extends Omit<TagProps<"li">, "children"> {
|
|
55
|
+
/** The connection in words, such as "1h 35m layover in VLS Vellis". */
|
|
56
|
+
children: RemixNode;
|
|
57
|
+
/** A second line, such as "Overnight · change terminals". */
|
|
58
|
+
note?: RemixNode;
|
|
59
|
+
/** @default "default" */
|
|
60
|
+
tone?: LayoverTone;
|
|
61
|
+
/** A glyph before the words; a clock, or an alert for a warning, when left out. */
|
|
62
|
+
icon?: RemixNode;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Renders the journey: a `<section>` with the title, stop count and total duration over the trip
|
|
67
|
+
* on one {@link FlightRoute} line, then a `<details>` whose `<summary>` is the toggle and whose
|
|
68
|
+
* body is an ordered list of legs and layovers, so the legs open and close with no script.
|
|
69
|
+
*
|
|
70
|
+
* @param handle Runtime handle carrying the journey's props.
|
|
71
|
+
* @returns The render function producing the journey's markup.
|
|
72
|
+
* @example
|
|
73
|
+
* <FlightItinerary title="Outbound · Fri 14 Mar" airline="Larkwing Air" departure={{ time: "08:40", code: "MRW" }}
|
|
74
|
+
* arrival={{ time: "18:20", code: "OSK" }} duration="9h 40m" stops={1} stopsLabel="1 stop" toggleLabel="Flight details">
|
|
75
|
+
* <FlightItinerary.Segment airline="Larkwing Air" flightNumber="LW 214" … />
|
|
76
|
+
* <FlightItinerary.Layover>1h 35m layover in VLS Vellis</FlightItinerary.Layover>
|
|
77
|
+
* <FlightItinerary.Segment airline="Larkwing Air" flightNumber="LW 731" … />
|
|
78
|
+
* </FlightItinerary>
|
|
79
|
+
*/
|
|
80
|
+
export declare function FlightItinerary(handle: Handle<FlightItinerary.Props>): () => import("remix/component").RemixElement;
|
|
81
|
+
export declare namespace FlightItinerary {
|
|
82
|
+
var Segment: (handle: Handle<FlightItinerary.SegmentProps>) => () => import("remix/component").RemixElement;
|
|
83
|
+
var Layover: (handle: Handle<FlightItinerary.LayoverProps>) => () => import("remix/component").RemixElement;
|
|
84
|
+
}
|