@nectary/labs 2.13.5 → 2.14.1

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 (63) hide show
  1. package/color-select/index.d.ts +3 -6
  2. package/color-select/types.d.ts +6 -0
  3. package/color-select/types.js +1 -0
  4. package/index.d.ts +1 -0
  5. package/index.js +1 -0
  6. package/package.json +2 -2
  7. package/phone-preview/index.d.ts +3 -6
  8. package/phone-preview/index.js +20 -3
  9. package/phone-preview/template.html +48 -30
  10. package/phone-preview/types.d.ts +6 -0
  11. package/phone-preview/types.js +1 -0
  12. package/phone-preview-rcs-channel/index.d.ts +4 -12
  13. package/phone-preview-rcs-channel/index.js +7 -18
  14. package/phone-preview-rcs-channel/types.d.ts +16 -0
  15. package/phone-preview-rcs-channel/types.js +1 -0
  16. package/phone-preview-rcs-channel-actions/index.d.ts +3 -8
  17. package/phone-preview-rcs-channel-actions/types.d.ts +10 -0
  18. package/phone-preview-rcs-channel-actions/types.js +1 -0
  19. package/phone-preview-rcs-channel-info/index.d.ts +3 -3
  20. package/phone-preview-rcs-channel-info/types.d.ts +1 -0
  21. package/phone-preview-rcs-channel-info/types.js +1 -0
  22. package/phone-preview-rcs-channel-info-option/index.d.ts +3 -8
  23. package/phone-preview-rcs-channel-info-option/types.d.ts +10 -0
  24. package/phone-preview-rcs-channel-info-option/types.js +1 -0
  25. package/phone-preview-rcs-channel-options/index.d.ts +3 -3
  26. package/phone-preview-rcs-channel-options/types.d.ts +1 -0
  27. package/phone-preview-rcs-channel-options/types.js +1 -0
  28. package/phone-preview-rcs-channel-tabs/index.d.ts +3 -6
  29. package/phone-preview-rcs-channel-tabs/index.js +2 -6
  30. package/phone-preview-rcs-channel-tabs/template.html +1 -1
  31. package/phone-preview-rcs-channel-tabs/types.d.ts +6 -0
  32. package/phone-preview-rcs-channel-tabs/types.js +1 -0
  33. package/phone-preview-rcs-chat/index.d.ts +3 -7
  34. package/phone-preview-rcs-chat/types.d.ts +8 -0
  35. package/phone-preview-rcs-chat/types.js +1 -0
  36. package/phone-preview-rcs-chat-message/index.d.ts +3 -6
  37. package/phone-preview-rcs-chat-message/types.d.ts +6 -0
  38. package/phone-preview-rcs-chat-message/types.js +1 -0
  39. package/phone-preview-whatsapp-channel/index.d.ts +47 -0
  40. package/phone-preview-whatsapp-channel/index.js +134 -0
  41. package/phone-preview-whatsapp-channel/template.html +181 -0
  42. package/phone-preview-whatsapp-channel/types.d.ts +18 -0
  43. package/phone-preview-whatsapp-channel/types.js +1 -0
  44. package/phone-preview-whatsapp-channel-account/index.d.ts +31 -0
  45. package/phone-preview-whatsapp-channel-account/index.js +60 -0
  46. package/phone-preview-whatsapp-channel-account/template.html +58 -0
  47. package/phone-preview-whatsapp-channel-account/types.d.ts +6 -0
  48. package/phone-preview-whatsapp-channel-account/types.js +1 -0
  49. package/phone-preview-whatsapp-channel-actions/index.d.ts +31 -0
  50. package/phone-preview-whatsapp-channel-actions/index.js +52 -0
  51. package/phone-preview-whatsapp-channel-actions/template.html +47 -0
  52. package/phone-preview-whatsapp-channel-actions/types.d.ts +6 -0
  53. package/phone-preview-whatsapp-channel-actions/types.js +1 -0
  54. package/phone-preview-whatsapp-channel-info/index.d.ts +22 -0
  55. package/phone-preview-whatsapp-channel-info/index.js +15 -0
  56. package/phone-preview-whatsapp-channel-info/template.html +25 -0
  57. package/phone-preview-whatsapp-channel-info/types.d.ts +1 -0
  58. package/phone-preview-whatsapp-channel-info/types.js +1 -0
  59. package/phone-preview-whatsapp-channel-info-option/index.d.ts +32 -0
  60. package/phone-preview-whatsapp-channel-info-option/index.js +60 -0
  61. package/phone-preview-whatsapp-channel-info-option/template.html +34 -0
  62. package/phone-preview-whatsapp-channel-info-option/types.d.ts +9 -0
  63. package/phone-preview-whatsapp-channel-info-option/types.js +1 -0
@@ -0,0 +1,52 @@
1
+ import "@nectary/components/icon";
2
+ import { defineCustomElement, NectaryElement } from "../utils/element.js";
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:host {\n display: block;\n}\n\n.actions {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 4px;\n}\n\n.action {\n --sinch-global-color-icon: var(--whatsapp-color, #008069);\n --sinch-global-size-icon: 20px;\n\n min-block-size: 48px;\n display: flex;\n flex-flow: column;\n align-items: center;\n justify-content: center;\n gap: 2px;\n padding-block: 8px;\n border-radius: 6px;\n background: var(--sinch-sys-color-surface-primary-default);\n color: var(--sinch-sys-color-text-default);\n font: var(--sinch-sys-font-body-xs);\n}\n</style>\n\n<div class="actions">\n <div class="action">\n <sinch-icon aria-hidden="true" icons-version="2" name="fa-share"></sinch-icon>\n <span id="share-label">Share</span>\n </div>\n <div class="action">\n <sinch-icon aria-hidden="true" icons-version="2" name="magnifying-glass"></sinch-icon>\n <span id="search-label">Search</span>\n </div>\n</div>\n';
4
+ const template = document.createElement("template");
5
+ template.innerHTML = templateHTML;
6
+ class PhonePreviewWhatsAppChannelActions extends NectaryElement {
7
+ #shareText;
8
+ #searchText;
9
+ constructor() {
10
+ super();
11
+ const shadowRoot = this.attachShadow();
12
+ shadowRoot.appendChild(template.content.cloneNode(true));
13
+ this.#shareText = shadowRoot.querySelector("#share-label");
14
+ this.#searchText = shadowRoot.querySelector("#search-label");
15
+ }
16
+ connectedCallback() {
17
+ super.connectedCallback();
18
+ this.#updateUI();
19
+ }
20
+ static get observedAttributes() {
21
+ return ["share-label", "search-label", "sharelabel", "searchlabel"];
22
+ }
23
+ attributeChangedCallback(name, oldVal, newVal) {
24
+ if (oldVal === newVal) {
25
+ return;
26
+ }
27
+ this.#updateUI();
28
+ }
29
+ get shareLabel() {
30
+ return this.getAttribute("share-label") ?? this.getAttribute("sharelabel") ?? "Share";
31
+ }
32
+ set shareLabel(value) {
33
+ this.setAttribute("share-label", value);
34
+ }
35
+ get searchLabel() {
36
+ return this.getAttribute("search-label") ?? this.getAttribute("searchlabel") ?? "Search";
37
+ }
38
+ set searchLabel(value) {
39
+ this.setAttribute("search-label", value);
40
+ }
41
+ #updateUI() {
42
+ if (!this.isDomConnected) {
43
+ return;
44
+ }
45
+ this.#shareText.textContent = this.shareLabel;
46
+ this.#searchText.textContent = this.searchLabel;
47
+ }
48
+ }
49
+ defineCustomElement("sinch-labs-phone-preview-whatsapp-channel-actions", PhonePreviewWhatsAppChannelActions);
50
+ export {
51
+ PhonePreviewWhatsAppChannelActions
52
+ };
@@ -0,0 +1,47 @@
1
+ <style>
2
+ :where(*, *::before, *::after) {
3
+ box-sizing: border-box;
4
+ padding: 0;
5
+ border: 0;
6
+ margin: 0;
7
+ font: inherit;
8
+ }
9
+
10
+ :host {
11
+ display: block;
12
+ }
13
+
14
+ .actions {
15
+ display: grid;
16
+ grid-template-columns: repeat(2, minmax(0, 1fr));
17
+ gap: 4px;
18
+ }
19
+
20
+ .action {
21
+ --sinch-global-color-icon: var(--whatsapp-color, #008069);
22
+ --sinch-global-size-icon: 20px;
23
+
24
+ min-block-size: 48px;
25
+ display: flex;
26
+ flex-flow: column;
27
+ align-items: center;
28
+ justify-content: center;
29
+ gap: 2px;
30
+ padding-block: 8px;
31
+ border-radius: 6px;
32
+ background: var(--sinch-sys-color-surface-primary-default);
33
+ color: var(--sinch-sys-color-text-default);
34
+ font: var(--sinch-sys-font-body-xs);
35
+ }
36
+ </style>
37
+
38
+ <div class="actions">
39
+ <div class="action">
40
+ <sinch-icon aria-hidden="true" icons-version="2" name="fa-share"></sinch-icon>
41
+ <span id="share-label">Share</span>
42
+ </div>
43
+ <div class="action">
44
+ <sinch-icon aria-hidden="true" icons-version="2" name="magnifying-glass"></sinch-icon>
45
+ <span id="search-label">Search</span>
46
+ </div>
47
+ </div>
@@ -0,0 +1,6 @@
1
+ export type PhonePreviewWhatsAppChannelActionsProps = {
2
+ /** Label shown below the share action. */
3
+ shareLabel?: string;
4
+ /** Label shown below the search action. */
5
+ searchLabel?: string;
6
+ };
@@ -0,0 +1,22 @@
1
+ import { NectaryElement } from '../utils';
2
+ import type { PhonePreviewWhatsAppChannelInfoProps } from './types';
3
+ import type React from 'react';
4
+ export * from './types';
5
+ export declare class PhonePreviewWhatsAppChannelInfo extends NectaryElement {
6
+ constructor();
7
+ }
8
+ type ElementProps = Partial<{
9
+ [K in keyof PhonePreviewWhatsAppChannelInfoProps]: PhonePreviewWhatsAppChannelInfoProps[K] | string;
10
+ }>;
11
+ declare global {
12
+ interface HTMLElementTagNameMap {
13
+ 'sinch-labs-phone-preview-whatsapp-channel-info': ElementProps & HTMLElement;
14
+ }
15
+ }
16
+ declare module 'react' {
17
+ namespace JSX {
18
+ interface IntrinsicElements {
19
+ 'sinch-labs-phone-preview-whatsapp-channel-info': ElementProps & React.ClassAttributes<HTMLElement> & React.HTMLAttributes<HTMLElement>;
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,15 @@
1
+ import { defineCustomElement, NectaryElement } from "../utils/element.js";
2
+ 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 display: block;\n overflow: hidden;\n border-radius: 6px;\n background: var(--sinch-sys-color-surface-primary-default);\n}\n\n.info {\n display: flex;\n flex-flow: column;\n}\n</style>\n\n<div class="info">\n <slot></slot>\n</div>\n';
3
+ const template = document.createElement("template");
4
+ template.innerHTML = templateHTML;
5
+ class PhonePreviewWhatsAppChannelInfo extends NectaryElement {
6
+ constructor() {
7
+ super();
8
+ const shadowRoot = this.attachShadow();
9
+ shadowRoot.appendChild(template.content.cloneNode(true));
10
+ }
11
+ }
12
+ defineCustomElement("sinch-labs-phone-preview-whatsapp-channel-info", PhonePreviewWhatsAppChannelInfo);
13
+ export {
14
+ PhonePreviewWhatsAppChannelInfo
15
+ };
@@ -0,0 +1,25 @@
1
+ <style>
2
+ :where(*, *::before, *::after) {
3
+ box-sizing: border-box;
4
+ padding: 0;
5
+ border: 0;
6
+ margin: 0;
7
+ font: inherit;
8
+ }
9
+
10
+ :host {
11
+ display: block;
12
+ overflow: hidden;
13
+ border-radius: 6px;
14
+ background: var(--sinch-sys-color-surface-primary-default);
15
+ }
16
+
17
+ .info {
18
+ display: flex;
19
+ flex-flow: column;
20
+ }
21
+ </style>
22
+
23
+ <div class="info">
24
+ <slot></slot>
25
+ </div>
@@ -0,0 +1 @@
1
+ export type PhonePreviewWhatsAppChannelInfoProps = Record<never, never>;
@@ -0,0 +1,32 @@
1
+ import { NectaryElement } from '../utils';
2
+ import type { PhonePreviewWhatsAppChannelInfoOptionProps, WhatsAppChannelInfoType } from './types';
3
+ import type React from 'react';
4
+ export * from './types';
5
+ export declare class PhonePreviewWhatsAppChannelInfoOption extends NectaryElement {
6
+ #private;
7
+ constructor();
8
+ connectedCallback(): void;
9
+ static get observedAttributes(): string[];
10
+ attributeChangedCallback(name: string, oldVal: string | null, newVal: string | null): void;
11
+ get type(): WhatsAppChannelInfoType;
12
+ set type(value: WhatsAppChannelInfoType);
13
+ get value(): string;
14
+ set value(value: string);
15
+ get placeholder(): boolean;
16
+ set placeholder(value: boolean);
17
+ }
18
+ type ElementProps = Partial<{
19
+ [K in keyof PhonePreviewWhatsAppChannelInfoOptionProps]: PhonePreviewWhatsAppChannelInfoOptionProps[K] | string;
20
+ }>;
21
+ declare global {
22
+ interface HTMLElementTagNameMap {
23
+ 'sinch-labs-phone-preview-whatsapp-channel-info-option': ElementProps & HTMLElement;
24
+ }
25
+ }
26
+ declare module 'react' {
27
+ namespace JSX {
28
+ interface IntrinsicElements {
29
+ 'sinch-labs-phone-preview-whatsapp-channel-info-option': ElementProps & React.ClassAttributes<HTMLElement> & React.HTMLAttributes<HTMLElement>;
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,60 @@
1
+ import { defineCustomElement, NectaryElement } from "../utils/element.js";
2
+ 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 min-block-size: 36px;\n display: flex;\n align-items: center;\n border-block-end: 1px solid var(--sinch-sys-color-border-subtle);\n color: var(--sinch-sys-color-text-muted);\n font: var(--sinch-sys-font-body-xs);\n}\n\n:host(:last-of-type) {\n border-block-end: 0;\n}\n\nspan {\n inline-size: 100%;\n padding: 8px;\n overflow-wrap: anywhere;\n}\n\n.link-like {\n color: var(--whatsapp-color, #008069);\n}\n</style>\n\n<span id="value"></span>\n';
3
+ const template = document.createElement("template");
4
+ template.innerHTML = templateHTML;
5
+ class PhonePreviewWhatsAppChannelInfoOption extends NectaryElement {
6
+ #value;
7
+ constructor() {
8
+ super();
9
+ const shadowRoot = this.attachShadow();
10
+ shadowRoot.appendChild(template.content.cloneNode(true));
11
+ this.#value = shadowRoot.querySelector("#value");
12
+ }
13
+ connectedCallback() {
14
+ super.connectedCallback();
15
+ this.#updateUI();
16
+ }
17
+ static get observedAttributes() {
18
+ return ["type", "value", "placeholder"];
19
+ }
20
+ attributeChangedCallback(name, oldVal, newVal) {
21
+ if (oldVal === newVal) {
22
+ return;
23
+ }
24
+ this.#updateUI();
25
+ }
26
+ get type() {
27
+ return this.getAttribute("type") === "link" ? "link" : "text";
28
+ }
29
+ set type(value) {
30
+ this.setAttribute("type", value);
31
+ }
32
+ get value() {
33
+ return this.getAttribute("value") ?? "";
34
+ }
35
+ set value(value) {
36
+ this.setAttribute("value", value);
37
+ }
38
+ get placeholder() {
39
+ return this.hasAttribute("placeholder");
40
+ }
41
+ set placeholder(value) {
42
+ if (value) {
43
+ this.setAttribute("placeholder", "");
44
+ } else {
45
+ this.removeAttribute("placeholder");
46
+ }
47
+ }
48
+ #updateUI() {
49
+ if (!this.isDomConnected) {
50
+ return;
51
+ }
52
+ const useLinkStyling = this.type === "link" && !this.placeholder;
53
+ this.#value.textContent = this.value;
54
+ this.#value.classList.toggle("link-like", useLinkStyling);
55
+ }
56
+ }
57
+ defineCustomElement("sinch-labs-phone-preview-whatsapp-channel-info-option", PhonePreviewWhatsAppChannelInfoOption);
58
+ export {
59
+ PhonePreviewWhatsAppChannelInfoOption
60
+ };
@@ -0,0 +1,34 @@
1
+ <style>
2
+ :where(*, *::before, *::after) {
3
+ box-sizing: border-box;
4
+ padding: 0;
5
+ border: 0;
6
+ margin: 0;
7
+ font: inherit;
8
+ }
9
+
10
+ :host {
11
+ min-block-size: 36px;
12
+ display: flex;
13
+ align-items: center;
14
+ border-block-end: 1px solid var(--sinch-sys-color-border-subtle);
15
+ color: var(--sinch-sys-color-text-muted);
16
+ font: var(--sinch-sys-font-body-xs);
17
+ }
18
+
19
+ :host(:last-of-type) {
20
+ border-block-end: 0;
21
+ }
22
+
23
+ span {
24
+ inline-size: 100%;
25
+ padding: 8px;
26
+ overflow-wrap: anywhere;
27
+ }
28
+
29
+ .link-like {
30
+ color: var(--whatsapp-color, #008069);
31
+ }
32
+ </style>
33
+
34
+ <span id="value"></span>
@@ -0,0 +1,9 @@
1
+ export type WhatsAppChannelInfoType = 'text' | 'link';
2
+ export type PhonePreviewWhatsAppChannelInfoOptionProps = {
3
+ /** Visual treatment of the information value. */
4
+ type?: WhatsAppChannelInfoType;
5
+ /** Information text displayed in the option. */
6
+ value?: string;
7
+ /** Displays the value using placeholder styling. */
8
+ placeholder?: boolean;
9
+ };