@nyaruka/temba-components 0.26.1 → 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 (38) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/demo/index.html +32 -13
  3. package/dist/4f80c187.js +4277 -0
  4. package/dist/index.js +279 -202
  5. package/dist/sw.js +1 -1
  6. package/dist/sw.js.map +1 -1
  7. package/dist/templates/components-body.html +1 -1
  8. package/dist/templates/components-head.html +1 -1
  9. package/out-tsc/src/contacts/ContactChat.js +99 -85
  10. package/out-tsc/src/contacts/ContactChat.js.map +1 -1
  11. package/out-tsc/src/contacts/ContactHistory.js +30 -36
  12. package/out-tsc/src/contacts/ContactHistory.js.map +1 -1
  13. package/out-tsc/src/contacts/events.js +61 -74
  14. package/out-tsc/src/contacts/events.js.map +1 -1
  15. package/out-tsc/src/list/TembaMenu.js +18 -13
  16. package/out-tsc/src/list/TembaMenu.js.map +1 -1
  17. package/out-tsc/src/tabpane/Tab.js +46 -0
  18. package/out-tsc/src/tabpane/Tab.js.map +1 -0
  19. package/out-tsc/src/tabpane/TabPane.js +109 -0
  20. package/out-tsc/src/tabpane/TabPane.js.map +1 -0
  21. package/out-tsc/temba-modules.js +4 -0
  22. package/out-tsc/temba-modules.js.map +1 -1
  23. package/out-tsc/test/temba-contact-history.test.js +9 -7
  24. package/out-tsc/test/temba-contact-history.test.js.map +1 -1
  25. package/package.json +1 -1
  26. package/screenshots/truth/contacts/history-expanded.png +0 -0
  27. package/screenshots/truth/contacts/history.png +0 -0
  28. package/screenshots/truth/list/menu-submenu.png +0 -0
  29. package/src/contacts/ContactChat.ts +113 -94
  30. package/src/contacts/ContactHistory.ts +57 -59
  31. package/src/contacts/events.ts +61 -75
  32. package/src/list/TembaMenu.ts +19 -14
  33. package/src/tabpane/Tab.ts +42 -0
  34. package/src/tabpane/TabPane.ts +113 -0
  35. package/temba-modules.ts +4 -0
  36. package/test/temba-contact-history.test.ts +9 -7
  37. package/test-assets/style.css +6 -0
  38. package/dist/e477aebd.js +0 -4200
package/temba-modules.ts CHANGED
@@ -23,6 +23,8 @@ import { Tip } from './src/tip/Tip';
23
23
  import { TembaMenu } from './src/list/TembaMenu';
24
24
  import { Anchor } from './src/anchor/Anchor';
25
25
  import { Dropdown } from './src/dropdown/Dropdown';
26
+ import { TabPane } from './src/tabpane/TabPane';
27
+ import { Tab } from './src/tabpane/Tab';
26
28
 
27
29
  export function addCustomElement(name: string, comp: any) {
28
30
  if (!window.customElements.get(name)) {
@@ -56,3 +58,5 @@ addCustomElement('temba-menu', TembaMenu);
56
58
  addCustomElement('temba-contact-search', ContactSearch);
57
59
  addCustomElement('temba-icon', VectorIcon);
58
60
  addCustomElement('temba-dropdown', Dropdown);
61
+ addCustomElement('temba-tabs', TabPane);
62
+ addCustomElement('temba-tab', Tab);
@@ -14,7 +14,7 @@ export const createHistory = async (def: string) => {
14
14
  const parentNode = document.createElement('div');
15
15
  parentNode.setAttribute(
16
16
  'style',
17
- 'width: 500px;height:750px;display:flex;flex-direction:column'
17
+ 'width: 500px;height:750px;display:flex;flex-direction:column;flex-grow:1;min-height:0;'
18
18
  );
19
19
  const history = (await fixture(def, { parentNode })) as ContactHistory;
20
20
 
@@ -29,7 +29,8 @@ export const createHistory = async (def: string) => {
29
29
  return history;
30
30
  };
31
31
 
32
- const getHistoryHTML = (attrs: any = {}) =>
32
+ const getHistoryHTML = (attrs: any = {} as any) =>
33
+ // attrs = "min-height:0;display:flex;flex-grow:1;flex-direction:column";
33
34
  getHTML('temba-contact-history', attrs);
34
35
 
35
36
  const getHistoryClip = (ele: ContactHistory) => {
@@ -74,10 +75,11 @@ describe('temba-contact-history', () => {
74
75
  // we should have scrolled to the bottom
75
76
  const events = history.shadowRoot.querySelector('.events');
76
77
  const top = events.scrollHeight - events.getBoundingClientRect().height;
77
- expect(top).to.equal(223);
78
+
79
+ expect(top).to.equal(539);
78
80
 
79
81
  // make sure we actually scrolled to there
80
- // expect(events.scrollTop).to.equal(top - 1);
82
+ expect(events.scrollTop).to.equal(top - 4);
81
83
 
82
84
  await assertScreenshot('contacts/history', getHistoryClip(history));
83
85
  });
@@ -90,15 +92,15 @@ describe('temba-contact-history', () => {
90
92
  );
91
93
 
92
94
  // our groups with collapsed events
93
- const groups = [3, 11];
95
+ const groups = [3, 5, 7];
94
96
  for (const idx of groups) {
95
97
  const group = history.shadowRoot.querySelector(
96
- `[data-group-index='${idx}']`
98
+ `.event-count[data-group-index='${idx}']`
97
99
  ) as HTMLDivElement;
98
100
  group.click();
99
101
  }
100
102
 
101
- await waitFor(1000);
103
+ await waitFor(500);
102
104
 
103
105
  await assertScreenshot(
104
106
  'contacts/history-expanded',
@@ -169,6 +169,12 @@ temba-button.light.active {
169
169
  --button-bg-img: linear-gradient(to bottom, transparent, rgba(0,0,0,.02));
170
170
  }
171
171
 
172
+ temba-contact-history {
173
+ min-height:0;
174
+ display:flex;
175
+ flex-grow:1;
176
+ flex-direction:column;
177
+ }
172
178
 
173
179
  temba-select:focus {
174
180
  outline: none;