@ni/ok-components 0.2.9 → 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
|
|
@@ -96797,6 +96798,14 @@ focus outline in that case.
|
|
|
96797
96798
|
border-color: transparent;
|
|
96798
96799
|
}
|
|
96799
96800
|
|
|
96801
|
+
.toolbar {
|
|
96802
|
+
display: block;
|
|
96803
|
+
}
|
|
96804
|
+
|
|
96805
|
+
.toolbar.toolbar-empty {
|
|
96806
|
+
display: none;
|
|
96807
|
+
}
|
|
96808
|
+
|
|
96800
96809
|
.messages {
|
|
96801
96810
|
flex: 1;
|
|
96802
96811
|
display: flex;
|
|
@@ -96824,6 +96833,9 @@ focus outline in that case.
|
|
|
96824
96833
|
`;
|
|
96825
96834
|
|
|
96826
96835
|
const template$8 = html `
|
|
96836
|
+
<div class="toolbar ${x => (x.toolbarEmpty ? 'toolbar-empty' : '')}">
|
|
96837
|
+
<slot name="toolbar" ${slotted({ property: 'slottedToolbarElements' })}></slot>
|
|
96838
|
+
</div>
|
|
96827
96839
|
<div class="messages"><slot></slot></div>
|
|
96828
96840
|
<div class="input ${x => (x.inputEmpty ? 'input-empty' : '')}">
|
|
96829
96841
|
<slot name="input" ${slotted({ property: 'slottedInputElements' })}>
|
|
@@ -96847,10 +96859,15 @@ focus outline in that case.
|
|
|
96847
96859
|
this.appearance = ChatConversationAppearance.default;
|
|
96848
96860
|
/** @internal */
|
|
96849
96861
|
this.inputEmpty = true;
|
|
96862
|
+
/** @internal */
|
|
96863
|
+
this.toolbarEmpty = true;
|
|
96850
96864
|
}
|
|
96851
96865
|
slottedInputElementsChanged(_prev, next) {
|
|
96852
96866
|
this.inputEmpty = next === undefined || next.length === 0;
|
|
96853
96867
|
}
|
|
96868
|
+
slottedToolbarElementsChanged(_prev, next) {
|
|
96869
|
+
this.toolbarEmpty = next === undefined || next.length === 0;
|
|
96870
|
+
}
|
|
96854
96871
|
}
|
|
96855
96872
|
__decorate([
|
|
96856
96873
|
attr
|
|
@@ -96861,6 +96878,12 @@ focus outline in that case.
|
|
|
96861
96878
|
__decorate([
|
|
96862
96879
|
observable
|
|
96863
96880
|
], ChatConversation.prototype, "slottedInputElements", void 0);
|
|
96881
|
+
__decorate([
|
|
96882
|
+
observable
|
|
96883
|
+
], ChatConversation.prototype, "toolbarEmpty", void 0);
|
|
96884
|
+
__decorate([
|
|
96885
|
+
observable
|
|
96886
|
+
], ChatConversation.prototype, "slottedToolbarElements", void 0);
|
|
96864
96887
|
const sprightChatConversation = ChatConversation.compose({
|
|
96865
96888
|
baseName: 'chat-conversation',
|
|
96866
96889
|
template: template$8,
|
|
@@ -96939,7 +96962,7 @@ focus outline in that case.
|
|
|
96939
96962
|
color: ${controlLabelFontColor};
|
|
96940
96963
|
}
|
|
96941
96964
|
|
|
96942
|
-
.
|
|
96965
|
+
.action-button {
|
|
96943
96966
|
align-self: flex-end;
|
|
96944
96967
|
width: 80px;
|
|
96945
96968
|
margin: ${mediumPadding};
|
|
@@ -96958,18 +96981,18 @@ focus outline in that case.
|
|
|
96958
96981
|
@input="${x => x.textAreaInputHandler()}"
|
|
96959
96982
|
></textarea>
|
|
96960
96983
|
<${buttonTag}
|
|
96961
|
-
class="
|
|
96984
|
+
class="action-button"
|
|
96962
96985
|
appearance="block"
|
|
96963
|
-
appearance-variant="accent"
|
|
96964
|
-
?disabled=${x => x.disableSendButton}
|
|
96965
|
-
@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())}
|
|
96966
96989
|
tabindex="${x => x.tabIndex}"
|
|
96967
|
-
title=${x => x.sendButtonLabel}
|
|
96990
|
+
title=${x => (x.processing ? x.stopButtonLabel : x.sendButtonLabel)}
|
|
96968
96991
|
content-hidden
|
|
96969
96992
|
>
|
|
96970
|
-
${x => x.sendButtonLabel}
|
|
96971
|
-
|
|
96972
|
-
</${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}>
|
|
96973
96996
|
</div>`;
|
|
96974
96997
|
|
|
96975
96998
|
/**
|
|
@@ -96980,6 +97003,7 @@ focus outline in that case.
|
|
|
96980
97003
|
super(...arguments);
|
|
96981
97004
|
this.value = '';
|
|
96982
97005
|
this.maxLength = -1;
|
|
97006
|
+
this.processing = false;
|
|
96983
97007
|
/**
|
|
96984
97008
|
* @internal
|
|
96985
97009
|
*/
|
|
@@ -96990,6 +97014,9 @@ focus outline in that case.
|
|
|
96990
97014
|
*/
|
|
96991
97015
|
textAreaKeydownHandler(e) {
|
|
96992
97016
|
if (e.key === keyEnter && !e.shiftKey) {
|
|
97017
|
+
if (this.processing) {
|
|
97018
|
+
return false;
|
|
97019
|
+
}
|
|
96993
97020
|
this.sendButtonClickHandler();
|
|
96994
97021
|
return false;
|
|
96995
97022
|
}
|
|
@@ -97032,6 +97059,16 @@ focus outline in that case.
|
|
|
97032
97059
|
this.resetInput();
|
|
97033
97060
|
this.$emit('send', eventDetail);
|
|
97034
97061
|
}
|
|
97062
|
+
/**
|
|
97063
|
+
* @internal
|
|
97064
|
+
*/
|
|
97065
|
+
stopButtonClickHandler() {
|
|
97066
|
+
if (!this.processing) {
|
|
97067
|
+
return;
|
|
97068
|
+
}
|
|
97069
|
+
this.$emit('stop');
|
|
97070
|
+
this.textArea?.blur();
|
|
97071
|
+
}
|
|
97035
97072
|
shouldDisableSendButton() {
|
|
97036
97073
|
return this.textArea.value.length === 0;
|
|
97037
97074
|
}
|
|
@@ -97050,6 +97087,9 @@ focus outline in that case.
|
|
|
97050
97087
|
__decorate([
|
|
97051
97088
|
attr({ attribute: 'send-button-label' })
|
|
97052
97089
|
], ChatInput.prototype, "sendButtonLabel", void 0);
|
|
97090
|
+
__decorate([
|
|
97091
|
+
attr({ attribute: 'stop-button-label' })
|
|
97092
|
+
], ChatInput.prototype, "stopButtonLabel", void 0);
|
|
97053
97093
|
__decorate([
|
|
97054
97094
|
attr
|
|
97055
97095
|
], ChatInput.prototype, "value", void 0);
|
|
@@ -97059,6 +97099,9 @@ focus outline in that case.
|
|
|
97059
97099
|
__decorate([
|
|
97060
97100
|
attr({ attribute: 'maxlength', converter: nullableNumberConverter })
|
|
97061
97101
|
], ChatInput.prototype, "maxLength", void 0);
|
|
97102
|
+
__decorate([
|
|
97103
|
+
attr({ attribute: 'processing', mode: 'boolean' })
|
|
97104
|
+
], ChatInput.prototype, "processing", void 0);
|
|
97062
97105
|
__decorate([
|
|
97063
97106
|
observable
|
|
97064
97107
|
], ChatInput.prototype, "textArea", void 0);
|