@cboxdk/cbox-ui 0.10.3 → 0.11.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/README.md +76 -9
- package/dist/index.d.ts +226 -10
- package/dist/index.js +1273 -352
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/tailwind.preset.js +4 -0
- package/tokens/cbox.css +17 -0
- package/tokens/shell.css +195 -9
package/README.md
CHANGED
|
@@ -277,11 +277,12 @@ produces. Abridged:
|
|
|
277
277
|
type Shell = {
|
|
278
278
|
app: { key; name; homeUrl };
|
|
279
279
|
person: { id; name; initials; avatarUrl? };
|
|
280
|
-
page?: { title; route
|
|
281
|
-
nav: { areas: NavArea[]; activeArea; activePage
|
|
280
|
+
page?: { title; route?; create?; actions?: PaletteAction[] }; // the page's create target and its palette actions
|
|
281
|
+
nav: { areas: NavArea[]; activeArea; activePage?; tabs?: string[] }; // tabs: the phone's tab bar, up to 4
|
|
282
282
|
context: { levels: ContextLevel[]; switchUrl }; // 1–3 levels, organization first
|
|
283
|
-
palette: { searchUrl?; gotoUrl?; actions: PaletteAction[]; placeholder
|
|
284
|
-
|
|
283
|
+
palette: { searchUrl?; gotoUrl?; actions: PaletteAction[]; placeholder?; recent?: PaletteRecord[] };
|
|
284
|
+
create?: { items: ShellCreatable[]; default? }; // what "+" and the palette can create
|
|
285
|
+
help: { enabled; topic?; sessionUrl?; scriptUrl?; portalUrl?; updatesUrl?; searchUrl?; articlesUrl?; articles?; unread? };
|
|
285
286
|
notifications: { enabled: false } | { enabled: true; unread; url };
|
|
286
287
|
apps: { catalogUrl; productsUrl? };
|
|
287
288
|
account?: { profileUrl?; switchAccountUrl?; signOutUrl?; signOutMethod?; languages?; formats?; signedInWith? };
|
|
@@ -334,7 +335,7 @@ moves focus to `<main id={mainId}>` (default `main-content`).
|
|
|
334
335
|
| `level.listUrl` | `GET ?q=&parent=&cursor=&limit=` | `{ object: "list", data: ContextItem[], has_more, next_cursor }`. Loaded when a menu opens; every level below the first gets `parent`, the level above's id (projects of an organization, environments of a project). Answers are kept for the page and dropped when the context changes. |
|
|
335
336
|
| `level.createUrl` | `POST { name, parent? }` | `{ id, detailsUrl }` (or `details_url`). The person lands on `detailsUrl`. A 422 shows its first error under the field. |
|
|
336
337
|
| `account.switchAccountUrl` | A plain link (full page load) | Usually a redirect to Cbox ID's account chooser. |
|
|
337
|
-
| `context.switchUrl` | `POST { <level key>: id,
|
|
338
|
+
| `context.switchUrl` | `POST { select: { <level key>: id, … }, from }` (a form post through `navigate`; as a form, `select[project]=…&from=…`). laravel-console-kit's `/shell/switch` reads it. 0.10.3 and older posted the flat `{ <level key>: id, …, return_to }`, which console-kit 0.2.5 still accepts. | A redirect: the same page in the new context, or that area's list for an entity page (§5.6). |
|
|
338
339
|
| `palette.searchUrl` | `GET ?q=` | `{ data: [{ id, title, subtitle?, url }] }`, in the current context. |
|
|
339
340
|
| `palette.gotoUrl` | `GET ?q=` | `{ data: [{ title, subtitle?, levels?: { organization, project, … }, url? }] }` across organizations. |
|
|
340
341
|
| `apps.catalogUrl` | `GET` | The catalog below, plus `in_organization`, `admission_url`, `purpose` and `hue` per app. |
|
|
@@ -389,16 +390,76 @@ a prop of the header: Help needs it on the first paint and on pages without a he
|
|
|
389
390
|
⌘K / Ctrl+K opens the palette anywhere (↑↓ move, Enter opens, ⌘Enter opens in a new tab, Esc
|
|
390
391
|
closes). In the context menus ↑↓ Home End move, Enter picks, → makes a row's gear the active
|
|
391
392
|
option (Enter opens its settings; in the cascade a second → crosses to the environments), ←
|
|
392
|
-
goes back, Esc closes and Tab leaves; focus returns to the trigger. ↓
|
|
393
|
+
goes back, Esc closes and Tab leaves; focus returns to the trigger. ↓ on a context trigger
|
|
394
|
+
opens its menu, and focus moves into the menu when it opens: the search field with a fine
|
|
395
|
+
pointer, else the list itself (typing there goes on in the search). ↓ past the last row
|
|
393
396
|
reaches "New …" and ↑ above the first reaches "View all", so both work without a mouse; in the
|
|
394
397
|
app grid End and ↓ from the bottom row reach "All products". ⌘. collapses the subnav. Search fields focus themselves only with a fine pointer and
|
|
395
398
|
hover, never on touch. Sheets and the Help overlay trap focus; the docked column does not.
|
|
396
399
|
|
|
400
|
+
### Scrolling
|
|
401
|
+
|
|
402
|
+
The document scrolls, not a box inside the shell. The rail, the header, the subnav and docked
|
|
403
|
+
Help stay in view with `position: sticky`. So Inertia resets the scroll on a new page and
|
|
404
|
+
restores it on back and forward with no `scroll-region`, and a full-page screenshot shows the
|
|
405
|
+
whole page. A page that needs its own scroller (a wide table) brings one.
|
|
406
|
+
|
|
397
407
|
### Phone (< 768px)
|
|
398
408
|
|
|
399
|
-
The
|
|
400
|
-
|
|
401
|
-
|
|
409
|
+
The phone has its own chrome (the approved V6 design):
|
|
410
|
+
|
|
411
|
+
- **Top bar:** the context pill (the organization chip; a small line with the levels above the
|
|
412
|
+
deepest, `Org · Project`; the deepest level large, with the environment's colour), then Help
|
|
413
|
+
(a dot while support has replied), Search and the page's "+". "+" shows only when the app
|
|
414
|
+
passes `renderCreate` and has `shell.create`; its name is "New {thing}" on a page with
|
|
415
|
+
`page.create`, else "Create". A dead button is never rendered.
|
|
416
|
+
- **Under it:** the area's name, large; the "not production" banner while the current
|
|
417
|
+
environment is not live; the area's pages as chips (only with more than one page).
|
|
418
|
+
- **Tab bar:** the areas in `nav.tabs` (up to four; default the first four), then More.
|
|
419
|
+
- **More:** a full screen with push navigation: search all pages; the app's areas (each opens
|
|
420
|
+
its grouped pages); "Where you work" (each level opens the context sheet at that step);
|
|
421
|
+
Help with the page; Notifications when the app has a source; Switch app; and the profile
|
|
422
|
+
last (the account screen: profile and security, language, regional format, time zone,
|
|
423
|
+
theme, switch account, sign out). Tapping More again goes back to its top.
|
|
424
|
+
- **Context sheet:** Organization and Project rows (each opens its searchable list), the
|
|
425
|
+
environment quick picks (the current one, a live one, a test one) and "All N environments",
|
|
426
|
+
a searchable list under the app's environment `group`s with "New environment".
|
|
427
|
+
- **Help sheet:** "Help with {page}": ask (the page and where you work are shared), your
|
|
428
|
+
conversations (`help.updatesUrl`), articles for the page, Chat with support and the Help
|
|
429
|
+
centre. After a question, "Talk to a person" is always offered. The conversation itself is
|
|
430
|
+
the Assistant SDK's element, as on a desktop.
|
|
431
|
+
- **Palette:** a near full-screen sheet with Cancel (see the palette below).
|
|
432
|
+
|
|
433
|
+
Environments say whether they are live: `ContextItem.live` (else `testData` true is not live,
|
|
434
|
+
else `tone: 'production'` is live; with neither the banner never shows). The shell never guesses
|
|
435
|
+
from the name. `group` and `description` list them under headings with a second line; `tone`
|
|
436
|
+
also takes `staging`, `preview` and `development`. On a desktop the same banner shows under the
|
|
437
|
+
header when no sandbox strip does; on the phone it replaces the sandbox strip.
|
|
438
|
+
|
|
439
|
+
### Palette groups
|
|
440
|
+
|
|
441
|
+
Before anything is typed: "On {page}" (the page's create target and `page.actions`, else the
|
|
442
|
+
app's `palette.actions`), Recent (`palette.recent`, else the pages last visited on this device)
|
|
443
|
+
and Switch (other environments, the organization). With a query: Actions (page and app
|
|
444
|
+
actions, every creatable as "New …", switches), Go to, Records, Pages, Help and Ask Cbox last.
|
|
445
|
+
Scope chips (All, Actions, Records, Pages, Help) keep one kind. Records come from `searchUrl`,
|
|
446
|
+
or from `CboxShell`'s `searchRecords(query, signal)` when the app passes it. A `PaletteAction`
|
|
447
|
+
may carry `hint` (a second line) and `create` (a creatable key it opens instead of `url`).
|
|
448
|
+
|
|
449
|
+
### Create (V7)
|
|
450
|
+
|
|
451
|
+
`shell.create.items` lists what the person can create (`{ key, label, area, keywords?,
|
|
452
|
+
submitLabel? }`) and `create.default` the target of "+" on a page without its own
|
|
453
|
+
(`page.create`). "+" never navigates away: it opens the create sheet (a bottom sheet on the
|
|
454
|
+
phone, a panel from the right on a desktop) on that form, with "‹ Create" up to a searchable
|
|
455
|
+
tree of everything, grouped by area. The forms are the app's: `CboxShell`'s
|
|
456
|
+
`renderCreate(form)` returns the fields for `form.creatable.key`. A reference field calls
|
|
457
|
+
`form.createRef('customer', created => …)`, which stacks the customer form; its submit reads
|
|
458
|
+
"Create and use in invoice", and `form.done(created)` goes back and hands it over, with the
|
|
459
|
+
invoice form's state kept. The bottom form's `done()` closes the sheet. While the environment
|
|
460
|
+
is not live the sheet says "Creating in {environment}, not production". `CreateForm`,
|
|
461
|
+
`CreateField`, `CreateRefField`, `CreateSubmit` and the `cbx-cinput` class lay a form out like
|
|
462
|
+
the rest of the sheet. A page's own "New …" button calls `useShellCreate()?.openCreate(key)`.
|
|
402
463
|
|
|
403
464
|
### Tests and snapshots
|
|
404
465
|
|
|
@@ -416,3 +477,9 @@ Core tokens now match the warm cream/ink design-system colors. Body text uses
|
|
|
416
477
|
the system stack; hosts self-host Plus Jakarta Sans for headings and JetBrains
|
|
417
478
|
Mono for technical values. Card/control/badge radii are 12/8/6px. The main canvas
|
|
418
479
|
uses the approved single radial wash at 30% 0 in both themes.
|
|
480
|
+
|
|
481
|
+
Words and icons in a tone use the tone's text token, not its fill: `--success-text`,
|
|
482
|
+
`--info-text`, `--warning-text` and `--destructive-text` (`text-success-text` and so on). They
|
|
483
|
+
reach 4.5:1 on the tone's soft tint over a card, the canvas or the background, in light and
|
|
484
|
+
dark; the fills (`--success` …) are for dots, squares and solid buttons. `StatusPill` and
|
|
485
|
+
`StatTile` use them. `tests/tokens/contrast.test.ts` checks every pair.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { ReactNode, ComponentType, AnchorHTMLAttributes, ComponentProps } from 'react';
|
|
3
|
+
import { ReactNode, ComponentType, FormEvent, AnchorHTMLAttributes, ComponentProps } from 'react';
|
|
4
4
|
import { C as CboxThemeMode, a as CboxKnownApp } from './catalog-BroZWvws.js';
|
|
5
5
|
export { b as CboxAppCatalogState, c as CboxCatalogApp, d as authorizeHref, p as parseAppCatalog, r as readKnownAppCatalog, e as rememberAppCatalog, s as secureIconUrl, f as signInTarget } from './catalog-BroZWvws.js';
|
|
6
6
|
import { LucideIcon } from 'lucide-react';
|
|
@@ -327,7 +327,10 @@ type NavPage = {
|
|
|
327
327
|
*/
|
|
328
328
|
group?: string;
|
|
329
329
|
};
|
|
330
|
-
/**
|
|
330
|
+
/**
|
|
331
|
+
* One area in the rail. The subnav shows its pages when it has more than one. On a phone, the
|
|
332
|
+
* areas named in `nav.tabs` sit in the bottom tab bar and every area is listed under More.
|
|
333
|
+
*/
|
|
331
334
|
type NavArea = {
|
|
332
335
|
key: string;
|
|
333
336
|
label: string;
|
|
@@ -336,7 +339,11 @@ type NavArea = {
|
|
|
336
339
|
icon?: string;
|
|
337
340
|
pages?: NavPage[];
|
|
338
341
|
};
|
|
339
|
-
|
|
342
|
+
/**
|
|
343
|
+
* The colour of an environment. `production`, `sandbox` and `neutral` since 0.10; `staging`,
|
|
344
|
+
* `preview` and `development` since 0.11, so an app with many environments can tell them apart.
|
|
345
|
+
*/
|
|
346
|
+
type ContextTone = 'production' | 'sandbox' | 'neutral' | 'staging' | 'preview' | 'development';
|
|
340
347
|
/**
|
|
341
348
|
* One selectable item of a level: the current one in the prop, and every row a level's
|
|
342
349
|
* `listUrl` returns. Environments are app-defined (§5.1a): `tone`, `label` and `testData` are
|
|
@@ -353,6 +360,20 @@ type ContextItem = {
|
|
|
353
360
|
label?: string;
|
|
354
361
|
/** The sandbox strip shows while the current item has test data. */
|
|
355
362
|
testData?: boolean;
|
|
363
|
+
/**
|
|
364
|
+
* The app's word on whether this environment is live (real customers, real money). `false`
|
|
365
|
+
* puts the "Not production" banner under the page title. Absent: the shell reads `testData`
|
|
366
|
+
* (true is not live) and `tone` (`production` is live, another tone is not), and shows no
|
|
367
|
+
* banner when neither is set. The shell never guesses from the name.
|
|
368
|
+
*/
|
|
369
|
+
live?: boolean;
|
|
370
|
+
/**
|
|
371
|
+
* The heading this item is listed under in "All environments" ("Live", "Test", "Preview",
|
|
372
|
+
* "Development"). Groups show in the order each first appears.
|
|
373
|
+
*/
|
|
374
|
+
group?: string;
|
|
375
|
+
/** A second line under the name ("Live customers", "From branch feat/quotes"). */
|
|
376
|
+
description?: string;
|
|
356
377
|
};
|
|
357
378
|
type ContextLevel = {
|
|
358
379
|
/** `organization`, `project`, `environment`, or the app's own key (`site`, `space`). */
|
|
@@ -386,6 +407,47 @@ type PaletteAction = {
|
|
|
386
407
|
icon?: string;
|
|
387
408
|
/** Extra words the palette matches on. */
|
|
388
409
|
keywords?: string[];
|
|
410
|
+
/** A short second line ("Create a draft for a customer"). */
|
|
411
|
+
hint?: string;
|
|
412
|
+
/**
|
|
413
|
+
* A `shell.create` key: the action opens the create sheet on that form instead of `url`
|
|
414
|
+
* (when the app renders create forms). `url` stays the fallback.
|
|
415
|
+
*/
|
|
416
|
+
create?: string;
|
|
417
|
+
};
|
|
418
|
+
/** A record the app suggests in the palette before anything is typed ("Recent"). */
|
|
419
|
+
type PaletteRecord = {
|
|
420
|
+
id: string;
|
|
421
|
+
title: string;
|
|
422
|
+
subtitle?: string;
|
|
423
|
+
url: string;
|
|
424
|
+
};
|
|
425
|
+
/**
|
|
426
|
+
* One thing the person can create, for the "+" button and the create sheet. `area` is the key
|
|
427
|
+
* of the nav area it is listed under in "What do you want to create?".
|
|
428
|
+
*/
|
|
429
|
+
type ShellCreatable = {
|
|
430
|
+
key: string;
|
|
431
|
+
/** Singular, as a noun: "Invoice", "Credit note", "API token". */
|
|
432
|
+
label: string;
|
|
433
|
+
area: string;
|
|
434
|
+
keywords?: string[];
|
|
435
|
+
/** The bottom form's submit text. Default "Create {label}"; a stacked form says "Create and use in {parent}". */
|
|
436
|
+
submitLabel?: string;
|
|
437
|
+
};
|
|
438
|
+
/** What the app can create from the shell. The forms themselves come from `CboxShell`'s `renderCreate`. */
|
|
439
|
+
type ShellCreate = {
|
|
440
|
+
items: ShellCreatable[];
|
|
441
|
+
/** The creatable "+" opens on a page that declares none (`page.create`). Absent: the tree. */
|
|
442
|
+
default?: string;
|
|
443
|
+
};
|
|
444
|
+
/** An article the app hands Help directly, for an app without `articlesUrl`. */
|
|
445
|
+
type ShellHelpArticle = {
|
|
446
|
+
id: string;
|
|
447
|
+
title: string;
|
|
448
|
+
excerpt?: string;
|
|
449
|
+
body?: string;
|
|
450
|
+
url?: string;
|
|
389
451
|
};
|
|
390
452
|
type ShellHelp = {
|
|
391
453
|
/** False: Help still renders, and says it is not available here. */
|
|
@@ -404,6 +466,13 @@ type ShellHelp = {
|
|
|
404
466
|
searchUrl?: string;
|
|
405
467
|
/** Articles for a topic, as a template: `{topic}` is replaced. */
|
|
406
468
|
articlesUrl?: string;
|
|
469
|
+
/** Articles for this page, sent with the page. Used when there is no `articlesUrl`. */
|
|
470
|
+
articles?: ShellHelpArticle[];
|
|
471
|
+
/**
|
|
472
|
+
* Unread support replies, sent with the page, so the Help button shows its dot before
|
|
473
|
+
* `updatesUrl` has answered. The loaded updates win once they are in.
|
|
474
|
+
*/
|
|
475
|
+
unread?: number;
|
|
407
476
|
};
|
|
408
477
|
type ShellNotifications = {
|
|
409
478
|
enabled: false;
|
|
@@ -469,11 +538,23 @@ type Shell = {
|
|
|
469
538
|
page?: {
|
|
470
539
|
title: string;
|
|
471
540
|
route?: string;
|
|
541
|
+
/**
|
|
542
|
+
* The key of the creatable this page makes (`shell.create`): the phone's "+" opens its form
|
|
543
|
+
* directly, labelled "New {label}". Absent: "+" opens the app's default create target.
|
|
544
|
+
*/
|
|
545
|
+
create?: string;
|
|
546
|
+
/** What can be done on this page, shown first in the palette ("On {page}"). */
|
|
547
|
+
actions?: PaletteAction[];
|
|
472
548
|
};
|
|
473
549
|
nav: {
|
|
474
550
|
areas: NavArea[];
|
|
475
551
|
activeArea: string;
|
|
476
552
|
activePage?: string;
|
|
553
|
+
/**
|
|
554
|
+
* The phone's bottom tab bar: up to four area keys, in order, before More. Absent: the
|
|
555
|
+
* first four areas.
|
|
556
|
+
*/
|
|
557
|
+
tabs?: string[];
|
|
477
558
|
};
|
|
478
559
|
context: {
|
|
479
560
|
/** 1–3, in order. The first is the organization. */
|
|
@@ -492,7 +573,11 @@ type Shell = {
|
|
|
492
573
|
* "Search or ask…". The header's Search button keeps "Search or ask…" in every app (spec §4.3).
|
|
493
574
|
*/
|
|
494
575
|
placeholder?: string;
|
|
576
|
+
/** What the palette shows under "Recent" before anything is typed. Absent: the pages last visited here. */
|
|
577
|
+
recent?: PaletteRecord[];
|
|
495
578
|
};
|
|
579
|
+
/** Things the person can create from "+" and the palette. Absent: no "+". */
|
|
580
|
+
create?: ShellCreate;
|
|
496
581
|
help: ShellHelp;
|
|
497
582
|
notifications: ShellNotifications;
|
|
498
583
|
apps: {
|
|
@@ -521,13 +606,87 @@ type ShellNavigate = (url: string, options?: {
|
|
|
521
606
|
/** Where the shell reports a preference the person changed, for the host to persist. */
|
|
522
607
|
type ShellPreferenceChange = <K extends keyof ShellPreferences>(key: K, value: ShellPreferences[K]) => void;
|
|
523
608
|
|
|
609
|
+
/** What a create form hands back: the new thing, for the form below it (or the page). */
|
|
610
|
+
type ShellCreated = {
|
|
611
|
+
id: string;
|
|
612
|
+
label: string;
|
|
613
|
+
url?: string;
|
|
614
|
+
};
|
|
615
|
+
/**
|
|
616
|
+
* What `renderCreate` gets for one form in the create sheet. The shell owns the sheet, the
|
|
617
|
+
* stack and the words around the form; the app owns the fields and the request.
|
|
618
|
+
*/
|
|
619
|
+
type ShellCreateForm = {
|
|
620
|
+
creatable: ShellCreatable;
|
|
621
|
+
/** The form this one feeds, when it was stacked from a reference field. Null at the bottom. */
|
|
622
|
+
parent: ShellCreatable | null;
|
|
623
|
+
/** "Create invoice", or "Create and use in invoice" for a stacked form. */
|
|
624
|
+
submitLabel: string;
|
|
625
|
+
/**
|
|
626
|
+
* Stack the form for another creatable (a reference field's "+ New customer"). When it is
|
|
627
|
+
* created, `onCreated` gets it and this form shows again, with its state kept.
|
|
628
|
+
*/
|
|
629
|
+
createRef: (key: string, onCreated: (created: ShellCreated) => void) => void;
|
|
630
|
+
/**
|
|
631
|
+
* The thing was created. A stacked form goes back to the one below and hands it `created`;
|
|
632
|
+
* the bottom form closes the sheet.
|
|
633
|
+
*/
|
|
634
|
+
done: (created?: ShellCreated) => void;
|
|
635
|
+
/** Close the whole sheet without creating anything. */
|
|
636
|
+
close: () => void;
|
|
637
|
+
/** The current environment, when the app has one. */
|
|
638
|
+
environment: ContextItem | null;
|
|
639
|
+
};
|
|
640
|
+
/** The app's create forms: one per creatable key. Return null for a key it has no form for. */
|
|
641
|
+
type ShellRenderCreate = (form: ShellCreateForm) => ReactNode;
|
|
642
|
+
/** A labelled field in a create form. */
|
|
643
|
+
declare function CreateField({ label, children, htmlFor }: {
|
|
644
|
+
label: string;
|
|
645
|
+
children: ReactNode;
|
|
646
|
+
htmlFor?: string;
|
|
647
|
+
}): react_jsx_runtime.JSX.Element;
|
|
648
|
+
/**
|
|
649
|
+
* A reference field (Customer on an invoice): the chosen value or a placeholder, a chooser, and
|
|
650
|
+
* "+ New {thing}", which stacks that thing's form and fills the field when it is created.
|
|
651
|
+
*/
|
|
652
|
+
declare function CreateRefField({ label, value, placeholder, thing, onChoose, onCreate }: {
|
|
653
|
+
label: string;
|
|
654
|
+
value?: string | null;
|
|
655
|
+
placeholder: string;
|
|
656
|
+
thing: string;
|
|
657
|
+
onChoose?: () => void;
|
|
658
|
+
onCreate: () => void;
|
|
659
|
+
}): react_jsx_runtime.JSX.Element;
|
|
660
|
+
/** The form's submit button, with the shell's label ("Create and use in invoice"). */
|
|
661
|
+
declare function CreateSubmit({ form, busy, disabled }: {
|
|
662
|
+
form: Pick<ShellCreateForm, 'submitLabel'>;
|
|
663
|
+
busy?: boolean;
|
|
664
|
+
disabled?: boolean;
|
|
665
|
+
}): react_jsx_runtime.JSX.Element;
|
|
666
|
+
/** A plain `<form>` laid out for the create sheet: the fields, then the submit at the bottom. */
|
|
667
|
+
declare function CreateForm({ onSubmit, children }: {
|
|
668
|
+
onSubmit: (event: FormEvent<HTMLFormElement>) => void;
|
|
669
|
+
children: ReactNode;
|
|
670
|
+
}): react_jsx_runtime.JSX.Element;
|
|
671
|
+
|
|
524
672
|
/** A client-side link (Inertia's `Link`). Receives `href`, `className`, `children` and ARIA props. */
|
|
525
673
|
type ShellLinkComponent = ComponentType<AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
526
674
|
href: string;
|
|
527
675
|
children?: ReactNode;
|
|
528
676
|
}>;
|
|
529
677
|
/** Which overlay is open. Only one at a time, so two menus never stack. */
|
|
530
|
-
type ShellOverlay = 'org' | 'context' | 'apps' | 'account' | 'palette' | '
|
|
678
|
+
type ShellOverlay = 'org' | 'context' | 'apps' | 'account' | 'palette' | 'more' | 'context-sheet' | 'apps-sheet' | 'create' | null;
|
|
679
|
+
/**
|
|
680
|
+
* Where the phone's context sheet opens: its root, a level's list (by key), or every environment.
|
|
681
|
+
* `direct`: opened at that step from More or the palette, so Back closes the sheet.
|
|
682
|
+
*/
|
|
683
|
+
type ContextStep = {
|
|
684
|
+
step: 'root' | 'environments' | (string & {});
|
|
685
|
+
direct: boolean;
|
|
686
|
+
underMore?: boolean;
|
|
687
|
+
};
|
|
688
|
+
/** The app's own records search, for the palette's Records group. */
|
|
689
|
+
type ShellRecordSearch = (query: string, signal: AbortSignal) => Promise<PaletteRecord[]>;
|
|
531
690
|
type ShellApi = {
|
|
532
691
|
shell: Shell;
|
|
533
692
|
t: CboxTranslator;
|
|
@@ -547,7 +706,24 @@ type ShellApi = {
|
|
|
547
706
|
ask: (question: string) => void;
|
|
548
707
|
/** Switch context: `chosen` maps level keys to ids. */
|
|
549
708
|
switchTo: (chosen: Record<string, string>) => void;
|
|
709
|
+
/** The phone layout is on (below 768px). */
|
|
710
|
+
mobile: boolean;
|
|
711
|
+
/** Open the context switcher: the phone's sheet at a step, or the desktop's menu. */
|
|
712
|
+
openContext: (step?: ContextStep['step'], direct?: boolean) => void;
|
|
713
|
+
contextStep: ContextStep;
|
|
714
|
+
/** Open the create sheet on a creatable, or on the page's own create target. */
|
|
715
|
+
openCreate: (key?: string) => void;
|
|
716
|
+
/** The creatable the create sheet opened on, or null for the tree. */
|
|
717
|
+
createKey: string | null;
|
|
718
|
+
/** True when "+" has something to open: a create target and the app's forms. */
|
|
719
|
+
canCreate: boolean;
|
|
720
|
+
renderCreate?: ShellRenderCreate;
|
|
721
|
+
searchRecords?: ShellRecordSearch;
|
|
550
722
|
};
|
|
723
|
+
/** The create sheet, for a page's own "New …" button, or `null` outside the shell. */
|
|
724
|
+
declare function useShellCreate(): {
|
|
725
|
+
openCreate: (key?: string) => void;
|
|
726
|
+
} | null;
|
|
551
727
|
/** Help for a page's own `?` button, or `null` outside the shell. */
|
|
552
728
|
declare function useShellHelp(): Pick<ShellApi, 'toggleHelp' | 'openArticle' | 'ask'> | null;
|
|
553
729
|
|
|
@@ -574,6 +750,16 @@ type CboxShellProps = {
|
|
|
574
750
|
brandAssetBase?: string;
|
|
575
751
|
/** `id` of the `<main>` landmark, which the shell's "Skip to content" link targets. Default `main-content`. */
|
|
576
752
|
mainId?: string;
|
|
753
|
+
/**
|
|
754
|
+
* The app's create forms, one per `shell.create` key (V7). The shell renders the sheet, the
|
|
755
|
+
* stack and the words; the app renders the fields. Without it there is no "+".
|
|
756
|
+
*/
|
|
757
|
+
renderCreate?: ShellRenderCreate;
|
|
758
|
+
/**
|
|
759
|
+
* The app's own records search for the palette's Records group, instead of
|
|
760
|
+
* `palette.searchUrl`'s records. Called with the query and an abort signal.
|
|
761
|
+
*/
|
|
762
|
+
searchRecords?: ShellRecordSearch;
|
|
577
763
|
};
|
|
578
764
|
/**
|
|
579
765
|
* Apply a theme choice to the document the way the tokens read it: `.dark` and `data-theme` on
|
|
@@ -594,7 +780,7 @@ declare function themeBootScript(theme: ShellTheme): string;
|
|
|
594
780
|
* Render it in the host's persistent layout (Inertia `Page.layout`), so the rail, Help and the
|
|
595
781
|
* chat survive page visits; only `shell` and `children` change.
|
|
596
782
|
*/
|
|
597
|
-
declare function CboxShell({ shell, children, navigate, LinkComponent, icons, onPreferenceChange, helpStore, brandAssetBase, mainId }: CboxShellProps): react_jsx_runtime.JSX.Element;
|
|
783
|
+
declare function CboxShell({ shell, children, navigate, LinkComponent, icons, onPreferenceChange, helpStore, brandAssetBase, mainId, renderCreate, searchRecords }: CboxShellProps): react_jsx_runtime.JSX.Element;
|
|
598
784
|
|
|
599
785
|
/** The page intent the chat is given (§7.2.4): route, title and context. */
|
|
600
786
|
type PageIntent = {
|
|
@@ -672,12 +858,40 @@ declare function settingsHref(level: Pick<ContextLevel, 'settingsUrl'>, id: stri
|
|
|
672
858
|
* name when the project has it, else its first. Undefined when the project has none.
|
|
673
859
|
*/
|
|
674
860
|
declare function environmentFor(environments: readonly ContextItem[], currentName: string | undefined): ContextItem | undefined;
|
|
861
|
+
/** The body `CboxShell` posts to `context.switchUrl`: laravel-console-kit's `select` and `from`. */
|
|
862
|
+
type SwitchBody = {
|
|
863
|
+
select: Record<string, string>;
|
|
864
|
+
from: string;
|
|
865
|
+
};
|
|
866
|
+
/**
|
|
867
|
+
* The switch body (§5.6): every level above the chosen one keeps its current id, the chosen
|
|
868
|
+
* levels get theirs, and levels below are left to the server (it keeps the item with the same
|
|
869
|
+
* name, else the first). `from` is where the person is, so the server can stay on the same page.
|
|
870
|
+
* This is the shape `POST /shell/switch` reads in laravel-console-kit, and the same one its
|
|
871
|
+
* palette links use as a query (`?select[project]=…&from=…`).
|
|
872
|
+
*/
|
|
873
|
+
declare function switchBody(levels: readonly ContextLevel[], chosen: Record<string, string>, from: string): SwitchBody;
|
|
675
874
|
/**
|
|
676
|
-
* The
|
|
677
|
-
*
|
|
678
|
-
*
|
|
875
|
+
* @deprecated The flat body 0.10.3 and older posted, `{ <level key>: id, …, return_to }`, which
|
|
876
|
+
* laravel-console-kit 0.2.4 and older answered with a 404. `CboxShell` posts `switchBody()` now.
|
|
877
|
+
* Kept for one minor; removed in 0.11.
|
|
679
878
|
*/
|
|
680
879
|
declare function switchPayload(levels: readonly ContextLevel[], chosen: Record<string, string>, returnTo: string): Record<string, string>;
|
|
880
|
+
/**
|
|
881
|
+
* Whether an environment is live, as the app declared it: `live`, else `testData` (true is not
|
|
882
|
+
* live), else `tone` (`production` is live). Undefined when the app said nothing: no banner.
|
|
883
|
+
*/
|
|
884
|
+
declare function isLive(item: Pick<ContextItem, 'live' | 'testData' | 'tone'>): boolean | undefined;
|
|
885
|
+
/**
|
|
886
|
+
* The environment quick picks (V6): the current one, the first live one and the first one
|
|
887
|
+
* that is not live, at most three, in that order, never twice.
|
|
888
|
+
*/
|
|
889
|
+
declare function quickEnvironments(items: readonly ContextItem[], current: ContextItem): ContextItem[];
|
|
890
|
+
/** Items under their `group` heading, in the order each group first appears. */
|
|
891
|
+
declare function groupItems(items: readonly ContextItem[]): Array<{
|
|
892
|
+
group: string | undefined;
|
|
893
|
+
items: ContextItem[];
|
|
894
|
+
}>;
|
|
681
895
|
|
|
682
896
|
type Props$2 = ComponentProps<'main'> & {
|
|
683
897
|
children: ReactNode;
|
|
@@ -943,7 +1157,9 @@ type SectionHeaderProps = {
|
|
|
943
1157
|
};
|
|
944
1158
|
/**
|
|
945
1159
|
* Section header that sits inside a DataPanel. Title in semibold sans,
|
|
946
|
-
* optional muted lead, right-aligned actions slot.
|
|
1160
|
+
* optional muted lead, right-aligned actions slot. The actions stay beside
|
|
1161
|
+
* the title while there is room (also on a phone) and wrap under it, left
|
|
1162
|
+
* aligned, when there is not; several actions wrap among themselves.
|
|
947
1163
|
*/
|
|
948
1164
|
declare function SectionHeader({ title, description, actions, className, }: SectionHeaderProps): react_jsx_runtime.JSX.Element;
|
|
949
1165
|
/**
|
|
@@ -1472,4 +1688,4 @@ declare function Sparkline({ values, color, width, height }: {
|
|
|
1472
1688
|
height?: number;
|
|
1473
1689
|
}): react_jsx_runtime.JSX.Element | null;
|
|
1474
1690
|
|
|
1475
|
-
export { APP_HUES, AppContent, type AppKey, AppShell, CHART_PALETTE, CboxAppCatalog, type CboxAppCatalogProps, CboxAppIcon, type CboxAppIconProps, type CboxAppKey, type CboxAppLink, CboxBrand, type CboxBrandProps, type CboxIdContextValue, CboxIdProvider, CboxKnownApp, CboxLocalizationProvider, type CboxNotificationPreviewItem, type CboxNotificationsState, type CboxOrganization, CboxServiceMark, type CboxServiceMarkProps, CboxShell, type CboxShellProps, CboxSurfaces, type CboxSurfacesProps, type CboxTranslationValues, type CboxTranslator, type CboxUser, Combobox, type ComboboxAvatar, type ComboboxGroup, type ComboboxOption, type ComboboxProps, type ContextItem, type ContextLevel, type ContextTone, DataPanel, EmptyState, Heading, type HelpArticle, type HelpState, type HelpStore, type InboxState, type InferUrlState, KeyValue, KeyValueList, type ListPage, type NavArea, type NavPage, PageHeader, type PageIntent, PageShell, type PageTabSpec, PageTabs, type PageTabsProps, type PageWidth, type PaletteAction, PanelBody, type RealtimeState, type RealtimeStatus, RowLink, type RowLinkProps, SHELL_ICONS, SectionHeader, type Shell, type ShellAccount, type Link as ShellActionLink, type ShellApp, type ShellBanner, type ShellCatalogState, type ShellHelp, type ShellIcon, type ShellLinkComponent, type ShellNavigate, type ShellNotifications, type ShellOption, type ShellPreferenceChange, type ShellPreferences, type ShellTheme, Sparkline, StatTile, StatusPill, type SupportUpdate, type SurfaceArgs, type SurfaceConfig, type SurfaceController, type SurfaceId, type Transport, type UrlField, type UrlSchema, applyTheme, buildUrlSearch, cn, contextTrail, createHelpStore, defineUrlSchema, environmentFor, hueFor, initialsOf, interpolate, pageIntent, parseListPage, parseShellCatalog, parseUrlSearch, settingsHref, switchPayload, themeBootScript, urlBoolean, urlEnum, urlNumber, urlString, urlStringArray, useCboxId, useCboxIdOptional, useCboxLocalization, useCboxSurfaces, useCboxSurfacesOptional, useKnownAppCatalog, useShellHelp, withQuery };
|
|
1691
|
+
export { APP_HUES, AppContent, type AppKey, AppShell, CHART_PALETTE, CboxAppCatalog, type CboxAppCatalogProps, CboxAppIcon, type CboxAppIconProps, type CboxAppKey, type CboxAppLink, CboxBrand, type CboxBrandProps, type CboxIdContextValue, CboxIdProvider, CboxKnownApp, CboxLocalizationProvider, type CboxNotificationPreviewItem, type CboxNotificationsState, type CboxOrganization, CboxServiceMark, type CboxServiceMarkProps, CboxShell, type CboxShellProps, CboxSurfaces, type CboxSurfacesProps, type CboxTranslationValues, type CboxTranslator, type CboxUser, Combobox, type ComboboxAvatar, type ComboboxGroup, type ComboboxOption, type ComboboxProps, type ContextItem, type ContextLevel, type ContextTone, CreateField, CreateForm, CreateRefField, CreateSubmit, DataPanel, EmptyState, Heading, type HelpArticle, type HelpState, type HelpStore, type InboxState, type InferUrlState, KeyValue, KeyValueList, type ListPage, type NavArea, type NavPage, PageHeader, type PageIntent, PageShell, type PageTabSpec, PageTabs, type PageTabsProps, type PageWidth, type PaletteAction, type PaletteRecord, PanelBody, type RealtimeState, type RealtimeStatus, RowLink, type RowLinkProps, SHELL_ICONS, SectionHeader, type Shell, type ShellAccount, type Link as ShellActionLink, type ShellApp, type ShellBanner, type ShellCatalogState, type ShellCreatable, type ShellCreate, type ShellCreateForm, type ShellCreated, type ShellHelp, type ShellHelpArticle, type ShellIcon, type ShellLinkComponent, type ShellNavigate, type ShellNotifications, type ShellOption, type ShellPreferenceChange, type ShellPreferences, type ShellRecordSearch, type ShellRenderCreate, type ShellTheme, Sparkline, StatTile, StatusPill, type SupportUpdate, type SurfaceArgs, type SurfaceConfig, type SurfaceController, type SurfaceId, type SwitchBody, type Transport, type UrlField, type UrlSchema, applyTheme, buildUrlSearch, cn, contextTrail, createHelpStore, defineUrlSchema, environmentFor, groupItems, hueFor, initialsOf, interpolate, isLive, pageIntent, parseListPage, parseShellCatalog, parseUrlSearch, quickEnvironments, settingsHref, switchBody, switchPayload, themeBootScript, urlBoolean, urlEnum, urlNumber, urlString, urlStringArray, useCboxId, useCboxIdOptional, useCboxLocalization, useCboxSurfaces, useCboxSurfacesOptional, useKnownAppCatalog, useShellCreate, useShellHelp, withQuery };
|