@opencxh/ui-kit 3.137.10 → 3.137.12
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 +1433 -1276
- 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/Page.d.ts +85 -0
- package/dist/src/forms/Form.d.ts +5 -1
- package/dist/src/forms/autofill.d.ts +30 -0
- package/dist/src/index.d.ts +5 -1
- 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>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { ContentLoadingShape } from '../feedback/ContentLoading';
|
|
3
|
+
import { PageHeaderAction } from './PageHeader';
|
|
4
|
+
/**
|
|
5
|
+
* The `md` gutter matches `PageHeader`'s own horizontal padding, so the table
|
|
6
|
+
* or form below lines up with the title above it. The top value is small
|
|
7
|
+
* because the header already supplies most of that gap (`pt-4 pb-2.5`).
|
|
8
|
+
*/
|
|
9
|
+
declare const paddingClasses: {
|
|
10
|
+
readonly none: "";
|
|
11
|
+
readonly sm: "px-3 pb-3 pt-1";
|
|
12
|
+
readonly md: "px-5 pb-5 pt-1.5";
|
|
13
|
+
};
|
|
14
|
+
export interface PageProps {
|
|
15
|
+
/** Page title, rendered by `PageHeader`. */
|
|
16
|
+
title: string;
|
|
17
|
+
/** Short description beside the title. */
|
|
18
|
+
subtitle?: string;
|
|
19
|
+
/** Line under the title — a count, a record, a timestamp. */
|
|
20
|
+
meta?: ReactNode;
|
|
21
|
+
/** Toolbar actions, right-aligned in the header. */
|
|
22
|
+
actions?: PageHeaderAction[];
|
|
23
|
+
/** Renders the back chevron beside the title. */
|
|
24
|
+
onBack?: () => void;
|
|
25
|
+
/**
|
|
26
|
+
* Draws the rule under the header. Defaults to `scroll`, because a header
|
|
27
|
+
* that stays put while the body scrolls needs an edge — without it the first
|
|
28
|
+
* row slides up against the title with nothing between them. A page that
|
|
29
|
+
* scrolls as a whole does not, so the rule would just be a stray line.
|
|
30
|
+
*/
|
|
31
|
+
surface?: boolean;
|
|
32
|
+
/** Full-width row at the bottom of the header — a filter strip, a tab bar. */
|
|
33
|
+
headerContent?: ReactNode;
|
|
34
|
+
/** Swaps the body for a skeleton. */
|
|
35
|
+
loading?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* What the body is about to render, so the placeholder has the right shape.
|
|
38
|
+
* Most app pages are a table; a detail page is usually a form.
|
|
39
|
+
*/
|
|
40
|
+
loadingShape?: ContentLoadingShape;
|
|
41
|
+
/**
|
|
42
|
+
* Rendered instead of `children` when there is nothing to show — pass an
|
|
43
|
+
* `EmptyState`. Ignored while `loading`, so an empty list does not flash its
|
|
44
|
+
* "nothing here" message during the first fetch.
|
|
45
|
+
*/
|
|
46
|
+
empty?: ReactNode;
|
|
47
|
+
padding?: keyof typeof paddingClasses;
|
|
48
|
+
/**
|
|
49
|
+
* Whether the page owns its scroll. `true` (default) pins the header and
|
|
50
|
+
* scrolls the body — the right behaviour for a table you page through.
|
|
51
|
+
* Set `false` when the page is rendered inside something that already
|
|
52
|
+
* scrolls and should flow with it.
|
|
53
|
+
*/
|
|
54
|
+
scroll?: boolean;
|
|
55
|
+
className?: string;
|
|
56
|
+
contentClassName?: string;
|
|
57
|
+
children?: ReactNode;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* One app page: the header, the content gutter, the scroll container, and the
|
|
61
|
+
* loading and empty states.
|
|
62
|
+
*
|
|
63
|
+
* These four were re-invented per page — 24 times in `eylo-voip` alone, each
|
|
64
|
+
* with its own gutter — which is how `p-4` there and `px-5` everywhere else
|
|
65
|
+
* ended up side by side in the same product. Reach for this instead of pairing
|
|
66
|
+
* a `PageHeader` with a padded `div`.
|
|
67
|
+
*
|
|
68
|
+
* Settings panels are the exception: they live inside the settings frame, which
|
|
69
|
+
* draws its own title and scrolls itself, so they use `SettingsPage`.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```tsx
|
|
73
|
+
* <Page
|
|
74
|
+
* title={t("interactions")}
|
|
75
|
+
* subtitle={t("interactions_description")}
|
|
76
|
+
* actions={[{ id: "refresh", label: t("refresh"), onClick: reload }]}
|
|
77
|
+
* loading={loading}
|
|
78
|
+
* empty={!interactions.length && <EmptyState title={t("interaction_no_records_found")} />}
|
|
79
|
+
* >
|
|
80
|
+
* <InteractionsTable interactions={interactions} />
|
|
81
|
+
* </Page>
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare const Page: React.FC<PageProps>;
|
|
85
|
+
export {};
|
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,6 +22,7 @@ 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';
|
|
@@ -36,11 +39,12 @@ 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';
|
|
43
46
|
export { KpiCard, type KpiCardProps } from './content/KpiCard';
|
|
47
|
+
export { Page, type PageProps } from './content/Page';
|
|
44
48
|
export { PageHeader, type PageHeaderAction, type PageHeaderProps } from './content/PageHeader';
|
|
45
49
|
export { PageToolbar, PageToolbarActions, type PageToolbarActionsProps, type PageToolbarProps } from './content/PageToolbar';
|
|
46
50
|
export { RichText, type RichTextProps } from './content/RichText';
|
|
@@ -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;
|