@iamproperty/components 5.7.1-beta5 → 6.0.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.
Files changed (63) hide show
  1. package/assets/css/components/barchart.component.css +1 -1
  2. package/assets/css/components/barchart.component.css.map +1 -1
  3. package/assets/css/components/card.css +1 -1
  4. package/assets/css/components/card.css.map +1 -1
  5. package/assets/css/components/card.global.css +1 -1
  6. package/assets/css/components/card.global.css.map +1 -1
  7. package/assets/css/components/charts.config.css +1 -1
  8. package/assets/css/components/charts.config.css.map +1 -1
  9. package/assets/css/components/charts.module.css +1 -1
  10. package/assets/css/components/charts.module.css.map +1 -1
  11. package/assets/css/core.min.css +1 -1
  12. package/assets/css/core.min.css.map +1 -1
  13. package/assets/css/style.min.css +1 -1
  14. package/assets/css/style.min.css.map +1 -1
  15. package/assets/js/components/_global.js +32 -0
  16. package/assets/js/components/accordion/accordion.component.min.js +1 -1
  17. package/assets/js/components/actionbar/actionbar.component.min.js +1 -1
  18. package/assets/js/components/address-lookup/address-lookup.component.min.js +1 -1
  19. package/assets/js/components/applied-filters/applied-filters.component.min.js +1 -1
  20. package/assets/js/components/barchart/barchart.component.js +11 -10
  21. package/assets/js/components/barchart/barchart.component.min.js +4 -6
  22. package/assets/js/components/barchart/barchart.component.min.js.map +1 -1
  23. package/assets/js/components/card/card.component.js +29 -4
  24. package/assets/js/components/card/card.component.min.js +15 -8
  25. package/assets/js/components/card/card.component.min.js.map +1 -1
  26. package/assets/js/components/carousel/carousel.component.min.js +1 -1
  27. package/assets/js/components/collapsible-side/collapsible-side.component.min.js +1 -1
  28. package/assets/js/components/fileupload/fileupload.component.min.js +1 -1
  29. package/assets/js/components/filterlist/filterlist.component.min.js +1 -1
  30. package/assets/js/components/header/header.component.min.js +1 -1
  31. package/assets/js/components/inline-edit/inline-edit.component.min.js +1 -1
  32. package/assets/js/components/marketing/marketing.component.min.js +1 -1
  33. package/assets/js/components/multiselect/multiselect.component.min.js +1 -1
  34. package/assets/js/components/nav/nav.component.min.js +1 -1
  35. package/assets/js/components/notification/notification.component.min.js +1 -1
  36. package/assets/js/components/pagination/pagination.component.min.js +1 -1
  37. package/assets/js/components/search/search.component.min.js +1 -1
  38. package/assets/js/components/slider/slider.component.min.js +1 -1
  39. package/assets/js/components/table/table.component.min.js +1 -1
  40. package/assets/js/components/tabs/tabs.component.min.js +1 -1
  41. package/assets/js/dynamic.min.js +1 -1
  42. package/assets/js/modules/chart.module.js +68 -88
  43. package/assets/js/scripts.bundle.js +22 -15
  44. package/assets/js/scripts.bundle.js.map +1 -1
  45. package/assets/js/scripts.bundle.min.js +2 -2
  46. package/assets/js/scripts.bundle.min.js.map +1 -1
  47. package/assets/js/tests/chart.spec.js +57 -0
  48. package/assets/sass/components/barchart.component.scss +47 -3
  49. package/assets/sass/components/card.global.scss +7 -1
  50. package/assets/sass/components/card.scss +114 -45
  51. package/assets/sass/components/charts.config.scss +15 -10
  52. package/assets/sass/components/charts.module.scss +19 -4
  53. package/assets/sass/elements/badge-tag.scss +6 -0
  54. package/assets/sass/elements/dialog.scss +6 -2
  55. package/assets/ts/components/_global.ts +40 -0
  56. package/assets/ts/components/barchart/barchart.component.ts +13 -19
  57. package/assets/ts/components/card/card.component.ts +35 -4
  58. package/assets/ts/modules/chart.module.ts +89 -108
  59. package/assets/ts/tests/chart.spec.ts +77 -0
  60. package/dist/components.es.js +11 -11
  61. package/dist/components.umd.js +54 -47
  62. package/package.json +1 -1
  63. package/src/components/BarChart/BarChart.vue +1 -1
@@ -0,0 +1,57 @@
1
+ // @ts-nocheck
2
+ import '@testing-library/jest-dom';
3
+ import { getChartData } from "../modules/chart.module.js";
4
+ import "expect-puppeteer";
5
+ import iamBarChart from "../components/barchart/barchart.component.js";
6
+ describe('The bar chart component', () => {
7
+ if (!window.customElements.get(`iam-barchart`))
8
+ window.customElements.define(`iam-barchart`, iamBarChart);
9
+ document.body.innerHTML = `
10
+ <iam-barchart>
11
+ <table>
12
+ <thead>
13
+ <tr>
14
+ <th>Items</th>
15
+ <th>Value</th>
16
+ </tr>
17
+ </thead>
18
+ <tbody>
19
+ <tr>
20
+ <td>Item 1</td>
21
+ <td>300</td>
22
+ </tr>
23
+ <tr>
24
+ <td>Item 2</td>
25
+ <td>150</td>
26
+ </tr>
27
+ <tr>
28
+ <td>Item 3</td>
29
+ <td>100</td>
30
+ </tr>
31
+ </tbody>
32
+ </table>
33
+ </iam-barchart>`;
34
+ test('should create the min attribute as 0', () => {
35
+ let component = document.querySelector('iam-barchart');
36
+ let { min } = getChartData(component);
37
+ expect(min).toEqual(0);
38
+ });
39
+ test('should equal the largest single value', () => {
40
+ let component = document.querySelector('iam-barchart');
41
+ let { max } = getChartData(component);
42
+ expect(max).toEqual(300);
43
+ });
44
+ test('should equal the largest single value', () => {
45
+ let component = document.querySelector('iam-barchart');
46
+ let { max } = getChartData(component);
47
+ expect(max).toEqual(300);
48
+ });
49
+ test('should have the class of .chart--fit-content added as there is less than 10 bars', () => {
50
+ let component = document.querySelector('iam-barchart');
51
+ expect(component.classList).toContain("chart--fit-content");
52
+ });
53
+ test('should have the class of .chart--no-scale added as there is less than 5 bars', () => {
54
+ let component = document.querySelector('iam-barchart');
55
+ expect(component.classList).toContain("chart--no-scale");
56
+ });
57
+ });
@@ -12,6 +12,7 @@
12
12
 
13
13
  .chart__outer > input[type="checkbox"]:nth-of-type(#{$i}):not(:checked) ~ .chart__wrapper table tbody tr td:not(:first-child):nth-child(#{$i+1}) {
14
14
  display: none;
15
+ opacity: 0;
15
16
  }
16
17
  }
17
18
  // #endregion
@@ -85,6 +86,13 @@
85
86
  display: block!important;
86
87
  height: var(--bar-height, #{rem(24)});
87
88
  line-height: var(--bar-height, #{rem(24)});
89
+ max-width: var(--xaxis-max-width, none);
90
+
91
+ > *:not([popover]) {
92
+ max-width: 100%;
93
+ text-overflow: ellipsis;
94
+ overflow: hidden;
95
+ }
88
96
  }
89
97
  }
90
98
 
@@ -96,11 +104,14 @@
96
104
  opacity: 0;
97
105
  pointer-events: none;
98
106
  white-space: nowrap;
107
+
108
+ width: var(--xaxis-max-width, none);
99
109
  }
100
110
 
101
111
  &:has(td .tooltip) .chart__wrapper[data-longest-label]:before {
102
112
 
103
113
  padding-right: 2em;
114
+ width: calc(var(--xaxis-max-width, none) - 1rem);
104
115
  }
105
116
 
106
117
  .chart__wrapper[data-longest-label] table tbody tr td:first-child {
@@ -114,7 +125,7 @@
114
125
  left: auto!important;
115
126
  right: 100%!important;
116
127
  padding-right: 0.5em;
117
-
128
+ width: fit-content;
118
129
  }
119
130
 
120
131
 
@@ -126,7 +137,7 @@
126
137
  // #endregion
127
138
 
128
139
  // #region stacked
129
- .chart--stacked .chart__wrapper {
140
+ :host(.chart--stacked) .chart__wrapper {
130
141
  table tbody tr {
131
142
  --bar-gap: 0;
132
143
  flex-direction: column-reverse;
@@ -138,6 +149,29 @@
138
149
  }
139
150
  }
140
151
  }
152
+ :host(.chart--stacked.chart--horizontal) .chart__wrapper table tbody tr {
153
+
154
+ flex-direction: row;
155
+
156
+ &::after {
157
+ content: attr(data-numeric);
158
+ position: absolute;
159
+ opacity: 1 !important;
160
+ bottom: 100%;
161
+ left: 50%;
162
+ transform: translate(-50%, 0);
163
+ display: block !important;
164
+ height: fit-content;
165
+ margin: 0;
166
+ bottom: 50%;
167
+ left: calc(var(--percent) + .5rem);
168
+ transform: translate(0, 50%);
169
+ }
170
+
171
+ td:after {
172
+ content: none;
173
+ }
174
+ }
141
175
  // #endregion
142
176
 
143
177
  // #region animation
@@ -267,13 +301,23 @@
267
301
  }
268
302
  }
269
303
 
304
+ :host(.chart--fit-content:not(.chart--horizontal).chart--no-scale) {
305
+ --fc-group-width: #{rem(22)};
306
+ --fc-value-width: #{rem(24)};
307
+
308
+ table{
309
+ height: var(--chart-height-lg-set,#{rem(120)});
310
+ }
311
+
312
+ }
313
+
270
314
  .chart__wrapper {
271
315
 
272
316
 
273
317
  @container (min-width: #{em($device-xs-width,16)}) {
274
318
  --fc-group-width: #{rem(22)};
275
319
  --fc-value-width: #{rem(24)};
276
-
320
+
277
321
  }
278
322
  }
279
323
 
@@ -4,6 +4,8 @@
4
4
 
5
5
  iam-card {
6
6
 
7
+ margin-bottom: 1.5rem;
8
+ display: block;
7
9
 
8
10
  @supports not selector(:has(*)) {
9
11
 
@@ -67,6 +69,10 @@ iam-card {
67
69
  }
68
70
  }
69
71
 
72
+ :is(a, button, label) iam-card{
73
+ margin-bottom: 0!important;
74
+ }
75
+
70
76
 
71
77
  [data-select-container]:has([type="checkbox"]:checked) iam-card {
72
78
 
@@ -93,4 +99,4 @@ iam-card {
93
99
  a[target="_blank"] iam-card::part(card) {
94
100
 
95
101
  --icon: var(--icon-new-tab);
96
- }
102
+ }
@@ -55,59 +55,61 @@
55
55
  }
56
56
  }
57
57
 
58
- &:before,
59
- &:after {
60
- content: "";
61
- position: absolute;
62
- right: var(--card-icon-right);
63
- bottom: var(--card-bottom-padding);
64
- height: rem(24);
65
- width: rem(24);
66
- background: var(--colour-warning);
67
- border-radius: 50%;
68
- }
58
+ &:not(:has(.dialog__wrapper)){
69
59
 
70
- &:after {
71
- background: var(--colour-primary-theme);
72
- mask-image: var(--icon,var(--icon-arrow));
73
- mask-size: 50%;
74
- mask-repeat: no-repeat;
75
- mask-position: 50% 50%;
76
- -webkit-mask-image: var(--icon,var(--icon-arrow));
77
- -webkit-mask-size: 50%;
78
- -webkit-mask-repeat: no-repeat;
79
- -webkit-mask-position: 50% 50%;
80
- z-index: 2;
81
- }
60
+ &:before,
61
+ &:after {
62
+ content: "";
63
+ position: absolute;
64
+ right: var(--card-icon-right);
65
+ bottom: var(--card-bottom-padding);
66
+ height: rem(24);
67
+ width: rem(24);
68
+ background: var(--colour-warning);
69
+ border-radius: 50%;
70
+ }
82
71
 
83
- &:is(:hover,:focus,.hover) {
84
- --hover-outline-colour-default: var(--colour, var(--colour-primary));
85
- outline: 2px solid var(--hover-outline-colour, var(--hover-outline-colour-default));
86
- outline-offset: -2px;
87
- }
88
-
89
- // Update arrow cololur
90
- &:not([class*="colour-"]):is(:hover,:focus,.hover,:active, .active) {
72
+ &:after {
73
+ background: var(--colour-primary-theme);
74
+ mask-image: var(--icon,var(--icon-arrow));
75
+ mask-size: 50%;
76
+ mask-repeat: no-repeat;
77
+ mask-position: 50% 50%;
78
+ -webkit-mask-image: var(--icon,var(--icon-arrow));
79
+ -webkit-mask-size: 50%;
80
+ -webkit-mask-repeat: no-repeat;
81
+ -webkit-mask-position: 50% 50%;
82
+ z-index: 2;
83
+ }
91
84
 
92
- &:before {
93
- background: var(--hover-icon-bg, var(--colour-primary-theme));
85
+ &:is(:hover,:focus,.hover) {
86
+ --hover-outline-colour-default: var(--colour, var(--colour-primary));
87
+ outline: 2px solid var(--hover-outline-colour, var(--hover-outline-colour-default));
88
+ outline-offset: -2px;
94
89
  }
95
- &:after {
96
- background: var(--hover-icon-colour, #ffffff);
90
+
91
+ // Update arrow cololur
92
+ &:not([class*="colour-"]):is(:hover,:focus,.hover,:active, .active) {
93
+
94
+ &:before {
95
+ background: var(--hover-icon-bg, var(--colour-primary-theme));
96
+ }
97
+ &:after {
98
+ background: var(--hover-icon-colour, #ffffff);
99
+ }
97
100
  }
98
- }
99
101
 
100
- &:is(:active, .active){
101
- --card-icon-right: var(--card-icon-right-overide,0.5rem);
102
- outline: none;
103
- }
102
+ &:is(:active, .active){
103
+ --card-icon-right: var(--card-icon-right-overide,0.5rem);
104
+ outline: none;
105
+ }
104
106
 
105
- &:is(:active){
106
- background: #FCFCFC;
107
+ &:is(:active){
108
+ background: #FCFCFC;
109
+ }
110
+
107
111
  }
108
112
 
109
-
110
-
111
113
  span{
112
114
  display: block;
113
115
  font-weight: bold;
@@ -534,4 +536,71 @@ slot[name="btns"] {
534
536
  margin: 0!important;
535
537
  }
536
538
 
537
- //#endregion
539
+ //#endregion
540
+
541
+ .dialog__wrapper {
542
+ position: absolute;
543
+ right: 1rem;
544
+ bottom: 2rem;
545
+ min-width: 3rem !important;
546
+ left: auto;
547
+ z-index: 999;
548
+
549
+ > dialog {
550
+
551
+ display: var(--menu-display, none);
552
+ position: fixed;
553
+ top: anchor(top);
554
+ position-anchor: --anchor-el;
555
+ left: anchor(right);
556
+ right: auto;
557
+ margin: 0 0 0 #{rem(4)};
558
+ padding: rem(16);
559
+
560
+
561
+ &::backdrop {
562
+ display: none;
563
+ }
564
+ }
565
+
566
+ > dialog:popover-open {
567
+
568
+ display: block!important;
569
+ }
570
+
571
+ &:has(dialog:popover-open) > button {
572
+ background-color: var(--colour);
573
+ }
574
+
575
+ > button {
576
+ margin: 0;
577
+ anchor-name: --anchor-el;
578
+
579
+ &:not(:hover,:focus,:focus-within,:active){
580
+
581
+ background: var(--ellipsis-bg);
582
+ }
583
+ }
584
+ }
585
+ ::slotted([slot="actions"]){
586
+ border: none !important;
587
+ margin: 0 !important;
588
+ display: block!important;
589
+ width: fit-content;
590
+ }
591
+ ::slotted([slot="primary-action"]){
592
+ overflow: hidden;
593
+ background-color: transparent;
594
+ text-indent: -300%;
595
+ position: absolute!important;
596
+ inset: 0;
597
+ margin: 0!important;
598
+ z-index: 99;
599
+ border: none;
600
+ }
601
+ ::slotted([slot="primary-action"]:is(:hover,:focus,.hover)) {
602
+ --hover-outline-colour-default: var(--colour, var(--colour-primary));
603
+ outline: 2px solid var(--hover-outline-colour, var(--hover-outline-colour-default));
604
+ outline-offset: -2px;
605
+ border-radius: var(--card-border-radius)!important;
606
+ }
@@ -27,9 +27,9 @@ iam-barchart:not(.chart--horizontal)::part(chart-key) {
27
27
  order: 3;
28
28
  }
29
29
 
30
- iam-barchart:not(.chart--horizontal)::part(key),
31
- iam-barchart:not(.chart--horizontal)::part(key-checked),
32
- iam-barchart:not(.chart--horizontal)::part(key-unchecked) {
30
+ iam-barchart::part(key),
31
+ iam-barchart::part(key-checked),
32
+ iam-barchart::part(key-unchecked) {
33
33
 
34
34
  --key-border-radius: 50%;
35
35
  --btn-border-width: 1px;
@@ -46,21 +46,22 @@ iam-barchart:not(.chart--horizontal)::part(key-unchecked) {
46
46
  color: var(--colour-heading);
47
47
  }
48
48
 
49
- iam-barchart:not(.chart--horizontal)::part(key):is(:hover, :focus, .hover, :focus-within):not([disabled],:active, .active),
50
- iam-barchart:not(.chart--horizontal)::part(key-checked):is(:hover, :focus, .hover, :focus-within):not([disabled],:active, .active),
51
- iam-barchart:not(.chart--horizontal)::part(key-unchecked):is(:hover, :focus, .hover, :focus-within):not([disabled],:active, .active) {
49
+ iam-barchart::part(key):is(:hover, :focus, .hover, :focus-within):not([disabled],:active, .active),
50
+ iam-barchart::part(key-checked):is(:hover, :focus, .hover, :focus-within):not([disabled],:active, .active),
51
+ iam-barchart::part(key-unchecked):is(:hover, :focus, .hover, :focus-within):not([disabled],:active, .active) {
52
52
  background: var(--colour-btn-action-hover-bg);
53
53
  }
54
- iam-barchart:not(.chart--horizontal)::part(key):is(:hover, :focus, .hover, :focus-within),
55
- iam-barchart:not(.chart--horizontal)::part(key-checked):is(:hover, :focus, .hover, :focus-within),
56
- iam-barchart:not(.chart--horizontal)::part(key-unchecked):is(:hover, :focus, .hover, :focus-within){
54
+ iam-barchart::part(key):is(:hover, :focus, .hover, :focus-within),
55
+ iam-barchart::part(key-checked):is(:hover, :focus, .hover, :focus-within),
56
+ iam-barchart::part(key-unchecked):is(:hover, :focus, .hover, :focus-within){
57
57
  background: var(--colour-btn-action-hover-bg);
58
58
  }
59
59
 
60
- iam-barchart:not(.chart--horizontal)::part(key-unchecked) {
60
+ iam-barchart::part(key-unchecked) {
61
61
 
62
62
  opacity: 0.25;
63
63
  }
64
+
64
65
  iam-barchart::part(tooltip) {
65
66
  text-decoration: none!important;
66
67
  }
@@ -76,4 +77,8 @@ iam-barchart::part(tooltip):after{
76
77
  color: var(--colour-primary);
77
78
  border: none;
78
79
 
80
+ }
81
+
82
+ iam-barchart{
83
+ //--xaxis-max-width: 3rem;
79
84
  }
@@ -100,8 +100,8 @@ $chart-height-lg: #{rem(200)}!default;
100
100
 
101
101
  display: flex;
102
102
  flex-direction: column;
103
-
104
- font-weight: var(--chart-font-weight, bold);;
103
+ position: relative;
104
+ font-weight: var(--chart-font-weight, bold);
105
105
  color: var(--chart-text-color, black);
106
106
 
107
107
 
@@ -210,7 +210,6 @@ $chart-height-lg: #{rem(200)}!default;
210
210
  }
211
211
 
212
212
  .key {
213
-
214
213
  margin: 0;
215
214
 
216
215
  &:before {
@@ -234,6 +233,16 @@ $chart-height-lg: #{rem(200)}!default;
234
233
  }
235
234
  }
236
235
 
236
+ @for $i from 1 to 10 {
237
+
238
+ .chart__outer input[type="checkbox"]:focus:nth-child(#{$i}) ~ .chart__key .key:nth-child(#{$i}) {
239
+ background: var(--colour-btn-action-hover-bg)!important;
240
+ border: var(--btn-border-width) solid var(--colour-muted)!important;
241
+ }
242
+ }
243
+
244
+
245
+
237
246
  // Hide chart keys
238
247
  .chart__outer > input[type="checkbox"]:not(:checked) ~ .chart__key .key {
239
248
 
@@ -418,7 +427,7 @@ $chart-height-lg: #{rem(200)}!default;
418
427
  tbody tr {
419
428
  display: flex;
420
429
  flex-direction: row;
421
- justify-content: var(--chart-bar-alignment ,center);
430
+ justify-content: var(--chart-bar-alignment, left);
422
431
  align-items: flex-end;
423
432
  border: none;
424
433
  width: 100%;
@@ -474,6 +483,12 @@ $chart-height-lg: #{rem(200)}!default;
474
483
  position: relative;
475
484
  padding: 0;
476
485
  background: var(--chart-colour);
486
+
487
+ @media screen and (prefers-color-scheme: dark) {
488
+
489
+ background: color-mix(in oklab, var(--chart-colour), black 20%);
490
+ }
491
+
477
492
  border-top-right-radius: 4px;
478
493
  border-top-left-radius: 4px;
479
494
 
@@ -30,6 +30,12 @@
30
30
 
31
31
  border-radius: rem(6);
32
32
  padding: 0 rem(8);
33
+
34
+ &--rounded {
35
+ border-radius: 1rem;
36
+ min-width: 1.625rem;
37
+ padding: 0;
38
+ }
33
39
  }
34
40
 
35
41
  .tag {
@@ -7,8 +7,7 @@ body:not(.js-enabled) dialog:not([open]):target {
7
7
  }
8
8
 
9
9
  // #region Default styling of both modals and popovers
10
- dialog[open] {
11
-
10
+ dialog {
12
11
  --dialog-padding: #{rem(24)};
13
12
 
14
13
  --mh-padding-inline: var(--dialog-padding);
@@ -22,7 +21,12 @@ dialog[open] {
22
21
  border-radius: rem(10);
23
22
  padding: var(--dialog-padding);
24
23
  outline: var(--contrast-outline-width, 0px) solid var(--colour-primary);
24
+ }
25
+
25
26
 
27
+ dialog[open] {
28
+
29
+
26
30
  display: flex;
27
31
  flex-direction: column;
28
32
 
@@ -0,0 +1,40 @@
1
+ // @ts-nocheck
2
+ export const trackComponentRegistered = (componentName: string) => {
3
+ // Data layer Web component created
4
+ window.dataLayer = window.dataLayer || [];
5
+ window.dataLayer.push({
6
+ "event": "customElementRegistered",
7
+ "element": componentName
8
+ });
9
+ };
10
+
11
+ export const trackComponent = (component:any, componentName:string, trackEvents:any) => {
12
+
13
+ // Data layer Web component created
14
+ window.dataLayer = window.dataLayer || [];
15
+ window.dataLayer.push({
16
+ "event": "customElementAdded",
17
+ "element": componentName
18
+ });
19
+
20
+ trackEvents.forEach((eventName:string) => {
21
+ component.addEventListener(eventName, function(event:any){
22
+
23
+ let eventDetails = {
24
+ "event": eventName,
25
+ "element": componentName,
26
+ "target": event.target
27
+ };
28
+
29
+ Object.keys(event.detail).forEach((eventKey:string) => {
30
+
31
+ const eventDetail = event.detail[eventKey];
32
+ eventDetails[eventKey] = eventDetail;
33
+ });
34
+
35
+ window.dataLayer.push(eventDetails);
36
+ });
37
+ });
38
+
39
+ return true;
40
+ };
@@ -1,9 +1,8 @@
1
1
  // @ts-nocheck
2
2
  import {addClasses,setupChart,setEventListener,setEventObservers,setLongestLabel,setLongestValue,createTooltips} from "../../modules/chart.module";
3
+ import {trackComponent, trackComponentRegistered} from "../_global";
3
4
 
4
-
5
- // TODO: tooltip
6
- // TODO: responsive 'fit-content' classes done through JS
5
+ trackComponentRegistered("iam-barchart");
7
6
 
8
7
  class iamBarChart extends HTMLElement {
9
8
 
@@ -19,7 +18,6 @@ class iamBarChart extends HTMLElement {
19
18
  <style>
20
19
  ${loadCSS}
21
20
  </style>
22
- <slot name="before"></slot>
23
21
  <div class="chart__outer" part="outer">
24
22
  <div class="chart__key" part="chart-key"></div>
25
23
  <div class="chart__wrapper" part="wrapper">
@@ -29,8 +27,7 @@ class iamBarChart extends HTMLElement {
29
27
  </div>
30
28
  </div>
31
29
  <div class="chart__spacer"><span part="spacer"></span</div>
32
- </div>
33
- <slot name="after"></slot>`;
30
+ </div>`;
34
31
 
35
32
  this.shadowRoot.appendChild(template.content.cloneNode(true));
36
33
  }
@@ -38,37 +35,34 @@ class iamBarChart extends HTMLElement {
38
35
  connectedCallback() {
39
36
 
40
37
  const chartComponent = this;
41
-
42
38
  const chartID = `chart-${Date.now()+(Math.floor(Math.random() * 100) + 1)}`;
43
-
44
39
  const orginalTable = this.querySelector('table');
45
40
  const clonedTable = orginalTable.cloneNode(true);
46
-
47
-
48
41
  const chart = this.shadowRoot.querySelector('.chart');
49
42
  const chartOuter = this.shadowRoot.querySelector('.chart__outer');
50
-
43
+ const barCount = chart.querySelectorAll('td:not(:first-child)').length;
51
44
 
52
45
  chart.appendChild(clonedTable);
46
+ addClasses(chartComponent, chartOuter);
53
47
 
54
- addClasses(chartComponent);
48
+ if(barCount <= 10){
55
49
 
50
+ chartComponent.classList.add('chart--fit-content');
51
+ }
56
52
 
57
- const barCount = chart.querySelectorAll('td:not(:first-child)').length;
58
-
59
- if(barCount < 10){
53
+ if(barCount <= 5){
60
54
 
61
- chartComponent.classList.add('chart--fit-content');
62
- chartComponent.classList.add('chart--display-data');
55
+ chartComponent.classList.add('chart--no-scale');
63
56
  }
64
57
 
65
58
  setupChart(chartComponent,chartOuter,clonedTable);
66
59
  setEventObservers(chartComponent,chartOuter);
67
- setEventListener(chartOuter);
60
+ setEventListener(chartComponent,chartOuter);
68
61
  setLongestLabel(chartOuter);
69
62
  setLongestValue(chartOuter);
70
-
71
63
  createTooltips(chartOuter);
64
+
65
+ trackComponent(chartComponent,"iam-barchart",['view-change']);
72
66
  }
73
67
 
74
68
  attributeChangedCallback(attrName, oldVal, newVal) {