toggle-components-library 1.10.1

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 (149) hide show
  1. package/README.md +24 -0
  2. package/babel.config.js +5 -0
  3. package/dist/demo.html +10 -0
  4. package/dist/img/add_circle.7c6b29c6.svg +29 -0
  5. package/dist/img/arrow-left-blue-hover.5b0a1e54.svg +32 -0
  6. package/dist/img/arrow-left-blue.1e5404dd.svg +32 -0
  7. package/dist/img/arrow-right-blue-hover.b800a882.svg +32 -0
  8. package/dist/img/arrow-right-blue.fbc83729.svg +32 -0
  9. package/dist/img/arrow_down.787e1a8b.svg +28 -0
  10. package/dist/img/calendar.16f176cd.svg +37 -0
  11. package/dist/img/card.e1735960.svg +9 -0
  12. package/dist/img/checkbox_blank.907b325c.svg +6 -0
  13. package/dist/img/checkbox_checked.3e2d399f.svg +9 -0
  14. package/dist/img/checkbox_hover.e99ab40c.svg +3 -0
  15. package/dist/img/checkbox_inactive.b94b6c81.svg +9 -0
  16. package/dist/img/circle_blank.ab1622db.svg +24 -0
  17. package/dist/img/clipboard.e483ded3.svg +12 -0
  18. package/dist/img/delete-grey.cf15dcd1.svg +29 -0
  19. package/dist/img/delete.ee71bb54.svg +29 -0
  20. package/dist/img/drag_drop.0c778868.svg +14 -0
  21. package/dist/img/draggable.7493006c.svg +1 -0
  22. package/dist/img/edit_circle.4f3826d3.svg +34 -0
  23. package/dist/img/edit_circle_grey.0c96938c.svg +34 -0
  24. package/dist/img/email.078e944d.svg +7 -0
  25. package/dist/img/file.f4fb9e5d.svg +9 -0
  26. package/dist/img/graph.7f2e3985.svg +16 -0
  27. package/dist/img/grey_cross.2ac5fda1.svg +15 -0
  28. package/dist/img/info.4b233da4.svg +29 -0
  29. package/dist/img/megaphone.73161a8a.svg +19 -0
  30. package/dist/img/orders.51f8963f.svg +29 -0
  31. package/dist/img/search.db8f673f.svg +25 -0
  32. package/dist/img/tick-grey.b6d7b16c.svg +12 -0
  33. package/dist/img/tick.97f35963.svg +12 -0
  34. package/dist/img/tick_circle.417fd97d.svg +28 -0
  35. package/dist/img/tick_circle_grey.92b7e747.svg +32 -0
  36. package/dist/img/upload.9b0f1f1c.svg +30 -0
  37. package/dist/toggle-components-library.common.js +17714 -0
  38. package/dist/toggle-components-library.common.js.map +1 -0
  39. package/dist/toggle-components-library.css +1 -0
  40. package/dist/toggle-components-library.umd.js +17724 -0
  41. package/dist/toggle-components-library.umd.js.map +1 -0
  42. package/dist/toggle-components-library.umd.min.js +9 -0
  43. package/dist/toggle-components-library.umd.min.js.map +1 -0
  44. package/package-lock.json +20271 -0
  45. package/package.json +78 -0
  46. package/public/favicon.ico +0 -0
  47. package/public/index.html +17 -0
  48. package/src/assets/ProximaNova-Regular.otf +0 -0
  49. package/src/assets/icons/add_circle.svg +29 -0
  50. package/src/assets/icons/arrow-left-blue-hover.svg +32 -0
  51. package/src/assets/icons/arrow-left-blue.svg +32 -0
  52. package/src/assets/icons/arrow-right-blue-hover.svg +32 -0
  53. package/src/assets/icons/arrow-right-blue.svg +32 -0
  54. package/src/assets/icons/arrow_down.svg +28 -0
  55. package/src/assets/icons/calendar.svg +37 -0
  56. package/src/assets/icons/card.svg +9 -0
  57. package/src/assets/icons/checkbox_blank.svg +6 -0
  58. package/src/assets/icons/checkbox_checked.svg +9 -0
  59. package/src/assets/icons/checkbox_hover.svg +3 -0
  60. package/src/assets/icons/checkbox_inactive.svg +9 -0
  61. package/src/assets/icons/circle_blank.svg +24 -0
  62. package/src/assets/icons/clipboard.svg +12 -0
  63. package/src/assets/icons/delete-grey.svg +29 -0
  64. package/src/assets/icons/delete.svg +29 -0
  65. package/src/assets/icons/drag.svg +15 -0
  66. package/src/assets/icons/drag_drop.svg +14 -0
  67. package/src/assets/icons/draggable.svg +1 -0
  68. package/src/assets/icons/draggable.textClipping +0 -0
  69. package/src/assets/icons/edit_circle.svg +34 -0
  70. package/src/assets/icons/edit_circle_grey.svg +34 -0
  71. package/src/assets/icons/email.svg +7 -0
  72. package/src/assets/icons/file.svg +9 -0
  73. package/src/assets/icons/graph.svg +16 -0
  74. package/src/assets/icons/grey_cross.svg +15 -0
  75. package/src/assets/icons/info.svg +29 -0
  76. package/src/assets/icons/megaphone.svg +19 -0
  77. package/src/assets/icons/orders.svg +29 -0
  78. package/src/assets/icons/search.svg +25 -0
  79. package/src/assets/icons/tick-grey.svg +12 -0
  80. package/src/assets/icons/tick.svg +12 -0
  81. package/src/assets/icons/tick_circle.svg +28 -0
  82. package/src/assets/icons/tick_circle_grey.svg +32 -0
  83. package/src/assets/icons/upload.svg +30 -0
  84. package/src/assets/img/airship.svg +42 -0
  85. package/src/assets/img/toggle.svg +1 -0
  86. package/src/assets/logo.png +0 -0
  87. package/src/components/badges/ToggleBadge.vue +23 -0
  88. package/src/components/breadcrumb/ToggleBreadCrumb.vue +43 -0
  89. package/src/components/buttons/ToggleButton.vue +88 -0
  90. package/src/components/buttons/ToggleFeatureButton.vue +68 -0
  91. package/src/components/elements/ToggleLineBreak.vue +9 -0
  92. package/src/components/forms/ToggleColourPicker.vue +192 -0
  93. package/src/components/forms/ToggleDatePicker.vue +168 -0
  94. package/src/components/forms/ToggleDateRangePicker.vue +208 -0
  95. package/src/components/forms/ToggleInputCheckbox.vue +74 -0
  96. package/src/components/forms/ToggleInputCheckboxContainer.vue +65 -0
  97. package/src/components/forms/ToggleInputCheckboxInline.vue +74 -0
  98. package/src/components/forms/ToggleInputCrudField.vue +95 -0
  99. package/src/components/forms/ToggleInputCurrency.vue +198 -0
  100. package/src/components/forms/ToggleInputFile.vue +101 -0
  101. package/src/components/forms/ToggleInputGrid.vue +409 -0
  102. package/src/components/forms/ToggleInputGroup.vue +48 -0
  103. package/src/components/forms/ToggleInputImage.vue +168 -0
  104. package/src/components/forms/ToggleInputNumber.vue +164 -0
  105. package/src/components/forms/ToggleInputPercentage.vue +142 -0
  106. package/src/components/forms/ToggleInputRadioButtonGroup.vue +81 -0
  107. package/src/components/forms/ToggleInputRadioButtons.vue +136 -0
  108. package/src/components/forms/ToggleInputSearch.vue +235 -0
  109. package/src/components/forms/ToggleInputSelect.vue +109 -0
  110. package/src/components/forms/ToggleInputText.vue +130 -0
  111. package/src/components/forms/ToggleInputTextArea.vue +123 -0
  112. package/src/components/forms/ToggleInputWebsite.vue +163 -0
  113. package/src/components/forms/ToggleInternationalPhoneInputSelect.vue +166 -0
  114. package/src/components/loaders/ToggleFillLoader.vue +34 -0
  115. package/src/components/mixins/mixins.js +48 -0
  116. package/src/components/modals/ToggleModal.vue +83 -0
  117. package/src/components/navs/sidenav/ToggleSideNav.vue +45 -0
  118. package/src/components/navs/sidenav/ToggleSideNavItem.vue +32 -0
  119. package/src/components/navs/sidenav/ToggleSideSubNav.vue +24 -0
  120. package/src/components/notifications/ToggleNotifications.vue +93 -0
  121. package/src/components/tables/TogglePagination.vue +114 -0
  122. package/src/components/tables/ToggleTable.vue +178 -0
  123. package/src/components/tables/ToggleTableColumn.vue +3 -0
  124. package/src/components/tables/ToggleTableRow.vue +5 -0
  125. package/src/components/text/ToggleHeaderTextLarge.vue +3 -0
  126. package/src/components/text/ToggleHelperTextSmall.vue +3 -0
  127. package/src/components/text/ToggleInfoText.vue +3 -0
  128. package/src/components/text/ToggleTextClipboardCopy.vue +51 -0
  129. package/src/index.js +105 -0
  130. package/src/sass/includes/_as_animations.scss +8 -0
  131. package/src/sass/includes/_as_badges.scss +27 -0
  132. package/src/sass/includes/_as_breadcrumb.scss +39 -0
  133. package/src/sass/includes/_as_buttons.scss +235 -0
  134. package/src/sass/includes/_as_elements.scss +3 -0
  135. package/src/sass/includes/_as_fonts.scss +12 -0
  136. package/src/sass/includes/_as_globals.scss +1 -0
  137. package/src/sass/includes/_as_gridbuilder.scss +136 -0
  138. package/src/sass/includes/_as_inputs.scss +900 -0
  139. package/src/sass/includes/_as_loader.scss +37 -0
  140. package/src/sass/includes/_as_loaders.scss +41 -0
  141. package/src/sass/includes/_as_modals.scss +83 -0
  142. package/src/sass/includes/_as_navs.scss +120 -0
  143. package/src/sass/includes/_as_notifications.scss +30 -0
  144. package/src/sass/includes/_as_sizes.scss +4 -0
  145. package/src/sass/includes/_as_table.scss +276 -0
  146. package/src/sass/includes/_as_text.scss +73 -0
  147. package/src/sass/includes/_as_variables.scss +49 -0
  148. package/src/sass/main.scss +20 -0
  149. package/vue.config.js +8 -0
@@ -0,0 +1,74 @@
1
+ <template>
2
+
3
+ <label class="toggle-input-checkbox-inline" >
4
+ <input type="checkbox" :name="name ? name : 'ToggleInputCheckbox' " v-model="inputVal" :disabled="disabled"/>
5
+ <div>
6
+ <span class="toggle-input-checkbox-check-element "></span>
7
+ <span :class="[ 'toggle-input-checkbox-label', label_style ]" >{{label}}</span>
8
+ </div>
9
+ </label>
10
+
11
+ </template>
12
+
13
+ <script>
14
+
15
+ import { mixins } from '../mixins/mixins'
16
+
17
+ export default {
18
+ mixins:[mixins],
19
+ props: {
20
+ value: {
21
+ type: Boolean
22
+ },
23
+ disabled: {
24
+ type: Boolean
25
+ },
26
+ name: {
27
+ type: String,
28
+ default: "ToggleInputText"
29
+ },
30
+ label_style: {
31
+ type: String,
32
+ default: ""
33
+ },
34
+ label: {
35
+ type: String,
36
+ required: false
37
+ },
38
+ isInvalid: {
39
+ type: Boolean,
40
+ default: false
41
+ },
42
+ errorMessage: {
43
+ type: String,
44
+ required: false
45
+ }
46
+ },
47
+
48
+ created : function(){
49
+ },
50
+ computed: {
51
+ inputVal: {
52
+ get: function (){
53
+ return this.value;
54
+ },
55
+
56
+ set: function (value){
57
+ this.$emit('input', value);
58
+ }
59
+ }
60
+ },
61
+ methods: {
62
+
63
+ onFocus() {
64
+ this.$emit('onFocus');
65
+ },
66
+
67
+ onBlur(){
68
+ this.$emit('onBlur');
69
+ },
70
+ }
71
+ }
72
+
73
+
74
+ </script>
@@ -0,0 +1,95 @@
1
+ <template>
2
+
3
+ <div class="toggle-input-crud-container" :class="{'toggle-input-is-invalid':isInvalid, 'toggle-input-crud-container-empty':empty }" @click="clickEmpty">
4
+ <label
5
+ v-if="label && !empty"
6
+ class="toggle-input-crud-container-label"
7
+ > {{ label }}
8
+ </label>
9
+ <button
10
+ v-if="label && empty"
11
+ @click="$emit('add')"
12
+ :class="['toggle-input-crud-container-label',{'toggle-input-crud-container-label-vertical-center':!description}]"
13
+ > {{ label }}
14
+ </button>
15
+ <label
16
+ class="toggle-input-crud-container-description"
17
+ > {{ description ? description : '&nbsp;' }}
18
+ </label>
19
+
20
+ <div class="toggle-input-crud-container-buttons">
21
+ <ToggleButton
22
+ v-if="!empty"
23
+ buttonStyle="mini_edit"
24
+ @click="$emit('edit')"
25
+ />
26
+ <ToggleButton
27
+ v-if="!empty"
28
+ buttonStyle="mini_delete"
29
+ @click="$emit('delete')"
30
+ />
31
+ </div>
32
+
33
+ <label
34
+ class="toggle-input-label-error"
35
+ v-if="isInvalid"
36
+ >
37
+ {{ errorMessage }}
38
+ </label>
39
+ </div>
40
+ </template>
41
+
42
+ <script>
43
+
44
+ import { mixins } from '../mixins/mixins'
45
+ import ToggleButton from '../buttons/ToggleButton.vue';
46
+
47
+ export default {
48
+ mixins:[mixins],
49
+ components:{ToggleButton},
50
+ props: {
51
+ value: {
52
+ type: [Number,String]
53
+ },
54
+ label: {
55
+ type: String,
56
+ required: false
57
+ },
58
+ description: {
59
+ type: String,
60
+ required: false
61
+ },
62
+ isInvalid: {
63
+ type: Boolean,
64
+ default: false
65
+ },
66
+ errorMessage: {
67
+ type: String,
68
+ required: false
69
+ },
70
+ empty:{
71
+ type: Boolean,
72
+ default: false
73
+ }
74
+ },
75
+
76
+ created : function(){
77
+ },
78
+ computed: {
79
+
80
+ },
81
+ methods: {
82
+
83
+ clickEmpty(e)
84
+ {
85
+ if(this.empty && e.target.nodeName !== 'BUTTON'){
86
+ this.$emit('add');
87
+ }
88
+ }
89
+
90
+
91
+ }
92
+ }
93
+
94
+
95
+ </script>
@@ -0,0 +1,198 @@
1
+ <template>
2
+
3
+
4
+
5
+
6
+ <div class="toggle-input-container" :class="{'toggle-input-is-invalid':isInvalid }" v-on:click="focusClosestInput">
7
+ <label
8
+ v-if="label"
9
+ :for="name ? name : 'InputText' "
10
+ class="toggle-input-label"
11
+ > {{ label }}
12
+ </label>
13
+ <input
14
+ :name="name ? name : 'ToggleInputCurrency' "
15
+ :class="[ 'toggle-input', size]"
16
+ :placeholder="placeholder ? placeholder : '' "
17
+ :autocomplete="autocomplete ? 'on' : 'off' "
18
+ :required="required"
19
+ v-model="inputVal"
20
+ @blur="isInputActive = false"
21
+ @focus="isInputActive = true"
22
+ />
23
+ <label
24
+ class="toggle-input-label-error"
25
+ v-if="isInvalid"
26
+ :for="name ? name : 'ToggleInputCurrency' "
27
+ >
28
+ {{ errorMessage }}
29
+ </label>
30
+ </div>
31
+ </template>
32
+
33
+ <script>
34
+
35
+ import { mixins } from '../mixins/mixins'
36
+
37
+ export default {
38
+ mixins:[mixins],
39
+ props: {
40
+ value: {
41
+ type: [Number, String]
42
+ },
43
+ allowBlank:{
44
+ type:Boolean,
45
+ default:false
46
+ },
47
+ name: {
48
+ type: String,
49
+ default: "ToggleInputCurrency"
50
+ },
51
+ label: {
52
+ type: String,
53
+ required: false
54
+ },
55
+ currencyCode:{
56
+ type:String,
57
+ required:false,
58
+ default:'GBP'
59
+ },
60
+ currencyLocale:{
61
+ type:String,
62
+ required:false,
63
+ default:'en-GB'
64
+ },
65
+ placeholder: {
66
+ type: String,
67
+ required: false
68
+ },
69
+ autocomplete: {
70
+ type: Boolean,
71
+ default: true
72
+ },
73
+ size: {
74
+ type: String,
75
+ validator: function (value) {
76
+ return ['extra-small', 'small', 'medium', 'large', 'full'].indexOf(value) !== -1
77
+ }
78
+ },
79
+ required: {
80
+ type: Boolean,
81
+ default: false
82
+ },
83
+ isInvalid: {
84
+ type: Boolean,
85
+ default: false
86
+ },
87
+ errorMessage: {
88
+ type: String,
89
+ required: false
90
+ },
91
+ currencyDenomination: {
92
+ type: Number,
93
+ default: 100
94
+ }
95
+
96
+ },
97
+
98
+ created : function(){
99
+ },
100
+
101
+ data : function(){
102
+ return {
103
+ isInputActive: false
104
+ };
105
+ },
106
+ computed: {
107
+
108
+ inputVal: {
109
+
110
+
111
+ get: function() {
112
+
113
+ if (this.isInputActive) {
114
+ if((this.value === '' || this.value === null) && this.allowBlank)
115
+ return '';
116
+ // Cursor is inside the input field. unformat display value for user
117
+ return (this.value/this.currencyDenomination).toLocaleString(this.currencyLocale);
118
+ } else {
119
+ if(this.value === '' || this.value == null)
120
+ return '';
121
+ // User is not modifying now. Format display value for user interface
122
+
123
+ return (this.value/this.currencyDenomination).toLocaleString(this.currencyLocale, {style: 'currency', currency: this.currencyCode});
124
+
125
+
126
+ }
127
+ },
128
+ set: function(modifiedValue) {
129
+
130
+ // if the decimal seperator is a comma replace any inputted commas to periods
131
+ let newValue = this.unformatString(modifiedValue);
132
+
133
+ // Recalculate value after ignoring "$" and "," in user input
134
+ // let newValue = parseFloat(modifiedValue.replace(/[^\d.]/g, ""));
135
+ // Ensure that it is not NaN
136
+ if (isNaN(newValue)){
137
+ if(this.allowBlank)
138
+ newValue = '';
139
+ else
140
+ newValue = 0;
141
+ }
142
+ // Note: we cannot set this.value as it is a "prop". It needs to be passed to parent component
143
+ // $emit the event so that parent component gets it
144
+ if(newValue !== '')
145
+ newValue = Math.round(newValue*this.currencyDenomination);
146
+
147
+
148
+ this.$emit('input', newValue);
149
+
150
+ }
151
+
152
+
153
+
154
+
155
+ }
156
+ },
157
+ methods: {
158
+
159
+
160
+ /**
161
+ * Unformats from locale currency to float
162
+ */
163
+
164
+ unformatString(string) {
165
+
166
+ var parts = (1234.5).toLocaleString(this.currencyLocale).match(/(\D+)/g);
167
+ var unformatted = string;
168
+
169
+ unformatted = unformatted.split(parts[0]).join("");
170
+ unformatted = unformatted.split(parts[1]).join(".");
171
+
172
+ return parseFloat(unformatted);
173
+
174
+ },
175
+
176
+ /*
177
+ * Concat message for count characters
178
+ * @return string
179
+ */
180
+ messageLength(count, maxLenght)
181
+ {
182
+ let mcount = count ? count.length : 0;
183
+ return mcount+' / '+maxLenght;
184
+ },
185
+
186
+ onFocus() {
187
+ this.$emit('onFocus');
188
+ },
189
+
190
+ onBlur(){
191
+ this.$emit('onBlur');
192
+ },
193
+ }
194
+ }
195
+
196
+
197
+
198
+ </script>
@@ -0,0 +1,101 @@
1
+ <template>
2
+
3
+ <div class="toggle-input-container" :class="{'toggle-input-is-invalid':isInvalid }" v-on:click="focusClosestInput">
4
+ <label
5
+ v-if="label"
6
+ class="toggle-input-label"
7
+ > {{ label }}
8
+ </label>
9
+ <div class="toggle-dropzone-container toggle-dropzone-file-container" :class="fileExists ? 'toggle-input-file-background' : ''" >
10
+ <ToggleFillLoader v-if="loading"/>
11
+ <vue-dropzone
12
+ ref="dropzone"
13
+ class="dropzone"
14
+ :id="'dropzone'+_uid"
15
+ :options="dropzoneOptions"
16
+ @vdropzone-file-added="fileAdded"
17
+ v-show="!fileExists"
18
+ />
19
+ </div>
20
+ <p class="toggle-helper-text" v-if="helperText"> {{helperText}} </p>
21
+ <ToggleButton class="toggle-button-float-left" buttonStyle="abort" buttonText="Remove file" v-if="fileExists" @click="removeFile" />
22
+ <label
23
+ class="toggle-input-label-error"
24
+ v-if="isInvalid"
25
+ >
26
+ {{ errorMessage }}
27
+ </label>
28
+ </div>
29
+ </template>
30
+
31
+ <script>
32
+
33
+ import { mixins } from '../mixins/mixins'
34
+ import ToggleButton from '../buttons/ToggleButton.vue';
35
+ import ToggleFillLoader from '../loaders/ToggleFillLoader.vue';
36
+
37
+ import vue2Dropzone from 'vue2-dropzone';
38
+ import 'vue2-dropzone/dist/vue2Dropzone.min.css'
39
+
40
+ export default {
41
+ mixins:[mixins],
42
+ props: {
43
+ fileExists:{
44
+ type: [Boolean]
45
+ },
46
+ fileAdded:{ // function to call when file added to dropzone
47
+
48
+ },
49
+ removeFile:{ // function to call when file is removed
50
+
51
+ },
52
+ helperText:{
53
+ type:String
54
+ },
55
+ label: {
56
+ type: String,
57
+ required: false
58
+ },
59
+ isInvalid: {
60
+ type: Boolean,
61
+ default: false
62
+ },
63
+ errorMessage: {
64
+ type: String,
65
+ required: false
66
+ },
67
+ dropzoneOptions:{
68
+ type: Object,
69
+ required:true
70
+ },
71
+ loading:{
72
+ type:Boolean,
73
+ default:false
74
+ }
75
+ },
76
+
77
+ components: {
78
+ vueDropzone: vue2Dropzone,
79
+ ToggleButton,
80
+ ToggleFillLoader
81
+ },
82
+
83
+ data : function(){
84
+ return {};
85
+ },
86
+
87
+ created : function(){
88
+ },
89
+ computed: {
90
+
91
+ },
92
+ methods: {
93
+
94
+
95
+
96
+
97
+ }
98
+ }
99
+
100
+
101
+ </script>