@nyaruka/temba-components 0.75.1 → 0.75.3
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 +7 -0
- package/demo/index.html +1 -1
- package/dist/{b1ce10ca.js → 42372647.js} +51 -31
- package/dist/index.js +51 -31
- package/dist/static/svg/index.svg +1 -1
- package/dist/sw.js +1 -1
- package/dist/sw.js.map +1 -1
- package/dist/templates/components-body.html +1 -1
- package/dist/templates/components-head.html +1 -1
- package/out-tsc/src/compose/Compose.js +0 -1
- package/out-tsc/src/compose/Compose.js.map +1 -1
- package/out-tsc/src/dialog/Dialog.js +20 -2
- package/out-tsc/src/dialog/Dialog.js.map +1 -1
- package/out-tsc/src/dropdown/Dropdown.js +46 -42
- package/out-tsc/src/dropdown/Dropdown.js.map +1 -1
- package/out-tsc/src/lightbox/Lightbox.js +2 -3
- package/out-tsc/src/lightbox/Lightbox.js.map +1 -1
- package/out-tsc/src/list/TembaList.js +8 -1
- package/out-tsc/src/list/TembaList.js.map +1 -1
- package/out-tsc/src/list/TembaMenu.js +5 -2
- package/out-tsc/src/list/TembaMenu.js.map +1 -1
- package/out-tsc/src/vectoricon/index.js +2 -2
- package/out-tsc/src/vectoricon/index.js.map +1 -1
- package/package.json +1 -1
- package/src/compose/Compose.ts +0 -1
- package/src/dialog/Dialog.ts +20 -6
- package/src/dropdown/Dropdown.ts +41 -30
- package/src/lightbox/Lightbox.ts +2 -3
- package/src/list/TembaList.ts +7 -1
- package/src/list/TembaMenu.ts +5 -2
- package/src/vectoricon/index.ts +2 -2
- package/static/svg/index.svg +1 -1
- package/static/svg/work/traced/volume-min.svg +1 -0
- package/static/svg/work/used/volume-min.svg +3 -0
package/src/dialog/Dialog.ts
CHANGED
|
@@ -53,6 +53,19 @@ export class Dialog extends ResizeElement {
|
|
|
53
53
|
height: 100vh;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
.mobile .flex {
|
|
57
|
+
height: 100%;
|
|
58
|
+
position: fixed;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.mobile .grow-top {
|
|
62
|
+
flex-grow: 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.mobile .grow-bottom {
|
|
66
|
+
flex-grow: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
56
69
|
.grow-top {
|
|
57
70
|
flex-grow: 1;
|
|
58
71
|
}
|
|
@@ -77,6 +90,10 @@ export class Dialog extends ResizeElement {
|
|
|
77
90
|
pointer-events: none;
|
|
78
91
|
}
|
|
79
92
|
|
|
93
|
+
.mobile.dialog-mask .dialog-container {
|
|
94
|
+
border-radius: 0px;
|
|
95
|
+
}
|
|
96
|
+
|
|
80
97
|
.dialog-mask .dialog-container {
|
|
81
98
|
position: relative;
|
|
82
99
|
transition: transform var(--transition-speed) var(--bounce),
|
|
@@ -425,6 +442,7 @@ export class Dialog extends ResizeElement {
|
|
|
425
442
|
'dialog-loading': this.loading,
|
|
426
443
|
'dialog-animation-end': this.animationEnd,
|
|
427
444
|
'dialog-ready': this.ready,
|
|
445
|
+
mobile: this.isMobile(),
|
|
428
446
|
})}"
|
|
429
447
|
>
|
|
430
448
|
<div style="position: absolute; width: 100%;">
|
|
@@ -446,9 +464,7 @@ export class Dialog extends ResizeElement {
|
|
|
446
464
|
class="dialog-container"
|
|
447
465
|
>
|
|
448
466
|
${header}
|
|
449
|
-
<div class="dialog-body" @keypress=${this.handleKeyUp}
|
|
450
|
-
this.isMobile() ? 'flex-grow:1;max-height:""' : ''
|
|
451
|
-
} >
|
|
467
|
+
<div class="dialog-body" @keypress=${this.handleKeyUp}>
|
|
452
468
|
${this.body ? this.body : html`<slot></slot>`}
|
|
453
469
|
<temba-loading units="6" size="8"></temba-loading>
|
|
454
470
|
</div>
|
|
@@ -473,9 +489,7 @@ export class Dialog extends ResizeElement {
|
|
|
473
489
|
)}
|
|
474
490
|
</div>
|
|
475
491
|
</div>
|
|
476
|
-
<div class="grow-bottom"
|
|
477
|
-
this.isMobile() ? 'flex-grow:0' : ''
|
|
478
|
-
}"></div>
|
|
492
|
+
<div class="grow-bottom"></div>
|
|
479
493
|
</div>
|
|
480
494
|
</div>
|
|
481
495
|
</div>
|
package/src/dropdown/Dropdown.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { css, html, TemplateResult } from 'lit';
|
|
|
2
2
|
import { property } from 'lit/decorators.js';
|
|
3
3
|
import { RapidElement } from '../RapidElement';
|
|
4
4
|
import { getClasses } from '../utils';
|
|
5
|
+
import { ContactStoreElement } from '../contacts/ContactStoreElement';
|
|
5
6
|
|
|
6
7
|
export class Dropdown extends RapidElement {
|
|
7
8
|
static get styles() {
|
|
@@ -111,6 +112,11 @@ export class Dropdown extends RapidElement {
|
|
|
111
112
|
@property({ type: Boolean })
|
|
112
113
|
mask = false;
|
|
113
114
|
|
|
115
|
+
constructor() {
|
|
116
|
+
super();
|
|
117
|
+
this.ensureOnScreen = this.ensureOnScreen.bind(this);
|
|
118
|
+
}
|
|
119
|
+
|
|
114
120
|
public firstUpdated(props: any) {
|
|
115
121
|
super.firstUpdated(props);
|
|
116
122
|
|
|
@@ -161,44 +167,49 @@ export class Dropdown extends RapidElement {
|
|
|
161
167
|
}
|
|
162
168
|
|
|
163
169
|
if (changedProperties.has('open')) {
|
|
164
|
-
|
|
170
|
+
// check right away if we are on the screen, and then again moments after render
|
|
171
|
+
window.setTimeout(this.ensureOnScreen, 0);
|
|
172
|
+
window.setTimeout(this.ensureOnScreen, 100);
|
|
165
173
|
}
|
|
166
174
|
}
|
|
167
175
|
|
|
168
176
|
public ensureOnScreen() {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
) as HTMLDivElement;
|
|
177
|
+
const dropdown = this.shadowRoot.querySelector(
|
|
178
|
+
'.dropdown'
|
|
179
|
+
) as HTMLDivElement;
|
|
173
180
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
if (dropdown.getBoundingClientRect().bottom > window.innerHeight) {
|
|
178
|
-
if (this.bottom) {
|
|
179
|
-
dropdown.style.top = toggle.clientHeight + 'px';
|
|
180
|
-
} else {
|
|
181
|
-
dropdown.style.top = '';
|
|
182
|
-
dropdown.style.bottom = toggle.clientHeight + 'px';
|
|
183
|
-
}
|
|
184
|
-
} else if (dropdown.getBoundingClientRect().top < 0) {
|
|
185
|
-
if (this.bottom) {
|
|
186
|
-
dropdown.style.top = toggle.clientHeight + 'px';
|
|
187
|
-
} else {
|
|
188
|
-
dropdown.style.top = toggle.clientHeight + 'px';
|
|
189
|
-
dropdown.style.bottom = '';
|
|
190
|
-
}
|
|
191
|
-
}
|
|
181
|
+
if (dropdown) {
|
|
182
|
+
// dropdown will go off the screen, let's push it up
|
|
183
|
+
const toggle = this.querySelector('div[slot="toggle"]');
|
|
192
184
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
185
|
+
if (!toggle) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (dropdown.getBoundingClientRect().bottom > window.innerHeight - 100) {
|
|
190
|
+
if (this.bottom) {
|
|
191
|
+
dropdown.style.top = toggle.clientHeight + 'px';
|
|
192
|
+
} else {
|
|
193
|
+
dropdown.style.top = '';
|
|
194
|
+
dropdown.style.bottom = toggle.clientHeight + 'px';
|
|
195
|
+
}
|
|
196
|
+
} else if (dropdown.getBoundingClientRect().top < 0) {
|
|
197
|
+
if (this.bottom) {
|
|
198
|
+
dropdown.style.top = toggle.clientHeight + 'px';
|
|
199
|
+
} else {
|
|
200
|
+
dropdown.style.top = toggle.clientHeight + 'px';
|
|
201
|
+
dropdown.style.bottom = '';
|
|
199
202
|
}
|
|
200
203
|
}
|
|
201
|
-
|
|
204
|
+
|
|
205
|
+
if (dropdown.getBoundingClientRect().right > window.innerWidth) {
|
|
206
|
+
dropdown.style.left = '';
|
|
207
|
+
dropdown.style.right = '0px';
|
|
208
|
+
} else if (dropdown.getBoundingClientRect().left < 0) {
|
|
209
|
+
dropdown.style.left = 0 + 'px';
|
|
210
|
+
dropdown.style.right = '';
|
|
211
|
+
}
|
|
212
|
+
}
|
|
202
213
|
}
|
|
203
214
|
|
|
204
215
|
public handleToggleClicked(event: MouseEvent): void {
|
package/src/lightbox/Lightbox.ts
CHANGED
|
@@ -21,8 +21,8 @@ export class Lightbox extends RapidElement {
|
|
|
21
21
|
opacity: 0;
|
|
22
22
|
background: rgba(0, 0, 0, 0.5);
|
|
23
23
|
position: absolute;
|
|
24
|
-
height:
|
|
25
|
-
width:
|
|
24
|
+
height: 100svh;
|
|
25
|
+
width: 100svw;
|
|
26
26
|
pointer-events: none;
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -80,7 +80,6 @@ export class Lightbox extends RapidElement {
|
|
|
80
80
|
|
|
81
81
|
public showElement(ele: HTMLElement) {
|
|
82
82
|
// size our matte according to the ele's boundaries
|
|
83
|
-
console.log(ele);
|
|
84
83
|
const bounds = ele.getBoundingClientRect();
|
|
85
84
|
this.ele = ele.cloneNode() as HTMLElement;
|
|
86
85
|
this.left = bounds.left;
|
package/src/list/TembaList.ts
CHANGED
|
@@ -403,7 +403,7 @@ export class TembaList extends RapidElement {
|
|
|
403
403
|
this.setSelection(this.nextSelection);
|
|
404
404
|
this.nextSelection = false;
|
|
405
405
|
} else {
|
|
406
|
-
if (this.cursorIndex === -1) {
|
|
406
|
+
if (this.cursorIndex === -1 && !this.isMobile()) {
|
|
407
407
|
this.cursorIndex = 0;
|
|
408
408
|
}
|
|
409
409
|
}
|
|
@@ -414,6 +414,12 @@ export class TembaList extends RapidElement {
|
|
|
414
414
|
if (this.value) {
|
|
415
415
|
this.setSelection(this.value);
|
|
416
416
|
this.value = null;
|
|
417
|
+
} else if (this.isMobile() && !this.selected) {
|
|
418
|
+
this.cursorIndex = -1;
|
|
419
|
+
this.value = null;
|
|
420
|
+
this.selected = null;
|
|
421
|
+
const evt = new Event('change', { bubbles: true });
|
|
422
|
+
this.dispatchEvent(evt);
|
|
417
423
|
}
|
|
418
424
|
|
|
419
425
|
return Promise.resolve();
|
package/src/list/TembaMenu.ts
CHANGED
|
@@ -348,13 +348,17 @@ export class TembaMenu extends ResizeElement {
|
|
|
348
348
|
}
|
|
349
349
|
|
|
350
350
|
.mobile.root {
|
|
351
|
-
height:
|
|
351
|
+
height: 100svh;
|
|
352
352
|
}
|
|
353
353
|
|
|
354
354
|
.mobile.root.fully-collapsed {
|
|
355
355
|
height: initial;
|
|
356
356
|
}
|
|
357
357
|
|
|
358
|
+
.root.fully-collapsed.mobile .level.level-0 {
|
|
359
|
+
padding-right: 0.5em;
|
|
360
|
+
}
|
|
361
|
+
|
|
358
362
|
.root.fully-collapsed.mobile .level.level-0 {
|
|
359
363
|
flex-direction: row;
|
|
360
364
|
}
|
|
@@ -1159,7 +1163,6 @@ export class TembaMenu extends ResizeElement {
|
|
|
1159
1163
|
arrowoffset="8"
|
|
1160
1164
|
arrowSize="0"
|
|
1161
1165
|
drop_align="left"
|
|
1162
|
-
mask
|
|
1163
1166
|
id="dd-${menuItem.id}"
|
|
1164
1167
|
>
|
|
1165
1168
|
<div slot="toggle">${item}</div>
|
package/src/vectoricon/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// for cache busting we dynamically generate a fingerprint, use yarn svg to update
|
|
2
|
-
export const SVG_FINGERPRINT = '
|
|
2
|
+
export const SVG_FINGERPRINT = '96c407ade55885693432afd343de1cc0';
|
|
3
3
|
|
|
4
4
|
// only icons below are included in the sprite sheet
|
|
5
5
|
export enum Icon {
|
|
@@ -16,7 +16,7 @@ export enum Icon {
|
|
|
16
16
|
arrow_left = 'chevron-left',
|
|
17
17
|
arrow_right = 'chevron-right',
|
|
18
18
|
attachment = 'paperclip',
|
|
19
|
-
attachment_audio = 'volume
|
|
19
|
+
attachment_audio = 'volume-min',
|
|
20
20
|
attachment_document = 'file-06',
|
|
21
21
|
attachment_image = 'image-01',
|
|
22
22
|
attachment_location = 'marker-pin-01',
|