@ni/spright-components 6.10.5 → 6.11.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.
- package/dist/all-components-bundle.js +12 -7
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +3 -3
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/custom-elements.json +145 -128
- package/dist/custom-elements.md +31 -29
- package/dist/esm/chat/input/index.d.ts +3 -1
- package/dist/esm/chat/input/index.js +11 -6
- package/dist/esm/chat/input/index.js.map +1 -1
- package/dist/esm/chat/input/template.js +1 -1
- package/dist/esm/chat/input/template.js.map +1 -1
- package/dist/esm/chat/input/testing/chat-input.pageobject.js +1 -1
- package/dist/esm/chat/input/testing/chat-input.pageobject.js.map +1 -1
- package/package.json +1 -1
|
@@ -49,134 +49,6 @@
|
|
|
49
49
|
}
|
|
50
50
|
]
|
|
51
51
|
},
|
|
52
|
-
{
|
|
53
|
-
"kind": "javascript-module",
|
|
54
|
-
"path": "src/chat/conversation/index.ts",
|
|
55
|
-
"declarations": [
|
|
56
|
-
{
|
|
57
|
-
"kind": "class",
|
|
58
|
-
"description": "A Spright component for displaying a series of chat messages",
|
|
59
|
-
"name": "ChatConversation",
|
|
60
|
-
"members": [
|
|
61
|
-
{
|
|
62
|
-
"kind": "field",
|
|
63
|
-
"name": "appearance",
|
|
64
|
-
"privacy": "public"
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"kind": "method",
|
|
68
|
-
"name": "slottedInputElementsChanged",
|
|
69
|
-
"privacy": "public",
|
|
70
|
-
"return": {
|
|
71
|
-
"type": {
|
|
72
|
-
"text": "void"
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
"parameters": [
|
|
76
|
-
{
|
|
77
|
-
"name": "_prev",
|
|
78
|
-
"type": {
|
|
79
|
-
"text": "HTMLElement[] | undefined"
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
"name": "next",
|
|
84
|
-
"type": {
|
|
85
|
-
"text": "HTMLElement[] | undefined"
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
]
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
"kind": "method",
|
|
92
|
-
"name": "slottedToolbarElementsChanged",
|
|
93
|
-
"privacy": "public",
|
|
94
|
-
"return": {
|
|
95
|
-
"type": {
|
|
96
|
-
"text": "void"
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
"parameters": [
|
|
100
|
-
{
|
|
101
|
-
"name": "_prev",
|
|
102
|
-
"type": {
|
|
103
|
-
"text": "HTMLElement[] | undefined"
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
"name": "next",
|
|
108
|
-
"type": {
|
|
109
|
-
"text": "HTMLElement[] | undefined"
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
]
|
|
113
|
-
}
|
|
114
|
-
],
|
|
115
|
-
"attributes": [
|
|
116
|
-
{
|
|
117
|
-
"name": "appearance",
|
|
118
|
-
"fieldName": "appearance"
|
|
119
|
-
}
|
|
120
|
-
],
|
|
121
|
-
"superclass": {
|
|
122
|
-
"name": "FoundationElement",
|
|
123
|
-
"package": "@ni/fast-foundation"
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
"kind": "variable",
|
|
128
|
-
"name": "chatConversationTag",
|
|
129
|
-
"type": {
|
|
130
|
-
"text": "string"
|
|
131
|
-
},
|
|
132
|
-
"default": "'spright-chat-conversation'"
|
|
133
|
-
}
|
|
134
|
-
],
|
|
135
|
-
"exports": [
|
|
136
|
-
{
|
|
137
|
-
"kind": "js",
|
|
138
|
-
"name": "ChatConversation",
|
|
139
|
-
"declaration": {
|
|
140
|
-
"name": "ChatConversation",
|
|
141
|
-
"module": "src/chat/conversation/index.ts"
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
"kind": "js",
|
|
146
|
-
"name": "chatConversationTag",
|
|
147
|
-
"declaration": {
|
|
148
|
-
"name": "chatConversationTag",
|
|
149
|
-
"module": "src/chat/conversation/index.ts"
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
]
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
"kind": "javascript-module",
|
|
156
|
-
"path": "src/chat/conversation/types.ts",
|
|
157
|
-
"declarations": [
|
|
158
|
-
{
|
|
159
|
-
"kind": "variable",
|
|
160
|
-
"name": "ChatConversationAppearance",
|
|
161
|
-
"type": {
|
|
162
|
-
"text": "{\n default: undefined,\n overlay: 'overlay'\n}"
|
|
163
|
-
},
|
|
164
|
-
"default": "{ default: undefined, overlay: 'overlay' }",
|
|
165
|
-
"description": "Appearances of chat conversation.",
|
|
166
|
-
"privacy": "public"
|
|
167
|
-
}
|
|
168
|
-
],
|
|
169
|
-
"exports": [
|
|
170
|
-
{
|
|
171
|
-
"kind": "js",
|
|
172
|
-
"name": "ChatConversationAppearance",
|
|
173
|
-
"declaration": {
|
|
174
|
-
"name": "ChatConversationAppearance",
|
|
175
|
-
"module": "src/chat/conversation/types.ts"
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
]
|
|
179
|
-
},
|
|
180
52
|
{
|
|
181
53
|
"kind": "javascript-module",
|
|
182
54
|
"path": "src/chat/input/index.ts",
|
|
@@ -245,6 +117,15 @@
|
|
|
245
117
|
"privacy": "public",
|
|
246
118
|
"default": "false"
|
|
247
119
|
},
|
|
120
|
+
{
|
|
121
|
+
"kind": "field",
|
|
122
|
+
"name": "sendDisabled",
|
|
123
|
+
"type": {
|
|
124
|
+
"text": "boolean"
|
|
125
|
+
},
|
|
126
|
+
"privacy": "public",
|
|
127
|
+
"default": "false"
|
|
128
|
+
},
|
|
248
129
|
{
|
|
249
130
|
"kind": "field",
|
|
250
131
|
"name": "resizeObserver",
|
|
@@ -365,6 +246,14 @@
|
|
|
365
246
|
},
|
|
366
247
|
"default": "false",
|
|
367
248
|
"fieldName": "processing"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"name": "send-disabled",
|
|
252
|
+
"type": {
|
|
253
|
+
"text": "boolean"
|
|
254
|
+
},
|
|
255
|
+
"default": "false",
|
|
256
|
+
"fieldName": "sendDisabled"
|
|
368
257
|
}
|
|
369
258
|
],
|
|
370
259
|
"mixins": [
|
|
@@ -412,6 +301,134 @@
|
|
|
412
301
|
"declarations": [],
|
|
413
302
|
"exports": []
|
|
414
303
|
},
|
|
304
|
+
{
|
|
305
|
+
"kind": "javascript-module",
|
|
306
|
+
"path": "src/chat/conversation/index.ts",
|
|
307
|
+
"declarations": [
|
|
308
|
+
{
|
|
309
|
+
"kind": "class",
|
|
310
|
+
"description": "A Spright component for displaying a series of chat messages",
|
|
311
|
+
"name": "ChatConversation",
|
|
312
|
+
"members": [
|
|
313
|
+
{
|
|
314
|
+
"kind": "field",
|
|
315
|
+
"name": "appearance",
|
|
316
|
+
"privacy": "public"
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"kind": "method",
|
|
320
|
+
"name": "slottedInputElementsChanged",
|
|
321
|
+
"privacy": "public",
|
|
322
|
+
"return": {
|
|
323
|
+
"type": {
|
|
324
|
+
"text": "void"
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
"parameters": [
|
|
328
|
+
{
|
|
329
|
+
"name": "_prev",
|
|
330
|
+
"type": {
|
|
331
|
+
"text": "HTMLElement[] | undefined"
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"name": "next",
|
|
336
|
+
"type": {
|
|
337
|
+
"text": "HTMLElement[] | undefined"
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
]
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
"kind": "method",
|
|
344
|
+
"name": "slottedToolbarElementsChanged",
|
|
345
|
+
"privacy": "public",
|
|
346
|
+
"return": {
|
|
347
|
+
"type": {
|
|
348
|
+
"text": "void"
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
"parameters": [
|
|
352
|
+
{
|
|
353
|
+
"name": "_prev",
|
|
354
|
+
"type": {
|
|
355
|
+
"text": "HTMLElement[] | undefined"
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
"name": "next",
|
|
360
|
+
"type": {
|
|
361
|
+
"text": "HTMLElement[] | undefined"
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
]
|
|
365
|
+
}
|
|
366
|
+
],
|
|
367
|
+
"attributes": [
|
|
368
|
+
{
|
|
369
|
+
"name": "appearance",
|
|
370
|
+
"fieldName": "appearance"
|
|
371
|
+
}
|
|
372
|
+
],
|
|
373
|
+
"superclass": {
|
|
374
|
+
"name": "FoundationElement",
|
|
375
|
+
"package": "@ni/fast-foundation"
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
"kind": "variable",
|
|
380
|
+
"name": "chatConversationTag",
|
|
381
|
+
"type": {
|
|
382
|
+
"text": "string"
|
|
383
|
+
},
|
|
384
|
+
"default": "'spright-chat-conversation'"
|
|
385
|
+
}
|
|
386
|
+
],
|
|
387
|
+
"exports": [
|
|
388
|
+
{
|
|
389
|
+
"kind": "js",
|
|
390
|
+
"name": "ChatConversation",
|
|
391
|
+
"declaration": {
|
|
392
|
+
"name": "ChatConversation",
|
|
393
|
+
"module": "src/chat/conversation/index.ts"
|
|
394
|
+
}
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
"kind": "js",
|
|
398
|
+
"name": "chatConversationTag",
|
|
399
|
+
"declaration": {
|
|
400
|
+
"name": "chatConversationTag",
|
|
401
|
+
"module": "src/chat/conversation/index.ts"
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
]
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
"kind": "javascript-module",
|
|
408
|
+
"path": "src/chat/conversation/types.ts",
|
|
409
|
+
"declarations": [
|
|
410
|
+
{
|
|
411
|
+
"kind": "variable",
|
|
412
|
+
"name": "ChatConversationAppearance",
|
|
413
|
+
"type": {
|
|
414
|
+
"text": "{\n default: undefined,\n overlay: 'overlay'\n}"
|
|
415
|
+
},
|
|
416
|
+
"default": "{ default: undefined, overlay: 'overlay' }",
|
|
417
|
+
"description": "Appearances of chat conversation.",
|
|
418
|
+
"privacy": "public"
|
|
419
|
+
}
|
|
420
|
+
],
|
|
421
|
+
"exports": [
|
|
422
|
+
{
|
|
423
|
+
"kind": "js",
|
|
424
|
+
"name": "ChatConversationAppearance",
|
|
425
|
+
"declaration": {
|
|
426
|
+
"name": "ChatConversationAppearance",
|
|
427
|
+
"module": "src/chat/conversation/types.ts"
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
]
|
|
431
|
+
},
|
|
415
432
|
{
|
|
416
433
|
"kind": "javascript-module",
|
|
417
434
|
"path": "src/chat/message/index.ts",
|
package/dist/custom-elements.md
CHANGED
|
@@ -8,35 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
<hr/>
|
|
10
10
|
|
|
11
|
-
## class: `ChatConversation`
|
|
12
|
-
|
|
13
|
-
### Superclass
|
|
14
|
-
|
|
15
|
-
| Name | Module | Package |
|
|
16
|
-
| ------------------- | ------ | ------------------- |
|
|
17
|
-
| `FoundationElement` | | @ni/fast-foundation |
|
|
18
|
-
|
|
19
|
-
### Fields
|
|
20
|
-
|
|
21
|
-
| Name | Privacy | Type | Default | Description | Inherited From |
|
|
22
|
-
| ------------ | ------- | ---- | ------- | ----------- | -------------- |
|
|
23
|
-
| `appearance` | public | | | | |
|
|
24
|
-
|
|
25
|
-
### Methods
|
|
26
|
-
|
|
27
|
-
| Name | Privacy | Description | Parameters | Return | Inherited From |
|
|
28
|
-
| ------------------------------- | ------- | ----------- | --------------------------------------------------------------------- | ------ | -------------- |
|
|
29
|
-
| `slottedInputElementsChanged` | public | | `_prev: HTMLElement[] \| undefined, next: HTMLElement[] \| undefined` | `void` | |
|
|
30
|
-
| `slottedToolbarElementsChanged` | public | | `_prev: HTMLElement[] \| undefined, next: HTMLElement[] \| undefined` | `void` | |
|
|
31
|
-
|
|
32
|
-
### Attributes
|
|
33
|
-
|
|
34
|
-
| Name | Field | Inherited From |
|
|
35
|
-
| ------------ | ---------- | -------------- |
|
|
36
|
-
| `appearance` | appearance | |
|
|
37
|
-
|
|
38
|
-
<hr/>
|
|
39
|
-
|
|
40
11
|
## class: `ChatInput`
|
|
41
12
|
|
|
42
13
|
### Superclass
|
|
@@ -56,6 +27,7 @@
|
|
|
56
27
|
| `tabIndex` | public | `number` | | | |
|
|
57
28
|
| `maxLength` | public | `number \| undefined` | `-1` | | |
|
|
58
29
|
| `processing` | public | `boolean` | `false` | | |
|
|
30
|
+
| `sendDisabled` | public | `boolean` | `false` | | |
|
|
59
31
|
|
|
60
32
|
### Attributes
|
|
61
33
|
|
|
@@ -68,6 +40,36 @@
|
|
|
68
40
|
| `tabindex` | tabIndex | |
|
|
69
41
|
| `maxlength` | maxLength | |
|
|
70
42
|
| `processing` | processing | |
|
|
43
|
+
| `send-disabled` | sendDisabled | |
|
|
44
|
+
|
|
45
|
+
<hr/>
|
|
46
|
+
|
|
47
|
+
## class: `ChatConversation`
|
|
48
|
+
|
|
49
|
+
### Superclass
|
|
50
|
+
|
|
51
|
+
| Name | Module | Package |
|
|
52
|
+
| ------------------- | ------ | ------------------- |
|
|
53
|
+
| `FoundationElement` | | @ni/fast-foundation |
|
|
54
|
+
|
|
55
|
+
### Fields
|
|
56
|
+
|
|
57
|
+
| Name | Privacy | Type | Default | Description | Inherited From |
|
|
58
|
+
| ------------ | ------- | ---- | ------- | ----------- | -------------- |
|
|
59
|
+
| `appearance` | public | | | | |
|
|
60
|
+
|
|
61
|
+
### Methods
|
|
62
|
+
|
|
63
|
+
| Name | Privacy | Description | Parameters | Return | Inherited From |
|
|
64
|
+
| ------------------------------- | ------- | ----------- | --------------------------------------------------------------------- | ------ | -------------- |
|
|
65
|
+
| `slottedInputElementsChanged` | public | | `_prev: HTMLElement[] \| undefined, next: HTMLElement[] \| undefined` | `void` | |
|
|
66
|
+
| `slottedToolbarElementsChanged` | public | | `_prev: HTMLElement[] \| undefined, next: HTMLElement[] \| undefined` | `void` | |
|
|
67
|
+
|
|
68
|
+
### Attributes
|
|
69
|
+
|
|
70
|
+
| Name | Field | Inherited From |
|
|
71
|
+
| ------------ | ---------- | -------------- |
|
|
72
|
+
| `appearance` | appearance | |
|
|
71
73
|
|
|
72
74
|
<hr/>
|
|
73
75
|
|
|
@@ -25,14 +25,16 @@ export declare class ChatInput extends ChatInput_base {
|
|
|
25
25
|
tabIndex: number;
|
|
26
26
|
maxLength?: number;
|
|
27
27
|
processing: boolean;
|
|
28
|
+
sendDisabled: boolean;
|
|
28
29
|
/**
|
|
29
30
|
* @internal
|
|
30
31
|
*/
|
|
31
32
|
textArea?: HTMLTextAreaElement;
|
|
32
33
|
/**
|
|
34
|
+
* Tracks whether the send button should be disabled based on input value
|
|
33
35
|
* @internal
|
|
34
36
|
*/
|
|
35
|
-
|
|
37
|
+
isInputEmpty: boolean;
|
|
36
38
|
/**
|
|
37
39
|
* The width of the vertical scrollbar, if displayed.
|
|
38
40
|
* @internal
|
|
@@ -14,10 +14,12 @@ export class ChatInput extends mixinErrorPattern(FoundationElement) {
|
|
|
14
14
|
this.value = '';
|
|
15
15
|
this.maxLength = -1;
|
|
16
16
|
this.processing = false;
|
|
17
|
+
this.sendDisabled = false;
|
|
17
18
|
/**
|
|
19
|
+
* Tracks whether the send button should be disabled based on input value
|
|
18
20
|
* @internal
|
|
19
21
|
*/
|
|
20
|
-
this.
|
|
22
|
+
this.isInputEmpty = true;
|
|
21
23
|
/**
|
|
22
24
|
* The width of the vertical scrollbar, if displayed.
|
|
23
25
|
* @internal
|
|
@@ -43,7 +45,7 @@ export class ChatInput extends mixinErrorPattern(FoundationElement) {
|
|
|
43
45
|
*/
|
|
44
46
|
textAreaInputHandler() {
|
|
45
47
|
this.value = this.textArea.value;
|
|
46
|
-
this.
|
|
48
|
+
this.isInputEmpty = this.shouldDisableSendButton();
|
|
47
49
|
this.queueUpdateScrollbarWidth();
|
|
48
50
|
}
|
|
49
51
|
// If a property can affect whether a scrollbar is visible, we need to
|
|
@@ -64,7 +66,7 @@ export class ChatInput extends mixinErrorPattern(FoundationElement) {
|
|
|
64
66
|
valueChanged() {
|
|
65
67
|
if (this.textArea) {
|
|
66
68
|
this.textArea.value = this.value;
|
|
67
|
-
this.
|
|
69
|
+
this.isInputEmpty = this.shouldDisableSendButton();
|
|
68
70
|
this.queueUpdateScrollbarWidth();
|
|
69
71
|
}
|
|
70
72
|
}
|
|
@@ -74,7 +76,7 @@ export class ChatInput extends mixinErrorPattern(FoundationElement) {
|
|
|
74
76
|
connectedCallback() {
|
|
75
77
|
super.connectedCallback();
|
|
76
78
|
this.textArea.value = this.value;
|
|
77
|
-
this.
|
|
79
|
+
this.isInputEmpty = this.shouldDisableSendButton();
|
|
78
80
|
this.resizeObserver = new ResizeObserver(() => this.onResize());
|
|
79
81
|
this.resizeObserver.observe(this);
|
|
80
82
|
}
|
|
@@ -113,7 +115,7 @@ export class ChatInput extends mixinErrorPattern(FoundationElement) {
|
|
|
113
115
|
}
|
|
114
116
|
resetInput() {
|
|
115
117
|
this.value = '';
|
|
116
|
-
this.
|
|
118
|
+
this.isInputEmpty = true;
|
|
117
119
|
if (this.textArea) {
|
|
118
120
|
this.textArea.value = '';
|
|
119
121
|
this.textArea.focus();
|
|
@@ -157,12 +159,15 @@ __decorate([
|
|
|
157
159
|
__decorate([
|
|
158
160
|
attr({ attribute: 'processing', mode: 'boolean' })
|
|
159
161
|
], ChatInput.prototype, "processing", void 0);
|
|
162
|
+
__decorate([
|
|
163
|
+
attr({ attribute: 'send-disabled', mode: 'boolean' })
|
|
164
|
+
], ChatInput.prototype, "sendDisabled", void 0);
|
|
160
165
|
__decorate([
|
|
161
166
|
observable
|
|
162
167
|
], ChatInput.prototype, "textArea", void 0);
|
|
163
168
|
__decorate([
|
|
164
169
|
observable
|
|
165
|
-
], ChatInput.prototype, "
|
|
170
|
+
], ChatInput.prototype, "isInputEmpty", void 0);
|
|
166
171
|
__decorate([
|
|
167
172
|
observable
|
|
168
173
|
], ChatInput.prototype, "scrollbarWidth", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/chat/input/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,uBAAuB,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qDAAqD,CAAC;AACxF,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAStC;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,iBAAiB,CAAC,iBAAiB,CAAC;IAAnE;;QAWW,UAAK,GAAG,EAAE,CAAC;QAMX,cAAS,GAAY,CAAC,CAAC,CAAC;QAGxB,eAAU,GAAG,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/chat/input/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,uBAAuB,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qDAAqD,CAAC;AACxF,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAStC;;GA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EAAE,SAAS,EAAE,CAAC;6CACzB;AAGnB;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;+CAC1B;AAMrB;IADN,UAAU;2CAC2B;AAO/B;IADN,UAAU;+CACgB;AAOpB;IADN,UAAU;iDACgB;AAkI/B,MAAM,gBAAgB,GAAG,SAAS,CAAC,OAAO,CAAC;IACvC,QAAQ,EAAE,YAAY;IACtB,QAAQ;IACR,MAAM;IACN,aAAa,EAAE;QACX,cAAc,EAAE,IAAI;KACvB;CACJ,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC;AAC9E,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,CAAC","sourcesContent":["import { DesignSystem, FoundationElement } from '@ni/fast-foundation';\nimport { keyEnter } from '@ni/fast-web-utilities';\nimport { attr, nullableNumberConverter, observable, DOM } from '@ni/fast-element';\nimport { mixinErrorPattern } from '@ni/nimble-components/dist/esm/patterns/error/types';\nimport { styles } from './styles';\nimport { template } from './template';\nimport type { ChatInputSendEventDetail } from './types';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'spright-chat-input': ChatInput;\n }\n}\n\n/**\n * A Spright component for composing and sending a chat message\n */\nexport class ChatInput extends mixinErrorPattern(FoundationElement) {\n @attr\n public placeholder?: string;\n\n @attr({ attribute: 'send-button-label' })\n public sendButtonLabel?: string;\n\n @attr({ attribute: 'stop-button-label' })\n public stopButtonLabel?: string;\n\n @attr\n public value = '';\n\n @attr({ attribute: 'tabindex', converter: nullableNumberConverter })\n public override tabIndex!: number;\n\n @attr({ attribute: 'maxlength', converter: nullableNumberConverter })\n public maxLength?: number = -1;\n\n @attr({ attribute: 'processing', mode: 'boolean' })\n public processing = false;\n\n @attr({ attribute: 'send-disabled', mode: 'boolean' })\n public sendDisabled = false;\n\n /**\n * @internal\n */\n @observable\n public textArea?: HTMLTextAreaElement;\n\n /**\n * Tracks whether the send button should be disabled based on input value\n * @internal\n */\n @observable\n public isInputEmpty = true;\n\n /**\n * The width of the vertical scrollbar, if displayed.\n * @internal\n */\n @observable\n public scrollbarWidth = -1;\n\n private resizeObserver?: ResizeObserver;\n private updateScrollbarWidthQueued = false;\n\n /**\n * @internal\n */\n public textAreaKeydownHandler(e: KeyboardEvent): boolean {\n if (e.key === keyEnter && !e.shiftKey) {\n if (this.processing) {\n return false;\n }\n this.sendButtonClickHandler();\n return false;\n }\n return true;\n }\n\n /**\n * @internal\n */\n public textAreaInputHandler(): void {\n this.value = this.textArea!.value;\n this.isInputEmpty = this.shouldDisableSendButton();\n this.queueUpdateScrollbarWidth();\n }\n\n // If a property can affect whether a scrollbar is visible, we need to\n // call queueUpdateScrollbarWidth() when it changes. The exceptions are\n // properties that affect size (e.g. height, width, cols, rows), because\n // we already have a ResizeObserver handling those changes. Also,\n // a change to errorVisible cannot cause scrollbar visibility to change,\n // because we always reserve space for the error icon.\n\n /**\n * @internal\n */\n public placeholderChanged(): void {\n this.queueUpdateScrollbarWidth();\n }\n\n /**\n * @internal\n */\n public valueChanged(): void {\n if (this.textArea) {\n this.textArea.value = this.value;\n this.isInputEmpty = this.shouldDisableSendButton();\n this.queueUpdateScrollbarWidth();\n }\n }\n\n /**\n * @internal\n */\n public override connectedCallback(): void {\n super.connectedCallback();\n this.textArea!.value = this.value;\n this.isInputEmpty = this.shouldDisableSendButton();\n this.resizeObserver = new ResizeObserver(() => this.onResize());\n this.resizeObserver.observe(this);\n }\n\n /**\n * @internal\n */\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.resizeObserver?.disconnect();\n }\n\n /**\n * @internal\n */\n public sendButtonClickHandler(): void {\n if (this.shouldDisableSendButton()) {\n return;\n }\n const eventDetail: ChatInputSendEventDetail = {\n text: this.textArea!.value\n };\n this.resetInput();\n this.$emit('send', eventDetail);\n }\n\n /**\n * @internal\n */\n public stopButtonClickHandler(): void {\n if (!this.processing) {\n return;\n }\n this.$emit('stop');\n this.textArea?.blur();\n }\n\n private shouldDisableSendButton(): boolean {\n return this.textArea!.value.length === 0;\n }\n\n private resetInput(): void {\n this.value = '';\n this.isInputEmpty = true;\n if (this.textArea) {\n this.textArea.value = '';\n this.textArea.focus();\n }\n }\n\n private onResize(): void {\n this.scrollbarWidth = this.textArea!.offsetWidth - this.textArea!.clientWidth;\n }\n\n private queueUpdateScrollbarWidth(): void {\n if (!this.$fastController.isConnected) {\n return;\n }\n if (!this.updateScrollbarWidthQueued) {\n this.updateScrollbarWidthQueued = true;\n DOM.queueUpdate(() => this.updateScrollbarWidth());\n }\n }\n\n private updateScrollbarWidth(): void {\n this.updateScrollbarWidthQueued = false;\n this.scrollbarWidth = this.textArea!.offsetWidth - this.textArea!.clientWidth;\n }\n}\n\nconst sprightChatInput = ChatInput.compose({\n baseName: 'chat-input',\n template,\n styles,\n shadowOptions: {\n delegatesFocus: true\n }\n});\n\nDesignSystem.getOrCreate().withPrefix('spright').register(sprightChatInput());\nexport const chatInputTag = 'spright-chat-input';\n"]}
|
|
@@ -19,7 +19,7 @@ export const template = html `
|
|
|
19
19
|
class="action-button"
|
|
20
20
|
appearance="block"
|
|
21
21
|
appearance-variant="${x => (x.processing ? 'primary' : 'accent')}"
|
|
22
|
-
?disabled=${x => (x.processing ? false : x.
|
|
22
|
+
?disabled=${x => (x.processing ? false : (x.sendDisabled || x.isInputEmpty))}
|
|
23
23
|
@click=${x => (x.processing ? x.stopButtonClickHandler() : x.sendButtonClickHandler())}
|
|
24
24
|
tabindex="${x => x.tabIndex}"
|
|
25
25
|
title=${x => (x.processing ? x.stopButtonLabel : x.sendButtonLabel)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/chat/input/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;A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AAI,CACF,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,EACjB,IAAI,CAAA,IAAI,iBAAiB,mBAAmB,iBAAiB,GAAG,EAChE,IAAI,CAAA,IAAI,iBAAiB,mBAAmB,iBAAiB,GAAG,CACnE;QACD,SAAS;OACV,sBAAsB;;4BAED,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,cAAc,IAAI,CAAC,CAAC,CAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC,EAAE,CAAC;+CAC7C,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc;SAC3D,sBAAsB;MACzB,iBAAiB;OAChB,CAAC","sourcesContent":["import { html, ref, when } from '@ni/fast-element';\nimport { buttonTag } from '@ni/nimble-components/dist/esm/button';\nimport { iconPaperPlaneTag } from '@ni/nimble-components/dist/esm/icons/paper-plane';\nimport { iconStopSquareTag } from '@ni/nimble-components/dist/esm/icons/stop-square';\nimport { iconExclamationMarkTag } from '@ni/nimble-components/dist/esm/icons/exclamation-mark';\nimport { errorTextTemplate } from '@ni/nimble-components/dist/esm/patterns/error/template';\nimport type { ChatInput } from '.';\n\nexport const template = html<ChatInput>`\n<div class=\"container\">\n <textarea\n ${ref('textArea')}\n placeholder=\"${x => x.placeholder}\"\n rows=\"1\"\n tabindex=\"${x => x.tabIndex}\"\n maxlength=\"${x => x.maxLength}\"\n @keydown=\"${(x, c) => x.textAreaKeydownHandler(c.event as KeyboardEvent)}\"\n @input=\"${x => x.textAreaInputHandler()}\"\n ></textarea>\n <${buttonTag}\n class=\"action-button\"\n appearance=\"block\"\n appearance-variant=\"${x => (x.processing ? 'primary' : 'accent')}\"\n ?disabled=${x => (x.processing ? false : (x.sendDisabled || x.isInputEmpty))}\n @click=${x => (x.processing ? x.stopButtonClickHandler() : x.sendButtonClickHandler())}\n tabindex=\"${x => x.tabIndex}\"\n title=${x => (x.processing ? x.stopButtonLabel : x.sendButtonLabel)}\n content-hidden\n >\n ${x => (x.processing ? x.stopButtonLabel : x.sendButtonLabel)}\n ${when(\n x => x.processing,\n html`<${iconStopSquareTag} slot=\"start\"></${iconStopSquareTag}>`,\n html`<${iconPaperPlaneTag} slot=\"start\"></${iconPaperPlaneTag}>`\n )}\n </${buttonTag}>\n <${iconExclamationMarkTag}\n severity=\"error\"\n class=\"error-icon ${x => (x.scrollbarWidth >= 0 ? 'scrollbar-width-calculated' : '')}\"\n style=\"--ni-private-scrollbar-width: ${x => x.scrollbarWidth}px;\"\n ></${iconExclamationMarkTag}>\n ${errorTextTemplate}\n</div>`;\n"]}
|
|
@@ -68,7 +68,7 @@ export class ChatInputPageObject {
|
|
|
68
68
|
setText(text) {
|
|
69
69
|
this.element.textArea.focus();
|
|
70
70
|
this.element.textArea.value = text;
|
|
71
|
-
this.element.
|
|
71
|
+
this.element.textArea.dispatchEvent(new InputEvent('input', { bubbles: true, composed: true }));
|
|
72
72
|
processUpdates();
|
|
73
73
|
}
|
|
74
74
|
async pressEnterKey() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-input.pageobject.js","sourceRoot":"","sources":["../../../../../src/chat/input/testing/chat-input.pageobject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AACrF,OAAO,EACH,cAAc,EACd,mBAAmB,EACtB,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4DAA4D,CAAC;AAG9F;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAC5B,YAAsC,OAAkB;QAAlB,YAAO,GAAP,OAAO,CAAW;IAAG,CAAC;IAErD,eAAe;QAClB,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,QAAQ,CAAC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,IAAI,CAAC,OAAO,CAAC,QAAS,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IAC3D,CAAC;IAEM,oBAAoB;QACvB,OAAO,IAAI,CAAC,OAAO,CAAC,QAAS,CAAC,SAAS,CAAC;IAC5C,CAAC;IAEM,cAAc;QACjB,IAAI,IAAI,CAAC,OAAO,CAAC,QAAS,CAAC,KAAK,EAAE,CAAC;YAC/B,MAAM,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAC3C,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,QAAS,CAAC,WAAW,CAAC;IAC9C,CAAC;IAEM,eAAe;QAClB,OAAO,IAAI,CAAC,OAAO,CAAC,QAAS,CAAC,KAAK,CAAC;IACxC,CAAC;IAEM,OAAO,CAAC,IAAY;QACvB,IAAI,CAAC,OAAO,CAAC,QAAS,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAI,CAAC,OAAO,CAAC,QAAS,CAAC,KAAK,GAAG,IAAI,CAAC;QACpC,IAAI,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"chat-input.pageobject.js","sourceRoot":"","sources":["../../../../../src/chat/input/testing/chat-input.pageobject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AACrF,OAAO,EACH,cAAc,EACd,mBAAmB,EACtB,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4DAA4D,CAAC;AAG9F;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAC5B,YAAsC,OAAkB;QAAlB,YAAO,GAAP,OAAO,CAAW;IAAG,CAAC;IAErD,eAAe;QAClB,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE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AAE,CAAC;QACvF,OAAO,YAAY,CAAC;IACxB,CAAC;IAEO,KAAK,CAAC,kBAAkB,CAAC,QAAiB;QAC9C,MAAM,YAAY,GAAG,MAAM,gBAAgB,CACvC,IAAI,CAAC,OAAO,CAAC,QAAS,EACtB,QAAQ,EACR,EAAE,QAAQ,EAAE,CACf,CAAC;QACF,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,CAAC;YACjC,IAAI,CAAC,OAAO,CAAC,QAAS,CAAC,KAAK,IAAI,IAAI,CAAC;YACrC,IAAI,CAAC,OAAO,CAAC,QAAS,CAAC,aAAa,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;QAClE,CAAC;QAED,MAAM,mBAAmB,EAAE,CAAC;IAChC,CAAC;CACJ","sourcesContent":["import { keyEnter } from '@ni/fast-web-utilities';\nimport { Button } from '@ni/nimble-components/dist/esm/button';\nimport { iconPaperPlaneTag } from '@ni/nimble-components/dist/esm/icons/paper-plane';\nimport { iconStopSquareTag } from '@ni/nimble-components/dist/esm/icons/stop-square';\nimport {\n processUpdates,\n waitForUpdatesAsync\n} from '@ni/nimble-components/dist/esm/testing/async-helpers';\nimport { sendKeyDownEvent } from '@ni/nimble-components/dist/esm/utilities/testing/component';\nimport type { ChatInput } from '..';\n\n/**\n * Page object for the `spright-chat-input` component to provide consistent ways\n * of querying and interacting with the component during tests.\n */\nexport class ChatInputPageObject {\n public constructor(protected readonly element: ChatInput) {}\n\n public isButtonEnabled(): boolean {\n return !this.getActionButton().disabled;\n }\n\n public isProcessing(): boolean {\n return this.element.processing;\n }\n\n public isTextAreaFocused(): boolean {\n return this.element.textArea === this.element.shadowRoot?.activeElement;\n }\n\n public clickSendButton(): void {\n if (!this.element.processing) {\n this.getActionButton().click();\n }\n }\n\n public clickStopButton(): void {\n if (this.element.processing) {\n this.getActionButton().click();\n }\n }\n\n public getButtonTitle(): string {\n return this.getActionButton().title;\n }\n\n public buttonHasSendIcon(): boolean {\n return this.getActionButton().querySelector(iconPaperPlaneTag) !== null;\n }\n\n public buttonHasStopIcon(): boolean {\n return this.getActionButton().querySelector(iconStopSquareTag) !== null;\n }\n\n public getButtonTextContent(): string {\n return this.getActionButton().textContent?.trim() ?? '';\n }\n\n public getButtonTabIndex(): string | null {\n return this.getActionButton().getAttribute('tabindex');\n }\n\n public textAreaHasFocus(): boolean {\n return (\n document.activeElement === this.element\n && this.element.shadowRoot?.activeElement === this.element.textArea\n );\n }\n\n public getTextAreaTabIndex(): string | null {\n return this.element.textArea!.getAttribute('tabindex');\n }\n\n public getTextAreaMaxLength(): number | null {\n return this.element.textArea!.maxLength;\n }\n\n public getPlaceholder(): string {\n if (this.element.textArea!.value) {\n throw Error('Placeholder not visible');\n }\n return this.element.textArea!.placeholder;\n }\n\n public getRenderedText(): string {\n return this.element.textArea!.value;\n }\n\n public setText(text: string): void {\n this.element.textArea!.focus();\n this.element.textArea!.value = text;\n this.element.textArea!.dispatchEvent(new InputEvent('input', { bubbles: true, composed: true }));\n processUpdates();\n }\n\n public async pressEnterKey(): Promise<void> {\n this.element.textArea!.focus();\n await this.sendEnterKeyEvents(false);\n }\n\n public async pressShiftEnterKey(): Promise<void> {\n this.element.textArea!.focus();\n await this.sendEnterKeyEvents(true);\n }\n\n private getActionButton(): Button {\n const actionButton = this.element.shadowRoot!.querySelector<Button>('.action-button')!;\n return actionButton;\n }\n\n private async sendEnterKeyEvents(shiftKey: boolean): Promise<void> {\n const keyDownEvent = await sendKeyDownEvent(\n this.element.textArea!,\n keyEnter,\n { shiftKey }\n );\n if (!keyDownEvent.defaultPrevented) {\n this.element.textArea!.value += '\\n';\n this.element.textArea!.dispatchEvent(new InputEvent('input'));\n }\n\n await waitForUpdatesAsync();\n }\n}\n"]}
|