@signalwire/web-components 4.0.0-beta.1 → 4.0.0-beta.11
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/README.md +9 -10
- package/dist/components/audio-level.d.ts +114 -0
- package/dist/components/audio-level.d.ts.map +1 -0
- package/dist/components/audio-level.js +203 -0
- package/dist/components/audio-level.js.map +1 -0
- package/dist/components/call-controls.d.ts +183 -0
- package/dist/components/call-controls.d.ts.map +1 -0
- package/dist/components/call-controls.js +606 -0
- package/dist/components/call-controls.js.map +1 -0
- package/dist/components/call-media.d.ts +118 -0
- package/dist/components/call-media.d.ts.map +1 -0
- package/dist/components/call-media.js +219 -0
- package/dist/components/call-media.js.map +1 -0
- package/dist/components/call-status.d.ts +83 -0
- package/dist/components/call-status.d.ts.map +1 -0
- package/dist/components/call-status.js +255 -0
- package/dist/components/call-status.js.map +1 -0
- package/dist/components/click-to-call.d.ts +151 -0
- package/dist/components/click-to-call.d.ts.map +1 -0
- package/dist/components/click-to-call.js +428 -0
- package/dist/components/click-to-call.js.map +1 -0
- package/dist/components/device-selector.d.ts +238 -0
- package/dist/components/device-selector.d.ts.map +1 -0
- package/dist/components/device-selector.js +685 -0
- package/dist/components/device-selector.js.map +1 -0
- package/dist/components/dialpad.d.ts +74 -0
- package/dist/components/dialpad.d.ts.map +1 -0
- package/dist/components/dialpad.js +372 -0
- package/dist/components/dialpad.js.map +1 -0
- package/dist/components/directory.d.ts +125 -0
- package/dist/components/directory.d.ts.map +1 -0
- package/dist/components/directory.js +503 -0
- package/dist/components/directory.js.map +1 -0
- package/dist/components/example-button.d.ts +21 -0
- package/dist/components/example-button.d.ts.map +1 -0
- package/dist/components/example-button.js +74 -0
- package/dist/components/example-button.js.map +1 -0
- package/dist/components/participant-controls.d.ts +123 -0
- package/dist/components/participant-controls.d.ts.map +1 -0
- package/dist/components/participant-controls.js +468 -0
- package/dist/components/participant-controls.js.map +1 -0
- package/dist/components/participants.d.ts +120 -0
- package/dist/components/participants.d.ts.map +1 -0
- package/dist/components/participants.js +394 -0
- package/dist/components/participants.js.map +1 -0
- package/dist/components/self-media.d.ts +78 -0
- package/dist/components/self-media.d.ts.map +1 -0
- package/dist/components/self-media.js +129 -0
- package/dist/components/self-media.js.map +1 -0
- package/dist/constants.d.ts +10 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +5 -0
- package/dist/constants.js.map +1 -0
- package/dist/context/call-context.d.ts +13 -0
- package/dist/context/call-context.d.ts.map +1 -0
- package/dist/context/call-context.js +6 -0
- package/dist/context/call-context.js.map +1 -0
- package/dist/context/index.d.ts +2 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -5644
- package/dist/index.js.map +1 -1
- package/dist/react.d.ts +122 -0
- package/dist/types/index.d.ts +20 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +12 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/debounce.d.ts +10 -0
- package/dist/utils/debounce.d.ts.map +1 -0
- package/dist/utils/debounce.js +13 -0
- package/dist/utils/debounce.js.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/video.d.ts +34 -0
- package/dist/utils/video.d.ts.map +1 -0
- package/dist/utils/video.js +26 -0
- package/dist/utils/video.js.map +1 -0
- package/package.json +70 -3
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Directory Component
|
|
3
|
+
*
|
|
4
|
+
* A searchable list of addresses from the directory service.
|
|
5
|
+
* Supports filtering, selection, and pagination.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```html
|
|
9
|
+
* <sw-directory .directory=${directory}></sw-directory>
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* @fires sw-address-select - Fired when an address is selected. Detail: `{ address: Address }`
|
|
13
|
+
* @fires sw-dial - Fired when the call button on an address is clicked. Detail: `{ address: Address, channel: string }`
|
|
14
|
+
*
|
|
15
|
+
* @cssprop [--sw-color-primary=#044cf6] - Primary brand color
|
|
16
|
+
* @cssprop [--sw-color-primary-hover=#0339c4] - Primary color on hover
|
|
17
|
+
* @cssprop [--sw-color-success=#10b981] - Success/positive color
|
|
18
|
+
* @cssprop [--sw-color-text=#1f2937] - Primary text color
|
|
19
|
+
* @cssprop [--sw-color-text-muted=#6b7280] - Secondary/muted text color
|
|
20
|
+
* @cssprop [--sw-color-background=#ffffff] - Component background color
|
|
21
|
+
* @cssprop [--sw-color-background-hover=#f3f4f6] - Background color on hover
|
|
22
|
+
* @cssprop [--sw-color-background-active=#e5e7eb] - Background color on active/press
|
|
23
|
+
* @cssprop [--sw-color-border=#e5e7eb] - Border color
|
|
24
|
+
* @cssprop [--sw-font-family=-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif] - Font family
|
|
25
|
+
* @cssprop [--sw-font-size-sm=12px] - Small font size
|
|
26
|
+
* @cssprop [--sw-font-size-base=14px] - Base font size
|
|
27
|
+
* @cssprop [--sw-font-size-lg=16px] - Large font size
|
|
28
|
+
* @cssprop [--sw-space-1=4px] - Smallest spacing unit
|
|
29
|
+
* @cssprop [--sw-space-2=8px] - Small spacing unit
|
|
30
|
+
* @cssprop [--sw-space-3=12px] - Medium spacing unit
|
|
31
|
+
* @cssprop [--sw-space-4=16px] - Large spacing unit
|
|
32
|
+
* @cssprop [--sw-border-radius=8px] - Border radius for containers and inputs
|
|
33
|
+
*/
|
|
34
|
+
import { LitElement } from 'lit';
|
|
35
|
+
import type { Observable } from 'rxjs';
|
|
36
|
+
/**
|
|
37
|
+
* Address type from SDK
|
|
38
|
+
*/
|
|
39
|
+
export interface Address {
|
|
40
|
+
id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
displayName?: string;
|
|
43
|
+
type?: 'room' | 'person';
|
|
44
|
+
channels?: {
|
|
45
|
+
audio?: boolean;
|
|
46
|
+
video?: boolean;
|
|
47
|
+
messaging?: boolean;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Directory interface for component
|
|
52
|
+
*/
|
|
53
|
+
export interface DirectoryService {
|
|
54
|
+
addresses$: Observable<Address[]>;
|
|
55
|
+
loading$?: Observable<boolean>;
|
|
56
|
+
hasMore$?: Observable<boolean>;
|
|
57
|
+
loadMore?(): Promise<void>;
|
|
58
|
+
}
|
|
59
|
+
export declare class DirectoryComponent extends LitElement {
|
|
60
|
+
static styles: import("lit").CSSResult;
|
|
61
|
+
/**
|
|
62
|
+
* Directory service with addresses$ observable
|
|
63
|
+
*/
|
|
64
|
+
directory: DirectoryService | null;
|
|
65
|
+
/**
|
|
66
|
+
* Currently selected address
|
|
67
|
+
*/
|
|
68
|
+
private selectedAddress;
|
|
69
|
+
/**
|
|
70
|
+
* Search filter query
|
|
71
|
+
*/
|
|
72
|
+
private searchQuery;
|
|
73
|
+
/**
|
|
74
|
+
* List of addresses from directory
|
|
75
|
+
*/
|
|
76
|
+
private addresses;
|
|
77
|
+
/**
|
|
78
|
+
* Loading state
|
|
79
|
+
*/
|
|
80
|
+
private loading;
|
|
81
|
+
/**
|
|
82
|
+
* Has more addresses to load
|
|
83
|
+
*/
|
|
84
|
+
private hasMore;
|
|
85
|
+
/**
|
|
86
|
+
* RxJS subscriptions for cleanup
|
|
87
|
+
*/
|
|
88
|
+
private subscriptions;
|
|
89
|
+
/**
|
|
90
|
+
* Debounce timer for search
|
|
91
|
+
*/
|
|
92
|
+
private searchDebounceTimer;
|
|
93
|
+
/**
|
|
94
|
+
* IntersectionObserver for infinite scroll
|
|
95
|
+
*/
|
|
96
|
+
private intersectionObserver;
|
|
97
|
+
/**
|
|
98
|
+
* Flag to track if we're auto-loading for search
|
|
99
|
+
*/
|
|
100
|
+
private isAutoLoadingForSearch;
|
|
101
|
+
connectedCallback(): void;
|
|
102
|
+
disconnectedCallback(): void;
|
|
103
|
+
private subscribeToDirectory;
|
|
104
|
+
private cleanup;
|
|
105
|
+
protected firstUpdated(): void;
|
|
106
|
+
private setupInfiniteScroll;
|
|
107
|
+
protected updated(changedProperties: Map<string, unknown>): void;
|
|
108
|
+
private checkAutoLoadForSearch;
|
|
109
|
+
private get filteredAddresses();
|
|
110
|
+
private handleSearchInput;
|
|
111
|
+
private handleItemClick;
|
|
112
|
+
private handleItemDoubleClick;
|
|
113
|
+
private handleDial;
|
|
114
|
+
private handleLoadMore;
|
|
115
|
+
private renderAddressIcon;
|
|
116
|
+
private renderChannelIcons;
|
|
117
|
+
private renderLoadingIndicator;
|
|
118
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
119
|
+
}
|
|
120
|
+
declare global {
|
|
121
|
+
interface HTMLElementTagNameMap {
|
|
122
|
+
'sw-directory': DirectoryComponent;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=directory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../../src/components/directory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IACzB,QAAQ,CAAC,EAAE;QACT,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;IAC/B,QAAQ,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;IAC/B,QAAQ,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAED,qBACa,kBAAmB,SAAQ,UAAU;IAChD,MAAM,CAAC,MAAM,0BAuPX;IAEF;;OAEG;IAEH,SAAS,EAAE,gBAAgB,GAAG,IAAI,CAAQ;IAE1C;;OAEG;IAEH,OAAO,CAAC,eAAe,CAAwB;IAE/C;;OAEG;IAEH,OAAO,CAAC,WAAW,CAAc;IAEjC;;OAEG;IAEH,OAAO,CAAC,SAAS,CAAiB;IAElC;;OAEG;IAEH,OAAO,CAAC,OAAO,CAAkB;IAEjC;;OAEG;IAEH,OAAO,CAAC,OAAO,CAAkB;IAEjC;;OAEG;IACH,OAAO,CAAC,aAAa,CAAsB;IAE3C;;OAEG;IACH,OAAO,CAAC,mBAAmB,CAAuB;IAElD;;OAEG;IACH,OAAO,CAAC,oBAAoB,CAAqC;IAEjE;;OAEG;IAEH,OAAO,CAAC,sBAAsB,CAAkB;IAEhD,iBAAiB;IAKjB,oBAAoB;IAKpB,OAAO,CAAC,oBAAoB;IAiC5B,OAAO,CAAC,OAAO;IAYf,SAAS,CAAC,YAAY;IAItB,OAAO,CAAC,mBAAmB;IAqB3B,SAAS,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;YAyB3C,sBAAsB;IAiBpC,OAAO,KAAK,iBAAiB,GAU5B;IAED,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,UAAU;YAUJ,cAAc;IAM5B,OAAO,CAAC,iBAAiB;IAmBzB,OAAO,CAAC,kBAAkB;IA8B1B,OAAO,CAAC,sBAAsB;IAS9B,MAAM;CA+EP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,kBAAkB,CAAC;KACpC;CACF"}
|
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
import { LitElement as p, html as i, css as u } from "lit";
|
|
2
|
+
import { property as v, state as d, customElement as w } from "lit/decorators.js";
|
|
3
|
+
var b = Object.defineProperty, m = Object.getOwnPropertyDescriptor, c = (e, s, a, r) => {
|
|
4
|
+
for (var t = r > 1 ? void 0 : r ? m(s, a) : s, n = e.length - 1, l; n >= 0; n--)
|
|
5
|
+
(l = e[n]) && (t = (r ? l(s, a, t) : l(t)) || t);
|
|
6
|
+
return r && t && b(s, a, t), t;
|
|
7
|
+
};
|
|
8
|
+
let o = class extends p {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments), this.directory = null, this.selectedAddress = null, this.searchQuery = "", this.addresses = [], this.loading = !1, this.hasMore = !1, this.subscriptions = [], this.searchDebounceTimer = null, this.intersectionObserver = null, this.isAutoLoadingForSearch = !1;
|
|
11
|
+
}
|
|
12
|
+
connectedCallback() {
|
|
13
|
+
super.connectedCallback(), this.subscribeToDirectory();
|
|
14
|
+
}
|
|
15
|
+
disconnectedCallback() {
|
|
16
|
+
super.disconnectedCallback(), this.cleanup();
|
|
17
|
+
}
|
|
18
|
+
subscribeToDirectory() {
|
|
19
|
+
if (this.directory) {
|
|
20
|
+
if (this.directory.addresses$) {
|
|
21
|
+
const e = this.directory.addresses$.subscribe((s) => {
|
|
22
|
+
this.addresses = s;
|
|
23
|
+
});
|
|
24
|
+
this.subscriptions.push(e);
|
|
25
|
+
}
|
|
26
|
+
if (this.directory.loading$) {
|
|
27
|
+
const e = this.directory.loading$.subscribe((s) => {
|
|
28
|
+
this.loading = s;
|
|
29
|
+
});
|
|
30
|
+
this.subscriptions.push(e);
|
|
31
|
+
}
|
|
32
|
+
if (this.directory.hasMore$) {
|
|
33
|
+
const e = this.directory.hasMore$.subscribe((s) => {
|
|
34
|
+
this.hasMore = s;
|
|
35
|
+
});
|
|
36
|
+
this.subscriptions.push(e);
|
|
37
|
+
}
|
|
38
|
+
this.directory.loadMore && this.directory.loadMore();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
cleanup() {
|
|
42
|
+
this.subscriptions.forEach((e) => e.unsubscribe()), this.subscriptions = [], this.searchDebounceTimer && clearTimeout(this.searchDebounceTimer), this.intersectionObserver && (this.intersectionObserver.disconnect(), this.intersectionObserver = null);
|
|
43
|
+
}
|
|
44
|
+
firstUpdated() {
|
|
45
|
+
this.setupInfiniteScroll();
|
|
46
|
+
}
|
|
47
|
+
setupInfiniteScroll() {
|
|
48
|
+
var s, a;
|
|
49
|
+
const e = (s = this.shadowRoot) == null ? void 0 : s.querySelector(".scroll-sentinel");
|
|
50
|
+
e && (this.intersectionObserver = new IntersectionObserver(
|
|
51
|
+
(r) => {
|
|
52
|
+
const t = r[0];
|
|
53
|
+
t != null && t.isIntersecting && this.hasMore && !this.loading && this.handleLoadMore();
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
root: (a = this.shadowRoot) == null ? void 0 : a.querySelector(".list"),
|
|
57
|
+
rootMargin: "100px",
|
|
58
|
+
threshold: 0
|
|
59
|
+
}
|
|
60
|
+
), this.intersectionObserver.observe(e));
|
|
61
|
+
}
|
|
62
|
+
updated(e) {
|
|
63
|
+
super.updated(e), e.has("directory") && (this.cleanup(), this.subscribeToDirectory()), this.intersectionObserver || this.setupInfiniteScroll(), (e.has("addresses") || e.has("searchQuery") || e.has("loading")) && this.checkAutoLoadForSearch();
|
|
64
|
+
}
|
|
65
|
+
async checkAutoLoadForSearch() {
|
|
66
|
+
this.searchQuery.trim() && this.filteredAddresses.length === 0 && this.hasMore && !this.loading ? (this.isAutoLoadingForSearch = !0, await this.handleLoadMore()) : (this.filteredAddresses.length > 0 || !this.hasMore) && (this.isAutoLoadingForSearch = !1);
|
|
67
|
+
}
|
|
68
|
+
get filteredAddresses() {
|
|
69
|
+
if (!this.searchQuery.trim())
|
|
70
|
+
return this.addresses;
|
|
71
|
+
const e = this.searchQuery.toLowerCase();
|
|
72
|
+
return this.addresses.filter(
|
|
73
|
+
(s) => s.name.toLowerCase().includes(e) || s.displayName && s.displayName.toLowerCase().includes(e)
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
handleSearchInput(e) {
|
|
77
|
+
const s = e.target;
|
|
78
|
+
this.searchDebounceTimer && clearTimeout(this.searchDebounceTimer), this.searchDebounceTimer = window.setTimeout(() => {
|
|
79
|
+
this.searchQuery = s.value;
|
|
80
|
+
}, 200);
|
|
81
|
+
}
|
|
82
|
+
handleItemClick(e) {
|
|
83
|
+
this.selectedAddress = e, this.dispatchEvent(
|
|
84
|
+
new CustomEvent("sw-address-select", {
|
|
85
|
+
detail: { address: e },
|
|
86
|
+
bubbles: !0,
|
|
87
|
+
composed: !0
|
|
88
|
+
})
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
handleItemDoubleClick(e) {
|
|
92
|
+
this.handleDial(e);
|
|
93
|
+
}
|
|
94
|
+
handleDial(e) {
|
|
95
|
+
this.dispatchEvent(
|
|
96
|
+
new CustomEvent("sw-dial", {
|
|
97
|
+
detail: { address: e },
|
|
98
|
+
bubbles: !0,
|
|
99
|
+
composed: !0
|
|
100
|
+
})
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
async handleLoadMore() {
|
|
104
|
+
var e;
|
|
105
|
+
(e = this.directory) != null && e.loadMore && await this.directory.loadMore();
|
|
106
|
+
}
|
|
107
|
+
renderAddressIcon(e) {
|
|
108
|
+
return e.type === "room" ? i`
|
|
109
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
|
110
|
+
<path
|
|
111
|
+
d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 3c1.93 0 3.5 1.57 3.5 3.5S13.93 13 12 13s-3.5-1.57-3.5-3.5S10.07 6 12 6zm7 13H5v-.23c0-.62.28-1.2.76-1.58C7.47 15.82 9.64 15 12 15s4.53.82 6.24 2.19c.48.38.76.97.76 1.58V19z"
|
|
112
|
+
/>
|
|
113
|
+
</svg>
|
|
114
|
+
` : i`
|
|
115
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
|
116
|
+
<path
|
|
117
|
+
d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"
|
|
118
|
+
/>
|
|
119
|
+
</svg>
|
|
120
|
+
`;
|
|
121
|
+
}
|
|
122
|
+
renderChannelIcons(e) {
|
|
123
|
+
const s = e.channels || {};
|
|
124
|
+
return i`
|
|
125
|
+
<div class="item-channels">
|
|
126
|
+
<svg
|
|
127
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
128
|
+
viewBox="0 0 24 24"
|
|
129
|
+
fill="currentColor"
|
|
130
|
+
class="${s.audio ? "active" : ""}"
|
|
131
|
+
title="Audio"
|
|
132
|
+
>
|
|
133
|
+
<path
|
|
134
|
+
d="M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"
|
|
135
|
+
/>
|
|
136
|
+
</svg>
|
|
137
|
+
<svg
|
|
138
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
139
|
+
viewBox="0 0 24 24"
|
|
140
|
+
fill="currentColor"
|
|
141
|
+
class="${s.video ? "active" : ""}"
|
|
142
|
+
title="Video"
|
|
143
|
+
>
|
|
144
|
+
<path
|
|
145
|
+
d="M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4z"
|
|
146
|
+
/>
|
|
147
|
+
</svg>
|
|
148
|
+
</div>
|
|
149
|
+
`;
|
|
150
|
+
}
|
|
151
|
+
renderLoadingIndicator() {
|
|
152
|
+
return i`
|
|
153
|
+
<div class="scroll-loading">
|
|
154
|
+
<div class="spinner"></div>
|
|
155
|
+
<span>${this.isAutoLoadingForSearch ? "Searching..." : "Loading more..."}</span>
|
|
156
|
+
</div>
|
|
157
|
+
`;
|
|
158
|
+
}
|
|
159
|
+
render() {
|
|
160
|
+
const e = this.loading && this.addresses.length === 0, s = !this.loading && this.filteredAddresses.length === 0 && !this.hasMore, a = this.isAutoLoadingForSearch && this.filteredAddresses.length === 0;
|
|
161
|
+
return i`
|
|
162
|
+
<div class="container" part="container">
|
|
163
|
+
<div class="search" part="search">
|
|
164
|
+
<input
|
|
165
|
+
type="text"
|
|
166
|
+
class="search-input"
|
|
167
|
+
placeholder="Search addresses..."
|
|
168
|
+
@input=${this.handleSearchInput}
|
|
169
|
+
aria-label="Search addresses"
|
|
170
|
+
/>
|
|
171
|
+
</div>
|
|
172
|
+
|
|
173
|
+
<div class="list" part="list" role="listbox">
|
|
174
|
+
${e ? i`<div class="loading">Loading...</div>` : a ? this.renderLoadingIndicator() : s ? i`<div class="empty">No addresses found</div>` : i`
|
|
175
|
+
${this.filteredAddresses.map(
|
|
176
|
+
(r) => {
|
|
177
|
+
var t, n, l;
|
|
178
|
+
return i`
|
|
179
|
+
<div
|
|
180
|
+
class="item ${((t = this.selectedAddress) == null ? void 0 : t.id) === r.id ? "selected" : ""}"
|
|
181
|
+
part="item ${((n = this.selectedAddress) == null ? void 0 : n.id) === r.id ? "item-selected" : ""}"
|
|
182
|
+
role="option"
|
|
183
|
+
aria-selected="${((l = this.selectedAddress) == null ? void 0 : l.id) === r.id}"
|
|
184
|
+
@click=${() => this.handleItemClick(r)}
|
|
185
|
+
@dblclick=${() => this.handleItemDoubleClick(r)}
|
|
186
|
+
>
|
|
187
|
+
<div class="item-icon">${this.renderAddressIcon(r)}</div>
|
|
188
|
+
<div class="item-content">
|
|
189
|
+
<div class="item-name" part="item-name">
|
|
190
|
+
${r.displayName || r.name}
|
|
191
|
+
</div>
|
|
192
|
+
<div class="item-type" part="item-type">
|
|
193
|
+
${r.type || "address"}
|
|
194
|
+
</div>
|
|
195
|
+
</div>
|
|
196
|
+
${this.renderChannelIcons(r)}
|
|
197
|
+
<button
|
|
198
|
+
class="dial-button"
|
|
199
|
+
@click=${(h) => {
|
|
200
|
+
h.stopPropagation(), this.handleDial(r);
|
|
201
|
+
}}
|
|
202
|
+
aria-label="Call ${r.displayName || r.name}"
|
|
203
|
+
>
|
|
204
|
+
<svg
|
|
205
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
206
|
+
viewBox="0 0 24 24"
|
|
207
|
+
fill="currentColor"
|
|
208
|
+
>
|
|
209
|
+
<path
|
|
210
|
+
d="M6.62 10.79c1.44 2.83 3.76 5.15 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z"
|
|
211
|
+
/>
|
|
212
|
+
</svg>
|
|
213
|
+
</button>
|
|
214
|
+
</div>
|
|
215
|
+
`;
|
|
216
|
+
}
|
|
217
|
+
)}
|
|
218
|
+
<!-- Scroll sentinel for infinite scroll -->
|
|
219
|
+
<div class="scroll-sentinel">
|
|
220
|
+
${this.loading && !this.isAutoLoadingForSearch ? this.renderLoadingIndicator() : null}
|
|
221
|
+
</div>
|
|
222
|
+
`}
|
|
223
|
+
</div>
|
|
224
|
+
</div>
|
|
225
|
+
`;
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
o.styles = u`
|
|
229
|
+
:host {
|
|
230
|
+
/* CSS Custom Properties for theming */
|
|
231
|
+
--sw-color-primary: #044cf6;
|
|
232
|
+
--sw-color-primary-hover: #0339c4;
|
|
233
|
+
--sw-color-success: #10b981;
|
|
234
|
+
--sw-color-text: #1f2937;
|
|
235
|
+
--sw-color-text-muted: #6b7280;
|
|
236
|
+
--sw-color-background: #ffffff;
|
|
237
|
+
--sw-color-background-hover: #f3f4f6;
|
|
238
|
+
--sw-color-background-active: #e5e7eb;
|
|
239
|
+
--sw-color-border: #e5e7eb;
|
|
240
|
+
--sw-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
241
|
+
--sw-font-size-sm: 12px;
|
|
242
|
+
--sw-font-size-base: 14px;
|
|
243
|
+
--sw-font-size-lg: 16px;
|
|
244
|
+
--sw-space-1: 4px;
|
|
245
|
+
--sw-space-2: 8px;
|
|
246
|
+
--sw-space-3: 12px;
|
|
247
|
+
--sw-space-4: 16px;
|
|
248
|
+
--sw-border-radius: 8px;
|
|
249
|
+
|
|
250
|
+
display: block;
|
|
251
|
+
font-family: var(--sw-font-family);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/* Dark mode support */
|
|
255
|
+
:host([data-theme='dark']) {
|
|
256
|
+
--sw-color-text: #f9fafb;
|
|
257
|
+
--sw-color-text-muted: #9ca3af;
|
|
258
|
+
--sw-color-background: #1f2937;
|
|
259
|
+
--sw-color-background-hover: #374151;
|
|
260
|
+
--sw-color-background-active: #4b5563;
|
|
261
|
+
--sw-color-border: #374151;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
@media (prefers-color-scheme: dark) {
|
|
265
|
+
:host(:not([data-theme='light'])) {
|
|
266
|
+
--sw-color-text: #f9fafb;
|
|
267
|
+
--sw-color-text-muted: #9ca3af;
|
|
268
|
+
--sw-color-background: #1f2937;
|
|
269
|
+
--sw-color-background-hover: #374151;
|
|
270
|
+
--sw-color-background-active: #4b5563;
|
|
271
|
+
--sw-color-border: #374151;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.container {
|
|
276
|
+
display: flex;
|
|
277
|
+
flex-direction: column;
|
|
278
|
+
background: var(--sw-color-background);
|
|
279
|
+
border: 1px solid var(--sw-color-border);
|
|
280
|
+
border-radius: var(--sw-border-radius);
|
|
281
|
+
overflow: hidden;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.search {
|
|
285
|
+
display: flex;
|
|
286
|
+
align-items: center;
|
|
287
|
+
gap: var(--sw-space-2);
|
|
288
|
+
padding: var(--sw-space-3);
|
|
289
|
+
border-bottom: 1px solid var(--sw-color-border);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.search-input {
|
|
293
|
+
flex: 1;
|
|
294
|
+
padding: var(--sw-space-2) var(--sw-space-3);
|
|
295
|
+
border: 1px solid var(--sw-color-border);
|
|
296
|
+
border-radius: var(--sw-border-radius);
|
|
297
|
+
background: var(--sw-color-background);
|
|
298
|
+
color: var(--sw-color-text);
|
|
299
|
+
font-family: var(--sw-font-family);
|
|
300
|
+
font-size: var(--sw-font-size-base);
|
|
301
|
+
outline: none;
|
|
302
|
+
transition: border-color 0.15s ease;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.search-input:focus {
|
|
306
|
+
border-color: var(--sw-color-primary);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.search-input::placeholder {
|
|
310
|
+
color: var(--sw-color-text-muted);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.list {
|
|
314
|
+
display: flex;
|
|
315
|
+
flex-direction: column;
|
|
316
|
+
max-height: 400px;
|
|
317
|
+
overflow-y: auto;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.item {
|
|
321
|
+
display: flex;
|
|
322
|
+
align-items: center;
|
|
323
|
+
gap: var(--sw-space-3);
|
|
324
|
+
padding: var(--sw-space-3) var(--sw-space-4);
|
|
325
|
+
border-bottom: 1px solid var(--sw-color-border);
|
|
326
|
+
cursor: pointer;
|
|
327
|
+
transition: background-color 0.15s ease;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.item:last-child {
|
|
331
|
+
border-bottom: none;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.item:hover {
|
|
335
|
+
background: var(--sw-color-background-hover);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.item:active {
|
|
339
|
+
background: var(--sw-color-background-active);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.item.selected {
|
|
343
|
+
background: var(--sw-color-primary);
|
|
344
|
+
color: white;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.item.selected .item-type,
|
|
348
|
+
.item.selected .item-channels {
|
|
349
|
+
color: rgba(255, 255, 255, 0.8);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.item-icon {
|
|
353
|
+
display: flex;
|
|
354
|
+
align-items: center;
|
|
355
|
+
justify-content: center;
|
|
356
|
+
width: 40px;
|
|
357
|
+
height: 40px;
|
|
358
|
+
border-radius: 50%;
|
|
359
|
+
background: var(--sw-color-background-hover);
|
|
360
|
+
color: var(--sw-color-text-muted);
|
|
361
|
+
flex-shrink: 0;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.item.selected .item-icon {
|
|
365
|
+
background: rgba(255, 255, 255, 0.2);
|
|
366
|
+
color: white;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.item-icon svg {
|
|
370
|
+
width: 20px;
|
|
371
|
+
height: 20px;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.item-content {
|
|
375
|
+
flex: 1;
|
|
376
|
+
min-width: 0;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
.item-name {
|
|
380
|
+
font-size: var(--sw-font-size-base);
|
|
381
|
+
font-weight: 500;
|
|
382
|
+
color: inherit;
|
|
383
|
+
white-space: nowrap;
|
|
384
|
+
overflow: hidden;
|
|
385
|
+
text-overflow: ellipsis;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
.item-type {
|
|
389
|
+
font-size: var(--sw-font-size-sm);
|
|
390
|
+
color: var(--sw-color-text-muted);
|
|
391
|
+
text-transform: capitalize;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.item-channels {
|
|
395
|
+
display: flex;
|
|
396
|
+
gap: var(--sw-space-1);
|
|
397
|
+
color: var(--sw-color-text-muted);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
.item-channels svg {
|
|
401
|
+
width: 16px;
|
|
402
|
+
height: 16px;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.item-channels .active {
|
|
406
|
+
color: var(--sw-color-success);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
.loading,
|
|
410
|
+
.empty {
|
|
411
|
+
display: flex;
|
|
412
|
+
align-items: center;
|
|
413
|
+
justify-content: center;
|
|
414
|
+
padding: var(--sw-space-4);
|
|
415
|
+
color: var(--sw-color-text-muted);
|
|
416
|
+
font-size: var(--sw-font-size-base);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
.scroll-sentinel {
|
|
420
|
+
display: flex;
|
|
421
|
+
align-items: center;
|
|
422
|
+
justify-content: center;
|
|
423
|
+
padding: var(--sw-space-3);
|
|
424
|
+
min-height: 1px;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
.scroll-loading {
|
|
428
|
+
display: flex;
|
|
429
|
+
align-items: center;
|
|
430
|
+
justify-content: center;
|
|
431
|
+
gap: var(--sw-space-2);
|
|
432
|
+
padding: var(--sw-space-3);
|
|
433
|
+
color: var(--sw-color-text-muted);
|
|
434
|
+
font-size: var(--sw-font-size-sm);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.spinner {
|
|
438
|
+
width: 16px;
|
|
439
|
+
height: 16px;
|
|
440
|
+
border: 2px solid var(--sw-color-border);
|
|
441
|
+
border-top-color: var(--sw-color-primary);
|
|
442
|
+
border-radius: 50%;
|
|
443
|
+
animation: spin 0.8s linear infinite;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
@keyframes spin {
|
|
447
|
+
to {
|
|
448
|
+
transform: rotate(360deg);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
.dial-button {
|
|
453
|
+
display: flex;
|
|
454
|
+
align-items: center;
|
|
455
|
+
justify-content: center;
|
|
456
|
+
width: 36px;
|
|
457
|
+
height: 36px;
|
|
458
|
+
background: var(--sw-color-success);
|
|
459
|
+
border: none;
|
|
460
|
+
border-radius: 50%;
|
|
461
|
+
color: white;
|
|
462
|
+
cursor: pointer;
|
|
463
|
+
flex-shrink: 0;
|
|
464
|
+
transition: background-color 0.15s ease;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
.dial-button:hover {
|
|
468
|
+
background: #0ea472;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
.dial-button svg {
|
|
472
|
+
width: 18px;
|
|
473
|
+
height: 18px;
|
|
474
|
+
}
|
|
475
|
+
`;
|
|
476
|
+
c([
|
|
477
|
+
v({ type: Object })
|
|
478
|
+
], o.prototype, "directory", 2);
|
|
479
|
+
c([
|
|
480
|
+
d()
|
|
481
|
+
], o.prototype, "selectedAddress", 2);
|
|
482
|
+
c([
|
|
483
|
+
d()
|
|
484
|
+
], o.prototype, "searchQuery", 2);
|
|
485
|
+
c([
|
|
486
|
+
d()
|
|
487
|
+
], o.prototype, "addresses", 2);
|
|
488
|
+
c([
|
|
489
|
+
d()
|
|
490
|
+
], o.prototype, "loading", 2);
|
|
491
|
+
c([
|
|
492
|
+
d()
|
|
493
|
+
], o.prototype, "hasMore", 2);
|
|
494
|
+
c([
|
|
495
|
+
d()
|
|
496
|
+
], o.prototype, "isAutoLoadingForSearch", 2);
|
|
497
|
+
o = c([
|
|
498
|
+
w("sw-directory")
|
|
499
|
+
], o);
|
|
500
|
+
export {
|
|
501
|
+
o as DirectoryComponent
|
|
502
|
+
};
|
|
503
|
+
//# sourceMappingURL=directory.js.map
|