@sdxc/ui 2026.11.17 → 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 +139 -2
- 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/mixins/video-player-sync.js +138 -5
- 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/dist/video/video-card.d.ts +3 -1
- package/dist/video/video-card.js +15 -5
- package/dist/video/video-player.d.ts +33 -0
- package/dist/video/video-player.js +226 -20
- package/package.json +21 -2
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A "find a time" grid: one row per person over one day's hours, their busy blocks and the hours
|
|
3
|
+
* outside their working day drawn on a track, and the suggested slots everyone can make as bands
|
|
4
|
+
* across every row. The names stay put while the tracks scroll sideways inside their own box.
|
|
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 FreeBusy}. */
|
|
11
|
+
export declare namespace FreeBusy {
|
|
12
|
+
/** Every string a row announces; `{times}` marks where its ranges go. */
|
|
13
|
+
interface Labels {
|
|
14
|
+
/** A row with busy time, such as "Busy {times}". */
|
|
15
|
+
busy: string;
|
|
16
|
+
/** A row with nothing booked, such as "Free all day". */
|
|
17
|
+
free: string;
|
|
18
|
+
}
|
|
19
|
+
/** A busy stretch on one person's day. */
|
|
20
|
+
interface Busy {
|
|
21
|
+
/** Minutes from midnight. */
|
|
22
|
+
start: number;
|
|
23
|
+
/** Minutes from midnight. */
|
|
24
|
+
end: number;
|
|
25
|
+
/** Shown on the block and read in the row's summary in place of nothing. */
|
|
26
|
+
title?: string;
|
|
27
|
+
/** Draws it hatched, for an invitation not yet answered. */
|
|
28
|
+
tentative?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/** A stretch of minutes from midnight. */
|
|
31
|
+
interface Range {
|
|
32
|
+
start: number;
|
|
33
|
+
end: number;
|
|
34
|
+
}
|
|
35
|
+
/** One person's row. */
|
|
36
|
+
interface Person {
|
|
37
|
+
/** Unique on the grid. */
|
|
38
|
+
id: string;
|
|
39
|
+
name: string;
|
|
40
|
+
/** A muted line under the name, such as "Lisbon · 2:00 PM local". */
|
|
41
|
+
detail?: string;
|
|
42
|
+
avatar?: RemixNode;
|
|
43
|
+
busy: Busy[];
|
|
44
|
+
/** Outside their working hours, drawn as a hatch on a tint. */
|
|
45
|
+
outside?: Range[];
|
|
46
|
+
}
|
|
47
|
+
/** A suggested time everyone can make, drawn as a band across every row. */
|
|
48
|
+
interface Slot {
|
|
49
|
+
/** Minutes from midnight. */
|
|
50
|
+
start: number;
|
|
51
|
+
/** Minutes from midnight. */
|
|
52
|
+
end: number;
|
|
53
|
+
/** Makes the slot's label a link, such as one that books it. */
|
|
54
|
+
href?: string;
|
|
55
|
+
/** The slot's visible name, such as "10:00 – 10:30". */
|
|
56
|
+
label: string;
|
|
57
|
+
/** Outlines the band in the brand colour and sets `aria-current` on its link. */
|
|
58
|
+
selected?: boolean;
|
|
59
|
+
}
|
|
60
|
+
/** An hour label on the axis. */
|
|
61
|
+
interface Hour {
|
|
62
|
+
/** Minutes from midnight. */
|
|
63
|
+
minute: number;
|
|
64
|
+
label: string;
|
|
65
|
+
}
|
|
66
|
+
/** Props accepted by {@link FreeBusy}. */
|
|
67
|
+
interface Props extends Omit<TagProps<"div">, "children"> {
|
|
68
|
+
/** The grid's accessible name, such as "Availability on November 18". */
|
|
69
|
+
label: string;
|
|
70
|
+
/** The first visible minute from midnight, such as 480. */
|
|
71
|
+
start: number;
|
|
72
|
+
/** The last visible minute from midnight, such as 1140. */
|
|
73
|
+
end: number;
|
|
74
|
+
/** Minutes per column; the track's faint lines fall on it. @default 30 */
|
|
75
|
+
step?: number;
|
|
76
|
+
/** The axis labels; each also draws an hour line down the tracks. */
|
|
77
|
+
hours: Hour[];
|
|
78
|
+
people: Person[];
|
|
79
|
+
slots?: Slot[];
|
|
80
|
+
/** The present minute, drawn as a thin line. */
|
|
81
|
+
now?: number;
|
|
82
|
+
/** Writes the minutes in each row's summary. @default H:MM on a 24-hour clock */
|
|
83
|
+
formatTime?: (minute: number) => string;
|
|
84
|
+
labels: Labels;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Renders the grid: a sticky column of names beside a track per person, under an axis of hours
|
|
89
|
+
* and a row of slot labels. Every block is placed as a percentage of the visible range, so it
|
|
90
|
+
* lines up at any width; each name carries a hidden summary of that person's busy times.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* <FreeBusy label="Availability" start={480} end={1140} hours={hours} labels={labels}
|
|
94
|
+
* people={[{ id: "ana", name: "Ana", busy: [{ start: 540, end: 600 }] }]} />
|
|
95
|
+
*/
|
|
96
|
+
export declare function FreeBusy(handle: Handle<FreeBusy.Props>): () => import("remix/component").RemixElement;
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "remix/component/jsx-runtime";
|
|
2
|
+
import { visuallyHidden } from "@sdxc/u/a11y";
|
|
3
|
+
import { mergeMix, raw } from "@sdxc/u/general";
|
|
4
|
+
import { when } from "@sdxc/u/state";
|
|
5
|
+
/** The container the grid queries to narrow its names column on a small screen. */
|
|
6
|
+
const CONTAINER = "ui-free-busy";
|
|
7
|
+
/** The names column's width. */
|
|
8
|
+
const NAMES = "var(--ui-free-busy-names, 11rem)";
|
|
9
|
+
/** The names column's width inside a narrow container. */
|
|
10
|
+
const NARROW_NAMES = "var(--ui-free-busy-names-narrow, 7.5rem)";
|
|
11
|
+
/** The tracks column's least width, under which the grid scrolls sideways. */
|
|
12
|
+
const TRACKS = "var(--ui-free-busy-tracks, 36rem)";
|
|
13
|
+
/** The column granularity when `step` is unset. */
|
|
14
|
+
const DEFAULT_STEP = 30;
|
|
15
|
+
/** A minute as `H:MM` on a 24-hour clock, the formatter used when none is given. */
|
|
16
|
+
function defaultFormatTime(minute) {
|
|
17
|
+
let hours = Math.floor(minute / 60) % 24;
|
|
18
|
+
let rest = Math.round(minute % 60);
|
|
19
|
+
return `${hours}:${String(rest).padStart(2, "0")}`;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Renders the grid: a sticky column of names beside a track per person, under an axis of hours
|
|
23
|
+
* and a row of slot labels. Every block is placed as a percentage of the visible range, so it
|
|
24
|
+
* lines up at any width; each name carries a hidden summary of that person's busy times.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* <FreeBusy label="Availability" start={480} end={1140} hours={hours} labels={labels}
|
|
28
|
+
* people={[{ id: "ana", name: "Ana", busy: [{ start: 540, end: 600 }] }]} />
|
|
29
|
+
*/
|
|
30
|
+
export function FreeBusy(handle) {
|
|
31
|
+
return () => {
|
|
32
|
+
let { label, start, end, step, hours, people, slots = [], now, formatTime, labels, mix, ...rest } = handle.props;
|
|
33
|
+
let span = Math.max(1, end - start);
|
|
34
|
+
let format = formatTime ?? defaultFormatTime;
|
|
35
|
+
let columnStep = step ?? DEFAULT_STEP;
|
|
36
|
+
let percent = (minute) => `${((Math.min(end, Math.max(start, minute)) - start) / span) * 100}%`;
|
|
37
|
+
let width = (from, to) => `${((Math.min(end, to) - Math.max(start, from)) / span) * 100}%`;
|
|
38
|
+
let hasSlots = slots.length > 0;
|
|
39
|
+
let axisRow = hasSlots ? 2 : 1;
|
|
40
|
+
let firstPersonRow = axisRow + 1;
|
|
41
|
+
let lastRow = axisRow + people.length;
|
|
42
|
+
let stickyCell = raw({
|
|
43
|
+
position: "sticky",
|
|
44
|
+
insetInlineStart: "0",
|
|
45
|
+
zIndex: "4",
|
|
46
|
+
boxSizing: "border-box",
|
|
47
|
+
minInlineSize: "0",
|
|
48
|
+
backgroundColor: "var(--ui-bg, Canvas)",
|
|
49
|
+
borderInlineEnd: "1px solid var(--ui-neutral-border)",
|
|
50
|
+
});
|
|
51
|
+
return (_jsx("div", { ...rest, role: "group", "aria-label": label, "data-slot": "free-busy", mix: mergeMix([
|
|
52
|
+
raw({
|
|
53
|
+
containerName: CONTAINER,
|
|
54
|
+
containerType: "inline-size",
|
|
55
|
+
minInlineSize: "0",
|
|
56
|
+
maxInlineSize: "100%",
|
|
57
|
+
overflowX: "auto",
|
|
58
|
+
overscrollBehaviorInline: "contain",
|
|
59
|
+
fontVariantNumeric: "tabular-nums",
|
|
60
|
+
}),
|
|
61
|
+
], mix), children: _jsxs("div", { "data-slot": "free-busy-grid", style: `--ui-free-busy-step: ${(columnStep / span) * 100}%`, mix: [
|
|
62
|
+
raw({
|
|
63
|
+
position: "relative",
|
|
64
|
+
display: "grid",
|
|
65
|
+
gridTemplateColumns: `${NAMES} minmax(${TRACKS}, 1fr)`,
|
|
66
|
+
minInlineSize: "min-content",
|
|
67
|
+
[`@container ${CONTAINER} (max-width: 30rem)`]: {
|
|
68
|
+
gridTemplateColumns: `${NARROW_NAMES} minmax(${TRACKS}, 1fr)`,
|
|
69
|
+
},
|
|
70
|
+
}),
|
|
71
|
+
], children: [hasSlots ? (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": "true", mix: [stickyCell, raw({ gridRow: "1", gridColumn: "1" })] }), _jsx("div", { "data-slot": "free-busy-slots", mix: [
|
|
72
|
+
raw({
|
|
73
|
+
position: "relative",
|
|
74
|
+
gridRow: "1",
|
|
75
|
+
gridColumn: "2",
|
|
76
|
+
zIndex: "3",
|
|
77
|
+
blockSize: "2rem",
|
|
78
|
+
}),
|
|
79
|
+
], children: slots.map((slot) => (_jsx(SlotLabel, { slot: slot, left: percent(slot.start), width: width(slot.start, slot.end) }))) })] })) : null, _jsx("span", { "aria-hidden": "true", mix: [
|
|
80
|
+
stickyCell,
|
|
81
|
+
raw({
|
|
82
|
+
gridRow: `${axisRow}`,
|
|
83
|
+
gridColumn: "1",
|
|
84
|
+
borderBlockEnd: "1px solid var(--ui-neutral-border)",
|
|
85
|
+
}),
|
|
86
|
+
] }), _jsx("div", { "aria-hidden": "true", "data-slot": "free-busy-axis", mix: [
|
|
87
|
+
raw({
|
|
88
|
+
position: "relative",
|
|
89
|
+
gridRow: `${axisRow}`,
|
|
90
|
+
gridColumn: "2",
|
|
91
|
+
blockSize: "1.5rem",
|
|
92
|
+
borderBlockEnd: "1px solid var(--ui-neutral-border)",
|
|
93
|
+
fontSize: "0.6875rem",
|
|
94
|
+
lineHeight: "1.5rem",
|
|
95
|
+
color: "var(--ui-neutral-fg-muted)",
|
|
96
|
+
}),
|
|
97
|
+
], children: hours.map((hour) => (_jsx("span", { "data-minute": hour.minute, style: `inset-inline-start: ${percent(hour.minute)}`, mix: [
|
|
98
|
+
raw({
|
|
99
|
+
position: "absolute",
|
|
100
|
+
insetBlock: "0",
|
|
101
|
+
display: "flex",
|
|
102
|
+
justifyContent: "center",
|
|
103
|
+
inlineSize: "0",
|
|
104
|
+
whiteSpace: "nowrap",
|
|
105
|
+
"&[data-minute]:first-child": { justifyContent: "start" },
|
|
106
|
+
"&[data-minute]:last-child": { justifyContent: "end" },
|
|
107
|
+
}),
|
|
108
|
+
], children: hour.label }))) }), _jsx("div", { "aria-hidden": "true", "data-slot": "free-busy-lines", style: `grid-row: ${firstPersonRow} / ${lastRow + 1}`, mix: [
|
|
109
|
+
raw({
|
|
110
|
+
position: "relative",
|
|
111
|
+
gridColumn: "2",
|
|
112
|
+
zIndex: "0",
|
|
113
|
+
pointerEvents: "none",
|
|
114
|
+
backgroundImage: "repeating-linear-gradient(to right, color-mix(in oklch, var(--ui-neutral-border) 50%, transparent) 0 1px, transparent 1px var(--ui-free-busy-step))",
|
|
115
|
+
}),
|
|
116
|
+
], children: hours.map((hour) => (_jsx("span", { style: `inset-inline-start: ${percent(hour.minute)}`, mix: [
|
|
117
|
+
raw({
|
|
118
|
+
position: "absolute",
|
|
119
|
+
insetBlock: "0",
|
|
120
|
+
inlineSize: "1px",
|
|
121
|
+
backgroundColor: "var(--ui-neutral-border)",
|
|
122
|
+
}),
|
|
123
|
+
] }))) }), people.map((person, index) => (_jsx(PersonRow, { person: person, row: firstPersonRow + index, summary: summarize(person.busy, format, labels), percent: percent, width: width, start: start, end: end, stickyCell: stickyCell }))), _jsxs("div", { "aria-hidden": "true", "data-slot": "free-busy-overlay", style: `grid-row: 1 / ${lastRow + 1}`, mix: [
|
|
124
|
+
raw({
|
|
125
|
+
position: "relative",
|
|
126
|
+
gridColumn: "2",
|
|
127
|
+
zIndex: "2",
|
|
128
|
+
pointerEvents: "none",
|
|
129
|
+
}),
|
|
130
|
+
], children: [slots.map((slot) => (_jsx("span", { "data-slot": "free-busy-band", "data-selected": slot.selected ? "" : undefined, style: `inset-inline-start: ${percent(slot.start)}; inline-size: ${width(slot.start, slot.end)}`, mix: [
|
|
131
|
+
raw({
|
|
132
|
+
position: "absolute",
|
|
133
|
+
insetBlock: "0",
|
|
134
|
+
boxSizing: "border-box",
|
|
135
|
+
borderRadius: "0.375rem",
|
|
136
|
+
backgroundColor: "color-mix(in oklch, var(--ui-brand-bg-solid) 12%, transparent)",
|
|
137
|
+
"&[data-selected]": {
|
|
138
|
+
backgroundColor: "color-mix(in oklch, var(--ui-brand-bg-solid) 18%, transparent)",
|
|
139
|
+
boxShadow: "inset 0 0 0 2px var(--ui-brand-bg-solid)",
|
|
140
|
+
},
|
|
141
|
+
}),
|
|
142
|
+
] }))), now === undefined || now < start || now > end ? null : (_jsx("span", { "data-slot": "free-busy-now", style: `inset-inline-start: ${percent(now)}`, mix: [
|
|
143
|
+
raw({
|
|
144
|
+
position: "absolute",
|
|
145
|
+
insetBlockStart: hasSlots ? "2rem" : "0",
|
|
146
|
+
insetBlockEnd: "0",
|
|
147
|
+
inlineSize: "2px",
|
|
148
|
+
marginInlineStart: "-1px",
|
|
149
|
+
backgroundColor: "var(--ui-free-busy-now, var(--ui-danger-bg-solid, crimson))",
|
|
150
|
+
}),
|
|
151
|
+
] }))] })] }) }));
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
/** A row's summary: its busy ranges, each with its title when it has one, or the free label. */
|
|
155
|
+
function summarize(busy, format, labels) {
|
|
156
|
+
if (busy.length === 0)
|
|
157
|
+
return labels.free;
|
|
158
|
+
let times = [...busy]
|
|
159
|
+
.sort((a, b) => a.start - b.start)
|
|
160
|
+
.map((block) => {
|
|
161
|
+
let range = `${format(block.start)}–${format(block.end)}`;
|
|
162
|
+
return block.title === undefined ? range : `${block.title} ${range}`;
|
|
163
|
+
})
|
|
164
|
+
.join(", ");
|
|
165
|
+
return labels.busy.replace("{times}", times);
|
|
166
|
+
}
|
|
167
|
+
/** A slot's label in the top row: a link when it books something, focusable and clickable. */
|
|
168
|
+
function SlotLabel(handle) {
|
|
169
|
+
return () => {
|
|
170
|
+
let { slot, left, width } = handle.props;
|
|
171
|
+
let mix = [
|
|
172
|
+
raw({
|
|
173
|
+
position: "absolute",
|
|
174
|
+
insetBlock: "0.25rem",
|
|
175
|
+
boxSizing: "border-box",
|
|
176
|
+
display: "flex",
|
|
177
|
+
alignItems: "center",
|
|
178
|
+
justifyContent: "center",
|
|
179
|
+
paddingInline: "0.375rem",
|
|
180
|
+
borderRadius: "999px",
|
|
181
|
+
fontSize: "0.6875rem",
|
|
182
|
+
fontWeight: "600",
|
|
183
|
+
whiteSpace: "nowrap",
|
|
184
|
+
color: "var(--ui-brand-fg)",
|
|
185
|
+
backgroundColor: "color-mix(in oklch, var(--ui-brand-bg-solid) 12%, var(--ui-bg, Canvas))",
|
|
186
|
+
textDecoration: "none",
|
|
187
|
+
outline: "none",
|
|
188
|
+
}),
|
|
189
|
+
when("&[href]:hover", raw({ backgroundColor: "var(--ui-brand-bg-tint-hover)" })),
|
|
190
|
+
when("&[data-selected]", raw({
|
|
191
|
+
backgroundColor: "var(--ui-brand-bg-solid)",
|
|
192
|
+
color: "var(--ui-brand-fg-on-solid, white)",
|
|
193
|
+
})),
|
|
194
|
+
when("&:focus-visible", raw({ boxShadow: "0 0 0 2px var(--ui-brand-ring)" })),
|
|
195
|
+
];
|
|
196
|
+
let style = `inset-inline-start: ${left}; min-inline-size: ${width}`;
|
|
197
|
+
if (slot.href === undefined)
|
|
198
|
+
return (_jsx("span", { "data-slot": "free-busy-slot", "data-selected": slot.selected ? "" : undefined, style: style, mix: mix, children: slot.label }));
|
|
199
|
+
return (_jsx("a", { href: slot.href, "data-slot": "free-busy-slot", "data-selected": slot.selected ? "" : undefined, "aria-current": slot.selected ? "true" : undefined, style: style, mix: mix, children: slot.label }));
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
/** One person: a sticky name cell with the row's hidden summary, and a track of their day. */
|
|
203
|
+
function PersonRow(handle) {
|
|
204
|
+
return () => {
|
|
205
|
+
let { person, row, summary, percent, width, start, end, stickyCell } = handle.props;
|
|
206
|
+
let visible = (range) => range.end > start && range.start < end;
|
|
207
|
+
let place = (range) => `inset-inline-start: ${percent(range.start)}; inline-size: ${width(range.start, range.end)}`;
|
|
208
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { "data-slot": "free-busy-person", "data-id": person.id, style: `grid-row: ${row}`, mix: [
|
|
209
|
+
stickyCell,
|
|
210
|
+
raw({
|
|
211
|
+
gridColumn: "1",
|
|
212
|
+
display: "flex",
|
|
213
|
+
alignItems: "center",
|
|
214
|
+
gap: "0.5rem",
|
|
215
|
+
paddingBlock: "0.375rem",
|
|
216
|
+
paddingInline: "0.5rem",
|
|
217
|
+
borderBlockEnd: "1px solid var(--ui-neutral-border)",
|
|
218
|
+
}),
|
|
219
|
+
], children: [person.avatar === undefined ? null : (_jsx("span", { "aria-hidden": "true", mix: [
|
|
220
|
+
raw({
|
|
221
|
+
display: "flex",
|
|
222
|
+
flexShrink: "0",
|
|
223
|
+
inlineSize: "1.75rem",
|
|
224
|
+
blockSize: "1.75rem",
|
|
225
|
+
}),
|
|
226
|
+
], children: person.avatar })), _jsxs("span", { mix: [raw({ display: "flex", flexDirection: "column", minInlineSize: "0" })], children: [_jsx("span", { "data-slot": "free-busy-name", mix: [
|
|
227
|
+
raw({
|
|
228
|
+
fontSize: "0.8125rem",
|
|
229
|
+
lineHeight: "1.125rem",
|
|
230
|
+
fontWeight: "600",
|
|
231
|
+
color: "var(--ui-neutral-fg-emphasis)",
|
|
232
|
+
whiteSpace: "nowrap",
|
|
233
|
+
overflow: "hidden",
|
|
234
|
+
textOverflow: "ellipsis",
|
|
235
|
+
}),
|
|
236
|
+
], children: person.name }), person.detail === undefined ? null : (_jsx("span", { mix: [
|
|
237
|
+
raw({
|
|
238
|
+
fontSize: "0.6875rem",
|
|
239
|
+
lineHeight: "1rem",
|
|
240
|
+
color: "var(--ui-neutral-fg-muted)",
|
|
241
|
+
whiteSpace: "nowrap",
|
|
242
|
+
overflow: "hidden",
|
|
243
|
+
textOverflow: "ellipsis",
|
|
244
|
+
}),
|
|
245
|
+
], children: person.detail })), _jsx("span", { "data-slot": "free-busy-summary", mix: [visuallyHidden()], children: summary })] })] }), _jsxs("div", { "aria-hidden": "true", "data-slot": "free-busy-track", "data-id": person.id, style: `grid-row: ${row}`, mix: [
|
|
246
|
+
raw({
|
|
247
|
+
position: "relative",
|
|
248
|
+
zIndex: "1",
|
|
249
|
+
gridColumn: "2",
|
|
250
|
+
minBlockSize: "2.75rem",
|
|
251
|
+
borderBlockEnd: "1px solid var(--ui-neutral-border)",
|
|
252
|
+
}),
|
|
253
|
+
], children: [(person.outside ?? []).filter(visible).map((range) => (_jsx("span", { "data-slot": "free-busy-outside", style: place(range), mix: [
|
|
254
|
+
raw({
|
|
255
|
+
position: "absolute",
|
|
256
|
+
insetBlock: "0",
|
|
257
|
+
backgroundColor: "var(--ui-neutral-bg-tint)",
|
|
258
|
+
backgroundImage: "repeating-linear-gradient(135deg, transparent 0 4px, color-mix(in oklch, var(--ui-neutral-fg-muted) 22%, transparent) 4px 5px)",
|
|
259
|
+
}),
|
|
260
|
+
] }))), person.busy.filter(visible).map((block) => (_jsx("span", { "data-slot": "free-busy-block", "data-start": block.start, "data-end": block.end, "data-tentative": block.tentative ? "" : undefined, title: block.title, style: place(block), mix: [
|
|
261
|
+
raw({
|
|
262
|
+
position: "absolute",
|
|
263
|
+
insetBlock: "0.375rem",
|
|
264
|
+
boxSizing: "border-box",
|
|
265
|
+
display: "flex",
|
|
266
|
+
alignItems: "center",
|
|
267
|
+
paddingInline: "0.375rem",
|
|
268
|
+
overflow: "hidden",
|
|
269
|
+
borderRadius: "0.375rem",
|
|
270
|
+
boxShadow: "0 0 0 1px var(--ui-bg, Canvas)",
|
|
271
|
+
fontSize: "0.6875rem",
|
|
272
|
+
fontWeight: "500",
|
|
273
|
+
whiteSpace: "nowrap",
|
|
274
|
+
textOverflow: "ellipsis",
|
|
275
|
+
color: "var(--ui-neutral-fg-emphasis)",
|
|
276
|
+
backgroundColor: "color-mix(in oklch, var(--ui-neutral-fg-muted) 32%, var(--ui-bg, Canvas))",
|
|
277
|
+
"&[data-tentative]": {
|
|
278
|
+
backgroundColor: "var(--ui-bg, Canvas)",
|
|
279
|
+
backgroundImage: "repeating-linear-gradient(135deg, transparent 0 4px, color-mix(in oklch, var(--ui-neutral-fg-muted) 32%, transparent) 4px 8px)",
|
|
280
|
+
boxShadow: "inset 0 0 0 1px color-mix(in oklch, var(--ui-neutral-fg-muted) 45%, transparent)",
|
|
281
|
+
},
|
|
282
|
+
}),
|
|
283
|
+
], children: block.title })))] })] }));
|
|
284
|
+
};
|
|
285
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Barrel for `@sdxc/ui/schedule`: the pieces of a calendar or scheduling app (a time grid of days and hours, a
|
|
3
|
+
* month, an agenda, a strip of days, and a people-by-hours availability grid). Each component also
|
|
4
|
+
* imports on its own as `@sdxc/ui/schedule/<module>`.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
export * from "./agenda.js";
|
|
10
|
+
export * from "./day-strip.js";
|
|
11
|
+
export * from "./free-busy.js";
|
|
12
|
+
export * from "./month-view.js";
|
|
13
|
+
export * from "./time-grid.js";
|
|
14
|
+
export * from "./year-view.js";
|
|
15
|
+
export * from "./utils/time-grid-layout.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Barrel for `@sdxc/ui/schedule`: the pieces of a calendar or scheduling app (a time grid of days and hours, a
|
|
3
|
+
* month, an agenda, a strip of days, and a people-by-hours availability grid). Each component also
|
|
4
|
+
* imports on its own as `@sdxc/ui/schedule/<module>`.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
export * from "./agenda.js";
|
|
10
|
+
export * from "./day-strip.js";
|
|
11
|
+
export * from "./free-busy.js";
|
|
12
|
+
export * from "./month-view.js";
|
|
13
|
+
export * from "./time-grid.js";
|
|
14
|
+
export * from "./year-view.js";
|
|
15
|
+
export * from "./utils/time-grid-layout.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why JS: a scroller opens at its start, and only script can bring the current day into view.
|
|
3
|
+
* No-JS baseline: the strip opens on its first day, and the current one is a swipe away with
|
|
4
|
+
* its highlight intact.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
import type { MixinFactory } from "remix/component";
|
|
10
|
+
/**
|
|
11
|
+
* Applied to a marker inside a `DayStrip`: once laid out, centres the current day (or today,
|
|
12
|
+
* when none is current) in the strip. A strip the reader already scrolled is left where it is.
|
|
13
|
+
*
|
|
14
|
+
* @example <span hidden mix={[dayStripScroll()]} />
|
|
15
|
+
*/
|
|
16
|
+
export declare const dayStripScroll: MixinFactory<HTMLElement>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why JS: a scroller opens at its start, and only script can bring the current day into view.
|
|
3
|
+
* No-JS baseline: the strip opens on its first day, and the current one is a swipe away with
|
|
4
|
+
* its highlight intact.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
import { createMixin } from "remix/component";
|
|
10
|
+
/**
|
|
11
|
+
* Applied to a marker inside a `DayStrip`: once laid out, centres the current day (or today,
|
|
12
|
+
* when none is current) in the strip. A strip the reader already scrolled is left where it is.
|
|
13
|
+
*
|
|
14
|
+
* @example <span hidden mix={[dayStripScroll()]} />
|
|
15
|
+
*/
|
|
16
|
+
export const dayStripScroll = createMixin((handle) => {
|
|
17
|
+
let frame;
|
|
18
|
+
/** Waits for layout, then centres the day without animating, so nothing slides on load. */
|
|
19
|
+
function attach(event) {
|
|
20
|
+
let marker = event.node;
|
|
21
|
+
frame = requestAnimationFrame(() => {
|
|
22
|
+
let strip = marker.closest('[data-slot="day-strip"]');
|
|
23
|
+
let day = strip?.querySelector('[aria-current="date"]') ??
|
|
24
|
+
strip?.querySelector("[data-today]");
|
|
25
|
+
if (!strip || !day || strip.scrollLeft !== 0)
|
|
26
|
+
return;
|
|
27
|
+
let offset = day.getBoundingClientRect().left -
|
|
28
|
+
strip.getBoundingClientRect().left -
|
|
29
|
+
(strip.clientWidth - day.offsetWidth) / 2;
|
|
30
|
+
strip.scrollLeft = Math.max(0, offset);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/** Drops a scroll that has not run yet. */
|
|
34
|
+
function detach() {
|
|
35
|
+
if (frame !== undefined)
|
|
36
|
+
cancelAnimationFrame(frame);
|
|
37
|
+
}
|
|
38
|
+
handle.addEventListener("insert", attach);
|
|
39
|
+
handle.addEventListener("remove", detach);
|
|
40
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why JS: a scroller opens at midnight, a line drawn on the server stays at the minute it was
|
|
3
|
+
* drawn, and a pointer has no way to say "from here to here". No-JS baseline: the grid opens at
|
|
4
|
+
* its first hour, and each event's own form moves, resizes and creates it.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
import type { MixinFactory } from "remix/component";
|
|
10
|
+
/** Options {@link timeGridDrag} reads. */
|
|
11
|
+
export interface TimeGridDragOptions {
|
|
12
|
+
/** What a keyboard move announces, with `{title}` and `{time}`. */
|
|
13
|
+
moved: string;
|
|
14
|
+
/** What a keyboard resize announces, with `{title}` and `{time}`. */
|
|
15
|
+
resized: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Applied to a marker inside a `TimeGrid`: opens the grid scrolled to its working day (or where
|
|
19
|
+
* it was), moves the now line with the clock, and turns drags and Alt+arrow keys into posts of
|
|
20
|
+
* the grid's create and move forms.
|
|
21
|
+
*
|
|
22
|
+
* @example <span hidden mix={[timeGridDrag({ moved: "{title} moved to {time}", resized: "{title} now ends at {time}" })]} />
|
|
23
|
+
*/
|
|
24
|
+
export declare const timeGridDrag: MixinFactory<HTMLElement, [options: TimeGridDragOptions]>;
|