toggle-components-library 1.36.1-beta.6 → 1.36.1-beta.7

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/dist/img/airship-feedback-hover.a207c947.svg +10 -0
  2. package/dist/img/airship-feedback.1f7c858c.svg +10 -0
  3. package/dist/toggle-components-library.common.js +298 -370
  4. package/dist/toggle-components-library.common.js.map +1 -1
  5. package/dist/toggle-components-library.css +1 -1
  6. package/dist/toggle-components-library.umd.js +298 -370
  7. package/dist/toggle-components-library.umd.js.map +1 -1
  8. package/dist/toggle-components-library.umd.min.js +1 -1
  9. package/dist/toggle-components-library.umd.min.js.map +1 -1
  10. package/package-lock.json +20285 -0
  11. package/package.json +1 -1
  12. package/src/assets/icons/airship-feedback-hover.svg +10 -0
  13. package/src/assets/icons/airship-feedback.svg +10 -0
  14. package/src/components/buttons/ToggleMetricsButton.vue +22 -3
  15. package/src/components/cards/ToggleCommentCard.vue +55 -0
  16. package/src/components/carousel/ToggleCarousel.vue +29 -16
  17. package/src/components/carousel/ToggleCarouselSlide.vue +1 -1
  18. package/src/components/forms/ToggleDatePicker.vue +3 -7
  19. package/src/components/forms/ToggleInputCurrency.vue +3 -8
  20. package/src/components/forms/ToggleInputSelect.vue +7 -13
  21. package/src/components/forms/ToggleInputText.vue +6 -15
  22. package/src/components/metrics/ToggleMetricSingleMetric.vue +12 -7
  23. package/src/components/metrics/ToggleMetricSparkLine.vue +7 -3
  24. package/src/components/mixins/mixins.js +2 -2
  25. package/src/components/tables/ToggleTable.vue +49 -114
  26. package/src/index.js +3 -4
  27. package/src/sass/includes/_as_buttons.scss +47 -4
  28. package/src/sass/includes/_as_cards.scss +33 -0
  29. package/src/sass/includes/_as_carousels.scss +12 -0
  30. package/src/sass/includes/_as_inputs.scss +836 -854
  31. package/src/sass/includes/_as_metrics.scss +5 -0
  32. package/src/sass/includes/_as_navs.scss +18 -2
  33. package/src/sass/includes/_as_table.scss +163 -163
  34. package/src/sass/main.scss +0 -1
  35. package/dist/img/contacts-greyblue.ef6f8a9a.svg +0 -1
  36. package/dist/img/contacts-white.95d07c7a.svg +0 -1
  37. package/src/components/statusbar/ToggleStatusBar.vue +0 -73
  38. package/src/sass/includes/_as_statusbar.scss +0 -179
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toggle-components-library",
3
- "version": "1.36.1-beta.6",
3
+ "version": "1.36.1-beta.7",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -0,0 +1,10 @@
1
+ <svg id="Group_10" data-name="Group 10" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="624.048" height="499" viewBox="0 0 624.048 499">
2
+ <defs>
3
+ <clipPath id="clip-path">
4
+ <rect id="Rectangle_25" data-name="Rectangle 25" width="624.048" height="499" fill="none"/>
5
+ </clipPath>
6
+ </defs>
7
+ <g id="Group_9" data-name="Group 9" clip-path="url(#clip-path)">
8
+ <path id="Path_3" data-name="Path 3" d="M617.3,465.069l-.384-.318c-.385-.317-.9-.738-1.674-1.49-1.419-1.279-3.616-3.309-6.36-6.112a225.664,225.664,0,0,1-20.162-23.534c-.136-.182-.271-.367-.406-.55-22.957-31.214-26.261-72.555-9.486-107.484,16.327-34,23.783-71.208,20.13-109.472C586.148,81.9,441.91-14.07,276.747,1.694S-11.9,138.983.914,273.192,157.963,503.371,323.126,487.608a364.7,364.7,0,0,0,89.545-20,77.522,77.522,0,0,1,58.556,2.224,367.136,367.136,0,0,0,38.334,14.95c29.035,9.42,63.567,16.569,96.922,13.5A19.281,19.281,0,0,0,622.561,486.8a18.785,18.785,0,0,0-5.261-21.731m-446.79-153.1A50.455,50.455,0,1,1,216.243,257.2a50.456,50.456,0,0,1-45.733,54.772m138.931-12.493a50.454,50.454,0,1,1,45.734-54.77,50.454,50.454,0,0,1-45.734,54.77m134.991-12.137a50.455,50.455,0,1,1,45.733-54.769,50.455,50.455,0,0,1-45.733,54.769" transform="translate(0 0)" fill="#477ef6"/>
9
+ </g>
10
+ </svg>
@@ -0,0 +1,10 @@
1
+ <svg id="Group_10" data-name="Group 10" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="624.048" height="499" viewBox="0 0 624.048 499">
2
+ <defs>
3
+ <clipPath id="clip-path">
4
+ <rect id="Rectangle_25" data-name="Rectangle 25" width="624.048" height="499" fill="none"/>
5
+ </clipPath>
6
+ </defs>
7
+ <g id="Group_9" data-name="Group 9" clip-path="url(#clip-path)">
8
+ <path id="Path_3" data-name="Path 3" d="M617.3,465.069l-.384-.318c-.385-.317-.9-.738-1.674-1.49-1.419-1.279-3.616-3.309-6.36-6.112a225.664,225.664,0,0,1-20.162-23.534c-.136-.182-.271-.367-.406-.55-22.957-31.214-26.261-72.555-9.486-107.484,16.327-34,23.783-71.208,20.13-109.472C586.148,81.9,441.91-14.07,276.747,1.694S-11.9,138.983.914,273.192,157.963,503.371,323.126,487.608a364.7,364.7,0,0,0,89.545-20,77.522,77.522,0,0,1,58.556,2.224,367.136,367.136,0,0,0,38.334,14.95c29.035,9.42,63.567,16.569,96.922,13.5A19.281,19.281,0,0,0,622.561,486.8a18.785,18.785,0,0,0-5.261-21.731m-446.79-153.1A50.455,50.455,0,1,1,216.243,257.2a50.456,50.456,0,0,1-45.733,54.772m138.931-12.493a50.454,50.454,0,1,1,45.734-54.77,50.454,50.454,0,0,1-45.734,54.77m134.991-12.137a50.455,50.455,0,1,1,45.733-54.769,50.455,50.455,0,0,1-45.733,54.769" transform="translate(0 0)" fill="#354b64"/>
9
+ </g>
10
+ </svg>
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <button :class="['toggle-metrics-button', buttonStyle]" @click="click">
3
- <div :class="icon"></div>
2
+ <button :class="['toggle-metrics-button', buttonStyle, 'toggle-metrics-button-' + size, {'toggle-metrics-button-disabled': disabled }]" :style="styles" @click="click" :disabled="disabled">
3
+ <div :class="icon" :style="styles ? 'background-color:' + styles.color : ''"></div>
4
4
  <slot>{{buttonText}}</slot>
5
5
  </button>
6
6
  </template>
@@ -19,8 +19,27 @@
19
19
  },
20
20
  icon: {
21
21
  type: String,
22
- required: true,
22
+ required: false,
23
+ validator: function(value) {
24
+ return ["heatmap-icon", "email-icon", "contacts-icon"].indexOf(value) !== -1;
25
+ }
23
26
  },
27
+ size: {
28
+ type: String,
29
+ default: "medium",
30
+ required: false,
31
+ validator: function(value) {
32
+ return ["small", "medium", "large"].indexOf(value) !== -1;
33
+ }
34
+ },
35
+ styles: {
36
+ type: Object,
37
+ required: false,
38
+ },
39
+ disabled: {
40
+ type: Boolean,
41
+ default: false
42
+ }
24
43
  },
25
44
  methods: {
26
45
  click() {
@@ -0,0 +1,55 @@
1
+ <template>
2
+ <div class="toggle-comment-card">
3
+ <div class="toggle-comment-card-info" :style="{ backgroundColor: cardColor }">
4
+ <div class="toggle-comment-card-text">
5
+ <p>"{{ comment }}"</p>
6
+ </div>
7
+ <div class="toggle-comment-card-name">
8
+ <slot name="button_contacts"></slot>
9
+ </div>
10
+ </div>
11
+ </div>
12
+ </template>
13
+ <script>
14
+ export default {
15
+ data() {
16
+ return {};
17
+ },
18
+ props: {
19
+ cardIndex: {
20
+ type: Number,
21
+ required: true,
22
+ },
23
+ totalCards: {
24
+ type: Number,
25
+ required: true,
26
+ },
27
+ comment: {
28
+ type: String,
29
+ required: true,
30
+ }
31
+ },
32
+ computed: {
33
+ cardColor() {
34
+ // adjust colour palette below to change the Reward Cards colors
35
+ const colorPalette = [
36
+ "#2c7da0",
37
+ "#f3c570",
38
+ "#8bbcbe",
39
+ "#a0a789",
40
+ "#cbae78",
41
+ "#a284b6",
42
+ "#d39999",
43
+ "#9b7361",
44
+ "#64aaa8",
45
+ "#799194",
46
+ ];
47
+
48
+ // pick random number to return random index of colourPalette
49
+ const paletteOrder = (this.cardIndex + 1) % colorPalette.length
50
+ const index = (paletteOrder === 0 ? colorPalette.length : paletteOrder) -1
51
+ return colorPalette[index];
52
+ }
53
+ }
54
+ };
55
+ </script>
@@ -1,28 +1,34 @@
1
1
  <template>
2
- <swiper
3
- ref="swiper"
4
- class="swiper toggle-carousel"
5
- :class="[
6
- carouselStyle == 'voucher' && slidesLength > 1 ? 'toggle-carousel--voucher' : '',
7
- carouselStyle == 'voucher' && isEnd && slidesLength > 1 ? 'toggle-carousel--voucher-end' : ''
8
- ]"
9
- :options="carouselOptions"
10
- @slideChangeTransitionStart="onSlideTransition"
11
- >
12
- <slot></slot>
13
- <div v-if="carouselPrev && slidesLength > 1"
2
+ <div class="toggle-carousel-wrapper">
3
+ <swiper
4
+ ref="swiper"
5
+ class="swiper toggle-carousel"
6
+ :class="[
7
+ carouselStyle == 'voucher' && slidesLength > 1 ? 'toggle-carousel--voucher' : '',
8
+ carouselStyle == 'voucher' && isEnd && slidesLength > 1 ? 'toggle-carousel--voucher-end' : ''
9
+ ]"
10
+ :options="carouselOptions"
11
+ @slideChangeTransitionStart="onSlideTransition"
12
+ >
13
+ <slot></slot>
14
+ </swiper>
15
+ <div v-if="carouselPrev && shouldShowArrows"
14
16
  class="toggle-carousel-button toggle-carousel-button--prev"
15
- :class="['toggle-carousel-button--' + carouselNavPosition, {'toggle-carousel-button--disabled': prevDisabled}]"
17
+ :class="['toggle-carousel-button--' + carouselNavPosition,
18
+ {'toggle-carousel-button--disabled': prevDisabled},
19
+ {'toggle-carousel-button--comments-left-arrow': carouselStyle == 'comments'}]"
16
20
  @click="slidePrev"
17
21
  slot="button-prev"
18
22
  ></div>
19
- <div v-if="carouselNext && slidesLength > 1"
23
+ <div v-if="carouselNext && shouldShowArrows"
20
24
  class="toggle-carousel-button toggle-carousel-button--next"
21
- :class="['toggle-carousel-button--' + carouselNavPosition, {'toggle-carousel-button--disabled': nextDisabled}]"
25
+ :class="['toggle-carousel-button--' + carouselNavPosition,
26
+ {'toggle-carousel-button--disabled': nextDisabled},
27
+ {'toggle-carousel-button--comments-right-arrow': carouselStyle == 'comments'}]"
22
28
  @click="$refs.swiper.swiperInstance.slideNext()"
23
29
  slot="button-next"
24
30
  ></div>
25
- </swiper>
31
+ </div>
26
32
  </template>
27
33
 
28
34
  <script>
@@ -38,6 +44,7 @@ export default {
38
44
  prevDisabled: false,
39
45
  nextDisabled: false,
40
46
  slidesLength: 0,
47
+ slidesShownPerView: 0,
41
48
  isEnd: false
42
49
  };
43
50
  },
@@ -98,6 +105,7 @@ export default {
98
105
  },
99
106
  refreshCarousel(){
100
107
  this.slidesLength = this.$refs.swiper.swiperInstance.slides.length;
108
+ this.slidesShownPerView = this.$refs.swiper.swiperInstance.slidesPerViewDynamic()
101
109
  this.onSlideTransition();
102
110
  },
103
111
  onSlideTransition(){
@@ -121,6 +129,11 @@ export default {
121
129
  this.nextDisabled = false;
122
130
  }
123
131
  }
132
+ },
133
+ computed: {
134
+ shouldShowArrows() {
135
+ return this.slidesLength > this.slidesShownPerView
136
+ }
124
137
  }
125
138
  }
126
139
  </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <swiper-slide class="toggle-carousel-slide" :style="'width:' + slideWidth + '; height:' + slideHeight">
2
+ <swiper-slide class="toggle-carousel-slide">
3
3
  <slot></slot>
4
4
  </swiper-slide>
5
5
  </template>
@@ -6,8 +6,8 @@
6
6
  <label class="toggle-input-label">{{label}}</label>
7
7
 
8
8
  <div class="toggle-date-input-container">
9
- <div :class="['toggle-date-input-calendar-icon', {'calendar-icon-disabled' :disabled}]">
10
- <input type="text" class="toggle-input" :name="name" :disabled="disabled" ref="date-input" :id="'toggle-date-input'+_uid" :value="date" v-on:keypress="$event.preventDefault()" />
9
+ <div class="toggle-date-input-calendar-icon">
10
+ <input type="text" class="toggle-input" :name="name" ref="date-input" :id="'toggle-date-input'+_uid" :value="date" v-on:keypress="$event.preventDefault()">
11
11
  </div>
12
12
  <button type="button" class="toggle-clear" v-on:click="clearDate" v-if="displayValue"></button>
13
13
  </div>
@@ -101,11 +101,7 @@ export default {
101
101
  maxLength:{
102
102
  type: Number,
103
103
  required:false
104
- },
105
- disabled: {
106
- type: Boolean,
107
- default: false
108
- },
104
+ }
109
105
  },
110
106
 
111
107
  created : function(){
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- <div class="toggle-input-container" :class="{'toggle-input-is-invalid':isInvalid, 'toggle-input-is-disabled': disabled }" v-on:click="focusClosestInput">
6
+ <div class="toggle-input-container" :class="{'toggle-input-is-invalid':isInvalid }" v-on:click="focusClosestInput">
7
7
  <label
8
8
  v-if="label"
9
9
  :for="name ? name : 'InputText' "
@@ -16,7 +16,6 @@
16
16
  :placeholder="placeholder ? placeholder : '' "
17
17
  :autocomplete="autocomplete ? 'on' : 'off' "
18
18
  :required="required"
19
- :disabled="disabled"
20
19
  v-model="inputVal"
21
20
  @blur="isInputActive = false"
22
21
  @focus="isInputActive = true"
@@ -92,12 +91,8 @@ export default {
92
91
  currencyDenomination: {
93
92
  type: Number,
94
93
  default: 100
95
- },
96
- disabled: {
97
- type: Boolean,
98
- required: false,
99
- default: false
100
- },
94
+ }
95
+
101
96
  },
102
97
 
103
98
  created : function(){
@@ -1,18 +1,18 @@
1
1
  <template>
2
2
 
3
3
  <div class="toggle-input-container" :class="{'toggle-input-is-invalid':isInvalid, 'toggle-input-is-disabled':disabled}" v-on:click="focusClosestInput">
4
- <label
4
+ <label
5
5
  v-if="label"
6
- :for="name ? name : 'ToggleInputSelect' "
6
+ :for="name ? name : 'ToggleInputSelect' "
7
7
  class="toggle-input-label"
8
- > {{ label }}
8
+ > {{ label }}
9
9
  </label>
10
10
 
11
11
  <div class="toggle-input-select-container">
12
- <select
13
- :name="name ? name : 'ToggleInputSelect' "
12
+ <select
13
+ :name="name ? name : 'ToggleInputSelect' "
14
14
  :class="[ 'toggle-input-select', size]"
15
- v-model="inputVal"
15
+ v-model="inputVal"
16
16
  :autocomplete="autocomplete ? 'on' : 'off' "
17
17
  :required="required"
18
18
  :disabled="disabled"
@@ -24,7 +24,7 @@
24
24
  </div>
25
25
 
26
26
  <label
27
- class="toggle-input-label-error"
27
+ class="toggle-input-label-error"
28
28
  v-if="isInvalid"
29
29
  :for="name ? name : 'ToggleInputText' "
30
30
  >
@@ -39,11 +39,6 @@ import { mixins } from '../mixins/mixins'
39
39
 
40
40
  export default {
41
41
  mixins:[mixins],
42
- data() {
43
- return {
44
- show: false
45
- }
46
- },
47
42
  props: {
48
43
  value: {},
49
44
  name: {
@@ -92,7 +87,6 @@ export default {
92
87
  },
93
88
 
94
89
  created : function(){
95
-
96
90
  },
97
91
  computed: {
98
92
  inputVal: {
@@ -1,16 +1,16 @@
1
1
  <template>
2
2
 
3
3
  <div class="toggle-input-container" :class="{'toggle-input-is-invalid':isInvalid, 'toggle-input-is-disabled':disabled}" v-on:click="focusClosestInput">
4
- <label
4
+ <label
5
5
  v-if="label"
6
- :for="name ? name : 'InputText' "
6
+ :for="name ? name : 'InputText' "
7
7
  class="toggle-input-label"
8
- > {{ label }}
8
+ > {{ label }}
9
9
  </label>
10
10
  <span class="toggle-input-counter" v-if="maxLength">{{messageLength(inputVal, maxLength)}}</span>
11
11
  <input
12
12
  :type="type"
13
- :name="name ? name : 'ToggleInputText' "
13
+ :name="name ? name : 'ToggleInputText' "
14
14
  :class="[ 'toggle-input', size]"
15
15
  :placeholder="placeholder ? placeholder : '' "
16
16
  :autocomplete="autocomplete ? 'on' : 'off' "
@@ -19,11 +19,9 @@
19
19
  :maxlength="maxLength"
20
20
  :disabled="disabled"
21
21
  :readonly="readonly"
22
- :ref="'input_ele'"
23
- @keyup.esc="handleEscPress"
24
22
  />
25
23
  <label
26
- class="toggle-input-label-error"
24
+ class="toggle-input-label-error"
27
25
  v-if="isInvalid"
28
26
  :for="name ? name : 'ToggleInputText' "
29
27
  >
@@ -105,9 +103,7 @@ export default {
105
103
  }
106
104
  },
107
105
 
108
- created : function()
109
- {
110
- this.$nextTick(() => this.$refs['input_ele'].focus());
106
+ created : function(){
111
107
  },
112
108
  computed: {
113
109
  inputVal: {
@@ -122,11 +118,6 @@ export default {
122
118
  },
123
119
  methods: {
124
120
 
125
- handleEscPress()
126
- {
127
- this.$emit('bail');
128
- },
129
-
130
121
  /*
131
122
  * Concat message for count characters
132
123
  * @return string
@@ -2,7 +2,9 @@
2
2
  <div>
3
3
  <h3 class="toggle-metric metric-label">{{label}}</h3>
4
4
  <div class="single-metric-icon" v-if="metricPending && label.length == 0"></div>
5
- <h1 class="toggle-metric metric-value" v-else>{{metricValue}}</h1>
5
+ <h1 class="toggle-metric metric-value" v-else>{{metricValue}}
6
+ <span v-if="score && value.maxScore" class="toggle-metric-score-rating">/{{value.maxScore}}</span>
7
+ </h1>
6
8
  </div>
7
9
  </template>
8
10
 
@@ -21,20 +23,20 @@ export default {
21
23
  type: String,
22
24
  default: "ToggleMetricSingleMetric"
23
25
  },
24
- /**
26
+ /**
25
27
  * Type of the value, this will affect on the format shown
26
28
  */
27
29
  type : {
28
30
  type: String,
29
31
  validator: function (value) {
30
- return ['text', 'number', 'percentage', 'currency'].indexOf(value) !== -1
32
+ return ['text', 'number', 'percentage', 'currency', 'score'].indexOf(value) !== -1
31
33
  }
32
34
  },
33
35
  /**
34
36
  * Component's value
35
37
  */
36
38
  value: {
37
- type: [String, Number],
39
+ type: [String, Number, Object],
38
40
  required: true
39
41
  },
40
42
  /**
@@ -87,14 +89,17 @@ export default {
87
89
  case 'currency':
88
90
  return (this.value/this.currencyDenomination).toLocaleString(this.currencyLocale, {style: 'currency', currency: this.currencyCode});
89
91
  case'percentage':
90
- return `${this.value} %`
92
+ return `${this.value} %`;
93
+ case 'score':
94
+ return this.value.score;
91
95
  default:
92
96
  return this.value.toLocaleString();
93
97
 
94
98
  }
99
+ },
100
+ score() {
101
+ return this.type === 'score';
95
102
  }
96
-
97
-
98
103
  }
99
104
  }
100
105
 
@@ -54,14 +54,14 @@ export default {
54
54
  type : {
55
55
  type: String,
56
56
  validator: function (value) {
57
- return ['text', 'number', 'percentage', 'currency'].indexOf(value) !== -1
57
+ return ['text', 'number', 'percentage', 'currency', 'score'].indexOf(value) !== -1
58
58
  }
59
59
  },
60
60
  /**
61
61
  * single metric component value
62
62
  */
63
63
  singleMetricVal: {
64
- type: [String, Number],
64
+ type: [String, Number, Object],
65
65
  required: true
66
66
  },
67
67
  /**
@@ -112,6 +112,10 @@ export default {
112
112
  inverse_trend_impact: {
113
113
  type: Boolean,
114
114
  default: false
115
+ },
116
+ showTrendForAllZeros: {
117
+ type: Boolean,
118
+ default: false
115
119
  }
116
120
  },
117
121
 
@@ -195,7 +199,7 @@ export default {
195
199
 
196
200
  const trendImpactVals = this.sparkLineVal[0].data[0].y || this.sparkLineVal[0].data[0].y === 0 ? this.sparkLineVal[0].data.map(data => data.y) : this.sparkLineVal[0].data;
197
201
 
198
- let result = this.calcTrendImpact(trendImpactVals, this.trend_impact_base);
202
+ let result = this.calcTrendImpact(trendImpactVals, this.trend_impact_base, this.showTrendForAllZeros);
199
203
 
200
204
  if (this.inverse_trend_impact === true && result != false)
201
205
  return result *-1;
@@ -139,10 +139,10 @@ export const charts = {
139
139
  *
140
140
  * @return { {Integer} 1, 0,-1 }
141
141
  */
142
- calcTrendImpact(values, trend_impact_base){
142
+ calcTrendImpact(values, trend_impact_base, show_trend_for_all_zeros){
143
143
 
144
144
  // If all values in the values array are 0 return 0;
145
- if (values.every((val) => val === 0)){
145
+ if (!show_trend_for_all_zeros && values.every((val) => val === 0)){
146
146
  return false;
147
147
  }
148
148