@nyaruka/temba-components 0.27.2 → 0.28.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 CHANGED
@@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [v0.28.0](https://github.com/nyaruka/temba-components/compare/v0.27.2...v0.28.0)
8
+
9
+ > 6 July 2022
10
+
11
+ - Add collapsible tab names [`#178`](https://github.com/nyaruka/temba-components/pull/178)
12
+ - Make contact tickets a list [`#179`](https://github.com/nyaruka/temba-components/pull/179)
13
+ - Update demo index, add slider test placeholder [`023606d`](https://github.com/nyaruka/temba-components/commit/023606d053f35c23919f868e7b53279f5af56b96)
14
+ - Update README.md [`66285a3`](https://github.com/nyaruka/temba-components/commit/66285a3f0cf2620add4261acf3a8e85480f24647)
15
+
7
16
  #### [v0.27.2](https://github.com/nyaruka/temba-components/compare/v0.27.1...v0.27.2)
8
17
 
9
18
  > 2 July 2022
package/README.md CHANGED
@@ -33,7 +33,8 @@ To view the interactive demo, use start.
33
33
  ## Testing
34
34
 
35
35
  All tests live under [/test](test). When running tests, some tests capture screenshots for pixel
36
- comparision under [/screenshots](screenshots/truth).
36
+ comparision under [/screenshots](screenshots/truth). Running tests requires that you have Chromium
37
+ installed.
37
38
 
38
39
  ```bash
39
40
  % yarn test
package/demo/index.html CHANGED
@@ -26,7 +26,6 @@
26
26
  padding: 10px;
27
27
  max-width: 500px;
28
28
  --temba-select-selected-font-size: 1em;
29
- display:none;
30
29
  }
31
30
 
32
31
  temba-dropdown.open {
@@ -43,6 +42,13 @@
43
42
  background: rgba(0,0,0,.3);
44
43
  }
45
44
 
45
+ body {
46
+ background: #f3f3f3;
47
+ }
48
+ temba-tabs {
49
+ margin: 2em;
50
+ }
51
+
46
52
  temba-tabs *, temba-tab * {
47
53
  opacity: 0;
48
54
  }
@@ -51,6 +57,42 @@
51
57
  opacity: 1;
52
58
  }
53
59
 
60
+ temba-tab {
61
+ padding: 1em;
62
+ }
63
+
64
+ .dropdown {
65
+ padding: 2em;
66
+ }
67
+
68
+ .dropdown .title {
69
+ font-weight: 400;
70
+ margin-bottom: 0.5em;
71
+ }
72
+
73
+ .dropdown .item {
74
+ padding: 0.5em;
75
+ }
76
+
77
+ .header {
78
+ margin-bottom:1em;
79
+ font-size: 2em;
80
+ font-weight: 400;
81
+ color: #777;
82
+ display: inline;
83
+ }
84
+
85
+ temba-dropdown {
86
+ position: relative;
87
+ display:inline-block;
88
+ margin:0em 0.5em;
89
+ }
90
+
91
+ temba-slider{
92
+ margin-top: 1em;
93
+ }
94
+
95
+
54
96
  </style>
55
97
  <script type="module">
56
98
  import '../out-tsc/temba-modules.js';
@@ -83,141 +125,148 @@
83
125
  groups="/static/api/groups.json"
84
126
  ></temba-store>
85
127
 
86
- <temba-tabs>
128
+ <temba-dropdown>
129
+ <div style="display:inline-block; margin-bottom:1em;" slot="toggle">
130
+ <temba-icon name="menu" size="1.3" clickable></temba-icon>
131
+ </div>
132
+ <div slot="dropdown" class="dropdown" style="width:250px; padding:0.5em 1em;">
133
+ <div class="item">
134
+ <div class="title">Check this out!</div>
135
+ <div class="details">temba-menu lets you do little popup menus like this.</div>
136
+ </div>
137
+ </div>
138
+ </temba-dropdown>
87
139
 
88
- <temba-tab name="Chats" icon="message-square">
89
- <div onclick="storeTest();">Click me!</div>
90
- </temba-tab>
140
+ <div class="header">temba-components</div>
91
141
 
92
- <temba-tab name="Details" icon="list">
93
- Details content
94
- </temba-tab>
142
+ <temba-tabs>
143
+ <temba-tab name="temba-slider" icon="sliders">
95
144
 
96
- <temba-tab name="Log" icon="log">
97
- Log content
98
- </temba-tab>
99
145
 
100
- </temba-tabs>
146
+ <div class="example">
147
+ With Range
148
+ <temba-slider value="50" min="0" max="100" range></temba-slider>
149
+ </div>
101
150
 
151
+ <div class="example">
152
+ Without Range
153
+ <temba-slider value="50" min="0" max="100"></temba-slider>
154
+ </div>
102
155
 
156
+ </temba-tab>
157
+ <temba-tab name="temba-select" icon="chevron-down">
158
+
159
+ <div class="example">
160
+ <temba-select
161
+ placeholder="Select a color"
162
+ info_text="Some colors are very dangerous, choose wisely"
163
+ onchange="handleColorChange(event)"
164
+ >
165
+ <temba-option name="Red" value="0"></temba-option>
166
+ <temba-option name="Green" value="1"></temba-option>
167
+ <temba-option name="Blue" value="2"></temba-option>
168
+ </temba-select>
169
+ </div>
170
+
171
+ <div class="example">
172
+ <temba-select placeholder="Select a color" clearable>
173
+ <temba-option name="Red" value="0"></temba-option>
174
+ <temba-option name="Green" value="1"></temba-option>
175
+ <temba-option name="Blue" value="2"></temba-option>
176
+ </temba-select>
177
+ </div>
178
+
179
+ <div class="example">
180
+ <temba-select
181
+ placeholder="Select a color"
182
+ expressions="message"
183
+ values='[{"name":"Red","value":"0"}]'
184
+ searchable
185
+ multi
186
+ >
187
+ <temba-option name="Red" value="0"></temba-option>
188
+ <temba-option name="Green" value="1"></temba-option>
189
+ <temba-option name="Blue" value="2"></temba-option>
190
+ </temba-select>
191
+ </div>
103
192
 
104
- <div class="example" style="margin: 10px; background: #ccc; border-radius:6px;">
105
- <temba-dropdown>
106
- <div style="display:inline-block" slot="toggle">
107
- <temba-icon name="chevron-down" size="1.3" clickable></temba-icon>
193
+ <div class="example">
194
+ <temba-select
195
+ name="Color"
196
+ label="Color"
197
+ help_text="I'm not really enabled at the moment"
198
+ placeholder="Select a color"
199
+ expressions="message"
200
+ values='[{"name":"Red","value":"0"}]'
201
+ searchable
202
+ multi
203
+ disabled
204
+ >
205
+ <temba-option name="Red" value="0"></temba-option>
206
+ <temba-option name="Green" value="1"></temba-option>
207
+ <temba-option name="Blue" value="2"></temba-option>
208
+ </temba-select>
209
+ </div>
210
+
211
+ <div class="example">
212
+ <script>
213
+ function toggleSelect(evt) {
214
+ document.getElementById('select-toggle').disabled = !evt.currentTarget
215
+ .checked;
216
+ }
217
+ </script>
218
+ <div style="display: flex; align-items: center">
219
+ <temba-checkbox onchange="toggleSelect(event)" checked></temba-checkbox>
220
+ <temba-select
221
+ style="margin-left: 10px"
222
+ id="select-toggle"
223
+ placeholder="Select a color"
224
+ expressions="message"
225
+ >
226
+ <temba-option name="Red" value="0"></temba-option>
227
+ <temba-option name="Green" value="1"></temba-option>
228
+ <temba-option name="Blue" value="2"></temba-option>
229
+ </temba-select>
230
+ </div>
108
231
  </div>
109
232
 
110
- <div slot="dropdown" style="width:250px; padding:0.5em 1em">
111
- <a href="http://google.com">Google</a>
233
+ </temba-tab>
234
+
235
+ <temba-tab name="temba-textinput" icon="edit">
236
+
237
+ <div class="example">
238
+ <temba-textinput value="plain text"></temba-textinput>
112
239
  </div>
113
- </temba-dropdown>
114
- </div>
115
- <div class="example">
116
- <temba-omnibox
117
- placeholder="Contacts or Groups"
118
- label="Recipients"
119
- help_text="This is the helpful friendly book"
120
- endpoint="/contact/omnibox/?v=2"
121
- groups
122
- contacts
123
- ></temba-omnibox>
124
- </div>
125
- <div class="example">
126
- <temba-checkbox label="you betcha" checked></temba-checkbox>
127
- </div>
128
-
129
- <div class="example">
130
- <temba-textinput value="plain text"></temba-textinput>
131
- </div>
132
-
133
- <div class="example">
134
- <temba-completion value="you complete me @cont"></temba-completion>
135
- </div>
136
-
137
- <div class="example">
138
- <temba-select
139
- placeholder="Select a color"
140
- info_text="Some colors are very dangerous, choose wisely"
141
- onchange="handleColorChange(event)"
142
- >
143
- <temba-option name="Red" value="0"></temba-option>
144
- <temba-option name="Green" value="1"></temba-option>
145
- <temba-option name="Blue" value="2"></temba-option>
146
- </temba-select>
147
- </div>
148
-
149
- <div class="example">
150
- <temba-select placeholder="Select a color" clearable>
151
- <temba-option name="Red" value="0"></temba-option>
152
- <temba-option name="Green" value="1"></temba-option>
153
- <temba-option name="Blue" value="2"></temba-option>
154
- </temba-select>
155
- </div>
156
-
157
- <div class="example">
158
- <temba-select
159
- placeholder="Select a color"
160
- expressions="message"
161
- values='[{"name":"Red","value":"0"}]'
162
- searchable
163
- multi
164
- >
165
- <temba-option name="Red" value="0"></temba-option>
166
- <temba-option name="Green" value="1"></temba-option>
167
- <temba-option name="Blue" value="2"></temba-option>
168
- </temba-select>
169
- </div>
170
-
171
- <div class="example">
172
- <temba-select
173
- name="Color"
174
- label="Color"
175
- help_text="I'm not really enabled at the moment"
176
- placeholder="Select a color"
177
- expressions="message"
178
- values='[{"name":"Red","value":"0"}]'
179
- searchable
180
- multi
181
- disabled
182
- >
183
- <temba-option name="Red" value="0"></temba-option>
184
- <temba-option name="Green" value="1"></temba-option>
185
- <temba-option name="Blue" value="2"></temba-option>
186
- </temba-select>
187
- </div>
188
-
189
- <div class="example">
190
- <script>
191
- function toggleSelect(evt) {
192
- document.getElementById('select-toggle').disabled = !evt.currentTarget
193
- .checked;
194
- }
195
- </script>
196
- <div style="display: flex; align-items: center">
197
- <temba-checkbox onchange="toggleSelect(event)" checked></temba-checkbox>
198
- <temba-select
199
- style="margin-left: 10px"
200
- id="select-toggle"
201
- placeholder="Select a color"
202
- expressions="message"
203
- >
204
- <temba-option name="Red" value="0"></temba-option>
205
- <temba-option name="Green" value="1"></temba-option>
206
- <temba-option name="Blue" value="2"></temba-option>
207
- </temba-select>
208
- </div>
209
- </div>
210
-
211
- <div class="example">
212
- <temba-textinput
213
- name="start"
214
- label="Start Time"
215
- help_text="This is something you should think long and hard about"
216
- placeholder="Put something down, for real"
217
- value="2020-11-28 15:03"
218
- clearable
219
- datetimepicker
220
- ></temba-textinput>
221
- </div>
240
+
241
+ <div class="example">
242
+ <temba-completion value="you complete me @cont"></temba-completion>
243
+ </div>
244
+
245
+ <div class="example">
246
+ <temba-textinput
247
+ name="start"
248
+ label="Start Time"
249
+ help_text="This is something you should think long and hard about"
250
+ placeholder="Put something down, for real"
251
+ value="2020-11-28 15:03"
252
+ clearable
253
+ datetimepicker
254
+ ></temba-textinput>
255
+ </div>
256
+
257
+ <div class="example">
258
+ <temba-completion counter="temba-charcount" value="This is a GSM charcounter in a textarea" gsm textarea></temba-completion>
259
+ <temba-charcount text='count this text'></temba-charcount>
260
+ </div>
261
+ </temba-tab>
262
+
263
+ <temba-tab name="other" icon="list">
264
+ <div class="example">
265
+ <temba-checkbox label="Check this out" checked></temba-checkbox>
266
+ </div>
267
+
268
+ </temba-tab>
269
+
270
+ </temba-tabs>
222
271
  </body>
223
272
  </html>
@@ -4011,7 +4011,7 @@ function t(t,e,i,n){var o,r=arguments.length,s=r<3?e:null===n?n=Object.getOwnPro
4011
4011
  <slot name="dropdown"></slot>
4012
4012
  </div>
4013
4013
  </div>
4014
- `}}t([it({type:Boolean})],Wa.prototype,"open",void 0),t([it({type:Number})],Wa.prototype,"arrowSize",void 0),t([it({type:Number})],Wa.prototype,"arrowOffset",void 0),t([it({type:Number})],Wa.prototype,"offsetX",void 0),t([it({type:Number})],Wa.prototype,"offsetY",void 0);class Ga extends tt{constructor(){super(...arguments),this.index=0}static get styles(){return r`
4014
+ `}}t([it({type:Boolean})],Wa.prototype,"open",void 0),t([it({type:Number})],Wa.prototype,"arrowSize",void 0),t([it({type:Number})],Wa.prototype,"arrowOffset",void 0),t([it({type:Number})],Wa.prototype,"offsetX",void 0),t([it({type:Number})],Wa.prototype,"offsetY",void 0);class Ga extends tt{constructor(){super(...arguments),this.collapses=!1,this.index=0}static get styles(){return r`
4015
4015
  :host {
4016
4016
  display: flex;
4017
4017
  flex-direction: column;
@@ -4023,6 +4023,7 @@ function t(t,e,i,n){var o,r=arguments.length,s=r<3?e:null===n?n=Object.getOwnPro
4023
4023
  }
4024
4024
 
4025
4025
  .tab {
4026
+ user-select: none;
4026
4027
  padding: 0.5em 1em;
4027
4028
  margin: 0em 0em;
4028
4029
  cursor: pointer;
@@ -4034,10 +4035,39 @@ function t(t,e,i,n){var o,r=arguments.length,s=r<3?e:null===n?n=Object.getOwnPro
4034
4035
  border: 0px solid rgba(0, 0, 0, 0.45);
4035
4036
  color: var(--color-text-dark);
4036
4037
  --icon-color: var(--color-text-dark);
4038
+ white-space: nowrap;
4039
+ }
4040
+
4041
+ .tab.hidden {
4042
+ display: none;
4037
4043
  }
4038
4044
 
4039
4045
  .tab temba-icon {
4046
+ }
4047
+
4048
+ .tab .name {
4049
+ margin-left: 0.4em;
4050
+ max-width: 80px;
4040
4051
  margin-right: 0.4em;
4052
+ overflow: hidden;
4053
+ transition: max-width 500ms ease-in-out;
4054
+ }
4055
+
4056
+ .tab .badge {
4057
+ margin-left: 0.4em;
4058
+ }
4059
+
4060
+ @media (max-width: 900px) {
4061
+ .collapses .tab .name {
4062
+ max-width: 0px;
4063
+ margin: 0;
4064
+ }
4065
+ }
4066
+
4067
+ @media (max-width: 600px) {
4068
+ .collapses .tab .badge {
4069
+ display: none;
4070
+ }
4041
4071
  }
4042
4072
 
4043
4073
  .tab.selected {
@@ -4062,7 +4092,6 @@ function t(t,e,i,n){var o,r=arguments.length,s=r<3?e:null===n?n=Object.getOwnPro
4062
4092
  }
4063
4093
 
4064
4094
  .badge {
4065
- margin-left: 0.4em;
4066
4095
  }
4067
4096
 
4068
4097
  .count {
@@ -4081,16 +4110,18 @@ function t(t,e,i,n){var o,r=arguments.length,s=r<3?e:null===n?n=Object.getOwnPro
4081
4110
  color: #fff;
4082
4111
  }
4083
4112
  `}handleTabClick(t){this.index=parseInt(t.currentTarget.dataset.index),this.requestUpdate("index"),this.fireEvent(de.ContextChanged)}updated(t){if(super.updated(t),t.has("index")&&this.children.length>this.index)for(let t=0;t<this.children.length;t++){const e=this.children[t];e.selected=t==this.index,e.selected?e.style.display="flex":e.style.display="none"}}getTab(t){return this.children.item(t)}render(){const t=[];for(const e of this.children)t.push(e);return O`
4084
- <div class="tabs">
4113
+ <div
4114
+ class="tabs ${Gt({tabs:!0,collapses:this.collapses})}"
4115
+ >
4085
4116
  ${t.map(((t,e)=>O`
4086
4117
  <div
4087
4118
  @click=${this.handleTabClick}
4088
4119
  data-index=${e}
4089
- class="tab ${e==this.index?"selected":""} ${t.notify?"notify":""}"
4120
+ class="${Gt({tab:!0,selected:e==this.index,hidden:t.hidden,notify:t.notify})}"
4090
4121
  style="${t.selectionColor&&e==this.index?`color:${t.selectionColor};--icon-color:${t.selectionColor};`:""} ${t.selectionBackground&&e==this.index?`background-color:${t.selectionBackground};`:""}"
4091
4122
  >
4092
4123
  ${t.icon?O`<temba-icon name=${t.icon} />`:null}
4093
- ${t.name}
4124
+ <div class="name">${t.name}</div>
4094
4125
  ${t.hasBadge()?O`
4095
4126
  <div class="badge">
4096
4127
  ${t.count>0?O`<div class="count">${t.count}</div>`:null}
@@ -4102,7 +4133,7 @@ function t(t,e,i,n){var o,r=arguments.length,s=r<3?e:null===n?n=Object.getOwnPro
4102
4133
  <div class="pane ${0===this.index?"first":null}">
4103
4134
  <slot></slot>
4104
4135
  </div>
4105
- `}}t([it({type:Number})],Ga.prototype,"index",void 0);class Ya extends tt{constructor(){super(...arguments),this.selected=!1,this.notify=!1,this.count=0}static get styles(){return r`
4136
+ `}}t([it({type:Boolean})],Ga.prototype,"collapses",void 0),t([it({type:Number})],Ga.prototype,"index",void 0);class Ya extends tt{constructor(){super(...arguments),this.selected=!1,this.notify=!1,this.hidden=!1,this.count=0}static get styles(){return r`
4106
4137
  :host {
4107
4138
  display: flex;
4108
4139
  flex-direction: column;
@@ -4121,7 +4152,7 @@ function t(t,e,i,n){var o,r=arguments.length,s=r<3?e:null===n?n=Object.getOwnPro
4121
4152
  }
4122
4153
  `}hasBadge(){return this.count>0}render(){return O`<slot
4123
4154
  class="${Gt({selected:this.selected})}"
4124
- ></slot> `}}t([it({type:String})],Ya.prototype,"name",void 0),t([it({type:String})],Ya.prototype,"icon",void 0),t([it({type:String})],Ya.prototype,"selectionColor",void 0),t([it({type:String})],Ya.prototype,"selectionBackground",void 0),t([it({type:Boolean})],Ya.prototype,"selected",void 0),t([it({type:Boolean})],Ya.prototype,"notify",void 0),t([it({type:Number})],Ya.prototype,"count",void 0);class Ka extends X{static get styles(){return r`
4155
+ ></slot> `}}t([it({type:String})],Ya.prototype,"name",void 0),t([it({type:String})],Ya.prototype,"icon",void 0),t([it({type:String})],Ya.prototype,"selectionColor",void 0),t([it({type:String})],Ya.prototype,"selectionBackground",void 0),t([it({type:Boolean})],Ya.prototype,"selected",void 0),t([it({type:Boolean})],Ya.prototype,"notify",void 0),t([it({type:Boolean})],Ya.prototype,"hidden",void 0),t([it({type:Number})],Ya.prototype,"count",void 0);class Ka extends X{static get styles(){return r`
4125
4156
  :host {
4126
4157
  display: inline-block;
4127
4158
  }
@@ -4618,17 +4649,16 @@ function t(t,e,i,n){var o,r=arguments.length,s=r<3?e:null===n?n=Object.getOwnPro
4618
4649
  ${this.data.map((t=>this.renderEvent(t)))}
4619
4650
  `:O`<slot name="empty"></slot>`}}t([it({type:String})],nl.prototype,"contact",void 0),t([it({type:Object,attribute:!1})],nl.prototype,"data",void 0),t([it({type:String})],nl.prototype,"lang_weekly",void 0),t([it({type:String})],nl.prototype,"lang_daily",void 0),t([it({type:String})],nl.prototype,"lang_once",void 0);class ol extends ga{static get styles(){return r`
4620
4651
  :host {
4621
- background: rgba(0, 0, 0, 0.6);
4622
- color: #fff;
4623
- --icon-color: #fff;
4624
- border-radius: var(--curvature);
4652
+ padding: 1em;
4625
4653
  }
4626
4654
 
4627
4655
  :hover {
4628
- background: rgba(0, 0, 0, 0.9);
4629
- border-radius: var(--curvature);
4630
- transition: background 200ms ease-in-out, padding 200ms ease-in-out;
4656
+ }
4657
+
4658
+ .ticket:hover {
4631
4659
  cursor: pointer;
4660
+ box-shadow: 0 0 8px 1px rgba(0, 0, 0, 0.055),
4661
+ 0 0 0px 2px var(--color-link-primary);
4632
4662
  }
4633
4663
 
4634
4664
  .tickets {
@@ -4661,26 +4691,19 @@ function t(t,e,i,n){var o,r=arguments.length,s=r<3?e:null===n?n=Object.getOwnPro
4661
4691
  }
4662
4692
 
4663
4693
  .ticket > div {
4664
- padding: 1em;
4665
- }
4666
-
4667
- .ticket .action {
4668
- background: rgba(0, 0, 0, 0.1);
4669
- border-top-right-radius: var(--curvature);
4670
- border-bottom-right-radius: var(--curvature);
4671
- padding: 1.5em;
4672
- --icon-color: rgba(0, 0, 0, 0.4);
4673
- white-space: nowrap;
4694
+ padding: 0.5em 1em;
4695
+ pointer-events: none;
4674
4696
  }
4675
4697
 
4676
- .open .action {
4677
- background: rgba(0, 0, 0, 0.1);
4698
+ .status {
4699
+ --icon-color: #999;
4678
4700
  }
4679
4701
 
4680
- .closed .action {
4681
- background: #fff;
4702
+ .ticket.closed {
4703
+ background: #f9f9f9;
4704
+ color: #888;
4682
4705
  }
4683
- `}prepareData(t){return t&&t.length&&t.sort(((t,e)=>new Date(t.opened_on).getTime()-new Date(e.opened_on).getTime())),t}updated(t){super.updated(t),t.has("contact")&&(this.contact?this.url=`/api/v2/tickets.json?contact=${this.contact}`:this.url=null)}renderTicket(t){const e=t.status===ue.Open?t.opened_on:t.closed_on;return O`
4706
+ `}prepareData(t){return t&&t.length&&t.sort(((t,e)=>t.status==ue.Open&&e.status==ue.Closed?-1:e.status==ue.Open&&t.status==ue.Closed?1:t.status==ue.Closed&&e.status==ue.Closed?new Date(e.closed_on).getTime()-new Date(t.closed_on).getTime():new Date(e.opened_on).getTime()-new Date(t.opened_on).getTime())),t}updated(t){super.updated(t),t.has("contact")&&(this.contact?this.url=`/api/v2/tickets.json?contact=${this.contact}`:this.url=null)}renderTicket(t){const e=t.status===ue.Open?t.opened_on:t.closed_on;return O`
4684
4707
  <div
4685
4708
  class="ticket ${t.status}"
4686
4709
  href="/ticket/all/open/${t.uuid}"
@@ -4695,47 +4718,31 @@ function t(t,e,i,n){var o,r=arguments.length,s=r<3?e:null===n?n=Object.getOwnPro
4695
4718
  </temba-tip>
4696
4719
  </div>
4697
4720
 
4698
- ${t.status===ue.Open?O`
4699
- <div class="action">
4700
- <temba-icon name="check" size="1.5" clickable></temba-icon>
4701
- </div>
4702
- `:O`
4703
- <div class="action">
4704
- <temba-icon name="check" size="1.5"></temba-icon>
4705
- </div>
4706
- `}
4721
+ ${t.status===ue.Closed?O`<div class="status">
4722
+ <temba-icon name="check"></temba-icon>
4723
+ </div>`:null}
4707
4724
  </div>
4708
- `}render(){if(this.data&&this.data.length>0){const t=this.data.find((t=>t.status==ue.Open));if(t)return O`
4709
- <div
4710
- class="tickets"
4711
- href="/ticket/all/open/${t.uuid}"
4712
- onclick="goto(event)"
4713
- >
4714
- <div style="flex-grow:1"></div>
4715
- <temba-icon name="agent" style="pointer-events: none;"></temba-icon>
4716
- <div class="count" style="pointer-events: none;">
4717
- ${this.data.filter((t=>t.status===ue.Open)).length}
4718
- </div>
4719
- </div>
4720
- `}}}t([it({type:String})],ol.prototype,"contact",void 0),t([it({type:Object,attribute:!1})],ol.prototype,"data",void 0);class rl extends ot{constructor(){super(...arguments),this.min=0,this.max=100,this.circleX=0,this.grabbed=!1,this.left=0,this.gap=0}static get styles(){return r`
4725
+ `}render(){if(this.data&&this.data.length>0){const t=this.data.map((t=>this.renderTicket(t)));return O`${t}`}return O`<slot name="empty"></slot>`}}t([it({type:String})],ol.prototype,"contact",void 0),t([it({type:Object,attribute:!1})],ol.prototype,"data",void 0);class rl extends ot{constructor(){super(...arguments),this.range=!1,this.min=0,this.max=100,this.circleX=0,this.grabbed=!1}static get styles(){return r`
4721
4726
  :host {
4722
4727
  display: block;
4723
4728
  }
4724
4729
 
4725
4730
  .track {
4726
- height: 0.1em;
4727
- border: 12px solid #fff;
4731
+ height: 2px;
4732
+ border-top: 0.5em solid #fff;
4733
+ border-bottom: 0.5em solid #fff;
4728
4734
  background: #ddd;
4735
+ flex-grow: 1;
4729
4736
  }
4730
4737
 
4731
4738
  .circle {
4732
- margin-top: 0.4em;
4733
- margin-left: 1em;
4739
+ margin-bottom: -1.05em;
4740
+ margin-left: -0.5em;
4734
4741
  width: 0.75em;
4735
4742
  height: 0.75em;
4736
4743
  border: 2px solid #999;
4737
4744
  border-radius: 999px;
4738
- position: absolute;
4745
+ position: relative;
4739
4746
  background: #fff;
4740
4747
  box-shadow: 0 0 0 4px rgb(255, 255, 255);
4741
4748
  transition: transform 200ms ease-in-out;
@@ -4750,10 +4757,6 @@ function t(t,e,i,n){var o,r=arguments.length,s=r<3?e:null===n?n=Object.getOwnPro
4750
4757
  cursor: pointer;
4751
4758
  }
4752
4759
 
4753
- .grabbed .circle {
4754
- // border-color: #777;
4755
- }
4756
-
4757
4760
  .grabbed .circle {
4758
4761
  border-color: var(--color-primary-dark);
4759
4762
  background: #fff;
@@ -4762,14 +4765,30 @@ function t(t,e,i,n){var o,r=arguments.length,s=r<3?e:null===n?n=Object.getOwnPro
4762
4765
  .grabbed .circle {
4763
4766
  transform: scale(1.2);
4764
4767
  }
4765
- `}firstUpdated(t){super.firstUpdated(t),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.left=Math.round(this.getBoundingClientRect().left);const e=this.shadowRoot.querySelector(".circle").clientWidth-4;this.left=Math.round(this.getBoundingClientRect().left+e),this.gap=.035*this.offsetWidth}updated(t){if(t.has("value")){const t=parseInt(this.value)/this.max,e=this.offsetWidth-this.gap;this.updateCircle(e*t)}}updateValue(t){const e=(t.pageX-this.left)/(this.offsetWidth-this.gap);this.value=""+Math.max(this.min,Math.min(Math.round(this.max*e),this.max))}handleMouseMove(t){this.grabbed&&this.updateValue(t)}handleTrackDown(t){this.grabbed=!0,document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp),document.querySelector("html").classList.add("dragging"),this.updateValue(t),this.requestUpdate()}handleMouseUp(t){this.grabbed=!1,this.updateValue(t),this.requestUpdate(),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.querySelector("html").classList.remove("dragging")}updateCircle(t){const e=this.shadowRoot.querySelector(".circle");this.circleX=Math.round(Math.min(this.offsetWidth-this.gap,Math.max(t+e.offsetWidth/2,this.gap))),this.requestUpdate()}render(){return O` <div class="${Gt({grabbed:this.grabbed})}">
4768
+
4769
+ .wrapper {
4770
+ display: flex;
4771
+ align-items: center;
4772
+ }
4773
+
4774
+ .pre,
4775
+ .post {
4776
+ font-size: 0.9em;
4777
+ color: #999;
4778
+ padding: 0em 1em;
4779
+ }
4780
+ `}firstUpdated(t){super.firstUpdated(t),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this)}updated(t){t.has("value")&&this.updateCircle()}updateValue(t){const e=this.shadowRoot.querySelector(".track"),i=(t.pageX-e.offsetLeft)/e.offsetWidth,n=(this.max-this.min)*i+this.min;this.value=""+Math.max(this.min,Math.min(Math.round(n),this.max))}handleMouseMove(t){this.grabbed&&this.updateValue(t)}handleTrackDown(t){this.grabbed=!0,document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp),document.querySelector("html").classList.add("dragging"),this.updateValue(t),this.requestUpdate()}handleMouseUp(t){this.grabbed=!1,this.updateValue(t),this.requestUpdate(),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.querySelector("html").classList.remove("dragging")}updateCircle(){const t=this.shadowRoot.querySelector(".track"),e=this.shadowRoot.querySelector(".pre"),i=this.max-this.min,n=(parseInt(this.value)-this.min)/i,o=t.offsetWidth*n;this.circleX=o+(e?e.offsetWidth:0),this.requestUpdate()}render(){return O` <div class="${Gt({grabbed:this.grabbed})}">
4766
4781
  <div
4767
4782
  style=${ut({left:this.circleX+"px"})}
4768
4783
  class="circle"
4769
4784
  @mousedown=${this.handleTrackDown}
4770
4785
  ></div>
4771
- <div class="track" @mousedown=${this.handleTrackDown}></div>
4772
- </div>`}}function sl(t,e){window.customElements.get(t)||window.customElements.define(t,e)}t([it({type:Number})],rl.prototype,"min",void 0),t([it({type:Number})],rl.prototype,"max",void 0),sl("temba-anchor",Va),sl("temba-alert",Ia),sl("temba-store",dr),sl("temba-textinput",Ht),sl("temba-completion",ea),sl("temba-checkbox",rt),sl("temba-select",ta),sl("temba-options",pr),sl("temba-loading",sa),sl("temba-button",oa),sl("temba-omnibox",Fa),sl("temba-tip",Za),sl("temba-contact-name",Ja),sl("temba-contact-field",tl),sl("temba-contact-fields",Qa),sl("temba-urn",Xa),sl("temba-field",ra),sl("temba-dialog",na),sl("temba-modax",ia),sl("temba-charcount",fa),sl("temba-contact-history",Aa),sl("temba-contact-chat",ya),sl("temba-contact-details",Pa),sl("temba-ticket-list",Oa),sl("temba-list",La),sl("temba-label",Ka),sl("temba-menu",Ua),sl("temba-contact-search",Na),sl("temba-icon",za),sl("temba-dropdown",Wa),sl("temba-tabs",Ga),sl("temba-tab",Ya),sl("temba-contact-groups",class extends va{static get styles(){return r`
4786
+ <div class="wrapper">
4787
+ ${this.range?O`<div class="pre">${this.min}</div>`:null}
4788
+ <div class="track" @mousedown=${this.handleTrackDown}></div>
4789
+ ${this.range?O`<div class="post">${this.max}</div>`:null}
4790
+ </div>
4791
+ </div>`}}function sl(t,e){window.customElements.get(t)||window.customElements.define(t,e)}t([it({type:Boolean})],rl.prototype,"range",void 0),t([it({type:Number})],rl.prototype,"min",void 0),t([it({type:Number})],rl.prototype,"max",void 0),sl("temba-anchor",Va),sl("temba-alert",Ia),sl("temba-store",dr),sl("temba-textinput",Ht),sl("temba-completion",ea),sl("temba-checkbox",rt),sl("temba-select",ta),sl("temba-options",pr),sl("temba-loading",sa),sl("temba-button",oa),sl("temba-omnibox",Fa),sl("temba-tip",Za),sl("temba-contact-name",Ja),sl("temba-contact-field",tl),sl("temba-contact-fields",Qa),sl("temba-urn",Xa),sl("temba-field",ra),sl("temba-dialog",na),sl("temba-modax",ia),sl("temba-charcount",fa),sl("temba-contact-history",Aa),sl("temba-contact-chat",ya),sl("temba-contact-details",Pa),sl("temba-ticket-list",Oa),sl("temba-list",La),sl("temba-label",Ka),sl("temba-menu",Ua),sl("temba-contact-search",Na),sl("temba-icon",za),sl("temba-dropdown",Wa),sl("temba-tabs",Ga),sl("temba-tab",Ya),sl("temba-contact-groups",class extends va{static get styles(){return r`
4773
4792
  temba-label {
4774
4793
  margin: 0.3em;
4775
4794
  }