@sdxc/ui 2026.11.18 → 2026.11.22
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/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,112 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
|
|
2
|
+
import { ChevronDownIcon, ClockIcon, CircleAlertIcon } from "@sdxc/icons";
|
|
3
|
+
import { bg, border, fg, outline } from "@sdxc/u/color";
|
|
4
|
+
import { rounded } from "@sdxc/u/effects";
|
|
5
|
+
import { cursor, listStyle, raw, mergeMix } from "@sdxc/u/general";
|
|
6
|
+
import { container, flex, gap, inlineFlex, items, vstack } from "@sdxc/u/layout";
|
|
7
|
+
import { motionSafe } from "@sdxc/u/responsive";
|
|
8
|
+
import { m, minIs, p, pi } from "@sdxc/u/size";
|
|
9
|
+
import { focusVisible, hover, when } from "@sdxc/u/state";
|
|
10
|
+
import { leading, tabularNums, text, truncate, weight } from "@sdxc/u/typography";
|
|
11
|
+
import { FlightRoute, FlightSegment } from "./flight-segment.js";
|
|
12
|
+
/** Container the journey names, so its legs measure the journey rather than the page. */
|
|
13
|
+
const CONTAINER_NAME = "ui-flight-itinerary";
|
|
14
|
+
/** Tone a layover takes when `tone` is left out. */
|
|
15
|
+
const DEFAULT_LAYOVER_TONE = "default";
|
|
16
|
+
/**
|
|
17
|
+
* Renders the journey: a `<section>` with the title, stop count and total duration over the trip
|
|
18
|
+
* on one {@link FlightRoute} line, then a `<details>` whose `<summary>` is the toggle and whose
|
|
19
|
+
* body is an ordered list of legs and layovers, so the legs open and close with no script.
|
|
20
|
+
*
|
|
21
|
+
* @param handle Runtime handle carrying the journey's props.
|
|
22
|
+
* @returns The render function producing the journey's markup.
|
|
23
|
+
* @example
|
|
24
|
+
* <FlightItinerary title="Outbound · Fri 14 Mar" airline="Larkwing Air" departure={{ time: "08:40", code: "MRW" }}
|
|
25
|
+
* arrival={{ time: "18:20", code: "OSK" }} duration="9h 40m" stops={1} stopsLabel="1 stop" toggleLabel="Flight details">
|
|
26
|
+
* <FlightItinerary.Segment airline="Larkwing Air" flightNumber="LW 214" … />
|
|
27
|
+
* <FlightItinerary.Layover>1h 35m layover in VLS Vellis</FlightItinerary.Layover>
|
|
28
|
+
* <FlightItinerary.Segment airline="Larkwing Air" flightNumber="LW 731" … />
|
|
29
|
+
* </FlightItinerary>
|
|
30
|
+
*/
|
|
31
|
+
export function FlightItinerary(handle) {
|
|
32
|
+
return () => {
|
|
33
|
+
let { title, airline, departure, arrival, duration, stops, stopsLabel, dayOffset, dayOffsetLabel, labels, toggleLabel, open, children, mix, ...rest } = handle.props;
|
|
34
|
+
return (_jsxs("section", { "data-slot": "flight-itinerary", ...rest, mix: mergeMix([container(CONTAINER_NAME, "inline-size"), vstack({ gap: 3 }), minIs(0), text("sm")], mix), children: [_jsxs("div", { "data-slot": "flight-itinerary-header", mix: [
|
|
35
|
+
flex(),
|
|
36
|
+
items("baseline"),
|
|
37
|
+
raw({ flexWrap: "wrap", columnGap: "0.75rem", rowGap: "0.125rem" }),
|
|
38
|
+
], children: [title === undefined ? null : (_jsx("span", { "data-slot": "flight-itinerary-title", mix: [weight("semibold"), fg("neutral.emphasis"), raw({ flex: "1 1 auto" })], children: title })), airline === undefined ? null : (_jsx("span", { "data-slot": "flight-itinerary-airline", mix: [fg("neutral.muted"), truncate(), raw({ flex: "1 1 auto" })], children: airline })), _jsxs("span", { "data-slot": "flight-itinerary-totals", mix: [text("xs"), fg("neutral.muted"), tabularNums(), raw({ whiteSpace: "nowrap" })], children: [stopsLabel, stopsLabel === undefined ? null : " · ", duration] })] }), _jsx(FlightRoute, { departure: departure, arrival: arrival, duration: duration, stops: stops, dayOffset: dayOffset, dayOffsetLabel: dayOffsetLabel, labels: labels }), _jsxs("details", { open: open, mix: [when("&[open] [data-slot=flight-itinerary-chevron]", raw({ rotate: "180deg" }))], children: [_jsxs("summary", { "data-slot": "flight-itinerary-summary", mix: [
|
|
39
|
+
inlineFlex(),
|
|
40
|
+
items("center"),
|
|
41
|
+
gap(1),
|
|
42
|
+
listStyle("none"),
|
|
43
|
+
raw({ "&::-webkit-details-marker": { display: "none" } }),
|
|
44
|
+
cursor("pointer"),
|
|
45
|
+
rounded("sm"),
|
|
46
|
+
text("xs"),
|
|
47
|
+
weight("medium"),
|
|
48
|
+
fg("brand"),
|
|
49
|
+
hover(raw({ textDecoration: "underline" })),
|
|
50
|
+
focusVisible(outline({ color: "brand.ring", width: 2, offset: 2 })),
|
|
51
|
+
], children: [toggleLabel, _jsx("span", { "data-slot": "flight-itinerary-chevron", "aria-hidden": "true", mix: [inlineFlex(), motionSafe(raw({ transition: "rotate 150ms ease" }))], children: _jsx(ChevronDownIcon, { size: 14 }) })] }), _jsx("ol", { "data-slot": "flight-itinerary-legs", mix: [
|
|
52
|
+
m(0),
|
|
53
|
+
p(0),
|
|
54
|
+
listStyle("none"),
|
|
55
|
+
vstack({ gap: 3 }),
|
|
56
|
+
raw({ marginBlockStart: "1rem", paddingBlockStart: "1rem" }),
|
|
57
|
+
border({ color: "neutral.border", width: 0 }),
|
|
58
|
+
raw({ borderBlockStartWidth: "1px", borderBlockStartStyle: "solid" }),
|
|
59
|
+
], children: children })] })] }));
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Renders one leg of the journey as a list item holding a {@link FlightSegment}.
|
|
64
|
+
*
|
|
65
|
+
* @param handle Runtime handle carrying the leg's props.
|
|
66
|
+
* @returns The render function producing the leg's list item.
|
|
67
|
+
* @example
|
|
68
|
+
* <FlightItinerary.Segment airline="Larkwing Air" flightNumber="LW 214"
|
|
69
|
+
* departure={{ time: "08:40", code: "MRW" }} arrival={{ time: "10:55", code: "VLS" }} duration="2h 15m" />
|
|
70
|
+
*/
|
|
71
|
+
FlightItinerary.Segment = function FlightItinerarySegment(handle) {
|
|
72
|
+
return () => (_jsx("li", { "data-slot": "flight-itinerary-segment", children: _jsx(FlightSegment, { ...handle.props }) }));
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Renders the connection between two legs as a tinted row with a glyph, the caller's words
|
|
76
|
+
* and an optional note. A `"warning"` layover takes the warning tone and an alert glyph, so a
|
|
77
|
+
* tight or overnight change stands out by shape as well as colour.
|
|
78
|
+
*
|
|
79
|
+
* @param handle Runtime handle carrying the layover's props.
|
|
80
|
+
* @returns The render function producing the layover's list item.
|
|
81
|
+
* @example
|
|
82
|
+
* <FlightItinerary.Layover tone="warning" note="Overnight · change terminals">10h 05m layover in VLS Vellis</FlightItinerary.Layover>
|
|
83
|
+
*/
|
|
84
|
+
FlightItinerary.Layover = function FlightItineraryLayover(handle) {
|
|
85
|
+
return () => {
|
|
86
|
+
let { children, note, tone, icon, mix, ...rest } = handle.props;
|
|
87
|
+
let resolved = tone ?? DEFAULT_LAYOVER_TONE;
|
|
88
|
+
let warning = resolved === "warning";
|
|
89
|
+
let glyph = icon ?? (warning ? _jsx(CircleAlertIcon, { size: 16 }) : _jsx(ClockIcon, { size: 16 }));
|
|
90
|
+
return (_jsxs("li", { "data-slot": "flight-itinerary-layover", "data-tone": resolved, ...rest, mix: mergeMix([
|
|
91
|
+
flex(),
|
|
92
|
+
items("start"),
|
|
93
|
+
gap(2),
|
|
94
|
+
pi(3),
|
|
95
|
+
raw({ paddingBlock: "0.5rem" }),
|
|
96
|
+
rounded("md"),
|
|
97
|
+
text("xs"),
|
|
98
|
+
leading(1.4),
|
|
99
|
+
warning
|
|
100
|
+
? [
|
|
101
|
+
bg("warning.tint"),
|
|
102
|
+
fg("warning.emphasis"),
|
|
103
|
+
border({ color: "warning.border", width: 1 }),
|
|
104
|
+
]
|
|
105
|
+
: [
|
|
106
|
+
bg("neutral.tint"),
|
|
107
|
+
fg("neutral.muted"),
|
|
108
|
+
border({ color: "transparent", width: 1 }),
|
|
109
|
+
],
|
|
110
|
+
], mix), children: [_jsx("span", { "aria-hidden": "true", mix: [inlineFlex(), raw({ flexShrink: 0, marginBlockStart: "0.0625rem" })], children: glyph }), _jsxs("span", { mix: [vstack({ gap: 0.5 }), minIs(0)], children: [_jsx("span", { "data-slot": "flight-itinerary-layover-text", mix: [weight("medium")], children: children }), note === undefined ? null : (_jsx("span", { "data-slot": "flight-itinerary-layover-note", children: note }))] })] }));
|
|
111
|
+
};
|
|
112
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One row of flight search results: badges such as "Cheapest", a line per journey with its
|
|
3
|
+
* airline and route, and the price with a select action. Under 36rem the price sits under the
|
|
4
|
+
* journeys; wider, it takes a column of its own beside them.
|
|
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 } from "./flight-segment.js";
|
|
11
|
+
/**
|
|
12
|
+
* Prop types for {@link FlightOption} and its compound parts.
|
|
13
|
+
*/
|
|
14
|
+
export declare namespace FlightOption {
|
|
15
|
+
/** Every native `<article>` attribute, plus the price, its action and the journeys. */
|
|
16
|
+
interface Props extends TagProps<"article"> {
|
|
17
|
+
/** The fare, formatted by the caller, such as "$412". */
|
|
18
|
+
price: RemixNode;
|
|
19
|
+
/** What the fare covers, such as "Round trip per person", under the price. */
|
|
20
|
+
priceDetail?: RemixNode;
|
|
21
|
+
/** Labels over the journeys, such as `<Badge>` elements reading "Cheapest" or "Fastest". */
|
|
22
|
+
badges?: RemixNode;
|
|
23
|
+
/** The select link or submit button, at the price's end. */
|
|
24
|
+
action?: RemixNode;
|
|
25
|
+
/** Rings the row in the brand colour, for the option a page recommends. */
|
|
26
|
+
featured?: boolean;
|
|
27
|
+
/** Full detail under the row, such as a `FlightItinerary` per journey. */
|
|
28
|
+
details?: RemixNode;
|
|
29
|
+
/** The {@link FlightOption.Journey} lines, one per direction. */
|
|
30
|
+
children: RemixNode;
|
|
31
|
+
}
|
|
32
|
+
/** The route's ends and what lies between them; see {@link FlightRoute}. */
|
|
33
|
+
type RouteProps = Pick<FlightRoute.Props, "departure" | "arrival" | "duration" | "stops" | "stopsLabel" | "dayOffset" | "dayOffsetLabel" | "labels">;
|
|
34
|
+
/** Every native `<li>` attribute and every route prop, plus who flies the journey. */
|
|
35
|
+
interface JourneyProps extends Omit<TagProps<"li">, "children">, RouteProps {
|
|
36
|
+
/** The airline or airlines, such as "Larkwing Air". */
|
|
37
|
+
airline: RemixNode;
|
|
38
|
+
/** The airline's mark, drawn in a 1.75rem square before the route. */
|
|
39
|
+
mark?: RemixNode;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Renders the row as an `<article>`: badges, then each {@link FlightOption.Journey}, then the
|
|
44
|
+
* price, its detail and the action. A list of these, each in an `<li>`, makes a results page;
|
|
45
|
+
* name each one with `aria-label` (such as "Larkwing Air, $412") so a list reads at a glance.
|
|
46
|
+
*
|
|
47
|
+
* @param handle Runtime handle carrying the row's props.
|
|
48
|
+
* @returns The render function producing the row's markup.
|
|
49
|
+
* @example
|
|
50
|
+
* <FlightOption price="$412" priceDetail="Round trip" badges={<Badge>Cheapest</Badge>} action={<Button>Select</Button>}>
|
|
51
|
+
* <FlightOption.Journey airline="Larkwing Air" departure={{ time: "08:40", code: "MRW" }}
|
|
52
|
+
* arrival={{ time: "10:55", code: "VLS" }} duration="2h 15m" stopsLabel="Nonstop" />
|
|
53
|
+
* </FlightOption>
|
|
54
|
+
*/
|
|
55
|
+
export declare function FlightOption(handle: Handle<FlightOption.Props>): () => import("remix/component").RemixElement;
|
|
56
|
+
export declare namespace FlightOption {
|
|
57
|
+
var Journey: (handle: Handle<FlightOption.JourneyProps>) => () => import("remix/component").RemixElement;
|
|
58
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
|
|
2
|
+
import { bg, border, fg } from "@sdxc/u/color";
|
|
3
|
+
import { rounded, shadow } from "@sdxc/u/effects";
|
|
4
|
+
import { listStyle, raw, mergeMix } from "@sdxc/u/general";
|
|
5
|
+
import { container, flex, gap, grid, inlineFlex, items, justify, vstack } from "@sdxc/u/layout";
|
|
6
|
+
import { at } from "@sdxc/u/responsive";
|
|
7
|
+
import { bs, is, m, minIs, p } from "@sdxc/u/size";
|
|
8
|
+
import { when } from "@sdxc/u/state";
|
|
9
|
+
import { leading, tabularNums, text, truncate, weight } from "@sdxc/u/typography";
|
|
10
|
+
import { FlightRoute } from "./flight-segment.js";
|
|
11
|
+
/** Container the row names, so it lays out by the width of the results column. */
|
|
12
|
+
const CONTAINER_NAME = "ui-flight-option";
|
|
13
|
+
/** Row width from which the price moves into a column beside the journeys. */
|
|
14
|
+
const PRICE_COLUMN_WIDTH = "36rem";
|
|
15
|
+
/**
|
|
16
|
+
* Renders the row as an `<article>`: badges, then each {@link FlightOption.Journey}, then the
|
|
17
|
+
* price, its detail and the action. A list of these, each in an `<li>`, makes a results page;
|
|
18
|
+
* name each one with `aria-label` (such as "Larkwing Air, $412") so a list reads at a glance.
|
|
19
|
+
*
|
|
20
|
+
* @param handle Runtime handle carrying the row's props.
|
|
21
|
+
* @returns The render function producing the row's markup.
|
|
22
|
+
* @example
|
|
23
|
+
* <FlightOption price="$412" priceDetail="Round trip" badges={<Badge>Cheapest</Badge>} action={<Button>Select</Button>}>
|
|
24
|
+
* <FlightOption.Journey airline="Larkwing Air" departure={{ time: "08:40", code: "MRW" }}
|
|
25
|
+
* arrival={{ time: "10:55", code: "VLS" }} duration="2h 15m" stopsLabel="Nonstop" />
|
|
26
|
+
* </FlightOption>
|
|
27
|
+
*/
|
|
28
|
+
export function FlightOption(handle) {
|
|
29
|
+
return () => {
|
|
30
|
+
let { price, priceDetail, badges, action, featured, details, children, mix, ...rest } = handle.props;
|
|
31
|
+
return (_jsxs("article", { "data-slot": "flight-option", "data-featured": featured ? "" : undefined, ...rest, mix: mergeMix([
|
|
32
|
+
container(CONTAINER_NAME, "inline-size"),
|
|
33
|
+
minIs(0),
|
|
34
|
+
rounded("lg"),
|
|
35
|
+
bg("var(--ui-surface-raised, var(--ui-bg, Canvas))"),
|
|
36
|
+
border({ color: "neutral.border", width: 1 }),
|
|
37
|
+
shadow("xs"),
|
|
38
|
+
text("sm"),
|
|
39
|
+
when("&[data-featured]", [
|
|
40
|
+
border({ color: "brand.strong", width: 1 }),
|
|
41
|
+
raw({ boxShadow: "0 0 0 1px var(--ui-brand-border-strong)" }),
|
|
42
|
+
]),
|
|
43
|
+
], mix), children: [_jsxs("div", { "data-slot": "flight-option-body", mix: [
|
|
44
|
+
grid(),
|
|
45
|
+
raw({ gridTemplateAreas: '"badges" "journeys" "price"' }),
|
|
46
|
+
at(PRICE_COLUMN_WIDTH, CONTAINER_NAME, raw({
|
|
47
|
+
gridTemplateColumns: "minmax(0, 1fr) minmax(9rem, auto)",
|
|
48
|
+
gridTemplateAreas: '"badges price" "journeys price"',
|
|
49
|
+
})),
|
|
50
|
+
], children: [badges === undefined ? null : (_jsx("div", { "data-slot": "flight-option-badges", mix: [
|
|
51
|
+
flex(),
|
|
52
|
+
raw({ flexWrap: "wrap", gridArea: "badges" }),
|
|
53
|
+
gap(1.5),
|
|
54
|
+
raw({ paddingInline: "1rem", paddingBlockStart: "1rem" }),
|
|
55
|
+
], children: badges })), _jsx("ul", { "data-slot": "flight-option-journeys", mix: [m(0), p(4), listStyle("none"), vstack({ gap: 4 }), raw({ gridArea: "journeys" })], children: children }), _jsxs("div", { "data-slot": "flight-option-price", mix: [
|
|
56
|
+
raw({ gridArea: "price" }),
|
|
57
|
+
flex(),
|
|
58
|
+
items("center"),
|
|
59
|
+
justify("between"),
|
|
60
|
+
gap(3),
|
|
61
|
+
p(4),
|
|
62
|
+
raw({ flexWrap: "wrap" }),
|
|
63
|
+
border({ color: "neutral.border", width: 0 }),
|
|
64
|
+
raw({ borderBlockStartWidth: "1px", borderBlockStartStyle: "solid" }),
|
|
65
|
+
at(PRICE_COLUMN_WIDTH, CONTAINER_NAME, raw({
|
|
66
|
+
flexDirection: "column",
|
|
67
|
+
alignItems: "stretch",
|
|
68
|
+
justifyContent: "center",
|
|
69
|
+
textAlign: "end",
|
|
70
|
+
borderBlockStartWidth: "0",
|
|
71
|
+
borderInlineStartWidth: "1px",
|
|
72
|
+
borderInlineStartStyle: "solid",
|
|
73
|
+
})),
|
|
74
|
+
], children: [_jsxs("p", { mix: [m(0), vstack({ gap: 0.5 })], children: [_jsx("span", { "data-slot": "flight-option-amount", mix: [
|
|
75
|
+
text("xl"),
|
|
76
|
+
weight("semibold"),
|
|
77
|
+
leading(1.1),
|
|
78
|
+
tabularNums(),
|
|
79
|
+
fg("neutral.emphasis"),
|
|
80
|
+
], children: price }), priceDetail === undefined ? null : (_jsx("span", { "data-slot": "flight-option-price-detail", mix: [text("xs"), fg("neutral.muted")], children: priceDetail }))] }), action === undefined ? null : (_jsx("div", { "data-slot": "flight-option-action", mix: [flex(), raw({ justifyContent: "end" })], children: action }))] })] }), details === undefined ? null : (_jsx("div", { "data-slot": "flight-option-details", mix: [
|
|
81
|
+
p(4),
|
|
82
|
+
vstack({ gap: 4 }),
|
|
83
|
+
border({ color: "neutral.border", width: 0 }),
|
|
84
|
+
raw({ borderBlockStartWidth: "1px", borderBlockStartStyle: "solid" }),
|
|
85
|
+
], children: details }))] }));
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Renders one direction of the trip as a list item: the airline's mark and name over the
|
|
90
|
+
* {@link FlightRoute}, so outbound and return lines stack with their routes aligned.
|
|
91
|
+
*
|
|
92
|
+
* @param handle Runtime handle carrying the journey's props.
|
|
93
|
+
* @returns The render function producing the journey's list item.
|
|
94
|
+
* @example
|
|
95
|
+
* <FlightOption.Journey airline="Larkwing Air" mark={<LarkwingMark />}
|
|
96
|
+
* departure={{ time: "22:40", code: "MRW" }} arrival={{ time: "06:05", code: "OSK" }}
|
|
97
|
+
* duration="7h 25m" stops={1} stopsLabel="1 stop · VLS" dayOffset="+1" dayOffsetLabel="next day" />
|
|
98
|
+
*/
|
|
99
|
+
FlightOption.Journey = function FlightOptionJourney(handle) {
|
|
100
|
+
return () => {
|
|
101
|
+
let { airline, mark, departure, arrival, duration, stops, stopsLabel, dayOffset, dayOffsetLabel, labels, mix, ...rest } = handle.props;
|
|
102
|
+
return (_jsxs("li", { "data-slot": "flight-option-journey", ...rest, mix: mergeMix([vstack({ gap: 2 }), minIs(0)], mix), children: [_jsxs("span", { mix: [flex(), items("center"), gap(2), minIs(0), text("xs"), fg("neutral.muted")], children: [mark === undefined ? null : (_jsx("span", { "data-slot": "flight-option-mark", "aria-hidden": "true", mix: [
|
|
103
|
+
inlineFlex(),
|
|
104
|
+
is("1.75rem"),
|
|
105
|
+
bs("1.75rem"),
|
|
106
|
+
rounded("md"),
|
|
107
|
+
raw({ flexShrink: 0, overflow: "hidden" }),
|
|
108
|
+
when("& > :is(svg, img)", raw({ inlineSize: "100%", blockSize: "100%" })),
|
|
109
|
+
], children: mark })), _jsx("span", { "data-slot": "flight-option-airline", mix: [truncate()], children: airline })] }), _jsx(FlightRoute, { departure: departure, arrival: arrival, duration: duration, stops: stops, stopsLabel: stopsLabel, dayOffset: dayOffset, dayOffsetLabel: dayOffsetLabel, labels: labels })] }));
|
|
110
|
+
};
|
|
111
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One flight leg: the airline's mark, name and flight number, then departure and arrival
|
|
3
|
+
* either side of a track that carries the duration, a dot per stop and a plane glyph. Times
|
|
4
|
+
* arrive formatted, and the leg sets its airline beside the route once its 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 FlightRoute} and {@link FlightSegment}.
|
|
12
|
+
*/
|
|
13
|
+
export declare namespace FlightRoute {
|
|
14
|
+
/** One end of a flight: when it leaves or lands, and where. */
|
|
15
|
+
interface Endpoint {
|
|
16
|
+
/** The local time, formatted by the caller, such as "08:40". */
|
|
17
|
+
time: RemixNode;
|
|
18
|
+
/** A machine-readable moment for the `<time>` the time sits in, such as "2026-03-14T08:40". */
|
|
19
|
+
dateTime?: string;
|
|
20
|
+
/** The airport code, such as "MRW", set large in tabular figures. */
|
|
21
|
+
code: string;
|
|
22
|
+
/** The city or airport name under the code, such as "Merrow". */
|
|
23
|
+
city?: RemixNode;
|
|
24
|
+
}
|
|
25
|
+
/** Visually hidden words that turn the route into a sentence for a screen reader. */
|
|
26
|
+
interface Labels {
|
|
27
|
+
/** Read before the departure, such as "Departs". */
|
|
28
|
+
departs?: string;
|
|
29
|
+
/** Read before the arrival, such as "Arrives". */
|
|
30
|
+
arrives?: string;
|
|
31
|
+
/** Read before the duration, such as "Flight time". */
|
|
32
|
+
duration?: string;
|
|
33
|
+
}
|
|
34
|
+
/** Every native `<div>` attribute, plus the two ends and what lies between them. */
|
|
35
|
+
interface Props extends Omit<TagProps<"div">, "children"> {
|
|
36
|
+
departure: Endpoint;
|
|
37
|
+
arrival: Endpoint;
|
|
38
|
+
/** The time in the air or the whole journey, formatted, such as "2h 15m". */
|
|
39
|
+
duration: RemixNode;
|
|
40
|
+
/**
|
|
41
|
+
* How many stops the track draws as dots; zero draws a clear line.
|
|
42
|
+
*
|
|
43
|
+
* @default 0
|
|
44
|
+
*/
|
|
45
|
+
stops?: number;
|
|
46
|
+
/** What the stops amount to, under the track, such as "Nonstop" or "1 stop · VLS". */
|
|
47
|
+
stopsLabel?: RemixNode;
|
|
48
|
+
/** The badge after the arrival time when it lands on a later day, such as "+1". */
|
|
49
|
+
dayOffset?: string;
|
|
50
|
+
/** What the day badge means, read in its place, such as "arrives the next day". */
|
|
51
|
+
dayOffsetLabel?: string;
|
|
52
|
+
labels?: Labels;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Prop types for {@link FlightSegment}.
|
|
57
|
+
*/
|
|
58
|
+
export declare namespace FlightSegment {
|
|
59
|
+
/** Every route prop, plus who flies the leg and on what. */
|
|
60
|
+
interface Props extends FlightRoute.Props {
|
|
61
|
+
/** The operating airline's name, such as "Larkwing Air". */
|
|
62
|
+
airline: RemixNode;
|
|
63
|
+
/** The airline's mark, such as a small SVG or `<img>`, drawn in a 2rem square. */
|
|
64
|
+
mark?: RemixNode;
|
|
65
|
+
/** The flight number, such as "LW 214". */
|
|
66
|
+
flightNumber?: RemixNode;
|
|
67
|
+
/** The aircraft, such as "Aerion 320neo". */
|
|
68
|
+
aircraft?: RemixNode;
|
|
69
|
+
/** The cabin booked, such as "Economy". */
|
|
70
|
+
cabin?: RemixNode;
|
|
71
|
+
/** Anything else about the leg, such as "Operated by Fenwick Connect", after the cabin. */
|
|
72
|
+
extra?: RemixNode;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Renders the route on one line: departure at the start, arrival at the end, and between them
|
|
77
|
+
* the duration over a drawn track with the stops label under it. It never wraps, so it doubles
|
|
78
|
+
* as the compact summary of a whole journey in a results row.
|
|
79
|
+
*
|
|
80
|
+
* @param handle Runtime handle carrying the route's props.
|
|
81
|
+
* @returns The render function producing the route's markup.
|
|
82
|
+
* @example
|
|
83
|
+
* <FlightRoute
|
|
84
|
+
* departure={{ time: "08:40", code: "MRW", city: "Merrow" }}
|
|
85
|
+
* arrival={{ time: "06:05", code: "OSK", city: "Oskarn" }}
|
|
86
|
+
* duration="19h 25m" stops={1} stopsLabel="1 stop · VLS" dayOffset="+1" dayOffsetLabel="next day"
|
|
87
|
+
* />
|
|
88
|
+
*/
|
|
89
|
+
export declare function FlightRoute(handle: Handle<FlightRoute.Props>): () => import("remix/component").RemixElement;
|
|
90
|
+
/**
|
|
91
|
+
* Renders one leg: the airline's mark, name and flight number, the {@link FlightRoute}, then a
|
|
92
|
+
* muted line of aircraft, cabin and extras. Under 34rem the airline heads the leg; wider, it
|
|
93
|
+
* takes a column before the route so legs in a list line their routes up.
|
|
94
|
+
*
|
|
95
|
+
* @param handle Runtime handle carrying the leg's props.
|
|
96
|
+
* @returns The render function producing the leg's markup.
|
|
97
|
+
* @example
|
|
98
|
+
* <FlightSegment
|
|
99
|
+
* airline="Larkwing Air" mark={<LarkwingMark />} flightNumber="LW 214"
|
|
100
|
+
* departure={{ time: "08:40", code: "MRW", city: "Merrow" }}
|
|
101
|
+
* arrival={{ time: "10:55", code: "VLS", city: "Vellis" }}
|
|
102
|
+
* duration="2h 15m" stopsLabel="Nonstop" aircraft="Aerion 320neo" cabin="Economy"
|
|
103
|
+
* />
|
|
104
|
+
*/
|
|
105
|
+
export declare function FlightSegment(handle: Handle<FlightSegment.Props>): () => import("remix/component").RemixElement;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "remix/component/jsx-runtime";
|
|
2
|
+
import { PlaneIcon } from "@sdxc/icons";
|
|
3
|
+
import { visuallyHidden } from "@sdxc/u/a11y";
|
|
4
|
+
import { bg, border, fg } from "@sdxc/u/color";
|
|
5
|
+
import { rounded } from "@sdxc/u/effects";
|
|
6
|
+
import { raw, mergeMix } from "@sdxc/u/general";
|
|
7
|
+
import { container, flex, gap, grid, inlineFlex, items, justify, vstack } from "@sdxc/u/layout";
|
|
8
|
+
import { at } from "@sdxc/u/responsive";
|
|
9
|
+
import { bs, is, m, minIs } from "@sdxc/u/size";
|
|
10
|
+
import { when } from "@sdxc/u/state";
|
|
11
|
+
import { leading, tabularNums, text, truncate, weight } from "@sdxc/u/typography";
|
|
12
|
+
/** Container a segment names, so its layout follows the space it sits in. */
|
|
13
|
+
const CONTAINER_NAME = "ui-flight-segment";
|
|
14
|
+
/** Segment width from which the airline moves into a column before the route. */
|
|
15
|
+
const SIDE_BY_SIDE_WIDTH = "34rem";
|
|
16
|
+
/**
|
|
17
|
+
* One end of the route: the time over the airport code and city. The day badge rides the
|
|
18
|
+
* arrival time and is read as its label, so "+1" is heard as "arrives the next day".
|
|
19
|
+
*
|
|
20
|
+
* @param handle Runtime handle carrying the endpoint and which edge it hugs.
|
|
21
|
+
* @returns The render function producing the endpoint's markup.
|
|
22
|
+
*/
|
|
23
|
+
function RouteEnd(handle) {
|
|
24
|
+
return () => {
|
|
25
|
+
let { endpoint, align, label, dayOffset, dayOffsetLabel } = handle.props;
|
|
26
|
+
let time = endpoint.dateTime === undefined ? (endpoint.time) : (_jsx("time", { dateTime: endpoint.dateTime, children: endpoint.time }));
|
|
27
|
+
return (_jsxs("div", { "data-slot": align === "start" ? "flight-route-departure" : "flight-route-arrival", mix: [vstack({ gap: 0.5 }), minIs(0), raw({ textAlign: align })], children: [_jsxs("span", { "data-slot": "flight-route-time", mix: [
|
|
28
|
+
text("lg"),
|
|
29
|
+
weight("semibold"),
|
|
30
|
+
leading(1.1),
|
|
31
|
+
tabularNums(),
|
|
32
|
+
fg("neutral.emphasis"),
|
|
33
|
+
raw({ whiteSpace: "nowrap" }),
|
|
34
|
+
], children: [label === undefined ? null : _jsx("span", { mix: [visuallyHidden()], children: `${label} ` }), time, dayOffset === undefined ? null : (_jsxs(_Fragment, { children: [_jsx("sup", { "data-slot": "flight-route-day-offset", "aria-hidden": dayOffsetLabel === undefined ? undefined : "true", mix: [
|
|
35
|
+
text("xs"),
|
|
36
|
+
weight("semibold"),
|
|
37
|
+
fg("warning.emphasis"),
|
|
38
|
+
raw({ marginInlineStart: "0.125rem", verticalAlign: "super" }),
|
|
39
|
+
], children: dayOffset }), dayOffsetLabel === undefined ? null : (_jsx("span", { mix: [visuallyHidden()], children: ` ${dayOffsetLabel}` }))] }))] }), _jsxs("span", { mix: [text("sm"), fg("neutral.muted"), truncate()], children: [_jsx("abbr", { "data-slot": "flight-route-code", mix: [weight("semibold"), fg("neutral.emphasis"), raw({ textDecoration: "none" })], children: endpoint.code }), endpoint.city === undefined ? null : _jsxs(_Fragment, { children: [" ", endpoint.city] })] })] }));
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The drawn line between the two ends: an origin ring, a hairline broken by a dot per stop,
|
|
44
|
+
* and the plane at the destination edge, mirrored for right-to-left reading. It is decoration;
|
|
45
|
+
* the stops label beneath carries the words.
|
|
46
|
+
*
|
|
47
|
+
* @param handle Runtime handle carrying the stop count.
|
|
48
|
+
* @returns The render function producing the track's markup.
|
|
49
|
+
*/
|
|
50
|
+
function RouteTrack(handle) {
|
|
51
|
+
return () => {
|
|
52
|
+
let count = Math.max(0, Math.floor(handle.props.stops));
|
|
53
|
+
let pieces = [_jsx(TrackLine, {})];
|
|
54
|
+
for (let index = 0; index < count; index++) {
|
|
55
|
+
pieces.push(_jsx(TrackDot, { kind: "stop" }), _jsx(TrackLine, {}));
|
|
56
|
+
}
|
|
57
|
+
return (_jsxs("span", { "data-slot": "flight-route-track", "data-stops": count, "aria-hidden": "true", mix: [flex(), items("center"), gap(1), fg("neutral.muted")], children: [_jsx(TrackDot, { kind: "origin" }), pieces, _jsx("span", { mix: [
|
|
58
|
+
inlineFlex(),
|
|
59
|
+
raw({ flexShrink: 0, rotate: "45deg" }),
|
|
60
|
+
when("&:dir(rtl)", raw({ scale: "-1 1" })),
|
|
61
|
+
when("& > svg", raw({ inlineSize: "1rem", blockSize: "1rem" })),
|
|
62
|
+
], children: _jsx(PlaneIcon, { size: 16 }) })] }));
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* One hairline run of the track, sharing what is left with every other run.
|
|
67
|
+
*
|
|
68
|
+
* @returns The render function producing the hairline.
|
|
69
|
+
*/
|
|
70
|
+
function TrackLine() {
|
|
71
|
+
return () => (_jsx("span", { mix: [raw({ flex: "1 1 0", minInlineSize: "0.5rem" }), bs("1px"), bg("neutral.border")] }));
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A ring on the track: hollow where the flight starts, filled with the warning tone at each
|
|
75
|
+
* stop, so a stop reads by shape as well as colour.
|
|
76
|
+
*
|
|
77
|
+
* @param handle Runtime handle carrying which ring to draw.
|
|
78
|
+
* @returns The render function producing the ring.
|
|
79
|
+
*/
|
|
80
|
+
function TrackDot(handle) {
|
|
81
|
+
return () => {
|
|
82
|
+
let stop = handle.props.kind === "stop";
|
|
83
|
+
return (_jsx("span", { "data-slot": stop ? "flight-route-stop" : "flight-route-origin", mix: [
|
|
84
|
+
is(stop ? "0.5rem" : "0.4375rem"),
|
|
85
|
+
bs(stop ? "0.5rem" : "0.4375rem"),
|
|
86
|
+
raw({ flexShrink: 0 }),
|
|
87
|
+
rounded("full"),
|
|
88
|
+
stop
|
|
89
|
+
? [bg("warning.solid"), raw({ boxShadow: "0 0 0 2px var(--ui-bg, Canvas)" })]
|
|
90
|
+
: border({ color: "neutral.border-strong", width: 1.5 }),
|
|
91
|
+
] }));
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Renders the route on one line: departure at the start, arrival at the end, and between them
|
|
96
|
+
* the duration over a drawn track with the stops label under it. It never wraps, so it doubles
|
|
97
|
+
* as the compact summary of a whole journey in a results row.
|
|
98
|
+
*
|
|
99
|
+
* @param handle Runtime handle carrying the route's props.
|
|
100
|
+
* @returns The render function producing the route's markup.
|
|
101
|
+
* @example
|
|
102
|
+
* <FlightRoute
|
|
103
|
+
* departure={{ time: "08:40", code: "MRW", city: "Merrow" }}
|
|
104
|
+
* arrival={{ time: "06:05", code: "OSK", city: "Oskarn" }}
|
|
105
|
+
* duration="19h 25m" stops={1} stopsLabel="1 stop · VLS" dayOffset="+1" dayOffsetLabel="next day"
|
|
106
|
+
* />
|
|
107
|
+
*/
|
|
108
|
+
export function FlightRoute(handle) {
|
|
109
|
+
return () => {
|
|
110
|
+
let { departure, arrival, duration, stops, stopsLabel, dayOffset, dayOffsetLabel, labels, mix, ...rest } = handle.props;
|
|
111
|
+
return (_jsxs("div", { "data-slot": "flight-route", ...rest, mix: mergeMix([
|
|
112
|
+
grid(),
|
|
113
|
+
raw({
|
|
114
|
+
gridTemplateColumns: "auto minmax(3.5rem, 1fr) auto",
|
|
115
|
+
columnGap: "0.75rem",
|
|
116
|
+
alignItems: "center",
|
|
117
|
+
}),
|
|
118
|
+
minIs(0),
|
|
119
|
+
], mix), children: [_jsx(RouteEnd, { endpoint: departure, align: "start", label: labels?.departs }), _jsxs("div", { "data-slot": "flight-route-middle", mix: [vstack({ gap: 1 }), minIs(0), text("xs"), fg("neutral.muted")], children: [_jsxs("span", { "data-slot": "flight-route-duration", mix: [raw({ textAlign: "center" }), tabularNums(), truncate()], children: [labels?.duration === undefined ? null : (_jsx("span", { mix: [visuallyHidden()], children: `${labels.duration} ` })), duration] }), _jsx(RouteTrack, { stops: stops ?? 0 }), stopsLabel === undefined ? null : (_jsx("span", { "data-slot": "flight-route-stops", mix: [
|
|
120
|
+
raw({ textAlign: "center" }),
|
|
121
|
+
truncate(),
|
|
122
|
+
(stops ?? 0) > 0 ? fg("warning.emphasis") : fg("success.emphasis"),
|
|
123
|
+
], children: stopsLabel }))] }), _jsx(RouteEnd, { endpoint: arrival, align: "end", label: labels?.arrives, dayOffset: dayOffset, dayOffsetLabel: dayOffsetLabel })] }));
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Renders one leg: the airline's mark, name and flight number, the {@link FlightRoute}, then a
|
|
128
|
+
* muted line of aircraft, cabin and extras. Under 34rem the airline heads the leg; wider, it
|
|
129
|
+
* takes a column before the route so legs in a list line their routes up.
|
|
130
|
+
*
|
|
131
|
+
* @param handle Runtime handle carrying the leg's props.
|
|
132
|
+
* @returns The render function producing the leg's markup.
|
|
133
|
+
* @example
|
|
134
|
+
* <FlightSegment
|
|
135
|
+
* airline="Larkwing Air" mark={<LarkwingMark />} flightNumber="LW 214"
|
|
136
|
+
* departure={{ time: "08:40", code: "MRW", city: "Merrow" }}
|
|
137
|
+
* arrival={{ time: "10:55", code: "VLS", city: "Vellis" }}
|
|
138
|
+
* duration="2h 15m" stopsLabel="Nonstop" aircraft="Aerion 320neo" cabin="Economy"
|
|
139
|
+
* />
|
|
140
|
+
*/
|
|
141
|
+
export function FlightSegment(handle) {
|
|
142
|
+
return () => {
|
|
143
|
+
let { airline, mark, flightNumber, aircraft, cabin, extra, departure, arrival, duration, stops, stopsLabel, dayOffset, dayOffsetLabel, labels, mix, ...rest } = handle.props;
|
|
144
|
+
let meta = [aircraft, cabin, extra].filter((part) => part !== undefined && part !== null);
|
|
145
|
+
return (_jsx("div", { "data-slot": "flight-segment", ...rest, mix: mergeMix([container(CONTAINER_NAME, "inline-size"), minIs(0)], mix), children: _jsxs("div", { "data-slot": "flight-segment-body", mix: [
|
|
146
|
+
grid(),
|
|
147
|
+
raw({ gridTemplateAreas: '"carrier" "route" "meta"', rowGap: "0.75rem" }),
|
|
148
|
+
text("sm"),
|
|
149
|
+
at(SIDE_BY_SIDE_WIDTH, CONTAINER_NAME, raw({
|
|
150
|
+
gridTemplateColumns: "minmax(9rem, 12rem) minmax(0, 1fr)",
|
|
151
|
+
gridTemplateAreas: '"carrier route" "carrier meta"',
|
|
152
|
+
columnGap: "1.5rem",
|
|
153
|
+
rowGap: "0.5rem",
|
|
154
|
+
})),
|
|
155
|
+
], children: [_jsxs("div", { "data-slot": "flight-segment-carrier", mix: [flex(), items("center"), gap(2.5), minIs(0), raw({ gridArea: "carrier" })], children: [mark === undefined ? null : (_jsx("span", { "data-slot": "flight-segment-mark", "aria-hidden": "true", mix: [
|
|
156
|
+
inlineFlex(),
|
|
157
|
+
items("center"),
|
|
158
|
+
justify("center"),
|
|
159
|
+
is("2rem"),
|
|
160
|
+
bs("2rem"),
|
|
161
|
+
rounded("md"),
|
|
162
|
+
raw({ flexShrink: 0, overflow: "hidden" }),
|
|
163
|
+
when("& > :is(svg, img)", raw({ inlineSize: "100%", blockSize: "100%" })),
|
|
164
|
+
], children: mark })), _jsxs("span", { mix: [vstack({ gap: 0 }), minIs(0)], children: [_jsx("span", { "data-slot": "flight-segment-airline", mix: [weight("medium"), fg("neutral.emphasis"), truncate()], children: airline }), flightNumber === undefined ? null : (_jsx("span", { "data-slot": "flight-segment-number", mix: [text("xs"), fg("neutral.muted"), tabularNums()], children: flightNumber }))] })] }), _jsx(FlightRoute, { departure: departure, arrival: arrival, duration: duration, stops: stops, stopsLabel: stopsLabel, dayOffset: dayOffset, dayOffsetLabel: dayOffsetLabel, labels: labels, mix: [raw({ gridArea: "route" })] }), meta.length === 0 ? null : (_jsx("ul", { "data-slot": "flight-segment-meta", mix: [
|
|
165
|
+
m(0),
|
|
166
|
+
raw({ padding: 0, listStyle: "none", gridArea: "meta", flexWrap: "wrap" }),
|
|
167
|
+
flex(),
|
|
168
|
+
raw({ columnGap: "0.75rem", rowGap: "0.25rem" }),
|
|
169
|
+
text("xs"),
|
|
170
|
+
fg("neutral.muted"),
|
|
171
|
+
when("& > li + li::before", raw({ content: '"·" / ""', marginInlineEnd: "0.75rem" })),
|
|
172
|
+
], children: meta.map((part) => (_jsx("li", { children: part }))) }))] }) }));
|
|
173
|
+
};
|
|
174
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Barrel for `@sdxc/ui/travel`: the pieces a travel or booking app is built from, such as
|
|
3
|
+
* price and rating breakdowns, flight segments, fare calendars, seat maps and boarding
|
|
4
|
+
* passes. Each module also imports on its own, as `@sdxc/ui/travel/seat-map`.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
export * from "./boarding-pass.js";
|
|
10
|
+
export * from "./car-offer.js";
|
|
11
|
+
export * from "./fare-calendar.js";
|
|
12
|
+
export * from "./fare-options.js";
|
|
13
|
+
export * from "./flight-itinerary.js";
|
|
14
|
+
export * from "./flight-option.js";
|
|
15
|
+
export * from "./flight-segment.js";
|
|
16
|
+
export * from "./package-savings.js";
|
|
17
|
+
export * from "./price-breakdown.js";
|
|
18
|
+
export * from "./rating-breakdown.js";
|
|
19
|
+
export * from "./seat-map.js";
|
|
20
|
+
export * from "./trip-timeline.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Barrel for `@sdxc/ui/travel`: the pieces a travel or booking app is built from, such as
|
|
3
|
+
* price and rating breakdowns, flight segments, fare calendars, seat maps and boarding
|
|
4
|
+
* passes. Each module also imports on its own, as `@sdxc/ui/travel/seat-map`.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
export * from "./boarding-pass.js";
|
|
10
|
+
export * from "./car-offer.js";
|
|
11
|
+
export * from "./fare-calendar.js";
|
|
12
|
+
export * from "./fare-options.js";
|
|
13
|
+
export * from "./flight-itinerary.js";
|
|
14
|
+
export * from "./flight-option.js";
|
|
15
|
+
export * from "./flight-segment.js";
|
|
16
|
+
export * from "./package-savings.js";
|
|
17
|
+
export * from "./price-breakdown.js";
|
|
18
|
+
export * from "./rating-breakdown.js";
|
|
19
|
+
export * from "./seat-map.js";
|
|
20
|
+
export * from "./trip-timeline.js";
|