@nectary/labs 2.7.1 → 2.9.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/package.json +2 -2
- package/phone-preview-rcs-channel/index.js +1 -1
- package/phone-preview-rcs-channel/template.html +0 -1
- package/phone-preview-rcs-channel-info/index.d.ts +0 -1
- package/phone-preview-rcs-channel-info/index.js +0 -1
- package/phone-preview-rcs-chat-message/index.d.ts +3 -0
- package/phone-preview-rcs-chat-message/index.js +53 -2
- package/phone-preview-rcs-chat-message/template.html +22 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nectary/labs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"**/*/*.css",
|
|
6
6
|
"**/*/*.json",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"dev": "vite build --watch"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@nectary/components": "5.
|
|
22
|
+
"@nectary/components": "5.34.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/node": "22.12.0",
|
|
@@ -5,7 +5,7 @@ import "../phone-preview-rcs-channel-info/index.js";
|
|
|
5
5
|
import "../phone-preview-rcs-channel-info-option/index.js";
|
|
6
6
|
import "../phone-preview-rcs-channel-options/index.js";
|
|
7
7
|
import "../phone-preview-rcs-channel-tabs/index.js";
|
|
8
|
-
const templateHTML = '<style>\n:where(*, *::before, *::after) {\n box-sizing: border-box;\n padding: 0;\n border: 0;\n margin: 0;\n font: inherit;\n}\n\n:host {\n --banner-color: var(--sinch-sys-color-surface-tertiary-active);\n --banner-aspect-ratio: 1440 / 448;\n --logo-color: var(--sinch-sys-color-surface-secondary-default);\n\n display: flex;\n flex-flow: column;\n color: var(--sinch-sys-color-text-default);\n}\n\n#banner-img {\n display: block;\n
|
|
8
|
+
const templateHTML = '<style>\n:where(*, *::before, *::after) {\n box-sizing: border-box;\n padding: 0;\n border: 0;\n margin: 0;\n font: inherit;\n}\n\n:host {\n --banner-color: var(--sinch-sys-color-surface-tertiary-active);\n --banner-aspect-ratio: 1440 / 448;\n --logo-color: var(--sinch-sys-color-surface-secondary-default);\n\n display: flex;\n flex-flow: column;\n color: var(--sinch-sys-color-text-default);\n}\n\n#banner-img {\n display: block;\n aspect-ratio: var(--banner-aspect-ratio);\n margin-block-end: -40px;\n background: var(--banner-color);\n}\n\n#logo-img {\n block-size: 64px;\n inline-size: 64px;\n border-radius: 100%;\n background: var(--logo-color);\n align-self: center;\n}\n\n#brand-name {\n padding: 8px 24px;\n font: var(--sinch-sys-font-body-m);\n text-align: center;\n text-wrap: balance;\n word-wrap: break-word;\n}\n\n#brand-description {\n padding-inline: 24px;\n font: var(--sinch-sys-font-body-xs);\n text-align: center;\n text-wrap: balance;\n word-wrap: break-word;\n}\n\n#actions {\n align-self: center;\n padding-block: 32px 24px;\n}\n\n#tabs {\n padding-block-end: 8px;\n}\n\n#info-container {\n display: block;\n}\n\n#options-container {\n display: none;\n}\n</style>\n\n<img id="banner-img" alt="" />\n<img id="logo-img" alt="" />\n<h1 id="brand-name">Brand name</h1>\n<p id="brand-description">Brand description</p>\n<sinch-labs-phone-preview-rcs-channel-actions id="actions"></sinch-labs-phone-preview-rcs-channel-actions>\n<sinch-labs-phone-preview-rcs-channel-tabs id="tabs"></sinch-labs-phone-preview-rcs-channel-tabs>\n<sinch-labs-phone-preview-rcs-channel-info id="info-container">\n <slot name="contacts"></slot>\n</sinch-labs-phone-preview-rcs-channel-info>\n<sinch-labs-phone-preview-rcs-channel-options id="options-container"></sinch-labs-phone-preview-rcs-channel-options>\n';
|
|
9
9
|
const template = document.createElement("template");
|
|
10
10
|
template.innerHTML = templateHTML;
|
|
11
11
|
class PhonePreviewRcsChannel extends NectaryElement {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import "@nectary/components/icon";
|
|
2
2
|
import { defineCustomElement, NectaryElement } from "../utils/element.js";
|
|
3
|
-
import "../phone-preview-rcs-channel-info-option/index.js";
|
|
4
3
|
const templateHTML = '<style>\n:where(*, *::before, *::after) {\n box-sizing: border-box;\n padding: 0;\n border: 0;\n margin: 0;\n font: inherit;\n}\n\n.info {\n display: flex;\n flex-flow: column;\n font: var(--sinch-sys-font-body-xs);\n}\n</style>\n\n<section class="info" id="info-container">\n <slot name="contacts"></slot>\n <slot></slot>\n</section>\n';
|
|
5
4
|
const template = document.createElement("template");
|
|
6
5
|
template.innerHTML = templateHTML;
|
|
@@ -13,8 +13,11 @@ export declare class RcsChatMessage extends NectaryElement {
|
|
|
13
13
|
attributeChangedCallback(name: string, oldVal: string | null, newVal: string | null): void;
|
|
14
14
|
get text(): string;
|
|
15
15
|
set text(value: string);
|
|
16
|
+
get direction(): 'in' | 'out';
|
|
17
|
+
set direction(value: 'in' | 'out');
|
|
16
18
|
}
|
|
17
19
|
type Props = {
|
|
20
|
+
direction?: 'in' | 'out';
|
|
18
21
|
text?: string;
|
|
19
22
|
};
|
|
20
23
|
type ElementProps = Partial<{
|
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
import { defineCustomElement, NectaryElement } from "../utils/element.js";
|
|
2
|
-
const templateHTML =
|
|
2
|
+
const templateHTML = `<style>
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
:host([direction='in']) {
|
|
8
|
+
display: flex;
|
|
9
|
+
justify-content: flex-start;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
:host([direction='out']) {
|
|
13
|
+
display: flex;
|
|
14
|
+
justify-content: flex-end;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.message {
|
|
18
|
+
max-inline-size: 80%;
|
|
19
|
+
padding: 8px 12px;
|
|
20
|
+
border-radius: 16px;
|
|
21
|
+
font: var(--sinch-sys-font-body-xs);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:host([direction='in']) .message {
|
|
25
|
+
margin-inline-end: 8px;
|
|
26
|
+
border-end-start-radius: 0;
|
|
27
|
+
background: var(--sinch-sys-color-surface-tertiary-default);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
:host([direction='out']) .message {
|
|
31
|
+
margin-inline-start: 8px;
|
|
32
|
+
border-end-end-radius: 0;
|
|
33
|
+
background: var(--sinch-sys-color-feedback-info-subtle);
|
|
34
|
+
}
|
|
35
|
+
</style>
|
|
36
|
+
|
|
37
|
+
<section class="message">
|
|
38
|
+
<span id="message-text">Sample message</span>
|
|
39
|
+
</section>
|
|
40
|
+
`;
|
|
3
41
|
const template = document.createElement("template");
|
|
42
|
+
const DIRECTION_IN = "in";
|
|
43
|
+
const DIRECTION_OUT = "out";
|
|
4
44
|
template.innerHTML = templateHTML;
|
|
5
45
|
class RcsChatMessage extends NectaryElement {
|
|
6
46
|
#messageText;
|
|
@@ -12,10 +52,13 @@ class RcsChatMessage extends NectaryElement {
|
|
|
12
52
|
}
|
|
13
53
|
connectedCallback() {
|
|
14
54
|
super.connectedCallback();
|
|
55
|
+
if (!this.hasAttribute("direction")) {
|
|
56
|
+
this.direction = DIRECTION_IN;
|
|
57
|
+
}
|
|
15
58
|
this.#updateUI();
|
|
16
59
|
}
|
|
17
60
|
static get observedAttributes() {
|
|
18
|
-
return ["text"];
|
|
61
|
+
return ["text", "direction"];
|
|
19
62
|
}
|
|
20
63
|
attributeChangedCallback(name, oldVal, newVal) {
|
|
21
64
|
if (oldVal === newVal) {
|
|
@@ -23,6 +66,7 @@ class RcsChatMessage extends NectaryElement {
|
|
|
23
66
|
}
|
|
24
67
|
switch (name) {
|
|
25
68
|
case "text":
|
|
69
|
+
case "direction":
|
|
26
70
|
this.#updateUI();
|
|
27
71
|
break;
|
|
28
72
|
}
|
|
@@ -33,6 +77,13 @@ class RcsChatMessage extends NectaryElement {
|
|
|
33
77
|
set text(value) {
|
|
34
78
|
this.setAttribute("text", value);
|
|
35
79
|
}
|
|
80
|
+
get direction() {
|
|
81
|
+
const direction = this.getAttribute("direction");
|
|
82
|
+
return direction === DIRECTION_OUT ? DIRECTION_OUT : DIRECTION_IN;
|
|
83
|
+
}
|
|
84
|
+
set direction(value) {
|
|
85
|
+
this.setAttribute("direction", value === DIRECTION_OUT ? DIRECTION_OUT : DIRECTION_IN);
|
|
86
|
+
}
|
|
36
87
|
#updateUI() {
|
|
37
88
|
if (!this.isDomConnected) {
|
|
38
89
|
return;
|
|
@@ -3,13 +3,33 @@
|
|
|
3
3
|
display: block;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
+
:host([direction='in']) {
|
|
7
|
+
display: flex;
|
|
8
|
+
justify-content: flex-start;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
:host([direction='out']) {
|
|
12
|
+
display: flex;
|
|
13
|
+
justify-content: flex-end;
|
|
14
|
+
}
|
|
15
|
+
|
|
6
16
|
.message {
|
|
17
|
+
max-inline-size: 80%;
|
|
7
18
|
padding: 8px 12px;
|
|
8
|
-
margin-inline-end: 8px;
|
|
9
19
|
border-radius: 16px;
|
|
20
|
+
font: var(--sinch-sys-font-body-xs);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
:host([direction='in']) .message {
|
|
24
|
+
margin-inline-end: 8px;
|
|
10
25
|
border-end-start-radius: 0;
|
|
26
|
+
background: var(--sinch-sys-color-surface-tertiary-default);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
:host([direction='out']) .message {
|
|
30
|
+
margin-inline-start: 8px;
|
|
31
|
+
border-end-end-radius: 0;
|
|
11
32
|
background: var(--sinch-sys-color-feedback-info-subtle);
|
|
12
|
-
font: var(--sinch-sys-font-body-xs);
|
|
13
33
|
}
|
|
14
34
|
</style>
|
|
15
35
|
|