@ni/spright-components 6.15.9 → 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.
Files changed (47) hide show
  1. package/dist/all-components-bundle.js +566 -355
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +1312 -1161
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/custom-elements.json +123 -0
  6. package/dist/custom-elements.md +31 -0
  7. package/dist/esm/all-components.d.ts +1 -0
  8. package/dist/esm/all-components.js +1 -0
  9. package/dist/esm/all-components.js.map +1 -1
  10. package/dist/esm/chat/input/index.d.ts +10 -0
  11. package/dist/esm/chat/input/index.js +22 -0
  12. package/dist/esm/chat/input/index.js.map +1 -1
  13. package/dist/esm/chat/input/styles.js +42 -1
  14. package/dist/esm/chat/input/styles.js.map +1 -1
  15. package/dist/esm/chat/input/template.js +28 -14
  16. package/dist/esm/chat/input/template.js.map +1 -1
  17. package/dist/esm/chat/input/testing/chat-input.pageobject.d.ts +6 -0
  18. package/dist/esm/chat/input/testing/chat-input.pageobject.js +20 -0
  19. package/dist/esm/chat/input/testing/chat-input.pageobject.js.map +1 -1
  20. package/dist/esm/chat/message/welcome/index.d.ts +19 -0
  21. package/dist/esm/chat/message/welcome/index.js +24 -0
  22. package/dist/esm/chat/message/welcome/index.js.map +1 -0
  23. package/dist/esm/chat/message/welcome/styles.d.ts +1 -0
  24. package/dist/esm/chat/message/welcome/styles.js +60 -0
  25. package/dist/esm/chat/message/welcome/styles.js.map +1 -0
  26. package/dist/esm/chat/message/welcome/template.d.ts +4 -0
  27. package/dist/esm/chat/message/welcome/template.js +21 -0
  28. package/dist/esm/chat/message/welcome/template.js.map +1 -0
  29. package/dist/esm/chat/message/welcome/testing/chat-message-welcome.pageobject.d.ts +18 -0
  30. package/dist/esm/chat/message/welcome/testing/chat-message-welcome.pageobject.js +51 -0
  31. package/dist/esm/chat/message/welcome/testing/chat-message-welcome.pageobject.js.map +1 -0
  32. package/dist/esm/icons/all-icons.d.ts +1 -0
  33. package/dist/esm/icons/all-icons.js +1 -0
  34. package/dist/esm/icons/all-icons.js.map +1 -1
  35. package/dist/esm/icons/nigel-chat/icon-data.d.ts +2 -0
  36. package/dist/esm/icons/nigel-chat/icon-data.js +3 -0
  37. package/dist/esm/icons/nigel-chat/icon-data.js.map +1 -0
  38. package/dist/esm/icons/nigel-chat/index.d.ts +13 -0
  39. package/dist/esm/icons/nigel-chat/index.js +20 -0
  40. package/dist/esm/icons/nigel-chat/index.js.map +1 -0
  41. package/dist/esm/icons/nigel-chat/styles.d.ts +1 -0
  42. package/dist/esm/icons/nigel-chat/styles.js +20 -0
  43. package/dist/esm/icons/nigel-chat/styles.js.map +1 -0
  44. package/dist/esm/icons/nigel-chat/template.d.ts +2 -0
  45. package/dist/esm/icons/nigel-chat/template.js +7 -0
  46. package/dist/esm/icons/nigel-chat/template.js.map +1 -0
  47. package/package.json +1 -1
@@ -326,6 +326,54 @@
326
326
  "privacy": "private",
327
327
  "default": "false"
328
328
  },
329
+ {
330
+ "kind": "method",
331
+ "name": "slottedFooterActionsElementsChanged",
332
+ "privacy": "public",
333
+ "return": {
334
+ "type": {
335
+ "text": "void"
336
+ }
337
+ },
338
+ "parameters": [
339
+ {
340
+ "name": "_prev",
341
+ "type": {
342
+ "text": "HTMLElement[] | undefined"
343
+ }
344
+ },
345
+ {
346
+ "name": "next",
347
+ "type": {
348
+ "text": "HTMLElement[] | undefined"
349
+ }
350
+ }
351
+ ]
352
+ },
353
+ {
354
+ "kind": "method",
355
+ "name": "slottedAttachmentsElementsChanged",
356
+ "privacy": "public",
357
+ "return": {
358
+ "type": {
359
+ "text": "void"
360
+ }
361
+ },
362
+ "parameters": [
363
+ {
364
+ "name": "_prev",
365
+ "type": {
366
+ "text": "HTMLElement[] | undefined"
367
+ }
368
+ },
369
+ {
370
+ "name": "next",
371
+ "type": {
372
+ "text": "HTMLElement[] | undefined"
373
+ }
374
+ }
375
+ ]
376
+ },
329
377
  {
330
378
  "kind": "method",
331
379
  "name": "shouldDisableSendButton",
@@ -754,6 +802,81 @@
754
802
  }
755
803
  }
756
804
  ]
805
+ },
806
+ {
807
+ "kind": "javascript-module",
808
+ "path": "src/chat/message/welcome/index.ts",
809
+ "declarations": [
810
+ {
811
+ "kind": "class",
812
+ "description": "A Spright component for displaying a welcome chat message",
813
+ "name": "ChatMessageWelcome",
814
+ "members": [
815
+ {
816
+ "kind": "field",
817
+ "name": "welcomeTitle",
818
+ "type": {
819
+ "text": "string | undefined"
820
+ },
821
+ "privacy": "public"
822
+ },
823
+ {
824
+ "kind": "field",
825
+ "name": "subtitle",
826
+ "type": {
827
+ "text": "string | undefined"
828
+ },
829
+ "privacy": "public"
830
+ }
831
+ ],
832
+ "attributes": [
833
+ {
834
+ "name": "welcome-title",
835
+ "type": {
836
+ "text": "string | undefined"
837
+ },
838
+ "fieldName": "welcomeTitle"
839
+ },
840
+ {
841
+ "name": "subtitle",
842
+ "type": {
843
+ "text": "string | undefined"
844
+ },
845
+ "fieldName": "subtitle"
846
+ }
847
+ ],
848
+ "superclass": {
849
+ "name": "FoundationElement",
850
+ "package": "@ni/fast-foundation"
851
+ }
852
+ },
853
+ {
854
+ "kind": "variable",
855
+ "name": "chatMessageWelcomeTag",
856
+ "type": {
857
+ "text": "string"
858
+ },
859
+ "default": "'spright-chat-message-welcome'"
860
+ }
861
+ ],
862
+ "exports": [
863
+ {
864
+ "kind": "js",
865
+ "name": "ChatMessageWelcome",
866
+ "declaration": {
867
+ "name": "ChatMessageWelcome",
868
+ "module": "src/chat/message/welcome/index.ts"
869
+ }
870
+ },
871
+ {
872
+ "kind": "js",
873
+ "name": "chatMessageWelcomeTag",
874
+ "declaration": {
875
+ "name": "chatMessageWelcomeTag",
876
+ "module": "src/chat/message/welcome/index.ts"
877
+ }
878
+ }
879
+ ]
757
880
  }
758
881
  ]
759
882
  }
@@ -60,6 +60,13 @@
60
60
  | `processing` | public | `boolean` | `false` | | |
61
61
  | `sendDisabled` | public | `boolean` | `false` | | |
62
62
 
63
+ ### Methods
64
+
65
+ | Name | Privacy | Description | Parameters | Return | Inherited From |
66
+ | ------------------------------------- | ------- | ----------- | --------------------------------------------------------------------- | ------ | -------------- |
67
+ | `slottedFooterActionsElementsChanged` | public | | `_prev: HTMLElement[] \| undefined, next: HTMLElement[] \| undefined` | `void` | |
68
+ | `slottedAttachmentsElementsChanged` | public | | `_prev: HTMLElement[] \| undefined, next: HTMLElement[] \| undefined` | `void` | |
69
+
63
70
  ### Attributes
64
71
 
65
72
  | Name | Field | Inherited From |
@@ -138,3 +145,27 @@
138
145
  | `FoundationElement` | | @ni/fast-foundation |
139
146
 
140
147
  <hr/>
148
+
149
+ ## class: `ChatMessageWelcome`
150
+
151
+ ### Superclass
152
+
153
+ | Name | Module | Package |
154
+ | ------------------- | ------ | ------------------- |
155
+ | `FoundationElement` | | @ni/fast-foundation |
156
+
157
+ ### Fields
158
+
159
+ | Name | Privacy | Type | Default | Description | Inherited From |
160
+ | -------------- | ------- | --------------------- | ------- | ----------- | -------------- |
161
+ | `welcomeTitle` | public | `string \| undefined` | | | |
162
+ | `subtitle` | public | `string \| undefined` | | | |
163
+
164
+ ### Attributes
165
+
166
+ | Name | Field | Inherited From |
167
+ | --------------- | ------------ | -------------- |
168
+ | `welcome-title` | welcomeTitle | |
169
+ | `subtitle` | subtitle | |
170
+
171
+ <hr/>
@@ -10,5 +10,6 @@ import './chat/message';
10
10
  import './chat/message/inbound';
11
11
  import './chat/message/outbound';
12
12
  import './chat/message/system';
13
+ import './chat/message/welcome';
13
14
  import './icons/all-icons';
14
15
  import './rectangle';
@@ -10,6 +10,7 @@ import './chat/message';
10
10
  import './chat/message/inbound';
11
11
  import './chat/message/outbound';
12
12
  import './chat/message/system';
13
+ import './chat/message/welcome';
13
14
  import './icons/all-icons';
14
15
  import './rectangle';
15
16
  //# sourceMappingURL=all-components.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"all-components.js","sourceRoot":"","sources":["../../src/all-components.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,+CAA+C,CAAC;AAEvD,OAAO,qBAAqB,CAAC;AAC7B,OAAO,cAAc,CAAC;AACtB,OAAO,gBAAgB,CAAC;AACxB,OAAO,wBAAwB,CAAC;AAChC,OAAO,yBAAyB,CAAC;AACjC,OAAO,uBAAuB,CAAC;AAC/B,OAAO,mBAAmB,CAAC;AAC3B,OAAO,aAAa,CAAC","sourcesContent":["/**\n * Import of all the web components available in Spright AND Nimble.\n * Production applications are encouraged to import only components\n * that are required instead of leveraging this file.\n */\n\nimport '@ni/nimble-components/dist/esm/all-components';\n\nimport './chat/conversation';\nimport './chat/input';\nimport './chat/message';\nimport './chat/message/inbound';\nimport './chat/message/outbound';\nimport './chat/message/system';\nimport './icons/all-icons';\nimport './rectangle';\n"]}
1
+ {"version":3,"file":"all-components.js","sourceRoot":"","sources":["../../src/all-components.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,+CAA+C,CAAC;AAEvD,OAAO,qBAAqB,CAAC;AAC7B,OAAO,cAAc,CAAC;AACtB,OAAO,gBAAgB,CAAC;AACxB,OAAO,wBAAwB,CAAC;AAChC,OAAO,yBAAyB,CAAC;AACjC,OAAO,uBAAuB,CAAC;AAC/B,OAAO,wBAAwB,CAAC;AAChC,OAAO,mBAAmB,CAAC;AAC3B,OAAO,aAAa,CAAC","sourcesContent":["/**\n * Import of all the web components available in Spright AND Nimble.\n * Production applications are encouraged to import only components\n * that are required instead of leveraging this file.\n */\n\nimport '@ni/nimble-components/dist/esm/all-components';\n\nimport './chat/conversation';\nimport './chat/input';\nimport './chat/message';\nimport './chat/message/inbound';\nimport './chat/message/outbound';\nimport './chat/message/system';\nimport './chat/message/welcome';\nimport './icons/all-icons';\nimport './rectangle';\n"]}
@@ -41,8 +41,18 @@ export declare class ChatInput extends ChatInput_base {
41
41
  * @internal
42
42
  */
43
43
  scrollbarWidth: number;
44
+ /** @internal */
45
+ footerActionsIsEmpty: boolean;
46
+ /** @internal */
47
+ readonly slottedFooterActionsElements?: HTMLElement[];
48
+ /** @internal */
49
+ attachmentsIsEmpty: boolean;
50
+ /** @internal */
51
+ readonly slottedAttachmentsElements?: HTMLElement[];
44
52
  private resizeObserver?;
45
53
  private updateScrollbarWidthQueued;
54
+ slottedFooterActionsElementsChanged(_prev: HTMLElement[] | undefined, next: HTMLElement[] | undefined): void;
55
+ slottedAttachmentsElementsChanged(_prev: HTMLElement[] | undefined, next: HTMLElement[] | undefined): void;
46
56
  /**
47
57
  * @internal
48
58
  */
@@ -25,8 +25,18 @@ export class ChatInput extends mixinErrorPattern(FoundationElement) {
25
25
  * @internal
26
26
  */
27
27
  this.scrollbarWidth = -1;
28
+ /** @internal */
29
+ this.footerActionsIsEmpty = true;
30
+ /** @internal */
31
+ this.attachmentsIsEmpty = true;
28
32
  this.updateScrollbarWidthQueued = false;
29
33
  }
34
+ slottedFooterActionsElementsChanged(_prev, next) {
35
+ this.footerActionsIsEmpty = next === undefined || next.length === 0;
36
+ }
37
+ slottedAttachmentsElementsChanged(_prev, next) {
38
+ this.attachmentsIsEmpty = next === undefined || next.length === 0;
39
+ }
30
40
  /**
31
41
  * @internal
32
42
  */
@@ -187,6 +197,18 @@ __decorate([
187
197
  __decorate([
188
198
  observable
189
199
  ], ChatInput.prototype, "scrollbarWidth", void 0);
200
+ __decorate([
201
+ observable
202
+ ], ChatInput.prototype, "footerActionsIsEmpty", void 0);
203
+ __decorate([
204
+ observable
205
+ ], ChatInput.prototype, "slottedFooterActionsElements", void 0);
206
+ __decorate([
207
+ observable
208
+ ], ChatInput.prototype, "attachmentsIsEmpty", void 0);
209
+ __decorate([
210
+ observable
211
+ ], ChatInput.prototype, "slottedAttachmentsElements", void 0);
190
212
  const sprightChatInput = ChatInput.compose({
191
213
  baseName: 'chat-input',
192
214
  template,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/chat/input/index.ts"],"names":[],"m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,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 private static readonly fieldSizingSupported = CSS.supports(\n 'field-sizing',\n 'content'\n );\n\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.adjustTextAreaHeight();\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.adjustTextAreaHeight();\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.adjustTextAreaHeight();\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.adjustTextAreaHeight();\n this.textArea.focus();\n }\n }\n\n private onResize(): void {\n this.adjustTextAreaHeight();\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 // Workaround for browsers that do not support the CSS property `field-sizing: content`\n // See https://github.com/ni/nimble/issues/2902\n private adjustTextAreaHeight(): void {\n if (ChatInput.fieldSizingSupported || !this.textArea) {\n return;\n }\n const textArea = this.textArea;\n textArea.style.height = 'auto';\n textArea.style.height = `${textArea.scrollHeight}px`;\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"]}
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;A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;IADf,UAAU;+DACkD;AAItD;IADN,UAAU;qDACsB;AAIjB;IADf,UAAU;6DACgD;AAgK/D,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 private static readonly fieldSizingSupported = CSS.supports(\n 'field-sizing',\n 'content'\n );\n\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 /** @internal */\n @observable\n public footerActionsIsEmpty = true;\n\n /** @internal */\n @observable\n public readonly slottedFooterActionsElements?: HTMLElement[];\n\n /** @internal */\n @observable\n public attachmentsIsEmpty = true;\n\n /** @internal */\n @observable\n public readonly slottedAttachmentsElements?: HTMLElement[];\n\n private resizeObserver?: ResizeObserver;\n private updateScrollbarWidthQueued = false;\n\n public slottedFooterActionsElementsChanged(\n _prev: HTMLElement[] | undefined,\n next: HTMLElement[] | undefined\n ): void {\n this.footerActionsIsEmpty = next === undefined || next.length === 0;\n }\n\n public slottedAttachmentsElementsChanged(\n _prev: HTMLElement[] | undefined,\n next: HTMLElement[] | undefined\n ): void {\n this.attachmentsIsEmpty = next === undefined || next.length === 0;\n }\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.adjustTextAreaHeight();\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.adjustTextAreaHeight();\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.adjustTextAreaHeight();\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.adjustTextAreaHeight();\n this.textArea.focus();\n }\n }\n\n private onResize(): void {\n this.adjustTextAreaHeight();\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 // Workaround for browsers that do not support the CSS property `field-sizing: content`\n // See https://github.com/ni/nimble/issues/2902\n private adjustTextAreaHeight(): void {\n if (ChatInput.fieldSizingSupported || !this.textArea) {\n return;\n }\n const textArea = this.textArea;\n textArea.style.height = 'auto';\n textArea.style.height = `${textArea.scrollHeight}px`;\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"]}
@@ -1,5 +1,5 @@
1
1
  import { css } from '@ni/fast-element';
2
- import { applicationBackgroundColor, bodyFont, bodyFontColor, borderWidth, controlLabelFontColor, elevation2BoxShadow, mediumPadding, popupBorderColor, borderHoverColor, smallDelay, failColor } from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';
2
+ import { applicationBackgroundColor, bodyFont, bodyFontColor, borderWidth, controlLabelFontColor, controlSlimHeight, elevation2BoxShadow, mediumPadding, popupBorderColor, borderHoverColor, smallDelay, failColor } from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';
3
3
  import { styles as errorStyles } from '@ni/nimble-components/dist/esm/patterns/error/styles';
4
4
  import { display } from '../../utilities/style/display';
5
5
  export const styles = css `
@@ -104,5 +104,46 @@ export const styles = css `
104
104
  width: 80px;
105
105
  margin: ${mediumPadding};
106
106
  }
107
+
108
+ .attachments {
109
+ display: none;
110
+ }
111
+
112
+ .attachments.has-content {
113
+ display: flex;
114
+ flex-wrap: wrap;
115
+ gap: ${mediumPadding};
116
+ padding: ${mediumPadding};
117
+ max-height: calc(${controlSlimHeight} * 3 + ${mediumPadding} * 4 );
118
+ overflow-y: auto;
119
+ }
120
+
121
+ .attachments ::slotted(*) {
122
+ height: ${controlSlimHeight};
123
+ }
124
+
125
+ .footer {
126
+ display: flex;
127
+ flex-direction: row;
128
+ align-items: flex-end;
129
+ justify-content: flex-end;
130
+ }
131
+
132
+ .footer-actions {
133
+ display: none;
134
+ flex: 1;
135
+ }
136
+
137
+ .footer-actions.has-content {
138
+ display: flex;
139
+ align-items: center;
140
+ flex-wrap: wrap;
141
+ column-gap: ${mediumPadding};
142
+ margin: ${mediumPadding};
143
+ }
144
+
145
+ .footer-actions ::slotted(*) {
146
+ height: ${controlSlimHeight};
147
+ }
107
148
  `;
108
149
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/chat/input/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EACH,0BAA0B,EAC1B,QAAQ,EACR,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,SAAS,EACZ,MAAM,6DAA6D,CAAC;AACrE,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,sDAAsD,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,MAAM,CAAC;MACf,WAAW;;;;;;mDAMkC,WAAW;;;;;;;;;;4BAUlC,0BAA0B;kBACpC,WAAW,UAAU,gBAAgB;sBACjC,mBAAmB;;;;;;4BAMb,WAAW;;;;yBAId,gBAAgB;;4BAEb,UAAU;;;;;4BAKV,UAAU;;;;+BAIP,gBAAgB;;;;+BAIhB,SAAS;;;;+BAIT,SAAS;;;;+BAIT,SAAS;;;;+BAIT,SAAS;;;;;;;;;;gBAUxB,QAAQ;iBACP,aAAa;;;;;;qCAMO,aAAa;;;;;mBAK/B,aAAa;;;;iBAIf,qBAAqB;;;;;;;;;;eAUvB,aAAa;;;;;;;kBAOV,aAAa;;CAE9B,CAAC","sourcesContent":["import { css } from '@ni/fast-element';\nimport {\n applicationBackgroundColor,\n bodyFont,\n bodyFontColor,\n borderWidth,\n controlLabelFontColor,\n elevation2BoxShadow,\n mediumPadding,\n popupBorderColor,\n borderHoverColor,\n smallDelay,\n failColor\n} from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';\nimport { styles as errorStyles } from '@ni/nimble-components/dist/esm/patterns/error/styles';\nimport { display } from '../../utilities/style/display';\n\nexport const styles = css`\n ${display('flex')}\n ${errorStyles}\n\n :host {\n width: 100%;\n height: auto;\n outline: none;\n --ni-private-hover-indicator-width: calc(${borderWidth} + 1px);\n }\n\n .container {\n display: flex;\n flex-direction: column;\n position: relative;\n width: 100%;\n height: 100%;\n\n background-color: ${applicationBackgroundColor};\n border: ${borderWidth} solid ${popupBorderColor};\n box-shadow: ${elevation2BoxShadow};\n }\n\n .container::after {\n content: '';\n position: absolute;\n bottom: calc(-1 * ${borderWidth});\n width: 0px;\n height: 0px;\n align-self: center;\n border-bottom: ${borderHoverColor}\n var(--ni-private-hover-indicator-width) solid;\n transition: width ${smallDelay} ease-in;\n }\n\n :host(:hover) .container::after {\n width: 100%;\n transition: width ${smallDelay} ease-in;\n }\n\n :host(:focus-within) .container {\n border-bottom-color: ${borderHoverColor};\n }\n\n :host([error-visible]) .container::after {\n border-bottom-color: ${failColor};\n }\n \n :host([error-visible]) .container {\n border-bottom-color: ${failColor};\n }\n\n :host([error-visible]:hover) .container::after {\n border-bottom-color: ${failColor};\n }\n\n :host([error-visible]:focus-within) .container {\n border-bottom-color: ${failColor};\n }\n\n @media (prefers-reduced-motion) {\n .container::after {\n transition-duration: 0s;\n }\n }\n\n textarea {\n font: ${bodyFont};\n color: ${bodyFontColor};\n background-color: transparent;\n\n width: 100%;\n resize: none;\n height: auto;\n max-height: calc(6lh + 2 * ${mediumPadding});\n field-sizing: content;\n\n border-width: 0px;\n outline: none;\n padding: ${mediumPadding};\n }\n\n textarea::placeholder {\n color: ${controlLabelFontColor};\n }\n\n :host([error-visible]) .error-icon {\n display: none;\n }\n\n :host([error-visible]) .error-icon.scrollbar-width-calculated {\n display: inline-flex;\n position: absolute;\n top: ${mediumPadding};\n right: var(--ni-private-scrollbar-width);\n }\n\n .action-button {\n align-self: flex-end;\n width: 80px;\n margin: ${mediumPadding};\n }\n`;\n"]}
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/chat/input/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EACH,0BAA0B,EAC1B,QAAQ,EACR,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,SAAS,EACZ,MAAM,6DAA6D,CAAC;AACrE,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,sDAAsD,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,MAAM,CAAC;MACf,WAAW;;;;;;mDAMkC,WAAW;;;;;;;;;;4BAUlC,0BAA0B;kBACpC,WAAW,UAAU,gBAAgB;sBACjC,mBAAmB;;;;;;4BAMb,WAAW;;;;yBAId,gBAAgB;;4BAEb,UAAU;;;;;4BAKV,UAAU;;;;+BAIP,gBAAgB;;;;+BAIhB,SAAS;;;;+BAIT,SAAS;;;;+BAIT,SAAS;;;;+BAIT,SAAS;;;;;;;;;;gBAUxB,QAAQ;iBACP,aAAa;;;;;;qCAMO,aAAa;;;;;mBAK/B,aAAa;;;;iBAIf,qBAAqB;;;;;;;;;;eAUvB,aAAa;;;;;;;kBAOV,aAAa;;;;;;;;;;eAUhB,aAAa;mBACT,aAAa;2BACL,iBAAiB,UAAU,aAAa;;;;;kBAKjD,iBAAiB;;;;;;;;;;;;;;;;;;;sBAmBb,aAAa;kBACjB,aAAa;;;;kBAIb,iBAAiB;;CAElC,CAAC","sourcesContent":["import { css } from '@ni/fast-element';\nimport {\n applicationBackgroundColor,\n bodyFont,\n bodyFontColor,\n borderWidth,\n controlLabelFontColor,\n controlSlimHeight,\n elevation2BoxShadow,\n mediumPadding,\n popupBorderColor,\n borderHoverColor,\n smallDelay,\n failColor\n} from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';\nimport { styles as errorStyles } from '@ni/nimble-components/dist/esm/patterns/error/styles';\nimport { display } from '../../utilities/style/display';\n\nexport const styles = css`\n ${display('flex')}\n ${errorStyles}\n\n :host {\n width: 100%;\n height: auto;\n outline: none;\n --ni-private-hover-indicator-width: calc(${borderWidth} + 1px);\n }\n\n .container {\n display: flex;\n flex-direction: column;\n position: relative;\n width: 100%;\n height: 100%;\n\n background-color: ${applicationBackgroundColor};\n border: ${borderWidth} solid ${popupBorderColor};\n box-shadow: ${elevation2BoxShadow};\n }\n\n .container::after {\n content: '';\n position: absolute;\n bottom: calc(-1 * ${borderWidth});\n width: 0px;\n height: 0px;\n align-self: center;\n border-bottom: ${borderHoverColor}\n var(--ni-private-hover-indicator-width) solid;\n transition: width ${smallDelay} ease-in;\n }\n\n :host(:hover) .container::after {\n width: 100%;\n transition: width ${smallDelay} ease-in;\n }\n\n :host(:focus-within) .container {\n border-bottom-color: ${borderHoverColor};\n }\n\n :host([error-visible]) .container::after {\n border-bottom-color: ${failColor};\n }\n \n :host([error-visible]) .container {\n border-bottom-color: ${failColor};\n }\n\n :host([error-visible]:hover) .container::after {\n border-bottom-color: ${failColor};\n }\n\n :host([error-visible]:focus-within) .container {\n border-bottom-color: ${failColor};\n }\n\n @media (prefers-reduced-motion) {\n .container::after {\n transition-duration: 0s;\n }\n }\n\n textarea {\n font: ${bodyFont};\n color: ${bodyFontColor};\n background-color: transparent;\n\n width: 100%;\n resize: none;\n height: auto;\n max-height: calc(6lh + 2 * ${mediumPadding});\n field-sizing: content;\n\n border-width: 0px;\n outline: none;\n padding: ${mediumPadding};\n }\n\n textarea::placeholder {\n color: ${controlLabelFontColor};\n }\n\n :host([error-visible]) .error-icon {\n display: none;\n }\n\n :host([error-visible]) .error-icon.scrollbar-width-calculated {\n display: inline-flex;\n position: absolute;\n top: ${mediumPadding};\n right: var(--ni-private-scrollbar-width);\n }\n\n .action-button {\n align-self: flex-end;\n width: 80px;\n margin: ${mediumPadding};\n }\n\n .attachments {\n display: none;\n }\n\n .attachments.has-content {\n display: flex;\n flex-wrap: wrap;\n gap: ${mediumPadding};\n padding: ${mediumPadding};\n max-height: calc(${controlSlimHeight} * 3 + ${mediumPadding} * 4 );\n overflow-y: auto;\n }\n\n .attachments ::slotted(*) {\n height: ${controlSlimHeight};\n }\n\n .footer {\n display: flex;\n flex-direction: row;\n align-items: flex-end;\n justify-content: flex-end;\n }\n\n .footer-actions {\n display: none;\n flex: 1;\n }\n\n .footer-actions.has-content {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n column-gap: ${mediumPadding};\n margin: ${mediumPadding};\n }\n\n .footer-actions ::slotted(*) {\n height: ${controlSlimHeight};\n }\n`;\n"]}
@@ -1,4 +1,4 @@
1
- import { html, ref, when } from '@ni/fast-element';
1
+ import { html, ref, slotted, when } from '@ni/fast-element';
2
2
  import { buttonTag } from '@ni/nimble-components/dist/esm/button';
3
3
  import { iconPaperPlaneTag } from '@ni/nimble-components/dist/esm/icons/paper-plane';
4
4
  import { iconStopSquareTag } from '@ni/nimble-components/dist/esm/icons/stop-square';
@@ -6,6 +6,12 @@ import { iconExclamationMarkTag } from '@ni/nimble-components/dist/esm/icons/exc
6
6
  import { errorTextTemplate } from '@ni/nimble-components/dist/esm/patterns/error/template';
7
7
  export const template = html `
8
8
  <div class="container">
9
+ <section class="attachments ${x => (x.attachmentsIsEmpty ? '' : 'has-content')}">
10
+ <slot
11
+ name="attachments"
12
+ ${slotted({ property: 'slottedAttachmentsElements' })}
13
+ ></slot>
14
+ </section>
9
15
  <textarea
10
16
  ${ref('textArea')}
11
17
  placeholder="${x => x.placeholder}"
@@ -15,19 +21,27 @@ export const template = html `
15
21
  @keydown="${(x, c) => x.textAreaKeydownHandler(c.event)}"
16
22
  @input="${x => x.textAreaInputHandler()}"
17
23
  ></textarea>
18
- <${buttonTag}
19
- class="action-button"
20
- appearance="block"
21
- appearance-variant="${x => (x.processing ? 'primary' : 'accent')}"
22
- ?disabled=${x => (x.processing ? false : (x.sendDisabled || x.isInputEmpty))}
23
- @click=${x => (x.processing ? x.stopButtonClickHandler() : x.sendButtonClickHandler())}
24
- tabindex="${x => x.tabIndex}"
25
- title=${x => (x.processing ? x.stopButtonLabel : x.sendButtonLabel)}
26
- content-hidden
27
- >
28
- ${x => (x.processing ? x.stopButtonLabel : x.sendButtonLabel)}
29
- ${when(x => x.processing, html `<${iconStopSquareTag} slot="start"></${iconStopSquareTag}>`, html `<${iconPaperPlaneTag} slot="start"></${iconPaperPlaneTag}>`)}
30
- </${buttonTag}>
24
+ <section class="footer">
25
+ <section class="footer-actions ${x => (x.footerActionsIsEmpty ? '' : 'has-content')}">
26
+ <slot
27
+ name="footer-actions"
28
+ ${slotted({ property: 'slottedFooterActionsElements' })}
29
+ ></slot>
30
+ </section>
31
+ <${buttonTag}
32
+ class="action-button"
33
+ appearance="block"
34
+ appearance-variant="${x => (x.processing ? 'primary' : 'accent')}"
35
+ ?disabled=${x => (x.processing ? false : (x.sendDisabled || x.isInputEmpty))}
36
+ @click=${x => (x.processing ? x.stopButtonClickHandler() : x.sendButtonClickHandler())}
37
+ tabindex="${x => x.tabIndex}"
38
+ title=${x => (x.processing ? x.stopButtonLabel : x.sendButtonLabel)}
39
+ content-hidden
40
+ >
41
+ ${x => (x.processing ? x.stopButtonLabel : x.sendButtonLabel)}
42
+ ${when(x => x.processing, html `<${iconStopSquareTag} slot="start"></${iconStopSquareTag}>`, html `<${iconPaperPlaneTag} slot="start"></${iconPaperPlaneTag}>`)}
43
+ </${buttonTag}>
44
+ </section>
31
45
  <${iconExclamationMarkTag}
32
46
  severity="error"
33
47
  class="error-icon ${x => (x.scrollbarWidth >= 0 ? 'scrollbar-width-calculated' : '')}"
@@ -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;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AACrF,OAAO,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AC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC;UAC3D,IAAI,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"]}
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/chat/input/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AACrF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uDAAuD,CAAC;AAC/F,OAAO,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAC;AAG3F,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAW;;kCAEL,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC;;;cAGpE,OAAO,CAAC,EAAE,QAAQ,EAAE,4BAA4B,EAAE,CAAC;;;;UAIvD,GAAG,CAAC,UAAU,CAAC;uBACF,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW;;oBAErB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;qBACd,CAAC,CAAC,EAAE,CAAC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ChE,IAAI,CAAA,IAAI,iBAAiB,mBAAmB,iBAAiB,GAAG,CACnE;YACD,SAAS;;OAEd,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, slotted, 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 <section class=\"attachments ${x => (x.attachmentsIsEmpty ? '' : 'has-content')}\">\n <slot\n name=\"attachments\"\n ${slotted({ property: 'slottedAttachmentsElements' })}\n ></slot>\n </section>\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 <section class=\"footer\">\n <section class=\"footer-actions ${x => (x.footerActionsIsEmpty ? '' : 'has-content')}\">\n <slot\n name=\"footer-actions\"\n ${slotted({ property: 'slottedFooterActionsElements' })}\n ></slot>\n </section>\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 </section>\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"]}
@@ -21,9 +21,15 @@ export declare class ChatInputPageObject {
21
21
  getTextAreaMaxLength(): number | null;
22
22
  getPlaceholder(): string;
23
23
  getRenderedText(): string;
24
+ hasFooterActionsSlot(): boolean;
25
+ getFooterActionsSlotElementCount(): number;
26
+ hasAttachmentSlot(): boolean;
27
+ getAttachmentsSlotElementCount(): number;
24
28
  setText(text: string): void;
25
29
  pressEnterKey(): Promise<void>;
26
30
  pressShiftEnterKey(): Promise<void>;
27
31
  private getActionButton;
32
+ private getAttachmentsSlot;
33
+ private getFooterActionsSlot;
28
34
  private sendEnterKeyEvents;
29
35
  }
@@ -65,6 +65,18 @@ export class ChatInputPageObject {
65
65
  getRenderedText() {
66
66
  return this.element.textArea.value;
67
67
  }
68
+ hasFooterActionsSlot() {
69
+ return this.getFooterActionsSlot() !== null;
70
+ }
71
+ getFooterActionsSlotElementCount() {
72
+ return this.getFooterActionsSlot()?.assignedElements().length ?? 0;
73
+ }
74
+ hasAttachmentSlot() {
75
+ return this.getAttachmentsSlot() !== null;
76
+ }
77
+ getAttachmentsSlotElementCount() {
78
+ return this.getAttachmentsSlot()?.assignedElements().length ?? 0;
79
+ }
68
80
  setText(text) {
69
81
  this.element.textArea.focus();
70
82
  this.element.textArea.value = text;
@@ -83,6 +95,14 @@ export class ChatInputPageObject {
83
95
  const actionButton = this.element.shadowRoot.querySelector('.action-button');
84
96
  return actionButton;
85
97
  }
98
+ getAttachmentsSlot() {
99
+ const attachmentsSlot = this.element.shadowRoot.querySelector('slot[name="attachments"]');
100
+ return attachmentsSlot;
101
+ }
102
+ getFooterActionsSlot() {
103
+ const footerActionsSlot = this.element.shadowRoot.querySelector('slot[name="footer-actions"]');
104
+ return footerActionsSlot;
105
+ }
86
106
  async sendEnterKeyEvents(shiftKey) {
87
107
  const keyDownEvent = await sendKeyDownEvent(this.element.textArea, keyEnter, { shiftKey });
88
108
  if (!keyDownEvent.defaultPrevented) {
@@ -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;IAC5C,CAAC;IAEM,YAAY;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;IACnC,CAAC;IAEM,iBAAiB;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,KAAK,IAAI,CAAC,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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"]}
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,mBA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AS,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 hasFooterActionsSlot(): boolean {\n return this.getFooterActionsSlot() !== null;\n }\n\n public getFooterActionsSlotElementCount(): number {\n return this.getFooterActionsSlot()?.assignedElements().length ?? 0;\n }\n\n public hasAttachmentSlot(): boolean {\n return this.getAttachmentsSlot() !== null;\n }\n\n public getAttachmentsSlotElementCount(): number {\n return this.getAttachmentsSlot()?.assignedElements().length ?? 0;\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 getAttachmentsSlot(): HTMLSlotElement | null {\n const attachmentsSlot = this.element.shadowRoot!.querySelector<HTMLSlotElement>('slot[name=\"attachments\"]');\n return attachmentsSlot;\n }\n\n private getFooterActionsSlot(): HTMLSlotElement | null {\n const footerActionsSlot = this.element.shadowRoot!.querySelector<HTMLSlotElement>('slot[name=\"footer-actions\"]');\n return footerActionsSlot;\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"]}
@@ -0,0 +1,19 @@
1
+ import { FoundationElement, type FoundationElementDefinition } from '@ni/fast-foundation';
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ 'spright-chat-message-welcome': ChatMessageWelcome;
5
+ }
6
+ }
7
+ /**
8
+ * SprightChatMessageWelcome configuration options
9
+ * @public
10
+ */
11
+ export type ChatMessageWelcomeOptions = FoundationElementDefinition;
12
+ /**
13
+ * A Spright component for displaying a welcome chat message
14
+ */
15
+ export declare class ChatMessageWelcome extends FoundationElement {
16
+ welcomeTitle?: string;
17
+ subtitle?: string;
18
+ }
19
+ export declare const chatMessageWelcomeTag = "spright-chat-message-welcome";
@@ -0,0 +1,24 @@
1
+ import { __decorate } from "tslib";
2
+ import { attr } from '@ni/fast-element';
3
+ import { DesignSystem, FoundationElement } from '@ni/fast-foundation';
4
+ import { styles } from './styles';
5
+ import { template } from './template';
6
+ /**
7
+ * A Spright component for displaying a welcome chat message
8
+ */
9
+ export class ChatMessageWelcome extends FoundationElement {
10
+ }
11
+ __decorate([
12
+ attr({ attribute: 'welcome-title' })
13
+ ], ChatMessageWelcome.prototype, "welcomeTitle", void 0);
14
+ __decorate([
15
+ attr
16
+ ], ChatMessageWelcome.prototype, "subtitle", void 0);
17
+ const sprightChatMessageWelcome = ChatMessageWelcome.compose({
18
+ baseName: 'chat-message-welcome',
19
+ template,
20
+ styles
21
+ });
22
+ DesignSystem.getOrCreate().withPrefix('spright').register(sprightChatMessageWelcome());
23
+ export const chatMessageWelcomeTag = 'spright-chat-message-welcome';
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/chat/message/welcome/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EACH,YAAY,EACZ,iBAAiB,EAEpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AActC;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB;CAMxD;AAJU;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;wDACR;AAGtB;IADN,IAAI;oDACoB;AAG7B,MAAM,yBAAyB,GAAG,kBAAkB,CAAC,OAAO,CAAC;IACzD,QAAQ,EAAE,sBAAsB;IAChC,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,yBAAyB,EAAE,CAAC,CAAC;AACvF,MAAM,CAAC,MAAM,qBAAqB,GAAG,8BAA8B,CAAC","sourcesContent":["import { attr } from '@ni/fast-element';\nimport {\n DesignSystem,\n FoundationElement,\n type FoundationElementDefinition\n} from '@ni/fast-foundation';\nimport { styles } from './styles';\nimport { template } from './template';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'spright-chat-message-welcome': ChatMessageWelcome;\n }\n}\n\n/**\n * SprightChatMessageWelcome configuration options\n * @public\n */\nexport type ChatMessageWelcomeOptions = FoundationElementDefinition;\n\n/**\n * A Spright component for displaying a welcome chat message\n */\nexport class ChatMessageWelcome extends FoundationElement {\n @attr({ attribute: 'welcome-title' })\n public welcomeTitle?: string;\n\n @attr\n public subtitle?: string;\n}\n\nconst sprightChatMessageWelcome = ChatMessageWelcome.compose({\n baseName: 'chat-message-welcome',\n template,\n styles\n});\n\nDesignSystem.getOrCreate().withPrefix('spright').register(sprightChatMessageWelcome());\nexport const chatMessageWelcomeTag = 'spright-chat-message-welcome';\n"]}
@@ -0,0 +1 @@
1
+ export declare const styles: import("@ni/fast-element").ElementStyles;