@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.
Files changed (233) hide show
  1. package/README.md +133 -1
  2. package/dist/app/index.d.ts +1 -0
  3. package/dist/app/index.js +1 -0
  4. package/dist/app/mixins/command-palette.js +10 -2
  5. package/dist/app/mixins/log-viewer.js +17 -14
  6. package/dist/app/mixins/route-dialog.d.ts +17 -0
  7. package/dist/app/mixins/route-dialog.js +53 -0
  8. package/dist/app/optimistic-toggle.js +6 -0
  9. package/dist/app/route-dialog.d.ts +38 -0
  10. package/dist/app/route-dialog.js +49 -0
  11. package/dist/audio/equalizer.d.ts +24 -0
  12. package/dist/audio/equalizer.js +57 -0
  13. package/dist/audio/index.d.ts +16 -0
  14. package/dist/audio/index.js +16 -0
  15. package/dist/audio/media-tile.d.ts +38 -0
  16. package/dist/audio/media-tile.js +98 -0
  17. package/dist/audio/player-bar.d.ts +108 -0
  18. package/dist/audio/player-bar.js +338 -0
  19. package/dist/audio/queue-list.d.ts +56 -0
  20. package/dist/audio/queue-list.js +102 -0
  21. package/dist/audio/track-list.d.ts +91 -0
  22. package/dist/audio/track-list.js +226 -0
  23. package/dist/audio/utils/media-session.d.ts +44 -0
  24. package/dist/audio/utils/media-session.js +87 -0
  25. package/dist/audio/utils/play-queue.d.ts +98 -0
  26. package/dist/audio/utils/play-queue.js +149 -0
  27. package/dist/audio/utils/track-time.d.ts +28 -0
  28. package/dist/audio/utils/track-time.js +36 -0
  29. package/dist/chat/composer-format.d.ts +35 -0
  30. package/dist/chat/composer-format.js +84 -0
  31. package/dist/chat/index.d.ts +6 -0
  32. package/dist/chat/index.js +6 -0
  33. package/dist/chat/mention-menu.d.ts +43 -0
  34. package/dist/chat/mention-menu.js +70 -0
  35. package/dist/chat/message-group.d.ts +92 -0
  36. package/dist/chat/message-group.js +222 -0
  37. package/dist/chat/mixins/composer-format.d.ts +28 -0
  38. package/dist/chat/mixins/composer-format.js +80 -0
  39. package/dist/chat/mixins/composer-send.d.ts +2 -2
  40. package/dist/chat/mixins/composer-send.js +4 -2
  41. package/dist/chat/mixins/mention-menu.d.ts +41 -0
  42. package/dist/chat/mixins/mention-menu.js +213 -0
  43. package/dist/chat/mixins/reaction-sync.d.ts +47 -0
  44. package/dist/chat/mixins/reaction-sync.js +172 -0
  45. package/dist/chat/reaction-bar.d.ts +70 -0
  46. package/dist/chat/reaction-bar.js +108 -0
  47. package/dist/chat/typing-indicator.d.ts +42 -0
  48. package/dist/chat/typing-indicator.js +68 -0
  49. package/dist/chat/utils/composer-text.d.ts +38 -0
  50. package/dist/chat/utils/composer-text.js +86 -0
  51. package/dist/chat/utils/markdown-format.d.ts +30 -0
  52. package/dist/chat/utils/markdown-format.js +158 -0
  53. package/dist/chat/utils/mention-query.d.ts +55 -0
  54. package/dist/chat/utils/mention-query.js +60 -0
  55. package/dist/commerce/cart-drawer.d.ts +69 -0
  56. package/dist/commerce/cart-drawer.js +163 -0
  57. package/dist/commerce/cart-line.d.ts +32 -0
  58. package/dist/commerce/cart-line.js +43 -0
  59. package/dist/commerce/checkout-layout.d.ts +32 -0
  60. package/dist/commerce/checkout-layout.js +51 -0
  61. package/dist/commerce/facet-filters.d.ts +121 -0
  62. package/dist/commerce/facet-filters.js +318 -0
  63. package/dist/commerce/fulfilment-note.d.ts +28 -0
  64. package/dist/commerce/fulfilment-note.js +26 -0
  65. package/dist/commerce/index.d.ts +27 -0
  66. package/dist/commerce/index.js +27 -0
  67. package/dist/commerce/item-options-dialog.d.ts +67 -0
  68. package/dist/commerce/item-options-dialog.js +150 -0
  69. package/dist/commerce/menu-item-card.d.ts +37 -0
  70. package/dist/commerce/menu-item-card.js +96 -0
  71. package/dist/commerce/option-group.d.ts +62 -0
  72. package/dist/commerce/option-group.js +121 -0
  73. package/dist/commerce/order-summary.d.ts +42 -0
  74. package/dist/commerce/order-summary.js +76 -0
  75. package/dist/commerce/order-tracker.d.ts +80 -0
  76. package/dist/commerce/order-tracker.js +178 -0
  77. package/dist/commerce/price.d.ts +52 -0
  78. package/dist/commerce/price.js +108 -0
  79. package/dist/commerce/product-card.d.ts +53 -0
  80. package/dist/commerce/product-card.js +127 -0
  81. package/dist/commerce/product-gallery.d.ts +70 -0
  82. package/dist/commerce/product-gallery.js +186 -0
  83. package/dist/commerce/promo-code.d.ts +56 -0
  84. package/dist/commerce/promo-code.js +101 -0
  85. package/dist/commerce/quantity-stepper.d.ts +42 -0
  86. package/dist/commerce/quantity-stepper.js +53 -0
  87. package/dist/commerce/question-list.d.ts +53 -0
  88. package/dist/commerce/question-list.js +92 -0
  89. package/dist/commerce/shipping-estimate.d.ts +53 -0
  90. package/dist/commerce/shipping-estimate.js +39 -0
  91. package/dist/commerce/sort-select.d.ts +38 -0
  92. package/dist/commerce/sort-select.js +38 -0
  93. package/dist/commerce/variant-picker.d.ts +75 -0
  94. package/dist/commerce/variant-picker.js +135 -0
  95. package/dist/components/amount.d.ts +46 -0
  96. package/dist/components/amount.js +34 -0
  97. package/dist/components/autocomplete.d.ts +82 -0
  98. package/dist/components/autocomplete.js +114 -0
  99. package/dist/components/carousel.d.ts +31 -1
  100. package/dist/components/carousel.js +66 -3
  101. package/dist/components/index.d.ts +11 -0
  102. package/dist/components/index.js +11 -0
  103. package/dist/components/letterbox.d.ts +47 -0
  104. package/dist/components/letterbox.js +56 -0
  105. package/dist/components/lightbox.d.ts +88 -0
  106. package/dist/components/lightbox.js +224 -0
  107. package/dist/components/media-grid.d.ts +53 -0
  108. package/dist/components/media-grid.js +89 -0
  109. package/dist/components/range-months.d.ts +100 -0
  110. package/dist/components/range-months.js +274 -0
  111. package/dist/components/rating-input.d.ts +33 -0
  112. package/dist/components/rating-input.js +63 -0
  113. package/dist/components/rating.d.ts +38 -0
  114. package/dist/components/rating.js +66 -0
  115. package/dist/components/review-card.d.ts +39 -0
  116. package/dist/components/review-card.js +59 -0
  117. package/dist/components/section-bar.d.ts +57 -0
  118. package/dist/components/section-bar.js +140 -0
  119. package/dist/components/step-indicator.d.ts +46 -0
  120. package/dist/components/step-indicator.js +96 -0
  121. package/dist/finance/index.d.ts +10 -0
  122. package/dist/finance/index.js +10 -0
  123. package/dist/finance/ledger.d.ts +60 -0
  124. package/dist/finance/ledger.js +93 -0
  125. package/dist/finance/payment-card.d.ts +49 -0
  126. package/dist/finance/payment-card.js +115 -0
  127. package/dist/map/engine.d.ts +49 -0
  128. package/dist/map/engine.js +591 -0
  129. package/dist/map/index.d.ts +12 -0
  130. package/dist/map/index.js +12 -0
  131. package/dist/map/map-canvas.d.ts +101 -0
  132. package/dist/map/map-canvas.js +275 -0
  133. package/dist/map/map.d.ts +217 -0
  134. package/dist/map/map.js +598 -0
  135. package/dist/map/mixins/map-link.d.ts +30 -0
  136. package/dist/map/mixins/map-link.js +116 -0
  137. package/dist/map/utils/basemap.d.ts +88 -0
  138. package/dist/map/utils/basemap.js +84 -0
  139. package/dist/map/utils/cluster.d.ts +43 -0
  140. package/dist/map/utils/cluster.js +80 -0
  141. package/dist/map/utils/mercator.d.ts +66 -0
  142. package/dist/map/utils/mercator.js +92 -0
  143. package/dist/map/utils/stage.d.ts +24 -0
  144. package/dist/map/utils/stage.js +49 -0
  145. package/dist/mixins/autocomplete.d.ts +28 -0
  146. package/dist/mixins/autocomplete.js +283 -0
  147. package/dist/mixins/carousel-controls.d.ts +14 -3
  148. package/dist/mixins/carousel-controls.js +89 -30
  149. package/dist/mixins/index.d.ts +2 -0
  150. package/dist/mixins/index.js +2 -0
  151. package/dist/mixins/lightbox-controls.d.ts +34 -0
  152. package/dist/mixins/lightbox-controls.js +176 -0
  153. package/dist/schedule/agenda.d.ts +63 -0
  154. package/dist/schedule/agenda.js +221 -0
  155. package/dist/schedule/day-strip.d.ts +50 -0
  156. package/dist/schedule/day-strip.js +136 -0
  157. package/dist/schedule/free-busy.d.ts +96 -0
  158. package/dist/schedule/free-busy.js +285 -0
  159. package/dist/schedule/index.d.ts +15 -0
  160. package/dist/schedule/index.js +15 -0
  161. package/dist/schedule/mixins/day-strip-scroll.d.ts +16 -0
  162. package/dist/schedule/mixins/day-strip-scroll.js +40 -0
  163. package/dist/schedule/mixins/time-grid-drag.d.ts +24 -0
  164. package/dist/schedule/mixins/time-grid-drag.js +532 -0
  165. package/dist/schedule/month-view.d.ts +68 -0
  166. package/dist/schedule/month-view.js +301 -0
  167. package/dist/schedule/time-grid.d.ts +168 -0
  168. package/dist/schedule/time-grid.js +417 -0
  169. package/dist/schedule/utils/time-grid-layout.d.ts +50 -0
  170. package/dist/schedule/utils/time-grid-layout.js +93 -0
  171. package/dist/schedule/year-view.d.ts +46 -0
  172. package/dist/schedule/year-view.js +142 -0
  173. package/dist/styles/index.d.ts +1 -0
  174. package/dist/styles/index.js +1 -0
  175. package/dist/styles/typewriter-text.d.ts +20 -0
  176. package/dist/styles/typewriter-text.js +23 -0
  177. package/dist/test/map.d.ts +18 -0
  178. package/dist/test/map.js +96 -0
  179. package/dist/test/reels.d.ts +30 -0
  180. package/dist/test/reels.js +41 -0
  181. package/dist/test/stories.d.ts +31 -0
  182. package/dist/test/stories.js +66 -0
  183. package/dist/travel/boarding-pass.d.ts +107 -0
  184. package/dist/travel/boarding-pass.js +293 -0
  185. package/dist/travel/car-offer.d.ts +70 -0
  186. package/dist/travel/car-offer.js +127 -0
  187. package/dist/travel/fare-calendar.d.ts +85 -0
  188. package/dist/travel/fare-calendar.js +233 -0
  189. package/dist/travel/fare-options.d.ts +84 -0
  190. package/dist/travel/fare-options.js +142 -0
  191. package/dist/travel/flight-itinerary.d.ts +84 -0
  192. package/dist/travel/flight-itinerary.js +112 -0
  193. package/dist/travel/flight-option.d.ts +58 -0
  194. package/dist/travel/flight-option.js +111 -0
  195. package/dist/travel/flight-segment.d.ts +105 -0
  196. package/dist/travel/flight-segment.js +174 -0
  197. package/dist/travel/index.d.ts +20 -0
  198. package/dist/travel/index.js +20 -0
  199. package/dist/travel/package-savings.d.ts +74 -0
  200. package/dist/travel/package-savings.js +128 -0
  201. package/dist/travel/price-breakdown.d.ts +66 -0
  202. package/dist/travel/price-breakdown.js +102 -0
  203. package/dist/travel/rating-breakdown.d.ts +81 -0
  204. package/dist/travel/rating-breakdown.js +132 -0
  205. package/dist/travel/seat-map.d.ts +108 -0
  206. package/dist/travel/seat-map.js +371 -0
  207. package/dist/travel/trip-timeline.d.ts +84 -0
  208. package/dist/travel/trip-timeline.js +212 -0
  209. package/dist/utils/gamepad-presses.d.ts +21 -0
  210. package/dist/utils/gamepad-presses.js +28 -0
  211. package/dist/utils/index.d.ts +5 -0
  212. package/dist/utils/index.js +5 -0
  213. package/dist/utils/move-focus.d.ts +20 -0
  214. package/dist/utils/move-focus.js +28 -0
  215. package/dist/utils/range-months.d.ts +54 -0
  216. package/dist/utils/range-months.js +98 -0
  217. package/dist/utils/swipe-direction.d.ts +23 -0
  218. package/dist/utils/swipe-direction.js +27 -0
  219. package/dist/utils/typewriter.d.ts +49 -0
  220. package/dist/utils/typewriter.js +171 -0
  221. package/dist/video/index.d.ts +6 -2
  222. package/dist/video/index.js +6 -2
  223. package/dist/video/mixins/reel-feed-sync.d.ts +41 -0
  224. package/dist/video/mixins/reel-feed-sync.js +430 -0
  225. package/dist/video/mixins/story-viewer-sync.d.ts +31 -0
  226. package/dist/video/mixins/story-viewer-sync.js +391 -0
  227. package/dist/video/reel-feed.d.ts +95 -0
  228. package/dist/video/reel-feed.js +124 -0
  229. package/dist/video/story-ring.d.ts +32 -0
  230. package/dist/video/story-ring.js +42 -0
  231. package/dist/video/story-viewer.d.ts +85 -0
  232. package/dist/video/story-viewer.js +250 -0
  233. package/package.json +21 -2
@@ -0,0 +1,176 @@
1
+ /**
2
+ * Script layer for a Lightbox `<dialog>`: Left/Right arrow keys step through the photos, a
3
+ * trigger opens the viewer as a modal at the photo it names, the step links scroll in place,
4
+ * and the photo in view is marked current and announced as the track scrolls.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import { createMixin } from "remix/component";
10
+ import { asCommandEvent } from "../utils/command-event.js";
11
+ /** Attribute on the scroll-snap track holding every slide. */
12
+ export const LIGHTBOX_TRACK_ATTRIBUTE = "data-lightbox-track";
13
+ /** Attribute on each slide, in photo order. */
14
+ export const LIGHTBOX_SLIDE_ATTRIBUTE = "data-lightbox-slide";
15
+ /** Attribute a trigger carries naming the zero-based photo it opens at. */
16
+ export const LIGHTBOX_INDEX_ATTRIBUTE = "data-lightbox-index";
17
+ /** Attribute a step link carries naming the zero-based photo it scrolls to. */
18
+ export const LIGHTBOX_STEP_ATTRIBUTE = "data-lightbox-to";
19
+ /** Attribute on the dialog naming the photo a server-opened viewer starts on. */
20
+ export const LIGHTBOX_INITIAL_ATTRIBUTE = "data-lightbox-initial";
21
+ /** Attribute on the polite live region that names the photo in view. */
22
+ export const LIGHTBOX_STATUS_ATTRIBUTE = "data-lightbox-status";
23
+ /** Attribute on each slide's counter and caption, read into the announcement. */
24
+ export const LIGHTBOX_ANNOUNCE_ATTRIBUTE = "data-lightbox-announce";
25
+ /**
26
+ * Parses a zero-based photo index out of an attribute value.
27
+ *
28
+ * @returns The index, or `null` for a missing or malformed value.
29
+ */
30
+ function parseIndex(value) {
31
+ if (value === null || value === undefined || value === "")
32
+ return null;
33
+ let index = Number(value);
34
+ return Number.isInteger(index) && index >= 0 ? index : null;
35
+ }
36
+ /** The viewer's slides in photo order. */
37
+ function slidesOf(viewer) {
38
+ return [...viewer.track.querySelectorAll(`[${LIGHTBOX_SLIDE_ATTRIBUTE}]`)];
39
+ }
40
+ /** Whether the track lays its photos out right to left, which flips the arrow keys. */
41
+ function isRightToLeft(node) {
42
+ return getComputedStyle(node).direction === "rtl";
43
+ }
44
+ /**
45
+ * The photo the track has settled nearest to. Every slide spans the track's full width, so
46
+ * the scroll offset over that width is the index.
47
+ */
48
+ function readIndex(viewer) {
49
+ let width = viewer.track.clientWidth;
50
+ if (width === 0)
51
+ return Math.max(0, viewer.current);
52
+ let last = slidesOf(viewer).length - 1;
53
+ return Math.max(0, Math.min(last, Math.round(Math.abs(viewer.track.scrollLeft) / width)));
54
+ }
55
+ /**
56
+ * Scrolls the track so photo `index` fills it. A step the visitor asked for animates unless
57
+ * they prefer reduced motion; opening at a photo always lands there instantly.
58
+ */
59
+ function goTo(viewer, index, instant) {
60
+ let slides = slidesOf(viewer);
61
+ let slide = slides[Math.max(0, Math.min(slides.length - 1, index))];
62
+ if (!slide)
63
+ return;
64
+ let trackBox = viewer.track.getBoundingClientRect();
65
+ let slideBox = slide.getBoundingClientRect();
66
+ let offset = isRightToLeft(viewer.track)
67
+ ? slideBox.right - trackBox.right
68
+ : slideBox.left - trackBox.left;
69
+ let reduced = matchMedia("(prefers-reduced-motion: reduce)").matches;
70
+ viewer.track.scrollTo({
71
+ left: viewer.track.scrollLeft + offset,
72
+ behavior: instant || reduced ? "instant" : "smooth",
73
+ });
74
+ sync(viewer);
75
+ }
76
+ /**
77
+ * Marks the photo in view with `data-current` and, when it changed, names it in the live
78
+ * region, so a screen reader hears "2 / 8" and the caption once per photo.
79
+ */
80
+ function sync(viewer) {
81
+ let index = readIndex(viewer);
82
+ let slides = slidesOf(viewer);
83
+ for (let [position, slide] of slides.entries()) {
84
+ if (position === index)
85
+ slide.setAttribute("data-current", "");
86
+ else
87
+ slide.removeAttribute("data-current");
88
+ }
89
+ if (index === viewer.current)
90
+ return;
91
+ viewer.current = index;
92
+ let status = viewer.dialog.querySelector(`[${LIGHTBOX_STATUS_ATTRIBUTE}]`);
93
+ let slide = slides[index];
94
+ if (!status || !slide)
95
+ return;
96
+ status.textContent = [...slide.querySelectorAll(`[${LIGHTBOX_ANNOUNCE_ATTRIBUTE}]`)]
97
+ .map((part) => part.textContent?.trim() ?? "")
98
+ .filter(Boolean)
99
+ .join(". ");
100
+ }
101
+ /**
102
+ * Opens the dialog as a modal at photo `index`. A viewer the server rendered open is a
103
+ * non-modal dialog, so it closes first and reopens in the top layer with focus trapped.
104
+ */
105
+ function openAt(viewer, index) {
106
+ if (viewer.dialog.open && !viewer.dialog.matches(":modal"))
107
+ viewer.dialog.close();
108
+ if (!viewer.dialog.open)
109
+ viewer.dialog.showModal();
110
+ goTo(viewer, index, true);
111
+ }
112
+ /** Wires the command, key, click and scroll listeners for one viewer until `signal` aborts. */
113
+ function listen(viewer, signal) {
114
+ let { dialog, track } = viewer;
115
+ dialog.addEventListener("command", (event) => {
116
+ let command = asCommandEvent(event);
117
+ if (command.command !== "show-modal")
118
+ return;
119
+ let source = command.source;
120
+ let index = source ? parseIndex(source.getAttribute(LIGHTBOX_INDEX_ATTRIBUTE)) : null;
121
+ event.preventDefault();
122
+ openAt(viewer, index ?? 0);
123
+ }, { signal });
124
+ dialog.addEventListener("keydown", (event) => {
125
+ if (event.key !== "ArrowLeft" && event.key !== "ArrowRight")
126
+ return;
127
+ if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey)
128
+ return;
129
+ let forward = (event.key === "ArrowRight") !== isRightToLeft(track);
130
+ event.preventDefault();
131
+ goTo(viewer, readIndex(viewer) + (forward ? 1 : -1), false);
132
+ }, { signal });
133
+ dialog.addEventListener("click", (event) => {
134
+ if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey)
135
+ return;
136
+ if (!(event.target instanceof Element))
137
+ return;
138
+ let link = event.target.closest(`[${LIGHTBOX_STEP_ATTRIBUTE}]`);
139
+ let index = link ? parseIndex(link.getAttribute(LIGHTBOX_STEP_ATTRIBUTE)) : null;
140
+ if (index === null)
141
+ return;
142
+ event.preventDefault();
143
+ goTo(viewer, index, false);
144
+ }, { signal });
145
+ track.addEventListener("scroll", () => sync(viewer), { signal, passive: true });
146
+ }
147
+ /**
148
+ * Attaches the viewer behavior to the `<dialog>` the host sits in, from insertion until
149
+ * removal. A dialog the server rendered open at a photo is upgraded to a modal there.
150
+ *
151
+ * @example
152
+ * <dialog id="photos">
153
+ * <span hidden mix={[lightboxControls()]} />
154
+ * <div data-lightbox-track>…</div>
155
+ * </dialog>
156
+ */
157
+ export const lightboxControls = createMixin((handle) => {
158
+ let controller;
159
+ handle.addEventListener("insert", (event) => {
160
+ controller?.abort();
161
+ let dialog = event.node.closest("dialog");
162
+ let track = dialog?.querySelector(`[${LIGHTBOX_TRACK_ATTRIBUTE}]`);
163
+ if (!dialog || !track)
164
+ return;
165
+ controller = new AbortController();
166
+ let viewer = { dialog, track, current: -1 };
167
+ listen(viewer, controller.signal);
168
+ let initial = parseIndex(dialog.getAttribute(LIGHTBOX_INITIAL_ATTRIBUTE));
169
+ if (dialog.open && initial !== null)
170
+ openAt(viewer, initial);
171
+ });
172
+ handle.addEventListener("remove", () => {
173
+ controller?.abort();
174
+ controller = undefined;
175
+ });
176
+ });
@@ -0,0 +1,63 @@
1
+ /**
2
+ * A calendar's schedule view: upcoming events grouped under a heading per day, each row a colour
3
+ * dot, its times in a fixed column, then its title and a detail line. Rows link, open a popover,
4
+ * or stay plain; the date gutter sits beside the day's events and stacks above them when narrow.
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 Agenda}. */
11
+ export declare namespace Agenda {
12
+ /** One event on a day. */
13
+ interface Event {
14
+ /** Unique on the agenda; prefixes the event's popover id. */
15
+ id: string;
16
+ title: string;
17
+ /** Its times as the reader reads them, such as "9:00 – 10:00 AM" or "All day". */
18
+ time: string;
19
+ /** Any CSS colour for the dot. @default the brand colour */
20
+ color?: string;
21
+ /** A muted line under the title, such as the place or the guests. */
22
+ detail?: RemixNode;
23
+ /** Makes the row a link; `popover` takes precedence over it. */
24
+ href?: string;
25
+ /** Opens in a popover anchored to the row. */
26
+ popover?: RemixNode;
27
+ /** Draws the dot hollow and hatched, for an invitation not yet answered. */
28
+ tentative?: boolean;
29
+ /** Dims the row, for an event already over. */
30
+ past?: boolean;
31
+ }
32
+ /** One day and its events, in the order they are listed. */
33
+ interface Day {
34
+ /** The day, as `YYYY-MM-DD`. */
35
+ date: string;
36
+ /** The day's own view, which its heading links to. */
37
+ href?: string;
38
+ events: Event[];
39
+ }
40
+ /** Props accepted by {@link Agenda}. */
41
+ interface Props extends Omit<TagProps<"section">, "children"> {
42
+ /** The region's accessible name, such as "Upcoming events". */
43
+ label: string;
44
+ /** Unique on the page; prefixes every event's popover id. */
45
+ id: string;
46
+ days: Day[];
47
+ /** Today, as `YYYY-MM-DD`; its heading takes the brand colour. */
48
+ today?: string;
49
+ /** Formats the day headings. @default "en" */
50
+ locale?: string;
51
+ /** Shown in place of the list when `days` is empty, such as "Nothing scheduled". */
52
+ empty?: RemixNode;
53
+ }
54
+ }
55
+ /**
56
+ * Renders the agenda: an ordered list of days, each a sticky date heading beside an ordered list
57
+ * of its events. Today's heading carries `aria-current="date"`, and an empty `days` shows `empty`.
58
+ *
59
+ * @example
60
+ * <Agenda id="upcoming" label="Upcoming" today="2026-11-18" days={[{ date: "2026-11-18",
61
+ * events: [{ id: "e1", title: "Standup", time: "9:00 – 9:15 AM", href: "/events/e1" }] }]} />
62
+ */
63
+ export declare function Agenda(handle: Handle<Agenda.Props>): () => import("remix/component").RemixElement;
@@ -0,0 +1,221 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "remix/component/jsx-runtime";
2
+ import { visuallyHidden } from "@sdxc/u/a11y";
3
+ import { mergeMix, raw } from "@sdxc/u/general";
4
+ import { motionReduce } from "@sdxc/u/responsive";
5
+ import { when } from "@sdxc/u/state";
6
+ import { Popover } from "../components/popover.js";
7
+ /** The container the rows and gutters query to decide between side by side and stacked. */
8
+ const CONTAINER = "ui-agenda";
9
+ /** The container width under which the date gutter stacks above its day's events. */
10
+ const STACK_WIDTH = "30rem";
11
+ /** The date gutter's width beside the events. */
12
+ const GUTTER = "var(--ui-agenda-gutter, 5.5rem)";
13
+ /** The time column's width, wide enough for a range such as "10:30 – 11:45 AM". */
14
+ const TIME = "var(--ui-agenda-time, 7.5rem)";
15
+ /** The locale the dates are formatted in when none is given. */
16
+ const DEFAULT_LOCALE = "en";
17
+ /** A `YYYY-MM-DD` day as a UTC instant, so its weekday and number never shift with a zone. */
18
+ function utcDay(date) {
19
+ return new Date(`${date.slice(0, 10)}T00:00:00Z`);
20
+ }
21
+ /**
22
+ * Renders the agenda: an ordered list of days, each a sticky date heading beside an ordered list
23
+ * of its events. Today's heading carries `aria-current="date"`, and an empty `days` shows `empty`.
24
+ *
25
+ * @example
26
+ * <Agenda id="upcoming" label="Upcoming" today="2026-11-18" days={[{ date: "2026-11-18",
27
+ * events: [{ id: "e1", title: "Standup", time: "9:00 – 9:15 AM", href: "/events/e1" }] }]} />
28
+ */
29
+ export function Agenda(handle) {
30
+ return () => {
31
+ let { id, label, days, today, locale, empty, mix, ...rest } = handle.props;
32
+ let resolved = locale ?? DEFAULT_LOCALE;
33
+ let number = new Intl.DateTimeFormat(resolved, { day: "numeric", timeZone: "UTC" });
34
+ let weekday = new Intl.DateTimeFormat(resolved, { weekday: "short", timeZone: "UTC" });
35
+ let month = new Intl.DateTimeFormat(resolved, { month: "short", timeZone: "UTC" });
36
+ let full = new Intl.DateTimeFormat(resolved, {
37
+ weekday: "long",
38
+ month: "long",
39
+ day: "numeric",
40
+ timeZone: "UTC",
41
+ });
42
+ return (_jsx("section", { ...rest, id: id, "aria-label": label, "data-slot": "agenda", mix: mergeMix([
43
+ raw({
44
+ containerName: CONTAINER,
45
+ containerType: "inline-size",
46
+ minInlineSize: "0",
47
+ fontVariantNumeric: "tabular-nums",
48
+ }),
49
+ ], mix), children: days.length === 0 ? (_jsx("div", { "data-slot": "agenda-empty", mix: [
50
+ raw({
51
+ paddingBlock: "2rem",
52
+ paddingInline: "1rem",
53
+ textAlign: "center",
54
+ color: "var(--ui-neutral-fg-muted)",
55
+ }),
56
+ ], children: empty })) : (_jsx("ol", { "data-slot": "agenda-days", mix: [raw({ margin: "0", padding: "0", listStyle: "none" })], children: days.map((day) => {
57
+ let instant = utcDay(day.date);
58
+ let isToday = day.date === today;
59
+ let content = (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": "true", "data-slot": "agenda-day-number", mix: [
60
+ raw({
61
+ fontSize: "1.5rem",
62
+ lineHeight: "1",
63
+ fontWeight: "600",
64
+ letterSpacing: "-0.02em",
65
+ color: "var(--ui-neutral-fg-emphasis)",
66
+ }),
67
+ when("[data-today] &", raw({ color: "var(--ui-brand-fg)" })),
68
+ ], children: number.format(instant) }), _jsxs("span", { "aria-hidden": "true", mix: [
69
+ raw({
70
+ display: "flex",
71
+ flexDirection: "column",
72
+ fontSize: "0.6875rem",
73
+ lineHeight: "0.875rem",
74
+ fontWeight: "600",
75
+ letterSpacing: "0.04em",
76
+ textTransform: "uppercase",
77
+ color: "var(--ui-neutral-fg-muted)",
78
+ }),
79
+ when("[data-today] &", raw({ color: "var(--ui-brand-fg)" })),
80
+ ], children: [_jsx("span", { children: weekday.format(instant) }), _jsx("span", { mix: [raw({ fontWeight: "500" })], children: month.format(instant) })] }), _jsx("span", { mix: [visuallyHidden()], children: full.format(instant) })] }));
81
+ let dateMix = [
82
+ raw({
83
+ display: "inline-flex",
84
+ alignItems: "center",
85
+ gap: "0.375rem",
86
+ paddingBlock: "0.25rem",
87
+ paddingInline: "0.375rem",
88
+ marginInline: "-0.375rem",
89
+ borderRadius: "0.5rem",
90
+ color: "inherit",
91
+ textDecoration: "none",
92
+ outline: "none",
93
+ }),
94
+ when("&[href]:hover", raw({ backgroundColor: "var(--ui-neutral-bg-tint)" })),
95
+ when("&:focus-visible", raw({ boxShadow: "0 0 0 2px var(--ui-brand-ring)" })),
96
+ ];
97
+ return (_jsxs("li", { "data-slot": "agenda-day", "data-date": day.date, "data-today": isToday ? "" : undefined, mix: [
98
+ raw({
99
+ display: "grid",
100
+ gridTemplateColumns: `${GUTTER} minmax(0, 1fr)`,
101
+ columnGap: "0.75rem",
102
+ paddingBlock: "0.75rem",
103
+ borderBlockStart: "1px solid var(--ui-neutral-border)",
104
+ "&:first-child": { borderBlockStart: "none" },
105
+ [`@container ${CONTAINER} (max-width: ${STACK_WIDTH})`]: {
106
+ gridTemplateColumns: "minmax(0, 1fr)",
107
+ paddingBlockStart: "0",
108
+ },
109
+ }),
110
+ ], children: [_jsx("h3", { "data-slot": "agenda-date", mix: [
111
+ raw({
112
+ position: "sticky",
113
+ insetBlockStart: "0",
114
+ zIndex: "1",
115
+ alignSelf: "start",
116
+ margin: "0",
117
+ paddingBlock: "0.25rem",
118
+ fontSize: "inherit",
119
+ fontWeight: "inherit",
120
+ backgroundColor: "var(--ui-bg, Canvas)",
121
+ [`@container ${CONTAINER} (max-width: ${STACK_WIDTH})`]: {
122
+ paddingBlock: "0.5rem 0.25rem",
123
+ borderBlockEnd: "1px solid var(--ui-neutral-border)",
124
+ marginBlockEnd: "0.25rem",
125
+ },
126
+ }),
127
+ ], children: day.href === undefined ? (_jsx("span", { "aria-current": isToday ? "date" : undefined, mix: dateMix, children: content })) : (_jsx("a", { href: day.href, "aria-current": isToday ? "date" : undefined, mix: dateMix, children: content })) }), _jsx("ol", { "data-slot": "agenda-events", mix: [
128
+ raw({
129
+ display: "flex",
130
+ flexDirection: "column",
131
+ gap: "0.125rem",
132
+ minInlineSize: "0",
133
+ margin: "0",
134
+ padding: "0",
135
+ listStyle: "none",
136
+ }),
137
+ ], children: day.events.map((event) => (_jsx(AgendaRow, { event: event, popoverId: `${id}-event-${event.id}-popover` }))) })] }));
138
+ }) })) }));
139
+ };
140
+ }
141
+ /**
142
+ * One event's row: a button opening its popover when it has one, a link when it has an address,
143
+ * and plain text otherwise. The dot takes the event's colour through `--ui-agenda-color`.
144
+ */
145
+ function AgendaRow(handle) {
146
+ return () => {
147
+ let { event, popoverId } = handle.props;
148
+ let content = (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": "true", "data-slot": "agenda-dot", mix: [
149
+ raw({
150
+ alignSelf: "start",
151
+ marginBlockStart: "0.3125rem",
152
+ boxSizing: "border-box",
153
+ inlineSize: "0.625rem",
154
+ blockSize: "0.625rem",
155
+ borderRadius: "999px",
156
+ backgroundColor: "var(--ui-agenda-color)",
157
+ "[data-tentative] &": {
158
+ backgroundColor: "var(--ui-bg, Canvas)",
159
+ backgroundImage: "repeating-linear-gradient(135deg, transparent 0 1.5px, var(--ui-agenda-color) 1.5px 3px)",
160
+ boxShadow: "inset 0 0 0 1.5px var(--ui-agenda-color)",
161
+ },
162
+ }),
163
+ ] }), _jsx("span", { "data-slot": "agenda-time", mix: [
164
+ raw({
165
+ fontSize: "0.8125rem",
166
+ color: "var(--ui-neutral-fg-muted)",
167
+ fontVariantNumeric: "tabular-nums",
168
+ }),
169
+ ], children: event.time }), _jsxs("span", { mix: [
170
+ raw({
171
+ display: "flex",
172
+ flexDirection: "column",
173
+ minInlineSize: "0",
174
+ overflowWrap: "anywhere",
175
+ }),
176
+ ], children: [_jsx("span", { "data-slot": "agenda-title", mix: [raw({ fontWeight: "600", color: "var(--ui-neutral-fg-emphasis)" })], children: event.title }), event.detail === undefined ? null : (_jsx("span", { "data-slot": "agenda-detail", mix: [
177
+ raw({
178
+ fontSize: "0.8125rem",
179
+ lineHeight: "1.125rem",
180
+ color: "var(--ui-neutral-fg-muted)",
181
+ }),
182
+ ], children: event.detail }))] })] }));
183
+ return (_jsxs("li", { "data-slot": "agenda-event", "data-id": event.id, "data-tentative": event.tentative ? "" : undefined, "data-past": event.past ? "" : undefined, style: `--ui-agenda-color: ${event.color ?? "var(--ui-brand-bg-solid)"}`, children: [_jsx(RowFace, { popoverId: event.popover === undefined ? undefined : popoverId, href: event.href, children: content }), event.popover === undefined ? null : (_jsx(Popover, { id: popoverId, placement: "bottom-start", children: event.popover }))] }));
184
+ };
185
+ }
186
+ /** A row's face: the button opening its popover, its link, or a plain block. */
187
+ function RowFace(handle) {
188
+ return () => {
189
+ let { popoverId, href, children } = handle.props;
190
+ let mix = [
191
+ raw({
192
+ all: "unset",
193
+ boxSizing: "border-box",
194
+ display: "grid",
195
+ gridTemplateColumns: `0.625rem ${TIME} minmax(0, 1fr)`,
196
+ alignItems: "baseline",
197
+ columnGap: "0.625rem",
198
+ inlineSize: "100%",
199
+ paddingBlock: "0.375rem",
200
+ paddingInline: "0.5rem",
201
+ borderRadius: "0.5rem",
202
+ fontSize: "0.875rem",
203
+ lineHeight: "1.25rem",
204
+ textAlign: "start",
205
+ color: "var(--ui-neutral-fg)",
206
+ textDecoration: "none",
207
+ transition: "background-color 120ms",
208
+ "&:is(a, button)": { cursor: "pointer" },
209
+ "&:is(a, button):hover": { backgroundColor: "var(--ui-neutral-bg-tint)" },
210
+ "&:focus-visible": { boxShadow: "0 0 0 2px var(--ui-brand-ring)" },
211
+ "[data-past] > &": { opacity: "0.6" },
212
+ }),
213
+ motionReduce(raw({ transition: "none" })),
214
+ ];
215
+ if (popoverId !== undefined)
216
+ return (_jsx("button", { type: "button", popovertarget: popoverId, "data-slot": "agenda-row", mix: mix, children: children }));
217
+ if (href !== undefined)
218
+ return (_jsx("a", { href: href, "data-slot": "agenda-row", mix: mix, children: children }));
219
+ return (_jsx("div", { "data-slot": "agenda-row", mix: mix, children: children }));
220
+ };
221
+ }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * A strip of days in one sideways scroller: each day a column of its short weekday, its number
3
+ * and an optional note (an event dot, a bill and its amount), as a link when it leads somewhere.
4
+ * A phone's calendar reads it as its month, and it snaps day by day without widening the page.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import type { EntryComponent, Handle, Props as TagProps, RemixNode } from "remix/component";
10
+ /** Prop types for {@link DayStrip}. */
11
+ export declare namespace DayStrip {
12
+ /** One day on the strip. */
13
+ interface Day {
14
+ /** The day, as `YYYY-MM-DD`. */
15
+ date: string;
16
+ /** Where the day leads; a day without one is a plain cell. */
17
+ href?: string;
18
+ /** The day the page shows; sets `aria-current="date"` and keeps it in view. */
19
+ current?: boolean;
20
+ /** Drawn under the number, such as event dots or an amount; two short lines at most. */
21
+ note?: RemixNode;
22
+ /** What the note means for a screen reader, such as "3 events". */
23
+ label?: string;
24
+ }
25
+ /** Props accepted by {@link DayStrip}. */
26
+ interface Props extends Omit<TagProps<"nav">, "children"> {
27
+ /** The landmark's name, such as "November 2026". */
28
+ label: string;
29
+ days: Day[];
30
+ /** Today, as `YYYY-MM-DD`, drawn with a ring. */
31
+ today?: string;
32
+ /** Formats the weekday names and the days' accessible names. @default "en" */
33
+ locale?: string;
34
+ }
35
+ }
36
+ /**
37
+ * Client island: keeps the current day in view once the strip is laid out, so a phone opens on
38
+ * the day it shows. Loads from `@sdxc/ui/schedule/day-strip#DayStripScroll`.
39
+ */
40
+ export declare const DayStripScroll: EntryComponent<Record<never, never>>;
41
+ /**
42
+ * Renders the strip: a list of day cells in a scroller that snaps to each one. The current day
43
+ * fills with the brand colour, today wears a ring, and weekends dim their weekday name.
44
+ *
45
+ * @example
46
+ * <DayStrip label="November 2026" today="2026-11-18" days={[
47
+ * { date: "2026-11-18", href: "?day=2026-11-18", current: true, note: <Dot />, label: "2 events" },
48
+ * ]} />
49
+ */
50
+ export declare function DayStrip(handle: Handle<DayStrip.Props>): () => import("remix/component").RemixElement;
@@ -0,0 +1,136 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "remix/component/jsx-runtime";
2
+ import { visuallyHidden } from "@sdxc/u/a11y";
3
+ import { mergeMix, raw } from "@sdxc/u/general";
4
+ import { motionReduce } from "@sdxc/u/responsive";
5
+ import { when } from "@sdxc/u/state";
6
+ import { clientEntry } from "remix/component";
7
+ import { dayStripScroll } from "./mixins/day-strip-scroll.js";
8
+ /** A cell's width when the consumer sets no `--ui-day-strip-cell`. */
9
+ const CELL = "var(--ui-day-strip-cell, 3rem)";
10
+ /**
11
+ * Client island: keeps the current day in view once the strip is laid out, so a phone opens on
12
+ * the day it shows. Loads from `@sdxc/ui/schedule/day-strip#DayStripScroll`.
13
+ */
14
+ export const DayStripScroll = clientEntry("@sdxc/ui/schedule/day-strip#DayStripScroll", function DayStripScroll() {
15
+ return () => _jsx("span", { hidden: true, "data-slot": "day-strip-scroll", mix: [dayStripScroll()] });
16
+ });
17
+ /** A `YYYY-MM-DD` day as a UTC instant, so its weekday and number never shift with a zone. */
18
+ function utcDay(date) {
19
+ return new Date(`${date.slice(0, 10)}T00:00:00Z`);
20
+ }
21
+ /**
22
+ * Renders the strip: a list of day cells in a scroller that snaps to each one. The current day
23
+ * fills with the brand colour, today wears a ring, and weekends dim their weekday name.
24
+ *
25
+ * @example
26
+ * <DayStrip label="November 2026" today="2026-11-18" days={[
27
+ * { date: "2026-11-18", href: "?day=2026-11-18", current: true, note: <Dot />, label: "2 events" },
28
+ * ]} />
29
+ */
30
+ export function DayStrip(handle) {
31
+ return () => {
32
+ let { label, days, today, locale = "en", mix, ...rest } = handle.props;
33
+ let weekday = new Intl.DateTimeFormat(locale, { weekday: "short", timeZone: "UTC" });
34
+ let number = new Intl.DateTimeFormat(locale, { day: "numeric", timeZone: "UTC" });
35
+ let full = new Intl.DateTimeFormat(locale, { dateStyle: "full", timeZone: "UTC" });
36
+ return (_jsxs("nav", { ...rest, "aria-label": label, "data-slot": "day-strip", mix: mergeMix([
37
+ raw({
38
+ position: "relative",
39
+ minInlineSize: "0",
40
+ overflowX: "auto",
41
+ overscrollBehaviorInline: "contain",
42
+ scrollSnapType: "x proximity",
43
+ scrollPaddingInline: "0.5rem",
44
+ scrollbarWidth: "none",
45
+ "&::-webkit-scrollbar": { display: "none" },
46
+ }),
47
+ ], mix), children: [_jsx("ol", { "data-slot": "day-strip-days", mix: [
48
+ raw({
49
+ display: "flex",
50
+ gap: "0.25rem",
51
+ margin: "0",
52
+ padding: "0.25rem 0.5rem",
53
+ listStyle: "none",
54
+ inlineSize: "max-content",
55
+ }),
56
+ ], children: days.map((day) => {
57
+ let instant = utcDay(day.date);
58
+ let weekend = [0, 6].includes(instant.getUTCDay());
59
+ let content = (_jsxs(_Fragment, { children: [_jsx("span", { "data-slot": "day-strip-weekday", "aria-hidden": "true", mix: [
60
+ raw({
61
+ fontSize: "0.6875rem",
62
+ lineHeight: "1rem",
63
+ fontWeight: "500",
64
+ textTransform: "uppercase",
65
+ letterSpacing: "0.04em",
66
+ color: "var(--ui-neutral-fg-muted)",
67
+ }),
68
+ when("[data-weekend] > &", raw({ opacity: "0.7" })),
69
+ when("[aria-current='date'] > &", raw({ color: "inherit", opacity: "0.85" })),
70
+ ], children: weekday.format(instant) }), _jsx("span", { "data-slot": "day-strip-number", "aria-hidden": "true", mix: [
71
+ raw({
72
+ display: "grid",
73
+ placeItems: "center",
74
+ inlineSize: "2rem",
75
+ blockSize: "2rem",
76
+ borderRadius: "999px",
77
+ fontSize: "0.9375rem",
78
+ fontWeight: "600",
79
+ fontVariantNumeric: "tabular-nums",
80
+ }),
81
+ when("[data-today]:not([aria-current='date']) > &", raw({
82
+ color: "var(--ui-brand-fg)",
83
+ boxShadow: "inset 0 0 0 1.5px currentColor",
84
+ })),
85
+ ], children: number.format(instant) }), day.note === undefined ? null : (_jsx("span", { "data-slot": "day-strip-note", "aria-hidden": "true", mix: [
86
+ raw({
87
+ display: "flex",
88
+ alignItems: "center",
89
+ justifyContent: "center",
90
+ gap: "0.125rem",
91
+ minBlockSize: "0.875rem",
92
+ maxInlineSize: "100%",
93
+ fontSize: "0.6875rem",
94
+ lineHeight: "0.875rem",
95
+ fontVariantNumeric: "tabular-nums",
96
+ overflow: "hidden",
97
+ textAlign: "center",
98
+ }),
99
+ ], children: day.note })), _jsxs("span", { mix: [visuallyHidden()], children: [full.format(instant), day.label === undefined ? "" : `, ${day.label}`] })] }));
100
+ let cell = [
101
+ raw({
102
+ position: "relative",
103
+ display: "flex",
104
+ flexDirection: "column",
105
+ alignItems: "center",
106
+ gap: "0.125rem",
107
+ boxSizing: "border-box",
108
+ inlineSize: CELL,
109
+ minBlockSize: "3.5rem",
110
+ paddingBlock: "0.375rem",
111
+ borderRadius: "0.75rem",
112
+ color: "var(--ui-neutral-fg)",
113
+ textDecoration: "none",
114
+ outline: "none",
115
+ transition: "background-color 120ms",
116
+ WebkitTapHighlightColor: "transparent",
117
+ }),
118
+ when("&[href]:hover", raw({ backgroundColor: "var(--ui-neutral-bg-tint)" })),
119
+ when("&[aria-current='date']", raw({
120
+ backgroundColor: "var(--ui-brand-bg-solid)",
121
+ color: "var(--ui-brand-fg-on-solid, white)",
122
+ })),
123
+ when("&:focus-visible", raw({ boxShadow: "0 0 0 2px var(--ui-brand-ring)" })),
124
+ motionReduce(raw({ transition: "none" })),
125
+ ];
126
+ let attributes = {
127
+ "data-slot": "day-strip-day",
128
+ "data-date": day.date,
129
+ "data-today": day.date === today ? "" : undefined,
130
+ "data-weekend": weekend ? "" : undefined,
131
+ "aria-current": day.current ? "date" : undefined,
132
+ };
133
+ return (_jsx("li", { mix: [raw({ scrollSnapAlign: "center" })], children: day.href === undefined ? (_jsx("span", { ...attributes, mix: cell, children: content })) : (_jsx("a", { ...attributes, href: day.href, mix: cell, children: content })) }));
134
+ }) }), _jsx(DayStripScroll, {})] }));
135
+ };
136
+ }