@assistant-ui/react 0.10.23 → 0.10.24

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 (189) hide show
  1. package/dist/cloud/AssistantCloudThreadHistoryAdapter.d.ts +1 -1
  2. package/dist/cloud/AssistantCloudThreadHistoryAdapter.d.ts.map +1 -1
  3. package/dist/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
  4. package/dist/cloud/auiV0.d.ts +1 -1
  5. package/dist/cloud/auiV0.d.ts.map +1 -1
  6. package/dist/cloud/auiV0.js.map +1 -1
  7. package/dist/cloud/index.d.ts +1 -1
  8. package/dist/cloud/index.d.ts.map +1 -1
  9. package/dist/cloud/index.js +1 -1
  10. package/dist/cloud/index.js.map +1 -1
  11. package/dist/cloud/useCloudThreadListRuntime.d.ts +1 -1
  12. package/dist/cloud/useCloudThreadListRuntime.d.ts.map +1 -1
  13. package/dist/cloud/useCloudThreadListRuntime.js.map +1 -1
  14. package/dist/context/react/AssistantContext.d.ts +23 -0
  15. package/dist/context/react/AssistantContext.d.ts.map +1 -1
  16. package/dist/context/react/AssistantContext.js.map +1 -1
  17. package/dist/context/react/ComposerContext.d.ts +64 -0
  18. package/dist/context/react/ComposerContext.d.ts.map +1 -1
  19. package/dist/context/react/ComposerContext.js.map +1 -1
  20. package/dist/context/react/MessageContext.d.ts +56 -0
  21. package/dist/context/react/MessageContext.d.ts.map +1 -1
  22. package/dist/context/react/MessageContext.js.map +1 -1
  23. package/dist/context/react/ThreadContext.d.ts +42 -0
  24. package/dist/context/react/ThreadContext.d.ts.map +1 -1
  25. package/dist/context/react/ThreadContext.js.map +1 -1
  26. package/dist/primitives/actionBar/ActionBarCopy.d.ts +42 -0
  27. package/dist/primitives/actionBar/ActionBarCopy.d.ts.map +1 -1
  28. package/dist/primitives/actionBar/ActionBarCopy.js.map +1 -1
  29. package/dist/primitives/actionBar/ActionBarEdit.d.ts +38 -0
  30. package/dist/primitives/actionBar/ActionBarEdit.d.ts.map +1 -1
  31. package/dist/primitives/actionBar/ActionBarEdit.js.map +1 -1
  32. package/dist/primitives/actionBar/ActionBarReload.d.ts +39 -0
  33. package/dist/primitives/actionBar/ActionBarReload.d.ts.map +1 -1
  34. package/dist/primitives/actionBar/ActionBarReload.js.map +1 -1
  35. package/dist/primitives/actionBar/ActionBarRoot.d.ts +56 -0
  36. package/dist/primitives/actionBar/ActionBarRoot.d.ts.map +1 -1
  37. package/dist/primitives/actionBar/ActionBarRoot.js.map +1 -1
  38. package/dist/primitives/attachment/AttachmentRoot.d.ts +18 -0
  39. package/dist/primitives/attachment/AttachmentRoot.d.ts.map +1 -1
  40. package/dist/primitives/attachment/AttachmentRoot.js.map +1 -1
  41. package/dist/primitives/branchPicker/BranchPickerCount.d.ts +17 -0
  42. package/dist/primitives/branchPicker/BranchPickerCount.d.ts.map +1 -1
  43. package/dist/primitives/branchPicker/BranchPickerCount.js.map +1 -1
  44. package/dist/primitives/branchPicker/BranchPickerNext.d.ts +17 -0
  45. package/dist/primitives/branchPicker/BranchPickerNext.d.ts.map +1 -1
  46. package/dist/primitives/branchPicker/BranchPickerNext.js.map +1 -1
  47. package/dist/primitives/branchPicker/BranchPickerPrevious.d.ts +38 -0
  48. package/dist/primitives/branchPicker/BranchPickerPrevious.d.ts.map +1 -1
  49. package/dist/primitives/branchPicker/BranchPickerPrevious.js.map +1 -1
  50. package/dist/primitives/branchPicker/BranchPickerRoot.d.ts +27 -0
  51. package/dist/primitives/branchPicker/BranchPickerRoot.d.ts.map +1 -1
  52. package/dist/primitives/branchPicker/BranchPickerRoot.js.map +1 -1
  53. package/dist/primitives/composer/ComposerAttachments.d.ts.map +1 -1
  54. package/dist/primitives/composer/ComposerAttachments.js +11 -8
  55. package/dist/primitives/composer/ComposerAttachments.js.map +1 -1
  56. package/dist/primitives/composer/ComposerCancel.d.ts +17 -0
  57. package/dist/primitives/composer/ComposerCancel.d.ts.map +1 -1
  58. package/dist/primitives/composer/ComposerCancel.js.map +1 -1
  59. package/dist/primitives/composer/ComposerInput.d.ts +72 -0
  60. package/dist/primitives/composer/ComposerInput.d.ts.map +1 -1
  61. package/dist/primitives/composer/ComposerInput.js.map +1 -1
  62. package/dist/primitives/composer/ComposerRoot.d.ts +19 -0
  63. package/dist/primitives/composer/ComposerRoot.d.ts.map +1 -1
  64. package/dist/primitives/composer/ComposerRoot.js.map +1 -1
  65. package/dist/primitives/composer/ComposerSend.d.ts +18 -0
  66. package/dist/primitives/composer/ComposerSend.d.ts.map +1 -1
  67. package/dist/primitives/composer/ComposerSend.js.map +1 -1
  68. package/dist/primitives/contentPart/ContentPartImage.d.ts +19 -0
  69. package/dist/primitives/contentPart/ContentPartImage.d.ts.map +1 -1
  70. package/dist/primitives/contentPart/ContentPartImage.js.map +1 -1
  71. package/dist/primitives/contentPart/ContentPartText.d.ts +34 -0
  72. package/dist/primitives/contentPart/ContentPartText.d.ts.map +1 -1
  73. package/dist/primitives/contentPart/ContentPartText.js.map +1 -1
  74. package/dist/primitives/message/MessageAttachments.d.ts.map +1 -1
  75. package/dist/primitives/message/MessageAttachments.js +11 -8
  76. package/dist/primitives/message/MessageAttachments.js.map +1 -1
  77. package/dist/primitives/message/MessageContent.d.ts +41 -0
  78. package/dist/primitives/message/MessageContent.d.ts.map +1 -1
  79. package/dist/primitives/message/MessageContent.js +14 -11
  80. package/dist/primitives/message/MessageContent.js.map +1 -1
  81. package/dist/primitives/message/MessageRoot.d.ts +22 -0
  82. package/dist/primitives/message/MessageRoot.d.ts.map +1 -1
  83. package/dist/primitives/message/MessageRoot.js.map +1 -1
  84. package/dist/primitives/thread/ThreadMessages.d.ts +44 -0
  85. package/dist/primitives/thread/ThreadMessages.d.ts.map +1 -1
  86. package/dist/primitives/thread/ThreadMessages.js +5 -2
  87. package/dist/primitives/thread/ThreadMessages.js.map +1 -1
  88. package/dist/primitives/thread/ThreadRoot.d.ts +19 -0
  89. package/dist/primitives/thread/ThreadRoot.d.ts.map +1 -1
  90. package/dist/primitives/thread/ThreadRoot.js.map +1 -1
  91. package/dist/primitives/thread/ThreadViewport.d.ts +24 -0
  92. package/dist/primitives/thread/ThreadViewport.d.ts.map +1 -1
  93. package/dist/primitives/thread/ThreadViewport.js.map +1 -1
  94. package/dist/primitives/threadList/ThreadListItems.d.ts.map +1 -1
  95. package/dist/primitives/threadList/ThreadListItems.js +12 -9
  96. package/dist/primitives/threadList/ThreadListItems.js.map +1 -1
  97. package/dist/runtimes/adapters/attachment/AttachmentAdapter.d.ts +54 -0
  98. package/dist/runtimes/adapters/attachment/AttachmentAdapter.d.ts.map +1 -1
  99. package/dist/runtimes/adapters/feedback/FeedbackAdapter.d.ts +33 -0
  100. package/dist/runtimes/adapters/feedback/FeedbackAdapter.d.ts.map +1 -1
  101. package/dist/runtimes/adapters/speech/SpeechAdapterTypes.d.ts +47 -0
  102. package/dist/runtimes/adapters/speech/SpeechAdapterTypes.d.ts.map +1 -1
  103. package/dist/runtimes/local/LocalRuntimeOptions.d.ts +2 -2
  104. package/dist/runtimes/local/LocalRuntimeOptions.d.ts.map +1 -1
  105. package/dist/runtimes/local/LocalRuntimeOptions.js.map +1 -1
  106. package/dist/runtimes/remote-thread-list/adapter/cloud.d.ts +1 -1
  107. package/dist/runtimes/remote-thread-list/adapter/cloud.d.ts.map +1 -1
  108. package/dist/runtimes/remote-thread-list/adapter/cloud.js +1 -1
  109. package/dist/runtimes/remote-thread-list/adapter/cloud.js.map +1 -1
  110. package/dist/tests/setup.js +8 -8
  111. package/dist/tests/setup.js.map +1 -1
  112. package/package.json +8 -7
  113. package/src/cloud/AssistantCloudThreadHistoryAdapter.tsx +1 -1
  114. package/src/cloud/auiV0.ts +1 -1
  115. package/src/cloud/index.ts +1 -1
  116. package/src/cloud/useCloudThreadListRuntime.tsx +1 -1
  117. package/src/context/react/AssistantContext.ts +23 -0
  118. package/src/context/react/ComposerContext.ts +64 -0
  119. package/src/context/react/MessageContext.ts +56 -0
  120. package/src/context/react/ThreadContext.ts +42 -0
  121. package/src/primitives/actionBar/ActionBarCopy.tsx +42 -0
  122. package/src/primitives/actionBar/ActionBarEdit.tsx +38 -0
  123. package/src/primitives/actionBar/ActionBarReload.tsx +39 -0
  124. package/src/primitives/actionBar/ActionBarRoot.tsx +38 -0
  125. package/src/primitives/attachment/AttachmentRoot.tsx +18 -0
  126. package/src/primitives/branchPicker/BranchPickerCount.tsx +17 -0
  127. package/src/primitives/branchPicker/BranchPickerNext.tsx +17 -0
  128. package/src/primitives/branchPicker/BranchPickerPrevious.tsx +38 -0
  129. package/src/primitives/branchPicker/BranchPickerRoot.tsx +22 -0
  130. package/src/primitives/composer/ComposerAttachments.tsx +11 -7
  131. package/src/primitives/composer/ComposerCancel.tsx +17 -0
  132. package/src/primitives/composer/ComposerInput.tsx +44 -0
  133. package/src/primitives/composer/ComposerRoot.tsx +19 -0
  134. package/src/primitives/composer/ComposerSend.tsx +18 -0
  135. package/src/primitives/contentPart/ContentPartImage.tsx +19 -0
  136. package/src/primitives/contentPart/ContentPartText.tsx +25 -0
  137. package/src/primitives/message/MessageAttachments.tsx +11 -7
  138. package/src/primitives/message/MessageContent.tsx +54 -18
  139. package/src/primitives/message/MessageRoot.tsx +22 -0
  140. package/src/primitives/thread/ThreadMessages.tsx +52 -4
  141. package/src/primitives/thread/ThreadRoot.tsx +19 -0
  142. package/src/primitives/thread/ThreadViewport.tsx +19 -0
  143. package/src/primitives/threadList/ThreadListItems.tsx +12 -8
  144. package/src/runtimes/adapters/attachment/AttachmentAdapter.ts +56 -0
  145. package/src/runtimes/adapters/feedback/FeedbackAdapter.ts +33 -0
  146. package/src/runtimes/adapters/speech/SpeechAdapterTypes.ts +47 -0
  147. package/src/runtimes/local/LocalRuntimeOptions.tsx +1 -1
  148. package/src/runtimes/remote-thread-list/adapter/cloud.tsx +1 -1
  149. package/dist/cloud/AssistantCloud.d.ts +0 -15
  150. package/dist/cloud/AssistantCloud.d.ts.map +0 -1
  151. package/dist/cloud/AssistantCloud.js +0 -25
  152. package/dist/cloud/AssistantCloud.js.map +0 -1
  153. package/dist/cloud/AssistantCloudAPI.d.ts +0 -28
  154. package/dist/cloud/AssistantCloudAPI.d.ts.map +0 -1
  155. package/dist/cloud/AssistantCloudAPI.js +0 -87
  156. package/dist/cloud/AssistantCloudAPI.js.map +0 -1
  157. package/dist/cloud/AssistantCloudAuthStrategy.d.ts +0 -30
  158. package/dist/cloud/AssistantCloudAuthStrategy.d.ts.map +0 -1
  159. package/dist/cloud/AssistantCloudAuthStrategy.js +0 -139
  160. package/dist/cloud/AssistantCloudAuthStrategy.js.map +0 -1
  161. package/dist/cloud/AssistantCloudAuthTokens.d.ts +0 -11
  162. package/dist/cloud/AssistantCloudAuthTokens.d.ts.map +0 -1
  163. package/dist/cloud/AssistantCloudAuthTokens.js +0 -13
  164. package/dist/cloud/AssistantCloudAuthTokens.js.map +0 -1
  165. package/dist/cloud/AssistantCloudFiles.d.ts +0 -27
  166. package/dist/cloud/AssistantCloudFiles.d.ts.map +0 -1
  167. package/dist/cloud/AssistantCloudFiles.js +0 -25
  168. package/dist/cloud/AssistantCloudFiles.js.map +0 -1
  169. package/dist/cloud/AssistantCloudRuns.d.ts +0 -26
  170. package/dist/cloud/AssistantCloudRuns.d.ts.map +0 -1
  171. package/dist/cloud/AssistantCloudRuns.js +0 -39
  172. package/dist/cloud/AssistantCloudRuns.js.map +0 -1
  173. package/dist/cloud/AssistantCloudThreadMessages.d.ts +0 -30
  174. package/dist/cloud/AssistantCloudThreadMessages.d.ts.map +0 -1
  175. package/dist/cloud/AssistantCloudThreadMessages.js +0 -21
  176. package/dist/cloud/AssistantCloudThreadMessages.js.map +0 -1
  177. package/dist/cloud/AssistantCloudThreads.d.ts +0 -48
  178. package/dist/cloud/AssistantCloudThreads.d.ts.map +0 -1
  179. package/dist/cloud/AssistantCloudThreads.js +0 -30
  180. package/dist/cloud/AssistantCloudThreads.js.map +0 -1
  181. package/src/cloud/AssistantCloud.tsx +0 -22
  182. package/src/cloud/AssistantCloudAPI.tsx +0 -121
  183. package/src/cloud/AssistantCloudAuthStrategy.tsx +0 -193
  184. package/src/cloud/AssistantCloudAuthTokens.tsx +0 -13
  185. package/src/cloud/AssistantCloudFiles.tsx +0 -48
  186. package/src/cloud/AssistantCloudRuns.tsx +0 -45
  187. package/src/cloud/AssistantCloudThreadMessages.tsx +0 -48
  188. package/src/cloud/AssistantCloudThreads.tsx +0 -79
  189. package/src/tests/AssistantCloudFiles.test.ts +0 -564
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/primitives/actionBar/ActionBarEdit.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport { useEditComposer, useMessageRuntime } from \"../../context\";\n\nconst useActionBarEdit = () => {\n const messageRuntime = useMessageRuntime();\n const disabled = useEditComposer((c) => c.isEditing);\n\n const callback = useCallback(() => {\n messageRuntime.composer.beginEdit();\n }, [messageRuntime]);\n\n if (disabled) return null;\n return callback;\n};\n\nexport namespace ActionBarPrimitiveEdit {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useActionBarEdit>;\n}\n\nexport const ActionBarPrimitiveEdit = createActionButton(\n \"ActionBarPrimitive.Edit\",\n useActionBarEdit,\n);\n"],"mappings":";;;AAEA;AAAA,EAGE;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB,yBAAyB;AAEnD,IAAM,mBAAmB,MAAM;AAC7B,QAAM,iBAAiB,kBAAkB;AACzC,QAAM,WAAW,gBAAgB,CAAC,MAAM,EAAE,SAAS;AAEnD,QAAM,WAAW,YAAY,MAAM;AACjC,mBAAe,SAAS,UAAU;AAAA,EACpC,GAAG,CAAC,cAAc,CAAC;AAEnB,MAAI,SAAU,QAAO;AACrB,SAAO;AACT;AAOO,IAAM,yBAAyB;AAAA,EACpC;AAAA,EACA;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/primitives/actionBar/ActionBarEdit.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport { useEditComposer, useMessageRuntime } from \"../../context\";\n\n/**\n * Hook that provides edit functionality for action bar buttons.\n *\n * This hook returns a callback function that starts editing the current message,\n * or null if editing is not available (e.g., already in editing mode).\n *\n * @returns An edit callback function, or null if editing is disabled\n *\n * @example\n * ```tsx\n * function CustomEditButton() {\n * const edit = useActionBarEdit();\n *\n * return (\n * <button onClick={edit} disabled={!edit}>\n * {edit ? \"Edit Message\" : \"Cannot Edit\"}\n * </button>\n * );\n * }\n * ```\n */\nconst useActionBarEdit = () => {\n const messageRuntime = useMessageRuntime();\n const disabled = useEditComposer((c) => c.isEditing);\n\n const callback = useCallback(() => {\n messageRuntime.composer.beginEdit();\n }, [messageRuntime]);\n\n if (disabled) return null;\n return callback;\n};\n\nexport namespace ActionBarPrimitiveEdit {\n export type Element = ActionButtonElement;\n /**\n * Props for the ActionBarPrimitive.Edit component.\n * Inherits all button element props and action button functionality.\n */\n export type Props = ActionButtonProps<typeof useActionBarEdit>;\n}\n\n/**\n * A button component that starts editing the current message.\n *\n * This component automatically handles starting the edit mode for the current message\n * and is disabled when editing is not available (e.g., already in editing mode).\n *\n * @example\n * ```tsx\n * <ActionBarPrimitive.Edit>\n * Edit Message\n * </ActionBarPrimitive.Edit>\n * ```\n */\nexport const ActionBarPrimitiveEdit = createActionButton(\n \"ActionBarPrimitive.Edit\",\n useActionBarEdit,\n);\n"],"mappings":";;;AAEA;AAAA,EAGE;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB,yBAAyB;AAuBnD,IAAM,mBAAmB,MAAM;AAC7B,QAAM,iBAAiB,kBAAkB;AACzC,QAAM,WAAW,gBAAgB,CAAC,MAAM,EAAE,SAAS;AAEnD,QAAM,WAAW,YAAY,MAAM;AACjC,mBAAe,SAAS,UAAU;AAAA,EACpC,GAAG,CAAC,cAAc,CAAC;AAEnB,MAAI,SAAU,QAAO;AACrB,SAAO;AACT;AAwBO,IAAM,yBAAyB;AAAA,EACpC;AAAA,EACA;AACF;","names":[]}
@@ -1,9 +1,48 @@
1
1
  import { ActionButtonElement, ActionButtonProps } from "../../utils/createActionButton";
2
+ /**
3
+ * Hook that provides reload functionality for action bar buttons.
4
+ *
5
+ * This hook returns a callback function that reloads/regenerates the current assistant message,
6
+ * or null if reloading is not available (e.g., thread is running, disabled, or message is not from assistant).
7
+ *
8
+ * @returns A reload callback function, or null if reloading is disabled
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * function CustomReloadButton() {
13
+ * const reload = useActionBarReload();
14
+ *
15
+ * return (
16
+ * <button onClick={reload} disabled={!reload}>
17
+ * {reload ? "Reload Message" : "Cannot Reload"}
18
+ * </button>
19
+ * );
20
+ * }
21
+ * ```
22
+ */
2
23
  declare const useActionBarReload: () => (() => void) | null;
3
24
  export declare namespace ActionBarPrimitiveReload {
4
25
  type Element = ActionButtonElement;
26
+ /**
27
+ * Props for the ActionBarPrimitive.Reload component.
28
+ * Inherits all button element props and action button functionality.
29
+ */
5
30
  type Props = ActionButtonProps<typeof useActionBarReload>;
6
31
  }
32
+ /**
33
+ * A button component that reloads/regenerates the current assistant message.
34
+ *
35
+ * This component automatically handles reloading the current assistant message
36
+ * and is disabled when reloading is not available (e.g., thread is running,
37
+ * disabled, or message is not from assistant).
38
+ *
39
+ * @example
40
+ * ```tsx
41
+ * <ActionBarPrimitive.Reload>
42
+ * Reload Message
43
+ * </ActionBarPrimitive.Reload>
44
+ * ```
45
+ */
7
46
  export declare const ActionBarPrimitiveReload: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
8
47
  asChild?: boolean;
9
48
  }, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"ActionBarReload.d.ts","sourceRoot":"","sources":["../../../src/primitives/actionBar/ActionBarReload.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAMxC,QAAA,MAAM,kBAAkB,2BAevB,CAAC;AAEF,yBAAiB,wBAAwB,CAAC;IACxC,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,kBAAkB,CAAC,CAAC;CAClE;AAED,eAAO,MAAM,wBAAwB;;6DAGpC,CAAC"}
1
+ {"version":3,"file":"ActionBarReload.d.ts","sourceRoot":"","sources":["../../../src/primitives/actionBar/ActionBarReload.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAMxC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,kBAAkB,2BAevB,CAAC;AAEF,yBAAiB,wBAAwB,CAAC;IACxC,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C;;;OAGG;IACH,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,kBAAkB,CAAC,CAAC;CAClE;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,wBAAwB;;6DAGpC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/primitives/actionBar/ActionBarReload.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport { useMessageRuntime } from \"../../context\";\nimport { useThreadRuntime } from \"../../context/react/ThreadContext\";\nimport { useCombinedStore } from \"../../utils/combined/useCombinedStore\";\n\nconst useActionBarReload = () => {\n const messageRuntime = useMessageRuntime();\n const threadRuntime = useThreadRuntime();\n\n const disabled = useCombinedStore(\n [threadRuntime, messageRuntime],\n (t, m) => t.isRunning || t.isDisabled || m.role !== \"assistant\",\n );\n\n const callback = useCallback(() => {\n messageRuntime.reload();\n }, [messageRuntime]);\n\n if (disabled) return null;\n return callback;\n};\n\nexport namespace ActionBarPrimitiveReload {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useActionBarReload>;\n}\n\nexport const ActionBarPrimitiveReload = createActionButton(\n \"ActionBarPrimitive.Reload\",\n useActionBarReload,\n);\n"],"mappings":";;;AAEA;AAAA,EAGE;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAClC,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AAEjC,IAAM,qBAAqB,MAAM;AAC/B,QAAM,iBAAiB,kBAAkB;AACzC,QAAM,gBAAgB,iBAAiB;AAEvC,QAAM,WAAW;AAAA,IACf,CAAC,eAAe,cAAc;AAAA,IAC9B,CAAC,GAAG,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS;AAAA,EACtD;AAEA,QAAM,WAAW,YAAY,MAAM;AACjC,mBAAe,OAAO;AAAA,EACxB,GAAG,CAAC,cAAc,CAAC;AAEnB,MAAI,SAAU,QAAO;AACrB,SAAO;AACT;AAOO,IAAM,2BAA2B;AAAA,EACtC;AAAA,EACA;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/primitives/actionBar/ActionBarReload.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport { useMessageRuntime } from \"../../context\";\nimport { useThreadRuntime } from \"../../context/react/ThreadContext\";\nimport { useCombinedStore } from \"../../utils/combined/useCombinedStore\";\n\n/**\n * Hook that provides reload functionality for action bar buttons.\n *\n * This hook returns a callback function that reloads/regenerates the current assistant message,\n * or null if reloading is not available (e.g., thread is running, disabled, or message is not from assistant).\n *\n * @returns A reload callback function, or null if reloading is disabled\n *\n * @example\n * ```tsx\n * function CustomReloadButton() {\n * const reload = useActionBarReload();\n *\n * return (\n * <button onClick={reload} disabled={!reload}>\n * {reload ? \"Reload Message\" : \"Cannot Reload\"}\n * </button>\n * );\n * }\n * ```\n */\nconst useActionBarReload = () => {\n const messageRuntime = useMessageRuntime();\n const threadRuntime = useThreadRuntime();\n\n const disabled = useCombinedStore(\n [threadRuntime, messageRuntime],\n (t, m) => t.isRunning || t.isDisabled || m.role !== \"assistant\",\n );\n\n const callback = useCallback(() => {\n messageRuntime.reload();\n }, [messageRuntime]);\n\n if (disabled) return null;\n return callback;\n};\n\nexport namespace ActionBarPrimitiveReload {\n export type Element = ActionButtonElement;\n /**\n * Props for the ActionBarPrimitive.Reload component.\n * Inherits all button element props and action button functionality.\n */\n export type Props = ActionButtonProps<typeof useActionBarReload>;\n}\n\n/**\n * A button component that reloads/regenerates the current assistant message.\n *\n * This component automatically handles reloading the current assistant message\n * and is disabled when reloading is not available (e.g., thread is running,\n * disabled, or message is not from assistant).\n *\n * @example\n * ```tsx\n * <ActionBarPrimitive.Reload>\n * Reload Message\n * </ActionBarPrimitive.Reload>\n * ```\n */\nexport const ActionBarPrimitiveReload = createActionButton(\n \"ActionBarPrimitive.Reload\",\n useActionBarReload,\n);\n"],"mappings":";;;AAEA;AAAA,EAGE;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAClC,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AAuBjC,IAAM,qBAAqB,MAAM;AAC/B,QAAM,iBAAiB,kBAAkB;AACzC,QAAM,gBAAgB,iBAAiB;AAEvC,QAAM,WAAW;AAAA,IACf,CAAC,eAAe,cAAc;AAAA,IAC9B,CAAC,GAAG,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS;AAAA,EACtD;AAEA,QAAM,WAAW,YAAY,MAAM;AACjC,mBAAe,OAAO;AAAA,EACxB,GAAG,CAAC,cAAc,CAAC;AAEnB,MAAI,SAAU,QAAO;AACrB,SAAO;AACT;AAyBO,IAAM,2BAA2B;AAAA,EACtC;AAAA,EACA;AACF;","names":[]}
@@ -4,16 +4,72 @@ type PrimitiveDivProps = ComponentPropsWithoutRef<typeof Primitive.div>;
4
4
  export declare namespace ActionBarPrimitiveRoot {
5
5
  type Element = ComponentRef<typeof Primitive.div>;
6
6
  type Props = PrimitiveDivProps & {
7
+ /**
8
+ * Whether to hide the action bar when the thread is running.
9
+ * @default false
10
+ */
7
11
  hideWhenRunning?: boolean | undefined;
12
+ /**
13
+ * Controls when the action bar should automatically hide.
14
+ * - "always": Always hide unless hovered
15
+ * - "not-last": Hide unless this is the last message
16
+ * - "never": Never auto-hide
17
+ * @default "never"
18
+ */
8
19
  autohide?: "always" | "not-last" | "never" | undefined;
20
+ /**
21
+ * Controls floating behavior when auto-hidden.
22
+ * - "always": Always float when hidden
23
+ * - "single-branch": Float only for single-branch messages
24
+ * - "never": Never float
25
+ * @default "never"
26
+ */
9
27
  autohideFloat?: "always" | "single-branch" | "never" | undefined;
10
28
  };
11
29
  }
30
+ /**
31
+ * The root container for action bar components.
32
+ *
33
+ * This component provides intelligent visibility and floating behavior for action bars,
34
+ * automatically hiding and showing based on message state, hover status, and configuration.
35
+ * It supports floating mode for better UX when space is limited.
36
+ *
37
+ * @example
38
+ * ```tsx
39
+ * <ActionBarPrimitive.Root
40
+ * hideWhenRunning={true}
41
+ * autohide="not-last"
42
+ * autohideFloat="single-branch"
43
+ * >
44
+ * <ActionBarPrimitive.Copy />
45
+ * <ActionBarPrimitive.Edit />
46
+ * <ActionBarPrimitive.Reload />
47
+ * </ActionBarPrimitive.Root>
48
+ * ```
49
+ */
12
50
  export declare const ActionBarPrimitiveRoot: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
13
51
  asChild?: boolean;
14
52
  }, "ref"> & {
53
+ /**
54
+ * Whether to hide the action bar when the thread is running.
55
+ * @default false
56
+ */
15
57
  hideWhenRunning?: boolean | undefined;
58
+ /**
59
+ * Controls when the action bar should automatically hide.
60
+ * - "always": Always hide unless hovered
61
+ * - "not-last": Hide unless this is the last message
62
+ * - "never": Never auto-hide
63
+ * @default "never"
64
+ */
16
65
  autohide?: "always" | "not-last" | "never" | undefined;
66
+ /**
67
+ * Controls floating behavior when auto-hidden.
68
+ * - "always": Always float when hidden
69
+ * - "single-branch": Float only for single-branch messages
70
+ * - "never": Never float
71
+ * @default "never"
72
+ */
17
73
  autohideFloat?: "always" | "single-branch" | "never" | undefined;
18
74
  } & import("react").RefAttributes<HTMLDivElement>>;
19
75
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"ActionBarRoot.d.ts","sourceRoot":"","sources":["../../../src/primitives/actionBar/ActionBarRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,KAAK,YAAY,EAAc,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAMhF,KAAK,iBAAiB,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;AAExE,yBAAiB,sBAAsB,CAAC;IACtC,KAAY,OAAO,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACzD,KAAY,KAAK,GAAG,iBAAiB,GAAG;QACtC,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QACtC,QAAQ,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,CAAC;QACvD,aAAa,CAAC,EAAE,QAAQ,GAAG,eAAe,GAAG,OAAO,GAAG,SAAS,CAAC;KAClE,CAAC;CACH;AAED,eAAO,MAAM,sBAAsB;;;sBANb,OAAO,GAAG,SAAS;eAC1B,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS;oBACtC,QAAQ,GAAG,eAAe,GAAG,OAAO,GAAG,SAAS;kDAyBlE,CAAC"}
1
+ {"version":3,"file":"ActionBarRoot.d.ts","sourceRoot":"","sources":["../../../src/primitives/actionBar/ActionBarRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,KAAK,YAAY,EAAc,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAMhF,KAAK,iBAAiB,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;AAExE,yBAAiB,sBAAsB,CAAC;IACtC,KAAY,OAAO,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACzD,KAAY,KAAK,GAAG,iBAAiB,GAAG;QACtC;;;WAGG;QACH,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QACtC;;;;;;WAMG;QACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,CAAC;QACvD;;;;;;WAMG;QACH,aAAa,CAAC,EAAE,QAAQ,GAAG,eAAe,GAAG,OAAO,GAAG,SAAS,CAAC;KAClE,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,sBAAsB;;;IA5C/B;;;OAGG;sBACe,OAAO,GAAG,SAAS;IACrC;;;;;;OAMG;eACQ,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS;IACtD;;;;;;OAMG;oBACa,QAAQ,GAAG,eAAe,GAAG,OAAO,GAAG,SAAS;kDA6ClE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/primitives/actionBar/ActionBarRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { type ComponentRef, forwardRef, ComponentPropsWithoutRef } from \"react\";\nimport {\n useActionBarFloatStatus,\n HideAndFloatStatus,\n} from \"./useActionBarFloatStatus\";\n\ntype PrimitiveDivProps = ComponentPropsWithoutRef<typeof Primitive.div>;\n\nexport namespace ActionBarPrimitiveRoot {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = PrimitiveDivProps & {\n hideWhenRunning?: boolean | undefined;\n autohide?: \"always\" | \"not-last\" | \"never\" | undefined;\n autohideFloat?: \"always\" | \"single-branch\" | \"never\" | undefined;\n };\n}\n\nexport const ActionBarPrimitiveRoot = forwardRef<\n ActionBarPrimitiveRoot.Element,\n ActionBarPrimitiveRoot.Props\n>(({ hideWhenRunning, autohide, autohideFloat, ...rest }, ref) => {\n const hideAndfloatStatus = useActionBarFloatStatus({\n hideWhenRunning,\n autohide,\n autohideFloat,\n });\n\n if (hideAndfloatStatus === HideAndFloatStatus.Hidden) return null;\n\n return (\n <Primitive.div\n {...(hideAndfloatStatus === HideAndFloatStatus.Floating\n ? { \"data-floating\": \"true\" }\n : null)}\n {...rest}\n ref={ref}\n />\n );\n});\n\nActionBarPrimitiveRoot.displayName = \"ActionBarPrimitive.Root\";\n"],"mappings":";;;AAEA,SAAS,iBAAiB;AAC1B,SAA4B,kBAA4C;AACxE;AAAA,EACE;AAAA,EACA;AAAA,OACK;AA0BH;AAbG,IAAM,yBAAyB,WAGpC,CAAC,EAAE,iBAAiB,UAAU,eAAe,GAAG,KAAK,GAAG,QAAQ;AAChE,QAAM,qBAAqB,wBAAwB;AAAA,IACjD;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,MAAI,uBAAuB,mBAAmB,OAAQ,QAAO;AAE7D,SACE;AAAA,IAAC,UAAU;AAAA,IAAV;AAAA,MACE,GAAI,uBAAuB,mBAAmB,WAC3C,EAAE,iBAAiB,OAAO,IAC1B;AAAA,MACH,GAAG;AAAA,MACJ;AAAA;AAAA,EACF;AAEJ,CAAC;AAED,uBAAuB,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/primitives/actionBar/ActionBarRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { type ComponentRef, forwardRef, ComponentPropsWithoutRef } from \"react\";\nimport {\n useActionBarFloatStatus,\n HideAndFloatStatus,\n} from \"./useActionBarFloatStatus\";\n\ntype PrimitiveDivProps = ComponentPropsWithoutRef<typeof Primitive.div>;\n\nexport namespace ActionBarPrimitiveRoot {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = PrimitiveDivProps & {\n /**\n * Whether to hide the action bar when the thread is running.\n * @default false\n */\n hideWhenRunning?: boolean | undefined;\n /**\n * Controls when the action bar should automatically hide.\n * - \"always\": Always hide unless hovered\n * - \"not-last\": Hide unless this is the last message\n * - \"never\": Never auto-hide\n * @default \"never\"\n */\n autohide?: \"always\" | \"not-last\" | \"never\" | undefined;\n /**\n * Controls floating behavior when auto-hidden.\n * - \"always\": Always float when hidden\n * - \"single-branch\": Float only for single-branch messages\n * - \"never\": Never float\n * @default \"never\"\n */\n autohideFloat?: \"always\" | \"single-branch\" | \"never\" | undefined;\n };\n}\n\n/**\n * The root container for action bar components.\n *\n * This component provides intelligent visibility and floating behavior for action bars,\n * automatically hiding and showing based on message state, hover status, and configuration.\n * It supports floating mode for better UX when space is limited.\n *\n * @example\n * ```tsx\n * <ActionBarPrimitive.Root\n * hideWhenRunning={true}\n * autohide=\"not-last\"\n * autohideFloat=\"single-branch\"\n * >\n * <ActionBarPrimitive.Copy />\n * <ActionBarPrimitive.Edit />\n * <ActionBarPrimitive.Reload />\n * </ActionBarPrimitive.Root>\n * ```\n */\nexport const ActionBarPrimitiveRoot = forwardRef<\n ActionBarPrimitiveRoot.Element,\n ActionBarPrimitiveRoot.Props\n>(({ hideWhenRunning, autohide, autohideFloat, ...rest }, ref) => {\n const hideAndfloatStatus = useActionBarFloatStatus({\n hideWhenRunning,\n autohide,\n autohideFloat,\n });\n\n if (hideAndfloatStatus === HideAndFloatStatus.Hidden) return null;\n\n return (\n <Primitive.div\n {...(hideAndfloatStatus === HideAndFloatStatus.Floating\n ? { \"data-floating\": \"true\" }\n : null)}\n {...rest}\n ref={ref}\n />\n );\n});\n\nActionBarPrimitiveRoot.displayName = \"ActionBarPrimitive.Root\";\n"],"mappings":";;;AAEA,SAAS,iBAAiB;AAC1B,SAA4B,kBAA4C;AACxE;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAgEH;AAbG,IAAM,yBAAyB,WAGpC,CAAC,EAAE,iBAAiB,UAAU,eAAe,GAAG,KAAK,GAAG,QAAQ;AAChE,QAAM,qBAAqB,wBAAwB;AAAA,IACjD;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,MAAI,uBAAuB,mBAAmB,OAAQ,QAAO;AAE7D,SACE;AAAA,IAAC,UAAU;AAAA,IAAV;AAAA,MACE,GAAI,uBAAuB,mBAAmB,WAC3C,EAAE,iBAAiB,OAAO,IAC1B;AAAA,MACH,GAAG;AAAA,MACJ;AAAA;AAAA,EACF;AAEJ,CAAC;AAED,uBAAuB,cAAc;","names":[]}
@@ -3,8 +3,26 @@ import { ComponentPropsWithoutRef, ComponentRef } from "react";
3
3
  type PrimitiveDivProps = ComponentPropsWithoutRef<typeof Primitive.div>;
4
4
  export declare namespace AttachmentPrimitiveRoot {
5
5
  type Element = ComponentRef<typeof Primitive.div>;
6
+ /**
7
+ * Props for the AttachmentPrimitive.Root component.
8
+ * Accepts all standard div element props.
9
+ */
6
10
  type Props = PrimitiveDivProps;
7
11
  }
12
+ /**
13
+ * The root container component for an attachment.
14
+ *
15
+ * This component provides the foundational wrapper for attachment-related components
16
+ * and content. It serves as the context provider for attachment state and actions.
17
+ *
18
+ * @example
19
+ * ```tsx
20
+ * <AttachmentPrimitive.Root>
21
+ * <AttachmentPrimitive.Name />
22
+ * <AttachmentPrimitive.Remove />
23
+ * </AttachmentPrimitive.Root>
24
+ * ```
25
+ */
8
26
  export declare const AttachmentPrimitiveRoot: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
9
27
  asChild?: boolean;
10
28
  }, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"AttachmentRoot.d.ts","sourceRoot":"","sources":["../../../src/primitives/attachment/AttachmentRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAc,MAAM,OAAO,CAAC;AAE3E,KAAK,iBAAiB,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;AAExE,yBAAiB,uBAAuB,CAAC;IACvC,KAAY,OAAO,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACzD,KAAY,KAAK,GAAG,iBAAiB,CAAC;CACvC;AAED,eAAO,MAAM,uBAAuB;;0DAKlC,CAAC"}
1
+ {"version":3,"file":"AttachmentRoot.d.ts","sourceRoot":"","sources":["../../../src/primitives/attachment/AttachmentRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAc,MAAM,OAAO,CAAC;AAE3E,KAAK,iBAAiB,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;AAExE,yBAAiB,uBAAuB,CAAC;IACvC,KAAY,OAAO,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACzD;;;OAGG;IACH,KAAY,KAAK,GAAG,iBAAiB,CAAC;CACvC;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,uBAAuB;;0DAKlC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/primitives/attachment/AttachmentRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { ComponentPropsWithoutRef, ComponentRef, forwardRef } from \"react\";\n\ntype PrimitiveDivProps = ComponentPropsWithoutRef<typeof Primitive.div>;\n\nexport namespace AttachmentPrimitiveRoot {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = PrimitiveDivProps;\n}\n\nexport const AttachmentPrimitiveRoot = forwardRef<\n AttachmentPrimitiveRoot.Element,\n AttachmentPrimitiveRoot.Props\n>((props, ref) => {\n return <Primitive.div {...props} ref={ref} />;\n});\n\nAttachmentPrimitiveRoot.displayName = \"AttachmentPrimitive.Root\";\n"],"mappings":";;;AAEA,SAAS,iBAAiB;AAC1B,SAAiD,kBAAkB;AAa1D;AAJF,IAAM,0BAA0B,WAGrC,CAAC,OAAO,QAAQ;AAChB,SAAO,oBAAC,UAAU,KAAV,EAAe,GAAG,OAAO,KAAU;AAC7C,CAAC;AAED,wBAAwB,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/primitives/attachment/AttachmentRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { ComponentPropsWithoutRef, ComponentRef, forwardRef } from \"react\";\n\ntype PrimitiveDivProps = ComponentPropsWithoutRef<typeof Primitive.div>;\n\nexport namespace AttachmentPrimitiveRoot {\n export type Element = ComponentRef<typeof Primitive.div>;\n /**\n * Props for the AttachmentPrimitive.Root component.\n * Accepts all standard div element props.\n */\n export type Props = PrimitiveDivProps;\n}\n\n/**\n * The root container component for an attachment.\n *\n * This component provides the foundational wrapper for attachment-related components\n * and content. It serves as the context provider for attachment state and actions.\n *\n * @example\n * ```tsx\n * <AttachmentPrimitive.Root>\n * <AttachmentPrimitive.Name />\n * <AttachmentPrimitive.Remove />\n * </AttachmentPrimitive.Root>\n * ```\n */\nexport const AttachmentPrimitiveRoot = forwardRef<\n AttachmentPrimitiveRoot.Element,\n AttachmentPrimitiveRoot.Props\n>((props, ref) => {\n return <Primitive.div {...props} ref={ref} />;\n});\n\nAttachmentPrimitiveRoot.displayName = \"AttachmentPrimitive.Root\";\n"],"mappings":";;;AAEA,SAAS,iBAAiB;AAC1B,SAAiD,kBAAkB;AA+B1D;AAJF,IAAM,0BAA0B,WAGrC,CAAC,OAAO,QAAQ;AAChB,SAAO,oBAAC,UAAU,KAAV,EAAe,GAAG,OAAO,KAAU;AAC7C,CAAC;AAED,wBAAwB,cAAc;","names":[]}
@@ -1,6 +1,23 @@
1
1
  import type { FC } from "react";
2
2
  export declare namespace BranchPickerPrimitiveCount {
3
+ /**
4
+ * Props for the BranchPickerPrimitive.Count component.
5
+ * This component takes no props.
6
+ */
3
7
  type Props = Record<string, never>;
4
8
  }
9
+ /**
10
+ * A component that displays the total number of branches for the current message.
11
+ *
12
+ * This component renders the branch count as plain text, useful for showing
13
+ * users how many alternative responses are available.
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * <div>
18
+ * Branch <BranchPickerPrimitive.Count /> of {totalBranches}
19
+ * </div>
20
+ * ```
21
+ */
5
22
  export declare const BranchPickerPrimitiveCount: FC<BranchPickerPrimitiveCount.Props>;
6
23
  //# sourceMappingURL=BranchPickerCount.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BranchPickerCount.d.ts","sourceRoot":"","sources":["../../../src/primitives/branchPicker/BranchPickerCount.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAQhC,yBAAiB,0BAA0B,CAAC;IAC1C,KAAY,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;CAC3C;AAED,eAAO,MAAM,0BAA0B,EAAE,EAAE,CACzC,0BAA0B,CAAC,KAAK,CAIjC,CAAC"}
1
+ {"version":3,"file":"BranchPickerCount.d.ts","sourceRoot":"","sources":["../../../src/primitives/branchPicker/BranchPickerCount.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAQhC,yBAAiB,0BAA0B,CAAC;IAC1C;;;OAGG;IACH,KAAY,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;CAC3C;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,0BAA0B,EAAE,EAAE,CACzC,0BAA0B,CAAC,KAAK,CAIjC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/primitives/branchPicker/BranchPickerCount.tsx"],"sourcesContent":["\"use client\";\n\nimport type { FC } from \"react\";\nimport { useMessage } from \"../../context/react/MessageContext\";\n\nconst useBranchPickerCount = () => {\n const branchCount = useMessage((s) => s.branchCount);\n return branchCount;\n};\n\nexport namespace BranchPickerPrimitiveCount {\n export type Props = Record<string, never>;\n}\n\nexport const BranchPickerPrimitiveCount: FC<\n BranchPickerPrimitiveCount.Props\n> = () => {\n const branchCount = useBranchPickerCount();\n return <>{branchCount}</>;\n};\n\nBranchPickerPrimitiveCount.displayName = \"BranchPickerPrimitive.Count\";\n"],"mappings":";;;AAGA,SAAS,kBAAkB;AAelB;AAbT,IAAM,uBAAuB,MAAM;AACjC,QAAM,cAAc,WAAW,CAAC,MAAM,EAAE,WAAW;AACnD,SAAO;AACT;AAMO,IAAM,6BAET,MAAM;AACR,QAAM,cAAc,qBAAqB;AACzC,SAAO,gCAAG,uBAAY;AACxB;AAEA,2BAA2B,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/primitives/branchPicker/BranchPickerCount.tsx"],"sourcesContent":["\"use client\";\n\nimport type { FC } from \"react\";\nimport { useMessage } from \"../../context/react/MessageContext\";\n\nconst useBranchPickerCount = () => {\n const branchCount = useMessage((s) => s.branchCount);\n return branchCount;\n};\n\nexport namespace BranchPickerPrimitiveCount {\n /**\n * Props for the BranchPickerPrimitive.Count component.\n * This component takes no props.\n */\n export type Props = Record<string, never>;\n}\n\n/**\n * A component that displays the total number of branches for the current message.\n *\n * This component renders the branch count as plain text, useful for showing\n * users how many alternative responses are available.\n *\n * @example\n * ```tsx\n * <div>\n * Branch <BranchPickerPrimitive.Count /> of {totalBranches}\n * </div>\n * ```\n */\nexport const BranchPickerPrimitiveCount: FC<\n BranchPickerPrimitiveCount.Props\n> = () => {\n const branchCount = useBranchPickerCount();\n return <>{branchCount}</>;\n};\n\nBranchPickerPrimitiveCount.displayName = \"BranchPickerPrimitive.Count\";\n"],"mappings":";;;AAGA,SAAS,kBAAkB;AAgClB;AA9BT,IAAM,uBAAuB,MAAM;AACjC,QAAM,cAAc,WAAW,CAAC,MAAM,EAAE,WAAW;AACnD,SAAO;AACT;AAuBO,IAAM,6BAET,MAAM;AACR,QAAM,cAAc,qBAAqB;AACzC,SAAO,gCAAG,uBAAY;AACxB;AAEA,2BAA2B,cAAc;","names":[]}
@@ -2,8 +2,25 @@ import { ActionButtonElement, ActionButtonProps } from "../../utils/createAction
2
2
  declare const useBranchPickerNext: () => (() => void) | null;
3
3
  export declare namespace BranchPickerPrimitiveNext {
4
4
  type Element = ActionButtonElement;
5
+ /**
6
+ * Props for the BranchPickerPrimitive.Next component.
7
+ * Inherits all button element props and action button functionality.
8
+ */
5
9
  type Props = ActionButtonProps<typeof useBranchPickerNext>;
6
10
  }
11
+ /**
12
+ * A button component that navigates to the next branch in the message tree.
13
+ *
14
+ * This component automatically handles switching to the next available branch
15
+ * and is disabled when there are no more branches to navigate to.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * <BranchPickerPrimitive.Next>
20
+ * Next →
21
+ * </BranchPickerPrimitive.Next>
22
+ * ```
23
+ */
7
24
  export declare const BranchPickerPrimitiveNext: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
8
25
  asChild?: boolean;
9
26
  }, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"BranchPickerNext.d.ts","sourceRoot":"","sources":["../../../src/primitives/branchPicker/BranchPickerNext.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAOxC,QAAA,MAAM,mBAAmB,2BAUxB,CAAC;AAEF,yBAAiB,yBAAyB,CAAC;IACzC,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACnE;AAED,eAAO,MAAM,yBAAyB;;6DAGrC,CAAC"}
1
+ {"version":3,"file":"BranchPickerNext.d.ts","sourceRoot":"","sources":["../../../src/primitives/branchPicker/BranchPickerNext.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAOxC,QAAA,MAAM,mBAAmB,2BAUxB,CAAC;AAEF,yBAAiB,yBAAyB,CAAC;IACzC,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C;;;OAGG;IACH,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACnE;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,yBAAyB;;6DAGrC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/primitives/branchPicker/BranchPickerNext.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport {\n useMessage,\n useMessageRuntime,\n} from \"../../context/react/MessageContext\";\n\nconst useBranchPickerNext = () => {\n const messageRuntime = useMessageRuntime();\n const disabled = useMessage((m) => m.branchNumber >= m.branchCount);\n\n const callback = useCallback(() => {\n messageRuntime.switchToBranch({ position: \"next\" });\n }, [messageRuntime]);\n\n if (disabled) return null;\n return callback;\n};\n\nexport namespace BranchPickerPrimitiveNext {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useBranchPickerNext>;\n}\n\nexport const BranchPickerPrimitiveNext = createActionButton(\n \"BranchPickerPrimitive.Next\",\n useBranchPickerNext,\n);\n"],"mappings":";;;AAEA;AAAA,EAGE;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP,IAAM,sBAAsB,MAAM;AAChC,QAAM,iBAAiB,kBAAkB;AACzC,QAAM,WAAW,WAAW,CAAC,MAAM,EAAE,gBAAgB,EAAE,WAAW;AAElE,QAAM,WAAW,YAAY,MAAM;AACjC,mBAAe,eAAe,EAAE,UAAU,OAAO,CAAC;AAAA,EACpD,GAAG,CAAC,cAAc,CAAC;AAEnB,MAAI,SAAU,QAAO;AACrB,SAAO;AACT;AAOO,IAAM,4BAA4B;AAAA,EACvC;AAAA,EACA;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/primitives/branchPicker/BranchPickerNext.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport {\n useMessage,\n useMessageRuntime,\n} from \"../../context/react/MessageContext\";\n\nconst useBranchPickerNext = () => {\n const messageRuntime = useMessageRuntime();\n const disabled = useMessage((m) => m.branchNumber >= m.branchCount);\n\n const callback = useCallback(() => {\n messageRuntime.switchToBranch({ position: \"next\" });\n }, [messageRuntime]);\n\n if (disabled) return null;\n return callback;\n};\n\nexport namespace BranchPickerPrimitiveNext {\n export type Element = ActionButtonElement;\n /**\n * Props for the BranchPickerPrimitive.Next component.\n * Inherits all button element props and action button functionality.\n */\n export type Props = ActionButtonProps<typeof useBranchPickerNext>;\n}\n\n/**\n * A button component that navigates to the next branch in the message tree.\n *\n * This component automatically handles switching to the next available branch\n * and is disabled when there are no more branches to navigate to.\n *\n * @example\n * ```tsx\n * <BranchPickerPrimitive.Next>\n * Next →\n * </BranchPickerPrimitive.Next>\n * ```\n */\nexport const BranchPickerPrimitiveNext = createActionButton(\n \"BranchPickerPrimitive.Next\",\n useBranchPickerNext,\n);\n"],"mappings":";;;AAEA;AAAA,EAGE;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP,IAAM,sBAAsB,MAAM;AAChC,QAAM,iBAAiB,kBAAkB;AACzC,QAAM,WAAW,WAAW,CAAC,MAAM,EAAE,gBAAgB,EAAE,WAAW;AAElE,QAAM,WAAW,YAAY,MAAM;AACjC,mBAAe,eAAe,EAAE,UAAU,OAAO,CAAC;AAAA,EACpD,GAAG,CAAC,cAAc,CAAC;AAEnB,MAAI,SAAU,QAAO;AACrB,SAAO;AACT;AAwBO,IAAM,4BAA4B;AAAA,EACvC;AAAA,EACA;AACF;","names":[]}
@@ -1,9 +1,47 @@
1
1
  import { ActionButtonElement, ActionButtonProps } from "../../utils/createActionButton";
2
+ /**
3
+ * Hook that provides navigation to the previous branch functionality.
4
+ *
5
+ * This hook returns a callback function that switches to the previous branch
6
+ * in the message branch tree, or null if there is no previous branch available.
7
+ *
8
+ * @returns A previous branch callback function, or null if navigation is disabled
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * function CustomPreviousButton() {
13
+ * const previous = useBranchPickerPrevious();
14
+ *
15
+ * return (
16
+ * <button onClick={previous} disabled={!previous}>
17
+ * {previous ? "Previous Branch" : "No Previous Branch"}
18
+ * </button>
19
+ * );
20
+ * }
21
+ * ```
22
+ */
2
23
  declare const useBranchPickerPrevious: () => (() => void) | null;
3
24
  export declare namespace BranchPickerPrimitivePrevious {
4
25
  type Element = ActionButtonElement;
26
+ /**
27
+ * Props for the BranchPickerPrimitive.Previous component.
28
+ * Inherits all button element props and action button functionality.
29
+ */
5
30
  type Props = ActionButtonProps<typeof useBranchPickerPrevious>;
6
31
  }
32
+ /**
33
+ * A button component that navigates to the previous branch in the message tree.
34
+ *
35
+ * This component automatically handles switching to the previous available branch
36
+ * and is disabled when there are no previous branches to navigate to.
37
+ *
38
+ * @example
39
+ * ```tsx
40
+ * <BranchPickerPrimitive.Previous>
41
+ * ← Previous
42
+ * </BranchPickerPrimitive.Previous>
43
+ * ```
44
+ */
7
45
  export declare const BranchPickerPrimitivePrevious: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
8
46
  asChild?: boolean;
9
47
  }, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"BranchPickerPrevious.d.ts","sourceRoot":"","sources":["../../../src/primitives/branchPicker/BranchPickerPrevious.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAOxC,QAAA,MAAM,uBAAuB,2BAU5B,CAAC;AAEF,yBAAiB,6BAA6B,CAAC;IAC7C,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,uBAAuB,CAAC,CAAC;CACvE;AAED,eAAO,MAAM,6BAA6B;;6DAGzC,CAAC"}
1
+ {"version":3,"file":"BranchPickerPrevious.d.ts","sourceRoot":"","sources":["../../../src/primitives/branchPicker/BranchPickerPrevious.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAOxC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,uBAAuB,2BAU5B,CAAC;AAEF,yBAAiB,6BAA6B,CAAC;IAC7C,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C;;;OAGG;IACH,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,uBAAuB,CAAC,CAAC;CACvE;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,6BAA6B;;6DAGzC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/primitives/branchPicker/BranchPickerPrevious.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport {\n useMessage,\n useMessageRuntime,\n} from \"../../context/react/MessageContext\";\n\nconst useBranchPickerPrevious = () => {\n const messageRuntime = useMessageRuntime();\n const disabled = useMessage((m) => m.branchNumber <= 1);\n\n const callback = useCallback(() => {\n messageRuntime.switchToBranch({ position: \"previous\" });\n }, [messageRuntime]);\n\n if (disabled) return null;\n return callback;\n};\n\nexport namespace BranchPickerPrimitivePrevious {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useBranchPickerPrevious>;\n}\n\nexport const BranchPickerPrimitivePrevious = createActionButton(\n \"BranchPickerPrimitive.Previous\",\n useBranchPickerPrevious,\n);\n"],"mappings":";;;AAEA;AAAA,EAGE;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP,IAAM,0BAA0B,MAAM;AACpC,QAAM,iBAAiB,kBAAkB;AACzC,QAAM,WAAW,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC;AAEtD,QAAM,WAAW,YAAY,MAAM;AACjC,mBAAe,eAAe,EAAE,UAAU,WAAW,CAAC;AAAA,EACxD,GAAG,CAAC,cAAc,CAAC;AAEnB,MAAI,SAAU,QAAO;AACrB,SAAO;AACT;AAOO,IAAM,gCAAgC;AAAA,EAC3C;AAAA,EACA;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/primitives/branchPicker/BranchPickerPrevious.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport {\n useMessage,\n useMessageRuntime,\n} from \"../../context/react/MessageContext\";\n\n/**\n * Hook that provides navigation to the previous branch functionality.\n *\n * This hook returns a callback function that switches to the previous branch\n * in the message branch tree, or null if there is no previous branch available.\n *\n * @returns A previous branch callback function, or null if navigation is disabled\n *\n * @example\n * ```tsx\n * function CustomPreviousButton() {\n * const previous = useBranchPickerPrevious();\n *\n * return (\n * <button onClick={previous} disabled={!previous}>\n * {previous ? \"Previous Branch\" : \"No Previous Branch\"}\n * </button>\n * );\n * }\n * ```\n */\nconst useBranchPickerPrevious = () => {\n const messageRuntime = useMessageRuntime();\n const disabled = useMessage((m) => m.branchNumber <= 1);\n\n const callback = useCallback(() => {\n messageRuntime.switchToBranch({ position: \"previous\" });\n }, [messageRuntime]);\n\n if (disabled) return null;\n return callback;\n};\n\nexport namespace BranchPickerPrimitivePrevious {\n export type Element = ActionButtonElement;\n /**\n * Props for the BranchPickerPrimitive.Previous component.\n * Inherits all button element props and action button functionality.\n */\n export type Props = ActionButtonProps<typeof useBranchPickerPrevious>;\n}\n\n/**\n * A button component that navigates to the previous branch in the message tree.\n *\n * This component automatically handles switching to the previous available branch\n * and is disabled when there are no previous branches to navigate to.\n *\n * @example\n * ```tsx\n * <BranchPickerPrimitive.Previous>\n * ← Previous\n * </BranchPickerPrimitive.Previous>\n * ```\n */\nexport const BranchPickerPrimitivePrevious = createActionButton(\n \"BranchPickerPrimitive.Previous\",\n useBranchPickerPrevious,\n);\n"],"mappings":";;;AAEA;AAAA,EAGE;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAuBP,IAAM,0BAA0B,MAAM;AACpC,QAAM,iBAAiB,kBAAkB;AACzC,QAAM,WAAW,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC;AAEtD,QAAM,WAAW,YAAY,MAAM;AACjC,mBAAe,eAAe,EAAE,UAAU,WAAW,CAAC;AAAA,EACxD,GAAG,CAAC,cAAc,CAAC;AAEnB,MAAI,SAAU,QAAO;AACrB,SAAO;AACT;AAwBO,IAAM,gCAAgC;AAAA,EAC3C;AAAA,EACA;AACF;","names":[]}
@@ -3,12 +3,39 @@ import { type ComponentRef, ComponentPropsWithoutRef } from "react";
3
3
  export declare namespace BranchPickerPrimitiveRoot {
4
4
  type Element = ComponentRef<typeof Primitive.div>;
5
5
  type Props = ComponentPropsWithoutRef<typeof Primitive.div> & {
6
+ /**
7
+ * Whether to hide the branch picker when there's only one branch available.
8
+ * When true, the component will only render when multiple branches exist.
9
+ * @default false
10
+ */
6
11
  hideWhenSingleBranch?: boolean | undefined;
7
12
  };
8
13
  }
14
+ /**
15
+ * The root container for branch picker components.
16
+ *
17
+ * This component provides a container for branch navigation controls,
18
+ * with optional conditional rendering based on the number of available branches.
19
+ * It integrates with the message branching system to allow users to navigate
20
+ * between different response variations.
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * <BranchPickerPrimitive.Root hideWhenSingleBranch={true}>
25
+ * <BranchPickerPrimitive.Previous />
26
+ * <BranchPickerPrimitive.Count />
27
+ * <BranchPickerPrimitive.Next />
28
+ * </BranchPickerPrimitive.Root>
29
+ * ```
30
+ */
9
31
  export declare const BranchPickerPrimitiveRoot: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
10
32
  asChild?: boolean;
11
33
  }, "ref"> & {
34
+ /**
35
+ * Whether to hide the branch picker when there's only one branch available.
36
+ * When true, the component will only render when multiple branches exist.
37
+ * @default false
38
+ */
12
39
  hideWhenSingleBranch?: boolean | undefined;
13
40
  } & import("react").RefAttributes<HTMLDivElement>>;
14
41
  //# sourceMappingURL=BranchPickerRoot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BranchPickerRoot.d.ts","sourceRoot":"","sources":["../../../src/primitives/branchPicker/BranchPickerRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,KAAK,YAAY,EAAc,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAGhF,yBAAiB,yBAAyB,CAAC;IACzC,KAAY,OAAO,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACzD,KAAY,KAAK,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG;QACnE,oBAAoB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KAC5C,CAAC;CACH;AAED,eAAO,MAAM,yBAAyB;;;2BAJX,OAAO,GAAG,SAAS;kDAa5C,CAAC"}
1
+ {"version":3,"file":"BranchPickerRoot.d.ts","sourceRoot":"","sources":["../../../src/primitives/branchPicker/BranchPickerRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,KAAK,YAAY,EAAc,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAGhF,yBAAiB,yBAAyB,CAAC;IACzC,KAAY,OAAO,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACzD,KAAY,KAAK,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG;QACnE;;;;WAIG;QACH,oBAAoB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KAC5C,CAAC;CACH;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,yBAAyB;;;IA1BlC;;;;OAIG;2BACoB,OAAO,GAAG,SAAS;kDA8B5C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/primitives/branchPicker/BranchPickerRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { type ComponentRef, forwardRef, ComponentPropsWithoutRef } from \"react\";\nimport { If } from \"../message\";\n\nexport namespace BranchPickerPrimitiveRoot {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div> & {\n hideWhenSingleBranch?: boolean | undefined;\n };\n}\n\nexport const BranchPickerPrimitiveRoot = forwardRef<\n BranchPickerPrimitiveRoot.Element,\n BranchPickerPrimitiveRoot.Props\n>(({ hideWhenSingleBranch, ...rest }, ref) => {\n return (\n <If hasBranches={hideWhenSingleBranch ? true : undefined}>\n <Primitive.div {...rest} ref={ref} />\n </If>\n );\n});\n\nBranchPickerPrimitiveRoot.displayName = \"BranchPickerPrimitive.Root\";\n"],"mappings":";;;AAEA,SAAS,iBAAiB;AAC1B,SAA4B,kBAA4C;AACxE,SAAS,UAAU;AAeb;AANC,IAAM,4BAA4B,WAGvC,CAAC,EAAE,sBAAsB,GAAG,KAAK,GAAG,QAAQ;AAC5C,SACE,oBAAC,MAAG,aAAa,uBAAuB,OAAO,QAC7C,8BAAC,UAAU,KAAV,EAAe,GAAG,MAAM,KAAU,GACrC;AAEJ,CAAC;AAED,0BAA0B,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/primitives/branchPicker/BranchPickerRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { type ComponentRef, forwardRef, ComponentPropsWithoutRef } from \"react\";\nimport { If } from \"../message\";\n\nexport namespace BranchPickerPrimitiveRoot {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div> & {\n /**\n * Whether to hide the branch picker when there's only one branch available.\n * When true, the component will only render when multiple branches exist.\n * @default false\n */\n hideWhenSingleBranch?: boolean | undefined;\n };\n}\n\n/**\n * The root container for branch picker components.\n *\n * This component provides a container for branch navigation controls,\n * with optional conditional rendering based on the number of available branches.\n * It integrates with the message branching system to allow users to navigate\n * between different response variations.\n *\n * @example\n * ```tsx\n * <BranchPickerPrimitive.Root hideWhenSingleBranch={true}>\n * <BranchPickerPrimitive.Previous />\n * <BranchPickerPrimitive.Count />\n * <BranchPickerPrimitive.Next />\n * </BranchPickerPrimitive.Root>\n * ```\n */\nexport const BranchPickerPrimitiveRoot = forwardRef<\n BranchPickerPrimitiveRoot.Element,\n BranchPickerPrimitiveRoot.Props\n>(({ hideWhenSingleBranch, ...rest }, ref) => {\n return (\n <If hasBranches={hideWhenSingleBranch ? true : undefined}>\n <Primitive.div {...rest} ref={ref} />\n </If>\n );\n});\n\nBranchPickerPrimitiveRoot.displayName = \"BranchPickerPrimitive.Root\";\n"],"mappings":";;;AAEA,SAAS,iBAAiB;AAC1B,SAA4B,kBAA4C;AACxE,SAAS,UAAU;AAqCb;AANC,IAAM,4BAA4B,WAGvC,CAAC,EAAE,sBAAsB,GAAG,KAAK,GAAG,QAAQ;AAC5C,SACE,oBAAC,MAAG,aAAa,uBAAuB,OAAO,QAC7C,8BAAC,UAAU,KAAV,EAAe,GAAG,MAAM,KAAU,GACrC;AAEJ,CAAC;AAED,0BAA0B,cAAc;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"ComposerAttachments.d.ts","sourceRoot":"","sources":["../../../src/primitives/composer/ComposerAttachments.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,EAAiB,MAAM,OAAO,CAAC;AAM9D,yBAAiB,4BAA4B,CAAC;IAC5C,KAAY,KAAK,GAAG;QAClB,UAAU,EACN;YACE,KAAK,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;YAClC,QAAQ,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;YACrC,IAAI,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;YACjC,UAAU,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;SACxC,GACD,SAAS,CAAC;KACf,CAAC;CACH;AAyDD,eAAO,MAAM,4BAA4B,EAAE,EAAE,CAC3C,4BAA4B,CAAC,KAAK,CAWnC,CAAC"}
1
+ {"version":3,"file":"ComposerAttachments.d.ts","sourceRoot":"","sources":["../../../src/primitives/composer/ComposerAttachments.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,EAAiB,MAAM,OAAO,CAAC;AAM9D,yBAAiB,4BAA4B,CAAC;IAC5C,KAAY,KAAK,GAAG;QAClB,UAAU,EACN;YACE,KAAK,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;YAClC,QAAQ,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;YACrC,IAAI,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;YACjC,UAAU,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;SACxC,GACD,SAAS,CAAC;KACf,CAAC;CACH;AAyDD,eAAO,MAAM,4BAA4B,EAAE,EAAE,CAC3C,4BAA4B,CAAC,KAAK,CAenC,CAAC"}
@@ -41,14 +41,17 @@ var ComposerAttachment = memo(
41
41
  );
42
42
  var ComposerPrimitiveAttachments = ({ components }) => {
43
43
  const attachmentsCount = useComposer((s) => s.attachments.length);
44
- return Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */ jsx(
45
- ComposerAttachment,
46
- {
47
- attachmentIndex: index,
48
- components
49
- },
50
- index
51
- ));
44
+ const attachmentElements = useMemo(() => {
45
+ return Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */ jsx(
46
+ ComposerAttachment,
47
+ {
48
+ attachmentIndex: index,
49
+ components
50
+ },
51
+ index
52
+ ));
53
+ }, [attachmentsCount, components]);
54
+ return attachmentElements;
52
55
  };
53
56
  ComposerPrimitiveAttachments.displayName = "ComposerPrimitive.Attachments";
54
57
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/primitives/composer/ComposerAttachments.tsx"],"sourcesContent":["\"use client\";\n\nimport { ComponentType, type FC, memo, useMemo } from \"react\";\nimport { Attachment } from \"../../types\";\nimport { useComposer, useComposerRuntime } from \"../../context\";\nimport { useThreadComposerAttachment } from \"../../context/react/AttachmentContext\";\nimport { AttachmentRuntimeProvider } from \"../../context/providers/AttachmentRuntimeProvider\";\n\nexport namespace ComposerPrimitiveAttachments {\n export type Props = {\n components:\n | {\n Image?: ComponentType | undefined;\n Document?: ComponentType | undefined;\n File?: ComponentType | undefined;\n Attachment?: ComponentType | undefined;\n }\n | undefined;\n };\n}\n\nconst getComponent = (\n components: ComposerPrimitiveAttachments.Props[\"components\"],\n attachment: Attachment,\n) => {\n const type = attachment.type;\n switch (type) {\n case \"image\":\n return components?.Image ?? components?.Attachment;\n case \"document\":\n return components?.Document ?? components?.Attachment;\n case \"file\":\n return components?.File ?? components?.Attachment;\n default:\n const _exhaustiveCheck: never = type;\n throw new Error(`Unknown attachment type: ${_exhaustiveCheck}`);\n }\n};\n\nconst AttachmentComponent: FC<{\n components: ComposerPrimitiveAttachments.Props[\"components\"];\n}> = ({ components }) => {\n const Component = useThreadComposerAttachment((a) =>\n getComponent(components, a),\n );\n\n if (!Component) return null;\n return <Component />;\n};\n\nconst ComposerAttachmentImpl: FC<\n ComposerPrimitiveAttachments.Props & { attachmentIndex: number }\n> = ({ components, attachmentIndex }) => {\n const composerRuntime = useComposerRuntime();\n const runtime = useMemo(\n () => composerRuntime.getAttachmentByIndex(attachmentIndex),\n [composerRuntime, attachmentIndex],\n );\n\n return (\n <AttachmentRuntimeProvider runtime={runtime}>\n <AttachmentComponent components={components} />\n </AttachmentRuntimeProvider>\n );\n};\n\nconst ComposerAttachment = memo(\n ComposerAttachmentImpl,\n (prev, next) =>\n prev.attachmentIndex === next.attachmentIndex &&\n prev.components?.Image === next.components?.Image &&\n prev.components?.Document === next.components?.Document &&\n prev.components?.File === next.components?.File &&\n prev.components?.Attachment === next.components?.Attachment,\n);\n\nexport const ComposerPrimitiveAttachments: FC<\n ComposerPrimitiveAttachments.Props\n> = ({ components }) => {\n const attachmentsCount = useComposer((s) => s.attachments.length);\n\n return Array.from({ length: attachmentsCount }, (_, index) => (\n <ComposerAttachment\n key={index}\n attachmentIndex={index}\n components={components}\n />\n ));\n};\n\nComposerPrimitiveAttachments.displayName = \"ComposerPrimitive.Attachments\";\n"],"mappings":";;;AAEA,SAAiC,MAAM,eAAe;AAEtD,SAAS,aAAa,0BAA0B;AAChD,SAAS,mCAAmC;AAC5C,SAAS,iCAAiC;AAyCjC;AA1BT,IAAM,eAAe,CACnB,YACA,eACG;AACH,QAAM,OAAO,WAAW;AACxB,UAAQ,MAAM;AAAA,IACZ,KAAK;AACH,aAAO,YAAY,SAAS,YAAY;AAAA,IAC1C,KAAK;AACH,aAAO,YAAY,YAAY,YAAY;AAAA,IAC7C,KAAK;AACH,aAAO,YAAY,QAAQ,YAAY;AAAA,IACzC;AACE,YAAM,mBAA0B;AAChC,YAAM,IAAI,MAAM,4BAA4B,gBAAgB,EAAE;AAAA,EAClE;AACF;AAEA,IAAM,sBAED,CAAC,EAAE,WAAW,MAAM;AACvB,QAAM,YAAY;AAAA,IAA4B,CAAC,MAC7C,aAAa,YAAY,CAAC;AAAA,EAC5B;AAEA,MAAI,CAAC,UAAW,QAAO;AACvB,SAAO,oBAAC,aAAU;AACpB;AAEA,IAAM,yBAEF,CAAC,EAAE,YAAY,gBAAgB,MAAM;AACvC,QAAM,kBAAkB,mBAAmB;AAC3C,QAAM,UAAU;AAAA,IACd,MAAM,gBAAgB,qBAAqB,eAAe;AAAA,IAC1D,CAAC,iBAAiB,eAAe;AAAA,EACnC;AAEA,SACE,oBAAC,6BAA0B,SACzB,8BAAC,uBAAoB,YAAwB,GAC/C;AAEJ;AAEA,IAAM,qBAAqB;AAAA,EACzB;AAAA,EACA,CAAC,MAAM,SACL,KAAK,oBAAoB,KAAK,mBAC9B,KAAK,YAAY,UAAU,KAAK,YAAY,SAC5C,KAAK,YAAY,aAAa,KAAK,YAAY,YAC/C,KAAK,YAAY,SAAS,KAAK,YAAY,QAC3C,KAAK,YAAY,eAAe,KAAK,YAAY;AACrD;AAEO,IAAM,+BAET,CAAC,EAAE,WAAW,MAAM;AACtB,QAAM,mBAAmB,YAAY,CAAC,MAAM,EAAE,YAAY,MAAM;AAEhE,SAAO,MAAM,KAAK,EAAE,QAAQ,iBAAiB,GAAG,CAAC,GAAG,UAClD;AAAA,IAAC;AAAA;AAAA,MAEC,iBAAiB;AAAA,MACjB;AAAA;AAAA,IAFK;AAAA,EAGP,CACD;AACH;AAEA,6BAA6B,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/primitives/composer/ComposerAttachments.tsx"],"sourcesContent":["\"use client\";\n\nimport { ComponentType, type FC, memo, useMemo } from \"react\";\nimport { Attachment } from \"../../types\";\nimport { useComposer, useComposerRuntime } from \"../../context\";\nimport { useThreadComposerAttachment } from \"../../context/react/AttachmentContext\";\nimport { AttachmentRuntimeProvider } from \"../../context/providers/AttachmentRuntimeProvider\";\n\nexport namespace ComposerPrimitiveAttachments {\n export type Props = {\n components:\n | {\n Image?: ComponentType | undefined;\n Document?: ComponentType | undefined;\n File?: ComponentType | undefined;\n Attachment?: ComponentType | undefined;\n }\n | undefined;\n };\n}\n\nconst getComponent = (\n components: ComposerPrimitiveAttachments.Props[\"components\"],\n attachment: Attachment,\n) => {\n const type = attachment.type;\n switch (type) {\n case \"image\":\n return components?.Image ?? components?.Attachment;\n case \"document\":\n return components?.Document ?? components?.Attachment;\n case \"file\":\n return components?.File ?? components?.Attachment;\n default:\n const _exhaustiveCheck: never = type;\n throw new Error(`Unknown attachment type: ${_exhaustiveCheck}`);\n }\n};\n\nconst AttachmentComponent: FC<{\n components: ComposerPrimitiveAttachments.Props[\"components\"];\n}> = ({ components }) => {\n const Component = useThreadComposerAttachment((a) =>\n getComponent(components, a),\n );\n\n if (!Component) return null;\n return <Component />;\n};\n\nconst ComposerAttachmentImpl: FC<\n ComposerPrimitiveAttachments.Props & { attachmentIndex: number }\n> = ({ components, attachmentIndex }) => {\n const composerRuntime = useComposerRuntime();\n const runtime = useMemo(\n () => composerRuntime.getAttachmentByIndex(attachmentIndex),\n [composerRuntime, attachmentIndex],\n );\n\n return (\n <AttachmentRuntimeProvider runtime={runtime}>\n <AttachmentComponent components={components} />\n </AttachmentRuntimeProvider>\n );\n};\n\nconst ComposerAttachment = memo(\n ComposerAttachmentImpl,\n (prev, next) =>\n prev.attachmentIndex === next.attachmentIndex &&\n prev.components?.Image === next.components?.Image &&\n prev.components?.Document === next.components?.Document &&\n prev.components?.File === next.components?.File &&\n prev.components?.Attachment === next.components?.Attachment,\n);\n\nexport const ComposerPrimitiveAttachments: FC<\n ComposerPrimitiveAttachments.Props\n> = ({ components }) => {\n const attachmentsCount = useComposer((s) => s.attachments.length);\n\n const attachmentElements = useMemo(() => {\n return Array.from({ length: attachmentsCount }, (_, index) => (\n <ComposerAttachment\n key={index}\n attachmentIndex={index}\n components={components}\n />\n ));\n }, [attachmentsCount, components]);\n\n return attachmentElements;\n};\n\nComposerPrimitiveAttachments.displayName = \"ComposerPrimitive.Attachments\";\n"],"mappings":";;;AAEA,SAAiC,MAAM,eAAe;AAEtD,SAAS,aAAa,0BAA0B;AAChD,SAAS,mCAAmC;AAC5C,SAAS,iCAAiC;AAyCjC;AA1BT,IAAM,eAAe,CACnB,YACA,eACG;AACH,QAAM,OAAO,WAAW;AACxB,UAAQ,MAAM;AAAA,IACZ,KAAK;AACH,aAAO,YAAY,SAAS,YAAY;AAAA,IAC1C,KAAK;AACH,aAAO,YAAY,YAAY,YAAY;AAAA,IAC7C,KAAK;AACH,aAAO,YAAY,QAAQ,YAAY;AAAA,IACzC;AACE,YAAM,mBAA0B;AAChC,YAAM,IAAI,MAAM,4BAA4B,gBAAgB,EAAE;AAAA,EAClE;AACF;AAEA,IAAM,sBAED,CAAC,EAAE,WAAW,MAAM;AACvB,QAAM,YAAY;AAAA,IAA4B,CAAC,MAC7C,aAAa,YAAY,CAAC;AAAA,EAC5B;AAEA,MAAI,CAAC,UAAW,QAAO;AACvB,SAAO,oBAAC,aAAU;AACpB;AAEA,IAAM,yBAEF,CAAC,EAAE,YAAY,gBAAgB,MAAM;AACvC,QAAM,kBAAkB,mBAAmB;AAC3C,QAAM,UAAU;AAAA,IACd,MAAM,gBAAgB,qBAAqB,eAAe;AAAA,IAC1D,CAAC,iBAAiB,eAAe;AAAA,EACnC;AAEA,SACE,oBAAC,6BAA0B,SACzB,8BAAC,uBAAoB,YAAwB,GAC/C;AAEJ;AAEA,IAAM,qBAAqB;AAAA,EACzB;AAAA,EACA,CAAC,MAAM,SACL,KAAK,oBAAoB,KAAK,mBAC9B,KAAK,YAAY,UAAU,KAAK,YAAY,SAC5C,KAAK,YAAY,aAAa,KAAK,YAAY,YAC/C,KAAK,YAAY,SAAS,KAAK,YAAY,QAC3C,KAAK,YAAY,eAAe,KAAK,YAAY;AACrD;AAEO,IAAM,+BAET,CAAC,EAAE,WAAW,MAAM;AACtB,QAAM,mBAAmB,YAAY,CAAC,MAAM,EAAE,YAAY,MAAM;AAEhE,QAAM,qBAAqB,QAAQ,MAAM;AACvC,WAAO,MAAM,KAAK,EAAE,QAAQ,iBAAiB,GAAG,CAAC,GAAG,UAClD;AAAA,MAAC;AAAA;AAAA,QAEC,iBAAiB;AAAA,QACjB;AAAA;AAAA,MAFK;AAAA,IAGP,CACD;AAAA,EACH,GAAG,CAAC,kBAAkB,UAAU,CAAC;AAEjC,SAAO;AACT;AAEA,6BAA6B,cAAc;","names":[]}
@@ -2,8 +2,25 @@ import { ActionButtonElement, ActionButtonProps } from "../../utils/createAction
2
2
  declare const useComposerCancel: () => (() => void) | null;
3
3
  export declare namespace ComposerPrimitiveCancel {
4
4
  type Element = ActionButtonElement;
5
+ /**
6
+ * Props for the ComposerPrimitive.Cancel component.
7
+ * Inherits all button element props and action button functionality.
8
+ */
5
9
  type Props = ActionButtonProps<typeof useComposerCancel>;
6
10
  }
11
+ /**
12
+ * A button component that cancels the current message composition.
13
+ *
14
+ * This component automatically handles the cancel functionality and is disabled
15
+ * when canceling is not available.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * <ComposerPrimitive.Cancel>
20
+ * Cancel
21
+ * </ComposerPrimitive.Cancel>
22
+ * ```
23
+ */
7
24
  export declare const ComposerPrimitiveCancel: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
8
25
  asChild?: boolean;
9
26
  }, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"ComposerCancel.d.ts","sourceRoot":"","sources":["../../../src/primitives/composer/ComposerCancel.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAIxC,QAAA,MAAM,iBAAiB,2BAUtB,CAAC;AAEF,yBAAiB,uBAAuB,CAAC;IACvC,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,iBAAiB,CAAC,CAAC;CACjE;AAED,eAAO,MAAM,uBAAuB;;6DAGnC,CAAC"}
1
+ {"version":3,"file":"ComposerCancel.d.ts","sourceRoot":"","sources":["../../../src/primitives/composer/ComposerCancel.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAIxC,QAAA,MAAM,iBAAiB,2BAUtB,CAAC;AAEF,yBAAiB,uBAAuB,CAAC;IACvC,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C;;;OAGG;IACH,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,iBAAiB,CAAC,CAAC;CACjE;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB;;6DAGnC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/primitives/composer/ComposerCancel.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport { useComposer, useComposerRuntime } from \"../../context\";\n\nconst useComposerCancel = () => {\n const composerRuntime = useComposerRuntime();\n const disabled = useComposer((c) => !c.canCancel);\n\n const callback = useCallback(() => {\n composerRuntime.cancel();\n }, [composerRuntime]);\n\n if (disabled) return null;\n return callback;\n};\n\nexport namespace ComposerPrimitiveCancel {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useComposerCancel>;\n}\n\nexport const ComposerPrimitiveCancel = createActionButton(\n \"ComposerPrimitive.Cancel\",\n useComposerCancel,\n);\n"],"mappings":";;;AAEA;AAAA,EAGE;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B,SAAS,aAAa,0BAA0B;AAEhD,IAAM,oBAAoB,MAAM;AAC9B,QAAM,kBAAkB,mBAAmB;AAC3C,QAAM,WAAW,YAAY,CAAC,MAAM,CAAC,EAAE,SAAS;AAEhD,QAAM,WAAW,YAAY,MAAM;AACjC,oBAAgB,OAAO;AAAA,EACzB,GAAG,CAAC,eAAe,CAAC;AAEpB,MAAI,SAAU,QAAO;AACrB,SAAO;AACT;AAOO,IAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/primitives/composer/ComposerCancel.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport { useComposer, useComposerRuntime } from \"../../context\";\n\nconst useComposerCancel = () => {\n const composerRuntime = useComposerRuntime();\n const disabled = useComposer((c) => !c.canCancel);\n\n const callback = useCallback(() => {\n composerRuntime.cancel();\n }, [composerRuntime]);\n\n if (disabled) return null;\n return callback;\n};\n\nexport namespace ComposerPrimitiveCancel {\n export type Element = ActionButtonElement;\n /**\n * Props for the ComposerPrimitive.Cancel component.\n * Inherits all button element props and action button functionality.\n */\n export type Props = ActionButtonProps<typeof useComposerCancel>;\n}\n\n/**\n * A button component that cancels the current message composition.\n *\n * This component automatically handles the cancel functionality and is disabled\n * when canceling is not available.\n *\n * @example\n * ```tsx\n * <ComposerPrimitive.Cancel>\n * Cancel\n * </ComposerPrimitive.Cancel>\n * ```\n */\nexport const ComposerPrimitiveCancel = createActionButton(\n \"ComposerPrimitive.Cancel\",\n useComposerCancel,\n);\n"],"mappings":";;;AAEA;AAAA,EAGE;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B,SAAS,aAAa,0BAA0B;AAEhD,IAAM,oBAAoB,MAAM;AAC9B,QAAM,kBAAkB,mBAAmB;AAC3C,QAAM,WAAW,YAAY,CAAC,MAAM,CAAC,EAAE,SAAS;AAEhD,QAAM,WAAW,YAAY,MAAM;AACjC,oBAAgB,OAAO;AAAA,EACzB,GAAG,CAAC,eAAe,CAAC;AAEpB,MAAI,SAAU,QAAO;AACrB,SAAO;AACT;AAwBO,IAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AACF;","names":[]}