@cloudgrid-io/ui 0.69.0 → 0.71.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/badge/marks.d.ts +2 -0
- package/dist/badge/marks.d.ts.map +1 -1
- package/dist/badge/marks.js +5 -0
- package/dist/badge/marks.js.map +1 -1
- package/dist/badge/watermark.js +2 -2
- package/dist/badge/watermark.js.map +1 -1
- package/dist/blocks/add-tile.d.ts +17 -12
- package/dist/blocks/add-tile.d.ts.map +1 -1
- package/dist/blocks/add-tile.js +26 -14
- package/dist/blocks/add-tile.js.map +1 -1
- package/dist/blocks/browse-categories.d.ts +80 -0
- package/dist/blocks/browse-categories.d.ts.map +1 -0
- package/dist/blocks/browse-categories.js +106 -0
- package/dist/blocks/browse-categories.js.map +1 -0
- package/dist/blocks/creation-search.d.ts +145 -102
- package/dist/blocks/creation-search.d.ts.map +1 -1
- package/dist/blocks/creation-search.js +503 -125
- package/dist/blocks/creation-search.js.map +1 -1
- package/dist/blocks/empty-creations.d.ts +29 -2
- package/dist/blocks/empty-creations.d.ts.map +1 -1
- package/dist/blocks/empty-creations.js +38 -14
- package/dist/blocks/empty-creations.js.map +1 -1
- package/dist/blocks/entity-card.d.ts +5 -1
- package/dist/blocks/entity-card.d.ts.map +1 -1
- package/dist/blocks/entity-card.js +3 -2
- package/dist/blocks/entity-card.js.map +1 -1
- package/dist/blocks/feed-row.d.ts +92 -0
- package/dist/blocks/feed-row.d.ts.map +1 -0
- package/dist/blocks/feed-row.js +30 -0
- package/dist/blocks/feed-row.js.map +1 -0
- package/dist/blocks/filter-tabs.d.ts +12 -1
- package/dist/blocks/filter-tabs.d.ts.map +1 -1
- package/dist/blocks/filter-tabs.js +11 -2
- package/dist/blocks/filter-tabs.js.map +1 -1
- package/dist/blocks/greeting.d.ts +42 -0
- package/dist/blocks/greeting.d.ts.map +1 -0
- package/dist/blocks/greeting.js +38 -0
- package/dist/blocks/greeting.js.map +1 -0
- package/dist/blocks/home-bento.d.ts +11 -4
- package/dist/blocks/home-bento.d.ts.map +1 -1
- package/dist/blocks/home-bento.js +22 -6
- package/dist/blocks/home-bento.js.map +1 -1
- package/dist/blocks/home-pinned.d.ts +137 -24
- package/dist/blocks/home-pinned.d.ts.map +1 -1
- package/dist/blocks/home-pinned.js +285 -38
- package/dist/blocks/home-pinned.js.map +1 -1
- package/dist/blocks/icons.d.ts +54 -6
- package/dist/blocks/icons.d.ts.map +1 -1
- package/dist/blocks/icons.js +67 -6
- package/dist/blocks/icons.js.map +1 -1
- package/dist/blocks/impact-card.d.ts +114 -0
- package/dist/blocks/impact-card.d.ts.map +1 -0
- package/dist/blocks/impact-card.js +57 -0
- package/dist/blocks/impact-card.js.map +1 -0
- package/dist/blocks/inspiration-cards.d.ts +234 -5
- package/dist/blocks/inspiration-cards.d.ts.map +1 -1
- package/dist/blocks/inspiration-cards.js +289 -8
- package/dist/blocks/inspiration-cards.js.map +1 -1
- package/dist/blocks/inspiration-gallery.d.ts +139 -0
- package/dist/blocks/inspiration-gallery.d.ts.map +1 -0
- package/dist/blocks/inspiration-gallery.js +189 -0
- package/dist/blocks/inspiration-gallery.js.map +1 -0
- package/dist/blocks/jump-back-in.d.ts +251 -0
- package/dist/blocks/jump-back-in.d.ts.map +1 -0
- package/dist/blocks/jump-back-in.js +275 -0
- package/dist/blocks/jump-back-in.js.map +1 -0
- package/dist/blocks/load-more-grid.d.ts +125 -0
- package/dist/blocks/load-more-grid.d.ts.map +1 -0
- package/dist/blocks/load-more-grid.js +157 -0
- package/dist/blocks/load-more-grid.js.map +1 -0
- package/dist/blocks/menu-trigger.d.ts +7 -2
- package/dist/blocks/menu-trigger.d.ts.map +1 -1
- package/dist/blocks/menu-trigger.js +2 -0
- package/dist/blocks/menu-trigger.js.map +1 -1
- package/dist/blocks/phosphor-marks.d.ts +17 -1
- package/dist/blocks/phosphor-marks.d.ts.map +1 -1
- package/dist/blocks/phosphor-marks.js +25 -1
- package/dist/blocks/phosphor-marks.js.map +1 -1
- package/dist/blocks/pin-mark.d.ts +40 -0
- package/dist/blocks/pin-mark.d.ts.map +1 -0
- package/dist/blocks/pin-mark.js +40 -0
- package/dist/blocks/pin-mark.js.map +1 -0
- package/dist/blocks/start-card.d.ts +76 -0
- package/dist/blocks/start-card.d.ts.map +1 -0
- package/dist/blocks/start-card.js +82 -0
- package/dist/blocks/start-card.js.map +1 -0
- package/dist/blocks/stat-tile.d.ts +20 -19
- package/dist/blocks/stat-tile.d.ts.map +1 -1
- package/dist/blocks/stat-tile.js +32 -3
- package/dist/blocks/stat-tile.js.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/motion.d.ts +14 -0
- package/dist/lib/motion.d.ts.map +1 -1
- package/dist/lib/motion.js +4 -0
- package/dist/lib/motion.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { DialogContent } from "../ui/dialog.js";
|
|
3
|
+
import { type InspirationCategory, type InspirationIdea, type InspirationPickUp } from "./inspiration-cards.js";
|
|
4
|
+
/**
|
|
5
|
+
* THE INSPIRATION GALLERY (ui#623), Asaf's design of 2026-11-29, opened from
|
|
6
|
+
* "Need inspiration?" on the empty My creations (`EmptyCreations`'
|
|
7
|
+
* `onInspire`).
|
|
8
|
+
*
|
|
9
|
+
* const [open, setOpen] = React.useState(false)
|
|
10
|
+
* <EmptyCreations onInspire={() => setOpen(true)} ... />
|
|
11
|
+
* <InspirationGallery ideas={ideas} open={open} onOpenChange={setOpen} pickUp={pickUp} />
|
|
12
|
+
*
|
|
13
|
+
* The ideas are the caller's, in the `InspirationIdea` shape `InspirationCards`
|
|
14
|
+
* takes; nothing here fetches. `pickUp` is `InspirationCards`' own opt-in
|
|
15
|
+
* (`onPickUp`, `canPickUp`, `isPickedUp`, `onSeeOnGrid`, `onOpenChange`).
|
|
16
|
+
*
|
|
17
|
+
* ## The overlay
|
|
18
|
+
*
|
|
19
|
+
* The library `Dialog` on the Style Guide scrim: a white panel at radius 24
|
|
20
|
+
* (`rounded-2xl`), 1180 wide at most, the window less 16 each side under that,
|
|
21
|
+
* and a round close X at the top right that stays put while the panel
|
|
22
|
+
* scrolls inside itself on a short screen. On a phone (under 640) the panel is
|
|
23
|
+
* the whole screen. Escape, the X and a click on the scrim close it; focus is
|
|
24
|
+
* held inside while it is open (on the pressed pill first) and goes back to
|
|
25
|
+
* what opened it on close ("Need inspiration?"), or to `finalFocus`.
|
|
26
|
+
*
|
|
27
|
+
* ## The header
|
|
28
|
+
*
|
|
29
|
+
* The eyebrow "Inspiration", the title "Make your first creation" (the
|
|
30
|
+
* dialog's name), the line "Ten ideas the team loves. Pick one and make it
|
|
31
|
+
* yours, your way." (its description), and the pills: All, For work, Everyday
|
|
32
|
+
* and For fun, each with its count. They are the library's filter tabs
|
|
33
|
+
* (`FilterTabs`, a group of toggle buttons, arrow keys between them), pills
|
|
34
|
+
* here, a dot of the category's hue before each category's word
|
|
35
|
+
* (`INSPIRATION_CATEGORY_HUES`, the hue of the ideas' tags). A pill shows its
|
|
36
|
+
* category's ideas only. Each open starts on All.
|
|
37
|
+
*
|
|
38
|
+
* ## The ideas
|
|
39
|
+
*
|
|
40
|
+
* One idea spans the full width at the top, the featured idea: its cover on
|
|
41
|
+
* the left, and on the right its tag, "Featured today", its name, its line
|
|
42
|
+
* and "Make it yours" with an arrow. It is a different idea each time the
|
|
43
|
+
* gallery opens: the ideas take turns, from a place chosen at random once per
|
|
44
|
+
* mount (`inspirationGalleryFeatured`). `featuredId` pins it (a test, a
|
|
45
|
+
* screenshot). Under a pill the featured idea stays on top when it is in that
|
|
46
|
+
* category, and the category's first idea takes its place when it is not
|
|
47
|
+
* (`inspirationGalleryView`).
|
|
48
|
+
*
|
|
49
|
+
* The other ideas sit 18 apart in three columns, two when the panel is
|
|
50
|
+
* narrower (a tablet) and one on a phone, by container queries on the panel.
|
|
51
|
+
* Each card is the real cover (560 by 324, its aspect at any width), the
|
|
52
|
+
* idea's tag (the library's, `INSPIRATION_TAG_CLASS` on the category's tint),
|
|
53
|
+
* the name and the line. On hover a card lifts 4px, takes the soft hover
|
|
54
|
+
* shadow and shows "Make it yours" with an arrow, over the library's 180ms;
|
|
55
|
+
* under reduced motion it does not move and nothing eases. Every card is one
|
|
56
|
+
* button, named by the idea's name and described by its line, with the hand
|
|
57
|
+
* cursor and the keyboard frame (`focus-line`) after Tab only.
|
|
58
|
+
*
|
|
59
|
+
* A card, or the featured idea, opens the Pick it up overlay of ui#609
|
|
60
|
+
* (`InspirationPickUpDialog`) for that idea, on top of the gallery, with
|
|
61
|
+
* `pickUp`'s props, as a card of `InspirationCards` does: `canPickUp` decides
|
|
62
|
+
* whether Pick it up is offered, `isPickedUp` and the gallery's own memory of
|
|
63
|
+
* a pick-up open it on Picked up. Closing it goes back to the gallery, focus
|
|
64
|
+
* on the card. Without `pickUp` it is Build it yourself only.
|
|
65
|
+
*
|
|
66
|
+
* ## The footer
|
|
67
|
+
*
|
|
68
|
+
* "Can't find it? Describe your own idea to your AI tool and plug it to the
|
|
69
|
+
* grid." over a hairline, and "Esc to close" at the right (not on a phone,
|
|
70
|
+
* which has no Esc).
|
|
71
|
+
*
|
|
72
|
+
* The words are `INSPIRATION_GALLERY_COPY`.
|
|
73
|
+
*/
|
|
74
|
+
/** The gallery's words (ui#623): Asaf's approved copy. Canon: plug, the grid; no em dashes; never "prompt". */
|
|
75
|
+
export declare const INSPIRATION_GALLERY_COPY: Readonly<{
|
|
76
|
+
eyebrow: "Inspiration";
|
|
77
|
+
title: "Make your first creation";
|
|
78
|
+
line: "Ten ideas the team loves. Pick one and make it yours, your way.";
|
|
79
|
+
/** Names the pills' group for a screen reader. */
|
|
80
|
+
filterLabel: "Filter ideas";
|
|
81
|
+
filters: Readonly<{
|
|
82
|
+
all: "All";
|
|
83
|
+
work: "For work";
|
|
84
|
+
everyday: "Everyday";
|
|
85
|
+
fun: "For fun";
|
|
86
|
+
}>;
|
|
87
|
+
featured: "Featured today";
|
|
88
|
+
makeItYours: "Make it yours";
|
|
89
|
+
/** The middle part is set in bold. */
|
|
90
|
+
footer: readonly ["Can't find it? ", "Describe your own idea to your AI tool", " and plug it to the grid."];
|
|
91
|
+
esc: "Esc to close";
|
|
92
|
+
close: "Close";
|
|
93
|
+
}>;
|
|
94
|
+
/** A pill: every idea, or one category. */
|
|
95
|
+
export type InspirationGalleryFilter = "all" | InspirationCategory;
|
|
96
|
+
/** The pills, in order. */
|
|
97
|
+
export declare const INSPIRATION_GALLERY_FILTERS: readonly InspirationGalleryFilter[];
|
|
98
|
+
/**
|
|
99
|
+
* The featured idea of the gallery's `turn`-th open: the idea with
|
|
100
|
+
* `featuredId` when there is one, else the ideas in turn, so each open shows a
|
|
101
|
+
* different one. Undefined with no ideas.
|
|
102
|
+
*/
|
|
103
|
+
export declare function inspirationGalleryFeatured(ideas: readonly InspirationIdea[], turn: number, featuredId?: string): InspirationIdea | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* What the gallery shows under `filter`: each pill's count, the idea on top
|
|
106
|
+
* (`featured` when it is in the filter, else the filter's first) and the rest
|
|
107
|
+
* in the caller's order.
|
|
108
|
+
*/
|
|
109
|
+
export declare function inspirationGalleryView(ideas: readonly InspirationIdea[], filter: InspirationGalleryFilter, featured: InspirationIdea | undefined): {
|
|
110
|
+
counts: Record<InspirationGalleryFilter, number>;
|
|
111
|
+
featured: InspirationIdea | undefined;
|
|
112
|
+
rest: InspirationIdea[];
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* The inspiration gallery (ui#623): every idea in one overlay, one featured
|
|
116
|
+
* at the top; a card opens the Pick it up overlay. Controlled. See the notes
|
|
117
|
+
* at the top of this file.
|
|
118
|
+
*/
|
|
119
|
+
declare function InspirationGallery({ ideas, open, onOpenChange, pickUp, featuredId, finalFocus, container, className, }: {
|
|
120
|
+
/** The ideas, the caller's: the same shape `InspirationCards` takes. */
|
|
121
|
+
ideas: readonly InspirationIdea[];
|
|
122
|
+
open: boolean;
|
|
123
|
+
onOpenChange: (open: boolean) => void;
|
|
124
|
+
/**
|
|
125
|
+
* `InspirationCards`' opt-in, for the Pick it up overlay a card opens:
|
|
126
|
+
* `onPickUp`, `canPickUp`, `isPickedUp`, `onSeeOnGrid`, `onOpenChange`.
|
|
127
|
+
* Absent: Build it yourself only.
|
|
128
|
+
*/
|
|
129
|
+
pickUp?: InspirationPickUp;
|
|
130
|
+
/** Pins the featured idea by `id`. Absent: a different idea each open. */
|
|
131
|
+
featuredId?: string;
|
|
132
|
+
/** Where focus goes on close. Absent: what had it before the gallery opened. */
|
|
133
|
+
finalFocus?: React.RefObject<HTMLElement | null>;
|
|
134
|
+
/** Where the scrim and the panel portal; the document body when absent. */
|
|
135
|
+
container?: React.ComponentProps<typeof DialogContent>["container"];
|
|
136
|
+
className?: string;
|
|
137
|
+
}): React.JSX.Element;
|
|
138
|
+
export { InspirationGallery };
|
|
139
|
+
//# sourceMappingURL=inspiration-gallery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspiration-gallery.d.ts","sourceRoot":"","sources":["../../src/blocks/inspiration-gallery.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,OAAO,EAAuB,aAAa,EAAkC,MAAM,sBAAsB,CAAA;AAIzG,OAAO,EAKL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACvB,MAAM,iCAAiC,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AAEH,+GAA+G;AAC/G,eAAO,MAAM,wBAAwB;;;;IAInC,kDAAkD;;;;;;;;;;IAKlD,sCAAsC;;;;EAItC,CAAA;AAEF,2CAA2C;AAC3C,MAAM,MAAM,wBAAwB,GAAG,KAAK,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AA"}
|
|
@@ -0,0 +1,189 @@
|
|
|
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 { FadeInPicture, PICTURE_FADE_IN } from "../lib/fade-in-picture.js";
|
|
6
|
+
import { Badge } from "../ui/badge.js";
|
|
7
|
+
import { Button } from "../ui/button.js";
|
|
8
|
+
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogTitle } from "../ui/dialog.js";
|
|
9
|
+
import { Eyebrow } from "./eyebrow.js";
|
|
10
|
+
import { FilterTab, FilterTabs } from "./filter-tabs.js";
|
|
11
|
+
import { CloseIcon, ForwardIcon } from "./icons.js";
|
|
12
|
+
import { INSPIRATION_CATEGORIES, INSPIRATION_CATEGORY_HUES, INSPIRATION_TAG_CLASS, InspirationPickUpDialog, } from "./inspiration-cards.js";
|
|
13
|
+
/**
|
|
14
|
+
* THE INSPIRATION GALLERY (ui#623), Asaf's design of 2026-11-29, opened from
|
|
15
|
+
* "Need inspiration?" on the empty My creations (`EmptyCreations`'
|
|
16
|
+
* `onInspire`).
|
|
17
|
+
*
|
|
18
|
+
* const [open, setOpen] = React.useState(false)
|
|
19
|
+
* <EmptyCreations onInspire={() => setOpen(true)} ... />
|
|
20
|
+
* <InspirationGallery ideas={ideas} open={open} onOpenChange={setOpen} pickUp={pickUp} />
|
|
21
|
+
*
|
|
22
|
+
* The ideas are the caller's, in the `InspirationIdea` shape `InspirationCards`
|
|
23
|
+
* takes; nothing here fetches. `pickUp` is `InspirationCards`' own opt-in
|
|
24
|
+
* (`onPickUp`, `canPickUp`, `isPickedUp`, `onSeeOnGrid`, `onOpenChange`).
|
|
25
|
+
*
|
|
26
|
+
* ## The overlay
|
|
27
|
+
*
|
|
28
|
+
* The library `Dialog` on the Style Guide scrim: a white panel at radius 24
|
|
29
|
+
* (`rounded-2xl`), 1180 wide at most, the window less 16 each side under that,
|
|
30
|
+
* and a round close X at the top right that stays put while the panel
|
|
31
|
+
* scrolls inside itself on a short screen. On a phone (under 640) the panel is
|
|
32
|
+
* the whole screen. Escape, the X and a click on the scrim close it; focus is
|
|
33
|
+
* held inside while it is open (on the pressed pill first) and goes back to
|
|
34
|
+
* what opened it on close ("Need inspiration?"), or to `finalFocus`.
|
|
35
|
+
*
|
|
36
|
+
* ## The header
|
|
37
|
+
*
|
|
38
|
+
* The eyebrow "Inspiration", the title "Make your first creation" (the
|
|
39
|
+
* dialog's name), the line "Ten ideas the team loves. Pick one and make it
|
|
40
|
+
* yours, your way." (its description), and the pills: All, For work, Everyday
|
|
41
|
+
* and For fun, each with its count. They are the library's filter tabs
|
|
42
|
+
* (`FilterTabs`, a group of toggle buttons, arrow keys between them), pills
|
|
43
|
+
* here, a dot of the category's hue before each category's word
|
|
44
|
+
* (`INSPIRATION_CATEGORY_HUES`, the hue of the ideas' tags). A pill shows its
|
|
45
|
+
* category's ideas only. Each open starts on All.
|
|
46
|
+
*
|
|
47
|
+
* ## The ideas
|
|
48
|
+
*
|
|
49
|
+
* One idea spans the full width at the top, the featured idea: its cover on
|
|
50
|
+
* the left, and on the right its tag, "Featured today", its name, its line
|
|
51
|
+
* and "Make it yours" with an arrow. It is a different idea each time the
|
|
52
|
+
* gallery opens: the ideas take turns, from a place chosen at random once per
|
|
53
|
+
* mount (`inspirationGalleryFeatured`). `featuredId` pins it (a test, a
|
|
54
|
+
* screenshot). Under a pill the featured idea stays on top when it is in that
|
|
55
|
+
* category, and the category's first idea takes its place when it is not
|
|
56
|
+
* (`inspirationGalleryView`).
|
|
57
|
+
*
|
|
58
|
+
* The other ideas sit 18 apart in three columns, two when the panel is
|
|
59
|
+
* narrower (a tablet) and one on a phone, by container queries on the panel.
|
|
60
|
+
* Each card is the real cover (560 by 324, its aspect at any width), the
|
|
61
|
+
* idea's tag (the library's, `INSPIRATION_TAG_CLASS` on the category's tint),
|
|
62
|
+
* the name and the line. On hover a card lifts 4px, takes the soft hover
|
|
63
|
+
* shadow and shows "Make it yours" with an arrow, over the library's 180ms;
|
|
64
|
+
* under reduced motion it does not move and nothing eases. Every card is one
|
|
65
|
+
* button, named by the idea's name and described by its line, with the hand
|
|
66
|
+
* cursor and the keyboard frame (`focus-line`) after Tab only.
|
|
67
|
+
*
|
|
68
|
+
* A card, or the featured idea, opens the Pick it up overlay of ui#609
|
|
69
|
+
* (`InspirationPickUpDialog`) for that idea, on top of the gallery, with
|
|
70
|
+
* `pickUp`'s props, as a card of `InspirationCards` does: `canPickUp` decides
|
|
71
|
+
* whether Pick it up is offered, `isPickedUp` and the gallery's own memory of
|
|
72
|
+
* a pick-up open it on Picked up. Closing it goes back to the gallery, focus
|
|
73
|
+
* on the card. Without `pickUp` it is Build it yourself only.
|
|
74
|
+
*
|
|
75
|
+
* ## The footer
|
|
76
|
+
*
|
|
77
|
+
* "Can't find it? Describe your own idea to your AI tool and plug it to the
|
|
78
|
+
* grid." over a hairline, and "Esc to close" at the right (not on a phone,
|
|
79
|
+
* which has no Esc).
|
|
80
|
+
*
|
|
81
|
+
* The words are `INSPIRATION_GALLERY_COPY`.
|
|
82
|
+
*/
|
|
83
|
+
/** The gallery's words (ui#623): Asaf's approved copy. Canon: plug, the grid; no em dashes; never "prompt". */
|
|
84
|
+
export const INSPIRATION_GALLERY_COPY = Object.freeze({
|
|
85
|
+
eyebrow: "Inspiration",
|
|
86
|
+
title: "Make your first creation",
|
|
87
|
+
line: "Ten ideas the team loves. Pick one and make it yours, your way.",
|
|
88
|
+
/** Names the pills' group for a screen reader. */
|
|
89
|
+
filterLabel: "Filter ideas",
|
|
90
|
+
filters: Object.freeze({ all: "All", work: "For work", everyday: "Everyday", fun: "For fun" }),
|
|
91
|
+
featured: "Featured today",
|
|
92
|
+
makeItYours: "Make it yours",
|
|
93
|
+
/** The middle part is set in bold. */
|
|
94
|
+
footer: Object.freeze(["Can't find it? ", "Describe your own idea to your AI tool", " and plug it to the grid."]),
|
|
95
|
+
esc: "Esc to close",
|
|
96
|
+
close: "Close",
|
|
97
|
+
});
|
|
98
|
+
/** The pills, in order. */
|
|
99
|
+
export const INSPIRATION_GALLERY_FILTERS = Object.freeze(["all", "work", "everyday", "fun"]);
|
|
100
|
+
/**
|
|
101
|
+
* The featured idea of the gallery's `turn`-th open: the idea with
|
|
102
|
+
* `featuredId` when there is one, else the ideas in turn, so each open shows a
|
|
103
|
+
* different one. Undefined with no ideas.
|
|
104
|
+
*/
|
|
105
|
+
export function inspirationGalleryFeatured(ideas, turn, featuredId) {
|
|
106
|
+
if (ideas.length === 0)
|
|
107
|
+
return undefined;
|
|
108
|
+
const pinned = featuredId === undefined ? undefined : ideas.find((idea) => idea.id === featuredId);
|
|
109
|
+
const n = ideas.length;
|
|
110
|
+
return pinned ?? ideas[((Math.floor(turn) % n) + n) % n];
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* What the gallery shows under `filter`: each pill's count, the idea on top
|
|
114
|
+
* (`featured` when it is in the filter, else the filter's first) and the rest
|
|
115
|
+
* in the caller's order.
|
|
116
|
+
*/
|
|
117
|
+
export function inspirationGalleryView(ideas, filter, featured) {
|
|
118
|
+
const counts = { all: ideas.length, work: 0, everyday: 0, fun: 0 };
|
|
119
|
+
for (const idea of ideas)
|
|
120
|
+
counts[idea.category] += 1;
|
|
121
|
+
const shown = filter === "all" ? [...ideas] : ideas.filter((idea) => idea.category === filter);
|
|
122
|
+
const top = featured !== undefined && shown.includes(featured) ? featured : shown[0];
|
|
123
|
+
return { counts, featured: top, rest: shown.filter((idea) => idea !== top) };
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Paper on every surface, as the ideas card and the Pick it up overlay are:
|
|
127
|
+
* `--ring`, which `focus-line` draws in, declared again from the reset accent.
|
|
128
|
+
*/
|
|
129
|
+
const LIGHT_SCOPE = "[--ring:var(--cg-text-accent)]";
|
|
130
|
+
/**
|
|
131
|
+
* A card and the featured idea: one button, the hairline at radius 16. On
|
|
132
|
+
* hover it lifts 4px and takes the soft hover shadow over 180ms; under
|
|
133
|
+
* reduced motion it stays put and nothing eases. The hand cursor; the
|
|
134
|
+
* keyboard frame only.
|
|
135
|
+
*/
|
|
136
|
+
const IDEA_CLASS = cn("group/idea relative w-full min-w-0 cursor-pointer overflow-hidden rounded-xl border border-hairline bg-(--cg-surface-card) text-left text-ink focus-line", "transition-[translate,box-shadow] duration-(--cg-duration) ease-(--cg-ease-out) hover:-translate-y-1 hover:shadow-hover", "motion-reduce:transition-none motion-reduce:hover:translate-y-0");
|
|
137
|
+
/** "Make it yours" and its arrow: the Primary words of an action. */
|
|
138
|
+
const GO_CLASS = "inline-flex items-center gap-1.5 font-semibold text-brand [&_svg]:size-4";
|
|
139
|
+
function IdeaButton({ idea, featured = false, onChoose, }) {
|
|
140
|
+
const C = INSPIRATION_GALLERY_COPY;
|
|
141
|
+
const titleId = React.useId();
|
|
142
|
+
const lineId = React.useId();
|
|
143
|
+
const tag = (_jsx(Badge, { "data-slot": "inspiration-gallery-tag", "data-category": idea.category, className: cn(INSPIRATION_TAG_CLASS, INSPIRATION_CATEGORIES[idea.category].className), children: INSPIRATION_CATEGORIES[idea.category].label }));
|
|
144
|
+
return (_jsxs("button", { type: "button", "data-slot": featured ? "inspiration-gallery-featured" : "inspiration-gallery-card", "data-idea": idea.id, "aria-haspopup": "dialog", "aria-labelledby": titleId, "aria-describedby": lineId, className: cn(IDEA_CLASS, featured ? "grid bg-brand-tint/50 @xl/gallery:grid-cols-[1.25fr_1fr] @xl/gallery:items-center" : "flex h-full flex-col"), onClick: (event) => onChoose(idea, event.currentTarget), children: [_jsx("span", { "data-slot": "inspiration-gallery-cover", className: "block overflow-hidden bg-page", children: _jsx(FadeInPicture, { src: idea.image, alt: "", width: 560, height: 324, loading: "eager", decoding: "async", className: cn("block aspect-[140/81] h-auto w-full object-cover", PICTURE_FADE_IN) }) }), featured ? (_jsxs("span", { className: "flex min-w-0 flex-col items-start px-5 py-5 @xl/gallery:px-8.5 @xl/gallery:py-7", children: [_jsxs("span", { className: "flex flex-wrap items-center gap-2", children: [tag, _jsx("span", { "data-slot": "inspiration-gallery-featured-label", className: "text-caption font-semibold text-faint-strong", children: C.featured })] }), _jsx("span", { id: titleId, "data-slot": "inspiration-gallery-title", className: "mt-2.5 mb-2 text-heading-28 leading-(--cg-heading-line) font-semibold text-balance text-ink", children: idea.title }), _jsx("span", { id: lineId, "data-slot": "inspiration-gallery-line", className: "max-w-105 text-body-md text-body", children: idea.description }), _jsxs("span", { "data-slot": "inspiration-gallery-go", "aria-hidden": "true", className: cn(GO_CLASS, "mt-4.5 text-body-md"), children: [C.makeItYours, _jsx(ForwardIcon, {})] })] })) : (_jsxs("span", { className: "flex min-w-0 flex-1 flex-col items-start px-3.5 pt-3 pb-3.5", children: [tag, _jsx("span", { id: titleId, "data-slot": "inspiration-gallery-title", className: "mt-1.5 mb-1 text-body-md font-semibold text-ink", children: idea.title }), _jsx("span", { id: lineId, "data-slot": "inspiration-gallery-line", className: "text-caption text-body", children: idea.description }), _jsxs("span", { "data-slot": "inspiration-gallery-go", "aria-hidden": "true", className: cn(GO_CLASS, "mt-2.5 text-body-sm opacity-0 transition-opacity duration-(--cg-duration) ease-(--cg-ease-out) motion-reduce:transition-none", "group-hover/idea:opacity-100 group-focus-visible/idea:opacity-100"), children: [C.makeItYours, _jsx(ForwardIcon, {})] })] }))] }));
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* The inspiration gallery (ui#623): every idea in one overlay, one featured
|
|
148
|
+
* at the top; a card opens the Pick it up overlay. Controlled. See the notes
|
|
149
|
+
* at the top of this file.
|
|
150
|
+
*/
|
|
151
|
+
function InspirationGallery({ ideas, open, onOpenChange, pickUp = {}, featuredId, finalFocus, container, className, }) {
|
|
152
|
+
const C = INSPIRATION_GALLERY_COPY;
|
|
153
|
+
// The ideas take turns at the top, from a place chosen once per mount; each
|
|
154
|
+
// open is the next turn and starts on All.
|
|
155
|
+
const [start] = React.useState(() => Math.floor(Math.random() * 1_000_000));
|
|
156
|
+
const [opens, setOpens] = React.useState(0);
|
|
157
|
+
const [wasOpen, setWasOpen] = React.useState(false);
|
|
158
|
+
const [filter, setFilter] = React.useState("all");
|
|
159
|
+
if (open !== wasOpen) {
|
|
160
|
+
setWasOpen(open);
|
|
161
|
+
if (open) {
|
|
162
|
+
setOpens((n) => n + 1);
|
|
163
|
+
setFilter("all");
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
const view = inspirationGalleryView(ideas, filter, inspirationGalleryFeatured(ideas, start + opens, featuredId));
|
|
167
|
+
// The Pick it up overlay, for the idea last chosen; kept while it closes.
|
|
168
|
+
const [active, setActive] = React.useState(null);
|
|
169
|
+
const [pickOpen, setPickOpen] = React.useState(false);
|
|
170
|
+
const opener = React.useRef(null);
|
|
171
|
+
// What was picked up in the page's life, by `id`, else by title.
|
|
172
|
+
const [picked, setPicked] = React.useState([]);
|
|
173
|
+
const keyOf = (idea) => idea.id ?? idea.title;
|
|
174
|
+
const choose = (idea, from) => {
|
|
175
|
+
opener.current = from;
|
|
176
|
+
setActive(idea);
|
|
177
|
+
setPickOpen(true);
|
|
178
|
+
pickUp.onOpenChange?.(true, idea);
|
|
179
|
+
};
|
|
180
|
+
return (_jsx(Dialog, { open: open, onOpenChange: (next) => onOpenChange(next), children: _jsxs(DialogContent, { "data-slot": "inspiration-gallery", "data-theme": "default", container: container, showCloseButton: false, finalFocus: finalFocus ?? true, className: cn("flex flex-col gap-0 overflow-hidden rounded-2xl p-0 sm:max-w-295", "max-sm:h-svh max-sm:max-h-svh max-sm:max-w-full max-sm:rounded-none max-sm:border-0", LIGHT_SCOPE, className), children: [_jsxs("div", { "data-slot": "inspiration-gallery-scroll", className: "@container/gallery min-h-0 flex-1 overflow-y-auto overscroll-contain px-5 pt-7 pb-6 sm:px-9 sm:pt-8.5 sm:pb-9", children: [_jsx(Eyebrow, { "data-slot": "inspiration-gallery-eyebrow", className: "mb-1.5 font-semibold text-brand", children: C.eyebrow }), _jsx(DialogTitle, { "data-slot": "inspiration-gallery-heading", className: "mb-1.5 pr-12 text-heading-28 leading-(--cg-heading-line) font-semibold text-balance text-ink", children: C.title }), _jsx(DialogDescription, { "data-slot": "inspiration-gallery-description", className: "mb-5 text-body-md", children: C.line }), _jsx(FilterTabs, { label: C.filterLabel, value: filter, onValueChange: (next) => setFilter(next), className: "mb-5.5 flex-wrap gap-2", children: INSPIRATION_GALLERY_FILTERS.map((f) => (_jsx(FilterTab, { value: f, "data-filter": f, count: view.counts[f], icon: f === "all" ? undefined : _jsx("span", { className: cn("block size-2 rounded-full", INSPIRATION_CATEGORY_HUES[f]) }), className: "h-8.5 cursor-pointer rounded-pill bg-page px-3.5", children: C.filters[f] }, f))) }), _jsxs("ul", { role: "list", "data-slot": "inspiration-gallery-grid", className: "m-0 grid list-none grid-cols-1 gap-4.5 p-0 @xl/gallery:grid-cols-2 @4xl/gallery:grid-cols-3", children: [view.featured ? (_jsx("li", { className: "col-span-full flex", children: _jsx(IdeaButton, { idea: view.featured, featured: true, onChoose: choose }) })) : null, view.rest.map((idea, i) => (_jsx("li", { className: "flex", children: _jsx(IdeaButton, { idea: idea, onChoose: choose }) }, idea.id ?? `${idea.title}-${i}`)))] }), _jsxs("div", { "data-slot": "inspiration-gallery-footer", className: "mt-5.5 flex flex-wrap items-center justify-between gap-x-4 gap-y-2 border-t border-hairline pt-4 text-body-sm text-faint-strong", children: [_jsxs("p", { className: "m-0", children: [C.footer[0], _jsx("strong", { className: "font-semibold text-ink", children: C.footer[1] }), C.footer[2]] }), _jsx("span", { "data-slot": "inspiration-gallery-esc", className: "max-sm:hidden", children: C.esc })] })] }), _jsxs(DialogClose, { "data-slot": "inspiration-gallery-close", render: _jsx(Button, { variant: "ghost", size: "icon", className: "absolute top-5 right-5 z-1 size-9 cursor-pointer rounded-full bg-page text-ink hover:bg-page-alt" }), children: [_jsx(CloseIcon, { className: "size-4.5" }), _jsx("span", { className: "sr-only", children: C.close })] }), active ? (_jsx(InspirationPickUpDialog, { idea: active, open: pickOpen, onOpenChange: (next) => {
|
|
181
|
+
setPickOpen(next);
|
|
182
|
+
pickUp.onOpenChange?.(next, active);
|
|
183
|
+
}, onPickUp: pickUp.onPickUp && (pickUp.canPickUp?.(active) ?? true) ? pickUp.onPickUp : undefined, onSeeOnGrid: pickUp.onSeeOnGrid, finalFocus: opener, pickedUp: picked.includes(keyOf(active)) || pickUp.isPickedUp?.(active) === true, onStateChange: (state) => {
|
|
184
|
+
if (state === "picked")
|
|
185
|
+
setPicked((now) => (now.includes(keyOf(active)) ? now : [...now, keyOf(active)]));
|
|
186
|
+
}, container: container }, keyOf(active))) : null] }) }));
|
|
187
|
+
}
|
|
188
|
+
export { InspirationGallery };
|
|
189
|
+
//# sourceMappingURL=inspiration-gallery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspiration-gallery.js","sourceRoot":"","sources":["../../src/blocks/inspiration-gallery.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACtE,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AACzG,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACjE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,qBAAqB,EACrB,u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CAAC;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type HomeCreation, type RecentlyOpenedCreation } from "./home-pinned.js";
|
|
3
|
+
/**
|
|
4
|
+
* JUMP BACK IN (ui#605, Asaf's design for console#1182, 2026-11-25, on top of
|
|
5
|
+
* Tamir's issue): the block both front pages place, and its "See all" window.
|
|
6
|
+
*
|
|
7
|
+
* Presentational, as the Home's pieces are: the pins, the recent opens, the
|
|
8
|
+
* window's rows and every handler are the caller's; nothing here fetches, and
|
|
9
|
+
* nothing here decides what is pinned.
|
|
10
|
+
*
|
|
11
|
+
* ## The block (`JumpBackIn`)
|
|
12
|
+
*
|
|
13
|
+
* One card, in the Home's card shell, the one every Home card wears
|
|
14
|
+
* (`BentoCard`'s look, class for class): `bg-card`, the hairline edge
|
|
15
|
+
* (`border-hairline`), radius 12 (`rounded-md`), 24 inside, no shadow. The
|
|
16
|
+
* issue first said radius 20 with the card shadow; the lead corrected it.
|
|
17
|
+
*
|
|
18
|
+
* header "Jump back in" at the Home's section title size (the
|
|
19
|
+
* `BentoCard` title: 20 bold on a 28 line), and 12 after it the
|
|
20
|
+
* line "Your pins, then what you opened last." in Small, muted
|
|
21
|
+
* (`text-faint-strong`); on a narrow card the line wraps under
|
|
22
|
+
* the title. At the far right, with `onSeeAll`, "See all N" and
|
|
23
|
+
* the arrow: the Home's teal text link (`ActionLink`, bold, the
|
|
24
|
+
* 16 arrow 6 after the words), a button that calls `onSeeAll`;
|
|
25
|
+
* the caller opens `JumpBackInWindow`
|
|
26
|
+
* Pinned "Pinned · N", a small label (Small, muted) after the outline
|
|
27
|
+
* pin, then `PinnedCreations` at its small size
|
|
28
|
+
* (`size="small"`, Asaf, 2026-11-26): the same small My
|
|
29
|
+
* creations cards, as many as fit at 192 or more (five of
|
|
30
|
+
* about 206 at the Console's 1440), sharing the row to its
|
|
31
|
+
* edge or the arrow, the arrows, the Unpin chip on hover, and
|
|
32
|
+
* one "Pin a creation" slot after the last pin (ui#622; none
|
|
33
|
+
* at six), My creations' empty card with the push pin: grey at
|
|
34
|
+
* rest, cyan on hover, where the pin stands up; at zero pins a
|
|
35
|
+
* muted line beside it. Its other props pass through untouched
|
|
36
|
+
* Recently "Recently opened", the same small label, then the recent
|
|
37
|
+
* opened opens as tiles (`RecentlyOpened layout="tiles"`): four in a
|
|
38
|
+
* row, two where four do not fit, one on a phone; on hover the
|
|
39
|
+
* pin chip, "Pin it" or "Unpin" (ui#622), with `onPin` and
|
|
40
|
+
* `onUnpin`
|
|
41
|
+
* spacing 16 between the header and the parts, 12 from a label to its row
|
|
42
|
+
*
|
|
43
|
+
* Each part can be absent. No `recent`, or none yet (the recent opens route is
|
|
44
|
+
* not live), and Recently opened is not drawn at all, not even its empty
|
|
45
|
+
* line. No `pinned` and Pinned is not drawn; an empty list is Pinned's own
|
|
46
|
+
* empty state, the one slot and its line.
|
|
47
|
+
*
|
|
48
|
+
* ## The window (`JumpBackInWindow`)
|
|
49
|
+
*
|
|
50
|
+
* The library's dialog, 680 wide where there is room (the search window's
|
|
51
|
+
* width, ui#531): the title "Everything you can open", the line "N creations
|
|
52
|
+
* across the spaces you belong to.", the tabs (`FilterTabs`): All with its
|
|
53
|
+
* count, Pinned with its count, Recently opened; and the rows. A row is the
|
|
54
|
+
* picture (64 by 40 at 8, the tiles' picture), the name, and under it "owner ·
|
|
55
|
+
* space · Opened 2h ago" (each part when known), the whole row the creation's
|
|
56
|
+
* link; at its end "Pinned" after the filled pin, or "+ Pin". With `onUnpin`
|
|
57
|
+
* "Pinned" is a button that unpins; with `onPin`, "+ Pin" pins. Both sit above
|
|
58
|
+
* the row's link, never inside it.
|
|
59
|
+
*
|
|
60
|
+
* The tabs filter the rows the caller gives (`jumpBackInRows`): All, every
|
|
61
|
+
* row; Pinned, those `pinned`; Recently opened, those with an `opened`. A
|
|
62
|
+
* caller that loads each tab's own rows (`onTabChange`) passes them as they
|
|
63
|
+
* come; the filter then changes nothing. A row whose id came before is never
|
|
64
|
+
* drawn again, so a page that repeats one cannot show it twice.
|
|
65
|
+
*
|
|
66
|
+
* It loads more as the reader scrolls: the rows are their own scrolling box,
|
|
67
|
+
* and when the reader is within 160 of its end (`JUMP_BACK_IN_LOAD_MARGIN`),
|
|
68
|
+
* or the rows do not fill it, `onLoadMore` is called, once for each count of
|
|
69
|
+
* the caller's rows, so a page that brings nothing the tab shows, or only
|
|
70
|
+
* repeats, still counts as come (`jumpBackInShouldLoad`,
|
|
71
|
+
* `jumpBackInLoadSettled`, `jumpBackInLoadAsk`). A load that ended without
|
|
72
|
+
* new rows (a failed page) is asked again on the reader's next scroll, wheel
|
|
73
|
+
* or touch on the rows, or tab, never by itself; not while `loading`, not without `hasMore`,
|
|
74
|
+
* and not again until the caller's rows have grown. While
|
|
75
|
+
* `loading`, a skeleton row stands at the end. Not in this cut: Edit pins,
|
|
76
|
+
* search, "Most used".
|
|
77
|
+
*
|
|
78
|
+
* An overlay: it portals to the body, out of any surface scope, so it is the
|
|
79
|
+
* white popover on the card, the panel and ink alike.
|
|
80
|
+
*
|
|
81
|
+
* ## Tokens
|
|
82
|
+
*
|
|
83
|
+
* the label Small (`text-caption`) in `text-faint-strong`, the 16 outline
|
|
84
|
+
* pin in `text-faint` (`PinMark`, tilted)
|
|
85
|
+
* Pinned the 15 filled pin, upright (`PinMark pinned`, ui#622), in the
|
|
86
|
+
* accent role, "Pinned" in Small, muted
|
|
87
|
+
* + Pin Small Medium in the accent role, the 14 plus before it
|
|
88
|
+
* the rows 60 tall, 2 apart, radius 8, the hover wash
|
|
89
|
+
*/
|
|
90
|
+
/** Every line the block and the window write, as the design writes them. */
|
|
91
|
+
export declare const JUMP_BACK_IN_COPY: {
|
|
92
|
+
readonly title: "Jump back in";
|
|
93
|
+
readonly line: "Your pins, then what you opened last.";
|
|
94
|
+
readonly seeAll: "See all";
|
|
95
|
+
readonly pinned: "Pinned";
|
|
96
|
+
readonly recent: "Recently opened";
|
|
97
|
+
readonly windowTitle: "Everything you can open";
|
|
98
|
+
readonly tabsLabel: "Filter what you can open";
|
|
99
|
+
readonly tabAll: "All";
|
|
100
|
+
readonly tabPinned: "Pinned";
|
|
101
|
+
readonly tabRecent: "Recently opened";
|
|
102
|
+
readonly rowPinned: "Pinned";
|
|
103
|
+
readonly rowPin: "Pin";
|
|
104
|
+
readonly rowUnpin: "unpin";
|
|
105
|
+
readonly loading: "Loading more";
|
|
106
|
+
readonly emptyAll: "Creations you can open will appear here.";
|
|
107
|
+
readonly emptyPinned: "Nothing pinned yet. Pin a creation and it stays here.";
|
|
108
|
+
readonly emptyRecent: "Creations you open will appear here.";
|
|
109
|
+
};
|
|
110
|
+
/** The window's line: "15 creations across the spaces you belong to." */
|
|
111
|
+
export declare function jumpBackInWindowLine(count: number): string;
|
|
112
|
+
/** The window's tabs. */
|
|
113
|
+
export type JumpBackInTab = "all" | "pinned" | "recent";
|
|
114
|
+
/** A creation in the window. */
|
|
115
|
+
export type JumpBackInRow = HomeCreation & {
|
|
116
|
+
/** "You", or the owner's name. */
|
|
117
|
+
owner?: React.ReactNode;
|
|
118
|
+
/** The space it lives in. */
|
|
119
|
+
space?: React.ReactNode;
|
|
120
|
+
/** "Opened 2h ago", when known. A row with it is on Recently opened. */
|
|
121
|
+
opened?: React.ReactNode;
|
|
122
|
+
/** Whether the reader has pinned it: "Pinned" at the row's end, or "+ Pin". */
|
|
123
|
+
pinned?: boolean;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* The rows a tab shows, in the caller's order: All every row, Pinned the
|
|
127
|
+
* pinned, Recently opened those with an `opened`. A row whose id came before
|
|
128
|
+
* is left out, so nothing shows twice.
|
|
129
|
+
*/
|
|
130
|
+
export declare function jumpBackInRows<T extends JumpBackInRow>(rows: readonly T[], tab: JumpBackInTab): T[];
|
|
131
|
+
/** How near the end of the rows, in px, the reader is when the next page is asked for. */
|
|
132
|
+
export declare const JUMP_BACK_IN_LOAD_MARGIN = 160;
|
|
133
|
+
/**
|
|
134
|
+
* Whether to ask for the next page: the reader is within `margin` of the end
|
|
135
|
+
* of the rows' box (or the rows do not fill it), there is more, nothing is
|
|
136
|
+
* loading, and either the rows have grown since the last ask (`count` and
|
|
137
|
+
* `askedAt` are the caller's rows, `rows.length`, not the rows a tab shows:
|
|
138
|
+
* a page that brings nothing the tab shows, or only repeats, still came), or
|
|
139
|
+
* the last load ended without new rows (`stalled`, a failed page) and the
|
|
140
|
+
* reader has just acted on the rows (`reader`: a scroll, a wheel or a touch on
|
|
141
|
+
* them, or a tab). A stalled load is never asked again by itself, so a
|
|
142
|
+
* failing feed is not asked in a loop (Nataly's review, PR #613).
|
|
143
|
+
*/
|
|
144
|
+
export declare function jumpBackInShouldLoad(view: {
|
|
145
|
+
scrollTop: number;
|
|
146
|
+
clientHeight: number;
|
|
147
|
+
scrollHeight: number;
|
|
148
|
+
}, state: {
|
|
149
|
+
hasMore: boolean;
|
|
150
|
+
loading: boolean;
|
|
151
|
+
count: number;
|
|
152
|
+
askedAt: number | null;
|
|
153
|
+
stalled?: boolean;
|
|
154
|
+
reader?: boolean;
|
|
155
|
+
}, margin?: number): boolean;
|
|
156
|
+
/**
|
|
157
|
+
* The window's paging bookkeeping between renders: `askedAt`, the caller's
|
|
158
|
+
* row count at the last ask (null before any, or after the list was
|
|
159
|
+
* replaced); `stalled`, the last load ended without new rows; `wasLoading`,
|
|
160
|
+
* `loading` at the last render.
|
|
161
|
+
*/
|
|
162
|
+
export type JumpBackInLoadTrack = {
|
|
163
|
+
askedAt: number | null;
|
|
164
|
+
stalled: boolean;
|
|
165
|
+
wasLoading: boolean;
|
|
166
|
+
};
|
|
167
|
+
/** The bookkeeping before the first ask. */
|
|
168
|
+
export declare const JUMP_BACK_IN_LOAD_START: JumpBackInLoadTrack;
|
|
169
|
+
/**
|
|
170
|
+
* The bookkeeping after a render with `rows` and `loading`: a load that has
|
|
171
|
+
* just ended with no more rows than when it was asked is stalled; a list
|
|
172
|
+
* shorter than at the last ask was replaced (a new tab's own rows, a reset),
|
|
173
|
+
* so it starts over.
|
|
174
|
+
*/
|
|
175
|
+
export declare function jumpBackInLoadSettled(track: JumpBackInLoadTrack, rows: readonly unknown[], loading: boolean): JumpBackInLoadTrack;
|
|
176
|
+
/**
|
|
177
|
+
* Whether to ask for the next page now, by `jumpBackInShouldLoad` with the
|
|
178
|
+
* caller's own `rows`: the bookkeeping after the ask, or null for no ask.
|
|
179
|
+
*/
|
|
180
|
+
export declare function jumpBackInLoadAsk(view: {
|
|
181
|
+
scrollTop: number;
|
|
182
|
+
clientHeight: number;
|
|
183
|
+
scrollHeight: number;
|
|
184
|
+
}, track: JumpBackInLoadTrack, now: {
|
|
185
|
+
rows: readonly unknown[];
|
|
186
|
+
hasMore: boolean;
|
|
187
|
+
loading: boolean;
|
|
188
|
+
reader?: boolean;
|
|
189
|
+
}): JumpBackInLoadTrack | null;
|
|
190
|
+
declare function JumpBackIn({ pinned, pinnedCount, recent, onUnpin, onAddPin, onPin, onOpen, onSeeAll, seeAllCount, linkComponent, title, line, seeAllLabel, pinnedLabel, recentLabel, level, className, ...props }: Omit<React.ComponentProps<"section">, "title" | "children"> & {
|
|
191
|
+
/** The pins, in the caller's order. Without it, no Pinned; empty, Pinned's one slot and its line. */
|
|
192
|
+
pinned?: readonly HomeCreation[];
|
|
193
|
+
/** The N in "Pinned · N". Defaults to how many `pinned` holds. */
|
|
194
|
+
pinnedCount?: number;
|
|
195
|
+
/** The recent opens, newest first. Without any, no Recently opened. */
|
|
196
|
+
recent?: readonly RecentlyOpenedCreation[];
|
|
197
|
+
/** Pinned's Unpin chip (PinnedCreations' own), and the pin chip on a recent tile that is pinned (ui#622). */
|
|
198
|
+
onUnpin?: (item: HomeCreation) => void;
|
|
199
|
+
/** Pinned's empty slots, "Pin a creation" (PinnedCreations' own). */
|
|
200
|
+
onAddPin?: () => void;
|
|
201
|
+
/** The pin chip, "Pin it", on a recent tile that is not pinned. */
|
|
202
|
+
onPin?: (item: RecentlyOpenedCreation) => void;
|
|
203
|
+
/** Opens a creation that has no `href`. */
|
|
204
|
+
onOpen?: (item: HomeCreation) => void;
|
|
205
|
+
/** "See all N": the caller opens the window. No See all without it. */
|
|
206
|
+
onSeeAll?: () => void;
|
|
207
|
+
/** The N in "See all N": everything the reader can open. */
|
|
208
|
+
seeAllCount?: number;
|
|
209
|
+
/** The element a link renders through, for a router's own link. */
|
|
210
|
+
linkComponent?: React.ElementType;
|
|
211
|
+
title?: React.ReactNode;
|
|
212
|
+
line?: React.ReactNode;
|
|
213
|
+
seeAllLabel?: string;
|
|
214
|
+
pinnedLabel?: React.ReactNode;
|
|
215
|
+
recentLabel?: React.ReactNode;
|
|
216
|
+
/** The title's heading level; the labels are one under it. */
|
|
217
|
+
level?: 2 | 3 | 4;
|
|
218
|
+
}): React.JSX.Element;
|
|
219
|
+
declare function JumpBackInWindow({ open, onOpenChange, rows, total, pinnedCount, tab: tabProp, defaultTab, onTabChange, hasMore, loading, onLoadMore, onPin, onUnpin, onOpen, linkComponent, title, line, className, }: {
|
|
220
|
+
open: boolean;
|
|
221
|
+
onOpenChange: (open: boolean) => void;
|
|
222
|
+
/** Every row loaded so far, in the caller's order. */
|
|
223
|
+
rows: readonly JumpBackInRow[];
|
|
224
|
+
/** Everything the reader can open: the line's N and All's count. */
|
|
225
|
+
total: number;
|
|
226
|
+
/** Pinned's count. Without it, how many loaded rows are pinned. */
|
|
227
|
+
pinnedCount?: number;
|
|
228
|
+
/** The tab, when the caller holds it. */
|
|
229
|
+
tab?: JumpBackInTab;
|
|
230
|
+
defaultTab?: JumpBackInTab;
|
|
231
|
+
onTabChange?: (tab: JumpBackInTab) => void;
|
|
232
|
+
/** There are rows not yet loaded. */
|
|
233
|
+
hasMore?: boolean;
|
|
234
|
+
/** The next page is on its way: a skeleton row at the end, and no new ask. */
|
|
235
|
+
loading?: boolean;
|
|
236
|
+
/** The reader nears the end of the rows. */
|
|
237
|
+
onLoadMore?: () => void;
|
|
238
|
+
/** "+ Pin" on a row that is not pinned. */
|
|
239
|
+
onPin?: (row: JumpBackInRow) => void;
|
|
240
|
+
/** "Pinned" on a pinned row, pressed: unpin it. Without it, "Pinned" is a word, not a button. */
|
|
241
|
+
onUnpin?: (row: JumpBackInRow) => void;
|
|
242
|
+
/** Opens a creation that has no `href`. */
|
|
243
|
+
onOpen?: (item: HomeCreation) => void;
|
|
244
|
+
linkComponent?: React.ElementType;
|
|
245
|
+
title?: React.ReactNode;
|
|
246
|
+
/** Under the title. Defaults to "N creations across the spaces you belong to." */
|
|
247
|
+
line?: React.ReactNode;
|
|
248
|
+
className?: string;
|
|
249
|
+
}): React.JSX.Element;
|
|
250
|
+
export { JumpBackIn, JumpBackInWindow };
|
|
251
|
+
//# sourceMappingURL=jump-back-in.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jump-back-in.d.ts","sourceRoot":"","sources":["../../src/blocks/jump-back-in.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B,OAAO,EAAmC,KAAK,YAAY,EAAE,KAAK,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;AAM3H;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AAEH,4EAA4E;AAC5E,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;CAkBpB,CAAA;AAEV,yEAAyE;AACzE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,yBAAyB;AACzB,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEvD,gCAAgC;AAChC,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG;IACzC,kCAAkC;IAClC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,6BAA6B;IAC7B,KAAK,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