toggle-components-library 1.22.8 → 1.22.9

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.
@@ -1,3 +1,4 @@
1
+ import styleInfo from '../../../src/sass/includes/_as_variables.scss';
1
2
 
2
3
  export const mixins = {
3
4
  data(){
@@ -100,3 +101,82 @@ export const mixins = {
100
101
 
101
102
  }
102
103
  }
104
+
105
+ export const charts = {
106
+
107
+ data: function() {
108
+ return {
109
+
110
+ defcolors: [
111
+ '#FF9494','#FFCA8A','#FCFF9D','#B2FFA2','#81F4FF','#85B4FF','#A898FF'
112
+ ]
113
+ }
114
+ },
115
+ methods: {
116
+
117
+ /*
118
+ * Calculates the trend impact
119
+ *
120
+ * @param {Array} [values] [the array of values to be calculated]
121
+ * @param {Number} [percentage] [Percentage that dertermiens if it's success, neutral or negative ]
122
+ *
123
+ * @return { {Integer} 1, 0,-1 }
124
+ */
125
+ calcTrendImpact(values, percentageBase){
126
+
127
+ // If all values in the values array are 0 return 0;
128
+ if (values.every((val) => val === 0)){
129
+ return 0;
130
+ }
131
+
132
+ let sum = 0
133
+ values.forEach(val => {
134
+ sum = sum + val;
135
+ });
136
+
137
+ let average = sum/values.length;
138
+
139
+ // the acceptable difference before it's trending positive or negatively
140
+ let difference = average/100 * percentageBase;
141
+
142
+ // lower 'keeping steady value'
143
+ let lower_base = average-difference;
144
+ // higher 'keeping steady value'
145
+ let upper_base = average+difference;
146
+
147
+ let last_value = values[values.length - 1];
148
+
149
+ if(last_value >= upper_base)
150
+ return 1;
151
+ if(last_value <= lower_base)
152
+ return -1;
153
+ return 0;
154
+
155
+ },
156
+
157
+ //return an array of default colors
158
+ getDefaultColors() {
159
+ return this.$data.defcolors.sort(() => Math.random() - 0.5);
160
+ },
161
+
162
+ //return a specific color
163
+ getColor(color) {
164
+ switch (color) {
165
+ case 'black':
166
+ return styleInfo.toggleMetricLabelBlack;
167
+ case 'gray':
168
+ return styleInfo.toggleMetricLabelGray;
169
+ case 'green':
170
+ return styleInfo.toggleMetricChartGreen;
171
+ case 'amber':
172
+ return styleInfo.toggleMetricChartAmber;
173
+ case 'red':
174
+ return styleInfo.toggleMetricChartRed;
175
+ case 'blue':
176
+ return styleInfo.toggleMetricChartBlue;
177
+ case 'additional':
178
+ return styleInfo.toggleMetricChartAdditional;
179
+ }
180
+ }
181
+ }
182
+ }
package/src/index.js CHANGED
@@ -61,6 +61,12 @@ import ToggleInputNumberUnit from "./components/forms/ToggleInputNumberUnit.vue"
61
61
  import ToggleInputLabelLeft from "./components/forms/ToggleInputLabelLeft.vue";
62
62
  import ToggleInputMultiSelect from "./components/forms/ToggleInputMultiSelect.vue";
63
63
 
64
+ import ToggleMetricSingleMetric from "./components/metrics/ToggleMetricSingleMetric.vue";
65
+ import ToggleMetricSparkLine from "./components/metrics/ToggleMetricSparkLine.vue";
66
+ import ToggleMetricBarChart from "./components/metrics/ToggleMetricBarChart.vue";
67
+ import ToggleMetricPieChart from "./components/metrics/ToggleMetricPieChart.vue";
68
+ import ToggleMetricFunnelChart from "./components/metrics/ToggleMetricFunnelChart.vue";
69
+
64
70
  import './sass/main.scss';
65
71
 
66
72
  const Components = {
@@ -111,7 +117,12 @@ const Components = {
111
117
  ToggleInputMultiSelect,
112
118
  ToggleMultiTierSideNav,
113
119
  ToggleMultiTierSideNavItem,
114
- ToggleMultiTierSideSubNav
120
+ ToggleMultiTierSideSubNav,
121
+ ToggleMetricSingleMetric,
122
+ ToggleMetricSparkLine,
123
+ ToggleMetricBarChart,
124
+ ToggleMetricPieChart,
125
+ ToggleMetricFunnelChart
115
126
  }
116
127
 
117
128
  Object.keys(Components).forEach(name => {
@@ -24,4 +24,12 @@
24
24
  &.inactive {
25
25
  background-color: $toggle-button-disabled;
26
26
  }
27
+
28
+ &.warning {
29
+ background-color: $toggle-button-amber;
30
+ }
31
+
32
+ &.empty {
33
+ background-color: $toggle-placeholder-grey;
34
+ }
27
35
  }
@@ -3,7 +3,7 @@
3
3
  top:0;
4
4
  left:0;
5
5
  height: 100vh;
6
- width:100vh;
6
+ width:100vw;
7
7
  z-index:10;
8
8
  background: white;
9
9
  position: fixed !important;
@@ -0,0 +1,117 @@
1
+ /* Single metric */
2
+
3
+ .toggle-metric {
4
+
5
+ @include toggle-global-font-config;
6
+ font-size: 1.5rem;
7
+ font-weight: 800;
8
+ margin: 0;
9
+
10
+ &.metric-label {
11
+ font-size: 1.2rem;
12
+ color: $toggle-metric-label-blue;
13
+ }
14
+
15
+ &.metric-value {
16
+ font-size: 275%;
17
+ color: $toggle-metric-label-black;
18
+ }
19
+ }
20
+
21
+
22
+ /* Funnel */
23
+ .toggle-metric-funnel-container {
24
+ grid-template-rows: auto;
25
+ grid-template-columns: 1fr 1fr 1fr 1fr;
26
+ display: grid;
27
+ grid-auto-flow: column;
28
+
29
+ }
30
+
31
+ .funnel-grid-svg {
32
+ min-height: 12rem;
33
+ background: transparent url('../assets/img/funnel.svg') no-repeat padding-box bottom;
34
+ background-size: 100% 100%;
35
+ grid-row-start: 2;
36
+ grid-column-start: 1;
37
+ grid-row-end: 3;
38
+ grid-column-end: 5;
39
+ }
40
+
41
+ .funnel-grid-1 {
42
+ grid-row-start: 1;
43
+ grid-column-start: 1;
44
+ grid-row-end: 2;
45
+ grid-column-end: 2;
46
+ }
47
+
48
+ .funnel-grid-2 {
49
+ grid-row-start: 1;
50
+ grid-column-start: 2;
51
+ grid-row-end: 2;
52
+ grid-column-end: 3;
53
+ }
54
+
55
+ .funnel-grid-3 {
56
+ grid-row-start: 1;
57
+ grid-column-start: 3;
58
+ grid-row-end: 2;
59
+ grid-column-end: 4;
60
+ }
61
+
62
+ .funnel-grid-4 {
63
+ grid-row-start: 1;
64
+ grid-column-start: 4;
65
+ grid-row-end: 2;
66
+ grid-column-end: 5;
67
+ }
68
+
69
+ .funnel-grid-5 {
70
+ grid-row-start: 2;
71
+ grid-column-start: 1;
72
+ grid-row-end: 3;
73
+ grid-column-end: 2;
74
+ display: flex;
75
+ }
76
+
77
+ .funnel-grid-6 {
78
+ grid-row-start: 2;
79
+ grid-column-start: 2;
80
+ grid-row-end: 3;
81
+ grid-column-end: 3;
82
+ display: flex;
83
+ }
84
+
85
+ .funnel-grid-7 {
86
+ grid-row-start: 2;
87
+ grid-column-start: 3;
88
+ grid-row-end: 3;
89
+ grid-column-end: 4;
90
+ display: flex;
91
+ }
92
+
93
+ .funnel-grid-8 {
94
+ grid-row-start: 2;
95
+ grid-column-start: 4;
96
+ grid-row-end: 3;
97
+ grid-column-end: 5;
98
+ display: flex;
99
+ }
100
+
101
+ .funnel-spark-line, .funnel-single-metric {
102
+ margin-right: 1rem;
103
+ border-right: 1px solid #BCDBEE;
104
+
105
+ &:nth-child(5), &:last-child {
106
+ border: 0;
107
+ }
108
+ }
109
+
110
+ .funnel-single-metric > * .toggle-metric {
111
+ font-size: 150%;
112
+ }
113
+
114
+ .funnel-single-metric-container {
115
+ margin-left: 40%;
116
+ align-self: center;
117
+ }
@@ -180,9 +180,13 @@
180
180
  list-style: none;
181
181
  font-family: $toggle-font-family;
182
182
  font-size: 1.1rem;
183
- font-weight: bold;
183
+ font-weight: bold !important;
184
184
  padding-bottom: 0.25rem;
185
185
 
186
+ a, span{
187
+ font-weight: bold !important;
188
+ }
189
+
186
190
  &.active {
187
191
  > a, > span {
188
192
  background: #FFF;
@@ -39,11 +39,30 @@ $toggle-button-success:$toggle-success-green;
39
39
  $toggle-button-abort:$toggle-error-red;
40
40
  $toggle-button-neutral:$toggle-light-blue;
41
41
  $toggle-button-disabled:#d6d6d6;
42
+ $toggle-button-amber: #E6A831;
43
+
44
+ /* metrics */
45
+ $toggle-metric-label-blue: #477EF6;
46
+ $toggle-metric-label-black: #354B64;
47
+ $toggle-metric-label-gray: #F1F5F6;
48
+ $toggle-metric-chart-blue: #B9D9ED;
49
+ $toggle-metric-chart-green: #68B916;
50
+ $toggle-metric-chart-red: #F45959;
51
+ $toggle-metric-chart-amber: #E6A831;
52
+ $toggle-metric-chart-additional: #deafef;
42
53
 
43
54
  :export {
44
55
  toggleblue : $toggle-blue;
45
56
  togglelightblue: $toggle-light-blue;
46
57
  togglewhite : $toggle-white;
47
58
  toggleinputcolour : $toggle-input-colour;
59
+
60
+ toggleMetricLabelBlue : $toggle-metric-label-blue;
61
+ toggleMetricLabelGray : $toggle-metric-label-gray;
62
+ toggleMetricLabelBlack : $toggle-metric-label-black;
63
+ toggleMetricChartGreen : $toggle-metric-chart-green;
64
+ toggleMetricChartAmber : $toggle-metric-chart-amber;
65
+ toggleMetricChartRed : $toggle-metric-chart-red;
66
+ toggleMetricChartAdditional : $toggle-metric-chart-additional;
48
67
 
49
68
  }
@@ -18,3 +18,4 @@
18
18
  @import "./includes/_as_navs.scss";
19
19
  @import "./includes/_as_elements.scss";
20
20
  @import "./includes/_as_notifications.scss";
21
+ @import "./includes/_as_metrics.scss";