@gitlab/duo-ui 8.14.0 → 8.14.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [8.14.2](https://gitlab.com/gitlab-org/duo-ui/compare/v8.14.1...v8.14.2) (2025-05-05)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **deps:** update dependency @floating-ui/dom to v1.7.0 ([e047457](https://gitlab.com/gitlab-org/duo-ui/commit/e047457020962c50ec78baef367593d78d9f9961))
7
+
8
+ ## [8.14.1](https://gitlab.com/gitlab-org/duo-ui/compare/v8.14.0...v8.14.1) (2025-05-01)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **chat:** Fix runtime error related to undefined element ([775fef2](https://gitlab.com/gitlab-org/duo-ui/commit/775fef27a59cd1d5891bb5c99d8aca430dbe0d51))
14
+
1
15
  # [8.14.0](https://gitlab.com/gitlab-org/duo-ui/compare/v8.13.2...v8.14.0) (2025-04-25)
2
16
 
3
17
 
@@ -266,7 +266,7 @@ var script = {
266
266
  prompt: '',
267
267
  scrolledToBottom: true,
268
268
  activeCommandIndex: 0,
269
- displaySubmitButton: true,
269
+ canSubmit: true,
270
270
  compositionJustEnded: false,
271
271
  contextItemsMenuIsOpen: false,
272
272
  contextItemMenuRef: null,
@@ -358,15 +358,15 @@ var script = {
358
358
  multiThreadedView(newView) {
359
359
  this.currentView = newView;
360
360
  },
361
- isLoading(newVal) {
362
- if (!newVal && !this.isStreaming) {
363
- this.displaySubmitButton = true; // Re-enable submit button when loading stops
361
+ isLoading(loading) {
362
+ if (!loading && !this.isStreaming) {
363
+ this.canSubmit = true; // Re-enable submit button when loading stops
364
364
  }
365
365
  this.isHidden = false;
366
366
  },
367
- isStreaming(newVal) {
368
- if (!newVal && !this.isLoading) {
369
- this.displaySubmitButton = true; // Re-enable submit button when streaming stops
367
+ isStreaming(streaming) {
368
+ if (!streaming && !this.isLoading) {
369
+ this.canSubmit = true; // Re-enable submit button when streaming stops
370
370
  }
371
371
  },
372
372
  lastMessage(newMessage) {
@@ -415,13 +415,12 @@ var script = {
415
415
  /**
416
416
  * Emitted when user clicks the stop button in the textarea
417
417
  */
418
-
419
- this.displaySubmitButton = true;
418
+ this.canSubmit = true;
420
419
  this.$emit('chat-cancel');
421
420
  this.setPromptAndFocus();
422
421
  },
423
422
  sendChatPrompt() {
424
- if (!this.displaySubmitButton || this.contextItemsMenuIsOpen) {
423
+ if (!this.canSubmit || this.contextItemsMenuIsOpen) {
425
424
  return;
426
425
  }
427
426
  if (this.prompt) {
@@ -430,7 +429,7 @@ var script = {
430
429
  return;
431
430
  }
432
431
  if (![CHAT_RESET_MESSAGE, CHAT_CLEAR_MESSAGE, CHAT_NEW_MESSAGE].includes(this.caseInsensitivePrompt)) {
433
- this.displaySubmitButton = false;
432
+ this.canSubmit = false;
434
433
  }
435
434
 
436
435
  /**
@@ -620,7 +619,7 @@ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=
620
619
  },attrs:{"width":_vm.shouldRenderResizable ? _vm.dimensions.width : null,"height":_vm.shouldRenderResizable ? _vm.dimensions.height : null,"max-width":_vm.shouldRenderResizable ? _vm.dimensions.maxWidth : null,"max-height":_vm.shouldRenderResizable ? _vm.dimensions.maxHeight : null,"min-width":_vm.shouldRenderResizable ? _vm.dimensions.minWidth : null,"left":_vm.shouldRenderResizable ? _vm.dimensions.left : null,"top":_vm.shouldRenderResizable ? _vm.dimensions.top : null,"fit-parent":true,"min-height":_vm.shouldRenderResizable ? _vm.dimensions.minHeight : null,"active":_vm.shouldRenderResizable ? ['l', 't', 'lt'] : null},on:{"resize:end":_vm.updateSize}},[(!_vm.isHidden)?_c('aside',{staticClass:"markdown-code-block duo-chat gl-bottom-0 gl-max-h-full gl-flex gl-flex-col",class:{
621
620
  'resizable-content': _vm.shouldRenderResizable,
622
621
  'duo-chat-drawer': !_vm.shouldRenderResizable,
623
- },attrs:{"id":"chat-component","role":"complementary","data-testid":"chat-component"}},[(_vm.showHeader)?_c('duo-chat-header',{ref:"header",attrs:{"active-thread-id":_vm.activeThreadId,"title":_vm.isMultithreaded && _vm.currentView === 'list' ? _vm.$options.i18n.CHAT_HISTORY_TITLE : _vm.title,"subtitle":_vm.activeThreadTitleForView,"error":_vm.error,"is-multithreaded":_vm.isMultithreaded,"current-view":_vm.currentView,"should-render-resizable":_vm.shouldRenderResizable,"badge-type":_vm.isMultithreaded ? null : _vm.badgeType},on:{"go-back":_vm.onGoBack,"new-chat":_vm.onNewChat,"close":_vm.hideChat},scopedSlots:_vm._u([{key:"subheader",fn:function(){return [_vm._t("subheader")]},proxy:true}],null,true)}):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-overflow-y-auto gl-flex gl-flex-col gl-flex-1 gl-flex-grow gl-bg-inherit gl-overscroll-contain",attrs:{"data-testid":"chat-history"},on:{"scroll":_vm.handleScrollingThrottled}},[(_vm.shouldShowThreadList)?_c('duo-chat-threads',{attrs:{"threads":_vm.threadList,"preferred-locale":_vm.preferredLocale},on:{"new-chat":_vm.onNewChat,"select-thread":_vm.onSelectThread,"delete-thread":_vm.onDeleteThread,"close":_vm.hideChat}}):_c('transition-group',{staticClass:"duo-chat-history gl-p-5 gl-mt-auto",attrs:{"mode":"out-in","tag":"section","name":"message"}},[_vm._l((_vm.conversations),function(conversation,index){return _c('duo-chat-conversation',{key:("conversation-" + index),attrs:{"enable-code-insertion":_vm.enableCodeInsertion,"messages":conversation,"canceled-request-ids":_vm.canceledRequestIds,"show-delimiter":index > 0,"with-feedback":_vm.withFeedback},on:{"track-feedback":_vm.onTrackFeedback,"insert-code-snippet":_vm.onInsertCodeSnippet,"copy-code-snippet":_vm.onCopyCodeSnippet,"copy-message":_vm.onCopyMessage,"get-context-item-content":_vm.onGetContextItemContent}})}),_vm._v(" "),(!_vm.hasMessages && !_vm.isLoading)?[_c('div',{key:"empty-state-message",staticClass:"duo-chat-message gl-rounded-bl-none gl-border-1 gl-border-solid gl-border-gray-50 gl-bg-gray-10 gl-p-4 gl-leading-20 gl-text-gray-900 gl-break-anywhere",attrs:{"data-testid":"gl-duo-chat-empty-state"}},[(_vm.emptyStateTitle)?_c('p',{staticClass:"gl-m-0",attrs:{"data-testid":"gl-duo-chat-empty-state-title"}},[_vm._v("\n "+_vm._s(_vm.emptyStateTitle)+"\n ")]):_vm._e(),_vm._v(" "),_c('duo-chat-predefined-prompts',{key:"predefined-prompts",attrs:{"prompts":_vm.predefinedPrompts},on:{"click":_vm.sendPredefinedPrompt}})],1)]:_vm._e(),_vm._v(" "),(_vm.isLoading)?_c('duo-chat-loader',{key:"loader",attrs:{"tool-name":_vm.toolName}}):_vm._e(),_vm._v(" "),_c('div',{key:"anchor",ref:"anchor",staticClass:"scroll-anchor"})],2)],1),_vm._v(" "),(_vm.isChatAvailable && !_vm.shouldShowThreadList)?_c('footer',{staticClass:"duo-chat-drawer-footer gl-border-0 gl-bg-default gl-pb-3 gl-shrink-0 gl-relative gl-z-2",class:{ 'duo-chat-drawer-body-scrim-on-footer': !_vm.scrolledToBottom },attrs:{"data-testid":"chat-footer"}},[_c('gl-form',{attrs:{"data-testid":"chat-prompt-form"},on:{"submit":function($event){$event.stopPropagation();$event.preventDefault();return _vm.sendChatPrompt.apply(null, arguments)}}},[_c('div',{staticClass:"gl-relative gl-max-w-full"},[_vm._t("context-items-menu",null,{"isOpen":_vm.contextItemsMenuIsOpen,"onClose":_vm.closeContextItemsMenuOpen,"setRef":_vm.setContextItemsMenuRef,"focusPrompt":_vm.focusChatInput})],2),_vm._v(" "),_c('gl-form-input-group',{scopedSlots:_vm._u([{key:"append",fn:function(){return [(_vm.displaySubmitButton)?_c('gl-button',{staticClass:"!gl-absolute gl-bottom-2 gl-right-2 !gl-rounded-full",attrs:{"icon":"paper-airplane","category":"primary","variant":"confirm","type":"submit","data-testid":"chat-prompt-submit-button","aria-label":_vm.$options.i18n.CHAT_SUBMIT_LABEL}}):_c('gl-button',{staticClass:"!gl-absolute gl-bottom-2 gl-right-2 !gl-rounded-full",attrs:{"icon":"stop","category":"primary","variant":"default","data-testid":"chat-prompt-cancel-button","aria-label":_vm.$options.i18n.CHAT_CANCEL_LABEL},on:{"click":_vm.cancelPrompt}})]},proxy:true}],null,false,608602988)},[_c('div',{staticClass:"duo-chat-input gl-min-h-8 gl-max-w-full gl-grow gl-align-top",attrs:{"data-value":_vm.prompt}},[(_vm.shouldShowSlashCommands)?_c('gl-card',{ref:"commands",staticClass:"slash-commands !gl-absolute gl-w-full -gl-translate-y-full gl-list-none gl-pl-0 gl-shadow-md",attrs:{"body-class":"!gl-p-2"}},_vm._l((_vm.filteredSlashCommands),function(command,index){return _c('gl-dropdown-item',{key:command.name,class:{ 'active-command': index === _vm.activeCommandIndex },on:{"click":function($event){return _vm.selectSlashCommand(index)}},nativeOn:{"mouseenter":function($event){_vm.activeCommandIndex = index;}}},[_c('span',{staticClass:"gl-flex gl-justify-between"},[_c('span',{staticClass:"gl-block"},[_vm._v(_vm._s(command.name))]),_vm._v(" "),_c('small',{staticClass:"gl-pl-3 gl-text-right gl-italic gl-text-subtle"},[_vm._v(_vm._s(command.description))])])])}),1):_vm._e(),_vm._v(" "),_c('gl-form-textarea',{ref:"prompt",staticClass:"gl-absolute !gl-h-full gl-rounded-br-none gl-rounded-tr-none !gl-bg-transparent !gl-py-4 !gl-shadow-none",class:{ 'gl-truncate': !_vm.prompt },attrs:{"data-testid":"chat-prompt-input","placeholder":_vm.inputPlaceholder,"autofocus":""},on:{"compositionend":_vm.compositionEnd},nativeOn:{"keydown":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }if($event.ctrlKey||$event.shiftKey||$event.altKey||$event.metaKey){ return null; }$event.preventDefault();},"keyup":function($event){return _vm.onInputKeyup.apply(null, arguments)}},model:{value:(_vm.prompt),callback:function ($$v) {_vm.prompt=$$v;},expression:"prompt"}})],1)])],1),_vm._v(" "),_c('p',{staticClass:"gl-mb-0 gl-mt-3 gl-px-4 gl-text-sm gl-text-secondary"},[_vm._v("\n "+_vm._s(_vm.$options.i18n.CHAT_DISCLAMER)+"\n ")])],1):_vm._e()],1):_vm._e()])};
622
+ },attrs:{"id":"chat-component","role":"complementary","data-testid":"chat-component"}},[(_vm.showHeader)?_c('duo-chat-header',{ref:"header",attrs:{"active-thread-id":_vm.activeThreadId,"title":_vm.isMultithreaded && _vm.currentView === 'list' ? _vm.$options.i18n.CHAT_HISTORY_TITLE : _vm.title,"subtitle":_vm.activeThreadTitleForView,"error":_vm.error,"is-multithreaded":_vm.isMultithreaded,"current-view":_vm.currentView,"should-render-resizable":_vm.shouldRenderResizable,"badge-type":_vm.isMultithreaded ? null : _vm.badgeType},on:{"go-back":_vm.onGoBack,"new-chat":_vm.onNewChat,"close":_vm.hideChat},scopedSlots:_vm._u([{key:"subheader",fn:function(){return [_vm._t("subheader")]},proxy:true}],null,true)}):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-overflow-y-auto gl-flex gl-flex-col gl-flex-1 gl-flex-grow gl-bg-inherit gl-overscroll-contain",attrs:{"data-testid":"chat-history"},on:{"scroll":_vm.handleScrollingThrottled}},[(_vm.shouldShowThreadList)?_c('duo-chat-threads',{attrs:{"threads":_vm.threadList,"preferred-locale":_vm.preferredLocale},on:{"new-chat":_vm.onNewChat,"select-thread":_vm.onSelectThread,"delete-thread":_vm.onDeleteThread,"close":_vm.hideChat}}):_c('transition-group',{staticClass:"duo-chat-history gl-p-5 gl-mt-auto",attrs:{"mode":"out-in","tag":"section","name":"message"}},[_vm._l((_vm.conversations),function(conversation,index){return _c('duo-chat-conversation',{key:("conversation-" + index),attrs:{"enable-code-insertion":_vm.enableCodeInsertion,"messages":conversation,"canceled-request-ids":_vm.canceledRequestIds,"show-delimiter":index > 0,"with-feedback":_vm.withFeedback},on:{"track-feedback":_vm.onTrackFeedback,"insert-code-snippet":_vm.onInsertCodeSnippet,"copy-code-snippet":_vm.onCopyCodeSnippet,"copy-message":_vm.onCopyMessage,"get-context-item-content":_vm.onGetContextItemContent}})}),_vm._v(" "),(!_vm.hasMessages && !_vm.isLoading)?[_c('div',{key:"empty-state-message",staticClass:"duo-chat-message gl-rounded-bl-none gl-border-1 gl-border-solid gl-border-gray-50 gl-bg-gray-10 gl-p-4 gl-leading-20 gl-text-gray-900 gl-break-anywhere",attrs:{"data-testid":"gl-duo-chat-empty-state"}},[(_vm.emptyStateTitle)?_c('p',{staticClass:"gl-m-0",attrs:{"data-testid":"gl-duo-chat-empty-state-title"}},[_vm._v("\n "+_vm._s(_vm.emptyStateTitle)+"\n ")]):_vm._e(),_vm._v(" "),_c('duo-chat-predefined-prompts',{key:"predefined-prompts",attrs:{"prompts":_vm.predefinedPrompts},on:{"click":_vm.sendPredefinedPrompt}})],1)]:_vm._e(),_vm._v(" "),(_vm.isLoading)?_c('duo-chat-loader',{key:"loader",attrs:{"tool-name":_vm.toolName}}):_vm._e(),_vm._v(" "),_c('div',{key:"anchor",ref:"anchor",staticClass:"scroll-anchor"})],2)],1),_vm._v(" "),(_vm.isChatAvailable && !_vm.shouldShowThreadList)?_c('footer',{staticClass:"duo-chat-drawer-footer gl-border-0 gl-bg-default gl-pb-3 gl-shrink-0 gl-relative gl-z-2",class:{ 'duo-chat-drawer-body-scrim-on-footer': !_vm.scrolledToBottom },attrs:{"data-testid":"chat-footer"}},[_c('gl-form',{attrs:{"data-testid":"chat-prompt-form"},on:{"submit":function($event){$event.stopPropagation();$event.preventDefault();return _vm.sendChatPrompt.apply(null, arguments)}}},[_c('div',{staticClass:"gl-relative gl-max-w-full"},[_vm._t("context-items-menu",null,{"isOpen":_vm.contextItemsMenuIsOpen,"onClose":_vm.closeContextItemsMenuOpen,"setRef":_vm.setContextItemsMenuRef,"focusPrompt":_vm.focusChatInput})],2),_vm._v(" "),_c('gl-form-input-group',{scopedSlots:_vm._u([{key:"append",fn:function(){return [(_vm.canSubmit)?_c('gl-button',{staticClass:"!gl-absolute gl-bottom-2 gl-right-2 !gl-rounded-full",attrs:{"icon":"paper-airplane","category":"primary","variant":"confirm","type":"submit","data-testid":"chat-prompt-submit-button","aria-label":_vm.$options.i18n.CHAT_SUBMIT_LABEL}}):_c('gl-button',{staticClass:"!gl-absolute gl-bottom-2 gl-right-2 !gl-rounded-full",attrs:{"icon":"stop","category":"primary","variant":"default","data-testid":"chat-prompt-cancel-button","aria-label":_vm.$options.i18n.CHAT_CANCEL_LABEL},on:{"click":_vm.cancelPrompt}})]},proxy:true}],null,false,3738248012)},[_c('div',{staticClass:"duo-chat-input gl-min-h-8 gl-max-w-full gl-grow gl-align-top",attrs:{"data-value":_vm.prompt}},[(_vm.shouldShowSlashCommands)?_c('gl-card',{ref:"commands",staticClass:"slash-commands !gl-absolute gl-w-full -gl-translate-y-full gl-list-none gl-pl-0 gl-shadow-md",attrs:{"body-class":"!gl-p-2"}},_vm._l((_vm.filteredSlashCommands),function(command,index){return _c('gl-dropdown-item',{key:command.name,class:{ 'active-command': index === _vm.activeCommandIndex },on:{"click":function($event){return _vm.selectSlashCommand(index)}},nativeOn:{"mouseenter":function($event){_vm.activeCommandIndex = index;}}},[_c('span',{staticClass:"gl-flex gl-justify-between"},[_c('span',{staticClass:"gl-block"},[_vm._v(_vm._s(command.name))]),_vm._v(" "),_c('small',{staticClass:"gl-pl-3 gl-text-right gl-italic gl-text-subtle"},[_vm._v(_vm._s(command.description))])])])}),1):_vm._e(),_vm._v(" "),_c('gl-form-textarea',{ref:"prompt",staticClass:"gl-absolute !gl-h-full gl-rounded-br-none gl-rounded-tr-none !gl-bg-transparent !gl-py-4 !gl-shadow-none",class:{ 'gl-truncate': !_vm.prompt },attrs:{"disabled":!_vm.canSubmit,"data-testid":"chat-prompt-input","placeholder":_vm.inputPlaceholder,"autofocus":""},on:{"compositionend":_vm.compositionEnd},nativeOn:{"keydown":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }if($event.ctrlKey||$event.shiftKey||$event.altKey||$event.metaKey){ return null; }$event.preventDefault();},"keyup":function($event){return _vm.onInputKeyup.apply(null, arguments)}},model:{value:(_vm.prompt),callback:function ($$v) {_vm.prompt=$$v;},expression:"prompt"}})],1)])],1),_vm._v(" "),_c('p',{staticClass:"gl-mb-0 gl-mt-3 gl-px-4 gl-text-sm gl-text-secondary"},[_vm._v("\n "+_vm._s(_vm.$options.i18n.CHAT_DISCLAMER)+"\n ")])],1):_vm._e()],1):_vm._e()])};
624
623
  var __vue_staticRenderFns__ = [];
625
624
 
626
625
  /* style */
@@ -42,12 +42,14 @@ var script = {
42
42
  computeTransitionWidth() {
43
43
  const container = this.$refs.transition;
44
44
  const active = this.$refs.currentTransition[0]; // There's only one `currentTransition` ref at a time, but refs in v-for loops are always Arrays
45
- const {
46
- width,
47
- height
48
- } = active.getBoundingClientRect();
49
- container.$el.style.width = `${width}px`;
50
- container.$el.style.height = `${height}px`;
45
+ if (active) {
46
+ const {
47
+ width,
48
+ height
49
+ } = active.getBoundingClientRect();
50
+ container.$el.style.width = `${width}px`;
51
+ container.$el.style.height = `${height}px`;
52
+ }
51
53
  },
52
54
  enter() {
53
55
  clearTimeout(this.timeout);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/duo-ui",
3
- "version": "8.14.0",
3
+ "version": "8.14.2",
4
4
  "description": "Duo UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -63,7 +63,7 @@
63
63
  "tailwind-config-viewer:export": "tailwind-config-viewer export ./tailwind-config-viewer-static"
64
64
  },
65
65
  "dependencies": {
66
- "@floating-ui/dom": "1.6.13",
66
+ "@floating-ui/dom": "1.7.0",
67
67
  "echarts": "^5.3.2",
68
68
  "iframe-resizer": "^4.3.2",
69
69
  "lodash": "^4.17.20",
@@ -92,15 +92,15 @@
92
92
  },
93
93
  "devDependencies": {
94
94
  "@arkweid/lefthook": "0.7.7",
95
- "@babel/core": "^7.26.10",
95
+ "@babel/core": "^7.27.1",
96
96
  "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
97
97
  "@babel/plugin-proposal-optional-chaining": "^7.21.0",
98
- "@babel/preset-env": "^7.26.9",
99
- "@babel/preset-react": "^7.26.3",
98
+ "@babel/preset-env": "^7.27.1",
99
+ "@babel/preset-react": "^7.27.1",
100
100
  "@gitlab/eslint-plugin": "20.7.1",
101
101
  "@gitlab/fonts": "^1.3.0",
102
102
  "@gitlab/stylelint-config": "6.2.2",
103
- "@gitlab/svgs": "^3.127.0",
103
+ "@gitlab/svgs": "^3.128.0",
104
104
  "@gitlab/ui": "latest",
105
105
  "@jest/test-sequencer": "^29.7.0",
106
106
  "@rollup/plugin-commonjs": "^11.1.0",
@@ -324,7 +324,7 @@ export default {
324
324
  prompt: '',
325
325
  scrolledToBottom: true,
326
326
  activeCommandIndex: 0,
327
- displaySubmitButton: true,
327
+ canSubmit: true,
328
328
  compositionJustEnded: false,
329
329
  contextItemsMenuIsOpen: false,
330
330
  contextItemMenuRef: null,
@@ -430,15 +430,15 @@ export default {
430
430
  multiThreadedView(newView) {
431
431
  this.currentView = newView;
432
432
  },
433
- isLoading(newVal) {
434
- if (!newVal && !this.isStreaming) {
435
- this.displaySubmitButton = true; // Re-enable submit button when loading stops
433
+ isLoading(loading) {
434
+ if (!loading && !this.isStreaming) {
435
+ this.canSubmit = true; // Re-enable submit button when loading stops
436
436
  }
437
437
  this.isHidden = false;
438
438
  },
439
- isStreaming(newVal) {
440
- if (!newVal && !this.isLoading) {
441
- this.displaySubmitButton = true; // Re-enable submit button when streaming stops
439
+ isStreaming(streaming) {
440
+ if (!streaming && !this.isLoading) {
441
+ this.canSubmit = true; // Re-enable submit button when streaming stops
442
442
  }
443
443
  },
444
444
  lastMessage(newMessage) {
@@ -489,13 +489,12 @@ export default {
489
489
  /**
490
490
  * Emitted when user clicks the stop button in the textarea
491
491
  */
492
-
493
- this.displaySubmitButton = true;
492
+ this.canSubmit = true;
494
493
  this.$emit('chat-cancel');
495
494
  this.setPromptAndFocus();
496
495
  },
497
496
  sendChatPrompt() {
498
- if (!this.displaySubmitButton || this.contextItemsMenuIsOpen) {
497
+ if (!this.canSubmit || this.contextItemsMenuIsOpen) {
499
498
  return;
500
499
  }
501
500
  if (this.prompt) {
@@ -512,7 +511,7 @@ export default {
512
511
  this.caseInsensitivePrompt
513
512
  )
514
513
  ) {
515
- this.displaySubmitButton = false;
514
+ this.canSubmit = false;
516
515
  }
517
516
 
518
517
  /**
@@ -842,6 +841,7 @@ export default {
842
841
  <gl-form-textarea
843
842
  ref="prompt"
844
843
  v-model="prompt"
844
+ :disabled="!canSubmit"
845
845
  data-testid="chat-prompt-input"
846
846
  class="gl-absolute !gl-h-full gl-rounded-br-none gl-rounded-tr-none !gl-bg-transparent !gl-py-4 !gl-shadow-none"
847
847
  :class="{ 'gl-truncate': !prompt }"
@@ -854,7 +854,7 @@ export default {
854
854
  </div>
855
855
  <template #append>
856
856
  <gl-button
857
- v-if="displaySubmitButton"
857
+ v-if="canSubmit"
858
858
  icon="paper-airplane"
859
859
  category="primary"
860
860
  variant="confirm"
@@ -51,9 +51,11 @@ export default {
51
51
  computeTransitionWidth() {
52
52
  const container = this.$refs.transition;
53
53
  const active = this.$refs.currentTransition[0]; // There's only one `currentTransition` ref at a time, but refs in v-for loops are always Arrays
54
- const { width, height } = active.getBoundingClientRect();
55
- container.$el.style.width = `${width}px`;
56
- container.$el.style.height = `${height}px`;
54
+ if (active) {
55
+ const { width, height } = active.getBoundingClientRect();
56
+ container.$el.style.width = `${width}px`;
57
+ container.$el.style.height = `${height}px`;
58
+ }
57
59
  },
58
60
  enter() {
59
61
  clearTimeout(this.timeout);