toggle-components-library 1.13.1 → 1.14.3

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.13.1",
3
+ "version": "1.14.3",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -1,9 +1,27 @@
1
1
  <template>
2
- <hr class="toggle-line-break"/>
2
+ <hr :class="classes"/>
3
3
  </template>
4
4
 
5
5
  <script>
6
6
  export default {
7
- name: "LineBreak"
7
+ name: "LineBreak",
8
+ props: {
9
+ colour: {
10
+ type: String,
11
+ default: 'blue',
12
+ validator: (value) => [
13
+ 'blue',
14
+ 'grey'
15
+ ].includes(value.toLowerCase())
16
+ },
17
+ },
18
+ computed: {
19
+ classes() {
20
+ return {
21
+ 'toggle-line-break': this.colour == 'blue',
22
+ 'toggle-line-break-grey': this.colour == 'grey'
23
+ };
24
+ },
25
+ }
8
26
  }
9
27
  </script>
@@ -22,6 +22,10 @@ export default {
22
22
  type: String,
23
23
  default: "Expandable",
24
24
  },
25
+ startOpen: {
26
+ type: Boolean,
27
+ default: false
28
+ }
25
29
  },
26
30
  data: function() {
27
31
  return {
@@ -29,8 +33,13 @@ export default {
29
33
  updated: false,
30
34
  }
31
35
  },
36
+ mounted() {
37
+ if (this.startOpen) {
38
+ this.visible = true;
39
+ }
40
+ },
32
41
  beforeUpdate: function() {
33
- this.updated = true
42
+ this.updated = true;
34
43
  }
35
44
  };
36
45
  </script>
@@ -4,7 +4,7 @@
4
4
  <label
5
5
  v-if="label && !empty"
6
6
  class="toggle-input-crud-container-label"
7
- > {{ label }}
7
+ > {{ computedLabel }}
8
8
  </label>
9
9
  <button
10
10
  v-if="label && empty"
@@ -23,11 +23,6 @@
23
23
  buttonStyle="mini_edit"
24
24
  @click="$emit('edit')"
25
25
  />
26
- <ToggleButton
27
- v-if="!empty"
28
- buttonStyle="mini_delete"
29
- @click="$emit('delete')"
30
- />
31
26
  </div>
32
27
 
33
28
  <label
@@ -76,7 +71,10 @@ export default {
76
71
  created : function(){
77
72
  },
78
73
  computed: {
79
-
74
+ computedLabel() {
75
+ let labelLength = this.label.split('').length;
76
+ return labelLength <= 15 ? this.label : this.label.slice(0,15) + '...'
77
+ }
80
78
  },
81
79
  methods: {
82
80
 
@@ -16,7 +16,7 @@
16
16
  <div class="toggle-grid-input-row-remove">
17
17
  <ToggleButton
18
18
  buttonStyle="mini_delete"
19
- @click="removeRow(rowindex)"
19
+ @click="deleteCurrentRow(rowindex)"
20
20
  />
21
21
  </div>
22
22
 
@@ -32,9 +32,6 @@
32
32
  </label>
33
33
  </div>
34
34
 
35
-
36
-
37
-
38
35
  </div>
39
36
  <div class="toggle-grid-input-add-row" >
40
37
  <button
@@ -44,6 +41,18 @@
44
41
  />
45
42
  </div>
46
43
 
44
+ <ToggleModal name="confirm_delete_row" maxwidth="500px">
45
+ <ToggleHeaderTextLarge class="text-center">Are you sure you want to delete this row?</ToggleHeaderTextLarge>
46
+ <div class="text-center toggle-copy-text">
47
+ You will lose all the fields in this row.
48
+ </div>
49
+
50
+ <div class="toggle-grid-modal-button-container">
51
+ <ToggleButton buttonStyle="abort" buttonText="Delete this row" @click="removeRow(editingGridRow)" />
52
+ <ToggleButton class="mr-3" buttonStyle="neutral" buttonText="Keep this row" @click="$toggle_event.$emit('modal_hide', 'confirm_delete_row')" />
53
+ </div>
54
+ </ToggleModal>
55
+
47
56
  </div>
48
57
  </template>
49
58
 
@@ -51,11 +60,13 @@
51
60
 
52
61
  import { mixins } from '../mixins/mixins'
53
62
  import ToggleButton from '../buttons/ToggleButton.vue';
63
+ import ToggleModal from '../modals/ToggleModal.vue';
64
+ import ToggleHeaderTextLarge from '../text/ToggleHeaderTextLarge.vue';
54
65
 
55
66
 
56
67
  export default {
57
68
  mixins:[mixins],
58
- components:{ToggleButton},
69
+ components:{ToggleButton, ToggleModal, ToggleHeaderTextLarge},
59
70
  props: {
60
71
  value: {
61
72
  type: [Array]
@@ -132,6 +143,7 @@ export default {
132
143
  layout:[3,9]
133
144
  },
134
145
  ],
146
+ editingGridRow: null,
135
147
 
136
148
  };
137
149
  },
@@ -236,6 +248,12 @@ export default {
236
248
  */
237
249
  removeRow(row_index){
238
250
  this.$delete( this.inputVal, row_index);
251
+ this.$toggle_event.$emit('modal_hide', 'confirm_delete_row');
252
+ },
253
+
254
+ deleteCurrentRow(rowindex) {
255
+ this.editingGridRow = rowindex;
256
+ this.$toggle_event.$emit('modal_show', 'confirm_delete_row')
239
257
  },
240
258
 
241
259
  /*
@@ -0,0 +1,90 @@
1
+ <template>
2
+ <div class="toggle-formbuilder-input-outer-container">
3
+ <div class="toggle-formbuilder-input-container">
4
+ <div class="toggle-formbuilder-input-label">
5
+ <p v-if="label" class="toggle-formbuilder-label-text">{{label}}</p>
6
+ </div>
7
+ <div v-if="!multipleInputs" class="inner-input-container">
8
+ <slot ></slot>
9
+ <ToggleInfoText v-if="infoText" class="info">{{infoText}}</ToggleInfoText>
10
+ </div>
11
+ <div v-else class="inner-input-container">
12
+ <div class="multiple-inputs-container">
13
+ <slot></slot>
14
+ </div>
15
+ <ToggleInfoText v-if="infoText" class="info">{{infoText}}</ToggleInfoText>
16
+ </div>
17
+ </div>
18
+ </div>
19
+ </template>
20
+
21
+ <script>
22
+ import ToggleInfoText from '../text/ToggleInfoText.vue';
23
+
24
+ export default {
25
+ name: 'ToggleInputLabelLeft',
26
+ components: {
27
+ ToggleInfoText
28
+ },
29
+ props: {
30
+ label: {
31
+ type: String,
32
+ required: true,
33
+ default: 'Label'
34
+ },
35
+ infoText: {
36
+ type: String,
37
+ required: false
38
+ },
39
+ multipleInputs: {
40
+ type: Boolean,
41
+ default: false,
42
+ required: false,
43
+ description: "Set to true if more than one input is required per line. Inputs will be rendered horizontally"
44
+ }
45
+ }
46
+
47
+ }
48
+ </script>
49
+
50
+ <style>
51
+ .toggle-formbuilder-input-outer-container {
52
+ margin-bottom: 20px;
53
+ width: 100%;
54
+ }
55
+ .toggle-formbuilder-input-container {
56
+ display: flex;
57
+ flex-direction: row;
58
+ width: 100%;
59
+ }
60
+
61
+ .inner-input-container {
62
+ width: 100%;
63
+ }
64
+
65
+ .toggle-formbuilder-input-label {
66
+ display: flex;
67
+ flex-direction: column;
68
+ width: 20rem;
69
+ justify-content: center;
70
+ margin-bottom: 20px;
71
+ }
72
+
73
+ .toggle-formbuilder-label-text {
74
+ font-size: 16px;
75
+ color: #202C38;
76
+ font-family: "Lato", sans-serif;
77
+ font-weight: normal;
78
+ }
79
+
80
+ .info {
81
+ margin: 5px 0 0 0;
82
+ }
83
+
84
+ .multiple-inputs-container {
85
+ width: 100%;
86
+ display: flex;
87
+ flex-direction: row;
88
+ column-gap: 0.875rem;
89
+ }
90
+ </style>
@@ -0,0 +1,158 @@
1
+ <template>
2
+ <div class="toggle-input-container" :class="{'toggle-input-is-invalid':isInvalid }" @click="focusClosestInput">
3
+ <label v-if="label" :for="name ? name : 'ToggleInputNumberUnit' " class="toggle-input-label" >
4
+ {{ label }}
5
+ </label>
6
+ <input
7
+ :name="name ? name : 'ToggleInputNumberUnit' "
8
+ :class="[ 'toggle-input', size]"
9
+ :placeholder="placeholder ? placeholder : '' "
10
+ :autocomplete="autocomplete ? 'on' : 'off' "
11
+ :required="required"
12
+ v-model="inputVal"
13
+ @blur="onBlur"
14
+ @focus="onFocus"
15
+ @keyup="onKeyup"
16
+ />
17
+ <label class="toggle-input-label-error" v-if="isInvalid" :for="name ? name : 'ToggleInputNumberUnit' ">
18
+ {{ errorMessage }}
19
+ </label>
20
+ </div>
21
+ </template>
22
+
23
+ <script>
24
+
25
+ import { mixins } from '../mixins/mixins'
26
+
27
+ export default {
28
+ mixins:[mixins],
29
+ props: {
30
+ value: {
31
+ type: [Number, String]
32
+ },
33
+ allowBlank:{
34
+ type:Boolean,
35
+ default:false
36
+ },
37
+ name: {
38
+ type: String,
39
+ default: "ToggleInputNumberUnit"
40
+ },
41
+ label: {
42
+ type: String,
43
+ required: false
44
+ },
45
+ placeholder: {
46
+ type: String,
47
+ required: false
48
+ },
49
+ autocomplete: {
50
+ type: Boolean,
51
+ default: true
52
+ },
53
+ size: {
54
+ type: String,
55
+ validator: function (value) {
56
+ return ['extra-small', 'small', 'medium', 'large', 'full'].indexOf(value) !== -1
57
+ }
58
+ },
59
+ required: {
60
+ type: Boolean,
61
+ default: false
62
+ },
63
+ isInvalid: {
64
+ type: Boolean,
65
+ default: false
66
+ },
67
+ errorMessage: {
68
+ type: String,
69
+ required: false
70
+ },
71
+ appendString: {
72
+ type: String,
73
+ required: false
74
+ },
75
+ prependString: {
76
+ type: String,
77
+ required: false
78
+ }
79
+ },
80
+
81
+ data() {
82
+ return {
83
+ inputActive: false
84
+ };
85
+ },
86
+ computed: {
87
+ inputVal: {
88
+ get() {
89
+ if (this.inputActive) {
90
+ if((this.value === '' || this.value === null) && this.allowBlank)
91
+ return '';
92
+
93
+ return this.value;
94
+ } else {
95
+ if(this.value === '' || this.value == null || this.value === 0)
96
+ return '';
97
+
98
+ return this.value;
99
+ }
100
+ },
101
+ set(modifiedValue) {
102
+ this.$emit('input', modifiedValue);
103
+ }
104
+ },
105
+ appendStringLength() {
106
+ return this.appendString.length ?? 0;
107
+ },
108
+ prependStringLength() {
109
+ return this.prependString.length ?? 0;
110
+ }
111
+ },
112
+ methods: {
113
+ onKeyup() {
114
+ // Remove any non-numbers from the input value
115
+ this.$emit('input', this.value.replace(/[^0-9]/g,''))
116
+ },
117
+
118
+ onFocus() {
119
+ this.inputActive = true;
120
+ // When the user clicks in the box, remove the append and/or prepend values
121
+ if ((this.value != 0) && (this.value != '')) {
122
+ let tempValue = this.value;
123
+ if (this.appendString) {
124
+ // First take off the appended string
125
+ tempValue = this.value.slice(0, -this.appendStringLength)
126
+ }
127
+ if (this.prependString) {
128
+ // Then take off the prepended string
129
+ tempValue = tempValue.slice(this.prependStringLength, this.value.length)
130
+ }
131
+ this.$emit('input', tempValue);
132
+ }
133
+ },
134
+
135
+ onBlur(){
136
+ this.inputActive = false;
137
+
138
+ // Don't add the unit if the value is left empty
139
+ if (this.value != '') {
140
+ // When the user clicks out of the box, add the prepend and/or append values
141
+ let tempValue = this.value;
142
+ if (this.appendString) {
143
+ // First add the append string
144
+ tempValue += this.appendString;
145
+ }
146
+ if (this.prependString) {
147
+ // Then add the prepend string
148
+ tempValue = this.prependString + tempValue;
149
+ }
150
+ this.$emit('input', tempValue)
151
+ }
152
+ },
153
+ }
154
+ }
155
+
156
+
157
+
158
+ </script>
package/src/index.js CHANGED
@@ -51,6 +51,9 @@ import ToggleInfoText from "./components/text/ToggleInfoText.vue";
51
51
 
52
52
  import ToggleFontPicker from "./components/forms/ToggleFontPicker.vue";
53
53
 
54
+ import ToggleInputNumberUnit from "./components/forms/ToggleInputNumberUnit.vue";
55
+ import ToggleInputLabelLeft from "./components/forms/ToggleInputLabelLeft.vue";
56
+
54
57
  import './sass/main.scss';
55
58
 
56
59
  const Components = {
@@ -95,7 +98,9 @@ const Components = {
95
98
  ToggleHelperTextSmall,
96
99
  ToggleInfoText,
97
100
  ToggleInternationalPhoneInputSelect,
98
- ToggleFontPicker
101
+ ToggleFontPicker,
102
+ ToggleInputNumberUnit,
103
+ ToggleInputLabelLeft
99
104
  }
100
105
 
101
106
  Object.keys(Components).forEach(name => {
@@ -1,11 +1,15 @@
1
1
  .toggle-line-break {
2
2
  border-bottom: 1px solid $toggle-blue;
3
3
  }
4
+ .toggle-line-break-grey {
5
+ border-bottom: 1px solid #D1D1D1;
6
+ }
4
7
  .toggle-section-collapse {
5
8
  .toggle-section-collapse-header {
6
9
  width: 100%;
7
10
  min-height: 25px;
8
11
  padding: 1em 0;
12
+ cursor: pointer;
9
13
  }
10
14
  .toggle-section-collapse-title {
11
15
  max-width: 80%;
@@ -698,7 +698,7 @@ $iconWidth:20px;
698
698
  height:100%;
699
699
  box-sizing:border-box;
700
700
  padding:1rem 0;
701
- top:0;
701
+ top: 0.8rem;
702
702
  position: absolute;
703
703
  width:2rem;
704
704
  }
@@ -43,6 +43,7 @@
43
43
  height:1.5rem;
44
44
  right:1rem;
45
45
  cursor: pointer;
46
+ z-index: 99;
46
47
  opacity : 0.5;
47
48
  &:hover{
48
49
  opacity: 1;
@@ -81,3 +82,10 @@
81
82
  {
82
83
  -webkit-transform: scale(0.8);
83
84
  }
85
+
86
+ .toggle-grid-modal-button-container {
87
+ display: flex;
88
+ flex-direction: row;
89
+ justify-content: space-between;
90
+ margin-top: 20px;
91
+ }
@@ -51,7 +51,7 @@ a {
51
51
  }
52
52
 
53
53
  .toggle-info-text{
54
- font-size: 0.85rem;
54
+ font-size: 0.7rem;
55
55
  font-family: "Lato", sans-serif;
56
56
 
57
57
  color:$toggle-dark-blue;
@@ -60,14 +60,15 @@ a {
60
60
  padding-left: 1.25rem;
61
61
  margin-top: 5px;
62
62
  font-weight: normal;
63
- line-height: 1.5;
63
+ line-height: 1;
64
64
 
65
65
  &::before{
66
66
  content: url('../assets/icons/info.svg');
67
67
  width: 1rem;
68
68
  position: absolute;
69
69
  margin-left:-1.25rem;
70
- margin-top: 2px;
70
+ margin-top: -0.15rem;
71
+ transform: scale(0.85);
71
72
  }
72
73
 
73
74
  }