@iamproperty/components 3.1.0 → 3.2.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.
Files changed (160) hide show
  1. package/README.md +141 -16
  2. package/assets/.DS_Store +0 -0
  3. package/assets/css/core.min.css +1 -1
  4. package/assets/css/core.min.css.map +1 -1
  5. package/assets/css/email.min.css +1 -1
  6. package/assets/css/email.min.css.map +1 -1
  7. package/assets/css/error.min.css +1 -1
  8. package/assets/css/error.min.css.map +1 -1
  9. package/assets/css/style.min.css +1 -1
  10. package/assets/css/style.min.css.map +1 -1
  11. package/assets/favicons/manifest.json +31 -31
  12. package/assets/js/main.js +57 -57
  13. package/assets/js/modules/accordion.js +32 -32
  14. package/assets/js/modules/alert.js +56 -56
  15. package/assets/js/modules/carousel.js +101 -101
  16. package/assets/js/modules/chart.js +218 -218
  17. package/assets/js/modules/drawer.js +15 -15
  18. package/assets/js/modules/file-upload.js +48 -48
  19. package/assets/js/modules/form.js +168 -168
  20. package/assets/js/modules/helpers.js +119 -119
  21. package/assets/js/modules/modal.js +89 -89
  22. package/assets/js/modules/nav.js +28 -28
  23. package/assets/js/modules/orderablelist.js +122 -122
  24. package/assets/js/modules/table.js +585 -585
  25. package/assets/js/modules/testimonial.js +82 -82
  26. package/assets/js/modules/youtubevideo.js +145 -145
  27. package/assets/js/scripts.bundle.js +220 -214
  28. package/assets/js/scripts.bundle.js.map +1 -1
  29. package/assets/js/scripts.bundle.min.js +1 -1
  30. package/assets/js/scripts.bundle.min.js.map +1 -1
  31. package/assets/sass/_components.scss +14 -14
  32. package/assets/sass/_corefiles.scss +40 -40
  33. package/assets/sass/_fonts.scss +16 -16
  34. package/assets/sass/_forms.scss +9 -9
  35. package/assets/sass/_func.scss +12 -12
  36. package/assets/sass/_functions/functions.scss +141 -141
  37. package/assets/sass/_functions/mixins.scss +170 -170
  38. package/assets/sass/_functions/utilities.scss +143 -143
  39. package/assets/sass/_functions/variables.scss +467 -467
  40. package/assets/sass/_print.scss +61 -61
  41. package/assets/sass/_tests/colours.spec.scss +44 -44
  42. package/assets/sass/_tests/func.spec.scss +232 -232
  43. package/assets/sass/_tests/mixins.spec.scss +194 -194
  44. package/assets/sass/_tests/sass.spec.js +9 -9
  45. package/assets/sass/_tests/typography.spec.scss +35 -35
  46. package/assets/sass/components/accordion.scss +197 -197
  47. package/assets/sass/components/alert.scss +98 -98
  48. package/assets/sass/components/cardDeck.scss +107 -107
  49. package/assets/sass/components/carousel.scss +234 -234
  50. package/assets/sass/components/charts.scss +569 -569
  51. package/assets/sass/components/drawer.scss +46 -46
  52. package/assets/sass/components/header.scss +63 -63
  53. package/assets/sass/components/modal.scss +136 -136
  54. package/assets/sass/components/nav.scss +960 -960
  55. package/assets/sass/components/property-searchbar.scss +143 -143
  56. package/assets/sass/components/snapshot.scss +70 -70
  57. package/assets/sass/components/stepper.scss +164 -164
  58. package/assets/sass/components/tabs.scss +87 -87
  59. package/assets/sass/components/testimonial.scss +132 -132
  60. package/assets/sass/components/timeline.scss +95 -95
  61. package/assets/sass/core.scss +6 -6
  62. package/assets/sass/elements/buttons.scss +251 -251
  63. package/assets/sass/elements/card.scss +288 -288
  64. package/assets/sass/elements/container.scss +236 -236
  65. package/assets/sass/elements/forms.scss +261 -261
  66. package/assets/sass/elements/links.scss +97 -97
  67. package/assets/sass/elements/lists.scss +159 -159
  68. package/assets/sass/elements/panel.scss +161 -161
  69. package/assets/sass/elements/tables.scss +290 -290
  70. package/assets/sass/elements/tooltips.scss +84 -84
  71. package/assets/sass/elements/type.scss +136 -136
  72. package/assets/sass/email.scss +65 -65
  73. package/assets/sass/error.scss +4 -4
  74. package/assets/sass/foundations/brand.scss +76 -72
  75. package/assets/sass/foundations/circles.scss +74 -74
  76. package/assets/sass/foundations/icons.scss +80 -80
  77. package/assets/sass/foundations/media.scss +50 -50
  78. package/assets/sass/foundations/reboot.scss +130 -130
  79. package/assets/sass/foundations/root.scss +125 -125
  80. package/assets/sass/main.scss +7 -7
  81. package/assets/svg/icons.svg +598 -598
  82. package/assets/svg/logo.svg +49 -43
  83. package/assets/ts/main.js +56 -56
  84. package/assets/ts/main.ts +68 -68
  85. package/assets/ts/modules/accordion.js +32 -32
  86. package/assets/ts/modules/accordion.ts +43 -43
  87. package/dist/components.es.js +381 -381
  88. package/dist/components.umd.js +16 -16
  89. package/package.json +96 -108
  90. package/src/.DS_Store +0 -0
  91. package/src/components/Accordion/Accordion.screenshot.vue +57 -57
  92. package/src/components/Accordion/Accordion.spec.js +63 -63
  93. package/src/components/Accordion/Accordion.vue +22 -22
  94. package/src/components/Accordion/AccordionItem.vue +52 -52
  95. package/src/components/Accordion/README.md +34 -34
  96. package/src/components/Alert/Alert.spec.js +49 -49
  97. package/src/components/Alert/Alert.vue +39 -39
  98. package/src/components/Alert/README.md +28 -28
  99. package/src/components/Banner/Banner.spec.js +28 -28
  100. package/src/components/Banner/Banner.vue +38 -38
  101. package/src/components/Banner/README.md +23 -23
  102. package/src/components/CardDeck/CardDeck.spec.js +99 -99
  103. package/src/components/CardDeck/CardDeck.vue +77 -77
  104. package/src/components/CardDeck/README.md +24 -24
  105. package/src/components/Carousel/Carousel.spec.js +45 -45
  106. package/src/components/Carousel/Carousel.vue +85 -85
  107. package/src/components/Carousel/README.md +19 -19
  108. package/src/components/Chart/Chart.spec.js +201 -201
  109. package/src/components/Chart/Chart.vue +88 -88
  110. package/src/components/Chart/README.md +17 -17
  111. package/src/components/Drawer/Drawer.vue +53 -53
  112. package/src/components/Drawer/README.md +22 -22
  113. package/src/components/Header/Header.spec.js +33 -33
  114. package/src/components/Header/Header.vue +38 -38
  115. package/src/components/Header/README.md +27 -27
  116. package/src/components/Modal/Modal.spec.js +22 -22
  117. package/src/components/Modal/Modal.vue +43 -43
  118. package/src/components/Modal/README.md +19 -19
  119. package/src/components/Nav/Nav.spec.js +35 -35
  120. package/src/components/Nav/Nav.vue +215 -215
  121. package/src/components/Nav/README.md +22 -22
  122. package/src/components/NoteFeed/NoteFeed.vue +79 -79
  123. package/src/components/NoteFeed/README.md +16 -16
  124. package/src/components/PropertySearchbar/PropertySearchbar.vue +204 -204
  125. package/src/components/PropertySearchbar/README.md +25 -25
  126. package/src/components/Snapshot/README.md +20 -20
  127. package/src/components/Snapshot/Snapshot.vue +32 -32
  128. package/src/components/Stepper/README.md +32 -32
  129. package/src/components/Stepper/Step.vue +28 -28
  130. package/src/components/Stepper/Stepper.spec.js +99 -99
  131. package/src/components/Stepper/Stepper.vue +33 -33
  132. package/src/components/Tabs/README.md +27 -27
  133. package/src/components/Tabs/Tab.vue +32 -32
  134. package/src/components/Tabs/Tabs.vue +77 -77
  135. package/src/components/Testimonial/README.md +25 -25
  136. package/src/components/Testimonial/Testimonial.spec.js +57 -57
  137. package/src/components/Testimonial/Testimonial.vue +60 -60
  138. package/src/components/Timeline/README.md +18 -18
  139. package/src/components/Timeline/Timeline.spec.js +17 -17
  140. package/src/components/Timeline/Timeline.vue +24 -24
  141. package/src/elements/Card/Card.vue +122 -122
  142. package/src/elements/Card/README.md +24 -24
  143. package/src/elements/FileUploads/FileUploads.vue +48 -48
  144. package/src/elements/FileUploads/README.md +24 -24
  145. package/src/elements/Input/Input.vue +272 -272
  146. package/src/elements/Input/README.md +19 -19
  147. package/src/elements/Table/README.md +62 -62
  148. package/src/elements/Table/Table.spec.js +90 -90
  149. package/src/elements/Table/Table.vue +129 -129
  150. package/src/foundations/Icon/Icon.spec.js +24 -24
  151. package/src/foundations/Icon/Icon.vue +24 -24
  152. package/src/foundations/Icon/README.md +11 -11
  153. package/src/foundations/Logo/Logo.spec.js +56 -56
  154. package/src/foundations/Logo/Logo.vue +39 -39
  155. package/src/foundations/Logo/README.md +20 -20
  156. package/src/foundations/YoutubeVideo/README.md +11 -11
  157. package/src/foundations/YoutubeVideo/YoutubeVideo.vue +24 -24
  158. package/src/helpers/strings.js +12 -12
  159. package/src/index.js +27 -27
  160. package/src/vue-shim.d.ts +6 -6
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Bootstrap v3.1.0
2
+ * Bootstrap v3.2.0
3
3
  * Copyright 2011-2022 [object Object]
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
@@ -8,29 +8,27 @@
8
8
  factory();
9
9
  })((function () { 'use strict';
10
10
 
11
- /**
12
- * Global helper functions to help maintain and enhance framework elements.
13
- * @module Helpers
11
+ /**
12
+ * Global helper functions to help maintain and enhance framework elements.
13
+ * @module Helpers
14
14
  */
15
15
 
16
- /**
17
- * Add global classes used by the CSS and later JavaScript.
18
- * @param {HTMLElement} body Dom element, this doesn't have to be the body but it is recommended.
16
+ /**
17
+ * Add global classes used by the CSS and later JavaScript.
18
+ * @param {HTMLElement} body Dom element, this doesn't have to be the body but it is recommended.
19
19
  */
20
20
  var addBodyClasses = body => {
21
21
  body.classList.add("js-enabled");
22
-
23
22
  if (navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0) {
24
23
  body.classList.add("ie");
25
24
  }
26
-
27
25
  return null;
28
26
  };
29
- /**
30
- * Add global events.
31
- * @param {HTMLElement} body Dom element, this doesn't have to be the body but it is recommended.
32
- */
33
27
 
28
+ /**
29
+ * Add global events.
30
+ * @param {HTMLElement} body Dom element, this doesn't have to be the body but it is recommended.
31
+ */
34
32
  var addGlobalEvents = body => {
35
33
  window.addEventListener('hashchange', function () {
36
34
  var hash = location.hash.replace('#', '');
@@ -40,11 +38,11 @@
40
38
  }, false);
41
39
  return null;
42
40
  };
43
- /**
44
- * Check if an element contains certain elements that needs enhancing with the JavaScript helpers, it is recommended to do this on the page body after the dom is loaded. Elements that are loaded via ajax should also run this function.
45
- * @param {HTMLElement} element Dom element, this doesn't have to be the body but it is recommended.
46
- */
47
41
 
42
+ /**
43
+ * Check if an element contains certain elements that needs enhancing with the JavaScript helpers, it is recommended to do this on the page body after the dom is loaded. Elements that are loaded via ajax should also run this function.
44
+ * @param {HTMLElement} element Dom element, this doesn't have to be the body but it is recommended.
45
+ */
48
46
  var checkElements = element => {
49
47
  // Tables
50
48
  Array.from(element.querySelectorAll('table')).forEach((table, index) => {
@@ -52,22 +50,22 @@
52
50
  tableWrap(table);
53
51
  });
54
52
  };
55
- /**
56
- * Wrap tables with a table wrapper div to help maintain its responsive design.
57
- * @param {HTMLElement} table Dom table element
58
- */
59
53
 
54
+ /**
55
+ * Wrap tables with a table wrapper div to help maintain its responsive design.
56
+ * @param {HTMLElement} table Dom table element
57
+ */
60
58
  var tableWrap = table => {
61
59
  if (!table.parentNode.classList.contains('table__wrapper')) {
62
60
  var tableHTML = table.outerHTML;
63
61
  table.outerHTML = "<div class=\"table__wrapper\">".concat(tableHTML, "</div>");
64
62
  }
65
63
  };
66
- /**
67
- * Creates data attributes to be used by the CSS for mobile views.
68
- * @param {HTMLElement} table Dom table element
69
- */
70
64
 
65
+ /**
66
+ * Creates data attributes to be used by the CSS for mobile views.
67
+ * @param {HTMLElement} table Dom table element
68
+ */
71
69
  var tableStacked = table => {
72
70
  var colHeadings = Array.from(table.querySelectorAll('thead th'));
73
71
  var colRows = Array.from(table.querySelectorAll('tbody tr'));
@@ -75,7 +73,6 @@
75
73
  var cells = Array.from(row.querySelectorAll('th, td'));
76
74
  cells.forEach((cell, cellIndex) => {
77
75
  var heading = colHeadings[cellIndex];
78
-
79
76
  if (typeof heading != "undefined") {
80
77
  var tempDiv = document.createElement("div");
81
78
  tempDiv.innerHTML = heading.innerHTML;
@@ -87,10 +84,11 @@
87
84
  };
88
85
  var isNumeric = function isNumeric(str) {
89
86
  if (typeof str != "string") return false; // we only process strings!
90
-
91
- return !isNaN(str) && // use type coercion to parse the _entirety_ of the string (`parseFloat` alone does not do this)...
87
+ return !isNaN(str) &&
88
+ // use type coercion to parse the _entirety_ of the string (`parseFloat` alone does not do this)...
92
89
  !isNaN(parseFloat(str)); // ...and ensure strings of whitespace fail
93
90
  };
91
+
94
92
  var zeroPad = (num, places) => String(num).padStart(places, '0');
95
93
 
96
94
  var navbar = element => {
@@ -102,7 +100,6 @@
102
100
  if (window.matchMedia('(min-width: 62em)').matches) detail.removeAttribute('open');
103
101
  }, false);
104
102
  });
105
-
106
103
  if ('IntersectionObserver' in window) {
107
104
  var observer = new IntersectionObserver(_ref => {
108
105
  var [e] = _ref;
@@ -123,10 +120,10 @@
123
120
  var filteredEvent = new Event('filtered');
124
121
  var reorderedEvent = new Event('reordered');
125
122
  var randID = 'table_' + Math.random().toString(36).substr(2, 9); // Random to make sure IDs created are unique
126
-
127
123
  var draggedRow;
128
- tableElement.setAttribute('id', randID); // #region Sortable
124
+ tableElement.setAttribute('id', randID);
129
125
 
126
+ // #region Sortable
130
127
  var sortTable = function sortTable(sortBy, sort) {
131
128
  // Create an array from the table rows, the index created is then used to sort the array
132
129
  var tableArr = [];
@@ -138,37 +135,45 @@
138
135
  row: tableRow
139
136
  };
140
137
  tableArr.push(dataRow);
141
- }); // Sort array
138
+ });
142
139
 
143
- tableArr.sort((a, b) => a.index > b.index ? 1 : -1); // Reverse if descending
140
+ // Sort array
141
+ tableArr.sort((a, b) => a.index > b.index ? 1 : -1);
144
142
 
145
- if (sort == "descending") tableArr = tableArr.reverse(); // Create a string to return and populate the tbody
143
+ // Reverse if descending
144
+ if (sort == "descending") tableArr = tableArr.reverse();
146
145
 
146
+ // Create a string to return and populate the tbody
147
147
  var strTbody = '';
148
148
  tableArr.forEach((tableRow, index) => {
149
149
  strTbody += tableRow.row.outerHTML;
150
150
  });
151
- tbody.innerHTML = strTbody; // Dispatch the sortable event
151
+ tbody.innerHTML = strTbody;
152
152
 
153
+ // Dispatch the sortable event
153
154
  tableElement.dispatchEvent(sortedEvent);
154
- }; // Declare event handlers
155
-
155
+ };
156
156
 
157
+ // Declare event handlers
157
158
  tableElement.addEventListener('click', function (e) {
158
159
  for (var target = e.target; target && target != this; target = target.parentNode) {
159
160
  if (target.matches('[data-sortable]')) {
160
161
  // Get current sort order
161
- var sort = target.getAttribute('aria-sort') == "ascending" ? "descending" : "ascending"; // unset sort attributes
162
+ var sort = target.getAttribute('aria-sort') == "ascending" ? "descending" : "ascending";
162
163
 
164
+ // unset sort attributes
163
165
  Array.from(tableElement.querySelectorAll('[data-sortable]')).forEach((col, index) => {
164
166
  col.setAttribute('aria-sort', 'none');
165
- }); // Set the sort order attribute
167
+ });
166
168
 
167
- target.setAttribute('aria-sort', sort); // Save the sort options on the table element so that it can be re-sorted later
169
+ // Set the sort order attribute
170
+ target.setAttribute('aria-sort', sort);
168
171
 
172
+ // Save the sort options on the table element so that it can be re-sorted later
169
173
  tableElement.setAttribute('data-sort', sort);
170
- tableElement.setAttribute('data-sortBy', target.textContent); // Sort the table
174
+ tableElement.setAttribute('data-sortBy', target.textContent);
171
175
 
176
+ // Sort the table
172
177
  sortTable(target.textContent, sort);
173
178
  Array.from(tableElement.querySelectorAll('tr[draggable]')).forEach((tableRow, index) => {
174
179
  tableRow.removeAttribute('draggable');
@@ -176,8 +181,9 @@
176
181
  break;
177
182
  }
178
183
  }
179
- }, false); // On page load check if the table should be pre-sorted, if so trigger a click
184
+ }, false);
180
185
 
186
+ // On page load check if the table should be pre-sorted, if so trigger a click
181
187
  if (tableElement.getAttribute('data-sortBy')) {
182
188
  var sort = tableElement.getAttribute('data-sort') == "ascending" ? "descending" : "ascending";
183
189
  Array.from(tableElement.querySelectorAll('[data-sortable]')).forEach((col, index) => {
@@ -186,36 +192,39 @@
186
192
  col.click();
187
193
  }
188
194
  });
189
- } // #endregion Sortable
190
- // #region Filters
195
+ }
191
196
 
197
+ // #endregion Sortable
192
198
 
199
+ // #region Filters
193
200
  var createFilterForm = function createFilterForm(count) {
194
201
  // Create wrapper div
195
202
  var form = document.createElement("div");
196
203
  form.classList.add('table__filters');
197
204
  form.classList.add('row');
198
205
  form.classList.add('pt-1');
199
- form.classList.add('pb-3'); // Create the filter options array
206
+ form.classList.add('pb-3');
200
207
 
201
- var filterColumns = Array.from(tableElement.querySelectorAll('th[data-filterable]')); // Populate a list of searchable terms from the cells of the columns that could be used as a filter
208
+ // Create the filter options array
209
+ var filterColumns = Array.from(tableElement.querySelectorAll('th[data-filterable]'));
202
210
 
211
+ // Populate a list of searchable terms from the cells of the columns that could be used as a filter
203
212
  var searchableTerms = {};
204
213
  filterColumns.forEach((columnHeading, index) => {
205
214
  Array.from(tableElement.querySelectorAll('td[data-label="' + columnHeading.textContent + '"]')).forEach((label, index) => {
206
215
  searchableTerms[label.textContent] = label.textContent;
207
216
  });
208
- }); // Create the form
217
+ });
209
218
 
219
+ // Create the form
210
220
  var filterTitle = filterColumns.length == 1 ? "Filter by " + filterColumns[0].textContent : "Filter"; // Update title if only one filter is chosen
211
-
212
221
  var checkboxClass = filterColumns.length == 1 ? "d-none" : "d-sm-flex"; // Hide controls when only one filter is chosen
213
222
 
214
- form.innerHTML = "<div class=\"col-sm-6 col-md-4 pb-3\">\n <div class=\"form-control__wrapper form-control-inline mb-0\">\n <label for=\"".concat(randID, "_filter\" class=\"form-label\">").concat(filterTitle, ":</label>\n <input type=\"search\" name=\"").concat(randID, "_filter\" id=\"").concat(randID, "_filter\" class=\"form-control form-control-sm\" placeholder=\"\" list=\"").concat(randID, "_list\" />\n </div>\n <datalist id=\"").concat(randID, "_list\">\n ").concat(Object.keys(searchableTerms).map(term => "<option value=\"".concat(term, "\"></option>")).join(""), "\n </datalist>\n</div>\n<div class=\"col-md-8 align-items-center pb-3 ").concat(checkboxClass, "\">\n ").concat("<span class=\"pe-3 text-nowrap h5 mb-0\">Filter by: </span>" + filterColumns.map(column => "<div class=\"form-check pe-3 mt-0 mb-0\"><input class=\"form-check-input\" type=\"checkbox\" id=\"".concat(randID, "_").concat(column.textContent.replace(' ', '_').toLowerCase(), "\" checked=\"checked\" /><label class=\"form-check-label text-nowrap\" for=\"").concat(randID, "_").concat(column.textContent.replace(' ', '_').toLowerCase(), "\">").concat(column.textContent, "</label></div>")).join(""), "\n</div>"); // Add before the actual table
223
+ form.innerHTML = "<div class=\"col-sm-6 col-md-4 pb-3\">\n <div class=\"form-control__wrapper form-control-inline mb-0\">\n <label for=\"".concat(randID, "_filter\" class=\"form-label\">").concat(filterTitle, ":</label>\n <input type=\"search\" name=\"").concat(randID, "_filter\" id=\"").concat(randID, "_filter\" class=\"form-control form-control-sm\" placeholder=\"\" list=\"").concat(randID, "_list\" />\n </div>\n <datalist id=\"").concat(randID, "_list\">\n ").concat(Object.keys(searchableTerms).map(term => "<option value=\"".concat(term, "\"></option>")).join(""), "\n </datalist>\n</div>\n<div class=\"col-md-8 align-items-center pb-3 ").concat(checkboxClass, "\">\n ").concat("<span class=\"pe-3 text-nowrap h5 mb-0\">Filter by: </span>" + filterColumns.map(column => "<div class=\"form-check pe-3 mt-0 mb-0\"><input class=\"form-check-input\" type=\"checkbox\" id=\"".concat(randID, "_").concat(column.textContent.replace(' ', '_').toLowerCase(), "\" checked=\"checked\" /><label class=\"form-check-label text-nowrap\" for=\"").concat(randID, "_").concat(column.textContent.replace(' ', '_').toLowerCase(), "\">").concat(column.textContent, "</label></div>")).join(""), "\n</div>");
215
224
 
225
+ // Add before the actual table
216
226
  tableElement.prepend(form);
217
227
  };
218
-
219
228
  var filterTable = function filterTable(searchTerm) {
220
229
  // Create an array of rows that match the search term
221
230
  var tableArr = [];
@@ -224,48 +233,53 @@
224
233
  var rowSearchString = '';
225
234
  Array.from(tableElement.querySelectorAll('[type="checkbox"]:checked + label')).forEach((label, index) => {
226
235
  rowSearchString += tableRow.querySelector('td[data-label="' + label.textContent + '"]').textContent + ' | ';
227
- }); // Check if the table row search string contains the search term
236
+ });
228
237
 
238
+ // Check if the table row search string contains the search term
229
239
  if (rowSearchString.indexOf(searchTerm) >= 0) {
230
240
  var dataRow = {
231
241
  row: tableRow
232
242
  };
233
243
  tableArr.push(dataRow);
234
244
  }
235
- }); // Create a string to return and populate the tbody
245
+ });
236
246
 
247
+ // Create a string to return and populate the tbody
237
248
  var strTbody = '';
238
249
  tableArr.forEach((tableRow, index) => {
239
250
  strTbody += tableRow.row.outerHTML;
240
251
  });
241
- tbody.innerHTML = strTbody; // Dispatch the filter event.
252
+ tbody.innerHTML = strTbody;
242
253
 
254
+ // Dispatch the filter event.
243
255
  tableElement.dispatchEvent(filteredEvent);
244
256
  };
245
-
246
257
  var createFilterList = function createFilterList() {
247
258
  // Check which options are checked
248
259
  var filterOptions = [];
249
260
  Array.from(tableElement.querySelectorAll('[type="checkbox"]:checked + label')).forEach((label, index) => {
250
261
  filterOptions.push(label.textContent);
251
- }); // Build up the list of searchable terms
262
+ });
252
263
 
264
+ // Build up the list of searchable terms
253
265
  var searchableTerms = [];
254
266
  filterOptions.forEach((option, index) => {
255
267
  Array.from(tableElement.querySelectorAll('td[data-label="' + option + '"]')).forEach((label, index) => {
256
268
  searchableTerms[label.textContent] = label.textContent;
257
269
  });
258
- }); // Rebuild the list
270
+ });
259
271
 
272
+ // Rebuild the list
260
273
  var dataList = tableElement.querySelector('datalist');
261
274
  dataList.innerHTML = Object.keys(searchableTerms).map(term => "<option value=\"".concat(term, "\"></option>")).join("");
262
- }; // On page load check if filters are needed
263
-
275
+ };
264
276
 
277
+ // On page load check if filters are needed
265
278
  if (Array.from(tableElement.querySelectorAll('[data-filterable]')).length) {
266
279
  // Create the filter options
267
- createFilterForm(tableElement, Array.from(tableElement.querySelectorAll('[data-filterable]')).length); // Add event handlers for the filter options
280
+ createFilterForm(tableElement, Array.from(tableElement.querySelectorAll('[data-filterable]')).length);
268
281
 
282
+ // Add event handlers for the filter options
269
283
  tableElement.addEventListener('keyup', function (e) {
270
284
  for (var target = e.target; target && target != this; target = target.parentNode) {
271
285
  if (target.matches('input[type="search"]')) {
@@ -291,31 +305,28 @@
291
305
  }
292
306
  }
293
307
  });
294
- } // #endregion Filters
295
- // #region Pagination
296
-
308
+ }
309
+ // #endregion Filters
297
310
 
311
+ // #region Pagination
298
312
  var paginateRows = function paginateRows(show, page) {
299
313
  // Create some inline CSS to control what is viewed on the table, unline the filters we are just hiding the rable rows not removing them from the DOM.
300
314
  var style = document.getElementById(randID + '_style');
301
-
302
315
  if (style == null) {
303
316
  style = document.createElement("style");
304
317
  style.setAttribute('id', randID + '_style');
305
318
  }
306
-
307
319
  var startShowing = show * (page - 1) + 1;
308
320
  var stopShowing = show * page;
309
321
  style.innerHTML = "\n #".concat(randID, " tbody tr {\n display: none;\n }\n #").concat(randID, " tbody tr:nth-child(").concat(startShowing, "),\n #").concat(randID, " tbody tr:nth-child(").concat(startShowing, ") ~ tr{\n display: block;\n }\n @media screen and (min-width: 36em) {\n #").concat(randID, " tbody tr:nth-child(").concat(startShowing, "),\n #").concat(randID, " tbody tr:nth-child(").concat(startShowing, ") ~ tr{\n display: table-row;\n }\n }\n #").concat(randID, " tbody tr:nth-child(").concat(stopShowing, ") ~ tr{\n display: none;\n }\n ");
310
322
  tableElement.append(style);
311
- }; // On page load check if the table should be paginated
312
-
323
+ };
313
324
 
325
+ // On page load check if the table should be paginated
314
326
  if (tableElement.getAttribute('data-show')) {
315
327
  var show = parseInt(tableElement.getAttribute('data-show'));
316
328
  var page = parseInt(tableElement.getAttribute('data-page')) ? parseInt(tableElement.getAttribute('data-page')) : 1;
317
329
  var totalRows = tableElement.querySelectorAll('tbody tr').length;
318
-
319
330
  if (show < totalRows) {
320
331
  paginateRows(show, page);
321
332
  createPaginationForm(randID, tableElement, show, page, totalRows);
@@ -346,18 +357,18 @@
346
357
  }
347
358
  });
348
359
  }
349
- } // #endregion Pagination
360
+ }
361
+ // #endregion Pagination
362
+
350
363
  // #region Reorderable
351
364
  // Set the row thats being dragged and copy the row
352
-
353
-
354
365
  function setDraggedRow(e) {
355
366
  e.dataTransfer.setData("text/plain", e.target.id);
356
367
  draggedRow = e.target;
357
368
  e.target.classList.add('tr--dragging');
358
- } // Create the order column and event handler for rows
359
-
369
+ }
360
370
 
371
+ // Create the order column and event handler for rows
361
372
  var setReorderRows = function setReorderRows() {
362
373
  Array.from(tbody.querySelectorAll('tr')).forEach((tableRow, index) => {
363
374
  // Create column if not already created
@@ -366,16 +377,15 @@
366
377
  orderColumn.innerHTML = index + 1;
367
378
  orderColumn.setAttribute('data-label', 'Order');
368
379
  tableRow.prepend(orderColumn);
369
- } // Make draggable
370
-
380
+ }
371
381
 
382
+ // Make draggable
372
383
  tableRow.setAttribute('id', randID + '_row_' + (index + 1));
373
384
  tableRow.setAttribute('data-order', index + 1);
374
385
  tableRow.setAttribute('draggable', 'true');
375
386
  tableRow.addEventListener("dragstart", setDraggedRow);
376
387
  });
377
388
  };
378
-
379
389
  if (tableElement.getAttribute('data-reorder') && tableElement.getAttribute('data-reorder') != "false") {
380
390
  // Add column heading
381
391
  var orderHeading = document.createElement('th');
@@ -383,19 +393,22 @@
383
393
  orderHeading.title = 'Click here to enable re-ordering via drag and drop';
384
394
  orderHeading.classList.add('table-order-reset');
385
395
  thead.querySelector('tr').prepend(orderHeading);
386
- setReorderRows(); // Reset order button
396
+ setReorderRows();
387
397
 
398
+ // Reset order button
388
399
  tableElement.addEventListener('click', function (e) {
389
400
  for (var target = e.target; target && target != this; target = target.parentNode) {
390
401
  if (target.matches('.table-order-reset')) {
391
402
  // unset sort attributes
392
403
  Array.from(tableElement.querySelectorAll('[data-sortable]')).forEach((col, index) => {
393
404
  col.setAttribute('aria-sort', 'none');
394
- }); // Save the sort options on the table element so that it can be re-sorted later
405
+ });
395
406
 
407
+ // Save the sort options on the table element so that it can be re-sorted later
396
408
  tableElement.removeAttribute('data-sort');
397
- tableElement.removeAttribute('data-sortBy'); // Sort the table
409
+ tableElement.removeAttribute('data-sortBy');
398
410
 
411
+ // Sort the table
399
412
  sortTable('Order', 'ascending');
400
413
  Array.from(tableElement.querySelectorAll('tbody tr')).forEach((tableRow, index) => {
401
414
  tableRow.setAttribute('draggable', 'true');
@@ -412,7 +425,6 @@
412
425
  // prevent default to allow drop
413
426
  e.preventDefault();
414
427
  e.dataTransfer.dropEffect = "move";
415
-
416
428
  for (var target = e.target; target && target != this; target = target.parentNode) {
417
429
  if (target.matches('[data-reorder] tbody tr')) {
418
430
  target.classList.add('tr--dropable');
@@ -422,7 +434,6 @@
422
434
  document.addEventListener("dragleave", function (e) {
423
435
  // prevent default to allow drop
424
436
  e.preventDefault();
425
-
426
437
  for (var target = e.target; target && target != this; target = target.parentNode) {
427
438
  if (target.matches('[data-reorder] tbody tr')) {
428
439
  target.classList.remove('tr--dropable');
@@ -431,13 +442,13 @@
431
442
  }, false);
432
443
  document.addEventListener("drop", function (e) {
433
444
  e.preventDefault();
434
-
435
445
  for (var target = e.target; target && target != this; target = target.parentNode) {
436
446
  if (target.matches('[data-reorder] tbody tr')) {
437
447
  if (target.parentNode != null && draggedRow.parentNode != null && target != draggedRow) {
438
448
  draggedRow.parentNode.removeChild(draggedRow);
439
- if (draggedRow.getAttribute('data-order') > target.getAttribute('data-order')) target.parentNode.insertBefore(draggedRow, target);else target.parentNode.insertBefore(draggedRow, target.nextElementSibling); // Re label the rows
449
+ if (draggedRow.getAttribute('data-order') > target.getAttribute('data-order')) target.parentNode.insertBefore(draggedRow, target);else target.parentNode.insertBefore(draggedRow, target.nextElementSibling);
440
450
 
451
+ // Re label the rows
441
452
  Array.from(tbody.querySelectorAll('tr')).forEach((tableRowOrder, index) => {
442
453
  tableRowOrder.classList.remove('tr--dragging');
443
454
  tableRowOrder.classList.remove('tr--dropable');
@@ -446,32 +457,27 @@
446
457
  });
447
458
  tableElement.dispatchEvent(reorderedEvent);
448
459
  }
449
-
450
460
  break;
451
461
  }
452
462
  }
453
463
  }, false);
454
- } // #endregion Reorderable
455
- // Watch for the filterable event and re-sort the tbody
456
-
464
+ }
465
+ // #endregion Reorderable
457
466
 
467
+ // Watch for the filterable event and re-sort the tbody
458
468
  tableElement.addEventListener('filtered', function (e) {
459
469
  if (tableElement.getAttribute('data-sortBy') && tableElement.getAttribute('data-sort')) sortTable(tableElement.getAttribute('data-sortBy'), tableElement.getAttribute('data-sort'));
460
-
461
470
  if (tableElement.getAttribute('data-show')) {
462
471
  var _show = parseInt(tableElement.getAttribute('data-show'));
463
-
464
472
  var _totalRows = tableElement.querySelectorAll('tbody tr').length;
465
473
  var tablePagination = tableElement.querySelector('.table__pagination');
466
474
  if (tablePagination != null) tablePagination.remove();
467
-
468
475
  if (_show < _totalRows) {
469
476
  paginateRows(_show, 1);
470
477
  createPaginationForm(randID, tableElement, _show, 1, _totalRows);
471
478
  createPaginationButttons(randID, tableElement, _show, 1, _totalRows);
472
479
  }
473
480
  }
474
-
475
481
  if (tableElement.getAttribute('data-reorder')) {
476
482
  setReorderRows();
477
483
  }
@@ -491,43 +497,41 @@
491
497
  table(newTable);
492
498
  }, false);
493
499
  }
494
-
495
500
  var createPaginationForm = function createPaginationForm(randID, tableElement, show, page, totalRows) {
496
501
  var form = document.createElement("div");
497
502
  form.classList.add('table__pagination');
498
503
  form.classList.add('row');
499
504
  form.classList.add('pt-3');
500
- form.classList.add('pb-3'); // Create the form and create a container div to hold the pagination buttons
505
+ form.classList.add('pb-3');
501
506
 
502
- form.innerHTML = "<div class=\"col mw-fit-content mb-3\">\n<div class=\"form-control__wrapper form-control-inline mb-0\">\n <label for=\"".concat(randID, "_showing\" class=\"form-label\">Showing:</label>\n <input type=\"number\" name=\"").concat(randID, "_showing\" id=\"").concat(randID, "_showing\" class=\"form-control form-control-sm showing-input-field\" placeholder=\"\" list=\"").concat(randID, "_pagination\" value=\"").concat(show, "\" min=\"1\" max=\"").concat(totalRows, "\" />\n</div>\n<datalist id=\"").concat(randID, "_pagination\">\n<option value=\"5\">5</option>\n").concat(totalRows > 10 ? "<option value=\"10\">10</option>" : '', "\n").concat(totalRows > 20 ? "<option value=\"20\">20</option>" : '', "\n<option value=\"").concat(totalRows, "\">").concat(totalRows, "</option>\n</datalist>\n</div>\n<div class=\"col mw-fit-content me-auto d-flex align-items-center mb-3\"><span class=\"label\">per page</span></div>\n<div class=\"col mw-fit-content d-sm-flex justify-content-end align-items-center\" id=\"").concat(randID, "_paginationBtns\"></div>"); // Add after the actual table
507
+ // Create the form and create a container div to hold the pagination buttons
508
+ form.innerHTML = "<div class=\"col mw-fit-content mb-3\">\n<div class=\"form-control__wrapper form-control-inline mb-0\">\n <label for=\"".concat(randID, "_showing\" class=\"form-label\">Showing:</label>\n <input type=\"number\" name=\"").concat(randID, "_showing\" id=\"").concat(randID, "_showing\" class=\"form-control form-control-sm showing-input-field\" placeholder=\"\" list=\"").concat(randID, "_pagination\" value=\"").concat(show, "\" min=\"1\" max=\"").concat(totalRows, "\" />\n</div>\n<datalist id=\"").concat(randID, "_pagination\">\n<option value=\"5\">5</option>\n").concat(totalRows > 10 ? "<option value=\"10\">10</option>" : '', "\n").concat(totalRows > 20 ? "<option value=\"20\">20</option>" : '', "\n<option value=\"").concat(totalRows, "\">").concat(totalRows, "</option>\n</datalist>\n</div>\n<div class=\"col mw-fit-content me-auto d-flex align-items-center mb-3\"><span class=\"label\">per page</span></div>\n<div class=\"col mw-fit-content d-sm-flex justify-content-end align-items-center\" id=\"").concat(randID, "_paginationBtns\"></div>");
503
509
 
510
+ // Add after the actual table
504
511
  tableElement.append(form);
505
512
  };
506
513
  var createPaginationButttons = function createPaginationButttons(randID, tableElement, show, page, totalRows) {
507
514
  var paginationButtonsWrapper = document.getElementById(randID + '_paginationBtns');
508
515
  if (paginationButtonsWrapper == null) return false;
509
516
  var numberPages = Math.ceil(totalRows / show);
510
-
511
517
  if (numberPages == 1) {
512
518
  // Remore the buttons or dont display any if we dont need them
513
519
  paginationButtonsWrapper.innerHTML = '';
514
520
  } else if (numberPages < 5) {
515
521
  // If less than 5 pages (which fits comfortably on mobile) we display buttons
516
- var strButtons = '';
517
522
 
523
+ var strButtons = '';
518
524
  for (var i = 1; i <= numberPages; i++) {
519
525
  if (i == page) strButtons += "<li class=\"page-item active\" aria-current=\"page\"><span class=\"page-link\">".concat(i, "</span></li>");else strButtons += "<li class=\"page-item\"><button class=\"page-link\" data-page=\"".concat(i, "\">").concat(i, "</button></li>");
520
526
  }
521
-
522
527
  paginationButtonsWrapper.innerHTML = "<span class=\"pe-2 mb-3\">Page: </span><ul class=\"pagination mb-3\">\n ".concat(page == 1 ? "<li class=\"page-item disabled\"><span class=\"page-link\">Previous</span></li>" : "<li class=\"page-item\"><button class=\"page-link\" data-page=\"".concat(parseInt(page) - 1, "\">Previous</button></li>"), "\n ").concat(strButtons, "\n ").concat(page == numberPages ? "<li class=\"page-item disabled\"><span class=\"page-link\">Next</span></li>" : "<li class=\"page-item\"><button class=\"page-link\" data-page=\"".concat(parseInt(page) + 1, "\">Next</button></li>"), "\n </ul>");
523
528
  } else {
524
529
  // If more than 5 lets show a select field instead so that we dont have loads and loads of buttons
525
- var strOptions = '';
526
530
 
531
+ var strOptions = '';
527
532
  for (var _i = 1; _i <= numberPages; _i++) {
528
533
  if (_i == page) strOptions += "<option value=\"".concat(_i, "\" selected>Page ").concat(_i, "</option>");else strOptions += "<option value=\"".concat(_i, "\">Page ").concat(_i, "</option>");
529
534
  }
530
-
531
535
  paginationButtonsWrapper.innerHTML = "\n<div class=\"form-control__wrapper page-number mb-2\">\n<select class=\"form-select\">\n".concat(strOptions, "\n</select>\n</div>\n ");
532
536
  }
533
537
  };
@@ -535,8 +539,8 @@
535
539
  function accordion(accordionElement) {
536
540
  // Fetch all the details element.
537
541
  if (!accordionElement.classList.contains('accordion--keep-open')) {
538
- var details = accordionElement.querySelectorAll(":scope > details"); // Add the onclick listeners.
539
-
542
+ var details = accordionElement.querySelectorAll(":scope > details");
543
+ // Add the onclick listeners.
540
544
  details.forEach(targetDetail => {
541
545
  targetDetail.addEventListener("click", () => {
542
546
  // Close all the details that are not targetDetail.
@@ -548,19 +552,15 @@
548
552
  });
549
553
  });
550
554
  }
551
-
552
555
  if (window.location.hash && document.querySelector(window.location.hash + ':not([open]) summary')) {
553
556
  var detail = document.querySelector(window.location.hash + ' summary');
554
-
555
557
  if (detail instanceof HTMLElement) {
556
558
  detail.click();
557
559
  }
558
560
  }
559
-
560
561
  window.addEventListener('hashchange', function () {
561
562
  if (window.location.hash && document.querySelector(window.location.hash + ' summary')) {
562
563
  var _detail = document.querySelector(window.location.hash + ' summary');
563
-
564
564
  if (_detail instanceof HTMLElement) {
565
565
  _detail.click();
566
566
  }
@@ -571,14 +571,15 @@
571
571
  function testimonial(testimonialElement) {
572
572
  var scrollTimeout;
573
573
  var imagesCarousel = testimonialElement.querySelector('.testimonial__images');
574
- var itemCount = imagesCarousel.querySelectorAll('img').length; // If we only have 1 item lets not bother doing anything else
574
+ var itemCount = imagesCarousel.querySelectorAll('img').length;
575
575
 
576
+ // If we only have 1 item lets not bother doing anything else
576
577
  if (itemCount == 1) {
577
578
  return false;
578
579
  }
580
+ testimonialElement.classList.add('testimonial--multi');
579
581
 
580
- testimonialElement.classList.add('testimonial--multi'); // Set where the buttons go to
581
-
582
+ // Set where the buttons go to
582
583
  var setButtons = function setButtons(scrollTo) {
583
584
  var nextButton = testimonialElement.querySelector('.btn-next');
584
585
  var prevButton = testimonialElement.querySelector('.btn-prev');
@@ -587,9 +588,9 @@
587
588
  nextButton.removeAttribute('disabled');
588
589
  prevButton.removeAttribute('disabled');
589
590
  if (scrollTo == 1) prevButton.setAttribute('disabled', true);else if (scrollTo == itemCount) nextButton.setAttribute('disabled', true);
590
- }; // On scroll we need to make sure the buttons get corrected and the next testimonial is shown
591
-
591
+ };
592
592
 
593
+ // On scroll we need to make sure the buttons get corrected and the next testimonial is shown
593
594
  imagesCarousel.addEventListener('scroll', function (e) {
594
595
  clearTimeout(scrollTimeout);
595
596
  scrollTimeout = setTimeout(function () {
@@ -597,14 +598,16 @@
597
598
  var scrollHeight = imagesCarousel.scrollHeight;
598
599
  var scrollLeft = imagesCarousel.scrollLeft;
599
600
  var scrollDown = imagesCarousel.scrollTop;
600
- var scrollTo = Math.round(scrollLeft / scrollWidth * itemCount) + 1; // Change in scroll direction
601
+ var scrollTo = Math.round(scrollLeft / scrollWidth * itemCount) + 1;
601
602
 
603
+ // Change in scroll direction
602
604
  if (scrollLeft == 0 && scrollDown != 0) scrollTo = Math.round(scrollDown / scrollHeight * itemCount) + 1;
603
605
  testimonialElement.setAttribute('data-show', scrollTo);
604
606
  setButtons(scrollTo);
605
607
  }, 300);
606
- }, false); // when the buttons are used we need to make sure the carousel scrolls to the correct place
608
+ }, false);
607
609
 
610
+ // when the buttons are used we need to make sure the carousel scrolls to the correct place
608
611
  testimonialElement.addEventListener('click', function (e) {
609
612
  for (var target = e.target; target && target != this; target = target.parentNode) {
610
613
  if (target.matches('[data-go]')) {
@@ -613,8 +616,9 @@
613
616
  var scrollLeft = 0;
614
617
  var scrollWidth = imagesCarousel.scrollWidth;
615
618
  var scrollHeight = imagesCarousel.scrollHeight;
616
- if (scrollWidth > scrollHeight) scrollLeft = Math.floor(scrollWidth * ((scrollTo - 1) / itemCount));else scrollDown = Math.floor(scrollHeight * ((scrollTo - 1) / itemCount)); // Trigger the scroll
619
+ if (scrollWidth > scrollHeight) scrollLeft = Math.floor(scrollWidth * ((scrollTo - 1) / itemCount));else scrollDown = Math.floor(scrollHeight * ((scrollTo - 1) / itemCount));
617
620
 
621
+ // Trigger the scroll
618
622
  imagesCarousel.scroll({
619
623
  top: scrollDown,
620
624
  left: scrollLeft,
@@ -633,8 +637,9 @@
633
637
  carouselElement.getAttribute('data-cols');
634
638
  var smCols = carouselElement.getAttribute('data-sm-cols');
635
639
  var mdCols = carouselElement.getAttribute('data-md-cols');
636
- carouselElement.querySelector('.carousel__controls a').classList.add('active'); // On scroll we need to make sure the buttons get corrected and the next testimonial is shown
640
+ carouselElement.querySelector('.carousel__controls a').classList.add('active');
637
641
 
642
+ // On scroll we need to make sure the buttons get corrected and the next testimonial is shown
638
643
  carouselInner.addEventListener('scroll', function (e) {
639
644
  clearTimeout(scrollTimeout);
640
645
  scrollTimeout = setTimeout(function () {
@@ -646,14 +651,17 @@
646
651
  Array.from(carouselElement.querySelectorAll('.carousel__controls a')).forEach((link, index) => {
647
652
  link.classList.remove('active');
648
653
  });
649
- carouselElement.querySelector('.control-' + targetSlide).classList.add('active'); // Disable the previous button
654
+ carouselElement.querySelector('.control-' + targetSlide).classList.add('active');
650
655
 
651
- if (targetSlide == 1) carouselElement.querySelector('.btn-prev').setAttribute('disabled', 'disabled');else carouselElement.querySelector('.btn-prev').removeAttribute('disabled'); // Disable the next button if the last item is in view
656
+ // Disable the previous button
657
+ if (targetSlide == 1) carouselElement.querySelector('.btn-prev').setAttribute('disabled', 'disabled');else carouselElement.querySelector('.btn-prev').removeAttribute('disabled');
652
658
 
659
+ // Disable the next button if the last item is in view
653
660
  if (carouselInner.scrollLeft + scrollArea > lastItemOffset) carouselElement.querySelector('.btn-next').setAttribute('disabled', 'disabled');else carouselElement.querySelector('.btn-next').removeAttribute('disabled');
654
661
  }, 100);
655
- }, false); // when the buttons are used we need to make sure the carousel scrolls to the correct place
662
+ }, false);
656
663
 
664
+ // when the buttons are used we need to make sure the carousel scrolls to the correct place
657
665
  carouselElement.addEventListener('click', function (e) {
658
666
  for (var target = e.target; target && target != this; target = target.parentNode) {
659
667
  if (target.matches('.carousel__controls a')) {
@@ -685,8 +693,9 @@
685
693
  break;
686
694
  }
687
695
  }
688
- }, false); // Add responsive hide button classes
696
+ }, false);
689
697
 
698
+ // Add responsive hide button classes
690
699
  if (itemCount == 1) carouselElement.classList.add('hide-btns');
691
700
  if (smCols >= itemCount) carouselElement.classList.add('hide-sm-btns');
692
701
  if (mdCols >= itemCount) carouselElement.classList.add('hide-md-btns');
@@ -697,15 +706,17 @@
697
706
  function inputRange(inputWrapper) {
698
707
  inputWrapper.addEventListener('change', function (e) {
699
708
  var min = parseInt(inputWrapper.querySelector('[data-min] select,[data-min] input').value);
700
- var max = parseInt(inputWrapper.querySelector('[data-max] select,[data-max] input').value); // Set attributes for input fields
709
+ var max = parseInt(inputWrapper.querySelector('[data-max] select,[data-max] input').value);
701
710
 
711
+ // Set attributes for input fields
702
712
  Array.from(inputWrapper.querySelectorAll('[data-min] input')).forEach((input, index) => {
703
713
  input.setAttribute('max', max);
704
714
  });
705
715
  Array.from(inputWrapper.querySelectorAll('[data-max] input')).forEach((input, index) => {
706
716
  input.setAttribute('min', min);
707
- }); // Hide select options if they are higher or lower than the min and max values
717
+ });
708
718
 
719
+ // Hide select options if they are higher or lower than the min and max values
709
720
  Array.from(inputWrapper.querySelectorAll('[data-min] select option')).forEach((option, index) => {
710
721
  if (parseInt(option.getAttribute('value')) > max) option.classList.add('d-none');else option.classList.remove('d-none');
711
722
  });
@@ -714,7 +725,6 @@
714
725
  });
715
726
  }, false);
716
727
  }
717
-
718
728
  function inputRedirect(inputWrapper) {
719
729
  inputWrapper.addEventListener('change', function (e) {
720
730
  if (inputWrapper.matches('[data-value-if]')) {
@@ -725,9 +735,9 @@
725
735
  if (typeof inputWrapper.value != "undefined") document.location.href = inputWrapper.value;
726
736
  }
727
737
  }, false);
728
- } //
729
-
738
+ }
730
739
 
740
+ //
731
741
  function multipleFileUploads(wrapper) {
732
742
  var fileTenplate = wrapper.querySelector('.row');
733
743
  var clone = fileTenplate.cloneNode(true);
@@ -736,14 +746,15 @@
736
746
  for (var target = e.target; target && target != this; target = target.parentNode) {
737
747
  if (target.matches('[data-add]')) {
738
748
  // Add a new row upload file input fields
749
+
739
750
  var tempClone = clone.cloneNode(true);
740
751
  wrapper.insertBefore(tempClone, target);
741
752
  if (addButton.matches('[data-maxfiles]') && Array.from(wrapper.querySelectorAll(':scope > .row')).length >= addButton.dataset.maxfiles) addButton.setAttribute('disabled', 'disabled');
742
753
  break;
743
754
  }
744
-
745
755
  if (target.matches('[data-delete]')) {
746
756
  // Delete the current row
757
+
747
758
  var row = target.closest('.row');
748
759
  row.remove();
749
760
  if (addButton.matches('[data-maxfiles]') && Array.from(wrapper.querySelectorAll(':scope > .row')).length < addButton.dataset.maxfiles) addButton.removeAttribute('disabled');
@@ -751,9 +762,9 @@
751
762
  }
752
763
  }
753
764
  }, false);
754
- } // Acts as an overall initialise function to trigger other functions.
755
-
765
+ }
756
766
 
767
+ // Acts as an overall initialise function to trigger other functions.
757
768
  function form(formElement) {
758
769
  // Check for input range groups
759
770
  Array.from(formElement.querySelectorAll('[data-input-range]')).forEach((arrayElement, index) => {
@@ -764,23 +775,23 @@
764
775
  });
765
776
  Array.from(formElement.querySelectorAll('.multiple-file-uploads')).forEach((arrayElement, index) => {
766
777
  multipleFileUploads(arrayElement);
767
- }); // Check the file size of a file when uploaded in case it exceeds the max file size set
778
+ });
768
779
 
780
+ // Check the file size of a file when uploaded in case it exceeds the max file size set
769
781
  formElement.addEventListener('change', function (e) {
770
782
  for (var target = e.target; target && target != this; target = target.parentNode) {
771
783
  if (target.matches('[type="file"][data-filesize]') && target.files && target.files[0]) {
772
784
  var maxAllowedSize = target.dataset.filesize;
773
-
774
785
  if (target.files[0].size > maxAllowedSize) {
775
786
  target.value = '';
776
787
  alert('File too large');
777
788
  }
778
-
779
789
  break;
780
790
  }
781
791
  }
782
- }, false); // When a form is updated we may want to update some of the existing input fields; setting active fields when some data is selected.
792
+ }, false);
783
793
 
794
+ // When a form is updated we may want to update some of the existing input fields; setting active fields when some data is selected.
784
795
  formElement.addEventListener('change', function (e) {
785
796
  // Remove disabled attribute when a pre-selected input field equals a certain value
786
797
  Array.from(formElement.querySelectorAll('select[data-activeif][data-equals],input[data-activeif][data-equals]')).forEach((arrayElement, index) => {
@@ -788,15 +799,15 @@
788
799
  var selector = arrayElement.dataset.activeif;
789
800
  var value = arrayElement.dataset.equals;
790
801
  var testElement = group.querySelector("select[data-id=\"".concat(selector, "\"],input[data-id=\"").concat(selector, "\"]"));
791
-
792
802
  if (testElement.value == value) {
793
803
  arrayElement.removeAttribute('disabled');
794
804
  } else {
795
805
  arrayElement.setAttribute('disabled', 'disabled');
796
806
  arrayElement.value = '';
797
807
  }
798
- }); // Show this input wrapper when a pre-selected input field equals a certain value
808
+ });
799
809
 
810
+ // Show this input wrapper when a pre-selected input field equals a certain value
800
811
  Array.from(formElement.querySelectorAll('.form-control__wrapper[data-displayif][data-equals]')).forEach((arrayElement, index) => {
801
812
  var group = arrayElement.closest('[data-group]') ? arrayElement.closest('[data-group]') : formElement;
802
813
  var selector = arrayElement.dataset.activeif;
@@ -807,14 +818,15 @@
807
818
  }, false);
808
819
  }
809
820
 
810
- /**
811
- * Integrate YouTube videos as a way of hosting videos without the overhead and worry surrounding hosting vides. i.e. file sizes, performance and accessibility.
821
+ /**
822
+ * Integrate YouTube videos as a way of hosting videos without the overhead and worry surrounding hosting vides. i.e. file sizes, performance and accessibility.
812
823
  */
813
824
  class youtubeVideo {
814
825
  /** @param {Element} embed dom element */
815
826
  constructor(embed) {
816
- var createEmbed = this.createEmbed; // If the scripts is already loaded then lets just create the embed
827
+ var createEmbed = this.createEmbed;
817
828
 
829
+ // If the scripts is already loaded then lets just create the embed
818
830
  if (document.body.classList.contains('youtubeLoaded')) {
819
831
  embed.addEventListener('click', function (e) {
820
832
  // loop parent nodes from the target to the delegation node
@@ -830,17 +842,15 @@
830
842
  this.loadScripts(embed, this.createEmbed);
831
843
  }
832
844
  }
833
- /**
834
- * Load the YouTube scripts before trying to create the embed
835
- * @param {HTMLElement} embed dom element
836
- * @param {Function} createEmbed function to create the embed after script loaded.
837
- */
838
-
839
845
 
846
+ /**
847
+ * Load the YouTube scripts before trying to create the embed
848
+ * @param {HTMLElement} embed dom element
849
+ * @param {Function} createEmbed function to create the embed after script loaded.
850
+ */
840
851
  loadScripts(embed, createEmbed) {
841
852
  return new Promise((resolve, reject) => {
842
853
  var image = new Image();
843
-
844
854
  image.onload = function () {
845
855
  // This code loads the IFrame Player API code asynchronously.
846
856
  var tag = document.createElement('script');
@@ -848,8 +858,9 @@
848
858
  var firstScriptTag = document.getElementsByTagName('script')[0];
849
859
  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
850
860
  document.body.classList.add('youtubeLoaded');
851
- resolve(true); // script has loaded, you can now use it safely
861
+ resolve(true);
852
862
 
863
+ // script has loaded, you can now use it safely
853
864
  tag.onload = () => {
854
865
  embed.addEventListener('click', function (e) {
855
866
  // loop parent nodes from the target to the delegation node
@@ -863,33 +874,31 @@
863
874
  }, false);
864
875
  };
865
876
  };
866
-
867
877
  image.onerror = function () {
868
878
  reject(false);
869
879
  };
870
-
871
880
  image.src = "https://youtube.com/favicon.ico";
872
881
  });
873
882
  }
874
- /**
875
- * Create the YouTube embed after the user has clicked on it.
876
- * @param {HTMLElement} embed dom element
877
- */
878
-
879
883
 
884
+ /**
885
+ * Create the YouTube embed after the user has clicked on it.
886
+ * @param {HTMLElement} embed dom element
887
+ */
880
888
  createEmbed(embed, target) {
881
889
  // If there is more than one video lets make sure there is only one playing at a time.
882
890
  if (typeof window.player != "undefined" && typeof window.player.pauseVideo == "function") window.player.pauseVideo();
883
891
  var video_id = target.getAttribute('data-id');
884
- var link_id = target.getAttribute('id'); // create an id to pass t the script if one isn't present
892
+ var link_id = target.getAttribute('id');
885
893
 
894
+ // create an id to pass t the script if one isn't present
886
895
  if (typeof link_id == 'undefined' || link_id == null) {
887
896
  var randLetter = String.fromCharCode(65 + Math.floor(Math.random() * 26));
888
897
  link_id = randLetter + Date.now();
889
898
  target.setAttribute('id', link_id);
890
- } // This function creates an <iframe> (and YouTube player) after the API code downloads.
891
-
899
+ }
892
900
 
901
+ // This function creates an <iframe> (and YouTube player) after the API code downloads.
893
902
  function onYouTubeIframeAPIReady() {
894
903
  window.player = new YT.Player(link_id, {
895
904
  height: '100%',
@@ -907,18 +916,17 @@
907
916
  }
908
917
  });
909
918
  }
919
+ onYouTubeIframeAPIReady();
910
920
 
911
- onYouTubeIframeAPIReady(); // The API will call this function when the video player is ready.
912
-
921
+ // The API will call this function when the video player is ready.
913
922
  function onPlayerReady(event) {
914
923
  // Play the video straight away
915
924
  event.target.playVideo();
916
- } // The API calls this function when the player's state changes.
917
- // The function indicates that when playing a video (state=1)
918
-
925
+ }
919
926
 
927
+ // The API calls this function when the player's state changes.
928
+ // The function indicates that when playing a video (state=1)
920
929
  var done = false;
921
-
922
930
  function onPlayerStateChange(event) {
923
931
  if (event.data == YT.PlayerState.PLAYING && !done) {
924
932
  var link = document.getElementById(link_id);
@@ -927,7 +935,6 @@
927
935
  }
928
936
  }
929
937
  }
930
-
931
938
  }
932
939
 
933
940
  var modal = element => {
@@ -935,17 +942,17 @@
935
942
  var firstLink = links[0];
936
943
  var lastLink = links[links.length - 1];
937
944
  var modalID = element.getAttribute('id');
938
-
939
945
  var closeModal = function closeModal() {
940
946
  var button = document.querySelector('[href="' + window.location.hash + '"]');
941
947
  button.focus();
942
948
  window.location.hash = "close";
943
- history.replaceState("", document.title, window.location.pathname + window.location.search); // If there is more than one video lets make sure there is only one playing at a time.
949
+ history.replaceState("", document.title, window.location.pathname + window.location.search);
944
950
 
951
+ // If there is more than one video lets make sure there is only one playing at a time.
945
952
  if (typeof window.player != "undefined" && typeof window.player.pauseVideo == "function") window.player.pauseVideo();
946
- }; // Trap the tab focus inside
947
-
953
+ };
948
954
 
955
+ // Trap the tab focus inside
949
956
  element.addEventListener('keydown', function (e) {
950
957
  if (e.key === "Tab" && e.shiftKey && document.activeElement == firstLink) {
951
958
  e.preventDefault();
@@ -954,8 +961,9 @@
954
961
  e.preventDefault();
955
962
  firstLink.focus();
956
963
  }
957
- }); // ESC will close the open modal
964
+ });
958
965
 
966
+ // ESC will close the open modal
959
967
  document.addEventListener("keydown", function (e) {
960
968
  if (e.key === "Escape" && document.querySelector('.modal:target')) closeModal();
961
969
  });
@@ -966,7 +974,8 @@
966
974
  e.preventDefault();
967
975
  closeModal();
968
976
  break;
969
- } // Dock the modal to the right or left to make the content behind readable
977
+ }
978
+ // Dock the modal to the right or left to make the content behind readable
970
979
  else if (target.matches('.modal__dock--right')) {
971
980
  e.preventDefault();
972
981
  if (!element.classList.contains('modal--left')) element.classList.add('modal--right');
@@ -980,68 +989,65 @@
980
989
  }
981
990
  }
982
991
  });
983
-
984
992
  function locationHashChanged() {
985
993
  if (location.hash === '#' + modalID) {
986
994
  console.log("Modal is now open");
987
995
  var videoButton = document.querySelector('.modal:target .modal__inner > .youtube-embed:first-child:last-child a');
988
996
  console.log(videoButton);
989
-
990
997
  if (videoButton) {
991
998
  videoButton.click();
992
999
  }
993
1000
  }
994
1001
  }
995
-
996
1002
  window.onhashchange = locationHashChanged;
997
1003
  };
998
1004
 
999
- // @ts-nocheck
1000
- // Attach classes to dom elements
1001
- document.addEventListener("DOMContentLoaded", function () {
1002
- addBodyClasses(document.body);
1003
- addGlobalEvents();
1004
- checkElements(document.body);
1005
- console.log('test.js');
1006
- // ANav
1007
- Array.from(document.querySelectorAll('.nav')).forEach(function (arrayElement) {
1008
- navbar(arrayElement);
1009
- });
1010
- // Advanced tables
1011
- Array.from(document.querySelectorAll('.table__wrapper')).forEach(function (arrayElement) {
1012
- table(arrayElement);
1013
- });
1014
- // Accordions
1015
- Array.from(document.querySelectorAll('.accordion')).forEach(function (arrayElement) {
1016
- accordion(arrayElement);
1017
- });
1018
- // Testimonial
1019
- Array.from(document.querySelectorAll('.testimonial')).forEach(function (arrayElement) {
1020
- testimonial(arrayElement);
1021
- });
1022
- // Carousel
1023
- Array.from(document.querySelectorAll('.carousel')).forEach(function (arrayElement) {
1024
- carousel(arrayElement);
1025
- });
1026
- // Form
1027
- Array.from(document.querySelectorAll('form')).forEach(function (arrayElement) {
1028
- form(arrayElement);
1029
- });
1030
- // Modal
1031
- Array.from(document.querySelectorAll('.modal')).forEach(function (arrayElement) {
1032
- modal(arrayElement);
1033
- });
1034
- // YouTube videos
1035
- Array.from(document.querySelectorAll('.youtube-embed')).forEach(function (arrayElement) {
1036
- new youtubeVideo(arrayElement);
1037
- });
1038
- window.addEventListener('hashchange', function () {
1039
- var hash = location.hash.replace('#', '');
1040
- var label = document.querySelector("label[for=\"".concat(hash, "\"]"));
1041
- if (label instanceof HTMLElement) {
1042
- label.click();
1043
- }
1044
- }, false);
1005
+ // @ts-nocheck
1006
+ // Attach classes to dom elements
1007
+ document.addEventListener("DOMContentLoaded", function () {
1008
+ addBodyClasses(document.body);
1009
+ addGlobalEvents();
1010
+ checkElements(document.body);
1011
+ console.log('test.js');
1012
+ // ANav
1013
+ Array.from(document.querySelectorAll('.nav')).forEach(function (arrayElement) {
1014
+ navbar(arrayElement);
1015
+ });
1016
+ // Advanced tables
1017
+ Array.from(document.querySelectorAll('.table__wrapper')).forEach(function (arrayElement) {
1018
+ table(arrayElement);
1019
+ });
1020
+ // Accordions
1021
+ Array.from(document.querySelectorAll('.accordion')).forEach(function (arrayElement) {
1022
+ accordion(arrayElement);
1023
+ });
1024
+ // Testimonial
1025
+ Array.from(document.querySelectorAll('.testimonial')).forEach(function (arrayElement) {
1026
+ testimonial(arrayElement);
1027
+ });
1028
+ // Carousel
1029
+ Array.from(document.querySelectorAll('.carousel')).forEach(function (arrayElement) {
1030
+ carousel(arrayElement);
1031
+ });
1032
+ // Form
1033
+ Array.from(document.querySelectorAll('form')).forEach(function (arrayElement) {
1034
+ form(arrayElement);
1035
+ });
1036
+ // Modal
1037
+ Array.from(document.querySelectorAll('.modal')).forEach(function (arrayElement) {
1038
+ modal(arrayElement);
1039
+ });
1040
+ // YouTube videos
1041
+ Array.from(document.querySelectorAll('.youtube-embed')).forEach(function (arrayElement) {
1042
+ new youtubeVideo(arrayElement);
1043
+ });
1044
+ window.addEventListener('hashchange', function () {
1045
+ var hash = location.hash.replace('#', '');
1046
+ var label = document.querySelector("label[for=\"".concat(hash, "\"]"));
1047
+ if (label instanceof HTMLElement) {
1048
+ label.click();
1049
+ }
1050
+ }, false);
1045
1051
  });
1046
1052
 
1047
1053
  }));