@opencxh/ui-kit 3.137.9 → 3.137.10
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/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2114 -2023
- package/dist/index.js.map +1 -1
- package/dist/src/content/SettingsPage.d.ts +7 -0
- package/dist/src/content/tableColumns.d.ts +67 -0
- package/dist/src/feedback/Badge.d.ts +7 -1
- package/dist/src/feedback/ContentLoading.d.ts +18 -10
- package/dist/src/index.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { ContentLoadingShape } from '../feedback/ContentLoading';
|
|
2
3
|
import { PageHeaderAction } from './PageHeader';
|
|
3
4
|
/**
|
|
4
5
|
* What a panel adds to the frame it is rendered in: the record it drilled into,
|
|
@@ -57,6 +58,12 @@ export interface SettingsPageProps {
|
|
|
57
58
|
title?: string;
|
|
58
59
|
/** Swaps the body for a skeleton while keeping the footer in place. */
|
|
59
60
|
loading?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* What the body is about to render. A settings panel is nearly always a form
|
|
63
|
+
* or a table, and saying which keeps the placeholder from announcing a
|
|
64
|
+
* heading and two paragraphs that never arrive.
|
|
65
|
+
*/
|
|
66
|
+
loadingShape?: ContentLoadingShape;
|
|
60
67
|
padding?: keyof typeof paddingClasses;
|
|
61
68
|
className?: string;
|
|
62
69
|
contentClassName?: string;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { BadgeProps } from '../feedback/Badge';
|
|
2
|
+
import { TableColumn } from './Table';
|
|
3
|
+
/**
|
|
4
|
+
* Column builders for the three things table configs kept getting wrong, each
|
|
5
|
+
* in the same way across apps: a state rendered as prose, a stored code shown
|
|
6
|
+
* raw, and an id shown instead of the name it points at.
|
|
7
|
+
*
|
|
8
|
+
* They all keep the *label* in `accessor` and render only the decoration in
|
|
9
|
+
* `cell`, because `Table` searches and sorts on the accessor value. Putting the
|
|
10
|
+
* readable text there means a search for "Active" or for a team's name matches
|
|
11
|
+
* what the row actually shows — which is exactly what a raw `enabled` boolean
|
|
12
|
+
* or a bare `teamId` used to break.
|
|
13
|
+
*/
|
|
14
|
+
export interface BadgeColumnConfig<T, V = unknown> {
|
|
15
|
+
id: string;
|
|
16
|
+
header: string;
|
|
17
|
+
accessor: (row: T) => V;
|
|
18
|
+
/** The text in the badge — and the text this column is searched on. */
|
|
19
|
+
label: (value: V, row: T) => string;
|
|
20
|
+
/** Defaults to `default`; give states their own tone (success/error/…). */
|
|
21
|
+
tone?: (value: V, row: T) => BadgeProps["variant"];
|
|
22
|
+
/** Return false to render nothing at all for this row. */
|
|
23
|
+
visible?: (value: V, row: T) => boolean;
|
|
24
|
+
width?: string | number;
|
|
25
|
+
sortable?: boolean;
|
|
26
|
+
align?: TableColumn<T>["align"];
|
|
27
|
+
}
|
|
28
|
+
/** A value that is a state rather than prose — render it as a pill. */
|
|
29
|
+
export declare function badgeColumn<T, V = unknown>(config: BadgeColumnConfig<T, V>): TableColumn<T>;
|
|
30
|
+
export interface BooleanBadgeColumnConfig<T> {
|
|
31
|
+
id: string;
|
|
32
|
+
header: string;
|
|
33
|
+
accessor: (row: T) => boolean | undefined;
|
|
34
|
+
onLabel: string;
|
|
35
|
+
offLabel: string;
|
|
36
|
+
/** Defaults to success/secondary — on reads as healthy, off as merely quiet. */
|
|
37
|
+
onTone?: BadgeProps["variant"];
|
|
38
|
+
offTone?: BadgeProps["variant"];
|
|
39
|
+
width?: string | number;
|
|
40
|
+
sortable?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/** The on/off case of `badgeColumn`, which is most of them. */
|
|
43
|
+
export declare function booleanBadgeColumn<T>(config: BooleanBadgeColumnConfig<T>): TableColumn<T>;
|
|
44
|
+
export interface LabelsColumnConfig<T> {
|
|
45
|
+
id: string;
|
|
46
|
+
header: string;
|
|
47
|
+
/** One code, a list of them, or nothing. */
|
|
48
|
+
accessor: (row: T) => string | string[] | undefined | null;
|
|
49
|
+
/**
|
|
50
|
+
* Code to readable text. Return `undefined` to fall back to the code itself,
|
|
51
|
+
* so an unknown value still shows something instead of vanishing.
|
|
52
|
+
*/
|
|
53
|
+
label: (code: string) => string | undefined;
|
|
54
|
+
/** Shown when there is nothing at all. Defaults to an em dash. */
|
|
55
|
+
empty?: string;
|
|
56
|
+
separator?: string;
|
|
57
|
+
width?: string | number;
|
|
58
|
+
searchable?: boolean;
|
|
59
|
+
sortable?: boolean;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Stored codes rendered as the words the user picked them by. Covers both
|
|
63
|
+
* localising an enum (`interactions:created` → "Interaction created") and
|
|
64
|
+
* resolving a foreign key (a `teamId` → that team's name — pass a lookup as
|
|
65
|
+
* `label`), because from the table's side those are the same problem.
|
|
66
|
+
*/
|
|
67
|
+
export declare function labelsColumn<T>(config: LabelsColumnConfig<T>): TableColumn<T>;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* `color` is deliberately omitted from the inherited HTML attributes. It is a
|
|
4
|
+
* legacy HTML attribute, so `<Badge color="success">` used to type-check while
|
|
5
|
+
* doing nothing at all — the badge silently rendered as `default`. Omitting it
|
|
6
|
+
* turns that mistake into a compile error pointing at `variant`.
|
|
7
|
+
*/
|
|
8
|
+
export interface BadgeProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'color'> {
|
|
3
9
|
/**
|
|
4
10
|
* The visual variant of the badge
|
|
5
11
|
*/
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* What is about to appear here. A placeholder only does its job if it has the
|
|
4
|
+
* geometry of the thing it stands in for: the default `text` shape under a form
|
|
5
|
+
* or a list announces a heading and two paragraphs, and the real content then
|
|
6
|
+
* shoves everything sideways when it lands.
|
|
7
|
+
*/
|
|
8
|
+
export type ContentLoadingShape = "text" | "table" | "list" | "form" | "menu" | "cards";
|
|
2
9
|
export interface ContentLoadingProps {
|
|
3
10
|
/**
|
|
4
11
|
* `page` (default) fills the route with its own `<main>` shell and padding.
|
|
@@ -6,21 +13,22 @@ export interface ContentLoadingProps {
|
|
|
6
13
|
* card or scroll container without nesting a second `<main>` landmark.
|
|
7
14
|
*/
|
|
8
15
|
variant?: "page" | "inline";
|
|
16
|
+
/** The shape of what is coming. Defaults to `text`. */
|
|
17
|
+
shape?: ContentLoadingShape;
|
|
18
|
+
/** Rows/items/fields/cards to draw, depending on `shape`. */
|
|
19
|
+
rows?: number;
|
|
20
|
+
/** Columns, for `table` and `cards`. */
|
|
21
|
+
columns?: number;
|
|
9
22
|
/**
|
|
10
23
|
* Optional custom skeleton content (overrides default)
|
|
11
24
|
*/
|
|
12
25
|
children?: ReactNode;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
*/
|
|
26
|
+
className?: string;
|
|
27
|
+
/** @deprecated Pass `shape="table"`. */
|
|
16
28
|
showTableSkeleton?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Number of table columns (default: 6)
|
|
19
|
-
*/
|
|
29
|
+
/** @deprecated Pass `columns`. */
|
|
20
30
|
tableColumns?: number;
|
|
21
|
-
/**
|
|
22
|
-
* Number of table rows (default: 8)
|
|
23
|
-
*/
|
|
31
|
+
/** @deprecated Pass `rows`. */
|
|
24
32
|
tableRows?: number;
|
|
25
33
|
}
|
|
26
|
-
export declare function ContentLoading({ variant, children, showTableSkeleton, tableColumns, tableRows, }: ContentLoadingProps): import("react").JSX.Element;
|
|
34
|
+
export declare function ContentLoading({ variant, shape, rows, columns, children, className, showTableSkeleton, tableColumns, tableRows, }: ContentLoadingProps): import("react").JSX.Element;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export { ConfirmDialog, type ConfirmDialogProps } from './overlays/ConfirmDialog
|
|
|
25
25
|
export { Modal, type ModalProps } from './overlays/Modal';
|
|
26
26
|
export { Popover, type PopoverProps } from './overlays/Popover';
|
|
27
27
|
export { Badge, type BadgeProps } from './feedback/Badge';
|
|
28
|
-
export { ContentLoading } from './feedback/ContentLoading';
|
|
28
|
+
export { ContentLoading, type ContentLoadingProps, type ContentLoadingShape } from './feedback/ContentLoading';
|
|
29
29
|
export { EmptyState, type EmptyStateProps } from './feedback/EmptyState';
|
|
30
30
|
export { Kbd, type KbdProps } from './feedback/Kbd';
|
|
31
31
|
export { ProgressBar, type ProgressBarProps } from './feedback/ProgressBar';
|
|
@@ -50,6 +50,7 @@ export { SettingsFrameProvider, SettingsPage, useSettingsFrame, useSettingsFrame
|
|
|
50
50
|
export { SettingsRow, SettingsSection, type SettingsRowProps, type SettingsSectionProps } from './content/SettingsRow';
|
|
51
51
|
export { SourceChip, type SourceChipProps } from './content/SourceChip';
|
|
52
52
|
export { Table, dateFilterHandler, selectFilterHandler, type TableAction, type TableColumn, type TableFilter, type TableProps } from './content/Table';
|
|
53
|
+
export { badgeColumn, booleanBadgeColumn, labelsColumn, type BadgeColumnConfig, type BooleanBadgeColumnConfig, type LabelsColumnConfig } from './content/tableColumns';
|
|
53
54
|
export { View, type ViewGroup, type ViewProps } from './content/View';
|
|
54
55
|
export { SidebarMenu, type MenuItem, type MenuItemAction } from './navigation/Sidebar';
|
|
55
56
|
export { TabBar, Tabs, type TabItem, type TabsProps } from './navigation/Tabs';
|