@opencxh/ui-kit 3.137.9 → 3.137.11
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 +2401 -2215
- package/dist/index.js.map +1 -1
- package/dist/src/content/Avatar.d.ts +6 -1
- package/dist/src/content/ChannelBadge.d.ts +6 -1
- package/dist/src/content/Icon.d.ts +9 -0
- 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/forms/Form.d.ts +5 -1
- package/dist/src/forms/autofill.d.ts +30 -0
- package/dist/src/index.d.ts +6 -2
- package/dist/src/utils/identity.d.ts +25 -0
- package/package.json +1 -1
|
@@ -3,13 +3,18 @@ import { default as React } from 'react';
|
|
|
3
3
|
* Plate colour. `default` is the neutral disc used everywhere a monogram is just
|
|
4
4
|
* an identity marker.
|
|
5
5
|
*
|
|
6
|
+
* `identity` derives the colour from `name`, so the same person or team is the
|
|
7
|
+
* same colour on every surface — see {@link identityPlateClass}. Use it in a
|
|
8
|
+
* list of many people; use `default` where there is only one plate on screen
|
|
9
|
+
* and colour would carry no information.
|
|
10
|
+
*
|
|
6
11
|
* The other three are for a message thread, where the plate answers "which side
|
|
7
12
|
* is this from" before you read a word: `in` is the other party, `out` is us
|
|
8
13
|
* (ink, so it reads as ours in both themes) and `note` is an internal remark.
|
|
9
14
|
* Each is a fill with its own foreground — a fill cannot borrow a colour from
|
|
10
15
|
* the ramp, because the ramp does not change between light and dark.
|
|
11
16
|
*/
|
|
12
|
-
export type AvatarTone = "default" | "in" | "out" | "note";
|
|
17
|
+
export type AvatarTone = "default" | "identity" | "in" | "out" | "note";
|
|
13
18
|
export interface AvatarProps {
|
|
14
19
|
/** Full name; used for the initials fallback and alt/title text */
|
|
15
20
|
name?: string;
|
|
@@ -2,7 +2,12 @@ import { default as React } from 'react';
|
|
|
2
2
|
/** Communication channel keys the redesign colour-codes. */
|
|
3
3
|
export type ChannelKey = "mail" | "wa" | "chat" | "tel" | "note";
|
|
4
4
|
export interface ChannelBadgeProps {
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Channel — drives the colour. A known key uses that channel's tokens; any
|
|
7
|
+
* other string (a provider that brought its own channel along) gets a stable
|
|
8
|
+
* colour derived from the string itself, so ten custom channels stay ten
|
|
9
|
+
* distinguishable colours instead of ten identical grey tiles.
|
|
10
|
+
*/
|
|
6
11
|
channel?: ChannelKey | string;
|
|
7
12
|
/** Glyph or short label inside the tile (e.g. an icon, or an initial). */
|
|
8
13
|
children?: React.ReactNode;
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Lucide icon by name, for icons that arrive as data rather than as an import —
|
|
4
|
+
* a provider declaring `icon: "MessageCircle"` in its description, a menu entry
|
|
5
|
+
* from a manifest. Accepts kebab-case, snake_case, spaced or PascalCase.
|
|
6
|
+
*
|
|
7
|
+
* Returns `undefined` for an unknown name so the caller can fall back; an app
|
|
8
|
+
* naming an icon that does not exist should not blank out the surface.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveLucideIcon(name: string | undefined): React.ComponentType<any> | undefined;
|
|
2
11
|
export interface IconProps {
|
|
3
12
|
/** Icon component from lucide-react or custom icon */
|
|
4
13
|
icon: React.ComponentType<any>;
|
|
@@ -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/forms/Form.d.ts
CHANGED
|
@@ -65,7 +65,11 @@ export interface FormGroupItem<T = any> {
|
|
|
65
65
|
* back while editing (a system prompt).
|
|
66
66
|
*/
|
|
67
67
|
rows?: number;
|
|
68
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* Autocomplete token. Only real HTML tokens (`email`, `tel`, `name`, …) are
|
|
70
|
+
* passed to the browser; anything else switches autofill *off* rather than
|
|
71
|
+
* silently meaning "on" — see {@link autofillProps}.
|
|
72
|
+
*/
|
|
69
73
|
autocomplete?: string;
|
|
70
74
|
/** Options for select/radio/checkbox types */
|
|
71
75
|
options?: Array<{
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keeping password managers out of fields that are not credentials.
|
|
3
|
+
*
|
|
4
|
+
* The problem was not that autofill was switched on — it was that most fields
|
|
5
|
+
* asked for it by accident. A form field passed things like `"sip-password"`,
|
|
6
|
+
* `"api-key"`, `"record-pin"` or `"system-prompt"` as its autocomplete value.
|
|
7
|
+
* None of those are autocomplete tokens, and the HTML spec says an unrecognised
|
|
8
|
+
* token behaves as `on`. So the fields most likely to be mistaken for a login
|
|
9
|
+
* were the ones most loudly inviting Bitwarden, LastPass and Dashlane to fill
|
|
10
|
+
* them in — and to offer to save them.
|
|
11
|
+
*
|
|
12
|
+
* `autocomplete="off"` alone does not settle it: the major managers ignore it on
|
|
13
|
+
* purpose, because sites used to abuse it. Each honours its own opt-out
|
|
14
|
+
* attribute instead, so a field that means it has to say so in four dialects.
|
|
15
|
+
*/
|
|
16
|
+
export interface AutofillProps {
|
|
17
|
+
autoComplete: string;
|
|
18
|
+
"data-1p-ignore"?: string;
|
|
19
|
+
"data-lpignore"?: string;
|
|
20
|
+
"data-bwignore"?: string;
|
|
21
|
+
"data-form-type"?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Props that switch a field's autofill behaviour on or off deliberately.
|
|
25
|
+
*
|
|
26
|
+
* Pass the field's declared autocomplete value; a genuine token is honoured, and
|
|
27
|
+
* anything else — including nothing at all — turns autofill off and tells each
|
|
28
|
+
* manager so in the attribute it listens to.
|
|
29
|
+
*/
|
|
30
|
+
export declare function autofillProps(token?: string): AutofillProps;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { cn, createSizes, createVariants } from './utils/cn';
|
|
2
|
+
export { useAnchoredPosition, type AnchoredPositionOptions } from './utils/useAnchoredPosition';
|
|
3
|
+
export { IDENTITY_TONE_COUNT, identityDotClass, identityPlateClass, identityTone, type IdentityTone } from './utils/identity';
|
|
2
4
|
export { catTone, type CatTone } from './utils/catTone';
|
|
3
5
|
export { MeetingGrid, type MeetingGridProps } from './meeting/MeetingGrid';
|
|
4
6
|
export { ParticipantTile, type ParticipantTileProps } from './meeting/ParticipantTile';
|
|
@@ -20,12 +22,13 @@ export { StorageInput, type StorageInputProps } from './input/StorageInput';
|
|
|
20
22
|
export { TextArea, type TextAreaProps } from './input/TextArea';
|
|
21
23
|
export { TextField, type TextFieldProps } from './input/TextField';
|
|
22
24
|
export { Form, FormSection, type FormButtonProps, type FormFieldType, type FormGroup, type FormGroupItem, type FormProps } from './forms/Form';
|
|
25
|
+
export { autofillProps, type AutofillProps } from './forms/autofill';
|
|
23
26
|
export { Dropdown, type DropdownOption, type DropdownProps } from './overlays/Dropdown';
|
|
24
27
|
export { ConfirmDialog, type ConfirmDialogProps } from './overlays/ConfirmDialog';
|
|
25
28
|
export { Modal, type ModalProps } from './overlays/Modal';
|
|
26
29
|
export { Popover, type PopoverProps } from './overlays/Popover';
|
|
27
30
|
export { Badge, type BadgeProps } from './feedback/Badge';
|
|
28
|
-
export { ContentLoading } from './feedback/ContentLoading';
|
|
31
|
+
export { ContentLoading, type ContentLoadingProps, type ContentLoadingShape } from './feedback/ContentLoading';
|
|
29
32
|
export { EmptyState, type EmptyStateProps } from './feedback/EmptyState';
|
|
30
33
|
export { Kbd, type KbdProps } from './feedback/Kbd';
|
|
31
34
|
export { ProgressBar, type ProgressBarProps } from './feedback/ProgressBar';
|
|
@@ -36,7 +39,7 @@ export { AssistantCard, type AssistantCardProps } from './content/AssistantCard'
|
|
|
36
39
|
export { Avatar, type AvatarProps, type AvatarTone } from './content/Avatar';
|
|
37
40
|
export { AvatarStack, type AvatarStackPerson, type AvatarStackProps } from './content/AvatarStack';
|
|
38
41
|
export { ChannelBadge, type ChannelBadgeProps, type ChannelKey } from './content/ChannelBadge';
|
|
39
|
-
export { Icon, type IconProps } from './content/Icon';
|
|
42
|
+
export { Icon, resolveLucideIcon, type IconProps } from './content/Icon';
|
|
40
43
|
export { Image, type ImageProps } from './content/Image';
|
|
41
44
|
export { List, ListBulkAction, type ListGroup, type ListProps } from './content/List';
|
|
42
45
|
export { MessageBubble, type MessageBubbleProps } from './content/MessageBubble';
|
|
@@ -50,6 +53,7 @@ export { SettingsFrameProvider, SettingsPage, useSettingsFrame, useSettingsFrame
|
|
|
50
53
|
export { SettingsRow, SettingsSection, type SettingsRowProps, type SettingsSectionProps } from './content/SettingsRow';
|
|
51
54
|
export { SourceChip, type SourceChipProps } from './content/SourceChip';
|
|
52
55
|
export { Table, dateFilterHandler, selectFilterHandler, type TableAction, type TableColumn, type TableFilter, type TableProps } from './content/Table';
|
|
56
|
+
export { badgeColumn, booleanBadgeColumn, labelsColumn, type BadgeColumnConfig, type BooleanBadgeColumnConfig, type LabelsColumnConfig } from './content/tableColumns';
|
|
53
57
|
export { View, type ViewGroup, type ViewProps } from './content/View';
|
|
54
58
|
export { SidebarMenu, type MenuItem, type MenuItemAction } from './navigation/Sidebar';
|
|
55
59
|
export { TabBar, Tabs, type TabItem, type TabsProps } from './navigation/Tabs';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic colour for a thing that has a name but no status.
|
|
3
|
+
*
|
|
4
|
+
* The rule this exists to enforce: the same name gets the same colour
|
|
5
|
+
* everywhere in the product. Every surface that used to pick a plate colour did
|
|
6
|
+
* it locally — an index in a list, a hash of its own, or a fixed neutral — so
|
|
7
|
+
* one person could be blue in the inbox and grey on a task, and the colour
|
|
8
|
+
* carried no information at all.
|
|
9
|
+
*
|
|
10
|
+
* The palette is the `--color-cat-*` categorical set, which the design system
|
|
11
|
+
* defines for exactly this: equal chroma and lightness, so no entry outranks
|
|
12
|
+
* another, and dark mode is handled by the tokens rather than here.
|
|
13
|
+
*/
|
|
14
|
+
/** How many `--color-cat-N` entries the design system defines. */
|
|
15
|
+
export declare const IDENTITY_TONE_COUNT = 5;
|
|
16
|
+
export type IdentityTone = 1 | 2 | 3 | 4 | 5;
|
|
17
|
+
/**
|
|
18
|
+
* Normalised so that the same identity written differently still lands on the
|
|
19
|
+
* same colour: casing and surrounding whitespace never distinguish two names.
|
|
20
|
+
*/
|
|
21
|
+
export declare function identityTone(seed: string | undefined | null): IdentityTone;
|
|
22
|
+
/** Wash + readable mark, for a plate that holds a monogram or a glyph. */
|
|
23
|
+
export declare function identityPlateClass(seed: string | undefined | null): string;
|
|
24
|
+
/** The solid colour, for a dot or a rule. */
|
|
25
|
+
export declare function identityDotClass(seed: string | undefined | null): string;
|