@assistant-ui/react 0.7.7 → 0.7.8
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/primitives/threadList/ThreadListItems.d.ts +2 -2
- package/dist/primitives/threadList/ThreadListItems.d.ts.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.js.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.mjs.map +1 -1
- package/dist/primitives/threadList/ThreadListNew.d.ts.map +1 -1
- package/dist/primitives/threadList/ThreadListNew.js +23 -6
- package/dist/primitives/threadList/ThreadListNew.js.map +1 -1
- package/dist/primitives/threadList/ThreadListNew.mjs +24 -9
- package/dist/primitives/threadList/ThreadListNew.mjs.map +1 -1
- package/dist/styles/index.css +66 -0
- package/dist/styles/index.css.map +1 -1
- package/dist/styles/tailwindcss/thread.css +30 -0
- package/dist/styles/tailwindcss/thread.css.json +21 -0
- package/dist/ui/assistant-action-bar.d.ts +7 -7
- package/dist/ui/assistant-action-bar.d.ts.map +1 -1
- package/dist/ui/assistant-action-bar.js.map +1 -1
- package/dist/ui/assistant-action-bar.mjs +1 -3
- package/dist/ui/assistant-action-bar.mjs.map +1 -1
- package/dist/ui/assistant-modal.d.ts +3 -3
- package/dist/ui/assistant-modal.d.ts.map +1 -1
- package/dist/ui/assistant-modal.js.map +1 -1
- package/dist/ui/assistant-modal.mjs +1 -3
- package/dist/ui/assistant-modal.mjs.map +1 -1
- package/dist/ui/attachment-ui.d.ts +2 -2
- package/dist/ui/attachment-ui.d.ts.map +1 -1
- package/dist/ui/attachment-ui.js.map +1 -1
- package/dist/ui/attachment-ui.mjs +1 -3
- package/dist/ui/attachment-ui.mjs.map +1 -1
- package/dist/ui/base/index.d.ts +1 -1
- package/dist/ui/base/index.d.ts.map +1 -1
- package/dist/ui/base/index.js.map +1 -1
- package/dist/ui/base/index.mjs +1 -3
- package/dist/ui/base/index.mjs.map +1 -1
- package/dist/ui/base/tooltip-icon-button.d.ts +6 -4
- package/dist/ui/base/tooltip-icon-button.d.ts.map +1 -1
- package/dist/ui/base/tooltip-icon-button.js.map +1 -1
- package/dist/ui/base/tooltip-icon-button.mjs.map +1 -1
- package/dist/ui/branch-picker.d.ts +3 -3
- package/dist/ui/branch-picker.d.ts.map +1 -1
- package/dist/ui/branch-picker.js.map +1 -1
- package/dist/ui/branch-picker.mjs +1 -3
- package/dist/ui/branch-picker.mjs.map +1 -1
- package/dist/ui/composer.d.ts +4 -4
- package/dist/ui/composer.d.ts.map +1 -1
- package/dist/ui/composer.js.map +1 -1
- package/dist/ui/composer.mjs +1 -3
- package/dist/ui/composer.mjs.map +1 -1
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +6 -0
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/index.mjs +4 -0
- package/dist/ui/index.mjs.map +1 -1
- package/dist/ui/thread-config.d.ts +13 -0
- package/dist/ui/thread-config.d.ts.map +1 -1
- package/dist/ui/thread-config.js.map +1 -1
- package/dist/ui/thread-config.mjs.map +1 -1
- package/dist/ui/thread-list-item.d.ts +24 -0
- package/dist/ui/thread-list-item.d.ts.map +1 -0
- package/dist/ui/thread-list-item.js +107 -0
- package/dist/ui/thread-list-item.js.map +1 -0
- package/dist/ui/thread-list-item.mjs +77 -0
- package/dist/ui/thread-list-item.mjs.map +1 -0
- package/dist/ui/thread-list.d.ts +20 -0
- package/dist/ui/thread-list.d.ts.map +1 -0
- package/dist/ui/thread-list.js +92 -0
- package/dist/ui/thread-list.js.map +1 -0
- package/dist/ui/thread-list.mjs +62 -0
- package/dist/ui/thread-list.mjs.map +1 -0
- package/dist/ui/thread.d.ts +2 -2
- package/dist/ui/thread.d.ts.map +1 -1
- package/dist/ui/thread.js.map +1 -1
- package/dist/ui/thread.mjs +1 -3
- package/dist/ui/thread.mjs.map +1 -1
- package/dist/ui/user-action-bar.d.ts +2 -2
- package/dist/ui/user-action-bar.d.ts.map +1 -1
- package/dist/ui/user-action-bar.js.map +1 -1
- package/dist/ui/user-action-bar.mjs +1 -3
- package/dist/ui/user-action-bar.mjs.map +1 -1
- package/package.json +5 -5
- package/src/primitives/threadList/ThreadListItems.tsx +3 -3
- package/src/primitives/threadList/ThreadListNew.tsx +45 -0
- package/src/styles/tailwindcss/thread.css +30 -0
- package/src/ui/assistant-action-bar.tsx +7 -10
- package/src/ui/assistant-modal.tsx +3 -6
- package/src/ui/attachment-ui.tsx +2 -5
- package/src/ui/base/index.ts +1 -4
- package/src/ui/base/tooltip-icon-button.tsx +7 -5
- package/src/ui/branch-picker.tsx +3 -6
- package/src/ui/composer.tsx +4 -7
- package/src/ui/index.ts +4 -0
- package/src/ui/thread-config.tsx +13 -0
- package/src/ui/thread-list-item.tsx +99 -0
- package/src/ui/thread-list.tsx +72 -0
- package/src/ui/thread.tsx +2 -5
- package/src/ui/user-action-bar.tsx +2 -5
- package/src/primitives/threadList/ThreadListNew.ts +0 -25
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/ui/branch-picker.tsx"],"sourcesContent":["\"use client\";\n\nimport { ComponentPropsWithoutRef, forwardRef, type FC } from \"react\";\nimport { ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\";\n\nimport {
|
1
|
+
{"version":3,"sources":["../../src/ui/branch-picker.tsx"],"sourcesContent":["\"use client\";\n\nimport { ComponentPropsWithoutRef, forwardRef, type FC } from \"react\";\nimport { ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\";\n\nimport { TooltipIconButton } from \"./base/tooltip-icon-button\";\nimport { withDefaults } from \"./utils/withDefaults\";\nimport { useThreadConfig } from \"./thread-config\";\nimport { BranchPickerPrimitive } from \"../primitives\";\nimport { useThread } from \"../context\";\n\nconst useAllowBranchPicker = (ensureCapability = false) => {\n const { branchPicker: { allowBranchPicker = true } = {} } = useThreadConfig();\n const branchPickerSupported = useThread((t) => t.capabilities.edit);\n return allowBranchPicker && (!ensureCapability || branchPickerSupported);\n};\n\nconst BranchPicker: FC = () => {\n const allowBranchPicker = useAllowBranchPicker(true);\n if (!allowBranchPicker) return null;\n return (\n <BranchPickerRoot hideWhenSingleBranch>\n <BranchPickerPrevious />\n <BranchPickerState />\n <BranchPickerNext />\n </BranchPickerRoot>\n );\n};\n\nBranchPicker.displayName = \"BranchPicker\";\n\nconst BranchPickerRoot = withDefaults(BranchPickerPrimitive.Root, {\n className: \"aui-branch-picker-root\",\n});\n\nBranchPickerRoot.displayName = \"BranchPickerRoot\";\n\nnamespace BranchPickerPrevious {\n export type Element = BranchPickerPrimitive.Previous.Element;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst BranchPickerPrevious = forwardRef<\n BranchPickerPrevious.Element,\n BranchPickerPrevious.Props\n>((props, ref) => {\n const {\n strings: {\n branchPicker: { previous: { tooltip = \"Previous\" } = {} } = {},\n } = {},\n } = useThreadConfig();\n const allowBranchPicker = useAllowBranchPicker();\n return (\n <BranchPickerPrimitive.Previous disabled={!allowBranchPicker} asChild>\n <TooltipIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <ChevronLeftIcon />}\n </TooltipIconButton>\n </BranchPickerPrimitive.Previous>\n );\n});\n\nBranchPickerPrevious.displayName = \"BranchPickerPrevious\";\n\nconst BranchPickerStateWrapper = withDefaults(\"span\", {\n className: \"aui-branch-picker-state\",\n});\n\nnamespace BranchPickerState {\n export type Element = HTMLSpanElement;\n export type Props = ComponentPropsWithoutRef<\"span\">;\n}\n\nconst BranchPickerState = forwardRef<\n BranchPickerState.Element,\n BranchPickerState.Props\n>((props, ref) => {\n return (\n <BranchPickerStateWrapper {...props} ref={ref}>\n <BranchPickerPrimitive.Number /> / <BranchPickerPrimitive.Count />\n </BranchPickerStateWrapper>\n );\n});\n\nBranchPickerState.displayName = \"BranchPickerState\";\n\nnamespace BranchPickerNext {\n export type Element = BranchPickerPrimitive.Next.Element;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst BranchPickerNext = forwardRef<\n BranchPickerNext.Element,\n BranchPickerNext.Props\n>((props, ref) => {\n const {\n strings: { branchPicker: { next: { tooltip = \"Next\" } = {} } = {} } = {},\n } = useThreadConfig();\n const allowBranchPicker = useAllowBranchPicker();\n return (\n <BranchPickerPrimitive.Next disabled={!allowBranchPicker} asChild>\n <TooltipIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <ChevronRightIcon />}\n </TooltipIconButton>\n </BranchPickerPrimitive.Next>\n );\n});\n\nBranchPickerNext.displayName = \"BranchPickerNext\";\n\nconst exports = {\n Root: BranchPickerRoot,\n Previous: BranchPickerPrevious,\n Next: BranchPickerNext,\n};\n\nexport default Object.assign(BranchPicker, exports) as typeof BranchPicker &\n typeof exports;\n"],"mappings":";;;AAEA,SAAmC,kBAA2B;AAC9D,SAAS,iBAAiB,wBAAwB;AAElD,SAAS,yBAAyB;AAClC,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,iBAAiB;AAYtB,SACE,KADF;AAVJ,IAAM,uBAAuB,CAAC,mBAAmB,UAAU;AACzD,QAAM,EAAE,cAAc,EAAE,oBAAoB,KAAK,IAAI,CAAC,EAAE,IAAI,gBAAgB;AAC5E,QAAM,wBAAwB,UAAU,CAAC,MAAM,EAAE,aAAa,IAAI;AAClE,SAAO,sBAAsB,CAAC,oBAAoB;AACpD;AAEA,IAAM,eAAmB,MAAM;AAC7B,QAAM,oBAAoB,qBAAqB,IAAI;AACnD,MAAI,CAAC,kBAAmB,QAAO;AAC/B,SACE,qBAAC,oBAAiB,sBAAoB,MACpC;AAAA,wBAAC,wBAAqB;AAAA,IACtB,oBAAC,qBAAkB;AAAA,IACnB,oBAAC,oBAAiB;AAAA,KACpB;AAEJ;AAEA,aAAa,cAAc;AAE3B,IAAM,mBAAmB,aAAa,sBAAsB,MAAM;AAAA,EAChE,WAAW;AACb,CAAC;AAED,iBAAiB,cAAc;AAO/B,IAAM,uBAAuB,WAG3B,CAAC,OAAO,QAAQ;AAChB,QAAM;AAAA,IACJ,SAAS;AAAA,MACP,cAAc,EAAE,UAAU,EAAE,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
|
+
import { TooltipIconButton } from "./base/tooltip-icon-button";
|
3
3
|
import { ComposerPrimitive } from "../primitives";
|
4
4
|
declare const Composer: FC;
|
5
5
|
declare const exports: {
|
@@ -17,9 +17,9 @@ declare const exports: {
|
|
17
17
|
unstable_focusOnThreadSwitched?: boolean | undefined;
|
18
18
|
} & import("react").RefAttributes<HTMLTextAreaElement>, "ref">> & import("react").RefAttributes<HTMLTextAreaElement>, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>>;
|
19
19
|
Action: FC;
|
20
|
-
Send: import("react").ForwardRefExoticComponent<Partial<
|
21
|
-
Cancel: import("react").ForwardRefExoticComponent<Partial<
|
22
|
-
AddAttachment: import("react").ForwardRefExoticComponent<Partial<
|
20
|
+
Send: import("react").ForwardRefExoticComponent<Partial<TooltipIconButton.Props> & import("react").RefAttributes<HTMLButtonElement>>;
|
21
|
+
Cancel: import("react").ForwardRefExoticComponent<Partial<TooltipIconButton.Props> & import("react").RefAttributes<HTMLButtonElement>>;
|
22
|
+
AddAttachment: import("react").ForwardRefExoticComponent<Partial<TooltipIconButton.Props> & import("react").RefAttributes<HTMLButtonElement>>;
|
23
23
|
Attachments: FC<Partial<ComposerPrimitive.Attachments.Props>>;
|
24
24
|
};
|
25
25
|
declare const _default: typeof Composer & typeof exports;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"composer.d.ts","sourceRoot":"","sources":["../../src/ui/composer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAwC,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAKtE,OAAO,
|
1
|
+
{"version":3,"file":"composer.d.ts","sourceRoot":"","sources":["../../src/ui/composer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAwC,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAKtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAE,iBAAiB,EAAmB,MAAM,eAAe,CAAC;AAUnE,QAAA,MAAM,QAAQ,EAAE,EAUf,CAAC;AAyKF,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;CAQZ,CAAC;wBAEiD,OAAO,QAAQ,GAChE,OAAO,OAAO;AADhB,wBACiB"}
|
package/dist/ui/composer.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/ui/composer.tsx"],"sourcesContent":["\"use client\";\n\nimport { ComponentPropsWithoutRef, forwardRef, type FC } from \"react\";\n\nimport { PaperclipIcon, SendHorizontalIcon } from \"lucide-react\";\nimport { withDefaults } from \"./utils/withDefaults\";\nimport { useThreadConfig } from \"./thread-config\";\nimport {
|
1
|
+
{"version":3,"sources":["../../src/ui/composer.tsx"],"sourcesContent":["\"use client\";\n\nimport { ComponentPropsWithoutRef, forwardRef, type FC } from \"react\";\n\nimport { PaperclipIcon, SendHorizontalIcon } from \"lucide-react\";\nimport { withDefaults } from \"./utils/withDefaults\";\nimport { useThreadConfig } from \"./thread-config\";\nimport { TooltipIconButton } from \"./base/tooltip-icon-button\";\nimport { CircleStopIcon } from \"./base/CircleStopIcon\";\nimport { ComposerPrimitive, ThreadPrimitive } from \"../primitives\";\nimport { useThread } from \"../context/react/ThreadContext\";\nimport Attachment from \"./attachment-ui\";\n\nconst useAllowAttachments = (ensureCapability = false) => {\n const { composer: { allowAttachments = true } = {} } = useThreadConfig();\n const attachmentsSupported = useThread((t) => t.capabilities.attachments);\n return allowAttachments && (!ensureCapability || attachmentsSupported);\n};\n\nconst Composer: FC = () => {\n const allowAttachments = useAllowAttachments(true);\n return (\n <ComposerRoot>\n {allowAttachments && <ComposerAttachments />}\n {allowAttachments && <ComposerAddAttachment />}\n <ComposerInput autoFocus />\n <ComposerAction />\n </ComposerRoot>\n );\n};\n\nComposer.displayName = \"Composer\";\n\nconst ComposerRoot = withDefaults(ComposerPrimitive.Root, {\n className: \"aui-composer-root\",\n});\n\nComposerRoot.displayName = \"ComposerRoot\";\n\nconst ComposerInputStyled = withDefaults(ComposerPrimitive.Input, {\n rows: 1,\n autoFocus: true,\n className: \"aui-composer-input\",\n});\n\nnamespace ComposerInput {\n export type Element = HTMLTextAreaElement;\n export type Props = ComponentPropsWithoutRef<typeof ComposerInputStyled>;\n}\n\nconst ComposerInput = forwardRef<ComposerInput.Element, ComposerInput.Props>(\n (props, ref) => {\n const {\n strings: {\n composer: { input: { placeholder = \"Write a message...\" } = {} } = {},\n } = {},\n } = useThreadConfig();\n return (\n <ComposerInputStyled placeholder={placeholder} {...props} ref={ref} />\n );\n },\n);\n\nComposerInput.displayName = \"ComposerInput\";\n\nconst ComposerAttachmentsContainer = withDefaults(\"div\", {\n className: \"aui-composer-attachments\",\n});\n\nnamespace ComposerAttachments {\n export type Props = Partial<ComposerPrimitive.Attachments.Props>;\n}\n\nconst ComposerAttachments: FC<ComposerAttachments.Props> = ({ components }) => {\n return (\n <ComposerAttachmentsContainer>\n <ComposerPrimitive.Attachments\n components={{\n ...components,\n Attachment: components?.Attachment ?? Attachment,\n }}\n />\n </ComposerAttachmentsContainer>\n );\n};\n\nconst ComposerAttachButton = withDefaults(TooltipIconButton, {\n variant: \"default\",\n className: \"aui-composer-attach\",\n});\n\nnamespace ComposerAddAttachment {\n export type Element = HTMLButtonElement;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst ComposerAddAttachment = forwardRef<\n ComposerAddAttachment.Element,\n ComposerAddAttachment.Props\n>((props, ref) => {\n const {\n strings: {\n composer: { addAttachment: { tooltip = \"Attach file\" } = {} } = {},\n } = {},\n } = useThreadConfig();\n const allowAttachments = useAllowAttachments();\n return (\n <ComposerPrimitive.AddAttachment disabled={!allowAttachments} asChild>\n <ComposerAttachButton\n tooltip={tooltip}\n variant={\"ghost\"}\n {...props}\n ref={ref}\n >\n {props.children ?? <PaperclipIcon />}\n </ComposerAttachButton>\n </ComposerPrimitive.AddAttachment>\n );\n});\n\nComposerAddAttachment.displayName = \"ComposerAddAttachment\";\n\nconst useAllowCancel = () => {\n const cancelSupported = useThread((t) => t.capabilities.cancel);\n return cancelSupported;\n};\n\nconst ComposerAction: FC = () => {\n const allowCancel = useAllowCancel();\n if (!allowCancel) return <ComposerSend />;\n return (\n <>\n <ThreadPrimitive.If running={false}>\n <ComposerSend />\n </ThreadPrimitive.If>\n <ThreadPrimitive.If running>\n <ComposerCancel />\n </ThreadPrimitive.If>\n </>\n );\n};\n\nComposerAction.displayName = \"ComposerAction\";\n\nconst ComposerSendButton = withDefaults(TooltipIconButton, {\n variant: \"default\",\n className: \"aui-composer-send\",\n});\n\nnamespace ComposerSend {\n export type Element = HTMLButtonElement;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst ComposerSend = forwardRef<ComposerSend.Element, ComposerSend.Props>(\n (props, ref) => {\n const {\n strings: { composer: { send: { tooltip = \"Send\" } = {} } = {} } = {},\n } = useThreadConfig();\n return (\n <ComposerPrimitive.Send asChild>\n <ComposerSendButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <SendHorizontalIcon />}\n </ComposerSendButton>\n </ComposerPrimitive.Send>\n );\n },\n);\n\nComposerSend.displayName = \"ComposerSend\";\n\nconst ComposerCancelButton = withDefaults(TooltipIconButton, {\n variant: \"default\",\n className: \"aui-composer-cancel\",\n});\n\nnamespace ComposerCancel {\n export type Element = HTMLButtonElement;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst ComposerCancel = forwardRef<ComposerCancel.Element, ComposerCancel.Props>(\n (props, ref) => {\n const {\n strings: { composer: { cancel: { tooltip = \"Cancel\" } = {} } = {} } = {},\n } = useThreadConfig();\n return (\n <ComposerPrimitive.Cancel asChild>\n <ComposerCancelButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <CircleStopIcon />}\n </ComposerCancelButton>\n </ComposerPrimitive.Cancel>\n );\n },\n);\n\nComposerCancel.displayName = \"ComposerCancel\";\n\nconst exports = {\n Root: ComposerRoot,\n Input: ComposerInput,\n Action: ComposerAction,\n Send: ComposerSend,\n Cancel: ComposerCancel,\n AddAttachment: ComposerAddAttachment,\n Attachments: ComposerAttachments,\n};\n\nexport default Object.assign(Composer, exports) as typeof Composer &\n typeof exports;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA8D;AAE9D,0BAAkD;AAClD,0BAA6B;AAC7B,2BAAgC;AAChC,iCAAkC;AAClC,4BAA+B;AAC/B,wBAAmD;AACnD,2BAA0B;AAC1B,2BAAuB;AAWnB;AATJ,IAAM,sBAAsB,CAAC,mBAAmB,UAAU;AACxD,QAAM,EAAE,UAAU,EAAE,mBAAmB,KAAK,IAAI,CAAC,EAAE,QAAI,sCAAgB;AACvE,QAAM,2BAAuB,gCAAU,CAAC,MAAM,EAAE,aAAa,WAAW;AACxE,SAAO,qBAAqB,CAAC,oBAAoB;AACnD;AAEA,IAAM,WAAe,MAAM;AACzB,QAAM,mBAAmB,oBAAoB,IAAI;AACjD,SACE,6CAAC,gBACE;AAAA,wBAAoB,4CAAC,uBAAoB;AAAA,IACzC,oBAAoB,4CAAC,yBAAsB;AAAA,IAC5C,4CAAC,iBAAc,WAAS,MAAC;AAAA,IACzB,4CAAC,kBAAe;AAAA,KAClB;AAEJ;AAEA,SAAS,cAAc;AAEvB,IAAM,mBAAe,kCAAa,oCAAkB,MAAM;AAAA,EACxD,WAAW;AACb,CAAC;AAED,aAAa,cAAc;AAE3B,IAAM,0BAAsB,kCAAa,oCAAkB,OAAO;AAAA,EAChE,MAAM;AAAA,EACN,WAAW;AAAA,EACX,WAAW;AACb,CAAC;AAOD,IAAM,oBAAgB;AAAA,EACpB,CAAC,OAAO,QAAQ;AACd,UAAM;AAAA,MACJ,SAAS;AAAA,QACP,UAAU,EAAE,OAAO,EAAE,cAAc,qBAAqB,IAAI,CAAC,EAAE,IAAI,CAAC;AAAA,MACtE,IAAI,CAAC;AAAA,IACP,QAAI,sCAAgB;AACpB,WACE,4CAAC,uBAAoB,aAA2B,GAAG,OAAO,KAAU;AAAA,EAExE;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orizontalIcon } from "lucide-react";
|
6
6
|
import { withDefaults } from "./utils/withDefaults.mjs";
|
7
7
|
import { useThreadConfig } from "./thread-config.mjs";
|
8
|
-
import {
|
9
|
-
TooltipIconButton
|
10
|
-
} from "./base/tooltip-icon-button.mjs";
|
8
|
+
import { TooltipIconButton } from "./base/tooltip-icon-button.mjs";
|
11
9
|
import { CircleStopIcon } from "./base/CircleStopIcon.mjs";
|
12
10
|
import { ComposerPrimitive, ThreadPrimitive } from "../primitives/index.mjs";
|
13
11
|
import { useThread } from "../context/react/ThreadContext.mjs";
|
package/dist/ui/composer.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/ui/composer.tsx"],"sourcesContent":["\"use client\";\n\nimport { ComponentPropsWithoutRef, forwardRef, type FC } from \"react\";\n\nimport { PaperclipIcon, SendHorizontalIcon } from \"lucide-react\";\nimport { withDefaults } from \"./utils/withDefaults\";\nimport { useThreadConfig } from \"./thread-config\";\nimport {
|
1
|
+
{"version":3,"sources":["../../src/ui/composer.tsx"],"sourcesContent":["\"use client\";\n\nimport { ComponentPropsWithoutRef, forwardRef, type FC } from \"react\";\n\nimport { PaperclipIcon, SendHorizontalIcon } from \"lucide-react\";\nimport { withDefaults } from \"./utils/withDefaults\";\nimport { useThreadConfig } from \"./thread-config\";\nimport { TooltipIconButton } from \"./base/tooltip-icon-button\";\nimport { CircleStopIcon } from \"./base/CircleStopIcon\";\nimport { ComposerPrimitive, ThreadPrimitive } from \"../primitives\";\nimport { useThread } from \"../context/react/ThreadContext\";\nimport Attachment from \"./attachment-ui\";\n\nconst useAllowAttachments = (ensureCapability = false) => {\n const { composer: { allowAttachments = true } = {} } = useThreadConfig();\n const attachmentsSupported = useThread((t) => t.capabilities.attachments);\n return allowAttachments && (!ensureCapability || attachmentsSupported);\n};\n\nconst Composer: FC = () => {\n const allowAttachments = useAllowAttachments(true);\n return (\n <ComposerRoot>\n {allowAttachments && <ComposerAttachments />}\n {allowAttachments && <ComposerAddAttachment />}\n <ComposerInput autoFocus />\n <ComposerAction />\n </ComposerRoot>\n );\n};\n\nComposer.displayName = \"Composer\";\n\nconst ComposerRoot = withDefaults(ComposerPrimitive.Root, {\n className: \"aui-composer-root\",\n});\n\nComposerRoot.displayName = \"ComposerRoot\";\n\nconst ComposerInputStyled = withDefaults(ComposerPrimitive.Input, {\n rows: 1,\n autoFocus: true,\n className: \"aui-composer-input\",\n});\n\nnamespace ComposerInput {\n export type Element = HTMLTextAreaElement;\n export type Props = ComponentPropsWithoutRef<typeof ComposerInputStyled>;\n}\n\nconst ComposerInput = forwardRef<ComposerInput.Element, ComposerInput.Props>(\n (props, ref) => {\n const {\n strings: {\n composer: { input: { placeholder = \"Write a message...\" } = {} } = {},\n } = {},\n } = useThreadConfig();\n return (\n <ComposerInputStyled placeholder={placeholder} {...props} ref={ref} />\n );\n },\n);\n\nComposerInput.displayName = \"ComposerInput\";\n\nconst ComposerAttachmentsContainer = withDefaults(\"div\", {\n className: \"aui-composer-attachments\",\n});\n\nnamespace ComposerAttachments {\n export type Props = Partial<ComposerPrimitive.Attachments.Props>;\n}\n\nconst ComposerAttachments: FC<ComposerAttachments.Props> = ({ components }) => {\n return (\n <ComposerAttachmentsContainer>\n <ComposerPrimitive.Attachments\n components={{\n ...components,\n Attachment: components?.Attachment ?? Attachment,\n }}\n />\n </ComposerAttachmentsContainer>\n );\n};\n\nconst ComposerAttachButton = withDefaults(TooltipIconButton, {\n variant: \"default\",\n className: \"aui-composer-attach\",\n});\n\nnamespace ComposerAddAttachment {\n export type Element = HTMLButtonElement;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst ComposerAddAttachment = forwardRef<\n ComposerAddAttachment.Element,\n ComposerAddAttachment.Props\n>((props, ref) => {\n const {\n strings: {\n composer: { addAttachment: { tooltip = \"Attach file\" } = {} } = {},\n } = {},\n } = useThreadConfig();\n const allowAttachments = useAllowAttachments();\n return (\n <ComposerPrimitive.AddAttachment disabled={!allowAttachments} asChild>\n <ComposerAttachButton\n tooltip={tooltip}\n variant={\"ghost\"}\n {...props}\n ref={ref}\n >\n {props.children ?? <PaperclipIcon />}\n </ComposerAttachButton>\n </ComposerPrimitive.AddAttachment>\n );\n});\n\nComposerAddAttachment.displayName = \"ComposerAddAttachment\";\n\nconst useAllowCancel = () => {\n const cancelSupported = useThread((t) => t.capabilities.cancel);\n return cancelSupported;\n};\n\nconst ComposerAction: FC = () => {\n const allowCancel = useAllowCancel();\n if (!allowCancel) return <ComposerSend />;\n return (\n <>\n <ThreadPrimitive.If running={false}>\n <ComposerSend />\n </ThreadPrimitive.If>\n <ThreadPrimitive.If running>\n <ComposerCancel />\n </ThreadPrimitive.If>\n </>\n );\n};\n\nComposerAction.displayName = \"ComposerAction\";\n\nconst ComposerSendButton = withDefaults(TooltipIconButton, {\n variant: \"default\",\n className: \"aui-composer-send\",\n});\n\nnamespace ComposerSend {\n export type Element = HTMLButtonElement;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst ComposerSend = forwardRef<ComposerSend.Element, ComposerSend.Props>(\n (props, ref) => {\n const {\n strings: { composer: { send: { tooltip = \"Send\" } = {} } = {} } = {},\n } = useThreadConfig();\n return (\n <ComposerPrimitive.Send asChild>\n <ComposerSendButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <SendHorizontalIcon />}\n </ComposerSendButton>\n </ComposerPrimitive.Send>\n );\n },\n);\n\nComposerSend.displayName = \"ComposerSend\";\n\nconst ComposerCancelButton = withDefaults(TooltipIconButton, {\n variant: \"default\",\n className: \"aui-composer-cancel\",\n});\n\nnamespace ComposerCancel {\n export type Element = HTMLButtonElement;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst ComposerCancel = forwardRef<ComposerCancel.Element, ComposerCancel.Props>(\n (props, ref) => {\n const {\n strings: { composer: { cancel: { tooltip = \"Cancel\" } = {} } = {} } = {},\n } = useThreadConfig();\n return (\n <ComposerPrimitive.Cancel asChild>\n <ComposerCancelButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <CircleStopIcon />}\n </ComposerCancelButton>\n </ComposerPrimitive.Cancel>\n );\n },\n);\n\nComposerCancel.displayName = \"ComposerCancel\";\n\nconst exports = {\n Root: ComposerRoot,\n Input: ComposerInput,\n Action: ComposerAction,\n Send: ComposerSend,\n Cancel: ComposerCancel,\n AddAttachment: ComposerAddAttachment,\n Attachments: ComposerAttachments,\n};\n\nexport default Object.assign(Composer, exports) as typeof Composer &\n typeof exports;\n"],"mappings":";;;AAEA,SAAmC,kBAA2B;AAE9D,SAAS,eAAe,0BAA0B;AAClD,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC,SAAS,yBAAyB;AAClC,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB,uBAAuB;AACnD,SAAS,iBAAiB;AAC1B,OAAO,gBAAgB;AAWnB,SA6GA,UA5GuB,KADvB;AATJ,IAAM,sBAAsB,CAAC,mBAAmB,UAAU;AACxD,QAAM,EAAE,UAAU,EAAE,mBAAmB,KAAK,IAAI,CAAC,EAAE,IAAI,gBAAgB;AACvE,QAAM,uBAAuB,UAAU,CAAC,MAAM,EAAE,aAAa,WAAW;AACxE,SAAO,qBAAqB,CAAC,oBAAoB;AACnD;AAEA,IAAM,WAAe,MAAM;AACzB,QAAM,mBAAmB,oBAAoB,IAAI;AACjD,SACE,qBAAC,gBACE;AAAA,wBAAoB,oBAAC,uBAAoB;AAAA,IACzC,oBAAoB,oBAAC,yBAAsB;AAAA,IAC5C,oBAAC,iBAAc,WAAS,MAAC;AAAA,IACzB,oBAAC,kBAAe;AAAA,KAClB;AAEJ;AAEA,SAAS,cAAc;AAEvB,IAAM,eAAe,aAAa,kBAAkB,MAAM;AAAA,EACxD,WAAW;AACb,CAAC;AAED,aAAa,cAAc;AAE3B,IAAM,sBAAsB,aAAa,kBAAkB,OAAO;AAAA,EAChE,MAAM;AAAA,EACN,WAAW;AAAA,EACX,WAAW;AACb,CAAC;AAOD,IAAM,gBAAgB;AAAA,EACpB,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EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,aAAa;AACf;AAEA,IAAO,mBAAQ,OAAO,OAAO,UAAU,OAAO;","names":[]}
|
package/dist/ui/index.d.ts
CHANGED
@@ -11,4 +11,6 @@ export { default as UserMessage } from "./user-message";
|
|
11
11
|
export { default as UserActionBar } from "./user-action-bar";
|
12
12
|
export { default as ThreadWelcome } from "./thread-welcome";
|
13
13
|
export { default as ContentPart } from "./content-part";
|
14
|
+
export { default as ThreadList } from "./thread-list";
|
15
|
+
export { default as ThreadListItem } from "./thread-list-item";
|
14
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/ui/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,yBAAyB,GAC/B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEvE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EACL,OAAO,IAAI,YAAY,GACxB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAA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AC;AAE5D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/ui/index.js
CHANGED
@@ -40,6 +40,8 @@ __export(ui_exports, {
|
|
40
40
|
EditComposer: () => import_edit_composer.default,
|
41
41
|
Thread: () => import_thread.default,
|
42
42
|
ThreadConfigProvider: () => import_thread_config.ThreadConfigProvider,
|
43
|
+
ThreadList: () => import_thread_list.default,
|
44
|
+
ThreadListItem: () => import_thread_list_item.default,
|
43
45
|
ThreadWelcome: () => import_thread_welcome.default,
|
44
46
|
UserActionBar: () => import_user_action_bar.default,
|
45
47
|
UserMessage: () => import_user_message.default,
|
@@ -59,6 +61,8 @@ var import_user_message = __toESM(require("./user-message.cjs"));
|
|
59
61
|
var import_user_action_bar = __toESM(require("./user-action-bar.cjs"));
|
60
62
|
var import_thread_welcome = __toESM(require("./thread-welcome.cjs"));
|
61
63
|
var import_content_part = __toESM(require("./content-part.cjs"));
|
64
|
+
var import_thread_list = __toESM(require("./thread-list.cjs"));
|
65
|
+
var import_thread_list_item = __toESM(require("./thread-list-item.cjs"));
|
62
66
|
// Annotate the CommonJS export names for ESM import in node:
|
63
67
|
0 && (module.exports = {
|
64
68
|
AssistantActionBar,
|
@@ -71,6 +75,8 @@ var import_content_part = __toESM(require("./content-part.cjs"));
|
|
71
75
|
EditComposer,
|
72
76
|
Thread,
|
73
77
|
ThreadConfigProvider,
|
78
|
+
ThreadList,
|
79
|
+
ThreadListItem,
|
74
80
|
ThreadWelcome,
|
75
81
|
UserActionBar,
|
76
82
|
UserMessage,
|
package/dist/ui/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/ui/index.ts"],"sourcesContent":["export {\n ThreadConfigProvider,\n useThreadConfig,\n type ThreadConfig,\n type ThreadWelcomeConfig,\n type UserMessageConfig,\n type AssistantMessageConfig,\n type StringsConfig,\n type SuggestionConfig,\n type ThreadConfigProviderProps,\n} from \"./thread-config\";\n\nexport { default as AssistantActionBar } from \"./assistant-action-bar\";\n\nexport { default as AssistantMessage } from \"./assistant-message\";\n\nexport { default as AssistantModal } from \"./assistant-modal\";\n\nexport { default as BranchPicker } from \"./branch-picker\";\n\nexport { default as Composer } from \"./composer\";\n\nexport {\n default as AttachmentUI, // TODO name collision with Attachment\n} from \"./attachment-ui\";\n\nexport { default as EditComposer } from \"./edit-composer\";\n\nexport { default as Thread } from \"./thread\";\n\nexport { default as UserMessage } from \"./user-message\";\n\nexport { default as UserActionBar } from \"./user-action-bar\";\n\nexport { default as ThreadWelcome } from \"./thread-welcome\";\n\nexport { default as ContentPart } from \"./content-part\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAUO;AAEP,kCAA8C;AAE9C,+BAA4C;AAE5C,6BAA0C;AAE1C,2BAAwC;AAExC,sBAAoC;AAEpC,2BAEO;AAEP,2BAAwC;AAExC,oBAAkC;AAElC,0BAAuC;AAEvC,6BAAyC;AAEzC,4BAAyC;AAEzC,0BAAuC;","names":[]}
|
1
|
+
{"version":3,"sources":["../../src/ui/index.ts"],"sourcesContent":["export {\n ThreadConfigProvider,\n useThreadConfig,\n type ThreadConfig,\n type ThreadWelcomeConfig,\n type UserMessageConfig,\n type AssistantMessageConfig,\n type StringsConfig,\n type SuggestionConfig,\n type ThreadConfigProviderProps,\n} from \"./thread-config\";\n\nexport { default as AssistantActionBar } from \"./assistant-action-bar\";\n\nexport { default as AssistantMessage } from \"./assistant-message\";\n\nexport { default as AssistantModal } from \"./assistant-modal\";\n\nexport { default as BranchPicker } from \"./branch-picker\";\n\nexport { default as Composer } from \"./composer\";\n\nexport {\n default as AttachmentUI, // TODO name collision with Attachment\n} from \"./attachment-ui\";\n\nexport { default as EditComposer } from \"./edit-composer\";\n\nexport { default as Thread } from \"./thread\";\n\nexport { default as UserMessage } from \"./user-message\";\n\nexport { default as UserActionBar } from \"./user-action-bar\";\n\nexport { default as ThreadWelcome } from \"./thread-welcome\";\n\nexport { default as ContentPart } from \"./content-part\";\n\nexport { default as ThreadList } from \"./thread-list\";\n\nexport { default as ThreadListItem } from \"./thread-list-item\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAUO;AAEP,kCAA8C;AAE9C,+BAA4C;AAE5C,6BAA0C;AAE1C,2BAAwC;AAExC,sBAAoC;AAEpC,2BAEO;AAEP,2BAAwC;AAExC,oBAAkC;AAElC,0BAAuC;AAEvC,6BAAyC;AAEzC,4BAAyC;AAEzC,0BAAuC;AAEvC,yBAAsC;AAEtC,8BAA0C;","names":[]}
|
package/dist/ui/index.mjs
CHANGED
@@ -17,6 +17,8 @@ import { default as default10 } from "./user-message.mjs";
|
|
17
17
|
import { default as default11 } from "./user-action-bar.mjs";
|
18
18
|
import { default as default12 } from "./thread-welcome.mjs";
|
19
19
|
import { default as default13 } from "./content-part.mjs";
|
20
|
+
import { default as default14 } from "./thread-list.mjs";
|
21
|
+
import { default as default15 } from "./thread-list-item.mjs";
|
20
22
|
export {
|
21
23
|
default2 as AssistantActionBar,
|
22
24
|
default3 as AssistantMessage,
|
@@ -28,6 +30,8 @@ export {
|
|
28
30
|
default8 as EditComposer,
|
29
31
|
default9 as Thread,
|
30
32
|
ThreadConfigProvider,
|
33
|
+
default14 as ThreadList,
|
34
|
+
default15 as ThreadListItem,
|
31
35
|
default12 as ThreadWelcome,
|
32
36
|
default11 as UserActionBar,
|
33
37
|
default10 as UserMessage,
|
package/dist/ui/index.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/ui/index.ts"],"sourcesContent":["export {\n ThreadConfigProvider,\n useThreadConfig,\n type ThreadConfig,\n type ThreadWelcomeConfig,\n type UserMessageConfig,\n type AssistantMessageConfig,\n type StringsConfig,\n type SuggestionConfig,\n type ThreadConfigProviderProps,\n} from \"./thread-config\";\n\nexport { default as AssistantActionBar } from \"./assistant-action-bar\";\n\nexport { default as AssistantMessage } from \"./assistant-message\";\n\nexport { default as AssistantModal } from \"./assistant-modal\";\n\nexport { default as BranchPicker } from \"./branch-picker\";\n\nexport { default as Composer } from \"./composer\";\n\nexport {\n default as AttachmentUI, // TODO name collision with Attachment\n} from \"./attachment-ui\";\n\nexport { default as EditComposer } from \"./edit-composer\";\n\nexport { default as Thread } from \"./thread\";\n\nexport { default as UserMessage } from \"./user-message\";\n\nexport { default as UserActionBar } from \"./user-action-bar\";\n\nexport { default as ThreadWelcome } from \"./thread-welcome\";\n\nexport { default as ContentPart } from \"./content-part\";\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,OAQK;AAEP,SAAoB,WAAXA,gBAAqC;AAE9C,SAAoB,WAAXA,gBAAmC;AAE5C,SAAoB,WAAXA,gBAAiC;AAE1C,SAAoB,WAAXA,gBAA+B;AAExC,SAAoB,WAAXA,gBAA2B;AAEpC;AAAA,EACa,WAAXA;AAAA,OACK;AAEP,SAAoB,WAAXA,gBAA+B;AAExC,SAAoB,WAAXA,gBAAyB;AAElC,SAAoB,WAAXA,iBAA8B;AAEvC,SAAoB,WAAXA,iBAAgC;AAEzC,SAAoB,WAAXA,iBAAgC;AAEzC,SAAoB,WAAXA,iBAA8B;","names":["default"]}
|
1
|
+
{"version":3,"sources":["../../src/ui/index.ts"],"sourcesContent":["export {\n ThreadConfigProvider,\n useThreadConfig,\n type ThreadConfig,\n type ThreadWelcomeConfig,\n type UserMessageConfig,\n type AssistantMessageConfig,\n type StringsConfig,\n type SuggestionConfig,\n type ThreadConfigProviderProps,\n} from \"./thread-config\";\n\nexport { default as AssistantActionBar } from \"./assistant-action-bar\";\n\nexport { default as AssistantMessage } from \"./assistant-message\";\n\nexport { default as AssistantModal } from \"./assistant-modal\";\n\nexport { default as BranchPicker } from \"./branch-picker\";\n\nexport { default as Composer } from \"./composer\";\n\nexport {\n default as AttachmentUI, // TODO name collision with Attachment\n} from \"./attachment-ui\";\n\nexport { default as EditComposer } from \"./edit-composer\";\n\nexport { default as Thread } from \"./thread\";\n\nexport { default as UserMessage } from \"./user-message\";\n\nexport { default as UserActionBar } from \"./user-action-bar\";\n\nexport { default as ThreadWelcome } from \"./thread-welcome\";\n\nexport { default as ContentPart } from \"./content-part\";\n\nexport { default as ThreadList } from \"./thread-list\";\n\nexport { default as ThreadListItem } from \"./thread-list-item\";\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,OAQK;AAEP,SAAoB,WAAXA,gBAAqC;AAE9C,SAAoB,WAAXA,gBAAmC;AAE5C,SAAoB,WAAXA,gBAAiC;AAE1C,SAAoB,WAAXA,gBAA+B;AAExC,SAAoB,WAAXA,gBAA2B;AAEpC;AAAA,EACa,WAAXA;AAAA,OACK;AAEP,SAAoB,WAAXA,gBAA+B;AAExC,SAAoB,WAAXA,gBAAyB;AAElC,SAAoB,WAAXA,iBAA8B;AAEvC,SAAoB,WAAXA,iBAAgC;AAEzC,SAAoB,WAAXA,iBAAgC;AAEzC,SAAoB,WAAXA,iBAA8B;AAEvC,SAAoB,WAAXA,iBAA6B;AAEtC,SAAoB,WAAXA,iBAAiC;","names":["default"]}
|
@@ -44,6 +44,19 @@ export type StringsConfig = {
|
|
44
44
|
};
|
45
45
|
};
|
46
46
|
};
|
47
|
+
threadList?: {
|
48
|
+
new?: {
|
49
|
+
label?: string | undefined;
|
50
|
+
};
|
51
|
+
item?: {
|
52
|
+
title?: {
|
53
|
+
fallback?: string | undefined;
|
54
|
+
};
|
55
|
+
archive?: {
|
56
|
+
label?: string | undefined;
|
57
|
+
};
|
58
|
+
};
|
59
|
+
};
|
47
60
|
thread?: {
|
48
61
|
scrollToBottom?: {
|
49
62
|
tooltip?: string | undefined;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"thread-config.d.ts","sourceRoot":"","sources":["../../src/ui/thread-config.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,aAAa,EACb,EAAE,EACF,iBAAiB,EACjB,SAAS,EAGV,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAE9E,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGlD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACpC,WAAW,CAAC,EAAE,gBAAgB,EAAE,GAAG,SAAS,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAClC,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC,qBAAqB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5C,qBAAqB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5C,UAAU,CAAC,EACP;QACE,IAA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@@
|
|
1
|
-
{"version":3,"sources":["../../src/ui/thread-config.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ComponentType,\n FC,\n PropsWithChildren,\n ReactNode,\n createContext,\n useContext,\n} from \"react\";\n\nimport { AssistantRuntime } from \"../api/AssistantRuntime\";\nimport { AvatarProps } from \"./base/avatar\";\nimport { TextContentPartComponent, ToolCallContentPartProps } from \"../types\";\nimport { AssistantRuntimeProvider } from \"../context\";\nimport { AssistantToolUI } from \"../model-config\";\nimport { useAssistantRuntime } from \"../context/react/AssistantContext\";\n\nexport type SuggestionConfig = {\n text?: ReactNode | undefined;\n prompt: string;\n};\n\nexport type ThreadWelcomeConfig = {\n message?: string | null | undefined;\n suggestions?: SuggestionConfig[] | undefined;\n};\n\nexport type UserMessageConfig = {\n allowEdit?: boolean | undefined;\n};\n\nexport type AssistantMessageConfig = {\n allowReload?: boolean | undefined;\n allowCopy?: boolean | undefined;\n allowSpeak?: boolean | undefined;\n allowFeedbackPositive?: boolean | undefined;\n allowFeedbackNegative?: boolean | undefined;\n components?:\n | {\n Text?: TextContentPartComponent | undefined;\n ToolFallback?: ComponentType<ToolCallContentPartProps> | undefined;\n }\n | undefined;\n};\n\nexport type BranchPickerConfig = {\n allowBranchPicker?: boolean | undefined;\n};\n\nexport type ComposerConfig = {\n allowAttachments?: boolean | undefined;\n};\n\nexport type StringsConfig = {\n assistantModal?: {\n open: {\n button: {\n tooltip?: string | undefined;\n };\n };\n closed: {\n button: {\n tooltip?: string | undefined;\n };\n };\n };\n thread?: {\n scrollToBottom?: {\n tooltip?: string | undefined;\n };\n };\n welcome?: {\n message?: string | undefined;\n };\n userMessage?: {\n edit?: {\n tooltip?: string | undefined;\n };\n };\n assistantMessage?: {\n reload?: {\n tooltip?: string | undefined;\n };\n copy?: {\n tooltip?: string | undefined;\n };\n speak?: {\n tooltip?: string | undefined;\n stop?: {\n tooltip?: string | undefined;\n };\n };\n feedback?: {\n positive?: {\n tooltip?: string | undefined;\n };\n negative?: {\n tooltip?: string | undefined;\n };\n };\n };\n branchPicker?: {\n previous?: {\n tooltip?: string | undefined;\n };\n next?: {\n tooltip?: string | undefined;\n };\n };\n composer?: {\n send?:\n | {\n tooltip?: string | undefined;\n }\n | undefined;\n cancel?:\n | {\n tooltip?: string | undefined;\n }\n | undefined;\n addAttachment?:\n | {\n tooltip?: string | undefined;\n }\n | undefined;\n removeAttachment?: {\n tooltip?: string | undefined;\n };\n input?: {\n placeholder?: string | undefined;\n };\n };\n editComposer?: {\n send?: {\n label?: string | undefined;\n };\n cancel?: {\n label?: string | undefined;\n };\n };\n code?: {\n header?: {\n copy?: {\n tooltip?: string | undefined;\n };\n };\n };\n};\n\nconst ThreadConfigContext = createContext<ThreadConfig>({});\n\nexport type ThreadConfig = {\n runtime?: AssistantRuntime | undefined;\n\n assistantAvatar?: AvatarProps | undefined;\n\n welcome?: ThreadWelcomeConfig | undefined;\n assistantMessage?: AssistantMessageConfig | undefined;\n userMessage?: UserMessageConfig | undefined;\n\n branchPicker?: BranchPickerConfig | undefined;\n\n composer?: ComposerConfig | undefined;\n\n strings?: StringsConfig | undefined;\n\n tools?: AssistantToolUI[] | undefined; // TODO add AssistantTool support\n\n components?:\n | {\n UserMessage?: ComponentType | undefined;\n AssistantMessage?: ComponentType | undefined;\n EditComposer?: ComponentType | undefined;\n Composer?: ComponentType | undefined;\n ThreadWelcome?: ComponentType | undefined;\n }\n | undefined;\n};\n\nexport const useThreadConfig = (): Omit<ThreadConfig, \"runtime\"> => {\n return useContext(ThreadConfigContext);\n};\n\nexport type ThreadConfigProviderProps = PropsWithChildren<{\n config?: ThreadConfig | undefined;\n}>;\n\nexport const ThreadConfigProvider: FC<ThreadConfigProviderProps> = ({\n children,\n config,\n}) => {\n const hasAssistant = !!useAssistantRuntime({ optional: true });\n\n const hasConfig = config && Object.keys(config).length > 0;\n const outerConfig = useThreadConfig();\n\n if (hasConfig && Object.keys(outerConfig).length > 0) {\n throw new Error(\n \"You are providing ThreadConfig to several nested components. Please provide all configuration to the same component.\",\n );\n }\n\n const configProvider = hasConfig ? (\n <ThreadConfigContext.Provider value={config}>\n {children}\n </ThreadConfigContext.Provider>\n ) : (\n <>{children}</>\n );\n\n if (!config?.runtime) return configProvider;\n\n if (hasAssistant) {\n throw new Error(\n \"You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed.\",\n );\n }\n return (\n <AssistantRuntimeProvider runtime={config.runtime}>\n {configProvider}\n </AssistantRuntimeProvider>\n );\n};\n\nThreadConfigProvider.displayName = \"ThreadConfigProvider\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAOO;AAKP,qBAAyC;AAEzC,8BAAoC;
|
1
|
+
{"version":3,"sources":["../../src/ui/thread-config.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ComponentType,\n FC,\n PropsWithChildren,\n ReactNode,\n createContext,\n useContext,\n} from \"react\";\n\nimport { AssistantRuntime } from \"../api/AssistantRuntime\";\nimport { AvatarProps } from \"./base/avatar\";\nimport { TextContentPartComponent, ToolCallContentPartProps } from \"../types\";\nimport { AssistantRuntimeProvider } from \"../context\";\nimport { AssistantToolUI } from \"../model-config\";\nimport { useAssistantRuntime } from \"../context/react/AssistantContext\";\n\nexport type SuggestionConfig = {\n text?: ReactNode | undefined;\n prompt: string;\n};\n\nexport type ThreadWelcomeConfig = {\n message?: string | null | undefined;\n suggestions?: SuggestionConfig[] | undefined;\n};\n\nexport type UserMessageConfig = {\n allowEdit?: boolean | undefined;\n};\n\nexport type AssistantMessageConfig = {\n allowReload?: boolean | undefined;\n allowCopy?: boolean | undefined;\n allowSpeak?: boolean | undefined;\n allowFeedbackPositive?: boolean | undefined;\n allowFeedbackNegative?: boolean | undefined;\n components?:\n | {\n Text?: TextContentPartComponent | undefined;\n ToolFallback?: ComponentType<ToolCallContentPartProps> | undefined;\n }\n | undefined;\n};\n\nexport type BranchPickerConfig = {\n allowBranchPicker?: boolean | undefined;\n};\n\nexport type ComposerConfig = {\n allowAttachments?: boolean | undefined;\n};\n\nexport type StringsConfig = {\n assistantModal?: {\n open: {\n button: {\n tooltip?: string | undefined;\n };\n };\n closed: {\n button: {\n tooltip?: string | undefined;\n };\n };\n };\n threadList?: {\n new?: {\n label?: string | undefined;\n };\n item?: {\n title?: {\n fallback?: string | undefined;\n };\n archive?: {\n label?: string | undefined;\n };\n };\n };\n thread?: {\n scrollToBottom?: {\n tooltip?: string | undefined;\n };\n };\n welcome?: {\n message?: string | undefined;\n };\n userMessage?: {\n edit?: {\n tooltip?: string | undefined;\n };\n };\n assistantMessage?: {\n reload?: {\n tooltip?: string | undefined;\n };\n copy?: {\n tooltip?: string | undefined;\n };\n speak?: {\n tooltip?: string | undefined;\n stop?: {\n tooltip?: string | undefined;\n };\n };\n feedback?: {\n positive?: {\n tooltip?: string | undefined;\n };\n negative?: {\n tooltip?: string | undefined;\n };\n };\n };\n branchPicker?: {\n previous?: {\n tooltip?: string | undefined;\n };\n next?: {\n tooltip?: string | undefined;\n };\n };\n composer?: {\n send?:\n | {\n tooltip?: string | undefined;\n }\n | undefined;\n cancel?:\n | {\n tooltip?: string | undefined;\n }\n | undefined;\n addAttachment?:\n | {\n tooltip?: string | undefined;\n }\n | undefined;\n removeAttachment?: {\n tooltip?: string | undefined;\n };\n input?: {\n placeholder?: string | undefined;\n };\n };\n editComposer?: {\n send?: {\n label?: string | undefined;\n };\n cancel?: {\n label?: string | undefined;\n };\n };\n code?: {\n header?: {\n copy?: {\n tooltip?: string | undefined;\n };\n };\n };\n};\n\nconst ThreadConfigContext = createContext<ThreadConfig>({});\n\nexport type ThreadConfig = {\n runtime?: AssistantRuntime | undefined;\n\n assistantAvatar?: AvatarProps | undefined;\n\n welcome?: ThreadWelcomeConfig | undefined;\n assistantMessage?: AssistantMessageConfig | undefined;\n userMessage?: UserMessageConfig | undefined;\n\n branchPicker?: BranchPickerConfig | undefined;\n\n composer?: ComposerConfig | undefined;\n\n strings?: StringsConfig | undefined;\n\n tools?: AssistantToolUI[] | undefined; // TODO add AssistantTool support\n\n components?:\n | {\n UserMessage?: ComponentType | undefined;\n AssistantMessage?: ComponentType | undefined;\n EditComposer?: ComponentType | undefined;\n Composer?: ComponentType | undefined;\n ThreadWelcome?: ComponentType | undefined;\n }\n | undefined;\n};\n\nexport const useThreadConfig = (): Omit<ThreadConfig, \"runtime\"> => {\n return useContext(ThreadConfigContext);\n};\n\nexport type ThreadConfigProviderProps = PropsWithChildren<{\n config?: ThreadConfig | undefined;\n}>;\n\nexport const ThreadConfigProvider: FC<ThreadConfigProviderProps> = ({\n children,\n config,\n}) => {\n const hasAssistant = !!useAssistantRuntime({ optional: true });\n\n const hasConfig = config && Object.keys(config).length > 0;\n const outerConfig = useThreadConfig();\n\n if (hasConfig && Object.keys(outerConfig).length > 0) {\n throw new Error(\n \"You are providing ThreadConfig to several nested components. Please provide all configuration to the same component.\",\n );\n }\n\n const configProvider = hasConfig ? (\n <ThreadConfigContext.Provider value={config}>\n {children}\n </ThreadConfigContext.Provider>\n ) : (\n <>{children}</>\n );\n\n if (!config?.runtime) return configProvider;\n\n if (hasAssistant) {\n throw new Error(\n \"You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed.\",\n );\n }\n return (\n <AssistantRuntimeProvider runtime={config.runtime}>\n {configProvider}\n </AssistantRuntimeProvider>\n );\n};\n\nThreadConfigProvider.displayName = \"ThreadConfigProvider\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAOO;AAKP,qBAAyC;AAEzC,8BAAoC;AAyMhC;AAtDJ,IAAM,0BAAsB,4BAA4B,CAAC,CAAC;AA8BnD,IAAM,kBAAkB,MAAqC;AAClE,aAAO,yBAAW,mBAAmB;AACvC;AAMO,IAAM,uBAAsD,CAAC;AAAA,EAClE;AAAA,EACA;AACF,MAAM;AACJ,QAAM,eAAe,CAAC,KAAC,6CAAoB,EAAE,UAAU,KAAK,CAAC;AAE7D,QAAM,YAAY,UAAU,OAAO,KAAK,MAAM,EAAE,SAAS;AACzD,QAAM,cAAc,gBAAgB;AAEpC,MAAI,aAAa,OAAO,KAAK,WAAW,EAAE,SAAS,GAAG;AACpD,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,iBAAiB,YACrB,4CAAC,oBAAoB,UAApB,EAA6B,OAAO,QAClC,UACH,IAEA,2EAAG,UAAS;AAGd,MAAI,CAAC,QAAQ,QAAS,QAAO;AAE7B,MAAI,cAAc;AAChB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SACE,4CAAC,2CAAyB,SAAS,OAAO,SACvC,0BACH;AAEJ;AAEA,qBAAqB,cAAc;","names":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/ui/thread-config.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ComponentType,\n FC,\n PropsWithChildren,\n ReactNode,\n createContext,\n useContext,\n} from \"react\";\n\nimport { AssistantRuntime } from \"../api/AssistantRuntime\";\nimport { AvatarProps } from \"./base/avatar\";\nimport { TextContentPartComponent, ToolCallContentPartProps } from \"../types\";\nimport { AssistantRuntimeProvider } from \"../context\";\nimport { AssistantToolUI } from \"../model-config\";\nimport { useAssistantRuntime } from \"../context/react/AssistantContext\";\n\nexport type SuggestionConfig = {\n text?: ReactNode | undefined;\n prompt: string;\n};\n\nexport type ThreadWelcomeConfig = {\n message?: string | null | undefined;\n suggestions?: SuggestionConfig[] | undefined;\n};\n\nexport type UserMessageConfig = {\n allowEdit?: boolean | undefined;\n};\n\nexport type AssistantMessageConfig = {\n allowReload?: boolean | undefined;\n allowCopy?: boolean | undefined;\n allowSpeak?: boolean | undefined;\n allowFeedbackPositive?: boolean | undefined;\n allowFeedbackNegative?: boolean | undefined;\n components?:\n | {\n Text?: TextContentPartComponent | undefined;\n ToolFallback?: ComponentType<ToolCallContentPartProps> | undefined;\n }\n | undefined;\n};\n\nexport type BranchPickerConfig = {\n allowBranchPicker?: boolean | undefined;\n};\n\nexport type ComposerConfig = {\n allowAttachments?: boolean | undefined;\n};\n\nexport type StringsConfig = {\n assistantModal?: {\n open: {\n button: {\n tooltip?: string | undefined;\n };\n };\n closed: {\n button: {\n tooltip?: string | undefined;\n };\n };\n };\n thread?: {\n scrollToBottom?: {\n tooltip?: string | undefined;\n };\n };\n welcome?: {\n message?: string | undefined;\n };\n userMessage?: {\n edit?: {\n tooltip?: string | undefined;\n };\n };\n assistantMessage?: {\n reload?: {\n tooltip?: string | undefined;\n };\n copy?: {\n tooltip?: string | undefined;\n };\n speak?: {\n tooltip?: string | undefined;\n stop?: {\n tooltip?: string | undefined;\n };\n };\n feedback?: {\n positive?: {\n tooltip?: string | undefined;\n };\n negative?: {\n tooltip?: string | undefined;\n };\n };\n };\n branchPicker?: {\n previous?: {\n tooltip?: string | undefined;\n };\n next?: {\n tooltip?: string | undefined;\n };\n };\n composer?: {\n send?:\n | {\n tooltip?: string | undefined;\n }\n | undefined;\n cancel?:\n | {\n tooltip?: string | undefined;\n }\n | undefined;\n addAttachment?:\n | {\n tooltip?: string | undefined;\n }\n | undefined;\n removeAttachment?: {\n tooltip?: string | undefined;\n };\n input?: {\n placeholder?: string | undefined;\n };\n };\n editComposer?: {\n send?: {\n label?: string | undefined;\n };\n cancel?: {\n label?: string | undefined;\n };\n };\n code?: {\n header?: {\n copy?: {\n tooltip?: string | undefined;\n };\n };\n };\n};\n\nconst ThreadConfigContext = createContext<ThreadConfig>({});\n\nexport type ThreadConfig = {\n runtime?: AssistantRuntime | undefined;\n\n assistantAvatar?: AvatarProps | undefined;\n\n welcome?: ThreadWelcomeConfig | undefined;\n assistantMessage?: AssistantMessageConfig | undefined;\n userMessage?: UserMessageConfig | undefined;\n\n branchPicker?: BranchPickerConfig | undefined;\n\n composer?: ComposerConfig | undefined;\n\n strings?: StringsConfig | undefined;\n\n tools?: AssistantToolUI[] | undefined; // TODO add AssistantTool support\n\n components?:\n | {\n UserMessage?: ComponentType | undefined;\n AssistantMessage?: ComponentType | undefined;\n EditComposer?: ComponentType | undefined;\n Composer?: ComponentType | undefined;\n ThreadWelcome?: ComponentType | undefined;\n }\n | undefined;\n};\n\nexport const useThreadConfig = (): Omit<ThreadConfig, \"runtime\"> => {\n return useContext(ThreadConfigContext);\n};\n\nexport type ThreadConfigProviderProps = PropsWithChildren<{\n config?: ThreadConfig | undefined;\n}>;\n\nexport const ThreadConfigProvider: FC<ThreadConfigProviderProps> = ({\n children,\n config,\n}) => {\n const hasAssistant = !!useAssistantRuntime({ optional: true });\n\n const hasConfig = config && Object.keys(config).length > 0;\n const outerConfig = useThreadConfig();\n\n if (hasConfig && Object.keys(outerConfig).length > 0) {\n throw new Error(\n \"You are providing ThreadConfig to several nested components. Please provide all configuration to the same component.\",\n );\n }\n\n const configProvider = hasConfig ? (\n <ThreadConfigContext.Provider value={config}>\n {children}\n </ThreadConfigContext.Provider>\n ) : (\n <>{children}</>\n );\n\n if (!config?.runtime) return configProvider;\n\n if (hasAssistant) {\n throw new Error(\n \"You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed.\",\n );\n }\n return (\n <AssistantRuntimeProvider runtime={config.runtime}>\n {configProvider}\n </AssistantRuntimeProvider>\n );\n};\n\nThreadConfigProvider.displayName = \"ThreadConfigProvider\";\n"],"mappings":";;;AAEA;AAAA,EAKE;AAAA,EACA;AAAA,OACK;AAKP,SAAS,gCAAgC;AAEzC,SAAS,2BAA2B;
|
1
|
+
{"version":3,"sources":["../../src/ui/thread-config.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ComponentType,\n FC,\n PropsWithChildren,\n ReactNode,\n createContext,\n useContext,\n} from \"react\";\n\nimport { AssistantRuntime } from \"../api/AssistantRuntime\";\nimport { AvatarProps } from \"./base/avatar\";\nimport { TextContentPartComponent, ToolCallContentPartProps } from \"../types\";\nimport { AssistantRuntimeProvider } from \"../context\";\nimport { AssistantToolUI } from \"../model-config\";\nimport { useAssistantRuntime } from \"../context/react/AssistantContext\";\n\nexport type SuggestionConfig = {\n text?: ReactNode | undefined;\n prompt: string;\n};\n\nexport type ThreadWelcomeConfig = {\n message?: string | null | undefined;\n suggestions?: SuggestionConfig[] | undefined;\n};\n\nexport type UserMessageConfig = {\n allowEdit?: boolean | undefined;\n};\n\nexport type AssistantMessageConfig = {\n allowReload?: boolean | undefined;\n allowCopy?: boolean | undefined;\n allowSpeak?: boolean | undefined;\n allowFeedbackPositive?: boolean | undefined;\n allowFeedbackNegative?: boolean | undefined;\n components?:\n | {\n Text?: TextContentPartComponent | undefined;\n ToolFallback?: ComponentType<ToolCallContentPartProps> | undefined;\n }\n | undefined;\n};\n\nexport type BranchPickerConfig = {\n allowBranchPicker?: boolean | undefined;\n};\n\nexport type ComposerConfig = {\n allowAttachments?: boolean | undefined;\n};\n\nexport type StringsConfig = {\n assistantModal?: {\n open: {\n button: {\n tooltip?: string | undefined;\n };\n };\n closed: {\n button: {\n tooltip?: string | undefined;\n };\n };\n };\n threadList?: {\n new?: {\n label?: string | undefined;\n };\n item?: {\n title?: {\n fallback?: string | undefined;\n };\n archive?: {\n label?: string | undefined;\n };\n };\n };\n thread?: {\n scrollToBottom?: {\n tooltip?: string | undefined;\n };\n };\n welcome?: {\n message?: string | undefined;\n };\n userMessage?: {\n edit?: {\n tooltip?: string | undefined;\n };\n };\n assistantMessage?: {\n reload?: {\n tooltip?: string | undefined;\n };\n copy?: {\n tooltip?: string | undefined;\n };\n speak?: {\n tooltip?: string | undefined;\n stop?: {\n tooltip?: string | undefined;\n };\n };\n feedback?: {\n positive?: {\n tooltip?: string | undefined;\n };\n negative?: {\n tooltip?: string | undefined;\n };\n };\n };\n branchPicker?: {\n previous?: {\n tooltip?: string | undefined;\n };\n next?: {\n tooltip?: string | undefined;\n };\n };\n composer?: {\n send?:\n | {\n tooltip?: string | undefined;\n }\n | undefined;\n cancel?:\n | {\n tooltip?: string | undefined;\n }\n | undefined;\n addAttachment?:\n | {\n tooltip?: string | undefined;\n }\n | undefined;\n removeAttachment?: {\n tooltip?: string | undefined;\n };\n input?: {\n placeholder?: string | undefined;\n };\n };\n editComposer?: {\n send?: {\n label?: string | undefined;\n };\n cancel?: {\n label?: string | undefined;\n };\n };\n code?: {\n header?: {\n copy?: {\n tooltip?: string | undefined;\n };\n };\n };\n};\n\nconst ThreadConfigContext = createContext<ThreadConfig>({});\n\nexport type ThreadConfig = {\n runtime?: AssistantRuntime | undefined;\n\n assistantAvatar?: AvatarProps | undefined;\n\n welcome?: ThreadWelcomeConfig | undefined;\n assistantMessage?: AssistantMessageConfig | undefined;\n userMessage?: UserMessageConfig | undefined;\n\n branchPicker?: BranchPickerConfig | undefined;\n\n composer?: ComposerConfig | undefined;\n\n strings?: StringsConfig | undefined;\n\n tools?: AssistantToolUI[] | undefined; // TODO add AssistantTool support\n\n components?:\n | {\n UserMessage?: ComponentType | undefined;\n AssistantMessage?: ComponentType | undefined;\n EditComposer?: ComponentType | undefined;\n Composer?: ComponentType | undefined;\n ThreadWelcome?: ComponentType | undefined;\n }\n | undefined;\n};\n\nexport const useThreadConfig = (): Omit<ThreadConfig, \"runtime\"> => {\n return useContext(ThreadConfigContext);\n};\n\nexport type ThreadConfigProviderProps = PropsWithChildren<{\n config?: ThreadConfig | undefined;\n}>;\n\nexport const ThreadConfigProvider: FC<ThreadConfigProviderProps> = ({\n children,\n config,\n}) => {\n const hasAssistant = !!useAssistantRuntime({ optional: true });\n\n const hasConfig = config && Object.keys(config).length > 0;\n const outerConfig = useThreadConfig();\n\n if (hasConfig && Object.keys(outerConfig).length > 0) {\n throw new Error(\n \"You are providing ThreadConfig to several nested components. Please provide all configuration to the same component.\",\n );\n }\n\n const configProvider = hasConfig ? (\n <ThreadConfigContext.Provider value={config}>\n {children}\n </ThreadConfigContext.Provider>\n ) : (\n <>{children}</>\n );\n\n if (!config?.runtime) return configProvider;\n\n if (hasAssistant) {\n throw new Error(\n \"You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed.\",\n );\n }\n return (\n <AssistantRuntimeProvider runtime={config.runtime}>\n {configProvider}\n </AssistantRuntimeProvider>\n );\n};\n\nThreadConfigProvider.displayName = \"ThreadConfigProvider\";\n"],"mappings":";;;AAEA;AAAA,EAKE;AAAA,EACA;AAAA,OACK;AAKP,SAAS,gCAAgC;AAEzC,SAAS,2BAA2B;AAyMhC,SAIA,UAJA;AAtDJ,IAAM,sBAAsB,cAA4B,CAAC,CAAC;AA8BnD,IAAM,kBAAkB,MAAqC;AAClE,SAAO,WAAW,mBAAmB;AACvC;AAMO,IAAM,uBAAsD,CAAC;AAAA,EAClE;AAAA,EACA;AACF,MAAM;AACJ,QAAM,eAAe,CAAC,CAAC,oBAAoB,EAAE,UAAU,KAAK,CAAC;AAE7D,QAAM,YAAY,UAAU,OAAO,KAAK,MAAM,EAAE,SAAS;AACzD,QAAM,cAAc,gBAAgB;AAEpC,MAAI,aAAa,OAAO,KAAK,WAAW,EAAE,SAAS,GAAG;AACpD,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,iBAAiB,YACrB,oBAAC,oBAAoB,UAApB,EAA6B,OAAO,QAClC,UACH,IAEA,gCAAG,UAAS;AAGd,MAAI,CAAC,QAAQ,QAAS,QAAO;AAE7B,MAAI,cAAc;AAChB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SACE,oBAAC,4BAAyB,SAAS,OAAO,SACvC,0BACH;AAEJ;AAEA,qBAAqB,cAAc;","names":[]}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { type FC } from "react";
|
2
|
+
declare const ThreadListItem: FC;
|
3
|
+
declare const exports: {
|
4
|
+
Root: import("react").ForwardRefExoticComponent<Partial<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
5
|
+
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
6
|
+
} & {
|
7
|
+
asChild?: boolean;
|
8
|
+
}, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref">> & import("react").RefAttributes<HTMLDivElement>>;
|
9
|
+
Title: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & import("react").RefAttributes<HTMLParagraphElement>>;
|
10
|
+
Archive: import("react").ForwardRefExoticComponent<Partial<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
11
|
+
ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
12
|
+
} & {
|
13
|
+
asChild?: boolean;
|
14
|
+
}, "ref"> & import("class-variance-authority").VariantProps<(props?: ({
|
15
|
+
variant?: "default" | "outline" | "ghost" | null | undefined;
|
16
|
+
size?: "default" | "icon" | null | undefined;
|
17
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & {
|
18
|
+
tooltip: string;
|
19
|
+
side?: "top" | "bottom" | "left" | "right";
|
20
|
+
} & import("react").RefAttributes<HTMLButtonElement>, "ref">> & import("react").RefAttributes<HTMLButtonElement>>;
|
21
|
+
};
|
22
|
+
declare const _default: typeof ThreadListItem & typeof exports;
|
23
|
+
export default _default;
|
24
|
+
//# sourceMappingURL=thread-list-item.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"thread-list-item.d.ts","sourceRoot":"","sources":["../../src/ui/thread-list-item.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAwC,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAStE,QAAA,MAAM,cAAc,EAAE,EASrB,CAAC;AAuEF,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;CAIZ,CAAC;wBAEuD,OAAO,cAAc,GAC5E,OAAO,OAAO;AADhB,wBACiB"}
|
@@ -0,0 +1,107 @@
|
|
1
|
+
"use strict";
|
2
|
+
"use client";
|
3
|
+
var __create = Object.create;
|
4
|
+
var __defProp = Object.defineProperty;
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
9
|
+
var __export = (target, all) => {
|
10
|
+
for (var name in all)
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
12
|
+
};
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
15
|
+
for (let key of __getOwnPropNames(from))
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
18
|
+
}
|
19
|
+
return to;
|
20
|
+
};
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
27
|
+
mod
|
28
|
+
));
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
30
|
+
|
31
|
+
// src/ui/thread-list-item.tsx
|
32
|
+
var thread_list_item_exports = {};
|
33
|
+
__export(thread_list_item_exports, {
|
34
|
+
default: () => thread_list_item_default
|
35
|
+
});
|
36
|
+
module.exports = __toCommonJS(thread_list_item_exports);
|
37
|
+
var import_react = require("react");
|
38
|
+
var import_lucide_react = require("lucide-react");
|
39
|
+
var import_withDefaults = require("./utils/withDefaults.cjs");
|
40
|
+
var import_tooltip_icon_button = require("./base/tooltip-icon-button.cjs");
|
41
|
+
var import_primitives = require("../primitives/index.cjs");
|
42
|
+
var import_thread_config = require("./thread-config.cjs");
|
43
|
+
var import_classnames = __toESM(require("classnames"));
|
44
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
45
|
+
var ThreadListItem = () => {
|
46
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ThreadListItemRoot, { children: [
|
47
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThreadListItemTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThreadListItemTitle, {}) }),
|
48
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThreadListItemArchive, {})
|
49
|
+
] });
|
50
|
+
};
|
51
|
+
var ThreadListItemRoot = (0, import_withDefaults.withDefaults)(import_primitives.ThreadListItemPrimitive.Root, {
|
52
|
+
className: "aui-thread-list-item"
|
53
|
+
});
|
54
|
+
ThreadListItemRoot.displayName = "ThreadListItemRoot";
|
55
|
+
var ThreadListItemTrigger = (0, import_withDefaults.withDefaults)(import_primitives.ThreadListItemPrimitive.Trigger, {
|
56
|
+
className: "aui-thread-list-item-trigger"
|
57
|
+
});
|
58
|
+
var ThreadListItemTitle = (0, import_react.forwardRef)(({ className, ...props }, ref) => {
|
59
|
+
const {
|
60
|
+
strings: {
|
61
|
+
threadList: { item: { title: { fallback = "New Chat" } = {} } = {} } = {}
|
62
|
+
} = {}
|
63
|
+
} = (0, import_thread_config.useThreadConfig)();
|
64
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
65
|
+
"p",
|
66
|
+
{
|
67
|
+
ref,
|
68
|
+
className: (0, import_classnames.default)("aui-thread-list-item-title", className),
|
69
|
+
...props,
|
70
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.ThreadListItemPrimitive.Title, { fallback })
|
71
|
+
}
|
72
|
+
);
|
73
|
+
});
|
74
|
+
ThreadListItemTitle.displayName = "ThreadListItemTitle";
|
75
|
+
var ThreadListItemArchive = (0, import_withDefaults.withDefaults)(
|
76
|
+
(0, import_react.forwardRef)(
|
77
|
+
({ className, ...props }, ref) => {
|
78
|
+
const {
|
79
|
+
strings: {
|
80
|
+
threadList: {
|
81
|
+
item: { archive: { label = "Archive thread" } = {} } = {}
|
82
|
+
} = {}
|
83
|
+
} = {}
|
84
|
+
} = (0, import_thread_config.useThreadConfig)();
|
85
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.ThreadListItemPrimitive.Archive, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
86
|
+
import_tooltip_icon_button.TooltipIconButton,
|
87
|
+
{
|
88
|
+
...props,
|
89
|
+
ref,
|
90
|
+
className: (0, import_classnames.default)("aui-thread-list-item-archive", className),
|
91
|
+
variant: "ghost",
|
92
|
+
tooltip: label,
|
93
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ArchiveIcon, {})
|
94
|
+
}
|
95
|
+
) });
|
96
|
+
}
|
97
|
+
),
|
98
|
+
{}
|
99
|
+
);
|
100
|
+
ThreadListItemArchive.displayName = "ThreadListItemArchive";
|
101
|
+
var exports2 = {
|
102
|
+
Root: ThreadListItemRoot,
|
103
|
+
Title: ThreadListItemTitle,
|
104
|
+
Archive: ThreadListItemArchive
|
105
|
+
};
|
106
|
+
var thread_list_item_default = Object.assign(ThreadListItem, exports2);
|
107
|
+
//# sourceMappingURL=thread-list-item.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/ui/thread-list-item.tsx"],"sourcesContent":["\"use client\";\n\nimport { ComponentPropsWithoutRef, forwardRef, type FC } from \"react\";\nimport { ArchiveIcon } from \"lucide-react\";\n\nimport { withDefaults } from \"./utils/withDefaults\";\nimport { TooltipIconButton } from \"./base/tooltip-icon-button\";\nimport { ThreadListItemPrimitive } from \"../primitives\";\nimport { useThreadConfig } from \"./thread-config\";\nimport classNames from \"classnames\";\n\nconst ThreadListItem: FC = () => {\n return (\n <ThreadListItemRoot>\n <ThreadListItemTrigger>\n <ThreadListItemTitle />\n </ThreadListItemTrigger>\n <ThreadListItemArchive />\n </ThreadListItemRoot>\n );\n};\n\nconst ThreadListItemRoot = withDefaults(ThreadListItemPrimitive.Root, {\n className: \"aui-thread-list-item\",\n});\n\nThreadListItemRoot.displayName = \"ThreadListItemRoot\";\n\nconst ThreadListItemTrigger = withDefaults(ThreadListItemPrimitive.Trigger, {\n className: \"aui-thread-list-item-trigger\",\n});\n\nnamespace ThreadListItemPrimitiveTitle {\n export type Element = HTMLParagraphElement;\n export type Props = ComponentPropsWithoutRef<\"p\">;\n}\n\nconst ThreadListItemTitle = forwardRef<\n ThreadListItemPrimitiveTitle.Element,\n ThreadListItemPrimitiveTitle.Props\n>(({ className, ...props }, ref) => {\n const {\n strings: {\n threadList: { item: { title: { fallback = \"New Chat\" } = {} } = {} } = {},\n } = {},\n } = useThreadConfig();\n\n return (\n <p\n ref={ref}\n className={classNames(\"aui-thread-list-item-title\", className)}\n {...props}\n >\n <ThreadListItemPrimitive.Title fallback={fallback} />\n </p>\n );\n});\n\nThreadListItemTitle.displayName = \"ThreadListItemTitle\";\n\nconst ThreadListItemArchive = withDefaults(\n forwardRef<HTMLButtonElement, TooltipIconButton.Props>(\n ({ className, ...props }, ref) => {\n const {\n strings: {\n threadList: {\n item: { archive: { label = \"Archive thread\" } = {} } = {},\n } = {},\n } = {},\n } = useThreadConfig();\n\n return (\n <ThreadListItemPrimitive.Archive asChild>\n <TooltipIconButton\n {...props}\n ref={ref}\n className={classNames(\"aui-thread-list-item-archive\", className)}\n variant=\"ghost\"\n tooltip={label}\n >\n <ArchiveIcon />\n </TooltipIconButton>\n </ThreadListItemPrimitive.Archive>\n );\n },\n ),\n {},\n);\n\nThreadListItemArchive.displayName = \"ThreadListItemArchive\";\n\nconst exports = {\n Root: ThreadListItemRoot,\n Title: ThreadListItemTitle,\n Archive: ThreadListItemArchive,\n};\n\nexport default Object.assign(ThreadListItem, exports) as typeof ThreadListItem &\n typeof exports;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA8D;AAC9D,0BAA4B;AAE5B,0BAA6B;AAC7B,iCAAkC;AAClC,wBAAwC;AACxC,2BAAgC;AAChC,wBAAuB;AAInB;AAFJ,IAAM,iBAAqB,MAAM;AAC/B,SACE,6CAAC,sBACC;AAAA,gDAAC,yBACC,sDAAC,uBAAoB,GACvB;AAAA,IACA,4CAAC,yBAAsB;AAAA,KACzB;AAEJ;AAEA,IAAM,yBAAqB,kCAAa,0CAAwB,MAAM;AAAA,EACpE,WAAW;AACb,CAAC;AAED,mBAAmB,cAAc;AAEjC,IAAM,4BAAwB,kCAAa,0CAAwB,SAAS;AAAA,EAC1E,WAAW;AACb,CAAC;AAOD,IAAM,0BAAsB,yBAG1B,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAAQ;AAClC,QAAM;AAAA,IACJ,SAAS;AAAA,MACP,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,WAAW,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC;AAAA,IAC1E,IAAI,CAAC;AAAA,EACP,QAAI,sCAAgB;AAEpB,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,eAAW,kBAAAA,SAAW,8BAA8B,SAAS;AAAA,MAC5D,GAAG;AAAA,MAEJ,sDAAC,0CAAwB,OAAxB,EAA8B,UAAoB;AAAA;AAAA,EACrD;AAEJ,CAAC;AAED,oBAAoB,cAAc;AAElC,IAAM,4BAAwB;AAAA,MAC5B;AAAA,IACE,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAAQ;AAChC,YAAM;AAAA,QACJ,SAAS;AAAA,UACP,YAAY;AAAA,YACV,MAAM,EAAE,SAAS,EAAE,QAAQ,iBAAiB,IAAI,CAAC,EAAE,IAAI,CAAC;AAAA,UAC1D,IAAI,CAAC;AAAA,QACP,IAAI,CAAC;AAAA,MACP,QAAI,sCAAgB;AAEpB,aACE,4CAAC,0CAAwB,SAAxB,EAAgC,SAAO,MACtC;AAAA,QAAC;AAAA;AAAA,UACE,GAAG;AAAA,UACJ;AAAA,UACA,eAAW,kBAAAA,SAAW,gCAAgC,SAAS;AAAA,UAC/D,SAAQ;AAAA,UACR,SAAS;AAAA,UAET,sDAAC,mCAAY;AAAA;AAAA,MACf,GACF;AAAA,IAEJ;AAAA,EACF;AAAA,EACA,CAAC;AACH;AAEA,sBAAsB,cAAc;AAEpC,IAAMC,WAAU;AAAA,EACd,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AACX;AAEA,IAAO,2BAAQ,OAAO,OAAO,gBAAgBA,QAAO;","names":["classNames","exports"]}
|
@@ -0,0 +1,77 @@
|
|
1
|
+
"use client";
|
2
|
+
|
3
|
+
// src/ui/thread-list-item.tsx
|
4
|
+
import { forwardRef } from "react";
|
5
|
+
import { ArchiveIcon } from "lucide-react";
|
6
|
+
import { withDefaults } from "./utils/withDefaults.mjs";
|
7
|
+
import { TooltipIconButton } from "./base/tooltip-icon-button.mjs";
|
8
|
+
import { ThreadListItemPrimitive } from "../primitives/index.mjs";
|
9
|
+
import { useThreadConfig } from "./thread-config.mjs";
|
10
|
+
import classNames from "classnames";
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
12
|
+
var ThreadListItem = () => {
|
13
|
+
return /* @__PURE__ */ jsxs(ThreadListItemRoot, { children: [
|
14
|
+
/* @__PURE__ */ jsx(ThreadListItemTrigger, { children: /* @__PURE__ */ jsx(ThreadListItemTitle, {}) }),
|
15
|
+
/* @__PURE__ */ jsx(ThreadListItemArchive, {})
|
16
|
+
] });
|
17
|
+
};
|
18
|
+
var ThreadListItemRoot = withDefaults(ThreadListItemPrimitive.Root, {
|
19
|
+
className: "aui-thread-list-item"
|
20
|
+
});
|
21
|
+
ThreadListItemRoot.displayName = "ThreadListItemRoot";
|
22
|
+
var ThreadListItemTrigger = withDefaults(ThreadListItemPrimitive.Trigger, {
|
23
|
+
className: "aui-thread-list-item-trigger"
|
24
|
+
});
|
25
|
+
var ThreadListItemTitle = forwardRef(({ className, ...props }, ref) => {
|
26
|
+
const {
|
27
|
+
strings: {
|
28
|
+
threadList: { item: { title: { fallback = "New Chat" } = {} } = {} } = {}
|
29
|
+
} = {}
|
30
|
+
} = useThreadConfig();
|
31
|
+
return /* @__PURE__ */ jsx(
|
32
|
+
"p",
|
33
|
+
{
|
34
|
+
ref,
|
35
|
+
className: classNames("aui-thread-list-item-title", className),
|
36
|
+
...props,
|
37
|
+
children: /* @__PURE__ */ jsx(ThreadListItemPrimitive.Title, { fallback })
|
38
|
+
}
|
39
|
+
);
|
40
|
+
});
|
41
|
+
ThreadListItemTitle.displayName = "ThreadListItemTitle";
|
42
|
+
var ThreadListItemArchive = withDefaults(
|
43
|
+
forwardRef(
|
44
|
+
({ className, ...props }, ref) => {
|
45
|
+
const {
|
46
|
+
strings: {
|
47
|
+
threadList: {
|
48
|
+
item: { archive: { label = "Archive thread" } = {} } = {}
|
49
|
+
} = {}
|
50
|
+
} = {}
|
51
|
+
} = useThreadConfig();
|
52
|
+
return /* @__PURE__ */ jsx(ThreadListItemPrimitive.Archive, { asChild: true, children: /* @__PURE__ */ jsx(
|
53
|
+
TooltipIconButton,
|
54
|
+
{
|
55
|
+
...props,
|
56
|
+
ref,
|
57
|
+
className: classNames("aui-thread-list-item-archive", className),
|
58
|
+
variant: "ghost",
|
59
|
+
tooltip: label,
|
60
|
+
children: /* @__PURE__ */ jsx(ArchiveIcon, {})
|
61
|
+
}
|
62
|
+
) });
|
63
|
+
}
|
64
|
+
),
|
65
|
+
{}
|
66
|
+
);
|
67
|
+
ThreadListItemArchive.displayName = "ThreadListItemArchive";
|
68
|
+
var exports = {
|
69
|
+
Root: ThreadListItemRoot,
|
70
|
+
Title: ThreadListItemTitle,
|
71
|
+
Archive: ThreadListItemArchive
|
72
|
+
};
|
73
|
+
var thread_list_item_default = Object.assign(ThreadListItem, exports);
|
74
|
+
export {
|
75
|
+
thread_list_item_default as default
|
76
|
+
};
|
77
|
+
//# sourceMappingURL=thread-list-item.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/ui/thread-list-item.tsx"],"sourcesContent":["\"use client\";\n\nimport { ComponentPropsWithoutRef, forwardRef, type FC } from \"react\";\nimport { ArchiveIcon } from \"lucide-react\";\n\nimport { withDefaults } from \"./utils/withDefaults\";\nimport { TooltipIconButton } from \"./base/tooltip-icon-button\";\nimport { ThreadListItemPrimitive } from \"../primitives\";\nimport { useThreadConfig } from \"./thread-config\";\nimport classNames from \"classnames\";\n\nconst ThreadListItem: FC = () => {\n return (\n <ThreadListItemRoot>\n <ThreadListItemTrigger>\n <ThreadListItemTitle />\n </ThreadListItemTrigger>\n <ThreadListItemArchive />\n </ThreadListItemRoot>\n );\n};\n\nconst ThreadListItemRoot = withDefaults(ThreadListItemPrimitive.Root, {\n className: \"aui-thread-list-item\",\n});\n\nThreadListItemRoot.displayName = \"ThreadListItemRoot\";\n\nconst ThreadListItemTrigger = withDefaults(ThreadListItemPrimitive.Trigger, {\n className: \"aui-thread-list-item-trigger\",\n});\n\nnamespace ThreadListItemPrimitiveTitle {\n export type Element = HTMLParagraphElement;\n export type Props = ComponentPropsWithoutRef<\"p\">;\n}\n\nconst ThreadListItemTitle = forwardRef<\n ThreadListItemPrimitiveTitle.Element,\n ThreadListItemPrimitiveTitle.Props\n>(({ className, ...props }, ref) => {\n const {\n strings: {\n threadList: { item: { title: { fallback = \"New Chat\" } = {} } = {} } = {},\n } = {},\n } = useThreadConfig();\n\n return (\n <p\n ref={ref}\n className={classNames(\"aui-thread-list-item-title\", className)}\n {...props}\n >\n <ThreadListItemPrimitive.Title fallback={fallback} />\n </p>\n );\n});\n\nThreadListItemTitle.displayName = \"ThreadListItemTitle\";\n\nconst ThreadListItemArchive = withDefaults(\n forwardRef<HTMLButtonElement, TooltipIconButton.Props>(\n ({ className, ...props }, ref) => {\n const {\n strings: {\n threadList: {\n item: { archive: { label = \"Archive thread\" } = {} } = {},\n } = {},\n } = {},\n } = useThreadConfig();\n\n return (\n <ThreadListItemPrimitive.Archive asChild>\n <TooltipIconButton\n {...props}\n ref={ref}\n className={classNames(\"aui-thread-list-item-archive\", className)}\n variant=\"ghost\"\n tooltip={label}\n >\n <ArchiveIcon />\n </TooltipIconButton>\n </ThreadListItemPrimitive.Archive>\n );\n },\n ),\n {},\n);\n\nThreadListItemArchive.displayName = \"ThreadListItemArchive\";\n\nconst exports = {\n Root: ThreadListItemRoot,\n Title: ThreadListItemTitle,\n Archive: ThreadListItemArchive,\n};\n\nexport default Object.assign(ThreadListItem, exports) as typeof ThreadListItem &\n typeof exports;\n"],"mappings":";;;AAEA,SAAmC,kBAA2B;AAC9D,SAAS,mBAAmB;AAE5B,SAAS,oBAAoB;AAC7B,SAAS,yBAAyB;AAClC,SAAS,+BAA+B;AACxC,SAAS,uBAAuB;AAChC,OAAO,gBAAgB;AAInB,SAEI,KAFJ;AAFJ,IAAM,iBAAqB,MAAM;AAC/B,SACE,qBAAC,sBACC;AAAA,wBAAC,yBACC,8BAAC,uBAAoB,GACvB;AAAA,IACA,oBAAC,yBAAsB;AAAA,KACzB;AAEJ;AAEA,IAAM,qBAAqB,aAAa,wBAAwB,MAAM;AAAA,EACpE,WAAW;AACb,CAAC;AAED,mBAAmB,cAAc;AAE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