@carbon/ai-chat-components 1.8.0-rc.0 → 1.9.0-alpha.0
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/custom-elements.json +15967 -10853
- package/es/components/audio-player/src/audio-player.js +0 -1
- package/es/components/audio-player/src/audio-player.js.map +1 -1
- package/es/components/audio-player/src/providers/base-provider.js +0 -1
- package/es/components/audio-player/src/providers/base-provider.js.map +1 -1
- package/es/components/audio-player/src/providers/native-audio-provider.js +0 -1
- package/es/components/audio-player/src/providers/native-audio-provider.js.map +1 -1
- package/es/components/audio-player/src/providers/soundcloud-provider.js +0 -1
- package/es/components/audio-player/src/providers/soundcloud-provider.js.map +1 -1
- package/es/components/audio-player/src/transcript.js +1 -1
- package/es/components/audio-player/src/transcript.js.map +1 -1
- package/es/components/audio-player/src/utils/url-detector.js +0 -1
- package/es/components/audio-player/src/utils/url-detector.js.map +1 -1
- package/es/components/autocomplete/index.d.ts +15 -0
- package/es/components/autocomplete/index.js +11 -0
- package/es/components/autocomplete/index.js.map +1 -0
- package/es/components/autocomplete/src/autocomplete-item-group.d.ts +44 -0
- package/es/components/autocomplete/src/autocomplete-item-group.js +139 -0
- package/es/components/autocomplete/src/autocomplete-item-group.js.map +1 -0
- package/es/components/autocomplete/src/autocomplete-item-group.scss.js +13 -0
- package/es/components/autocomplete/src/autocomplete-item-group.scss.js.map +1 -0
- package/es/components/autocomplete/src/autocomplete-item.d.ts +54 -0
- package/es/components/autocomplete/src/autocomplete-item.js +197 -0
- package/es/components/autocomplete/src/autocomplete-item.js.map +1 -0
- package/es/components/autocomplete/src/autocomplete-item.scss.js +13 -0
- package/es/components/autocomplete/src/autocomplete-item.scss.js.map +1 -0
- package/es/components/autocomplete/src/autocomplete.d.ts +97 -0
- package/es/components/autocomplete/src/autocomplete.js +321 -0
- package/es/components/autocomplete/src/autocomplete.js.map +1 -0
- package/es/components/autocomplete/src/autocomplete.scss.js +13 -0
- package/es/components/autocomplete/src/autocomplete.scss.js.map +1 -0
- package/es/components/card/src/card.scss.js +1 -1
- package/es/components/chat-history/src/chat-history.scss.js +1 -1
- package/es/components/chat-shell/src/chat-header.js +0 -1
- package/es/components/chat-shell/src/chat-header.js.map +1 -1
- package/es/components/chat-shell/src/corner-manager.d.ts +1 -1
- package/es/components/chat-shell/src/corner-manager.js +1 -2
- package/es/components/chat-shell/src/corner-manager.js.map +1 -1
- package/es/components/chat-shell/src/initialization-manager.d.ts +1 -1
- package/es/components/chat-shell/src/initialization-manager.js +1 -2
- package/es/components/chat-shell/src/initialization-manager.js.map +1 -1
- package/es/components/chat-shell/src/resize-observer-manager.js +0 -1
- package/es/components/chat-shell/src/resize-observer-manager.js.map +1 -1
- package/es/components/chat-shell/src/shell.js +2 -2
- package/es/components/chat-shell/src/shell.js.map +1 -1
- package/es/components/chat-shell/src/slot-observer.d.ts +1 -1
- package/es/components/chat-shell/src/slot-observer.js +1 -2
- package/es/components/chat-shell/src/slot-observer.js.map +1 -1
- package/es/components/chat-shell/src/workspace-manager-utils.d.ts +1 -1
- package/es/components/chat-shell/src/workspace-manager-utils.js +1 -2
- package/es/components/chat-shell/src/workspace-manager-utils.js.map +1 -1
- package/es/components/chat-shell/src/workspace-manager.d.ts +1 -1
- package/es/components/chat-shell/src/workspace-manager.js +1 -2
- package/es/components/chat-shell/src/workspace-manager.js.map +1 -1
- package/es/components/code-snippet/src/code-snippet.d.ts +11 -0
- package/es/components/code-snippet/src/code-snippet.js +37 -5
- package/es/components/code-snippet/src/code-snippet.js.map +1 -1
- package/es/components/code-snippet/src/code-snippet.scss.js +1 -1
- package/es/components/code-snippet/src/codemirror/theme.js +5 -0
- package/es/components/code-snippet/src/codemirror/theme.js.map +1 -1
- package/es/components/code-snippet/src/layout-utils.js +21 -8
- package/es/components/code-snippet/src/layout-utils.js.map +1 -1
- package/es/components/feedback/src/feedback.js +1 -0
- package/es/components/feedback/src/feedback.js.map +1 -1
- package/es/components/feedback/src/feedback.scss.js +1 -1
- package/es/components/file-uploads/index.d.ts +12 -0
- package/es/components/file-uploads/index.js +10 -0
- package/es/components/file-uploads/index.js.map +1 -0
- package/es/components/file-uploads/src/file-upload-item.d.ts +43 -0
- package/es/components/file-uploads/src/file-upload-item.js +267 -0
- package/es/components/file-uploads/src/file-upload-item.js.map +1 -0
- package/es/components/file-uploads/src/file-upload-item.scss.js +13 -0
- package/es/components/file-uploads/src/file-upload-item.scss.js.map +1 -0
- package/es/components/file-uploads/src/file-uploads.d.ts +87 -0
- package/es/components/file-uploads/src/file-uploads.js +213 -0
- package/es/components/file-uploads/src/file-uploads.js.map +1 -0
- package/es/components/file-uploads/src/file-uploads.scss.js +13 -0
- package/es/components/file-uploads/src/file-uploads.scss.js.map +1 -0
- package/es/components/markdown/index.d.ts +1 -0
- package/es/components/markdown/index.js +1 -0
- package/es/components/markdown/index.js.map +1 -1
- package/es/components/markdown/src/markdown-token-tree.d.ts +8 -0
- package/es/components/markdown/src/markdown-token-tree.js +12 -1
- package/es/components/markdown/src/markdown-token-tree.js.map +1 -1
- package/es/components/markdown/src/markdown.js +4 -0
- package/es/components/markdown/src/markdown.js.map +1 -1
- package/es/components/markdown/src/markdown.scss.js +1 -1
- package/es/components/prompt-line/index.d.ts +26 -0
- package/es/components/prompt-line/index.js +32 -0
- package/es/components/prompt-line/index.js.map +1 -0
- package/es/components/prompt-line/src/autocomplete-controller.d.ts +178 -0
- package/es/components/prompt-line/src/autocomplete-controller.js +548 -0
- package/es/components/prompt-line/src/autocomplete-controller.js.map +1 -0
- package/es/components/prompt-line/src/error-message.d.ts +50 -0
- package/es/components/prompt-line/src/error-message.js +144 -0
- package/es/components/prompt-line/src/error-message.js.map +1 -0
- package/es/components/prompt-line/src/error-message.scss.js +13 -0
- package/es/components/prompt-line/src/error-message.scss.js.map +1 -0
- package/es/components/prompt-line/src/prompt-line-constants.d.ts +17 -0
- package/es/components/prompt-line/src/prompt-line-constants.js +27 -0
- package/es/components/prompt-line/src/prompt-line-constants.js.map +1 -0
- package/es/components/prompt-line/src/prompt-line-controller.d.ts +155 -0
- package/es/components/prompt-line/src/prompt-line-controller.js +394 -0
- package/es/components/prompt-line/src/prompt-line-controller.js.map +1 -0
- package/es/components/prompt-line/src/prompt-line-rich-loader.d.ts +34 -0
- package/es/components/prompt-line/src/prompt-line-rich-loader.js +51 -0
- package/es/components/prompt-line/src/prompt-line-rich-loader.js.map +1 -0
- package/es/components/prompt-line/src/prompt-line-rich-runtime.d.ts +14 -0
- package/es/components/prompt-line/src/prompt-line-rich-runtime.js +340 -0
- package/es/components/prompt-line/src/prompt-line-rich-runtime.js.map +1 -0
- package/es/components/prompt-line/src/prompt-line-shell.d.ts +72 -0
- package/es/components/prompt-line/src/prompt-line-shell.js +227 -0
- package/es/components/prompt-line/src/prompt-line-shell.js.map +1 -0
- package/es/components/prompt-line/src/prompt-line-shell.scss.js +13 -0
- package/es/components/prompt-line/src/prompt-line-shell.scss.js.map +1 -0
- package/es/components/prompt-line/src/prompt-line.d.ts +147 -0
- package/es/components/prompt-line/src/prompt-line.js +391 -0
- package/es/components/prompt-line/src/prompt-line.js.map +1 -0
- package/es/components/prompt-line/src/prompt-line.scss.js +13 -0
- package/es/components/prompt-line/src/prompt-line.scss.js.map +1 -0
- package/es/components/prompt-line/src/send-control.d.ts +46 -0
- package/es/components/prompt-line/src/send-control.js +138 -0
- package/es/components/prompt-line/src/send-control.js.map +1 -0
- package/es/components/prompt-line/src/send-control.scss.js +13 -0
- package/es/components/prompt-line/src/send-control.scss.js.map +1 -0
- package/es/components/prompt-line/src/stop-streaming-button.d.ts +42 -0
- package/es/components/prompt-line/src/stop-streaming-button.js +93 -0
- package/es/components/prompt-line/src/stop-streaming-button.js.map +1 -0
- package/es/components/prompt-line/src/stop-streaming-button.scss.js +13 -0
- package/es/components/prompt-line/src/stop-streaming-button.scss.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/build-extensions.d.ts +30 -0
- package/es/components/prompt-line/src/tiptap/build-extensions.js +38 -0
- package/es/components/prompt-line/src/tiptap/build-extensions.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/carbon-autocomplete.d.ts +21 -0
- package/es/components/prompt-line/src/tiptap/carbon-autocomplete.js +127 -0
- package/es/components/prompt-line/src/tiptap/carbon-autocomplete.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/carbon-mention.d.ts +19 -0
- package/es/components/prompt-line/src/tiptap/carbon-mention.js +237 -0
- package/es/components/prompt-line/src/tiptap/carbon-mention.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/carbon-starter-trigger.d.ts +22 -0
- package/es/components/prompt-line/src/tiptap/carbon-starter-trigger.js +64 -0
- package/es/components/prompt-line/src/tiptap/carbon-starter-trigger.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/chat-enter.d.ts +17 -0
- package/es/components/prompt-line/src/tiptap/chat-enter.js +46 -0
- package/es/components/prompt-line/src/tiptap/chat-enter.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/editor-styles.d.ts +18 -0
- package/es/components/prompt-line/src/tiptap/editor-styles.js +83 -0
- package/es/components/prompt-line/src/tiptap/editor-styles.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/index.d.ts +42 -0
- package/es/components/prompt-line/src/tiptap/index.js +43 -0
- package/es/components/prompt-line/src/tiptap/index.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/json-utils.d.ts +61 -0
- package/es/components/prompt-line/src/tiptap/json-utils.js +158 -0
- package/es/components/prompt-line/src/tiptap/json-utils.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/keymap.d.ts +31 -0
- package/es/components/prompt-line/src/tiptap/keymap.js +59 -0
- package/es/components/prompt-line/src/tiptap/keymap.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/origin-meta.d.ts +11 -0
- package/es/components/prompt-line/src/tiptap/origin-meta.js +33 -0
- package/es/components/prompt-line/src/tiptap/origin-meta.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/plain-text-paste.d.ts +16 -0
- package/es/components/prompt-line/src/tiptap/plain-text-paste.js +85 -0
- package/es/components/prompt-line/src/tiptap/plain-text-paste.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/render-in-light-dom.d.ts +87 -0
- package/es/components/prompt-line/src/tiptap/render-in-light-dom.js +41 -0
- package/es/components/prompt-line/src/tiptap/render-in-light-dom.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/render-token-chip.d.ts +57 -0
- package/es/components/prompt-line/src/tiptap/render-token-chip.js +95 -0
- package/es/components/prompt-line/src/tiptap/render-token-chip.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/token-node-view.d.ts +36 -0
- package/es/components/prompt-line/src/tiptap/token-node-view.js +41 -0
- package/es/components/prompt-line/src/tiptap/token-node-view.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/trigger-utils.d.ts +30 -0
- package/es/components/prompt-line/src/tiptap/trigger-utils.js +44 -0
- package/es/components/prompt-line/src/tiptap/trigger-utils.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/types.d.ts +161 -0
- package/es/components/prompt-line/src/tiptap/types.js +8 -0
- package/es/components/prompt-line/src/tiptap/types.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/typing-indicator.d.ts +30 -0
- package/es/components/prompt-line/src/tiptap/typing-indicator.js +104 -0
- package/es/components/prompt-line/src/tiptap/typing-indicator.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/value-sync.d.ts +25 -0
- package/es/components/prompt-line/src/tiptap/value-sync.js +65 -0
- package/es/components/prompt-line/src/tiptap/value-sync.js.map +1 -0
- package/es/components/prompt-line/src/types.d.ts +100 -0
- package/es/components/prompt-line/src/types.js +50 -0
- package/es/components/prompt-line/src/types.js.map +1 -0
- package/es/components/shared/media-utils/script-loader.js +0 -1
- package/es/components/shared/media-utils/script-loader.js.map +1 -1
- package/es/components/video-player/src/providers/base-provider.js +0 -1
- package/es/components/video-player/src/providers/base-provider.js.map +1 -1
- package/es/components/video-player/src/providers/kaltura-provider.js +0 -1
- package/es/components/video-player/src/providers/kaltura-provider.js.map +1 -1
- package/es/components/video-player/src/providers/native-video-provider.js +0 -1
- package/es/components/video-player/src/providers/native-video-provider.js.map +1 -1
- package/es/components/video-player/src/providers/vimeo-provider.js +0 -1
- package/es/components/video-player/src/providers/vimeo-provider.js.map +1 -1
- package/es/components/video-player/src/providers/youtube-provider.js +0 -1
- package/es/components/video-player/src/providers/youtube-provider.js.map +1 -1
- package/es/components/video-player/src/utils/url-detector.js +0 -1
- package/es/components/video-player/src/utils/url-detector.js.map +1 -1
- package/es/components/video-player/src/video-player.js +0 -1
- package/es/components/video-player/src/video-player.js.map +1 -1
- package/es/components/workspace-shell/src/header-collapsible-manager.js +0 -1
- package/es/components/workspace-shell/src/header-collapsible-manager.js.map +1 -1
- package/es/globals/utils/aria-announcer-manager.d.ts +62 -0
- package/es/globals/utils/aria-announcer-manager.js +125 -0
- package/es/globals/utils/aria-announcer-manager.js.map +1 -0
- package/es/globals/utils/browser-utils.d.ts +10 -0
- package/es/globals/utils/browser-utils.js +37 -0
- package/es/globals/utils/browser-utils.js.map +1 -0
- package/es/globals/utils/dom-utils.d.ts +6 -0
- package/es/globals/utils/dom-utils.js +39 -0
- package/es/globals/utils/dom-utils.js.map +1 -0
- package/{es-custom/react → es/globals}/utils/iconTransform.js +1 -2
- package/es/globals/utils/iconTransform.js.map +1 -0
- package/es/react/__tests__/jest.setup.js +1 -2
- package/es/react/__tests__/jest.setup.js.map +1 -1
- package/es/react/audio-player.js +0 -1
- package/es/react/audio-player.js.map +1 -1
- package/es/react/autocomplete.d.ts +11 -0
- package/es/react/autocomplete.js +36 -0
- package/es/react/autocomplete.js.map +1 -0
- package/es/react/chat-header.js +1 -1
- package/es/react/code-snippet.js +1 -1
- package/es/react/error-message.d.ts +11 -0
- package/es/react/error-message.js +28 -0
- package/es/react/error-message.js.map +1 -0
- package/es/react/file-uploads.d.ts +11 -0
- package/es/react/file-uploads.js +31 -0
- package/es/react/file-uploads.js.map +1 -0
- package/es/react/hooks/useChatAutocomplete.d.ts +41 -0
- package/es/react/hooks/useChatAutocomplete.js +178 -0
- package/es/react/hooks/useChatAutocomplete.js.map +1 -0
- package/es/react/input-send-control.d.ts +11 -0
- package/es/react/input-send-control.js +32 -0
- package/es/react/input-send-control.js.map +1 -0
- package/es/react/prompt-line-shell.d.ts +18 -0
- package/es/react/prompt-line-shell.js +36 -0
- package/es/react/prompt-line-shell.js.map +1 -0
- package/es/react/prompt-line.d.ts +25 -0
- package/es/react/prompt-line.js +52 -0
- package/es/react/prompt-line.js.map +1 -0
- package/es/react/stop-streaming-button.d.ts +11 -0
- package/es/react/stop-streaming-button.js +28 -0
- package/es/react/stop-streaming-button.js.map +1 -0
- package/es/react/toolbar.js +1 -1
- package/es/react/transcript.js +0 -1
- package/es/react/transcript.js.map +1 -1
- package/es/react/utils/transformSuggestionConfig.d.ts +21 -0
- package/es/react/utils/transformSuggestionConfig.js +67 -0
- package/es/react/utils/transformSuggestionConfig.js.map +1 -0
- package/es/react/video-player.js +0 -1
- package/es/react/video-player.js.map +1 -1
- package/es/testing/PageObjectId.js +1 -2
- package/es/testing/PageObjectId.js.map +1 -1
- package/es-custom/components/audio-player/src/audio-player.js +0 -1
- package/es-custom/components/audio-player/src/audio-player.js.map +1 -1
- package/es-custom/components/audio-player/src/providers/base-provider.js +0 -1
- package/es-custom/components/audio-player/src/providers/base-provider.js.map +1 -1
- package/es-custom/components/audio-player/src/providers/native-audio-provider.js +0 -1
- package/es-custom/components/audio-player/src/providers/native-audio-provider.js.map +1 -1
- package/es-custom/components/audio-player/src/providers/soundcloud-provider.js +0 -1
- package/es-custom/components/audio-player/src/providers/soundcloud-provider.js.map +1 -1
- package/es-custom/components/audio-player/src/transcript.js +1 -1
- package/es-custom/components/audio-player/src/transcript.js.map +1 -1
- package/es-custom/components/audio-player/src/utils/url-detector.js +0 -1
- package/es-custom/components/audio-player/src/utils/url-detector.js.map +1 -1
- package/es-custom/components/autocomplete/index.d.ts +15 -0
- package/es-custom/components/autocomplete/index.js +11 -0
- package/es-custom/components/autocomplete/index.js.map +1 -0
- package/es-custom/components/autocomplete/src/autocomplete-item-group.d.ts +44 -0
- package/es-custom/components/autocomplete/src/autocomplete-item-group.js +139 -0
- package/es-custom/components/autocomplete/src/autocomplete-item-group.js.map +1 -0
- package/es-custom/components/autocomplete/src/autocomplete-item-group.scss.js +13 -0
- package/es-custom/components/autocomplete/src/autocomplete-item-group.scss.js.map +1 -0
- package/es-custom/components/autocomplete/src/autocomplete-item.d.ts +54 -0
- package/es-custom/components/autocomplete/src/autocomplete-item.js +197 -0
- package/es-custom/components/autocomplete/src/autocomplete-item.js.map +1 -0
- package/es-custom/components/autocomplete/src/autocomplete-item.scss.js +13 -0
- package/es-custom/components/autocomplete/src/autocomplete-item.scss.js.map +1 -0
- package/es-custom/components/autocomplete/src/autocomplete.d.ts +97 -0
- package/es-custom/components/autocomplete/src/autocomplete.js +321 -0
- package/es-custom/components/autocomplete/src/autocomplete.js.map +1 -0
- package/es-custom/components/autocomplete/src/autocomplete.scss.js +13 -0
- package/es-custom/components/autocomplete/src/autocomplete.scss.js.map +1 -0
- package/es-custom/components/card/src/card.scss.js +1 -1
- package/es-custom/components/chat-history/src/chat-history.scss.js +1 -1
- package/es-custom/components/chat-shell/src/chat-header.js +0 -1
- package/es-custom/components/chat-shell/src/chat-header.js.map +1 -1
- package/es-custom/components/chat-shell/src/corner-manager.d.ts +1 -1
- package/es-custom/components/chat-shell/src/corner-manager.js +1 -2
- package/es-custom/components/chat-shell/src/corner-manager.js.map +1 -1
- package/es-custom/components/chat-shell/src/initialization-manager.d.ts +1 -1
- package/es-custom/components/chat-shell/src/initialization-manager.js +1 -2
- package/es-custom/components/chat-shell/src/initialization-manager.js.map +1 -1
- package/es-custom/components/chat-shell/src/resize-observer-manager.js +0 -1
- package/es-custom/components/chat-shell/src/resize-observer-manager.js.map +1 -1
- package/es-custom/components/chat-shell/src/shell.js +2 -2
- package/es-custom/components/chat-shell/src/shell.js.map +1 -1
- package/es-custom/components/chat-shell/src/slot-observer.d.ts +1 -1
- package/es-custom/components/chat-shell/src/slot-observer.js +1 -2
- package/es-custom/components/chat-shell/src/slot-observer.js.map +1 -1
- package/es-custom/components/chat-shell/src/workspace-manager-utils.d.ts +1 -1
- package/es-custom/components/chat-shell/src/workspace-manager-utils.js +1 -2
- package/es-custom/components/chat-shell/src/workspace-manager-utils.js.map +1 -1
- package/es-custom/components/chat-shell/src/workspace-manager.d.ts +1 -1
- package/es-custom/components/chat-shell/src/workspace-manager.js +1 -2
- package/es-custom/components/chat-shell/src/workspace-manager.js.map +1 -1
- package/es-custom/components/code-snippet/src/code-snippet.d.ts +11 -0
- package/es-custom/components/code-snippet/src/code-snippet.js +37 -5
- package/es-custom/components/code-snippet/src/code-snippet.js.map +1 -1
- package/es-custom/components/code-snippet/src/code-snippet.scss.js +1 -1
- package/es-custom/components/code-snippet/src/codemirror/theme.js +5 -0
- package/es-custom/components/code-snippet/src/codemirror/theme.js.map +1 -1
- package/es-custom/components/code-snippet/src/layout-utils.js +21 -8
- package/es-custom/components/code-snippet/src/layout-utils.js.map +1 -1
- package/es-custom/components/feedback/src/feedback.js +1 -0
- package/es-custom/components/feedback/src/feedback.js.map +1 -1
- package/es-custom/components/feedback/src/feedback.scss.js +1 -1
- package/es-custom/components/file-uploads/index.d.ts +12 -0
- package/es-custom/components/file-uploads/index.js +10 -0
- package/es-custom/components/file-uploads/index.js.map +1 -0
- package/es-custom/components/file-uploads/src/file-upload-item.d.ts +43 -0
- package/es-custom/components/file-uploads/src/file-upload-item.js +267 -0
- package/es-custom/components/file-uploads/src/file-upload-item.js.map +1 -0
- package/es-custom/components/file-uploads/src/file-upload-item.scss.js +13 -0
- package/es-custom/components/file-uploads/src/file-upload-item.scss.js.map +1 -0
- package/es-custom/components/file-uploads/src/file-uploads.d.ts +87 -0
- package/es-custom/components/file-uploads/src/file-uploads.js +213 -0
- package/es-custom/components/file-uploads/src/file-uploads.js.map +1 -0
- package/es-custom/components/file-uploads/src/file-uploads.scss.js +13 -0
- package/es-custom/components/file-uploads/src/file-uploads.scss.js.map +1 -0
- package/es-custom/components/markdown/index.d.ts +1 -0
- package/es-custom/components/markdown/index.js +1 -0
- package/es-custom/components/markdown/index.js.map +1 -1
- package/es-custom/components/markdown/src/markdown-token-tree.d.ts +8 -0
- package/es-custom/components/markdown/src/markdown-token-tree.js +12 -1
- package/es-custom/components/markdown/src/markdown-token-tree.js.map +1 -1
- package/es-custom/components/markdown/src/markdown.js +4 -0
- package/es-custom/components/markdown/src/markdown.js.map +1 -1
- package/es-custom/components/markdown/src/markdown.scss.js +1 -1
- package/es-custom/components/prompt-line/index.d.ts +26 -0
- package/es-custom/components/prompt-line/index.js +32 -0
- package/es-custom/components/prompt-line/index.js.map +1 -0
- package/es-custom/components/prompt-line/src/autocomplete-controller.d.ts +178 -0
- package/es-custom/components/prompt-line/src/autocomplete-controller.js +548 -0
- package/es-custom/components/prompt-line/src/autocomplete-controller.js.map +1 -0
- package/es-custom/components/prompt-line/src/error-message.d.ts +50 -0
- package/es-custom/components/prompt-line/src/error-message.js +144 -0
- package/es-custom/components/prompt-line/src/error-message.js.map +1 -0
- package/es-custom/components/prompt-line/src/error-message.scss.js +13 -0
- package/es-custom/components/prompt-line/src/error-message.scss.js.map +1 -0
- package/es-custom/components/prompt-line/src/prompt-line-constants.d.ts +17 -0
- package/es-custom/components/prompt-line/src/prompt-line-constants.js +27 -0
- package/es-custom/components/prompt-line/src/prompt-line-constants.js.map +1 -0
- package/es-custom/components/prompt-line/src/prompt-line-controller.d.ts +155 -0
- package/es-custom/components/prompt-line/src/prompt-line-controller.js +394 -0
- package/es-custom/components/prompt-line/src/prompt-line-controller.js.map +1 -0
- package/es-custom/components/prompt-line/src/prompt-line-rich-loader.d.ts +34 -0
- package/es-custom/components/prompt-line/src/prompt-line-rich-loader.js +51 -0
- package/es-custom/components/prompt-line/src/prompt-line-rich-loader.js.map +1 -0
- package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.d.ts +14 -0
- package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.js +340 -0
- package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.js.map +1 -0
- package/es-custom/components/prompt-line/src/prompt-line-shell.d.ts +72 -0
- package/es-custom/components/prompt-line/src/prompt-line-shell.js +227 -0
- package/es-custom/components/prompt-line/src/prompt-line-shell.js.map +1 -0
- package/es-custom/components/prompt-line/src/prompt-line-shell.scss.js +13 -0
- package/es-custom/components/prompt-line/src/prompt-line-shell.scss.js.map +1 -0
- package/es-custom/components/prompt-line/src/prompt-line.d.ts +147 -0
- package/es-custom/components/prompt-line/src/prompt-line.js +391 -0
- package/es-custom/components/prompt-line/src/prompt-line.js.map +1 -0
- package/es-custom/components/prompt-line/src/prompt-line.scss.js +13 -0
- package/es-custom/components/prompt-line/src/prompt-line.scss.js.map +1 -0
- package/es-custom/components/prompt-line/src/send-control.d.ts +46 -0
- package/es-custom/components/prompt-line/src/send-control.js +138 -0
- package/es-custom/components/prompt-line/src/send-control.js.map +1 -0
- package/es-custom/components/prompt-line/src/send-control.scss.js +13 -0
- package/es-custom/components/prompt-line/src/send-control.scss.js.map +1 -0
- package/es-custom/components/prompt-line/src/stop-streaming-button.d.ts +42 -0
- package/es-custom/components/prompt-line/src/stop-streaming-button.js +93 -0
- package/es-custom/components/prompt-line/src/stop-streaming-button.js.map +1 -0
- package/es-custom/components/prompt-line/src/stop-streaming-button.scss.js +13 -0
- package/es-custom/components/prompt-line/src/stop-streaming-button.scss.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/build-extensions.d.ts +30 -0
- package/es-custom/components/prompt-line/src/tiptap/build-extensions.js +38 -0
- package/es-custom/components/prompt-line/src/tiptap/build-extensions.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/carbon-autocomplete.d.ts +21 -0
- package/es-custom/components/prompt-line/src/tiptap/carbon-autocomplete.js +127 -0
- package/es-custom/components/prompt-line/src/tiptap/carbon-autocomplete.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/carbon-mention.d.ts +19 -0
- package/es-custom/components/prompt-line/src/tiptap/carbon-mention.js +237 -0
- package/es-custom/components/prompt-line/src/tiptap/carbon-mention.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/carbon-starter-trigger.d.ts +22 -0
- package/es-custom/components/prompt-line/src/tiptap/carbon-starter-trigger.js +64 -0
- package/es-custom/components/prompt-line/src/tiptap/carbon-starter-trigger.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/chat-enter.d.ts +17 -0
- package/es-custom/components/prompt-line/src/tiptap/chat-enter.js +46 -0
- package/es-custom/components/prompt-line/src/tiptap/chat-enter.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/editor-styles.d.ts +18 -0
- package/es-custom/components/prompt-line/src/tiptap/editor-styles.js +83 -0
- package/es-custom/components/prompt-line/src/tiptap/editor-styles.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/index.d.ts +42 -0
- package/es-custom/components/prompt-line/src/tiptap/index.js +43 -0
- package/es-custom/components/prompt-line/src/tiptap/index.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/json-utils.d.ts +61 -0
- package/es-custom/components/prompt-line/src/tiptap/json-utils.js +158 -0
- package/es-custom/components/prompt-line/src/tiptap/json-utils.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/keymap.d.ts +31 -0
- package/es-custom/components/prompt-line/src/tiptap/keymap.js +59 -0
- package/es-custom/components/prompt-line/src/tiptap/keymap.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/origin-meta.d.ts +11 -0
- package/es-custom/components/prompt-line/src/tiptap/origin-meta.js +33 -0
- package/es-custom/components/prompt-line/src/tiptap/origin-meta.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/plain-text-paste.d.ts +16 -0
- package/es-custom/components/prompt-line/src/tiptap/plain-text-paste.js +85 -0
- package/es-custom/components/prompt-line/src/tiptap/plain-text-paste.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/render-in-light-dom.d.ts +87 -0
- package/es-custom/components/prompt-line/src/tiptap/render-in-light-dom.js +41 -0
- package/es-custom/components/prompt-line/src/tiptap/render-in-light-dom.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/render-token-chip.d.ts +57 -0
- package/es-custom/components/prompt-line/src/tiptap/render-token-chip.js +95 -0
- package/es-custom/components/prompt-line/src/tiptap/render-token-chip.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/token-node-view.d.ts +36 -0
- package/es-custom/components/prompt-line/src/tiptap/token-node-view.js +41 -0
- package/es-custom/components/prompt-line/src/tiptap/token-node-view.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/trigger-utils.d.ts +30 -0
- package/es-custom/components/prompt-line/src/tiptap/trigger-utils.js +44 -0
- package/es-custom/components/prompt-line/src/tiptap/trigger-utils.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/types.d.ts +161 -0
- package/es-custom/components/prompt-line/src/tiptap/types.js +8 -0
- package/es-custom/components/prompt-line/src/tiptap/types.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/typing-indicator.d.ts +30 -0
- package/es-custom/components/prompt-line/src/tiptap/typing-indicator.js +104 -0
- package/es-custom/components/prompt-line/src/tiptap/typing-indicator.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/value-sync.d.ts +25 -0
- package/es-custom/components/prompt-line/src/tiptap/value-sync.js +65 -0
- package/es-custom/components/prompt-line/src/tiptap/value-sync.js.map +1 -0
- package/es-custom/components/prompt-line/src/types.d.ts +100 -0
- package/es-custom/components/prompt-line/src/types.js +50 -0
- package/es-custom/components/prompt-line/src/types.js.map +1 -0
- package/es-custom/components/shared/media-utils/script-loader.js +0 -1
- package/es-custom/components/shared/media-utils/script-loader.js.map +1 -1
- package/es-custom/components/video-player/src/providers/base-provider.js +0 -1
- package/es-custom/components/video-player/src/providers/base-provider.js.map +1 -1
- package/es-custom/components/video-player/src/providers/kaltura-provider.js +0 -1
- package/es-custom/components/video-player/src/providers/kaltura-provider.js.map +1 -1
- package/es-custom/components/video-player/src/providers/native-video-provider.js +0 -1
- package/es-custom/components/video-player/src/providers/native-video-provider.js.map +1 -1
- package/es-custom/components/video-player/src/providers/vimeo-provider.js +0 -1
- package/es-custom/components/video-player/src/providers/vimeo-provider.js.map +1 -1
- package/es-custom/components/video-player/src/providers/youtube-provider.js +0 -1
- package/es-custom/components/video-player/src/providers/youtube-provider.js.map +1 -1
- package/es-custom/components/video-player/src/utils/url-detector.js +0 -1
- package/es-custom/components/video-player/src/utils/url-detector.js.map +1 -1
- package/es-custom/components/video-player/src/video-player.js +0 -1
- package/es-custom/components/video-player/src/video-player.js.map +1 -1
- package/es-custom/components/workspace-shell/src/header-collapsible-manager.js +0 -1
- package/es-custom/components/workspace-shell/src/header-collapsible-manager.js.map +1 -1
- package/es-custom/globals/utils/aria-announcer-manager.d.ts +62 -0
- package/es-custom/globals/utils/aria-announcer-manager.js +125 -0
- package/es-custom/globals/utils/aria-announcer-manager.js.map +1 -0
- package/es-custom/globals/utils/browser-utils.d.ts +10 -0
- package/es-custom/globals/utils/browser-utils.js +37 -0
- package/es-custom/globals/utils/browser-utils.js.map +1 -0
- package/es-custom/globals/utils/dom-utils.d.ts +6 -0
- package/es-custom/globals/utils/dom-utils.js +39 -0
- package/es-custom/globals/utils/dom-utils.js.map +1 -0
- package/{es/react → es-custom/globals}/utils/iconTransform.js +1 -2
- package/es-custom/globals/utils/iconTransform.js.map +1 -0
- package/es-custom/react/__tests__/jest.setup.js +1 -2
- package/es-custom/react/__tests__/jest.setup.js.map +1 -1
- package/es-custom/react/audio-player.js +0 -1
- package/es-custom/react/audio-player.js.map +1 -1
- package/es-custom/react/autocomplete.d.ts +11 -0
- package/es-custom/react/autocomplete.js +36 -0
- package/es-custom/react/autocomplete.js.map +1 -0
- package/es-custom/react/chat-header.js +1 -1
- package/es-custom/react/code-snippet.js +1 -1
- package/es-custom/react/error-message.d.ts +11 -0
- package/es-custom/react/error-message.js +28 -0
- package/es-custom/react/error-message.js.map +1 -0
- package/es-custom/react/file-uploads.d.ts +11 -0
- package/es-custom/react/file-uploads.js +31 -0
- package/es-custom/react/file-uploads.js.map +1 -0
- package/es-custom/react/hooks/useChatAutocomplete.d.ts +41 -0
- package/es-custom/react/hooks/useChatAutocomplete.js +178 -0
- package/es-custom/react/hooks/useChatAutocomplete.js.map +1 -0
- package/es-custom/react/input-send-control.d.ts +11 -0
- package/es-custom/react/input-send-control.js +32 -0
- package/es-custom/react/input-send-control.js.map +1 -0
- package/es-custom/react/prompt-line-shell.d.ts +18 -0
- package/es-custom/react/prompt-line-shell.js +36 -0
- package/es-custom/react/prompt-line-shell.js.map +1 -0
- package/es-custom/react/prompt-line.d.ts +25 -0
- package/es-custom/react/prompt-line.js +52 -0
- package/es-custom/react/prompt-line.js.map +1 -0
- package/es-custom/react/stop-streaming-button.d.ts +11 -0
- package/es-custom/react/stop-streaming-button.js +28 -0
- package/es-custom/react/stop-streaming-button.js.map +1 -0
- package/es-custom/react/toolbar.js +1 -1
- package/es-custom/react/transcript.js +0 -1
- package/es-custom/react/transcript.js.map +1 -1
- package/es-custom/react/utils/transformSuggestionConfig.d.ts +21 -0
- package/es-custom/react/utils/transformSuggestionConfig.js +67 -0
- package/es-custom/react/utils/transformSuggestionConfig.js.map +1 -0
- package/es-custom/react/video-player.js +0 -1
- package/es-custom/react/video-player.js.map +1 -1
- package/es-custom/testing/PageObjectId.js +1 -2
- package/es-custom/testing/PageObjectId.js.map +1 -1
- package/package.json +24 -3
- package/scss/_custom-properties.scss +1 -3
- package/scss/_tokens-component.scss +1 -3
- package/scss/_tokens-layout.scss +1 -3
- package/scss/_utilities.scss +1 -3
- package/LICENSE +0 -201
- package/es/components/chat-shell/src/aria-announcer-manager.d.ts +0 -40
- package/es/components/chat-shell/src/aria-announcer-manager.js +0 -104
- package/es/components/chat-shell/src/aria-announcer-manager.js.map +0 -1
- package/es/react/utils/iconTransform.js.map +0 -1
- package/es-custom/components/chat-shell/src/aria-announcer-manager.d.ts +0 -40
- package/es-custom/components/chat-shell/src/aria-announcer-manager.js +0 -104
- package/es-custom/components/chat-shell/src/aria-announcer-manager.js.map +0 -1
- package/es-custom/react/utils/iconTransform.js.map +0 -1
- /package/es/{react → globals}/utils/iconTransform.d.ts +0 -0
- /package/es-custom/{react → globals}/utils/iconTransform.d.ts +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*
|
|
4
|
+
* Copyright IBM Corp. 2026
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
import "./src/file-uploads.js";
|
|
10
|
+
import "./src/file-upload-item.js";
|
|
11
|
+
export { default as FileUploadsElement } from "./src/file-uploads.js";
|
|
12
|
+
export { default as FileUploadItemElement } from "./src/file-upload-item.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
|
|
8
|
+
export { default as FileUploadsElement } from './src/file-uploads.js';
|
|
9
|
+
export { default as FileUploadItemElement } from './src/file-upload-item.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*
|
|
4
|
+
* Copyright IBM Corp. 2026
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
import { LitElement, nothing } from "lit";
|
|
10
|
+
import "@carbon/web-components/es/components/file-uploader/index.js";
|
|
11
|
+
import type { FileUpload } from "../../prompt-line/src/types.js";
|
|
12
|
+
/**
|
|
13
|
+
* Renders a single file upload chip with an optional media preview or file-type icon.
|
|
14
|
+
*
|
|
15
|
+
* @element cds-aichat-file-upload-item
|
|
16
|
+
* @fires {CustomEvent<FileRemoveEventDetail>} cds-aichat-file-remove - Fired when the remove button is clicked
|
|
17
|
+
*/
|
|
18
|
+
declare class FileUploadItemElement extends LitElement {
|
|
19
|
+
static styles: import("lit").CSSResult;
|
|
20
|
+
/** The file upload data to render. */
|
|
21
|
+
upload: FileUpload | null;
|
|
22
|
+
/** Label for the remove file button. */
|
|
23
|
+
removeFileLabel: string;
|
|
24
|
+
/** Label for the uploading status. */
|
|
25
|
+
uploadingFileLabel: string;
|
|
26
|
+
/** Object URL created for image/video previews. Revoked on disconnect or when the file changes. */
|
|
27
|
+
private _objectURL;
|
|
28
|
+
/** The File instance the current object URL was created for. */
|
|
29
|
+
private _objectURLFile;
|
|
30
|
+
private _getOrCreateObjectURL;
|
|
31
|
+
private _hasMediaPreview;
|
|
32
|
+
firstUpdated(): void;
|
|
33
|
+
disconnectedCallback(): void;
|
|
34
|
+
private _renderPreview;
|
|
35
|
+
private _handleRemove;
|
|
36
|
+
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
37
|
+
}
|
|
38
|
+
declare global {
|
|
39
|
+
interface HTMLElementTagNameMap {
|
|
40
|
+
"cds-aichat-file-upload-item": FileUploadItemElement;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export default FileUploadItemElement;
|
|
@@ -0,0 +1,267 @@
|
|
|
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
|
+
|
|
8
|
+
import { __decorate } from 'tslib';
|
|
9
|
+
import { unsafeCSS, css, LitElement, nothing, html } from 'lit';
|
|
10
|
+
import { property } from 'lit/decorators.js';
|
|
11
|
+
import { carbonElement } from '../../../globals/decorators/carbon-element.js';
|
|
12
|
+
import { isBrowser } from '../../../globals/utils/browser-utils.js';
|
|
13
|
+
import prefix from '../../../globals/settings.js';
|
|
14
|
+
import '@carbon/web-components/es/components/file-uploader/index.js';
|
|
15
|
+
import { iconLoader } from '@carbon/web-components/es/globals/internal/icon-loader.js';
|
|
16
|
+
import DocumentPDF20 from '@carbon/icons/es/PDF/20.js';
|
|
17
|
+
import DocumentTXT20 from '@carbon/icons/es/TXT/20.js';
|
|
18
|
+
import DocumentXLS20 from '@carbon/icons/es/XLS/20.js';
|
|
19
|
+
import DocumentZIP20 from '@carbon/icons/es/ZIP/20.js';
|
|
20
|
+
import DocumentPPT20 from '@carbon/icons/es/PPT/20.js';
|
|
21
|
+
import DocumentCSV20 from '@carbon/icons/es/CSV/20.js';
|
|
22
|
+
import DocumentDOC20 from '@carbon/icons/es/DOC/20.js';
|
|
23
|
+
import DocumentHTML20 from '@carbon/icons/es/HTML/20.js';
|
|
24
|
+
import DocumentJSON20 from '@carbon/icons/es/JSON/20.js';
|
|
25
|
+
import PlayFilledAlt16 from '@carbon/icons/es/play--filled--alt/16.js';
|
|
26
|
+
import styles from './file-upload-item.scss.js';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @license
|
|
30
|
+
*
|
|
31
|
+
* Copyright IBM Corp. 2026
|
|
32
|
+
*
|
|
33
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
34
|
+
* LICENSE file in the root directory of this source tree.
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* Renders a single file upload chip with an optional media preview or file-type icon.
|
|
38
|
+
*
|
|
39
|
+
* @element cds-aichat-file-upload-item
|
|
40
|
+
* @fires {CustomEvent<FileRemoveEventDetail>} cds-aichat-file-remove - Fired when the remove button is clicked
|
|
41
|
+
*/
|
|
42
|
+
let FileUploadItemElement = class FileUploadItemElement extends LitElement {
|
|
43
|
+
constructor() {
|
|
44
|
+
super(...arguments);
|
|
45
|
+
/** The file upload data to render. */
|
|
46
|
+
this.upload = null;
|
|
47
|
+
/** Label for the remove file button. */
|
|
48
|
+
this.removeFileLabel = "Remove file";
|
|
49
|
+
/** Label for the uploading status. */
|
|
50
|
+
this.uploadingFileLabel = "Uploading";
|
|
51
|
+
/** Object URL created for image/video previews. Revoked on disconnect or when the file changes. */
|
|
52
|
+
this._objectURL = null;
|
|
53
|
+
/** The File instance the current object URL was created for. */
|
|
54
|
+
this._objectURLFile = null;
|
|
55
|
+
}
|
|
56
|
+
_getOrCreateObjectURL() {
|
|
57
|
+
if (this.upload && this._objectURLFile !== this.upload.file) {
|
|
58
|
+
if (this._objectURL) {
|
|
59
|
+
URL.revokeObjectURL(this._objectURL);
|
|
60
|
+
}
|
|
61
|
+
this._objectURL = URL.createObjectURL(this.upload.file);
|
|
62
|
+
this._objectURLFile = this.upload.file;
|
|
63
|
+
}
|
|
64
|
+
return this._objectURL;
|
|
65
|
+
}
|
|
66
|
+
_hasMediaPreview() {
|
|
67
|
+
if (!this.upload) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
const { type } = this.upload.file;
|
|
71
|
+
return type.startsWith("image/") || type.startsWith("video/");
|
|
72
|
+
}
|
|
73
|
+
firstUpdated() {
|
|
74
|
+
if (!this._hasMediaPreview()) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const uploaderItem = this.shadowRoot?.querySelector("cds-file-uploader-item");
|
|
78
|
+
const innerRoot = uploaderItem?.shadowRoot;
|
|
79
|
+
if (!innerRoot) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
// apply style that reduces margin when there is a media preview being rendered in the chip
|
|
83
|
+
const style = document.createElement("style");
|
|
84
|
+
style.textContent =
|
|
85
|
+
".cds--file-filename { margin-inline-start: 2px !important; }";
|
|
86
|
+
innerRoot.appendChild(style);
|
|
87
|
+
}
|
|
88
|
+
disconnectedCallback() {
|
|
89
|
+
super.disconnectedCallback();
|
|
90
|
+
if (this._objectURL) {
|
|
91
|
+
URL.revokeObjectURL(this._objectURL);
|
|
92
|
+
this._objectURL = null;
|
|
93
|
+
this._objectURLFile = null;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
_renderPreview() {
|
|
97
|
+
if (!this.upload) {
|
|
98
|
+
return nothing;
|
|
99
|
+
}
|
|
100
|
+
const { type, name } = this.upload.file;
|
|
101
|
+
// Image preview
|
|
102
|
+
if (type.startsWith("image/")) {
|
|
103
|
+
const url = this._getOrCreateObjectURL();
|
|
104
|
+
if (!url) {
|
|
105
|
+
return nothing;
|
|
106
|
+
}
|
|
107
|
+
return html `<span class="${prefix}-file-upload-item__preview-wrapper"
|
|
108
|
+
><img
|
|
109
|
+
class="${prefix}-file-upload-item__preview"
|
|
110
|
+
src="${url}"
|
|
111
|
+
width="36"
|
|
112
|
+
height="36"
|
|
113
|
+
alt=""
|
|
114
|
+
aria-hidden="true"
|
|
115
|
+
/></span>`;
|
|
116
|
+
}
|
|
117
|
+
// Video preview
|
|
118
|
+
if (type.startsWith("video/")) {
|
|
119
|
+
const url = this._getOrCreateObjectURL();
|
|
120
|
+
if (!url) {
|
|
121
|
+
return nothing;
|
|
122
|
+
}
|
|
123
|
+
const openVideo = () => {
|
|
124
|
+
const newWindow = isBrowser()
|
|
125
|
+
? window.open("", "_blank", "width=800,height=600")
|
|
126
|
+
: null;
|
|
127
|
+
if (!newWindow) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const style = newWindow.document.createElement("style");
|
|
131
|
+
style.textContent =
|
|
132
|
+
"* { margin: 0; padding: 0; background: #000 } video { display: block; width: 100%; height: 100vh; object-fit: contain }";
|
|
133
|
+
const video = newWindow.document.createElement("video");
|
|
134
|
+
video.src = url;
|
|
135
|
+
video.controls = true;
|
|
136
|
+
video.autoplay = true;
|
|
137
|
+
newWindow.document.title = name;
|
|
138
|
+
newWindow.document.head.appendChild(style);
|
|
139
|
+
newWindow.document.body.appendChild(video);
|
|
140
|
+
};
|
|
141
|
+
return html `<button
|
|
142
|
+
class="${prefix}-file-upload-item__preview-wrapper ${prefix}-file-upload-item__video-preview-wrapper"
|
|
143
|
+
type="button"
|
|
144
|
+
aria-label="Play video"
|
|
145
|
+
@click="${openVideo}"
|
|
146
|
+
>
|
|
147
|
+
<video
|
|
148
|
+
class="${prefix}-file-upload-item__preview"
|
|
149
|
+
src="${url}"
|
|
150
|
+
width="36"
|
|
151
|
+
height="36"
|
|
152
|
+
preload="metadata"
|
|
153
|
+
muted
|
|
154
|
+
playsinline
|
|
155
|
+
tabindex="-1"
|
|
156
|
+
aria-hidden="true"
|
|
157
|
+
@loadedmetadata="${(e) => {
|
|
158
|
+
e.target.currentTime = 0.1;
|
|
159
|
+
}}"
|
|
160
|
+
></video
|
|
161
|
+
><span class="${prefix}-file-upload-item__play-badge" aria-hidden="true"
|
|
162
|
+
>${iconLoader(PlayFilledAlt16)}</span
|
|
163
|
+
>
|
|
164
|
+
</button>`;
|
|
165
|
+
}
|
|
166
|
+
// File type icon (for supported icons)
|
|
167
|
+
const extension = name.split(".").pop()?.toLowerCase() ?? "";
|
|
168
|
+
const mime = type.toLowerCase();
|
|
169
|
+
const iconMap = [
|
|
170
|
+
[mime === "application/pdf" || extension === "pdf", DocumentPDF20],
|
|
171
|
+
[mime === "text/plain" || extension === "txt", DocumentTXT20],
|
|
172
|
+
[
|
|
173
|
+
mime === "application/vnd.ms-excel" ||
|
|
174
|
+
mime ===
|
|
175
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ||
|
|
176
|
+
extension === "xls" ||
|
|
177
|
+
extension === "xlsx",
|
|
178
|
+
DocumentXLS20,
|
|
179
|
+
],
|
|
180
|
+
[
|
|
181
|
+
mime === "application/zip" ||
|
|
182
|
+
mime === "application/x-zip-compressed" ||
|
|
183
|
+
extension === "zip",
|
|
184
|
+
DocumentZIP20,
|
|
185
|
+
],
|
|
186
|
+
[
|
|
187
|
+
mime === "application/vnd.ms-powerpoint" ||
|
|
188
|
+
mime ===
|
|
189
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation" ||
|
|
190
|
+
extension === "ppt" ||
|
|
191
|
+
extension === "pptx",
|
|
192
|
+
DocumentPPT20,
|
|
193
|
+
],
|
|
194
|
+
[mime === "text/csv" || extension === "csv", DocumentCSV20],
|
|
195
|
+
[
|
|
196
|
+
mime === "application/msword" ||
|
|
197
|
+
mime ===
|
|
198
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document" ||
|
|
199
|
+
extension === "doc" ||
|
|
200
|
+
extension === "docx",
|
|
201
|
+
DocumentDOC20,
|
|
202
|
+
],
|
|
203
|
+
[
|
|
204
|
+
mime === "text/html" || extension === "html" || extension === "htm",
|
|
205
|
+
DocumentHTML20,
|
|
206
|
+
],
|
|
207
|
+
[mime === "application/json" || extension === "json", DocumentJSON20],
|
|
208
|
+
];
|
|
209
|
+
const match = iconMap.find((entry) => entry[0] === true);
|
|
210
|
+
if (match) {
|
|
211
|
+
return html `<span
|
|
212
|
+
class="${prefix}-file-upload-item__icon"
|
|
213
|
+
aria-hidden="true"
|
|
214
|
+
>${iconLoader(match[1])}</span
|
|
215
|
+
>`;
|
|
216
|
+
}
|
|
217
|
+
return nothing;
|
|
218
|
+
}
|
|
219
|
+
_handleRemove() {
|
|
220
|
+
if (!this.upload) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
this.dispatchEvent(new CustomEvent("cds-aichat-file-remove", {
|
|
224
|
+
detail: { fileId: this.upload.id },
|
|
225
|
+
bubbles: true,
|
|
226
|
+
composed: true,
|
|
227
|
+
}));
|
|
228
|
+
}
|
|
229
|
+
render() {
|
|
230
|
+
if (!this.upload) {
|
|
231
|
+
return nothing;
|
|
232
|
+
}
|
|
233
|
+
return html `
|
|
234
|
+
<cds-file-uploader-item
|
|
235
|
+
size="md"
|
|
236
|
+
.state="${this.upload.status}"
|
|
237
|
+
.iconDescription="${this.upload.status === "uploading"
|
|
238
|
+
? this.uploadingFileLabel
|
|
239
|
+
: this.removeFileLabel}"
|
|
240
|
+
.errorSubject="${this.upload.errorMessage || ""}"
|
|
241
|
+
?invalid="${this.upload.isError}"
|
|
242
|
+
@cds-file-uploader-item-deleted="${this._handleRemove}"
|
|
243
|
+
>
|
|
244
|
+
${this._renderPreview()} ${this.upload.file.name}
|
|
245
|
+
</cds-file-uploader-item>
|
|
246
|
+
`;
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
FileUploadItemElement.styles = css `
|
|
250
|
+
${unsafeCSS(styles)}
|
|
251
|
+
`;
|
|
252
|
+
__decorate([
|
|
253
|
+
property({ type: Object, attribute: false })
|
|
254
|
+
], FileUploadItemElement.prototype, "upload", void 0);
|
|
255
|
+
__decorate([
|
|
256
|
+
property({ type: String, attribute: "remove-file-label" })
|
|
257
|
+
], FileUploadItemElement.prototype, "removeFileLabel", void 0);
|
|
258
|
+
__decorate([
|
|
259
|
+
property({ type: String, attribute: "uploading-file-label" })
|
|
260
|
+
], FileUploadItemElement.prototype, "uploadingFileLabel", void 0);
|
|
261
|
+
FileUploadItemElement = __decorate([
|
|
262
|
+
carbonElement(`${prefix}-file-upload-item`)
|
|
263
|
+
], FileUploadItemElement);
|
|
264
|
+
var FileUploadItemElement_default = FileUploadItemElement;
|
|
265
|
+
|
|
266
|
+
export { FileUploadItemElement_default as default };
|
|
267
|
+
//# sourceMappingURL=file-upload-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-upload-item.js","sources":["../../../../src/components/file-uploads/src/file-upload-item.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AA8BH;;;;;AAKG;AAEH,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,UAAU,CAAA;AAA9C,IAAA,WAAA,GAAA;;;QA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EAAA,qBAAA,CAAA,SAAA,EAAA,oBAAA,EAAA,MAAA,CAAA;AAf7B,qBAAqB,GAAA,UAAA,CAAA;AAD1B,IAAA,aAAa,CAAC,CAAA,EAAG,MAAM,CAAA,iBAAA,CAAmB;AACrC,CAAA,EAAA,qBAAqB,CAkP1B;AAQD,oCAAe,qBAAqB;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
|
|
8
|
+
import { css } from 'lit';
|
|
9
|
+
|
|
10
|
+
var styles = css([":host{display:block;margin-inline-end:.5rem}cds-file-uploader-item{border-radius:.5rem;font-size:var(--cds-body-compact-01-font-size,.875rem);font-weight:var(--cds-body-compact-01-font-weight,400);letter-spacing:var(--cds-body-compact-01-letter-spacing,.16px);line-height:var(--cds-body-compact-01-line-height,1.28572)}.cds-aichat-file-upload-item__preview-wrapper{block-size:36px;border-radius:6px;display:inline-block;inline-size:36px;margin-inline-end:1rem;overflow:hidden;position:relative;vertical-align:middle}.cds-aichat-file-upload-item__video-preview-wrapper{background:none;border:0;cursor:pointer;padding:0}.cds-aichat-file-upload-item__play-badge{align-items:center;background:rgba(0,0,0,.6);block-size:.75rem;border-radius:6px;display:flex;inline-size:1rem;inset-block-end:.125rem;inset-inline-end:0;inset-inline-start:.25rem;justify-content:center;pointer-events:none;position:absolute}.cds-aichat-file-upload-item__play-badge svg{fill:#fff;block-size:.5rem;inline-size:.5rem}.cds-aichat-file-upload-item__preview{block-size:100%;display:block;inline-size:100%;-o-object-fit:cover;object-fit:cover}.cds-aichat-file-upload-item__icon{align-items:center;display:inline-flex;margin-inline-end:.5rem;vertical-align:middle}"]);
|
|
11
|
+
|
|
12
|
+
export { styles as default };
|
|
13
|
+
//# sourceMappingURL=file-upload-item.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-upload-item.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*
|
|
4
|
+
* Copyright IBM Corp. 2026
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
import { LitElement, type PropertyValues } from "lit";
|
|
10
|
+
import type { FileUpload } from "../../prompt-line/src/types.js";
|
|
11
|
+
import "./file-upload-item.js";
|
|
12
|
+
/**
|
|
13
|
+
* Displays a list of file uploads with status indicators, and announces upload
|
|
14
|
+
* state changes (added / uploading / success / failure / removed) to screen
|
|
15
|
+
* readers via the shared {@link AriaAnnouncerManager}.
|
|
16
|
+
*
|
|
17
|
+
* The element stays mounted whenever uploading is available (even with no
|
|
18
|
+
* pending files) so its live regions survive removal of the last file; the host
|
|
19
|
+
* reflects a `has-uploads` attribute so the surrounding layout can collapse its
|
|
20
|
+
* spacing when empty.
|
|
21
|
+
*
|
|
22
|
+
* @element cds-aichat-file-uploads
|
|
23
|
+
* @fires {CustomEvent<FileRemoveEventDetail>} cds-aichat-file-remove - Fired when a file is removed
|
|
24
|
+
*/
|
|
25
|
+
declare class FileUploadsElement extends LitElement {
|
|
26
|
+
static styles: import("lit").CSSResult;
|
|
27
|
+
/** Array of file uploads to display. */
|
|
28
|
+
uploads: FileUpload[];
|
|
29
|
+
/** Label for the remove file button. */
|
|
30
|
+
removeFileLabel: string;
|
|
31
|
+
/** Label announced and shown while a file is uploading. */
|
|
32
|
+
uploadingFileLabel: string;
|
|
33
|
+
/** Announced when a file is removed from the upload list. */
|
|
34
|
+
fileRemovedLabel: string;
|
|
35
|
+
/** Announced when a file finishes uploading successfully. */
|
|
36
|
+
uploadSuccessLabel: string;
|
|
37
|
+
/** Announced when a file fails to upload. */
|
|
38
|
+
uploadFailureLabel: string;
|
|
39
|
+
/**
|
|
40
|
+
* Returns the announcement made when one or more files are added in the same
|
|
41
|
+
* frame. Receives the batch count so the consumer can localize and pluralize
|
|
42
|
+
* (correct plural rules are locale-specific). The default English formatter is
|
|
43
|
+
* for standalone use; `@carbon/ai-chat` supplies an `intl`-backed one. Files
|
|
44
|
+
* added together are announced once, not once per file.
|
|
45
|
+
*/
|
|
46
|
+
getFilesAddedText: (args: {
|
|
47
|
+
count: number;
|
|
48
|
+
}) => string;
|
|
49
|
+
/**
|
|
50
|
+
* Returns the announcement made when one or more files begin uploading in the
|
|
51
|
+
* same frame. Receives the batch count for localization/pluralization; the
|
|
52
|
+
* default English formatter is for standalone use.
|
|
53
|
+
*/
|
|
54
|
+
getFilesUploadingText: (args: {
|
|
55
|
+
count: number;
|
|
56
|
+
}) => string;
|
|
57
|
+
private _announcer;
|
|
58
|
+
/** Previous-frame snapshot keyed by upload id, used to detect transitions. */
|
|
59
|
+
private _snapshots;
|
|
60
|
+
protected firstUpdated(): void;
|
|
61
|
+
disconnectedCallback(): void;
|
|
62
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
63
|
+
private _snapshotOf;
|
|
64
|
+
/**
|
|
65
|
+
* Announce per-file status transitions by diffing the current uploads against
|
|
66
|
+
* the previous frame. The input list never carries a positive "complete"
|
|
67
|
+
* status (a finished assistant upload settles back to "edit"), so success is
|
|
68
|
+
* inferred from the `uploading → not-uploading` transition. Removals are
|
|
69
|
+
* announced from {@link _handleFileRemove} instead — diffing would also fire
|
|
70
|
+
* when uploads clear on send.
|
|
71
|
+
*
|
|
72
|
+
* Added and uploading transitions are coalesced: when several files are added
|
|
73
|
+
* or start uploading in the same frame, a single counted announcement is made
|
|
74
|
+
* (via {@link getFilesAddedText} / {@link getFilesUploadingText}) rather than
|
|
75
|
+
* one per file. Success and failure settle per file in their own frames, so
|
|
76
|
+
* they are announced inline.
|
|
77
|
+
*/
|
|
78
|
+
private _announceTransitions;
|
|
79
|
+
private _handleFileRemove;
|
|
80
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
81
|
+
}
|
|
82
|
+
declare global {
|
|
83
|
+
interface HTMLElementTagNameMap {
|
|
84
|
+
"cds-aichat-file-uploads": FileUploadsElement;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
export default FileUploadsElement;
|
|
@@ -0,0 +1,213 @@
|
|
|
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
|
+
|
|
8
|
+
import { __decorate } from 'tslib';
|
|
9
|
+
import { unsafeCSS, css, LitElement, nothing, html } from 'lit';
|
|
10
|
+
import { property } from 'lit/decorators.js';
|
|
11
|
+
import { AriaAnnouncerManager } from '../../../globals/utils/aria-announcer-manager.js';
|
|
12
|
+
import { carbonElement } from '../../../globals/decorators/carbon-element.js';
|
|
13
|
+
import prefix from '../../../globals/settings.js';
|
|
14
|
+
import './file-upload-item.js';
|
|
15
|
+
import styles from './file-uploads.scss.js';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @license
|
|
19
|
+
*
|
|
20
|
+
* Copyright IBM Corp. 2026
|
|
21
|
+
*
|
|
22
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
23
|
+
* LICENSE file in the root directory of this source tree.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Displays a list of file uploads with status indicators, and announces upload
|
|
27
|
+
* state changes (added / uploading / success / failure / removed) to screen
|
|
28
|
+
* readers via the shared {@link AriaAnnouncerManager}.
|
|
29
|
+
*
|
|
30
|
+
* The element stays mounted whenever uploading is available (even with no
|
|
31
|
+
* pending files) so its live regions survive removal of the last file; the host
|
|
32
|
+
* reflects a `has-uploads` attribute so the surrounding layout can collapse its
|
|
33
|
+
* spacing when empty.
|
|
34
|
+
*
|
|
35
|
+
* @element cds-aichat-file-uploads
|
|
36
|
+
* @fires {CustomEvent<FileRemoveEventDetail>} cds-aichat-file-remove - Fired when a file is removed
|
|
37
|
+
*/
|
|
38
|
+
let FileUploadsElement = class FileUploadsElement extends LitElement {
|
|
39
|
+
constructor() {
|
|
40
|
+
super(...arguments);
|
|
41
|
+
/** Array of file uploads to display. */
|
|
42
|
+
this.uploads = [];
|
|
43
|
+
/** Label for the remove file button. */
|
|
44
|
+
this.removeFileLabel = "Remove file";
|
|
45
|
+
/** Label announced and shown while a file is uploading. */
|
|
46
|
+
this.uploadingFileLabel = "Uploading file";
|
|
47
|
+
/** Announced when a file is removed from the upload list. */
|
|
48
|
+
this.fileRemovedLabel = "File removed.";
|
|
49
|
+
/** Announced when a file finishes uploading successfully. */
|
|
50
|
+
this.uploadSuccessLabel = "The file was uploaded successfully.";
|
|
51
|
+
/** Announced when a file fails to upload. */
|
|
52
|
+
this.uploadFailureLabel = "There was an error uploading the file.";
|
|
53
|
+
/**
|
|
54
|
+
* Returns the announcement made when one or more files are added in the same
|
|
55
|
+
* frame. Receives the batch count so the consumer can localize and pluralize
|
|
56
|
+
* (correct plural rules are locale-specific). The default English formatter is
|
|
57
|
+
* for standalone use; `@carbon/ai-chat` supplies an `intl`-backed one. Files
|
|
58
|
+
* added together are announced once, not once per file.
|
|
59
|
+
*/
|
|
60
|
+
this.getFilesAddedText = ({ count }) => count === 1 ? "File added." : `${count} files added.`;
|
|
61
|
+
/**
|
|
62
|
+
* Returns the announcement made when one or more files begin uploading in the
|
|
63
|
+
* same frame. Receives the batch count for localization/pluralization; the
|
|
64
|
+
* default English formatter is for standalone use.
|
|
65
|
+
*/
|
|
66
|
+
this.getFilesUploadingText = ({ count }) => count === 1 ? "Uploading file." : `Uploading ${count} files.`;
|
|
67
|
+
this._announcer = new AriaAnnouncerManager();
|
|
68
|
+
/** Previous-frame snapshot keyed by upload id, used to detect transitions. */
|
|
69
|
+
this._snapshots = new Map();
|
|
70
|
+
}
|
|
71
|
+
firstUpdated() {
|
|
72
|
+
const regions = this.renderRoot.querySelectorAll(`.${prefix}--file-uploads-live-region`);
|
|
73
|
+
this._announcer.connect(Array.from(regions));
|
|
74
|
+
// Seed from the initial uploads so the already-rendered set does not
|
|
75
|
+
// produce a burst of "added" announcements on first paint.
|
|
76
|
+
this._snapshots = this._snapshotOf(this.uploads);
|
|
77
|
+
}
|
|
78
|
+
disconnectedCallback() {
|
|
79
|
+
this._announcer.disconnect();
|
|
80
|
+
super.disconnectedCallback();
|
|
81
|
+
}
|
|
82
|
+
updated(changedProperties) {
|
|
83
|
+
if (changedProperties.has("uploads")) {
|
|
84
|
+
this.toggleAttribute("has-uploads", this.uploads.length > 0);
|
|
85
|
+
this._announceTransitions();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
_snapshotOf(uploads) {
|
|
89
|
+
return new Map(uploads.map((upload) => [
|
|
90
|
+
upload.id,
|
|
91
|
+
{ status: upload.status, isError: Boolean(upload.isError) },
|
|
92
|
+
]));
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Announce per-file status transitions by diffing the current uploads against
|
|
96
|
+
* the previous frame. The input list never carries a positive "complete"
|
|
97
|
+
* status (a finished assistant upload settles back to "edit"), so success is
|
|
98
|
+
* inferred from the `uploading → not-uploading` transition. Removals are
|
|
99
|
+
* announced from {@link _handleFileRemove} instead — diffing would also fire
|
|
100
|
+
* when uploads clear on send.
|
|
101
|
+
*
|
|
102
|
+
* Added and uploading transitions are coalesced: when several files are added
|
|
103
|
+
* or start uploading in the same frame, a single counted announcement is made
|
|
104
|
+
* (via {@link getFilesAddedText} / {@link getFilesUploadingText}) rather than
|
|
105
|
+
* one per file. Success and failure settle per file in their own frames, so
|
|
106
|
+
* they are announced inline.
|
|
107
|
+
*/
|
|
108
|
+
_announceTransitions() {
|
|
109
|
+
const previous = this._snapshots;
|
|
110
|
+
let addedCount = 0;
|
|
111
|
+
let uploadingCount = 0;
|
|
112
|
+
for (const upload of this.uploads) {
|
|
113
|
+
const before = previous.get(upload.id);
|
|
114
|
+
const isError = Boolean(upload.isError);
|
|
115
|
+
if (!before) {
|
|
116
|
+
// New item this frame.
|
|
117
|
+
if (upload.status === "uploading") {
|
|
118
|
+
uploadingCount += 1;
|
|
119
|
+
}
|
|
120
|
+
else if (isError) {
|
|
121
|
+
this._announcer.announce(this.uploadFailureLabel);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
addedCount += 1;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
else if (!before.isError && isError) {
|
|
128
|
+
this._announcer.announce(this.uploadFailureLabel);
|
|
129
|
+
}
|
|
130
|
+
else if (before.status === "uploading" &&
|
|
131
|
+
upload.status !== "uploading" &&
|
|
132
|
+
!isError) {
|
|
133
|
+
this._announcer.announce(this.uploadSuccessLabel);
|
|
134
|
+
}
|
|
135
|
+
else if (before.status !== "uploading" &&
|
|
136
|
+
upload.status === "uploading") {
|
|
137
|
+
// A staged file that begins uploading. Files staged in the input area
|
|
138
|
+
// start in the "edit" state and flip to "uploading" once their upload
|
|
139
|
+
// begins, so this transition fires for staged-then-uploaded files (the
|
|
140
|
+
// "added" announcement already fired when they were staged).
|
|
141
|
+
uploadingCount += 1;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (addedCount > 0) {
|
|
145
|
+
this._announcer.announce(this.getFilesAddedText({ count: addedCount }));
|
|
146
|
+
}
|
|
147
|
+
if (uploadingCount > 0) {
|
|
148
|
+
this._announcer.announce(this.getFilesUploadingText({ count: uploadingCount }));
|
|
149
|
+
}
|
|
150
|
+
this._snapshots = this._snapshotOf(this.uploads);
|
|
151
|
+
}
|
|
152
|
+
_handleFileRemove(_e) {
|
|
153
|
+
// Announce here rather than in the diff so we only speak on a user-initiated
|
|
154
|
+
// removal, not when uploads clear on send.
|
|
155
|
+
this._announcer.announce(this.fileRemovedLabel);
|
|
156
|
+
// Event was dispatched composed+bubbling from file-upload-item — it will
|
|
157
|
+
// continue to bubble to the consumer. No need to re-dispatch.
|
|
158
|
+
}
|
|
159
|
+
render() {
|
|
160
|
+
return html `
|
|
161
|
+
<div class="${prefix}--file-uploads-live-region" aria-live="polite"></div>
|
|
162
|
+
<div class="${prefix}--file-uploads-live-region" aria-live="polite"></div>
|
|
163
|
+
${this.uploads && this.uploads.length > 0
|
|
164
|
+
? html `
|
|
165
|
+
<div class="${prefix}--file-uploads-container">
|
|
166
|
+
${this.uploads.map((upload) => html `
|
|
167
|
+
<cds-aichat-file-upload-item
|
|
168
|
+
.upload="${upload}"
|
|
169
|
+
remove-file-label="${this.removeFileLabel}"
|
|
170
|
+
uploading-file-label="${this.uploadingFileLabel}"
|
|
171
|
+
@cds-aichat-file-remove="${this._handleFileRemove}"
|
|
172
|
+
></cds-aichat-file-upload-item>
|
|
173
|
+
`)}
|
|
174
|
+
</div>
|
|
175
|
+
`
|
|
176
|
+
: nothing}
|
|
177
|
+
`;
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
FileUploadsElement.styles = css `
|
|
181
|
+
${unsafeCSS(styles)}
|
|
182
|
+
`;
|
|
183
|
+
__decorate([
|
|
184
|
+
property({ type: Array, attribute: false })
|
|
185
|
+
], FileUploadsElement.prototype, "uploads", void 0);
|
|
186
|
+
__decorate([
|
|
187
|
+
property({ type: String, attribute: "remove-file-label" })
|
|
188
|
+
], FileUploadsElement.prototype, "removeFileLabel", void 0);
|
|
189
|
+
__decorate([
|
|
190
|
+
property({ type: String, attribute: "uploading-file-label" })
|
|
191
|
+
], FileUploadsElement.prototype, "uploadingFileLabel", void 0);
|
|
192
|
+
__decorate([
|
|
193
|
+
property({ type: String, attribute: "file-removed-label" })
|
|
194
|
+
], FileUploadsElement.prototype, "fileRemovedLabel", void 0);
|
|
195
|
+
__decorate([
|
|
196
|
+
property({ type: String, attribute: "upload-success-label" })
|
|
197
|
+
], FileUploadsElement.prototype, "uploadSuccessLabel", void 0);
|
|
198
|
+
__decorate([
|
|
199
|
+
property({ type: String, attribute: "upload-failure-label" })
|
|
200
|
+
], FileUploadsElement.prototype, "uploadFailureLabel", void 0);
|
|
201
|
+
__decorate([
|
|
202
|
+
property({ type: Object, attribute: false })
|
|
203
|
+
], FileUploadsElement.prototype, "getFilesAddedText", void 0);
|
|
204
|
+
__decorate([
|
|
205
|
+
property({ type: Object, attribute: false })
|
|
206
|
+
], FileUploadsElement.prototype, "getFilesUploadingText", void 0);
|
|
207
|
+
FileUploadsElement = __decorate([
|
|
208
|
+
carbonElement(`${prefix}-file-uploads`)
|
|
209
|
+
], FileUploadsElement);
|
|
210
|
+
var FileUploadsElement$1 = FileUploadsElement;
|
|
211
|
+
|
|
212
|
+
export { FileUploadsElement$1 as default };
|
|
213
|
+
//# sourceMappingURL=file-uploads.js.map
|