@ni/spright-components 6.16.0 → 6.17.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.
@@ -16876,8 +16876,55 @@ const t1=_t`
16876
16876
  width: 80px;
16877
16877
  margin: ${Ec};
16878
16878
  }
16879
+
16880
+ .attachments {
16881
+ display: none;
16882
+ }
16883
+
16884
+ .attachments.has-content {
16885
+ display: flex;
16886
+ flex-wrap: wrap;
16887
+ gap: ${Ec};
16888
+ padding: ${Ec};
16889
+ max-height: calc(${Mc} * 3 + ${Ec} * 4 );
16890
+ overflow-y: auto;
16891
+ }
16892
+
16893
+ .attachments ::slotted(*) {
16894
+ height: ${Mc};
16895
+ }
16896
+
16897
+ .footer {
16898
+ display: flex;
16899
+ flex-direction: row;
16900
+ align-items: flex-end;
16901
+ justify-content: flex-end;
16902
+ }
16903
+
16904
+ .footer-actions {
16905
+ display: none;
16906
+ flex: 1;
16907
+ }
16908
+
16909
+ .footer-actions.has-content {
16910
+ display: flex;
16911
+ align-items: center;
16912
+ flex-wrap: wrap;
16913
+ column-gap: ${Ec};
16914
+ margin: ${Ec};
16915
+ }
16916
+
16917
+ .footer-actions ::slotted(*) {
16918
+ height: ${Mc};
16919
+ }
16879
16920
  `,e1=J`
16880
16921
  <div class="container">
16922
+ <section class="attachments ${t=>t.attachmentsIsEmpty?"":"has-content"}">
16923
+ <slot
16924
+ name="attachments"
16925
+ ${Qt({property:"slottedAttachmentsElements"})}
16926
+ ></slot>
16927
+ </section>
16881
16928
  <textarea
16882
16929
  ${Pt("textArea")}
16883
16930
  placeholder="${t=>t.placeholder}"
@@ -16887,19 +16934,27 @@ const t1=_t`
16887
16934
  @keydown="${(t,e)=>t.textAreaKeydownHandler(e.event)}"
16888
16935
  @input="${t=>t.textAreaInputHandler()}"
16889
16936
  ></textarea>
16890
- <${Bg}
16891
- class="action-button"
16892
- appearance="block"
16893
- appearance-variant="${t=>t.processing?"primary":"accent"}"
16894
- ?disabled=${t=>!t.processing&&(t.sendDisabled||t.isInputEmpty)}
16895
- @click=${t=>t.processing?t.stopButtonClickHandler():t.sendButtonClickHandler()}
16896
- tabindex="${t=>t.tabIndex}"
16897
- title=${t=>t.processing?t.stopButtonLabel:t.sendButtonLabel}
16898
- content-hidden
16899
- >
16900
- ${t=>t.processing?t.stopButtonLabel:t.sendButtonLabel}
16901
- ${Ut(t=>t.processing,J`<${bb} slot="start"></${bb}>`,J`<${vb} slot="start"></${vb}>`)}
16902
- </${Bg}>
16937
+ <section class="footer">
16938
+ <section class="footer-actions ${t=>t.footerActionsIsEmpty?"":"has-content"}">
16939
+ <slot
16940
+ name="footer-actions"
16941
+ ${Qt({property:"slottedFooterActionsElements"})}
16942
+ ></slot>
16943
+ </section>
16944
+ <${Bg}
16945
+ class="action-button"
16946
+ appearance="block"
16947
+ appearance-variant="${t=>t.processing?"primary":"accent"}"
16948
+ ?disabled=${t=>!t.processing&&(t.sendDisabled||t.isInputEmpty)}
16949
+ @click=${t=>t.processing?t.stopButtonClickHandler():t.sendButtonClickHandler()}
16950
+ tabindex="${t=>t.tabIndex}"
16951
+ title=${t=>t.processing?t.stopButtonLabel:t.sendButtonLabel}
16952
+ content-hidden
16953
+ >
16954
+ ${t=>t.processing?t.stopButtonLabel:t.sendButtonLabel}
16955
+ ${Ut(t=>t.processing,J`<${bb} slot="start"></${bb}>`,J`<${vb} slot="start"></${vb}>`)}
16956
+ </${Bg}>
16957
+ </section>
16903
16958
  <${Km}
16904
16959
  severity="error"
16905
16960
  class="error-icon ${t=>t.scrollbarWidth>=0?"scrollbar-width-calculated":""}"
@@ -16907,11 +16962,11 @@ const t1=_t`
16907
16962
  ></${Km}>
16908
16963
  ${bv}
16909
16964
  </div>`
16910
- class n1 extends(yv(He)){constructor(){super(...arguments),this.value="",this.maxLength=-1,this.processing=!1,this.sendDisabled=!1,this.isInputEmpty=!0,this.scrollbarWidth=-1,this.updateScrollbarWidthQueued=!1}textAreaKeydownHandler(t){return!(t.key===sn&&!t.shiftKey)||(this.processing||this.sendButtonClickHandler(),!1)}textAreaInputHandler(){this.value=this.textArea.value,this.isInputEmpty=this.shouldDisableSendButton(),this.adjustTextAreaHeight(),this.queueUpdateScrollbarWidth()}placeholderChanged(){this.queueUpdateScrollbarWidth()}valueChanged(){this.textArea&&(this.textArea.value=this.value,this.isInputEmpty=this.shouldDisableSendButton(),this.adjustTextAreaHeight(),this.queueUpdateScrollbarWidth())}connectedCallback(){super.connectedCallback(),this.textArea.value=this.value,this.isInputEmpty=this.shouldDisableSendButton(),this.adjustTextAreaHeight(),this.resizeObserver=new ResizeObserver(()=>this.onResize()),this.resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver?.disconnect()}sendButtonClickHandler(){if(this.shouldDisableSendButton())return
16965
+ class n1 extends(yv(He)){constructor(){super(...arguments),this.value="",this.maxLength=-1,this.processing=!1,this.sendDisabled=!1,this.isInputEmpty=!0,this.scrollbarWidth=-1,this.footerActionsIsEmpty=!0,this.attachmentsIsEmpty=!0,this.updateScrollbarWidthQueued=!1}slottedFooterActionsElementsChanged(t,e){this.footerActionsIsEmpty=void 0===e||0===e.length}slottedAttachmentsElementsChanged(t,e){this.attachmentsIsEmpty=void 0===e||0===e.length}textAreaKeydownHandler(t){return!(t.key===sn&&!t.shiftKey)||(this.processing||this.sendButtonClickHandler(),!1)}textAreaInputHandler(){this.value=this.textArea.value,this.isInputEmpty=this.shouldDisableSendButton(),this.adjustTextAreaHeight(),this.queueUpdateScrollbarWidth()}placeholderChanged(){this.queueUpdateScrollbarWidth()}valueChanged(){this.textArea&&(this.textArea.value=this.value,this.isInputEmpty=this.shouldDisableSendButton(),this.adjustTextAreaHeight(),this.queueUpdateScrollbarWidth())}connectedCallback(){super.connectedCallback(),this.textArea.value=this.value,this.isInputEmpty=this.shouldDisableSendButton(),this.adjustTextAreaHeight(),this.resizeObserver=new ResizeObserver(()=>this.onResize()),this.resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver?.disconnect()}sendButtonClickHandler(){if(this.shouldDisableSendButton())return
16911
16966
  const t={text:this.textArea.value}
16912
16967
  this.resetInput(),this.$emit("send",t)}stopButtonClickHandler(){this.processing&&(this.$emit("stop"),this.textArea?.blur())}shouldDisableSendButton(){return 0===this.textArea.value.length}resetInput(){this.value="",this.isInputEmpty=!0,this.textArea&&(this.textArea.value="",this.adjustTextAreaHeight(),this.textArea.focus())}onResize(){this.adjustTextAreaHeight(),this.scrollbarWidth=this.textArea.offsetWidth-this.textArea.clientWidth}queueUpdateScrollbarWidth(){this.$fastController.isConnected&&(this.updateScrollbarWidthQueued||(this.updateScrollbarWidthQueued=!0,b.queueUpdate(()=>this.updateScrollbarWidth())))}adjustTextAreaHeight(){if(n1.fieldSizingSupported||!this.textArea)return
16913
16968
  const t=this.textArea
16914
- t.style.height="auto",t.style.height=`${t.scrollHeight}px`}updateScrollbarWidth(){this.updateScrollbarWidthQueued=!1,this.scrollbarWidth=this.textArea.offsetWidth-this.textArea.clientWidth}}n1.fieldSizingSupported=CSS.supports("field-sizing","content"),t([pt],n1.prototype,"placeholder",void 0),t([pt({attribute:"send-button-label"})],n1.prototype,"sendButtonLabel",void 0),t([pt({attribute:"stop-button-label"})],n1.prototype,"stopButtonLabel",void 0),t([pt],n1.prototype,"value",void 0),t([pt({attribute:"tabindex",converter:ht})],n1.prototype,"tabIndex",void 0),t([pt({attribute:"maxlength",converter:ht})],n1.prototype,"maxLength",void 0),t([pt({attribute:"processing",mode:"boolean"})],n1.prototype,"processing",void 0),t([pt({attribute:"send-disabled",mode:"boolean"})],n1.prototype,"sendDisabled",void 0),t([C],n1.prototype,"textArea",void 0),t([C],n1.prototype,"isInputEmpty",void 0),t([C],n1.prototype,"scrollbarWidth",void 0)
16969
+ t.style.height="auto",t.style.height=`${t.scrollHeight}px`}updateScrollbarWidth(){this.updateScrollbarWidthQueued=!1,this.scrollbarWidth=this.textArea.offsetWidth-this.textArea.clientWidth}}n1.fieldSizingSupported=CSS.supports("field-sizing","content"),t([pt],n1.prototype,"placeholder",void 0),t([pt({attribute:"send-button-label"})],n1.prototype,"sendButtonLabel",void 0),t([pt({attribute:"stop-button-label"})],n1.prototype,"stopButtonLabel",void 0),t([pt],n1.prototype,"value",void 0),t([pt({attribute:"tabindex",converter:ht})],n1.prototype,"tabIndex",void 0),t([pt({attribute:"maxlength",converter:ht})],n1.prototype,"maxLength",void 0),t([pt({attribute:"processing",mode:"boolean"})],n1.prototype,"processing",void 0),t([pt({attribute:"send-disabled",mode:"boolean"})],n1.prototype,"sendDisabled",void 0),t([C],n1.prototype,"textArea",void 0),t([C],n1.prototype,"isInputEmpty",void 0),t([C],n1.prototype,"scrollbarWidth",void 0),t([C],n1.prototype,"footerActionsIsEmpty",void 0),t([C],n1.prototype,"slottedFooterActionsElements",void 0),t([C],n1.prototype,"attachmentsIsEmpty",void 0),t([C],n1.prototype,"slottedAttachmentsElements",void 0)
16915
16970
  const i1=n1.compose({baseName:"chat-input",template:e1,styles:t1,shadowOptions:{delegatesFocus:!0}})
16916
16971
  Mi.getOrCreate().withPrefix("spright").register(i1())
16917
16972
  const o1={system:void 0,outbound:"outbound",inbound:"inbound"},r1=_t`