toggle-components-library 1.15.0 → 1.16.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.15.0",
3
+ "version": "1.16.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -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>
@@ -1,21 +1,23 @@
1
1
  <template>
2
2
  <div class="toggle-input-container" :class="{'toggle-input-is-invalid':isInvalid }">
3
3
 
4
- <div ref="colorpicker">
5
- <label class="toggle-input-label">{{label}}</label>
6
- <input :name="name" type="text" class="toggle-input-colour-picker toggle-input" v-model="colorValue" @input="updateFromInput" :style="'outline-color:'+borderColour"/>
7
- <span class="toggle-color-picker-current-color" :style="'background-color: ' + borderColour" @click="togglePicker()"></span>
4
+ <div class="color-picker-container" ref="colorpicker">
5
+ <div>
6
+ <label class="toggle-input-label">{{label}}</label>
7
+ <input :name="name" type="text" class="toggle-input-colour-picker toggle-input" v-model="colorValue" @input="updateFromInput" :style="'outline-color:'+borderColour"/>
8
+ <span class="toggle-color-picker-current-color" :style="'background-color: ' + borderColour" @click="togglePicker()"></span>
9
+ </div>
10
+
11
+ <chrome-picker class="toggle-chrome-picker" :value="colors" v-if="displayPicker" @input="updateFromPicker"/>
12
+
13
+ <label
14
+ class="toggle-input-label-error"
15
+ v-if="isInvalid"
16
+ :for="name ? name : 'ToggleInputText' "
17
+ >
18
+ {{ errorMessage }}
19
+ </label>
8
20
  </div>
9
-
10
- <chrome-picker class="toggle-chrome-picker" :value="colors" v-if="displayPicker" @input="updateFromPicker"/>
11
-
12
- <label
13
- class="toggle-input-label-error"
14
- v-if="isInvalid"
15
- :for="name ? name : 'ToggleInputText' "
16
- >
17
- {{ errorMessage }}
18
- </label>
19
21
  </div>
20
22
  </template>
21
23
 
@@ -167,7 +169,6 @@ export default {
167
169
  },
168
170
 
169
171
  documentClick(e) {
170
- console.log('fda');
171
172
  var el = this.$refs.colorpicker,
172
173
  target = e.target;
173
174
  if(el !== target && !el.contains(target)) {
@@ -48,6 +48,7 @@ export default {
48
48
  'Bodoni Moda',
49
49
  'EB Garamond',
50
50
  'Fredoka One',
51
+ 'Helvetica',
51
52
  'IBM Plex Mono',
52
53
  'Lato',
53
54
  'Libre Baskerville',
@@ -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>
package/src/index.js CHANGED
@@ -52,6 +52,7 @@ import ToggleInfoText from "./components/text/ToggleInfoText.vue";
52
52
  import ToggleFontPicker from "./components/forms/ToggleFontPicker.vue";
53
53
 
54
54
  import ToggleInputNumberUnit from "./components/forms/ToggleInputNumberUnit.vue";
55
+ import ToggleInputLabelLeft from "./components/forms/ToggleInputLabelLeft.vue";
55
56
 
56
57
  import './sass/main.scss';
57
58
 
@@ -98,7 +99,8 @@ const Components = {
98
99
  ToggleInfoText,
99
100
  ToggleInternationalPhoneInputSelect,
100
101
  ToggleFontPicker,
101
- ToggleInputNumberUnit
102
+ ToggleInputNumberUnit,
103
+ ToggleInputLabelLeft
102
104
  }
103
105
 
104
106
  Object.keys(Components).forEach(name => {
@@ -9,6 +9,7 @@
9
9
  width: 100%;
10
10
  min-height: 25px;
11
11
  padding: 1em 0;
12
+ cursor: pointer;
12
13
  }
13
14
  .toggle-section-collapse-title {
14
15
  max-width: 80%;
@@ -6,6 +6,7 @@
6
6
  display: flex;
7
7
  align-items: center;
8
8
  position:relative;
9
+ overflow-y: hidden;
9
10
  }
10
11
  .toggle-grid-input-row-preview{
11
12
  width: calc(100% - 8rem);
@@ -634,6 +634,7 @@ $iconWidth:20px;
634
634
  height: 2rem;
635
635
  width: 2rem;
636
636
  border-radius: 0% 50% 50% 0%;
637
+ margin-left: -5px;
637
638
  }
638
639
  .toggle-input-colour-picker {
639
640
  box-shadow: 0px 0px 1px $toggle-placeholder-grey;
@@ -698,7 +699,7 @@ $iconWidth:20px;
698
699
  height:100%;
699
700
  box-sizing:border-box;
700
701
  padding:1rem 0;
701
- top:0;
702
+ top: 0.8rem;
702
703
  position: absolute;
703
704
  width:2rem;
704
705
  }
@@ -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
  }