toggle-components-library 1.34.0 → 1.35.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.
package/package-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toggle-components-library",
3
- "version": "1.34.0",
3
+ "version": "1.35.0",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toggle-components-library",
3
- "version": "1.34.0",
3
+ "version": "1.35.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -1,19 +1,25 @@
1
1
  <template>
2
- <button :class="['toggle-booster-button-container', boosterType]" @click="click">
3
-
4
- <img
5
- :src="logo.src"
6
- :alt="logo.alt"
7
- class="toggle-booster-button-logo"
8
- >
9
-
10
- <div :class="['toggle-booster-button', boosterType]" >
11
- <p class="plus">+</p>
12
- <div v-if="buttonText" class="toggle-booster-button-button-text">
13
- <slot>{{buttonText}}</slot>
2
+ <div :class="[{'toggle-booster-button-tooltip-container': !!tooltipText }]">
3
+ <button :class="['toggle-booster-button-container', boosterType, {'toggle-booster-button-disabled': disabled}]" :disabled="disabled" @click="click">
4
+
5
+ <img
6
+ :src="logo.src"
7
+ :alt="logo.alt"
8
+ class="toggle-booster-button-logo"
9
+ >
10
+
11
+ <div :class="['toggle-booster-button', boosterType]" >
12
+ <p class="plus">+</p>
13
+ <div v-if="buttonText" class="toggle-booster-button-button-text">
14
+ <slot>{{buttonText}}</slot>
15
+ </div>
14
16
  </div>
17
+ </button>
18
+
19
+ <div class="toggle-booster-button-tooltip-text" v-if="tooltipText">
20
+ <div >{{ tooltipText }}</div>
15
21
  </div>
16
- </button>
22
+ </div>
17
23
  </template>
18
24
 
19
25
  <script>
@@ -36,6 +42,14 @@
36
42
  type: Object,
37
43
  required: true,
38
44
  },
45
+ disabled: {
46
+ type: Boolean,
47
+ default: false,
48
+ },
49
+ tooltipText: {
50
+ type: String,
51
+ required: false
52
+ }
39
53
  },
40
54
  methods: {
41
55
  click() {
@@ -1,22 +1,29 @@
1
1
  <template>
2
- <div :class="[ 'toggle-button-container', {'toggle-button-container-mini':isMini}]">
2
+ <div :class="[ 'toggle-button-container', {'toggle-button-container-mini':isMini, 'toggle-button-tooltip-container': !!tooltipText }]">
3
3
  <button
4
4
  v-if="!$slots.default"
5
5
  :type="type"
6
- :class="[ 'toggle-button', buttonStyle, {'toggle-button-loading':loading, 'toggle-button-subscribed': !subscribed}]"
6
+ :class="[ 'toggle-button', buttonStyle, {'toggle-button-loading':loading, 'toggle-button-subscribed': !subscribed, 'toggle-button-booster-badge': boosterImageProperties}]"
7
7
  :disabled="(loading || disabled)"
8
8
  @click="click"
9
9
  >
10
10
  <div class="toggle-button-loader" v-if="loading" ></div>
11
11
  <span v-html="buttonText" v-if="!isMini"/>
12
+
13
+ <div v-if="boosterImageProperties" :class="['toggle-button-booster-image-badge', {'shimmer': boosterShimmer && !disabled, 'toggle-button-loading': loading, 'toggle-button-disabled': disabled}]" :style="'background-color: ' + boosterImageProperties.bgColor">
14
+ <img class="toggle-button-booster-image" :src="boosterImageProperties.src" :alt="boosterImageProperties.alt">
15
+ </div>
12
16
  </button>
13
17
  <div v-else :class="[ 'toggle-button-a', buttonStyle, {'toggle-button-a-loading':loading, 'disabled':disabled, 'toggle-button-subscribed': !subscribed}]">
14
- <div class="toggle-button-loader" v-if="loading" ></div>
15
- <div class="toggle-button-a-border" />
16
- <!--
17
- @slot String of button text
18
- -->
19
- <slot>{{buttonText}}</slot>
18
+ <div class="toggle-button-loader" v-if="loading" ></div>
19
+ <div class="toggle-button-a-border" />
20
+ <!--
21
+ @slot String of button text
22
+ -->
23
+ <slot>{{buttonText}}</slot>
24
+ </div>
25
+ <div class="toggle-button-tooltip-text" v-if="tooltipText">
26
+ <div >{{ tooltipText }}</div>
20
27
  </div>
21
28
  </div>
22
29
  </template>
@@ -67,10 +74,33 @@ export default {
67
74
  type:String,
68
75
  default:'confirm'
69
76
  },
70
- /* Grey out button if booster not enabled*/
77
+ /*
78
+ * Grey out button if booster not enabled
79
+ */
71
80
  subscribed: {
72
81
  type: Boolean,
73
82
  default: true
83
+ },
84
+ /*
85
+ * Booster badge image properties, image, alt text, background colour
86
+ */
87
+ boosterImageProperties: {
88
+ type: Object,
89
+ required: false,
90
+ },
91
+ /*
92
+ * Turns the shimmer animation on and off for the booster badge
93
+ */
94
+ boosterShimmer: {
95
+ type: Boolean,
96
+ default: true
97
+ },
98
+ /*
99
+ * Text displayed in tooltip
100
+ */
101
+ tooltipText: {
102
+ type: String,
103
+ required: false
74
104
  }
75
105
  },
76
106
  computed: {
@@ -1,5 +1,23 @@
1
1
  <template>
2
- <tr class="toggle-tablee-tr" @click="$emit('click')" >
2
+ <tr :class="['toggle-tablee-tr',{'tr-disabled':disabled }]" @click="handleClick" >
3
3
  <slot></slot>
4
4
  </tr>
5
- </template>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ props: {
10
+ disabled: {
11
+ type: Boolean,
12
+ default: false
13
+ }
14
+ },
15
+ methods: {
16
+ handleClick() {
17
+ if(!this.disabled) {
18
+ this.$emit('click')
19
+ }
20
+ }
21
+ }
22
+ }
23
+ </script>
@@ -219,3 +219,37 @@ margin:1rem
219
219
 
220
220
  }
221
221
 
222
+ .toggle-booster-button-disabled {
223
+ opacity: 0.3;
224
+ }
225
+
226
+ /* Tooltip container */
227
+ .toggle-booster-button-tooltip-container {
228
+ position: relative;
229
+ display: flex;
230
+ justify-content: center;
231
+ }
232
+
233
+ /* Tooltip text */
234
+ .toggle-booster-button-tooltip-container .toggle-booster-button-tooltip-text {
235
+ visibility: hidden;
236
+ width: 120px;
237
+ height: fit-content;
238
+ background-color: black;
239
+ color: #fff;
240
+ text-align: center;
241
+ padding: 5px;
242
+ border-radius: 6px;
243
+ position: absolute;
244
+ z-index: 999;
245
+ top: 100%;
246
+ }
247
+
248
+ .toggle-booster-button-tooltip-text {
249
+ font-family: $toggle-font-family;
250
+ padding: 10px;
251
+ }
252
+
253
+ .toggle-booster-button-tooltip-container:hover .toggle-booster-button-tooltip-text {
254
+ visibility: visible;
255
+ }
@@ -427,3 +427,83 @@
427
427
  transition: all 0.2s ease-in-out;
428
428
  }
429
429
  }
430
+
431
+ .toggle-button-booster-badge {
432
+ display: flex;
433
+ align-items: center;
434
+ padding: 0.2rem 0.2rem 0.2rem 1rem !important;
435
+ }
436
+
437
+ .shimmer {
438
+ color: grey;
439
+ display: inline-block;
440
+ mask: linear-gradient(-60deg, #000 30%, #0005, #000 70%) right/400% 100%;
441
+ background-repeat: no-repeat;
442
+ animation: shimmer 4s infinite;
443
+ }
444
+
445
+ .toggle-button-booster-image-badge {
446
+ width: 6rem;
447
+ height: 2rem;
448
+ display: flex;
449
+ align-items: center;
450
+ justify-content: center;
451
+ border-radius: 4px;
452
+ margin: 0 0 0 20px;
453
+ padding: 0px 8px 0px 8px;
454
+ width: 6rem;
455
+ height: 1.8rem;
456
+ .toggle-button-booster-image {
457
+ width: 100%;
458
+ height: 100%;
459
+ }
460
+ &.toggle-button-loading {
461
+ opacity: 0
462
+ }
463
+ &.toggle-button-disabled {
464
+ opacity: 0.3;
465
+ }
466
+ }
467
+
468
+ /* Tooltip container */
469
+ .toggle-button-tooltip-container {
470
+ position: relative;
471
+ justify-content: center;
472
+ display: flex;
473
+ }
474
+
475
+ /* Tooltip text */
476
+ .toggle-button-tooltip-container .toggle-button-tooltip-text {
477
+ visibility: hidden;
478
+ width: 120px;
479
+ height: fit-content;
480
+ background-color: black;
481
+ color: #fff;
482
+ text-align: center;
483
+ padding: 5px;
484
+ border-radius: 6px;
485
+ position: absolute;
486
+ z-index: 999;
487
+ top: 100%;
488
+ }
489
+
490
+ .toggle-button-tooltip-text {
491
+ font-family: $toggle-font-family;
492
+ }
493
+
494
+ .toggle-button-tooltip-container:hover .toggle-button-tooltip-text {
495
+ visibility: visible;
496
+ }
497
+
498
+ // Shimmer animation for booster badge
499
+ @keyframes shimmer {
500
+ 0% {
501
+ mask-position: right;
502
+ }
503
+ 30% {
504
+ mask-position: left;
505
+ }
506
+ 100% {
507
+ mask-position: left;
508
+ }
509
+ }
@@ -117,9 +117,7 @@ table.toggle-table {
117
117
  }
118
118
  }
119
119
 
120
-
121
120
  tr.toggle-tablee-tr {
122
-
123
121
  &:hover {
124
122
  background-color: #FFF;
125
123
  .arrow-order {
@@ -146,6 +144,10 @@ table.toggle-table {
146
144
 
147
145
 
148
146
  }
147
+ tr.toggle-tablee-tr.tr-disabled * {
148
+ opacity: 0.5;
149
+ cursor: not-allowed;
150
+ }
149
151
 
150
152
  }
151
153
 
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 448 512"><!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><style>svg{fill:#6d90b4}</style><path d="M304 128a80 80 0 1 0 -160 0 80 80 0 1 0 160 0zM96 128a128 128 0 1 1 256 0A128 128 0 1 1 96 128zM49.3 464H398.7c-8.9-63.3-63.3-112-129-112H178.3c-65.7 0-120.1 48.7-129 112zM0 482.3C0 383.8 79.8 304 178.3 304h91.4C368.2 304 448 383.8 448 482.3c0 16.4-13.3 29.7-29.7 29.7H29.7C13.3 512 0 498.7 0 482.3z"/></svg>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 448 512"><!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><style>svg{fill:#fff}</style><path d="M304 128a80 80 0 1 0 -160 0 80 80 0 1 0 160 0zM96 128a128 128 0 1 1 256 0A128 128 0 1 1 96 128zM49.3 464H398.7c-8.9-63.3-63.3-112-129-112H178.3c-65.7 0-120.1 48.7-129 112zM0 482.3C0 383.8 79.8 304 178.3 304h91.4C368.2 304 448 383.8 448 482.3c0 16.4-13.3 29.7-29.7 29.7H29.7C13.3 512 0 498.7 0 482.3z"/></svg>