@ni/spright-components 7.0.0 → 7.1.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 +22 -3
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +9 -4
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/custom-elements.json +24 -0
- package/dist/custom-elements.md +6 -0
- package/dist/esm/chat/message/welcome/index.d.ts +5 -0
- package/dist/esm/chat/message/welcome/index.js +15 -1
- package/dist/esm/chat/message/welcome/index.js.map +1 -1
- package/dist/esm/chat/message/welcome/styles.js +6 -1
- package/dist/esm/chat/message/welcome/styles.js.map +1 -1
- package/dist/esm/chat/message/welcome/template.js +4 -4
- package/dist/esm/chat/message/welcome/template.js.map +1 -1
- package/dist/esm/chat/message/welcome/testing/chat-message-welcome.pageobject.d.ts +3 -0
- package/dist/esm/chat/message/welcome/testing/chat-message-welcome.pageobject.js +15 -1
- package/dist/esm/chat/message/welcome/testing/chat-message-welcome.pageobject.js.map +1 -1
- package/package.json +1 -1
|
@@ -988,6 +988,30 @@
|
|
|
988
988
|
"text": "string | undefined"
|
|
989
989
|
},
|
|
990
990
|
"privacy": "public"
|
|
991
|
+
},
|
|
992
|
+
{
|
|
993
|
+
"kind": "method",
|
|
994
|
+
"name": "slottedSubtitleElementsChanged",
|
|
995
|
+
"privacy": "public",
|
|
996
|
+
"return": {
|
|
997
|
+
"type": {
|
|
998
|
+
"text": "void"
|
|
999
|
+
}
|
|
1000
|
+
},
|
|
1001
|
+
"parameters": [
|
|
1002
|
+
{
|
|
1003
|
+
"name": "_prev",
|
|
1004
|
+
"type": {
|
|
1005
|
+
"text": "HTMLElement[] | undefined"
|
|
1006
|
+
}
|
|
1007
|
+
},
|
|
1008
|
+
{
|
|
1009
|
+
"name": "next",
|
|
1010
|
+
"type": {
|
|
1011
|
+
"text": "HTMLElement[] | undefined"
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
]
|
|
991
1015
|
}
|
|
992
1016
|
],
|
|
993
1017
|
"attributes": [
|
package/dist/custom-elements.md
CHANGED
|
@@ -189,6 +189,12 @@
|
|
|
189
189
|
| `welcomeTitle` | public | `string \| undefined` | | | |
|
|
190
190
|
| `subtitle` | public | `string \| undefined` | | | |
|
|
191
191
|
|
|
192
|
+
### Methods
|
|
193
|
+
|
|
194
|
+
| Name | Privacy | Description | Parameters | Return | Inherited From |
|
|
195
|
+
| -------------------------------- | ------- | ----------- | --------------------------------------------------------------------- | ------ | -------------- |
|
|
196
|
+
| `slottedSubtitleElementsChanged` | public | | `_prev: HTMLElement[] \| undefined, next: HTMLElement[] \| undefined` | `void` | |
|
|
197
|
+
|
|
192
198
|
### Attributes
|
|
193
199
|
|
|
194
200
|
| Name | Field | Inherited From |
|
|
@@ -15,5 +15,10 @@ export type ChatMessageWelcomeOptions = FoundationElementDefinition;
|
|
|
15
15
|
export declare class ChatMessageWelcome extends FoundationElement {
|
|
16
16
|
welcomeTitle?: string;
|
|
17
17
|
subtitle?: string;
|
|
18
|
+
/** @internal */
|
|
19
|
+
readonly slottedSubtitleElements?: HTMLElement[];
|
|
20
|
+
/** @internal */
|
|
21
|
+
subtitleIsEmpty: boolean;
|
|
22
|
+
slottedSubtitleElementsChanged(_prev: HTMLElement[] | undefined, next: HTMLElement[] | undefined): void;
|
|
18
23
|
}
|
|
19
24
|
export declare const chatMessageWelcomeTag = "spright-chat-message-welcome";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { attr } from '@ni/fast-element';
|
|
2
|
+
import { attr, observable } from '@ni/fast-element';
|
|
3
3
|
import { DesignSystem, FoundationElement } from '@ni/fast-foundation';
|
|
4
4
|
import { styles } from './styles';
|
|
5
5
|
import { template } from './template';
|
|
@@ -7,6 +7,14 @@ import { template } from './template';
|
|
|
7
7
|
* A Spright component for displaying a welcome chat message
|
|
8
8
|
*/
|
|
9
9
|
export class ChatMessageWelcome extends FoundationElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
/** @internal */
|
|
13
|
+
this.subtitleIsEmpty = true;
|
|
14
|
+
}
|
|
15
|
+
slottedSubtitleElementsChanged(_prev, next) {
|
|
16
|
+
this.subtitleIsEmpty = next === undefined || next.length === 0;
|
|
17
|
+
}
|
|
10
18
|
}
|
|
11
19
|
__decorate([
|
|
12
20
|
attr({ attribute: 'welcome-title' })
|
|
@@ -14,6 +22,12 @@ __decorate([
|
|
|
14
22
|
__decorate([
|
|
15
23
|
attr
|
|
16
24
|
], ChatMessageWelcome.prototype, "subtitle", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
observable
|
|
27
|
+
], ChatMessageWelcome.prototype, "slottedSubtitleElements", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
observable
|
|
30
|
+
], ChatMessageWelcome.prototype, "subtitleIsEmpty", void 0);
|
|
17
31
|
const sprightChatMessageWelcome = ChatMessageWelcome.compose({
|
|
18
32
|
baseName: 'chat-message-welcome',
|
|
19
33
|
template,
|
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/chat/message/welcome/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACpD,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;IAAzD;;QAWI,gBAAgB;QAET,oBAAe,GAAG,IAAI,CAAC;IAQlC,CAAC;IANU,8BAA8B,CACjC,KAAgC,EAChC,IAA+B;QAE/B,IAAI,CAAC,eAAe,GAAG,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;IACnE,CAAC;CACJ;AAnBU;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;wDACR;AAGtB;IADN,IAAI;oDACoB;AAIT;IADf,UAAU;mEAC6C;AAIjD;IADN,UAAU;2DACmB;AAUlC,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, observable } 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 /** @internal */\n @observable\n public readonly slottedSubtitleElements?: HTMLElement[];\n\n /** @internal */\n @observable\n public subtitleIsEmpty = true;\n\n public slottedSubtitleElementsChanged(\n _prev: HTMLElement[] | undefined,\n next: HTMLElement[] | undefined\n ): void {\n this.subtitleIsEmpty = next === undefined || next.length === 0;\n }\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"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { css } from '@ni/fast-element';
|
|
2
|
-
import { bodyFont, bodyFontColor, mediumPadding, standardPadding, subtitleFont, subtitleFontColor, titlePlus1Font, titlePlus1FontColor, } from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';
|
|
2
|
+
import { bodyFont, bodyFontColor, mediumPadding, standardPadding, linkFont, subtitleFont, subtitleFontColor, titlePlus1Font, titlePlus1FontColor, } from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';
|
|
3
3
|
import { display } from '../../../utilities/style/display';
|
|
4
4
|
export const styles = css `
|
|
5
5
|
${display('flex')}
|
|
@@ -47,6 +47,11 @@ export const styles = css `
|
|
|
47
47
|
font: ${subtitleFont};
|
|
48
48
|
color: ${subtitleFontColor};
|
|
49
49
|
text-align: center;
|
|
50
|
+
${linkFont.cssCustomProperty}: ${subtitleFont};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.subtitle.subtitle-empty {
|
|
54
|
+
display: none;
|
|
50
55
|
}
|
|
51
56
|
|
|
52
57
|
.message-content {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../src/chat/message/welcome/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEvC,OAAO,EACH,QAAQ,EACR,aAAa,EACb,aAAa,EACb,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,mBAAmB,GACtB,MAAM,6DAA6D,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAE3D,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,MAAM,CAAC;;;qBAGA,eAAe;sBACd,eAAe;;;;;;;;gBAQrB,QAAQ;iBACP,aAAa;;;;;;;eAOf,aAAa;;;;;;;;;;;;;;;;gBAgBZ,cAAc;iBACb,mBAAmB;;;;;gBAKpB,YAAY;iBACX,iBAAiB
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../src/chat/message/welcome/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEvC,OAAO,EACH,QAAQ,EACR,aAAa,EACb,aAAa,EACb,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,mBAAmB,GACtB,MAAM,6DAA6D,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAE3D,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,MAAM,CAAC;;;qBAGA,eAAe;sBACd,eAAe;;;;;;;;gBAQrB,QAAQ;iBACP,aAAa;;;;;;;eAOf,aAAa;;;;;;;;;;;;;;;;gBAgBZ,cAAc;iBACb,mBAAmB;;;;;gBAKpB,YAAY;iBACX,iBAAiB;;UAExB,QAAQ,CAAC,iBAAiB,KAAK,YAAY;;;;;;;;;;;;;;;eAetC,aAAa;;CAE3B,CAAC","sourcesContent":["import { css } from '@ni/fast-element';\n\nimport {\n bodyFont,\n bodyFontColor,\n mediumPadding,\n standardPadding,\n linkFont,\n subtitleFont,\n subtitleFontColor,\n titlePlus1Font,\n titlePlus1FontColor,\n} from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';\nimport { display } from '../../../utilities/style/display';\n\nexport const styles = css`\n ${display('flex')}\n\n :host {\n min-width: ${standardPadding};\n min-height: ${standardPadding};\n max-width: 90%;\n\n flex: 1;\n flex-direction: row;\n justify-content: center;\n align-self: center;\n align-items: center;\n font: ${bodyFont};\n color: ${bodyFontColor};\n }\n\n .container {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: ${mediumPadding};\n }\n\n .brand-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n slot[name='brand-icon']::slotted(*),\n slot[name='brand-icon'] > * {\n width: 48px;\n height: 48px;\n }\n\n .title {\n font: ${titlePlus1Font};\n color: ${titlePlus1FontColor};\n text-align: center;\n }\n\n .subtitle {\n font: ${subtitleFont};\n color: ${subtitleFontColor};\n text-align: center;\n ${linkFont.cssCustomProperty}: ${subtitleFont};\n }\n\n .subtitle.subtitle-empty {\n display: none;\n }\n\n .message-content {\n display: flex;\n flex-direction: column;\n align-items: center;\n width: fit-content;\n height: fit-content;\n max-width: 100%;\n overflow-x: auto;\n gap: ${mediumPadding};\n }\n`;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { html, ViewTemplate, when } from '@ni/fast-element';
|
|
1
|
+
import { html, slotted, ViewTemplate, when } from '@ni/fast-element';
|
|
2
2
|
import { iconNigelChatTag } from '../../../icons/nigel-chat';
|
|
3
3
|
export const template = () => html `
|
|
4
4
|
<div class="container">
|
|
@@ -10,9 +10,9 @@ export const template = () => html `
|
|
|
10
10
|
${when(x => x.welcomeTitle, html `
|
|
11
11
|
<div class="title">${x => x.welcomeTitle}</div>
|
|
12
12
|
`)}
|
|
13
|
-
${
|
|
14
|
-
<
|
|
15
|
-
|
|
13
|
+
<div class="subtitle ${x => (!x.subtitle && x.subtitleIsEmpty ? 'subtitle-empty' : '')}">
|
|
14
|
+
<slot name="subtitle" ${slotted({ property: 'slottedSubtitleElements' })}>${x => x.subtitle}</slot>
|
|
15
|
+
</div>
|
|
16
16
|
<section class="message-content">
|
|
17
17
|
<slot></slot>
|
|
18
18
|
</section>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../../src/chat/message/welcome/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../../src/chat/message/welcome/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAKrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,MAAM,CAAC,MAAM,QAAQ,GAEjB,GAAG,EAAE,CAAC,IAAI,CAAoB;;;;mBAIf,gBAAgB,MAAM,gBAAgB;;;UAG/C,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,EAAE,IAAI,CAAoB;iCAC3B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY;SAC3C,CAAC;+BACqB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;oCAC1D,OAAO,CAAC,EAAE,QAAQ,EAAE,yBAAyB,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;;;;;;CAMtG,CAAC","sourcesContent":["import { html, slotted, ViewTemplate, when } from '@ni/fast-element';\nimport type {\n FoundationElementTemplate\n} from '@ni/fast-foundation';\nimport type { ChatMessageWelcome } from '.';\nimport { iconNigelChatTag } from '../../../icons/nigel-chat';\n\nexport const template: FoundationElementTemplate<\nViewTemplate<ChatMessageWelcome>\n> = () => html<ChatMessageWelcome>`\n <div class=\"container\">\n <div class=\"brand-icon\">\n <slot name=\"brand-icon\">\n <${iconNigelChatTag}></${iconNigelChatTag}>\n </slot>\n </div>\n ${when(x => x.welcomeTitle, html<ChatMessageWelcome>`\n <div class=\"title\">${x => x.welcomeTitle}</div>\n `)}\n <div class=\"subtitle ${x => (!x.subtitle && x.subtitleIsEmpty ? 'subtitle-empty' : '')}\">\n <slot name=\"subtitle\" ${slotted({ property: 'slottedSubtitleElements' })}>${x => x.subtitle}</slot>\n </div>\n <section class=\"message-content\">\n <slot></slot>\n </section>\n </div>\n`;\n"]}
|
|
@@ -8,6 +8,8 @@ export declare class ChatMessageWelcomePageObject {
|
|
|
8
8
|
constructor(element: ChatMessageWelcome);
|
|
9
9
|
getTitleText(): string | null;
|
|
10
10
|
getSubtitleText(): string | null;
|
|
11
|
+
getSlottedSubtitleText(): string;
|
|
12
|
+
getSlottedSubtitleLinkHref(): string | null;
|
|
11
13
|
isTitleRendered(): boolean;
|
|
12
14
|
isSubtitleRendered(): boolean;
|
|
13
15
|
getSlottedBrandIconNodes(): Element[];
|
|
@@ -15,4 +17,5 @@ export declare class ChatMessageWelcomePageObject {
|
|
|
15
17
|
getMessageContentSlottedText(): string;
|
|
16
18
|
private getDefaultSlot;
|
|
17
19
|
private getBrandIconSlot;
|
|
20
|
+
private getSubtitleSlot;
|
|
18
21
|
}
|
|
@@ -21,11 +21,22 @@ export class ChatMessageWelcomePageObject {
|
|
|
21
21
|
}
|
|
22
22
|
return subtitleDiv.textContent?.trim() ?? '';
|
|
23
23
|
}
|
|
24
|
+
getSlottedSubtitleText() {
|
|
25
|
+
const assignedNodes = this.getSubtitleSlot()?.assignedNodes() ?? [];
|
|
26
|
+
return assignedNodes.map(node => node.textContent ?? '').join('').trim();
|
|
27
|
+
}
|
|
28
|
+
getSlottedSubtitleLinkHref() {
|
|
29
|
+
const assignedElement = this.getSubtitleSlot()?.assignedElements()[0];
|
|
30
|
+
return assignedElement?.querySelector('a')?.getAttribute('href') ?? null;
|
|
31
|
+
}
|
|
24
32
|
isTitleRendered() {
|
|
25
33
|
return this.element.shadowRoot?.querySelector('.title') !== null;
|
|
26
34
|
}
|
|
27
35
|
isSubtitleRendered() {
|
|
28
|
-
|
|
36
|
+
const subtitleDiv = this.element.shadowRoot?.querySelector('.subtitle');
|
|
37
|
+
return subtitleDiv !== null
|
|
38
|
+
&& subtitleDiv !== undefined
|
|
39
|
+
&& !subtitleDiv.classList.contains('subtitle-empty');
|
|
29
40
|
}
|
|
30
41
|
getSlottedBrandIconNodes() {
|
|
31
42
|
const slot = this.getBrandIconSlot();
|
|
@@ -47,5 +58,8 @@ export class ChatMessageWelcomePageObject {
|
|
|
47
58
|
getBrandIconSlot() {
|
|
48
59
|
return this.element.shadowRoot?.querySelector('slot[name="brand-icon"]');
|
|
49
60
|
}
|
|
61
|
+
getSubtitleSlot() {
|
|
62
|
+
return this.element.shadowRoot?.querySelector('slot[name="subtitle"]');
|
|
63
|
+
}
|
|
50
64
|
}
|
|
51
65
|
//# sourceMappingURL=chat-message-welcome.pageobject.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-message-welcome.pageobject.js","sourceRoot":"","sources":["../../../../../../src/chat/message/welcome/testing/chat-message-welcome.pageobject.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE;;;GAGG;AACH,MAAM,OAAO,4BAA4B;IACrC,YAAsC,OAA2B;QAA3B,YAAO,GAAP,OAAO,CAAoB;IAAG,CAAC;IAE9D,YAAY;QACf,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;QAClE,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC9C,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,QAAQ,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC9C,CAAC;IAEM,eAAe;QAClB,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;QACxE,IAAI,WAAW,KAAK,IAAI,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YACpD,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,WAAW,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACjD,CAAC;IAEM,eAAe;QAClB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,aAAa,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;IACrE,CAAC;IAEM,kBAAkB;QACrB,
|
|
1
|
+
{"version":3,"file":"chat-message-welcome.pageobject.js","sourceRoot":"","sources":["../../../../../../src/chat/message/welcome/testing/chat-message-welcome.pageobject.ts"],"names":[],"mappings":"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","sourcesContent":["import type { ChatMessageWelcome } from '..';\nimport { iconNigelChatTag } from '../../../../icons/nigel-chat';\n\n/**\n * Page object for the `spright-chat-message-welcome` component to provide consistent ways\n * of querying and interacting with the component during tests.\n */\nexport class ChatMessageWelcomePageObject {\n public constructor(protected readonly element: ChatMessageWelcome) {}\n\n public getTitleText(): string | null {\n const titleDiv = this.element.shadowRoot?.querySelector('.title');\n if (titleDiv === null || titleDiv === undefined) {\n return null;\n }\n return titleDiv.textContent?.trim() ?? '';\n }\n\n public getSubtitleText(): string | null {\n const subtitleDiv = this.element.shadowRoot?.querySelector('.subtitle');\n if (subtitleDiv === null || subtitleDiv === undefined) {\n return null;\n }\n return subtitleDiv.textContent?.trim() ?? '';\n }\n\n public getSlottedSubtitleText(): string {\n const assignedNodes = this.getSubtitleSlot()?.assignedNodes() ?? [];\n return assignedNodes.map(node => node.textContent ?? '').join('').trim();\n }\n\n public getSlottedSubtitleLinkHref(): string | null {\n const assignedElement = this.getSubtitleSlot()?.assignedElements()[0];\n return assignedElement?.querySelector('a')?.getAttribute('href') ?? null;\n }\n\n public isTitleRendered(): boolean {\n return this.element.shadowRoot?.querySelector('.title') !== null;\n }\n\n public isSubtitleRendered(): boolean {\n const subtitleDiv = this.element.shadowRoot?.querySelector('.subtitle');\n return subtitleDiv !== null\n && subtitleDiv !== undefined\n && !subtitleDiv.classList.contains('subtitle-empty');\n }\n\n public getSlottedBrandIconNodes(): Element[] {\n const slot = this.getBrandIconSlot();\n return slot?.assignedElements() ?? [];\n }\n\n public hasBrandIconDefaultContent(): boolean {\n const slot = this.getBrandIconSlot();\n const defaultContent = slot?.children[0];\n return defaultContent?.tagName.toLowerCase() === iconNigelChatTag;\n }\n\n public getMessageContentSlottedText(): string {\n const slot = this.getDefaultSlot();\n const assigned = slot?.assignedNodes({ flatten: true }) ?? [];\n return assigned.map(n => n.textContent ?? '').join('');\n }\n\n private getDefaultSlot(): HTMLSlotElement | null | undefined {\n return this.element.shadowRoot?.querySelector('slot:not([name])');\n }\n\n private getBrandIconSlot(): HTMLSlotElement | null | undefined {\n return this.element.shadowRoot?.querySelector('slot[name=\"brand-icon\"]');\n }\n\n private getSubtitleSlot(): HTMLSlotElement | null | undefined {\n return this.element.shadowRoot?.querySelector('slot[name=\"subtitle\"]');\n }\n}\n"]}
|