@proteos/ui 0.31.0 → 0.32.1
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 +1302 -516
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +259 -1
- package/dist/index.d.ts +259 -1
- package/dist/index.js +1292 -520
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/draft-message-composer/create-draft-message-client.ts +27 -0
- package/src/components/draft-message-composer/draft-message-actions-store.test.ts +62 -0
- package/src/components/draft-message-composer/draft-message-actions-store.ts +81 -0
- package/src/components/draft-message-composer/draft-message-composer.stories.tsx +175 -0
- package/src/components/draft-message-composer/draft-message-composer.test.tsx +276 -0
- package/src/components/draft-message-composer/draft-message-composer.tsx +470 -0
- package/src/components/draft-message-composer/draft-message-outcome-store.test.ts +59 -0
- package/src/components/draft-message-composer/draft-message-outcome-store.ts +56 -0
- package/src/components/draft-message-composer/index.ts +19 -0
- package/src/components/draft-message-composer/types.ts +32 -0
- package/src/components/message-composer/index.ts +13 -0
- package/src/components/message-composer/message-composer.stories.tsx +155 -0
- package/src/components/message-composer/message-composer.test.tsx +320 -0
- package/src/components/message-composer/message-composer.tsx +480 -0
- package/src/components/recipient-select/index.ts +2 -0
- package/src/components/recipient-select/recipient-select.test.tsx +139 -0
- package/src/components/recipient-select/recipient-select.tsx +94 -0
- package/src/index.ts +3 -0
package/dist/index.d.cts
CHANGED
|
@@ -7,6 +7,8 @@ import { HTMLAttributes, ReactNode, AnchorHTMLAttributes, Ref, MouseEvent, Keybo
|
|
|
7
7
|
import * as react_aria_components from 'react-aria-components';
|
|
8
8
|
import { Key, BreadcrumbsProps as BreadcrumbsProps$1, ButtonProps as ButtonProps$1, CheckboxProps as CheckboxProps$1, CheckboxGroupProps as CheckboxGroupProps$1, ComboBoxProps, DateValue, DatePickerProps as DatePickerProps$1, TextFieldProps, InputProps as InputProps$1, MenuProps as MenuProps$1, MenuItemProps as MenuItemProps$1, PopoverProps, MenuTrigger as MenuTrigger$1, DialogTriggerProps, ModalOverlayProps, DialogProps, HeadingProps, DisclosureProps, ProgressBarProps as ProgressBarProps$1, RadioProps as RadioProps$1, RadioGroupProps as RadioGroupProps$1, SelectProps as SelectProps$1, SeparatorProps as SeparatorProps$1, SwitchProps as SwitchProps$1, TabsProps, TabListProps, TabProps, TabPanelProps, TextAreaProps, TimeValue, TimeFieldProps as TimeFieldProps$1, TooltipProps as TooltipProps$1, TooltipTriggerComponentProps } from 'react-aria-components';
|
|
9
9
|
import { ColumnDef, SortingState, OnChangeFn, Row } from '@tanstack/react-table';
|
|
10
|
+
import { Message, Conversation, UpdateDraftRequest, ContactAddress, ConversationClient, SendRecipient } from '@proteos/sdk';
|
|
11
|
+
import * as tailwind_merge from 'tailwind-merge';
|
|
10
12
|
import { ClassValue } from 'clsx';
|
|
11
13
|
|
|
12
14
|
declare const attachmentChipStyles: tailwind_variants.TVReturnType<{
|
|
@@ -1024,6 +1026,157 @@ type DateTimePickerProps<T extends DateValue> = DatePickerProps$1<T> & {
|
|
|
1024
1026
|
};
|
|
1025
1027
|
declare function DateTimePicker<T extends DateValue>({ label, description, errorMessage, size, appearance, className, granularity, hideTimeZone, shouldCloseOnSelect, ...props }: DateTimePickerProps<T>): react_jsx_runtime.JSX.Element;
|
|
1026
1028
|
|
|
1029
|
+
/**
|
|
1030
|
+
* The minimal fetch surface DraftMessageComposer needs, injected per host:
|
|
1031
|
+
* the web app builds it from `useSdk().conversation`, custom components from
|
|
1032
|
+
* `useSdk().conversations` — both via {@link createDraftMessageClient}.
|
|
1033
|
+
*/
|
|
1034
|
+
interface DraftMessageClient {
|
|
1035
|
+
/** One message with projections — also resolves terminal states by id. */
|
|
1036
|
+
getMessage(messageId: string): Promise<Message>;
|
|
1037
|
+
/** The draft's conversation: subject, status (draft ⇒ subject editable), room. */
|
|
1038
|
+
getConversation(conversationId: string): Promise<Conversation>;
|
|
1039
|
+
/** Full-replacement draft edit (PUT semantics — send the complete state). */
|
|
1040
|
+
updateDraft(messageId: string, patch: UpdateDraftRequest): Promise<Message>;
|
|
1041
|
+
/** Deliver the draft (draft → pending → sent/failed). 409 on a lost race. */
|
|
1042
|
+
sendDraft(messageId: string): Promise<Message>;
|
|
1043
|
+
/** Decline the draft (draft → rejected, terminal). 409 on a lost race. */
|
|
1044
|
+
rejectDraft(messageId: string): Promise<Message>;
|
|
1045
|
+
/** Directory search backing the To/Cc/Bcc pickers (email drafts only). */
|
|
1046
|
+
searchRecipients(connectionId: string, q: string): Promise<ContactAddress[]>;
|
|
1047
|
+
}
|
|
1048
|
+
/** What happened to a reviewed draft — the payload of the outcome store. */
|
|
1049
|
+
type DraftMessageOutcome = {
|
|
1050
|
+
type: 'sent';
|
|
1051
|
+
message: Message;
|
|
1052
|
+
} | {
|
|
1053
|
+
type: 'rejected';
|
|
1054
|
+
message: Message;
|
|
1055
|
+
};
|
|
1056
|
+
|
|
1057
|
+
/**
|
|
1058
|
+
* One-liner adapter from the sdk ConversationClient (web app:
|
|
1059
|
+
* `useSdk().conversation`; custom components: `useSdk().conversations`) to
|
|
1060
|
+
* the composer's injected client. Type-only sdk import — no runtime coupling.
|
|
1061
|
+
*/
|
|
1062
|
+
declare function createDraftMessageClient(conversation: Pick<ConversationClient, 'messages' | 'conversations' | 'connections'>): DraftMessageClient;
|
|
1063
|
+
|
|
1064
|
+
interface DraftMessageActions {
|
|
1065
|
+
/** Persists dirty edits, then delivers — the internal Send button's path. */
|
|
1066
|
+
send(): Promise<void>;
|
|
1067
|
+
/** Declines the draft. Bypasses the inline confirm — the external UI owns confirmation. */
|
|
1068
|
+
reject(): Promise<void>;
|
|
1069
|
+
/** Persists the current edits without sending. */
|
|
1070
|
+
saveDraft(): Promise<void>;
|
|
1071
|
+
/** True while the composer is saving/sending/rejecting — disable external buttons. */
|
|
1072
|
+
isBusy: boolean;
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* Registers a composer's handlers for its message id; returns the
|
|
1076
|
+
* unregister. Re-register (a fresh object) whenever isBusy flips so
|
|
1077
|
+
* subscribers re-render. Unregistering only clears the entry while it still
|
|
1078
|
+
* owns it (last-registered wins across overlapping mounts).
|
|
1079
|
+
*/
|
|
1080
|
+
declare function registerDraftMessageActions(messageId: string, actions: DraftMessageActions): () => void;
|
|
1081
|
+
/**
|
|
1082
|
+
* The mounted composer's actions for this draft, or null while none is
|
|
1083
|
+
* mounted (disable the external button).
|
|
1084
|
+
*/
|
|
1085
|
+
declare function useDraftMessageActions(messageId: string): DraftMessageActions | null;
|
|
1086
|
+
/** Test-only escape hatch — clears every registration and listener. */
|
|
1087
|
+
declare function __resetDraftMessageActions(): void;
|
|
1088
|
+
|
|
1089
|
+
declare const draftMessageComposerStyles: tailwind_variants.TVReturnType<{
|
|
1090
|
+
[key: string]: {
|
|
1091
|
+
[key: string]: tailwind_merge.ClassNameValue | {
|
|
1092
|
+
header?: tailwind_merge.ClassNameValue;
|
|
1093
|
+
error?: tailwind_merge.ClassNameValue;
|
|
1094
|
+
actions?: tailwind_merge.ClassNameValue;
|
|
1095
|
+
sender?: tailwind_merge.ClassNameValue;
|
|
1096
|
+
root?: tailwind_merge.ClassNameValue;
|
|
1097
|
+
badge?: tailwind_merge.ClassNameValue;
|
|
1098
|
+
terminal?: tailwind_merge.ClassNameValue;
|
|
1099
|
+
};
|
|
1100
|
+
};
|
|
1101
|
+
} | {
|
|
1102
|
+
[x: string]: {
|
|
1103
|
+
[x: string]: tailwind_merge.ClassNameValue | {
|
|
1104
|
+
header?: tailwind_merge.ClassNameValue;
|
|
1105
|
+
error?: tailwind_merge.ClassNameValue;
|
|
1106
|
+
actions?: tailwind_merge.ClassNameValue;
|
|
1107
|
+
sender?: tailwind_merge.ClassNameValue;
|
|
1108
|
+
root?: tailwind_merge.ClassNameValue;
|
|
1109
|
+
badge?: tailwind_merge.ClassNameValue;
|
|
1110
|
+
terminal?: tailwind_merge.ClassNameValue;
|
|
1111
|
+
};
|
|
1112
|
+
};
|
|
1113
|
+
} | {}, {
|
|
1114
|
+
root: string;
|
|
1115
|
+
header: string;
|
|
1116
|
+
badge: string[];
|
|
1117
|
+
sender: string;
|
|
1118
|
+
actions: string;
|
|
1119
|
+
terminal: string[];
|
|
1120
|
+
error: string;
|
|
1121
|
+
}, undefined, {
|
|
1122
|
+
[key: string]: {
|
|
1123
|
+
[key: string]: tailwind_merge.ClassNameValue | {
|
|
1124
|
+
header?: tailwind_merge.ClassNameValue;
|
|
1125
|
+
error?: tailwind_merge.ClassNameValue;
|
|
1126
|
+
actions?: tailwind_merge.ClassNameValue;
|
|
1127
|
+
sender?: tailwind_merge.ClassNameValue;
|
|
1128
|
+
root?: tailwind_merge.ClassNameValue;
|
|
1129
|
+
badge?: tailwind_merge.ClassNameValue;
|
|
1130
|
+
terminal?: tailwind_merge.ClassNameValue;
|
|
1131
|
+
};
|
|
1132
|
+
};
|
|
1133
|
+
} | {}, {
|
|
1134
|
+
root: string;
|
|
1135
|
+
header: string;
|
|
1136
|
+
badge: string[];
|
|
1137
|
+
sender: string;
|
|
1138
|
+
actions: string;
|
|
1139
|
+
terminal: string[];
|
|
1140
|
+
error: string;
|
|
1141
|
+
}, tailwind_variants.TVReturnType<unknown, {
|
|
1142
|
+
root: string;
|
|
1143
|
+
header: string;
|
|
1144
|
+
badge: string[];
|
|
1145
|
+
sender: string;
|
|
1146
|
+
actions: string;
|
|
1147
|
+
terminal: string[];
|
|
1148
|
+
error: string;
|
|
1149
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
1150
|
+
interface DraftMessageComposerProps {
|
|
1151
|
+
/** The status=draft message to review. */
|
|
1152
|
+
messageId: string;
|
|
1153
|
+
/** Injected fetch surface — see createDraftMessageClient. */
|
|
1154
|
+
client: DraftMessageClient;
|
|
1155
|
+
/** Fires once the draft delivered (send resolved pending/sent). */
|
|
1156
|
+
onSent?: (message: Message) => void;
|
|
1157
|
+
/** Fires once the draft was declined. */
|
|
1158
|
+
onRejected?: (message: Message) => void;
|
|
1159
|
+
/**
|
|
1160
|
+
* Default true. When false the internal Send / Save draft / Reject row is
|
|
1161
|
+
* hidden — the composer becomes a pure preview/edit surface driven by
|
|
1162
|
+
* external controls via useDraftMessageActions.
|
|
1163
|
+
*/
|
|
1164
|
+
showActions?: boolean;
|
|
1165
|
+
className?: string;
|
|
1166
|
+
}
|
|
1167
|
+
declare function DraftMessageComposer({ messageId, client, onSent, onRejected, showActions, className, }: DraftMessageComposerProps): react_jsx_runtime.JSX.Element;
|
|
1168
|
+
|
|
1169
|
+
declare function publishDraftMessageOutcome(messageId: string, outcome: DraftMessageOutcome): void;
|
|
1170
|
+
declare function subscribeDraftMessageOutcome(messageId: string, listener: () => void): () => void;
|
|
1171
|
+
/**
|
|
1172
|
+
* The last outcome for this draft, or null while it is still under review.
|
|
1173
|
+
* Re-renders when the outcome lands — including for subscribers that mounted
|
|
1174
|
+
* after it (last-value replay).
|
|
1175
|
+
*/
|
|
1176
|
+
declare function useDraftMessageOutcome(messageId: string): DraftMessageOutcome | null;
|
|
1177
|
+
/** Test-only escape hatch — clears every stored outcome and listener. */
|
|
1178
|
+
declare function __resetDraftMessageOutcomes(): void;
|
|
1179
|
+
|
|
1027
1180
|
declare const emptyStateStyles: tailwind_variants.TVReturnType<{
|
|
1028
1181
|
size: {
|
|
1029
1182
|
sm: {
|
|
@@ -1253,6 +1406,102 @@ type MenuItemProps = Omit<MenuItemProps$1, 'children'> & {
|
|
|
1253
1406
|
/** A single menu row. Pass `onAction` to handle selection; `isDisabled` to dim it. */
|
|
1254
1407
|
declare function MenuItem({ icon, hasSubmenu, children, className, ...props }: MenuItemProps): react_jsx_runtime.JSX.Element;
|
|
1255
1408
|
|
|
1409
|
+
/** Controlled text + subject. Draft persistence lives with the host. */
|
|
1410
|
+
interface ComposerValue {
|
|
1411
|
+
text: string;
|
|
1412
|
+
subject?: string;
|
|
1413
|
+
}
|
|
1414
|
+
interface ComposerSendInput {
|
|
1415
|
+
text: string;
|
|
1416
|
+
subject?: string;
|
|
1417
|
+
/** Only when the composer owns addressing (`showToField` — compose). */
|
|
1418
|
+
to?: SendRecipient[];
|
|
1419
|
+
cc?: SendRecipient[];
|
|
1420
|
+
bcc?: SendRecipient[];
|
|
1421
|
+
}
|
|
1422
|
+
/** The compose view's connection switcher, rendered as the composer's top row. */
|
|
1423
|
+
interface ComposerConnectionPicker {
|
|
1424
|
+
options: ReadonlyArray<{
|
|
1425
|
+
id: string;
|
|
1426
|
+
/** Rich render (channel icon + name); `textValue` carries the plain name. */
|
|
1427
|
+
label: ReactNode;
|
|
1428
|
+
textValue: string;
|
|
1429
|
+
}>;
|
|
1430
|
+
selectedId: string;
|
|
1431
|
+
onSelect: (connectionId: string) => void;
|
|
1432
|
+
}
|
|
1433
|
+
/** Presentational attachment chip input — hosts map their own upload model onto it. */
|
|
1434
|
+
interface ComposerAttachment {
|
|
1435
|
+
localId: string;
|
|
1436
|
+
name: string;
|
|
1437
|
+
/** Bytes when known — server-loaded attachments may not know their size. */
|
|
1438
|
+
sizeInBytes?: number;
|
|
1439
|
+
contentType?: string;
|
|
1440
|
+
status: 'uploading' | 'ready' | 'error';
|
|
1441
|
+
errorMessage?: string;
|
|
1442
|
+
}
|
|
1443
|
+
/** Directory search backing the To/Cc/Bcc pickers — injected per host (the lib never fetches). */
|
|
1444
|
+
type SearchRecipients = (connectionId: string, q: string) => Promise<ContactAddress[]>;
|
|
1445
|
+
/** Per-file cap for conversation-channel sends (the backend rejects larger
|
|
1446
|
+
* with `attachment_too_large`; Slack additionally caps at 10 files/message,
|
|
1447
|
+
* surfaced through the send error line). */
|
|
1448
|
+
declare const MAX_COMPOSER_ATTACHMENT_BYTES: number;
|
|
1449
|
+
/** Outer box chrome — exported so hosts can re-apply the same shell. */
|
|
1450
|
+
declare const messageComposerStyles: tailwind_variants.TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, tailwind_variants.TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
|
|
1451
|
+
interface MessageComposerProps {
|
|
1452
|
+
mode: 'chat' | 'email';
|
|
1453
|
+
/** Controlled text+subject (draft persistence lives with the host). */
|
|
1454
|
+
value: ComposerValue;
|
|
1455
|
+
onValueChange: (value: ComposerValue) => void;
|
|
1456
|
+
placeholder: string;
|
|
1457
|
+
/** Email replies arrive with `re: <subject>` prefilled. */
|
|
1458
|
+
subjectPrefill?: string;
|
|
1459
|
+
/** When true (email mode), the Subject row renders the subject as static
|
|
1460
|
+
* text — reply drafts where the subject is derived from the thread and
|
|
1461
|
+
* must not be edited. The Cc/Bcc reveal stays functional. Default false. */
|
|
1462
|
+
isSubjectReadOnly?: boolean;
|
|
1463
|
+
/** When set, the composer is replaced by this banner (ended conversation,
|
|
1464
|
+
* read-only transcript). */
|
|
1465
|
+
disabledReason?: ReactNode;
|
|
1466
|
+
onSend: (input: ComposerSendInput) => Promise<unknown>;
|
|
1467
|
+
/** Connection whose directory backs the To/Cc/Bcc pickers. */
|
|
1468
|
+
connectionId?: string;
|
|
1469
|
+
/** Compose only: a connection switcher as the composer's top row. */
|
|
1470
|
+
connectionPicker?: ComposerConnectionPicker;
|
|
1471
|
+
/** Compose only: the composer owns addressing — a To recipient row; the
|
|
1472
|
+
* picks arrive on `ComposerSendInput.to` and gate send. */
|
|
1473
|
+
showToField?: boolean;
|
|
1474
|
+
/** Email originate only: reveal Cc/Bcc recipient rows. */
|
|
1475
|
+
showRecipientFields?: boolean;
|
|
1476
|
+
/** Required for the To/Cc/Bcc rows to render (with `connectionId`). */
|
|
1477
|
+
searchRecipients?: SearchRecipients;
|
|
1478
|
+
/** Controlled-if-provided recipients; internal state otherwise. Internal
|
|
1479
|
+
* recipient state resets when `connectionId` changes and clears after a
|
|
1480
|
+
* successful send — controlled parents own their own resets. */
|
|
1481
|
+
to?: SendRecipient[];
|
|
1482
|
+
cc?: SendRecipient[];
|
|
1483
|
+
bcc?: SendRecipient[];
|
|
1484
|
+
onToChange?: (next: SendRecipient[]) => void;
|
|
1485
|
+
onCcChange?: (next: SendRecipient[]) => void;
|
|
1486
|
+
onBccChange?: (next: SendRecipient[]) => void;
|
|
1487
|
+
/** The host-owned pending queue, rendered as chips above the input. */
|
|
1488
|
+
attachments?: ComposerAttachment[];
|
|
1489
|
+
/** When set, the paperclip renders and picked files flow to the host. */
|
|
1490
|
+
onAddFiles?: (files: File[]) => void;
|
|
1491
|
+
onRemoveAttachment?: (localId: string) => void;
|
|
1492
|
+
/** True while any attachment is still uploading — blocks send. */
|
|
1493
|
+
hasUploadingAttachments?: boolean;
|
|
1494
|
+
/**
|
|
1495
|
+
* Default true. When false: the send button AND the keybinding hint are
|
|
1496
|
+
* hidden and the ↵/⌘↵ submit combo is disabled — submission is fully
|
|
1497
|
+
* delegated to an external driver (e.g. the draft review surface).
|
|
1498
|
+
*/
|
|
1499
|
+
showSendButton?: boolean;
|
|
1500
|
+
/** Composes onto the outer box chrome (`messageComposerStyles`). */
|
|
1501
|
+
className?: string;
|
|
1502
|
+
}
|
|
1503
|
+
declare function MessageComposer({ mode, value, onValueChange, placeholder, subjectPrefill, isSubjectReadOnly, disabledReason, onSend, connectionId, connectionPicker, showToField, showRecipientFields, searchRecipients, to: toProp, cc: ccProp, bcc: bccProp, onToChange, onCcChange, onBccChange, attachments, onAddFiles, onRemoveAttachment, hasUploadingAttachments, showSendButton, className, }: MessageComposerProps): react_jsx_runtime.JSX.Element;
|
|
1504
|
+
|
|
1256
1505
|
/** Stateful root. Pass `isOpen` + `onOpenChange` for controlled usage. */
|
|
1257
1506
|
declare function Modal(props: DialogTriggerProps): react_jsx_runtime.JSX.Element;
|
|
1258
1507
|
type ModalContentProps = ModalOverlayProps & {
|
|
@@ -1470,6 +1719,15 @@ type RadioProps = Omit<RadioProps$1, 'children'> & {
|
|
|
1470
1719
|
};
|
|
1471
1720
|
declare function Radio({ children, className, ...props }: RadioProps): react_jsx_runtime.JSX.Element;
|
|
1472
1721
|
|
|
1722
|
+
interface RecipientSelectProps {
|
|
1723
|
+
connectionId: string;
|
|
1724
|
+
searchRecipients: SearchRecipients;
|
|
1725
|
+
value: SendRecipient[];
|
|
1726
|
+
onChange: (next: SendRecipient[]) => void;
|
|
1727
|
+
placeholder?: string;
|
|
1728
|
+
}
|
|
1729
|
+
declare function RecipientSelect({ connectionId, searchRecipients, value, onChange, placeholder, }: RecipientSelectProps): react_jsx_runtime.JSX.Element;
|
|
1730
|
+
|
|
1473
1731
|
type FilterFieldType = Exclude<AttributeType, 'object'>;
|
|
1474
1732
|
type FilterFieldOption = {
|
|
1475
1733
|
value: string;
|
|
@@ -2123,4 +2381,4 @@ declare function Tooltip({ className, offset, ...props }: TooltipProps): react_j
|
|
|
2123
2381
|
|
|
2124
2382
|
declare function cn(...inputs: ClassValue[]): string;
|
|
2125
2383
|
|
|
2126
|
-
export { ATTRIBUTE_TYPES, ATTRIBUTE_TYPE_ICONS, type ActionsColumnOptions, AttachmentChip, type AttachmentChipProps, type AttachmentChipVariants, AttributePicker, type AttributePickerProps, AttributeType, AttributeTypeIcon, type AttributeTypeIconProps, Avatar, AvatarGroup, type AvatarGroupItem, type AvatarGroupProps, type AvatarGroupVariants, type AvatarProps, type AvatarVariants, Badge, BadgeMultiSelect, type BadgeMultiSelectOption, type BadgeMultiSelectProps, type BadgeProps, type BadgeVariants, BooleanCell, type BooleanCellProps, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonProps, type ButtonVariants, COLUMN_DRAG_KIND, Card, CardBody, CardContent, CardEyebrow, CardFeatureTitle, CardFooter, CardHeader, type CardProps, CardTitle, type CardVariants, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, ChipValue, type ChipValueItemRenderer, type ChipValueProps, type ColumnDragData, Combobox, type ComboboxOption, type ComboboxProps, Command, CommandHint, type CommandHintProps, type CommandHintTone, type CommandProps, type ComparisonOperator, CurrencyInput, type CurrencyInputOption, type CurrencyInputProps, type CurrencyInputValue, DataTable, DataTableEmpty, type DataTableEmptyProps, DataTableError, type DataTableErrorProps, type DataTableProps, DataTableSkeleton, type DataTableSkeletonProps, DateCell, type DateCellProps, DatePicker, type DatePickerProps, DateTimeCell, type DateTimeCellProps, DateTimePicker, type DateTimePickerProps, EmptyState, type EmptyStateProps, type EmptyStateVariants, ErrorAnimation, type ErrorAnimationProps, type FieldAppearance, FieldCaret, type FieldControlVariants, type FieldSize, FileField, type FileFieldProps, type FileFieldValue, FileViewer, FileViewerFallbackCard, type FileViewerFallbackCardProps, type FileViewerFallbackCardVariants, type FileViewerKind, type FileViewerProps, type FileViewerVariants, type FilterElement, type FilterField, type FilterFieldOption, type FilterFieldRelation, type FilterFieldType, type FilterGroup, FilterRow, type FilterRowProps, type FilterValue, FilterValueInput, type FilterValueInputProps, type FilterValueInputRenderer, ImageAttachment, type ImageAttachmentProps, type ImageAttachmentVariants, ImageLightbox, type ImageLightboxProps, type ImageLightboxVariants, type InfiniteQueryLike, Input, type InputProps, Kbd, type KbdProps, type KeyCombo, LinkCell, type LinkCellProps, type LogicalOperator, Menu, MenuItem, type MenuItemProps, MenuPopover, type MenuPopoverProps, type MenuProps, MenuTrigger, Modal, ModalBody, ModalContent, type ModalContentProps, ModalDescription, ModalFooter, ModalHeader, ModalTitle, MultiSelect, type MultiSelectOption, type MultiSelectProps, NavGroup, type NavGroupProps, NavItem, type NavItemProps, type NavItemVariants, NavSection, type NavSectionProps, OPERATORS, type OperatorArity, type OperatorDescriptor, OperatorPicker, type OperatorPickerProps, PROTECTED_COMBOS, Popover, PopoverContent, type PopoverContentProps, PopoverPanelBody, PopoverPanelFooter, PopoverPanelHeader, PressableCard, type PressableCardProps, ProgressBar, type ProgressBarProps, type ProgressBarVariants, Radio, RadioGroup, type RadioGroupProps, type RadioProps, RecordFilterBuilderPanel, type RecordFilterBuilderPanelProps, RecordFilterButton, type RecordFilterButtonProps, RecordFilterChips, type RecordFilterChipsProps, RecordFilterEditor, type RecordFilterEditorProps, RenderChipItemProvider, RenderValueInputProvider, SegmentedControl, type SegmentedControlOption, type SegmentedControlProps, type SegmentedControlVariants, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Skeleton, type SkeletonProps, type SkeletonVariants, type SortDirection, SubmenuTrigger, SuccessAnimation, type SuccessAnimationProps, Switch, type SwitchProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableHeader, TableHeaderCell, type TableHeaderCellProps, type TableHeaderProps, TableHeaderSpacer, type TableProps, TableRow, type TableRowProps, TableScroller, type TableVariants, Tabs, type TabsListProps, type TabsPanelProps, type TabsRootProps, type TabsTriggerProps, type TabsVariants, TagInput, type TagInputProps, Textarea, type TextareaProps, TimeField, type TimeFieldProps, Tooltip, type TooltipProps, TooltipTrigger, TruncateCell, type TruncateCellProps, type UseCommandOptions, type UseEscapeKeyOptions, type UseInfiniteScrollSentinelOptions, addLeaf as addFilterLeaf, addPendingLeaf, addSubgroup, arityOf, attachmentChipStyles, avatarGroupStyles, avatarStyles, badgeStyles, buttonStyles, cardStyles, cn, countLeaves, defaultValueFor, emptyStateStyles, fieldControlStyles, fieldErrorStyles, fieldHintStyles, fieldLabelStyles, fileViewerFallbackCardStyles, fileViewerStyles, formatFileSize, formatValue, iconForContentType, imageAttachmentStyles, imageLightboxStyles, isColumnDragData, isEditableTarget, isPreviewableImageName, makeActionsColumn, navItemStyles, operatorById, operatorsForType, parseCombo, progressBarStyles, rebaseRowOnFieldChange, rebaseRowOnOperatorChange, removeLeaf, removeSubgroup, replaceLeaf, segmentedControlStyles, setJoiner, skeletonStyles, tableCellStyles, tableHeaderCellStyles, tabsStyles, updateLeaf, updateSubgroup, useAttributeTypeIcon, useCommand, useDiscoveryActive, useEscapeKey, useInfiniteScrollSentinel, useRenderChipItem, useRenderValueInput, useShowDetails, viewerKindForContentType, wrapLeafInGroup };
|
|
2384
|
+
export { ATTRIBUTE_TYPES, ATTRIBUTE_TYPE_ICONS, type ActionsColumnOptions, AttachmentChip, type AttachmentChipProps, type AttachmentChipVariants, AttributePicker, type AttributePickerProps, AttributeType, AttributeTypeIcon, type AttributeTypeIconProps, Avatar, AvatarGroup, type AvatarGroupItem, type AvatarGroupProps, type AvatarGroupVariants, type AvatarProps, type AvatarVariants, Badge, BadgeMultiSelect, type BadgeMultiSelectOption, type BadgeMultiSelectProps, type BadgeProps, type BadgeVariants, BooleanCell, type BooleanCellProps, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonProps, type ButtonVariants, COLUMN_DRAG_KIND, Card, CardBody, CardContent, CardEyebrow, CardFeatureTitle, CardFooter, CardHeader, type CardProps, CardTitle, type CardVariants, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, ChipValue, type ChipValueItemRenderer, type ChipValueProps, type ColumnDragData, Combobox, type ComboboxOption, type ComboboxProps, Command, CommandHint, type CommandHintProps, type CommandHintTone, type CommandProps, type ComparisonOperator, type ComposerAttachment, type ComposerConnectionPicker, type ComposerSendInput, type ComposerValue, CurrencyInput, type CurrencyInputOption, type CurrencyInputProps, type CurrencyInputValue, DataTable, DataTableEmpty, type DataTableEmptyProps, DataTableError, type DataTableErrorProps, type DataTableProps, DataTableSkeleton, type DataTableSkeletonProps, DateCell, type DateCellProps, DatePicker, type DatePickerProps, DateTimeCell, type DateTimeCellProps, DateTimePicker, type DateTimePickerProps, type DraftMessageActions, type DraftMessageClient, DraftMessageComposer, type DraftMessageComposerProps, type DraftMessageOutcome, EmptyState, type EmptyStateProps, type EmptyStateVariants, ErrorAnimation, type ErrorAnimationProps, type FieldAppearance, FieldCaret, type FieldControlVariants, type FieldSize, FileField, type FileFieldProps, type FileFieldValue, FileViewer, FileViewerFallbackCard, type FileViewerFallbackCardProps, type FileViewerFallbackCardVariants, type FileViewerKind, type FileViewerProps, type FileViewerVariants, type FilterElement, type FilterField, type FilterFieldOption, type FilterFieldRelation, type FilterFieldType, type FilterGroup, FilterRow, type FilterRowProps, type FilterValue, FilterValueInput, type FilterValueInputProps, type FilterValueInputRenderer, ImageAttachment, type ImageAttachmentProps, type ImageAttachmentVariants, ImageLightbox, type ImageLightboxProps, type ImageLightboxVariants, type InfiniteQueryLike, Input, type InputProps, Kbd, type KbdProps, type KeyCombo, LinkCell, type LinkCellProps, type LogicalOperator, MAX_COMPOSER_ATTACHMENT_BYTES, Menu, MenuItem, type MenuItemProps, MenuPopover, type MenuPopoverProps, type MenuProps, MenuTrigger, MessageComposer, type MessageComposerProps, Modal, ModalBody, ModalContent, type ModalContentProps, ModalDescription, ModalFooter, ModalHeader, ModalTitle, MultiSelect, type MultiSelectOption, type MultiSelectProps, NavGroup, type NavGroupProps, NavItem, type NavItemProps, type NavItemVariants, NavSection, type NavSectionProps, OPERATORS, type OperatorArity, type OperatorDescriptor, OperatorPicker, type OperatorPickerProps, PROTECTED_COMBOS, Popover, PopoverContent, type PopoverContentProps, PopoverPanelBody, PopoverPanelFooter, PopoverPanelHeader, PressableCard, type PressableCardProps, ProgressBar, type ProgressBarProps, type ProgressBarVariants, Radio, RadioGroup, type RadioGroupProps, type RadioProps, RecipientSelect, type RecipientSelectProps, RecordFilterBuilderPanel, type RecordFilterBuilderPanelProps, RecordFilterButton, type RecordFilterButtonProps, RecordFilterChips, type RecordFilterChipsProps, RecordFilterEditor, type RecordFilterEditorProps, RenderChipItemProvider, RenderValueInputProvider, type SearchRecipients, SegmentedControl, type SegmentedControlOption, type SegmentedControlProps, type SegmentedControlVariants, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Skeleton, type SkeletonProps, type SkeletonVariants, type SortDirection, SubmenuTrigger, SuccessAnimation, type SuccessAnimationProps, Switch, type SwitchProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableHeader, TableHeaderCell, type TableHeaderCellProps, type TableHeaderProps, TableHeaderSpacer, type TableProps, TableRow, type TableRowProps, TableScroller, type TableVariants, Tabs, type TabsListProps, type TabsPanelProps, type TabsRootProps, type TabsTriggerProps, type TabsVariants, TagInput, type TagInputProps, Textarea, type TextareaProps, TimeField, type TimeFieldProps, Tooltip, type TooltipProps, TooltipTrigger, TruncateCell, type TruncateCellProps, type UseCommandOptions, type UseEscapeKeyOptions, type UseInfiniteScrollSentinelOptions, __resetDraftMessageActions, __resetDraftMessageOutcomes, addLeaf as addFilterLeaf, addPendingLeaf, addSubgroup, arityOf, attachmentChipStyles, avatarGroupStyles, avatarStyles, badgeStyles, buttonStyles, cardStyles, cn, countLeaves, createDraftMessageClient, defaultValueFor, draftMessageComposerStyles, emptyStateStyles, fieldControlStyles, fieldErrorStyles, fieldHintStyles, fieldLabelStyles, fileViewerFallbackCardStyles, fileViewerStyles, formatFileSize, formatValue, iconForContentType, imageAttachmentStyles, imageLightboxStyles, isColumnDragData, isEditableTarget, isPreviewableImageName, makeActionsColumn, messageComposerStyles, navItemStyles, operatorById, operatorsForType, parseCombo, progressBarStyles, publishDraftMessageOutcome, rebaseRowOnFieldChange, rebaseRowOnOperatorChange, registerDraftMessageActions, removeLeaf, removeSubgroup, replaceLeaf, segmentedControlStyles, setJoiner, skeletonStyles, subscribeDraftMessageOutcome, tableCellStyles, tableHeaderCellStyles, tabsStyles, updateLeaf, updateSubgroup, useAttributeTypeIcon, useCommand, useDiscoveryActive, useDraftMessageActions, useDraftMessageOutcome, useEscapeKey, useInfiniteScrollSentinel, useRenderChipItem, useRenderValueInput, useShowDetails, viewerKindForContentType, wrapLeafInGroup };
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ import { HTMLAttributes, ReactNode, AnchorHTMLAttributes, Ref, MouseEvent, Keybo
|
|
|
7
7
|
import * as react_aria_components from 'react-aria-components';
|
|
8
8
|
import { Key, BreadcrumbsProps as BreadcrumbsProps$1, ButtonProps as ButtonProps$1, CheckboxProps as CheckboxProps$1, CheckboxGroupProps as CheckboxGroupProps$1, ComboBoxProps, DateValue, DatePickerProps as DatePickerProps$1, TextFieldProps, InputProps as InputProps$1, MenuProps as MenuProps$1, MenuItemProps as MenuItemProps$1, PopoverProps, MenuTrigger as MenuTrigger$1, DialogTriggerProps, ModalOverlayProps, DialogProps, HeadingProps, DisclosureProps, ProgressBarProps as ProgressBarProps$1, RadioProps as RadioProps$1, RadioGroupProps as RadioGroupProps$1, SelectProps as SelectProps$1, SeparatorProps as SeparatorProps$1, SwitchProps as SwitchProps$1, TabsProps, TabListProps, TabProps, TabPanelProps, TextAreaProps, TimeValue, TimeFieldProps as TimeFieldProps$1, TooltipProps as TooltipProps$1, TooltipTriggerComponentProps } from 'react-aria-components';
|
|
9
9
|
import { ColumnDef, SortingState, OnChangeFn, Row } from '@tanstack/react-table';
|
|
10
|
+
import { Message, Conversation, UpdateDraftRequest, ContactAddress, ConversationClient, SendRecipient } from '@proteos/sdk';
|
|
11
|
+
import * as tailwind_merge from 'tailwind-merge';
|
|
10
12
|
import { ClassValue } from 'clsx';
|
|
11
13
|
|
|
12
14
|
declare const attachmentChipStyles: tailwind_variants.TVReturnType<{
|
|
@@ -1024,6 +1026,157 @@ type DateTimePickerProps<T extends DateValue> = DatePickerProps$1<T> & {
|
|
|
1024
1026
|
};
|
|
1025
1027
|
declare function DateTimePicker<T extends DateValue>({ label, description, errorMessage, size, appearance, className, granularity, hideTimeZone, shouldCloseOnSelect, ...props }: DateTimePickerProps<T>): react_jsx_runtime.JSX.Element;
|
|
1026
1028
|
|
|
1029
|
+
/**
|
|
1030
|
+
* The minimal fetch surface DraftMessageComposer needs, injected per host:
|
|
1031
|
+
* the web app builds it from `useSdk().conversation`, custom components from
|
|
1032
|
+
* `useSdk().conversations` — both via {@link createDraftMessageClient}.
|
|
1033
|
+
*/
|
|
1034
|
+
interface DraftMessageClient {
|
|
1035
|
+
/** One message with projections — also resolves terminal states by id. */
|
|
1036
|
+
getMessage(messageId: string): Promise<Message>;
|
|
1037
|
+
/** The draft's conversation: subject, status (draft ⇒ subject editable), room. */
|
|
1038
|
+
getConversation(conversationId: string): Promise<Conversation>;
|
|
1039
|
+
/** Full-replacement draft edit (PUT semantics — send the complete state). */
|
|
1040
|
+
updateDraft(messageId: string, patch: UpdateDraftRequest): Promise<Message>;
|
|
1041
|
+
/** Deliver the draft (draft → pending → sent/failed). 409 on a lost race. */
|
|
1042
|
+
sendDraft(messageId: string): Promise<Message>;
|
|
1043
|
+
/** Decline the draft (draft → rejected, terminal). 409 on a lost race. */
|
|
1044
|
+
rejectDraft(messageId: string): Promise<Message>;
|
|
1045
|
+
/** Directory search backing the To/Cc/Bcc pickers (email drafts only). */
|
|
1046
|
+
searchRecipients(connectionId: string, q: string): Promise<ContactAddress[]>;
|
|
1047
|
+
}
|
|
1048
|
+
/** What happened to a reviewed draft — the payload of the outcome store. */
|
|
1049
|
+
type DraftMessageOutcome = {
|
|
1050
|
+
type: 'sent';
|
|
1051
|
+
message: Message;
|
|
1052
|
+
} | {
|
|
1053
|
+
type: 'rejected';
|
|
1054
|
+
message: Message;
|
|
1055
|
+
};
|
|
1056
|
+
|
|
1057
|
+
/**
|
|
1058
|
+
* One-liner adapter from the sdk ConversationClient (web app:
|
|
1059
|
+
* `useSdk().conversation`; custom components: `useSdk().conversations`) to
|
|
1060
|
+
* the composer's injected client. Type-only sdk import — no runtime coupling.
|
|
1061
|
+
*/
|
|
1062
|
+
declare function createDraftMessageClient(conversation: Pick<ConversationClient, 'messages' | 'conversations' | 'connections'>): DraftMessageClient;
|
|
1063
|
+
|
|
1064
|
+
interface DraftMessageActions {
|
|
1065
|
+
/** Persists dirty edits, then delivers — the internal Send button's path. */
|
|
1066
|
+
send(): Promise<void>;
|
|
1067
|
+
/** Declines the draft. Bypasses the inline confirm — the external UI owns confirmation. */
|
|
1068
|
+
reject(): Promise<void>;
|
|
1069
|
+
/** Persists the current edits without sending. */
|
|
1070
|
+
saveDraft(): Promise<void>;
|
|
1071
|
+
/** True while the composer is saving/sending/rejecting — disable external buttons. */
|
|
1072
|
+
isBusy: boolean;
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* Registers a composer's handlers for its message id; returns the
|
|
1076
|
+
* unregister. Re-register (a fresh object) whenever isBusy flips so
|
|
1077
|
+
* subscribers re-render. Unregistering only clears the entry while it still
|
|
1078
|
+
* owns it (last-registered wins across overlapping mounts).
|
|
1079
|
+
*/
|
|
1080
|
+
declare function registerDraftMessageActions(messageId: string, actions: DraftMessageActions): () => void;
|
|
1081
|
+
/**
|
|
1082
|
+
* The mounted composer's actions for this draft, or null while none is
|
|
1083
|
+
* mounted (disable the external button).
|
|
1084
|
+
*/
|
|
1085
|
+
declare function useDraftMessageActions(messageId: string): DraftMessageActions | null;
|
|
1086
|
+
/** Test-only escape hatch — clears every registration and listener. */
|
|
1087
|
+
declare function __resetDraftMessageActions(): void;
|
|
1088
|
+
|
|
1089
|
+
declare const draftMessageComposerStyles: tailwind_variants.TVReturnType<{
|
|
1090
|
+
[key: string]: {
|
|
1091
|
+
[key: string]: tailwind_merge.ClassNameValue | {
|
|
1092
|
+
header?: tailwind_merge.ClassNameValue;
|
|
1093
|
+
error?: tailwind_merge.ClassNameValue;
|
|
1094
|
+
actions?: tailwind_merge.ClassNameValue;
|
|
1095
|
+
sender?: tailwind_merge.ClassNameValue;
|
|
1096
|
+
root?: tailwind_merge.ClassNameValue;
|
|
1097
|
+
badge?: tailwind_merge.ClassNameValue;
|
|
1098
|
+
terminal?: tailwind_merge.ClassNameValue;
|
|
1099
|
+
};
|
|
1100
|
+
};
|
|
1101
|
+
} | {
|
|
1102
|
+
[x: string]: {
|
|
1103
|
+
[x: string]: tailwind_merge.ClassNameValue | {
|
|
1104
|
+
header?: tailwind_merge.ClassNameValue;
|
|
1105
|
+
error?: tailwind_merge.ClassNameValue;
|
|
1106
|
+
actions?: tailwind_merge.ClassNameValue;
|
|
1107
|
+
sender?: tailwind_merge.ClassNameValue;
|
|
1108
|
+
root?: tailwind_merge.ClassNameValue;
|
|
1109
|
+
badge?: tailwind_merge.ClassNameValue;
|
|
1110
|
+
terminal?: tailwind_merge.ClassNameValue;
|
|
1111
|
+
};
|
|
1112
|
+
};
|
|
1113
|
+
} | {}, {
|
|
1114
|
+
root: string;
|
|
1115
|
+
header: string;
|
|
1116
|
+
badge: string[];
|
|
1117
|
+
sender: string;
|
|
1118
|
+
actions: string;
|
|
1119
|
+
terminal: string[];
|
|
1120
|
+
error: string;
|
|
1121
|
+
}, undefined, {
|
|
1122
|
+
[key: string]: {
|
|
1123
|
+
[key: string]: tailwind_merge.ClassNameValue | {
|
|
1124
|
+
header?: tailwind_merge.ClassNameValue;
|
|
1125
|
+
error?: tailwind_merge.ClassNameValue;
|
|
1126
|
+
actions?: tailwind_merge.ClassNameValue;
|
|
1127
|
+
sender?: tailwind_merge.ClassNameValue;
|
|
1128
|
+
root?: tailwind_merge.ClassNameValue;
|
|
1129
|
+
badge?: tailwind_merge.ClassNameValue;
|
|
1130
|
+
terminal?: tailwind_merge.ClassNameValue;
|
|
1131
|
+
};
|
|
1132
|
+
};
|
|
1133
|
+
} | {}, {
|
|
1134
|
+
root: string;
|
|
1135
|
+
header: string;
|
|
1136
|
+
badge: string[];
|
|
1137
|
+
sender: string;
|
|
1138
|
+
actions: string;
|
|
1139
|
+
terminal: string[];
|
|
1140
|
+
error: string;
|
|
1141
|
+
}, tailwind_variants.TVReturnType<unknown, {
|
|
1142
|
+
root: string;
|
|
1143
|
+
header: string;
|
|
1144
|
+
badge: string[];
|
|
1145
|
+
sender: string;
|
|
1146
|
+
actions: string;
|
|
1147
|
+
terminal: string[];
|
|
1148
|
+
error: string;
|
|
1149
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
1150
|
+
interface DraftMessageComposerProps {
|
|
1151
|
+
/** The status=draft message to review. */
|
|
1152
|
+
messageId: string;
|
|
1153
|
+
/** Injected fetch surface — see createDraftMessageClient. */
|
|
1154
|
+
client: DraftMessageClient;
|
|
1155
|
+
/** Fires once the draft delivered (send resolved pending/sent). */
|
|
1156
|
+
onSent?: (message: Message) => void;
|
|
1157
|
+
/** Fires once the draft was declined. */
|
|
1158
|
+
onRejected?: (message: Message) => void;
|
|
1159
|
+
/**
|
|
1160
|
+
* Default true. When false the internal Send / Save draft / Reject row is
|
|
1161
|
+
* hidden — the composer becomes a pure preview/edit surface driven by
|
|
1162
|
+
* external controls via useDraftMessageActions.
|
|
1163
|
+
*/
|
|
1164
|
+
showActions?: boolean;
|
|
1165
|
+
className?: string;
|
|
1166
|
+
}
|
|
1167
|
+
declare function DraftMessageComposer({ messageId, client, onSent, onRejected, showActions, className, }: DraftMessageComposerProps): react_jsx_runtime.JSX.Element;
|
|
1168
|
+
|
|
1169
|
+
declare function publishDraftMessageOutcome(messageId: string, outcome: DraftMessageOutcome): void;
|
|
1170
|
+
declare function subscribeDraftMessageOutcome(messageId: string, listener: () => void): () => void;
|
|
1171
|
+
/**
|
|
1172
|
+
* The last outcome for this draft, or null while it is still under review.
|
|
1173
|
+
* Re-renders when the outcome lands — including for subscribers that mounted
|
|
1174
|
+
* after it (last-value replay).
|
|
1175
|
+
*/
|
|
1176
|
+
declare function useDraftMessageOutcome(messageId: string): DraftMessageOutcome | null;
|
|
1177
|
+
/** Test-only escape hatch — clears every stored outcome and listener. */
|
|
1178
|
+
declare function __resetDraftMessageOutcomes(): void;
|
|
1179
|
+
|
|
1027
1180
|
declare const emptyStateStyles: tailwind_variants.TVReturnType<{
|
|
1028
1181
|
size: {
|
|
1029
1182
|
sm: {
|
|
@@ -1253,6 +1406,102 @@ type MenuItemProps = Omit<MenuItemProps$1, 'children'> & {
|
|
|
1253
1406
|
/** A single menu row. Pass `onAction` to handle selection; `isDisabled` to dim it. */
|
|
1254
1407
|
declare function MenuItem({ icon, hasSubmenu, children, className, ...props }: MenuItemProps): react_jsx_runtime.JSX.Element;
|
|
1255
1408
|
|
|
1409
|
+
/** Controlled text + subject. Draft persistence lives with the host. */
|
|
1410
|
+
interface ComposerValue {
|
|
1411
|
+
text: string;
|
|
1412
|
+
subject?: string;
|
|
1413
|
+
}
|
|
1414
|
+
interface ComposerSendInput {
|
|
1415
|
+
text: string;
|
|
1416
|
+
subject?: string;
|
|
1417
|
+
/** Only when the composer owns addressing (`showToField` — compose). */
|
|
1418
|
+
to?: SendRecipient[];
|
|
1419
|
+
cc?: SendRecipient[];
|
|
1420
|
+
bcc?: SendRecipient[];
|
|
1421
|
+
}
|
|
1422
|
+
/** The compose view's connection switcher, rendered as the composer's top row. */
|
|
1423
|
+
interface ComposerConnectionPicker {
|
|
1424
|
+
options: ReadonlyArray<{
|
|
1425
|
+
id: string;
|
|
1426
|
+
/** Rich render (channel icon + name); `textValue` carries the plain name. */
|
|
1427
|
+
label: ReactNode;
|
|
1428
|
+
textValue: string;
|
|
1429
|
+
}>;
|
|
1430
|
+
selectedId: string;
|
|
1431
|
+
onSelect: (connectionId: string) => void;
|
|
1432
|
+
}
|
|
1433
|
+
/** Presentational attachment chip input — hosts map their own upload model onto it. */
|
|
1434
|
+
interface ComposerAttachment {
|
|
1435
|
+
localId: string;
|
|
1436
|
+
name: string;
|
|
1437
|
+
/** Bytes when known — server-loaded attachments may not know their size. */
|
|
1438
|
+
sizeInBytes?: number;
|
|
1439
|
+
contentType?: string;
|
|
1440
|
+
status: 'uploading' | 'ready' | 'error';
|
|
1441
|
+
errorMessage?: string;
|
|
1442
|
+
}
|
|
1443
|
+
/** Directory search backing the To/Cc/Bcc pickers — injected per host (the lib never fetches). */
|
|
1444
|
+
type SearchRecipients = (connectionId: string, q: string) => Promise<ContactAddress[]>;
|
|
1445
|
+
/** Per-file cap for conversation-channel sends (the backend rejects larger
|
|
1446
|
+
* with `attachment_too_large`; Slack additionally caps at 10 files/message,
|
|
1447
|
+
* surfaced through the send error line). */
|
|
1448
|
+
declare const MAX_COMPOSER_ATTACHMENT_BYTES: number;
|
|
1449
|
+
/** Outer box chrome — exported so hosts can re-apply the same shell. */
|
|
1450
|
+
declare const messageComposerStyles: tailwind_variants.TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, tailwind_variants.TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
|
|
1451
|
+
interface MessageComposerProps {
|
|
1452
|
+
mode: 'chat' | 'email';
|
|
1453
|
+
/** Controlled text+subject (draft persistence lives with the host). */
|
|
1454
|
+
value: ComposerValue;
|
|
1455
|
+
onValueChange: (value: ComposerValue) => void;
|
|
1456
|
+
placeholder: string;
|
|
1457
|
+
/** Email replies arrive with `re: <subject>` prefilled. */
|
|
1458
|
+
subjectPrefill?: string;
|
|
1459
|
+
/** When true (email mode), the Subject row renders the subject as static
|
|
1460
|
+
* text — reply drafts where the subject is derived from the thread and
|
|
1461
|
+
* must not be edited. The Cc/Bcc reveal stays functional. Default false. */
|
|
1462
|
+
isSubjectReadOnly?: boolean;
|
|
1463
|
+
/** When set, the composer is replaced by this banner (ended conversation,
|
|
1464
|
+
* read-only transcript). */
|
|
1465
|
+
disabledReason?: ReactNode;
|
|
1466
|
+
onSend: (input: ComposerSendInput) => Promise<unknown>;
|
|
1467
|
+
/** Connection whose directory backs the To/Cc/Bcc pickers. */
|
|
1468
|
+
connectionId?: string;
|
|
1469
|
+
/** Compose only: a connection switcher as the composer's top row. */
|
|
1470
|
+
connectionPicker?: ComposerConnectionPicker;
|
|
1471
|
+
/** Compose only: the composer owns addressing — a To recipient row; the
|
|
1472
|
+
* picks arrive on `ComposerSendInput.to` and gate send. */
|
|
1473
|
+
showToField?: boolean;
|
|
1474
|
+
/** Email originate only: reveal Cc/Bcc recipient rows. */
|
|
1475
|
+
showRecipientFields?: boolean;
|
|
1476
|
+
/** Required for the To/Cc/Bcc rows to render (with `connectionId`). */
|
|
1477
|
+
searchRecipients?: SearchRecipients;
|
|
1478
|
+
/** Controlled-if-provided recipients; internal state otherwise. Internal
|
|
1479
|
+
* recipient state resets when `connectionId` changes and clears after a
|
|
1480
|
+
* successful send — controlled parents own their own resets. */
|
|
1481
|
+
to?: SendRecipient[];
|
|
1482
|
+
cc?: SendRecipient[];
|
|
1483
|
+
bcc?: SendRecipient[];
|
|
1484
|
+
onToChange?: (next: SendRecipient[]) => void;
|
|
1485
|
+
onCcChange?: (next: SendRecipient[]) => void;
|
|
1486
|
+
onBccChange?: (next: SendRecipient[]) => void;
|
|
1487
|
+
/** The host-owned pending queue, rendered as chips above the input. */
|
|
1488
|
+
attachments?: ComposerAttachment[];
|
|
1489
|
+
/** When set, the paperclip renders and picked files flow to the host. */
|
|
1490
|
+
onAddFiles?: (files: File[]) => void;
|
|
1491
|
+
onRemoveAttachment?: (localId: string) => void;
|
|
1492
|
+
/** True while any attachment is still uploading — blocks send. */
|
|
1493
|
+
hasUploadingAttachments?: boolean;
|
|
1494
|
+
/**
|
|
1495
|
+
* Default true. When false: the send button AND the keybinding hint are
|
|
1496
|
+
* hidden and the ↵/⌘↵ submit combo is disabled — submission is fully
|
|
1497
|
+
* delegated to an external driver (e.g. the draft review surface).
|
|
1498
|
+
*/
|
|
1499
|
+
showSendButton?: boolean;
|
|
1500
|
+
/** Composes onto the outer box chrome (`messageComposerStyles`). */
|
|
1501
|
+
className?: string;
|
|
1502
|
+
}
|
|
1503
|
+
declare function MessageComposer({ mode, value, onValueChange, placeholder, subjectPrefill, isSubjectReadOnly, disabledReason, onSend, connectionId, connectionPicker, showToField, showRecipientFields, searchRecipients, to: toProp, cc: ccProp, bcc: bccProp, onToChange, onCcChange, onBccChange, attachments, onAddFiles, onRemoveAttachment, hasUploadingAttachments, showSendButton, className, }: MessageComposerProps): react_jsx_runtime.JSX.Element;
|
|
1504
|
+
|
|
1256
1505
|
/** Stateful root. Pass `isOpen` + `onOpenChange` for controlled usage. */
|
|
1257
1506
|
declare function Modal(props: DialogTriggerProps): react_jsx_runtime.JSX.Element;
|
|
1258
1507
|
type ModalContentProps = ModalOverlayProps & {
|
|
@@ -1470,6 +1719,15 @@ type RadioProps = Omit<RadioProps$1, 'children'> & {
|
|
|
1470
1719
|
};
|
|
1471
1720
|
declare function Radio({ children, className, ...props }: RadioProps): react_jsx_runtime.JSX.Element;
|
|
1472
1721
|
|
|
1722
|
+
interface RecipientSelectProps {
|
|
1723
|
+
connectionId: string;
|
|
1724
|
+
searchRecipients: SearchRecipients;
|
|
1725
|
+
value: SendRecipient[];
|
|
1726
|
+
onChange: (next: SendRecipient[]) => void;
|
|
1727
|
+
placeholder?: string;
|
|
1728
|
+
}
|
|
1729
|
+
declare function RecipientSelect({ connectionId, searchRecipients, value, onChange, placeholder, }: RecipientSelectProps): react_jsx_runtime.JSX.Element;
|
|
1730
|
+
|
|
1473
1731
|
type FilterFieldType = Exclude<AttributeType, 'object'>;
|
|
1474
1732
|
type FilterFieldOption = {
|
|
1475
1733
|
value: string;
|
|
@@ -2123,4 +2381,4 @@ declare function Tooltip({ className, offset, ...props }: TooltipProps): react_j
|
|
|
2123
2381
|
|
|
2124
2382
|
declare function cn(...inputs: ClassValue[]): string;
|
|
2125
2383
|
|
|
2126
|
-
export { ATTRIBUTE_TYPES, ATTRIBUTE_TYPE_ICONS, type ActionsColumnOptions, AttachmentChip, type AttachmentChipProps, type AttachmentChipVariants, AttributePicker, type AttributePickerProps, AttributeType, AttributeTypeIcon, type AttributeTypeIconProps, Avatar, AvatarGroup, type AvatarGroupItem, type AvatarGroupProps, type AvatarGroupVariants, type AvatarProps, type AvatarVariants, Badge, BadgeMultiSelect, type BadgeMultiSelectOption, type BadgeMultiSelectProps, type BadgeProps, type BadgeVariants, BooleanCell, type BooleanCellProps, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonProps, type ButtonVariants, COLUMN_DRAG_KIND, Card, CardBody, CardContent, CardEyebrow, CardFeatureTitle, CardFooter, CardHeader, type CardProps, CardTitle, type CardVariants, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, ChipValue, type ChipValueItemRenderer, type ChipValueProps, type ColumnDragData, Combobox, type ComboboxOption, type ComboboxProps, Command, CommandHint, type CommandHintProps, type CommandHintTone, type CommandProps, type ComparisonOperator, CurrencyInput, type CurrencyInputOption, type CurrencyInputProps, type CurrencyInputValue, DataTable, DataTableEmpty, type DataTableEmptyProps, DataTableError, type DataTableErrorProps, type DataTableProps, DataTableSkeleton, type DataTableSkeletonProps, DateCell, type DateCellProps, DatePicker, type DatePickerProps, DateTimeCell, type DateTimeCellProps, DateTimePicker, type DateTimePickerProps, EmptyState, type EmptyStateProps, type EmptyStateVariants, ErrorAnimation, type ErrorAnimationProps, type FieldAppearance, FieldCaret, type FieldControlVariants, type FieldSize, FileField, type FileFieldProps, type FileFieldValue, FileViewer, FileViewerFallbackCard, type FileViewerFallbackCardProps, type FileViewerFallbackCardVariants, type FileViewerKind, type FileViewerProps, type FileViewerVariants, type FilterElement, type FilterField, type FilterFieldOption, type FilterFieldRelation, type FilterFieldType, type FilterGroup, FilterRow, type FilterRowProps, type FilterValue, FilterValueInput, type FilterValueInputProps, type FilterValueInputRenderer, ImageAttachment, type ImageAttachmentProps, type ImageAttachmentVariants, ImageLightbox, type ImageLightboxProps, type ImageLightboxVariants, type InfiniteQueryLike, Input, type InputProps, Kbd, type KbdProps, type KeyCombo, LinkCell, type LinkCellProps, type LogicalOperator, Menu, MenuItem, type MenuItemProps, MenuPopover, type MenuPopoverProps, type MenuProps, MenuTrigger, Modal, ModalBody, ModalContent, type ModalContentProps, ModalDescription, ModalFooter, ModalHeader, ModalTitle, MultiSelect, type MultiSelectOption, type MultiSelectProps, NavGroup, type NavGroupProps, NavItem, type NavItemProps, type NavItemVariants, NavSection, type NavSectionProps, OPERATORS, type OperatorArity, type OperatorDescriptor, OperatorPicker, type OperatorPickerProps, PROTECTED_COMBOS, Popover, PopoverContent, type PopoverContentProps, PopoverPanelBody, PopoverPanelFooter, PopoverPanelHeader, PressableCard, type PressableCardProps, ProgressBar, type ProgressBarProps, type ProgressBarVariants, Radio, RadioGroup, type RadioGroupProps, type RadioProps, RecordFilterBuilderPanel, type RecordFilterBuilderPanelProps, RecordFilterButton, type RecordFilterButtonProps, RecordFilterChips, type RecordFilterChipsProps, RecordFilterEditor, type RecordFilterEditorProps, RenderChipItemProvider, RenderValueInputProvider, SegmentedControl, type SegmentedControlOption, type SegmentedControlProps, type SegmentedControlVariants, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Skeleton, type SkeletonProps, type SkeletonVariants, type SortDirection, SubmenuTrigger, SuccessAnimation, type SuccessAnimationProps, Switch, type SwitchProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableHeader, TableHeaderCell, type TableHeaderCellProps, type TableHeaderProps, TableHeaderSpacer, type TableProps, TableRow, type TableRowProps, TableScroller, type TableVariants, Tabs, type TabsListProps, type TabsPanelProps, type TabsRootProps, type TabsTriggerProps, type TabsVariants, TagInput, type TagInputProps, Textarea, type TextareaProps, TimeField, type TimeFieldProps, Tooltip, type TooltipProps, TooltipTrigger, TruncateCell, type TruncateCellProps, type UseCommandOptions, type UseEscapeKeyOptions, type UseInfiniteScrollSentinelOptions, addLeaf as addFilterLeaf, addPendingLeaf, addSubgroup, arityOf, attachmentChipStyles, avatarGroupStyles, avatarStyles, badgeStyles, buttonStyles, cardStyles, cn, countLeaves, defaultValueFor, emptyStateStyles, fieldControlStyles, fieldErrorStyles, fieldHintStyles, fieldLabelStyles, fileViewerFallbackCardStyles, fileViewerStyles, formatFileSize, formatValue, iconForContentType, imageAttachmentStyles, imageLightboxStyles, isColumnDragData, isEditableTarget, isPreviewableImageName, makeActionsColumn, navItemStyles, operatorById, operatorsForType, parseCombo, progressBarStyles, rebaseRowOnFieldChange, rebaseRowOnOperatorChange, removeLeaf, removeSubgroup, replaceLeaf, segmentedControlStyles, setJoiner, skeletonStyles, tableCellStyles, tableHeaderCellStyles, tabsStyles, updateLeaf, updateSubgroup, useAttributeTypeIcon, useCommand, useDiscoveryActive, useEscapeKey, useInfiniteScrollSentinel, useRenderChipItem, useRenderValueInput, useShowDetails, viewerKindForContentType, wrapLeafInGroup };
|
|
2384
|
+
export { ATTRIBUTE_TYPES, ATTRIBUTE_TYPE_ICONS, type ActionsColumnOptions, AttachmentChip, type AttachmentChipProps, type AttachmentChipVariants, AttributePicker, type AttributePickerProps, AttributeType, AttributeTypeIcon, type AttributeTypeIconProps, Avatar, AvatarGroup, type AvatarGroupItem, type AvatarGroupProps, type AvatarGroupVariants, type AvatarProps, type AvatarVariants, Badge, BadgeMultiSelect, type BadgeMultiSelectOption, type BadgeMultiSelectProps, type BadgeProps, type BadgeVariants, BooleanCell, type BooleanCellProps, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonProps, type ButtonVariants, COLUMN_DRAG_KIND, Card, CardBody, CardContent, CardEyebrow, CardFeatureTitle, CardFooter, CardHeader, type CardProps, CardTitle, type CardVariants, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, ChipValue, type ChipValueItemRenderer, type ChipValueProps, type ColumnDragData, Combobox, type ComboboxOption, type ComboboxProps, Command, CommandHint, type CommandHintProps, type CommandHintTone, type CommandProps, type ComparisonOperator, type ComposerAttachment, type ComposerConnectionPicker, type ComposerSendInput, type ComposerValue, CurrencyInput, type CurrencyInputOption, type CurrencyInputProps, type CurrencyInputValue, DataTable, DataTableEmpty, type DataTableEmptyProps, DataTableError, type DataTableErrorProps, type DataTableProps, DataTableSkeleton, type DataTableSkeletonProps, DateCell, type DateCellProps, DatePicker, type DatePickerProps, DateTimeCell, type DateTimeCellProps, DateTimePicker, type DateTimePickerProps, type DraftMessageActions, type DraftMessageClient, DraftMessageComposer, type DraftMessageComposerProps, type DraftMessageOutcome, EmptyState, type EmptyStateProps, type EmptyStateVariants, ErrorAnimation, type ErrorAnimationProps, type FieldAppearance, FieldCaret, type FieldControlVariants, type FieldSize, FileField, type FileFieldProps, type FileFieldValue, FileViewer, FileViewerFallbackCard, type FileViewerFallbackCardProps, type FileViewerFallbackCardVariants, type FileViewerKind, type FileViewerProps, type FileViewerVariants, type FilterElement, type FilterField, type FilterFieldOption, type FilterFieldRelation, type FilterFieldType, type FilterGroup, FilterRow, type FilterRowProps, type FilterValue, FilterValueInput, type FilterValueInputProps, type FilterValueInputRenderer, ImageAttachment, type ImageAttachmentProps, type ImageAttachmentVariants, ImageLightbox, type ImageLightboxProps, type ImageLightboxVariants, type InfiniteQueryLike, Input, type InputProps, Kbd, type KbdProps, type KeyCombo, LinkCell, type LinkCellProps, type LogicalOperator, MAX_COMPOSER_ATTACHMENT_BYTES, Menu, MenuItem, type MenuItemProps, MenuPopover, type MenuPopoverProps, type MenuProps, MenuTrigger, MessageComposer, type MessageComposerProps, Modal, ModalBody, ModalContent, type ModalContentProps, ModalDescription, ModalFooter, ModalHeader, ModalTitle, MultiSelect, type MultiSelectOption, type MultiSelectProps, NavGroup, type NavGroupProps, NavItem, type NavItemProps, type NavItemVariants, NavSection, type NavSectionProps, OPERATORS, type OperatorArity, type OperatorDescriptor, OperatorPicker, type OperatorPickerProps, PROTECTED_COMBOS, Popover, PopoverContent, type PopoverContentProps, PopoverPanelBody, PopoverPanelFooter, PopoverPanelHeader, PressableCard, type PressableCardProps, ProgressBar, type ProgressBarProps, type ProgressBarVariants, Radio, RadioGroup, type RadioGroupProps, type RadioProps, RecipientSelect, type RecipientSelectProps, RecordFilterBuilderPanel, type RecordFilterBuilderPanelProps, RecordFilterButton, type RecordFilterButtonProps, RecordFilterChips, type RecordFilterChipsProps, RecordFilterEditor, type RecordFilterEditorProps, RenderChipItemProvider, RenderValueInputProvider, type SearchRecipients, SegmentedControl, type SegmentedControlOption, type SegmentedControlProps, type SegmentedControlVariants, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Skeleton, type SkeletonProps, type SkeletonVariants, type SortDirection, SubmenuTrigger, SuccessAnimation, type SuccessAnimationProps, Switch, type SwitchProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableHeader, TableHeaderCell, type TableHeaderCellProps, type TableHeaderProps, TableHeaderSpacer, type TableProps, TableRow, type TableRowProps, TableScroller, type TableVariants, Tabs, type TabsListProps, type TabsPanelProps, type TabsRootProps, type TabsTriggerProps, type TabsVariants, TagInput, type TagInputProps, Textarea, type TextareaProps, TimeField, type TimeFieldProps, Tooltip, type TooltipProps, TooltipTrigger, TruncateCell, type TruncateCellProps, type UseCommandOptions, type UseEscapeKeyOptions, type UseInfiniteScrollSentinelOptions, __resetDraftMessageActions, __resetDraftMessageOutcomes, addLeaf as addFilterLeaf, addPendingLeaf, addSubgroup, arityOf, attachmentChipStyles, avatarGroupStyles, avatarStyles, badgeStyles, buttonStyles, cardStyles, cn, countLeaves, createDraftMessageClient, defaultValueFor, draftMessageComposerStyles, emptyStateStyles, fieldControlStyles, fieldErrorStyles, fieldHintStyles, fieldLabelStyles, fileViewerFallbackCardStyles, fileViewerStyles, formatFileSize, formatValue, iconForContentType, imageAttachmentStyles, imageLightboxStyles, isColumnDragData, isEditableTarget, isPreviewableImageName, makeActionsColumn, messageComposerStyles, navItemStyles, operatorById, operatorsForType, parseCombo, progressBarStyles, publishDraftMessageOutcome, rebaseRowOnFieldChange, rebaseRowOnOperatorChange, registerDraftMessageActions, removeLeaf, removeSubgroup, replaceLeaf, segmentedControlStyles, setJoiner, skeletonStyles, subscribeDraftMessageOutcome, tableCellStyles, tableHeaderCellStyles, tabsStyles, updateLeaf, updateSubgroup, useAttributeTypeIcon, useCommand, useDiscoveryActive, useDraftMessageActions, useDraftMessageOutcome, useEscapeKey, useInfiniteScrollSentinel, useRenderChipItem, useRenderValueInput, useShowDetails, viewerKindForContentType, wrapLeafInGroup };
|