@assistant-ui/react-native 0.1.37 → 0.1.38

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.
Files changed (165) hide show
  1. package/dist/index.d.ts +3 -2
  2. package/dist/index.js +2 -1
  3. package/dist/primitives/actionBar/ActionBarCopy.js +1 -0
  4. package/dist/primitives/actionBar/ActionBarCopy.js.map +1 -1
  5. package/dist/primitives/actionBar/ActionBarEdit.d.ts +2 -3
  6. package/dist/primitives/actionBar/ActionBarEdit.d.ts.map +1 -1
  7. package/dist/primitives/actionBar/ActionBarEdit.js +1 -0
  8. package/dist/primitives/actionBar/ActionBarEdit.js.map +1 -1
  9. package/dist/primitives/actionBar/ActionBarFeedbackNegative.js +1 -0
  10. package/dist/primitives/actionBar/ActionBarFeedbackNegative.js.map +1 -1
  11. package/dist/primitives/actionBar/ActionBarFeedbackPositive.js +1 -0
  12. package/dist/primitives/actionBar/ActionBarFeedbackPositive.js.map +1 -1
  13. package/dist/primitives/actionBar/ActionBarReload.d.ts +2 -3
  14. package/dist/primitives/actionBar/ActionBarReload.d.ts.map +1 -1
  15. package/dist/primitives/actionBar/ActionBarReload.js +1 -0
  16. package/dist/primitives/actionBar/ActionBarReload.js.map +1 -1
  17. package/dist/primitives/attachment/AttachmentRemove.d.ts +2 -3
  18. package/dist/primitives/attachment/AttachmentRemove.d.ts.map +1 -1
  19. package/dist/primitives/attachment/AttachmentRemove.js +1 -0
  20. package/dist/primitives/attachment/AttachmentRemove.js.map +1 -1
  21. package/dist/primitives/branchPicker/BranchPickerNext.d.ts +2 -3
  22. package/dist/primitives/branchPicker/BranchPickerNext.d.ts.map +1 -1
  23. package/dist/primitives/branchPicker/BranchPickerNext.js +1 -0
  24. package/dist/primitives/branchPicker/BranchPickerNext.js.map +1 -1
  25. package/dist/primitives/branchPicker/BranchPickerPrevious.d.ts +2 -3
  26. package/dist/primitives/branchPicker/BranchPickerPrevious.d.ts.map +1 -1
  27. package/dist/primitives/branchPicker/BranchPickerPrevious.js +1 -0
  28. package/dist/primitives/branchPicker/BranchPickerPrevious.js.map +1 -1
  29. package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.d.ts +2 -3
  30. package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.d.ts.map +1 -1
  31. package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.js +1 -0
  32. package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.js.map +1 -1
  33. package/dist/primitives/composer/ComposerAddAttachment.d.ts +2 -3
  34. package/dist/primitives/composer/ComposerAddAttachment.d.ts.map +1 -1
  35. package/dist/primitives/composer/ComposerAddAttachment.js +1 -0
  36. package/dist/primitives/composer/ComposerAddAttachment.js.map +1 -1
  37. package/dist/primitives/composer/ComposerCancel.d.ts +2 -3
  38. package/dist/primitives/composer/ComposerCancel.d.ts.map +1 -1
  39. package/dist/primitives/composer/ComposerCancel.js +1 -0
  40. package/dist/primitives/composer/ComposerCancel.js.map +1 -1
  41. package/dist/primitives/composer/ComposerQueue.d.ts +2 -0
  42. package/dist/primitives/composer/ComposerQueue.js +2 -0
  43. package/dist/primitives/composer/ComposerQuote.d.ts +10 -0
  44. package/dist/primitives/composer/ComposerQuote.d.ts.map +1 -0
  45. package/dist/primitives/composer/ComposerQuote.js +38 -0
  46. package/dist/primitives/composer/ComposerQuote.js.map +1 -0
  47. package/dist/primitives/composer/ComposerQuoteDismiss.d.ts +9 -0
  48. package/dist/primitives/composer/ComposerQuoteDismiss.d.ts.map +1 -0
  49. package/dist/primitives/composer/ComposerQuoteDismiss.js +48 -0
  50. package/dist/primitives/composer/ComposerQuoteDismiss.js.map +1 -0
  51. package/dist/primitives/composer/ComposerQuoteText.d.ts +10 -0
  52. package/dist/primitives/composer/ComposerQuoteText.d.ts.map +1 -0
  53. package/dist/primitives/composer/ComposerQuoteText.js +40 -0
  54. package/dist/primitives/composer/ComposerQuoteText.js.map +1 -0
  55. package/dist/primitives/composer/ComposerSend.d.ts +2 -3
  56. package/dist/primitives/composer/ComposerSend.d.ts.map +1 -1
  57. package/dist/primitives/composer/ComposerSend.js +1 -0
  58. package/dist/primitives/composer/ComposerSend.js.map +1 -1
  59. package/dist/primitives/composer.d.ts +6 -2
  60. package/dist/primitives/composer.js +9 -1
  61. package/dist/primitives/composer.js.map +1 -1
  62. package/dist/primitives/message/MessageIf.d.ts +3 -0
  63. package/dist/primitives/message/MessageIf.d.ts.map +1 -1
  64. package/dist/primitives/message/MessageIf.js +3 -0
  65. package/dist/primitives/message/MessageIf.js.map +1 -1
  66. package/dist/primitives/queueItem/QueueItemRemove.d.ts +9 -0
  67. package/dist/primitives/queueItem/QueueItemRemove.d.ts.map +1 -0
  68. package/dist/primitives/queueItem/QueueItemRemove.js +48 -0
  69. package/dist/primitives/queueItem/QueueItemRemove.js.map +1 -0
  70. package/dist/primitives/queueItem/QueueItemSteer.d.ts +9 -0
  71. package/dist/primitives/queueItem/QueueItemSteer.d.ts.map +1 -0
  72. package/dist/primitives/queueItem/QueueItemSteer.js +48 -0
  73. package/dist/primitives/queueItem/QueueItemSteer.js.map +1 -0
  74. package/dist/primitives/queueItem/QueueItemText.d.ts +10 -0
  75. package/dist/primitives/queueItem/QueueItemText.d.ts.map +1 -0
  76. package/dist/primitives/queueItem/QueueItemText.js +45 -0
  77. package/dist/primitives/queueItem/QueueItemText.js.map +1 -0
  78. package/dist/primitives/queueItem.d.ts +9 -0
  79. package/dist/primitives/queueItem.d.ts.map +1 -0
  80. package/dist/primitives/queueItem.js +14 -0
  81. package/dist/primitives/queueItem.js.map +1 -0
  82. package/dist/primitives/suggestion/SuggestionTrigger.d.ts +2 -3
  83. package/dist/primitives/suggestion/SuggestionTrigger.d.ts.map +1 -1
  84. package/dist/primitives/suggestion/SuggestionTrigger.js +1 -0
  85. package/dist/primitives/suggestion/SuggestionTrigger.js.map +1 -1
  86. package/dist/primitives/thread/ThreadEmpty.d.ts +4 -1
  87. package/dist/primitives/thread/ThreadEmpty.d.ts.map +1 -1
  88. package/dist/primitives/thread/ThreadEmpty.js +12 -4
  89. package/dist/primitives/thread/ThreadEmpty.js.map +1 -1
  90. package/dist/primitives/thread/ThreadIf.d.ts +3 -0
  91. package/dist/primitives/thread/ThreadIf.d.ts.map +1 -1
  92. package/dist/primitives/thread/ThreadIf.js +5 -6
  93. package/dist/primitives/thread/ThreadIf.js.map +1 -1
  94. package/dist/primitives/thread/ThreadSuggestion.d.ts +2 -3
  95. package/dist/primitives/thread/ThreadSuggestion.d.ts.map +1 -1
  96. package/dist/primitives/thread/ThreadSuggestion.js +1 -0
  97. package/dist/primitives/thread/ThreadSuggestion.js.map +1 -1
  98. package/dist/primitives/threadList/ThreadListNew.d.ts +6 -4
  99. package/dist/primitives/threadList/ThreadListNew.d.ts.map +1 -1
  100. package/dist/primitives/threadList/ThreadListNew.js +46 -15
  101. package/dist/primitives/threadList/ThreadListNew.js.map +1 -1
  102. package/dist/primitives/threadListItem/ThreadListItemArchive.d.ts +2 -3
  103. package/dist/primitives/threadListItem/ThreadListItemArchive.d.ts.map +1 -1
  104. package/dist/primitives/threadListItem/ThreadListItemArchive.js +1 -0
  105. package/dist/primitives/threadListItem/ThreadListItemArchive.js.map +1 -1
  106. package/dist/primitives/threadListItem/ThreadListItemDelete.d.ts +2 -3
  107. package/dist/primitives/threadListItem/ThreadListItemDelete.d.ts.map +1 -1
  108. package/dist/primitives/threadListItem/ThreadListItemDelete.js +1 -0
  109. package/dist/primitives/threadListItem/ThreadListItemDelete.js.map +1 -1
  110. package/dist/primitives/threadListItem/ThreadListItemTrigger.d.ts +6 -4
  111. package/dist/primitives/threadListItem/ThreadListItemTrigger.d.ts.map +1 -1
  112. package/dist/primitives/threadListItem/ThreadListItemTrigger.js +46 -15
  113. package/dist/primitives/threadListItem/ThreadListItemTrigger.js.map +1 -1
  114. package/dist/primitives/threadListItem/ThreadListItemUnarchive.d.ts +2 -3
  115. package/dist/primitives/threadListItem/ThreadListItemUnarchive.d.ts.map +1 -1
  116. package/dist/primitives/threadListItem/ThreadListItemUnarchive.js +1 -0
  117. package/dist/primitives/threadListItem/ThreadListItemUnarchive.js.map +1 -1
  118. package/package.json +5 -5
  119. package/src/index.ts +2 -0
  120. package/src/primitives/accessibilityRole.test.tsx +335 -0
  121. package/src/primitives/actionBar/ActionBarCopy.tsx +1 -0
  122. package/src/primitives/actionBar/ActionBarEdit.tsx +6 -3
  123. package/src/primitives/actionBar/ActionBarFeedbackNegative.tsx +1 -1
  124. package/src/primitives/actionBar/ActionBarFeedbackPositive.tsx +1 -1
  125. package/src/primitives/actionBar/ActionBarReload.tsx +6 -3
  126. package/src/primitives/attachment/AttachmentRemove.tsx +11 -4
  127. package/src/primitives/branchPicker/BranchPickerNext.tsx +6 -3
  128. package/src/primitives/branchPicker/BranchPickerPrevious.tsx +6 -3
  129. package/src/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.tsx +4 -4
  130. package/src/primitives/composer/ComposerAddAttachment.tsx +10 -4
  131. package/src/primitives/composer/ComposerCancel.tsx +6 -3
  132. package/src/primitives/composer/ComposerQueue.test.tsx +9 -0
  133. package/src/primitives/composer/ComposerQueue.tsx +1 -0
  134. package/src/primitives/composer/ComposerQuote.test.tsx +163 -0
  135. package/src/primitives/composer/ComposerQuote.tsx +17 -0
  136. package/src/primitives/composer/ComposerQuoteDismiss.tsx +31 -0
  137. package/src/primitives/composer/ComposerQuoteText.tsx +17 -0
  138. package/src/primitives/composer/ComposerSend.test.tsx +26 -0
  139. package/src/primitives/composer/ComposerSend.tsx +3 -3
  140. package/src/primitives/composer.ts +13 -0
  141. package/src/primitives/message/MessageIf.tsx +3 -0
  142. package/src/primitives/queueItem/QueueItem.test.tsx +132 -0
  143. package/src/primitives/queueItem/QueueItemRemove.tsx +31 -0
  144. package/src/primitives/queueItem/QueueItemSteer.tsx +31 -0
  145. package/src/primitives/queueItem/QueueItemText.tsx +22 -0
  146. package/src/primitives/queueItem.ts +12 -0
  147. package/src/primitives/suggestion/SuggestionTrigger.tsx +6 -3
  148. package/src/primitives/thread/ThreadEmpty.test.tsx +17 -3
  149. package/src/primitives/thread/ThreadEmpty.tsx +7 -6
  150. package/src/primitives/thread/ThreadIf.test.tsx +20 -20
  151. package/src/primitives/thread/ThreadIf.tsx +5 -8
  152. package/src/primitives/thread/ThreadSuggestion.tsx +6 -3
  153. package/src/primitives/threadList/ThreadListNew.test.tsx +118 -3
  154. package/src/primitives/threadList/ThreadListNew.tsx +28 -5
  155. package/src/primitives/threadListItem/ThreadListItemArchive.tsx +6 -4
  156. package/src/primitives/threadListItem/ThreadListItemDelete.tsx +10 -4
  157. package/src/primitives/threadListItem/ThreadListItemTrigger.test.tsx +74 -0
  158. package/src/primitives/threadListItem/ThreadListItemTrigger.tsx +28 -5
  159. package/src/primitives/threadListItem/ThreadListItemUnarchive.tsx +10 -4
  160. package/dist/runtimes/RemoteThreadListHookInstanceManager.d.ts +0 -2
  161. package/dist/runtimes/RemoteThreadListHookInstanceManager.js +0 -2
  162. package/dist/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts +0 -2
  163. package/dist/runtimes/RemoteThreadListThreadListRuntimeCore.js +0 -2
  164. package/src/runtimes/RemoteThreadListHookInstanceManager.tsx +0 -1
  165. package/src/runtimes/RemoteThreadListThreadListRuntimeCore.tsx +0 -1
@@ -0,0 +1,335 @@
1
+ import { act, type ReactNode } from "react";
2
+ import { createRoot, type Root } from "react-dom/client";
3
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
4
+
5
+ import { ActionBarCopy } from "./actionBar/ActionBarCopy";
6
+ import { ActionBarEdit } from "./actionBar/ActionBarEdit";
7
+ import { ActionBarFeedbackNegative } from "./actionBar/ActionBarFeedbackNegative";
8
+ import { ActionBarFeedbackPositive } from "./actionBar/ActionBarFeedbackPositive";
9
+ import { ActionBarReload } from "./actionBar/ActionBarReload";
10
+ import { AttachmentRemove } from "./attachment/AttachmentRemove";
11
+ import { BranchPickerNext } from "./branchPicker/BranchPickerNext";
12
+ import { BranchPickerPrevious } from "./branchPicker/BranchPickerPrevious";
13
+ import { ChainOfThoughtAccordionTrigger } from "./chainOfThought/ChainOfThoughtAccordionTrigger";
14
+ import { ComposerAddAttachment } from "./composer/ComposerAddAttachment";
15
+ import { ComposerCancel } from "./composer/ComposerCancel";
16
+ import { ComposerQuoteDismiss } from "./composer/ComposerQuoteDismiss";
17
+ import { ComposerSend } from "./composer/ComposerSend";
18
+ import { QueueItemRemove } from "./queueItem/QueueItemRemove";
19
+ import { QueueItemSteer } from "./queueItem/QueueItemSteer";
20
+ import { SuggestionTrigger } from "./suggestion/SuggestionTrigger";
21
+ import { ThreadSuggestion } from "./thread/ThreadSuggestion";
22
+ import { ThreadListNew } from "./threadList/ThreadListNew";
23
+ import { ThreadListItemArchive } from "./threadListItem/ThreadListItemArchive";
24
+ import { ThreadListItemDelete } from "./threadListItem/ThreadListItemDelete";
25
+ import { ThreadListItemTrigger } from "./threadListItem/ThreadListItemTrigger";
26
+ import { ThreadListItemUnarchive } from "./threadListItem/ThreadListItemUnarchive";
27
+
28
+ vi.mock("@assistant-ui/store", () => ({
29
+ useAui: () => ({
30
+ attachment: { remove: vi.fn() },
31
+ chainOfThought: { setCollapsed: vi.fn() },
32
+ composer: { setQuote: vi.fn() },
33
+ queueItem: { remove: vi.fn(), steer: vi.fn() },
34
+ }),
35
+ useAuiState: <T,>(
36
+ selector: (s: {
37
+ suggestion: { prompt: string };
38
+ chainOfThought: { collapsed: boolean };
39
+ threads: { newThreadId: string | null; mainThreadId: string };
40
+ threadListItem: { id: string };
41
+ }) => T,
42
+ ) =>
43
+ selector({
44
+ suggestion: { prompt: "p" },
45
+ chainOfThought: { collapsed: false },
46
+ threads: { newThreadId: null, mainThreadId: "main" },
47
+ threadListItem: { id: "thread" },
48
+ }),
49
+ }));
50
+
51
+ vi.mock("@assistant-ui/core/react", () => ({
52
+ useActionBarCopy: () => ({
53
+ copy: vi.fn(),
54
+ disabled: false,
55
+ isCopied: false,
56
+ }),
57
+ useActionBarEdit: () => ({ edit: vi.fn(), disabled: false }),
58
+ useActionBarFeedbackNegative: () => ({
59
+ submit: vi.fn(),
60
+ isSubmitted: false,
61
+ }),
62
+ useActionBarFeedbackPositive: () => ({
63
+ submit: vi.fn(),
64
+ isSubmitted: false,
65
+ }),
66
+ useActionBarReload: () => ({ reload: vi.fn(), disabled: false }),
67
+ useBranchPickerNext: () => ({ next: vi.fn(), disabled: false }),
68
+ useBranchPickerPrevious: () => ({ previous: vi.fn(), disabled: false }),
69
+ useComposerAddAttachment: () => ({ disabled: false }),
70
+ useComposerCancel: () => ({ cancel: vi.fn(), disabled: false }),
71
+ useComposerSend: () => ({ send: vi.fn(), disabled: false }),
72
+ useSuggestionTrigger: () => ({ trigger: vi.fn(), disabled: false }),
73
+ useThreadListNew: () => ({ switchToNewThread: vi.fn() }),
74
+ useThreadListItemArchive: () => ({ archive: vi.fn() }),
75
+ useThreadListItemDelete: () => ({ delete: vi.fn() }),
76
+ useThreadListItemTrigger: () => ({ switchTo: vi.fn() }),
77
+ useThreadListItemUnarchive: () => ({ unarchive: vi.fn() }),
78
+ }));
79
+
80
+ (globalThis as Record<string, unknown>).IS_REACT_ACT_ENVIRONMENT = true;
81
+
82
+ declare global {
83
+ interface ImportMeta {
84
+ glob(
85
+ pattern: string,
86
+ options: { query: "?raw"; eager: true; import: "default" },
87
+ ): Record<string, string>;
88
+ }
89
+ }
90
+
91
+ type Extra = { accessibilityRole?: "link" | undefined };
92
+
93
+ const actionable: ReadonlyArray<{
94
+ name: string;
95
+ render: (extra: Extra) => ReactNode;
96
+ }> = [
97
+ {
98
+ name: "ActionBarCopy",
99
+ render: (e) => (
100
+ <ActionBarCopy testID="t" {...e}>
101
+ x
102
+ </ActionBarCopy>
103
+ ),
104
+ },
105
+ {
106
+ name: "ActionBarEdit",
107
+ render: (e) => (
108
+ <ActionBarEdit testID="t" {...e}>
109
+ x
110
+ </ActionBarEdit>
111
+ ),
112
+ },
113
+ {
114
+ name: "ActionBarFeedbackNegative",
115
+ render: (e) => (
116
+ <ActionBarFeedbackNegative testID="t" {...e}>
117
+ x
118
+ </ActionBarFeedbackNegative>
119
+ ),
120
+ },
121
+ {
122
+ name: "ActionBarFeedbackPositive",
123
+ render: (e) => (
124
+ <ActionBarFeedbackPositive testID="t" {...e}>
125
+ x
126
+ </ActionBarFeedbackPositive>
127
+ ),
128
+ },
129
+ {
130
+ name: "ActionBarReload",
131
+ render: (e) => (
132
+ <ActionBarReload testID="t" {...e}>
133
+ x
134
+ </ActionBarReload>
135
+ ),
136
+ },
137
+ {
138
+ name: "AttachmentRemove",
139
+ render: (e) => (
140
+ <AttachmentRemove testID="t" {...e}>
141
+ x
142
+ </AttachmentRemove>
143
+ ),
144
+ },
145
+ {
146
+ name: "BranchPickerNext",
147
+ render: (e) => (
148
+ <BranchPickerNext testID="t" {...e}>
149
+ x
150
+ </BranchPickerNext>
151
+ ),
152
+ },
153
+ {
154
+ name: "BranchPickerPrevious",
155
+ render: (e) => (
156
+ <BranchPickerPrevious testID="t" {...e}>
157
+ x
158
+ </BranchPickerPrevious>
159
+ ),
160
+ },
161
+ {
162
+ name: "ChainOfThoughtAccordionTrigger",
163
+ render: (e) => (
164
+ <ChainOfThoughtAccordionTrigger testID="t" {...e}>
165
+ x
166
+ </ChainOfThoughtAccordionTrigger>
167
+ ),
168
+ },
169
+ {
170
+ name: "ComposerAddAttachment",
171
+ render: (e) => (
172
+ <ComposerAddAttachment testID="t" {...e}>
173
+ x
174
+ </ComposerAddAttachment>
175
+ ),
176
+ },
177
+ {
178
+ name: "ComposerCancel",
179
+ render: (e) => (
180
+ <ComposerCancel testID="t" {...e}>
181
+ x
182
+ </ComposerCancel>
183
+ ),
184
+ },
185
+ {
186
+ name: "ComposerSend",
187
+ render: (e) => (
188
+ <ComposerSend testID="t" {...e}>
189
+ x
190
+ </ComposerSend>
191
+ ),
192
+ },
193
+ {
194
+ name: "ComposerQuoteDismiss",
195
+ render: (e) => (
196
+ <ComposerQuoteDismiss testID="t" {...e}>
197
+ x
198
+ </ComposerQuoteDismiss>
199
+ ),
200
+ },
201
+ {
202
+ name: "QueueItemRemove",
203
+ render: (e) => (
204
+ <QueueItemRemove testID="t" {...e}>
205
+ x
206
+ </QueueItemRemove>
207
+ ),
208
+ },
209
+ {
210
+ name: "QueueItemSteer",
211
+ render: (e) => (
212
+ <QueueItemSteer testID="t" {...e}>
213
+ x
214
+ </QueueItemSteer>
215
+ ),
216
+ },
217
+ {
218
+ name: "SuggestionTrigger",
219
+ render: (e) => (
220
+ <SuggestionTrigger testID="t" {...e}>
221
+ x
222
+ </SuggestionTrigger>
223
+ ),
224
+ },
225
+ {
226
+ name: "ThreadSuggestion",
227
+ render: (e) => (
228
+ <ThreadSuggestion testID="t" prompt="p" {...e}>
229
+ x
230
+ </ThreadSuggestion>
231
+ ),
232
+ },
233
+ {
234
+ name: "ThreadListNew",
235
+ render: (e) => (
236
+ <ThreadListNew testID="t" {...e}>
237
+ x
238
+ </ThreadListNew>
239
+ ),
240
+ },
241
+ {
242
+ name: "ThreadListItemArchive",
243
+ render: (e) => (
244
+ <ThreadListItemArchive testID="t" {...e}>
245
+ x
246
+ </ThreadListItemArchive>
247
+ ),
248
+ },
249
+ {
250
+ name: "ThreadListItemDelete",
251
+ render: (e) => (
252
+ <ThreadListItemDelete testID="t" {...e}>
253
+ x
254
+ </ThreadListItemDelete>
255
+ ),
256
+ },
257
+ {
258
+ name: "ThreadListItemTrigger",
259
+ render: (e) => (
260
+ <ThreadListItemTrigger testID="t" {...e}>
261
+ x
262
+ </ThreadListItemTrigger>
263
+ ),
264
+ },
265
+ {
266
+ name: "ThreadListItemUnarchive",
267
+ render: (e) => (
268
+ <ThreadListItemUnarchive testID="t" {...e}>
269
+ x
270
+ </ThreadListItemUnarchive>
271
+ ),
272
+ },
273
+ ];
274
+
275
+ describe("react-native primitive accessibility roles", () => {
276
+ let container: HTMLDivElement;
277
+ let root: Root;
278
+
279
+ beforeEach(() => {
280
+ container = document.createElement("div");
281
+ document.body.appendChild(container);
282
+ root = createRoot(container);
283
+ });
284
+
285
+ afterEach(async () => {
286
+ await act(async () => {
287
+ root.unmount();
288
+ });
289
+ container.remove();
290
+ });
291
+
292
+ const mount = async (node: ReactNode) => {
293
+ await act(async () => {
294
+ root.render(node);
295
+ });
296
+ const el = container.querySelector('[data-testid="t"]');
297
+ expect(el).not.toBeNull();
298
+ return el as HTMLElement;
299
+ };
300
+
301
+ it("gives every Pressable primitive in the package a button role", () => {
302
+ const wrappers = Object.entries(
303
+ import.meta.glob("./**/*.tsx", {
304
+ query: "?raw",
305
+ eager: true,
306
+ import: "default",
307
+ }),
308
+ ).filter(
309
+ ([file, source]) =>
310
+ !file.endsWith(".test.tsx") && source.includes("<Pressable"),
311
+ );
312
+
313
+ expect(
314
+ wrappers
315
+ .filter(([, source]) => !source.includes('accessibilityRole="button"'))
316
+ .map(([file]) => file),
317
+ ).toEqual([]);
318
+
319
+ expect(
320
+ wrappers.map(([file]) => file.replace(/^.*\/|\.tsx$/g, "")).sort(),
321
+ ).toEqual(actionable.map(({ name }) => name).sort());
322
+ });
323
+
324
+ for (const { name, render } of actionable) {
325
+ it(`${name} defaults its accessibilityRole to button`, async () => {
326
+ const el = await mount(render({}));
327
+ expect(el.getAttribute("role")).toBe("button");
328
+ });
329
+
330
+ it(`${name} lets the caller override the role`, async () => {
331
+ const el = await mount(render({ accessibilityRole: "link" }));
332
+ expect(el.getAttribute("role")).toBe("link");
333
+ });
334
+ }
335
+ });
@@ -26,6 +26,7 @@ export const ActionBarCopy = ({
26
26
  <Pressable
27
27
  onPress={copy}
28
28
  disabled={disabledProp ?? disabled}
29
+ accessibilityRole="button"
29
30
  {...pressableProps}
30
31
  >
31
32
  {typeof children === "function" ? children({ isCopied }) : children}
@@ -1,9 +1,11 @@
1
- import type { ReactNode } from "react";
2
1
  import { Pressable, type PressableProps } from "react-native";
3
2
  import { useActionBarEdit } from "@assistant-ui/core/react";
4
3
 
5
- export type ActionBarEditProps = Omit<PressableProps, "onPress"> & {
6
- children: ReactNode;
4
+ export type ActionBarEditProps = Omit<
5
+ PressableProps,
6
+ "onPress" | "children"
7
+ > & {
8
+ children: PressableProps["children"];
7
9
  };
8
10
 
9
11
  export const ActionBarEdit = ({
@@ -17,6 +19,7 @@ export const ActionBarEdit = ({
17
19
  <Pressable
18
20
  onPress={edit}
19
21
  disabled={disabledProp ?? disabled}
22
+ accessibilityRole="button"
20
23
  {...pressableProps}
21
24
  >
22
25
  {children}
@@ -16,7 +16,7 @@ export const ActionBarFeedbackNegative = ({
16
16
  const { submit, isSubmitted } = useActionBarFeedbackNegative();
17
17
 
18
18
  return (
19
- <Pressable onPress={submit} {...pressableProps}>
19
+ <Pressable onPress={submit} accessibilityRole="button" {...pressableProps}>
20
20
  {typeof children === "function" ? children({ isSubmitted }) : children}
21
21
  </Pressable>
22
22
  );
@@ -16,7 +16,7 @@ export const ActionBarFeedbackPositive = ({
16
16
  const { submit, isSubmitted } = useActionBarFeedbackPositive();
17
17
 
18
18
  return (
19
- <Pressable onPress={submit} {...pressableProps}>
19
+ <Pressable onPress={submit} accessibilityRole="button" {...pressableProps}>
20
20
  {typeof children === "function" ? children({ isSubmitted }) : children}
21
21
  </Pressable>
22
22
  );
@@ -1,9 +1,11 @@
1
- import type { ReactNode } from "react";
2
1
  import { Pressable, type PressableProps } from "react-native";
3
2
  import { useActionBarReload } from "@assistant-ui/core/react";
4
3
 
5
- export type ActionBarReloadProps = Omit<PressableProps, "onPress"> & {
6
- children: ReactNode;
4
+ export type ActionBarReloadProps = Omit<
5
+ PressableProps,
6
+ "onPress" | "children"
7
+ > & {
8
+ children: PressableProps["children"];
7
9
  };
8
10
 
9
11
  export const ActionBarReload = ({
@@ -17,6 +19,7 @@ export const ActionBarReload = ({
17
19
  <Pressable
18
20
  onPress={reload}
19
21
  disabled={disabledProp ?? disabled}
22
+ accessibilityRole="button"
20
23
  {...pressableProps}
21
24
  >
22
25
  {children}
@@ -1,10 +1,13 @@
1
- import { type ReactNode, useCallback } from "react";
1
+ import { useCallback } from "react";
2
2
  import { Pressable, type PressableProps } from "react-native";
3
3
 
4
4
  import { useAui } from "@assistant-ui/store";
5
5
 
6
- export type AttachmentRemoveProps = Omit<PressableProps, "onPress"> & {
7
- children: ReactNode;
6
+ export type AttachmentRemoveProps = Omit<
7
+ PressableProps,
8
+ "onPress" | "children"
9
+ > & {
10
+ children: PressableProps["children"];
8
11
  };
9
12
 
10
13
  export const AttachmentRemove = ({
@@ -18,7 +21,11 @@ export const AttachmentRemove = ({
18
21
  }, [aui]);
19
22
 
20
23
  return (
21
- <Pressable onPress={handleRemove} {...pressableProps}>
24
+ <Pressable
25
+ onPress={handleRemove}
26
+ accessibilityRole="button"
27
+ {...pressableProps}
28
+ >
22
29
  {children}
23
30
  </Pressable>
24
31
  );
@@ -1,9 +1,11 @@
1
- import type { ReactNode } from "react";
2
1
  import { Pressable, type PressableProps } from "react-native";
3
2
  import { useBranchPickerNext } from "@assistant-ui/core/react";
4
3
 
5
- export type BranchPickerNextProps = Omit<PressableProps, "onPress"> & {
6
- children: ReactNode;
4
+ export type BranchPickerNextProps = Omit<
5
+ PressableProps,
6
+ "onPress" | "children"
7
+ > & {
8
+ children: PressableProps["children"];
7
9
  };
8
10
 
9
11
  export const BranchPickerNext = ({
@@ -17,6 +19,7 @@ export const BranchPickerNext = ({
17
19
  <Pressable
18
20
  onPress={next}
19
21
  disabled={disabledProp ?? disabled}
22
+ accessibilityRole="button"
20
23
  {...pressableProps}
21
24
  >
22
25
  {children}
@@ -1,9 +1,11 @@
1
- import type { ReactNode } from "react";
2
1
  import { Pressable, type PressableProps } from "react-native";
3
2
  import { useBranchPickerPrevious } from "@assistant-ui/core/react";
4
3
 
5
- export type BranchPickerPreviousProps = Omit<PressableProps, "onPress"> & {
6
- children: ReactNode;
4
+ export type BranchPickerPreviousProps = Omit<
5
+ PressableProps,
6
+ "onPress" | "children"
7
+ > & {
8
+ children: PressableProps["children"];
7
9
  };
8
10
 
9
11
  export const BranchPickerPrevious = ({
@@ -17,6 +19,7 @@ export const BranchPickerPrevious = ({
17
19
  <Pressable
18
20
  onPress={previous}
19
21
  disabled={disabledProp ?? disabled}
22
+ accessibilityRole="button"
20
23
  {...pressableProps}
21
24
  >
22
25
  {children}
@@ -1,12 +1,12 @@
1
- import { useCallback, type ReactNode } from "react";
1
+ import { useCallback } from "react";
2
2
  import { Pressable, type PressableProps } from "react-native";
3
3
  import { useAuiState, useAui } from "@assistant-ui/store";
4
4
 
5
5
  export type ChainOfThoughtAccordionTriggerProps = Omit<
6
6
  PressableProps,
7
- "onPress"
7
+ "onPress" | "children"
8
8
  > & {
9
- children: ReactNode;
9
+ children: PressableProps["children"];
10
10
  };
11
11
 
12
12
  export const ChainOfThoughtAccordionTrigger = ({
@@ -21,7 +21,7 @@ export const ChainOfThoughtAccordionTrigger = ({
21
21
  }, [aui, collapsed]);
22
22
 
23
23
  return (
24
- <Pressable onPress={onPress} {...pressableProps}>
24
+ <Pressable onPress={onPress} accessibilityRole="button" {...pressableProps}>
25
25
  {children}
26
26
  </Pressable>
27
27
  );
@@ -1,9 +1,11 @@
1
- import type { ReactNode } from "react";
2
1
  import { Pressable, type PressableProps } from "react-native";
3
2
  import { useComposerAddAttachment } from "@assistant-ui/core/react";
4
3
 
5
- export type ComposerAddAttachmentProps = Omit<PressableProps, "onPress"> & {
6
- children: ReactNode;
4
+ export type ComposerAddAttachmentProps = Omit<
5
+ PressableProps,
6
+ "onPress" | "children"
7
+ > & {
8
+ children: PressableProps["children"];
7
9
  };
8
10
 
9
11
  /**
@@ -21,7 +23,11 @@ export const ComposerAddAttachment = ({
21
23
  const { disabled } = useComposerAddAttachment();
22
24
 
23
25
  return (
24
- <Pressable disabled={disabledProp ?? disabled} {...pressableProps}>
26
+ <Pressable
27
+ disabled={disabledProp ?? disabled}
28
+ accessibilityRole="button"
29
+ {...pressableProps}
30
+ >
25
31
  {children}
26
32
  </Pressable>
27
33
  );
@@ -1,9 +1,11 @@
1
- import type { ReactNode } from "react";
2
1
  import { Pressable, type PressableProps } from "react-native";
3
2
  import { useComposerCancel } from "@assistant-ui/core/react";
4
3
 
5
- export type ComposerCancelProps = Omit<PressableProps, "onPress"> & {
6
- children: ReactNode;
4
+ export type ComposerCancelProps = Omit<
5
+ PressableProps,
6
+ "onPress" | "children"
7
+ > & {
8
+ children: PressableProps["children"];
7
9
  };
8
10
 
9
11
  export const ComposerCancel = ({
@@ -17,6 +19,7 @@ export const ComposerCancel = ({
17
19
  <Pressable
18
20
  onPress={cancel}
19
21
  disabled={disabled ?? hookDisabled}
22
+ accessibilityRole="button"
20
23
  {...pressableProps}
21
24
  >
22
25
  {children}
@@ -0,0 +1,9 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { ComposerPrimitiveQueue } from "@assistant-ui/core/react";
3
+ import { ComposerQueue } from "./ComposerQueue";
4
+
5
+ describe("ComposerPrimitive.Queue", () => {
6
+ it("re-exports the shared core queue primitive", () => {
7
+ expect(ComposerQueue).toBe(ComposerPrimitiveQueue);
8
+ });
9
+ });
@@ -0,0 +1 @@
1
+ export { ComposerPrimitiveQueue as ComposerQueue } from "@assistant-ui/core/react";