toggle-components-library 1.37.0 → 1.38.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.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toggle-components-library",
3
- "version": "1.37.0",
3
+ "version": "1.38.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -0,0 +1,9 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="6.922" height="12.381" viewBox="0 0 6.922 12.381">
2
+ <defs>
3
+ <linearGradient id="linear-gradient" x1="0.343" y1="-0.06" x2="0.923" y2="2.008" gradientUnits="objectBoundingBox">
4
+ <stop offset="0" stop-color="#3180FF"/>
5
+ <stop offset="1" stop-color="#38ABFF"/>
6
+ </linearGradient>
7
+ </defs>
8
+ <path id="bolt-solid" d="M37.679,1.07a.944.944,0,0,0-.191-.931.469.469,0,0,0-.719.044L32.156,5.6a.961.961,0,0,0-.16.854.616.616,0,0,0,.541.5h2.009L33.16,11.294a.944.944,0,0,0,.191.931.469.469,0,0,0,.719-.044l4.613-5.417a.961.961,0,0,0,.16-.854.612.612,0,0,0-.541-.5H36.293Z" transform="translate(-31.959 0.009)" fill="url(#linear-gradient)"/>
9
+ </svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#abb7c5"><path d="M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z"/></svg>
@@ -1,20 +1,24 @@
1
1
  <template>
2
2
  <div class="toggle-breadcrumb" v-if="breadcrumb_computed">
3
3
  <div v-for="(crumb, index) in breadcrumb_computed" :key="index">
4
- <router-link :to="{ name: crumb.link}" class="back-product" v-if="crumb.link && !isNuxt">{{ crumb.name }}</router-link>
5
- <NuxtLink :to="{ name: crumb.link}" class="back-product" v-if="crumb.link && isNuxt">{{ crumb.name }}</NuxtLink>
6
- <i class="toggle-breadcrumb-arrow-right" v-if="crumb.link"></i>
7
- <h1 class="toggle-breadcrumb-h1" v-if="!crumb.link">{{ crumb.name }}</h1>
4
+ <template v-if="index === breadcrumb_computed.length - 1 && editable">
5
+ <div class="toggle-breadcrumb-last-element-container">
6
+ <h1 class="toggle-breadcrumb-h1 toggle-breadcrumb-last-element">{{ crumb.name }}</h1>
7
+ <div v-if="editable" class="toggle-breadcrumb-edit-icon" @click="editClicked"></div>
8
+ </div>
9
+ </template>
10
+ <template v-else>
11
+ <router-link :to="{ name: crumb.link}" class="back-product" v-if="crumb.link && !isNuxt">{{ crumb.name }}</router-link>
12
+ <NuxtLink :to="{ name: crumb.link}" class="back-product" v-if="crumb.link && isNuxt">{{ crumb.name }}</NuxtLink>
13
+ <i class="toggle-breadcrumb-arrow-right" v-if="crumb.link"></i>
14
+ <h1 class="toggle-breadcrumb-h1" v-if="!crumb.link">{{ crumb.name }}</h1>
15
+ </template>
8
16
  </div>
9
17
  </div>
10
18
  </template>
11
19
 
12
20
  <script>
13
-
14
-
15
21
  export default {
16
-
17
- mixins: [],
18
22
  props: {
19
23
  isNuxt: {
20
24
  type: Boolean,
@@ -23,21 +27,21 @@ export default {
23
27
  breadcrumb: {
24
28
  type: Array,
25
29
  required: false
30
+ },
31
+ editable: {
32
+ type: Boolean,
33
+ default: false
26
34
  }
27
35
  },
28
-
29
- data: function () {
30
-
31
-
32
- return {};
33
- },
34
-
35
36
  computed: {
36
-
37
37
  breadcrumb_computed() {
38
38
  return this.isNuxt ? this.breadcrumb : this.$route.meta.breadcrumb
39
- },
39
+ }
40
+ },
41
+ methods: {
42
+ editClicked() {
43
+ this.$emit('edit-clicked')
44
+ }
40
45
  }
41
-
42
46
  }
43
47
  </script>
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <div class="toggle-input-radio-button-mini-switch-wrapper">
3
+ <label :class="['toggle-input-radio-button-mini-switch', {'toggle-input-radio-button-mini-switch-disabled': disabled}]">
4
+ <input type="checkbox" :value="value" v-model="value" :disabled="disabled">
5
+ <span :class="['toggle-input-radio-button-mini-slider', {'toggle-input-radio-button-mini-slider-disabled': disabled}]"
6
+ :style="value == false ? ('background-color: ' + inactiveStyles.backgroundColor) : ('background-color: ' + activeStyles.backgroundColor)">
7
+ <span class="toggle-input-radio-button-mini-text-on" :style="'color: ' + activeStyles.color">On</span>
8
+ <span class="toggle-input-radio-button-mini-text-off" :style="'color: ' + inactiveStyles.color">Off</span>
9
+ </span>
10
+ </label>
11
+ </div>
12
+ </template>
13
+
14
+ <script>
15
+ export default {
16
+ name: 'ToggleInputRadioButtonMini',
17
+ props: {
18
+ disabled: {
19
+ type: Boolean,
20
+ default: false
21
+ },
22
+ // Allows for the passing of background colour and text colour for active and inactive states
23
+ styles : {
24
+ type: Object,
25
+ default: () => ({})
26
+ }
27
+ },
28
+ computed: {
29
+ value: {
30
+ get() {
31
+ return this.$attrs.value
32
+ },
33
+ set(value) {
34
+ this.$emit('input', value)
35
+ }
36
+ },
37
+ activeStyles () {
38
+ return {
39
+ backgroundColor: this.styles.active?.backgroundColor ? this.styles.active.backgroundColor : '#2196F3',
40
+ color: this.styles.active?.color ? this.styles.active.color : '#ffffff'
41
+ }
42
+ },
43
+ inactiveStyles () {
44
+ return {
45
+ backgroundColor: this.styles.inactive?.backgroundColor ? this.styles.inactive.backgroundColor : '#ccc',
46
+ color: this.styles.inactive?.color ? this.styles.inactive.color : '#3A4A62'
47
+ }
48
+ }
49
+ },
50
+ watch: {
51
+ value: function (val) {
52
+ this.$emit('input', val)
53
+ }
54
+ }
55
+ }
56
+ </script>
@@ -1,10 +1,10 @@
1
1
  <template>
2
2
  <div>
3
- <h3 :class="['toggle-metric metric-label', {'metric-label-atmosphere': atmosphere}]">{{label}}</h3>
3
+ <h3 :class="['toggle-metric metric-label', {'metric-label-atmosphere': atmosphere || toggle}]">{{label}}</h3>
4
4
  <div class="single-metric-icon" v-if="metricPending && label.length == 0"></div>
5
- <h1 :class="['toggle-metric metric-value', { 'metric-value-atmosphere': atmosphere }, { 'metric-value-small': small}]" v-else>{{metricValue}}
5
+ <h1 :class="['toggle-metric metric-value', { 'metric-value-atmosphere': atmosphere || toggle }, { 'metric-value-small': small}]" v-else>{{metricValue}}
6
6
  <span v-if="score && value.maxScore" class="toggle-metric-score-rating">/{{value.maxScore}}</span>
7
- <span v-if="atmosphere && live == true" class="toggle-metric-live-icon"></span>
7
+ <span v-if="(atmosphere || toggle) && live == true" :class="['toggle-metric-live-icon', {'toggle-metric-live-icon-toggle': toggle}]"></span>
8
8
  </h1>
9
9
  </div>
10
10
  </template>
@@ -82,7 +82,7 @@ export default {
82
82
  type: String,
83
83
  default: "default",
84
84
  validator: function (value) {
85
- return ['default', 'atmosphere'].indexOf(value) !== -1
85
+ return ['default', 'atmosphere', 'toggle'].indexOf(value) !== -1
86
86
  }
87
87
  },
88
88
  metricSize: {
@@ -128,6 +128,9 @@ export default {
128
128
  atmosphere() {
129
129
  return this.metricStyle === 'atmosphere';
130
130
  },
131
+ toggle() {
132
+ return this.metricStyle === 'toggle';
133
+ },
131
134
  small() {
132
135
  return this.metricSize === 'small';
133
136
  }
package/src/index.js CHANGED
@@ -8,6 +8,7 @@ import ToggleInputSelect from "./components/forms/ToggleInputSelect.vue";
8
8
  import ToggleInputPercentage from "./components/forms/ToggleInputPercentage.vue";
9
9
  import ToggleInputCurrency from "./components/forms/ToggleInputCurrency.vue";
10
10
  import ToggleInputRadioButtons from "./components/forms/ToggleInputRadioButtons.vue";
11
+ import ToggleInputRadioButtonMini from "./components/forms/ToggleInputRadioButtonMini.vue";
11
12
  import ToggleInputTextArea from "./components/forms/ToggleInputTextArea.vue";
12
13
  import ToggleInputCheckboxContainer from "./components/forms/ToggleInputCheckboxContainer.vue";
13
14
  import ToggleInternationalPhoneInputSelect from "./components/forms/ToggleInternationalPhoneInputSelect.vue";
@@ -112,6 +113,7 @@ const Components = {
112
113
  ToggleInputPercentage,
113
114
  ToggleInputCurrency,
114
115
  ToggleInputRadioButtons,
116
+ ToggleInputRadioButtonMini,
115
117
  ToggleInputTextArea,
116
118
  ToggleInputCheckboxContainer,
117
119
  ToggleInputCheckbox,
@@ -36,4 +36,30 @@
36
36
  transform: rotate(-45deg);
37
37
  -webkit-transform: rotate(-45deg);
38
38
  }
39
- }
39
+ .toggle-breadcrumb-last-element-container {
40
+ display: flex;
41
+
42
+ .toggle-breadcrumb-last-element {
43
+ margin: 0;
44
+ overflow: hidden;
45
+ white-space: nowrap;
46
+ text-overflow: ellipsis;
47
+ }
48
+ .toggle-breadcrumb-edit-icon {
49
+ margin: 4px 0 0 0;
50
+ background-image: url('../assets/icons/edit-icon.svg');
51
+ background-repeat:no-repeat;
52
+ background-size:contain;
53
+ height: 22px;
54
+ width: 22px;
55
+ min-width: 22px;
56
+ margin-left: 15px;
57
+ cursor: pointer;
58
+ transition: 0.2s;
59
+ }
60
+ .toggle-breadcrumb-edit-icon:hover {
61
+ filter: invert(0.5) sepia(1) saturate(3) hue-rotate(180deg);
62
+ transform: scale(1.07) rotate(-6deg);
63
+ }
64
+ }
65
+ }
@@ -1218,4 +1218,71 @@ $iconWidth:20px;
1218
1218
  .drop-down-leave-to {
1219
1219
  overflow: hidden;
1220
1220
  max-height: 0;
1221
+ }
1222
+
1223
+ // Radio button mini
1224
+ .toggle-input-radio-button-mini-switch-wrapper{
1225
+ display: flex;
1226
+ align-items: center;
1227
+
1228
+ .toggle-input-radio-button-mini-switch {
1229
+ position: relative;
1230
+ display: inline-block;
1231
+ width: 52px;
1232
+ height: 28px;
1233
+ }
1234
+
1235
+ .toggle-input-radio-button-mini-switch input {
1236
+ opacity: 0;
1237
+ width: 0;
1238
+ height: 0;
1239
+ }
1240
+
1241
+ .toggle-input-radio-button-mini-slider {
1242
+ position: absolute;
1243
+ cursor: pointer;
1244
+ top: 0;
1245
+ left: 0;
1246
+ right: 0;
1247
+ bottom: 0;
1248
+ -webkit-transition: .4s;
1249
+ transition: .4s;
1250
+ display: flex;
1251
+ align-items: center;
1252
+ border-radius: 34px;
1253
+ }
1254
+
1255
+ .toggle-input-radio-button-mini-slider:before {
1256
+ position: absolute;
1257
+ content: "";
1258
+ height: 22px;
1259
+ width: 22px;
1260
+ left: 4px;
1261
+ bottom: 3px;
1262
+ background-color: white;
1263
+ -webkit-transition: .4s;
1264
+ transition: .4s;
1265
+ border-radius: 50%;
1266
+ }
1267
+
1268
+ input:checked + .toggle-input-radio-button-mini-slider:before {
1269
+ -webkit-transform: translateX(22px);
1270
+ -ms-transform: translateX(22px);
1271
+ transform: translateX(22px);
1272
+ }
1273
+
1274
+ .toggle-input-radio-button-mini-text-on {
1275
+ font-family: $toggle-font-family;
1276
+ font-size: 12px;
1277
+ margin-left: 7px;
1278
+ }
1279
+ .toggle-input-radio-button-mini-text-off {
1280
+ font-family: $toggle-font-family;
1281
+ font-size: 12px;
1282
+ margin-left: 6px;
1283
+ }
1284
+ .toggle-input-radio-button-mini-switch-disabled {
1285
+ cursor: default !important;
1286
+ opacity: 0.5;
1287
+ }
1221
1288
  }
@@ -164,4 +164,8 @@
164
164
  height: 19px;
165
165
  width: 19px;
166
166
  margin: 17px 0 0 5px;
167
+ }
168
+
169
+ .toggle-metric-live-icon-toggle {
170
+ background-image: url('../assets/icons/bolt-solid-toggle.svg') !important;
167
171
  }