@godxjp/chat 32.0.0 → 32.0.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.
@@ -0,0 +1,184 @@
1
+ import * as React from 'react';
2
+
3
+ /**
4
+ * Shared atomic prop types used across multiple components.
5
+ * @see docs/PROPS-VOCABULARY.md
6
+ */
7
+
8
+ /** Extra CSS class names on a component root. */
9
+ type ClassNameProp = string;
10
+ /** Stable DOM / form identifier. */
11
+ type IdProp = string;
12
+ /** Loading / pending state — disables actions and shows spinners. */
13
+ type PendingProp = boolean;
14
+ /** Disable user interaction. */
15
+ type DisabledProp = boolean;
16
+ /** Placeholder text for inputs. */
17
+ type PlaceholderProp = string;
18
+ /** HTML input `name` attribute. */
19
+ type NameProp = string;
20
+ /** Abstract controlled value. */
21
+ type ValueProp<T = string> = T;
22
+ /** Abstract uncontrolled initial value. */
23
+ type DefaultValueProp<T = string> = T;
24
+ /** Callback when an abstract value changes. */
25
+ type OnValueChangeProp<T = string> = (value: T) => void;
26
+ /** Click handler for buttons and interactive elements. */
27
+ type OnClickProp = React.MouseEventHandler<HTMLButtonElement>;
28
+ /** Radix/shadcn `asChild` polymorphism — render as child element. */
29
+ type AsChildProp = boolean;
30
+
31
+ /**
32
+ * Interaction & visual variant prop types.
33
+ * @see docs/PROPS-VOCABULARY.md#interaction-variants
34
+ */
35
+
36
+ /**
37
+ * Button visual style.
38
+ *
39
+ * `bare` (gh#404) is the control WITHOUT geometry: a real button — hitbox, focus ring, keyboard
40
+ * semantics, `aria-label` — around content that already IS the shape (a `Badge`, a truncating
41
+ * title). Every other variant loads a height and an inline inset from its `size`, so wrapping a
42
+ * chip meant writing `className="h-auto p-0"`, an audit error with no legal replacement; `link`
43
+ * was not it either, since it still loads a size class and adds primary colour plus a hover
44
+ * underline. The 24×24 target WCAG 2.2 SC 2.5.8 requires is kept by a pseudo-element, so the box
45
+ * stays exactly as big as its content.
46
+ */
47
+ type ButtonVariantProp = "default" | "destructive" | "outline" | "dashed" | "secondary" | "ghost" | "link" | "bare";
48
+ /**
49
+ * Corner shape — maps to the radius tokens (default = control/component radius). Shared by Button
50
+ * + Badge.
51
+ */
52
+ type ShapeProp = "default" | "pill" | "sharp";
53
+ /** Inline text alignment (logical, RTL-safe). */
54
+ type TextAlignProp = "start" | "center" | "end";
55
+ /** Button size preset. */
56
+ type SizeProp = "xs" | "sm" | "md" | "lg";
57
+ /** Button size preset; icon-only sizes are a documented Button subset. */
58
+ type ButtonSizeProp = SizeProp | "default" | "icon" | "icon-xs" | "icon-sm" | "icon-lg";
59
+ /**
60
+ * Validation state a data-entry control PAINTS — Ant Design's `status` axis, which
61
+ * docs/DESIGN-AUTHORITY.md names the taxonomy authority for this library.
62
+ *
63
+ * Two members, not antd's five. `error` and `warning` are the two antd paints from the prop alone;
64
+ * `success` and `validating` are only ever drawn together with antd's `hasFeedback` icon slot,
65
+ * which this library does not have (FormField owns the message and the icon), and `""` is antd's
66
+ * way of spelling "no status" in a required field — `undefined` already says that here.
67
+ *
68
+ * `error` and `aria-invalid` are the same state seen from two sides: a control given
69
+ * `status="error"` also reports `aria-invalid`, so the paint and the announcement can never drift.
70
+ * `warning` deliberately does NOT set `aria-invalid` — a warning is not a validity failure, and
71
+ * antd does not announce one either.
72
+ */
73
+ type ControlStatusProp = "error" | "warning";
74
+
75
+ /** Foundation component prop types — @see docs/COMPONENTS.md#foundation */
76
+
77
+ /** @see Button */
78
+ type ButtonProp = React.ButtonHTMLAttributes<HTMLButtonElement> & {
79
+ variant?: ButtonVariantProp;
80
+ size?: ButtonSizeProp;
81
+ /** Corner shape — `default` (control radius) · `pill` (fully rounded) · `sharp` (square). */
82
+ shape?: ShapeProp;
83
+ fullWidth?: boolean;
84
+ /**
85
+ * Take the space the siblings leave, and let a long label ELLIPSE instead of widening the row —
86
+ * the same axis `Flex` calls `fill`, for the same reason.
87
+ *
88
+ * Button ships `flex-shrink: 0`, right almost everywhere and wrong in a constrained bar: an
89
+ * account menu holding an avatar plus a person's name keeps its full width while the cluster
90
+ * clips it, so a keyboard user tabs to a control they cannot see (SC 2.4.7). Until this axis
91
+ * existed the only move was `className="min-w-0 flex-1"`, which ui-audit blocks — and which this
92
+ * package's own Topbar guidance recommended, so the docs prescribed the utility the audit forbids.
93
+ *
94
+ * Sets `flex: 1 1 auto` and `min-inline-size: 0`; pair it with a `<Text truncate>` label.
95
+ */
96
+ fill?: boolean;
97
+ /** Allow a text button to grow vertically for multi-line labels. */
98
+ wrap?: boolean;
99
+ /** Logical content alignment, especially for full-width collection actions. */
100
+ align?: TextAlignProp;
101
+ asChild?: AsChildProp;
102
+ onClick?: OnClickProp;
103
+ disabled?: DisabledProp;
104
+ /**
105
+ * In-flight state — shows a leading spinner (replaces a leading icon if present),
106
+ * sets `aria-busy` and blocks activation while keeping the label to avoid layout shift.
107
+ */
108
+ loading?: PendingProp;
109
+ /** Optional label to swap in while `loading` (pass the `t()`-translated string). */
110
+ loadingText?: string;
111
+ /**
112
+ * Optional numeric count rendered as a borderless counter pill after the label (filter tabs /
113
+ * segmented toggles, e.g. "Chờ bay 18").
114
+ */
115
+ count?: number;
116
+ /**
117
+ * Cap for `count` (Ant Badge parity). When `count` exceeds it the pill shows `{overflowCount}+`
118
+ * (e.g.
119
+ */
120
+ overflowCount?: number;
121
+ /**
122
+ * Whether to render the pill when `count` is 0 (Ant Badge parity). Defaults to
123
+ * `true` (a `0` pill shows); pass `false` to hide the pill at zero.
124
+ */
125
+ showZero?: boolean;
126
+ /**
127
+ * Localized description of what the count MEANS, folded into the accessible name so the control
128
+ * never announces as a bare digit run. The SAME prop and the same contract `Toggle` has carried
129
+ * since gh#312 — without it a counted button measured `"Git3"` in the accessibility tree, not
130
+ * "Git, 3 pages" (gh#734).
131
+ *
132
+ * The pill itself is `aria-hidden` and the spoken form is an `sr-only` sibling, so the name
133
+ * reads `"<label>, <count> <countLabel>"` from the contents; with an explicit `aria-label`
134
+ * (an icon-only counted button) the same clause is folded into that instead. Pass a
135
+ * `t()`-resolved string — the library does not own this wording.
136
+ */
137
+ countLabel?: string;
138
+ };
139
+
140
+ /**
141
+ * Which keystroke SENDS and which one breaks the line — Ant Design X `Sender.submitType`.
142
+ *
143
+ * `enter` (default) is the chat convention: `Enter` sends, `Shift+Enter` inserts a newline.
144
+ * `shiftEnter` is the inverse, for composers that hold long, deliberately multi-line drafts.
145
+ * `modEnter` is this library's extension (antd X has only the first two; see
146
+ * docs/DESIGN-AUTHORITY.md): `⌘+Enter` on Apple platforms, `Ctrl+Enter` elsewhere sends, while
147
+ * `Enter` and `Shift+Enter` both insert a newline — the record-comment convention.
148
+ * None of them ever fires while an IME conversion is in flight.
149
+ * @see ChatComposer
150
+ */
151
+ type ChatComposerSubmitTypeProp = "enter" | "shiftEnter" | "modEnter";
152
+ /**
153
+ * @see ChatComposer `footer` — the built-in trailing action, pre-wired (onClick/disabled/
154
+ * accessible name already resolved) and handed to a `footer` render function so it can be
155
+ * RELOCATED instead of duplicated.
156
+ *
157
+ * Ant Design X `Sender.ActionsComponents` ships four (`SendButton`/`ClearButton`/`LoadingButton`/
158
+ * `SpeechButton`) because `Sender` has a clear affordance and speech input this composer does not
159
+ * — porting those two as inert components would ship dead API (the same "not ported" discipline
160
+ * `docs/DESIGN-AUTHORITY.md` applies to antd fields nothing here reads). `LoadingButton` is
161
+ * `CancelButton` here — this composer already names the streaming state's trailing action `cancel`
162
+ * (`onCancel`, `cancelLabel`), so the antd-x name would be a second spelling of the same button.
163
+ */
164
+ type ChatComposerActionComponents = {
165
+ /** The send action — disabled while empty/disabled/readOnly/loading, exactly like the inline one. */
166
+ SubmitButton: React.ComponentType<ButtonProp>;
167
+ /** The stop action — only meaningful while `loading`; renders antd X's `LoadingButton` slot. */
168
+ CancelButton: React.ComponentType<ButtonProp>;
169
+ };
170
+ /**
171
+ * @see ChatComposer `footer` — either a plain node (unchanged default behaviour) or Ant Design X
172
+ * `Sender`'s `NodeRender` shape: a function receiving `{ components }` so a consumer can render
173
+ * the real send/cancel buttons BELOW the draft box instead of beside it. Combine with `actions=
174
+ * {false}` to hide the inline pair and avoid rendering both.
175
+ */
176
+ type ChatComposerFooterProp = React.ReactNode | ((info: {
177
+ components: ChatComposerActionComponents;
178
+ }) => React.ReactNode);
179
+ /** Ant Design X `Attachments` overflow modes — how the card list behaves when it exceeds its box. */
180
+ type AttachmentsOverflowProp = "wrap" | "scrollX" | "scrollY";
181
+ /** Semantic slots Ant Design X exposes on `Attachments`. */
182
+ type AttachmentsSemanticProp = "list" | "placeholder" | "upload" | "root" | "card" | "file";
183
+
184
+ export type { AttachmentsOverflowProp as A, ChatComposerFooterProp as C, DefaultValueProp as D, IdProp as I, NameProp as N, OnValueChangeProp as O, PendingProp as P, SizeProp as S, ValueProp as V, AttachmentsSemanticProp as a, ChatComposerSubmitTypeProp as b, ClassNameProp as c, ControlStatusProp as d, DisabledProp as e, PlaceholderProp as f };
package/dist/index.d.ts CHANGED
@@ -1,425 +1,11 @@
1
- import * as React from 'react';
2
- import { ChatBubbleProp, ChatBubbleListProp, ChatSuggestionProp, AttachmentsItemProp, AttachmentsPlaceholderProp, AttachmentsRefProp, ConversationsProp, ThoughtChainProp, ThoughtChainItemProp, WelcomeProp } from '@godxjp/ui/props/components';
1
+ export { ChatBubble, ChatBubbleList, ChatBubbleListProps, ChatBubbleProps } from './chat-bubble.js';
2
+ export { ChatComposer } from './chat-composer.js';
3
+ export { ChatSuggestion } from './chat-suggestion.js';
4
+ export { Attachments } from './attachments.js';
5
+ export { Conversations } from './conversations.js';
6
+ export { ThoughtChain, ThoughtChainItem } from './thought-chain.js';
7
+ export { Welcome } from './welcome.js';
3
8
  export { AttachmentsItemProp, AttachmentsOverflowProp, AttachmentsPlaceholderProp, AttachmentsProp, AttachmentsProp as AttachmentsProps, AttachmentsRefProp, ChatBubbleListProp, ChatBubblePlacementProp, ChatBubbleProp, ChatBubbleToneProp, ChatBubbleTypingProp, ChatBubbleVariantProp, ChatComposerProp, ChatComposerProp as ChatComposerProps, ChatComposerSubmitTypeProp, ChatMessageProp, ChatSuggestionItemProp, ChatSuggestionProp, ChatSuggestionProp as ChatSuggestionProps, ChatSuggestionRenderProp, ConversationsCreationProp, ConversationsDividerProp, ConversationsEntryProp, ConversationsGroupableProp, ConversationsItemProp, ConversationsMenuItemProp, ConversationsMenuProp, ConversationsProp, ConversationsProp as ConversationsProps, ThoughtChainItemProp, ThoughtChainItemProp as ThoughtChainItemProps, ThoughtChainItemsProp, ThoughtChainLineProp, ThoughtChainProp, ThoughtChainProp as ThoughtChainProps, ThoughtChainStatusProp, ThoughtChainVariantProp, WelcomeProp, WelcomeProp as WelcomeProps, WelcomeVariantProp } from '@godxjp/ui/props/components';
4
- import * as _godxjp_ui_data_entry from '@godxjp/ui/data-entry';
5
-
6
- type ChatBubbleProps = ChatBubbleProp & Omit<React.HTMLAttributes<HTMLElement>, keyof ChatBubbleProp>;
7
- /**
8
- * ChatBubble — ONE message in a conversation: an optional author mark, a header naming the turn,
9
- * the message body, and a footer for timestamps or per-message actions.
10
- *
11
- * It is an `<article>` inside the feed's `role="log"`, and it deliberately owns NO live region of
12
- * its own: one live region per bubble floods a screen reader on every token of a stream. The feed
13
- * (`ChatBubbleList`) owns the single `aria-live="polite"` region; a bubble only ever says "I am
14
- * still being produced" through `aria-busy`.
15
- */
16
- declare const ChatBubble: React.ForwardRefExoticComponent<ChatBubbleProp & Omit<React.HTMLAttributes<HTMLElement>, keyof ChatBubbleProp> & React.RefAttributes<HTMLElement>>;
17
- type ChatBubbleListProps = ChatBubbleListProp & Omit<React.HTMLAttributes<HTMLDivElement>, keyof ChatBubbleListProp>;
18
- /**
19
- * ChatBubbleList — the message feed.
20
- *
21
- * The behaviour that earns this a component rather than a `ScrollArea` + `map` is STICK-TO-BOTTOM:
22
- * new messages keep the viewport pinned only while the reader is ALREADY at the bottom. The moment
23
- * they scroll up to re-read something the pin is revoked and stays revoked until they ask for it
24
- * back — silently yanking a reader to the newest message mid-sentence is a change of context they
25
- * did not request (WCAG 3.2.5), and it is the classic chat-UI defect. The way back is a real,
26
- * focusable button that also says how many messages arrived while they were away.
27
- *
28
- * GIVE IT A DEFINITE HEIGHT — `className="h-96"`, or a flex/grid parent that hands it a track.
29
- * The feed scrolls INSIDE itself; with no height it simply grows to its content, nothing ever
30
- * overflows, and every behaviour above has nothing to act on.
31
- */
32
- declare const ChatBubbleList: React.ForwardRefExoticComponent<ChatBubbleListProp & Omit<React.HTMLAttributes<HTMLDivElement>, keyof ChatBubbleListProp> & React.RefAttributes<HTMLDivElement>>;
33
-
34
- /**
35
- * Interaction & visual variant prop types.
36
- * @see docs/PROPS-VOCABULARY.md#interaction-variants
37
- */
38
-
39
- /**
40
- * Button visual style.
41
- *
42
- * `bare` (gh#404) is the control WITHOUT geometry: a real button — hitbox, focus ring, keyboard
43
- * semantics, `aria-label` — around content that already IS the shape (a `Badge`, a truncating
44
- * title). Every other variant loads a height and an inline inset from its `size`, so wrapping a
45
- * chip meant writing `className="h-auto p-0"`, an audit error with no legal replacement; `link`
46
- * was not it either, since it still loads a size class and adds primary colour plus a hover
47
- * underline. The 24×24 target WCAG 2.2 SC 2.5.8 requires is kept by a pseudo-element, so the box
48
- * stays exactly as big as its content.
49
- */
50
- type ButtonVariantProp = "default" | "destructive" | "outline" | "dashed" | "secondary" | "ghost" | "link" | "bare";
51
- /**
52
- * Corner shape — maps to the radius tokens (default = control/component radius). Shared by Button
53
- * + Badge.
54
- */
55
- type ShapeProp = "default" | "pill" | "sharp";
56
- /** Inline text alignment (logical, RTL-safe). */
57
- type TextAlignProp = "start" | "center" | "end";
58
- /** Button size preset. */
59
- type SizeProp = "xs" | "sm" | "md" | "lg";
60
- /** Button size preset; icon-only sizes are a documented Button subset. */
61
- type ButtonSizeProp = SizeProp | "default" | "icon" | "icon-xs" | "icon-sm" | "icon-lg";
62
- /**
63
- * Validation state a data-entry control PAINTS — Ant Design's `status` axis, which
64
- * docs/DESIGN-AUTHORITY.md names the taxonomy authority for this library.
65
- *
66
- * Two members, not antd's five. `error` and `warning` are the two antd paints from the prop alone;
67
- * `success` and `validating` are only ever drawn together with antd's `hasFeedback` icon slot,
68
- * which this library does not have (FormField owns the message and the icon), and `""` is antd's
69
- * way of spelling "no status" in a required field — `undefined` already says that here.
70
- *
71
- * `error` and `aria-invalid` are the same state seen from two sides: a control given
72
- * `status="error"` also reports `aria-invalid`, so the paint and the announcement can never drift.
73
- * `warning` deliberately does NOT set `aria-invalid` — a warning is not a validity failure, and
74
- * antd does not announce one either.
75
- */
76
- type ControlStatusProp = "error" | "warning";
77
-
78
- /**
79
- * The accessible-name / description / validation contract that {@link FormField} injects onto its
80
- * single control child (via `cloneElement`). EVERY form-capable `@godxjp/ui` component accepts
81
- * these props and forwards them to its **semantic focus target** — the real `<input>` / combobox /
82
- * trigger the user tabs to, never a presentational wrapper `<div>`.
83
- */
84
- interface FieldA11yProps {
85
- "aria-label"?: string;
86
- "aria-labelledby"?: string;
87
- "aria-describedby"?: string;
88
- "aria-errormessage"?: string;
89
- "aria-invalid"?: React.AriaAttributes["aria-invalid"];
90
- "aria-required"?: React.AriaAttributes["aria-required"];
91
- "data-field"?: string;
92
- }
93
-
94
- /**
95
- * Shared atomic prop types used across multiple components.
96
- * @see docs/PROPS-VOCABULARY.md
97
- */
98
-
99
- /** Extra CSS class names on a component root. */
100
- type ClassNameProp = string;
101
- /** Stable DOM / form identifier. */
102
- type IdProp = string;
103
- /** Loading / pending state — disables actions and shows spinners. */
104
- type PendingProp = boolean;
105
- /** Disable user interaction. */
106
- type DisabledProp = boolean;
107
- /** Placeholder text for inputs. */
108
- type PlaceholderProp = string;
109
- /** HTML input `name` attribute. */
110
- type NameProp = string;
111
- /** Abstract controlled value. */
112
- type ValueProp<T = string> = T;
113
- /** Abstract uncontrolled initial value. */
114
- type DefaultValueProp<T = string> = T;
115
- /** Callback when an abstract value changes. */
116
- type OnValueChangeProp<T = string> = (value: T) => void;
117
- /** Click handler for buttons and interactive elements. */
118
- type OnClickProp = React.MouseEventHandler<HTMLButtonElement>;
119
- /** Radix/shadcn `asChild` polymorphism — render as child element. */
120
- type AsChildProp = boolean;
121
-
122
- /** Foundation component prop types — @see docs/COMPONENTS.md#foundation */
123
-
124
- /** @see Button */
125
- type ButtonProp = React.ButtonHTMLAttributes<HTMLButtonElement> & {
126
- variant?: ButtonVariantProp;
127
- size?: ButtonSizeProp;
128
- /** Corner shape — `default` (control radius) · `pill` (fully rounded) · `sharp` (square). */
129
- shape?: ShapeProp;
130
- fullWidth?: boolean;
131
- /**
132
- * Take the space the siblings leave, and let a long label ELLIPSE instead of widening the row —
133
- * the same axis `Flex` calls `fill`, for the same reason.
134
- *
135
- * Button ships `flex-shrink: 0`, right almost everywhere and wrong in a constrained bar: an
136
- * account menu holding an avatar plus a person's name keeps its full width while the cluster
137
- * clips it, so a keyboard user tabs to a control they cannot see (SC 2.4.7). Until this axis
138
- * existed the only move was `className="min-w-0 flex-1"`, which ui-audit blocks — and which this
139
- * package's own Topbar guidance recommended, so the docs prescribed the utility the audit forbids.
140
- *
141
- * Sets `flex: 1 1 auto` and `min-inline-size: 0`; pair it with a `<Text truncate>` label.
142
- */
143
- fill?: boolean;
144
- /** Allow a text button to grow vertically for multi-line labels. */
145
- wrap?: boolean;
146
- /** Logical content alignment, especially for full-width collection actions. */
147
- align?: TextAlignProp;
148
- asChild?: AsChildProp;
149
- onClick?: OnClickProp;
150
- disabled?: DisabledProp;
151
- /**
152
- * In-flight state — shows a leading spinner (replaces a leading icon if present),
153
- * sets `aria-busy` and blocks activation while keeping the label to avoid layout shift.
154
- */
155
- loading?: PendingProp;
156
- /** Optional label to swap in while `loading` (pass the `t()`-translated string). */
157
- loadingText?: string;
158
- /**
159
- * Optional numeric count rendered as a borderless counter pill after the label (filter tabs /
160
- * segmented toggles, e.g. "Chờ bay 18").
161
- */
162
- count?: number;
163
- /**
164
- * Cap for `count` (Ant Badge parity). When `count` exceeds it the pill shows `{overflowCount}+`
165
- * (e.g.
166
- */
167
- overflowCount?: number;
168
- /**
169
- * Whether to render the pill when `count` is 0 (Ant Badge parity). Defaults to
170
- * `true` (a `0` pill shows); pass `false` to hide the pill at zero.
171
- */
172
- showZero?: boolean;
173
- /**
174
- * Localized description of what the count MEANS, folded into the accessible name so the control
175
- * never announces as a bare digit run. The SAME prop and the same contract `Toggle` has carried
176
- * since gh#312 — without it a counted button measured `"Git3"` in the accessibility tree, not
177
- * "Git, 3 pages" (gh#734).
178
- *
179
- * The pill itself is `aria-hidden` and the spoken form is an `sr-only` sibling, so the name
180
- * reads `"<label>, <count> <countLabel>"` from the contents; with an explicit `aria-label`
181
- * (an icon-only counted button) the same clause is folded into that instead. Pass a
182
- * `t()`-resolved string — the library does not own this wording.
183
- */
184
- countLabel?: string;
185
- };
186
-
187
- /**
188
- * Which keystroke SENDS and which one breaks the line — Ant Design X `Sender.submitType`.
189
- *
190
- * `enter` (default) is the chat convention: `Enter` sends, `Shift+Enter` inserts a newline.
191
- * `shiftEnter` is the inverse, for composers that hold long, deliberately multi-line drafts.
192
- * `modEnter` is this library's extension (antd X has only the first two; see
193
- * docs/DESIGN-AUTHORITY.md): `⌘+Enter` on Apple platforms, `Ctrl+Enter` elsewhere sends, while
194
- * `Enter` and `Shift+Enter` both insert a newline — the record-comment convention.
195
- * None of them ever fires while an IME conversion is in flight.
196
- * @see ChatComposer
197
- */
198
- type ChatComposerSubmitTypeProp = "enter" | "shiftEnter" | "modEnter";
199
- /**
200
- * @see ChatComposer `footer` — the built-in trailing action, pre-wired (onClick/disabled/
201
- * accessible name already resolved) and handed to a `footer` render function so it can be
202
- * RELOCATED instead of duplicated.
203
- *
204
- * Ant Design X `Sender.ActionsComponents` ships four (`SendButton`/`ClearButton`/`LoadingButton`/
205
- * `SpeechButton`) because `Sender` has a clear affordance and speech input this composer does not
206
- * — porting those two as inert components would ship dead API (the same "not ported" discipline
207
- * `docs/DESIGN-AUTHORITY.md` applies to antd fields nothing here reads). `LoadingButton` is
208
- * `CancelButton` here — this composer already names the streaming state's trailing action `cancel`
209
- * (`onCancel`, `cancelLabel`), so the antd-x name would be a second spelling of the same button.
210
- */
211
- type ChatComposerActionComponents = {
212
- /** The send action — disabled while empty/disabled/readOnly/loading, exactly like the inline one. */
213
- SubmitButton: React.ComponentType<ButtonProp>;
214
- /** The stop action — only meaningful while `loading`; renders antd X's `LoadingButton` slot. */
215
- CancelButton: React.ComponentType<ButtonProp>;
216
- };
217
- /**
218
- * @see ChatComposer `footer` — either a plain node (unchanged default behaviour) or Ant Design X
219
- * `Sender`'s `NodeRender` shape: a function receiving `{ components }` so a consumer can render
220
- * the real send/cancel buttons BELOW the draft box instead of beside it. Combine with `actions=
221
- * {false}` to hide the inline pair and avoid rendering both.
222
- */
223
- type ChatComposerFooterProp = React.ReactNode | ((info: {
224
- components: ChatComposerActionComponents;
225
- }) => React.ReactNode);
226
- /** Ant Design X `Attachments` overflow modes — how the card list behaves when it exceeds its box. */
227
- type AttachmentsOverflowProp = "wrap" | "scrollX" | "scrollY";
228
- /** Semantic slots Ant Design X exposes on `Attachments`. */
229
- type AttachmentsSemanticProp = "list" | "placeholder" | "upload" | "root" | "card" | "file";
230
-
231
- /**
232
- * ChatComposer — the message input of a conversation (Ant Design X `Sender`).
233
- *
234
- * ## Why a component and not a composition
235
- *
236
- * Three behaviours live here and nowhere else, and every app that hand-rolls a composer gets at
237
- * least one of them wrong:
238
- *
239
- * 1. **An IME conversion is not a message.** Between `compositionstart` and `compositionend` the
240
- * text in the box is a CANDIDATE being converted, and the `Enter` that accepts it belongs to
241
- * the IME. A composer that reads that `Enter` as "send" makes Japanese and Vietnamese input
242
- * impossible — the first kanji conversion sends a half-written line. The guard is a ref, not
243
- * state, because it has to be readable inside the keydown that fires between the two events.
244
- * 2. **One trailing action at a time.** While a response streams the send button IS the cancel
245
- * button — the same discipline as the picker trailing-action rule. Rendering both is how a
246
- * user cancels by aiming for send.
247
- * 3. **The draft box is the focus target.** `ref`, `id`, `name` and the whole `FormField`
248
- * label/helper/error contract land on the `<textarea>`, not on the frame, so a composer inside
249
- * a `FormField` is labelled and described exactly like an `Input`.
250
- *
251
- * Everything visible is a real primitive: the draft box is `Textarea` (`variant="borderless"`, so
252
- * the frame is the only boundary) and every action is a `Button`.
253
- */
254
- declare const ChatComposer: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement>, "defaultValue" | "prefix" | "onChange" | "onSubmit" | "onKeyDown"> & FieldA11yProps & {
255
- value?: ValueProp<string>;
256
- defaultValue?: DefaultValueProp<string>;
257
- onValueChange?: OnValueChangeProp<string>;
258
- onSubmit?: (value: string) => void;
259
- onCancel?: () => void;
260
- loading?: PendingProp;
261
- submitType?: ChatComposerSubmitTypeProp;
262
- allowEmptySubmit?: boolean;
263
- placeholder?: PlaceholderProp;
264
- disabled?: DisabledProp;
265
- readOnly?: boolean;
266
- header?: React.ReactNode;
267
- prefix?: React.ReactNode;
268
- footer?: ChatComposerFooterProp;
269
- actions?: React.ReactNode | false;
270
- size?: SizeProp;
271
- maxLength?: number;
272
- status?: ControlStatusProp;
273
- submitLabel?: string;
274
- cancelLabel?: string;
275
- onKeyDown?: React.KeyboardEventHandler<HTMLTextAreaElement>;
276
- name?: NameProp;
277
- id?: IdProp;
278
- className?: ClassNameProp;
279
- } & React.RefAttributes<HTMLTextAreaElement>>;
280
-
281
- /**
282
- * ChatSuggestion — trigger-character autocomplete over a `ChatComposer` (Ant Design X
283
- * `Suggestion`).
284
- *
285
- * ## What it owns, and what it deliberately does not
286
- *
287
- * The list is the existing `Command` (cmdk) inside a `Popover`: the listbox/option roles, the
288
- * active-row bookkeeping and the scroll-into-view all come from a primitive that already ships
289
- * them, so there is no hand-rolled listbox here. What this component owns is the part `Command`
290
- * cannot know about — a `<textarea>` it does not render:
291
- *
292
- * - **Detecting the trigger at the CARET**, not merely anywhere in the text, so a `/` in the
293
- * middle of a URL opens nothing and a caret moved out of a token closes the list.
294
- * - **Driving the list from a box that keeps focus.** Focus never leaves the textarea (the popover
295
- * is opened with `onOpenAutoFocus` prevented), so arrows/Enter are forwarded through the render
296
- * prop and the active row is announced through `aria-activedescendant` — the APG combobox
297
- * pattern, rather than moving focus into the panel and stranding the draft.
298
- * - **`Escape` costs nothing.** It closes the list, returns focus to the textarea and leaves the
299
- * typed text exactly as it was; a suggestion list that eats the draft on dismiss is the defect
300
- * this guards.
301
- */
302
- declare function ChatSuggestion({ items, onValueChange, triggerCharacter, open, defaultOpen, onOpenChange, children, emptyMessage, listLabel: listLabelProp, id, className, allowSpaces, terminator, shouldFilter, onQueryChange, }: ChatSuggestionProp): React.JSX.Element;
303
- declare namespace ChatSuggestion {
304
- var displayName: string;
305
- }
306
-
307
- declare const Attachments: React.ForwardRefExoticComponent<Omit<_godxjp_ui_data_entry.UploadProps, "value" | "children" | "defaultValue" | "variant" | "onValueChange" | "showUploadList" | "onRemove"> & {
308
- items?: readonly AttachmentsItemProp[];
309
- onChange?: (info: {
310
- file: AttachmentsItemProp;
311
- fileList: AttachmentsItemProp[];
312
- }) => void;
313
- onRemove?: (item: AttachmentsItemProp) => boolean | void | Promise<boolean | void>;
314
- overflow?: AttachmentsOverflowProp;
315
- placeholder?: AttachmentsPlaceholderProp | ((type: "inline" | "drop") => AttachmentsPlaceholderProp);
316
- getDropContainer?: (() => HTMLElement | null | undefined) | null;
317
- classNames?: Partial<Record<AttachmentsSemanticProp, string>>;
318
- styles?: Partial<Record<AttachmentsSemanticProp, React.CSSProperties>>;
319
- rootClassName?: ClassNameProp;
320
- children?: React.ReactElement;
321
- imageProps?: Record<string, unknown>;
322
- } & React.RefAttributes<AttachmentsRefProp>>;
323
-
324
- /**
325
- * Conversations — the session rail of a chat surface (Ant Design X `Conversations`).
326
- *
327
- * ## What is ported, and the one half that is deliberately not
328
- *
329
- * Every prop a caller passes keeps Ant X's spelling and semantics: `items` (conversations and
330
- * `{ type: "divider" }` rules), `activeKey` / `defaultActiveKey` / `onActiveChange`, `menu` (flat
331
- * or per-row), `groupable` (with `label`, `collapsible` and the `expandedKeys` triad) and
332
- * `creation`. The two knobs left out are `styles` / `classNames` — the semantic style maps — and
333
- * they are left out by a standing decision of this repository, not by omission: a free-form style
334
- * hole freezes internal DOM slot names into public API and is unmeasurable by the audit
335
- * (docs/WHAT-BELONGS-HERE.md · "Lỗ kiểu dáng tự do"; docs/DESIGN-AUTHORITY.md · "A knob that only
336
- * a fork could reach is not parity either"). The rail is retuned through
337
- * `src/tokens/components/conversations.css` instead. `prefixCls`, `rootClassName`,
338
- * `menu.getPopupContainer`, `menu.trigger` and `shortcutKeys` are out for the same reason or
339
- * because the subsystem behind them does not exist here (see the PR for the per-prop ledger).
340
- *
341
- * ## What this adds, because Ant X's rail has no keyboard model at all
342
- *
343
- * Measured in `@ant-design/x@2.9.0`: `es/conversations/Item.js` renders a bare
344
- * `<li title … onClick>`. No `role`, no `tabIndex`, no key handling — the rail is unreachable by
345
- * keyboard, and a screen reader meets twelve list items with no hint that any of them is a
346
- * control or that one of them is current. Neither is the hand-rolled alternative the issue
347
- * describes (a stack of `Button`s) any better on the axis that matters: it is one tab stop PER
348
- * conversation.
349
- *
350
- * So the rows here are real `Button`s under ONE roving tabindex, the APG composite-widget rule:
351
- *
352
- * - the whole rail — group headings included — is a single tab stop;
353
- * - `↑` / `↓` walk it and wrap, `Home` / `End` jump to its ends;
354
- * - the logical FORWARD arrow (`→` in LTR, `←` in RTL) steps from a row onto its overflow menu,
355
- * and the backward arrow steps back, so a row's second action costs no extra tab stop;
356
- * - the current conversation carries `aria-current="true"`, which is what makes "current" survive
357
- * a theme that does not tint (WCAG 1.4.1 — never colour alone).
358
- */
359
- declare const Conversations: React.ForwardRefExoticComponent<ConversationsProp & React.RefAttributes<HTMLDivElement>>;
360
-
361
- /**
362
- * ThoughtChain — the assistant's reasoning, step by step (Ant Design X `ThoughtChain`).
363
- *
364
- * ## The shape, and why it is an `<ol>`
365
- *
366
- * Ant renders the whole chain as nested `<div>`s and paints the step number itself
367
- * (`index + 1` in `es/thought-chain/Node.js`). The order of the steps IS the content here — step 3
368
- * only makes sense after step 2 — so the chain is an ordered list and a screen reader gets "list,
369
- * 4 items" plus each step's position for free. The visible ordinal stays, because the same number
370
- * has to be on screen for a sighted reader following a long chain.
371
- *
372
- * ## The disclosure is a real button
373
- *
374
- * A `collapsible` step's title in Ant is a `<div onClick>` with a rotating chevron — no role, no
375
- * `tabIndex`, no `aria-expanded`. Here it is a `<button aria-expanded aria-controls>` over the
376
- * body it opens: the WAI-ARIA APG Disclosure pattern, so the step can be opened from the keyboard
377
- * and its state is announced rather than inferred from a rotation.
378
- *
379
- * Everything a caller passes keeps Ant's spelling: `items` (with `icon`, `title`, `description`,
380
- * `content`, `footer`, `status`, `collapsible`, `blink`, `destroyOnHidden`), the
381
- * `defaultExpandedKeys` / `expandedKeys` / `onExpand` triad, and `line`. `styles` / `classNames` /
382
- * `prefixCls` / `rootClassName` are not ported — the standing style-hole decision
383
- * (docs/WHAT-BELONGS-HERE.md, docs/DESIGN-AUTHORITY.md); the chain is retuned through
384
- * `src/tokens/components/thought-chain.css`.
385
- */
386
- declare const ThoughtChain: React.ForwardRefExoticComponent<ThoughtChainProp & React.RefAttributes<HTMLOListElement>>;
387
- /**
388
- * ThoughtChainItem — one step OUTSIDE a chain (Ant Design X `ThoughtChain.Item`).
389
- *
390
- * A named export rather than `ThoughtChain.Item`, for the same reason `ActionsItem` is: every
391
- * compound in this library is separate named exports (`CardHeader`, `TabsList`), and attaching
392
- * statics to one component would be the only instance of it here.
393
- *
394
- * ONE DEVIATION: Ant renders the chip as a `<div>` and hangs `onClick` on it, so a clickable step
395
- * is invisible to the keyboard and to assistive technology. Here an item WITH `onClick` renders a
396
- * real `<button>` and one without renders a plain `<div>` — the element follows whether the thing
397
- * is actually a control.
398
- */
399
- declare const ThoughtChainItem: React.ForwardRefExoticComponent<ThoughtChainItemProp & React.RefAttributes<HTMLElement>>;
400
-
401
- /**
402
- * Welcome — the greeting block at the head of an empty conversation (Ant Design X `Welcome`).
403
- *
404
- * ## Why this is a component and not four lines of composition
405
- *
406
- * It is close to the line, and the honest answer is that the SHAPE is the value: an assistant's
407
- * first screen is the same object in every product — glyph, greeting, one line under it, one
408
- * trailing action — and Ant X named it, so every consumer that builds a chat now expects the name.
409
- * What it owns beyond a `Flex` is the `extra` slot's placement (on the TITLE row, not below the
410
- * description, which is where a hand-roll puts it) and the `icon`-as-URL rule below.
411
- *
412
- * ## Two deliberate differences from Ant X, both in the same direction
413
- *
414
- * - **The image icon is decorative.** Ant renders `alt="icon"` — a screen reader then reads the
415
- * word "icon" beside a title the glyph is only decorating. Here it is `alt=""`, which is what an
416
- * image that duplicates adjacent text is supposed to be.
417
- * - **The heading level is Ant's.** Ant hardcodes `Typography.Title level={4}`, so this renders an
418
- * `<h4>`. Hardcoding a level is a document-structure decision a component should not normally
419
- * make, but the alternative — inventing a `level` prop Ant does not have — is a second spelling
420
- * of an axis the issue asked to port verbatim. Wrap it in your own heading hierarchy if the page
421
- * needs a different rung.
422
- */
423
- declare const Welcome: React.ForwardRefExoticComponent<WelcomeProp & React.RefAttributes<HTMLDivElement>>;
424
-
425
- export { Attachments, ChatBubble, ChatBubbleList, type ChatBubbleListProps, type ChatBubbleProps, ChatComposer, ChatSuggestion, Conversations, ThoughtChain, ThoughtChainItem, Welcome };
9
+ import 'react';
10
+ import './data-entry.prop-D4jLTqUk.js';
11
+ import '@godxjp/ui/data-entry';