@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,224 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
|
|
2
|
+
import { ChevronLeftIcon, ChevronRightIcon, XIcon } from "@sdxc/icons";
|
|
3
|
+
import { visuallyHidden } from "@sdxc/u/a11y";
|
|
4
|
+
import { outline } from "@sdxc/u/color";
|
|
5
|
+
import { raw, mergeMix } from "@sdxc/u/general";
|
|
6
|
+
import { container } from "@sdxc/u/layout";
|
|
7
|
+
import { at, motionReduce, motionSafe, startingStyle } from "@sdxc/u/responsive";
|
|
8
|
+
import { when } from "@sdxc/u/state";
|
|
9
|
+
import { tabularNums } from "@sdxc/u/typography";
|
|
10
|
+
import { clientEntry } from "remix/component";
|
|
11
|
+
import { lightboxControls } from "../mixins/lightbox-controls.js";
|
|
12
|
+
/** Container the viewer names, so its step buttons move beside the photo once there is room. */
|
|
13
|
+
const CONTAINER_NAME = "ui-lightbox";
|
|
14
|
+
/** Width from which the step buttons sit in their own gutters instead of over the photo. */
|
|
15
|
+
const GUTTER_WIDTH = "48rem";
|
|
16
|
+
/** Words the controls are named by when `labels` leaves them out. */
|
|
17
|
+
const DEFAULT_LABELS = {
|
|
18
|
+
close: "Close",
|
|
19
|
+
previous: "Previous photo",
|
|
20
|
+
next: "Next photo",
|
|
21
|
+
};
|
|
22
|
+
/** The round, 44px control shared by the close button and the step links. */
|
|
23
|
+
const CONTROL_STYLES = raw({
|
|
24
|
+
display: "inline-grid",
|
|
25
|
+
placeItems: "center",
|
|
26
|
+
inlineSize: "2.75rem",
|
|
27
|
+
blockSize: "2.75rem",
|
|
28
|
+
padding: 0,
|
|
29
|
+
border: 0,
|
|
30
|
+
borderRadius: "999px",
|
|
31
|
+
background: "rgb(0 0 0 / 0.55)",
|
|
32
|
+
color: "white",
|
|
33
|
+
cursor: "pointer",
|
|
34
|
+
textDecoration: "none",
|
|
35
|
+
zIndex: 1,
|
|
36
|
+
});
|
|
37
|
+
/** The id of photo `index`, one-based so it reads like the counter (`photos-photo-3`). */
|
|
38
|
+
function slideId(id, index) {
|
|
39
|
+
return `${id}-photo-${index + 1}`;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Loads the viewer's script: the hidden host whose mixin wires the arrow keys, the
|
|
43
|
+
* index-aware triggers and the live region. It loads from `@sdxc/ui/lightbox`, which the
|
|
44
|
+
* app's browser entry maps; {@link Lightbox} renders it, so a page never places it itself.
|
|
45
|
+
*/
|
|
46
|
+
export const LightboxControls = clientEntry("@sdxc/ui/lightbox#LightboxControls", function LightboxControls() {
|
|
47
|
+
return () => _jsx("span", { hidden: true, mix: [lightboxControls()] });
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* Renders the viewer: a full-screen dark `<dialog>` with a close button, one slide per photo
|
|
51
|
+
* (contained, with "n / N" and its caption) and step links between neighbours. Opened from a
|
|
52
|
+
* {@link Lightbox.Trigger}; Escape and the close button dismiss it.
|
|
53
|
+
*
|
|
54
|
+
* @param handle Runtime handle carrying the dialog's props.
|
|
55
|
+
* @returns The render function producing the viewer's markup.
|
|
56
|
+
* @example
|
|
57
|
+
* <Lightbox.Trigger lightbox="cabin-photos" index={2}><img src={thumb} alt="" /></Lightbox.Trigger>
|
|
58
|
+
* <Lightbox id="cabin-photos" label="Photos of Fern Cabin" photos={photos} />
|
|
59
|
+
* @example
|
|
60
|
+
* <Lightbox id="cabin-photos" label="Photos" photos={photos} initial={Number(url.searchParams.get("photo")) - 1} />
|
|
61
|
+
*/
|
|
62
|
+
export function Lightbox(handle) {
|
|
63
|
+
return () => {
|
|
64
|
+
let { id, label, photos, initial, labels, mix, ...rest } = handle.props;
|
|
65
|
+
let words = { ...DEFAULT_LABELS, ...labels };
|
|
66
|
+
let total = photos.length;
|
|
67
|
+
let start = initial === undefined ? undefined : Math.max(0, Math.min(total - 1, initial));
|
|
68
|
+
return (_jsxs("dialog", { ...rest, id: id, "aria-label": label, open: start !== undefined, "data-lightbox-initial": start === undefined ? undefined : String(start), "data-slot": "lightbox", mix: mergeMix([
|
|
69
|
+
raw({
|
|
70
|
+
position: "fixed",
|
|
71
|
+
inset: 0,
|
|
72
|
+
inlineSize: "auto",
|
|
73
|
+
blockSize: "auto",
|
|
74
|
+
maxInlineSize: "none",
|
|
75
|
+
maxBlockSize: "none",
|
|
76
|
+
margin: 0,
|
|
77
|
+
padding: 0,
|
|
78
|
+
border: 0,
|
|
79
|
+
overflow: "hidden",
|
|
80
|
+
background: "rgb(12 12 14)",
|
|
81
|
+
color: "white",
|
|
82
|
+
colorScheme: "dark",
|
|
83
|
+
zIndex: 50,
|
|
84
|
+
opacity: 1,
|
|
85
|
+
}),
|
|
86
|
+
container(CONTAINER_NAME, "inline-size"),
|
|
87
|
+
when("&[open]", raw({ display: "block" })),
|
|
88
|
+
when("&::backdrop", raw({ background: "rgb(0 0 0 / 0.9)" })),
|
|
89
|
+
motionSafe([
|
|
90
|
+
raw({
|
|
91
|
+
transition: "opacity 160ms ease-out, display 160ms allow-discrete, overlay 160ms allow-discrete",
|
|
92
|
+
}),
|
|
93
|
+
startingStyle(when("&[open]", raw({ opacity: 0 }))),
|
|
94
|
+
]),
|
|
95
|
+
], mix), children: [_jsx(LightboxControls, {}), _jsx("button", { type: "button", commandfor: id, command: "close", "aria-label": words.close, "data-slot": "lightbox-close", mix: [
|
|
96
|
+
CONTROL_STYLES,
|
|
97
|
+
raw({ position: "absolute", insetBlockStart: "0.75rem", insetInlineEnd: "0.75rem" }),
|
|
98
|
+
when("&:focus-visible", outline({ color: "white", offset: 2, width: 2 })),
|
|
99
|
+
], children: _jsx(XIcon, { size: 20 }) }), _jsx("p", { role: "status", "data-lightbox-status": "", mix: [visuallyHidden()] }), _jsx("div", { "data-lightbox-track": "", "data-slot": "lightbox-track", mix: [
|
|
100
|
+
raw({
|
|
101
|
+
display: "flex",
|
|
102
|
+
blockSize: "100%",
|
|
103
|
+
overflowX: "auto",
|
|
104
|
+
overflowY: "hidden",
|
|
105
|
+
scrollSnapType: "x mandatory",
|
|
106
|
+
overscrollBehaviorX: "contain",
|
|
107
|
+
scrollbarWidth: "none",
|
|
108
|
+
}),
|
|
109
|
+
when("&::-webkit-scrollbar", raw({ display: "none" })),
|
|
110
|
+
motionSafe(raw({ scrollBehavior: "smooth" })),
|
|
111
|
+
motionReduce(raw({ scrollBehavior: "auto" })),
|
|
112
|
+
], children: photos.map((photo, index) => (_jsx(LightboxSlide, { viewer: id, photo: photo, index: index, total: total, initial: index === start, labels: words }))) })] }));
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* One photo filling the track: the picture contained in the space above its counter and
|
|
117
|
+
* caption, with a link to each neighbour that addresses it by id, so the track scrolls there
|
|
118
|
+
* with or without script. The first photo has no previous link and the last no next.
|
|
119
|
+
*
|
|
120
|
+
* @param handle Runtime handle carrying the slide's photo and position.
|
|
121
|
+
* @returns The render function producing the slide's markup.
|
|
122
|
+
*/
|
|
123
|
+
function LightboxSlide(handle) {
|
|
124
|
+
return () => {
|
|
125
|
+
let { viewer, photo, index, total, initial, labels } = handle.props;
|
|
126
|
+
let hasPrevious = index > 0;
|
|
127
|
+
let hasNext = index < total - 1;
|
|
128
|
+
return (_jsxs("figure", { id: slideId(viewer, index), "data-lightbox-slide": "", "data-slot": "lightbox-slide", mix: [
|
|
129
|
+
raw({
|
|
130
|
+
position: "relative",
|
|
131
|
+
flex: "0 0 100%",
|
|
132
|
+
display: "grid",
|
|
133
|
+
gridTemplateRows: "minmax(0, 1fr) auto",
|
|
134
|
+
gap: "0.75rem",
|
|
135
|
+
margin: 0,
|
|
136
|
+
paddingBlock: "4rem 1rem",
|
|
137
|
+
scrollSnapAlign: "center",
|
|
138
|
+
minInlineSize: 0,
|
|
139
|
+
}),
|
|
140
|
+
initial ? raw({ scrollInitialTarget: "nearest" }) : undefined,
|
|
141
|
+
at(GUTTER_WIDTH, CONTAINER_NAME, raw({ paddingInline: "4.5rem" })),
|
|
142
|
+
], children: [photo.art === undefined ? (_jsx("img", { src: photo.src, srcset: photo.srcset, alt: photo.alt, loading: initial ? "eager" : "lazy", decoding: "async", mix: [
|
|
143
|
+
raw({
|
|
144
|
+
display: "block",
|
|
145
|
+
inlineSize: "100%",
|
|
146
|
+
blockSize: "100%",
|
|
147
|
+
minBlockSize: 0,
|
|
148
|
+
objectFit: "contain",
|
|
149
|
+
}),
|
|
150
|
+
] })) : (_jsx("div", { role: "img", "aria-label": photo.alt, "data-slot": "lightbox-art", mix: [
|
|
151
|
+
raw({
|
|
152
|
+
display: "grid",
|
|
153
|
+
placeItems: "center",
|
|
154
|
+
minBlockSize: 0,
|
|
155
|
+
overflow: "hidden",
|
|
156
|
+
}),
|
|
157
|
+
when("& > svg", raw({ inlineSize: "100%", blockSize: "100%" })),
|
|
158
|
+
], children: photo.art })), _jsxs("figcaption", { mix: [
|
|
159
|
+
raw({
|
|
160
|
+
display: "flex",
|
|
161
|
+
gap: "0.75rem",
|
|
162
|
+
alignItems: "baseline",
|
|
163
|
+
justifyContent: "center",
|
|
164
|
+
flexWrap: "wrap",
|
|
165
|
+
paddingInline: "1rem",
|
|
166
|
+
fontSize: "0.875rem",
|
|
167
|
+
lineHeight: 1.4,
|
|
168
|
+
textAlign: "center",
|
|
169
|
+
color: "rgb(255 255 255 / 0.86)",
|
|
170
|
+
}),
|
|
171
|
+
], children: [_jsx("span", { "data-lightbox-announce": "", "data-slot": "lightbox-counter", mix: [tabularNums(), raw({ color: "rgb(255 255 255 / 0.6)" })], children: `${index + 1} / ${total}` }), photo.caption === undefined ? null : (_jsx("span", { "data-lightbox-announce": "", "data-slot": "lightbox-caption", children: photo.caption }))] }), hasPrevious ? (_jsx(LightboxStep, { href: `#${slideId(viewer, index - 1)}`, to: index - 1, label: labels.previous, side: "start" })) : null, hasNext ? (_jsx(LightboxStep, { href: `#${slideId(viewer, index + 1)}`, to: index + 1, label: labels.next, side: "end" })) : null] }));
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* A round link to a neighbouring photo, centred on the slide's edge: over the photo on a
|
|
176
|
+
* phone, in the slide's own gutter once the viewer is wide. The chevron mirrors under RTL.
|
|
177
|
+
*
|
|
178
|
+
* @param handle Runtime handle carrying the link's target and side.
|
|
179
|
+
* @returns The render function producing the link's markup.
|
|
180
|
+
*/
|
|
181
|
+
function LightboxStep(handle) {
|
|
182
|
+
return () => {
|
|
183
|
+
let { href, to, label, side } = handle.props;
|
|
184
|
+
return (_jsx("a", { href: href, "aria-label": label, "data-lightbox-to": String(to), "data-slot": side === "start" ? "lightbox-previous" : "lightbox-next", mix: [
|
|
185
|
+
CONTROL_STYLES,
|
|
186
|
+
raw({
|
|
187
|
+
position: "absolute",
|
|
188
|
+
insetBlockStart: "50%",
|
|
189
|
+
translate: "0 -50%",
|
|
190
|
+
[side === "start" ? "insetInlineStart" : "insetInlineEnd"]: "0.5rem",
|
|
191
|
+
}),
|
|
192
|
+
when(":dir(rtl) > &", raw({ scale: "-1 1" })),
|
|
193
|
+
when("&:focus-visible", outline({ color: "white", offset: 2, width: 2 })),
|
|
194
|
+
], children: side === "start" ? _jsx(ChevronLeftIcon, { size: 22 }) : _jsx(ChevronRightIcon, { size: 22 }) }));
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Renders a button that opens the viewer named by `lightbox` as a modal, at photo `index`
|
|
199
|
+
* once the island has loaded. It is unstyled apart from a focus ring, so a thumbnail or a
|
|
200
|
+
* "Show all photos" label inside it sets its look.
|
|
201
|
+
*
|
|
202
|
+
* @param handle Runtime handle carrying the button's props.
|
|
203
|
+
* @returns The render function producing the trigger's markup.
|
|
204
|
+
* @example
|
|
205
|
+
* <Lightbox.Trigger lightbox="cabin-photos" index={3} aria-label="Open photo 4"><img src={thumb} alt="" /></Lightbox.Trigger>
|
|
206
|
+
*/
|
|
207
|
+
Lightbox.Trigger = function LightboxTrigger(handle) {
|
|
208
|
+
return () => {
|
|
209
|
+
let { lightbox, index, mix, ...rest } = handle.props;
|
|
210
|
+
return (_jsx("button", { type: "button", ...rest, commandfor: lightbox, command: "show-modal", "data-lightbox-index": String(index ?? 0), "data-slot": "lightbox-trigger", mix: mergeMix([
|
|
211
|
+
raw({
|
|
212
|
+
display: "block",
|
|
213
|
+
padding: 0,
|
|
214
|
+
border: 0,
|
|
215
|
+
background: "none",
|
|
216
|
+
color: "inherit",
|
|
217
|
+
font: "inherit",
|
|
218
|
+
textAlign: "inherit",
|
|
219
|
+
cursor: "zoom-in",
|
|
220
|
+
}),
|
|
221
|
+
when("&:focus-visible", outline({ color: "brand.ring", offset: 2, width: 2 })),
|
|
222
|
+
], mix) }));
|
|
223
|
+
};
|
|
224
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A grid of photos and videos as links, three square tiles to a row with a hairline gap, the
|
|
3
|
+
* way a profile or an explore page lays out a person's pictures: a tile can stand two rows
|
|
4
|
+
* tall, carry a badge in its corner and show an overlay (likes, a count) on hover or focus.
|
|
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
|
+
/** Prop types for {@link MediaGrid} and {@link MediaGrid.Item}. */
|
|
11
|
+
export declare namespace MediaGrid {
|
|
12
|
+
/** Every native `<ul>` attribute, plus the grid's name and tiles. */
|
|
13
|
+
interface Props extends Omit<TagProps<"ul">, "children"> {
|
|
14
|
+
/** The list's accessible name, such as "Posts". */
|
|
15
|
+
label: string;
|
|
16
|
+
/** How many tiles to a row. Default: `3`. */
|
|
17
|
+
columns?: number;
|
|
18
|
+
/** {@link MediaGrid.Item} elements in order. */
|
|
19
|
+
children: RemixNode;
|
|
20
|
+
}
|
|
21
|
+
/** Every native `<li>` attribute but `children`, plus the tile's link and content. */
|
|
22
|
+
interface ItemProps extends Omit<TagProps<"li">, "children"> {
|
|
23
|
+
/** Where the tile leads: the post or the video. */
|
|
24
|
+
href: string;
|
|
25
|
+
/** The link's accessible name, such as "Post by Mara: bowls cooling on a plank". */
|
|
26
|
+
label: string;
|
|
27
|
+
/** The picture, drawn edge to edge and cropped to the tile: an `<img>`, an `<svg>`, a `<video>`. */
|
|
28
|
+
children: RemixNode;
|
|
29
|
+
/** Stands two rows tall, for a video among photos. */
|
|
30
|
+
tall?: boolean;
|
|
31
|
+
/** An icon in the top corner, such as a stack for several photos or a film for a video. */
|
|
32
|
+
badge?: RemixNode;
|
|
33
|
+
/** What shows over the picture on hover or focus, such as its likes and comments. */
|
|
34
|
+
overlay?: RemixNode;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Renders the grid. Tiles flow densely, so a tall tile never leaves a hole; the gap reads
|
|
39
|
+
* `--ui-media-grid-gap`, a hairline unless a page widens it.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* <MediaGrid label="Posts">
|
|
43
|
+
* {posts.map((post) => (
|
|
44
|
+
* <MediaGrid.Item href={post.href} label={post.alt} badge={post.many ? <LayersIcon /> : null}>
|
|
45
|
+
* <img src={post.thumb} alt="" />
|
|
46
|
+
* </MediaGrid.Item>
|
|
47
|
+
* ))}
|
|
48
|
+
* </MediaGrid>
|
|
49
|
+
*/
|
|
50
|
+
export declare function MediaGrid(handle: Handle<MediaGrid.Props>): () => import("remix/component").RemixElement;
|
|
51
|
+
export declare namespace MediaGrid {
|
|
52
|
+
var Item: (handle: Handle<MediaGrid.ItemProps>) => () => import("remix/component").RemixElement;
|
|
53
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
|
|
2
|
+
import { mergeMix, raw } from "@sdxc/u/general";
|
|
3
|
+
import { motionReduce } from "@sdxc/u/responsive";
|
|
4
|
+
import { when } from "@sdxc/u/state";
|
|
5
|
+
/** Tiles to a row when a page names no other count. */
|
|
6
|
+
const DEFAULT_COLUMNS = 3;
|
|
7
|
+
/**
|
|
8
|
+
* Renders the grid. Tiles flow densely, so a tall tile never leaves a hole; the gap reads
|
|
9
|
+
* `--ui-media-grid-gap`, a hairline unless a page widens it.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* <MediaGrid label="Posts">
|
|
13
|
+
* {posts.map((post) => (
|
|
14
|
+
* <MediaGrid.Item href={post.href} label={post.alt} badge={post.many ? <LayersIcon /> : null}>
|
|
15
|
+
* <img src={post.thumb} alt="" />
|
|
16
|
+
* </MediaGrid.Item>
|
|
17
|
+
* ))}
|
|
18
|
+
* </MediaGrid>
|
|
19
|
+
*/
|
|
20
|
+
export function MediaGrid(handle) {
|
|
21
|
+
return () => {
|
|
22
|
+
let { children, columns = DEFAULT_COLUMNS, label, mix, ...rest } = handle.props;
|
|
23
|
+
return (_jsx("ul", { ...rest, "aria-label": label, "data-slot": "media-grid", mix: mergeMix([
|
|
24
|
+
raw({
|
|
25
|
+
display: "grid",
|
|
26
|
+
gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`,
|
|
27
|
+
gridAutoFlow: "dense",
|
|
28
|
+
gap: "var(--ui-media-grid-gap, 2px)",
|
|
29
|
+
margin: "0",
|
|
30
|
+
padding: "0",
|
|
31
|
+
listStyle: "none",
|
|
32
|
+
}),
|
|
33
|
+
], mix), children: children }));
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* One tile: a link holding the picture, square or two rows tall, with its badge and an
|
|
38
|
+
* overlay that fades in over a scrim while the tile is hovered or focused.
|
|
39
|
+
*/
|
|
40
|
+
MediaGrid.Item = function MediaGridItem(handle) {
|
|
41
|
+
return () => {
|
|
42
|
+
let { badge, children, href, label, mix, overlay, tall = false, ...rest } = handle.props;
|
|
43
|
+
return (_jsx("li", { ...rest, "data-slot": "media-grid-item", "data-tall": tall ? "" : undefined, mix: mergeMix([
|
|
44
|
+
raw({ minInlineSize: "0" }),
|
|
45
|
+
when("&[data-tall]", raw({ gridRow: "span 2", "--ui-media-grid-ratio": "auto" })),
|
|
46
|
+
], mix), children: _jsxs("a", { href: href, "aria-label": label, mix: [
|
|
47
|
+
raw({
|
|
48
|
+
position: "relative",
|
|
49
|
+
display: "block",
|
|
50
|
+
blockSize: "100%",
|
|
51
|
+
aspectRatio: "var(--ui-media-grid-ratio, 1)",
|
|
52
|
+
overflow: "hidden",
|
|
53
|
+
color: "oklch(0.99 0 0)",
|
|
54
|
+
backgroundColor: "var(--ui-neutral-bg-tint)",
|
|
55
|
+
"& > [data-media-grid-picture] > *": {
|
|
56
|
+
display: "block",
|
|
57
|
+
inlineSize: "100%",
|
|
58
|
+
blockSize: "100%",
|
|
59
|
+
objectFit: "cover",
|
|
60
|
+
},
|
|
61
|
+
}),
|
|
62
|
+
when("&:hover [data-media-grid-overlay], &:focus-visible [data-media-grid-overlay]", raw({ opacity: "1" })),
|
|
63
|
+
when("&:focus-visible", raw({ outline: "2px solid var(--ui-brand-ring)", outlineOffset: "-2px" })),
|
|
64
|
+
], children: [_jsx("span", { "data-media-grid-picture": "", mix: [raw({ position: "absolute", inset: "0", display: "block" })], children: children }), badge === undefined || badge === null ? null : (_jsx("span", { "aria-hidden": "true", "data-media-grid-badge": "", mix: [
|
|
65
|
+
raw({
|
|
66
|
+
position: "absolute",
|
|
67
|
+
insetBlockStart: "0.5rem",
|
|
68
|
+
insetInlineEnd: "0.5rem",
|
|
69
|
+
display: "inline-flex",
|
|
70
|
+
filter: "drop-shadow(0 1px 2px rgb(0 0 0 / 0.5))",
|
|
71
|
+
"& > svg": { inlineSize: "1.125rem", blockSize: "1.125rem" },
|
|
72
|
+
}),
|
|
73
|
+
], children: badge })), overlay === undefined || overlay === null ? null : (_jsx("span", { "aria-hidden": "true", "data-media-grid-overlay": "", mix: [
|
|
74
|
+
raw({
|
|
75
|
+
position: "absolute",
|
|
76
|
+
inset: "0",
|
|
77
|
+
display: "flex",
|
|
78
|
+
alignItems: "center",
|
|
79
|
+
justifyContent: "center",
|
|
80
|
+
gap: "1.25rem",
|
|
81
|
+
backgroundColor: "rgb(0 0 0 / 0.35)",
|
|
82
|
+
fontWeight: "700",
|
|
83
|
+
opacity: "0",
|
|
84
|
+
transition: "opacity 120ms ease",
|
|
85
|
+
}),
|
|
86
|
+
motionReduce(raw({ transition: "none" })),
|
|
87
|
+
], children: overlay }))] }) }));
|
|
88
|
+
};
|
|
89
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A server-rendered run of consecutive month grids for picking a stay's check-in and check-out,
|
|
3
|
+
* or a single date. Every selectable day is a link the caller builds, so picking works without
|
|
4
|
+
* script; a CSS-only band previews the range under the pointer once a start is chosen.
|
|
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 { Heading } from "./heading.js";
|
|
11
|
+
/** Prop types for {@link RangeMonths}. */
|
|
12
|
+
export declare namespace RangeMonths {
|
|
13
|
+
/** What a link asks the page to show next: the selection it makes and the first month on view. */
|
|
14
|
+
interface Next {
|
|
15
|
+
/** First day of the range, or the picked day in single mode, `YYYY-MM-DD`. */
|
|
16
|
+
start?: string;
|
|
17
|
+
/** Last day of the range, `YYYY-MM-DD`; absent while only a start is chosen. */
|
|
18
|
+
end?: string;
|
|
19
|
+
/** First month on view, `YYYY-MM`. */
|
|
20
|
+
month: string;
|
|
21
|
+
}
|
|
22
|
+
/** Words read to assistive technology, in the page's language. */
|
|
23
|
+
interface Labels {
|
|
24
|
+
/** Name of the previous-month link, e.g. "Previous month". */
|
|
25
|
+
previous: string;
|
|
26
|
+
/** Name of the next-month link, e.g. "Next month". */
|
|
27
|
+
next: string;
|
|
28
|
+
/** Appended to the start day's name, e.g. "check-in". */
|
|
29
|
+
start?: string;
|
|
30
|
+
/** Appended to the end day's name, e.g. "check-out". */
|
|
31
|
+
end?: string;
|
|
32
|
+
/** Appended to the picked day's name in single mode. */
|
|
33
|
+
selected?: string;
|
|
34
|
+
}
|
|
35
|
+
/** Every native `<div>` attribute, plus the months, selection and links to draw. */
|
|
36
|
+
interface Props extends Omit<TagProps<"div">, "children"> {
|
|
37
|
+
/** First month shown, `YYYY-MM`. */
|
|
38
|
+
month: string;
|
|
39
|
+
/** How many consecutive months to show, side by side while they fit and one per row below. Defaults to {@link DEFAULT_MONTHS}. */
|
|
40
|
+
months?: number;
|
|
41
|
+
/** Chosen start day (the picked day in single mode), `YYYY-MM-DD`. */
|
|
42
|
+
start?: string;
|
|
43
|
+
/** Chosen end day, `YYYY-MM-DD`; read in range mode only. */
|
|
44
|
+
end?: string;
|
|
45
|
+
/** Picks one day: a day link carries `start` alone and no band is drawn. */
|
|
46
|
+
single?: boolean;
|
|
47
|
+
/** Today, `YYYY-MM-DD`, passed in so the server and the browser draw the same marker. */
|
|
48
|
+
today?: string;
|
|
49
|
+
/** Earliest selectable day, `YYYY-MM-DD`; also hides the previous link before its month. */
|
|
50
|
+
min?: string;
|
|
51
|
+
/** Latest selectable day, `YYYY-MM-DD`; also hides the next link from its month on. */
|
|
52
|
+
max?: string;
|
|
53
|
+
/** Days already taken: drawn struck through, never a link, and never crossed by a range. */
|
|
54
|
+
isUnavailable?: (date: string) => boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Counts each day as a night, as a stay calendar does: the first taken day after a pending
|
|
57
|
+
* start still links as its end, since checking out that morning leaves the night free.
|
|
58
|
+
*/
|
|
59
|
+
nights?: boolean;
|
|
60
|
+
/** Builds the URL of every day and month link from what that link selects. */
|
|
61
|
+
href: (next: Next) => string;
|
|
62
|
+
/** A small line under each day's number, such as the nightly price or event dots. */
|
|
63
|
+
dayNote?: (date: string) => RemixNode;
|
|
64
|
+
/** First weekday column, 0 for Sunday through 6 for Saturday. Defaults to {@link DEFAULT_WEEK_STARTS_ON}. */
|
|
65
|
+
weekStartsOn?: number;
|
|
66
|
+
/** BCP 47 locale for the month, weekday and day names; pass it so server and browser agree. */
|
|
67
|
+
locale?: string;
|
|
68
|
+
/** Names the whole calendar, e.g. "Stay dates". */
|
|
69
|
+
label: string;
|
|
70
|
+
/** Level of each month's heading; resolved from the surrounding heading scope when unset. */
|
|
71
|
+
headingLevel?: Heading.Level;
|
|
72
|
+
/** Words read to assistive technology. */
|
|
73
|
+
labels: Labels;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Renders `months` month grids from `month`, each day a link to `href`'s URL for the selection
|
|
78
|
+
* a click makes: with no start, or both ends set, the day becomes a new start; with only a start,
|
|
79
|
+
* a later day becomes the end and an earlier or equal one the new start. Single mode links each day
|
|
80
|
+
* as `{ start: day }`. Unavailable days, days outside `min`–`max`, and, while a start waits for its
|
|
81
|
+
* end, days past the first unavailable day after it render as plain text.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* <RangeMonths
|
|
85
|
+
* label={t("stay.dates")}
|
|
86
|
+
* labels={{ previous: t("calendar.previous"), next: t("calendar.next"), start: t("stay.checkIn"), end: t("stay.checkOut") }}
|
|
87
|
+
* locale={locale}
|
|
88
|
+
* month="2026-03"
|
|
89
|
+
* start={query.checkIn}
|
|
90
|
+
* end={query.checkOut}
|
|
91
|
+
* today="2026-03-02"
|
|
92
|
+
* min="2026-03-02"
|
|
93
|
+
* isUnavailable={(date) => booked.has(date)}
|
|
94
|
+
* dayNote={(date) => `$${prices[date]}`}
|
|
95
|
+
* href={(next) => `?${new URLSearchParams({ ...next })}`}
|
|
96
|
+
* />
|
|
97
|
+
* @example
|
|
98
|
+
* <RangeMonths single months={1} label={t("jump")} labels={labels} month="2026-03" start={day} today={today} href={({ start, month }) => `/day/${start ?? month}`} />
|
|
99
|
+
*/
|
|
100
|
+
export declare function RangeMonths(handle: Handle<RangeMonths.Props>): () => import("remix/component").RemixElement;
|