@nyaruka/temba-components 0.25.2 → 0.26.2

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.
Files changed (186) hide show
  1. package/.github/workflows/build.yml +1 -1
  2. package/CHANGELOG.md +33 -0
  3. package/demo/index.html +60 -1
  4. package/dist/4f80c187.js +4277 -0
  5. package/dist/index.js +3957 -36
  6. package/dist/static/icons/symbol-defs.svg +29 -20
  7. package/dist/sw.js +1 -1
  8. package/dist/sw.js.map +1 -1
  9. package/dist/templates/components-body.html +1 -1
  10. package/dist/templates/components-head.html +1 -1
  11. package/out-tsc/src/FormElement.js +1 -1
  12. package/out-tsc/src/FormElement.js.map +1 -1
  13. package/out-tsc/src/RapidElement.js +1 -1
  14. package/out-tsc/src/RapidElement.js.map +1 -1
  15. package/out-tsc/src/alert/Alert.js +3 -3
  16. package/out-tsc/src/alert/Alert.js.map +1 -1
  17. package/out-tsc/src/aliaseditor/AliasEditor.js +3 -3
  18. package/out-tsc/src/aliaseditor/AliasEditor.js.map +1 -1
  19. package/out-tsc/src/anchor/Anchor.js +2 -1
  20. package/out-tsc/src/anchor/Anchor.js.map +1 -1
  21. package/out-tsc/src/button/Button.js +2 -1
  22. package/out-tsc/src/button/Button.js.map +1 -1
  23. package/out-tsc/src/charcount/CharCount.js +2 -1
  24. package/out-tsc/src/charcount/CharCount.js.map +1 -1
  25. package/out-tsc/src/checkbox/Checkbox.js +3 -1
  26. package/out-tsc/src/checkbox/Checkbox.js.map +1 -1
  27. package/out-tsc/src/completion/Completion.js +2 -1
  28. package/out-tsc/src/completion/Completion.js.map +1 -1
  29. package/out-tsc/src/completion/helpers.js +27 -4
  30. package/out-tsc/src/completion/helpers.js.map +1 -1
  31. package/out-tsc/src/contacts/ContactChat.js +101 -86
  32. package/out-tsc/src/contacts/ContactChat.js.map +1 -1
  33. package/out-tsc/src/contacts/ContactDetails.js +2 -1
  34. package/out-tsc/src/contacts/ContactDetails.js.map +1 -1
  35. package/out-tsc/src/contacts/ContactHistory.js +32 -37
  36. package/out-tsc/src/contacts/ContactHistory.js.map +1 -1
  37. package/out-tsc/src/contacts/events.js +62 -76
  38. package/out-tsc/src/contacts/events.js.map +1 -1
  39. package/out-tsc/src/contactsearch/ContactSearch.js +2 -1
  40. package/out-tsc/src/contactsearch/ContactSearch.js.map +1 -1
  41. package/out-tsc/src/datepicker/DatePicker.js +2 -1
  42. package/out-tsc/src/datepicker/DatePicker.js.map +1 -1
  43. package/out-tsc/src/dialog/Dialog.js +2 -2
  44. package/out-tsc/src/dialog/Dialog.js.map +1 -1
  45. package/out-tsc/src/dialog/Modax.js +3 -6
  46. package/out-tsc/src/dialog/Modax.js.map +1 -1
  47. package/out-tsc/src/dropdown/Dropdown.js +133 -0
  48. package/out-tsc/src/dropdown/Dropdown.js.map +1 -0
  49. package/out-tsc/src/formfield/FormField.js +2 -1
  50. package/out-tsc/src/formfield/FormField.js.map +1 -1
  51. package/out-tsc/src/label/Label.js +2 -1
  52. package/out-tsc/src/label/Label.js.map +1 -1
  53. package/out-tsc/src/leafletmap/LeafletMap.js +2 -1
  54. package/out-tsc/src/leafletmap/LeafletMap.js.map +1 -1
  55. package/out-tsc/src/list/TembaList.js +7 -5
  56. package/out-tsc/src/list/TembaList.js.map +1 -1
  57. package/out-tsc/src/list/TembaMenu.js +112 -97
  58. package/out-tsc/src/list/TembaMenu.js.map +1 -1
  59. package/out-tsc/src/list/TicketList.js +2 -1
  60. package/out-tsc/src/list/TicketList.js.map +1 -1
  61. package/out-tsc/src/loading/Loading.js +2 -1
  62. package/out-tsc/src/loading/Loading.js.map +1 -1
  63. package/out-tsc/src/omnibox/Omnibox.js +2 -1
  64. package/out-tsc/src/omnibox/Omnibox.js.map +1 -1
  65. package/out-tsc/src/options/Options.js +3 -2
  66. package/out-tsc/src/options/Options.js.map +1 -1
  67. package/out-tsc/src/remote/Remote.js +2 -1
  68. package/out-tsc/src/remote/Remote.js.map +1 -1
  69. package/out-tsc/src/select/Select.js +8 -10
  70. package/out-tsc/src/select/Select.js.map +1 -1
  71. package/out-tsc/src/shadowless/Shadowless.js +2 -2
  72. package/out-tsc/src/shadowless/Shadowless.js.map +1 -1
  73. package/out-tsc/src/store/Store.js +2 -1
  74. package/out-tsc/src/store/Store.js.map +1 -1
  75. package/out-tsc/src/tabpane/Tab.js +46 -0
  76. package/out-tsc/src/tabpane/Tab.js.map +1 -0
  77. package/out-tsc/src/tabpane/TabPane.js +109 -0
  78. package/out-tsc/src/tabpane/TabPane.js.map +1 -0
  79. package/out-tsc/src/textinput/TextInput.js +3 -2
  80. package/out-tsc/src/textinput/TextInput.js.map +1 -1
  81. package/out-tsc/src/tip/Tip.js +2 -2
  82. package/out-tsc/src/tip/Tip.js.map +1 -1
  83. package/out-tsc/src/vectoricon/VectorIcon.js +18 -6
  84. package/out-tsc/src/vectoricon/VectorIcon.js.map +1 -1
  85. package/out-tsc/temba-modules.js +6 -0
  86. package/out-tsc/temba-modules.js.map +1 -1
  87. package/out-tsc/test/temba-contact-history.test.js +9 -6
  88. package/out-tsc/test/temba-contact-history.test.js.map +1 -1
  89. package/out-tsc/test/temba-dialog.test.js +3 -3
  90. package/out-tsc/test/temba-dialog.test.js.map +1 -1
  91. package/package.json +10 -9
  92. package/screenshots/truth/alert/error.png +0 -0
  93. package/screenshots/truth/alert/info.png +0 -0
  94. package/screenshots/truth/alert/warning.png +0 -0
  95. package/screenshots/truth/contacts/history-expanded.png +0 -0
  96. package/screenshots/truth/contacts/history.png +0 -0
  97. package/screenshots/truth/counter/summary.png +0 -0
  98. package/screenshots/truth/counter/unicode-variables.png +0 -0
  99. package/screenshots/truth/counter/unicode.png +0 -0
  100. package/screenshots/truth/dialog/focused.png +0 -0
  101. package/screenshots/truth/list/items-selected.png +0 -0
  102. package/screenshots/truth/list/items-updated.png +0 -0
  103. package/screenshots/truth/list/items.png +0 -0
  104. package/screenshots/truth/list/menu-root.png +0 -0
  105. package/screenshots/truth/list/menu-submenu.png +0 -0
  106. package/screenshots/truth/modax/form.png +0 -0
  107. package/screenshots/truth/modax/simple.png +0 -0
  108. package/screenshots/truth/options/block.png +0 -0
  109. package/screenshots/truth/select/embedded.png +0 -0
  110. package/screenshots/truth/select/expression-selected.png +0 -0
  111. package/screenshots/truth/select/expressions.png +0 -0
  112. package/screenshots/truth/select/functions.png +0 -0
  113. package/screenshots/truth/select/local-options.png +0 -0
  114. package/screenshots/truth/select/remote-options.png +0 -0
  115. package/screenshots/truth/select/search-enabled.png +0 -0
  116. package/screenshots/truth/select/search-selected-focus.png +0 -0
  117. package/screenshots/truth/select/search-selected.png +0 -0
  118. package/screenshots/truth/select/search-with-selected.png +0 -0
  119. package/screenshots/truth/select/searching.png +0 -0
  120. package/screenshots/truth/select/selected-multi.png +0 -0
  121. package/screenshots/truth/select/selected-single.png +0 -0
  122. package/screenshots/truth/select/selection-clearable.png +0 -0
  123. package/screenshots/truth/select/with-placeholder.png +0 -0
  124. package/screenshots/truth/select/without-placeholder.png +0 -0
  125. package/screenshots/truth/textinput/date-initialized.png +0 -0
  126. package/screenshots/truth/textinput/input-focused.png +0 -0
  127. package/screenshots/truth/textinput/textarea-focused.png +0 -0
  128. package/screenshots/truth/tip/bottom.png +0 -0
  129. package/screenshots/truth/tip/left.png +0 -0
  130. package/screenshots/truth/tip/right.png +0 -0
  131. package/screenshots/truth/tip/top.png +0 -0
  132. package/src/FormElement.ts +1 -1
  133. package/src/RapidElement.ts +1 -1
  134. package/src/alert/Alert.ts +3 -3
  135. package/src/aliaseditor/AliasEditor.ts +4 -3
  136. package/src/anchor/Anchor.ts +2 -1
  137. package/src/button/Button.ts +3 -1
  138. package/src/charcount/CharCount.ts +2 -1
  139. package/src/checkbox/Checkbox.ts +3 -1
  140. package/src/completion/Completion.ts +2 -1
  141. package/src/completion/helpers.ts +30 -4
  142. package/src/contacts/ContactChat.ts +115 -95
  143. package/src/contacts/ContactDetails.ts +2 -1
  144. package/src/contacts/ContactHistory.ts +64 -67
  145. package/src/contacts/events.ts +62 -77
  146. package/src/contactsearch/ContactSearch.ts +2 -1
  147. package/src/datepicker/DatePicker.ts +2 -7
  148. package/src/dialog/Dialog.ts +2 -2
  149. package/src/dialog/Modax.ts +4 -6
  150. package/src/dropdown/Dropdown.ts +136 -0
  151. package/src/formfield/FormField.ts +2 -1
  152. package/src/label/Label.ts +2 -8
  153. package/src/leafletmap/LeafletMap.ts +2 -2
  154. package/src/list/TembaList.ts +8 -5
  155. package/src/list/TembaMenu.ts +125 -103
  156. package/src/list/TicketList.ts +2 -1
  157. package/src/loading/Loading.ts +2 -1
  158. package/src/omnibox/Omnibox.ts +2 -1
  159. package/src/options/Options.ts +3 -2
  160. package/src/remote/Remote.ts +2 -7
  161. package/src/select/Select.ts +11 -10
  162. package/src/shadowless/Shadowless.ts +2 -2
  163. package/src/store/Store.ts +2 -1
  164. package/src/tabpane/Tab.ts +42 -0
  165. package/src/tabpane/TabPane.ts +113 -0
  166. package/src/textinput/TextInput.ts +3 -2
  167. package/src/tip/Tip.ts +2 -2
  168. package/src/vectoricon/VectorIcon.ts +18 -6
  169. package/static/css/temba-components.css +11 -0
  170. package/static/icons/Read Me.txt +1 -1
  171. package/static/icons/SVG/pause.svg +5 -0
  172. package/static/icons/SVG/play.svg +5 -0
  173. package/static/icons/SVG/{upload-cloud.svg → publish.svg} +1 -1
  174. package/static/icons/SVG/user-x.svg +5 -0
  175. package/static/icons/demo-external-svg.html +157 -142
  176. package/static/icons/demo-files/demo.css +3 -3
  177. package/static/icons/demo.html +186 -162
  178. package/static/icons/selection.json +390 -318
  179. package/static/icons/symbol-defs.svg +29 -20
  180. package/temba-modules.ts +6 -0
  181. package/test/temba-contact-history.test.ts +10 -6
  182. package/test/temba-dialog.test.ts +5 -6
  183. package/test-assets/modax/form.html +1 -1
  184. package/test-assets/style.css +7 -0
  185. package/web-test-runner.config.mjs +130 -117
  186. package/dist/56e0e480.js +0 -356
Binary file
Binary file
Binary file
Binary file
@@ -1,5 +1,5 @@
1
1
  import { RapidElement } from './RapidElement';
2
- import { property } from 'lit-element';
2
+ import { property } from 'lit/decorators';
3
3
 
4
4
  /**
5
5
  * FormElement is a component that appends a hidden input (outside of
@@ -1,4 +1,4 @@
1
- import { LitElement } from 'lit-element';
1
+ import { LitElement } from 'lit';
2
2
  import { CustomEventType } from './interfaces';
3
3
 
4
4
  export interface EventHandler {
@@ -1,4 +1,5 @@
1
- import { css, html, LitElement, property, TemplateResult } from 'lit-element';
1
+ import { css, html, LitElement, TemplateResult } from 'lit';
2
+ import { property } from 'lit/decorators';
2
3
 
3
4
  export class Alert extends LitElement {
4
5
  static get styles() {
@@ -9,11 +10,10 @@ export class Alert extends LitElement {
9
10
 
10
11
  .temba-alert {
11
12
  color: rgba(0, 0, 0, 0.8);
12
- padding: 0.65em 1em;
13
+ padding: 0.65rem 1rem;
13
14
  border: 1px solid rgba(0, 0, 0, 0.35);
14
15
  border-left: 10px solid rgba(0, 0, 0, 0.35);
15
16
  border-radius: var(--curvature-widget);
16
- font-size: 14px;
17
17
  box-shadow: var(--shadow);
18
18
  }
19
19
 
@@ -1,11 +1,12 @@
1
- /* eslint-disable @typescript-eslint/camelcase */
2
- import { css, html, LitElement, property, TemplateResult } from 'lit-element';
1
+ import { css, html, LitElement, TemplateResult } from 'lit';
3
2
  import { FeatureProperties } from '../interfaces';
4
3
  import { getUrl, postJSON, WebResponse } from '../utils';
5
4
  import { TextInput } from '../textinput/TextInput';
6
5
  import { styleMap } from 'lit-html/directives/style-map';
7
6
  import { FormElement } from '../FormElement';
8
7
 
8
+ import { property } from 'lit/decorators';
9
+
9
10
  export class AliasEditor extends LitElement {
10
11
  static get styles() {
11
12
  return css`
@@ -258,7 +259,7 @@ export class AliasEditor extends LitElement {
258
259
  evt.stopPropagation();
259
260
  }}
260
261
  >
261
- <temba-icon name="edit" path-prefix="/sitestatic" />
262
+ <temba-icon name="edit" />
262
263
  </div>
263
264
  `
264
265
  : ''}
@@ -1,4 +1,5 @@
1
- import { LitElement, TemplateResult, html, css, property } from 'lit-element';
1
+ import { LitElement, TemplateResult, html, css } from 'lit';
2
+ import { property } from 'lit/decorators';
2
3
 
3
4
  export class Anchor extends LitElement {
4
5
  static get styles() {
@@ -1,6 +1,8 @@
1
- import { LitElement, TemplateResult, html, css, property } from 'lit-element';
1
+ import { LitElement, TemplateResult, html, css } from 'lit';
2
2
  import { getClasses } from '../utils';
3
3
 
4
+ import { property } from 'lit/decorators';
5
+
4
6
  export class Button extends LitElement {
5
7
  static get styles() {
6
8
  return css`
@@ -1,7 +1,8 @@
1
- import { css, html, property, TemplateResult } from 'lit-element';
1
+ import { css, html, TemplateResult } from 'lit';
2
2
  import { RapidElement } from '../RapidElement';
3
3
  import { splitSMS } from '../sms';
4
4
  import { getExtendedCharacters } from './helpers';
5
+ import { property } from 'lit/decorators';
5
6
 
6
7
  export class CharCount extends RapidElement {
7
8
  static get styles() {
@@ -1,5 +1,6 @@
1
- import { TemplateResult, html, css, property } from 'lit-element';
1
+ import { TemplateResult, html, css } from 'lit';
2
2
  import { FormElement } from '../FormElement';
3
+ import { property } from 'lit/decorators';
3
4
 
4
5
  export class Checkbox extends FormElement {
5
6
  static get styles() {
@@ -96,6 +97,7 @@ export class Checkbox extends FormElement {
96
97
 
97
98
  public click(): void {
98
99
  this.handleClick();
100
+ super.click();
99
101
  }
100
102
 
101
103
  public render(): TemplateResult {
@@ -1,4 +1,5 @@
1
- import { TemplateResult, css, property, html } from 'lit-element';
1
+ import { TemplateResult, css, html } from 'lit';
2
+ import { property } from 'lit/decorators';
2
3
  import { ifDefined } from 'lit-html/directives/if-defined';
3
4
  import { TextInput } from '../textinput/TextInput';
4
5
  import {
@@ -1,5 +1,6 @@
1
- import { html, directive, Part, TemplateResult } from 'lit-html';
1
+ import { html, TemplateResult } from 'lit';
2
2
  import { unsafeHTML } from 'lit-html/directives/unsafe-html';
3
+ import { directive, Directive, Part, PartInfo, PartType } from 'lit/directive';
3
4
  import ExcellentParser, { Expression } from './ExcellentParser';
4
5
  import {
5
6
  CompletionOption,
@@ -38,9 +39,34 @@ const sessionParser = new ExcellentParser('@', [
38
39
  'resume',
39
40
  ]);
40
41
 
41
- export const renderMarkdown = directive((contents: string) => (part: Part) => {
42
- part.setValue(unsafeHTML(md.render(contents)));
43
- });
42
+ // Class-based directive API
43
+ export class RenderMarkdown extends Directive {
44
+ // State stored in class field
45
+ value: string | undefined;
46
+ constructor(partInfo: PartInfo) {
47
+ super(partInfo);
48
+ // When necessary, validate part in constructor using `part.type`
49
+ if (partInfo.type !== PartType.CHILD) {
50
+ throw new Error('renderMarkdown only supports child expressions');
51
+ }
52
+ }
53
+ // Optional: override update to perform any direct DOM manipulation
54
+ // DirectiveParameters<this>
55
+ update(part: Part, [initialValue]: any) {
56
+ /* Any imperative updates to DOM/parts would go here */
57
+ return this.render(initialValue);
58
+ }
59
+ // Do SSR-compatible rendering (arguments are passed from call site)
60
+ render(initialValue: string) {
61
+ // Previous state available on class field
62
+ if (this.value === undefined) {
63
+ this.value = initialValue;
64
+ }
65
+ return html`${unsafeHTML(md.render(this.value))}`;
66
+ }
67
+ }
68
+
69
+ export const renderMarkdown = directive(RenderMarkdown);
44
70
 
45
71
  export const renderCompletionOption = (
46
72
  option: CompletionOption,
@@ -1,4 +1,5 @@
1
- import { css, html, property, TemplateResult } from 'lit-element';
1
+ import { css, html, TemplateResult } from 'lit';
2
+ import { property } from 'lit/decorators';
2
3
  import { RapidElement } from '../RapidElement';
3
4
  import { Contact, CustomEventType, Ticket } from '../interfaces';
4
5
  import { COOKIE_KEYS, getCookieBoolean, postJSON, setCookie } from '../utils';
@@ -13,35 +14,36 @@ const DEFAULT_REFRESH = 10000;
13
14
  export class ContactChat extends RapidElement {
14
15
  public static get styles() {
15
16
  return css`
16
- :host {
17
- box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2),
18
- 0 1px 2px 0 rgba(0, 0, 0, 0.06);
19
-
20
- height: 100%;
21
- border-radius: var(--curvature);
22
-
23
- flex-grow: 1;
24
- width: 100%;
25
- display: block;
26
- background: #f2f2f2;
27
- overflow: hidden;
28
- }
29
-
30
17
  .left-pane {
31
18
  box-shadow: -13px 10px 7px 14px rgba(0, 0, 0, 0);
32
19
  transition: box-shadow 600ms linear;
33
20
  }
34
21
 
35
22
  .left-pane.open {
36
- box-shadow: -13px 10px 7px 14px rgba(0, 0, 0, 0.15);
37
23
  z-index: 1000;
38
24
  }
39
25
 
26
+ :host {
27
+ flex-grow: 1;
28
+ display: flex;
29
+ flex-direction: row;
30
+ min-height: 0;
31
+ border-radius: var(--curvature);
32
+ }
33
+
40
34
  .chat-wrapper {
41
35
  display: flex;
36
+ flex-grow: 1;
42
37
  flex-direction: column;
43
- height: 100%;
44
38
  overflow: hidden;
39
+ min-height: 0;
40
+ }
41
+
42
+ temba-contact-history {
43
+ flex-grow: 1;
44
+ display: flex;
45
+ flex-direction: column;
46
+ min-height: 0;
45
47
  }
46
48
 
47
49
  .chatbox {
@@ -52,6 +54,11 @@ export class ContactChat extends RapidElement {
52
54
  flex-direction: column;
53
55
  z-index: 3;
54
56
  border-bottom-left-radius: var(--curvature);
57
+ border-bottom-right-radius: var(--curvature);
58
+ }
59
+
60
+ .chatbox.full {
61
+ border-bottom-right-radius: 0 !important;
55
62
  }
56
63
 
57
64
  .closed-footer {
@@ -175,6 +182,9 @@ export class ContactChat extends RapidElement {
175
182
  @property({ type: Boolean })
176
183
  showDetails = true;
177
184
 
185
+ @property({ type: Boolean })
186
+ toolbar = false;
187
+
178
188
  @property({ type: Boolean })
179
189
  monitor = false;
180
190
 
@@ -320,14 +330,13 @@ export class ContactChat extends RapidElement {
320
330
 
321
331
  public render(): TemplateResult {
322
332
  return html`
323
- <div style="display: flex; height: 100%;">
324
- <div
325
- style="flex-grow: 1; margin-right: 0em;"
326
- class="left-pane ${this.showDetails ? 'open' : ''}"
327
- >
328
- <div class="chat-wrapper">
329
- ${this.currentContact
330
- ? html` <temba-contact-history
333
+ <div
334
+ style="flex-grow: 1; margin-right: 0em; display:flex; flex-direction:row; min-height: 0;"
335
+ class="left-pane ${this.showDetails ? 'open' : ''}"
336
+ >
337
+ <div class="chat-wrapper">
338
+ ${this.currentContact
339
+ ? html`<temba-contact-history
331
340
  .uuid=${this.currentContact.uuid}
332
341
  .contact=${this.currentContact}
333
342
  .ticket=${
@@ -348,7 +357,9 @@ export class ContactChat extends RapidElement {
348
357
  @click=${this.handleReopen}
349
358
  ></temba-button>
350
359
  </div>`
351
- : html` <div class="chatbox">
360
+ : html` <div
361
+ class="chatbox ${this.toolbar ? 'full' : ''}"
362
+ >
352
363
  <temba-completion
353
364
  @change=${this.handleChatChange}
354
365
  .value=${this.currentChat}
@@ -374,81 +385,88 @@ export class ContactChat extends RapidElement {
374
385
  </div>`
375
386
  }
376
387
  </div>`
377
- : null}
378
- </div>
388
+ : null}
379
389
  </div>
380
- ${this.currentContact
381
- ? html`<temba-contact-details
382
- style="z-index: 10"
383
- class="${this.showDetails ? '' : 'hidden'}"
384
- showGroups="true"
385
- .visible=${this.showDetails}
386
- .ticket=${this.currentTicket}
387
- .contact=${this.currentContact}
388
- ></temba-contact-details>`
389
- : null}
390
+ </div>
391
+
392
+ ${this.toolbar
393
+ ? html`${
394
+ this.currentContact
395
+ ? html`<temba-contact-details
396
+ style="z-index: 10"
397
+ class="${this.showDetails ? '' : 'hidden'}"
398
+ showGroups="true"
399
+ .visible=${this.showDetails}
400
+ .ticket=${this.currentTicket}
401
+ .contact=${this.currentContact}
402
+ ></temba-contact-details>`
403
+ : null
404
+ }
390
405
 
391
406
  <div class="toolbar ${this.showDetails ? '' : 'closed'}">
392
- ${this.currentContact
393
- ? html`
394
- <temba-tip
395
- style="margin-top:5px"
396
- text="${this.showDetails ? 'Hide Details' : 'Show Details'}"
397
- position="left"
398
- hideOnChange
399
- >
400
- <temba-icon
401
- id="details-button"
402
- name="${this.showDetails ? 'chevrons-left' : 'sidebar'}"
403
- @click="${this.handleDetailSlider}"
404
- clickable
405
- animatechange="spin"
406
- ></temba-icon>
407
- </temba-tip>
408
-
409
- ${this.currentTicket
410
- ? html`<temba-tip
411
- style="margin-top:5px"
412
- text="Assign"
413
- position="left"
414
- >
415
- <temba-icon
416
- id="assign-button"
417
- name="user"
418
- @click="${() => {
419
- const modax = this.shadowRoot.getElementById(
420
- 'assign-dialog'
421
- ) as Modax;
422
- modax.open = true;
423
- }}"
424
- clickable
425
- ></temba-icon>
426
- </temba-tip>
427
- <temba-tip
428
- style="margin-top:5px"
429
- text="Add Note"
430
- position="left"
431
- >
432
- <temba-icon
433
- id="add-note-button"
434
- name="edit"
435
- @click="${() => {
436
- const note = this.shadowRoot.getElementById(
437
- 'note-dialog'
438
- ) as Modax;
439
- note.open = true;
440
- }}"
441
- clickable
442
- ></temba-icon>
443
- </temba-tip>`
444
- : null}
445
- `
446
- : null}
407
+ ${
408
+ this.currentContact
409
+ ? html`
410
+ <temba-tip
411
+ style="margin-top:5px"
412
+ text="${this.showDetails ? 'Hide Details' : 'Show Details'}"
413
+ position="left"
414
+ hideOnChange
415
+ >
416
+ <temba-icon
417
+ id="details-button"
418
+ name="${this.showDetails ? 'chevrons-left' : 'sidebar'}"
419
+ @click="${this.handleDetailSlider}"
420
+ clickable
421
+ animatechange="spin"
422
+ ></temba-icon>
423
+ </temba-tip>
424
+
425
+ ${this.currentTicket
426
+ ? html`<temba-tip
427
+ style="margin-top:5px"
428
+ text="Assign"
429
+ position="left"
430
+ >
431
+ <temba-icon
432
+ id="assign-button"
433
+ name="user"
434
+ @click="${() => {
435
+ const modax = this.shadowRoot.getElementById(
436
+ 'assign-dialog'
437
+ ) as Modax;
438
+ modax.open = true;
439
+ }}"
440
+ clickable
441
+ ></temba-icon>
442
+ </temba-tip>
443
+ <temba-tip
444
+ style="margin-top:5px"
445
+ text="Add Note"
446
+ position="left"
447
+ >
448
+ <temba-icon
449
+ id="add-note-button"
450
+ name="edit"
451
+ @click="${() => {
452
+ const note = this.shadowRoot.getElementById(
453
+ 'note-dialog'
454
+ ) as Modax;
455
+ note.open = true;
456
+ }}"
457
+ clickable
458
+ ></temba-icon>
459
+ </temba-tip>`
460
+ : null}
461
+ `
462
+ : null
463
+ }
447
464
  </div>
448
465
  </div>
449
466
 
450
- ${this.currentTicket
451
- ? html`<temba-modax
467
+ ${
468
+ this.currentTicket
469
+ ? html`<temba-modax
452
470
  header="Add Note"
453
471
  id="note-dialog"
454
472
  @temba-submitted=${this.refresh}
@@ -460,6 +478,8 @@ export class ContactChat extends RapidElement {
460
478
  @temba-submitted=${this.handleTicketAssigned}
461
479
  endpoint="/ticket/assign/${this.currentTicket.uuid}/"
462
480
  /></temba-modax>`
481
+ : null
482
+ }`
463
483
  : null}
464
484
  `;
465
485
  }
@@ -1,4 +1,5 @@
1
- import { css, html, property, TemplateResult } from 'lit-element';
1
+ import { css, html, TemplateResult } from 'lit';
2
+ import { property } from 'lit/decorators';
2
3
  import { Contact, Group, Ticket } from '../interfaces';
3
4
  import { RapidElement } from '../RapidElement';
4
5
  import { isDate, timeSince, truncate } from '../utils';