@sincpro/web-ui 2.15.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.
Files changed (40) hide show
  1. package/README.md +36 -1
  2. package/dist/components/index.d.ts +1 -0
  3. package/dist/components/index.js +1 -0
  4. package/dist/components/media/Carousel.d.ts +34 -0
  5. package/dist/components/media/Carousel.js +148 -0
  6. package/dist/components/media/OnScroll.d.ts +27 -0
  7. package/dist/components/media/OnScroll.js +18 -0
  8. package/dist/components/media/Ribbon.d.ts +39 -0
  9. package/dist/components/media/Ribbon.js +74 -0
  10. package/dist/components/media/Rise.d.ts +31 -0
  11. package/dist/components/media/Rise.js +27 -0
  12. package/dist/components/media/Stories.d.ts +71 -0
  13. package/dist/components/media/Stories.js +174 -0
  14. package/dist/components/media/index.d.ts +5 -0
  15. package/dist/components/media/index.js +9 -0
  16. package/dist/components/media/motion.d.ts +7 -0
  17. package/dist/components/media/motion.js +17 -0
  18. package/dist/components/navigation/PortalNav.d.ts +49 -0
  19. package/dist/components/navigation/PortalNav.js +40 -0
  20. package/dist/components/navigation/index.d.ts +1 -0
  21. package/dist/components/navigation/index.js +3 -0
  22. package/dist/components/preview/FilePreview.d.ts +5 -3
  23. package/dist/components/preview/FilePreview.js +39 -3
  24. package/dist/components/preview/index.d.ts +1 -1
  25. package/dist/components/preview/index.js +1 -1
  26. package/dist/components/preview/previewKind.d.ts +12 -2
  27. package/dist/components/preview/previewKind.js +44 -2
  28. package/dist/components/shell/Notifications.d.ts +64 -0
  29. package/dist/components/shell/Notifications.js +84 -0
  30. package/dist/components/shell/index.d.ts +1 -0
  31. package/dist/components/shell/index.js +3 -0
  32. package/dist/foundations/copy.es.js +35 -0
  33. package/dist/foundations/uiCopy.d.ts +58 -0
  34. package/dist/foundations/uiCopy.js +42 -1
  35. package/dist/primitives/choice/CheckField.d.ts +26 -0
  36. package/dist/primitives/choice/CheckField.js +45 -0
  37. package/dist/primitives/choice/index.d.ts +1 -0
  38. package/dist/primitives/choice/index.js +2 -0
  39. package/dist/tokens.css +182 -0
  40. package/package.json +1 -1
@@ -0,0 +1,84 @@
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 { Button } from "../../primitives/button/Button.js";
6
+ import { Empty } from "../../primitives/notice/Notice.js";
7
+ import { NOTICE_ICON } from "../../primitives/notice/tones.js";
8
+ import { Popover } from "../../primitives/overlay/Popover.js";
9
+ import { Count, countText } from "../../primitives/tag/Count.js";
10
+ import { Avatar } from "../../primitives/value/Avatar.js";
11
+ import { formatRelative } from "../../primitives/value/format.js";
12
+ import { Bell } from "lucide-react";
13
+ import { useMemo, useState } from "react";
14
+ import { Dialog, DialogTrigger, Heading, Pressable } from "react-aria-components";
15
+ /* A badge over an icon is read in a glance: past two digits it says «a lot» (as the systray). */
16
+ const BELL_MAX = 99;
17
+ /**
18
+ * The bell with the unread count, for any header — a public site's, a portal's, not only the
19
+ * ERP's dark bar (that one is `Inbox`).
20
+ *
21
+ * Context: zero is not drawn, past 99 it says «99+», and the number is in the button's name
22
+ * (the badge is only seen), the way `SystrayButton` does it; this one is drawn on the paper's
23
+ * ink, so it sits in a white header.
24
+ */
25
+ export function NotificationBell({ unread = 0, label, icon: Icon = Bell, onPress, children, open: openProp, onOpenChange, }) {
26
+ const copy = useUiCopy();
27
+ const number = useMemo(() => new Intl.NumberFormat(copy.locale), [copy.locale]);
28
+ const [own, setOwn] = useState(false);
29
+ const open = openProp ?? own;
30
+ const setOpen = (next) => {
31
+ if (openProp === undefined)
32
+ setOwn(next);
33
+ onOpenChange?.(next);
34
+ };
35
+ const name = label ?? copy.inbox.label;
36
+ const said = countText(unread, number.format, BELL_MAX);
37
+ const button = (_jsxs("button", { type: "button", "data-ui": "notification-bell", onClick: children === undefined ? onPress : undefined, "aria-label": unread > 0 ? `${name}: ${said}` : name, title: name, className: `relative inline-flex size-(--size-control-md) items-center justify-center rounded-pill text-muted transition-colors duration-(--duration-instant) hover:bg-ink/6 hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary ${open ? "bg-ink/6 text-ink" : ""}`, ...(children === undefined
38
+ ? {}
39
+ : { "aria-haspopup": "dialog", "aria-expanded": open }), children: [_jsx(Icon, { "aria-hidden": true, className: "size-(--size-icon-md)", strokeWidth: 2 }), unread <= 0 ? null : (_jsx("span", { className: "absolute -top-0.5 -right-0.5 flex", children: _jsx(Count, { value: unread, tone: "bad", solid: true, max: BELL_MAX, "aria-hidden": true }) }))] }));
40
+ if (children === undefined)
41
+ return button;
42
+ return (_jsxs(DialogTrigger, { isOpen: open, onOpenChange: setOpen, children: [_jsx(Pressable, { children: button }), _jsx(Popover, { placement: "bottom end", children: _jsx(Dialog, { "aria-label": name, className: "max-h-[inherit] w-(--container-inbox) overflow-auto outline-0", children: _jsx(SurfaceProvider, { value: "canvas", children: typeof children === "function" ? children(() => setOpen(false)) : children }) }) })] }));
43
+ }
44
+ const ICON_TONE = {
45
+ info: "text-info",
46
+ good: "text-good",
47
+ warn: "text-warn",
48
+ bad: "text-bad",
49
+ };
50
+ function sameDay(a, b) {
51
+ return (a.getFullYear() === b.getFullYear() &&
52
+ a.getMonth() === b.getMonth() &&
53
+ a.getDate() === b.getDate());
54
+ }
55
+ /**
56
+ * The notification centre: grouped by «Hoy» and «Antes», a face or an icon, the unread dot,
57
+ * one action per item, «Marcar todo como leído», «Ver más» and the empty state.
58
+ *
59
+ * Context: controlled — it fetches nothing; the application passes the page it has and is
60
+ * told what was opened, read or asked for. Unread is not only a colour: the dot goes with the
61
+ * title in bold and the word said (as `InboxList`). An item's action is a button BESIDE the
62
+ * item, never inside it: one press, one meaning.
63
+ */
64
+ export function NotificationPanel({ items, onOpen, onRead, onReadAll, onMore, title, now, }) {
65
+ const copy = useUiCopy();
66
+ const clock = now ?? new Date();
67
+ const unread = items.filter((item) => item.unread === true).length;
68
+ const today = items.filter((item) => sameDay(new Date(item.when), clock));
69
+ const before = items.filter((item) => !sameDay(new Date(item.when), clock));
70
+ const groups = [
71
+ { key: "today", label: copy.notifications.today, items: today },
72
+ { key: "before", label: copy.notifications.before, items: before },
73
+ ].filter((group) => group.items.length > 0);
74
+ const row = (item) => {
75
+ const fresh = item.unread === true;
76
+ const Icon = item.icon ?? (item.tone === undefined ? undefined : NOTICE_ICON[item.tone]);
77
+ return (_jsxs("li", { className: `flex items-start ${fresh ? "bg-primary/4" : ""}`, children: [_jsxs("button", { type: "button", "data-ui": "notification-panel.item", "data-unread": fresh ? "" : undefined, onClick: () => {
78
+ if (fresh)
79
+ onRead?.(item.id);
80
+ onOpen?.(item.id);
81
+ }, className: "flex min-w-0 flex-1 items-start gap-3 px-3 py-2.5 text-left transition-colors duration-(--duration-instant) hover:bg-ink/4 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary", children: [item.avatar !== undefined ? (_jsx(Avatar, { name: item.avatar.name, size: "lg", ...(item.avatar.src === undefined ? {} : { src: item.avatar.src }) })) : Icon === undefined ? null : (_jsx(Icon, { "aria-hidden": true, strokeWidth: 2, className: `mt-0.5 size-(--size-icon-md) shrink-0 ${item.tone === undefined ? "text-muted" : ICON_TONE[item.tone]}` })), _jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [_jsxs("span", { className: `text-meta text-ink ${fresh ? "font-semibold" : "font-normal"}`, children: [fresh ? _jsxs("span", { className: "sr-only", children: [copy.inbox.unread, ": "] }) : null, item.title] }), item.detail === undefined ? null : (_jsx("span", { className: "line-clamp-2 text-meta text-muted", children: item.detail })), _jsx("span", { className: "text-micro text-muted tabular-nums", children: formatRelative(new Date(item.when), now, copy) })] }), fresh ? (_jsx("span", { "aria-hidden": true, className: "mt-1.5 size-2 shrink-0 rounded-pill bg-primary" })) : null] }), item.action === undefined ? null : (_jsx("span", { className: "shrink-0 py-2 pr-2", children: _jsx(Button, { role: "secondary", size: "sm", onClick: item.action.onPress, children: item.action.label }) }))] }, item.id));
82
+ };
83
+ return (_jsxs("div", { "data-ui": "notification-panel", className: "flex min-w-0 flex-col", children: [_jsxs("div", { className: "flex items-center justify-between gap-3 border-b border-line px-3 py-2", children: [_jsxs(Heading, { level: 2, className: "text-meta font-semibold text-ink", children: [title ?? copy.inbox.label, unread === 0 ? null : (_jsx("span", { className: "ml-1.5 font-normal text-muted tabular-nums", children: fillCopy(copy.inbox.unreadCount, { count: unread }) }))] }), onReadAll === undefined || unread === 0 ? null : (_jsx(Button, { role: "ghost", size: "sm", onClick: onReadAll, children: copy.inbox.markAllRead }))] }), items.length === 0 ? (_jsx(Empty, { sentence: copy.inbox.empty })) : (groups.map((group) => (_jsxs("section", { "aria-label": group.label, "data-ui": "notification-panel.group", children: [_jsx("h3", { className: "px-3 pt-3 pb-1 text-micro font-semibold text-muted uppercase", children: group.label }), _jsx("ul", { className: "flex flex-col divide-y divide-line", children: group.items.map(row) })] }, group.key)))), onMore === undefined || items.length === 0 ? null : (_jsx("div", { className: "border-t border-line px-1 py-1", children: _jsx(Button, { role: "ghost", size: "sm", onClick: onMore, children: copy.notifications.more }) }))] }));
84
+ }
@@ -5,5 +5,6 @@ export { SearchEntry, type SearchEntryProps, } from "./SearchEntry.js";
5
5
  export { type SidebarDrawer, SidebarToggle, useSidebarDrawer, } from "./sidebarDrawer.js";
6
6
  export { type AppEntry, SystrayButton, TopBar, type TopMenu, } from "./TopBar.js";
7
7
  export { Inbox, type InboxItem, InboxList, type InboxListProps, type InboxProps, } from "./Inbox.js";
8
+ export { NotificationBell, type NotificationBellProps, type NotificationItem, NotificationPanel, type NotificationPanelProps, } from "./Notifications.js";
8
9
  export { KioskFrame, type KioskFrameProps, } from "./KioskFrame.js";
9
10
  export { Pane, Panes } from "./Panes.js";
@@ -13,6 +13,9 @@ export { SystrayButton, TopBar, } from "./TopBar.js";
13
13
  /* The notifications: a bell with how many are unread and the list in a popover — or the list
14
14
  alone, as a portal's page. */
15
15
  export { Inbox, InboxList, } from "./Inbox.js";
16
+ /* The notification centre for any header: the bell with its count, and the panel grouped by
17
+ «Hoy» / «Anteriores» with an action per item. Controlled — it fetches nothing. */
18
+ export { NotificationBell, NotificationPanel, } from "./Notifications.js";
16
19
  /* A screen of N sets side by side — the reconciliation: each pane scrolls on its own. */
17
20
  export { KioskFrame, } from "./KioskFrame.js";
18
21
  export { Pane, Panes } from "./Panes.js";
@@ -636,6 +636,35 @@ export const SPANISH_COPY = {
636
636
  close: "Cerrar",
637
637
  empty: "Todavía no hay imágenes",
638
638
  },
639
+ carousel: {
640
+ roledescription: "carrusel",
641
+ slide: "diapositiva",
642
+ position: "{index} de {total}",
643
+ previous: "Diapositiva anterior",
644
+ next: "Diapositiva siguiente",
645
+ goTo: "Ir a la diapositiva {index}",
646
+ pause: "Pausar",
647
+ play: "Reproducir",
648
+ },
649
+ ribbon: {
650
+ pause: "Pausar la cinta",
651
+ play: "Reanudar la cinta",
652
+ },
653
+ stories: {
654
+ label: "Historias",
655
+ open: "Historias de {name}",
656
+ seen: "vistas",
657
+ unseen: "nuevas",
658
+ viewer: "Historias de {name}",
659
+ position: "{index} de {total}",
660
+ previous: "Anterior",
661
+ next: "Siguiente",
662
+ pause: "Pausar",
663
+ play: "Reproducir",
664
+ close: "Cerrar",
665
+ },
666
+ notifications: { today: "Hoy", before: "Anteriores", more: "Ver más" },
667
+ portalNav: { label: "Mi portal" },
639
668
  inbox: {
640
669
  label: "Notificaciones",
641
670
  unread: "Sin leer",
@@ -756,8 +785,14 @@ export const SPANISH_COPY = {
756
785
  pdf: "PDF",
757
786
  text: "Texto",
758
787
  markdown: "Documento",
788
+ video: "Video",
789
+ audio: "Audio",
790
+ office: "Documento de Office",
759
791
  other: "Archivo",
760
792
  },
793
+ office: { doc: "Documento de Word", sheet: "Hoja de cálculo", slides: "Presentación" },
794
+ officeSentence: "Se ve mejor en su programa. Abrilo o descargalo.",
795
+ open: "Abrir",
761
796
  },
762
797
  chat: {
763
798
  thread: "Conversación",
@@ -948,6 +948,51 @@ export type UiCopy = {
948
948
  empty: string;
949
949
  };
950
950
  /** The notifications (`Inbox`, `InboxList`). */
951
+ /** Slides that turn (`Carousel`). */
952
+ carousel: {
953
+ roledescription: string;
954
+ slide: string;
955
+ /** `{index}` of `{total}`. */
956
+ position: string;
957
+ previous: string;
958
+ next: string;
959
+ /** `{index}`: the dot that goes there. */
960
+ goTo: string;
961
+ pause: string;
962
+ play: string;
963
+ };
964
+ /** Items that pass by themselves (`Ribbon`). */
965
+ ribbon: {
966
+ pause: string;
967
+ play: string;
968
+ };
969
+ /** A person's stories (`StoryBar`, `StoryViewer`). */
970
+ stories: {
971
+ label: string;
972
+ /** `{name}`: the ring that opens them. */
973
+ open: string;
974
+ seen: string;
975
+ unseen: string;
976
+ /** `{name}`: the viewer's name. */
977
+ viewer: string;
978
+ /** `{index}` of `{total}`. */
979
+ position: string;
980
+ previous: string;
981
+ next: string;
982
+ pause: string;
983
+ play: string;
984
+ close: string;
985
+ };
986
+ /** The notification centre (`NotificationPanel`); the rest of its words are `inbox`'s. */
987
+ notifications: {
988
+ today: string;
989
+ before: string;
990
+ more: string;
991
+ };
992
+ /** A portal's side menu (`PortalNav`). */
993
+ portalNav: {
994
+ label: string;
995
+ };
951
996
  inbox: {
952
997
  label: string;
953
998
  unread: string;
@@ -1132,8 +1177,21 @@ export type UiCopy = {
1132
1177
  pdf: string;
1133
1178
  text: string;
1134
1179
  markdown: string;
1180
+ video: string;
1181
+ audio: string;
1182
+ office: string;
1135
1183
  other: string;
1136
1184
  };
1185
+ /** The Office card's heading, one per family: the word says which program. */
1186
+ office: {
1187
+ doc: string;
1188
+ sheet: string;
1189
+ slides: string;
1190
+ };
1191
+ /** Under it: why there is no drawing, and what to do. */
1192
+ officeSentence: string;
1193
+ /** Opens the file in a tab of its own. */
1194
+ open: string;
1137
1195
  };
1138
1196
  /** A conversation: the thread of messages and the composer under it. */
1139
1197
  chat: {
@@ -621,6 +621,35 @@ export const ENGLISH_COPY = {
621
621
  close: "Close",
622
622
  empty: "No images yet",
623
623
  },
624
+ carousel: {
625
+ roledescription: "carousel",
626
+ slide: "slide",
627
+ position: "{index} of {total}",
628
+ previous: "Previous slide",
629
+ next: "Next slide",
630
+ goTo: "Go to slide {index}",
631
+ pause: "Pause",
632
+ play: "Play",
633
+ },
634
+ ribbon: {
635
+ pause: "Pause the ribbon",
636
+ play: "Play the ribbon",
637
+ },
638
+ stories: {
639
+ label: "Stories",
640
+ open: "Stories of {name}",
641
+ seen: "seen",
642
+ unseen: "new",
643
+ viewer: "Stories of {name}",
644
+ position: "{index} of {total}",
645
+ previous: "Previous",
646
+ next: "Next",
647
+ pause: "Pause",
648
+ play: "Play",
649
+ close: "Close",
650
+ },
651
+ notifications: { today: "Today", before: "Earlier", more: "See more" },
652
+ portalNav: { label: "My portal" },
624
653
  inbox: {
625
654
  label: "Notifications",
626
655
  unread: "Unread",
@@ -741,7 +770,19 @@ export const ENGLISH_COPY = {
741
770
  nextPage: "Next page",
742
771
  fit: "Fit",
743
772
  actualSize: "Actual size",
744
- kind: { image: "Image", pdf: "PDF", text: "Text", markdown: "Document", other: "File" },
773
+ kind: {
774
+ image: "Image",
775
+ pdf: "PDF",
776
+ text: "Text",
777
+ markdown: "Document",
778
+ video: "Video",
779
+ audio: "Audio",
780
+ office: "Office document",
781
+ other: "File",
782
+ },
783
+ office: { doc: "Word document", sheet: "Spreadsheet", slides: "Presentation" },
784
+ officeSentence: "Its program draws it best. Open it or download it.",
785
+ open: "Open",
745
786
  },
746
787
  chat: {
747
788
  thread: "Conversation",
@@ -0,0 +1,26 @@
1
+ import { type FormMode } from "../../foundations/form.js";
2
+ export type CheckFieldProps = {
3
+ /** The sentence that IS its name: «Recibir el boletín por correo». */
4
+ label: string;
5
+ /** A line under it: what saying yes does. */
6
+ hint?: string;
7
+ checked: boolean;
8
+ onChange?: (next: boolean) => void;
9
+ /** A box (the default) or a switch. In the «settings» style it is always a switch: a
10
+ * settings row turns something on, it does not tick an item of a list. */
11
+ control?: "checkbox" | "switch";
12
+ disabled?: boolean;
13
+ /** Forces the mode; by default the form's (read mode draws the answer). */
14
+ mode?: FormMode;
15
+ };
16
+ /**
17
+ * A yes/no whose sentence is its own name, as a row of a form.
18
+ *
19
+ * Context: a `Checkbox` inside a `Field` says its name twice («Boletín · Recibir el
20
+ * boletín») and, in `FormSection columns`, sits under an empty label — the box at the height
21
+ * of the neighbours' LABELS, not of their controls. This row keeps a label's height empty
22
+ * above it (stacked), or the label column empty beside it (horizontal), so the box lines up
23
+ * with the inputs next to it. In the «settings» style it is that style's row: the sentence
24
+ * and its help on the left, the switch on the right, named by the sentence.
25
+ */
26
+ export declare function CheckField({ label, hint, checked, onChange, control, disabled, mode, }: CheckFieldProps): import("react").JSX.Element;
@@ -0,0 +1,45 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { byDensity, useDensity } from "../../foundations/density.js";
4
+ import { FieldIdsContext, useFormStyle, } from "../../foundations/form.js";
5
+ import { Switch } from "./Switch.js";
6
+ import { Checkbox } from "../field/Checks.js";
7
+ import { useSheetLayout } from "../field/layout.js";
8
+ import { useId } from "react";
9
+ /**
10
+ * A yes/no whose sentence is its own name, as a row of a form.
11
+ *
12
+ * Context: a `Checkbox` inside a `Field` says its name twice («Boletín · Recibir el
13
+ * boletín») and, in `FormSection columns`, sits under an empty label — the box at the height
14
+ * of the neighbours' LABELS, not of their controls. This row keeps a label's height empty
15
+ * above it (stacked), or the label column empty beside it (horizontal), so the box lines up
16
+ * with the inputs next to it. In the «settings» style it is that style's row: the sentence
17
+ * and its help on the left, the switch on the right, named by the sentence.
18
+ */
19
+ export function CheckField({ label, hint, checked, onChange, control = "checkbox", disabled = false, mode, }) {
20
+ const d = useDensity();
21
+ const settings = useFormStyle() === "settings";
22
+ const horizontal = useSheetLayout() === "horizontal";
23
+ const id = useId();
24
+ const hintId = hint === undefined ? undefined : `${id}-hint`;
25
+ const hintNode = hint === undefined ? null : (_jsx("p", { id: hintId, className: "max-w-prose text-micro text-muted", children: hint }));
26
+ if (settings) {
27
+ /* The sentence names the switch the way a field's label does: through the field ids. */
28
+ const ids = {
29
+ id,
30
+ labelId: `${id}-label`,
31
+ label,
32
+ describedBy: hintId,
33
+ invalid: false,
34
+ };
35
+ return (_jsxs("div", { "data-ui": "check-field", "data-style": "settings", className: "flex min-w-0 items-start justify-between gap-6", children: [_jsxs("div", { className: "flex min-w-0 flex-col gap-0.5", children: [_jsx("label", { id: ids.labelId, htmlFor: id, className: "text-meta font-medium text-ink", children: label }), hintNode] }), _jsx(FieldIdsContext.Provider, { value: ids, children: _jsx("span", { className: "shrink-0", children: _jsx(Switch, { checked: checked, onChange: onChange, disabled: disabled, ...(mode === undefined ? {} : { mode }) }) }) })] }));
36
+ }
37
+ const answer = control === "switch" ? (_jsx(Switch, { checked: checked, onChange: onChange, disabled: disabled, describedBy: hintId, ...(mode === undefined ? {} : { mode }), children: label })) : (_jsx(Checkbox, { checked: checked, onChange: onChange, label: label, disabled: disabled, describedBy: hintId, ...(mode === undefined ? {} : { mode }) }));
38
+ /* Its own context: inside a `Field` by mistake it would be named twice. */
39
+ const row = (_jsxs(FieldIdsContext.Provider, { value: null, children: [_jsx("div", { className: "flex min-h-(--size-control-md) items-center", children: answer }), hintNode] }));
40
+ if (horizontal) {
41
+ return (_jsxs("div", { "data-ui": "check-field", className: "grid-label grid min-w-0 items-start gap-x-4", children: [_jsx("span", { "aria-hidden": true }), _jsx("div", { className: "flex min-w-0 flex-col gap-1", children: row })] }));
42
+ }
43
+ /* The empty line is a label's, in its type: the box starts where the neighbours' inputs do. */
44
+ return (_jsxs("div", { "data-ui": "check-field", className: `flex min-w-0 flex-col ${byDensity(d, "gap-1", "gap-0.5")}`, children: [_jsx("span", { "aria-hidden": true, className: "text-micro select-none", children: " " }), _jsx("div", { className: "flex min-w-0 flex-col gap-1", children: row })] }));
45
+ }
@@ -1,3 +1,4 @@
1
+ export { CheckField, type CheckFieldProps, } from "./CheckField.js";
1
2
  export { ComboBox, type ComboBoxProps } from "./ComboBox.js";
2
3
  export { KanbanState, type KanbanStateValue, } from "./KanbanState.js";
3
4
  export { type ChoiceOption, type SegmentOption, } from "./options.js";
@@ -1,6 +1,8 @@
1
1
  /* THE CHOICES — pick one of many by typing (ComboBox), one of a few in sight
2
2
  (RadioGroup, SegmentedControl), turn on or off (Switch), a value in a range (Slider)
3
3
  and search for loose text (SearchField). The value is always plain data. */
4
+ /* A yes/no as a form row: the sentence is its name, lined up with the inputs beside it. */
5
+ export { CheckField, } from "./CheckField.js";
4
6
  export { ComboBox } from "./ComboBox.js";
5
7
  export { KanbanState, } from "./KanbanState.js";
6
8
  export {} from "./options.js";
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.15.0",
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",