@sincpro/web-ui 2.16.0 → 2.17.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 +24 -1
- package/dist/components/media/OnScroll.d.ts +27 -0
- package/dist/components/media/OnScroll.js +18 -0
- package/dist/components/media/Ribbon.d.ts +39 -0
- package/dist/components/media/Ribbon.js +74 -0
- package/dist/components/media/Rise.d.ts +31 -0
- package/dist/components/media/Rise.js +27 -0
- package/dist/components/media/index.d.ts +3 -0
- package/dist/components/media/index.js +7 -2
- package/dist/foundations/copy.es.js +4 -0
- package/dist/foundations/uiCopy.d.ts +5 -0
- package/dist/foundations/uiCopy.js +4 -0
- package/dist/tokens.css +182 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -365,7 +365,9 @@ The parts: `button`, `icon-button`, `control`, `popover`, `menu`, `menu.trigger`
|
|
|
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
367
|
`gallery.main`, `gallery.strip`, `lightbox`, `carousel`, `carousel.track`, `carousel.slide`,
|
|
368
|
-
`carousel.dots`, `
|
|
368
|
+
`carousel.dots`, `rise.line`, `appear`, `draw-on-scroll` (with `data-axis`), `enter-on-scroll`,
|
|
369
|
+
`ribbon` (with `data-moving`, `data-paused`, `data-direction`), `ribbon.viewport`, `ribbon.list`,
|
|
370
|
+
`ribbon.copy`, `story-ring` (with `data-seen`), `story-bar`, `story-viewer`, `story-viewer.progress`,
|
|
369
371
|
`story-viewer.media`, `notification-bell`, `notification-panel`, `notification-panel.group`,
|
|
370
372
|
`notification-panel.item` (with `data-unread`), `portal-nav`, `portal-nav.person`, `portal-nav.toggle`,
|
|
371
373
|
`portal-nav.sections`, `check-field`, `file-preview.video`, `file-preview.audio`, `file-preview.office` (with `data-kind`), `sidebar`, `sidebar.brand`,
|
|
@@ -407,6 +409,27 @@ real links, folded into one button on a phone), and `CheckField` — a yes/no ro
|
|
|
407
409
|
`FormSection columns` and is the «settings» row. `FilePreview` plays video and audio with the
|
|
408
410
|
browser's own players and shows Word, Excel and PowerPoint as an «abrir o descargar» card.
|
|
409
411
|
|
|
412
|
+
A site's landing has its own motion — and only a site's page uses it (the register is explained
|
|
413
|
+
under «A SITE'S PAGE» in `tokens.css`): `Rise` (a headline that rises line by line, inside the
|
|
414
|
+
application's own `<h1>`), `Appear step` (what follows it, on the same clock), `DrawOnScroll`
|
|
415
|
+
(a rule or a line drawn by the scroll itself) and `EnterOnScroll` (a section that enters), all
|
|
416
|
+
CSS with no JavaScript; and `Ribbon` (items that pass in a loop, as many copies as the width
|
|
417
|
+
needs, with a pause button). The same motion is open as utilities for an element of the site's
|
|
418
|
+
own — `rise-line`, `appear-in` (with `--motion-step`), `draw-on-scroll-x`, `draw-on-scroll-y`,
|
|
419
|
+
`enter-on-scroll`. Every one is the final state in the HTML, moves only under
|
|
420
|
+
`prefers-reduced-motion: no-preference`, and the scroll-driven ones are simply drawn where the
|
|
421
|
+
browser lacks `animation-timeline`; under reduced motion the ribbon is a row to scroll.
|
|
422
|
+
|
|
423
|
+
```tsx
|
|
424
|
+
<h1 className="font-serif text-6xl">
|
|
425
|
+
<Rise lines={["¿Tu auditor está", "habilitado para ejercer?"]} />
|
|
426
|
+
</h1>
|
|
427
|
+
<Appear step={2} as="p">Verifica en el registro del colegio…</Appear>
|
|
428
|
+
<Ribbon label="Galería del colegio" speed="slow">
|
|
429
|
+
{albums.map((album) => <AlbumCover key={album.id} album={album} />)}
|
|
430
|
+
</Ribbon>
|
|
431
|
+
```
|
|
432
|
+
|
|
410
433
|
#### A form that explains itself: the «settings» style
|
|
411
434
|
|
|
412
435
|
The default form is the dense sheet of an ERP — label | control, two columns, help behind a
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export type DrawOnScrollProps = {
|
|
3
|
+
/** The rule or line drawn: a `Divider`, a bar of the brand's colour, a timeline's line. */
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/** `x` draws from the start edge (a rule under a word), `y` from the top (a timeline). */
|
|
6
|
+
axis?: "x" | "y";
|
|
7
|
+
/** The element it is. `div` by default; `span` inside a line of text. */
|
|
8
|
+
as?: "div" | "span";
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* A rule or a line drawn by the scroll itself as it comes into view.
|
|
12
|
+
*
|
|
13
|
+
* Context: it scales its own box, so it wraps the line and nothing else — a line that sits
|
|
14
|
+
* absolutely (a timeline's spine) takes the utility on itself instead:
|
|
15
|
+
* `className="draw-on-scroll-y"`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function DrawOnScroll({ children, axis, as: Element, }: DrawOnScrollProps): import("react").JSX.Element;
|
|
18
|
+
export type EnterOnScrollProps = {
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
/** The element it is. `div` by default; `li` for an item of a list. */
|
|
21
|
+
as?: "div" | "li" | "section" | "article";
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* A row of a site's page that enters as it scrolls into view. For a landing's sections —
|
|
25
|
+
* never for a list a person works in, where a row that is not there yet is a row not read.
|
|
26
|
+
*/
|
|
27
|
+
export declare function EnterOnScroll({ children, as: Element }: EnterOnScrollProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* A rule or a line drawn by the scroll itself as it comes into view.
|
|
4
|
+
*
|
|
5
|
+
* Context: it scales its own box, so it wraps the line and nothing else — a line that sits
|
|
6
|
+
* absolutely (a timeline's spine) takes the utility on itself instead:
|
|
7
|
+
* `className="draw-on-scroll-y"`.
|
|
8
|
+
*/
|
|
9
|
+
export function DrawOnScroll({ children, axis = "x", as: Element = "div", }) {
|
|
10
|
+
return (_jsx(Element, { "data-ui": "draw-on-scroll", "data-axis": axis, className: axis === "x" ? "draw-on-scroll-x" : "draw-on-scroll-y", children: children }));
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A row of a site's page that enters as it scrolls into view. For a landing's sections —
|
|
14
|
+
* never for a list a person works in, where a row that is not there yet is a row not read.
|
|
15
|
+
*/
|
|
16
|
+
export function EnterOnScroll({ children, as: Element = "div" }) {
|
|
17
|
+
return (_jsx(Element, { "data-ui": "enter-on-scroll", className: "enter-on-scroll", children: children }));
|
|
18
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
declare const SPEED: {
|
|
3
|
+
readonly slow: 24;
|
|
4
|
+
readonly normal: 40;
|
|
5
|
+
readonly fast: 64;
|
|
6
|
+
};
|
|
7
|
+
declare const GAP: {
|
|
8
|
+
readonly sm: "gap-2 pe-2";
|
|
9
|
+
readonly md: "gap-4 pe-4";
|
|
10
|
+
readonly lg: "gap-6 pe-6";
|
|
11
|
+
};
|
|
12
|
+
export type RibbonProps = {
|
|
13
|
+
/** Each child is an item that passes: a cover, a logo, a testimony. */
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
/** What the ribbon is, said: «Galería del colegio», «Confían en nosotros». */
|
|
16
|
+
label: string;
|
|
17
|
+
/** How fast it passes, by distance: slow, normal (default) or fast. */
|
|
18
|
+
speed?: keyof typeof SPEED;
|
|
19
|
+
/** Where it goes: to the left (default) or to the right — two rows that cross. */
|
|
20
|
+
direction?: "left" | "right";
|
|
21
|
+
/** The space between the items. */
|
|
22
|
+
gap?: keyof typeof GAP;
|
|
23
|
+
/** The edges fade instead of cutting. On by default. */
|
|
24
|
+
fade?: boolean;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Items that pass by themselves in a loop: a site's covers, its partners' logos.
|
|
28
|
+
*
|
|
29
|
+
* Context: the list is written once for everyone and repeated only to fill the loop — as
|
|
30
|
+
* many copies as the width needs, measured, so a short list on a wide screen never leaves a
|
|
31
|
+
* hole. The copies are `aria-hidden` and `inert`: a reader hears the list once, Tab stops on
|
|
32
|
+
* each link once. It stops under the pointer, with the focus inside, and with its pause
|
|
33
|
+
* button — a finger has no hover, and something that moves by itself for more than five
|
|
34
|
+
* seconds must be stoppable (WCAG 2.2.2). Under reduced motion, and on the server, it is a
|
|
35
|
+
* row that scrolls by hand: the server cannot know, so it sends the row, and the browser
|
|
36
|
+
* starts it once it has measured.
|
|
37
|
+
*/
|
|
38
|
+
export declare function Ribbon({ children, label, speed, direction, gap, fade, }: RibbonProps): import("react").JSX.Element;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useReducedMotion } from "./motion.js";
|
|
4
|
+
import { useUiCopy } from "../../foundations/copy.js";
|
|
5
|
+
import { IconButton } from "../../primitives/button/Button.js";
|
|
6
|
+
import { Pause, Play } from "lucide-react";
|
|
7
|
+
import { Children, useLayoutEffect, useRef, useState, } from "react";
|
|
8
|
+
/* Pixels per second. By distance and not by a duration for the whole loop: a ribbon of four
|
|
9
|
+
covers and one of twenty logos then pass at the same pace, the one the eye can follow. */
|
|
10
|
+
const SPEED = { slow: 24, normal: 40, fast: 64 };
|
|
11
|
+
/* The gap is written twice on purpose: between the items, and once more after the last
|
|
12
|
+
(`pe-*`). Every copy is then exactly one period wide, and the track can move one copy and
|
|
13
|
+
start again without a jump — a single row with `gap` lands half a gap off on each turn. */
|
|
14
|
+
const GAP = {
|
|
15
|
+
sm: "gap-2 pe-2",
|
|
16
|
+
md: "gap-4 pe-4",
|
|
17
|
+
lg: "gap-6 pe-6",
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Items that pass by themselves in a loop: a site's covers, its partners' logos.
|
|
21
|
+
*
|
|
22
|
+
* Context: the list is written once for everyone and repeated only to fill the loop — as
|
|
23
|
+
* many copies as the width needs, measured, so a short list on a wide screen never leaves a
|
|
24
|
+
* hole. The copies are `aria-hidden` and `inert`: a reader hears the list once, Tab stops on
|
|
25
|
+
* each link once. It stops under the pointer, with the focus inside, and with its pause
|
|
26
|
+
* button — a finger has no hover, and something that moves by itself for more than five
|
|
27
|
+
* seconds must be stoppable (WCAG 2.2.2). Under reduced motion, and on the server, it is a
|
|
28
|
+
* row that scrolls by hand: the server cannot know, so it sends the row, and the browser
|
|
29
|
+
* starts it once it has measured.
|
|
30
|
+
*/
|
|
31
|
+
export function Ribbon({ children, label, speed = "normal", direction = "left", gap = "md", fade = true, }) {
|
|
32
|
+
const copy = useUiCopy();
|
|
33
|
+
const reduced = useReducedMotion();
|
|
34
|
+
const items = Children.toArray(children);
|
|
35
|
+
const viewport = useRef(null);
|
|
36
|
+
const first = useRef(null);
|
|
37
|
+
const [loop, setLoop] = useState(null);
|
|
38
|
+
const [paused, setPaused] = useState(false);
|
|
39
|
+
const moving = !reduced && loop !== null && items.length > 1;
|
|
40
|
+
/* Measured before paint, again when the width changes (a rotated phone, loaded images). */
|
|
41
|
+
useLayoutEffect(() => {
|
|
42
|
+
if (reduced)
|
|
43
|
+
return;
|
|
44
|
+
const view = viewport.current;
|
|
45
|
+
const list = first.current;
|
|
46
|
+
if (view === null || list === null)
|
|
47
|
+
return;
|
|
48
|
+
const measure = () => {
|
|
49
|
+
const period = list.offsetWidth;
|
|
50
|
+
if (period === 0)
|
|
51
|
+
return;
|
|
52
|
+
const copies = Math.max(2, Math.ceil(view.clientWidth / period) + 1);
|
|
53
|
+
const seconds = period / SPEED[speed];
|
|
54
|
+
setLoop((was) => was?.copies === copies && was.seconds === seconds ? was : { copies, seconds });
|
|
55
|
+
};
|
|
56
|
+
measure();
|
|
57
|
+
const observer = new ResizeObserver(measure);
|
|
58
|
+
observer.observe(view);
|
|
59
|
+
observer.observe(list);
|
|
60
|
+
return () => observer.disconnect();
|
|
61
|
+
}, [reduced, speed]);
|
|
62
|
+
const list = (repeat) => (_jsx("ul", { ref: repeat === 0 ? first : undefined, "data-ui": repeat === 0 ? "ribbon.list" : "ribbon.copy", "aria-hidden": repeat === 0 ? undefined : true, inert: repeat !== 0, className: `flex shrink-0 items-stretch ${GAP[gap]}`, children: items.map((item, at) => (_jsx("li", { className: "flex shrink-0 snap-start", children: item }, at))) }, repeat));
|
|
63
|
+
return (_jsxs("section", { "data-ui": "ribbon", "aria-label": label, "data-moving": moving ? "" : undefined, "data-paused": moving && paused ? "" : undefined, "data-direction": direction, className: "relative min-w-0", style: moving && loop !== null
|
|
64
|
+
? {
|
|
65
|
+
"--ribbon-copies": loop.copies,
|
|
66
|
+
"--ribbon-duration": `${loop.seconds}s`,
|
|
67
|
+
}
|
|
68
|
+
: undefined, children: [_jsx("div", { ref: viewport, "data-ui": "ribbon.viewport",
|
|
69
|
+
/* Still, it is a row to scroll — reachable by keyboard (axe:
|
|
70
|
+
scrollable-region-focusable); moving, the pause button is the stop. */
|
|
71
|
+
tabIndex: moving ? undefined : 0, className: `rounded-control focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary ${moving ? "overflow-clip" : "snap-x overflow-x-auto overscroll-x-contain"} ${fade && moving ? "ribbon-fade" : ""}`, children: _jsxs("div", { className: "ribbon-track", children: [list(0), moving && loop !== null
|
|
72
|
+
? Array.from({ length: loop.copies - 1 }, (_, at) => list(at + 1))
|
|
73
|
+
: null] }) }), !moving ? null : (_jsx("span", { className: "absolute end-3 top-1/2 -translate-y-1/2 rounded-pill bg-surface/90 shadow-raised", children: _jsx(IconButton, { icon: paused ? Play : Pause, label: paused ? copy.ribbon.play : copy.ribbon.pause, size: "sm", onClick: () => setPaused((was) => !was) }) }))] }));
|
|
74
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export type RiseProps = {
|
|
3
|
+
/** The headline, one entry per line: each rises in turn. Where it breaks is the
|
|
4
|
+
* application's decision — a line that does not fit still wraps inside its own mask. */
|
|
5
|
+
lines: readonly ReactNode[];
|
|
6
|
+
/** The step of the first line, when something enters before it. 0 by default. */
|
|
7
|
+
start?: number;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* A headline that rises line by line from behind its own lower edge — the one moment a
|
|
11
|
+
* site's landing opens with.
|
|
12
|
+
*
|
|
13
|
+
* Context: it draws only the lines, so it goes inside the application's own heading, with
|
|
14
|
+
* the heading's own look: `<h1 className="…"><Rise lines={[…]} /></h1>`. A space is written
|
|
15
|
+
* between the lines: each line is a block, and without it a reader announces «estáhabilitado».
|
|
16
|
+
* Under reduced motion the lines are simply there.
|
|
17
|
+
*/
|
|
18
|
+
export declare function Rise({ lines, start }: RiseProps): import("react").JSX.Element[];
|
|
19
|
+
export type AppearProps = {
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
/** Its place in the page's entrance, on the same clock as `Rise`'s lines: after a
|
|
22
|
+
* two-line headline, what follows is step 2, then 3. */
|
|
23
|
+
step?: number;
|
|
24
|
+
/** The element it is. `div` by default. */
|
|
25
|
+
as?: "div" | "span" | "li" | "p";
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* What follows a headline, appearing in its step: the lead, the search box, the call to
|
|
29
|
+
* action.
|
|
30
|
+
*/
|
|
31
|
+
export declare function Appear({ children, step, as: Element }: AppearProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/* No "use client": an entrance is CSS (`rise-line`, `appear-in` in tokens.css). The server
|
|
3
|
+
sends the final state and the browser plays the entrance on its own first paint — there is
|
|
4
|
+
nothing to hydrate and nothing that can differ between the two sides. */
|
|
5
|
+
/** The place of a piece in its page's entrance: 0, 1, 2… on one clock (`--duration-step`). */
|
|
6
|
+
function stepStyle(step) {
|
|
7
|
+
return { "--motion-step": step };
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A headline that rises line by line from behind its own lower edge — the one moment a
|
|
11
|
+
* site's landing opens with.
|
|
12
|
+
*
|
|
13
|
+
* Context: it draws only the lines, so it goes inside the application's own heading, with
|
|
14
|
+
* the heading's own look: `<h1 className="…"><Rise lines={[…]} /></h1>`. A space is written
|
|
15
|
+
* between the lines: each line is a block, and without it a reader announces «estáhabilitado».
|
|
16
|
+
* Under reduced motion the lines are simply there.
|
|
17
|
+
*/
|
|
18
|
+
export function Rise({ lines, start = 0 }) {
|
|
19
|
+
return lines.map((line, at) => (_jsxs("span", { "data-ui": "rise.line", className: "rise-line", style: stepStyle(start + at), children: [_jsx("span", { children: line }), at < lines.length - 1 ? " " : null] }, at)));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* What follows a headline, appearing in its step: the lead, the search box, the call to
|
|
23
|
+
* action.
|
|
24
|
+
*/
|
|
25
|
+
export function Appear({ children, step = 0, as: Element = "div" }) {
|
|
26
|
+
return (_jsx(Element, { "data-ui": "appear", className: "appear-in", style: stepStyle(step), children: children }));
|
|
27
|
+
}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
export { Carousel, type CarouselPerView, type CarouselProps, } from "./Carousel.js";
|
|
2
|
+
export { DrawOnScroll, type DrawOnScrollProps, EnterOnScroll, type EnterOnScrollProps, } from "./OnScroll.js";
|
|
3
|
+
export { Ribbon, type RibbonProps } from "./Ribbon.js";
|
|
4
|
+
export { Appear, type AppearProps, Rise, type RiseProps, } from "./Rise.js";
|
|
2
5
|
export { StoryBar, type StoryBarProps, type StoryItem, type StoryPerson, StoryRing, type StoryRingProps, StoryViewer, type StoryViewerProps, } from "./Stories.js";
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
/* MEDIA AND SOCIAL — slides that turn (Carousel)
|
|
2
|
-
(StoryRing, StoryBar, StoryViewer)
|
|
1
|
+
/* MEDIA AND SOCIAL — slides that turn (Carousel), a person's stories at full screen
|
|
2
|
+
(StoryRing, StoryBar, StoryViewer), and a site's motion: a headline that rises (Rise,
|
|
3
|
+
Appear), lines drawn by the scroll (DrawOnScroll, EnterOnScroll) and items that pass by
|
|
4
|
+
themselves (Ribbon). Data-agnostic: the application passes the content. */
|
|
3
5
|
export { Carousel, } from "./Carousel.js";
|
|
6
|
+
export { DrawOnScroll, EnterOnScroll, } from "./OnScroll.js";
|
|
7
|
+
export { Ribbon } from "./Ribbon.js";
|
|
8
|
+
export { Appear, Rise, } from "./Rise.js";
|
|
4
9
|
export { StoryBar, StoryRing, StoryViewer, } from "./Stories.js";
|
|
@@ -961,6 +961,11 @@ export type UiCopy = {
|
|
|
961
961
|
pause: string;
|
|
962
962
|
play: string;
|
|
963
963
|
};
|
|
964
|
+
/** Items that pass by themselves (`Ribbon`). */
|
|
965
|
+
ribbon: {
|
|
966
|
+
pause: string;
|
|
967
|
+
play: string;
|
|
968
|
+
};
|
|
964
969
|
/** A person's stories (`StoryBar`, `StoryViewer`). */
|
|
965
970
|
stories: {
|
|
966
971
|
label: string;
|
package/dist/tokens.css
CHANGED
|
@@ -803,6 +803,30 @@
|
|
|
803
803
|
takes its opacity. Something set by Enter — the dropdown closes, the text clears — has to
|
|
804
804
|
be seen landing, or the eye looks for where the question went. Behind `motion-safe:`. */
|
|
805
805
|
--animate-chip-in: chip-in var(--duration-quick) var(--ease-out) both;
|
|
806
|
+
|
|
807
|
+
/* ---------------------------------------------------------------- *
|
|
808
|
+
* A SITE'S PAGE — the second register, and the only one that may decorate.
|
|
809
|
+
*
|
|
810
|
+
* Everything above is for a screen used eight hours a day, and there the rule holds.
|
|
811
|
+
* A public site's landing is the opposite case: it is read once, by someone who has not
|
|
812
|
+
* decided to stay, and an entrance that orders the eye — the headline first, then what
|
|
813
|
+
* it promises, then what to do — is part of what it says. So it gets its own clock,
|
|
814
|
+
* slower and declared here, and the components that use it (`Rise`, `Appear`,
|
|
815
|
+
* `DrawOnScroll`, `EnterOnScroll`, `Ribbon`) are for a site's pages. A view (`List`,
|
|
816
|
+
* `Record`) never uses them.
|
|
817
|
+
*
|
|
818
|
+
* entrance 800ms a line that rises, a block that appears, once per page
|
|
819
|
+
* step 120ms the gap between one and the next of the same entrance
|
|
820
|
+
*
|
|
821
|
+
* Every one of them animates only under `prefers-reduced-motion: no-preference`. The
|
|
822
|
+
* global rule at the end of this file shortens durations to 1ms, and that is NOT enough
|
|
823
|
+
* here: it leaves the delays of a staggered entrance in place, a scroll-driven animation
|
|
824
|
+
* converts its duration into a share of the scroll (1ms = all of it, so it keeps
|
|
825
|
+
* moving), and a ribbon cut to one iteration stops on its last frame — half its track
|
|
826
|
+
* away, showing the copy.
|
|
827
|
+
* ---------------------------------------------------------------- */
|
|
828
|
+
--duration-entrance: 800ms;
|
|
829
|
+
--duration-step: 120ms;
|
|
806
830
|
}
|
|
807
831
|
|
|
808
832
|
/* ==================================================================== *
|
|
@@ -941,6 +965,50 @@
|
|
|
941
965
|
}
|
|
942
966
|
}
|
|
943
967
|
|
|
968
|
+
/* A site's page (see «A SITE'S PAGE» in the motion tokens). Individual properties —
|
|
969
|
+
`translate`, `scale` — and not `transform`: Tailwind v4's `translate-*` and `scale-*` write
|
|
970
|
+
these, so an application's own utility on the same element and the entrance do not fight
|
|
971
|
+
over one shorthand. */
|
|
972
|
+
@keyframes rise {
|
|
973
|
+
from {
|
|
974
|
+
translate: 0 110%;
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
@keyframes appear {
|
|
979
|
+
from {
|
|
980
|
+
opacity: 0;
|
|
981
|
+
translate: 0 0.875rem;
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
@keyframes draw-x {
|
|
986
|
+
from {
|
|
987
|
+
scale: 0 1;
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
@keyframes draw-y {
|
|
992
|
+
from {
|
|
993
|
+
scale: 1 0;
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
@keyframes enter {
|
|
998
|
+
from {
|
|
999
|
+
opacity: 0;
|
|
1000
|
+
translate: 0 1.75rem;
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
/* One copy of the list away: the track holds `--ribbon-copies` equal copies, so this lands
|
|
1005
|
+
exactly where the first began. */
|
|
1006
|
+
@keyframes ribbon {
|
|
1007
|
+
to {
|
|
1008
|
+
translate: calc(-100% / var(--ribbon-copies, 2)) 0;
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
|
|
944
1012
|
/* The segment is two fifths of its track: from just off the left edge (-100 % of
|
|
945
1013
|
itself) to just off the right one (250 % of itself = the track's width). */
|
|
946
1014
|
@keyframes progress-sweep {
|
|
@@ -1694,6 +1762,120 @@
|
|
|
1694
1762
|
transform: rotate(180deg);
|
|
1695
1763
|
}
|
|
1696
1764
|
|
|
1765
|
+
/* ==================================================================== *
|
|
1766
|
+
* A SITE'S MOTION — `Rise`, `Appear`, `DrawOnScroll`, `EnterOnScroll`, `Ribbon`.
|
|
1767
|
+
*
|
|
1768
|
+
* Utilities and not only components, so a site can put them on an element of its own (a
|
|
1769
|
+
* timeline's line drawn absolutely, a rule inside a heading). Each one is the final state
|
|
1770
|
+
* first — what the server sends and what a browser without the feature, or a person who
|
|
1771
|
+
* asked for less motion, sees — and the motion is added on top, only under
|
|
1772
|
+
* `no-preference` (why the global rule is not enough: «A SITE'S PAGE», in the tokens).
|
|
1773
|
+
* The order of one entrance is `--motion-step` (0, 1, 2…): one clock for the lines of a
|
|
1774
|
+
* headline and for what follows them.
|
|
1775
|
+
* ==================================================================== */
|
|
1776
|
+
|
|
1777
|
+
/* A line of a headline that rises from behind its own lower edge. The mask is the line box,
|
|
1778
|
+
widened by 0.12em above and below — padding given back with a negative margin, so the
|
|
1779
|
+
layout does not move — or a tight leading cuts the accent of «Á» and the tail of «g». */
|
|
1780
|
+
@utility rise-line {
|
|
1781
|
+
display: block;
|
|
1782
|
+
overflow: clip;
|
|
1783
|
+
padding-block: 0.12em;
|
|
1784
|
+
margin-block: -0.12em;
|
|
1785
|
+
& > * {
|
|
1786
|
+
display: block;
|
|
1787
|
+
}
|
|
1788
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
1789
|
+
& > * {
|
|
1790
|
+
animation: rise var(--duration-entrance) var(--ease-out) both;
|
|
1791
|
+
animation-delay: calc((var(--motion-step, 0) + 1) * var(--duration-step));
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
|
|
1796
|
+
/* What follows the headline, on the same clock. */
|
|
1797
|
+
@utility appear-in {
|
|
1798
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
1799
|
+
animation: appear var(--duration-entrance) var(--ease-out) both;
|
|
1800
|
+
animation-delay: calc((var(--motion-step, 0) + 1) * var(--duration-step));
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
/* Drawn by the scroll itself. `animation-timeline` goes AFTER the shorthand: `animation`
|
|
1805
|
+
resets it. Without scroll-driven animations the line is simply there.
|
|
1806
|
+
The ranges end where every element can get to, even in the last screen of a page: `entry
|
|
1807
|
+
100%` is its lower edge inside the window, which the page's end always reaches. A range
|
|
1808
|
+
that ends at `cover 45%` leaves the last section half drawn — or half transparent — for
|
|
1809
|
+
good. A thin rule is the exception: its entry lasts its own 4px, so it draws over the
|
|
1810
|
+
first quarter of its way up, and in the last screen of a page it is drawn as far as the
|
|
1811
|
+
scroll goes. */
|
|
1812
|
+
@utility draw-on-scroll-x {
|
|
1813
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
1814
|
+
@supports (animation-timeline: view()) {
|
|
1815
|
+
transform-origin: left center;
|
|
1816
|
+
animation: draw-x linear both;
|
|
1817
|
+
animation-timeline: view();
|
|
1818
|
+
animation-range: cover 0% cover 25%;
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
@utility draw-on-scroll-y {
|
|
1824
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
1825
|
+
@supports (animation-timeline: view()) {
|
|
1826
|
+
transform-origin: center top;
|
|
1827
|
+
animation: draw-y linear both;
|
|
1828
|
+
animation-timeline: view();
|
|
1829
|
+
animation-range: entry 0% entry 100%;
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
@utility enter-on-scroll {
|
|
1835
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
1836
|
+
@supports (animation-timeline: view()) {
|
|
1837
|
+
animation: enter linear both;
|
|
1838
|
+
animation-timeline: view();
|
|
1839
|
+
animation-range: entry 0% entry 100%;
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
|
|
1844
|
+
/* The ribbon's track. It moves only once `Ribbon` has measured it (`data-moving` on the
|
|
1845
|
+
root, set in the browser and never under reduced motion), and it stops under the pointer,
|
|
1846
|
+
with the focus inside, and with its pause button. */
|
|
1847
|
+
@utility ribbon-track {
|
|
1848
|
+
display: flex;
|
|
1849
|
+
width: max-content;
|
|
1850
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
1851
|
+
:where([data-ui="ribbon"][data-moving]) & {
|
|
1852
|
+
animation: ribbon var(--ribbon-duration, 40s) linear infinite;
|
|
1853
|
+
}
|
|
1854
|
+
:where([data-ui="ribbon"][data-direction="right"]) & {
|
|
1855
|
+
animation-direction: reverse;
|
|
1856
|
+
}
|
|
1857
|
+
:where(
|
|
1858
|
+
[data-ui="ribbon"]:hover,
|
|
1859
|
+
[data-ui="ribbon"]:focus-within,
|
|
1860
|
+
[data-ui="ribbon"][data-paused]
|
|
1861
|
+
)
|
|
1862
|
+
& {
|
|
1863
|
+
animation-play-state: paused;
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
/* The edges fade instead of cutting a card in two: what leaves is seen leaving. */
|
|
1869
|
+
@utility ribbon-fade {
|
|
1870
|
+
mask-image: linear-gradient(
|
|
1871
|
+
to right,
|
|
1872
|
+
transparent,
|
|
1873
|
+
black calc(var(--spacing) * 16),
|
|
1874
|
+
black calc(100% - var(--spacing) * 16),
|
|
1875
|
+
transparent
|
|
1876
|
+
);
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1697
1879
|
/* ==================================================================== *
|
|
1698
1880
|
* RICH TEXT — the HTML of a note, a description, an email body.
|
|
1699
1881
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sincpro/web-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.17.0",
|
|
4
4
|
"description": "An enterprise web design system for business software — ERPs, back offices, management tools — in React and Tailwind: tokens, primitives, components and the two views every management screen is made of.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|