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