@cloudgrid-io/ui 0.67.0 → 0.69.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/dist/blocks/add-tile.d.ts +34 -1
- package/dist/blocks/add-tile.d.ts.map +1 -1
- package/dist/blocks/add-tile.js +34 -1
- package/dist/blocks/add-tile.js.map +1 -1
- package/dist/blocks/entity-card.d.ts +23 -8
- package/dist/blocks/entity-card.d.ts.map +1 -1
- package/dist/blocks/entity-card.js +25 -47
- package/dist/blocks/entity-card.js.map +1 -1
- package/dist/blocks/header-menu.d.ts +41 -5
- package/dist/blocks/header-menu.d.ts.map +1 -1
- package/dist/blocks/header-menu.js +85 -14
- package/dist/blocks/header-menu.js.map +1 -1
- package/dist/blocks/help-menu.d.ts +18 -3
- package/dist/blocks/help-menu.d.ts.map +1 -1
- package/dist/blocks/help-menu.js +59 -6
- package/dist/blocks/help-menu.js.map +1 -1
- package/dist/blocks/home-pinned.d.ts +132 -43
- package/dist/blocks/home-pinned.d.ts.map +1 -1
- package/dist/blocks/home-pinned.js +149 -33
- package/dist/blocks/home-pinned.js.map +1 -1
- package/dist/blocks/inspiration-cards.d.ts +43 -13
- package/dist/blocks/inspiration-cards.d.ts.map +1 -1
- package/dist/blocks/inspiration-cards.js +67 -6
- package/dist/blocks/inspiration-cards.js.map +1 -1
- package/dist/blocks/recent-plugs.js +1 -1
- package/dist/blocks/recent-plugs.js.map +1 -1
- package/dist/blocks/top-creations.js +1 -1
- package/dist/blocks/top-creations.js.map +1 -1
- package/dist/lib/fade-in-picture.d.ts +37 -0
- package/dist/lib/fade-in-picture.d.ts.map +1 -0
- package/dist/lib/fade-in-picture.js +72 -0
- package/dist/lib/fade-in-picture.js.map +1 -0
- package/package.json +1 -1
|
@@ -3,7 +3,10 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { Menu as MenuPrimitive } from "@base-ui/react/menu";
|
|
5
5
|
import { cn } from "../lib/cloudgrid-cn.js";
|
|
6
|
-
import {
|
|
6
|
+
import { AVATAR_PICKER_LABEL } from "./avatar-picker.js";
|
|
7
|
+
import { DropdownMenuContent, DropdownMenuSub, DropdownMenuSubContent } from "../ui/dropdown-menu.js";
|
|
8
|
+
import { ChangePhotoIcon } from "./icons.js";
|
|
9
|
+
import { PictureMenuItems } from "./picture-menu.js";
|
|
7
10
|
/**
|
|
8
11
|
* THE HEADER MENUS' LOOK (#381): the grid, space and account menus of the
|
|
9
12
|
* CloudGrid-2026 header (frames 11324:90626, 11324:90892, 11324:92125).
|
|
@@ -16,13 +19,17 @@ import { DropdownMenuContent } from "../ui/dropdown-menu.js";
|
|
|
16
19
|
* shadow, 12/8 padding, 2px between rows; 252 wide (account 258)
|
|
17
20
|
* section an eyebrow label in slate-500 with an optional action ("+ New" in
|
|
18
21
|
* `--cg-tertiary-dark`); 24 above it when `spaced` (SHARED WITH YOU)
|
|
19
|
-
* row
|
|
20
|
-
*
|
|
21
|
-
* (the
|
|
22
|
-
*
|
|
22
|
+
* row 36 tall in every header menu (ui#588; it was 40, and 44 in the
|
|
23
|
+
* account menu), 6/20 padding, radius 12, Medium 15 Ink, the hand
|
|
24
|
+
* cursor; selected (the current grid or space) on the brand tint,
|
|
25
|
+
* which a hover leaves as it is (ui#588; it was the page colour,
|
|
26
|
+
* almost the hover's grey), with a trailing action (the gear) whose
|
|
27
|
+
* right edge is 20 from the row's
|
|
28
|
+
* band a 16px band with a 1px page-colour line, before Sign out (ui#588;
|
|
29
|
+
* it was 24, with the 44px rows)
|
|
23
30
|
*
|
|
24
31
|
* Two calls the frames left open (spec §8.3, §8.4): row text is Ink (#222), not
|
|
25
|
-
* the frames' #000; Sign out is the same
|
|
32
|
+
* the frames' #000; Sign out is the same row as Profile. Hover and keyboard
|
|
26
33
|
* highlight are not drawn in the frames and use `--cg-hover`.
|
|
27
34
|
*/
|
|
28
35
|
const PANEL_WIDTH = 252;
|
|
@@ -35,10 +42,10 @@ function HeaderMenuSection({ label, action, spaced = false, className, children,
|
|
|
35
42
|
return (_jsxs(MenuPrimitive.Group, { "data-slot": "header-menu-section", className: cn("flex flex-col gap-0.5", className), ...props, children: [_jsxs("div", { "data-slot": "header-menu-section-header", className: cn("flex items-center justify-between px-5 pb-2", spaced && "pt-6"), children: [_jsx(MenuPrimitive.GroupLabel, { "data-slot": "header-menu-section-label", className: "text-eyebrow text-steel uppercase", children: label }), action] }), children] }));
|
|
36
43
|
}
|
|
37
44
|
function HeaderMenuAction({ className, ...props }) {
|
|
38
|
-
return (_jsx(MenuPrimitive.LinkItem, { "data-slot": "header-menu-action", className: cn("rounded-xs text-body-sm font-semibold text-cyan-dark no-underline outline-none", "data-highlighted:bg-(--cg-hover) focus-line", className), ...props }));
|
|
45
|
+
return (_jsx(MenuPrimitive.LinkItem, { "data-slot": "header-menu-action", className: cn("cursor-pointer rounded-xs text-body-sm font-semibold text-cyan-dark no-underline outline-none", "data-highlighted:bg-(--cg-hover) focus-line", className), ...props }));
|
|
39
46
|
}
|
|
40
|
-
function HeaderMenuRow({ children, leading, trailing, selected = false,
|
|
41
|
-
const itemClass = cn("flex min-w-0 flex-1 items-center gap-3 self-stretch rounded-md px-5 text-body-sm leading-none font-medium text-ink no-underline outline-none", "focus-line", "data-disabled:cursor-default data-disabled:opacity-50",
|
|
47
|
+
function HeaderMenuRow({ children, leading, trailing, selected = false, href, render, onClick, disabled, closeOnClick, className, }) {
|
|
48
|
+
const itemClass = cn("flex min-w-0 flex-1 cursor-pointer items-center gap-3 self-stretch rounded-md px-5 py-1.5 text-body-sm leading-none font-medium text-ink no-underline outline-none", "focus-line", "data-disabled:cursor-default data-disabled:opacity-50", trailing && "pr-3");
|
|
42
49
|
const content = (_jsxs(_Fragment, { children: [leading ? (_jsx("span", { "data-slot": "header-menu-row-leading", className: "inline-flex shrink-0 text-steel", children: leading })) : null, _jsx("span", { "data-slot": "header-menu-row-label", className: "-my-1 truncate leading-normal", children: children }), selected ? _jsx("span", { className: "sr-only", children: " (current)" }) : null] }));
|
|
43
50
|
const shared = {
|
|
44
51
|
"data-slot": "header-menu-item",
|
|
@@ -47,10 +54,13 @@ function HeaderMenuRow({ children, leading, trailing, selected = false, size = "
|
|
|
47
54
|
onClick,
|
|
48
55
|
closeOnClick,
|
|
49
56
|
};
|
|
50
|
-
return (_jsxs("div", { "data-slot": "header-menu-row", "data-selected": selected ? "" : undefined, className: cn("flex items-center self-stretch rounded-md",
|
|
57
|
+
return (_jsxs("div", { "data-slot": "header-menu-row", "data-selected": selected ? "" : undefined, className: cn("flex min-h-9 items-center self-stretch rounded-md",
|
|
58
|
+
// ui#588: the current row is the brand tint and keeps it under the
|
|
59
|
+
// pointer; the hover grey is for every other row, so the two never meet.
|
|
60
|
+
selected ? "bg-brand-tint" : "has-[[data-highlighted]]:bg-(--cg-hover)", trailing && "pr-4", className), children: [href || render ? (_jsx(MenuPrimitive.LinkItem, { ...shared, href: href, render: render, children: content })) : (_jsx(MenuPrimitive.Item, { ...shared, disabled: disabled, children: content })), trailing] }));
|
|
51
61
|
}
|
|
52
62
|
function HeaderMenuRowAction({ label, icon, href, render, onClick, disabled = false, }) {
|
|
53
|
-
const className = cn("inline-flex size-7 shrink-0 items-center justify-center rounded-xs text-steel no-underline outline-none", "data-highlighted:bg-(--cg-hover) focus-line [&_svg]:size-5",
|
|
63
|
+
const className = cn("inline-flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-xs text-steel no-underline outline-none", "data-highlighted:bg-(--cg-hover) focus-line [&_svg]:size-5",
|
|
54
64
|
// The library's disabled look for a menu item (dropdown-menu.tsx), only
|
|
55
65
|
// when disabled, so an enabled action's markup is what it was.
|
|
56
66
|
disabled && "data-disabled:pointer-events-none data-disabled:opacity-50");
|
|
@@ -64,10 +74,71 @@ function HeaderMenuRowAction({ label, icon, href, render, onClick, disabled = fa
|
|
|
64
74
|
return href || render ? (_jsx(MenuPrimitive.LinkItem, { "data-slot": "header-menu-row-action", "aria-label": label, href: href, render: render, onClick: onClick, className: className, children: icon })) : (_jsx(MenuPrimitive.Item, { "data-slot": "header-menu-row-action", "aria-label": label, onClick: onClick, className: className, children: icon }));
|
|
65
75
|
}
|
|
66
76
|
function HeaderMenuSeparator({ className, ...props }) {
|
|
67
|
-
return (_jsx(MenuPrimitive.Separator, { "data-slot": "header-menu-separator", className: cn("relative h-
|
|
77
|
+
return (_jsx(MenuPrimitive.Separator, { "data-slot": "header-menu-separator", className: cn("relative h-4 shrink-0 after:absolute after:inset-x-0 after:top-1/2 after:h-px after:bg-page", className), ...props }));
|
|
68
78
|
}
|
|
69
|
-
|
|
70
|
-
|
|
79
|
+
/**
|
|
80
|
+
* The Settings picture's camera (`AvatarPicker`'s mark), class for class: the
|
|
81
|
+
* strong scrim on the ink surface, faded in. Shown on hover, on keyboard focus
|
|
82
|
+
* and while the picture menu is open.
|
|
83
|
+
*/
|
|
84
|
+
const PICTURE_CAMERA_CLASS = cn("absolute inset-0 grid place-items-center rounded-pill bg-scrim-strong text-ink", "opacity-0 transition-opacity duration-150 motion-reduce:transition-none", "group-hover/header-menu-picture:opacity-100 group-focus-visible/header-menu-picture:opacity-100", "group-data-popup-open/header-menu-picture:opacity-100");
|
|
85
|
+
/**
|
|
86
|
+
* The Console's phone breakpoint, as `Shelf` and `HelpMenu` read it. Under it
|
|
87
|
+
* there is no room beside the account menu, so the picture menu opens under
|
|
88
|
+
* the picture.
|
|
89
|
+
*/
|
|
90
|
+
const PHONE = "(max-width: 767px)";
|
|
91
|
+
/** True under `PHONE`. False on the server and the first paint. */
|
|
92
|
+
function usePhoneWidth() {
|
|
93
|
+
const [phone, setPhone] = React.useState(false);
|
|
94
|
+
React.useEffect(() => {
|
|
95
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function")
|
|
96
|
+
return;
|
|
97
|
+
const list = window.matchMedia(PHONE);
|
|
98
|
+
const update = () => setPhone(list.matches);
|
|
99
|
+
update();
|
|
100
|
+
list.addEventListener?.("change", update);
|
|
101
|
+
return () => list.removeEventListener?.("change", update);
|
|
102
|
+
}, []);
|
|
103
|
+
return phone;
|
|
104
|
+
}
|
|
105
|
+
/** The picture menu's gap from the account menu's left edge (Asaf, ui#599). */
|
|
106
|
+
const PICTURE_MENU_GAP = 10;
|
|
107
|
+
/**
|
|
108
|
+
* On a desktop the picture menu opens on the account menu's left: from the
|
|
109
|
+
* picture, which sits at that menu's left edge, the offset is the inset from
|
|
110
|
+
* the picture to the menu's edge, plus the gap.
|
|
111
|
+
*/
|
|
112
|
+
function pastTheMenu(trigger) {
|
|
113
|
+
return () => {
|
|
114
|
+
const el = trigger.current;
|
|
115
|
+
const menu = el?.closest('[role="menu"]');
|
|
116
|
+
if (!el || !menu)
|
|
117
|
+
return PICTURE_MENU_GAP;
|
|
118
|
+
return el.getBoundingClientRect().left - menu.getBoundingClientRect().left + PICTURE_MENU_GAP;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* The account menu's card (`HeaderMenuContent`): its radius, line, ground and
|
|
123
|
+
* shadow, so the picture menu beside it reads as its sibling. The shadow is
|
|
124
|
+
* `shadow-md`, which theme.css points at the card shadow: tailwind-merge
|
|
125
|
+
* knows it as a shadow and drops the submenu's `shadow-lg` (the raised one)
|
|
126
|
+
* for it, where it does not know `shadow-card` and would keep both.
|
|
127
|
+
*/
|
|
128
|
+
const PICTURE_MENU_CARD = "w-max rounded-xl border border-line bg-card text-ink shadow-md ring-0";
|
|
129
|
+
/** The big picture, with its camera, as the trigger of the Settings picture menu. */
|
|
130
|
+
function IdentityPicture({ avatar, menu }) {
|
|
131
|
+
const trigger = React.useRef(null);
|
|
132
|
+
const phone = usePhoneWidth();
|
|
133
|
+
return (
|
|
134
|
+
// Escape closes the account menu too, as it does from any of its rows.
|
|
135
|
+
_jsxs(DropdownMenuSub, { closeParentOnEsc: true, children: [_jsxs(MenuPrimitive.SubmenuTrigger, { ref: trigger, "data-slot": "header-menu-identity-picture", "aria-label": menu.label ?? AVATAR_PICKER_LABEL,
|
|
136
|
+
// A hover shows the camera; only a click (or Enter, Space, Arrow
|
|
137
|
+
// Right) opens the menu.
|
|
138
|
+
openOnHover: false, className: "group/header-menu-picture relative inline-flex shrink-0 cursor-pointer rounded-pill outline-none focus-line", children: [avatar, _jsx("span", { "data-slot": "header-menu-identity-camera", "data-cg-surface": "ink", "aria-hidden": "true", className: PICTURE_CAMERA_CLASS, children: _jsx(ChangePhotoIcon, { className: "size-[40%] min-h-3.5 min-w-3.5 shrink-0" }) })] }), _jsx(DropdownMenuSubContent, { "data-slot": "header-menu-picture-menu", side: phone ? "bottom" : "left", align: "start", alignOffset: 0, sideOffset: phone ? 4 : pastTheMenu(trigger), className: PICTURE_MENU_CARD, children: _jsx(PictureMenuItems, { noun: "photo", picture: menu.picture, onAdjust: menu.onAdjust, onPick: menu.onPick, onRemove: menu.onRemove }) })] }));
|
|
139
|
+
}
|
|
140
|
+
function HeaderMenuIdentity({ avatar, name, detail, pictureMenu, className, }) {
|
|
141
|
+
return (_jsxs("div", { "data-slot": "header-menu-identity", className: cn("flex items-center gap-4 pb-1.5", className), children: [pictureMenu ? _jsx(IdentityPicture, { avatar: avatar, menu: pictureMenu }) : avatar, _jsxs("div", { className: "flex min-w-0 flex-col", children: [_jsx("span", { className: "truncate text-body-sm font-medium text-ink", children: name }), detail ? _jsx("span", { className: "truncate text-body-sm text-steel", children: detail }) : null] })] }));
|
|
71
142
|
}
|
|
72
143
|
export { HeaderMenuAction, HeaderMenuContent, HeaderMenuIdentity, HeaderMenuRow, HeaderMenuRowAction, HeaderMenuSection, HeaderMenuSeparator, };
|
|
73
144
|
//# sourceMappingURL=header-menu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header-menu.js","sourceRoot":"","sources":["../../src/blocks/header-menu.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,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AK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAC/B,KAAK,EAAC,OAAO,EACb,WAAW,EAAE,CAAC,EACd,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,EAC5C,SAAS,EAAE,iBAAiB,YAE5B,KAAC,gBAAgB,IACf,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ,GACvB,GACqB,IACT,CACnB,CAAA;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,EAC1B,MAAM,EACN,IAAI,EACJ,MAAM,EACN,WAAW,EACX,SAAS,GAiBV;IACC,OAAO,CACL,4BAAe,sBAAsB,EAAC,SAAS,EAAE,EAAE,CAAC,gCAAgC,EAAE,SAAS,CAAC,aAC7F,WAAW,CAAC,CAAC,CAAC,KAAC,eAAe,IAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAI,CAAC,CAAC,CAAC,MAAM,EAC9E,eAAK,SAAS,EAAC,uBAAuB,aACpC,eAAM,SAAS,EAAC,4CAA4C,YAAE,IAAI,GAAQ,EACzE,MAAM,CAAC,CAAC,CAAC,eAAM,SAAS,EAAC,kCAAkC,YAAE,MAAM,GAAQ,CAAC,CAAC,CAAC,IAAI,IAC/E,IACF,CACP,CAAA;AACH,CAAC;AAED,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,GAEpB,CAAA"}
|
|
@@ -21,7 +21,14 @@ declare const HELP_COPY: Readonly<{
|
|
|
21
21
|
needHelp: "Need help?";
|
|
22
22
|
/** Read after "Read the docs" by a screen reader: the link opens a new tab. */
|
|
23
23
|
newTab: "(opens in a new tab)";
|
|
24
|
+
/** The row that opens the website's legal pages (ui#597). */
|
|
25
|
+
learnMore: "Learn more";
|
|
24
26
|
}>;
|
|
27
|
+
/** One of the website's pages under Learn more: its own name, and where it is. */
|
|
28
|
+
type HelpMenuLink = {
|
|
29
|
+
label: string;
|
|
30
|
+
href: string;
|
|
31
|
+
};
|
|
25
32
|
/**
|
|
26
33
|
* HELP MENU: the "?" button and the small menu it opens.
|
|
27
34
|
*
|
|
@@ -30,7 +37,9 @@ declare const HELP_COPY: Readonly<{
|
|
|
30
37
|
* menu the library's dropdown menu, 232 wide, under the button's right
|
|
31
38
|
* edge: "Chat with us" (`onChat`), "Read the docs" (a link to
|
|
32
39
|
* `docsHref`, in a new tab), a separator, "Report a problem"
|
|
33
|
-
* (`onReport`), each after its glyph
|
|
40
|
+
* (`onReport`), each after its glyph; with `legalLinks`, a
|
|
41
|
+
* separator and "Learn more", which opens the website's legal
|
|
42
|
+
* pages, each in a new tab (`LearnMore`, ui#597)
|
|
34
43
|
* keyboard the library's menu: Enter or Space opens it on the first row,
|
|
35
44
|
* the arrows move between rows, Escape closes it and gives the
|
|
36
45
|
* button its focus back. No outline on a click; the line for the
|
|
@@ -41,18 +50,24 @@ declare const HELP_COPY: Readonly<{
|
|
|
41
50
|
* `container`, as for any library menu. `open`, `defaultOpen` and
|
|
42
51
|
* `onOpenChange` are the menu's own.
|
|
43
52
|
*/
|
|
44
|
-
declare function HelpMenu({ onChat, onReport, docsHref, open, defaultOpen, onOpenChange, container, className, ...props }: Omit<React.ComponentProps<typeof DropdownMenuTrigger>, "children" | "render" | "className"> & {
|
|
53
|
+
declare function HelpMenu({ onChat, onReport, docsHref, legalLinks, open, defaultOpen, onOpenChange, container, className, ...props }: Omit<React.ComponentProps<typeof DropdownMenuTrigger>, "children" | "render" | "className"> & {
|
|
45
54
|
/** Opens the chat. */
|
|
46
55
|
onChat: () => void;
|
|
47
56
|
/** Opens the way to report a problem. */
|
|
48
57
|
onReport: () => void;
|
|
49
58
|
/** The docs, opened in a new tab. */
|
|
50
59
|
docsHref: string;
|
|
60
|
+
/**
|
|
61
|
+
* ui#597: the website's legal pages, under "Learn more", each in a new tab,
|
|
62
|
+
* with the website's own names: the Console passes Terms & Conditions,
|
|
63
|
+
* Privacy and Launch Offer Terms. No list, or an empty one: no Learn more.
|
|
64
|
+
*/
|
|
65
|
+
legalLinks?: readonly HelpMenuLink[];
|
|
51
66
|
open?: React.ComponentProps<typeof DropdownMenu>["open"];
|
|
52
67
|
defaultOpen?: React.ComponentProps<typeof DropdownMenu>["defaultOpen"];
|
|
53
68
|
onOpenChange?: React.ComponentProps<typeof DropdownMenu>["onOpenChange"];
|
|
54
69
|
container?: React.ComponentProps<typeof DropdownMenuContent>["container"];
|
|
55
70
|
className?: string;
|
|
56
71
|
}): React.JSX.Element;
|
|
57
|
-
export { HELP_COPY, HelpMenu };
|
|
72
|
+
export { HELP_COPY, HelpMenu, type HelpMenuLink };
|
|
58
73
|
//# sourceMappingURL=help-menu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help-menu.d.ts","sourceRoot":"","sources":["../../src/blocks/help-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EACL,YAAY,EACZ,mBAAmB,
|
|
1
|
+
{"version":3,"file":"help-menu.d.ts","sourceRoot":"","sources":["../../src/blocks/help-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EACL,YAAY,EACZ,mBAAmB,EAOnB,mBAAmB,EACpB,MAAM,6BAA6B,CAAA;AAWpC;;;;;;;;;;GAUG;AACH,QAAA,MAAM,SAAS;IACb,6CAA6C;;;;;IAK7C,iEAAiE;;IAEjE,+EAA+E;;IAE/E,6DAA6D;;EAE7D,CAAA;AAEF,kFAAkF;AAClF,KAAK,YAAY,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AA8GnD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,iBAAS,QAAQ,CAAC,EAChB,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,WAAW,EACX,YAAY,EACZ,SAAS,EACT,SAAS,EACT,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,EAAE,UAAU,GAAG,QAAQ,GAAG,WAAW,CAAC,GAAG;IAC/F,sBAAsB;IACtB,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,yCAAyC;IACzC,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,qCAAqC;IACrC,QAAQ,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,YAAY,EAAE,CAAA;IACpC,IAAI,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA;IACxD,WAAW,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC,aAAa,CAAC,CAAA;IACtE,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC,cAAc,CAAC,CAAA;IACxE,SAAS,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,CAAC,WAAW,CAAC,CAAA;IACzE,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,qBAmDA;AAED,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,YAAY,EAAE,CAAA"}
|
package/dist/blocks/help-menu.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx,
|
|
2
|
+
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { cn } from "../lib/cloudgrid-cn.js";
|
|
5
|
-
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLinkItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "../ui/dropdown-menu.js";
|
|
6
|
-
import { ChatWithUsIcon, DocsIcon, HelpIcon, ReportProblemIcon } from "./icons.js";
|
|
5
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLinkItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, } from "../ui/dropdown-menu.js";
|
|
6
|
+
import { ChatWithUsIcon, ChevronRightIcon, DocsIcon, HelpIcon, InfoIcon, ReportProblemIcon, } from "./icons.js";
|
|
7
7
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip.js";
|
|
8
8
|
/**
|
|
9
9
|
* THE HELP ENTRY (ui#563, Asaf, 2026-11-22). The Console's floating chat
|
|
@@ -26,6 +26,8 @@ const HELP_COPY = Object.freeze({
|
|
|
26
26
|
needHelp: "Need help?",
|
|
27
27
|
/** Read after "Read the docs" by a screen reader: the link opens a new tab. */
|
|
28
28
|
newTab: "(opens in a new tab)",
|
|
29
|
+
/** The row that opens the website's legal pages (ui#597). */
|
|
30
|
+
learnMore: "Learn more",
|
|
29
31
|
});
|
|
30
32
|
/**
|
|
31
33
|
* The Console top bar's bell button (NotificationsBell), class for class, so
|
|
@@ -35,6 +37,55 @@ const HELP_COPY = Object.freeze({
|
|
|
35
37
|
const TRIGGER_CLASS = "relative inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-full border-0 bg-transparent text-steel transition-colors hover:bg-(--cg-hover) focus-line";
|
|
36
38
|
/** A row: the library's menu row, roomier, with its 16px glyph 10 before the words. */
|
|
37
39
|
const ROW_CLASS = "min-h-8 gap-2.5 px-2.5 py-1.5";
|
|
40
|
+
/**
|
|
41
|
+
* The Console's phone breakpoint, as `Shelf` reads it. Under it Learn more
|
|
42
|
+
* opens its pages inside the same menu: a side menu beside a menu that already
|
|
43
|
+
* spans most of a phone would be off the screen.
|
|
44
|
+
*/
|
|
45
|
+
const PHONE = "(max-width: 767px)";
|
|
46
|
+
/** True under `PHONE`. False on the server and the first paint. */
|
|
47
|
+
function usePhoneWidth() {
|
|
48
|
+
const [phone, setPhone] = React.useState(false);
|
|
49
|
+
React.useEffect(() => {
|
|
50
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function")
|
|
51
|
+
return;
|
|
52
|
+
const list = window.matchMedia(PHONE);
|
|
53
|
+
const update = () => setPhone(list.matches);
|
|
54
|
+
update();
|
|
55
|
+
list.addEventListener?.("change", update);
|
|
56
|
+
return () => list.removeEventListener?.("change", update);
|
|
57
|
+
}, []);
|
|
58
|
+
return phone;
|
|
59
|
+
}
|
|
60
|
+
/** A legal page: a link to a new tab, said so to a screen reader, as Read the docs is. */
|
|
61
|
+
function LegalLink({ link, className }) {
|
|
62
|
+
return (_jsxs(DropdownMenuLinkItem, { "data-slot": "help-menu-legal-link", className: cn(ROW_CLASS, className), href: link.href, target: "_blank", rel: "noopener noreferrer", children: [link.label, _jsxs("span", { className: "sr-only", children: [" ", HELP_COPY.newTab] })] }));
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* LEARN MORE (ui#597): the website's legal pages, after a divider.
|
|
66
|
+
*
|
|
67
|
+
* On a wide screen, the library's submenu beside the menu: a hover or a click
|
|
68
|
+
* opens it, Arrow Right opens it on its first page, Arrow Left closes it and
|
|
69
|
+
* gives Learn more its focus back, Escape closes the whole menu. On a phone's
|
|
70
|
+
* width the pages open inside the same menu, under Learn more, which says
|
|
71
|
+
* whether they are open (`aria-expanded`) and turns its chevron down; the
|
|
72
|
+
* arrows open and close it there too.
|
|
73
|
+
*/
|
|
74
|
+
function LearnMore({ links }) {
|
|
75
|
+
const phone = usePhoneWidth();
|
|
76
|
+
const [open, setOpen] = React.useState(false);
|
|
77
|
+
if (!phone) {
|
|
78
|
+
return (
|
|
79
|
+
// Escape closes the whole menu, not only the pages.
|
|
80
|
+
_jsxs(DropdownMenuSub, { closeParentOnEsc: true, children: [_jsxs(DropdownMenuSubTrigger, { "data-slot": "help-menu-learn-more", className: ROW_CLASS, children: [_jsx(InfoIcon, {}), HELP_COPY.learnMore] }), _jsx(DropdownMenuSubContent, { "data-slot": "help-menu-legal", sideOffset: 8, className: "w-58", children: links.map((link) => (_jsx(LegalLink, { link: link }, link.href))) })] }));
|
|
81
|
+
}
|
|
82
|
+
return (_jsxs(_Fragment, { children: [_jsxs(DropdownMenuItem, { "data-slot": "help-menu-learn-more", "aria-expanded": open, closeOnClick: false, className: ROW_CLASS, onClick: () => setOpen((was) => !was), onKeyDown: (e) => {
|
|
83
|
+
if (e.key === "ArrowRight")
|
|
84
|
+
setOpen(true);
|
|
85
|
+
if (e.key === "ArrowLeft")
|
|
86
|
+
setOpen(false);
|
|
87
|
+
}, children: [_jsx(InfoIcon, {}), HELP_COPY.learnMore, _jsx(ChevronRightIcon, { className: cn("ml-auto transition-transform motion-reduce:transition-none", open && "rotate-90") })] }), open ? (_jsx("div", { "data-slot": "help-menu-legal", role: "group", "aria-label": HELP_COPY.learnMore, children: links.map((link) => (_jsx(LegalLink, { link: link, className: "pl-[2.25rem]" }, link.href))) })) : null] }));
|
|
88
|
+
}
|
|
38
89
|
/**
|
|
39
90
|
* HELP MENU: the "?" button and the small menu it opens.
|
|
40
91
|
*
|
|
@@ -43,7 +94,9 @@ const ROW_CLASS = "min-h-8 gap-2.5 px-2.5 py-1.5";
|
|
|
43
94
|
* menu the library's dropdown menu, 232 wide, under the button's right
|
|
44
95
|
* edge: "Chat with us" (`onChat`), "Read the docs" (a link to
|
|
45
96
|
* `docsHref`, in a new tab), a separator, "Report a problem"
|
|
46
|
-
* (`onReport`), each after its glyph
|
|
97
|
+
* (`onReport`), each after its glyph; with `legalLinks`, a
|
|
98
|
+
* separator and "Learn more", which opens the website's legal
|
|
99
|
+
* pages, each in a new tab (`LearnMore`, ui#597)
|
|
47
100
|
* keyboard the library's menu: Enter or Space opens it on the first row,
|
|
48
101
|
* the arrows move between rows, Escape closes it and gives the
|
|
49
102
|
* button its focus back. No outline on a click; the line for the
|
|
@@ -54,11 +107,11 @@ const ROW_CLASS = "min-h-8 gap-2.5 px-2.5 py-1.5";
|
|
|
54
107
|
* `container`, as for any library menu. `open`, `defaultOpen` and
|
|
55
108
|
* `onOpenChange` are the menu's own.
|
|
56
109
|
*/
|
|
57
|
-
function HelpMenu({ onChat, onReport, docsHref, open, defaultOpen, onOpenChange, container, className, ...props }) {
|
|
110
|
+
function HelpMenu({ onChat, onReport, docsHref, legalLinks, open, defaultOpen, onOpenChange, container, className, ...props }) {
|
|
58
111
|
return (_jsxs(DropdownMenu, { open: open, defaultOpen: defaultOpen, onOpenChange: onOpenChange, children: [_jsxs(Tooltip, { children: [_jsx(TooltipTrigger
|
|
59
112
|
// The tooltip repeats the button's name; describing the button by it
|
|
60
113
|
// as well would read "Help" twice.
|
|
61
|
-
, { "aria-describedby": undefined, render: _jsx(DropdownMenuTrigger, { "data-slot": "help-menu-trigger", "aria-label": HELP_COPY.label, className: cn(TRIGGER_CLASS, className), ...props }), children: _jsx(HelpIcon, { className: "size-5" }) }), _jsx(TooltipContent, { side: "bottom", children: HELP_COPY.label })] }), _jsxs(DropdownMenuContent, { "data-slot": "help-menu-content", align: "end", sideOffset: 8, container: container, className: "w-58", children: [_jsxs(DropdownMenuItem, { "data-slot": "help-menu-chat", className: ROW_CLASS, onClick: onChat, children: [_jsx(ChatWithUsIcon, {}), HELP_COPY.chat] }), _jsxs(DropdownMenuLinkItem, { "data-slot": "help-menu-docs", className: ROW_CLASS, href: docsHref, target: "_blank", rel: "noopener noreferrer", children: [_jsx(DocsIcon, {}), HELP_COPY.docs, _jsxs("span", { className: "sr-only", children: [" ", HELP_COPY.newTab] })] }), _jsx(DropdownMenuSeparator, { className: "mx-1 my-1.5" }), _jsxs(DropdownMenuItem, { "data-slot": "help-menu-report", className: ROW_CLASS, onClick: onReport, children: [_jsx(ReportProblemIcon, {}), HELP_COPY.report] })] })] }));
|
|
114
|
+
, { "aria-describedby": undefined, render: _jsx(DropdownMenuTrigger, { "data-slot": "help-menu-trigger", "aria-label": HELP_COPY.label, className: cn(TRIGGER_CLASS, className), ...props }), children: _jsx(HelpIcon, { className: "size-5" }) }), _jsx(TooltipContent, { side: "bottom", children: HELP_COPY.label })] }), _jsxs(DropdownMenuContent, { "data-slot": "help-menu-content", align: "end", sideOffset: 8, container: container, className: "w-58", children: [_jsxs(DropdownMenuItem, { "data-slot": "help-menu-chat", className: ROW_CLASS, onClick: onChat, children: [_jsx(ChatWithUsIcon, {}), HELP_COPY.chat] }), _jsxs(DropdownMenuLinkItem, { "data-slot": "help-menu-docs", className: ROW_CLASS, href: docsHref, target: "_blank", rel: "noopener noreferrer", children: [_jsx(DocsIcon, {}), HELP_COPY.docs, _jsxs("span", { className: "sr-only", children: [" ", HELP_COPY.newTab] })] }), _jsx(DropdownMenuSeparator, { className: "mx-1 my-1.5" }), _jsxs(DropdownMenuItem, { "data-slot": "help-menu-report", className: ROW_CLASS, onClick: onReport, children: [_jsx(ReportProblemIcon, {}), HELP_COPY.report] }), legalLinks?.length ? (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, { className: "mx-1 my-1.5" }), _jsx(LearnMore, { links: legalLinks })] })) : null] })] }));
|
|
62
115
|
}
|
|
63
116
|
export { HELP_COPY, HelpMenu };
|
|
64
117
|
//# sourceMappingURL=help-menu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help-menu.js","sourceRoot":"","sources":["../../src/blocks/help-menu.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,E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G,EACjD,MAAC,gBAAgB,iBAAW,kBAAkB,EAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,aACpF,KAAC,iBAAiB,KAAG,EACpB,SAAS,CAAC,MAAM,IACA,EAClB,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,CACpB,8BACE,KAAC,qBAAqB,IAAC,SAAS,EAAC,aAAa,GAAG,EACjD,KAAC,SAAS,IAAC,KAAK,EAAE,UAAU,GAAI,IAC/B,CACJ,CAAC,CAAC,CAAC,IAAI,IACY,IACT,CAChB,CAAA;AACH,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAqB,CAAA"}
|
|
@@ -11,14 +11,25 @@ import { type EntityKind } from "./entity-card.js";
|
|
|
11
11
|
*
|
|
12
12
|
* ## Pinned
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* Four a page, each a small My creations card (ui#591, Asaf's pick for
|
|
15
|
+
* console#1170, 2026-11-24): the Home card (`EntityCard look="home"`), smaller.
|
|
16
|
+
* The picture, with the views count at its top right (`views`: the Home card's
|
|
17
|
+
* views, in the Home card's materials, on one line: the eye, then the number);
|
|
18
|
+
* under it the filled pin, in the brand purple, before
|
|
19
|
+
* the name, which truncates; the type at the right of the name line; and the
|
|
20
|
+
* caller's `byline` ("By you · 2 days ago", or the owner's name and the time)
|
|
21
|
+
* under that. The whole card is the item's link. With more than four, an arrow
|
|
22
|
+
* at the right pages forward and, once the row has moved, its mirror at the left
|
|
23
|
+
* pages back (ui#587, Tamir's review in console#1170): the previous arrow is
|
|
24
|
+
* not there on the first page and the next arrow is not there on the last, so
|
|
25
|
+
* neither wraps around. When a press takes its own arrow away, keyboard focus
|
|
26
|
+
* goes to the other arrow rather than to the page. With fewer than four the
|
|
27
|
+
* rest of the row is the empty state's soft slots, each the size of a card, so
|
|
28
|
+
* a pinned creation is the same size whether it has company or not.
|
|
19
29
|
*
|
|
20
30
|
* Hover an item and its picture dims a little while an "Unpin" chip eases in
|
|
21
|
-
* at the picture's top right
|
|
31
|
+
* at the picture's top right, where the views count was: the count gives way
|
|
32
|
+
* as the chip arrives (ui#591). The chip is its own button, beside the item's
|
|
22
33
|
* link rather than in it (no nested interactive), laid over the picture: a
|
|
23
34
|
* click on the chip calls `onUnpin`, a click anywhere else on the item opens
|
|
24
35
|
* the creation. The chip is out of reach of the pointer until it shows, so a
|
|
@@ -45,24 +56,34 @@ import { type EntityKind } from "./entity-card.js";
|
|
|
45
56
|
* top corners are the arrow's and the chip's. The name truncates before the
|
|
46
57
|
* mark, which keeps its place. No `kind`, no mark.
|
|
47
58
|
*
|
|
48
|
-
* ##
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* picture: 6 + 24 + 12 + 70 + 6 = 118 a picture,
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
59
|
+
* ## Fewer where the box is narrower, two on a phone (ui#559, ui#591)
|
|
60
|
+
*
|
|
61
|
+
* A page needs room for the arrow, a 12 gap and the whole chip on each
|
|
62
|
+
* picture: 6 + 24 + 12 + 70 + 6 = 118 a picture, in its card's 2 a side (the
|
|
63
|
+
* hairline and the pad), 122 a card. Four with their three 12 gaps and the
|
|
64
|
+
* pager are 556 (`PINNED_FOUR_MIN`, in rem at 16), three 422
|
|
65
|
+
* (`PINNED_THREE_MIN`). Narrower than four's, Pinned shows three a page;
|
|
66
|
+
* narrower than three's (a phone), two; the pager steps by what shows, and the
|
|
67
|
+
* empty state's slots follow. The width is Pinned's own, never the screen's or
|
|
68
|
+
* the user agent's, and the columns are CSS, as the inspiration card's rows
|
|
69
|
+
* are (#549): Pinned is a container (`@container/pinned`); under 34.75rem of
|
|
70
|
+
* it (556 at a 16 root) the row is three columns and the fourth of a server's
|
|
71
|
+
* page of four is hidden, under 26.375rem (422) two and the third hidden too,
|
|
72
|
+
* so the first paint is right and nothing re-lays out when the script
|
|
60
73
|
* arrives. The script only pages: it reads the width once in the commit that
|
|
61
|
-
* mounts Pinned, then with one ResizeObserver (`useBand`)
|
|
62
|
-
*
|
|
63
|
-
*
|
|
74
|
+
* mounts Pinned, then with one ResizeObserver (`useBand`). With exactly four
|
|
75
|
+
* pinned the server renders the pager three and two a page need, hidden from
|
|
76
|
+
* 34.75rem, where four fit without it; with three, the pager two a page
|
|
77
|
+
* needs, hidden from 26.375rem.
|
|
64
78
|
*
|
|
65
|
-
* Empty:
|
|
79
|
+
* Empty: four soft slots, an outline pin in each, "Pin a creation" under. A
|
|
80
|
+
* slot is a card's size (ui#591): the card's frame with its line clear, the
|
|
81
|
+
* picture's box, and the card's text block, of a fixed height.
|
|
82
|
+
* With `onAddPin` (ui#587) each slot, the art and the label, is one button
|
|
83
|
+
* that calls it (the Console opens its search window, where every result has
|
|
84
|
+
* a pin): the hand cursor, the library's hover wash over the art's own
|
|
85
|
+
* ground, the keyboard line, and the label as its name. Without it the slot is
|
|
86
|
+
* a picture and a label, as it always was.
|
|
66
87
|
*
|
|
67
88
|
* ## No picture: the identity (ui#573)
|
|
68
89
|
*
|
|
@@ -76,20 +97,41 @@ import { type EntityKind } from "./entity-card.js";
|
|
|
76
97
|
* 48-wide thumbnails take the small one (`size="thumb"`). Without a `seed`
|
|
77
98
|
* the thumbnail is exactly what it was: the picture, or the blank.
|
|
78
99
|
*
|
|
100
|
+
* A pinned picture fades in once it has loaded (ui#598), in 150ms on the
|
|
101
|
+
* library's ease, over the thumbnail's ground or the identity, so it never
|
|
102
|
+
* pops in; under reduced motion it is there at once. It still dims on hover.
|
|
103
|
+
* Pinned's pictures, and the Continue rows' thumbnails, show the top of the
|
|
104
|
+
* creation, its header and title, not its middle (ui#561).
|
|
105
|
+
*
|
|
79
106
|
* ## The values
|
|
80
107
|
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* state's slots
|
|
84
|
-
*
|
|
108
|
+
* card the Home card's frame: a hairline at 12 (`rounded-md`), a 1
|
|
109
|
+
* pad inside it, on `bg-card`; the row's four are 12 apart, the
|
|
110
|
+
* empty state's slots too
|
|
111
|
+
* thumbnail the Home card's 159/92, its top corners at 11 (the card's 12
|
|
112
|
+
* less the pad), on `bg-raised` until the picture paints
|
|
113
|
+
* views 6 in from the picture's top right, where the chip arrives: 20
|
|
114
|
+
* tall at radius 8, 6 aside, the 12 eye in `text-steel`, 4, the
|
|
115
|
+
* number in Small; the Home card's pill's white at 85% with its
|
|
116
|
+
* blur and the mark's lift, so it does not flip with the surface
|
|
117
|
+
* phone at two a page, the name line alone: no byline, no type mark,
|
|
118
|
+
* the text 42 tall; the Unpin chip the glyph alone in a 24
|
|
119
|
+
* circle, as the live arrow is (Asaf, 2026-11-24)
|
|
120
|
+
* text 62 tall, whatever it holds: 10 above, 12 aside and under. The
|
|
121
|
+
* name line, 20: the 15 filled pin in the accent role
|
|
85
122
|
* (`--cg-text-accent`: the brand purple on the page, white on the
|
|
86
|
-
* panel, lime on ink), 6,
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
123
|
+
* panel, lime on ink), 6, the name in Small Medium (`text-caption
|
|
124
|
+
* font-medium`), and the 16 type mark at the right. 4 under it
|
|
125
|
+
* the byline in Small, the Home card's muted line
|
|
126
|
+
* on hover the chip and the live arrow 6 in from the picture's corners
|
|
127
|
+
* (8 from the card's), the count fading as they arrive
|
|
128
|
+
* arrows 24, the caret in the action colour (`text-cyan-dark`), 8 after
|
|
129
|
+
* the row (next) or 8 before it (previous), centred on it; the
|
|
130
|
+
* two are one class list, mirrored
|
|
131
|
+
* slot the card's box, its line clear: the picture's box in `bg-page`
|
|
132
|
+
* at radius 8 (the page grey; the hover wash on the panel and
|
|
133
|
+
* ink, where the page grey would be a light slab), a 30 outline
|
|
134
|
+
* pin in the middle, and the card's text block with
|
|
93
135
|
* "Pin a creation" in Small, `text-faint-strong`
|
|
94
136
|
* continue rows 40 tall, 6 apart: a 48 by 30 thumbnail at radius 8, 12,
|
|
95
137
|
* the name in Small Medium, and the time at the right in Small
|
|
@@ -111,7 +153,7 @@ export type HomeCreation = {
|
|
|
111
153
|
thumbnailSrc?: string;
|
|
112
154
|
/** Where it opens. Without it, `onOpen` makes the item a button. */
|
|
113
155
|
href?: string;
|
|
114
|
-
/** What it is: draws the
|
|
156
|
+
/** What it is: draws its mark at the right of a pinned card's name line. */
|
|
115
157
|
kind?: EntityKind;
|
|
116
158
|
/**
|
|
117
159
|
* The live creation. On a pinned item it draws the open live arrow, a new-tab
|
|
@@ -126,6 +168,19 @@ export type HomeCreation = {
|
|
|
126
168
|
* name, so pass the id: a rename then keeps the look.
|
|
127
169
|
*/
|
|
128
170
|
seed?: string;
|
|
171
|
+
/**
|
|
172
|
+
* How many have viewed it. On a pinned card, the views count at the
|
|
173
|
+
* picture's top right (ui#591): drawn short (1.2K), announced whole ("1,204
|
|
174
|
+
* views"), shown only above zero. It gives way to the Unpin chip on hover.
|
|
175
|
+
*/
|
|
176
|
+
views?: number;
|
|
177
|
+
/**
|
|
178
|
+
* The line under a pinned card's name (ui#591): "By you · 2 days ago" for the
|
|
179
|
+
* reader's own creation, the owner's name and the time for another's
|
|
180
|
+
* ("Dana · 4 days ago"). The caller's words, as the Home card's `byline`
|
|
181
|
+
* is. Without it, no line; the card keeps its height.
|
|
182
|
+
*/
|
|
183
|
+
byline?: React.ReactNode;
|
|
129
184
|
};
|
|
130
185
|
/** A creation the reader opened lately, and when, in the caller's words. */
|
|
131
186
|
export type RecentlyOpenedCreation = HomeCreation & {
|
|
@@ -133,15 +188,40 @@ export type RecentlyOpenedCreation = HomeCreation & {
|
|
|
133
188
|
opened: React.ReactNode;
|
|
134
189
|
};
|
|
135
190
|
/**
|
|
136
|
-
* The least width of Pinned (its row and the pager) that shows
|
|
137
|
-
* (ui#
|
|
138
|
-
* the 70 chip, 6
|
|
139
|
-
* the pager
|
|
191
|
+
* The least width of Pinned (its row and the pager) that shows four a page
|
|
192
|
+
* (ui#591), in px at a 16px root: four cards of 122 (a picture of 118: 6, the
|
|
193
|
+
* 24 arrow, 12, the 70 chip, 6; in its 2 of frame a side), three 12 gaps, and
|
|
194
|
+
* the 24 pager with its 8. It is measured with the pager in, whether or not it
|
|
195
|
+
* shows, so showing it never changes the count.
|
|
140
196
|
*/
|
|
141
|
-
export declare const
|
|
197
|
+
export declare const PINNED_FOUR_MIN = 556;
|
|
198
|
+
/**
|
|
199
|
+
* The least width of Pinned that shows three a page (ui#559): three cards of
|
|
200
|
+
* 122, two 12 gaps and the pager, measured as `PINNED_FOUR_MIN` is. Narrower,
|
|
201
|
+
* two (a phone).
|
|
202
|
+
*/
|
|
203
|
+
export declare const PINNED_THREE_MIN = 422;
|
|
204
|
+
/**
|
|
205
|
+
* Where Pinned's arrows are, `count` pinned on `page` (from 0) at `perPage` a
|
|
206
|
+
* page (ui#587): the previous arrow once the row has moved, the next arrow
|
|
207
|
+
* while a later page has something. No wrap around: `page` past the last is
|
|
208
|
+
* the last (a list that shrank shows its last page), before the first the
|
|
209
|
+
* first. Before the script has measured, the CSS shows fewer of a page than
|
|
210
|
+
* `perPage` where Pinned is narrower (three or two of the server's four;
|
|
211
|
+
* ui#559, ui#591), so one those columns leave behind needs the next arrow
|
|
212
|
+
* there and only there: `nextNarrowOnly` is the most a page shows where it is
|
|
213
|
+
* needed (3: under the four line; 2: under the three line), or false.
|
|
214
|
+
*/
|
|
215
|
+
export declare function pinnedPager(count: number, page: number, perPage: 2 | 3 | 4): {
|
|
216
|
+
page: number;
|
|
217
|
+
pages: number;
|
|
218
|
+
prev: boolean;
|
|
219
|
+
next: boolean;
|
|
220
|
+
nextNarrowOnly: false | 2 | 3;
|
|
221
|
+
};
|
|
142
222
|
/** How many pinned creations a page shows at `width` px of Pinned, the root font at `rem` px. */
|
|
143
|
-
export declare function pinnedPerPage(width: number, rem: number): 2 | 3;
|
|
144
|
-
declare function PinnedCreations({ items, onUnpin, onOpen, linkComponent, emptyLabel, unpinLabel, liveLabel, nextLabel, className, ...props }: Omit<React.ComponentProps<"div">, "children"> & {
|
|
223
|
+
export declare function pinnedPerPage(width: number, rem: number): 2 | 3 | 4;
|
|
224
|
+
declare function PinnedCreations({ items, onUnpin, onOpen, linkComponent, emptyLabel, unpinLabel, liveLabel, nextLabel, prevLabel, onAddPin, className, ...props }: Omit<React.ComponentProps<"div">, "children"> & {
|
|
145
225
|
/** The pinned creations, in the caller's order. */
|
|
146
226
|
items: readonly HomeCreation[];
|
|
147
227
|
/** The reader pressed Unpin on one. No chip without it. */
|
|
@@ -156,8 +236,15 @@ declare function PinnedCreations({ items, onUnpin, onOpen, linkComponent, emptyL
|
|
|
156
236
|
unpinLabel?: string;
|
|
157
237
|
/** The open live arrow's name and tooltip. A screen reader hears the creation's name after it. */
|
|
158
238
|
liveLabel?: string;
|
|
159
|
-
/** The arrow's accessible name. */
|
|
239
|
+
/** The next arrow's accessible name. */
|
|
160
240
|
nextLabel?: string;
|
|
241
|
+
/** The previous arrow's accessible name (ui#587). */
|
|
242
|
+
prevLabel?: string;
|
|
243
|
+
/**
|
|
244
|
+
* The reader pressed an empty slot, "Pin a creation" (ui#587): each slot is
|
|
245
|
+
* a button that calls this. Without it the slots are pictures, as before.
|
|
246
|
+
*/
|
|
247
|
+
onAddPin?: () => void;
|
|
161
248
|
}): React.JSX.Element;
|
|
162
249
|
declare function RecentlyOpened({ items, onOpen, linkComponent, emptyLabel, className, ...props }: Omit<React.ComponentProps<"ul">, "children"> & {
|
|
163
250
|
/** The creations, most recent first, as the caller orders them. */
|
|
@@ -174,11 +261,13 @@ declare function RecentlyOpened({ items, onOpen, linkComponent, emptyLabel, clas
|
|
|
174
261
|
* The card shell is #533's `BentoCard`, its children 14 apart as the design
|
|
175
262
|
* draws this card.
|
|
176
263
|
*/
|
|
177
|
-
declare function PinnedCard({ pinned, recent, onUnpin, onOpen, linkComponent, title, continueTitle, className, ...props }: Omit<React.ComponentProps<"section">, "title" | "children"> & {
|
|
264
|
+
declare function PinnedCard({ pinned, recent, onUnpin, onOpen, onAddPin, linkComponent, title, continueTitle, className, ...props }: Omit<React.ComponentProps<"section">, "title" | "children"> & {
|
|
178
265
|
pinned: readonly HomeCreation[];
|
|
179
266
|
recent: readonly RecentlyOpenedCreation[];
|
|
180
267
|
onUnpin?: (item: HomeCreation) => void;
|
|
181
268
|
onOpen?: (item: HomeCreation) => void;
|
|
269
|
+
/** Makes each empty Pinned slot a button that calls it (ui#587). */
|
|
270
|
+
onAddPin?: () => void;
|
|
182
271
|
linkComponent?: React.ElementType;
|
|
183
272
|
title?: React.ReactNode;
|
|
184
273
|
continueTitle?: React.ReactNode;
|