@anvia/react-ui 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/attachment/index.d.ts +3 -21
  2. package/dist/attachment/index.js +3 -12
  3. package/dist/attachment-DsKTPumt.js +89 -0
  4. package/dist/attachment-DsKTPumt.js.map +1 -0
  5. package/dist/chat/index.d.ts +3 -152
  6. package/dist/chat/index.js +3 -25
  7. package/dist/chat-CAnvUEAv.js +1210 -0
  8. package/dist/chat-CAnvUEAv.js.map +1 -0
  9. package/dist/completion/index.d.ts +3 -29
  10. package/dist/completion/index.js +3 -16
  11. package/dist/completion-DDTKoZRJ.js +124 -0
  12. package/dist/completion-DDTKoZRJ.js.map +1 -0
  13. package/dist/connection-DeNq8wHS.js +203 -0
  14. package/dist/connection-DeNq8wHS.js.map +1 -0
  15. package/dist/contexts-B4ijG24z.js +212 -0
  16. package/dist/contexts-B4ijG24z.js.map +1 -0
  17. package/dist/elements-D4vmkkF8.js +19 -0
  18. package/dist/elements-D4vmkkF8.js.map +1 -0
  19. package/dist/graph-explorer/index.d.ts +54 -73
  20. package/dist/graph-explorer/index.d.ts.map +1 -0
  21. package/dist/graph-explorer/index.js +181 -248
  22. package/dist/graph-explorer/index.js.map +1 -1
  23. package/dist/human-input/index.d.ts +3 -78
  24. package/dist/human-input/index.js +3 -21
  25. package/dist/human-input-CsCbZomZ.js +314 -0
  26. package/dist/human-input-CsCbZomZ.js.map +1 -0
  27. package/dist/image/index.d.ts +3 -40
  28. package/dist/image/index.js +3 -12
  29. package/dist/image-D_7vaQCR.js +302 -0
  30. package/dist/image-D_7vaQCR.js.map +1 -0
  31. package/dist/index-B1Qs2Cjv.d.ts +145 -0
  32. package/dist/index-B1Qs2Cjv.d.ts.map +1 -0
  33. package/dist/index-BCBVcl0D.d.ts +277 -0
  34. package/dist/index-BCBVcl0D.d.ts.map +1 -0
  35. package/dist/index-CE22tsua.d.ts +20 -0
  36. package/dist/index-CE22tsua.d.ts.map +1 -0
  37. package/dist/index-CGqtpc6b.d.ts +25 -0
  38. package/dist/index-CGqtpc6b.d.ts.map +1 -0
  39. package/dist/index-DqdyM0Jm.d.ts +7 -0
  40. package/dist/index-DqdyM0Jm.d.ts.map +1 -0
  41. package/dist/index-Mw3ltwSG.d.ts +318 -0
  42. package/dist/index-Mw3ltwSG.d.ts.map +1 -0
  43. package/dist/index.d.ts +7 -40
  44. package/dist/index.js +34 -118
  45. package/dist/index.js.map +1 -1
  46. package/dist/message/index.d.ts +3 -105
  47. package/dist/message/index.js +3 -20
  48. package/dist/message-Dn3wW6yy.js +783 -0
  49. package/dist/message-Dn3wW6yy.js.map +1 -0
  50. package/dist/primitives-xfE7zfwJ.js +15 -0
  51. package/dist/primitives-xfE7zfwJ.js.map +1 -0
  52. package/dist/refs-Djj9rSvB.js +10 -0
  53. package/dist/refs-Djj9rSvB.js.map +1 -0
  54. package/dist/sandbox-desktop/index.d.ts +100 -104
  55. package/dist/sandbox-desktop/index.d.ts.map +1 -0
  56. package/dist/sandbox-desktop/index.js +344 -342
  57. package/dist/sandbox-desktop/index.js.map +1 -1
  58. package/dist/sandbox-terminal/index.d.ts +52 -56
  59. package/dist/sandbox-terminal/index.d.ts.map +1 -0
  60. package/dist/sandbox-terminal/index.js +217 -208
  61. package/dist/sandbox-terminal/index.js.map +1 -1
  62. package/dist/selection-toolbar/index.d.ts +3 -21
  63. package/dist/selection-toolbar/index.js +3 -13
  64. package/dist/selection-toolbar-CIkOoM-7.js +171 -0
  65. package/dist/selection-toolbar-CIkOoM-7.js.map +1 -0
  66. package/dist/shared-BSYElFU2.d.ts +2 -0
  67. package/dist/shared.d.ts +4 -14
  68. package/dist/shared.js +1 -43
  69. package/dist/stream/index.d.ts +2 -22
  70. package/dist/stream/index.js +1 -8
  71. package/dist/stream-CAO0x8_1.js +298 -0
  72. package/dist/stream-CAO0x8_1.js.map +1 -0
  73. package/dist/thread-list/index.d.ts +3 -47
  74. package/dist/thread-list/index.js +3 -18
  75. package/dist/thread-list-xJbGXFrE.js +228 -0
  76. package/dist/thread-list-xJbGXFrE.js.map +1 -0
  77. package/dist/ticket-CoJHBpdF.d.ts +32 -0
  78. package/dist/ticket-CoJHBpdF.d.ts.map +1 -0
  79. package/dist/value-BGGrx72L.js +13 -0
  80. package/dist/value-BGGrx72L.js.map +1 -0
  81. package/package.json +22 -22
  82. package/dist/attachment/index.js.map +0 -1
  83. package/dist/attachment-mbjsroli.d.ts +0 -9
  84. package/dist/chat/index.js.map +0 -1
  85. package/dist/chat-PSj1Fo4W.d.ts +0 -88
  86. package/dist/chunk-22EZJUPM.js +0 -120
  87. package/dist/chunk-22EZJUPM.js.map +0 -1
  88. package/dist/chunk-5FZKTDZR.js +0 -201
  89. package/dist/chunk-5FZKTDZR.js.map +0 -1
  90. package/dist/chunk-6XOJFLX4.js +0 -22
  91. package/dist/chunk-6XOJFLX4.js.map +0 -1
  92. package/dist/chunk-CKA4CE26.js +0 -25
  93. package/dist/chunk-CKA4CE26.js.map +0 -1
  94. package/dist/chunk-DLBNFBXQ.js +0 -425
  95. package/dist/chunk-DLBNFBXQ.js.map +0 -1
  96. package/dist/chunk-E73S3SOF.js +0 -404
  97. package/dist/chunk-E73S3SOF.js.map +0 -1
  98. package/dist/chunk-F6AKBUO3.js +0 -380
  99. package/dist/chunk-F6AKBUO3.js.map +0 -1
  100. package/dist/chunk-HGOPGZNQ.js +0 -195
  101. package/dist/chunk-HGOPGZNQ.js.map +0 -1
  102. package/dist/chunk-KHB5CHAU.js +0 -220
  103. package/dist/chunk-KHB5CHAU.js.map +0 -1
  104. package/dist/chunk-LHABOAOP.js +0 -316
  105. package/dist/chunk-LHABOAOP.js.map +0 -1
  106. package/dist/chunk-N5XQU36W.js +0 -410
  107. package/dist/chunk-N5XQU36W.js.map +0 -1
  108. package/dist/chunk-T3ZFZ3NP.js +0 -30
  109. package/dist/chunk-T3ZFZ3NP.js.map +0 -1
  110. package/dist/chunk-T4IYUEPH.js +0 -1612
  111. package/dist/chunk-T4IYUEPH.js.map +0 -1
  112. package/dist/chunk-W2AHKMRS.js +0 -1092
  113. package/dist/chunk-W2AHKMRS.js.map +0 -1
  114. package/dist/completion/index.js.map +0 -1
  115. package/dist/completion-input-DHlwrhxB.d.ts +0 -24
  116. package/dist/composer-6iCSIq6L.d.ts +0 -111
  117. package/dist/human-input/index.js.map +0 -1
  118. package/dist/human-input-CkLrZ8IC.d.ts +0 -27
  119. package/dist/image/index.js.map +0 -1
  120. package/dist/image-VZv6Ddsn.d.ts +0 -14
  121. package/dist/message/index.js.map +0 -1
  122. package/dist/message-CNRnZQwU.d.ts +0 -14
  123. package/dist/render-CRKWam2v.d.ts +0 -8
  124. package/dist/selection-toolbar/index.js.map +0 -1
  125. package/dist/selection-toolbar-Cwjbuv5S.d.ts +0 -14
  126. package/dist/shared.js.map +0 -1
  127. package/dist/stream/index.js.map +0 -1
  128. package/dist/thread-Bz6-1zaJ.d.ts +0 -12
  129. package/dist/thread-list/index.js.map +0 -1
  130. package/dist/thread-list-On8db4XL.d.ts +0 -34
  131. package/dist/ticket-pexI1zIa.d.ts +0 -33
@@ -1,21 +1,3 @@
1
- import * as _anvia_client from '@anvia/client';
2
- import * as react from 'react';
3
- export { A as AttachmentContextValue, u as useAttachment } from '../attachment-mbjsroli.js';
4
- import { P as PrimitiveProps } from '../render-CRKWam2v.js';
5
-
6
- declare const AttachmentPrimitive: {
7
- readonly Root: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
8
- children?: react.ReactNode | ((attachment: _anvia_client.UIAttachment) => react.ReactNode);
9
- } & react.RefAttributes<HTMLDivElement>>;
10
- readonly Name: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "asChild"> & {
11
- asChild?: boolean;
12
- } & react.RefAttributes<HTMLSpanElement>>;
13
- readonly Preview: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
14
- asChild?: boolean;
15
- } & react.RefAttributes<HTMLDivElement>>;
16
- readonly Remove: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "asChild"> & {
17
- asChild?: boolean;
18
- } & react.RefAttributes<HTMLButtonElement>>;
19
- };
20
-
21
- export { AttachmentPrimitive };
1
+ import { ct as useAttachment, st as AttachmentContextValue } from "../index-Mw3ltwSG.js";
2
+ import { t as AttachmentPrimitive } from "../index-BCBVcl0D.js";
3
+ export { type AttachmentContextValue, AttachmentPrimitive, useAttachment };
@@ -1,12 +1,3 @@
1
- import {
2
- AttachmentPrimitive
3
- } from "../chunk-22EZJUPM.js";
4
- import "../chunk-T3ZFZ3NP.js";
5
- import {
6
- useAttachment
7
- } from "../chunk-E73S3SOF.js";
8
- export {
9
- AttachmentPrimitive,
10
- useAttachment
11
- };
12
- //# sourceMappingURL=index.js.map
1
+ import { z as useAttachment } from "../contexts-B4ijG24z.js";
2
+ import { t as AttachmentPrimitive } from "../attachment-DsKTPumt.js";
3
+ export { AttachmentPrimitive, useAttachment };
@@ -0,0 +1,89 @@
1
+ import { z as useAttachment } from "./contexts-B4ijG24z.js";
2
+ import { t as renderPrimitive } from "./primitives-xfE7zfwJ.js";
3
+ import { forwardRef, useCallback } from "react";
4
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
5
+ // src/attachment/parts.tsx
6
+ const AttachmentRoot = forwardRef(function AttachmentRoot({ children, ...props }, ref) {
7
+ const { attachment, remove } = useAttachment();
8
+ const renderedChildren = typeof children === "function" ? children(attachment) : children ?? defaultAttachment(remove);
9
+ return renderPrimitive("div", {
10
+ ...props,
11
+ children: renderedChildren
12
+ }, ref);
13
+ });
14
+ const AttachmentName = forwardRef(function AttachmentName(props, ref) {
15
+ const { attachment } = useAttachment();
16
+ return renderPrimitive("span", {
17
+ ...props,
18
+ children: props.children ?? attachmentLabel(attachment)
19
+ }, ref);
20
+ });
21
+ const AttachmentPreview = forwardRef(function AttachmentPreview(props, ref) {
22
+ const { attachment } = useAttachment();
23
+ return renderPrimitive("div", {
24
+ ...props,
25
+ children: props.children ?? defaultPreview(attachment)
26
+ }, ref);
27
+ });
28
+ const AttachmentRemove = forwardRef(function AttachmentRemove({ onClick, ...props }, ref) {
29
+ const { remove } = useAttachment();
30
+ const disabled = props.disabled ?? remove === void 0;
31
+ const handleClick = useCallback((event) => {
32
+ onClick?.(event);
33
+ if (event.defaultPrevented || disabled) return;
34
+ remove?.();
35
+ }, [
36
+ disabled,
37
+ onClick,
38
+ remove
39
+ ]);
40
+ return renderPrimitive("button", {
41
+ ...props,
42
+ children: props.children ?? "Remove",
43
+ disabled,
44
+ onClick: handleClick,
45
+ type: props.type ?? "button",
46
+ "data-state": disabled ? "disabled" : "enabled"
47
+ }, ref);
48
+ });
49
+ function defaultAttachment(remove) {
50
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
51
+ /* @__PURE__ */ jsx(AttachmentPreview, {}),
52
+ /* @__PURE__ */ jsx(AttachmentName, {}),
53
+ remove === void 0 ? null : /* @__PURE__ */ jsx(AttachmentRemove, {})
54
+ ] });
55
+ }
56
+ function defaultPreview(attachment) {
57
+ if (isImageAttachment(attachment)) {
58
+ const source = attachment.url ?? attachmentDataUrl(attachment);
59
+ if (source !== void 0) return /* @__PURE__ */ jsx("img", {
60
+ alt: attachment.name ?? "Attachment",
61
+ src: source
62
+ });
63
+ }
64
+ if (attachment.url !== void 0) return /* @__PURE__ */ jsx("a", {
65
+ href: attachment.url,
66
+ children: attachmentLabel(attachment)
67
+ });
68
+ return /* @__PURE__ */ jsx("span", { children: attachment.mediaType ?? attachment.type });
69
+ }
70
+ function attachmentLabel(attachment) {
71
+ return attachment.name ?? attachment.mediaType ?? attachment.type;
72
+ }
73
+ function isImageAttachment(attachment) {
74
+ return attachment.type === "image" || attachment.mediaType?.startsWith("image/") === true;
75
+ }
76
+ function attachmentDataUrl(attachment) {
77
+ if (attachment.data === void 0 || attachment.mediaType === void 0) return;
78
+ return `data:${attachment.mediaType};base64,${attachment.data}`;
79
+ }
80
+ // src/attachment/index.ts
81
+ const AttachmentPrimitive = {
82
+ Root: AttachmentRoot,
83
+ Name: AttachmentName,
84
+ Preview: AttachmentPreview,
85
+ Remove: AttachmentRemove
86
+ };
87
+ export { AttachmentPrimitive as t };
88
+
89
+ //# sourceMappingURL=attachment-DsKTPumt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachment-DsKTPumt.js","names":[],"sources":["../src/attachment/parts.tsx","../src/attachment/index.ts"],"sourcesContent":["import type { UIAttachment } from \"@anvia/client\";\nimport { forwardRef, type MouseEvent, type ReactNode, useCallback } from \"react\";\n\nimport { useAttachment } from \"../contexts\";\nimport { type PrimitiveProps, renderPrimitive } from \"../primitives\";\n\ntype AttachmentChildren = ReactNode | ((attachment: UIAttachment) => ReactNode);\n\ntype AttachmentRootProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n children?: AttachmentChildren;\n};\n\nconst AttachmentRoot = forwardRef<HTMLDivElement, AttachmentRootProps>(function AttachmentRoot(\n { children, ...props },\n ref,\n) {\n const { attachment, remove } = useAttachment();\n const renderedChildren =\n typeof children === \"function\" ? children(attachment) : (children ?? defaultAttachment(remove));\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: renderedChildren,\n } as PrimitiveProps<\"div\">,\n ref,\n );\n});\n\nconst AttachmentName = forwardRef<HTMLSpanElement, PrimitiveProps<\"span\">>(\n function AttachmentName(props, ref) {\n const { attachment } = useAttachment();\n\n return renderPrimitive(\n \"span\",\n {\n ...props,\n children: props.children ?? attachmentLabel(attachment),\n } as PrimitiveProps<\"span\">,\n ref,\n );\n },\n);\n\nconst AttachmentPreview = forwardRef<HTMLDivElement, PrimitiveProps<\"div\">>(\n function AttachmentPreview(props, ref) {\n const { attachment } = useAttachment();\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: props.children ?? defaultPreview(attachment),\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\nconst AttachmentRemove = forwardRef<HTMLButtonElement, PrimitiveProps<\"button\">>(\n function AttachmentRemove({ onClick, ...props }, ref) {\n const { remove } = useAttachment();\n const disabled = props.disabled ?? remove === undefined;\n\n const handleClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled) {\n return;\n }\n remove?.();\n },\n [disabled, onClick, remove],\n );\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Remove\",\n disabled,\n onClick: handleClick,\n type: props.type ?? \"button\",\n \"data-state\": disabled ? \"disabled\" : \"enabled\",\n } as PrimitiveProps<\"button\">,\n ref,\n );\n },\n);\n\nfunction defaultAttachment(remove: (() => void) | undefined): ReactNode {\n return (\n <>\n <AttachmentPreview />\n <AttachmentName />\n {remove === undefined ? null : <AttachmentRemove />}\n </>\n );\n}\n\nfunction defaultPreview(attachment: UIAttachment): ReactNode {\n if (isImageAttachment(attachment)) {\n const source = attachment.url ?? attachmentDataUrl(attachment);\n if (source !== undefined) {\n return <img alt={attachment.name ?? \"Attachment\"} src={source} />;\n }\n }\n\n if (attachment.url !== undefined) {\n return <a href={attachment.url}>{attachmentLabel(attachment)}</a>;\n }\n\n return <span>{attachment.mediaType ?? attachment.type}</span>;\n}\n\nfunction attachmentLabel(attachment: UIAttachment): string {\n return attachment.name ?? attachment.mediaType ?? attachment.type;\n}\n\nfunction isImageAttachment(attachment: UIAttachment): boolean {\n return attachment.type === \"image\" || attachment.mediaType?.startsWith(\"image/\") === true;\n}\n\nfunction attachmentDataUrl(attachment: UIAttachment): string | undefined {\n if (attachment.data === undefined || attachment.mediaType === undefined) {\n return undefined;\n }\n return `data:${attachment.mediaType};base64,${attachment.data}`;\n}\n\nexport { AttachmentName, AttachmentPreview, AttachmentRemove, AttachmentRoot };\n","import { AttachmentName, AttachmentPreview, AttachmentRemove, AttachmentRoot } from \"./parts\";\n\nexport const AttachmentPrimitive = {\n Root: AttachmentRoot,\n Name: AttachmentName,\n Preview: AttachmentPreview,\n Remove: AttachmentRemove,\n} as const;\n\nexport type { AttachmentContextValue } from \"../contexts\";\nexport { useAttachment } from \"../contexts\";\n"],"mappings":";;;;;AAYA,MAAM,iBAAiB,WAAgD,SAAS,eAC9E,EAAE,UAAU,GAAG,SACf,KACA;CACA,MAAM,EAAE,YAAY,WAAW,cAAc;CAC7C,MAAM,mBACJ,OAAO,aAAa,aAAa,SAAS,UAAU,IAAK,YAAY,kBAAkB,MAAM;CAE/F,OAAO,gBACL,OACA;EACE,GAAG;EACH,UAAU;CACZ,GACA,GACF;AACF,CAAC;AAED,MAAM,iBAAiB,WACrB,SAAS,eAAe,OAAO,KAAK;CAClC,MAAM,EAAE,eAAe,cAAc;CAErC,OAAO,gBACL,QACA;EACE,GAAG;EACH,UAAU,MAAM,YAAY,gBAAgB,UAAU;CACxD,GACA,GACF;AACF,CACF;AAEA,MAAM,oBAAoB,WACxB,SAAS,kBAAkB,OAAO,KAAK;CACrC,MAAM,EAAE,eAAe,cAAc;CAErC,OAAO,gBACL,OACA;EACE,GAAG;EACH,UAAU,MAAM,YAAY,eAAe,UAAU;CACvD,GACA,GACF;AACF,CACF;AAEA,MAAM,mBAAmB,WACvB,SAAS,iBAAiB,EAAE,SAAS,GAAG,SAAS,KAAK;CACpD,MAAM,EAAE,WAAW,cAAc;CACjC,MAAM,WAAW,MAAM,YAAY,WAAW,KAAA;CAE9C,MAAM,cAAc,aACjB,UAAyC;EACxC,UAAU,KAAK;EACf,IAAI,MAAM,oBAAoB,UAC5B;EAEF,SAAS;CACX,GACA;EAAC;EAAU;EAAS;CAAM,CAC5B;CAEA,OAAO,gBACL,UACA;EACE,GAAG;EACH,UAAU,MAAM,YAAY;EAC5B;EACA,SAAS;EACT,MAAM,MAAM,QAAQ;EACpB,cAAc,WAAW,aAAa;CACxC,GACA,GACF;AACF,CACF;AAEA,SAAS,kBAAkB,QAA6C;CACtE,OACE,qBAAA,YAAA,EAAA,UAAA;EACE,oBAAC,mBAAD,CAAoB,CAAA;EACpB,oBAAC,gBAAD,CAAiB,CAAA;EAChB,WAAW,KAAA,IAAY,OAAO,oBAAC,kBAAD,CAAmB,CAAA;CAClD,EAAA,CAAA;AAEN;AAEA,SAAS,eAAe,YAAqC;CAC3D,IAAI,kBAAkB,UAAU,GAAG;EACjC,MAAM,SAAS,WAAW,OAAO,kBAAkB,UAAU;EAC7D,IAAI,WAAW,KAAA,GACb,OAAO,oBAAC,OAAD;GAAK,KAAK,WAAW,QAAQ;GAAc,KAAK;EAAS,CAAA;CAEpE;CAEA,IAAI,WAAW,QAAQ,KAAA,GACrB,OAAO,oBAAC,KAAD;EAAG,MAAM,WAAW;EAAM,UAAA,gBAAgB,UAAU;CAAK,CAAA;CAGlE,OAAO,oBAAC,QAAD,EAAA,UAAO,WAAW,aAAa,WAAW,KAAW,CAAA;AAC9D;AAEA,SAAS,gBAAgB,YAAkC;CACzD,OAAO,WAAW,QAAQ,WAAW,aAAa,WAAW;AAC/D;AAEA,SAAS,kBAAkB,YAAmC;CAC5D,OAAO,WAAW,SAAS,WAAW,WAAW,WAAW,WAAW,QAAQ,MAAM;AACvF;AAEA,SAAS,kBAAkB,YAA8C;CACvE,IAAI,WAAW,SAAS,KAAA,KAAa,WAAW,cAAc,KAAA,GAC5D;CAEF,OAAO,QAAQ,WAAW,UAAU,UAAU,WAAW;AAC3D;;AC/HA,MAAa,sBAAsB;CACjC,MAAM;CACN,MAAM;CACN,SAAS;CACT,QAAQ;AACV"}
@@ -1,152 +1,3 @@
1
- import { C as ChatController } from '../chat-PSj1Fo4W.js';
2
- export { a as ChatProvider, b as ChatProviderProps, u as useChatContext } from '../chat-PSj1Fo4W.js';
3
- import { d as ComposerEntity, g as ComposerQuote, h as ComposerTriggerDefinition, l as ComposerTriggerState, i as ComposerTriggerItem } from '../composer-6iCSIq6L.js';
4
- export { C as ComposerAttachmentInput, a as ComposerAttachmentsUpdate, b as ComposerContextValue, c as ComposerEntitiesUpdate, e as ComposerEntityData, f as ComposerMessageMetadata, j as ComposerTriggerItems, k as ComposerTriggerItemsArgs, m as ComposerTriggerStateUpdate, u as useComposer } from '../composer-6iCSIq6L.js';
5
- export { T as ThreadContextValue, u as useThread } from '../thread-Bz6-1zaJ.js';
6
- import * as react from 'react';
7
- import { ReactNode } from 'react';
8
- import { UIAttachment, ClientDataMap, ClientMetadata, UIMessage } from '@anvia/client';
9
- import { P as PrimitiveProps } from '../render-CRKWam2v.js';
10
- import { UseChatStatus, ChatSuggestion } from '@anvia/react';
11
-
12
- type ComposerSubmitMessageArgs<TData extends ClientDataMap = ClientDataMap> = {
13
- input: string;
14
- attachments: UIAttachment[];
15
- entities: ComposerEntity[];
16
- chat: ChatController<ClientMetadata, TData>;
17
- quote?: ComposerQuote | undefined;
18
- clear(): void;
19
- };
20
- type ComposerSubmitMessage<TData extends ClientDataMap = ClientDataMap> = (args: ComposerSubmitMessageArgs<TData>) => Promise<void> | void;
21
- /** A mention token as the editor knows it; `range` is meaningful only in the saved message. */
22
- type ComposerInputEntity = Omit<ComposerEntity, "range">;
23
- type ComposerTriggerMenuChildren = ReactNode | ((trigger: ComposerTriggerState) => ReactNode);
24
- type ComposerTriggerItemChildren = ReactNode | ((item: ComposerTriggerItem, trigger: ComposerTriggerState) => ReactNode);
25
- type ComposerAttachmentsChildren = ReactNode | ((attachment: UIAttachment) => ReactNode);
26
- declare const ComposerPrimitive: {
27
- readonly Root: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "ref">, "asChild"> & {
28
- asChild?: boolean;
29
- } & {
30
- attachments?: UIAttachment[];
31
- defaultAttachments?: UIAttachment[];
32
- defaultEntities?: ComposerEntity[];
33
- defaultInput?: string;
34
- defaultQuote?: ComposerQuote | undefined;
35
- entities?: ComposerEntity[];
36
- input?: string;
37
- onAttachmentsChange?: (attachments: UIAttachment[]) => void;
38
- onEntitiesChange?: (entities: ComposerEntity[]) => void;
39
- onInputChange?: (input: string) => void;
40
- onQuoteChange?: (quote: ComposerQuote | undefined) => void;
41
- quote?: ComposerQuote | undefined;
42
- submitMessage?: ComposerSubmitMessage;
43
- triggers?: ComposerTriggerDefinition[];
44
- } & react.RefAttributes<HTMLFormElement>>;
45
- readonly Quote: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"blockquote">, "children"> & {
46
- children?: ReactNode | ((quote: ComposerQuote) => ReactNode);
47
- } & react.RefAttributes<HTMLQuoteElement>>;
48
- readonly ClearQuote: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "asChild"> & {
49
- asChild?: boolean;
50
- } & react.RefAttributes<HTMLButtonElement>>;
51
- readonly Input: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
52
- asChild?: boolean;
53
- } & {
54
- autoResize?: boolean;
55
- disabled?: boolean | undefined;
56
- maxRows?: number;
57
- minRows?: number;
58
- placeholder?: string | undefined;
59
- /**
60
- * Customises how a mention token displays in the editor. The saved text and entities are
61
- * unchanged. Return `null` or `undefined` to show the entity's text. Keep it a pure function of
62
- * `entity`: a token re-renders only when its node changes, not when the function's closure does.
63
- */
64
- renderEntity?: ((entity: ComposerInputEntity) => ReactNode) | undefined;
65
- } & react.RefAttributes<HTMLDivElement>>;
66
- readonly TextareaInput: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref">, "asChild"> & {
67
- asChild?: boolean;
68
- } & {
69
- autoResize?: boolean;
70
- maxRows?: number;
71
- minRows?: number;
72
- } & react.RefAttributes<HTMLTextAreaElement>>;
73
- readonly TriggerMenu: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
74
- children?: ComposerTriggerMenuChildren;
75
- keepMounted?: boolean;
76
- } & react.RefAttributes<HTMLDivElement>>;
77
- readonly TriggerItem: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"button">, "children"> & {
78
- children?: ComposerTriggerItemChildren;
79
- index?: number | undefined;
80
- item?: ComposerTriggerItem | undefined;
81
- } & react.RefAttributes<HTMLButtonElement>>;
82
- readonly Attachments: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
83
- children?: ComposerAttachmentsChildren;
84
- keepMounted?: boolean;
85
- } & react.RefAttributes<HTMLDivElement>>;
86
- readonly AddAttachment: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "asChild"> & {
87
- asChild?: boolean;
88
- } & {
89
- accept?: string;
90
- multiple?: boolean;
91
- } & react.RefAttributes<HTMLButtonElement>>;
92
- readonly AttachmentInput: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "asChild"> & {
93
- asChild?: boolean;
94
- } & react.RefAttributes<HTMLInputElement>>;
95
- readonly AttachmentDropzone: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
96
- asChild?: boolean;
97
- } & {
98
- disabled?: boolean;
99
- } & react.RefAttributes<HTMLDivElement>>;
100
- readonly Submit: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "asChild"> & {
101
- asChild?: boolean;
102
- } & react.RefAttributes<HTMLButtonElement>>;
103
- readonly Stop: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "asChild"> & {
104
- asChild?: boolean;
105
- } & react.RefAttributes<HTMLButtonElement>>;
106
- };
107
-
108
- type ThreadMessagesChildren = ReactNode | ((message: UIMessage) => ReactNode);
109
- type ThreadSuggestionChildren = ReactNode | ((suggestion: ChatSuggestion) => ReactNode);
110
- declare const ThreadPrimitive: {
111
- readonly Root: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
112
- asChild?: boolean;
113
- } & react.RefAttributes<HTMLDivElement>>;
114
- readonly Viewport: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
115
- asChild?: boolean;
116
- } & {
117
- autoScroll?: boolean;
118
- } & react.RefAttributes<HTMLDivElement>>;
119
- readonly ViewportFooter: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
120
- asChild?: boolean;
121
- } & react.RefAttributes<HTMLDivElement>>;
122
- readonly Messages: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
123
- children?: ThreadMessagesChildren;
124
- keepMounted?: boolean;
125
- } & react.RefAttributes<HTMLDivElement>>;
126
- readonly Empty: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
127
- asChild?: boolean;
128
- } & react.RefAttributes<HTMLDivElement>>;
129
- readonly Status: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
130
- children?: ReactNode | ((status: UseChatStatus) => ReactNode);
131
- } & react.RefAttributes<HTMLDivElement>>;
132
- readonly Loading: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
133
- asChild?: boolean;
134
- } & react.RefAttributes<HTMLDivElement>>;
135
- readonly Error: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
136
- children?: ReactNode | ((error: unknown) => ReactNode);
137
- } & react.RefAttributes<HTMLDivElement>>;
138
- readonly Suggestions: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
139
- children?: ThreadSuggestionChildren;
140
- keepMounted?: boolean;
141
- } & react.RefAttributes<HTMLDivElement>>;
142
- readonly Suggestion: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"button">, "children"> & {
143
- children?: ReactNode;
144
- prompt?: string;
145
- suggestion?: ChatSuggestion;
146
- } & react.RefAttributes<HTMLButtonElement>>;
147
- readonly ScrollToBottom: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "asChild"> & {
148
- asChild?: boolean;
149
- } & react.RefAttributes<HTMLButtonElement>>;
150
- };
151
-
152
- export { ChatController, ComposerEntity, type ComposerInputEntity, ComposerPrimitive, ComposerQuote, type ComposerSubmitMessage, type ComposerSubmitMessageArgs, ComposerTriggerDefinition, ComposerTriggerItem, ComposerTriggerState, ThreadPrimitive };
1
+ import { A as ComposerEntitiesUpdate, B as ComposerTriggerStateUpdate, D as ComposerAttachmentInput, F as ComposerTriggerDefinition, I as ComposerTriggerItem, L as ComposerTriggerItems, M as ComposerEntityData, N as ComposerMessageMetadata, O as ComposerAttachmentsUpdate, P as ComposerQuote, R as ComposerTriggerItemsArgs, V as useComposer, at as useChatContext, c as ThreadContextValue, it as ChatProviderProps, j as ComposerEntity, k as ComposerContextValue, l as useThread, nt as ChatController, rt as ChatProvider, z as ComposerTriggerState } from "../index-Mw3ltwSG.js";
2
+ import { a as ComposerSubmitMessageArgs, i as ComposerSubmitMessage, n as ComposerInputEntity, r as ComposerPrimitive, t as ThreadPrimitive } from "../index-B1Qs2Cjv.js";
3
+ export { type ChatController, ChatProvider, type ChatProviderProps, type ComposerAttachmentInput, type ComposerAttachmentsUpdate, type ComposerContextValue, type ComposerEntitiesUpdate, type ComposerEntity, type ComposerEntityData, type ComposerInputEntity, type ComposerMessageMetadata, ComposerPrimitive, type ComposerQuote, type ComposerSubmitMessage, type ComposerSubmitMessageArgs, type ComposerTriggerDefinition, type ComposerTriggerItem, type ComposerTriggerItems, type ComposerTriggerItemsArgs, type ComposerTriggerState, type ComposerTriggerStateUpdate, type ThreadContextValue, ThreadPrimitive, useChatContext, useComposer, useThread };
@@ -1,25 +1,3 @@
1
- import {
2
- ComposerPrimitive,
3
- ThreadPrimitive
4
- } from "../chunk-T4IYUEPH.js";
5
- import "../chunk-W2AHKMRS.js";
6
- import "../chunk-6XOJFLX4.js";
7
- import "../chunk-F6AKBUO3.js";
8
- import "../chunk-22EZJUPM.js";
9
- import "../chunk-CKA4CE26.js";
10
- import "../chunk-T3ZFZ3NP.js";
11
- import {
12
- ChatProvider,
13
- useChatContext,
14
- useComposer,
15
- useThread
16
- } from "../chunk-E73S3SOF.js";
17
- export {
18
- ChatProvider,
19
- ComposerPrimitive,
20
- ThreadPrimitive,
21
- useChatContext,
22
- useComposer,
23
- useThread
24
- };
25
- //# sourceMappingURL=index.js.map
1
+ import { F as ChatProvider, I as useChatContext, T as useComposer, c as useThread } from "../contexts-B4ijG24z.js";
2
+ import { n as ComposerPrimitive, t as ThreadPrimitive } from "../chat-CAnvUEAv.js";
3
+ export { ChatProvider, ComposerPrimitive, ThreadPrimitive, useChatContext, useComposer, useThread };