@assistant-ui/react 0.7.7 → 0.7.9
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/api/AssistantRuntime.js +3 -3
- package/dist/api/ComposerRuntime.d.ts.map +1 -1
- package/dist/api/ComposerRuntime.js +4 -4
- package/dist/api/MessageRuntime.js +7 -7
- package/dist/api/ThreadListRuntime.js +4 -4
- package/dist/api/ThreadRuntime.js +6 -6
- package/dist/api/subscribable/LazyMemoizeSubject.js +2 -2
- package/dist/api/subscribable/NestedSubscriptionSubject.js +1 -1
- package/dist/api/subscribable/ShallowMemoizeSubject.js +3 -3
- package/dist/context/index.js +6 -6
- package/dist/context/index.js.map +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.js +4 -4
- package/dist/context/providers/AttachmentRuntimeProvider.js +2 -2
- package/dist/context/providers/ContentPartRuntimeProvider.js +2 -2
- package/dist/context/providers/MessageRuntimeProvider.js +3 -3
- package/dist/context/providers/TextContentPartProvider.js +3 -3
- package/dist/context/providers/ThreadListItemRuntimeProvider.js +2 -2
- package/dist/context/providers/ThreadRuntimeProvider.js +3 -3
- package/dist/context/providers/index.js +2 -2
- package/dist/context/react/AssistantContext.js +2 -2
- package/dist/context/react/AttachmentContext.js +1 -1
- package/dist/context/react/ComposerContext.js +3 -3
- package/dist/context/react/ContentPartContext.js +2 -2
- package/dist/context/react/MessageContext.js +2 -2
- package/dist/context/react/ThreadContext.js +2 -2
- package/dist/context/react/ThreadListItemContext.js +2 -2
- package/dist/context/react/index.js +6 -6
- package/dist/context/react/utils/createContextStoreHook.d.ts.map +1 -1
- package/dist/edge.js +1 -1
- package/dist/index.js +17 -17
- package/dist/index.js.map +1 -1
- package/dist/internal.js +11 -11
- package/dist/internal.js.map +1 -1
- package/dist/model-config/index.js +6 -6
- package/dist/model-config/makeAssistantTool.js +1 -1
- package/dist/model-config/makeAssistantToolUI.js +1 -1
- package/dist/model-config/useAssistantInstructions.js +1 -1
- package/dist/model-config/useAssistantTool.js +1 -1
- package/dist/model-config/useAssistantToolUI.js +1 -1
- package/dist/primitive-hooks/actionBar/useActionBarCopy.js +2 -2
- package/dist/primitive-hooks/actionBar/useActionBarEdit.js +1 -1
- package/dist/primitive-hooks/actionBar/useActionBarFeedbackNegative.js +1 -1
- package/dist/primitive-hooks/actionBar/useActionBarFeedbackPositive.js +1 -1
- package/dist/primitive-hooks/actionBar/useActionBarReload.js +3 -3
- package/dist/primitive-hooks/actionBar/useActionBarSpeak.js +1 -1
- package/dist/primitive-hooks/actionBar/useActionBarStopSpeaking.js +1 -1
- package/dist/primitive-hooks/attachment/useAttachmentRemove.js +1 -1
- package/dist/primitive-hooks/branchPicker/useBranchPickerCount.js +1 -1
- package/dist/primitive-hooks/branchPicker/useBranchPickerNext.js +1 -1
- package/dist/primitive-hooks/branchPicker/useBranchPickerNumber.js +1 -1
- package/dist/primitive-hooks/branchPicker/useBranchPickerPrevious.js +1 -1
- package/dist/primitive-hooks/composer/useComposerAddAttachment.js +1 -1
- package/dist/primitive-hooks/composer/useComposerCancel.js +1 -1
- package/dist/primitive-hooks/composer/useComposerIf.js +1 -1
- package/dist/primitive-hooks/composer/useComposerSend.js +3 -3
- package/dist/primitive-hooks/contentPart/index.js +3 -3
- package/dist/primitive-hooks/contentPart/useContentPartDisplay.js +1 -1
- package/dist/primitive-hooks/contentPart/useContentPartImage.js +1 -1
- package/dist/primitive-hooks/contentPart/useContentPartText.js +1 -1
- package/dist/primitive-hooks/index.js +2 -2
- package/dist/primitive-hooks/index.js.map +1 -1
- package/dist/primitive-hooks/message/useMessageIf.js +2 -2
- package/dist/primitive-hooks/thread/useThreadEmpty.js +1 -1
- package/dist/primitive-hooks/thread/useThreadIf.js +1 -1
- package/dist/primitive-hooks/thread/useThreadScrollToBottom.js +2 -2
- package/dist/primitive-hooks/thread/useThreadSuggestion.js +2 -2
- package/dist/primitive-hooks/thread/useThreadViewportAutoScroll.js +5 -5
- package/dist/primitives/actionBar/ActionBarCopy.js +2 -2
- package/dist/primitives/actionBar/ActionBarEdit.js +2 -2
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.js +2 -2
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.js +2 -2
- package/dist/primitives/actionBar/ActionBarReload.js +2 -2
- package/dist/primitives/actionBar/ActionBarRoot.js +1 -1
- package/dist/primitives/actionBar/ActionBarSpeak.js +2 -2
- package/dist/primitives/actionBar/ActionBarStopSpeaking.js +1 -1
- package/dist/primitives/actionBar/index.js +8 -8
- package/dist/primitives/actionBar/useActionBarFloatStatus.js +3 -3
- package/dist/primitives/assistantModal/AssistantModalAnchor.js +1 -1
- package/dist/primitives/assistantModal/AssistantModalContent.js +1 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.js +2 -2
- package/dist/primitives/assistantModal/AssistantModalTrigger.js +1 -1
- package/dist/primitives/assistantModal/index.js +4 -4
- package/dist/primitives/attachment/AttachmentName.js +1 -1
- package/dist/primitives/attachment/AttachmentRemove.js +2 -2
- package/dist/primitives/attachment/AttachmentThumb.js +1 -1
- package/dist/primitives/attachment/index.js +4 -4
- package/dist/primitives/branchPicker/BranchPickerCount.js +1 -1
- package/dist/primitives/branchPicker/BranchPickerNext.js +2 -2
- package/dist/primitives/branchPicker/BranchPickerNumber.js +1 -1
- package/dist/primitives/branchPicker/BranchPickerPrevious.js +2 -2
- package/dist/primitives/branchPicker/BranchPickerRoot.js +1 -1
- package/dist/primitives/branchPicker/index.js +5 -5
- package/dist/primitives/composer/ComposerAddAttachment.js +2 -2
- package/dist/primitives/composer/ComposerAttachments.js +3 -3
- package/dist/primitives/composer/ComposerCancel.js +2 -2
- package/dist/primitives/composer/ComposerIf.js +1 -1
- package/dist/primitives/composer/ComposerInput.js +3 -3
- package/dist/primitives/composer/ComposerRoot.js +1 -1
- package/dist/primitives/composer/ComposerSend.js +2 -2
- package/dist/primitives/composer/index.js +7 -7
- package/dist/primitives/contentPart/ContentPartDisplay.js +1 -1
- package/dist/primitives/contentPart/ContentPartImage.js +1 -1
- package/dist/primitives/contentPart/ContentPartInProgress.js +1 -1
- package/dist/primitives/contentPart/ContentPartText.js +2 -2
- package/dist/primitives/contentPart/index.js +4 -4
- package/dist/primitives/index.js +10 -10
- package/dist/primitives/message/MessageAttachments.js +3 -3
- package/dist/primitives/message/MessageContent.js +8 -8
- package/dist/primitives/message/MessageIf.js +1 -1
- package/dist/primitives/message/MessageRoot.js +2 -2
- package/dist/primitives/message/index.js +4 -4
- package/dist/primitives/thread/ThreadEmpty.js +1 -1
- package/dist/primitives/thread/ThreadIf.js +1 -1
- package/dist/primitives/thread/ThreadMessages.js +3 -3
- package/dist/primitives/thread/ThreadScrollToBottom.js +2 -2
- package/dist/primitives/thread/ThreadSuggestion.js +2 -2
- package/dist/primitives/thread/ThreadViewport.js +1 -1
- package/dist/primitives/thread/index.js +7 -7
- 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 +2 -2
- 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 +24 -7
- 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/primitives/threadList/index.js +2 -2
- package/dist/primitives/threadListItem/ThreadListItemArchive.js +2 -2
- package/dist/primitives/threadListItem/ThreadListItemDelete.js +2 -2
- package/dist/primitives/threadListItem/ThreadListItemRoot.js +2 -2
- package/dist/primitives/threadListItem/ThreadListItemRoot.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemRoot.mjs +1 -1
- package/dist/primitives/threadListItem/ThreadListItemRoot.mjs.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTitle.js +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTrigger.js +2 -2
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.js +2 -2
- package/dist/primitives/threadListItem/index.js +6 -6
- package/dist/runtimes/attachment/index.js +3 -3
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.js +2 -2
- package/dist/runtimes/composer/DefaultThreadComposerRuntimeCore.js +1 -1
- package/dist/runtimes/core/BaseAssistantRuntimeCore.js +1 -1
- package/dist/runtimes/core/BaseThreadRuntimeCore.js +4 -4
- package/dist/runtimes/dangerous-in-browser/DangerousInBrowserAdapter.js +6 -6
- package/dist/runtimes/dangerous-in-browser/index.js +1 -1
- package/dist/runtimes/dangerous-in-browser/useDangerousInBrowserRuntime.js +3 -3
- package/dist/runtimes/edge/EdgeChatAdapter.js +7 -7
- package/dist/runtimes/edge/EdgeRuntimeRequestOptions.js +1 -1
- package/dist/runtimes/edge/converters/fromCoreMessage.js +1 -1
- package/dist/runtimes/edge/converters/index.js +6 -6
- package/dist/runtimes/edge/createEdgeRuntimeAPI.js +9 -9
- package/dist/runtimes/edge/index.js +6 -6
- package/dist/runtimes/edge/index.js.map +1 -1
- package/dist/runtimes/edge/partial-json/parse-partial-json.js +1 -1
- package/dist/runtimes/edge/streams/assistantDecoderStream.js +1 -1
- package/dist/runtimes/edge/streams/assistantEncoderStream.js +1 -1
- package/dist/runtimes/edge/streams/runResultStream.js +1 -1
- package/dist/runtimes/edge/streams/utils/index.js +2 -2
- package/dist/runtimes/edge/streams/utils/streamPartDecoderStream.js +2 -2
- package/dist/runtimes/edge/streams/utils/streamPartEncoderStream.d.ts +1 -1
- package/dist/runtimes/edge/streams/utils/streamPartEncoderStream.d.ts.map +1 -1
- package/dist/runtimes/edge/streams/utils/streamPartEncoderStream.js +1 -1
- package/dist/runtimes/edge/useEdgeRuntime.js +3 -3
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js +3 -3
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js +7 -7
- package/dist/runtimes/external-store/external-message-converter.js +4 -4
- package/dist/runtimes/external-store/index.js +3 -3
- package/dist/runtimes/external-store/useExternalStoreRuntime.js +3 -3
- package/dist/runtimes/index.js +16 -16
- package/dist/runtimes/index.js.map +1 -1
- package/dist/runtimes/local/LocalRuntimeCore.js +4 -4
- package/dist/runtimes/local/LocalThreadListRuntimeCore.js +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.js +5 -5
- package/dist/runtimes/local/index.js +1 -1
- package/dist/runtimes/local/useLocalRuntime.js +3 -3
- package/dist/runtimes/speech/index.js +1 -1
- package/dist/runtimes/utils/MessageRepository.js +2 -2
- package/dist/styles/index.css +78 -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 +5 -5
- 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-message.js +7 -7
- 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 +5 -5
- 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 +7 -7
- 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/avatar.js +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 +5 -5
- 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 +2 -2
- 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/base/tooltip.js +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 +5 -5
- 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 +7 -7
- 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/content-part.js +2 -2
- package/dist/ui/edit-composer.js +4 -4
- package/dist/ui/index.d.ts +4 -2
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +19 -13
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/index.mjs +18 -14
- 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 +2 -2
- 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 +15 -0
- package/dist/ui/thread-list-item.d.ts.map +1 -0
- package/dist/ui/thread-list-item.js +94 -0
- package/dist/ui/thread-list-item.js.map +1 -0
- package/dist/ui/thread-list-item.mjs +64 -0
- package/dist/ui/thread-list-item.mjs.map +1 -0
- package/dist/ui/thread-list.d.ts +27 -0
- package/dist/ui/thread-list.d.ts.map +1 -0
- package/dist/ui/thread-list.js +91 -0
- package/dist/ui/thread-list.js.map +1 -0
- package/dist/ui/thread-list.mjs +61 -0
- package/dist/ui/thread-list.mjs.map +1 -0
- package/dist/ui/thread-welcome.js +5 -5
- package/dist/ui/thread.d.ts +2 -2
- package/dist/ui/thread.d.ts.map +1 -1
- package/dist/ui/thread.js +10 -10
- 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 +5 -5
- 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/dist/ui/user-message.js +6 -6
- package/dist/utils/ProxyConfigProvider.js +1 -1
- package/dist/utils/combined/createCombinedStore.d.ts.map +1 -1
- package/dist/utils/combined/useCombinedStore.d.ts.map +1 -1
- package/dist/utils/combined/useCombinedStore.js +1 -1
- package/dist/utils/hooks/useOnResizeContent.js +1 -1
- package/dist/utils/hooks/useOnScrollToBottom.js +1 -1
- package/dist/utils/smooth/SmoothContext.js +2 -2
- package/dist/utils/smooth/index.js +3 -3
- package/dist/utils/smooth/useSmooth.js +3 -3
- package/package.json +5 -5
- package/src/primitives/threadList/ThreadListItems.tsx +3 -3
- package/src/primitives/threadList/ThreadListNew.tsx +45 -0
- package/src/primitives/threadListItem/ThreadListItemRoot.tsx +1 -1
- 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 +7 -3
- package/src/ui/thread-config.tsx +13 -0
- package/src/ui/thread-list-item.tsx +91 -0
- package/src/ui/thread-list.tsx +78 -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/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 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;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,15 @@
|
|
1
|
+
import { type FC } from "react";
|
2
|
+
import { TooltipIconButton } from "./base/tooltip-icon-button";
|
3
|
+
declare const ThreadListItem: FC;
|
4
|
+
declare const exports: {
|
5
|
+
Root: import("react").ForwardRefExoticComponent<Partial<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
6
|
+
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;
|
7
|
+
} & {
|
8
|
+
asChild?: boolean;
|
9
|
+
}, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref">> & import("react").RefAttributes<HTMLDivElement>>;
|
10
|
+
Title: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & import("react").RefAttributes<HTMLParagraphElement>>;
|
11
|
+
Archive: import("react").ForwardRefExoticComponent<Partial<TooltipIconButton.Props> & import("react").RefAttributes<HTMLButtonElement>>;
|
12
|
+
};
|
13
|
+
declare const _default: typeof ThreadListItem & typeof exports;
|
14
|
+
export default _default;
|
15
|
+
//# 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;AAItE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAK/D,QAAA,MAAM,cAAc,EAAE,EASrB,CAAC;AA+DF,QAAA,MAAM,OAAO;;;;;;;;CAIZ,CAAC;wBAEuD,OAAO,cAAc,GAC5E,OAAO,OAAO;AADhB,wBACiB"}
|
@@ -0,0 +1,94 @@
|
|
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.js");
|
40
|
+
var import_tooltip_icon_button = require("./base/tooltip-icon-button.js");
|
41
|
+
var import_primitives = require("../primitives/index.js");
|
42
|
+
var import_thread_config = require("./thread-config.js");
|
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 config = (0, import_thread_config.useThreadConfig)();
|
60
|
+
const fallback = config.strings?.threadList?.item?.title?.fallback ?? "New Chat";
|
61
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
62
|
+
"p",
|
63
|
+
{
|
64
|
+
ref,
|
65
|
+
className: (0, import_classnames.default)("aui-thread-list-item-title", className),
|
66
|
+
...props,
|
67
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.ThreadListItemPrimitive.Title, { fallback })
|
68
|
+
}
|
69
|
+
);
|
70
|
+
});
|
71
|
+
ThreadListItemTitle.displayName = "ThreadListItemTitle";
|
72
|
+
var ThreadListItemArchive = (0, import_react.forwardRef)(({ className, ...props }, ref) => {
|
73
|
+
const config = (0, import_thread_config.useThreadConfig)();
|
74
|
+
const tooltip = config.strings?.threadList?.item?.archive?.tooltip ?? "Archive thread";
|
75
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.ThreadListItemPrimitive.Archive, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
76
|
+
import_tooltip_icon_button.TooltipIconButton,
|
77
|
+
{
|
78
|
+
ref,
|
79
|
+
className: (0, import_classnames.default)("aui-thread-list-item-archive", className),
|
80
|
+
variant: "ghost",
|
81
|
+
tooltip,
|
82
|
+
...props,
|
83
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ArchiveIcon, {})
|
84
|
+
}
|
85
|
+
) });
|
86
|
+
});
|
87
|
+
ThreadListItemArchive.displayName = "ThreadListItemArchive";
|
88
|
+
var exports2 = {
|
89
|
+
Root: ThreadListItemRoot,
|
90
|
+
Title: ThreadListItemTitle,
|
91
|
+
Archive: ThreadListItemArchive
|
92
|
+
};
|
93
|
+
var thread_list_item_default = Object.assign(ThreadListItem, exports2);
|
94
|
+
//# 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 config = useThreadConfig();\n const fallback =\n config.strings?.threadList?.item?.title?.fallback ?? \"New Chat\";\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 = forwardRef<\n HTMLButtonElement,\n Partial<TooltipIconButton.Props>\n>(({ className, ...props }, ref) => {\n const config = useThreadConfig();\n const tooltip =\n config.strings?.threadList?.item?.archive?.tooltip ?? \"Archive thread\";\n\n return (\n <ThreadListItemPrimitive.Archive asChild>\n <TooltipIconButton\n ref={ref}\n className={classNames(\"aui-thread-list-item-archive\", className)}\n variant=\"ghost\"\n tooltip={tooltip}\n {...props}\n >\n <ArchiveIcon />\n </TooltipIconButton>\n </ThreadListItemPrimitive.Archive>\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,aAAS,sCAAgB;AAC/B,QAAM,WACJ,OAAO,SAAS,YAAY,MAAM,OAAO,YAAY;AAEvD,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,yBAG5B,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAAQ;AAClC,QAAM,aAAS,sCAAgB;AAC/B,QAAM,UACJ,OAAO,SAAS,YAAY,MAAM,SAAS,WAAW;AAExD,SACE,4CAAC,0CAAwB,SAAxB,EAAgC,SAAO,MACtC;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,eAAW,kBAAAA,SAAW,gCAAgC,SAAS;AAAA,MAC/D,SAAQ;AAAA,MACR;AAAA,MACC,GAAG;AAAA,MAEJ,sDAAC,mCAAY;AAAA;AAAA,EACf,GACF;AAEJ,CAAC;AAED,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,64 @@
|
|
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 config = useThreadConfig();
|
27
|
+
const fallback = config.strings?.threadList?.item?.title?.fallback ?? "New Chat";
|
28
|
+
return /* @__PURE__ */ jsx(
|
29
|
+
"p",
|
30
|
+
{
|
31
|
+
ref,
|
32
|
+
className: classNames("aui-thread-list-item-title", className),
|
33
|
+
...props,
|
34
|
+
children: /* @__PURE__ */ jsx(ThreadListItemPrimitive.Title, { fallback })
|
35
|
+
}
|
36
|
+
);
|
37
|
+
});
|
38
|
+
ThreadListItemTitle.displayName = "ThreadListItemTitle";
|
39
|
+
var ThreadListItemArchive = forwardRef(({ className, ...props }, ref) => {
|
40
|
+
const config = useThreadConfig();
|
41
|
+
const tooltip = config.strings?.threadList?.item?.archive?.tooltip ?? "Archive thread";
|
42
|
+
return /* @__PURE__ */ jsx(ThreadListItemPrimitive.Archive, { asChild: true, children: /* @__PURE__ */ jsx(
|
43
|
+
TooltipIconButton,
|
44
|
+
{
|
45
|
+
ref,
|
46
|
+
className: classNames("aui-thread-list-item-archive", className),
|
47
|
+
variant: "ghost",
|
48
|
+
tooltip,
|
49
|
+
...props,
|
50
|
+
children: /* @__PURE__ */ jsx(ArchiveIcon, {})
|
51
|
+
}
|
52
|
+
) });
|
53
|
+
});
|
54
|
+
ThreadListItemArchive.displayName = "ThreadListItemArchive";
|
55
|
+
var exports = {
|
56
|
+
Root: ThreadListItemRoot,
|
57
|
+
Title: ThreadListItemTitle,
|
58
|
+
Archive: ThreadListItemArchive
|
59
|
+
};
|
60
|
+
var thread_list_item_default = Object.assign(ThreadListItem, exports);
|
61
|
+
export {
|
62
|
+
thread_list_item_default as default
|
63
|
+
};
|
64
|
+
//# 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 config = useThreadConfig();\n const fallback =\n config.strings?.threadList?.item?.title?.fallback ?? \"New Chat\";\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 = forwardRef<\n HTMLButtonElement,\n Partial<TooltipIconButton.Props>\n>(({ className, ...props }, ref) => {\n const config = useThreadConfig();\n const tooltip =\n config.strings?.threadList?.item?.archive?.tooltip ?? \"Archive thread\";\n\n return (\n <ThreadListItemPrimitive.Archive asChild>\n <TooltipIconButton\n ref={ref}\n className={classNames(\"aui-thread-list-item-archive\", className)}\n variant=\"ghost\"\n tooltip={tooltip}\n {...props}\n >\n <ArchiveIcon />\n </TooltipIconButton>\n </ThreadListItemPrimitive.Archive>\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;AAEjC,IAAM,wBAAwB,aAAa,wBAAwB,SAAS;AAAA,EAC1E,WAAW;AACb,CAAC;AAOD,IAAM,sBAAsB,WAG1B,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAAQ;AAClC,QAAM,SAAS,gBAAgB;AAC/B,QAAM,WACJ,OAAO,SAAS,YAAY,MAAM,OAAO,YAAY;AAEvD,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAW,WAAW,8BAA8B,SAAS;AAAA,MAC5D,GAAG;AAAA,MAEJ,8BAAC,wBAAwB,OAAxB,EAA8B,UAAoB;AAAA;AAAA,EACrD;AAEJ,CAAC;AAED,oBAAoB,cAAc;AAElC,IAAM,wBAAwB,WAG5B,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAAQ;AAClC,QAAM,SAAS,gBAAgB;AAC/B,QAAM,UACJ,OAAO,SAAS,YAAY,MAAM,SAAS,WAAW;AAExD,SACE,oBAAC,wBAAwB,SAAxB,EAAgC,SAAO,MACtC;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAW,WAAW,gCAAgC,SAAS;AAAA,MAC/D,SAAQ;AAAA,MACR;AAAA,MACC,GAAG;AAAA,MAEJ,8BAAC,eAAY;AAAA;AAAA,EACf,GACF;AAEJ,CAAC;AAED,sBAAsB,cAAc;AAEpC,IAAM,UAAU;AAAA,EACd,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AACX;AAEA,IAAO,2BAAQ,OAAO,OAAO,gBAAgB,OAAO;","names":[]}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { type FC } from "react";
|
2
|
+
import { ThreadListPrimitive } from "../primitives";
|
3
|
+
declare const ThreadList: FC;
|
4
|
+
declare namespace ThreadListItems {
|
5
|
+
type Props = {
|
6
|
+
/**
|
7
|
+
* Optional custom components to override default thread list items
|
8
|
+
*/
|
9
|
+
components?: Partial<ThreadListPrimitive.Items.Props["components"]>;
|
10
|
+
};
|
11
|
+
}
|
12
|
+
declare const ThreadListItems: FC<ThreadListItems.Props>;
|
13
|
+
declare const exports: {
|
14
|
+
Root: import("react").ForwardRefExoticComponent<Partial<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">> & import("react").RefAttributes<HTMLDivElement>>;
|
15
|
+
New: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
16
|
+
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;
|
17
|
+
} & {
|
18
|
+
asChild?: boolean;
|
19
|
+
}, "ref"> & import("class-variance-authority").VariantProps<(props?: ({
|
20
|
+
variant?: "default" | "outline" | "ghost" | null | undefined;
|
21
|
+
size?: "default" | "icon" | null | undefined;
|
22
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & import("react").RefAttributes<HTMLButtonElement>>;
|
23
|
+
Items: FC<ThreadListItems.Props>;
|
24
|
+
};
|
25
|
+
declare const _default: typeof ThreadList & typeof exports;
|
26
|
+
export default _default;
|
27
|
+
//# sourceMappingURL=thread-list.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"thread-list.d.ts","sourceRoot":"","sources":["../../src/ui/thread-list.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAI5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAKpD,QAAA,MAAM,UAAU,EAAE,EAOjB,CAAC;AA8BF,kBAAU,eAAe,CAAC;IACxB,KAAY,KAAK,GAAG;QAClB;;WAEG;QACH,UAAU,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;KACrE,CAAC;CACH;AAED,QAAA,MAAM,eAAe,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,CAS9C,CAAC;AAIF,QAAA,MAAM,OAAO;;;;;;;;;;;CAIZ,CAAC;wBAEmD,OAAO,UAAU,GACpE,OAAO,OAAO;AADhB,wBACiB"}
|
@@ -0,0 +1,91 @@
|
|
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.tsx
|
32
|
+
var thread_list_exports = {};
|
33
|
+
__export(thread_list_exports, {
|
34
|
+
default: () => thread_list_default
|
35
|
+
});
|
36
|
+
module.exports = __toCommonJS(thread_list_exports);
|
37
|
+
var import_react = require("react");
|
38
|
+
var import_lucide_react = require("lucide-react");
|
39
|
+
var import_withDefaults = require("./utils/withDefaults.js");
|
40
|
+
var import_primitives = require("../primitives/index.js");
|
41
|
+
var import_thread_list_item = __toESM(require("./thread-list-item.js"));
|
42
|
+
var import_thread_config = require("./thread-config.js");
|
43
|
+
var import_base = require("./base/index.js");
|
44
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
45
|
+
var ThreadList = () => {
|
46
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ThreadListRoot, { children: [
|
47
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThreadListNew, {}),
|
48
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThreadListItems, {})
|
49
|
+
] });
|
50
|
+
};
|
51
|
+
var ThreadListRoot = (0, import_withDefaults.withDefaults)("div", {
|
52
|
+
className: "aui-root aui-thread-list-root"
|
53
|
+
});
|
54
|
+
ThreadListRoot.displayName = "ThreadListRoot";
|
55
|
+
var ThreadListNew = (0, import_react.forwardRef)((props, ref) => {
|
56
|
+
const config = (0, import_thread_config.useThreadConfig)();
|
57
|
+
const label = config.strings?.threadList?.new?.label ?? "New Thread";
|
58
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.ThreadListPrimitive.New, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
59
|
+
import_base.Button,
|
60
|
+
{
|
61
|
+
ref,
|
62
|
+
className: "aui-thread-list-new",
|
63
|
+
variant: "ghost",
|
64
|
+
...props,
|
65
|
+
children: [
|
66
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.PlusIcon, {}),
|
67
|
+
label
|
68
|
+
]
|
69
|
+
}
|
70
|
+
) });
|
71
|
+
});
|
72
|
+
ThreadListNew.displayName = "ThreadListNew";
|
73
|
+
var ThreadListItems = ({ components }) => {
|
74
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
75
|
+
import_primitives.ThreadListPrimitive.Items,
|
76
|
+
{
|
77
|
+
components: {
|
78
|
+
...components,
|
79
|
+
ThreadListItem: components?.ThreadListItem ?? import_thread_list_item.default
|
80
|
+
}
|
81
|
+
}
|
82
|
+
);
|
83
|
+
};
|
84
|
+
ThreadListItems.displayName = "ThreadListItems";
|
85
|
+
var exports2 = {
|
86
|
+
Root: ThreadListRoot,
|
87
|
+
New: ThreadListNew,
|
88
|
+
Items: ThreadListItems
|
89
|
+
};
|
90
|
+
var thread_list_default = Object.assign(ThreadList, exports2);
|
91
|
+
//# sourceMappingURL=thread-list.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/ui/thread-list.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, type FC } from \"react\";\nimport { PlusIcon } from \"lucide-react\";\n\nimport { withDefaults } from \"./utils/withDefaults\";\nimport { ThreadListPrimitive } from \"../primitives\";\nimport ThreadListItem from \"./thread-list-item\";\nimport { useThreadConfig } from \"./thread-config\";\nimport { Button, ButtonProps } from \"./base\";\n\nconst ThreadList: FC = () => {\n return (\n <ThreadListRoot>\n <ThreadListNew />\n <ThreadListItems />\n </ThreadListRoot>\n );\n};\n\nconst ThreadListRoot = withDefaults(\"div\", {\n className: \"aui-root aui-thread-list-root\",\n});\nThreadListRoot.displayName = \"ThreadListRoot\";\n\nconst ThreadListNew = forwardRef<\n HTMLButtonElement,\n ThreadListPrimitive.New.Props & ButtonProps\n>((props, ref) => {\n const config = useThreadConfig();\n const label = config.strings?.threadList?.new?.label ?? \"New Thread\";\n\n return (\n <ThreadListPrimitive.New asChild>\n <Button\n ref={ref}\n className=\"aui-thread-list-new\"\n variant=\"ghost\"\n {...props}\n >\n <PlusIcon />\n {label}\n </Button>\n </ThreadListPrimitive.New>\n );\n});\nThreadListNew.displayName = \"ThreadListNew\";\n\nnamespace ThreadListItems {\n export type Props = {\n /**\n * Optional custom components to override default thread list items\n */\n components?: Partial<ThreadListPrimitive.Items.Props[\"components\"]>;\n };\n}\n\nconst ThreadListItems: FC<ThreadListItems.Props> = ({ components }) => {\n return (\n <ThreadListPrimitive.Items\n components={{\n ...components,\n ThreadListItem: components?.ThreadListItem ?? ThreadListItem,\n }}\n />\n );\n};\n\nThreadListItems.displayName = \"ThreadListItems\";\n\nconst exports = {\n Root: ThreadListRoot,\n New: ThreadListNew,\n Items: ThreadListItems,\n};\n\nexport default Object.assign(ThreadList, exports) as typeof ThreadList &\n typeof exports;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAoC;AACpC,0BAAyB;AAEzB,0BAA6B;AAC7B,wBAAoC;AACpC,8BAA2B;AAC3B,2BAAgC;AAChC,kBAAoC;AAIhC;AAFJ,IAAM,aAAiB,MAAM;AAC3B,SACE,6CAAC,kBACC;AAAA,gDAAC,iBAAc;AAAA,IACf,4CAAC,mBAAgB;AAAA,KACnB;AAEJ;AAEA,IAAM,qBAAiB,kCAAa,OAAO;AAAA,EACzC,WAAW;AACb,CAAC;AACD,eAAe,cAAc;AAE7B,IAAM,oBAAgB,yBAGpB,CAAC,OAAO,QAAQ;AAChB,QAAM,aAAS,sCAAgB;AAC/B,QAAM,QAAQ,OAAO,SAAS,YAAY,KAAK,SAAS;AAExD,SACE,4CAAC,sCAAoB,KAApB,EAAwB,SAAO,MAC9B;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAU;AAAA,MACV,SAAQ;AAAA,MACP,GAAG;AAAA,MAEJ;AAAA,oDAAC,gCAAS;AAAA,QACT;AAAA;AAAA;AAAA,EACH,GACF;AAEJ,CAAC;AACD,cAAc,cAAc;AAW5B,IAAM,kBAA6C,CAAC,EAAE,WAAW,MAAM;AACrE,SACE;AAAA,IAAC,sCAAoB;AAAA,IAApB;AAAA,MACC,YAAY;AAAA,QACV,GAAG;AAAA,QACH,gBAAgB,YAAY,kBAAkB,wBAAAA;AAAA,MAChD;AAAA;AAAA,EACF;AAEJ;AAEA,gBAAgB,cAAc;AAE9B,IAAMC,WAAU;AAAA,EACd,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AACT;AAEA,IAAO,sBAAQ,OAAO,OAAO,YAAYA,QAAO;","names":["ThreadListItem","exports"]}
|
@@ -0,0 +1,61 @@
|
|
1
|
+
"use client";
|
2
|
+
|
3
|
+
// src/ui/thread-list.tsx
|
4
|
+
import { forwardRef } from "react";
|
5
|
+
import { PlusIcon } from "lucide-react";
|
6
|
+
import { withDefaults } from "./utils/withDefaults.mjs";
|
7
|
+
import { ThreadListPrimitive } from "../primitives/index.mjs";
|
8
|
+
import ThreadListItem from "./thread-list-item.mjs";
|
9
|
+
import { useThreadConfig } from "./thread-config.mjs";
|
10
|
+
import { Button } from "./base/index.mjs";
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
12
|
+
var ThreadList = () => {
|
13
|
+
return /* @__PURE__ */ jsxs(ThreadListRoot, { children: [
|
14
|
+
/* @__PURE__ */ jsx(ThreadListNew, {}),
|
15
|
+
/* @__PURE__ */ jsx(ThreadListItems, {})
|
16
|
+
] });
|
17
|
+
};
|
18
|
+
var ThreadListRoot = withDefaults("div", {
|
19
|
+
className: "aui-root aui-thread-list-root"
|
20
|
+
});
|
21
|
+
ThreadListRoot.displayName = "ThreadListRoot";
|
22
|
+
var ThreadListNew = forwardRef((props, ref) => {
|
23
|
+
const config = useThreadConfig();
|
24
|
+
const label = config.strings?.threadList?.new?.label ?? "New Thread";
|
25
|
+
return /* @__PURE__ */ jsx(ThreadListPrimitive.New, { asChild: true, children: /* @__PURE__ */ jsxs(
|
26
|
+
Button,
|
27
|
+
{
|
28
|
+
ref,
|
29
|
+
className: "aui-thread-list-new",
|
30
|
+
variant: "ghost",
|
31
|
+
...props,
|
32
|
+
children: [
|
33
|
+
/* @__PURE__ */ jsx(PlusIcon, {}),
|
34
|
+
label
|
35
|
+
]
|
36
|
+
}
|
37
|
+
) });
|
38
|
+
});
|
39
|
+
ThreadListNew.displayName = "ThreadListNew";
|
40
|
+
var ThreadListItems = ({ components }) => {
|
41
|
+
return /* @__PURE__ */ jsx(
|
42
|
+
ThreadListPrimitive.Items,
|
43
|
+
{
|
44
|
+
components: {
|
45
|
+
...components,
|
46
|
+
ThreadListItem: components?.ThreadListItem ?? ThreadListItem
|
47
|
+
}
|
48
|
+
}
|
49
|
+
);
|
50
|
+
};
|
51
|
+
ThreadListItems.displayName = "ThreadListItems";
|
52
|
+
var exports = {
|
53
|
+
Root: ThreadListRoot,
|
54
|
+
New: ThreadListNew,
|
55
|
+
Items: ThreadListItems
|
56
|
+
};
|
57
|
+
var thread_list_default = Object.assign(ThreadList, exports);
|
58
|
+
export {
|
59
|
+
thread_list_default as default
|
60
|
+
};
|
61
|
+
//# sourceMappingURL=thread-list.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/ui/thread-list.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, type FC } from \"react\";\nimport { PlusIcon } from \"lucide-react\";\n\nimport { withDefaults } from \"./utils/withDefaults\";\nimport { ThreadListPrimitive } from \"../primitives\";\nimport ThreadListItem from \"./thread-list-item\";\nimport { useThreadConfig } from \"./thread-config\";\nimport { Button, ButtonProps } from \"./base\";\n\nconst ThreadList: FC = () => {\n return (\n <ThreadListRoot>\n <ThreadListNew />\n <ThreadListItems />\n </ThreadListRoot>\n );\n};\n\nconst ThreadListRoot = withDefaults(\"div\", {\n className: \"aui-root aui-thread-list-root\",\n});\nThreadListRoot.displayName = \"ThreadListRoot\";\n\nconst ThreadListNew = forwardRef<\n HTMLButtonElement,\n ThreadListPrimitive.New.Props & ButtonProps\n>((props, ref) => {\n const config = useThreadConfig();\n const label = config.strings?.threadList?.new?.label ?? \"New Thread\";\n\n return (\n <ThreadListPrimitive.New asChild>\n <Button\n ref={ref}\n className=\"aui-thread-list-new\"\n variant=\"ghost\"\n {...props}\n >\n <PlusIcon />\n {label}\n </Button>\n </ThreadListPrimitive.New>\n );\n});\nThreadListNew.displayName = \"ThreadListNew\";\n\nnamespace ThreadListItems {\n export type Props = {\n /**\n * Optional custom components to override default thread list items\n */\n components?: Partial<ThreadListPrimitive.Items.Props[\"components\"]>;\n };\n}\n\nconst ThreadListItems: FC<ThreadListItems.Props> = ({ components }) => {\n return (\n <ThreadListPrimitive.Items\n components={{\n ...components,\n ThreadListItem: components?.ThreadListItem ?? ThreadListItem,\n }}\n />\n );\n};\n\nThreadListItems.displayName = \"ThreadListItems\";\n\nconst exports = {\n Root: ThreadListRoot,\n New: ThreadListNew,\n Items: ThreadListItems,\n};\n\nexport default Object.assign(ThreadList, exports) as typeof ThreadList &\n typeof exports;\n"],"mappings":";;;AAEA,SAAS,kBAA2B;AACpC,SAAS,gBAAgB;AAEzB,SAAS,oBAAoB;AAC7B,SAAS,2BAA2B;AACpC,OAAO,oBAAoB;AAC3B,SAAS,uBAAuB;AAChC,SAAS,cAA2B;AAIhC,SACE,KADF;AAFJ,IAAM,aAAiB,MAAM;AAC3B,SACE,qBAAC,kBACC;AAAA,wBAAC,iBAAc;AAAA,IACf,oBAAC,mBAAgB;AAAA,KACnB;AAEJ;AAEA,IAAM,iBAAiB,aAAa,OAAO;AAAA,EACzC,WAAW;AACb,CAAC;AACD,eAAe,cAAc;AAE7B,IAAM,gBAAgB,WAGpB,CAAC,OAAO,QAAQ;AAChB,QAAM,SAAS,gBAAgB;AAC/B,QAAM,QAAQ,OAAO,SAAS,YAAY,KAAK,SAAS;AAExD,SACE,oBAAC,oBAAoB,KAApB,EAAwB,SAAO,MAC9B;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAU;AAAA,MACV,SAAQ;AAAA,MACP,GAAG;AAAA,MAEJ;AAAA,4BAAC,YAAS;AAAA,QACT;AAAA;AAAA;AAAA,EACH,GACF;AAEJ,CAAC;AACD,cAAc,cAAc;AAW5B,IAAM,kBAA6C,CAAC,EAAE,WAAW,MAAM;AACrE,SACE;AAAA,IAAC,oBAAoB;AAAA,IAApB;AAAA,MACC,YAAY;AAAA,QACV,GAAG;AAAA,QACH,gBAAgB,YAAY,kBAAkB;AAAA,MAChD;AAAA;AAAA,EACF;AAEJ;AAEA,gBAAgB,cAAc;AAE9B,IAAM,UAAU;AAAA,EACd,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AACT;AAEA,IAAO,sBAAQ,OAAO,OAAO,YAAY,OAAO;","names":[]}
|
@@ -25,11 +25,11 @@ __export(thread_welcome_exports, {
|
|
25
25
|
});
|
26
26
|
module.exports = __toCommonJS(thread_welcome_exports);
|
27
27
|
var import_react = require("react");
|
28
|
-
var import_withDefaults = require("./utils/withDefaults.
|
29
|
-
var import_avatar = require("./base/avatar.
|
30
|
-
var import_thread_config = require("./thread-config.
|
31
|
-
var import_primitives = require("../primitives/index.
|
32
|
-
var import_context = require("../context/index.
|
28
|
+
var import_withDefaults = require("./utils/withDefaults.js");
|
29
|
+
var import_avatar = require("./base/avatar.js");
|
30
|
+
var import_thread_config = require("./thread-config.js");
|
31
|
+
var import_primitives = require("../primitives/index.js");
|
32
|
+
var import_context = require("../context/index.js");
|
33
33
|
var import_jsx_runtime = require("react/jsx-runtime");
|
34
34
|
var ThreadWelcome = () => {
|
35
35
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ThreadWelcomeRoot, { children: [
|
package/dist/ui/thread.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { type FC } from "react";
|
2
|
-
import {
|
2
|
+
import { TooltipIconButton } from "./base/tooltip-icon-button";
|
3
3
|
import { ThreadConfig } from "./thread-config";
|
4
4
|
import { ThreadPrimitive } from "../primitives";
|
5
5
|
declare const Thread: FC<ThreadConfig>;
|
@@ -23,7 +23,7 @@ declare const exports: {
|
|
23
23
|
components?: Partial<ThreadPrimitive.Messages.Props["components"]>;
|
24
24
|
}>;
|
25
25
|
FollowupSuggestions: FC;
|
26
|
-
ScrollToBottom: import("react").ForwardRefExoticComponent<Partial<
|
26
|
+
ScrollToBottom: import("react").ForwardRefExoticComponent<Partial<TooltipIconButton.Props> & import("react").RefAttributes<HTMLButtonElement>>;
|
27
27
|
ViewportFooter: import("react").ForwardRefExoticComponent<Partial<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">> & import("react").RefAttributes<HTMLDivElement>>;
|
28
28
|
};
|
29
29
|
declare const _default: typeof Thread & typeof exports;
|
package/dist/ui/thread.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"thread.d.ts","sourceRoot":"","sources":["../../src/ui/thread.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAM5C,OAAO,
|
1
|
+
{"version":3,"file":"thread.d.ts","sourceRoot":"","sources":["../../src/ui/thread.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAM5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAI/D,OAAO,EACL,YAAY,EAIb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGhD,QAAA,MAAM,MAAM,EAAE,EAAE,CAAC,YAAY,CAqB5B,CAAC;AAiHF,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;+BA7EY,OAAO;qBACjB,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;;;;;CAmFnE,CAAC;wBAE+C,OAAO,MAAM,GAAG,OAAO,OAAO;AAA/E,wBAAgF"}
|
package/dist/ui/thread.js
CHANGED
@@ -36,16 +36,16 @@ __export(thread_exports, {
|
|
36
36
|
module.exports = __toCommonJS(thread_exports);
|
37
37
|
var import_react = require("react");
|
38
38
|
var import_lucide_react = require("lucide-react");
|
39
|
-
var import_withDefaults = require("./utils/withDefaults.
|
40
|
-
var import_composer = __toESM(require("./composer.
|
41
|
-
var import_thread_welcome = __toESM(require("./thread-welcome.
|
42
|
-
var import_tooltip_icon_button = require("./base/tooltip-icon-button.
|
43
|
-
var import_assistant_message = __toESM(require("./assistant-message.
|
44
|
-
var import_user_message = __toESM(require("./user-message.
|
45
|
-
var import_edit_composer = __toESM(require("./edit-composer.
|
46
|
-
var import_thread_config = require("./thread-config.
|
47
|
-
var import_primitives = require("../primitives/index.
|
48
|
-
var import_context = require("../context/index.
|
39
|
+
var import_withDefaults = require("./utils/withDefaults.js");
|
40
|
+
var import_composer = __toESM(require("./composer.js"));
|
41
|
+
var import_thread_welcome = __toESM(require("./thread-welcome.js"));
|
42
|
+
var import_tooltip_icon_button = require("./base/tooltip-icon-button.js");
|
43
|
+
var import_assistant_message = __toESM(require("./assistant-message.js"));
|
44
|
+
var import_user_message = __toESM(require("./user-message.js"));
|
45
|
+
var import_edit_composer = __toESM(require("./edit-composer.js"));
|
46
|
+
var import_thread_config = require("./thread-config.js");
|
47
|
+
var import_primitives = require("../primitives/index.js");
|
48
|
+
var import_context = require("../context/index.js");
|
49
49
|
var import_jsx_runtime = require("react/jsx-runtime");
|
50
50
|
var Thread = (config) => {
|
51
51
|
const {
|
package/dist/ui/thread.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/ui/thread.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, type FC } from \"react\";\nimport { ArrowDownIcon } from \"lucide-react\";\n\nimport { withDefaults } from \"./utils/withDefaults\";\nimport Composer from \"./composer\";\nimport ThreadWelcome from \"./thread-welcome\";\nimport {
|
1
|
+
{"version":3,"sources":["../../src/ui/thread.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, type FC } from \"react\";\nimport { ArrowDownIcon } from \"lucide-react\";\n\nimport { withDefaults } from \"./utils/withDefaults\";\nimport Composer from \"./composer\";\nimport ThreadWelcome from \"./thread-welcome\";\nimport { TooltipIconButton } from \"./base/tooltip-icon-button\";\nimport AssistantMessage from \"./assistant-message\";\nimport UserMessage from \"./user-message\";\nimport EditComposer from \"./edit-composer\";\nimport {\n ThreadConfig,\n ThreadConfigProvider,\n ThreadConfigProviderProps,\n useThreadConfig,\n} from \"./thread-config\";\nimport { ThreadPrimitive } from \"../primitives\";\nimport { useThread } from \"../context\";\n\nconst Thread: FC<ThreadConfig> = (config) => {\n const {\n components: {\n Composer: ComposerComponent = Composer,\n ThreadWelcome: ThreadWelcomeComponent = ThreadWelcome,\n ...messageComponents\n } = {},\n } = config;\n return (\n <ThreadRoot config={config}>\n <ThreadViewport>\n <ThreadWelcomeComponent />\n <ThreadMessages components={messageComponents} />\n <ThreadFollowupSuggestions />\n <ThreadViewportFooter>\n <ThreadScrollToBottom />\n <ComposerComponent />\n </ThreadViewportFooter>\n </ThreadViewport>\n </ThreadRoot>\n );\n};\n\nnamespace ThreadRoot {\n export type Element = HTMLDivElement;\n export type Props = ThreadPrimitive.Root.Props & ThreadConfigProviderProps;\n}\n\nconst ThreadRootStyled = withDefaults(ThreadPrimitive.Root, {\n className: \"aui-root aui-thread-root\",\n});\n\nconst ThreadRoot = forwardRef<ThreadRoot.Element, ThreadRoot.Props>(\n ({ config, ...props }, ref) => {\n return (\n <ThreadConfigProvider config={config}>\n <ThreadRootStyled {...props} ref={ref} />\n </ThreadConfigProvider>\n );\n },\n);\n\nThreadRoot.displayName = \"ThreadRoot\";\n\nconst ThreadViewport = withDefaults(ThreadPrimitive.Viewport, {\n className: \"aui-thread-viewport\",\n});\n\nThreadViewport.displayName = \"ThreadViewport\";\n\nconst ThreadViewportFooter = withDefaults(\"div\", {\n className: \"aui-thread-viewport-footer\",\n});\n\nThreadViewportFooter.displayName = \"ThreadViewportFooter\";\n\nconst ThreadMessages: FC<{\n unstable_flexGrowDiv?: boolean;\n components?: Partial<ThreadPrimitive.Messages.Props[\"components\"]>;\n}> = ({ components, unstable_flexGrowDiv: flexGrowDiv = true, ...rest }) => {\n return (\n <>\n <ThreadPrimitive.Messages\n components={{\n ...components,\n UserMessage: components?.UserMessage ?? UserMessage,\n AssistantMessage: components?.AssistantMessage ?? AssistantMessage,\n EditComposer: components?.EditComposer ?? EditComposer,\n }}\n {...rest}\n />\n {flexGrowDiv && (\n <ThreadPrimitive.If empty={false}>\n <div style={{ flexGrow: 1 }} />\n </ThreadPrimitive.If>\n )}\n </>\n );\n};\n\nThreadMessages.displayName = \"ThreadMessages\";\n\nconst ThreadFollowupSuggestions: FC = () => {\n const suggestions = useThread((t) => t.suggestions);\n\n return (\n <ThreadPrimitive.If empty={false} running={false}>\n <div className=\"aui-thread-followup-suggestions\">\n {suggestions?.map((suggestion, idx) => (\n <ThreadPrimitive.Suggestion\n key={idx}\n className=\"aui-thread-followup-suggestion\"\n prompt={suggestion.prompt}\n method=\"replace\"\n autoSend\n >\n {suggestion.prompt}\n </ThreadPrimitive.Suggestion>\n ))}\n </div>\n </ThreadPrimitive.If>\n );\n};\n\nconst ThreadScrollToBottomIconButton = withDefaults(TooltipIconButton, {\n variant: \"outline\",\n className: \"aui-thread-scroll-to-bottom\",\n});\n\nnamespace ThreadScrollToBottom {\n export type Element = HTMLButtonElement;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst ThreadScrollToBottom = forwardRef<\n ThreadScrollToBottom.Element,\n ThreadScrollToBottom.Props\n>((props, ref) => {\n const {\n strings: {\n thread: { scrollToBottom: { tooltip = \"Scroll to bottom\" } = {} } = {},\n } = {},\n } = useThreadConfig();\n return (\n <ThreadPrimitive.ScrollToBottom asChild>\n <ThreadScrollToBottomIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <ArrowDownIcon />}\n </ThreadScrollToBottomIconButton>\n </ThreadPrimitive.ScrollToBottom>\n );\n});\n\nThreadScrollToBottom.displayName = \"ThreadScrollToBottom\";\n\nconst exports = {\n Root: ThreadRoot,\n Viewport: ThreadViewport,\n Messages: ThreadMessages,\n FollowupSuggestions: ThreadFollowupSuggestions,\n ScrollToBottom: ThreadScrollToBottom,\n ViewportFooter: ThreadViewportFooter,\n};\n\nexport default Object.assign(Thread, exports) as typeof Thread & typeof exports;\n"],"mappings":"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","names":["Composer","ThreadWelcome","UserMessage","AssistantMessage","EditComposer","exports"]}
|
package/dist/ui/thread.mjs
CHANGED
@@ -6,9 +6,7 @@ import { ArrowDownIcon } from "lucide-react";
|
|
6
6
|
import { withDefaults } from "./utils/withDefaults.mjs";
|
7
7
|
import Composer from "./composer.mjs";
|
8
8
|
import ThreadWelcome from "./thread-welcome.mjs";
|
9
|
-
import {
|
10
|
-
TooltipIconButton
|
11
|
-
} from "./base/tooltip-icon-button.mjs";
|
9
|
+
import { TooltipIconButton } from "./base/tooltip-icon-button.mjs";
|
12
10
|
import AssistantMessage from "./assistant-message.mjs";
|
13
11
|
import UserMessage from "./user-message.mjs";
|
14
12
|
import EditComposer from "./edit-composer.mjs";
|
package/dist/ui/thread.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/ui/thread.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, type FC } from \"react\";\nimport { ArrowDownIcon } from \"lucide-react\";\n\nimport { withDefaults } from \"./utils/withDefaults\";\nimport Composer from \"./composer\";\nimport ThreadWelcome from \"./thread-welcome\";\nimport {
|
1
|
+
{"version":3,"sources":["../../src/ui/thread.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, type FC } from \"react\";\nimport { ArrowDownIcon } from \"lucide-react\";\n\nimport { withDefaults } from \"./utils/withDefaults\";\nimport Composer from \"./composer\";\nimport ThreadWelcome from \"./thread-welcome\";\nimport { TooltipIconButton } from \"./base/tooltip-icon-button\";\nimport AssistantMessage from \"./assistant-message\";\nimport UserMessage from \"./user-message\";\nimport EditComposer from \"./edit-composer\";\nimport {\n ThreadConfig,\n ThreadConfigProvider,\n ThreadConfigProviderProps,\n useThreadConfig,\n} from \"./thread-config\";\nimport { ThreadPrimitive } from \"../primitives\";\nimport { useThread } from \"../context\";\n\nconst Thread: FC<ThreadConfig> = (config) => {\n const {\n components: {\n Composer: ComposerComponent = Composer,\n ThreadWelcome: ThreadWelcomeComponent = ThreadWelcome,\n ...messageComponents\n } = {},\n } = config;\n return (\n <ThreadRoot config={config}>\n <ThreadViewport>\n <ThreadWelcomeComponent />\n <ThreadMessages components={messageComponents} />\n <ThreadFollowupSuggestions />\n <ThreadViewportFooter>\n <ThreadScrollToBottom />\n <ComposerComponent />\n </ThreadViewportFooter>\n </ThreadViewport>\n </ThreadRoot>\n );\n};\n\nnamespace ThreadRoot {\n export type Element = HTMLDivElement;\n export type Props = ThreadPrimitive.Root.Props & ThreadConfigProviderProps;\n}\n\nconst ThreadRootStyled = withDefaults(ThreadPrimitive.Root, {\n className: \"aui-root aui-thread-root\",\n});\n\nconst ThreadRoot = forwardRef<ThreadRoot.Element, ThreadRoot.Props>(\n ({ config, ...props }, ref) => {\n return (\n <ThreadConfigProvider config={config}>\n <ThreadRootStyled {...props} ref={ref} />\n </ThreadConfigProvider>\n );\n },\n);\n\nThreadRoot.displayName = \"ThreadRoot\";\n\nconst ThreadViewport = withDefaults(ThreadPrimitive.Viewport, {\n className: \"aui-thread-viewport\",\n});\n\nThreadViewport.displayName = \"ThreadViewport\";\n\nconst ThreadViewportFooter = withDefaults(\"div\", {\n className: \"aui-thread-viewport-footer\",\n});\n\nThreadViewportFooter.displayName = \"ThreadViewportFooter\";\n\nconst ThreadMessages: FC<{\n unstable_flexGrowDiv?: boolean;\n components?: Partial<ThreadPrimitive.Messages.Props[\"components\"]>;\n}> = ({ components, unstable_flexGrowDiv: flexGrowDiv = true, ...rest }) => {\n return (\n <>\n <ThreadPrimitive.Messages\n components={{\n ...components,\n UserMessage: components?.UserMessage ?? UserMessage,\n AssistantMessage: components?.AssistantMessage ?? AssistantMessage,\n EditComposer: components?.EditComposer ?? EditComposer,\n }}\n {...rest}\n />\n {flexGrowDiv && (\n <ThreadPrimitive.If empty={false}>\n <div style={{ flexGrow: 1 }} />\n </ThreadPrimitive.If>\n )}\n </>\n );\n};\n\nThreadMessages.displayName = \"ThreadMessages\";\n\nconst ThreadFollowupSuggestions: FC = () => {\n const suggestions = useThread((t) => t.suggestions);\n\n return (\n <ThreadPrimitive.If empty={false} running={false}>\n <div className=\"aui-thread-followup-suggestions\">\n {suggestions?.map((suggestion, idx) => (\n <ThreadPrimitive.Suggestion\n key={idx}\n className=\"aui-thread-followup-suggestion\"\n prompt={suggestion.prompt}\n method=\"replace\"\n autoSend\n >\n {suggestion.prompt}\n </ThreadPrimitive.Suggestion>\n ))}\n </div>\n </ThreadPrimitive.If>\n );\n};\n\nconst ThreadScrollToBottomIconButton = withDefaults(TooltipIconButton, {\n variant: \"outline\",\n className: \"aui-thread-scroll-to-bottom\",\n});\n\nnamespace ThreadScrollToBottom {\n export type Element = HTMLButtonElement;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst ThreadScrollToBottom = forwardRef<\n ThreadScrollToBottom.Element,\n ThreadScrollToBottom.Props\n>((props, ref) => {\n const {\n strings: {\n thread: { scrollToBottom: { tooltip = \"Scroll to bottom\" } = {} } = {},\n } = {},\n } = useThreadConfig();\n return (\n <ThreadPrimitive.ScrollToBottom asChild>\n <ThreadScrollToBottomIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <ArrowDownIcon />}\n </ThreadScrollToBottomIconButton>\n </ThreadPrimitive.ScrollToBottom>\n );\n});\n\nThreadScrollToBottom.displayName = \"ThreadScrollToBottom\";\n\nconst exports = {\n Root: ThreadRoot,\n Viewport: ThreadViewport,\n Messages: ThreadMessages,\n FollowupSuggestions: ThreadFollowupSuggestions,\n ScrollToBottom: ThreadScrollToBottom,\n ViewportFooter: ThreadViewportFooter,\n};\n\nexport default Object.assign(Thread, exports) as typeof Thread & typeof exports;\n"],"mappings":"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","names":[]}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { type FC } from "react";
|
2
|
-
import {
|
2
|
+
import { TooltipIconButton } from "./base/tooltip-icon-button";
|
3
3
|
declare const UserActionBar: FC;
|
4
4
|
declare const exports: {
|
5
5
|
Root: import("react").ForwardRefExoticComponent<Partial<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
@@ -7,7 +7,7 @@ declare const exports: {
|
|
7
7
|
} & {
|
8
8
|
asChild?: boolean;
|
9
9
|
}, "ref"> & import("../primitives/actionBar/useActionBarFloatStatus").UseActionBarFloatStatusProps & import("react").RefAttributes<HTMLDivElement>, "ref">> & import("react").RefAttributes<HTMLDivElement>>;
|
10
|
-
Edit: import("react").ForwardRefExoticComponent<Partial<
|
10
|
+
Edit: import("react").ForwardRefExoticComponent<Partial<TooltipIconButton.Props> & import("react").RefAttributes<HTMLButtonElement>>;
|
11
11
|
};
|
12
12
|
declare const _default: typeof UserActionBar & typeof exports;
|
13
13
|
export default _default;
|