@cloudgrid-io/ui 0.64.0 → 0.65.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 (112) hide show
  1. package/dist/blocks/add-tile.d.ts +16 -1
  2. package/dist/blocks/add-tile.d.ts.map +1 -1
  3. package/dist/blocks/add-tile.js +20 -3
  4. package/dist/blocks/add-tile.js.map +1 -1
  5. package/dist/blocks/bento-card-hint.d.ts +16 -0
  6. package/dist/blocks/bento-card-hint.d.ts.map +1 -0
  7. package/dist/blocks/bento-card-hint.js +23 -0
  8. package/dist/blocks/bento-card-hint.js.map +1 -0
  9. package/dist/blocks/bento-card.d.ts +59 -0
  10. package/dist/blocks/bento-card.d.ts.map +1 -0
  11. package/dist/blocks/bento-card.js +59 -0
  12. package/dist/blocks/bento-card.js.map +1 -0
  13. package/dist/blocks/coming-soon-hint.d.ts.map +1 -1
  14. package/dist/blocks/coming-soon-hint.js +110 -7
  15. package/dist/blocks/coming-soon-hint.js.map +1 -1
  16. package/dist/blocks/creation-search.d.ts +147 -0
  17. package/dist/blocks/creation-search.d.ts.map +1 -0
  18. package/dist/blocks/creation-search.js +239 -0
  19. package/dist/blocks/creation-search.js.map +1 -0
  20. package/dist/blocks/entity-card.d.ts +80 -2
  21. package/dist/blocks/entity-card.d.ts.map +1 -1
  22. package/dist/blocks/entity-card.js +162 -17
  23. package/dist/blocks/entity-card.js.map +1 -1
  24. package/dist/blocks/from-your-grid.d.ts +66 -0
  25. package/dist/blocks/from-your-grid.d.ts.map +1 -0
  26. package/dist/blocks/from-your-grid.js +63 -0
  27. package/dist/blocks/from-your-grid.js.map +1 -0
  28. package/dist/blocks/grid-profile.d.ts +10 -1
  29. package/dist/blocks/grid-profile.d.ts.map +1 -1
  30. package/dist/blocks/grid-profile.js +57 -6
  31. package/dist/blocks/grid-profile.js.map +1 -1
  32. package/dist/blocks/home-bento.d.ts +86 -0
  33. package/dist/blocks/home-bento.d.ts.map +1 -0
  34. package/dist/blocks/home-bento.js +87 -0
  35. package/dist/blocks/home-bento.js.map +1 -0
  36. package/dist/blocks/home-empty-illustrations.d.ts +37 -0
  37. package/dist/blocks/home-empty-illustrations.d.ts.map +1 -0
  38. package/dist/blocks/home-empty-illustrations.js +47 -0
  39. package/dist/blocks/home-empty-illustrations.js.map +1 -0
  40. package/dist/blocks/home-pinned.d.ts +120 -0
  41. package/dist/blocks/home-pinned.d.ts.map +1 -0
  42. package/dist/blocks/home-pinned.js +58 -0
  43. package/dist/blocks/home-pinned.js.map +1 -0
  44. package/dist/blocks/icons.d.ts +33 -0
  45. package/dist/blocks/icons.d.ts.map +1 -1
  46. package/dist/blocks/icons.js +33 -0
  47. package/dist/blocks/icons.js.map +1 -1
  48. package/dist/blocks/inspiration-cards.d.ts +241 -0
  49. package/dist/blocks/inspiration-cards.d.ts.map +1 -0
  50. package/dist/blocks/inspiration-cards.js +234 -0
  51. package/dist/blocks/inspiration-cards.js.map +1 -0
  52. package/dist/blocks/liquid-glass.d.ts +106 -0
  53. package/dist/blocks/liquid-glass.d.ts.map +1 -0
  54. package/dist/blocks/liquid-glass.js +283 -0
  55. package/dist/blocks/liquid-glass.js.map +1 -0
  56. package/dist/blocks/meter.d.ts +5 -2
  57. package/dist/blocks/meter.d.ts.map +1 -1
  58. package/dist/blocks/meter.js +4 -0
  59. package/dist/blocks/meter.js.map +1 -1
  60. package/dist/blocks/motion.d.ts +46 -0
  61. package/dist/blocks/motion.d.ts.map +1 -0
  62. package/dist/blocks/motion.js +144 -0
  63. package/dist/blocks/motion.js.map +1 -0
  64. package/dist/blocks/needs-attention.d.ts +78 -0
  65. package/dist/blocks/needs-attention.d.ts.map +1 -0
  66. package/dist/blocks/needs-attention.js +29 -0
  67. package/dist/blocks/needs-attention.js.map +1 -0
  68. package/dist/blocks/phosphor-marks.d.ts +12 -0
  69. package/dist/blocks/phosphor-marks.d.ts.map +1 -1
  70. package/dist/blocks/phosphor-marks.js +18 -0
  71. package/dist/blocks/phosphor-marks.js.map +1 -1
  72. package/dist/blocks/ranked-list.d.ts +7 -1
  73. package/dist/blocks/ranked-list.d.ts.map +1 -1
  74. package/dist/blocks/ranked-list.js +8 -6
  75. package/dist/blocks/ranked-list.js.map +1 -1
  76. package/dist/blocks/recent-plugs.d.ts +66 -0
  77. package/dist/blocks/recent-plugs.d.ts.map +1 -0
  78. package/dist/blocks/recent-plugs.js +20 -0
  79. package/dist/blocks/recent-plugs.js.map +1 -0
  80. package/dist/blocks/shared-grid-illustration.d.ts +55 -0
  81. package/dist/blocks/shared-grid-illustration.d.ts.map +1 -0
  82. package/dist/blocks/shared-grid-illustration.js +81 -0
  83. package/dist/blocks/shared-grid-illustration.js.map +1 -0
  84. package/dist/blocks/shelf-strip.d.ts +36 -0
  85. package/dist/blocks/shelf-strip.d.ts.map +1 -0
  86. package/dist/blocks/shelf-strip.js +32 -0
  87. package/dist/blocks/shelf-strip.js.map +1 -0
  88. package/dist/blocks/stat-tile.d.ts +17 -1
  89. package/dist/blocks/stat-tile.d.ts.map +1 -1
  90. package/dist/blocks/stat-tile.js +4 -1
  91. package/dist/blocks/stat-tile.js.map +1 -1
  92. package/dist/blocks/top-creations.d.ts +76 -0
  93. package/dist/blocks/top-creations.d.ts.map +1 -0
  94. package/dist/blocks/top-creations.js +54 -0
  95. package/dist/blocks/top-creations.js.map +1 -0
  96. package/dist/index.d.ts +15 -0
  97. package/dist/index.d.ts.map +1 -1
  98. package/dist/index.js +15 -0
  99. package/dist/index.js.map +1 -1
  100. package/dist/lib/fit.d.ts +39 -0
  101. package/dist/lib/fit.d.ts.map +1 -0
  102. package/dist/lib/fit.js +92 -0
  103. package/dist/lib/fit.js.map +1 -0
  104. package/dist/lib/motion.d.ts +126 -0
  105. package/dist/lib/motion.d.ts.map +1 -0
  106. package/dist/lib/motion.js +132 -0
  107. package/dist/lib/motion.js.map +1 -0
  108. package/dist/ui/dialog.d.ts +7 -1
  109. package/dist/ui/dialog.d.ts.map +1 -1
  110. package/dist/ui/dialog.js +2 -2
  111. package/dist/ui/dialog.js.map +1 -1
  112. package/package.json +2 -1
@@ -0,0 +1,234 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cn } from "../lib/cloudgrid-cn.js";
5
+ import { useBand, useFits } from "../lib/fit.js";
6
+ import { Badge } from "../ui/badge.js";
7
+ import { Button } from "../ui/button.js";
8
+ import { CopyButton } from "./copy-button.js";
9
+ import { CheckIcon, ChevronLeftIcon, ChevronRightIcon, CopyIcon } from "./icons.js";
10
+ import { GeminiColorMark } from "./onboard-widget.js";
11
+ import { ONBOARD_WIDGET_SLOTS, bindLogoCycle, createLogoCycle, } from "./onboard-widget-content.js";
12
+ import { ToolLogo } from "./tool-logo.js";
13
+ import { TOOL_MARKS } from "./tool-marks.js";
14
+ /** The tags: the word and the tint, per category. */
15
+ export const INSPIRATION_CATEGORIES = Object.freeze({
16
+ work: Object.freeze({ label: "For work", className: "bg-lime-tint" }),
17
+ everyday: Object.freeze({ label: "Everyday", className: "bg-brand-100" }),
18
+ fun: Object.freeze({ label: "Just for fun", className: "bg-cyan-tint" }),
19
+ });
20
+ /** The words around the ideas. */
21
+ export const INSPIRATION_COPY = Object.freeze({
22
+ title: "Your grid starts with your creations.",
23
+ subtitle: "Need inspiration? Pick an idea and make it yours.",
24
+ copy: "Copy prompt",
25
+ copied: "Copied",
26
+ blocked: "Couldn't copy",
27
+ announceCopied: "Prompt copied. Paste it into your AI coding tool.",
28
+ pasteIn: "Paste in",
29
+ /** Read after "Paste in" by a screen reader only: the mark beside it is hidden. */
30
+ pasteInEnd: "your AI coding tool",
31
+ previous: "Previous page",
32
+ next: "Next page",
33
+ });
34
+ /** The agent marks the Paste in slot shows: the pill's, slot by slot, A then B. */
35
+ export const PASTE_IN_MARKS = Object.freeze(ONBOARD_WIDGET_SLOTS.flatMap((s) => [s.a, s.b]));
36
+ const REST_MARK = ONBOARD_WIDGET_SLOTS[0].a;
37
+ /**
38
+ * The mark the Paste in slot shows after the pill's cycle moves from `prev` to
39
+ * `next`: the mark the first slot that crossed turned to. With nothing crossed,
40
+ * the rest mark, slot 1's A.
41
+ */
42
+ export function pasteInMark(prev, next) {
43
+ const i = next.findIndex((set, j) => set !== prev[j]);
44
+ if (i === -1)
45
+ return REST_MARK;
46
+ const slot = ONBOARD_WIDGET_SLOTS[i];
47
+ return next[i] === "a" ? slot.a : slot.b;
48
+ }
49
+ /** The mark shown now, turned by the pill's cycle unless held still. */
50
+ function useAgentMark(still) {
51
+ const [mark, setMark] = React.useState(REST_MARK);
52
+ React.useEffect(() => {
53
+ if (still || typeof window === "undefined" || typeof window.matchMedia !== "function")
54
+ return;
55
+ const reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)");
56
+ let prev = ONBOARD_WIDGET_SLOTS.map(() => "a");
57
+ const cycle = createLogoCycle({
58
+ onChange: (next) => {
59
+ // Reduced motion switched on mid-loop: `bindLogoCycle` stops the cycle
60
+ // and resets it to every slot's A, which is the rest mark, whichever
61
+ // slot that reset happened to move.
62
+ const reset = reducedMotion.matches && next.every((set) => set === "a");
63
+ setMark(reset ? REST_MARK : pasteInMark(prev, next));
64
+ prev = [...next];
65
+ },
66
+ });
67
+ return bindLogoCycle(cycle, { document, reducedMotion });
68
+ }, [still]);
69
+ return still ? REST_MARK : mark;
70
+ }
71
+ /** One 20px place, every mark stacked, the shown one at full opacity. */
72
+ function AgentMark({ still }) {
73
+ const shown = useAgentMark(still);
74
+ return (_jsx("span", { "data-slot": "inspiration-card-agent", "data-agent-shown": shown, "aria-hidden": "true", className: "relative size-5 shrink-0", children: PASTE_IN_MARKS.map((name) => {
75
+ const { Mark, hex } = TOOL_MARKS[name];
76
+ const colour = ONBOARD_WIDGET_SLOTS.some((s) => s.a === name && s.aColour);
77
+ return (_jsx("span", { "data-agent": name, className: cn(
78
+ // The pill's crossfade: CSS's own ease-in-out over 600ms.
79
+ "absolute inset-0 flex transition-opacity duration-600 ease-[ease-in-out] motion-reduce:transition-none", shown === name ? "opacity-100" : "opacity-0"), children: colour ? _jsx(ToolLogo, { name: name, mark: _jsx(GeminiColorMark, {}) }) : _jsx(ToolLogo, { name: name, mark: _jsx(Mark, {}), hex: hex }) }, name));
80
+ }) }));
81
+ }
82
+ /** The button's three faces in one cell: the shown one visible, the others keep the width. */
83
+ function Face({ face, shown, children }) {
84
+ const on = face === shown;
85
+ return (_jsx("span", { "data-face": face, "aria-hidden": on ? undefined : true, className: cn("col-start-1 row-start-1 inline-flex items-center justify-center gap-1.5", on ? "visible" : "invisible"), children: children }));
86
+ }
87
+ /**
88
+ * Paper on every surface. `data-theme="default"` puts every --cg- token back to
89
+ * its default inside, but the shadcn bridge's names are declared per surface and
90
+ * arrive already resolved, so the ground reads `--cg-surface-card` directly
91
+ * (not `bg-card`) and `--ring`, which `focus-line` draws in, is declared again
92
+ * here from the reset --cg-text-accent: Primary on this white, where the
93
+ * panel's white line or ink's lime would not show.
94
+ */
95
+ const LIGHT_SCOPE = "[--ring:var(--cg-text-accent)]";
96
+ const COPY_BUTTON_CLASS =
97
+ // The design's compact filled button: 34 tall, 10 aside, 6 between the word
98
+ // and the 18px icon, radius 8. The family's type, at the caption's size.
99
+ "h-8.5 gap-1.5 rounded-xs px-2.5 text-caption font-bold";
100
+ const SPECIMEN_CLASS = {
101
+ hover: "bg-cyan-press",
102
+ // focus-line's look, drawn without the focus.
103
+ focus: "outline-1 outline-solid outline-offset-2 outline-(--ring)",
104
+ };
105
+ function InspirationCard({ image, category, title, description, prompt, specimen, className, }) {
106
+ const titleId = React.useId();
107
+ const tag = INSPIRATION_CATEGORIES[category];
108
+ const [state, setState] = React.useState("idle");
109
+ const face = specimen === "copied" ? "copied" : specimen === "blocked" ? "blocked" : state;
110
+ return (_jsxs("article", { "data-slot": "inspiration-card", "data-theme": "default", className: cn("flex h-full min-w-0 flex-col gap-2.5 rounded-md border border-hairline bg-(--cg-surface-card) p-2.75 font-ui text-ink", LIGHT_SCOPE, className), children: [_jsx("img", { "data-slot": "inspiration-card-picture", src: image, alt: "", loading: "lazy", decoding: "async", className: "block aspect-[26/15] w-full rounded-xs bg-page object-cover" }), _jsx(Badge, { "data-slot": "inspiration-card-tag", "data-category": category, className: cn("h-5.5 rounded-full px-2.5 py-0 text-caption font-bold leading-none text-ink", tag.className), children: tag.label }), _jsxs("div", { className: "flex min-w-0 flex-col gap-1", children: [_jsx("h3", { id: titleId, "data-slot": "inspiration-card-title", className: "m-0 text-body-sm font-bold text-ink", children: title }), _jsx("p", { "data-slot": "inspiration-card-description", className: "m-0 min-h-[2lh] text-caption text-ink", children: description })] }), _jsxs("div", { "data-slot": "inspiration-card-actions", className: "mt-auto flex flex-wrap items-center justify-between gap-x-1 gap-y-2", children: [_jsx(CopyButton, { value: prompt, copiedLabel: INSPIRATION_COPY.copied, blockedLabel: INSPIRATION_COPY.blocked, announceCopied: INSPIRATION_COPY.announceCopied, onStateChange: setState, render: _jsx(Button, { "data-slot": "inspiration-card-copy", "data-face": face, "aria-describedby": titleId, size: "sm", className: cn(COPY_BUTTON_CLASS, specimen && SPECIMEN_CLASS[specimen]) }), children: () => (_jsxs("span", { className: "inline-grid", children: [_jsxs(Face, { face: "idle", shown: face, children: [INSPIRATION_COPY.copy, _jsx("span", { "data-slot": "inspiration-card-copy-icon", className: "inline-flex size-4.5", children: _jsx(CopyIcon, { className: "size-full" }) })] }), _jsxs(Face, { face: "copied", shown: face, children: [INSPIRATION_COPY.copied, _jsx("span", { "data-slot": "inspiration-card-check", className: "inline-flex size-4.5", children: _jsx(CheckIcon, { className: "size-full" }) })] }), _jsx(Face, { face: "blocked", shown: face, children: INSPIRATION_COPY.blocked })] })) }), _jsxs("span", { "data-slot": "inspiration-card-paste-in", className: "ml-auto inline-flex shrink-0 items-center gap-1.25 text-caption text-faint-strong", children: [_jsxs("span", { children: [INSPIRATION_COPY.pasteIn, _jsxs("span", { className: "sr-only", children: [" ", INSPIRATION_COPY.pasteInEnd] })] }), _jsx(AgentMark, { still: specimen !== undefined })] })] })] }));
111
+ }
112
+ /**
113
+ * The rows, in CSS, so the server's page is the hydrated one (nothing moves
114
+ * when the script arrives). The card's inside is its outer width less the
115
+ * 24 padding, so `INSPIRATION_COLUMNS`' outer 516 and 776 are 468 and 728
116
+ * here. One to a row, 16 apart, under 468; two, 12 apart, from 468, the
117
+ * third idea of a server's page of three hidden (the script then pages two
118
+ * at a time, so the same two are in view); three, 16 apart, from 728.
119
+ */
120
+ const PAGE_COLUMNS = "m-0 grid list-none grid-cols-1 gap-4 p-0 @min-[468px]/inspiration-cards:grid-cols-2 @min-[468px]/inspiration-cards:gap-3 @min-[728px]/inspiration-cards:grid-cols-3 @min-[728px]/inspiration-cards:gap-4 @min-[468px]/inspiration-cards:@max-[728px]/inspiration-cards:[&>li:nth-child(n+3)]:hidden";
121
+ /**
122
+ * Two to a row is 20 inside, not 24, and a card cannot set its own padding
123
+ * from its own size: its rows come 4 out on every side instead.
124
+ */
125
+ const TWO_INSET = "@min-[468px]/inspiration-cards:@max-[728px]/inspiration-cards:*:-mx-1 @min-[468px]/inspiration-cards:@max-[728px]/inspiration-cards:*:first:-mt-1 @min-[468px]/inspiration-cards:@max-[728px]/inspiration-cards:*:last:-mb-1";
126
+ /**
127
+ * Where the card puts its ideas two to a row (ui#546, Asaf's option A): under
128
+ * 40rem inside three do not fit, and stacked one under another the card is
129
+ * very tall on a narrow laptop. Two to a row is tighter (Asaf, 2026-11-20):
130
+ * 12 between the idea cards and 20 inside the card, against 16 and 24.
131
+ *
132
+ * The widths are the card's OUTER width, so the band does not move when two
133
+ * to a row changes the padding. An idea card's action row is Copy prompt
134
+ * (126.4) + 4 + Paste in with its mark (72.5) = 202.9 here; CI's Linux
135
+ * Chromium sets it 3.1 wider, 206.0. An idea card adds 12 each side (11
136
+ * padding, the 1px edge).
137
+ *
138
+ * - `twoMin` 516: two idea cards each fit their row on one line on Linux too,
139
+ * with the same 2 to spare: 206.0 + 24 + 2 = 232; two, 12 apart, 20 inside
140
+ * each side = 516 (the bare Linux minimum is 512). The Home at 1024 is 519.
141
+ * Under it, a phone, one to a row as before.
142
+ * - `threeMin` 776: three idea cards each fit their row on one line on Linux
143
+ * too, with 2 to spare: 206.0 + 24 + 2 = 232, the design's own card; three,
144
+ * 16 apart, 24 inside each side = 776, the card on the Home at 1440. Under
145
+ * it a card is too narrow for three (at 40rem inside, the old rule, Paste
146
+ * in wrapped at 1366), so it shows two.
147
+ */
148
+ export const INSPIRATION_COLUMNS = Object.freeze({ twoMin: 516, threeMin: 776, padding: 24, gap: 16, twoPadding: 20, twoGap: 12 });
149
+ /** How many ideas a row holds at the card's outer width: 1, 2 from `twoMin`, 3 from `threeMin`. */
150
+ export function inspirationColumns(width) {
151
+ const c = INSPIRATION_COLUMNS;
152
+ if (width >= c.threeMin)
153
+ return 3;
154
+ if (width >= c.twoMin)
155
+ return 2;
156
+ return 1;
157
+ }
158
+ /**
159
+ * Ideas per page: `pageSize` (3) three to a row and on a phone; two thirds of
160
+ * it (2) two to a row; twice that (4) two to a row with room for a second row.
161
+ */
162
+ export function inspirationPerPage({ pageSize, columns, secondRow }) {
163
+ const size = Math.max(1, Math.floor(pageSize));
164
+ if (columns !== 2)
165
+ return size;
166
+ const row = Math.max(1, Math.round((size * 2) / 3));
167
+ return secondRow ? row * 2 : row;
168
+ }
169
+ /** The page, from 0, that holds idea `first` when pages hold `perPage`. */
170
+ export function inspirationPageOf(first, perPage) {
171
+ return Math.floor(Math.max(0, first) / Math.max(1, perPage));
172
+ }
173
+ /** The pager's arrow: a 28 by 30 ghost button, an 18px chevron, dimmed at the end. */
174
+ const ARROW_CLASS = "h-7.5 w-7 text-ink hover:bg-(--cg-hover) hover:text-ink aria-disabled:cursor-default aria-disabled:opacity-30 aria-disabled:hover:bg-transparent [&_svg]:size-4.5";
175
+ function InspirationCards({ ideas, title = INSPIRATION_COPY.title, subtitle = INSPIRATION_COPY.subtitle, pageSize = 3, layout = "paged", page: pageProp, defaultPage = 0, onPageChange, specimen, className, ...props }) {
176
+ const headingId = React.useId();
177
+ const size = Math.max(1, Math.floor(pageSize));
178
+ // Two to a row only once measured: the server and the first render are the
179
+ // card as it always was, three to a row from 40rem and stacked under it.
180
+ const section = React.useRef(null);
181
+ const columns = useBand(section, inspirationColumns) ?? 3;
182
+ const two = columns === 2;
183
+ const rowSize = inspirationPerPage({ pageSize: size, columns, secondRow: false });
184
+ const rowPages = Math.max(1, Math.ceil(ideas.length / rowSize));
185
+ // Fill, three to a row: every page at once. Fill, two to a row: a second row
186
+ // of two on each page. Both only in the room a stretch gives.
187
+ const fillAll = layout === "fill" && !two && rowPages > 1;
188
+ const fillTwo = layout === "fill" && two && rowPages > 1;
189
+ const more = React.useRef(null);
190
+ const rows = React.useRef(null);
191
+ const viewport = React.useRef(null);
192
+ const allShown = useFits(more, rows, fillAll);
193
+ // The second row is as tall as the first, so the first row measures it,
194
+ // with the 12 above it: the room never depends on what is shown in it.
195
+ const secondRow = useFits(more, viewport, fillTwo, INSPIRATION_COLUMNS.twoGap);
196
+ const perPage = inspirationPerPage({ pageSize: size, columns, secondRow });
197
+ const pages = Math.max(1, Math.ceil(ideas.length / perPage));
198
+ // The card keeps its place as the first idea in view, so a change of
199
+ // columns or of rows shows the page that holds it.
200
+ const [anchor, setAnchor] = React.useState(Math.max(0, defaultPage) * size);
201
+ // Every page shown at once starts at page 1, so when the room goes the card
202
+ // is back on page 1, the row that was at the top (the card's own place only;
203
+ // a caller driving `page` keeps it).
204
+ const [wasAllShown, setWasAllShown] = React.useState(allShown);
205
+ if (wasAllShown !== allShown) {
206
+ setWasAllShown(allShown);
207
+ if (allShown)
208
+ setAnchor(0);
209
+ }
210
+ const page = Math.min(Math.max(0, pageProp ?? inspirationPageOf(anchor, perPage)), pages - 1);
211
+ const start = allShown ? 0 : page * perPage;
212
+ const shown = ideas.slice(start, start + rowSize);
213
+ const paged = pages > 1 && !allShown;
214
+ const go = (next) => {
215
+ if (next < 0 || next >= pages || next === page)
216
+ return;
217
+ if (pageProp === undefined)
218
+ setAnchor(next * perPage);
219
+ onPageChange?.(next);
220
+ };
221
+ const onKeyDown = (event) => {
222
+ if (event.key === "ArrowLeft") {
223
+ event.preventDefault();
224
+ go(page - 1);
225
+ }
226
+ else if (event.key === "ArrowRight") {
227
+ event.preventDefault();
228
+ go(page + 1);
229
+ }
230
+ };
231
+ return (_jsxs("section", { ref: section, "data-slot": "inspiration-cards", "data-theme": "default", ...(layout === "fill" ? { "data-layout": "fill", "data-all-shown": allShown } : {}), ...(two ? { "data-columns": "2" } : {}), ...(fillTwo ? { "data-second-row": secondRow } : {}), "aria-labelledby": headingId, ...(paged ? { "aria-roledescription": "carousel" } : {}), className: cn("@container/inspiration-cards flex w-full min-w-0 flex-col gap-5 rounded-md bg-(--cg-surface-card) p-6 font-ui text-ink", TWO_INSET, LIGHT_SCOPE, className), ...props, children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-x-4 gap-y-3", children: [_jsxs("div", { className: "flex min-w-0 flex-col gap-1", children: [_jsx("h2", { id: headingId, "data-slot": "inspiration-cards-title", className: "m-0 text-body-xl font-bold text-ink", children: title }), _jsx("p", { "data-slot": "inspiration-cards-subtitle", className: "m-0 text-caption text-ink", children: subtitle })] }), paged ? (_jsxs("div", { "data-slot": "inspiration-cards-pager", className: "ml-auto flex shrink-0 items-center gap-2", children: [_jsx(Button, { "data-slot": "inspiration-cards-previous", variant: "ghost", size: "icon-sm", "aria-label": INSPIRATION_COPY.previous, "aria-disabled": page === 0 || undefined, onClick: () => go(page - 1), onKeyDown: onKeyDown, className: ARROW_CLASS, children: _jsx(ChevronLeftIcon, {}) }), _jsxs("span", { "data-slot": "inspiration-cards-position", "aria-hidden": "true", className: "text-caption font-bold text-ink tabular-nums", children: [page + 1, " / ", pages] }), _jsx(Button, { "data-slot": "inspiration-cards-next", variant: "ghost", size: "icon-sm", "aria-label": INSPIRATION_COPY.next, "aria-disabled": page === pages - 1 || undefined, onClick: () => go(page + 1), onKeyDown: onKeyDown, className: ARROW_CLASS, children: _jsx(ChevronRightIcon, {}) })] })) : null] }), _jsx("div", { ref: viewport, "data-slot": "inspiration-cards-viewport", "aria-live": "polite", className: "min-w-0", children: _jsx("ul", { "data-slot": "inspiration-cards-page", ...(paged ? { "aria-roledescription": "slide", "aria-label": `Page ${page + 1} of ${pages}` } : {}), className: PAGE_COLUMNS, children: shown.map((idea, i) => (_jsx("li", { className: "min-w-0", children: _jsx(InspirationCard, { ...idea, specimen: specimen }) }, `${page}-${i}`))) }, page) }), fillAll || fillTwo ? (_jsx("div", { ref: more, "data-slot": "inspiration-cards-more", className: "-mt-5 min-h-0 flex-[1_1_0] overflow-hidden", children: fillTwo ? (_jsx("ul", { "data-slot": "inspiration-cards-second-row", className: cn(PAGE_COLUMNS, "pt-3 transition-[opacity,visibility] duration-200 ease-out motion-reduce:transition-none", secondRow ? "visible opacity-100" : "invisible opacity-0"), children: ideas.slice(page * perPage + rowSize, page * perPage + 2 * rowSize).map((idea, i) => (_jsx("li", { className: "min-w-0", children: _jsx(InspirationCard, { ...idea, specimen: specimen }) }, `${page}-${i}`))) })) : (_jsx("div", { ref: rows, "data-slot": "inspiration-cards-more-rows", className: cn("grid gap-4 pt-4 transition-[opacity,visibility] duration-200 ease-out motion-reduce:transition-none", allShown ? "visible opacity-100" : "invisible opacity-0"), children: Array.from({ length: pages - 1 }, (_, p) => (_jsx("ul", { "data-slot": "inspiration-cards-row", "data-page": p + 1, className: PAGE_COLUMNS, children: ideas.slice((p + 1) * size, (p + 2) * size).map((idea, i) => (_jsx("li", { className: "min-w-0", children: _jsx(InspirationCard, { ...idea, specimen: specimen }) }, i))) }, p + 1))) })) })) : null] }));
232
+ }
233
+ export { InspirationCard, InspirationCards };
234
+ //# sourceMappingURL=inspiration-cards.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspiration-cards.js","sourceRoot":"","sources":["../../src/blocks/inspiration-cards.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAA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AAC,qBAAqB,CACzD,YAEA,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAC3C,0BAEY,uBAAuB,eACtB,CAAC,GAAG,CAAC,EAChB,SAAS,EAAE,YAAY,YAEtB,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAC5D,aAAY,SAAS,EAAC,SAAS,YAC7B,KAAC,eAAe,OAAK,IAAI,EAAE,QAAQ,EAAE,QAAQ,GAAI,IAD1C,CAAC,CAEL,CACN,CAAC,IATG,CAAC,GAAG,CAAC,CAUP,CACN,CAAC,GACE,CACP,GACG,CACP,CAAC,CAAC,CAAC,IAAI,IACA,CACX,CAAA;AACH,CAAC;AAED,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,CAAA"}
@@ -0,0 +1,106 @@
1
+ import * as React from "react";
2
+ /**
3
+ * LIQUID GLASS (ui#541), Asaf's design of 2026-11-20: the full-width band under
4
+ * the Console's floating header that appears once the page is scrolled.
5
+ *
6
+ * Content slides under the header's clusters (the grid menu, the centred pill,
7
+ * the bell and the person) as the page scrolls. The band sits UNDER those
8
+ * clusters and bends what passes behind it like a lens:
9
+ *
10
+ * - **Bend** (where `backdrop-filter: url()` is drawn, i.e. Chromium): an SVG
11
+ * displacement filter as the backdrop filter, pushing most near the top and
12
+ * bottom edges and not at all in the middle (scale 40), then a 6px blur and
13
+ * saturation 1.9, so colours glow through and the header's words read
14
+ * cleanly over busy content.
15
+ * - **Glass** (everywhere else, under reduced motion or reduced transparency,
16
+ * and when `fallback` is set): the clear glass, the scrim's blur token and the
17
+ * same saturation.
18
+ *
19
+ * Both: a sheen of the page colour, 55% at the top, held near half through the
20
+ * header's line and easing to 8% at the bottom, a 1px white highlight along
21
+ * the very top, and a mask that fades the bottom 28% into the page. No border
22
+ * line. Lower down the band it stays see-through and liquid.
23
+ *
24
+ * `active` fades it in (the slow duration, ease out) and out again; the fade is
25
+ * instant under reduced motion. Once faded out it is `visibility: hidden`, so a
26
+ * band at the top of the page costs nothing to draw. Pass `useScrolled()`:
27
+ *
28
+ * const scrolled = useScrolled() // the window
29
+ * const scrolled = useScrolled(4, mainRef) // a scrolling element
30
+ * <LiquidGlass active={scrolled} className="fixed inset-x-0 top-0 z-44" />
31
+ *
32
+ * The caller places it (position, inset, z-index under the clusters) and may
33
+ * change its height (64 by default). It is decorative: `aria-hidden`, no
34
+ * pointer events, never focused.
35
+ *
36
+ * The filter is defined once per page for each band height (one, in the
37
+ * Console: 64 on the desktop, 56 on the phone), in a hidden `<svg>` at the end
38
+ * of `<body>` that the first band to mount adds; the band measures itself to
39
+ * pick it. Until React runs, and in an engine that cannot draw it, the band is
40
+ * the clear glass.
41
+ */
42
+ /**
43
+ * The design's numbers, strengthened from the mockup's (scale 26, blur 2, a
44
+ * straight 55% to 8% white) so the header reads cleanly over busy content.
45
+ */
46
+ declare const LIQUID_GLASS: {
47
+ /** The band's height, px: about the header's. */
48
+ readonly height: 64;
49
+ /** The displacement's scale, px, at the edges. */
50
+ readonly scale: 40;
51
+ /** The blur after the bending, px. */
52
+ readonly blur: 6;
53
+ /** The saturation, both modes. */
54
+ readonly saturate: 1.9;
55
+ /** The page-colour sheen, top to bottom: [alpha %, at %]. */
56
+ readonly sheen: readonly [readonly [55, 0], readonly [48, 50], readonly [30, 75], readonly [8, 100]];
57
+ /** The 1px highlight's alpha along the very top, %. */
58
+ readonly highlight: 80;
59
+ /** The share of the band at the bottom that fades into the page, %. */
60
+ readonly fade: 28;
61
+ /** `useScrolled`'s default: "a few pixels". */
62
+ readonly threshold: 4;
63
+ };
64
+ /** The filter for a band `height` px tall: one per height on a page, shared by every band of it. */
65
+ declare const liquidGlassFilterId: (height?: number) => string;
66
+ type LiquidGlassMode = "bend" | "glass";
67
+ /**
68
+ * Which glass an environment gets. Bend only where the bending is drawn and
69
+ * nothing asks for less.
70
+ */
71
+ declare function liquidGlassMode(env: {
72
+ bendSupported: boolean;
73
+ reducedMotion: boolean;
74
+ reducedTransparency: boolean;
75
+ fallback?: boolean;
76
+ }): LiquidGlassMode;
77
+ /**
78
+ * The `<filter>` the bend mode's backdrop filter points at, for a band
79
+ * `height` px tall. sRGB, so the map's 0.5 means "no shift" (in the default
80
+ * linearRGB it would shift everything).
81
+ *
82
+ * The map is drawn 1px wide and exactly the band's height, in pixels, then
83
+ * tiled across the band, so one filter serves a band of any width. Pixels, not
84
+ * percentages: Chromium draws a percentage-sized `feImage` in a backdrop
85
+ * filter as nothing, which reads as a map of zeros (a flat 20px shift); and
86
+ * bounding-box units scale the shift by the band's width.
87
+ */
88
+ declare function liquidGlassFilterMarkup(height?: number): string;
89
+ /** Scrolled means past the threshold, not at it; an overscroll bounce above the top is not. */
90
+ declare function scrolledPast(offset: number, threshold: number): boolean;
91
+ /**
92
+ * True once `target` (or the window) has scrolled past `threshold` px, false
93
+ * again at the top. Passive listener; re-renders only when the answer changes.
94
+ * False on the server and until the first effect.
95
+ */
96
+ declare function useScrolled(threshold?: number, target?: React.RefObject<HTMLElement | null>): boolean;
97
+ type LiquidGlassProps = Omit<React.ComponentProps<"div">, "children" | "ref"> & {
98
+ /** Shown (faded in) while true. Pass `useScrolled()`. */
99
+ active?: boolean;
100
+ /** Forces the clear glass, as an engine without the bending draws it. */
101
+ fallback?: boolean;
102
+ };
103
+ declare function LiquidGlass({ active, fallback, className, style, ...props }: LiquidGlassProps): React.JSX.Element;
104
+ export { LIQUID_GLASS, LiquidGlass, liquidGlassFilterId, liquidGlassFilterMarkup, liquidGlassMode, scrolledPast, useScrolled, };
105
+ export type { LiquidGlassMode, LiquidGlassProps };
106
+ //# sourceMappingURL=liquid-glass.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":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