@sincpro/web-ui 2.15.0 → 2.16.0
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 +13 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/media/Carousel.d.ts +34 -0
- package/dist/components/media/Carousel.js +148 -0
- package/dist/components/media/Stories.d.ts +71 -0
- package/dist/components/media/Stories.js +174 -0
- package/dist/components/media/index.d.ts +2 -0
- package/dist/components/media/index.js +4 -0
- package/dist/components/media/motion.d.ts +7 -0
- package/dist/components/media/motion.js +17 -0
- package/dist/components/navigation/PortalNav.d.ts +49 -0
- package/dist/components/navigation/PortalNav.js +40 -0
- package/dist/components/navigation/index.d.ts +1 -0
- package/dist/components/navigation/index.js +3 -0
- package/dist/components/preview/FilePreview.d.ts +5 -3
- package/dist/components/preview/FilePreview.js +39 -3
- package/dist/components/preview/index.d.ts +1 -1
- package/dist/components/preview/index.js +1 -1
- package/dist/components/preview/previewKind.d.ts +12 -2
- package/dist/components/preview/previewKind.js +44 -2
- package/dist/components/shell/Notifications.d.ts +64 -0
- package/dist/components/shell/Notifications.js +84 -0
- package/dist/components/shell/index.d.ts +1 -0
- package/dist/components/shell/index.js +3 -0
- package/dist/foundations/copy.es.js +31 -0
- package/dist/foundations/uiCopy.d.ts +53 -0
- package/dist/foundations/uiCopy.js +38 -1
- package/dist/primitives/choice/CheckField.d.ts +26 -0
- package/dist/primitives/choice/CheckField.js +45 -0
- package/dist/primitives/choice/index.d.ts +1 -0
- package/dist/primitives/choice/index.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -364,7 +364,11 @@ The parts: `button`, `icon-button`, `control`, `popover`, `menu`, `menu.trigger`
|
|
|
364
364
|
`frame`, `frame.banner`, `frame.bar`, `frame.sidebar`, `frame.main`, `banner`, `banner.action`,
|
|
365
365
|
`inbox`, `inbox.item` (with `data-unread`), `kbd`, `plans`, `plan` (with `data-highlight`, `data-current`), `plan.highlight`, `plan.price`,
|
|
366
366
|
`plan.features`, `plan.action`, `qr`, `price`, `price.before`, `range-slider`, `rating`, `gallery`,
|
|
367
|
-
`gallery.main`, `gallery.strip`, `lightbox`, `
|
|
367
|
+
`gallery.main`, `gallery.strip`, `lightbox`, `carousel`, `carousel.track`, `carousel.slide`,
|
|
368
|
+
`carousel.dots`, `story-ring` (with `data-seen`), `story-bar`, `story-viewer`, `story-viewer.progress`,
|
|
369
|
+
`story-viewer.media`, `notification-bell`, `notification-panel`, `notification-panel.group`,
|
|
370
|
+
`notification-panel.item` (with `data-unread`), `portal-nav`, `portal-nav.person`, `portal-nav.toggle`,
|
|
371
|
+
`portal-nav.sections`, `check-field`, `file-preview.video`, `file-preview.audio`, `file-preview.office` (with `data-kind`), `sidebar`, `sidebar.brand`,
|
|
368
372
|
`sidebar.user`, `sidebar.search`, `sidebar.nav`, `sidebar.account`, `navigation`,
|
|
369
373
|
`navigation.item`, `dirty.blocked`, `dirty.bar`, `field`, `field.label`, `form.section`,
|
|
370
374
|
`form.index`, `dock`, `dock.pill`, `dock.bare`, `pager`, `pagination`, `smart`, `guide`, `guide.veil`, `guide.spot`, `guide.card`,
|
|
@@ -395,6 +399,14 @@ computed), `Rating` (an average with its figure, or the opinion asked), `Gallery
|
|
|
395
399
|
full-size `Lightbox`), `Inbox` (the bell in `TopBar systray`, or `InboxList` as a page), and
|
|
396
400
|
`Banner` — a notice about the whole application, in `AppFrame banner`.
|
|
397
401
|
|
|
402
|
+
For a public site and a member portal (server-rendered, as in Next.js): `Carousel` (a hero that
|
|
403
|
+
turns, a news strip — scroll-snap, `slidesPerView` by width, autoplay that stops on hover, focus
|
|
404
|
+
and «reduce motion»), the stories (`StoryBar` of `StoryRing`s and the full-screen `StoryViewer`),
|
|
405
|
+
`NotificationBell` with a `NotificationPanel` in any header, `PortalNav` (a portal's menu with
|
|
406
|
+
real links, folded into one button on a phone), and `CheckField` — a yes/no row that lines up in
|
|
407
|
+
`FormSection columns` and is the «settings» row. `FilePreview` plays video and audio with the
|
|
408
|
+
browser's own players and shows Word, Excel and PowerPoint as an «abrir o descargar» card.
|
|
409
|
+
|
|
398
410
|
#### A form that explains itself: the «settings» style
|
|
399
411
|
|
|
400
412
|
The default form is the dense sheet of an ERP — label | control, two columns, help behind a
|
|
@@ -13,6 +13,7 @@ export * from "./gantt/index.js";
|
|
|
13
13
|
export * from "./guide/index.js";
|
|
14
14
|
export * from "./lines/index.js";
|
|
15
15
|
export * from "./listing/index.js";
|
|
16
|
+
export * from "./media/index.js";
|
|
16
17
|
export * from "./navigation/index.js";
|
|
17
18
|
export * from "./plans/index.js";
|
|
18
19
|
export * from "./preview/index.js";
|
package/dist/components/index.js
CHANGED
|
@@ -14,6 +14,7 @@ export * from "./gantt/index.js";
|
|
|
14
14
|
export * from "./guide/index.js";
|
|
15
15
|
export * from "./lines/index.js";
|
|
16
16
|
export * from "./listing/index.js";
|
|
17
|
+
export * from "./media/index.js";
|
|
17
18
|
export * from "./navigation/index.js";
|
|
18
19
|
export * from "./plans/index.js";
|
|
19
20
|
export * from "./preview/index.js";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
type PerView = 1 | 2 | 3 | 4;
|
|
3
|
+
export type CarouselPerView = PerView | Partial<Record<"base" | "sm" | "md" | "lg", PerView>>;
|
|
4
|
+
export type CarouselProps = {
|
|
5
|
+
/** Each child is a slide: a hero's picture, a news card, a product. */
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
/** What the carousel is, said: «Noticias», «Destacados». */
|
|
8
|
+
label: string;
|
|
9
|
+
/** How many slides are seen at once, by width: `{ base: 1, md: 2, lg: 3 }`. One by default. */
|
|
10
|
+
slidesPerView?: CarouselPerView;
|
|
11
|
+
/** Past the last comes the first (arrows and autoplay). */
|
|
12
|
+
loop?: boolean;
|
|
13
|
+
/** Turns by itself every so many milliseconds. Stops on hover and on focus, has a pause
|
|
14
|
+
* button, and never runs when the person asked for less motion. */
|
|
15
|
+
autoplay?: number;
|
|
16
|
+
/** The dots under it. On by default when there is more than one position. */
|
|
17
|
+
dots?: boolean;
|
|
18
|
+
/** Which slide starts the view, when the application holds it. */
|
|
19
|
+
index?: number;
|
|
20
|
+
onIndexChange?: (next: number) => void;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Slides of any content that the person moves — the arrows, the dots, a finger or the
|
|
24
|
+
* mouse dragging, the keyboard — and that may turn by themselves.
|
|
25
|
+
*
|
|
26
|
+
* Context: built on CSS scroll-snap, so a finger swipes with the browser's own physics and
|
|
27
|
+
* the server renders every slide (a search engine reads them; nothing waits for JS). Where
|
|
28
|
+
* the person is, is written for a screen reader («2 de 5» on each slide), never only a dot.
|
|
29
|
+
* Autoplay is a courtesy that yields: a hover, a focus inside, the pause button or the
|
|
30
|
+
* system's «reduce motion» stop it, and while it runs the region is not live — a reader is
|
|
31
|
+
* not interrupted every five seconds.
|
|
32
|
+
*/
|
|
33
|
+
export declare function Carousel({ children, label, slidesPerView, loop, autoplay, dots, index: indexProp, onIndexChange, }: CarouselProps): import("react").JSX.Element;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useReducedMotion } from "./motion.js";
|
|
4
|
+
import { fillCopy, useUiCopy } from "../../foundations/copy.js";
|
|
5
|
+
import { IconButton } from "../../primitives/button/Button.js";
|
|
6
|
+
import { ChevronLeft, ChevronRight, Pause, Play } from "lucide-react";
|
|
7
|
+
import { Children, useCallback, useEffect, useRef, useState, } from "react";
|
|
8
|
+
/* Written whole so Tailwind sees every class: one table per breakpoint. */
|
|
9
|
+
const BASIS = {
|
|
10
|
+
base: { 1: "basis-full", 2: "basis-1/2", 3: "basis-1/3", 4: "basis-1/4" },
|
|
11
|
+
sm: { 1: "sm:basis-full", 2: "sm:basis-1/2", 3: "sm:basis-1/3", 4: "sm:basis-1/4" },
|
|
12
|
+
md: { 1: "md:basis-full", 2: "md:basis-1/2", 3: "md:basis-1/3", 4: "md:basis-1/4" },
|
|
13
|
+
lg: { 1: "lg:basis-full", 2: "lg:basis-1/2", 3: "lg:basis-1/3", 4: "lg:basis-1/4" },
|
|
14
|
+
};
|
|
15
|
+
/** The class of a slide's width for each breakpoint asked. */
|
|
16
|
+
function slideBasis(perView = 1) {
|
|
17
|
+
const asked = typeof perView === "number" ? { base: perView } : perView;
|
|
18
|
+
return Object.keys(BASIS)
|
|
19
|
+
.flatMap((at) => (asked[at] === undefined ? [] : [BASIS[at][asked[at]]]))
|
|
20
|
+
.join(" ");
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Slides of any content that the person moves — the arrows, the dots, a finger or the
|
|
24
|
+
* mouse dragging, the keyboard — and that may turn by themselves.
|
|
25
|
+
*
|
|
26
|
+
* Context: built on CSS scroll-snap, so a finger swipes with the browser's own physics and
|
|
27
|
+
* the server renders every slide (a search engine reads them; nothing waits for JS). Where
|
|
28
|
+
* the person is, is written for a screen reader («2 de 5» on each slide), never only a dot.
|
|
29
|
+
* Autoplay is a courtesy that yields: a hover, a focus inside, the pause button or the
|
|
30
|
+
* system's «reduce motion» stop it, and while it runs the region is not live — a reader is
|
|
31
|
+
* not interrupted every five seconds.
|
|
32
|
+
*/
|
|
33
|
+
export function Carousel({ children, label, slidesPerView = 1, loop = false, autoplay, dots = true, index: indexProp, onIndexChange, }) {
|
|
34
|
+
const copy = useUiCopy();
|
|
35
|
+
const reduced = useReducedMotion();
|
|
36
|
+
const slides = Children.toArray(children);
|
|
37
|
+
const total = slides.length;
|
|
38
|
+
const track = useRef(null);
|
|
39
|
+
const drag = useRef(null);
|
|
40
|
+
const [current, setCurrent] = useState(indexProp ?? 0);
|
|
41
|
+
const [perView, setPerView] = useState(1);
|
|
42
|
+
const [stopped, setStopped] = useState(false);
|
|
43
|
+
const [held, setHeld] = useState(false);
|
|
44
|
+
const last = Math.max(0, total - perView);
|
|
45
|
+
const slideAt = (at) => track.current?.children[at];
|
|
46
|
+
const go = useCallback((next) => {
|
|
47
|
+
const scroller = track.current;
|
|
48
|
+
if (scroller === null)
|
|
49
|
+
return;
|
|
50
|
+
const max = Math.max(0, scroller.children.length - perView);
|
|
51
|
+
const at = loop
|
|
52
|
+
? next > max
|
|
53
|
+
? 0
|
|
54
|
+
: next < 0
|
|
55
|
+
? max
|
|
56
|
+
: next
|
|
57
|
+
: Math.min(max, Math.max(0, next));
|
|
58
|
+
const slide = scroller.children[at];
|
|
59
|
+
if (slide === undefined)
|
|
60
|
+
return;
|
|
61
|
+
scroller.scrollTo({ left: slide.offsetLeft, behavior: reduced ? "auto" : "smooth" });
|
|
62
|
+
}, [loop, perView, reduced]);
|
|
63
|
+
/* Where it is comes from the scroll — whatever moved it: a finger, a wheel, a button. */
|
|
64
|
+
const measure = () => {
|
|
65
|
+
const scroller = track.current;
|
|
66
|
+
const first = slideAt(0);
|
|
67
|
+
if (scroller === null || first === undefined || first.offsetWidth === 0)
|
|
68
|
+
return;
|
|
69
|
+
const step = first.offsetWidth;
|
|
70
|
+
setPerView(Math.max(1, Math.round(scroller.clientWidth / step)));
|
|
71
|
+
const at = Math.round(scroller.scrollLeft / step);
|
|
72
|
+
setCurrent((was) => {
|
|
73
|
+
if (was !== at)
|
|
74
|
+
onIndexChange?.(at);
|
|
75
|
+
return at;
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
const scroller = track.current;
|
|
80
|
+
if (scroller === null)
|
|
81
|
+
return;
|
|
82
|
+
measure();
|
|
83
|
+
const observer = new ResizeObserver(measure);
|
|
84
|
+
observer.observe(scroller);
|
|
85
|
+
return () => observer.disconnect();
|
|
86
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- measured on mount and resize
|
|
87
|
+
}, []);
|
|
88
|
+
/* A controlled index moves the view, without the smooth scroll on the first paint. */
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (indexProp !== undefined && indexProp !== current)
|
|
91
|
+
go(indexProp);
|
|
92
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- only when the application moves it
|
|
93
|
+
}, [indexProp]);
|
|
94
|
+
const playing = autoplay !== undefined && total > 1 && !reduced && !stopped;
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
if (!playing || held)
|
|
97
|
+
return;
|
|
98
|
+
const timer = window.setInterval(() => {
|
|
99
|
+
go(current >= last ? 0 : current + 1);
|
|
100
|
+
}, autoplay);
|
|
101
|
+
return () => window.clearInterval(timer);
|
|
102
|
+
}, [playing, held, autoplay, current, last, go]);
|
|
103
|
+
const keys = (event) => {
|
|
104
|
+
const step = { ArrowRight: 1, ArrowLeft: -1 }[event.key];
|
|
105
|
+
if (step !== undefined)
|
|
106
|
+
go(current + step);
|
|
107
|
+
else if (event.key === "Home")
|
|
108
|
+
go(0);
|
|
109
|
+
else if (event.key === "End")
|
|
110
|
+
go(last);
|
|
111
|
+
else
|
|
112
|
+
return;
|
|
113
|
+
event.preventDefault();
|
|
114
|
+
};
|
|
115
|
+
/* A finger already swipes the snap; the mouse drags it by hand and lets it snap at the end. */
|
|
116
|
+
const down = (event) => {
|
|
117
|
+
if (event.pointerType !== "mouse" || track.current === null)
|
|
118
|
+
return;
|
|
119
|
+
drag.current = { x: event.clientX, left: track.current.scrollLeft };
|
|
120
|
+
track.current.dataset.dragging = "";
|
|
121
|
+
};
|
|
122
|
+
const move = (event) => {
|
|
123
|
+
if (drag.current === null || track.current === null)
|
|
124
|
+
return;
|
|
125
|
+
track.current.scrollLeft = drag.current.left - (event.clientX - drag.current.x);
|
|
126
|
+
};
|
|
127
|
+
const up = () => {
|
|
128
|
+
const scroller = track.current;
|
|
129
|
+
if (drag.current === null || scroller === null)
|
|
130
|
+
return;
|
|
131
|
+
drag.current = null;
|
|
132
|
+
delete scroller.dataset.dragging;
|
|
133
|
+
const first = slideAt(0);
|
|
134
|
+
if (first !== undefined)
|
|
135
|
+
go(Math.round(scroller.scrollLeft / first.offsetWidth));
|
|
136
|
+
};
|
|
137
|
+
const atStart = !loop && current <= 0;
|
|
138
|
+
const atEnd = !loop && current >= last;
|
|
139
|
+
const positions = last + 1;
|
|
140
|
+
const basis = slideBasis(slidesPerView);
|
|
141
|
+
return (_jsxs("section", { "data-ui": "carousel", "aria-roledescription": copy.carousel.roledescription, "aria-label": label, onKeyDown: keys, onPointerEnter: () => setHeld(true), onPointerLeave: () => setHeld(false), onFocus: () => setHeld(true), onBlur: (event) => {
|
|
142
|
+
if (!event.currentTarget.contains(event.relatedTarget))
|
|
143
|
+
setHeld(false);
|
|
144
|
+
}, className: "group/carousel relative flex min-w-0 flex-col gap-3", children: [_jsxs("div", { className: "relative min-w-0", children: [_jsx("div", { ref: track, "data-ui": "carousel.track",
|
|
145
|
+
/* A scroll box a keyboard can reach (axe: scrollable-region-focusable); its arrows
|
|
146
|
+
move the slides through the section's handler. */
|
|
147
|
+
tabIndex: 0, "aria-live": playing && !held ? "off" : "polite", onScroll: measure, onPointerDown: down, onPointerMove: move, onPointerUp: up, onPointerCancel: up, className: "scroll-quiet -mx-2 flex snap-x rounded-control focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary snap-mandatory data-dragging:cursor-grabbing data-dragging:snap-none data-dragging:select-none", children: slides.map((slide, at) => (_jsx("div", { "data-ui": "carousel.slide", role: "group", "aria-roledescription": copy.carousel.slide, "aria-label": fillCopy(copy.carousel.position, { index: at + 1, total }), className: `min-w-0 shrink-0 snap-start px-2 ${basis}`, children: slide }, at))) }), positions < 2 ? null : (_jsxs(_Fragment, { children: [_jsx("span", { className: "absolute top-1/2 left-1 -translate-y-1/2 rounded-pill bg-surface/90 shadow-raised", children: _jsx(IconButton, { icon: ChevronLeft, label: copy.carousel.previous, size: "md", disabled: atStart, onClick: () => go(current - 1) }) }), _jsx("span", { className: "absolute top-1/2 right-1 -translate-y-1/2 rounded-pill bg-surface/90 shadow-raised", children: _jsx(IconButton, { icon: ChevronRight, label: copy.carousel.next, size: "md", disabled: atEnd, onClick: () => go(current + 1) }) })] }))] }), positions < 2 || (!dots && autoplay === undefined) ? null : (_jsxs("div", { className: "flex items-center justify-center gap-2", children: [autoplay === undefined || reduced ? null : (_jsx(IconButton, { icon: stopped ? Play : Pause, label: stopped ? copy.carousel.play : copy.carousel.pause, size: "sm", onClick: () => setStopped((was) => !was) })), !dots ? null : (_jsx("div", { "data-ui": "carousel.dots", className: "flex items-center gap-1", children: Array.from({ length: positions }, (_, at) => (_jsx("button", { type: "button", "aria-label": fillCopy(copy.carousel.goTo, { index: at + 1 }), "aria-current": at === current ? "true" : undefined, onClick: () => go(at), className: "hit-target flex size-4 items-center justify-center rounded-pill focus-visible:outline-2 focus-visible:outline-primary", children: _jsx("span", { "aria-hidden": true, className: `h-2 rounded-pill transition-all duration-(--duration-quick) ${at === current ? "w-4 bg-primary" : "w-2 bg-line-strong"}` }) }, at))) }))] }))] }));
|
|
148
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export type StoryItem = {
|
|
2
|
+
id: string;
|
|
3
|
+
/** An image, or a video played by the browser's own `<video>`. */
|
|
4
|
+
src: string;
|
|
5
|
+
type?: "image" | "video";
|
|
6
|
+
/** What it shows, said. Not optional: a story without words is a hole for a reader. */
|
|
7
|
+
alt: string;
|
|
8
|
+
/** How long an image stays, in milliseconds (5 s by default). A video lasts what it lasts. */
|
|
9
|
+
duration?: number;
|
|
10
|
+
caption?: string;
|
|
11
|
+
/** «Ver la nota», «Inscribirme»: a real link, so it works without JS and opens in place. */
|
|
12
|
+
action?: {
|
|
13
|
+
label: string;
|
|
14
|
+
href: string;
|
|
15
|
+
};
|
|
16
|
+
when?: Date | string;
|
|
17
|
+
};
|
|
18
|
+
export type StoryPerson = {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
avatar?: string;
|
|
22
|
+
items: readonly StoryItem[];
|
|
23
|
+
/** Everything already seen: the ring goes quiet. */
|
|
24
|
+
seen?: boolean;
|
|
25
|
+
};
|
|
26
|
+
export type StoryRingProps = {
|
|
27
|
+
name: string;
|
|
28
|
+
avatar?: string;
|
|
29
|
+
/** Seen: a hairline instead of the coloured ring. */
|
|
30
|
+
seen?: boolean;
|
|
31
|
+
onPress?: () => void;
|
|
32
|
+
/** The name under the ring. On by default. */
|
|
33
|
+
showName?: boolean;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* A person's avatar with the ring that says there is something new.
|
|
37
|
+
*
|
|
38
|
+
* Context: unseen is not only a colour — the ring is thicker and the word is in the
|
|
39
|
+
* button's name («Ana, nuevo»), so it reads the same without colour vision.
|
|
40
|
+
*/
|
|
41
|
+
export declare function StoryRing({ name, avatar, seen, onPress, showName, }: StoryRingProps): import("react").JSX.Element;
|
|
42
|
+
export type StoryBarProps = {
|
|
43
|
+
people: readonly StoryPerson[];
|
|
44
|
+
/** Pressing a ring: the application opens the viewer at that person. */
|
|
45
|
+
onOpen: (personIndex: number) => void;
|
|
46
|
+
};
|
|
47
|
+
/** The row of rings, scrolling sideways — the top of a portal's home. */
|
|
48
|
+
export declare function StoryBar({ people, onOpen }: StoryBarProps): import("react").JSX.Element;
|
|
49
|
+
export type StoryViewerProps = {
|
|
50
|
+
people: readonly StoryPerson[];
|
|
51
|
+
open: boolean;
|
|
52
|
+
/** Whose stories are shown. */
|
|
53
|
+
personIndex: number;
|
|
54
|
+
onPersonChange: (next: number) => void;
|
|
55
|
+
onClose: () => void;
|
|
56
|
+
/** Each item, the moment it is shown: the application marks it seen. */
|
|
57
|
+
onSeen?: (personId: string, itemId: string) => void;
|
|
58
|
+
/** The clock the times are read against; now by default (a test passes a fixed one). */
|
|
59
|
+
now?: Date;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* One person's stories at full screen, then the next person's.
|
|
63
|
+
*
|
|
64
|
+
* Context: the gestures of the apps people already know — a tap on the left half goes back,
|
|
65
|
+
* on the right goes on, holding pauses, a swipe down closes — and each one has a key and a
|
|
66
|
+
* button too: the arrows, Space, Escape, the ✕ and the pause button, so it is not a
|
|
67
|
+
* touchscreen-only toy. The progress is a segment per item; the time runs only while the
|
|
68
|
+
* item is really there (a video's own clock, an image's timer), and stops while paused or
|
|
69
|
+
* while the tab is hidden.
|
|
70
|
+
*/
|
|
71
|
+
export declare function StoryViewer({ people, open, personIndex, onPersonChange, onClose, onSeen, now, }: StoryViewerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { fillCopy, useUiCopy } from "../../foundations/copy.js";
|
|
4
|
+
import { SurfaceProvider } from "../../foundations/surface.js";
|
|
5
|
+
import { ButtonLink, IconButton } from "../../primitives/button/Button.js";
|
|
6
|
+
import { Avatar } from "../../primitives/value/Avatar.js";
|
|
7
|
+
import { formatRelative } from "../../primitives/value/format.js";
|
|
8
|
+
import { ChevronLeft, ChevronRight, ExternalLink, Pause, Play, X } from "lucide-react";
|
|
9
|
+
import { useEffect, useRef, useState } from "react";
|
|
10
|
+
import { Dialog, Modal, ModalOverlay } from "react-aria-components";
|
|
11
|
+
const IMAGE_MS = 5000;
|
|
12
|
+
/* A finger that travels this far down meant «close», not «next». */
|
|
13
|
+
const SWIPE_CLOSE = 80;
|
|
14
|
+
/* Pressed longer than this is «hold to pause», not a tap that moves. */
|
|
15
|
+
const HOLD_MS = 250;
|
|
16
|
+
/**
|
|
17
|
+
* A person's avatar with the ring that says there is something new.
|
|
18
|
+
*
|
|
19
|
+
* Context: unseen is not only a colour — the ring is thicker and the word is in the
|
|
20
|
+
* button's name («Ana, nuevo»), so it reads the same without colour vision.
|
|
21
|
+
*/
|
|
22
|
+
export function StoryRing({ name, avatar, seen = false, onPress, showName = true, }) {
|
|
23
|
+
const copy = useUiCopy();
|
|
24
|
+
return (_jsxs("button", { type: "button", "data-ui": "story-ring", "data-seen": seen ? "" : undefined, onClick: onPress, ...(showName ? {} : { "aria-label": fillCopy(copy.stories.open, { name }) }), className: "group/ring flex w-16 shrink-0 flex-col items-center gap-1 rounded-control focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary", children: [_jsx("span", { "aria-hidden": true, className: `flex rounded-pill ${seen ? "bg-line-strong p-px" : "bg-linear-to-tr from-accent to-primary p-0.5"}`, children: _jsx("span", { className: "flex rounded-pill bg-canvas p-0.5", children: _jsx(Avatar, { name: name, size: "xl", ...(avatar === undefined ? {} : { src: avatar }) }) }) }), showName ? (_jsx("span", { className: `w-full truncate text-center text-micro ${seen ? "text-muted" : "font-medium text-ink"}`, children: name })) : null, _jsxs("span", { className: "sr-only", children: [", ", seen ? copy.stories.seen : copy.stories.unseen] })] }));
|
|
25
|
+
}
|
|
26
|
+
/** The row of rings, scrolling sideways — the top of a portal's home. */
|
|
27
|
+
export function StoryBar({ people, onOpen }) {
|
|
28
|
+
const copy = useUiCopy();
|
|
29
|
+
return (_jsx("ul", { "data-ui": "story-bar", "aria-label": copy.stories.label, className: "scroll-quiet flex gap-3 py-1", children: people.map((person, at) => (_jsx("li", { children: _jsx(StoryRing, { name: person.name, ...(person.avatar === undefined ? {} : { avatar: person.avatar }), seen: person.seen === true, onPress: () => onOpen(at) }) }, person.id))) }));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* One person's stories at full screen, then the next person's.
|
|
33
|
+
*
|
|
34
|
+
* Context: the gestures of the apps people already know — a tap on the left half goes back,
|
|
35
|
+
* on the right goes on, holding pauses, a swipe down closes — and each one has a key and a
|
|
36
|
+
* button too: the arrows, Space, Escape, the ✕ and the pause button, so it is not a
|
|
37
|
+
* touchscreen-only toy. The progress is a segment per item; the time runs only while the
|
|
38
|
+
* item is really there (a video's own clock, an image's timer), and stops while paused or
|
|
39
|
+
* while the tab is hidden.
|
|
40
|
+
*/
|
|
41
|
+
export function StoryViewer({ people, open, personIndex, onPersonChange, onClose, onSeen, now, }) {
|
|
42
|
+
const copy = useUiCopy();
|
|
43
|
+
const person = people[personIndex];
|
|
44
|
+
const items = person?.items ?? [];
|
|
45
|
+
const [index, setIndex] = useState(0);
|
|
46
|
+
const [paused, setPaused] = useState(false);
|
|
47
|
+
/* Held by a finger or the mouse: apart from `paused`, so releasing does not undo the button. */
|
|
48
|
+
const [held, setHeld] = useState(false);
|
|
49
|
+
const stopped = paused || held;
|
|
50
|
+
const [progress, setProgress] = useState(0);
|
|
51
|
+
const video = useRef(null);
|
|
52
|
+
const press = useRef(null);
|
|
53
|
+
const item = items[Math.min(index, items.length - 1)];
|
|
54
|
+
const isVideo = item?.type === "video";
|
|
55
|
+
/* A new person starts at their first item. */
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
setIndex(0);
|
|
58
|
+
setProgress(0);
|
|
59
|
+
}, [personIndex]);
|
|
60
|
+
const next = () => {
|
|
61
|
+
setProgress(0);
|
|
62
|
+
if (index < items.length - 1)
|
|
63
|
+
setIndex(index + 1);
|
|
64
|
+
else if (personIndex < people.length - 1)
|
|
65
|
+
onPersonChange(personIndex + 1);
|
|
66
|
+
else
|
|
67
|
+
onClose();
|
|
68
|
+
};
|
|
69
|
+
const previous = () => {
|
|
70
|
+
setProgress(0);
|
|
71
|
+
if (index > 0)
|
|
72
|
+
setIndex(index - 1);
|
|
73
|
+
else if (personIndex > 0)
|
|
74
|
+
onPersonChange(personIndex - 1);
|
|
75
|
+
};
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (open && person !== undefined && item !== undefined)
|
|
78
|
+
onSeen?.(person.id, item.id);
|
|
79
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- once per item shown
|
|
80
|
+
}, [open, person?.id, item?.id]);
|
|
81
|
+
/* An image's clock. A video keeps its own (`onTimeUpdate`). */
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
if (!open || stopped || item === undefined || isVideo)
|
|
84
|
+
return;
|
|
85
|
+
const length = item.duration ?? IMAGE_MS;
|
|
86
|
+
let start = performance.now() - progress * length;
|
|
87
|
+
let frame = 0;
|
|
88
|
+
const tick = (time) => {
|
|
89
|
+
if (document.hidden)
|
|
90
|
+
start = time - progress * length;
|
|
91
|
+
const share = Math.min(1, (time - start) / length);
|
|
92
|
+
setProgress(share);
|
|
93
|
+
if (share >= 1)
|
|
94
|
+
next();
|
|
95
|
+
else
|
|
96
|
+
frame = requestAnimationFrame(tick);
|
|
97
|
+
};
|
|
98
|
+
frame = requestAnimationFrame(tick);
|
|
99
|
+
return () => cancelAnimationFrame(frame);
|
|
100
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- restarts per item and on pause
|
|
101
|
+
}, [open, stopped, item?.id, isVideo]);
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
const player = video.current;
|
|
104
|
+
if (player === null)
|
|
105
|
+
return;
|
|
106
|
+
if (stopped)
|
|
107
|
+
player.pause();
|
|
108
|
+
else
|
|
109
|
+
void player.play().catch(() => undefined);
|
|
110
|
+
}, [stopped, item?.id]);
|
|
111
|
+
/* On the window: the focus starts ON the dialog, and a key pressed there never reaches a
|
|
112
|
+
handler inside it (as in `Lightbox`). */
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
if (!open)
|
|
115
|
+
return;
|
|
116
|
+
const keys = (event) => {
|
|
117
|
+
if (event.key === "ArrowRight")
|
|
118
|
+
next();
|
|
119
|
+
else if (event.key === "ArrowLeft")
|
|
120
|
+
previous();
|
|
121
|
+
else if (event.key === " ")
|
|
122
|
+
setPaused((was) => !was);
|
|
123
|
+
else
|
|
124
|
+
return;
|
|
125
|
+
event.preventDefault();
|
|
126
|
+
};
|
|
127
|
+
window.addEventListener("keydown", keys);
|
|
128
|
+
return () => window.removeEventListener("keydown", keys);
|
|
129
|
+
});
|
|
130
|
+
const down = (event) => {
|
|
131
|
+
/* The side buttons move by themselves; their press is not also a tap on the halves. */
|
|
132
|
+
if (event.target instanceof Element && event.target.closest("button") !== null)
|
|
133
|
+
return;
|
|
134
|
+
const box = event.currentTarget.getBoundingClientRect();
|
|
135
|
+
press.current = {
|
|
136
|
+
x: event.clientX - box.left,
|
|
137
|
+
y: event.clientY,
|
|
138
|
+
at: Date.now(),
|
|
139
|
+
width: box.width,
|
|
140
|
+
};
|
|
141
|
+
setHeld(true);
|
|
142
|
+
};
|
|
143
|
+
const up = (event) => {
|
|
144
|
+
const start = press.current;
|
|
145
|
+
if (start === null)
|
|
146
|
+
return;
|
|
147
|
+
press.current = null;
|
|
148
|
+
setHeld(false);
|
|
149
|
+
if (event.clientY - start.y > SWIPE_CLOSE)
|
|
150
|
+
onClose();
|
|
151
|
+
else if (Date.now() - start.at < HOLD_MS) {
|
|
152
|
+
if (start.x < start.width / 3)
|
|
153
|
+
previous();
|
|
154
|
+
else
|
|
155
|
+
next();
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
return (_jsx(ModalOverlay, { isOpen: open && item !== undefined, onOpenChange: (shown) => {
|
|
159
|
+
if (!shown)
|
|
160
|
+
onClose();
|
|
161
|
+
}, isDismissable: true, className: "fixed inset-0 z-50 bg-scrim/95", children: _jsx(Modal, { className: "fixed inset-0 outline-0", children: _jsx(Dialog, { "data-ui": "story-viewer", "aria-label": fillCopy(copy.stories.viewer, { name: person?.name ?? "" }), className: "mx-auto flex size-full max-w-(--container-short) flex-col outline-0", children: _jsxs(SurfaceProvider, { value: "chrome", children: [_jsxs("div", { className: "flex shrink-0 flex-col gap-2 px-3 pt-3", children: [_jsx("div", { "data-ui": "story-viewer.progress", className: "flex gap-1", "aria-hidden": true, children: items.map((entry, at) => (_jsx("span", { className: "h-0.5 flex-1 overflow-hidden rounded-pill bg-chrome-ink/30", children: _jsx("span", { className: "block h-full bg-chrome-ink", style: {
|
|
162
|
+
width: `${String(at < index ? 100 : at === index ? progress * 100 : 0)}%`,
|
|
163
|
+
} }) }, entry.id))) }), _jsxs("div", { className: "flex items-center gap-2", children: [person === undefined ? null : (_jsx(Avatar, { name: person.name, size: "lg", ...(person.avatar === undefined ? {} : { src: person.avatar }) })), _jsxs("p", { className: "flex min-w-0 flex-1 items-baseline gap-2 text-meta text-chrome-ink", children: [_jsx("span", { className: "truncate font-semibold", children: person?.name }), item?.when === undefined ? null : (_jsx("span", { className: "shrink-0 text-micro text-chrome-muted", children: formatRelative(new Date(item.when), now, copy) })), _jsx("span", { className: "sr-only", "aria-live": "polite", children: fillCopy(copy.stories.position, {
|
|
164
|
+
index: index + 1,
|
|
165
|
+
total: items.length,
|
|
166
|
+
}) })] }), _jsx(IconButton, { icon: paused ? Play : Pause, label: paused ? copy.stories.play : copy.stories.pause, size: "md", onClick: () => setPaused((was) => !was) }), _jsx(IconButton, { icon: X, label: copy.stories.close, size: "md", onClick: onClose })] })] }), _jsxs("div", { "data-ui": "story-viewer.media", onPointerDown: down, onPointerUp: up, onPointerCancel: () => {
|
|
167
|
+
press.current = null;
|
|
168
|
+
setHeld(false);
|
|
169
|
+
}, className: "relative flex min-h-0 flex-1 touch-none items-center justify-center px-3 py-3 select-none", children: [item === undefined ? null : isVideo ? (_jsx("video", { ref: video, src: item.src, "aria-label": item.alt, autoPlay: true, playsInline: true, muted: true, preload: "auto", onTimeUpdate: (event) => {
|
|
170
|
+
const player = event.currentTarget;
|
|
171
|
+
if (player.duration > 0)
|
|
172
|
+
setProgress(player.currentTime / player.duration);
|
|
173
|
+
}, onEnded: next, className: "max-h-full max-w-full rounded-control" }, item.id)) : (_jsx("img", { src: item.src, alt: item.alt, draggable: false, className: "max-h-full max-w-full rounded-control object-contain" }, item.id)), _jsx("span", { className: "absolute top-1/2 left-0 hidden -translate-y-1/2 sm:flex", children: _jsx(IconButton, { icon: ChevronLeft, label: copy.stories.previous, size: "lg", onClick: previous }) }), _jsx("span", { className: "absolute top-1/2 right-0 hidden -translate-y-1/2 sm:flex", children: _jsx(IconButton, { icon: ChevronRight, label: copy.stories.next, size: "lg", onClick: next }) })] }), item?.caption === undefined && item?.action === undefined ? null : (_jsxs("div", { className: "safe-bottom flex shrink-0 flex-col items-center gap-3 px-4 pb-5 text-center", children: [item?.caption === undefined ? null : (_jsx("p", { className: "text-meta text-chrome-ink", children: item.caption })), item?.action === undefined ? null : (_jsx(ButtonLink, { href: item.action.href, role: "primary", size: "md", icon: ExternalLink, children: item.action.label }))] }))] }) }) }) }));
|
|
174
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/* MEDIA AND SOCIAL — slides that turn (Carousel) and a person's stories at full screen
|
|
2
|
+
(StoryRing, StoryBar, StoryViewer). Data-agnostic: the application passes the content. */
|
|
3
|
+
export { Carousel, } from "./Carousel.js";
|
|
4
|
+
export { StoryBar, StoryRing, StoryViewer, } from "./Stories.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the person asked the system for less motion.
|
|
3
|
+
*
|
|
4
|
+
* Context: the server cannot know, so it answers «yes» — nothing turns or plays by itself
|
|
5
|
+
* until the browser has said otherwise, and the first paint matches on both sides.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useReducedMotion(): boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useSyncExternalStore } from "react";
|
|
3
|
+
const QUERY = "(prefers-reduced-motion: reduce)";
|
|
4
|
+
function subscribe(changed) {
|
|
5
|
+
const media = window.matchMedia(QUERY);
|
|
6
|
+
media.addEventListener("change", changed);
|
|
7
|
+
return () => media.removeEventListener("change", changed);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Whether the person asked the system for less motion.
|
|
11
|
+
*
|
|
12
|
+
* Context: the server cannot know, so it answers «yes» — nothing turns or plays by itself
|
|
13
|
+
* until the browser has said otherwise, and the first paint matches on both sides.
|
|
14
|
+
*/
|
|
15
|
+
export function useReducedMotion() {
|
|
16
|
+
return useSyncExternalStore(subscribe, () => window.matchMedia(QUERY).matches, () => true);
|
|
17
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type LucideIcon } from "lucide-react";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
export type PortalNavItem = {
|
|
4
|
+
key: string;
|
|
5
|
+
label: string;
|
|
6
|
+
/** A real address: the menu works server-rendered, before and without JS. */
|
|
7
|
+
href: string;
|
|
8
|
+
icon?: LucideIcon;
|
|
9
|
+
/** How many are waiting there: «3» unpaid fees, «1» new message. Zero is not drawn. */
|
|
10
|
+
count?: number;
|
|
11
|
+
};
|
|
12
|
+
export type PortalNavSection = {
|
|
13
|
+
/** «Mi cuenta», «Comunidad». Absent for a first section without a heading. */
|
|
14
|
+
title?: string;
|
|
15
|
+
items: readonly PortalNavItem[];
|
|
16
|
+
};
|
|
17
|
+
export type PortalNavLink = {
|
|
18
|
+
href: string;
|
|
19
|
+
className: string;
|
|
20
|
+
"aria-current"?: "page";
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
};
|
|
23
|
+
export type PortalNavProps = {
|
|
24
|
+
sections: readonly PortalNavSection[];
|
|
25
|
+
/** The `key` of the page the person is on. */
|
|
26
|
+
current?: string;
|
|
27
|
+
/** The person, at the top: their face, their name, a line under it («Socio 0412»). */
|
|
28
|
+
person?: {
|
|
29
|
+
name: string;
|
|
30
|
+
avatar?: string;
|
|
31
|
+
detail?: string;
|
|
32
|
+
};
|
|
33
|
+
/** What the menu is, said: «Mi portal». */
|
|
34
|
+
label?: string;
|
|
35
|
+
/** The application's own link (Next's `Link`), with the props it must pass on. */
|
|
36
|
+
renderLink?: (link: PortalNavLink) => ReactNode;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* A portal's side menu, INSIDE a site's page: the person at the top, sections with their
|
|
40
|
+
* headings, items with icons and counts, the current one marked — and on a phone, folded
|
|
41
|
+
* into one button.
|
|
42
|
+
*
|
|
43
|
+
* Context: `Sidebar` is the whole chrome of a back office (full height, in `AppFrame`) and
|
|
44
|
+
* `NavigationTree` a tree of modules; neither sits in a public site's column. This one is
|
|
45
|
+
* plain links (`href`, `aria-current="page"`), so the server renders it whole and it works
|
|
46
|
+
* before hydration; the fold is the only thing that needs JS, and closed it hides only on a
|
|
47
|
+
* phone — from `md` up the menu is always there.
|
|
48
|
+
*/
|
|
49
|
+
export declare function PortalNav({ sections, current, person, label, renderLink }: PortalNavProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useUiCopy } from "../../foundations/copy.js";
|
|
4
|
+
import { Count } from "../../primitives/tag/Count.js";
|
|
5
|
+
import { Avatar } from "../../primitives/value/Avatar.js";
|
|
6
|
+
import { ChevronDown } from "lucide-react";
|
|
7
|
+
import { useId, useState } from "react";
|
|
8
|
+
/**
|
|
9
|
+
* A portal's side menu, INSIDE a site's page: the person at the top, sections with their
|
|
10
|
+
* headings, items with icons and counts, the current one marked — and on a phone, folded
|
|
11
|
+
* into one button.
|
|
12
|
+
*
|
|
13
|
+
* Context: `Sidebar` is the whole chrome of a back office (full height, in `AppFrame`) and
|
|
14
|
+
* `NavigationTree` a tree of modules; neither sits in a public site's column. This one is
|
|
15
|
+
* plain links (`href`, `aria-current="page"`), so the server renders it whole and it works
|
|
16
|
+
* before hydration; the fold is the only thing that needs JS, and closed it hides only on a
|
|
17
|
+
* phone — from `md` up the menu is always there.
|
|
18
|
+
*/
|
|
19
|
+
export function PortalNav({ sections, current, person, label, renderLink }) {
|
|
20
|
+
const copy = useUiCopy();
|
|
21
|
+
const [open, setOpen] = useState(false);
|
|
22
|
+
const listId = useId();
|
|
23
|
+
const name = label ?? copy.portalNav.label;
|
|
24
|
+
const currentLabel = sections
|
|
25
|
+
.flatMap((section) => section.items)
|
|
26
|
+
.find((item) => item.key === current)?.label;
|
|
27
|
+
const link = (item) => {
|
|
28
|
+
const here = item.key === current;
|
|
29
|
+
const Icon = item.icon;
|
|
30
|
+
const children = (_jsxs(_Fragment, { children: [Icon === undefined ? null : (_jsx(Icon, { "aria-hidden": true, strokeWidth: 2, className: "size-(--size-icon-md) shrink-0" })), _jsx("span", { className: "min-w-0 flex-1 truncate", children: item.label }), item.count === undefined || item.count <= 0 ? null : _jsx(Count, { value: item.count })] }));
|
|
31
|
+
const props = {
|
|
32
|
+
href: item.href,
|
|
33
|
+
className: `flex min-h-(--size-control-md) items-center gap-2.5 rounded-control px-2.5 text-meta no-underline transition-colors duration-(--duration-instant) focus-visible:outline-2 focus-visible:outline-primary ${here ? "bg-primary/8 font-semibold text-primary" : "text-ink hover:bg-ink/4"}`,
|
|
34
|
+
...(here ? { "aria-current": "page" } : {}),
|
|
35
|
+
children,
|
|
36
|
+
};
|
|
37
|
+
return renderLink === undefined ? _jsx("a", { ...props }) : renderLink(props);
|
|
38
|
+
};
|
|
39
|
+
return (_jsxs("nav", { "data-ui": "portal-nav", "aria-label": name, className: "flex min-w-0 flex-col gap-2", children: [person === undefined ? null : (_jsxs("div", { "data-ui": "portal-nav.person", className: "flex min-w-0 items-center gap-3 px-2.5 py-2", children: [_jsx(Avatar, { name: person.name, size: "xl", ...(person.avatar === undefined ? {} : { src: person.avatar }) }), _jsxs("div", { className: "flex min-w-0 flex-col", children: [_jsx("span", { className: "truncate text-body font-semibold text-ink", children: person.name }), person.detail === undefined ? null : (_jsx("span", { className: "truncate text-micro text-muted", children: person.detail }))] })] })), _jsxs("button", { type: "button", "data-ui": "portal-nav.toggle", "aria-expanded": open, "aria-controls": listId, onClick: () => setOpen((was) => !was), className: "flex min-h-(--size-control-md) items-center justify-between gap-2 rounded-control border border-line px-3 text-meta font-medium text-ink focus-visible:outline-2 focus-visible:outline-primary md:hidden", children: [_jsx("span", { className: "truncate", children: currentLabel ?? name }), _jsx(ChevronDown, { "aria-hidden": true, className: `size-(--size-icon-md) shrink-0 transition-transform duration-(--duration-quick) ${open ? "rotate-180" : ""}` })] }), _jsx("div", { id: listId, "data-ui": "portal-nav.sections", className: `flex-col gap-4 md:flex ${open ? "flex" : "hidden"}`, children: sections.map((section, at) => (_jsxs("div", { className: "flex flex-col gap-0.5", children: [section.title === undefined ? null : (_jsx("h2", { className: "px-2.5 pb-1 text-micro font-semibold text-muted uppercase", children: section.title })), _jsx("ul", { className: "flex flex-col gap-0.5", children: section.items.map((item) => (_jsx("li", { children: link(item) }, item.key))) })] }, section.title ?? at))) })] }));
|
|
40
|
+
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
/* NAVIGATION — an application's side tree. The command palette (⌘K) belongs to the
|
|
2
2
|
workspace (composer), not here. */
|
|
3
3
|
export { NavigationTree, } from "./NavigationTree.js";
|
|
4
|
+
/* A portal's side menu inside a site's page: the person, sections, counts, real links, and
|
|
5
|
+
one button on a phone. */
|
|
6
|
+
export { PortalNav, } from "./PortalNav.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type PreviewKind, previewKind } from "./previewKind.js";
|
|
2
|
-
export type { PreviewKind };
|
|
3
|
-
export { previewKind };
|
|
1
|
+
import { type OfficeKind, officeKind, type PreviewKind, previewKind } from "./previewKind.js";
|
|
2
|
+
export type { OfficeKind, PreviewKind };
|
|
3
|
+
export { officeKind, previewKind };
|
|
4
4
|
export type PreviewFile = {
|
|
5
5
|
/** The file name as saved: it picks the kind together with `type`. */
|
|
6
6
|
name: string;
|
|
@@ -10,6 +10,8 @@ export type PreviewFile = {
|
|
|
10
10
|
type?: string;
|
|
11
11
|
/** In bytes. Written for the locale in the header. */
|
|
12
12
|
size?: number;
|
|
13
|
+
/** A video's still, shown before it plays — the server's thumbnail. */
|
|
14
|
+
poster?: string;
|
|
13
15
|
};
|
|
14
16
|
export type FilePreviewProps = {
|
|
15
17
|
file: PreviewFile;
|