@carbon/ai-chat 0.4.0-rc.2 → 0.4.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/aiChatEntry.js +220 -14
- package/dist/es/chat.AppContainer.js +6491 -0
- package/dist/es/chat.AppState.js +40 -0
- package/dist/es/{chat/shared/components/BasePanelComponent.js → chat.BasePanelComponent.js} +3 -3
- package/dist/es/{chat/shared/components/panels/BodyAndFooterPanelComponent.js → chat.BodyAndFooterPanelComponent.js} +92 -9
- package/dist/es/chat.BodyWithFooterComponent.js +140 -0
- package/dist/es/{chat/shared/components/header/BotHeader.js → chat.BotHeader.js} +7 -9
- package/dist/es/{chat/shared/components/responseTypes/carousel/Carousel.js → chat.Carousel.js} +3 -3
- package/dist/es/chat.CatastrophicError.js +381 -0
- package/dist/es/chat.Chat.js +2009 -0
- package/dist/es/chat.Disclaimer.js +553 -0
- package/dist/es/chat.Header.js +1025 -0
- package/dist/es/{chat/shared/components/util/HideComponent.js → chat.HideComponent.js} +9 -2
- package/dist/es/{types/config/HomeScreenConfig.js → chat.HomeScreenConfig.js} +1 -1
- package/dist/es/{chat/shared/components/homeScreen/HomeScreen.js → chat.HomeScreenContainer.js} +159 -14
- package/dist/es/{chat/shared/components/homeScreen/HomeScreenHeader.js → chat.HomeScreenHeader.js} +3 -3
- package/dist/es/{chat/shared/services/haa/HumanAgentServiceImpl.js → chat.HumanAgentServiceImpl.js} +215 -17
- package/dist/es/{chat/shared/components/responseTypes/iframe/IFrameComponent.js → chat.IFrameComponent.js} +4 -8
- package/dist/es/chat.IFramePanel.js +151 -0
- package/dist/es/{chat/shared/components/input/Input.js → chat.Input.js} +214 -18
- package/dist/es/{types/config/ServiceDeskConfig.js → chat.LocalMessageItem.js} +17 -1
- package/dist/es/chat.MessageTypeComponent.js +3580 -0
- package/dist/es/{types/messaging/Messages.js → chat.Messages.js} +1 -1
- package/dist/es/chat.MountChildrenOnDelay.js +97 -0
- package/dist/es/{chat/shared/components/OverlayPanel.js → chat.PageObjectId.js} +70 -4
- package/dist/es/{chat/web-components/components/markdownText/src/markdownText.scss.js → chat.RichText.js} +347 -1
- package/dist/es/chat.TourContainer.js +524 -0
- package/dist/es/{chat/languages/en.json.js → chat.VideoComponent.js} +561 -1
- package/dist/es/chat.ViewSourcePanel.js +187 -0
- package/dist/es/{chat/shared/store/actions.js → chat.actions.js} +2 -2
- package/dist/es/{chat/shared/utils/browserUtils.js → chat.browserUtils.js} +1 -1
- package/dist/es/{types/utilities/carbonTypes.js → chat.carbonTypes.js} +2 -2
- package/dist/es/{chat/web-components/components/codeElement/src/codeElement.scss.js → chat.cds-aichat-code.js} +64 -1
- package/dist/es/{chat/shared/utils/constants.js → chat.constants.js} +4 -7
- package/dist/es/{types/events/eventBusTypes.js → chat.customElement.js} +32 -1
- package/dist/es/chat.dynamic-imports.js +192 -0
- package/dist/es/{chat/shared/utils/htmlUtils.js → chat.htmlUtils.js} +16 -2
- package/dist/es/{chat/shared/utils/messageUtils.js → chat.messageUtils.js} +54 -7
- package/dist/es/{chat/shared/utils/miscUtils.js → chat.miscUtils.js} +24 -5
- package/dist/es/chat.resolvablePromise.js +315 -0
- package/dist/es/{chat/shared/store/selectors.js → chat.selectors.js} +1 -1
- package/dist/es/{chat/shared/utils/lang/stringUtils.js → chat.stringUtils.js} +2 -2
- package/dist/es/{chat/shared/hooks/useCounter.js → chat.useCounter.js} +1 -1
- package/dist/es/{chat/shared/hooks/useOnMount.js → chat.useOnMount.js} +1 -1
- package/dist/es/{chat/shared/utils/domUtils.js → chat.usePrevious.js} +47 -1
- package/dist/es/{chat/shared/utils/lang/UUIDType.js → chat.uuid.js} +15 -3
- package/dist/es/web-components/cds-aichat-container/index.js +73 -4
- package/dist/es/web-components/cds-aichat-custom-element/index.js +1 -3
- package/package.json +2 -2
- package/dist/es/chat/dynamic-imports/dynamic-imports.js +0 -96
- package/dist/es/chat/react/components/AppContainer.js +0 -197
- package/dist/es/chat/react/components/UserDefinedResponsePortalsContainer.js +0 -31
- package/dist/es/chat/react/components/WriteableElementsPortalsContainer.js +0 -28
- package/dist/es/chat/react/components/chainOfThought/ChainOfThought.js +0 -20
- package/dist/es/chat/react/components/chatHeader/ChatHeaderAvatar.js +0 -20
- package/dist/es/chat/react/components/chatHeader/ChatHeaderLink.js +0 -22
- package/dist/es/chat/react/components/chatHeader/ChatHeaderMenu.js +0 -27
- package/dist/es/chat/react/components/chatHeader/ChatHeaderMenuButton.js +0 -60
- package/dist/es/chat/react/components/chatHeader/ChatHeaderMenuItem.js +0 -24
- package/dist/es/chat/react/components/chatHeader/ChatHeaderMenuItemRadioGroup.js +0 -28
- package/dist/es/chat/react/components/chatHeader/ChatHeaderOverflowMenu.js +0 -69
- package/dist/es/chat/react/components/chatHeader/ChatHeaderTitle.js +0 -22
- package/dist/es/chat/react/components/feedback/FeedbackButtonsComponent.js +0 -20
- package/dist/es/chat/react/components/feedback/FeedbackComponent.js +0 -20
- package/dist/es/chat/react/components/inlineLoading/InlineLoadingComponent.js +0 -20
- package/dist/es/chat/react/components/markdownText/MarkdownText.js +0 -20
- package/dist/es/chat/react/components/stopStreamingButton/StopStreamingButton.js +0 -20
- package/dist/es/chat/react/components/table/Table.js +0 -20
- package/dist/es/chat/shared/Chat.js +0 -115
- package/dist/es/chat/shared/ChatInstanceImpl.js +0 -360
- package/dist/es/chat/shared/chatEntryFunctions.js +0 -46
- package/dist/es/chat/shared/components/Avatar.js +0 -286
- package/dist/es/chat/shared/components/BodyWithFooterComponent.js +0 -56
- package/dist/es/chat/shared/components/CatastrophicError.js +0 -77
- package/dist/es/chat/shared/components/Chat.js +0 -244
- package/dist/es/chat/shared/components/ChatBubbleDark.js +0 -124
- package/dist/es/chat/shared/components/ChatBubbleLight.js +0 -216
- package/dist/es/chat/shared/components/Disclaimer.js +0 -86
- package/dist/es/chat/shared/components/ErrorIcon.js +0 -20
- package/dist/es/chat/shared/components/ErrorMessageDark.js +0 -89
- package/dist/es/chat/shared/components/ErrorMessageLight.js +0 -135
- package/dist/es/chat/shared/components/HydrationPanel.js +0 -58
- package/dist/es/chat/shared/components/LatestWelcomeNodes.js +0 -26
- package/dist/es/chat/shared/components/ResponseStopped.js +0 -19
- package/dist/es/chat/shared/components/SkeletonPicker.js +0 -32
- package/dist/es/chat/shared/components/WriteableElement.js +0 -22
- package/dist/es/chat/shared/components/agent/AgentAvatar.js +0 -54
- package/dist/es/chat/shared/components/agent/AgentBanner.js +0 -109
- package/dist/es/chat/shared/components/agent/AgentBannerContainer.js +0 -28
- package/dist/es/chat/shared/components/agent/AvailabilityMessage.js +0 -49
- package/dist/es/chat/shared/components/aria/AriaAnnouncerComponent.js +0 -122
- package/dist/es/chat/shared/components/aria/AriaAnnouncerProvider.js +0 -48
- package/dist/es/chat/shared/components/aria/AriaLiveMessage.js +0 -22
- package/dist/es/chat/shared/components/header/AISlug.js +0 -22
- package/dist/es/chat/shared/components/header/Header.js +0 -460
- package/dist/es/chat/shared/components/header/SimpleHeader.js +0 -27
- package/dist/es/chat/shared/components/homeScreen/HomeScreenContainer.js +0 -68
- package/dist/es/chat/shared/components/launcher/Launcher.js +0 -88
- package/dist/es/chat/shared/components/launcher/LauncherComplex.js +0 -63
- package/dist/es/chat/shared/components/launcher/LauncherContainer.js +0 -73
- package/dist/es/chat/shared/components/launcher/LauncherDesktopContainer.js +0 -221
- package/dist/es/chat/shared/components/launcher/LauncherExtended.js +0 -244
- package/dist/es/chat/shared/components/launcher/LauncherMobileContainer.js +0 -175
- package/dist/es/chat/shared/components/launcher/launcherUtils.js +0 -16
- package/dist/es/chat/shared/components/modals/ConfirmModal.js +0 -67
- package/dist/es/chat/shared/components/modals/EndAgentChatModal.js +0 -46
- package/dist/es/chat/shared/components/modals/RequestScreenShareModal.js +0 -43
- package/dist/es/chat/shared/components/notifications/Notifications.js +0 -58
- package/dist/es/chat/shared/components/panels/CustomPanel.js +0 -136
- package/dist/es/chat/shared/components/responseTypes/agent/ConnectToAgent.js +0 -30
- package/dist/es/chat/shared/components/responseTypes/agent/RealConnectToAgent.js +0 -102
- package/dist/es/chat/shared/components/responseTypes/audio/AudioComponent.js +0 -26
- package/dist/es/chat/shared/components/responseTypes/buttonItem/BaseButtonItemComponent.js +0 -69
- package/dist/es/chat/shared/components/responseTypes/buttonItem/ButtonItemComponent.js +0 -48
- package/dist/es/chat/shared/components/responseTypes/buttonItem/ButtonItemCustomEventComponent.js +0 -42
- package/dist/es/chat/shared/components/responseTypes/buttonItem/ButtonItemPostBackComponent.js +0 -54
- package/dist/es/chat/shared/components/responseTypes/buttonItem/ButtonItemShowPanelComponent.js +0 -36
- package/dist/es/chat/shared/components/responseTypes/buttonItem/ButtonItemURLComponent.js +0 -42
- package/dist/es/chat/shared/components/responseTypes/card/CardItemComponent.js +0 -34
- package/dist/es/chat/shared/components/responseTypes/carousel/CarouselItemComponent.js +0 -39
- package/dist/es/chat/shared/components/responseTypes/conversationalSearch/ConversationalSearch.js +0 -92
- package/dist/es/chat/shared/components/responseTypes/conversationalSearch/ConversationalSearchText.js +0 -158
- package/dist/es/chat/shared/components/responseTypes/custom/UserDefinedResponse.js +0 -33
- package/dist/es/chat/shared/components/responseTypes/datePicker/DatePickerComponent.js +0 -176
- package/dist/es/chat/shared/components/responseTypes/error/InlineError.js +0 -32
- package/dist/es/chat/shared/components/responseTypes/grid/GridItemComponent.js +0 -109
- package/dist/es/chat/shared/components/responseTypes/iframe/IFrameMessage.js +0 -32
- package/dist/es/chat/shared/components/responseTypes/iframe/IFramePanel.js +0 -51
- package/dist/es/chat/shared/components/responseTypes/iframe/IFramePreviewCard.js +0 -64
- package/dist/es/chat/shared/components/responseTypes/iframe/InlineIFrame.js +0 -55
- package/dist/es/chat/shared/components/responseTypes/image/Image.js +0 -120
- package/dist/es/chat/shared/components/responseTypes/options/OptionComponent.js +0 -83
- package/dist/es/chat/shared/components/responseTypes/options/SelectComponent.js +0 -84
- package/dist/es/chat/shared/components/responseTypes/table/TableContainer.js +0 -96
- package/dist/es/chat/shared/components/responseTypes/text/TextArea.js +0 -68
- package/dist/es/chat/shared/components/responseTypes/tour/TourCard.js +0 -73
- package/dist/es/chat/shared/components/responseTypes/util/BodyMessageComponents.js +0 -65
- package/dist/es/chat/shared/components/responseTypes/util/ClickableImage.js +0 -36
- package/dist/es/chat/shared/components/responseTypes/util/Description.js +0 -21
- package/dist/es/chat/shared/components/responseTypes/util/FooterButtonComponents.js +0 -36
- package/dist/es/chat/shared/components/responseTypes/util/MediaPlayer.js +0 -157
- package/dist/es/chat/shared/components/responseTypes/util/Metablock.js +0 -27
- package/dist/es/chat/shared/components/responseTypes/util/RichText.js +0 -31
- package/dist/es/chat/shared/components/responseTypes/util/SearchResultBody.js +0 -53
- package/dist/es/chat/shared/components/responseTypes/util/StreamingRichText.js +0 -38
- package/dist/es/chat/shared/components/responseTypes/util/TextHolderTile.js +0 -35
- package/dist/es/chat/shared/components/responseTypes/util/citations/CitationCard.js +0 -65
- package/dist/es/chat/shared/components/responseTypes/util/citations/CitationCardContent.js +0 -62
- package/dist/es/chat/shared/components/responseTypes/util/citations/CitationClickableCard.js +0 -23
- package/dist/es/chat/shared/components/responseTypes/util/citations/ExpandToPanelCard.js +0 -50
- package/dist/es/chat/shared/components/responseTypes/util/citations/ViewSourcePanel.js +0 -57
- package/dist/es/chat/shared/components/responseTypes/video/VideoComponent.js +0 -23
- package/dist/es/chat/shared/components/tour/TourCloseMinimizeComponent.js +0 -44
- package/dist/es/chat/shared/components/tour/TourContainer.js +0 -212
- package/dist/es/chat/shared/components/tour/TourControlsComponent.js +0 -98
- package/dist/es/chat/shared/components/tour/TourStepContentComponent.js +0 -156
- package/dist/es/chat/shared/components/tour/TourStepSkeletonComponent.js +0 -20
- package/dist/es/chat/shared/components/util/AnnounceOnMountComponent.js +0 -42
- package/dist/es/chat/shared/components/util/IconHolder.js +0 -16
- package/dist/es/chat/shared/components/util/ImageWithFallback.js +0 -31
- package/dist/es/chat/shared/components/util/MaybeDangerouslySetInnerHTML.js +0 -42
- package/dist/es/chat/shared/components/util/MountChildrenOnDelay.js +0 -40
- package/dist/es/chat/shared/components/util/VisuallyHidden.js +0 -18
- package/dist/es/chat/shared/containers/App.js +0 -181
- package/dist/es/chat/shared/containers/MessageComponent.js +0 -465
- package/dist/es/chat/shared/containers/MessageTypeComponent.js +0 -496
- package/dist/es/chat/shared/containers/MessagesComponent.js +0 -469
- package/dist/es/chat/shared/containers/ModalPortal.js +0 -53
- package/dist/es/chat/shared/containers/main/MainWindow.js +0 -708
- package/dist/es/chat/shared/contexts/AriaAnnouncerContext.js +0 -12
- package/dist/es/chat/shared/contexts/HideComponentContext.js +0 -12
- package/dist/es/chat/shared/contexts/LanguagePackContext.js +0 -12
- package/dist/es/chat/shared/contexts/ModalPortalRootContext.js +0 -12
- package/dist/es/chat/shared/contexts/ServiceManagerContext.js +0 -12
- package/dist/es/chat/shared/contexts/WindowSizeContext.js +0 -12
- package/dist/es/chat/shared/environmentVariables.js +0 -13
- package/dist/es/chat/shared/events/ChatActionsImpl.js +0 -783
- package/dist/es/chat/shared/events/EventBus.js +0 -161
- package/dist/es/chat/shared/hocs/withAriaAnnouncer.js +0 -25
- package/dist/es/chat/shared/hocs/withServiceManager.js +0 -25
- package/dist/es/chat/shared/hooks/useAriaAnnouncer.js +0 -16
- package/dist/es/chat/shared/hooks/useCSSCustomProperties.js +0 -21
- package/dist/es/chat/shared/hooks/useCallbackOnChange.js +0 -24
- package/dist/es/chat/shared/hooks/useEffectDidUpdate.js +0 -21
- package/dist/es/chat/shared/hooks/useLanguagePack.js +0 -16
- package/dist/es/chat/shared/hooks/usePrevious.js +0 -18
- package/dist/es/chat/shared/hooks/useServiceManager.js +0 -16
- package/dist/es/chat/shared/hooks/useShouldSanitizeHTML.js +0 -15
- package/dist/es/chat/shared/hooks/useUUID.js +0 -22
- package/dist/es/chat/shared/hooks/useWindowSize.js +0 -16
- package/dist/es/chat/shared/loadServices.js +0 -72
- package/dist/es/chat/shared/schema/historyToMessages.js +0 -231
- package/dist/es/chat/shared/schema/inputItemToLocalItem.js +0 -30
- package/dist/es/chat/shared/schema/outputItemToLocalItem.js +0 -124
- package/dist/es/chat/shared/services/CustomPanelInstance.js +0 -26
- package/dist/es/chat/shared/services/CustomPanelManager.js +0 -23
- package/dist/es/chat/shared/services/HistoryService.js +0 -59
- package/dist/es/chat/shared/services/MessageService.js +0 -351
- package/dist/es/chat/shared/services/NamespaceService.js +0 -26
- package/dist/es/chat/shared/services/ServiceManager.js +0 -19
- package/dist/es/chat/shared/services/UserSessionStorageService.js +0 -89
- package/dist/es/chat/shared/services/haa/agentStatusMessage.js +0 -108
- package/dist/es/chat/shared/services/haa/humanAgentUtils.js +0 -114
- package/dist/es/chat/shared/services/mockStorage.js +0 -30
- package/dist/es/chat/shared/store/agentActions.js +0 -125
- package/dist/es/chat/shared/store/agentReducers.js +0 -215
- package/dist/es/chat/shared/store/doCreateStore.js +0 -142
- package/dist/es/chat/shared/store/reducerUtils.js +0 -320
- package/dist/es/chat/shared/store/reducers.js +0 -871
- package/dist/es/chat/shared/store/subscriptions.js +0 -55
- package/dist/es/chat/shared/store/tourReducerUtils.js +0 -51
- package/dist/es/chat/shared/utils/ListenerList.js +0 -26
- package/dist/es/chat/shared/utils/PageObjectId.js +0 -25
- package/dist/es/chat/shared/utils/animationUtils.js +0 -77
- package/dist/es/chat/shared/utils/colors.js +0 -71
- package/dist/es/chat/shared/utils/customizers.js +0 -16
- package/dist/es/chat/shared/utils/dateUtils.js +0 -38
- package/dist/es/chat/shared/utils/homeScreenUtils.js +0 -27
- package/dist/es/chat/shared/utils/intlUtils.js +0 -21
- package/dist/es/chat/shared/utils/lang/arrayUtils.js +0 -53
- package/dist/es/chat/shared/utils/lang/langUtils.js +0 -13
- package/dist/es/chat/shared/utils/lang/objectUtils.js +0 -19
- package/dist/es/chat/shared/utils/lang/promiseUtils.js +0 -25
- package/dist/es/chat/shared/utils/lang/uuid.js +0 -16
- package/dist/es/chat/shared/utils/languages.js +0 -156
- package/dist/es/chat/shared/utils/memoizerUtils.js +0 -38
- package/dist/es/chat/shared/utils/messageServiceUtils.js +0 -36
- package/dist/es/chat/shared/utils/resolvablePromise.js +0 -32
- package/dist/es/chat/shared/utils/styleUtils.js +0 -231
- package/dist/es/chat/shared/utils/timeUtils.js +0 -14
- package/dist/es/chat/shared/utils/viewStateUtils.js +0 -38
- package/dist/es/chat/web-components/components/chainOfThought/cds-aichat-chain-of-thought.js +0 -26
- package/dist/es/chat/web-components/components/chainOfThought/src/ChainOfThoughtElement.js +0 -130
- package/dist/es/chat/web-components/components/chainOfThought/src/chainOfThoughtElement.scss.js +0 -3
- package/dist/es/chat/web-components/components/chainOfThought/src/chainOfThoughtElement.template.js +0 -186
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderAvatar/cds-aichat-chat-header-avatar.js +0 -26
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderAvatar/src/chatHeaderAvatar.template.js +0 -32
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderAvatar/src/chatHeaderAvatarElement.js +0 -52
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderAvatar/src/chatHeaderAvatarElement.scss.js +0 -3
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderLink/cds-aichat-chat-header-link.js +0 -44
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderLink/src/chatHeaderLinkElement.template.js +0 -28
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderTitle/cds-aichat-chat-header-title.js +0 -42
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderTitle/src/chatHeaderTitle.scss.js +0 -3
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderTitle/src/chatHeaderTitle.template.js +0 -20
- package/dist/es/chat/web-components/components/codeElement/cds-aichat-code.js +0 -66
- package/dist/es/chat/web-components/components/feedbackButtonsElement/cds-aichat-feedback-buttons.js +0 -26
- package/dist/es/chat/web-components/components/feedbackButtonsElement/src/FeedbackButtonsElement.js +0 -93
- package/dist/es/chat/web-components/components/feedbackButtonsElement/src/feedbackButtonsElement.scss.js +0 -3
- package/dist/es/chat/web-components/components/feedbackButtonsElement/src/feedbackButtonsElement.template.js +0 -84
- package/dist/es/chat/web-components/components/feedbackElement/cds-aichat-feedback.js +0 -30
- package/dist/es/chat/web-components/components/feedbackElement/src/FeedbackElement.js +0 -157
- package/dist/es/chat/web-components/components/feedbackElement/src/feedbackElement.scss.js +0 -3
- package/dist/es/chat/web-components/components/feedbackElement/src/feedbackElement.template.js +0 -95
- package/dist/es/chat/web-components/components/inlineLoadingElement/cds-aichat-inline-loading.js +0 -85
- package/dist/es/chat/web-components/components/inlineLoadingElement/src/styles.scss.js +0 -3
- package/dist/es/chat/web-components/components/markdownText/cds-aichat-markdown-text.js +0 -32
- package/dist/es/chat/web-components/components/markdownText/markdown/markdownToHTML.js +0 -28
- package/dist/es/chat/web-components/components/markdownText/markdown/utils/renderTokenTree.js +0 -191
- package/dist/es/chat/web-components/components/markdownText/markdown/workers/workerManager.js +0 -16
- package/dist/es/chat/web-components/components/markdownText/src/MarkdownElement.js +0 -70
- package/dist/es/chat/web-components/components/markdownText/src/markdownElement.template.js +0 -19
- package/dist/es/chat/web-components/components/roundedButton/cds-aichat-rounded-button.js +0 -29
- package/dist/es/chat/web-components/components/stopStreamingButton/cds-aichat-stop-streaming-button.js +0 -26
- package/dist/es/chat/web-components/components/stopStreamingButton/src/StopStreamingButtonElement.js +0 -49
- package/dist/es/chat/web-components/components/stopStreamingButton/src/stopStreamingButton.scss.js +0 -3
- package/dist/es/chat/web-components/components/stopStreamingButton/src/stopStreamingButton.template.js +0 -44
- package/dist/es/chat/web-components/components/table/cds-aichat-table.js +0 -229
- package/dist/es/chat/web-components/components/table/src/table.scss.js +0 -3
- package/dist/es/chat/web-components/components/table/src/table.template.js +0 -81
- package/dist/es/chat/web-components/components/table/src/tablePagination.template.js +0 -43
- package/dist/es/chat/web-components/components/table/src/tableSkeleton.template.js +0 -17
- package/dist/es/chat/web-components/components/tagListElement/cds-aichat-tag-list.js +0 -28
- package/dist/es/chat/web-components/components/tagListElement/src/TagListElement.js +0 -70
- package/dist/es/chat/web-components/components/tagListElement/src/tagListElement.scss.js +0 -3
- package/dist/es/chat/web-components/components/tagListElement/src/tagListElement.template.js +0 -40
- package/dist/es/chat/web-components/decorators/customElement.js +0 -33
- package/dist/es/chat/web-components/internal/cds-aichat-internal.js +0 -78
- package/dist/es/chat/web-components/settings.js +0 -13
- package/dist/es/node_modules/@carbon/colors/es/index.js +0 -11
- package/dist/es/react/ChatContainer.js +0 -162
- package/dist/es/react/ChatCustomElement.js +0 -58
- package/dist/es/types/config/ChatHeaderConfig.js +0 -18
- package/dist/es/types/config/CornersType.js +0 -16
- package/dist/es/types/config/LauncherConfig.js +0 -19
- package/dist/es/types/config/PublicConfig.js +0 -36
- package/dist/es/types/instance/ChatInstance.js +0 -31
- package/dist/es/types/instance/apiTypes.js +0 -33
- package/dist/es/types/messaging/LocalMessageItem.js +0 -18
- package/dist/es/types/state/AppState.js +0 -18
- package/dist/es/types/utilities/Animation.js +0 -31
- package/dist/es/types/utilities/HasAddRemoveClassName.js +0 -27
- /package/dist/es/{chat/shared/styles/export.carbon.scss.js → chat.export.carbon.js} +0 -0
- /package/dist/es/{chat/shared/styles/export.scss.js → chat.export.js} +0 -0
- /package/dist/es/{chat/web-components/components/markdownText/markdown/utils/markdown.js → chat.markdown.js} +0 -0
- /package/dist/es/{chat/web-components/components/markdownText/markdown/utils/tokenTree.js → chat.tokenTree.js} +0 -0
package/dist/es/chat/web-components/components/markdownText/markdown/utils/renderTokenTree.js
DELETED
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import DOMPurify from "dompurify";
|
|
2
|
-
|
|
3
|
-
import { html } from "lit";
|
|
4
|
-
|
|
5
|
-
import { repeat } from "lit/directives/repeat.js";
|
|
6
|
-
|
|
7
|
-
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
8
|
-
|
|
9
|
-
/*
|
|
10
|
-
* Copyright IBM Corp. 2025
|
|
11
|
-
*
|
|
12
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
13
|
-
* LICENSE file in the root directory of this source tree.
|
|
14
|
-
*
|
|
15
|
-
* @license
|
|
16
|
-
*/ function renderTokenTree(node, sanitize) {
|
|
17
|
-
const {token: token, children: children} = node;
|
|
18
|
-
if (token.type === "html_block" || token.type === "html_inline") {
|
|
19
|
-
const raw = token.content;
|
|
20
|
-
return html`${unsafeHTML(sanitize ? DOMPurify.sanitize(raw, {
|
|
21
|
-
CUSTOM_ELEMENT_HANDLING: {
|
|
22
|
-
tagNameCheck: () => true,
|
|
23
|
-
attributeNameCheck: () => true,
|
|
24
|
-
allowCustomizedBuiltInElements: true
|
|
25
|
-
}
|
|
26
|
-
}) : raw)}`;
|
|
27
|
-
}
|
|
28
|
-
if (token.type === "text") {
|
|
29
|
-
return html`${token.content}`;
|
|
30
|
-
}
|
|
31
|
-
if (token.type === "code_inline") {
|
|
32
|
-
return html`<code class="WACWidget__MarkdownCode">${token.content}</code>`;
|
|
33
|
-
}
|
|
34
|
-
if (token.type === "fence") {
|
|
35
|
-
import("../../../codeElement/cds-aichat-code.js");
|
|
36
|
-
const language = token.info?.trim() ?? "";
|
|
37
|
-
return html`<cds-aichat-code
|
|
38
|
-
language=${language}
|
|
39
|
-
content=${token.content}
|
|
40
|
-
></cds-aichat-code>`;
|
|
41
|
-
}
|
|
42
|
-
const tag = token.tag || "div";
|
|
43
|
-
const rawAttrs = (token.attrs || []).reduce((acc, [key, value]) => {
|
|
44
|
-
acc[key] = value;
|
|
45
|
-
return acc;
|
|
46
|
-
}, {});
|
|
47
|
-
const attrs = sanitize ? Object.fromEntries(Object.entries(rawAttrs).filter(([key, value]) => {
|
|
48
|
-
const fragment = DOMPurify.sanitize(`<a ${key}="${value}">`, {
|
|
49
|
-
RETURN_DOM: true
|
|
50
|
-
});
|
|
51
|
-
const element = fragment.firstChild;
|
|
52
|
-
return element?.getAttribute(key) !== null;
|
|
53
|
-
})) : rawAttrs;
|
|
54
|
-
const content = html`${repeat(children, c => c.key, c => renderTokenTree(c, sanitize))}`;
|
|
55
|
-
return renderWithStaticTag(tag, token, content, attrs);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function renderWithStaticTag(tag, token, content, attrs) {
|
|
59
|
-
switch (tag) {
|
|
60
|
-
case "p":
|
|
61
|
-
return html`<p class="WACWidget__MarkdownP" ...=${attrs}>${content}</p>`;
|
|
62
|
-
|
|
63
|
-
case "ul":
|
|
64
|
-
{
|
|
65
|
-
const className = `cds--list--unordered${token.level > 1 ? " cds--list--nested" : ""}`;
|
|
66
|
-
return html`<ul class=${className} ...=${attrs}>
|
|
67
|
-
${content}
|
|
68
|
-
</ul>`;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
case "ol":
|
|
72
|
-
{
|
|
73
|
-
const className = `cds--list--ordered${token.level > 1 ? " cds--list--nested" : ""}`;
|
|
74
|
-
return html`<ol class=${className} ...=${attrs}>
|
|
75
|
-
${content}
|
|
76
|
-
</ol>`;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
case "li":
|
|
80
|
-
return html`<li class="cds--list__item" ...=${attrs}>${content}</li>`;
|
|
81
|
-
|
|
82
|
-
case "h1":
|
|
83
|
-
return html`<h1 class="WACWidget__MarkdownHeading" ...=${attrs}>
|
|
84
|
-
${content}
|
|
85
|
-
</h1>`;
|
|
86
|
-
|
|
87
|
-
case "h2":
|
|
88
|
-
return html`<h2 class="WACWidget__MarkdownHeading" ...=${attrs}>
|
|
89
|
-
${content}
|
|
90
|
-
</h2>`;
|
|
91
|
-
|
|
92
|
-
case "h3":
|
|
93
|
-
return html`<h3 class="WACWidget__MarkdownHeading" ...=${attrs}>
|
|
94
|
-
${content}
|
|
95
|
-
</h3>`;
|
|
96
|
-
|
|
97
|
-
case "h4":
|
|
98
|
-
return html`<h4 class="WACWidget__MarkdownHeading" ...=${attrs}>
|
|
99
|
-
${content}
|
|
100
|
-
</h4>`;
|
|
101
|
-
|
|
102
|
-
case "h5":
|
|
103
|
-
return html`<h5 class="WACWidget__MarkdownHeading" ...=${attrs}>
|
|
104
|
-
${content}
|
|
105
|
-
</h5>`;
|
|
106
|
-
|
|
107
|
-
case "h6":
|
|
108
|
-
return html`<h6 class="WACWidget__MarkdownHeading" ...=${attrs}>
|
|
109
|
-
${content}
|
|
110
|
-
</h6>`;
|
|
111
|
-
|
|
112
|
-
case "blockquote":
|
|
113
|
-
return html`<blockquote
|
|
114
|
-
class="WACWidget__MarkdownBlockquote"
|
|
115
|
-
...=${attrs}
|
|
116
|
-
>
|
|
117
|
-
${content}
|
|
118
|
-
</blockquote>`;
|
|
119
|
-
|
|
120
|
-
case "pre":
|
|
121
|
-
return html`<pre class="WACWidget__MarkdownPre" ...=${attrs}>
|
|
122
|
-
${content}</pre
|
|
123
|
-
>`;
|
|
124
|
-
|
|
125
|
-
case "code":
|
|
126
|
-
return html`<code class="WACWidget__MarkdownCode" ...=${attrs}
|
|
127
|
-
>${content}</code
|
|
128
|
-
>`;
|
|
129
|
-
|
|
130
|
-
case "strong":
|
|
131
|
-
return html`<strong ...=${attrs}>${content}</strong>`;
|
|
132
|
-
|
|
133
|
-
case "em":
|
|
134
|
-
return html`<em ...=${attrs}>${content}</em>`;
|
|
135
|
-
|
|
136
|
-
case "del":
|
|
137
|
-
return html`<del ...=${attrs}>${content}</del>`;
|
|
138
|
-
|
|
139
|
-
case "sub":
|
|
140
|
-
return html`<sub ...=${attrs}>${content}</del>`;
|
|
141
|
-
|
|
142
|
-
case "sup":
|
|
143
|
-
return html`<sup ...=${attrs}>${content}</del>`;
|
|
144
|
-
|
|
145
|
-
case "a":
|
|
146
|
-
if (!attrs.target) {
|
|
147
|
-
attrs.target = "_blank";
|
|
148
|
-
}
|
|
149
|
-
return html`<a class="cds--link cds--link-url" ...=${attrs}
|
|
150
|
-
>${content}</a
|
|
151
|
-
>`;
|
|
152
|
-
|
|
153
|
-
case "table":
|
|
154
|
-
{
|
|
155
|
-
const className = "cds--data-table cds--data-table--zebra cds--data-table--md";
|
|
156
|
-
return html`
|
|
157
|
-
<div class="cds--layer-two cds--data-table-content">
|
|
158
|
-
<table class=${className} ...=${attrs}>
|
|
159
|
-
${content}
|
|
160
|
-
</table>
|
|
161
|
-
</div>
|
|
162
|
-
`;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
case "thead":
|
|
166
|
-
return html`<thead ...=${attrs}>
|
|
167
|
-
${content}
|
|
168
|
-
</thead>`;
|
|
169
|
-
|
|
170
|
-
case "tbody":
|
|
171
|
-
return html`<tbody ...=${attrs}>
|
|
172
|
-
${content}
|
|
173
|
-
</tbody>`;
|
|
174
|
-
|
|
175
|
-
case "tr":
|
|
176
|
-
return html`<tr ...=${attrs}>
|
|
177
|
-
${content}
|
|
178
|
-
</tr>`;
|
|
179
|
-
|
|
180
|
-
case "td":
|
|
181
|
-
return html`<td ...=${attrs}>${content}</td>`;
|
|
182
|
-
|
|
183
|
-
case "th":
|
|
184
|
-
return html`<th ...=${attrs}>${content}</th>`;
|
|
185
|
-
|
|
186
|
-
default:
|
|
187
|
-
return html`<div ...=${attrs}>${content}</div>`;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
export { renderTokenTree };
|
package/dist/es/chat/web-components/components/markdownText/markdown/workers/workerManager.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright IBM Corp. 2025
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @license
|
|
8
|
-
*/
|
|
9
|
-
async function getMarkdownWorker(markdown, lastTree) {
|
|
10
|
-
const [{buildTokenTree: buildTokenTree, diffTokenTree: diffTokenTree}, {parseMarkdown: parseMarkdown}] = await Promise.all([ import("../utils/tokenTree.js"), import("../utils/markdown.js") ]);
|
|
11
|
-
const tokens = parseMarkdown(markdown);
|
|
12
|
-
const tree = buildTokenTree(tokens);
|
|
13
|
-
return diffTokenTree(lastTree, tree);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { getMarkdownWorker };
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
|
|
3
|
-
import { LitElement } from "lit";
|
|
4
|
-
|
|
5
|
-
import { property, state } from "lit/decorators.js";
|
|
6
|
-
|
|
7
|
-
import throttle from "lodash-es/throttle.js";
|
|
8
|
-
|
|
9
|
-
import { getMarkdownWorker } from "../markdown/workers/workerManager.js";
|
|
10
|
-
|
|
11
|
-
/*
|
|
12
|
-
* Copyright IBM Corp. 2025
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
15
|
-
* LICENSE file in the root directory of this source tree.
|
|
16
|
-
*
|
|
17
|
-
* @license
|
|
18
|
-
*/ class MarkdownTextElement extends LitElement {
|
|
19
|
-
constructor() {
|
|
20
|
-
super(...arguments);
|
|
21
|
-
this.sanitizeHTML = false;
|
|
22
|
-
this.fullText = "";
|
|
23
|
-
this.tokenTree = {
|
|
24
|
-
key: "root",
|
|
25
|
-
token: {
|
|
26
|
-
type: "root",
|
|
27
|
-
tag: "",
|
|
28
|
-
nesting: 0,
|
|
29
|
-
level: 0,
|
|
30
|
-
content: "",
|
|
31
|
-
attrs: null,
|
|
32
|
-
children: null,
|
|
33
|
-
markup: "",
|
|
34
|
-
block: true,
|
|
35
|
-
hidden: false,
|
|
36
|
-
map: null,
|
|
37
|
-
info: "",
|
|
38
|
-
meta: null
|
|
39
|
-
},
|
|
40
|
-
children: []
|
|
41
|
-
};
|
|
42
|
-
this.scheduleTokenParse = throttle(async () => {
|
|
43
|
-
this.tokenTree = await getMarkdownWorker(this.fullText, this.tokenTree);
|
|
44
|
-
}, 100);
|
|
45
|
-
}
|
|
46
|
-
set markdown(newMarkdown) {
|
|
47
|
-
if (newMarkdown !== this.fullText) {
|
|
48
|
-
this.fullText = newMarkdown;
|
|
49
|
-
this.scheduleTokenParse();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
__decorate([ property({
|
|
55
|
-
type: String
|
|
56
|
-
}) ], MarkdownTextElement.prototype, "markdown", null);
|
|
57
|
-
|
|
58
|
-
__decorate([ property({
|
|
59
|
-
type: Boolean
|
|
60
|
-
}) ], MarkdownTextElement.prototype, "sanitizeHTML", void 0);
|
|
61
|
-
|
|
62
|
-
__decorate([ property({
|
|
63
|
-
type: Boolean,
|
|
64
|
-
attribute: "should-remove-padding",
|
|
65
|
-
reflect: true
|
|
66
|
-
}) ], MarkdownTextElement.prototype, "shouldRemovePadding", void 0);
|
|
67
|
-
|
|
68
|
-
__decorate([ state() ], MarkdownTextElement.prototype, "tokenTree", void 0);
|
|
69
|
-
|
|
70
|
-
export { MarkdownTextElement as default };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { html } from "lit";
|
|
2
|
-
|
|
3
|
-
import { renderTokenTree } from "../markdown/utils/renderTokenTree.js";
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
* Copyright IBM Corp. 2025
|
|
7
|
-
*
|
|
8
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
9
|
-
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*
|
|
11
|
-
* @license
|
|
12
|
-
*/ function markdownTextTemplate(customElementClass) {
|
|
13
|
-
const {tokenTree: tokenTree, sanitizeHTML: sanitizeHTML} = customElementClass;
|
|
14
|
-
return html`<div class="cds-aichat-markdown-text">
|
|
15
|
-
${renderTokenTree(tokenTree, sanitizeHTML)}
|
|
16
|
-
</div>`;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { markdownTextTemplate };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
|
|
3
|
-
import CDSButton from "@carbon/web-components/es-custom/components/button/button.js";
|
|
4
|
-
|
|
5
|
-
import { unsafeCSS, css } from "lit";
|
|
6
|
-
|
|
7
|
-
import { carbonElement } from "../../decorators/customElement.js";
|
|
8
|
-
|
|
9
|
-
/*
|
|
10
|
-
* Copyright IBM Corp. 2025
|
|
11
|
-
*
|
|
12
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
13
|
-
* LICENSE file in the root directory of this source tree.
|
|
14
|
-
*
|
|
15
|
-
* @license
|
|
16
|
-
*/ const ROUNDED_BUTTON_TAG_NAME = `cds-aichat-rounded-button`;
|
|
17
|
-
|
|
18
|
-
const styles = `\n .cds-custom--btn {\n border-start-start-radius: var(--${ROUNDED_BUTTON_TAG_NAME}-top-left);\n border-start-end-radius: var(--${ROUNDED_BUTTON_TAG_NAME}-top-right);\n border-end-start-radius: var(--${ROUNDED_BUTTON_TAG_NAME}-bottom-left);\n border-end-end-radius: var(--${ROUNDED_BUTTON_TAG_NAME}-bottom-right);\n width: var(--${ROUNDED_BUTTON_TAG_NAME}-width);\n max-width: var(--${ROUNDED_BUTTON_TAG_NAME}-max-width);\n }`;
|
|
19
|
-
|
|
20
|
-
let CDSRoundedButtonElement = class CDSRoundedButtonElement extends CDSButton {};
|
|
21
|
-
|
|
22
|
-
CDSRoundedButtonElement.styles = css`
|
|
23
|
-
${CDSButton.styles}
|
|
24
|
-
${unsafeCSS(styles)}
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
CDSRoundedButtonElement = __decorate([ carbonElement(ROUNDED_BUTTON_TAG_NAME) ], CDSRoundedButtonElement);
|
|
28
|
-
|
|
29
|
-
export { CDSRoundedButtonElement, ROUNDED_BUTTON_TAG_NAME };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
|
|
3
|
-
import { carbonElement } from "../../decorators/customElement.js";
|
|
4
|
-
|
|
5
|
-
import { stopStreamingButtonTemplate } from "./src/stopStreamingButton.template.js";
|
|
6
|
-
|
|
7
|
-
import { StopStreamingButtonElement } from "./src/StopStreamingButtonElement.js";
|
|
8
|
-
|
|
9
|
-
/*
|
|
10
|
-
* Copyright IBM Corp. 2025
|
|
11
|
-
*
|
|
12
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
13
|
-
* LICENSE file in the root directory of this source tree.
|
|
14
|
-
*
|
|
15
|
-
* @license
|
|
16
|
-
*/ const STOP_STREAMING_BUTTON_TAG_NAME = "cds-aichat-stop-streaming-button";
|
|
17
|
-
|
|
18
|
-
let CDSChatStopStreamingButtonElement = class CDSChatStopStreamingButtonElement extends StopStreamingButtonElement {
|
|
19
|
-
render() {
|
|
20
|
-
return stopStreamingButtonTemplate(this);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
CDSChatStopStreamingButtonElement = __decorate([ carbonElement(STOP_STREAMING_BUTTON_TAG_NAME) ], CDSChatStopStreamingButtonElement);
|
|
25
|
-
|
|
26
|
-
export { CDSChatStopStreamingButtonElement as default };
|
package/dist/es/chat/web-components/components/stopStreamingButton/src/StopStreamingButtonElement.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
|
|
3
|
-
import { bind } from "bind-decorator";
|
|
4
|
-
|
|
5
|
-
import { LitElement, unsafeCSS, css } from "lit";
|
|
6
|
-
|
|
7
|
-
import { property } from "lit/decorators.js";
|
|
8
|
-
|
|
9
|
-
import css_248z from "./stopStreamingButton.scss.js";
|
|
10
|
-
|
|
11
|
-
/*
|
|
12
|
-
* Copyright IBM Corp. 2025
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
15
|
-
* LICENSE file in the root directory of this source tree.
|
|
16
|
-
*
|
|
17
|
-
* @license
|
|
18
|
-
*/ class StopStreamingButtonElement extends LitElement {
|
|
19
|
-
_handleOnClick() {
|
|
20
|
-
this.onClick();
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
StopStreamingButtonElement.styles = css`
|
|
25
|
-
${unsafeCSS(css_248z)}
|
|
26
|
-
`;
|
|
27
|
-
|
|
28
|
-
__decorate([ property({
|
|
29
|
-
type: String,
|
|
30
|
-
attribute: "label"
|
|
31
|
-
}) ], StopStreamingButtonElement.prototype, "label", void 0);
|
|
32
|
-
|
|
33
|
-
__decorate([ property({
|
|
34
|
-
type: String,
|
|
35
|
-
attribute: "tooltip-alignment"
|
|
36
|
-
}) ], StopStreamingButtonElement.prototype, "tooltipAlignment", void 0);
|
|
37
|
-
|
|
38
|
-
__decorate([ property({
|
|
39
|
-
type: Boolean,
|
|
40
|
-
attribute: "disabled"
|
|
41
|
-
}) ], StopStreamingButtonElement.prototype, "disabled", void 0);
|
|
42
|
-
|
|
43
|
-
__decorate([ property({
|
|
44
|
-
type: Object
|
|
45
|
-
}) ], StopStreamingButtonElement.prototype, "onClick", void 0);
|
|
46
|
-
|
|
47
|
-
__decorate([ bind ], StopStreamingButtonElement.prototype, "_handleOnClick", null);
|
|
48
|
-
|
|
49
|
-
export { StopStreamingButtonElement };
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import "@carbon/web-components/es-custom/components/icon-button/index.js";
|
|
2
|
-
|
|
3
|
-
import { toString } from "@carbon/icon-helpers";
|
|
4
|
-
|
|
5
|
-
import StopFilled16 from "@carbon/icons/es/stop--filled/16.js";
|
|
6
|
-
|
|
7
|
-
import { html } from "lit";
|
|
8
|
-
|
|
9
|
-
import { unsafeSVG } from "lit/directives/unsafe-svg.js";
|
|
10
|
-
|
|
11
|
-
import { CSS_CLASS_PREFIX } from "../../../settings.js";
|
|
12
|
-
|
|
13
|
-
import { ButtonKindEnum, ButtonSizeEnum } from "../../../../../types/utilities/carbonTypes.js";
|
|
14
|
-
|
|
15
|
-
/*
|
|
16
|
-
* Copyright IBM Corp. 2025
|
|
17
|
-
*
|
|
18
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
19
|
-
* LICENSE file in the root directory of this source tree.
|
|
20
|
-
*
|
|
21
|
-
* @license
|
|
22
|
-
*/ const StopFilled16svg = toString(StopFilled16);
|
|
23
|
-
|
|
24
|
-
function stopStreamingButtonTemplate({label: label, disabled: disabled, tooltipAlignment: tooltipAlignment, onClick: onClick}) {
|
|
25
|
-
return html`
|
|
26
|
-
<cds-custom-icon-button
|
|
27
|
-
class="${CSS_CLASS_PREFIX}-stop-streaming-button"
|
|
28
|
-
align="${tooltipAlignment}"
|
|
29
|
-
kind="${ButtonKindEnum.GHOST}"
|
|
30
|
-
size="${ButtonSizeEnum.SMALL}"
|
|
31
|
-
?disabled=${disabled}
|
|
32
|
-
@click="${onClick}"
|
|
33
|
-
>
|
|
34
|
-
<span
|
|
35
|
-
class="${disabled ? `${CSS_CLASS_PREFIX}-stop-icon` : ""}"
|
|
36
|
-
slot="icon"
|
|
37
|
-
>${unsafeSVG(StopFilled16svg)}</span
|
|
38
|
-
>
|
|
39
|
-
<span slot="tooltip-content">${label}</span>
|
|
40
|
-
</cds-custom-icon-button>
|
|
41
|
-
`;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export { stopStreamingButtonTemplate };
|
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
|
|
3
|
-
import { bind } from "bind-decorator";
|
|
4
|
-
|
|
5
|
-
import { stringify } from "csv-stringify/browser/esm/sync";
|
|
6
|
-
|
|
7
|
-
import { LitElement, html, unsafeCSS, css } from "lit";
|
|
8
|
-
|
|
9
|
-
import { property, state } from "lit/decorators.js";
|
|
10
|
-
|
|
11
|
-
import { carbonElement } from "../../decorators/customElement.js";
|
|
12
|
-
|
|
13
|
-
import css_248z from "./src/table.scss.js";
|
|
14
|
-
|
|
15
|
-
import { tableTemplate } from "./src/table.template.js";
|
|
16
|
-
|
|
17
|
-
import { tablePaginationTemplate } from "./src/tablePagination.template.js";
|
|
18
|
-
|
|
19
|
-
import { tableSkeletonTemplate } from "./src/tableSkeleton.template.js";
|
|
20
|
-
|
|
21
|
-
/*
|
|
22
|
-
* Copyright IBM Corp. 2025
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
25
|
-
* LICENSE file in the root directory of this source tree.
|
|
26
|
-
*
|
|
27
|
-
* @license
|
|
28
|
-
*/ const DEFAULT_TABLE_PAGE_SIZE = 5;
|
|
29
|
-
|
|
30
|
-
const DEFAULT_TABLE_PAGE_SIZE_TALL_CHAT = 10;
|
|
31
|
-
|
|
32
|
-
const POSSIBLE_PAGE_SIZES = [ DEFAULT_TABLE_PAGE_SIZE, DEFAULT_TABLE_PAGE_SIZE_TALL_CHAT, 15, 20, 50 ];
|
|
33
|
-
|
|
34
|
-
const TALL_CHAT_HEIGHT = 850;
|
|
35
|
-
|
|
36
|
-
const TABLE_COMPONENT_TAG_NAME = "cds-aichat-table";
|
|
37
|
-
|
|
38
|
-
let TableElement = class TableElement extends LitElement {
|
|
39
|
-
constructor() {
|
|
40
|
-
super(...arguments);
|
|
41
|
-
this._isValid = true;
|
|
42
|
-
this._currentPageNumber = 1;
|
|
43
|
-
this._rowsPerPageChanged = false;
|
|
44
|
-
this._rowsWithIDs = [];
|
|
45
|
-
}
|
|
46
|
-
updated(changedProperties) {
|
|
47
|
-
if ((changedProperties.has("headers") || changedProperties.has("rows")) && this.headers !== undefined && this.rows !== undefined) {
|
|
48
|
-
this._calcIsTableValid();
|
|
49
|
-
}
|
|
50
|
-
if (changedProperties.has("rows") && this.rows !== undefined) {
|
|
51
|
-
this._initializeRowsArrays();
|
|
52
|
-
}
|
|
53
|
-
if (this._currentPageSize === undefined && changedProperties.has("chatHeight") && this.chatHeight !== changedProperties.get("chatHeight")) {
|
|
54
|
-
this._initializePageSize();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
_calcIsTableValid() {
|
|
58
|
-
const columnCount = this.headers.length;
|
|
59
|
-
this._isValid = !this.rows.some(row => row.cells.length !== columnCount);
|
|
60
|
-
}
|
|
61
|
-
_initializeRowsArrays() {
|
|
62
|
-
this._rowsWithIDs = [];
|
|
63
|
-
this._filterVisibleRowIDs = new Set;
|
|
64
|
-
this.rows.forEach((row, index) => {
|
|
65
|
-
const id = index.toString();
|
|
66
|
-
this._rowsWithIDs.push({
|
|
67
|
-
...row,
|
|
68
|
-
id: id
|
|
69
|
-
});
|
|
70
|
-
this._filterVisibleRowIDs.add(id);
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
_initializePageSize() {
|
|
74
|
-
if (this.chatHeight > TALL_CHAT_HEIGHT) {
|
|
75
|
-
this._currentPageSize = DEFAULT_TABLE_PAGE_SIZE_TALL_CHAT;
|
|
76
|
-
} else {
|
|
77
|
-
this._currentPageSize = DEFAULT_TABLE_PAGE_SIZE;
|
|
78
|
-
}
|
|
79
|
-
this._allowFiltering = this.rows.length > this._currentPageSize;
|
|
80
|
-
this._updateVisibleRows();
|
|
81
|
-
}
|
|
82
|
-
_handlePageChangeEvent(event) {
|
|
83
|
-
this._updateVisibleRows(event.detail?.page, event.detail?.pageSize);
|
|
84
|
-
event.stopPropagation();
|
|
85
|
-
}
|
|
86
|
-
_handlePageSizeChangeEvent(event) {
|
|
87
|
-
this._rowsPerPageChanged = true;
|
|
88
|
-
this._currentPageSize = event.detail?.pageSize;
|
|
89
|
-
this._updateVisibleRows();
|
|
90
|
-
event.stopPropagation();
|
|
91
|
-
}
|
|
92
|
-
_handleFilterEvent(event) {
|
|
93
|
-
this._filterVisibleRowIDs = new Set(event?.detail?.unfilteredRows.map(row => row.id));
|
|
94
|
-
this._currentPageNumber = 1;
|
|
95
|
-
this._updateVisibleRows();
|
|
96
|
-
event.stopPropagation();
|
|
97
|
-
}
|
|
98
|
-
_updateVisibleRows(page = this._currentPageNumber, pageSize = this._currentPageSize) {
|
|
99
|
-
this._currentPageNumber = page;
|
|
100
|
-
const rows = Array.from(this.renderRoot.querySelectorAll("cds-custom-table-row"));
|
|
101
|
-
rows.forEach(row => row.style.setProperty("display", "none"));
|
|
102
|
-
const filterVisibleRows = rows.filter(row => this._filterVisibleRowIDs.has(row.id));
|
|
103
|
-
const pageStart = (page - 1) * pageSize;
|
|
104
|
-
const pageEnd = page * pageSize - 1;
|
|
105
|
-
for (let index = pageStart; index <= pageEnd; index++) {
|
|
106
|
-
filterVisibleRows[index]?.removeAttribute("style");
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
_handleDownload() {
|
|
110
|
-
const tableArray = [ this.headers, ...this.rows.map(row => row.cells) ];
|
|
111
|
-
const stringifiedTable = stringify(tableArray);
|
|
112
|
-
const blob = new Blob([ stringifiedTable ], {
|
|
113
|
-
type: "text/csv;charset=utf-8;"
|
|
114
|
-
});
|
|
115
|
-
const link = document.createElement("a");
|
|
116
|
-
const url = URL.createObjectURL(blob);
|
|
117
|
-
link.setAttribute("href", url);
|
|
118
|
-
link.setAttribute("download", "table-data.csv");
|
|
119
|
-
link.style.visibility = "hidden";
|
|
120
|
-
document.body.appendChild(link);
|
|
121
|
-
link.click();
|
|
122
|
-
document.body.removeChild(link);
|
|
123
|
-
}
|
|
124
|
-
render() {
|
|
125
|
-
if (this.loading) {
|
|
126
|
-
return tableSkeletonTemplate();
|
|
127
|
-
}
|
|
128
|
-
if (this.rows.length > this._currentPageSize || this._rowsPerPageChanged) {
|
|
129
|
-
return html`${tableTemplate(this)} ${tablePaginationTemplate(this)}`;
|
|
130
|
-
}
|
|
131
|
-
return html`${tableTemplate(this)}`;
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
TableElement.styles = css`
|
|
136
|
-
${unsafeCSS(css_248z)}
|
|
137
|
-
`;
|
|
138
|
-
|
|
139
|
-
__decorate([ property({
|
|
140
|
-
type: String,
|
|
141
|
-
attribute: "table-title"
|
|
142
|
-
}) ], TableElement.prototype, "tableTitle", void 0);
|
|
143
|
-
|
|
144
|
-
__decorate([ property({
|
|
145
|
-
type: String,
|
|
146
|
-
attribute: "table-description"
|
|
147
|
-
}) ], TableElement.prototype, "tableDescription", void 0);
|
|
148
|
-
|
|
149
|
-
__decorate([ property({
|
|
150
|
-
type: Array
|
|
151
|
-
}) ], TableElement.prototype, "headers", void 0);
|
|
152
|
-
|
|
153
|
-
__decorate([ property({
|
|
154
|
-
type: Array
|
|
155
|
-
}) ], TableElement.prototype, "rows", void 0);
|
|
156
|
-
|
|
157
|
-
__decorate([ property({
|
|
158
|
-
type: Number,
|
|
159
|
-
attribute: "container-width"
|
|
160
|
-
}) ], TableElement.prototype, "containerWidth", void 0);
|
|
161
|
-
|
|
162
|
-
__decorate([ property({
|
|
163
|
-
type: Number,
|
|
164
|
-
attribute: "chat-height"
|
|
165
|
-
}) ], TableElement.prototype, "chatHeight", void 0);
|
|
166
|
-
|
|
167
|
-
__decorate([ property({
|
|
168
|
-
type: Boolean,
|
|
169
|
-
attribute: "loading"
|
|
170
|
-
}) ], TableElement.prototype, "loading", void 0);
|
|
171
|
-
|
|
172
|
-
__decorate([ property({
|
|
173
|
-
type: String,
|
|
174
|
-
attribute: "filter-placeholder-text"
|
|
175
|
-
}) ], TableElement.prototype, "filterPlaceholderText", void 0);
|
|
176
|
-
|
|
177
|
-
__decorate([ property({
|
|
178
|
-
type: String,
|
|
179
|
-
attribute: "previous-page-text"
|
|
180
|
-
}) ], TableElement.prototype, "previousPageText", void 0);
|
|
181
|
-
|
|
182
|
-
__decorate([ property({
|
|
183
|
-
type: String,
|
|
184
|
-
attribute: "next-page-text"
|
|
185
|
-
}) ], TableElement.prototype, "nextPageText", void 0);
|
|
186
|
-
|
|
187
|
-
__decorate([ property({
|
|
188
|
-
type: String,
|
|
189
|
-
attribute: "items-per-page-text"
|
|
190
|
-
}) ], TableElement.prototype, "itemsPerPageText", void 0);
|
|
191
|
-
|
|
192
|
-
__decorate([ property({
|
|
193
|
-
type: String,
|
|
194
|
-
attribute: "locale"
|
|
195
|
-
}) ], TableElement.prototype, "locale", void 0);
|
|
196
|
-
|
|
197
|
-
__decorate([ property({
|
|
198
|
-
type: Function,
|
|
199
|
-
attribute: false
|
|
200
|
-
}) ], TableElement.prototype, "getPaginationSupplementalText", void 0);
|
|
201
|
-
|
|
202
|
-
__decorate([ property({
|
|
203
|
-
type: Function,
|
|
204
|
-
attribute: false
|
|
205
|
-
}) ], TableElement.prototype, "getPaginationStatusText", void 0);
|
|
206
|
-
|
|
207
|
-
__decorate([ state() ], TableElement.prototype, "_isValid", void 0);
|
|
208
|
-
|
|
209
|
-
__decorate([ state() ], TableElement.prototype, "_currentPageNumber", void 0);
|
|
210
|
-
|
|
211
|
-
__decorate([ state() ], TableElement.prototype, "_currentPageSize", void 0);
|
|
212
|
-
|
|
213
|
-
__decorate([ state() ], TableElement.prototype, "_rowsPerPageChanged", void 0);
|
|
214
|
-
|
|
215
|
-
__decorate([ state() ], TableElement.prototype, "_filterVisibleRowIDs", void 0);
|
|
216
|
-
|
|
217
|
-
__decorate([ state() ], TableElement.prototype, "_rowsWithIDs", void 0);
|
|
218
|
-
|
|
219
|
-
__decorate([ state() ], TableElement.prototype, "_allowFiltering", void 0);
|
|
220
|
-
|
|
221
|
-
__decorate([ bind ], TableElement.prototype, "_handlePageChangeEvent", null);
|
|
222
|
-
|
|
223
|
-
__decorate([ bind ], TableElement.prototype, "_handlePageSizeChangeEvent", null);
|
|
224
|
-
|
|
225
|
-
__decorate([ bind ], TableElement.prototype, "_handleFilterEvent", null);
|
|
226
|
-
|
|
227
|
-
TableElement = __decorate([ carbonElement(TABLE_COMPONENT_TAG_NAME) ], TableElement);
|
|
228
|
-
|
|
229
|
-
export { POSSIBLE_PAGE_SIZES, TABLE_COMPONENT_TAG_NAME, TableElement };
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var css_248z = "cds-custom-table-header-title,\ncds-custom-table-header-description,\ncds-custom-table-toolbar{\n position:sticky;\n inline-size:var(--cds-chat-table-width, auto);\n inset-inline-start:0;\n}\n\n:dir(rtl) cds-custom-table-header-title,\n:dir(rtl) cds-custom-table-header-description,\n:dir(rtl) cds-custom-table-toolbar{\n right:0;\n left:unset;\n}\n\ncds-custom-table-header-title,\ncds-custom-table-header-description{\n padding:0 1rem;\n inline-size:calc(var(--cds-chat-table-width, auto) - 1rem - 1rem);\n margin-inline:-1rem;\n}\n\ncds-custom-table-header-description{\n margin-block-end:-0.5rem;\n}\n\ncds-custom-pagination{\n inline-size:100%;\n}";
|
|
2
|
-
|
|
3
|
-
export { css_248z as default };
|