@nyaruka/temba-components 0.158.1 → 0.159.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 +12 -0
- package/dist/static/svg/index.svg +1 -1
- package/dist/temba-components.js +1458 -600
- package/dist/temba-components.js.map +1 -1
- package/package.json +1 -2
- package/src/Icons.ts +8 -1
- package/src/display/Button.ts +24 -14
- package/src/display/Thumbnail.ts +1 -1
- package/src/flow/nodes/split_by_resthook.ts +3 -3
- package/src/interfaces.ts +46 -2
- package/src/layout/PageHeader.ts +338 -0
- package/src/list/ContactList.ts +68 -52
- package/src/list/ContentList.ts +1461 -346
- package/src/list/FlowList.ts +20 -26
- package/src/list/MsgList.ts +169 -71
- package/src/live/ContactEvents.ts +880 -0
- package/src/styles/designTokens.ts +5 -2
- package/src/styles/pillVariants.ts +21 -6
- package/static/css/design-system.css +769 -0
- package/static/css/temba-components.css +16 -77
- package/static/svg/index.svg +1 -1
- package/static/svg/work/traced/chevron-down-double.svg +1 -0
- package/static/svg/work/traced/chevron-up-double.svg +1 -0
- package/static/svg/work/used/chevron-down-double.svg +3 -0
- package/static/svg/work/used/chevron-up-double.svg +3 -0
- package/temba-modules.ts +4 -2
- package/web-dev-server.config.mjs +9 -0
- package/src/live/ContactPending.ts +0 -247
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6.596 5.126 C 6.199 5.286,5.927 5.834,6.037 6.253 C 6.075 6.399,7.347 7.752,8.864 9.259 C 10.877 11.261,11.723 12.000,12.000 12.000 C 12.277 12.000,13.123 11.261,15.136 9.259 C 16.653 7.752,17.925 6.399,17.963 6.253 C 18.162 5.493,17.288 4.783,16.590 5.137 C 16.397 5.235,15.286 6.260,14.120 7.415 L 12.000 9.516 9.880 7.415 C 8.073 5.625,7.249 4.922,7.011 4.970 C 6.983 4.976,6.796 5.046,6.596 5.126 M6.325 12.315 C 5.683 13.024,5.870 13.318,8.829 16.264 C 10.871 18.296,11.720 19.040,11.998 19.040 C 12.275 19.040,13.091 18.333,15.002 16.440 C 16.445 15.010,17.718 13.660,17.831 13.440 C 18.056 13.001,18.006 12.707,17.634 12.280 C 17.092 11.657,16.687 11.898,14.292 14.273 L 12.000 16.546 9.708 14.273 C 7.282 11.868,6.919 11.658,6.325 12.315 " stroke="none" fill-rule="evenodd" fill="black"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M11.600 5.118 C 11.424 5.192,10.101 6.439,8.660 7.888 C 5.884 10.680,5.694 10.989,6.325 11.685 C 6.919 12.342,7.282 12.132,9.708 9.727 L 12.000 7.454 14.292 9.727 C 16.718 12.132,17.081 12.342,17.675 11.685 C 18.311 10.983,18.123 10.683,15.260 7.836 C 13.775 6.359,12.416 5.113,12.240 5.067 C 12.064 5.021,11.776 5.044,11.600 5.118 M8.864 14.741 C 7.347 16.248,6.075 17.601,6.037 17.747 C 5.856 18.438,6.577 19.154,7.246 18.949 C 7.441 18.890,8.590 17.863,9.800 16.668 L 12.000 14.495 14.200 16.668 C 15.410 17.863,16.559 18.890,16.754 18.949 C 17.423 19.154,18.144 18.438,17.963 17.747 C 17.925 17.601,16.653 16.248,15.136 14.741 C 13.123 12.739,12.277 12.000,12.000 12.000 C 11.723 12.000,10.877 12.739,8.864 14.741 " stroke="none" fill-rule="evenodd" fill="black"></path></svg>
|
package/temba-modules.ts
CHANGED
|
@@ -31,7 +31,7 @@ import { ContactFields } from './src/live/ContactFields';
|
|
|
31
31
|
import { ContactFieldEditor } from './src/live/ContactFieldEditor';
|
|
32
32
|
|
|
33
33
|
import { ContactBadges } from './src/live/ContactBadges';
|
|
34
|
-
import {
|
|
34
|
+
import { ContactEvents } from './src/live/ContactEvents';
|
|
35
35
|
import { TembaSlider } from './src/form/TembaSlider';
|
|
36
36
|
import { RunList } from './src/list/RunList';
|
|
37
37
|
import { FlowStoreElement } from './src/store/FlowStoreElement';
|
|
@@ -48,6 +48,7 @@ import { Resizer } from './src/layout/Resizer';
|
|
|
48
48
|
import { Thumbnail } from './src/display/Thumbnail';
|
|
49
49
|
import { NotificationList } from './src/list/NotificationList';
|
|
50
50
|
import { ContentList } from './src/list/ContentList';
|
|
51
|
+
import { PageHeader } from './src/layout/PageHeader';
|
|
51
52
|
import { MsgList } from './src/list/MsgList';
|
|
52
53
|
import { ContactList } from './src/list/ContactList';
|
|
53
54
|
import { FlowList } from './src/list/FlowList';
|
|
@@ -132,6 +133,7 @@ addCustomElement('temba-contact-details', ContactDetails);
|
|
|
132
133
|
addCustomElement('temba-ticket-list', TicketList);
|
|
133
134
|
addCustomElement('temba-notification-list', NotificationList);
|
|
134
135
|
addCustomElement('temba-content-list', ContentList);
|
|
136
|
+
addCustomElement('temba-page-header', PageHeader);
|
|
135
137
|
addCustomElement('temba-msg-list', MsgList);
|
|
136
138
|
addCustomElement('temba-contact-list', ContactList);
|
|
137
139
|
addCustomElement('temba-flow-list', FlowList);
|
|
@@ -147,7 +149,7 @@ addCustomElement('temba-dropdown', Dropdown);
|
|
|
147
149
|
addCustomElement('temba-tabs', TabPane);
|
|
148
150
|
addCustomElement('temba-tab', Tab);
|
|
149
151
|
addCustomElement('temba-contact-badges', ContactBadges);
|
|
150
|
-
addCustomElement('temba-contact-
|
|
152
|
+
addCustomElement('temba-contact-events', ContactEvents);
|
|
151
153
|
addCustomElement('temba-slider', TembaSlider);
|
|
152
154
|
addCustomElement('temba-content-menu', ContentMenu);
|
|
153
155
|
addCustomElement('temba-compose', Compose);
|
|
@@ -291,6 +291,15 @@ function applyDemoListAction(body, items, labels, idKey) {
|
|
|
291
291
|
|
|
292
292
|
export default {
|
|
293
293
|
nodeResolve: true,
|
|
294
|
+
middleware: [
|
|
295
|
+
// Permissive CORS so this dev server can be loaded as a cross-origin
|
|
296
|
+
// module source by a rapidpro instance running on a different localhost
|
|
297
|
+
// port (e.g. Nautilus/run-pair.sh launching rapidpro:8001 + components:3011).
|
|
298
|
+
(ctx, next) => {
|
|
299
|
+
ctx.set('Access-Control-Allow-Origin', '*');
|
|
300
|
+
return next();
|
|
301
|
+
},
|
|
302
|
+
],
|
|
294
303
|
plugins: [
|
|
295
304
|
replacePlugin({
|
|
296
305
|
preventAssignment: true,
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
import { css, html, PropertyValueMap, TemplateResult } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators.js';
|
|
3
|
-
import {
|
|
4
|
-
CustomEventType,
|
|
5
|
-
ScheduledEvent,
|
|
6
|
-
ScheduledEventType
|
|
7
|
-
} from '../interfaces';
|
|
8
|
-
import { EndpointMonitorElement } from '../store/EndpointMonitorElement';
|
|
9
|
-
import { Icon } from '../Icons';
|
|
10
|
-
|
|
11
|
-
const ICONS = {
|
|
12
|
-
[ScheduledEventType.CampaignEvent]: Icon.campaign,
|
|
13
|
-
[ScheduledEventType.ScheduledBroadcast]: Icon.message,
|
|
14
|
-
[ScheduledEventType.ScheduledTrigger]: Icon.trigger
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export class ContactPending extends EndpointMonitorElement {
|
|
18
|
-
@property({ type: String })
|
|
19
|
-
contact: string;
|
|
20
|
-
|
|
21
|
-
@property({ type: Object, attribute: false })
|
|
22
|
-
data: ScheduledEvent[];
|
|
23
|
-
|
|
24
|
-
@property({ type: String })
|
|
25
|
-
lang_weekly = 'Weekly';
|
|
26
|
-
|
|
27
|
-
@property({ type: String })
|
|
28
|
-
lang_daily = 'Daily';
|
|
29
|
-
|
|
30
|
-
@property({ type: String })
|
|
31
|
-
lang_once = 'Once';
|
|
32
|
-
|
|
33
|
-
REPEAT_PERIOD = {
|
|
34
|
-
O: this.lang_once,
|
|
35
|
-
D: this.lang_daily,
|
|
36
|
-
W: this.lang_weekly
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
static get styles() {
|
|
40
|
-
return css`
|
|
41
|
-
:host {
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
a,
|
|
45
|
-
.linked {
|
|
46
|
-
color: var(--color-link-primary);
|
|
47
|
-
cursor: pointer;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
a:hover,
|
|
51
|
-
.linked:hover {
|
|
52
|
-
text-decoration: underline;
|
|
53
|
-
color: var(--color-link-primary-hover);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.type {
|
|
57
|
-
background: rgba(0, 0, 0, 0.02);
|
|
58
|
-
padding: 1em;
|
|
59
|
-
display: flex;
|
|
60
|
-
align-self: stretch;
|
|
61
|
-
--icon-color: rgba(50, 50, 50, 0.25);
|
|
62
|
-
border-top-left-radius: var(--curvature);
|
|
63
|
-
border-bottom-left-radius: var(--curvature);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.details {
|
|
67
|
-
display: flex;
|
|
68
|
-
flex-direction: column;
|
|
69
|
-
padding: 0.5em 1em;
|
|
70
|
-
flex-grow: 1;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.campaign {
|
|
74
|
-
display: flex;
|
|
75
|
-
color: var(--text-color);
|
|
76
|
-
--icon-color: var(--text-color);
|
|
77
|
-
align-self: center;
|
|
78
|
-
white-space: nowrap;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.message {
|
|
82
|
-
display: -webkit-box;
|
|
83
|
-
-webkit-line-clamp: 2;
|
|
84
|
-
-webkit-box-orient: vertical;
|
|
85
|
-
overflow: hidden;
|
|
86
|
-
padding: 0.1em;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.event {
|
|
90
|
-
margin-bottom: 0.5em;
|
|
91
|
-
border-radius: var(--curvature);
|
|
92
|
-
display: flex;
|
|
93
|
-
flex-direction: row;
|
|
94
|
-
align-items: center;
|
|
95
|
-
background: var(--surface);
|
|
96
|
-
box-shadow:
|
|
97
|
-
0 0 8px 1px rgba(0, 0, 0, 0.055),
|
|
98
|
-
0 0 0px 1px rgba(0, 0, 0, 0.02);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.event:hover {
|
|
102
|
-
cursor: pointer;
|
|
103
|
-
box-shadow:
|
|
104
|
-
0 0 8px 1px rgba(0, 0, 0, 0.055),
|
|
105
|
-
0 0 0px 2px var(--color-link-primary);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.time {
|
|
109
|
-
white-space: nowrap;
|
|
110
|
-
background: rgba(0, 0, 0, 0.02);
|
|
111
|
-
border-top-right-radius: var(--curvature);
|
|
112
|
-
border-bottom-right-radius: var(--curvature);
|
|
113
|
-
display: flex;
|
|
114
|
-
align-self: stretch;
|
|
115
|
-
padding: 0 1em;
|
|
116
|
-
min-width: 5em;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.duration {
|
|
120
|
-
align-self: center;
|
|
121
|
-
flex-grow: 1;
|
|
122
|
-
text-align: center;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.flow {
|
|
126
|
-
display: inline-block;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
temba-tip {
|
|
130
|
-
cursor: default;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.scheduled-by {
|
|
134
|
-
font-size: 0.85em;
|
|
135
|
-
display: flex;
|
|
136
|
-
color: var(--text-color);
|
|
137
|
-
--icon-color: var(--text-color);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
.scheduled-by temba-icon {
|
|
141
|
-
margin-right: 0.25em;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
.scheduled-by .name {
|
|
145
|
-
flex-grow: 1;
|
|
146
|
-
}
|
|
147
|
-
`;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
constructor() {
|
|
151
|
-
super();
|
|
152
|
-
this.handleEventClicked = this.handleEventClicked.bind(this);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
protected updated(
|
|
156
|
-
changes: PropertyValueMap<any> | Map<PropertyKey, unknown>
|
|
157
|
-
): void {
|
|
158
|
-
super.updated(changes);
|
|
159
|
-
if (changes.has('contact')) {
|
|
160
|
-
if (this.contact) {
|
|
161
|
-
this.url = `/contact/scheduled/${this.contact}/`;
|
|
162
|
-
} else {
|
|
163
|
-
this.url = null;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if (changes.has('data')) {
|
|
168
|
-
this.fireCustomEvent(CustomEventType.DetailsChanged, {
|
|
169
|
-
count: this.data.length
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
public handleEventClicked(event: ScheduledEvent) {
|
|
175
|
-
this.fireCustomEvent(CustomEventType.Selection, event);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
public renderEvent(scheduledEvent: ScheduledEvent) {
|
|
179
|
-
return html`
|
|
180
|
-
<div
|
|
181
|
-
class="event ${scheduledEvent.type}"
|
|
182
|
-
@click="${() => this.handleEventClicked(scheduledEvent)}"
|
|
183
|
-
>
|
|
184
|
-
<div class="type">
|
|
185
|
-
<temba-icon
|
|
186
|
-
size="2"
|
|
187
|
-
name="${scheduledEvent.message ? Icon.message : Icon.flow}"
|
|
188
|
-
></temba-icon>
|
|
189
|
-
</div>
|
|
190
|
-
|
|
191
|
-
<div class="details">
|
|
192
|
-
<div>
|
|
193
|
-
${scheduledEvent.flow
|
|
194
|
-
? html` Start ${scheduledEvent.flow.name}`
|
|
195
|
-
: null}
|
|
196
|
-
${scheduledEvent.message
|
|
197
|
-
? html` <div class="message">${scheduledEvent.message}</div> `
|
|
198
|
-
: null}
|
|
199
|
-
</div>
|
|
200
|
-
|
|
201
|
-
<div class="scheduled-by">
|
|
202
|
-
${scheduledEvent.campaign
|
|
203
|
-
? html`<div style="display:flex">
|
|
204
|
-
<temba-icon name="${Icon.campaign}"></temba-icon>
|
|
205
|
-
<div class="name">${scheduledEvent.campaign.name}</div>
|
|
206
|
-
</div>`
|
|
207
|
-
: html`
|
|
208
|
-
${scheduledEvent.type === ScheduledEventType.ScheduledTrigger
|
|
209
|
-
? html`<temba-icon
|
|
210
|
-
name="${ICONS[scheduledEvent.type]}"
|
|
211
|
-
></temba-icon>`
|
|
212
|
-
: null}
|
|
213
|
-
<div class="name">
|
|
214
|
-
${this.REPEAT_PERIOD[scheduledEvent.repeat_period]}
|
|
215
|
-
</div>
|
|
216
|
-
`}
|
|
217
|
-
</div>
|
|
218
|
-
</div>
|
|
219
|
-
|
|
220
|
-
<div class="time">
|
|
221
|
-
<div class="duration">
|
|
222
|
-
<temba-tip
|
|
223
|
-
text=${this.store.formatDate(scheduledEvent.scheduled)}
|
|
224
|
-
position="left"
|
|
225
|
-
>
|
|
226
|
-
${this.store.getShortDurationFromIso(scheduledEvent.scheduled)}
|
|
227
|
-
</temba-tip>
|
|
228
|
-
</div>
|
|
229
|
-
</div>
|
|
230
|
-
</div>
|
|
231
|
-
`;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
public render(): TemplateResult {
|
|
235
|
-
if (this.data) {
|
|
236
|
-
if (this.data.length > 0) {
|
|
237
|
-
return html`
|
|
238
|
-
${this.data.map((event) => {
|
|
239
|
-
return this.renderEvent(event);
|
|
240
|
-
})}
|
|
241
|
-
`;
|
|
242
|
-
} else {
|
|
243
|
-
return html`<slot name="empty"></slot>`;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|