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,163 @@
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
+ :for="name ? name : 'InputWebsite' "
7
+ class="toggle-input-label"
8
+ > {{ label }}
9
+ </label>
10
+ <select class="toggle-input toggle-input-protocol" name="protocol" v-model="protocol" :required="required">
11
+ <option value="http://">http://</option>
12
+ <option value="https://">https://</option>
13
+ </select>
14
+ <input
15
+ :type="type"
16
+ :name="name ? name : 'ToggleInputwebsite' "
17
+ :class="[ 'toggle-input toggle-input-website', size]"
18
+ :placeholder="placeholder ? placeholder : '' "
19
+ :autocomplete="autocomplete ? 'on' : 'off' "
20
+ :required="required"
21
+ v-model="website"
22
+ :maxlength="maxLength"
23
+ v-on:blur="setWebsite"
24
+ />
25
+ <label
26
+ class="toggle-input-label-error"
27
+ v-if="isInvalid"
28
+ :for="name ? name : 'ToggleInputwebsite' "
29
+ >
30
+ {{ errorMessage }}
31
+ </label>
32
+ </div>
33
+ </template>
34
+
35
+ <script>
36
+
37
+ import { mixins } from '../mixins/mixins'
38
+
39
+ export default {
40
+ mixins:[mixins],
41
+ props: {
42
+ value: {
43
+ type: [Number,String]
44
+ },
45
+ type: {
46
+ type: String,
47
+ required: true,
48
+ validator: function (value) {
49
+ return ['text', 'email', 'number', 'password'].indexOf(value) !== -1
50
+ }
51
+ },
52
+ name: {
53
+ type: String,
54
+ default: "ToggleInputWebsite"
55
+ },
56
+ label: {
57
+ type: String,
58
+ required: false
59
+ },
60
+ placeholder: {
61
+ type: String,
62
+ required: false
63
+ },
64
+ autocomplete: {
65
+ type: Boolean,
66
+ default: true
67
+ },
68
+ size: {
69
+ type: String,
70
+ validator: function (value) {
71
+ return ['extra-small', 'small', 'medium', 'large', 'full'].indexOf(value) !== -1
72
+ }
73
+ },
74
+ required: {
75
+ type: Boolean,
76
+ default: false
77
+ },
78
+ isInvalid: {
79
+ type: Boolean,
80
+ default: false
81
+ },
82
+ errorMessage: {
83
+ type: String,
84
+ required: false
85
+ },
86
+ maxLength:{
87
+ type: Number,
88
+ required:false
89
+ }
90
+ },
91
+ data : function(){
92
+ return {
93
+ protocol : "https://",
94
+ website : ""
95
+ };
96
+ },
97
+ created : function(){
98
+ },
99
+ computed: {
100
+ inputVal: {
101
+ get: function (){
102
+ return this.value;
103
+ },
104
+
105
+ set: function (value){
106
+ this.$emit('input', value);
107
+ }
108
+ }
109
+ },
110
+ watch:{
111
+
112
+ website : function()
113
+ {
114
+ this.inputVal = this.protocol + this.website;
115
+ },
116
+ protocol : function()
117
+ {
118
+ this.inputVal = this.protocol + this.website;
119
+ }
120
+
121
+ },
122
+ methods: {
123
+
124
+ /*
125
+ * Concat message for count characters
126
+ * @return string
127
+ */
128
+ messageLength(count, maxLenght)
129
+ {
130
+ let mcount = count ? count.length : 0;
131
+ return mcount+' / '+maxLenght;
132
+ },
133
+
134
+ onFocus() {
135
+ this.$emit('onFocus');
136
+ },
137
+
138
+ onBlur(){
139
+ this.$emit('onBlur');
140
+ },
141
+
142
+ setWebsite(){
143
+ if(this.inputVal) {
144
+
145
+ this.website = this.website.replace(/(^\w+:|^)\/\//, '');
146
+ var arr = this.inputVal.split("/");
147
+
148
+ if(arr[2] === 'http:' || arr[2] === 'https:'){
149
+ this.protocol = arr[2] + "//";
150
+ } else {
151
+ this.protocol = arr[0] + "//";
152
+ }
153
+
154
+ } else {
155
+ this.protocol = 'https://';
156
+ this.website = '';
157
+ }
158
+ },
159
+ }
160
+ }
161
+
162
+
163
+ </script>
@@ -0,0 +1,166 @@
1
+ <template>
2
+ <div class="toggle-country-wrapper" >
3
+ <div class="toggle-country-selector">
4
+ <label
5
+ v-if="label"
6
+ :for="name ? name : 'InternationalPhone' "
7
+ class="toggle-input-label"
8
+ > {{ label }}
9
+ </label>
10
+ <select
11
+ class="toggle-input-select-country select"
12
+ v-model="countrySelectormodel"
13
+ aria-placeholder="Select country"
14
+
15
+ >
16
+ <option
17
+ value=""
18
+ selected
19
+ data-default
20
+ :required="required"
21
+ >
22
+ {{placeholder ? placeholder : 'Country'}}
23
+ </option>
24
+ <option
25
+ v-bind:value="country"
26
+ v-for="country in countries"
27
+ :key="country.name"
28
+ >
29
+ {{ country.name + ' ' + country.emoji }}
30
+ </option>
31
+ </select>
32
+ <div class="toggle-selected-wraper">
33
+
34
+ <div class="selected_number_code">
35
+ {{ ' (+'+inputVal.areaCode+')' }}
36
+ </div>
37
+ <div class="toggle-selected-country-emoji">
38
+ {{ countrySelectormodel.emoji }}
39
+ </div>
40
+ </div>
41
+ </div>
42
+ <input
43
+ type="tel"
44
+ class="toggle-input-select-country toggle-number"
45
+ :class="{'toggle-invalid-number':isInvalid }"
46
+ :name="name ? name : 'InputTel' "
47
+ :placeholder="placeholder ? placeholder : 'Mobile Number' "
48
+ :required="required"
49
+ v-model="inputVal.lineNumber"
50
+ />
51
+ <label
52
+ class="toggle-input-label-error "
53
+ v-if="isInvalid"
54
+ :for="name ? name : 'InternationalPhone' "
55
+ >
56
+ {{ componentError }}
57
+ </label>
58
+ </div>
59
+ </template>
60
+
61
+ <script>
62
+ import 'countries-list';
63
+
64
+ export default {
65
+ data() {
66
+ return {
67
+ InternationalPhoneVal: '',
68
+ countries: {},
69
+ countrySelectormodel:''
70
+ }
71
+ },
72
+ props: {
73
+ value: {
74
+ type: Object,
75
+ default: {
76
+ areaCode: '44',
77
+ lineNumber: ''
78
+ }
79
+ },
80
+ name: {
81
+ type: String,
82
+ default: "InternationalPhone"
83
+ },
84
+ label: {
85
+ type: String,
86
+ required: false
87
+ },
88
+ placeholder: {
89
+ type: String,
90
+ required: false
91
+ },
92
+ required: {
93
+ type: Boolean,
94
+ default: false
95
+ },
96
+ isInvalid: {
97
+ type: Boolean,
98
+ default: false
99
+ },
100
+ componentError: {
101
+ type: String,
102
+ required: false
103
+ }
104
+ },
105
+ computed: {
106
+ inputVal: {
107
+ get: function (){
108
+ return this.value
109
+ },
110
+
111
+ set: function (value){
112
+ this.$emit('input', value)
113
+ }
114
+ }
115
+ },
116
+ watch:{
117
+ countrySelectormodel(newVal){
118
+ this.inputVal.areaCode = newVal.phone;
119
+ }
120
+
121
+ },
122
+ mounted(){
123
+ const {countries,getUnicode } = require('countries-list');
124
+ this.setDefaultContry(countries);
125
+ },
126
+ methods: {
127
+
128
+ // Sets the selected country on page load
129
+ setDefaultContry(countries){
130
+
131
+ // convert the counties object into a sensible payload (array of objects) so that it can be sorted alphabetically.
132
+ let co = Object.keys(countries).map(function(key, index) {
133
+ countries[key].code = key;
134
+ return (countries[key]);
135
+ });
136
+
137
+ // sort the countires by name, alphabetically
138
+ this.countries = co.sort(function(a, b) {
139
+ if(a.name < b.name) return -1;
140
+ if(a.name > b.name) return 1;
141
+ return 0;
142
+ });
143
+
144
+ // if a value hasn't been set, lets select UK as default
145
+ if(!this.value.areaCode){
146
+ this.value.areaCode = '44';
147
+ }
148
+
149
+ // some provinces share phone country codes, including the UK, if it's a 44 number, let's select United Kingdom by default
150
+ // otherwise just select the first country found that's a match.
151
+ let possibleCountries = this.countries.filter(country => country.phone == this.value.areaCode);
152
+ let gb = possibleCountries.filter(country => country.code == 'GB');
153
+ this.countrySelectormodel = gb.length ? gb[0] : possibleCountries.length ? possibleCountries[0] : '';
154
+ },
155
+
156
+ onFocus() {
157
+ this.$emit('onFocus');
158
+ },
159
+
160
+ onBlur(){
161
+ this.$emit('onBlur');
162
+ },
163
+ }
164
+ }
165
+
166
+ </script>
@@ -0,0 +1,34 @@
1
+ <template>
2
+ <div class="toggle-fill-loader-container">
3
+ <div class="toggle-fill-loader-container-background">
4
+ <div class="toggle-fill-loader" ></div>
5
+ </div>
6
+ </div>
7
+ </template>
8
+
9
+ <script>
10
+ export default {
11
+ name: 'ButtonPrimary',
12
+ props: {
13
+ buttonText: {
14
+ type: String,
15
+ default: "button"
16
+ },
17
+ type: {
18
+ type: String,
19
+ default: "text"
20
+ },
21
+ disabled: {
22
+ default: false
23
+ },
24
+ loading: {
25
+ type: Boolean,
26
+ default: false
27
+ },
28
+ buttonStyle:{
29
+ type:String,
30
+ default:'confirm'
31
+ }
32
+ }
33
+ }
34
+ </script>
@@ -0,0 +1,48 @@
1
+
2
+ export const mixins = {
3
+ data(){
4
+ return {}
5
+ },
6
+ methods:{
7
+
8
+ // When a container is clicked, the cosest internal input is focused.
9
+ focusClosestInput(event)
10
+ {
11
+ if(event.target.querySelector('input, textarea') !== null)
12
+ event.target.querySelector('input, textarea').focus();
13
+ },
14
+
15
+ // Pass in a string date YYYY-MM-DD and returned as DD/MM/YYYY
16
+ dateRangeView(date)
17
+ {
18
+ let formattedDate = ''
19
+ if (date) {
20
+ let splitdate = date.split("-");
21
+ formattedDate = splitdate[2]+'/'+splitdate[1]+'/'+splitdate[0];
22
+ }
23
+ return formattedDate
24
+ },
25
+
26
+ // Pass in a Javascript Date object and return as a string YYYY-MM-DD
27
+ formatDate(date)
28
+ {
29
+
30
+ if(!date)
31
+ return '';
32
+
33
+ let dd = date.getDate();
34
+ let mm = date.getMonth()+1;
35
+ let yyyy = date.getFullYear();
36
+
37
+ // add zeros to single figures
38
+ if(dd<10)
39
+ dd='0'+dd;
40
+ if(mm<10)
41
+ mm='0'+mm;
42
+
43
+ return yyyy+'-'+mm+'-'+dd;
44
+
45
+ },
46
+
47
+ }
48
+ }
@@ -0,0 +1,83 @@
1
+ <template>
2
+ <transition name="toggle-modal">
3
+ <div class="toggle-modal-mask toggle-modal-close" v-if="showModal" @click="backgroundClick">
4
+ <div class="toggle-modal-wrapper toggle-modal-close" >
5
+ <div class="toggle-modal-container" :style="{'max-width':maxwidth}" >
6
+
7
+ <span class="toggle-modal-close-button" @click="showModal = false"></span>
8
+
9
+ <slot></slot>
10
+
11
+ </div>
12
+ </div>
13
+ </div>
14
+ </transition>
15
+ </template>
16
+
17
+ <script>
18
+
19
+ import { mixins } from '../mixins/mixins'
20
+
21
+
22
+
23
+ export default {
24
+ mixins:[mixins],
25
+ props: {
26
+ name: {
27
+ type: String,
28
+ required: true
29
+ },
30
+ maxwidth: {
31
+ type:[String]
32
+ }
33
+ },
34
+
35
+ components: {
36
+
37
+
38
+ },
39
+
40
+ data : function(){
41
+ return {
42
+ showModal:false
43
+ };
44
+ },
45
+ created : function(){
46
+ this.$toggle_event.$on('modal_show', this.show);
47
+ this.$toggle_event.$on('modal_hide', this.hide);
48
+
49
+ },
50
+ beforeDestroy() {
51
+ this.$toggle_event.$off('modal_show', this.show);
52
+ this.$toggle_event.$off('modal_hide', this.hide);
53
+ },
54
+ computed: {
55
+
56
+ },
57
+ methods: {
58
+
59
+ show(payload)
60
+ {
61
+ if(payload == this.name)
62
+ this.showModal = true;
63
+ },
64
+ hide(payload)
65
+ {
66
+ if(payload == this.name)
67
+ this.showModal = false;
68
+ },
69
+
70
+ backgroundClick(e)
71
+ {
72
+ if(e.target.classList.contains('toggle-modal-close'))
73
+ this.showModal = false;
74
+ }
75
+
76
+
77
+
78
+
79
+ }
80
+ }
81
+
82
+
83
+ </script>
@@ -0,0 +1,45 @@
1
+ <template>
2
+ <nav class="toggle-sidenav-container">
3
+ <img
4
+ :src="logo.src"
5
+ :alt="logo.alt"
6
+ class="toggle-sidenav-logo"
7
+ >
8
+ <ToggleHeaderTextLarge class="toggle-sidenav-title">
9
+ {{ title }}
10
+ </ToggleHeaderTextLarge>
11
+ <ul class="toggle-sidenav-ul">
12
+ <!-- @slot For ToggleSideNavItems -->
13
+ <slot></slot>
14
+ </ul>
15
+ </nav>
16
+ </template>
17
+
18
+ <script>
19
+
20
+ import ToggleHeaderTextLarge from '../../text/ToggleHeaderTextLarge.vue';
21
+
22
+ export default {
23
+ name: 'ToggleSideNav',
24
+ props: {
25
+ /**
26
+ * For the logo that is displayed at the top of the nav
27
+ */
28
+ logo: {
29
+ type: Object,
30
+ required: true
31
+ },
32
+ /**
33
+ * The main title, displayed below logo
34
+ */
35
+ title: {
36
+ type: String,
37
+ default: 'toggle'
38
+ },
39
+ },
40
+ components: {
41
+ ToggleHeaderTextLarge,
42
+ },
43
+ };
44
+ </script>
45
+
@@ -0,0 +1,32 @@
1
+ <template>
2
+ <li :class="['toggle-sidenav-item', icon, {'active':active, 'toggle-icon':icon,}]">
3
+
4
+ <!-- @slot For nav-item link (either regular a tag or vue-router link)-->
5
+ <slot name="item"></slot>
6
+ <!-- @slot For sub nav component-->
7
+ <slot name="sub-nav"></slot>
8
+ </li>
9
+ </template>
10
+
11
+ <script>
12
+
13
+
14
+ export default {
15
+ name: 'ToggleSideNavItem',
16
+ props: {
17
+ /**
18
+ * Set whether an item is active
19
+ */
20
+ active: {
21
+ type: Boolean,
22
+ default: false,
23
+ },
24
+ /**
25
+ * Icon to use `toggle-graph-icon`, `toggle-orders-icon`, `toggle-card-icon`, `toggle-megaphone-icon`
26
+ */
27
+ icon: {
28
+ type: String,
29
+ },
30
+ }
31
+ };
32
+ </script>
@@ -0,0 +1,24 @@
1
+ <template>
2
+ <ul
3
+ class="toggle-sidenav-sub-ul"
4
+ v-if="expanded"
5
+ >
6
+ <!-- @slot For nav-item link (either regular a tag or vue-router link)-->
7
+ <slot></slot>
8
+ </ul>
9
+ </template>
10
+
11
+ <script>
12
+ export default {
13
+ name: 'ToggleSideSubNav',
14
+ props: {
15
+ /**
16
+ * Should the subnav display expanded?
17
+ */
18
+ expanded: {
19
+ type: Boolean,
20
+ required: true,
21
+ },
22
+ },
23
+ };
24
+ </script>
@@ -0,0 +1,93 @@
1
+ <template>
2
+ <div>
3
+ <div class="toggle-notifications-messagebox" :class="{active:active, error:isError}">
4
+ <span class="message">{{ message }}</span>
5
+ </div>
6
+ </div>
7
+ </template>
8
+
9
+ <script>
10
+ export default {
11
+ name: 'ToggleNotifications',
12
+ mixins: [],
13
+ props: [],
14
+
15
+ data: function() {
16
+ return {
17
+
18
+ message: '', // the message to show
19
+ queuedMessages: 0, // number of messages being/waiting to be displayed
20
+ showAlertsFor: 3000, // how long should each error display for?
21
+ isError: false, // is it an error? true for yes, false for now
22
+
23
+ };
24
+ },
25
+ computed: {
26
+
27
+ active() // is the message showing?
28
+ {
29
+ return this.queuedMessages > 0;
30
+ },
31
+
32
+ timeout() // timeouts ensure that when there are multiple errors, they are shown in order rather than all at once.
33
+ {
34
+ return this.queuedMessages * this.showAlertsFor;
35
+ },
36
+
37
+ },
38
+ watch: {},
39
+ created: function() {
40
+ this.$toggle_event.$on('success_message', this.showBox);
41
+ this.$toggle_event.$on('error_message', this.showErrorBox);
42
+ },
43
+ beforeDestroy() {
44
+ this.$toggle_event.$off('success_message', this.showBox);
45
+ this.$toggle_event.$off('error_message', this.showErrorBox);
46
+ },
47
+ mounted: function() {
48
+ },
49
+ destroyed() {
50
+ },
51
+ methods: {
52
+
53
+ // trigger an error alert
54
+ showErrorBox(message) {
55
+ setTimeout(() => { // timeouts ensure that when there are multiple errors, they are shown in order rather than all at once.
56
+ this.isError = true;
57
+ this.message = message;
58
+ }, this.timeout);
59
+ this.queuedMessages++;
60
+ setTimeout(() => {
61
+ this.hideBox();
62
+ }, this.timeout);
63
+ },
64
+
65
+ // trigger a success alert
66
+ showBox(message) {
67
+ setTimeout(() => { // timeouts ensure that when there are multiple errors, they are shown in order rather than all at once.
68
+ this.isError = false;
69
+ this.message = message;
70
+ }, this.timeout);
71
+ this.queuedMessages++;
72
+ setTimeout(() => {
73
+ this.hideBox();
74
+ }, this.timeout);
75
+ },
76
+
77
+ // remove a queued message and remove the box if none remaining
78
+ hideBox() {
79
+ this.queuedMessages--;
80
+
81
+ if (this.queuedMessages == 0) {
82
+ setTimeout(() => {
83
+ this.message = '';
84
+ this.isError = false;
85
+ }, 1000); // wait for the box to transition out of the page before resetting the message
86
+ }
87
+ },
88
+
89
+ },
90
+ };
91
+ </script>
92
+
93
+