@cloudgrid-io/ui 0.31.3 → 0.31.5

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 (109) hide show
  1. package/README.md +32 -0
  2. package/dist/badge/brand.d.ts +8 -0
  3. package/dist/badge/brand.d.ts.map +1 -0
  4. package/dist/badge/brand.js +22 -0
  5. package/dist/badge/brand.js.map +1 -0
  6. package/dist/badge/css-base.d.ts +25 -0
  7. package/dist/badge/css-base.d.ts.map +1 -0
  8. package/dist/badge/css-base.js +103 -0
  9. package/dist/badge/css-base.js.map +1 -0
  10. package/dist/badge/css-owner.d.ts +7 -0
  11. package/dist/badge/css-owner.d.ts.map +1 -0
  12. package/dist/badge/css-owner.js +128 -0
  13. package/dist/badge/css-owner.js.map +1 -0
  14. package/dist/badge/css-visitor.d.ts +7 -0
  15. package/dist/badge/css-visitor.d.ts.map +1 -0
  16. package/dist/badge/css-visitor.js +75 -0
  17. package/dist/badge/css-visitor.js.map +1 -0
  18. package/dist/badge/html.d.ts +26 -0
  19. package/dist/badge/html.d.ts.map +1 -0
  20. package/dist/badge/html.js +55 -0
  21. package/dist/badge/html.js.map +1 -0
  22. package/dist/badge/index.d.ts +43 -0
  23. package/dist/badge/index.d.ts.map +1 -0
  24. package/dist/badge/index.js +46 -0
  25. package/dist/badge/index.js.map +1 -0
  26. package/dist/badge/marks.d.ts +45 -0
  27. package/dist/badge/marks.d.ts.map +1 -0
  28. package/dist/badge/marks.js +126 -0
  29. package/dist/badge/marks.js.map +1 -0
  30. package/dist/badge/owner.d.ts +213 -0
  31. package/dist/badge/owner.d.ts.map +1 -0
  32. package/dist/badge/owner.js +309 -0
  33. package/dist/badge/owner.js.map +1 -0
  34. package/dist/badge/palette.d.ts +23 -0
  35. package/dist/badge/palette.d.ts.map +1 -0
  36. package/dist/badge/palette.js +86 -0
  37. package/dist/badge/palette.js.map +1 -0
  38. package/dist/badge/root.d.ts +24 -0
  39. package/dist/badge/root.d.ts.map +1 -0
  40. package/dist/badge/root.js +11 -0
  41. package/dist/badge/root.js.map +1 -0
  42. package/dist/badge/shared.d.ts +56 -0
  43. package/dist/badge/shared.d.ts.map +1 -0
  44. package/dist/badge/shared.js +53 -0
  45. package/dist/badge/shared.js.map +1 -0
  46. package/dist/badge/visitor.d.ts +96 -0
  47. package/dist/badge/visitor.d.ts.map +1 -0
  48. package/dist/badge/visitor.js +119 -0
  49. package/dist/badge/visitor.js.map +1 -0
  50. package/dist/blocks/confirm-delete-dialog.d.ts +81 -0
  51. package/dist/blocks/confirm-delete-dialog.d.ts.map +1 -0
  52. package/dist/blocks/confirm-delete-dialog.js +89 -0
  53. package/dist/blocks/confirm-delete-dialog.js.map +1 -0
  54. package/dist/blocks/entity-status.d.ts +44 -1
  55. package/dist/blocks/entity-status.d.ts.map +1 -1
  56. package/dist/blocks/entity-status.js +26 -1
  57. package/dist/blocks/entity-status.js.map +1 -1
  58. package/dist/blocks/expiry-notice.d.ts +86 -0
  59. package/dist/blocks/expiry-notice.d.ts.map +1 -0
  60. package/dist/blocks/expiry-notice.js +81 -0
  61. package/dist/blocks/expiry-notice.js.map +1 -0
  62. package/dist/blocks/icons.d.ts +22 -0
  63. package/dist/blocks/icons.d.ts.map +1 -1
  64. package/dist/blocks/icons.js +22 -0
  65. package/dist/blocks/icons.js.map +1 -1
  66. package/dist/blocks/notification-row.d.ts +88 -0
  67. package/dist/blocks/notification-row.d.ts.map +1 -0
  68. package/dist/blocks/notification-row.js +32 -0
  69. package/dist/blocks/notification-row.js.map +1 -0
  70. package/dist/blocks/phosphor-marks.d.ts +10 -0
  71. package/dist/blocks/phosphor-marks.d.ts.map +1 -1
  72. package/dist/blocks/phosphor-marks.js +15 -0
  73. package/dist/blocks/phosphor-marks.js.map +1 -1
  74. package/dist/blocks/shelf.d.ts +384 -0
  75. package/dist/blocks/shelf.d.ts.map +1 -0
  76. package/dist/blocks/shelf.js +489 -0
  77. package/dist/blocks/shelf.js.map +1 -0
  78. package/dist/brand/badge/manrope-latin-wght-normal.woff2 +0 -0
  79. package/dist/brand/badge/space-grotesk-latin-wght-normal.woff2 +0 -0
  80. package/dist/brand/email/headline-activity.png +0 -0
  81. package/dist/brand/email/headline-expired.png +0 -0
  82. package/dist/brand/email/headline-expires-tomorrow.png +0 -0
  83. package/dist/brand/email/headline-expiring-soon.png +0 -0
  84. package/dist/brand/email/headline-invited.png +0 -0
  85. package/dist/brand/email/headline-sign-in-code.png +0 -0
  86. package/dist/brand/email/mesh.png +0 -0
  87. package/dist/brand/email/wordmark.png +0 -0
  88. package/dist/email/assets.d.ts +50 -0
  89. package/dist/email/assets.d.ts.map +1 -0
  90. package/dist/email/assets.js +16 -0
  91. package/dist/email/assets.js.map +1 -0
  92. package/dist/email/index.d.ts +204 -0
  93. package/dist/email/index.d.ts.map +1 -0
  94. package/dist/email/index.js +429 -0
  95. package/dist/email/index.js.map +1 -0
  96. package/dist/email/palette.d.ts +40 -0
  97. package/dist/email/palette.d.ts.map +1 -0
  98. package/dist/email/palette.js +44 -0
  99. package/dist/email/palette.js.map +1 -0
  100. package/dist/index.d.ts +4 -0
  101. package/dist/index.d.ts.map +1 -1
  102. package/dist/index.js +4 -0
  103. package/dist/index.js.map +1 -1
  104. package/dist/shadcn.css +41 -0
  105. package/dist/ui/dropdown-menu.d.ts +8 -1
  106. package/dist/ui/dropdown-menu.d.ts.map +1 -1
  107. package/dist/ui/dropdown-menu.js +9 -2
  108. package/dist/ui/dropdown-menu.js.map +1 -1
  109. package/package.json +17 -1
@@ -0,0 +1,384 @@
1
+ import * as React from "react";
2
+ import { DrawerContent } from "../ui/drawer.js";
3
+ import { type EntityKind } from "./entity-card.js";
4
+ /**
5
+ * The Shelf (Shelf spec 2026-10-07, Part B): where things that expired or were
6
+ * never published go on their own, and where they are moved back from.
7
+ *
8
+ * Figma `5ouhISIL0mwYGHurvCGoEO`, section "Shelf v2 - 2026-10-07" (9834:7965),
9
+ * frames 01 to 09b. The frames are the LAYOUT. The sizes are the Console's: the
10
+ * founder's instruction was that the Shelf look like the app page and the grid
11
+ * settings page do as they render, so every height and type size below is the
12
+ * one measured off those pages (audit log `2026-10-07-shelf-blocks.md`, step 0)
13
+ * and expressed with the library primitive that already produces it:
14
+ *
15
+ * table head 40, 15/500 `TableHead` as is
16
+ * row 57 (two lines) `TableCell` as is, 8 padding
17
+ * reason pill 20, 13/500 `Badge variant="secondary"`, the Versions table's grey pill
18
+ * row buttons 28, 13/500 `Button size="sm"` / `size="icon-sm"`, the app header's rung
19
+ * toolbar 32 `InputGroup`, `Button`, `Tabs` default, all h-8
20
+ * drawer 448 `DrawerContent size="md"`, every Console drawer
21
+ *
22
+ * ## What is in here
23
+ *
24
+ * The parts, each usable alone, and `Shelf`, which composes them the way the
25
+ * frames do and owns the transient state between them: which row's drawer is
26
+ * open, which item the delete dialog is about, which rows are mid-request.
27
+ *
28
+ * ShelfToolbar reason tabs with counts, search, sort menu, List/Compact
29
+ * ShelfTable the List view: a real <table>
30
+ * ShelfCardList the Compact view, and every view under 768px of shelf
31
+ * ShelfItemDetails the drawer (right) or bottom sheet (phone)
32
+ * ShelfEmpty "Your shelf is empty"
33
+ * ShelfFooter "Showing 6 of 24 creations" and Show more
34
+ * toastMovedToGrid the confirmation toast, no Undo
35
+ *
36
+ * The type-to-confirm dialog is its own module, `confirm-delete-dialog`,
37
+ * because nothing about it is Shelf-specific.
38
+ *
39
+ * ## Data-agnostic
40
+ *
41
+ * Nothing here fetches, filters, sorts or counts. The spec is explicit that the
42
+ * counts, search and sort come from the server (Part D) and that the Console must
43
+ * not filter a truncated list in the browser, so the blocks only REPORT what the
44
+ * reader asked for (`onTabChange`, `onSearch`, `onSort`) and render the `items`
45
+ * they are handed. Counts are optional: until the server sends them, a tab is
46
+ * its word alone.
47
+ *
48
+ * ## Narrow
49
+ *
50
+ * By container query on the block, not the window: under 48rem of shelf the
51
+ * table becomes the stacked cards, the cards go to one column with a full-width
52
+ * Move to grid, and the sort menu and view toggle leave (frame 09 draws neither).
53
+ * The reason tabs are the library's `pill` chips at every width, which is what
54
+ * frame 09 draws and what scrolls rather than wraps on a phone. The drawer is
55
+ * the one thing that asks the WINDOW, because a sheet is a property of the
56
+ * screen: `detailsSide="auto"` is a bottom sheet under 768px, the Console's own
57
+ * phone breakpoint.
58
+ */
59
+ /**
60
+ * Why something is on the shelf. The reason follows the kind (spec, "The
61
+ * model"): a page only ever expires, an app or agent is only ever never
62
+ * published. The Console derives it from `realm`; the block takes it as given.
63
+ */
64
+ export declare const SHELF_REASON_ORDER: readonly ["expired", "never_published"];
65
+ export type ShelfReason = (typeof SHELF_REASON_ORDER)[number];
66
+ /** The pill's word. */
67
+ export declare const SHELF_REASON_LABEL: Record<ShelfReason, string>;
68
+ /** The line beside the pill. Library copy, from the frames' annotation. */
69
+ export declare const SHELF_REASON_DETAIL: Record<ShelfReason, string>;
70
+ /** The reason tabs. `all` first, then the reasons in their own order. */
71
+ export declare const SHELF_TAB_ORDER: readonly ["all", "expired", "never_published"];
72
+ export type ShelfTab = (typeof SHELF_TAB_ORDER)[number];
73
+ export declare const SHELF_TAB_LABEL: Record<ShelfTab, string>;
74
+ /** The sort menu, in the order frame 08 lists it. The first is the default. */
75
+ export declare const SHELF_SORT_ORDER: readonly ["recent", "oldest", "name"];
76
+ export type ShelfSort = (typeof SHELF_SORT_ORDER)[number];
77
+ export declare const SHELF_SORT_LABEL: Record<ShelfSort, string>;
78
+ export declare const SHELF_VIEW_ORDER: readonly ["list", "compact"];
79
+ export type ShelfView = (typeof SHELF_VIEW_ORDER)[number];
80
+ export declare const SHELF_VIEW_LABEL: Record<ShelfView, string>;
81
+ export declare const SHELF_EMPTY_TITLE = "Your shelf is empty";
82
+ export declare const SHELF_EMPTY_DESCRIPTION = "Things that expire or are never published will show up here on their own.";
83
+ export declare const SHELF_NO_MATCHES = "Nothing on your shelf matches that.";
84
+ export declare const SHELF_SEARCH_PLACEHOLDER = "Search your shelf";
85
+ export declare const SHELF_AVAILABILITY_NOTE = "Move it to your grid to bring it back.";
86
+ export declare const SHELF_MOVE_LABEL = "Move to grid";
87
+ /** The toast after a move. No Undo: the move is the undo. */
88
+ export declare function shelfMovedMessage(name: string): string;
89
+ /** One thing on the shelf. */
90
+ export type ShelfItem = {
91
+ id: string;
92
+ /** The display name. */
93
+ name: string;
94
+ /** What the reader types to confirm a delete. Falls back to `name`. */
95
+ slug?: string;
96
+ /** Drives the fallback mark and, without `kindLabel`, the word under the name. */
97
+ kind: EntityKind;
98
+ /** The word under the name, when the kind's own word is not specific enough ("Presentation"). */
99
+ kindLabel?: string;
100
+ reason: ShelfReason;
101
+ /** When it moved to the shelf. An ISO string, a Date or epoch milliseconds. */
102
+ movedAt: string | number | Date;
103
+ /** A preview picture. Without one, or if it fails to load, the kind's mark. */
104
+ thumbnailSrc?: string;
105
+ };
106
+ /** Per-tab counts. Any that are missing render as the tab's word alone. */
107
+ export type ShelfCounts = Partial<Record<ShelfTab, number>>;
108
+ /**
109
+ * "Sep 14" in a row, "Sep 12, 2026" in the drawer. English months, the
110
+ * reader's own time zone, which is how the Console prints every other date.
111
+ */
112
+ export declare function formatShelfDate(value: ShelfItem["movedAt"], style?: "short" | "long"): string;
113
+ declare const THUMB_SIZE: {
114
+ readonly row: "h-10 w-16 rounded-2xs";
115
+ readonly card: "h-[70px] w-28 rounded-xs";
116
+ readonly sheet: "h-[70px] w-28 rounded-xs";
117
+ readonly preview: "aspect-[16/9] w-full rounded-lg";
118
+ };
119
+ /**
120
+ * The picture, or the kind's mark on the kind's tint when there is none.
121
+ *
122
+ * Decorative in both forms (`alt=""`, `aria-hidden` mark): the name is always
123
+ * beside it, and a screenshot of an app has nothing a screen reader needs. A
124
+ * picture that fails to load falls back to the mark rather than a broken box.
125
+ */
126
+ declare function ShelfThumbnail({ item, size, className, }: {
127
+ item: Pick<ShelfItem, "kind" | "thumbnailSrc">;
128
+ size?: keyof typeof THUMB_SIZE;
129
+ className?: string;
130
+ }): React.JSX.Element;
131
+ /** The grey pill and its detail line. */
132
+ declare function ShelfReasonTag({ reason, className }: {
133
+ reason: ShelfReason;
134
+ className?: string;
135
+ }): React.JSX.Element;
136
+ /** The row's "..." menu. Delete is its only item (frame 06). */
137
+ declare function ShelfRowMenu({ item, onRequestDelete, }: {
138
+ item: ShelfItem;
139
+ onRequestDelete: (item: ShelfItem) => void;
140
+ }): React.JSX.Element;
141
+ type RowActions = {
142
+ /** The reader asked to see an item: its name was pressed, or its row clicked. */
143
+ onOpenDetails?: (item: ShelfItem) => void;
144
+ onMoveToGrid?: (item: ShelfItem) => void;
145
+ /** The reader picked Delete in a row's menu. Absent, the menu is not drawn. */
146
+ onRequestDelete?: (item: ShelfItem) => void;
147
+ /** The item whose details are open; its row is drawn selected. */
148
+ selectedId?: string | null;
149
+ /** Items with a Move to grid in flight. */
150
+ movingIds?: ReadonlySet<string>;
151
+ };
152
+ /**
153
+ * The List view (frame 01): Creation, Why it's here, Moved here, actions.
154
+ *
155
+ * A real `<table>` with a header row, because it is one: four facts per item in
156
+ * columns a reader compares down the page. The name is a button that opens the
157
+ * details, which is the keyboard path; a click anywhere else on the row does the
158
+ * same for a mouse, and ignores clicks that land on the row's own buttons.
159
+ */
160
+ declare function ShelfTable({ items, onOpenDetails, onMoveToGrid, onRequestDelete, selectedId, movingIds, caption, className, }: RowActions & {
161
+ items: readonly ShelfItem[];
162
+ /** The table's accessible name. Rendered for screen readers only. */
163
+ caption?: string;
164
+ className?: string;
165
+ }): React.JSX.Element;
166
+ /**
167
+ * One item as a card (frames 02 and 09).
168
+ *
169
+ * Two arrangements by container query on the card itself. Wide (a Compact
170
+ * column on a desktop): picture, three lines, Move to grid and the menu in a
171
+ * row. Narrow (a phone): a smaller picture and two lines with the menu top
172
+ * right, and Move to grid full width underneath, which is frame 09 exactly,
173
+ * detail line and all left out.
174
+ */
175
+ declare function ShelfCard({ item, onOpenDetails, onMoveToGrid, onRequestDelete, selected, moving, }: Omit<RowActions, "selectedId" | "movingIds"> & {
176
+ item: ShelfItem;
177
+ selected?: boolean;
178
+ moving?: boolean;
179
+ }): React.JSX.Element;
180
+ /**
181
+ * The cards as a list. `columns="auto"` is two columns from 48rem of shelf and
182
+ * one below, which is the Compact view; `columns={1}` is one at every width,
183
+ * which is the List view on a phone.
184
+ */
185
+ declare function ShelfCardList({ items, columns, label, onOpenDetails, onMoveToGrid, onRequestDelete, selectedId, movingIds, className, }: RowActions & {
186
+ items: readonly ShelfItem[];
187
+ columns?: "auto" | 1;
188
+ /** The list's accessible name. */
189
+ label?: string;
190
+ className?: string;
191
+ }): React.JSX.Element;
192
+ /** What the reason tabs, search and sort do: work, go, or show and refuse. */
193
+ export declare const SHELF_QUERY_CONTROLS_ORDER: readonly ["enabled", "hidden", "disabled"];
194
+ export type ShelfQueryControls = (typeof SHELF_QUERY_CONTROLS_ORDER)[number];
195
+ /**
196
+ * Reason tabs, then search, sort and the view toggle (frames 01, 08 and 09).
197
+ *
198
+ * Every control is controlled: the toolbar reports and the caller decides,
199
+ * because what a tab or a sort MEANS is a server query (spec, Part D).
200
+ *
201
+ * - The reason tabs are `Tabs` with the `pill` list: the chips frame 09 draws,
202
+ * scrolling rather than wrapping on a phone. A count renders only when the
203
+ * caller has one; "All" alone is honest, "All 0" while loading is not.
204
+ * - The view toggle is `Tabs` with the default list, the library's segmented
205
+ * control. Hidden under 48rem of shelf, where there is one view.
206
+ * - Sort is a `DropdownMenu` radio group, so the current order carries the tick
207
+ * frame 08 draws and a screen reader hears which one is checked.
208
+ *
209
+ * ## `queryControls`, for a caller whose server cannot filter yet
210
+ *
211
+ * The tabs, the search and the sort are QUERIES. Until the server answers them
212
+ * (spec, Part D), a caller holding a paged list must not offer them, because
213
+ * answering them in the browser over the rows it happens to have loaded is the
214
+ * silent data loss the spec forbids. So:
215
+ *
216
+ * "enabled" the default: all of it works
217
+ * "hidden" the three are not rendered at all; the List/Compact toggle
218
+ * stays, because the view is presentation, not a query
219
+ * "disabled" the three render, dimmed and refusing: the tabs and the sort
220
+ * are disabled, the search field is a real `disabled` input so
221
+ * Tab skips it (no focusable dead box), each group carries
222
+ * `aria-disabled`, and none of them calls back. One tab stop
223
+ * is left on purpose: Base UI keeps the selected tab focusable
224
+ * while disabled (the ARIA pattern for a disabled tab), and that
225
+ * is where a screen reader hears `queryHint`.
226
+ *
227
+ * `queryHint` is the one line saying why, where the controls are or would be.
228
+ * When the controls are disabled it also describes them (`aria-describedby`), so
229
+ * a screen reader that lands on a dimmed tab hears the reason.
230
+ */
231
+ declare function ShelfToolbar({ tab, onTabChange, counts, query, onSearch, sort, onSort, view, onViewChange, showControls, queryControls, queryHint, className, }: {
232
+ tab: ShelfTab;
233
+ onTabChange?: (tab: ShelfTab) => void;
234
+ counts?: ShelfCounts;
235
+ query: string;
236
+ onSearch?: (query: string) => void;
237
+ sort: ShelfSort;
238
+ onSort?: (sort: ShelfSort) => void;
239
+ view: ShelfView;
240
+ onViewChange?: (view: ShelfView) => void;
241
+ /** False draws the tabs alone: the empty shelf (frame 05) has nothing to search. */
242
+ showControls?: boolean;
243
+ /** Whether the reason tabs, search and sort work, are left out, or show disabled. */
244
+ queryControls?: ShelfQueryControls;
245
+ /**
246
+ * One quiet line where the query controls are or would be, saying why they are
247
+ * off. Shown with `"hidden"` and `"disabled"` only: beside working controls it
248
+ * would be a reason for nothing.
249
+ */
250
+ queryHint?: React.ReactNode;
251
+ className?: string;
252
+ }): React.JSX.Element | null;
253
+ /**
254
+ * "Showing 6 of 24 creations" and Show more. The count line needs `total`; a
255
+ * caller without one (no server count yet, spec Part C) gets Show more alone.
256
+ */
257
+ declare function ShelfFooter({ shown, total, hasMore, onShowMore, loadingMore, className, }: {
258
+ shown: number;
259
+ total?: number;
260
+ hasMore?: boolean;
261
+ onShowMore?: () => void;
262
+ loadingMore?: boolean;
263
+ className?: string;
264
+ }): React.JSX.Element | null;
265
+ /**
266
+ * The empty shelf (frame 05). The way out is a link when `backHref` is given,
267
+ * rendered through `linkComponent` (Next's `Link`, say), or a button for
268
+ * `onBack` alone.
269
+ */
270
+ declare function ShelfEmpty({ backHref, onBack, backLabel, linkComponent, title, description, headingLevel, className, }: {
271
+ backHref?: string;
272
+ onBack?: () => void;
273
+ backLabel?: string;
274
+ linkComponent?: React.ElementType;
275
+ title?: React.ReactNode;
276
+ description?: React.ReactNode;
277
+ headingLevel?: 2 | 3;
278
+ className?: string;
279
+ }): React.JSX.Element;
280
+ /**
281
+ * The details drawer (frame 03), or the bottom sheet on a phone (frame 09b).
282
+ *
283
+ * The library `Drawer` at its `md` rung, 448, which is every Console drawer.
284
+ * What it says is the frames' list and nothing more: no Open app, because
285
+ * nothing on the shelf is live, and no Last opened, because the platform does
286
+ * not record it (annotation 9837:8842).
287
+ *
288
+ * Move to grid is the page's primary action, so it takes the Console's primary
289
+ * variant (`cta`, the teal, `PrimaryAction`). Delete is a quiet red link under
290
+ * it and opens the confirm dialog; the caller decides what that means.
291
+ */
292
+ declare function ShelfItemDetails({ item, open, onOpenChange, side, onMoveToGrid, onRequestDelete, moving, container, }: {
293
+ item: ShelfItem | null;
294
+ open: boolean;
295
+ onOpenChange: (open: boolean) => void;
296
+ side?: "right" | "bottom";
297
+ onMoveToGrid?: (item: ShelfItem) => void;
298
+ onRequestDelete?: (item: ShelfItem) => void;
299
+ moving?: boolean;
300
+ /** Forwarded to the portal, for a drawer that must stay inside a surface scope. */
301
+ container?: React.ComponentProps<typeof DrawerContent>["container"];
302
+ }): React.JSX.Element;
303
+ /**
304
+ * "{name} moved to your grid", with View grid when the caller can take the
305
+ * reader there (frame 04). No Undo: moving it back is what the Shelf is for.
306
+ *
307
+ * Fires through the library `Toaster` (`sonner`), which the Console already
308
+ * mounts once at its root. Returns the toast's id.
309
+ */
310
+ export declare function toastMovedToGrid(name: string, { onViewGrid, viewGridLabel }?: {
311
+ onViewGrid?: () => void;
312
+ viewGridLabel?: string;
313
+ }): string | number;
314
+ export type ShelfProps = {
315
+ /** What to show: the server's page for the current tab, search and sort. */
316
+ items: readonly ShelfItem[];
317
+ /** Per-tab counts from the server. Missing ones render as the word alone. */
318
+ counts?: ShelfCounts;
319
+ /** The total for the current tab and search, for "Showing 6 of 24". */
320
+ total?: number;
321
+ /** More pages exist; draws Show more when `onShowMore` is given. */
322
+ hasMore?: boolean;
323
+ onShowMore?: () => void;
324
+ loadingMore?: boolean;
325
+ tab?: ShelfTab;
326
+ defaultTab?: ShelfTab;
327
+ onTabChange?: (tab: ShelfTab) => void;
328
+ query?: string;
329
+ defaultQuery?: string;
330
+ /** Every keystroke. Debounce on the caller's side if the server needs it. */
331
+ onSearch?: (query: string) => void;
332
+ sort?: ShelfSort;
333
+ defaultSort?: ShelfSort;
334
+ onSort?: (sort: ShelfSort) => void;
335
+ view?: ShelfView;
336
+ defaultView?: ShelfView;
337
+ onViewChange?: (view: ShelfView) => void;
338
+ /** Move to grid, from a row or the drawer. A returned promise disables the button until it settles. */
339
+ onMoveToGrid?: (item: ShelfItem) => void | Promise<void>;
340
+ /**
341
+ * The CONFIRMED delete, after the reader has typed the slug. A returned promise
342
+ * keeps the dialog open and pending until it settles; a rejection shows
343
+ * `deleteErrorMessage` and keeps it open. Absent, no Delete is offered anywhere.
344
+ */
345
+ onDelete?: (item: ShelfItem) => void | Promise<void>;
346
+ deleteErrorMessage?: string;
347
+ /** A row or card was opened; the drawer opens either way. */
348
+ onOpenDetails?: (item: ShelfItem) => void;
349
+ /**
350
+ * Whether the reason tabs, search and sort work (`"enabled"`, the default), are
351
+ * left out (`"hidden"`), or show disabled (`"disabled"`). For a caller whose
352
+ * server cannot answer them yet: answering them over a partly loaded list is
353
+ * silent data loss. The List/Compact toggle is unaffected.
354
+ */
355
+ queryControls?: ShelfQueryControls;
356
+ /** Why the query controls are off, in one line where they are or would be. Not shown on an empty shelf. */
357
+ queryHint?: React.ReactNode;
358
+ /** The empty state's way out. */
359
+ emptyBackHref?: string;
360
+ onEmptyBack?: () => void;
361
+ linkComponent?: React.ElementType;
362
+ /**
363
+ * Where the details open. `auto` is a bottom sheet under 768px of window and
364
+ * a right-hand drawer above.
365
+ */
366
+ detailsSide?: "auto" | "right" | "bottom";
367
+ className?: string;
368
+ };
369
+ /**
370
+ * The whole Shelf body, as frames 01 to 09b compose it: toolbar, then the
371
+ * table, the cards or the empty state, then the footer, plus the drawer and the
372
+ * delete dialog it opens.
373
+ *
374
+ * NOT in it: the page around it. The breadcrumb, the "Shelf" title and its
375
+ * subtitle, the white box and the Back pill are the Console's page frame, and the
376
+ * gallery's full-page frame draws them at the Console's measured sizes.
377
+ *
378
+ * Empty means the server says the whole shelf is empty: `counts.all === 0`, or
379
+ * no counts, no items, the All tab and no search. A tab or a search with no
380
+ * results is not an empty shelf, and says so in one line instead.
381
+ */
382
+ declare function Shelf({ items, counts, total, hasMore, onShowMore, loadingMore, tab: tabProp, defaultTab, onTabChange, query: queryProp, defaultQuery, onSearch, sort: sortProp, defaultSort, onSort, view: viewProp, defaultView, onViewChange, onMoveToGrid, onDelete, deleteErrorMessage, onOpenDetails, emptyBackHref, onEmptyBack, linkComponent, detailsSide, queryControls, queryHint, className, }: ShelfProps): React.JSX.Element;
383
+ export { Shelf, ShelfCard, ShelfCardList, ShelfEmpty, ShelfFooter, ShelfItemDetails, ShelfReasonTag, ShelfRowMenu, ShelfTable, ShelfThumbnail, ShelfToolbar, };
384
+ //# sourceMappingURL=shelf.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shelf.d.ts","sourceRoot":"","sources":["../../src/blocks/shelf.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,OAAO,EAGL,aAAa,EAEd,MAAM,sBAAsB,CAAA;AAS7B,OAAO,EAIL,KAAK,UAAU,EAChB,MAAM,2BAA2B,CAAA;AAclC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAMH;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,yCAA0C,CAAA;AAEzE,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,kBAAkB,CAAC,CA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