@cboxdk/cbox-ui 0.6.0 → 0.7.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 +93 -2
- package/dist/charts.d.ts +82 -0
- package/dist/charts.js +189 -0
- package/dist/charts.js.map +1 -0
- package/dist/chunk-OFTNLF7H.js +55 -0
- package/dist/chunk-OFTNLF7H.js.map +1 -0
- package/dist/engine-4DRZ3POZ.js +10 -0
- package/dist/engine-4DRZ3POZ.js.map +1 -0
- package/dist/index.d.ts +148 -4
- package/dist/index.js +475 -130
- package/dist/index.js.map +1 -1
- package/dist/scale-BaaY5qJs.d.ts +24 -0
- package/package.json +10 -1
- package/tokens/cbox.css +92 -88
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import { ReactNode, ComponentProps, ComponentType } from 'react';
|
|
3
3
|
import { LucideIcon } from 'lucide-react';
|
|
4
4
|
import { ClassValue } from 'clsx';
|
|
5
|
+
export { T as TimePoint, n as niceTicks, t as timeTicks } from './scale-BaaY5qJs.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Identity contract every Cbox-family app must populate.
|
|
@@ -22,7 +23,8 @@ import { ClassValue } from 'clsx';
|
|
|
22
23
|
*/
|
|
23
24
|
type CboxAppKey = string;
|
|
24
25
|
type CboxUser = {
|
|
25
|
-
id:
|
|
26
|
+
/** Cbox ID's user id: numeric in id itself, a prefixed string (`usr_…`) in the apps that mirror it. */
|
|
27
|
+
id: number | string;
|
|
26
28
|
name: string;
|
|
27
29
|
email: string;
|
|
28
30
|
avatar_url?: string | null;
|
|
@@ -32,7 +34,8 @@ type CboxUser = {
|
|
|
32
34
|
timezone?: string | null;
|
|
33
35
|
};
|
|
34
36
|
type CboxOrganization = {
|
|
35
|
-
id:
|
|
37
|
+
/** Cbox ID's organization id: numeric in id itself, a prefixed string (`org_…`) in the apps that mirror it. */
|
|
38
|
+
id: number | string;
|
|
36
39
|
slug: string;
|
|
37
40
|
name: string;
|
|
38
41
|
/**
|
|
@@ -255,6 +258,8 @@ type LinkComponent = ComponentType<{
|
|
|
255
258
|
className?: string;
|
|
256
259
|
title?: string;
|
|
257
260
|
'aria-label'?: string;
|
|
261
|
+
/** Set on the link of the page the person is on. */
|
|
262
|
+
'aria-current'?: 'page';
|
|
258
263
|
}>;
|
|
259
264
|
type CboxAppSidebarProps = {
|
|
260
265
|
/** App key for the brand submark (and aria labels). */
|
|
@@ -494,6 +499,67 @@ type AppLauncherProps = {
|
|
|
494
499
|
*/
|
|
495
500
|
declare function AppLauncher({ className, onLockedAppClick }: AppLauncherProps): react_jsx_runtime.JSX.Element | null;
|
|
496
501
|
|
|
502
|
+
/** One app as the host's catalog endpoint lists it. */
|
|
503
|
+
type CboxCatalogApp = {
|
|
504
|
+
key: string;
|
|
505
|
+
name: string;
|
|
506
|
+
launch_url: string;
|
|
507
|
+
icon_url?: string | null;
|
|
508
|
+
description?: string | null;
|
|
509
|
+
};
|
|
510
|
+
type CboxAppCatalogState = {
|
|
511
|
+
status: 'idle' | 'loading';
|
|
512
|
+
} | {
|
|
513
|
+
status: 'ready';
|
|
514
|
+
apps: CboxCatalogApp[];
|
|
515
|
+
refreshAfter: number;
|
|
516
|
+
} | {
|
|
517
|
+
status: 'authorization_required';
|
|
518
|
+
authorizeUrl: string | null;
|
|
519
|
+
} | {
|
|
520
|
+
status: 'unavailable';
|
|
521
|
+
};
|
|
522
|
+
type CboxAppCatalogProps = {
|
|
523
|
+
/**
|
|
524
|
+
* Same-origin URL the host serves the person's app catalog from (a proxy of Cbox ID's
|
|
525
|
+
* catalog, authorized for the signed-in person). `null` renders the control disabled, so the
|
|
526
|
+
* chrome keeps its shape on pages without an organization.
|
|
527
|
+
*/
|
|
528
|
+
endpoint: string | null;
|
|
529
|
+
/** The app key of this app; its tile is marked current and does not navigate. */
|
|
530
|
+
currentAppKey: string;
|
|
531
|
+
/**
|
|
532
|
+
* Marks per app key, rendered instead of the catalog's `icon_url` (a host that bundles the
|
|
533
|
+
* family's service marks). An app without one shows its `icon_url`, then its initials.
|
|
534
|
+
*/
|
|
535
|
+
icons?: Record<string, ReactNode>;
|
|
536
|
+
className?: string;
|
|
537
|
+
};
|
|
538
|
+
/**
|
|
539
|
+
* Interpret the catalog endpoint's answer. The contract every Cbox app serves:
|
|
540
|
+
*
|
|
541
|
+
* - `200 { apps: [{ key, name, launch_url, icon_url?, description? }], refresh_after?: seconds }`
|
|
542
|
+
* - `401`/`403 { authorize_url?: string }` or `{ state: 'authorization_required' }`: the
|
|
543
|
+
* person has to (re)connect their catalog grant; `authorize_url` is where.
|
|
544
|
+
* - anything else: unavailable right now.
|
|
545
|
+
*
|
|
546
|
+
* Only `http(s)` launch URLs are kept: the tiles are links the person will click.
|
|
547
|
+
*/
|
|
548
|
+
declare function parseAppCatalog(ok: boolean, body: unknown): CboxAppCatalogState;
|
|
549
|
+
/** The authorize link with `return_to` set to where the person is, when it is on this origin. */
|
|
550
|
+
declare function authorizeHref(authorizeUrl: string | null, location: {
|
|
551
|
+
origin: string;
|
|
552
|
+
pathname: string;
|
|
553
|
+
search: string;
|
|
554
|
+
}): string | null;
|
|
555
|
+
/**
|
|
556
|
+
* The Switch-app control: a grid of the Cbox apps this person can open, read live from the
|
|
557
|
+
* host's catalog endpoint. The host owns the endpoint and the grant; this renders the answer,
|
|
558
|
+
* refreshes it when it expires while the panel is open, and offers the way back to Cbox ID
|
|
559
|
+
* when the grant is missing.
|
|
560
|
+
*/
|
|
561
|
+
declare function CboxAppCatalog({ endpoint, currentAppKey, icons, className }: CboxAppCatalogProps): react_jsx_runtime.JSX.Element;
|
|
562
|
+
|
|
497
563
|
type AppSwitcherProps = {
|
|
498
564
|
className?: string;
|
|
499
565
|
/**
|
|
@@ -595,7 +661,14 @@ type Props$3 = {
|
|
|
595
661
|
* is consistency across apps.
|
|
596
662
|
*/
|
|
597
663
|
extras?: ReactNode;
|
|
664
|
+
placement?: 'bottom-end' | 'top-start';
|
|
598
665
|
className?: string;
|
|
666
|
+
/**
|
|
667
|
+
* The router's link for the account and organization rows, when they are pages of this
|
|
668
|
+
* app (an Inertia `Link` keeps the visit client-side). Default: a plain anchor, which is
|
|
669
|
+
* right when the rows deep-link into Cbox ID on another origin.
|
|
670
|
+
*/
|
|
671
|
+
LinkComponent?: LinkComponent;
|
|
599
672
|
};
|
|
600
673
|
/**
|
|
601
674
|
* User-menu dropdown. Always exposes:
|
|
@@ -605,7 +678,7 @@ type Props$3 = {
|
|
|
605
678
|
*
|
|
606
679
|
* The arrows signal cross-app navigation — id is canonical.
|
|
607
680
|
*/
|
|
608
|
-
declare function UserMenu({ extras, className }: Props$3): react_jsx_runtime.JSX.Element;
|
|
681
|
+
declare function UserMenu({ extras, className, placement, LinkComponent: Link }: Props$3): react_jsx_runtime.JSX.Element;
|
|
609
682
|
|
|
610
683
|
/**
|
|
611
684
|
* Combobox — the canonical select replacement for the Cbox suite.
|
|
@@ -1380,4 +1453,75 @@ declare function parseUrlSearch<S extends UrlSchema>(search: string, schema: S):
|
|
|
1380
1453
|
*/
|
|
1381
1454
|
declare function buildUrlSearch<S extends UrlSchema>(state: InferUrlState<S>, schema: S): string;
|
|
1382
1455
|
|
|
1383
|
-
|
|
1456
|
+
type CboxTranslationValues = Record<string, string | number>;
|
|
1457
|
+
type CboxTranslator = (message: string, values?: CboxTranslationValues) => string;
|
|
1458
|
+
declare function interpolate(message: string, values?: CboxTranslationValues): string;
|
|
1459
|
+
/** Optional and additive: without a provider existing consumers retain English. */
|
|
1460
|
+
declare function CboxLocalizationProvider({ locale, translate, formatDate, children }: {
|
|
1461
|
+
locale: string;
|
|
1462
|
+
translate: CboxTranslator;
|
|
1463
|
+
formatDate?: (value: string) => string;
|
|
1464
|
+
children: ReactNode;
|
|
1465
|
+
}): react_jsx_runtime.JSX.Element;
|
|
1466
|
+
declare function useCboxLocalization(): {
|
|
1467
|
+
locale: string;
|
|
1468
|
+
t: CboxTranslator;
|
|
1469
|
+
formatDate: (value: string) => string;
|
|
1470
|
+
};
|
|
1471
|
+
|
|
1472
|
+
type CboxNavArea = CboxNavItem & {
|
|
1473
|
+
items?: CboxNavItem[];
|
|
1474
|
+
};
|
|
1475
|
+
type CboxWorkspaceShellProps = {
|
|
1476
|
+
appKey: string;
|
|
1477
|
+
brandSubmark: string;
|
|
1478
|
+
areas: CboxNavArea[];
|
|
1479
|
+
currentPath: string;
|
|
1480
|
+
LinkComponent: LinkComponent;
|
|
1481
|
+
context: ReactNode;
|
|
1482
|
+
tools: ReactNode;
|
|
1483
|
+
account: ReactNode;
|
|
1484
|
+
children: ReactNode;
|
|
1485
|
+
/** Where the brand row links. Default `/`. */
|
|
1486
|
+
brandHref?: string;
|
|
1487
|
+
/** `id` of the `<main>` landmark, so a host's skip link can target it. Default `main-content`. */
|
|
1488
|
+
mainId?: string;
|
|
1489
|
+
/**
|
|
1490
|
+
* Rail pinned open. Pass `pinned` + `onPinnedChange` to control it (the host persists the
|
|
1491
|
+
* preference, in a cookie or Cbox ID), or `defaultPinned` to seed the shell's own state.
|
|
1492
|
+
*/
|
|
1493
|
+
pinned?: boolean;
|
|
1494
|
+
defaultPinned?: boolean;
|
|
1495
|
+
onPinnedChange?: (pinned: boolean) => void;
|
|
1496
|
+
/** Contextual subnav collapsed to its strip. Controlled and uncontrolled as `pinned`. */
|
|
1497
|
+
collapsed?: boolean;
|
|
1498
|
+
defaultCollapsed?: boolean;
|
|
1499
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
1500
|
+
};
|
|
1501
|
+
/**
|
|
1502
|
+
* How well `href` matches `path`: the href's length when the path is the href or beneath it,
|
|
1503
|
+
* -1 otherwise. `/` matches only itself, so a home item never claims every page.
|
|
1504
|
+
*/
|
|
1505
|
+
declare function navMatchLength(path: string, href: string): number;
|
|
1506
|
+
/** The item whose href is the most specific match for `path`, or undefined. */
|
|
1507
|
+
declare function activeNavItem<T extends CboxNavItem>(path: string, items: readonly T[]): T | undefined;
|
|
1508
|
+
/**
|
|
1509
|
+
* The area `path` is in: the one holding the most specific match among its own href and its
|
|
1510
|
+
* items' hrefs. A first-match would put every page beneath an area at `/` (an overview, a
|
|
1511
|
+
* dashboard) under that area and never show another area's subnav.
|
|
1512
|
+
*/
|
|
1513
|
+
declare function activeNavArea<T extends CboxNavArea>(path: string, areas: readonly T[]): T | undefined;
|
|
1514
|
+
/** Two-tier workspace navigation. Route ownership and preference persistence stay with the host. */
|
|
1515
|
+
declare function CboxWorkspaceShell({ appKey, brandSubmark, areas, currentPath, LinkComponent: Link, context, tools, account, children, brandHref, mainId, pinned: pinnedProp, defaultPinned, onPinnedChange, collapsed: collapsedProp, defaultCollapsed, onCollapsedChange }: CboxWorkspaceShellProps): react_jsx_runtime.JSX.Element;
|
|
1516
|
+
|
|
1517
|
+
/** The chart tokens in order, for series that set their own colour. */
|
|
1518
|
+
declare const CHART_PALETTE: string[];
|
|
1519
|
+
/** A row's shape over the window, small: a line with a faint area, zero at the bottom. Decorative. */
|
|
1520
|
+
declare function Sparkline({ values, color, width, height }: {
|
|
1521
|
+
values: number[];
|
|
1522
|
+
color?: string;
|
|
1523
|
+
width?: number;
|
|
1524
|
+
height?: number;
|
|
1525
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
1526
|
+
|
|
1527
|
+
export { AppContent, AppLauncher, AppShell, AppSwitcher, CHART_PALETTE, CboxAppCatalog, type CboxAppCatalogProps, type CboxAppCatalogState, type CboxAppKey, type CboxAppLink, CboxAppShell, type CboxAppShellProps, CboxAppSidebar, type CboxAppSidebarProps, CboxBrand, type CboxBrandProps, type CboxCatalogApp, type CboxIdContextValue, CboxIdProvider, CboxLocalizationProvider, CboxMobileNavDrawer, type CboxMobileNavDrawerProps, type CboxNavArea, type CboxNavItem, type CboxNavSection, type CboxNotificationPreviewItem, type CboxNotificationsState, CboxOrgContextBar, type CboxOrgContextBarProps, type CboxOrganization, CboxSurfaces, type CboxSurfacesProps, type CboxTranslationValues, type CboxTranslator, type CboxUser, CboxWorkspaceShell, type CboxWorkspaceShellProps, Combobox, type ComboboxAvatar, type ComboboxGroup, type ComboboxOption, type ComboboxProps, type ContextAvatar, ContextAvatarChip, ContextBar, type ContextCrumb, type ContextItem, DataPanel, EmptyState, Heading, type InboxState, type InferUrlState, KeyValue, KeyValueList, type LinkComponent, NotificationsBell, OrgSwitcher, PageHeader, PageShell, type PageTabSpec, PageTabs, type PageTabsProps, type PageWidth, PanelBody, type RealtimeState, type RealtimeStatus, RowLink, type RowLinkProps, SearchTrigger, SectionHeader, Sparkline, StatTile, StatusPill, type SurfaceArgs, type SurfaceConfig, type SurfaceController, type SurfaceId, TopBar, type Transport, type UrlField, type UrlSchema, UserMenu, activeNavArea, activeNavItem, authorizeHref, buildUrlSearch, cn, defineUrlSchema, interpolate, navMatchLength, parseAppCatalog, parseUrlSearch, urlBoolean, urlEnum, urlNumber, urlString, urlStringArray, useCboxId, useCboxIdOptional, useCboxLocalization, useCboxSurfaces, useCboxSurfacesOptional };
|