@ni/ok-components 0.2.10 → 0.2.11

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.
@@ -24932,6 +24932,7 @@ so this becomes the fallback color for the slot */ ''}
24932
24932
  }
24933
24933
  }
24934
24934
  registerIconSvg('icon-stop-square', IconStopSquare);
24935
+ const iconStopSquareTag = 'nimble-icon-stop-square';
24935
24936
 
24936
24937
  // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
24937
24938
  // See generation source in nimble-components/build/generate-icons
@@ -96961,7 +96962,7 @@ focus outline in that case.
96961
96962
  color: ${controlLabelFontColor};
96962
96963
  }
96963
96964
 
96964
- .send-button {
96965
+ .action-button {
96965
96966
  align-self: flex-end;
96966
96967
  width: 80px;
96967
96968
  margin: ${mediumPadding};
@@ -96980,18 +96981,18 @@ focus outline in that case.
96980
96981
  @input="${x => x.textAreaInputHandler()}"
96981
96982
  ></textarea>
96982
96983
  <${buttonTag}
96983
- class="send-button"
96984
+ class="action-button"
96984
96985
  appearance="block"
96985
- appearance-variant="accent"
96986
- ?disabled=${x => x.disableSendButton}
96987
- @click=${x => x.sendButtonClickHandler()}
96986
+ appearance-variant="${x => (x.processing ? 'primary' : 'accent')}"
96987
+ ?disabled=${x => (x.processing ? false : x.disableSendButton)}
96988
+ @click=${x => (x.processing ? x.stopButtonClickHandler() : x.sendButtonClickHandler())}
96988
96989
  tabindex="${x => x.tabIndex}"
96989
- title=${x => x.sendButtonLabel}
96990
+ title=${x => (x.processing ? x.stopButtonLabel : x.sendButtonLabel)}
96990
96991
  content-hidden
96991
96992
  >
96992
- ${x => x.sendButtonLabel}
96993
- <${iconPaperPlaneTag} slot="start"><${iconPaperPlaneTag}/>
96994
- </${buttonTag}>
96993
+ ${x => (x.processing ? x.stopButtonLabel : x.sendButtonLabel)}
96994
+ ${when(x => x.processing, html `<${iconStopSquareTag} slot="start"></${iconStopSquareTag}>`, html `<${iconPaperPlaneTag} slot="start"></${iconPaperPlaneTag}>`)}
96995
+ </${buttonTag}>
96995
96996
  </div>`;
96996
96997
 
96997
96998
  /**
@@ -97002,6 +97003,7 @@ focus outline in that case.
97002
97003
  super(...arguments);
97003
97004
  this.value = '';
97004
97005
  this.maxLength = -1;
97006
+ this.processing = false;
97005
97007
  /**
97006
97008
  * @internal
97007
97009
  */
@@ -97012,6 +97014,9 @@ focus outline in that case.
97012
97014
  */
97013
97015
  textAreaKeydownHandler(e) {
97014
97016
  if (e.key === keyEnter && !e.shiftKey) {
97017
+ if (this.processing) {
97018
+ return false;
97019
+ }
97015
97020
  this.sendButtonClickHandler();
97016
97021
  return false;
97017
97022
  }
@@ -97054,6 +97059,16 @@ focus outline in that case.
97054
97059
  this.resetInput();
97055
97060
  this.$emit('send', eventDetail);
97056
97061
  }
97062
+ /**
97063
+ * @internal
97064
+ */
97065
+ stopButtonClickHandler() {
97066
+ if (!this.processing) {
97067
+ return;
97068
+ }
97069
+ this.$emit('stop');
97070
+ this.textArea?.blur();
97071
+ }
97057
97072
  shouldDisableSendButton() {
97058
97073
  return this.textArea.value.length === 0;
97059
97074
  }
@@ -97072,6 +97087,9 @@ focus outline in that case.
97072
97087
  __decorate([
97073
97088
  attr({ attribute: 'send-button-label' })
97074
97089
  ], ChatInput.prototype, "sendButtonLabel", void 0);
97090
+ __decorate([
97091
+ attr({ attribute: 'stop-button-label' })
97092
+ ], ChatInput.prototype, "stopButtonLabel", void 0);
97075
97093
  __decorate([
97076
97094
  attr
97077
97095
  ], ChatInput.prototype, "value", void 0);
@@ -97081,6 +97099,9 @@ focus outline in that case.
97081
97099
  __decorate([
97082
97100
  attr({ attribute: 'maxlength', converter: nullableNumberConverter })
97083
97101
  ], ChatInput.prototype, "maxLength", void 0);
97102
+ __decorate([
97103
+ attr({ attribute: 'processing', mode: 'boolean' })
97104
+ ], ChatInput.prototype, "processing", void 0);
97084
97105
  __decorate([
97085
97106
  observable
97086
97107
  ], ChatInput.prototype, "textArea", void 0);