@ni/ok-components 0.2.12 → 0.2.13
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.
|
@@ -96975,6 +96975,7 @@ focus outline in that case.
|
|
|
96975
96975
|
|
|
96976
96976
|
const styles$7 = css `
|
|
96977
96977
|
${display$1('flex')}
|
|
96978
|
+
${styles$Y}
|
|
96978
96979
|
|
|
96979
96980
|
:host {
|
|
96980
96981
|
width: 100%;
|
|
@@ -97016,6 +97017,22 @@ focus outline in that case.
|
|
|
97016
97017
|
border-bottom-color: ${borderHoverColor};
|
|
97017
97018
|
}
|
|
97018
97019
|
|
|
97020
|
+
:host([error-visible]) .container::after {
|
|
97021
|
+
border-bottom-color: ${failColor};
|
|
97022
|
+
}
|
|
97023
|
+
|
|
97024
|
+
:host([error-visible]) .container {
|
|
97025
|
+
border-bottom-color: ${failColor};
|
|
97026
|
+
}
|
|
97027
|
+
|
|
97028
|
+
:host([error-visible]:hover) .container::after {
|
|
97029
|
+
border-bottom-color: ${failColor};
|
|
97030
|
+
}
|
|
97031
|
+
|
|
97032
|
+
:host([error-visible]:focus-within) .container {
|
|
97033
|
+
border-bottom-color: ${failColor};
|
|
97034
|
+
}
|
|
97035
|
+
|
|
97019
97036
|
@media (prefers-reduced-motion) {
|
|
97020
97037
|
.container::after {
|
|
97021
97038
|
transition-duration: 0s;
|
|
@@ -97042,6 +97059,17 @@ focus outline in that case.
|
|
|
97042
97059
|
color: ${controlLabelFontColor};
|
|
97043
97060
|
}
|
|
97044
97061
|
|
|
97062
|
+
:host([error-visible]) .error-icon {
|
|
97063
|
+
display: none;
|
|
97064
|
+
}
|
|
97065
|
+
|
|
97066
|
+
:host([error-visible]) .error-icon.scrollbar-width-calculated {
|
|
97067
|
+
display: inline-flex;
|
|
97068
|
+
position: absolute;
|
|
97069
|
+
top: ${mediumPadding};
|
|
97070
|
+
right: var(--ni-private-scrollbar-width);
|
|
97071
|
+
}
|
|
97072
|
+
|
|
97045
97073
|
.action-button {
|
|
97046
97074
|
align-self: flex-end;
|
|
97047
97075
|
width: 80px;
|
|
@@ -97073,12 +97101,18 @@ focus outline in that case.
|
|
|
97073
97101
|
${x => (x.processing ? x.stopButtonLabel : x.sendButtonLabel)}
|
|
97074
97102
|
${when(x => x.processing, html `<${iconStopSquareTag} slot="start"></${iconStopSquareTag}>`, html `<${iconPaperPlaneTag} slot="start"></${iconPaperPlaneTag}>`)}
|
|
97075
97103
|
</${buttonTag}>
|
|
97104
|
+
<${iconExclamationMarkTag}
|
|
97105
|
+
severity="error"
|
|
97106
|
+
class="error-icon ${x => (x.scrollbarWidth >= 0 ? 'scrollbar-width-calculated' : '')}"
|
|
97107
|
+
style="--ni-private-scrollbar-width: ${x => x.scrollbarWidth}px;"
|
|
97108
|
+
></${iconExclamationMarkTag}>
|
|
97109
|
+
${errorTextTemplate}
|
|
97076
97110
|
</div>`;
|
|
97077
97111
|
|
|
97078
97112
|
/**
|
|
97079
97113
|
* A Spright component for composing and sending a chat message
|
|
97080
97114
|
*/
|
|
97081
|
-
class ChatInput extends FoundationElement {
|
|
97115
|
+
class ChatInput extends mixinErrorPattern(FoundationElement) {
|
|
97082
97116
|
constructor() {
|
|
97083
97117
|
super(...arguments);
|
|
97084
97118
|
this.value = '';
|
|
@@ -97088,6 +97122,12 @@ focus outline in that case.
|
|
|
97088
97122
|
* @internal
|
|
97089
97123
|
*/
|
|
97090
97124
|
this.disableSendButton = true;
|
|
97125
|
+
/**
|
|
97126
|
+
* The width of the vertical scrollbar, if displayed.
|
|
97127
|
+
* @internal
|
|
97128
|
+
*/
|
|
97129
|
+
this.scrollbarWidth = -1;
|
|
97130
|
+
this.updateScrollbarWidthQueued = false;
|
|
97091
97131
|
}
|
|
97092
97132
|
/**
|
|
97093
97133
|
* @internal
|
|
@@ -97108,6 +97148,19 @@ focus outline in that case.
|
|
|
97108
97148
|
textAreaInputHandler() {
|
|
97109
97149
|
this.value = this.textArea.value;
|
|
97110
97150
|
this.disableSendButton = this.shouldDisableSendButton();
|
|
97151
|
+
this.queueUpdateScrollbarWidth();
|
|
97152
|
+
}
|
|
97153
|
+
// If a property can affect whether a scrollbar is visible, we need to
|
|
97154
|
+
// call queueUpdateScrollbarWidth() when it changes. The exceptions are
|
|
97155
|
+
// properties that affect size (e.g. height, width, cols, rows), because
|
|
97156
|
+
// we already have a ResizeObserver handling those changes. Also,
|
|
97157
|
+
// a change to errorVisible cannot cause scrollbar visibility to change,
|
|
97158
|
+
// because we always reserve space for the error icon.
|
|
97159
|
+
/**
|
|
97160
|
+
* @internal
|
|
97161
|
+
*/
|
|
97162
|
+
placeholderChanged() {
|
|
97163
|
+
this.queueUpdateScrollbarWidth();
|
|
97111
97164
|
}
|
|
97112
97165
|
/**
|
|
97113
97166
|
* @internal
|
|
@@ -97116,6 +97169,7 @@ focus outline in that case.
|
|
|
97116
97169
|
if (this.textArea) {
|
|
97117
97170
|
this.textArea.value = this.value;
|
|
97118
97171
|
this.disableSendButton = this.shouldDisableSendButton();
|
|
97172
|
+
this.queueUpdateScrollbarWidth();
|
|
97119
97173
|
}
|
|
97120
97174
|
}
|
|
97121
97175
|
/**
|
|
@@ -97125,6 +97179,15 @@ focus outline in that case.
|
|
|
97125
97179
|
super.connectedCallback();
|
|
97126
97180
|
this.textArea.value = this.value;
|
|
97127
97181
|
this.disableSendButton = this.shouldDisableSendButton();
|
|
97182
|
+
this.resizeObserver = new ResizeObserver(() => this.onResize());
|
|
97183
|
+
this.resizeObserver.observe(this);
|
|
97184
|
+
}
|
|
97185
|
+
/**
|
|
97186
|
+
* @internal
|
|
97187
|
+
*/
|
|
97188
|
+
disconnectedCallback() {
|
|
97189
|
+
super.disconnectedCallback();
|
|
97190
|
+
this.resizeObserver?.disconnect();
|
|
97128
97191
|
}
|
|
97129
97192
|
/**
|
|
97130
97193
|
* @internal
|
|
@@ -97160,6 +97223,22 @@ focus outline in that case.
|
|
|
97160
97223
|
this.textArea.focus();
|
|
97161
97224
|
}
|
|
97162
97225
|
}
|
|
97226
|
+
onResize() {
|
|
97227
|
+
this.scrollbarWidth = this.textArea.offsetWidth - this.textArea.clientWidth;
|
|
97228
|
+
}
|
|
97229
|
+
queueUpdateScrollbarWidth() {
|
|
97230
|
+
if (!this.$fastController.isConnected) {
|
|
97231
|
+
return;
|
|
97232
|
+
}
|
|
97233
|
+
if (!this.updateScrollbarWidthQueued) {
|
|
97234
|
+
this.updateScrollbarWidthQueued = true;
|
|
97235
|
+
DOM.queueUpdate(() => this.updateScrollbarWidth());
|
|
97236
|
+
}
|
|
97237
|
+
}
|
|
97238
|
+
updateScrollbarWidth() {
|
|
97239
|
+
this.updateScrollbarWidthQueued = false;
|
|
97240
|
+
this.scrollbarWidth = this.textArea.offsetWidth - this.textArea.clientWidth;
|
|
97241
|
+
}
|
|
97163
97242
|
}
|
|
97164
97243
|
__decorate([
|
|
97165
97244
|
attr
|
|
@@ -97188,6 +97267,9 @@ focus outline in that case.
|
|
|
97188
97267
|
__decorate([
|
|
97189
97268
|
observable
|
|
97190
97269
|
], ChatInput.prototype, "disableSendButton", void 0);
|
|
97270
|
+
__decorate([
|
|
97271
|
+
observable
|
|
97272
|
+
], ChatInput.prototype, "scrollbarWidth", void 0);
|
|
97191
97273
|
const sprightChatInput = ChatInput.compose({
|
|
97192
97274
|
baseName: 'chat-input',
|
|
97193
97275
|
template: template$7,
|