@nyaruka/temba-components 0.46.0 → 0.47.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 +6 -0
- package/dist/{041a136a.js → df04e47b.js} +68 -35
- package/dist/index.js +68 -35
- 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/contacts/ContactFieldEditor.js +34 -8
- package/out-tsc/src/contacts/ContactFieldEditor.js.map +1 -1
- package/out-tsc/src/contacts/ContactFields.js +34 -21
- package/out-tsc/src/contacts/ContactFields.js.map +1 -1
- package/out-tsc/src/datepicker/DatePicker.js +15 -4
- package/out-tsc/src/datepicker/DatePicker.js.map +1 -1
- package/out-tsc/src/formfield/FormField.js +1 -1
- package/out-tsc/src/formfield/FormField.js.map +1 -1
- package/out-tsc/src/list/TembaList.js +1 -1
- package/out-tsc/src/list/TembaList.js.map +1 -1
- package/package.json +1 -1
- package/screenshots/truth/contacts/fields-updated.png +0 -0
- package/screenshots/truth/contacts/fields.png +0 -0
- package/screenshots/truth/datepicker/datetime.png +0 -0
- package/screenshots/truth/datepicker/initial-timezone.png +0 -0
- package/screenshots/truth/datepicker/initial-value.png +0 -0
- package/screenshots/truth/datepicker/updated-keyboard.png +0 -0
- package/src/contacts/ContactFieldEditor.ts +33 -8
- package/src/contacts/ContactFields.ts +31 -22
- package/src/datepicker/DatePicker.ts +15 -4
- package/src/formfield/FormField.ts +1 -1
- package/src/list/TembaList.ts +1 -1
- package/static/css/temba-components.css +2 -1
|
@@ -5,6 +5,7 @@ import { CustomEventType } from '../interfaces';
|
|
|
5
5
|
import { RapidElement } from '../RapidElement';
|
|
6
6
|
import { TextInput } from '../textinput/TextInput';
|
|
7
7
|
import { Icon } from '../vectoricon';
|
|
8
|
+
import { getClasses } from '../utils';
|
|
8
9
|
|
|
9
10
|
export class ContactFieldEditor extends RapidElement {
|
|
10
11
|
@property({ type: String })
|
|
@@ -28,37 +29,43 @@ export class ContactFieldEditor extends RapidElement {
|
|
|
28
29
|
@property({ type: String })
|
|
29
30
|
iconClass = '';
|
|
30
31
|
|
|
32
|
+
@property({ type: Boolean })
|
|
33
|
+
disabled = false;
|
|
34
|
+
|
|
31
35
|
static get styles() {
|
|
32
36
|
return css`
|
|
33
37
|
.wrapper {
|
|
34
38
|
--widget-box-shadow: none;
|
|
39
|
+
--temba-textinput-padding: 1.4em 0.8em 0.4em 0.8em;
|
|
40
|
+
--disabled-opacity: 1;
|
|
41
|
+
position: relative;
|
|
35
42
|
}
|
|
36
43
|
|
|
37
44
|
.prefix {
|
|
38
|
-
background: rgba(0, 0, 0, 0.05);
|
|
39
45
|
border-top-left-radius: var(--curvature-widget);
|
|
40
46
|
border-bottom-left-radius: var(--curvature-widget);
|
|
41
47
|
color: #888;
|
|
42
48
|
cursor: pointer;
|
|
43
|
-
width: 200px;
|
|
44
49
|
white-space: nowrap;
|
|
45
50
|
overflow: hidden;
|
|
46
51
|
text-overflow: ellipsis;
|
|
47
52
|
display: flex;
|
|
48
53
|
padding: 0em 0.5em;
|
|
54
|
+
position: absolute;
|
|
55
|
+
margin-top: 0.2em;
|
|
49
56
|
}
|
|
50
57
|
|
|
51
58
|
.wrapper {
|
|
52
|
-
margin-bottom:
|
|
59
|
+
margin-bottom: 0.5em;
|
|
53
60
|
}
|
|
54
61
|
|
|
55
62
|
.prefix .name {
|
|
56
|
-
padding: 0.
|
|
57
|
-
color: #
|
|
58
|
-
width: 200px;
|
|
63
|
+
padding: 0em 0.4em;
|
|
64
|
+
color: #999;
|
|
59
65
|
white-space: nowrap;
|
|
60
66
|
overflow: hidden;
|
|
61
67
|
text-overflow: ellipsis;
|
|
68
|
+
font-size: 0.8em;
|
|
62
69
|
}
|
|
63
70
|
|
|
64
71
|
.postfix {
|
|
@@ -104,6 +111,16 @@ export class ContactFieldEditor extends RapidElement {
|
|
|
104
111
|
transform: scale(1);
|
|
105
112
|
}
|
|
106
113
|
|
|
114
|
+
.disabled temba-textinput .postfix {
|
|
115
|
+
display: none;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.disabled {
|
|
119
|
+
--color-widget-border: transparent;
|
|
120
|
+
padding-bottom: 0.4em;
|
|
121
|
+
border-bottom: 1px solid #e6e6e6;
|
|
122
|
+
}
|
|
123
|
+
|
|
107
124
|
.unset temba-textinput:focus .popper,
|
|
108
125
|
.unset temba-textinput:hover .popper {
|
|
109
126
|
opacity: 0;
|
|
@@ -122,7 +139,6 @@ export class ContactFieldEditor extends RapidElement {
|
|
|
122
139
|
}
|
|
123
140
|
|
|
124
141
|
temba-datepicker {
|
|
125
|
-
--curvature: 0px;
|
|
126
142
|
position: relative;
|
|
127
143
|
}
|
|
128
144
|
`;
|
|
@@ -186,13 +202,21 @@ export class ContactFieldEditor extends RapidElement {
|
|
|
186
202
|
|
|
187
203
|
public render(): TemplateResult {
|
|
188
204
|
return html`
|
|
189
|
-
<div
|
|
205
|
+
<div
|
|
206
|
+
class=${getClasses({
|
|
207
|
+
wrapper: true,
|
|
208
|
+
set: !!this.value,
|
|
209
|
+
unset: !this.value,
|
|
210
|
+
disabled: this.disabled,
|
|
211
|
+
})}
|
|
212
|
+
>
|
|
190
213
|
${this.type === 'datetime'
|
|
191
214
|
? html`
|
|
192
215
|
<temba-datepicker
|
|
193
216
|
timezone=${this.timezone}
|
|
194
217
|
value="${this.value ? this.value : ''}"
|
|
195
218
|
@change=${this.handleSubmit}
|
|
219
|
+
?disabled=${this.disabled}
|
|
196
220
|
time
|
|
197
221
|
>
|
|
198
222
|
<div class="prefix" slot="prefix">
|
|
@@ -206,6 +230,7 @@ export class ContactFieldEditor extends RapidElement {
|
|
|
206
230
|
@blur=${this.handleSubmit}
|
|
207
231
|
@keydown=${this.handleInput}
|
|
208
232
|
@change=${this.handleChange}
|
|
233
|
+
?disabled=${this.disabled}
|
|
209
234
|
>
|
|
210
235
|
<div class="prefix" slot="prefix">
|
|
211
236
|
<div class="name">${this.name}</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css, html, PropertyValueMap, TemplateResult } from 'lit';
|
|
2
2
|
import { property } from 'lit/decorators.js';
|
|
3
|
-
import { postJSON } from '../utils';
|
|
3
|
+
import { getClasses, postJSON } from '../utils';
|
|
4
4
|
import { ContactFieldEditor } from './ContactFieldEditor';
|
|
5
5
|
import { ContactStoreElement } from './ContactStoreElement';
|
|
6
6
|
import { Checkbox } from '../checkbox/Checkbox';
|
|
@@ -11,11 +11,9 @@ export class ContactFields extends ContactStoreElement {
|
|
|
11
11
|
static get styles() {
|
|
12
12
|
return css`
|
|
13
13
|
:host {
|
|
14
|
-
--curvature-widget: 0px;
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
.fields {
|
|
18
|
-
box-shadow: var(--widget-box-shadow);
|
|
19
17
|
}
|
|
20
18
|
|
|
21
19
|
.field {
|
|
@@ -66,12 +64,15 @@ export class ContactFields extends ContactStoreElement {
|
|
|
66
64
|
temba-contact-field {
|
|
67
65
|
}
|
|
68
66
|
|
|
69
|
-
.
|
|
70
|
-
margin-bottom: 0;
|
|
67
|
+
.toggle {
|
|
71
68
|
display: flex;
|
|
72
69
|
background: #fff;
|
|
73
70
|
align-items: center;
|
|
74
|
-
margin-
|
|
71
|
+
margin-bottom: 0.5em;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.disabled .toggle {
|
|
75
|
+
display: none;
|
|
75
76
|
}
|
|
76
77
|
`;
|
|
77
78
|
}
|
|
@@ -91,6 +92,9 @@ export class ContactFields extends ContactStoreElement {
|
|
|
91
92
|
@property({ type: String })
|
|
92
93
|
timezone: string;
|
|
93
94
|
|
|
95
|
+
@property({ type: Boolean })
|
|
96
|
+
disabled = false;
|
|
97
|
+
|
|
94
98
|
connectedCallback(): void {
|
|
95
99
|
super.connectedCallback();
|
|
96
100
|
this.handleFieldChanged = this.handleFieldChanged.bind(this);
|
|
@@ -160,27 +164,32 @@ export class ContactFields extends ContactStoreElement {
|
|
|
160
164
|
type=${field.value_type}
|
|
161
165
|
@change=${this.handleFieldChanged}
|
|
162
166
|
timezone=${this.timezone}
|
|
167
|
+
?disabled=${this.disabled}
|
|
163
168
|
></temba-contact-field>`;
|
|
164
169
|
});
|
|
165
170
|
|
|
166
171
|
return html`
|
|
167
|
-
<div class
|
|
168
|
-
${
|
|
172
|
+
<div class=${getClasses({ disabled: this.disabled })}>
|
|
173
|
+
${!this.featured &&
|
|
174
|
+
Object.keys(this.data.fields).length >= MIN_FOR_FILTER
|
|
175
|
+
? html`<div class="toggle">
|
|
176
|
+
<div style="flex-grow: 1"></div>
|
|
177
|
+
<div>
|
|
178
|
+
<temba-checkbox
|
|
179
|
+
?checked=${this.showAll}
|
|
180
|
+
@change=${this.handleToggle}
|
|
181
|
+
label="Show All"
|
|
182
|
+
/>
|
|
183
|
+
</div>
|
|
184
|
+
</div>`
|
|
185
|
+
: null}
|
|
186
|
+
|
|
187
|
+
<div
|
|
188
|
+
class="fields ${this.showAll || this.featured ? 'show-all' : ''}"
|
|
189
|
+
>
|
|
190
|
+
${fields}
|
|
191
|
+
</div>
|
|
169
192
|
</div>
|
|
170
|
-
|
|
171
|
-
${!this.featured &&
|
|
172
|
-
Object.keys(this.data.fields).length >= MIN_FOR_FILTER
|
|
173
|
-
? html`<div class="footer">
|
|
174
|
-
<div style="flex-grow: 1"></div>
|
|
175
|
-
<div>
|
|
176
|
-
<temba-checkbox
|
|
177
|
-
?checked=${this.showAll}
|
|
178
|
-
@change=${this.handleToggle}
|
|
179
|
-
label="Show All"
|
|
180
|
-
/>
|
|
181
|
-
</div>
|
|
182
|
-
</div>`
|
|
183
|
-
: null}
|
|
184
193
|
`;
|
|
185
194
|
}
|
|
186
195
|
|
|
@@ -17,11 +17,13 @@ export default class DatePicker extends FormElement {
|
|
|
17
17
|
display: flex;
|
|
18
18
|
cursor: pointer;
|
|
19
19
|
box-shadow: var(--widget-box-shadow);
|
|
20
|
+
flex-wrap: wrap;
|
|
21
|
+
overflow: hidden;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
.input-wrapper {
|
|
23
25
|
padding: var(--temba-textinput-padding);
|
|
24
|
-
flex-grow:
|
|
26
|
+
flex-grow: 20;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
.tz {
|
|
@@ -36,7 +38,7 @@ export default class DatePicker extends FormElement {
|
|
|
36
38
|
padding: 0em 1em;
|
|
37
39
|
font-weight: 400;
|
|
38
40
|
cursor: pointer;
|
|
39
|
-
margin: auto;
|
|
41
|
+
margin: auto 0;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
.tz .label {
|
|
@@ -53,11 +55,11 @@ export default class DatePicker extends FormElement {
|
|
|
53
55
|
|
|
54
56
|
.tz-wrapper {
|
|
55
57
|
background: #efefef;
|
|
56
|
-
border-top-right-radius: var(--curvature);
|
|
57
|
-
border-bottom-right-radius: var(--curvature);
|
|
58
58
|
display: flex;
|
|
59
59
|
flex-direction: row;
|
|
60
60
|
align-items: center;
|
|
61
|
+
flex-grow: 1;
|
|
62
|
+
padding: 0.4em 0em;
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
.container:focus-within {
|
|
@@ -91,6 +93,14 @@ export default class DatePicker extends FormElement {
|
|
|
91
93
|
outline: none;
|
|
92
94
|
}
|
|
93
95
|
|
|
96
|
+
.disabled ::-webkit-calendar-picker-indicator {
|
|
97
|
+
display: none;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.disabled .tz-wrapper {
|
|
101
|
+
border-radius: var(--curvature);
|
|
102
|
+
}
|
|
103
|
+
|
|
94
104
|
::-webkit-calendar-picker-indicator {
|
|
95
105
|
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="15" viewBox="0 0 24 24"><path fill="%23bbbbbb" d="M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 18H4V8h16v13z"/></svg>');
|
|
96
106
|
cursor: pointer;
|
|
@@ -202,6 +212,7 @@ export default class DatePicker extends FormElement {
|
|
|
202
212
|
|
|
203
213
|
return html`
|
|
204
214
|
<temba-field
|
|
215
|
+
class=${getClasses({ disabled: this.disabled })}
|
|
205
216
|
name=${this.name}
|
|
206
217
|
.label="${this.label}"
|
|
207
218
|
.helpText="${this.helpText}"
|
package/src/list/TembaList.ts
CHANGED
|
@@ -138,7 +138,7 @@ export class TembaList extends RapidElement {
|
|
|
138
138
|
this.refreshTop();
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
if (changedProperties.has('mostRecentItem')) {
|
|
141
|
+
if (changedProperties.has('mostRecentItem') && this.mostRecentItem) {
|
|
142
142
|
this.fireCustomEvent(CustomEventType.Refreshed);
|
|
143
143
|
}
|
|
144
144
|
|