@stealthscale/component-messaging 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,826 @@
1
+ import { ComponentProps, ReactElement, ReactNode } from "react";
2
+ import { ButtonProps } from "@stealthscale/component-actions";
3
+ import { ScrollArea } from "@stealthscale/component-primitives";
4
+ import { StickToBottomInstance } from "use-stick-to-bottom";
5
+ import { Popover } from "@stealthscale/component-disclosure";
6
+ //#region src/attachment/actions.d.ts
7
+ /**
8
+ * Renders the actions' `div`.
9
+ */
10
+ declare const Actions$1: import("@stealthscale/theme").StyledComponent<"div", {}>;
11
+ /**
12
+ * Describes the props of `Actions`.
13
+ */
14
+ type ActionsProps$1 = ComponentProps<typeof Actions$1>;
15
+ //#endregion
16
+ //#region src/attachment/content.d.ts
17
+ /**
18
+ * Renders the column's `div`.
19
+ */
20
+ declare const Content$2: import("@stealthscale/theme").StyledComponent<"div", {}>;
21
+ /**
22
+ * Describes the props of `Content`.
23
+ */
24
+ type ContentProps$2 = ComponentProps<typeof Content$2>;
25
+ //#endregion
26
+ //#region src/attachment/description.d.ts
27
+ /**
28
+ * Renders the description's `span`.
29
+ */
30
+ declare const Description: import("@stealthscale/theme").StyledComponent<"span", {}>;
31
+ /**
32
+ * Describes the props of `Description`.
33
+ */
34
+ type DescriptionProps = ComponentProps<typeof Description>;
35
+ //#endregion
36
+ //#region src/attachment/group.d.ts
37
+ /**
38
+ * Renders the `ul` with the attachment's group class.
39
+ */
40
+ declare const Listed: import("@stealthscale/theme").StyledComponent<"ul", {
41
+ readonly orientation?: "horizontal" | "vertical";
42
+ readonly size?: "md" | "sm" | "xs";
43
+ }>;
44
+ /**
45
+ * Describes the props of the group: the size and orientation of its attachments, and the props of
46
+ * a `ul`.
47
+ */
48
+ type GroupProps = ComponentProps<typeof Listed>;
49
+ /**
50
+ * Renders the list and provides its size and orientation to the attachments inside.
51
+ *
52
+ * @param props - The size and orientation of the attachments, and the props of a `ul`.
53
+ * @returns The `ul` element inside the provider.
54
+ */
55
+ declare function Group(props: GroupProps): ReactElement;
56
+ //#endregion
57
+ //#region src/attachment/media.d.ts
58
+ /**
59
+ * Renders the media square's `div`.
60
+ */
61
+ declare const Media: import("@stealthscale/theme").StyledComponent<"div", {}>;
62
+ /**
63
+ * Describes the props of `Media`.
64
+ */
65
+ type MediaProps = ComponentProps<typeof Media>;
66
+ //#endregion
67
+ //#region src/attachment/root.d.ts
68
+ /**
69
+ * Renders the `div` with the attachment's variants.
70
+ */
71
+ declare const Framed: import("@stealthscale/theme").StyledComponent<"div", {
72
+ readonly orientation?: "horizontal" | "vertical";
73
+ readonly size?: "md" | "sm" | "xs";
74
+ }>;
75
+ /**
76
+ * Lists the states of an attachment.
77
+ */
78
+ type AttachmentState = "done" | "error" | "idle" | "processing" | "uploading";
79
+ /**
80
+ * Describes the props of an attachment: its state, the recipe's variants and the props of a `div`.
81
+ */
82
+ interface RootProps$4 extends ComponentProps<typeof Framed> {
83
+ /**
84
+ * Where the file is on its way, `done` unless stated.
85
+ */
86
+ readonly state?: AttachmentState | undefined;
87
+ }
88
+ /**
89
+ * Renders the attachment, an `li` inside a group.
90
+ *
91
+ * @param props - The state, the recipe's variants and the props of a `div`.
92
+ * @returns The `div` or `li` element.
93
+ */
94
+ declare function Root$4({ orientation, size, state, ...props }: RootProps$4): ReactElement;
95
+ //#endregion
96
+ //#region src/attachment/title.d.ts
97
+ /**
98
+ * Renders the title's `span`.
99
+ */
100
+ declare const Title: import("@stealthscale/theme").StyledComponent<"span", {}>;
101
+ /**
102
+ * Describes the props of `Title`.
103
+ */
104
+ type TitleProps = ComponentProps<typeof Title>;
105
+ declare namespace index_d_exports {
106
+ export { Actions$1 as Actions, ActionsProps$1 as ActionsProps, AttachmentState, Content$2 as Content, ContentProps$2 as ContentProps, Description, DescriptionProps, Group, GroupProps, Media, MediaProps, Root$4 as Root, RootProps$4 as RootProps, Title, TitleProps };
107
+ }
108
+ //#endregion
109
+ //#region src/composer/attach-trigger.d.ts
110
+ /**
111
+ * Describes the props of the attach control: its name, the files it accepts, and the props of the
112
+ * actions `Button`.
113
+ */
114
+ interface AttachTriggerProps extends ButtonProps {
115
+ /**
116
+ * File types the picker offers, as an `input`'s `accept` attribute takes them.
117
+ */
118
+ readonly accept?: string | undefined;
119
+ /**
120
+ * Accessible name of the control, "Attach files" unless stated.
121
+ */
122
+ readonly label?: string | undefined;
123
+ }
124
+ /**
125
+ * Renders the control and the hidden file input.
126
+ *
127
+ * @param props - The name, the accepted types and the props of the actions `Button`, the glyph
128
+ * among its children.
129
+ * @returns The `button` element and the `input` element.
130
+ */
131
+ declare function AttachTrigger({ accept, label, onClick, ...props }: AttachTriggerProps): ReactElement;
132
+ //#endregion
133
+ //#region src/composer/attachments.d.ts
134
+ /**
135
+ * Renders the row's `div`.
136
+ */
137
+ declare const Attachments: import("@stealthscale/theme").StyledComponent<"div", {}>;
138
+ /**
139
+ * Describes the props of `Attachments`.
140
+ */
141
+ type AttachmentsProps = ComponentProps<typeof Attachments>;
142
+ //#endregion
143
+ //#region src/composer/context-strip.d.ts
144
+ /**
145
+ * Renders the strip's `div`.
146
+ */
147
+ declare const Context: import("@stealthscale/theme").StyledComponent<"div", {}>;
148
+ /**
149
+ * Describes the props of `Context`.
150
+ */
151
+ type ContextProps = ComponentProps<typeof Context>;
152
+ //#endregion
153
+ //#region src/composer/mentions.d.ts
154
+ /**
155
+ * Finds the mention a reader is typing at the caret, and writes a chosen name in its place.
156
+ *
157
+ * @remarks
158
+ * A trigger character opens a query only at the start of the text or after whitespace, so
159
+ * `ada@example.com` is an address and not a mention of `example.com`. Whitespace ends a query: a
160
+ * term never spans a space or a line break. So at most one trigger opens a query at the caret: a
161
+ * second trigger after the first needs whitespace before it, which ends the first query. The text
162
+ * keeps the name the reader sees, such as `@Ada Okafor`, and a space after it.
163
+ */
164
+ /**
165
+ * Describes the mention a reader is typing.
166
+ */
167
+ interface Query {
168
+ /**
169
+ * Index of the trigger character in the text.
170
+ */
171
+ readonly from: number;
172
+ /**
173
+ * The text typed after the trigger, up to the caret, without whitespace.
174
+ */
175
+ readonly term: string;
176
+ /**
177
+ * The trigger character, such as `@`.
178
+ */
179
+ readonly trigger: string;
180
+ }
181
+ //#endregion
182
+ //#region src/composer/use-mentions.d.ts
183
+ /**
184
+ * Describes one suggestion: the name inserted and a line that tells two names apart.
185
+ */
186
+ interface Suggestion {
187
+ /**
188
+ * Line under the name, such as a team or an email address.
189
+ */
190
+ readonly description?: string | undefined;
191
+ /**
192
+ * Identifier of the suggestion, unique among the suggestions.
193
+ */
194
+ readonly id: string;
195
+ /**
196
+ * The name listed and inserted after the trigger.
197
+ */
198
+ readonly label: string;
199
+ }
200
+ /**
201
+ * Describes the mention options the textarea takes.
202
+ */
203
+ interface MentionOptions {
204
+ /**
205
+ * Called with the suggestion inserted and the query it replaced.
206
+ */
207
+ readonly onMention?: ((suggestion: Suggestion, query: Query) => void) | undefined;
208
+ /**
209
+ * Called with the query at the caret whenever it changes, undefined outside every mention.
210
+ */
211
+ readonly onQueryChange?: ((query: Query | undefined) => void) | undefined;
212
+ /**
213
+ * The suggestions for the query, which the caller finds from the term.
214
+ */
215
+ readonly suggestions?: readonly Suggestion[] | undefined;
216
+ /**
217
+ * The characters that open a mention, such as `@` and `#`.
218
+ */
219
+ readonly triggers?: readonly string[] | undefined;
220
+ }
221
+ //#endregion
222
+ //#region src/composer/input.d.ts
223
+ /**
224
+ * Renders the `textarea` with the composer's input class.
225
+ */
226
+ declare const Typed: import("@stealthscale/theme").StyledComponent<"textarea", {}>;
227
+ /**
228
+ * Describes the props of the input: its name, its row limit, the mention options, and the props of
229
+ * a `textarea` without the value and the style, which the composer sets.
230
+ */
231
+ interface InputProps extends MentionOptions, Omit<ComponentProps<typeof Typed>, "defaultValue" | "style" | "value"> {
232
+ /**
233
+ * Accessible name of the textarea, "Message" unless stated.
234
+ */
235
+ readonly label?: string | undefined;
236
+ /**
237
+ * Most lines the textarea grows to before it scrolls, 8 unless stated.
238
+ */
239
+ readonly maxRows?: number | undefined;
240
+ /**
241
+ * Accessible name of the list of suggestions, "Suggestions" unless stated.
242
+ */
243
+ readonly suggestionsLabel?: string | undefined;
244
+ }
245
+ /**
246
+ * Renders the textarea with the composer's text and keys, and the list of suggestions.
247
+ *
248
+ * @param props - The name, the row limit, the mention options and the props of a `textarea`.
249
+ * @returns The `textarea` element and the list.
250
+ */
251
+ declare function Input({ label, maxRows, onBlur, onChange, onKeyDown, onMention, onPaste, onQueryChange, onSelect, ref: handed, suggestions, suggestionsLabel, triggers, ...props }: InputProps): ReactElement;
252
+ //#endregion
253
+ //#region src/composer/state.d.ts
254
+ /**
255
+ * Provides what the composer's root knows to its parts: the text, whether it can be sent, and the
256
+ * handlers the parts call.
257
+ */
258
+ /**
259
+ * Lists the keys that send: Enter, with Shift+Enter for a new line, or Ctrl+Enter and Cmd+Enter,
260
+ * with Enter for a new line.
261
+ */
262
+ type SubmitKey = "enter" | "modEnter";
263
+ //#endregion
264
+ //#region src/composer/root.d.ts
265
+ /**
266
+ * Renders the `form` with the composer's variants.
267
+ */
268
+ declare const Form: import("@stealthscale/theme").StyledComponent<"form", {
269
+ readonly size?: "lg" | "md" | "sm";
270
+ readonly variant?: import("@stealthscale/theme/authoring").Field;
271
+ }>;
272
+ /**
273
+ * Describes the props of the root: the text, the states, the handlers and the props of a `form`,
274
+ * without the element's `onSubmit` event, which the text handler replaces.
275
+ */
276
+ interface RootProps$3 extends Omit<ComponentProps<typeof Form>, "defaultValue" | "onSubmit"> {
277
+ /**
278
+ * Whether files are attached, which makes a message without text one that can be sent.
279
+ */
280
+ readonly attached?: boolean | undefined;
281
+ /**
282
+ * Whether a response is running: the composer sends nothing, and the submit control stops the
283
+ * response where `onStop` is set.
284
+ */
285
+ readonly busy?: boolean | undefined;
286
+ /**
287
+ * Text of a composer the caller does not control.
288
+ */
289
+ readonly defaultValue?: string | undefined;
290
+ /**
291
+ * Whether the composer takes no input.
292
+ */
293
+ readonly disabled?: boolean | undefined;
294
+ /**
295
+ * Called with the files a reader picks, drops or pastes. Without it the composer attaches
296
+ * nothing.
297
+ */
298
+ readonly onAttach?: ((files: File[]) => void) | undefined;
299
+ /**
300
+ * Called when Escape in the textarea dismisses the message the composer replies to.
301
+ */
302
+ readonly onCancelContext?: (() => void) | undefined;
303
+ /**
304
+ * Called when ArrowUp in an empty textarea asks to edit the reader's last message.
305
+ */
306
+ readonly onEditLast?: (() => void) | undefined;
307
+ /**
308
+ * Called when the submit control interrupts a running response.
309
+ */
310
+ readonly onStop?: (() => void) | undefined;
311
+ /**
312
+ * Called with the text, trimmed, when the reader sends it.
313
+ */
314
+ readonly onSubmit?: ((value: string) => void) | undefined;
315
+ /**
316
+ * Called with the text on every change.
317
+ */
318
+ readonly onValueChange?: ((value: string) => void) | undefined;
319
+ /**
320
+ * Keys that send, `enter` unless stated.
321
+ */
322
+ readonly submitOn?: SubmitKey | undefined;
323
+ /**
324
+ * Controlled text.
325
+ */
326
+ readonly value?: string | undefined;
327
+ }
328
+ /**
329
+ * Renders the form and provides the text and the handlers to its parts.
330
+ *
331
+ * @param props - The text, the states, the handlers and the props of a `form`.
332
+ * @returns The `form` element inside the state's provider.
333
+ */
334
+ declare function Root$3({ attached, busy, defaultValue, disabled, onAttach, onCancelContext, onEditLast, onStop, onSubmit, onValueChange, submitOn, value, ...props }: RootProps$3): ReactElement;
335
+ //#endregion
336
+ //#region src/composer/submit.d.ts
337
+ /**
338
+ * Describes the props of the submit control: its names, the stop glyph, and the props of the
339
+ * actions `Button`.
340
+ */
341
+ interface SubmitProps extends ButtonProps {
342
+ /**
343
+ * Accessible name while the control sends, "Send" unless stated.
344
+ */
345
+ readonly label?: string | undefined;
346
+ /**
347
+ * Glyph while the control stops a response.
348
+ */
349
+ readonly stopIcon?: ReactNode;
350
+ /**
351
+ * Accessible name while the control stops a response, "Stop" unless stated.
352
+ */
353
+ readonly stopLabel?: string | undefined;
354
+ }
355
+ /**
356
+ * Renders the control that sends, or stops while a response runs.
357
+ *
358
+ * @param props - The names, the stop glyph and the props of the actions `Button`, the send glyph
359
+ * among its children.
360
+ * @returns The `button` element.
361
+ */
362
+ declare function Submit({ children, label, onClick, stopIcon, stopLabel, ...props }: SubmitProps): ReactElement;
363
+ //#endregion
364
+ //#region src/composer/toolbar.d.ts
365
+ /**
366
+ * Renders the row's `div`.
367
+ */
368
+ declare const Toolbar: import("@stealthscale/theme").StyledComponent<"div", {}>;
369
+ /**
370
+ * Describes the props of `Toolbar`.
371
+ */
372
+ type ToolbarProps = ComponentProps<typeof Toolbar>;
373
+ declare namespace index_d_exports$1 {
374
+ export { AttachTrigger, AttachTriggerProps, Attachments, AttachmentsProps, Context, ContextProps, Input, InputProps, Query, Root$3 as Root, RootProps$3 as RootProps, Submit, SubmitKey, SubmitProps, Suggestion, Toolbar, ToolbarProps };
375
+ }
376
+ //#endregion
377
+ //#region src/conversation/content.d.ts
378
+ /**
379
+ * Describes the props of the transcript: the props of the scroll area's viewport, without `ref`,
380
+ * which the engine takes.
381
+ */
382
+ type ContentProps$1 = Omit<ScrollArea.ViewportProps, "ref">;
383
+ /**
384
+ * Renders the log around the content, with the engine's refs on both.
385
+ *
386
+ * @param props - The props of the scroll area's viewport, the turns among its children.
387
+ * @returns The viewport element.
388
+ */
389
+ declare function Content$1({ children, ...props }: ContentProps$1): ReactElement;
390
+ //#endregion
391
+ //#region src/conversation/jump-trigger.d.ts
392
+ /**
393
+ * Describes the props of the control: its name and the props of the actions `Button`.
394
+ */
395
+ interface JumpTriggerProps extends ButtonProps {
396
+ /**
397
+ * Accessible name of the control, "Jump to the latest message" unless stated.
398
+ */
399
+ readonly label?: string | undefined;
400
+ }
401
+ /**
402
+ * Renders the control while the view is away from the end.
403
+ *
404
+ * @param props - The control's name and the props of the actions `Button`, the glyph among its
405
+ * children.
406
+ * @returns The placed control, or nothing at the end of the transcript.
407
+ */
408
+ declare function JumpTrigger({ label, onClick, ...props }: JumpTriggerProps): null | ReactElement;
409
+ //#endregion
410
+ //#region src/conversation/use-conversation.d.ts
411
+ /**
412
+ * Describes a conversation's scroll engine: the view's place, the two scrolls, and the refs
413
+ * `Conversation.Root` gives its viewport and content.
414
+ */
415
+ interface ConversationApi {
416
+ /**
417
+ * Whether the view is at the end of the transcript or within 70px of it.
418
+ */
419
+ readonly atEnd: boolean;
420
+ /**
421
+ * Ref the transcript's content element takes, whose growth the engine follows.
422
+ */
423
+ readonly contentRef: StickToBottomInstance["contentRef"];
424
+ /**
425
+ * Ref the transcript's viewport takes, the element that scrolls.
426
+ */
427
+ readonly scrollRef: StickToBottomInstance["scrollRef"];
428
+ /**
429
+ * Scrolls to the end of the transcript and follows it again.
430
+ */
431
+ readonly scrollToEnd: () => void;
432
+ /**
433
+ * Scrolls the element with the `id` given to the top of the view and stops following the end,
434
+ * for a jump to the first unread message or to a search result.
435
+ */
436
+ readonly scrollToMessage: (id: string) => void;
437
+ }
438
+ /**
439
+ * Runs the scroll engine of one conversation.
440
+ *
441
+ * @returns Whether the view is at the end, the two scrolls, and the refs the root passes on.
442
+ */
443
+ declare function useConversation(): ConversationApi;
444
+ //#endregion
445
+ //#region src/conversation/root.d.ts
446
+ /**
447
+ * Describes the props of the root: the engine, the log's name and the props of the scroll area's
448
+ * root.
449
+ */
450
+ interface RootProps$2 extends ScrollArea.RootProps {
451
+ /**
452
+ * Scroll engine `useConversation` returns. The root runs its own unless stated.
453
+ */
454
+ readonly conversation?: ConversationApi | undefined;
455
+ /**
456
+ * Accessible name of the transcript's log, "Messages" unless stated.
457
+ */
458
+ readonly label?: string | undefined;
459
+ }
460
+ /**
461
+ * Renders the root and provides the conversation's state to its parts.
462
+ *
463
+ * @param props - The engine, the log's name and the props of the scroll area's root.
464
+ * @returns The scroll area's root inside the state's provider.
465
+ */
466
+ declare function Root$2({ children, conversation, label, ...props }: RootProps$2): ReactElement;
467
+ //#endregion
468
+ //#region src/conversation/typing.d.ts
469
+ /**
470
+ * Renders the row's `div`.
471
+ */
472
+ declare const Row: import("@stealthscale/theme").StyledComponent<"div", {}>;
473
+ /**
474
+ * Describes the props of the row: the props of a `div`, the words among its children.
475
+ */
476
+ type TypingProps = ComponentProps<typeof Row>;
477
+ /**
478
+ * Renders the dots before the caller's words.
479
+ *
480
+ * @param props - The props of a `div`, the words among its children.
481
+ * @returns The `div` element.
482
+ */
483
+ declare function Typing({ children, ...props }: TypingProps): ReactElement;
484
+ declare namespace index_d_exports$2 {
485
+ export { Content$1 as Content, ContentProps$1 as ContentProps, ConversationApi, JumpTrigger, JumpTriggerProps, Root$2 as Root, RootProps$2 as RootProps, Typing, TypingProps, useConversation };
486
+ }
487
+ //#endregion
488
+ //#region src/message/actions.d.ts
489
+ /**
490
+ * Renders the actions' `div`.
491
+ */
492
+ declare const Actions: import("@stealthscale/theme").StyledComponent<"div", {}>;
493
+ /**
494
+ * Describes the props of `Actions`.
495
+ */
496
+ type ActionsProps = ComponentProps<typeof Actions>;
497
+ //#endregion
498
+ //#region src/message/avatar.d.ts
499
+ /**
500
+ * Renders the avatar's `div`.
501
+ */
502
+ declare const Avatar: import("@stealthscale/theme").StyledComponent<"div", {}>;
503
+ /**
504
+ * Describes the props of `Avatar`.
505
+ */
506
+ type AvatarProps = ComponentProps<typeof Avatar>;
507
+ //#endregion
508
+ //#region src/message/bubble.d.ts
509
+ /**
510
+ * Renders the bubble's `div`.
511
+ */
512
+ declare const Surface: import("@stealthscale/theme").StyledComponent<"div", {}>;
513
+ /**
514
+ * Describes the props of the bubble: whether the message failed, and the props of a `div`.
515
+ */
516
+ interface BubbleProps extends ComponentProps<typeof Surface> {
517
+ /**
518
+ * Whether the message did not send.
519
+ */
520
+ readonly failed?: boolean | undefined;
521
+ }
522
+ /**
523
+ * Renders the bubble, with `data-failed` while `failed`.
524
+ *
525
+ * @param props - Whether the message failed, and the props of a `div`.
526
+ * @returns The `div` element.
527
+ */
528
+ declare function Bubble({ failed, ...props }: BubbleProps): ReactElement;
529
+ //#endregion
530
+ //#region src/message/content.d.ts
531
+ /**
532
+ * Renders the column's `div`.
533
+ */
534
+ declare const Content: import("@stealthscale/theme").StyledComponent<"div", {}>;
535
+ /**
536
+ * Describes the props of `Content`.
537
+ */
538
+ type ContentProps = ComponentProps<typeof Content>;
539
+ //#endregion
540
+ //#region src/message/footer.d.ts
541
+ /**
542
+ * Renders the footer's `div`.
543
+ */
544
+ declare const Footer: import("@stealthscale/theme").StyledComponent<"div", {}>;
545
+ /**
546
+ * Describes the props of `Footer`.
547
+ */
548
+ type FooterProps = ComponentProps<typeof Footer>;
549
+ //#endregion
550
+ //#region src/message/header.d.ts
551
+ /**
552
+ * Renders the header's `div`.
553
+ */
554
+ declare const Header: import("@stealthscale/theme").StyledComponent<"div", {}>;
555
+ /**
556
+ * Describes the props of `Header`.
557
+ */
558
+ type HeaderProps = ComponentProps<typeof Header>;
559
+ //#endregion
560
+ //#region src/message/root.d.ts
561
+ /**
562
+ * Renders the root `article` with the message's variants.
563
+ */
564
+ declare const Root$1: import("@stealthscale/theme").StyledComponent<"article", {
565
+ readonly align?: "end" | "start";
566
+ readonly look?: import("@stealthscale/theme/authoring").Flat;
567
+ readonly palette?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning";
568
+ readonly reveal?: "always" | "hover";
569
+ readonly size?: "lg" | "md" | "sm";
570
+ }>;
571
+ /**
572
+ * Describes the props of `Root`.
573
+ */
574
+ type RootProps$1 = ComponentProps<typeof Root$1>;
575
+ //#endregion
576
+ //#region src/message/status.d.ts
577
+ /**
578
+ * Renders the status `span`.
579
+ */
580
+ declare const Marked: import("@stealthscale/theme").StyledComponent<"span", {}>;
581
+ /**
582
+ * Lists how far a message can get.
583
+ */
584
+ type MessageStatus = "delivered" | "failed" | "read" | "sending" | "sent";
585
+ /**
586
+ * Describes the props of the status: how far the message has got, and the props of a `span`.
587
+ */
588
+ interface StatusProps extends ComponentProps<typeof Marked> {
589
+ /**
590
+ * How far the message has got.
591
+ */
592
+ readonly status: MessageStatus;
593
+ }
594
+ /**
595
+ * Renders the status with its state written as `data-status`.
596
+ *
597
+ * @param props - How far the message has got, and the props of a `span`.
598
+ * @returns The `span` element.
599
+ */
600
+ declare function Status({ status, ...props }: StatusProps): ReactElement;
601
+ declare namespace index_d_exports$3 {
602
+ export { Actions, ActionsProps, Avatar, AvatarProps, Bubble, BubbleProps, Content, ContentProps, Footer, FooterProps, Header, HeaderProps, MessageStatus, Root$1 as Root, RootProps$1 as RootProps, Status, StatusProps };
603
+ }
604
+ //#endregion
605
+ //#region src/reactions/choice.d.ts
606
+ /**
607
+ * Describes the props of a choice: its name, its value, and the props of the actions `Button`.
608
+ */
609
+ interface ChoiceProps extends ButtonProps {
610
+ /**
611
+ * Accessible name of the reaction, such as "Thumbs up".
612
+ */
613
+ readonly label: string;
614
+ /**
615
+ * Value the picker's `onSelect` receives.
616
+ */
617
+ readonly value: string;
618
+ }
619
+ /**
620
+ * Renders the choice's button.
621
+ *
622
+ * @param props - The name, the value, and the props of the actions `Button`, the glyph among its
623
+ * children.
624
+ * @returns The `button` element.
625
+ */
626
+ declare function Choice({ children, label, onClick, value, ...props }: ChoiceProps): ReactElement;
627
+ //#endregion
628
+ //#region src/reactions/item.d.ts
629
+ /**
630
+ * Describes the props of a reaction: its count, its name, whether the reader reacted, and the
631
+ * props of the actions `Button`.
632
+ */
633
+ interface ItemProps extends ButtonProps {
634
+ /**
635
+ * Number of people who reacted, rendered after the glyph when stated.
636
+ */
637
+ readonly count?: number | undefined;
638
+ /**
639
+ * Accessible name: the reaction, the count and whether the reader is among them.
640
+ */
641
+ readonly label: string;
642
+ /**
643
+ * Whether the reader is among the people who reacted.
644
+ */
645
+ readonly pressed?: boolean | undefined;
646
+ }
647
+ /**
648
+ * Renders the reaction's button.
649
+ *
650
+ * @param props - The count, the name, whether the reader reacted, and the props of the actions
651
+ * `Button`, the glyph among its children.
652
+ * @returns The `button` element.
653
+ */
654
+ declare function Item({ children, count, label, pressed, ...props }: ItemProps): ReactElement;
655
+ //#endregion
656
+ //#region src/reactions/picker.d.ts
657
+ /**
658
+ * Describes the props of the picker: the trigger's glyph and name, the panel's name, the handler of
659
+ * a choice, and the popover root's props without its open state, which the picker keeps, and
660
+ * without the element's `onSelect` event, which the choice handler replaces.
661
+ */
662
+ interface PickerProps extends Omit<Popover.RootProps, "children" | "defaultOpen" | "onOpenChange" | "onSelect" | "open"> {
663
+ /**
664
+ * The choices, each a `Reactions.Choice`.
665
+ */
666
+ readonly children?: ReactNode;
667
+ /**
668
+ * Accessible name of the panel, "Choose a reaction" unless stated.
669
+ */
670
+ readonly choicesLabel?: string | undefined;
671
+ /**
672
+ * Glyph of the trigger.
673
+ */
674
+ readonly icon: ReactNode;
675
+ /**
676
+ * Accessible name of the trigger, "Add a reaction" unless stated.
677
+ */
678
+ readonly label?: string | undefined;
679
+ /**
680
+ * Called with the value of the choice pressed.
681
+ */
682
+ readonly onSelect?: ((value: string) => void) | undefined;
683
+ }
684
+ /**
685
+ * Renders the trigger and the panel, and closes the panel on a choice.
686
+ *
687
+ * @param props - The trigger's glyph and name, the panel's name, the handler of a choice and the
688
+ * popover root's props.
689
+ * @returns The popover's root.
690
+ */
691
+ declare function Picker({ children, choicesLabel, icon, label, onSelect, ...props }: PickerProps): ReactElement;
692
+ //#endregion
693
+ //#region src/reactions/root.d.ts
694
+ /**
695
+ * Renders the `fieldset` with the reactions' root class.
696
+ */
697
+ declare const Grouped: import("@stealthscale/theme").StyledComponent<"fieldset", {}>;
698
+ /**
699
+ * Describes the props of the row: its name and the props of a `fieldset`.
700
+ */
701
+ interface RootProps extends ComponentProps<typeof Grouped> {
702
+ /**
703
+ * Accessible name of the row, "Reactions" unless stated.
704
+ */
705
+ readonly label?: string | undefined;
706
+ }
707
+ /**
708
+ * Renders the row, named by `label`.
709
+ *
710
+ * @param props - The row's name and the props of a `fieldset`.
711
+ * @returns The `fieldset` element.
712
+ */
713
+ declare function Root({ label, ...props }: RootProps): ReactElement;
714
+ declare namespace index_d_exports$4 {
715
+ export { Choice, ChoiceProps, Item, ItemProps, Picker, PickerProps, Root, RootProps };
716
+ }
717
+ //#endregion
718
+ //#region src/turns/group-turns.d.ts
719
+ /**
720
+ * Groups a transcript into days, and each day into turns: the runs of messages one author sent
721
+ * close together.
722
+ *
723
+ * @remarks
724
+ * A turn renders one avatar and one header over its messages, so two messages an hour apart
725
+ * start two turns: their header would otherwise date the second message wrongly. A new day always
726
+ * starts a new turn, because a divider between the messages of one turn would separate them from
727
+ * their avatar. A day starts at midnight in `timeZone`, or in the runtime's time zone, the
728
+ * reader's own calendar in a browser. A caller that formats its times in a zone passes that zone,
729
+ * so a day's label and its messages' times name one calendar.
730
+ */
731
+ /**
732
+ * Describes the fields of a message that the grouping reads.
733
+ */
734
+ interface TurnMessage {
735
+ /**
736
+ * Identifier of the person or the assistant that sent the message.
737
+ */
738
+ readonly author: string;
739
+ /**
740
+ * Identifier of the message, unique in the transcript.
741
+ */
742
+ readonly id: string;
743
+ /**
744
+ * Instant the message was sent: a `Date`, the milliseconds since the epoch, or a string `Date`
745
+ * parses. A message without one, or with one `Date` cannot read, joins the turn and the day
746
+ * before it.
747
+ */
748
+ readonly sentAt?: Date | number | string | undefined;
749
+ }
750
+ /**
751
+ * Describes one turn: the messages one author sent in a row.
752
+ *
753
+ * @typeParam Message - The caller's message type.
754
+ */
755
+ interface Turn<Message extends TurnMessage> {
756
+ /**
757
+ * Identifier of the author every message of the turn shares.
758
+ */
759
+ readonly author: string;
760
+ /**
761
+ * The message that opens the turn, whose `id` keys the turn and whose `sentAt` its header shows.
762
+ */
763
+ readonly first: Message;
764
+ /**
765
+ * The latest message of the turn, whose status and actions its footer shows.
766
+ */
767
+ readonly last: Message;
768
+ /**
769
+ * Every message of the turn, oldest first, never empty.
770
+ */
771
+ readonly messages: readonly Message[];
772
+ /**
773
+ * Whether `author` is the reader, the `self` option.
774
+ */
775
+ readonly own: boolean;
776
+ }
777
+ /**
778
+ * Describes one day of the transcript: the turns under one divider.
779
+ *
780
+ * @typeParam Message - The caller's message type.
781
+ */
782
+ interface TurnDay<Message extends TurnMessage> {
783
+ /**
784
+ * Midnight at the start of the day, the day's first instant where a daylight saving change skips
785
+ * midnight, or undefined for messages without a readable `sentAt`.
786
+ */
787
+ readonly day: Date | undefined;
788
+ /**
789
+ * Identifier of the first message of the day, unique across the days.
790
+ */
791
+ readonly key: string;
792
+ /**
793
+ * The turns of the day, oldest first.
794
+ */
795
+ readonly turns: ReadonlyArray<Turn<Message>>;
796
+ }
797
+ /**
798
+ * Describes the options of the grouping.
799
+ */
800
+ interface GroupTurnsOptions {
801
+ /**
802
+ * Identifier of the reader, whose turns are `own`.
803
+ */
804
+ readonly self?: string | undefined;
805
+ /**
806
+ * IANA time zone a day starts at midnight in, such as `UTC` or `Europe/Amsterdam`. The runtime's
807
+ * zone unless stated.
808
+ */
809
+ readonly timeZone?: string | undefined;
810
+ /**
811
+ * Longest gap in milliseconds between two messages of one turn, 5 minutes unless stated.
812
+ */
813
+ readonly window?: number | undefined;
814
+ }
815
+ /**
816
+ * Groups messages into days and turns.
817
+ *
818
+ * @typeParam Message - The caller's message type, which each turn returns as it was given.
819
+ * @param messages - The transcript, oldest first.
820
+ * @param options - The reader's identifier, the zone a day starts in and the longest gap inside
821
+ * one turn.
822
+ * @returns The days in order, each with its turns in order.
823
+ */
824
+ export declare function groupTurns<Message extends TurnMessage>(messages: readonly Message[], options?: GroupTurnsOptions): ReadonlyArray<TurnDay<Message>>;
825
+ //#endregion
826
+ export { index_d_exports as Attachment, index_d_exports$1 as Composer, index_d_exports$2 as Conversation, type GroupTurnsOptions, index_d_exports$3 as Message, index_d_exports$4 as Reactions, type Turn, type TurnDay, type TurnMessage };