@nyaruka/temba-components 0.168.1 → 0.170.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/CHANGELOG.md +19 -0
- package/dist/locales/es.js +1 -0
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/fr.js +1 -0
- package/dist/locales/fr.js.map +1 -1
- package/dist/locales/pt.js +1 -0
- package/dist/locales/pt.js.map +1 -1
- package/dist/temba-components.js +1329 -1378
- package/dist/temba-components.js.map +1 -1
- package/package.json +1 -1
- package/src/display/Chat.ts +2 -2
- package/src/display/ContactName.ts +123 -1
- package/src/display/Dropdown.ts +11 -7
- package/src/display/Options.ts +27 -14
- package/src/display/TembaDate.ts +9 -2
- package/src/form/Compose.ts +37 -28
- package/src/interfaces.ts +13 -3
- package/src/list/BroadcastList.ts +3 -1
- package/src/list/ContactList.ts +113 -9
- package/src/list/ContentList.ts +351 -8
- package/src/list/ContentMenu.ts +12 -6
- package/src/list/TembaList.ts +99 -29
- package/src/list/TicketList.ts +87 -18
- package/src/live/ContactChat.ts +13 -1
- package/src/live/ContactDetails.ts +32 -1
- package/src/live/ContactFields.ts +34 -1
- package/src/live/ContactNotepad.ts +46 -11
- package/src/live/ContactStoreElement.ts +103 -1
- package/src/live/ContactWatch.ts +415 -0
- package/src/locales/es.ts +1 -0
- package/src/locales/fr.ts +1 -0
- package/src/locales/pt.ts +1 -0
- package/src/simulator/Simulator.ts +1 -0
- package/temba-modules.ts +0 -4
- package/xliff/es.xlf +3 -0
- package/xliff/fr.xlf +3 -0
- package/xliff/pt.xlf +3 -0
- package/src/live/ContactBadges.ts +0 -207
- package/src/live/ContactNameFetch.ts +0 -35
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import { css, html, TemplateResult } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators.js';
|
|
3
|
-
import { Group } from '../interfaces';
|
|
4
|
-
import { debounce, getClasses } from '../utils';
|
|
5
|
-
import { Icon } from '../Icons';
|
|
6
|
-
import { getLanguageName } from '../languages';
|
|
7
|
-
import { ContactStoreElement } from './ContactStoreElement';
|
|
8
|
-
|
|
9
|
-
const STATUS = {
|
|
10
|
-
stopped: { name: 'Stopped' },
|
|
11
|
-
blocked: { name: 'Blocked' },
|
|
12
|
-
archived: { name: 'Archived' }
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export class ContactBadges extends ContactStoreElement {
|
|
16
|
-
static get styles() {
|
|
17
|
-
return css`
|
|
18
|
-
.wrapper {
|
|
19
|
-
display: flex;
|
|
20
|
-
flex-direction: column;
|
|
21
|
-
align-items: center;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
temba-label {
|
|
25
|
-
margin: 0.3em;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.expanded .badges {
|
|
29
|
-
max-height: inherit;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.expanded .show-button {
|
|
33
|
-
opacity: 1;
|
|
34
|
-
margin-bottom: 0em;
|
|
35
|
-
margin-top: -0.5em;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.expanded .show-line {
|
|
39
|
-
width: 98%;
|
|
40
|
-
opacity: 1;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.badges {
|
|
44
|
-
display: flex;
|
|
45
|
-
overflow: hidden;
|
|
46
|
-
flex-wrap: wrap;
|
|
47
|
-
max-height: 2.2em;
|
|
48
|
-
align-self: flex-start;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.show-button {
|
|
52
|
-
transition: all var(--transition-speed) ease-in-out
|
|
53
|
-
var(--transition-speed);
|
|
54
|
-
opacity: 0;
|
|
55
|
-
display: flex;
|
|
56
|
-
padding: 0em 1em;
|
|
57
|
-
margin-top: -0.8em;
|
|
58
|
-
cursor: pointer;
|
|
59
|
-
--icon-color-circle: #fff;
|
|
60
|
-
margin-bottom: -1.5em;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.show-line {
|
|
64
|
-
height: 1px;
|
|
65
|
-
width: 100%;
|
|
66
|
-
background: rgba(0, 0, 0, 0.05);
|
|
67
|
-
margin-top: 1em;
|
|
68
|
-
width: 0px;
|
|
69
|
-
transition: width calc(var(--transition-speed) * 2) linear
|
|
70
|
-
var(--transition-speed);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.has-more .show-line {
|
|
74
|
-
width: 98%;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.has-more .show-button {
|
|
78
|
-
opacity: 1;
|
|
79
|
-
margin-bottom: 0em;
|
|
80
|
-
margin-top: -0.5em;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.show-button temba-icon {
|
|
84
|
-
border-radius: 9999px;
|
|
85
|
-
}
|
|
86
|
-
`;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
@property({ type: Boolean })
|
|
90
|
-
hasMore = false;
|
|
91
|
-
|
|
92
|
-
@property({ type: Boolean })
|
|
93
|
-
expanded = false;
|
|
94
|
-
|
|
95
|
-
private handleResized() {
|
|
96
|
-
if (this.shadowRoot) {
|
|
97
|
-
const badges = this.shadowRoot.querySelector('.badges');
|
|
98
|
-
if (badges) {
|
|
99
|
-
this.hasMore = badges.scrollHeight > badges.clientHeight;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
public updated(changedProperties: Map<string, any>) {
|
|
105
|
-
super.updated(changedProperties);
|
|
106
|
-
if (changedProperties.has('data')) {
|
|
107
|
-
if (!changedProperties.get('data')) {
|
|
108
|
-
const badges = this.shadowRoot.querySelector('.badges');
|
|
109
|
-
new ResizeObserver(
|
|
110
|
-
debounce(this.handleResized.bind(this), 200)
|
|
111
|
-
).observe(badges);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
public render(): TemplateResult {
|
|
117
|
-
if (this.data) {
|
|
118
|
-
const status = STATUS[this.data.status];
|
|
119
|
-
return html`
|
|
120
|
-
<div
|
|
121
|
-
class=${getClasses({
|
|
122
|
-
wrapper: true,
|
|
123
|
-
'has-more': this.hasMore,
|
|
124
|
-
expanded: this.expanded
|
|
125
|
-
})}
|
|
126
|
-
>
|
|
127
|
-
<div class="badges">
|
|
128
|
-
${status && this.data.status !== 'active'
|
|
129
|
-
? html`
|
|
130
|
-
<temba-label
|
|
131
|
-
icon="icon.contact_${this.data.status}"
|
|
132
|
-
onclick="goto(event)"
|
|
133
|
-
href="/contact/${status.name.toLowerCase()}/"
|
|
134
|
-
secondary
|
|
135
|
-
clickable
|
|
136
|
-
shadow
|
|
137
|
-
>
|
|
138
|
-
${status.name}
|
|
139
|
-
</temba-label>
|
|
140
|
-
`
|
|
141
|
-
: null}
|
|
142
|
-
${this.data.flow
|
|
143
|
-
? html`
|
|
144
|
-
<temba-label
|
|
145
|
-
icon="flow"
|
|
146
|
-
onclick="goto(event)"
|
|
147
|
-
href="/contact/?search=flow+%3D+${encodeURIComponent(
|
|
148
|
-
'"' + this.data.flow.name + '"'
|
|
149
|
-
)}"
|
|
150
|
-
clickable
|
|
151
|
-
primary
|
|
152
|
-
shadow
|
|
153
|
-
>
|
|
154
|
-
${this.data.flow.name}
|
|
155
|
-
</temba-label>
|
|
156
|
-
`
|
|
157
|
-
: null}
|
|
158
|
-
${this.data.language
|
|
159
|
-
? html`
|
|
160
|
-
<temba-label
|
|
161
|
-
icon=${Icon.language}
|
|
162
|
-
onclick="goto(event)"
|
|
163
|
-
href="/contact/?search=language+%3D+${encodeURIComponent(
|
|
164
|
-
'"' + this.data.language + '"'
|
|
165
|
-
)}"
|
|
166
|
-
clickable
|
|
167
|
-
primary
|
|
168
|
-
shadow
|
|
169
|
-
>
|
|
170
|
-
${getLanguageName(this.data.language)}
|
|
171
|
-
</temba-label>
|
|
172
|
-
`
|
|
173
|
-
: null}
|
|
174
|
-
${this.data.groups.map((group: Group) => {
|
|
175
|
-
return html`
|
|
176
|
-
<temba-label
|
|
177
|
-
class="group"
|
|
178
|
-
onclick="goto(event)"
|
|
179
|
-
href="/contact/group/${group.uuid}/"
|
|
180
|
-
icon=${group.is_dynamic ? Icon.group_smart : Icon.group}
|
|
181
|
-
clickable
|
|
182
|
-
shadow
|
|
183
|
-
>
|
|
184
|
-
${group.name}
|
|
185
|
-
</temba-label>
|
|
186
|
-
`;
|
|
187
|
-
})}
|
|
188
|
-
</div>
|
|
189
|
-
<div class="show-line"></div>
|
|
190
|
-
|
|
191
|
-
<div class="show-button">
|
|
192
|
-
<temba-icon
|
|
193
|
-
@click=${() => {
|
|
194
|
-
this.expanded = !this.expanded;
|
|
195
|
-
}}
|
|
196
|
-
circled
|
|
197
|
-
name=${!this.expanded ? Icon.down : Icon.up}
|
|
198
|
-
animateChange="spin"
|
|
199
|
-
></temba-icon>
|
|
200
|
-
</div>
|
|
201
|
-
</div>
|
|
202
|
-
`;
|
|
203
|
-
} else {
|
|
204
|
-
return null;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { css, html, TemplateResult } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators.js';
|
|
3
|
-
import { ContactStoreElement, getDestinationURN } from './ContactStoreElement';
|
|
4
|
-
|
|
5
|
-
export class ContactNameFetch extends ContactStoreElement {
|
|
6
|
-
@property({ type: Number, attribute: 'icon-size' })
|
|
7
|
-
size = 20;
|
|
8
|
-
|
|
9
|
-
static get styles() {
|
|
10
|
-
return css`
|
|
11
|
-
:host {
|
|
12
|
-
display: flex;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
temba-urn {
|
|
16
|
-
margin-right: 0.2em;
|
|
17
|
-
margin-top: 2px;
|
|
18
|
-
}
|
|
19
|
-
`;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
public render(): TemplateResult {
|
|
23
|
-
if (this.data) {
|
|
24
|
-
// show the URN that will be used when messaging the contact, falling
|
|
25
|
-
// back to their highest priority URN if none are sendable
|
|
26
|
-
const urn = getDestinationURN(this.data) || this.data.urns[0] || null;
|
|
27
|
-
return html` <temba-contact-name
|
|
28
|
-
name=${this.data.name || this.data.ref}
|
|
29
|
-
urn=${urn ? `${urn.scheme}:${urn.display || urn.path}` : null}
|
|
30
|
-
></temba-contact-name>
|
|
31
|
-
<slot></slot>`;
|
|
32
|
-
}
|
|
33
|
-
return super.render();
|
|
34
|
-
}
|
|
35
|
-
}
|