solid-ui 2.4.22-fd0ccabe → 2.4.23

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 (248) hide show
  1. package/LICENSE.md +0 -0
  2. package/README.md +0 -0
  3. package/dist/index.html +0 -0
  4. package/dist/main.js +8141 -7208
  5. package/dist/main.js.map +1 -1
  6. package/lib/acl/access-controller.d.ts +0 -0
  7. package/lib/acl/access-controller.d.ts.map +0 -0
  8. package/lib/acl/access-controller.js +0 -0
  9. package/lib/acl/access-controller.js.map +1 -1
  10. package/lib/acl/access-groups.d.ts +0 -0
  11. package/lib/acl/access-groups.d.ts.map +0 -0
  12. package/lib/acl/access-groups.js +0 -0
  13. package/lib/acl/access-groups.js.map +1 -1
  14. package/lib/acl/acl-control.d.ts +0 -0
  15. package/lib/acl/acl-control.d.ts.map +0 -0
  16. package/lib/acl/acl-control.js +0 -0
  17. package/lib/acl/acl-control.js.map +1 -1
  18. package/lib/acl/acl.d.ts +0 -0
  19. package/lib/acl/acl.d.ts.map +0 -0
  20. package/lib/acl/acl.js +0 -0
  21. package/lib/acl/acl.js.map +1 -1
  22. package/lib/acl/add-agent-buttons.d.ts +0 -0
  23. package/lib/acl/add-agent-buttons.d.ts.map +0 -0
  24. package/lib/acl/add-agent-buttons.js +0 -1
  25. package/lib/acl/add-agent-buttons.js.map +1 -1
  26. package/lib/acl/index.d.ts +0 -0
  27. package/lib/acl/index.d.ts.map +0 -0
  28. package/lib/acl/index.js +0 -0
  29. package/lib/acl/index.js.map +1 -1
  30. package/lib/acl/styles.d.ts +0 -0
  31. package/lib/acl/styles.d.ts.map +0 -0
  32. package/lib/acl/styles.js +0 -0
  33. package/lib/acl/styles.js.map +1 -1
  34. package/lib/acl/types.d.ts +0 -0
  35. package/lib/acl/types.d.ts.map +0 -0
  36. package/lib/acl/types.js +0 -0
  37. package/lib/acl/types.js.map +1 -1
  38. package/lib/chat/bookmarks.js +2 -4
  39. package/lib/chat/bookmarks.js.map +1 -1
  40. package/lib/chat/chatLogic.js +0 -0
  41. package/lib/chat/chatLogic.js.map +1 -1
  42. package/lib/chat/dateFolder.js +0 -0
  43. package/lib/chat/dateFolder.js.map +1 -1
  44. package/lib/chat/infinite.js +0 -0
  45. package/lib/chat/infinite.js.map +1 -1
  46. package/lib/chat/message.js +0 -0
  47. package/lib/chat/message.js.map +1 -1
  48. package/lib/chat/messageTools.js +0 -0
  49. package/lib/chat/messageTools.js.map +1 -1
  50. package/lib/chat/thread.js +0 -0
  51. package/lib/chat/thread.js.map +1 -1
  52. package/lib/create/create.d.ts +0 -0
  53. package/lib/create/create.d.ts.map +0 -0
  54. package/lib/create/create.js +0 -0
  55. package/lib/create/create.js.map +1 -1
  56. package/lib/create/index.d.ts +0 -0
  57. package/lib/create/index.d.ts.map +0 -0
  58. package/lib/create/index.js +0 -0
  59. package/lib/create/index.js.map +1 -1
  60. package/lib/create/types.d.ts +0 -0
  61. package/lib/create/types.d.ts.map +0 -0
  62. package/lib/create/types.js +0 -0
  63. package/lib/create/types.js.map +1 -1
  64. package/lib/debug.d.ts +0 -0
  65. package/lib/debug.d.ts.map +0 -0
  66. package/lib/debug.js +0 -0
  67. package/lib/debug.js.map +1 -1
  68. package/lib/folders.js +0 -0
  69. package/lib/folders.js.map +1 -1
  70. package/lib/footer/index.d.ts +0 -0
  71. package/lib/footer/index.d.ts.map +0 -0
  72. package/lib/footer/index.js +0 -0
  73. package/lib/footer/index.js.map +1 -1
  74. package/lib/footer/styleMap.d.ts +0 -0
  75. package/lib/footer/styleMap.d.ts.map +0 -0
  76. package/lib/footer/styleMap.js +0 -0
  77. package/lib/footer/styleMap.js.map +1 -1
  78. package/lib/header/empty-profile.d.ts +0 -0
  79. package/lib/header/empty-profile.d.ts.map +0 -0
  80. package/lib/header/empty-profile.js +0 -0
  81. package/lib/header/empty-profile.js.map +1 -1
  82. package/lib/header/index.d.ts +0 -0
  83. package/lib/header/index.d.ts.map +0 -0
  84. package/lib/header/index.js +0 -0
  85. package/lib/header/index.js.map +1 -1
  86. package/lib/header/styleMap.d.ts +0 -0
  87. package/lib/header/styleMap.d.ts.map +0 -0
  88. package/lib/header/styleMap.js +0 -0
  89. package/lib/header/styleMap.js.map +1 -1
  90. package/lib/iconBase.d.ts +0 -0
  91. package/lib/iconBase.d.ts.map +0 -0
  92. package/lib/iconBase.js +3 -2
  93. package/lib/iconBase.js.map +1 -1
  94. package/lib/icons/solid_logo.d.ts +0 -0
  95. package/lib/icons/solid_logo.d.ts.map +0 -0
  96. package/lib/icons/solid_logo.js +0 -0
  97. package/lib/icons/solid_logo.js.map +1 -1
  98. package/lib/index.d.ts +0 -0
  99. package/lib/index.d.ts.map +0 -0
  100. package/lib/index.js +0 -0
  101. package/lib/index.js.map +1 -1
  102. package/lib/jss/index.d.ts +0 -0
  103. package/lib/jss/index.d.ts.map +0 -0
  104. package/lib/jss/index.js +0 -0
  105. package/lib/jss/index.js.map +1 -1
  106. package/lib/log.d.ts +0 -0
  107. package/lib/log.d.ts.map +0 -0
  108. package/lib/log.js +0 -0
  109. package/lib/log.js.map +1 -1
  110. package/lib/login/login.d.ts +9 -8
  111. package/lib/login/login.d.ts.map +1 -1
  112. package/lib/login/login.js +298 -344
  113. package/lib/login/login.js.map +1 -1
  114. package/lib/matrix/index.d.ts +0 -0
  115. package/lib/matrix/index.d.ts.map +0 -0
  116. package/lib/matrix/index.js +0 -0
  117. package/lib/matrix/index.js.map +1 -1
  118. package/lib/matrix/matrix.d.ts +0 -0
  119. package/lib/matrix/matrix.d.ts.map +0 -0
  120. package/lib/matrix/matrix.js +0 -0
  121. package/lib/matrix/matrix.js.map +1 -1
  122. package/lib/matrix/types.d.ts +0 -0
  123. package/lib/matrix/types.d.ts.map +0 -0
  124. package/lib/matrix/types.js +0 -0
  125. package/lib/matrix/types.js.map +1 -1
  126. package/lib/media/index.d.ts +0 -0
  127. package/lib/media/index.d.ts.map +0 -0
  128. package/lib/media/index.js +0 -0
  129. package/lib/media/index.js.map +1 -1
  130. package/lib/media/media-capture.d.ts +0 -0
  131. package/lib/media/media-capture.d.ts.map +0 -0
  132. package/lib/media/media-capture.js +0 -0
  133. package/lib/media/media-capture.js.map +1 -1
  134. package/lib/messageArea.js +0 -0
  135. package/lib/messageArea.js.map +1 -1
  136. package/lib/noun_Camera_1618446_000000.js +0 -0
  137. package/lib/noun_Camera_1618446_000000.js.map +1 -1
  138. package/lib/ns.js +0 -0
  139. package/lib/ns.js.map +1 -1
  140. package/lib/pad.d.ts +0 -0
  141. package/lib/pad.d.ts.map +0 -0
  142. package/lib/pad.js +0 -0
  143. package/lib/pad.js.map +1 -1
  144. package/lib/participation.d.ts +0 -0
  145. package/lib/participation.d.ts.map +0 -0
  146. package/lib/participation.js +0 -0
  147. package/lib/participation.js.map +1 -1
  148. package/lib/preferences.js +0 -0
  149. package/lib/preferences.js.map +1 -1
  150. package/lib/signup/config-default.js +0 -0
  151. package/lib/signup/config-default.js.map +1 -1
  152. package/lib/signup/signup.js +0 -0
  153. package/lib/signup/signup.js.map +1 -1
  154. package/lib/stories/decorators.js +0 -0
  155. package/lib/stories/decorators.js.map +1 -1
  156. package/lib/style.js +0 -0
  157. package/lib/style.js.map +1 -1
  158. package/lib/style_multiSelect.js +67 -0
  159. package/lib/style_multiSelect.js.map +1 -0
  160. package/lib/table.js +0 -0
  161. package/lib/table.js.map +1 -1
  162. package/lib/tabs.d.ts +1 -1
  163. package/lib/tabs.d.ts.map +1 -1
  164. package/lib/tabs.js +38 -22
  165. package/lib/tabs.js.map +1 -1
  166. package/lib/typings.d.js +0 -0
  167. package/lib/typings.d.js.map +1 -1
  168. package/lib/utils/headerFooterHelpers.d.ts +0 -0
  169. package/lib/utils/headerFooterHelpers.d.ts.map +0 -0
  170. package/lib/utils/headerFooterHelpers.js +0 -0
  171. package/lib/utils/headerFooterHelpers.js.map +1 -1
  172. package/lib/utils/index.js +0 -0
  173. package/lib/utils/index.js.map +1 -1
  174. package/lib/utils/label.d.ts +0 -0
  175. package/lib/utils/label.d.ts.map +0 -0
  176. package/lib/utils/label.js +1 -1
  177. package/lib/utils/label.js.map +1 -1
  178. package/lib/versionInfo.d.ts +9 -9
  179. package/lib/versionInfo.d.ts.map +0 -0
  180. package/lib/versionInfo.js +15 -15
  181. package/lib/versionInfo.js.map +1 -1
  182. package/lib/widgets/buttons/iconLinks.d.ts +0 -0
  183. package/lib/widgets/buttons/iconLinks.d.ts.map +0 -0
  184. package/lib/widgets/buttons/iconLinks.js +0 -0
  185. package/lib/widgets/buttons/iconLinks.js.map +1 -1
  186. package/lib/widgets/buttons.d.ts +0 -0
  187. package/lib/widgets/buttons.d.ts.map +0 -0
  188. package/lib/widgets/buttons.js +0 -0
  189. package/lib/widgets/buttons.js.map +1 -1
  190. package/lib/widgets/dragAndDrop.js +0 -0
  191. package/lib/widgets/dragAndDrop.js.map +1 -1
  192. package/lib/widgets/error.d.ts +0 -12
  193. package/lib/widgets/error.d.ts.map +1 -1
  194. package/lib/widgets/error.js +5 -0
  195. package/lib/widgets/error.js.map +1 -1
  196. package/lib/widgets/forms/autocomplete/autocompleteBar.d.ts +0 -0
  197. package/lib/widgets/forms/autocomplete/autocompleteBar.d.ts.map +0 -0
  198. package/lib/widgets/forms/autocomplete/autocompleteBar.js +0 -0
  199. package/lib/widgets/forms/autocomplete/autocompleteBar.js.map +1 -1
  200. package/lib/widgets/forms/autocomplete/autocompleteField.d.ts +0 -0
  201. package/lib/widgets/forms/autocomplete/autocompleteField.d.ts.map +0 -0
  202. package/lib/widgets/forms/autocomplete/autocompleteField.js +0 -0
  203. package/lib/widgets/forms/autocomplete/autocompleteField.js.map +1 -1
  204. package/lib/widgets/forms/autocomplete/autocompletePicker.d.ts +0 -0
  205. package/lib/widgets/forms/autocomplete/autocompletePicker.d.ts.map +0 -0
  206. package/lib/widgets/forms/autocomplete/autocompletePicker.js +0 -0
  207. package/lib/widgets/forms/autocomplete/autocompletePicker.js.map +1 -1
  208. package/lib/widgets/forms/autocomplete/language.d.ts +0 -0
  209. package/lib/widgets/forms/autocomplete/language.d.ts.map +0 -0
  210. package/lib/widgets/forms/autocomplete/language.js +0 -0
  211. package/lib/widgets/forms/autocomplete/language.js.map +1 -1
  212. package/lib/widgets/forms/autocomplete/publicData.d.ts +0 -0
  213. package/lib/widgets/forms/autocomplete/publicData.d.ts.map +0 -0
  214. package/lib/widgets/forms/autocomplete/publicData.js +0 -0
  215. package/lib/widgets/forms/autocomplete/publicData.js.map +1 -1
  216. package/lib/widgets/forms/basic.d.ts +0 -0
  217. package/lib/widgets/forms/basic.d.ts.map +0 -0
  218. package/lib/widgets/forms/basic.js +0 -0
  219. package/lib/widgets/forms/basic.js.map +1 -1
  220. package/lib/widgets/forms/comment.d.ts +0 -0
  221. package/lib/widgets/forms/comment.d.ts.map +0 -0
  222. package/lib/widgets/forms/comment.js +0 -0
  223. package/lib/widgets/forms/comment.js.map +1 -1
  224. package/lib/widgets/forms/fieldFunction.d.ts +0 -0
  225. package/lib/widgets/forms/fieldFunction.d.ts.map +0 -0
  226. package/lib/widgets/forms/fieldFunction.js +0 -0
  227. package/lib/widgets/forms/fieldFunction.js.map +1 -1
  228. package/lib/widgets/forms/fieldParams.d.ts +0 -0
  229. package/lib/widgets/forms/fieldParams.d.ts.map +0 -0
  230. package/lib/widgets/forms/fieldParams.js +0 -0
  231. package/lib/widgets/forms/fieldParams.js.map +1 -1
  232. package/lib/widgets/forms/formStyle.d.ts +0 -0
  233. package/lib/widgets/forms/formStyle.d.ts.map +0 -0
  234. package/lib/widgets/forms/formStyle.js +0 -0
  235. package/lib/widgets/forms/formStyle.js.map +1 -1
  236. package/lib/widgets/forms.js +694 -150
  237. package/lib/widgets/forms.js.map +1 -1
  238. package/lib/widgets/index.js +0 -0
  239. package/lib/widgets/index.js.map +1 -1
  240. package/lib/widgets/multiSelect.js +784 -0
  241. package/lib/widgets/multiSelect.js.map +1 -0
  242. package/lib/widgets/peoplePicker.js +0 -0
  243. package/lib/widgets/peoplePicker.js.map +1 -1
  244. package/lib/widgets/widgetHelpers.d.ts +0 -0
  245. package/lib/widgets/widgetHelpers.d.ts.map +0 -0
  246. package/lib/widgets/widgetHelpers.js +0 -0
  247. package/lib/widgets/widgetHelpers.js.map +1 -1
  248. package/package.json +51 -47
@@ -0,0 +1,784 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports.IconicMultiSelect = void 0;
11
+
12
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
+
14
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
+
16
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
+
18
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
19
+
20
+ var style = _interopRequireWildcard(require("../style_multiSelect"));
21
+
22
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
+
24
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
+
26
+ /*
27
+ * IconicMultiSelect v0.7.0
28
+ * Licence: MIT
29
+ * (c) 2021 Sidney Wimart.
30
+ * repo & configuration: https://github.com/sidneywm/iconic-multiselect
31
+ */
32
+
33
+ /**
34
+ * @version IconicMultiSelect v0.7.0
35
+ * @licence MIT
36
+ */
37
+ var IconicMultiSelect = /*#__PURE__*/function () {
38
+ /**
39
+ * Iconic Multiselect constructor.
40
+ * @param { Object[] } data - Array of objects.
41
+ * @param { string } noData - Defines the message when there is no data input.
42
+ * @param { string } noResults - Defines the message when there is no result if options are filtered.
43
+ * @param { string } placeholder - Defines the placeholder's text.
44
+ * @param { string } select - DOM element to be selected. It must be a HTML Select tag - https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select
45
+ * @param { string } textField - Field to select in the object for the text.
46
+ * @param { string } valueField - Field to select in the object for the value.
47
+ */
48
+ function IconicMultiSelect(_ref) {
49
+ var data = _ref.data,
50
+ itemTemplate = _ref.itemTemplate,
51
+ noData = _ref.noData,
52
+ noResults = _ref.noResults,
53
+ placeholder = _ref.placeholder,
54
+ select = _ref.select,
55
+ container = _ref.container,
56
+ tagTemplate = _ref.tagTemplate,
57
+ textField = _ref.textField,
58
+ valueField = _ref.valueField;
59
+ (0, _classCallCheck2["default"])(this, IconicMultiSelect);
60
+ (0, _defineProperty2["default"])(this, "_data", void 0);
61
+ (0, _defineProperty2["default"])(this, "_domElements", void 0);
62
+ (0, _defineProperty2["default"])(this, "_event", function () {});
63
+ (0, _defineProperty2["default"])(this, "_itemTemplate", void 0);
64
+ (0, _defineProperty2["default"])(this, "_multiselect", void 0);
65
+ (0, _defineProperty2["default"])(this, "_noData", void 0);
66
+ (0, _defineProperty2["default"])(this, "_noResults", void 0);
67
+ (0, _defineProperty2["default"])(this, "_options", []);
68
+ (0, _defineProperty2["default"])(this, "_placeholder", void 0);
69
+ (0, _defineProperty2["default"])(this, "_select", void 0);
70
+ (0, _defineProperty2["default"])(this, "_selectContainer", void 0);
71
+ (0, _defineProperty2["default"])(this, "_selectedOptions", []);
72
+ (0, _defineProperty2["default"])(this, "_tagTemplate", void 0);
73
+ (0, _defineProperty2["default"])(this, "_textField", void 0);
74
+ (0, _defineProperty2["default"])(this, "_valueField", void 0);
75
+ (0, _defineProperty2["default"])(this, "_cross", "\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M6.2253 4.81108C5.83477 4.42056 5.20161 4.42056 4.81108 4.81108C4.42056 5.20161 4.42056 5.83477 4.81108 6.2253L10.5858 12L4.81114 17.7747C4.42062 18.1652 4.42062 18.7984 4.81114 19.1889C5.20167 19.5794 5.83483 19.5794 6.22535 19.1889L12 13.4142L17.7747 19.1889C18.1652 19.5794 18.7984 19.5794 19.1889 19.1889C19.5794 18.7984 19.5794 18.1652 19.1889 17.7747L13.4142 12L19.189 6.2253C19.5795 5.83477 19.5795 5.20161 19.189 4.81108C18.7985 4.42056 18.1653 4.42056 17.7748 4.81108L12 10.5858L6.2253 4.81108Z\"\n fill=\"currentColor\"\n />\n </svg>\n ");
76
+ this._data = data !== null && data !== void 0 ? data : [];
77
+ this._itemTemplate = itemTemplate !== null && itemTemplate !== void 0 ? itemTemplate : null;
78
+ this._noData = noData !== null && noData !== void 0 ? noData : 'No data found.';
79
+ this._noResults = noResults !== null && noResults !== void 0 ? noResults : 'No results found.';
80
+ this._placeholder = placeholder !== null && placeholder !== void 0 ? placeholder : 'Select...';
81
+ this._select = select; // Timea added a container here
82
+
83
+ this._selectContainer = container;
84
+ this._tagTemplate = tagTemplate !== null && tagTemplate !== void 0 ? tagTemplate : null;
85
+ this._textField = textField !== null && textField !== void 0 ? textField : null;
86
+ this._valueField = valueField !== null && valueField !== void 0 ? valueField : null;
87
+ }
88
+ /**
89
+ * Initialize the Iconic Multiselect component.
90
+ * @public
91
+ */
92
+
93
+
94
+ (0, _createClass2["default"])(IconicMultiSelect, [{
95
+ key: "init",
96
+ value: function init() {
97
+ // Timea change to use this._select instead of this._selectContainer
98
+ if (this._select && this._select.nodeName === 'SELECT') {
99
+ if (this._itemTemplate && this._data.length === 0) {
100
+ throw new Error('itemTemplate must be initialized with data from the component settings');
101
+ }
102
+
103
+ if (this._tagTemplate && this._data.length === 0) {
104
+ throw new Error('tagTemplate must be initialized with data from the component settings');
105
+ }
106
+
107
+ this._options = this._data.length > 0 ? this._getDataFromSettings() : this._getDataFromSelectTag();
108
+
109
+ this._renderMultiselect();
110
+
111
+ this._renderOptionsList();
112
+
113
+ this._domElements = {
114
+ clear: this._multiselect.querySelector('.multiselect__clear-btn'),
115
+ input: this._multiselect.querySelector('.multiselect__input'),
116
+ optionsContainer: this._multiselect.querySelector('.multiselect__options'),
117
+ optionsContainerList: this._multiselect.querySelector('.multiselect__options > ul'),
118
+ options: {
119
+ list: this._multiselect.querySelectorAll('.multiselect__options > ul > li'),
120
+ find: function find(callbackFn) {
121
+ for (var i = 0; i < this.list.length; i++) {
122
+ var node = this.list[i];
123
+ if (callbackFn(node)) return node;
124
+ }
125
+
126
+ return undefined;
127
+ },
128
+ some: function some(callbackFn) {
129
+ for (var i = 0; i < this.list.length; i++) {
130
+ var node = this.list[i];
131
+ if (callbackFn(node, i)) return true;
132
+ }
133
+
134
+ return false;
135
+ }
136
+ }
137
+ };
138
+
139
+ this._enableEventListenners();
140
+
141
+ this._initSelectedList();
142
+ } else {
143
+ throw new Error("The selector '".concat(this._select, "' did not select any valid select tag."));
144
+ }
145
+ }
146
+ /**
147
+ * Subscribes to the emitted events.
148
+ * @param { Function } callback - Callback function which emits a custom event object.
149
+ * @public
150
+ */
151
+
152
+ }, {
153
+ key: "subscribe",
154
+ value: function subscribe(callback) {
155
+ if (typeof callback === 'function') {
156
+ this._event = callback;
157
+ } else {
158
+ throw new Error('parameter in the subscribe method is not a function');
159
+ }
160
+ }
161
+ /**
162
+ * Add an option to the selection list.
163
+ * @param { Object: { text: string; value: string; }} option
164
+ * @private
165
+ */
166
+
167
+ }, {
168
+ key: "_addOptionToList",
169
+ value: function _addOptionToList(option, index) {
170
+ var _this = this;
171
+
172
+ var html = "<span class=\"multiselect__selected\" style=\"".concat(style.multiselect__selected, "\" data-value=\"").concat(option.value, "\">").concat(this._tagTemplate ? this._processTemplate(this._tagTemplate, index) : option.text, "<span class=\"multiselect__remove-btn\" style=\"").concat(style.multiselect__remove_btn, "\">").concat(this._cross, "</span></span>");
173
+
174
+ this._domElements.input.insertAdjacentHTML('beforebegin', html);
175
+
176
+ var _this$_multiselect$qu = this._multiselect.querySelector("span[data-value=\"".concat(option.value, "\"]")),
177
+ removeBtn = _this$_multiselect$qu.lastElementChild;
178
+
179
+ removeBtn.addEventListener('click', function () {
180
+ var target = _this._domElements.options.find(function (el) {
181
+ return el.dataset.value === option.value;
182
+ });
183
+
184
+ _this._handleOption(target);
185
+ });
186
+ }
187
+ /**
188
+ * Clears all selected options.
189
+ * @private
190
+ */
191
+
192
+ }, {
193
+ key: "_clearSelection",
194
+ value: function _clearSelection() {
195
+ var _this2 = this;
196
+
197
+ var _loop = function _loop(i) {
198
+ var option = _this2._selectedOptions[i];
199
+
200
+ var target = _this2._domElements.options.find(function (el) {
201
+ return el.dataset.value === option.value;
202
+ });
203
+
204
+ target.classList.remove('multiselect__options--selected');
205
+ target.setAttribute('style', style.multiselect__options);
206
+
207
+ _this2._removeOptionFromList(target.dataset.value);
208
+ };
209
+
210
+ for (var i = 0; i < this._selectedOptions.length; i++) {
211
+ _loop(i);
212
+ }
213
+
214
+ this._selectedOptions = [];
215
+
216
+ this._handleClearSelectionBtn();
217
+
218
+ this._handlePlaceholder();
219
+
220
+ this._dispatchEvent({
221
+ action: 'CLEAR_ALL_OPTIONS',
222
+ selection: this._selectedOptions
223
+ });
224
+ }
225
+ /**
226
+ * Close the options container.
227
+ * @private
228
+ */
229
+
230
+ }, {
231
+ key: "_closeList",
232
+ value: function _closeList() {
233
+ this._domElements.input.value = '';
234
+
235
+ this._domElements.optionsContainer.classList.remove('visible');
236
+
237
+ this._domElements.optionsContainer.setAttribute('style', style.multiselect__options);
238
+
239
+ this._filterOptions('');
240
+
241
+ this._removeAllArrowSelected();
242
+ }
243
+ /**
244
+ * Dispatches new events.
245
+ * @param { object : { action: string; selection: { option: string; text: string; }[]; value?: string; } } event
246
+ * @private
247
+ */
248
+
249
+ }, {
250
+ key: "_dispatchEvent",
251
+ value: function _dispatchEvent(event) {
252
+ this._event(event);
253
+ }
254
+ /**
255
+ * Enables all main event listenners.
256
+ * @private
257
+ */
258
+
259
+ }, {
260
+ key: "_enableEventListenners",
261
+ value: function _enableEventListenners() {
262
+ var _this3 = this;
263
+
264
+ document.addEventListener('mouseup', function (_ref2) {
265
+ var target = _ref2.target;
266
+
267
+ if (!_this3._multiselect.contains(target)) {
268
+ _this3._filterOptions('');
269
+
270
+ _this3._closeList();
271
+
272
+ _this3._handlePlaceholder();
273
+ }
274
+ });
275
+
276
+ this._domElements.clear.addEventListener('click', function () {
277
+ _this3._clearSelection();
278
+ });
279
+
280
+ for (var i = 0; i < this._domElements.options.list.length; i++) {
281
+ var option = this._domElements.options.list[i];
282
+ option.addEventListener('click', function (_ref3) {
283
+ var target = _ref3.target;
284
+
285
+ _this3._handleOption(target);
286
+
287
+ _this3._closeList();
288
+ });
289
+ }
290
+
291
+ this._domElements.input.addEventListener('focus', function () {
292
+ _this3._domElements.optionsContainer.classList.add('visible');
293
+
294
+ _this3._domElements.optionsContainer.setAttribute('style', style.multiselect__options_visible);
295
+ });
296
+
297
+ this._domElements.input.addEventListener('input', function (_ref4) {
298
+ var value = _ref4.target.value;
299
+
300
+ if (_this3._domElements.options.list.length > 0) {
301
+ _this3._filterOptions(value);
302
+ }
303
+ });
304
+
305
+ this._domElements.input.addEventListener('keydown', function (e) {
306
+ _this3._handleArrows(e);
307
+
308
+ _this3._handleBackspace(e);
309
+
310
+ _this3._handleEnter(e);
311
+ });
312
+ }
313
+ /**
314
+ * Filters user input.
315
+ * @param { string } value
316
+ * @private
317
+ */
318
+
319
+ }, {
320
+ key: "_filterOptions",
321
+ value: function _filterOptions(value) {
322
+ var _this4 = this;
323
+
324
+ var isOpen = this._domElements.optionsContainer.classList.contains('visible');
325
+
326
+ var valueLowerCase = value.toLowerCase();
327
+
328
+ if (!isOpen && value.length > 0) {
329
+ this._domElements.optionsContainer.classList.add('visible');
330
+
331
+ this._domElements.optionsContainer.setAttribute('style', style.multiselect__options_visible);
332
+ }
333
+
334
+ if (this._domElements.options.list.length > 0) {
335
+ for (var i = 0; i < this._domElements.options.list.length; i++) {
336
+ var el = this._domElements.options.list[i];
337
+ var text = this._itemTemplate ? this._data[i][this._textField] : el.textContent;
338
+
339
+ if (text.toLowerCase().substring(0, valueLowerCase.length) === valueLowerCase) {
340
+ this._domElements.optionsContainerList.appendChild(el);
341
+ } else {
342
+ el.parentNode && el.parentNode.removeChild(el);
343
+ }
344
+ }
345
+
346
+ var hasResults = this._domElements.options.some(function (el, index) {
347
+ return (_this4._itemTemplate ? _this4._data[index][_this4._textField] : el.textContent).toLowerCase().substring(0, valueLowerCase.length) === valueLowerCase;
348
+ });
349
+
350
+ this._showNoResults(!hasResults);
351
+ }
352
+ }
353
+ }, {
354
+ key: "_generateId",
355
+ value: function _generateId(length) {
356
+ var result = '';
357
+ var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
358
+ var charactersLength = characters.length;
359
+
360
+ for (var i = 0; i < length; i++) {
361
+ result += characters.charAt(Math.floor(Math.random() * charactersLength));
362
+ }
363
+
364
+ return result;
365
+ }
366
+ /**
367
+ * Gets data from select tag.
368
+ * @private
369
+ */
370
+
371
+ }, {
372
+ key: "_getDataFromSelectTag",
373
+ value: function _getDataFromSelectTag() {
374
+ var arr = [];
375
+ var options = this._select.options;
376
+
377
+ for (var i = 0; i < options.length; i++) {
378
+ var item = options[i];
379
+ arr.push({
380
+ text: item.text,
381
+ value: item.value,
382
+ selected: item.hasAttribute('selected')
383
+ });
384
+ }
385
+
386
+ return arr;
387
+ }
388
+ /**
389
+ * Gets data from settings.
390
+ * @private
391
+ */
392
+
393
+ }, {
394
+ key: "_getDataFromSettings",
395
+ value: function _getDataFromSettings() {
396
+ if (this._data.length > 0 && this._valueField && this._textField) {
397
+ var isValueFieldValid = typeof this._valueField === 'string';
398
+ var isTextFieldValid = typeof this._textField === 'string';
399
+ var arr = [];
400
+
401
+ if (!isValueFieldValid || !isTextFieldValid) {
402
+ throw new Error('textField and valueField must be of type string');
403
+ }
404
+
405
+ for (var i = 0; i < this._data.length; i++) {
406
+ var item = this._data[i];
407
+ arr.push({
408
+ value: item[this._valueField],
409
+ text: item[this._textField],
410
+ selected: typeof item.selected === 'boolean' ? item.selected : false
411
+ });
412
+ }
413
+
414
+ return arr;
415
+ } else {
416
+ return null;
417
+ }
418
+ }
419
+ /**
420
+ * Handles Arrow up & Down. Selection of an option is also possible with these keys.
421
+ * @param { Event } event
422
+ * @private
423
+ */
424
+
425
+ }, {
426
+ key: "_handleArrows",
427
+ value: function _handleArrows(event) {
428
+ if (event.keyCode === 40 || event.keyCode === 38) {
429
+ event.preventDefault();
430
+
431
+ var isOpen = this._domElements.optionsContainer.classList.contains('visible'); // An updated view of the container is needed because of the filtering option
432
+
433
+
434
+ var optionsContainerList = this._multiselect.querySelector('.multiselect__options > ul');
435
+
436
+ if (!isOpen) {
437
+ this._domElements.optionsContainer.classList.add('visible');
438
+
439
+ this._domElements.optionsContainer.setAttribute('style', style.multiselect__options_visible);
440
+
441
+ optionsContainerList.firstElementChild.classList.add('arrow-selected');
442
+ optionsContainerList.firstElementChild.setAttribute('style', style.multiselect__options_ul_li_arrow_selected);
443
+ optionsContainerList.firstElementChild.scrollIntoView(false);
444
+ } else {
445
+ var selected = this._multiselect.querySelector('.multiselect__options ul li.arrow-selected');
446
+
447
+ var action = {
448
+ ArrowUp: 'previous',
449
+ Up: 'previous',
450
+ ArrowDown: 'next',
451
+ Down: 'next'
452
+ };
453
+
454
+ if (!selected) {
455
+ optionsContainerList.firstElementChild.classList.add('arrow-selected');
456
+ optionsContainerList.firstElementChild.setAttribute('style', style.multiselect__options_ul_li_arrow_selected);
457
+ optionsContainerList.firstElementChild.scrollIntoView(false);
458
+ return;
459
+ }
460
+
461
+ selected.classList.remove('arrow-selected');
462
+ selected.setAttribute('style', style.multiselect__options_ul_li);
463
+ selected = selected[action[event.key] + 'ElementSibling']; // Go to start or end of the popup list
464
+
465
+ if (!selected) {
466
+ selected = optionsContainerList.children[action[event.key] === 'next' ? 0 : optionsContainerList.children.length - 1];
467
+ selected.classList.add('arrow-selected');
468
+ selected.setAttribute('style', style.multiselect__options_ul_li_arrow_selected);
469
+
470
+ this._scrollIntoView(optionsContainerList, selected);
471
+
472
+ return;
473
+ }
474
+
475
+ selected.classList.add('arrow-selected');
476
+ selected.setAttribute('style', style.multiselect__options_ul_li_arrow_selected);
477
+
478
+ this._scrollIntoView(optionsContainerList, selected);
479
+ }
480
+ }
481
+ }
482
+ /**
483
+ * Handles the backspace key event - Deletes the preceding option in the selection list.
484
+ * @param { Event } e
485
+ * @private
486
+ */
487
+
488
+ }, {
489
+ key: "_handleBackspace",
490
+ value: function _handleBackspace(e) {
491
+ if (e.keyCode === 8 && e.target.value === '') {
492
+ var lastSelectedOption = this._selectedOptions.length > 0 ? this._selectedOptions[this._selectedOptions.length - 1] : null;
493
+
494
+ if (lastSelectedOption) {
495
+ var targetLastSelectedOption = this._multiselect.querySelector("li[data-value=\"".concat(lastSelectedOption.value, "\"]"));
496
+
497
+ this._handleOption(targetLastSelectedOption);
498
+
499
+ if (this._selectedOptions.length === 0) {
500
+ this._domElements.optionsContainer.classList.remove('visible');
501
+
502
+ this._domElements.optionsContainer.setAttribute('style', style.multiselect__options);
503
+ }
504
+ }
505
+ }
506
+ }
507
+ /**
508
+ * Shows clear selection button if some options are selected.
509
+ * @private
510
+ */
511
+
512
+ }, {
513
+ key: "_handleClearSelectionBtn",
514
+ value: function _handleClearSelectionBtn() {
515
+ if (this._selectedOptions.length > 0) {
516
+ this._domElements.clear.style.display = 'flex';
517
+ } else {
518
+ this._domElements.clear.style.display = 'none';
519
+ }
520
+ }
521
+ /**
522
+ * Handles the enter key event.
523
+ * @param { Event } event
524
+ * @private
525
+ */
526
+
527
+ }, {
528
+ key: "_handleEnter",
529
+ value: function _handleEnter(event) {
530
+ if (event.keyCode === 13) {
531
+ var selected = this._multiselect.querySelector('.multiselect__options ul li.arrow-selected');
532
+
533
+ if (selected) {
534
+ this._handleOption(selected);
535
+
536
+ this._closeList();
537
+ }
538
+ }
539
+ }
540
+ }, {
541
+ key: "_handleOption",
542
+ value: function _handleOption(target) {
543
+ var dispatchEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
544
+
545
+ // Remove
546
+ for (var i = 0; i < this._selectedOptions.length; i++) {
547
+ var el = this._selectedOptions[i];
548
+
549
+ if (el.value === target.dataset.value) {
550
+ target.classList.remove('multiselect__options--selected');
551
+ target.setAttribute('style', style.multiselect__options);
552
+
553
+ this._selectedOptions.splice(i, 1);
554
+
555
+ this._removeOptionFromList(target.dataset.value);
556
+
557
+ this._handleClearSelectionBtn();
558
+
559
+ this._handlePlaceholder();
560
+
561
+ return dispatchEvent && this._dispatchEvent({
562
+ action: 'REMOVE_OPTION',
563
+ value: target.dataset.value,
564
+ selection: this._selectedOptions
565
+ });
566
+ }
567
+ } // Add
568
+
569
+
570
+ for (var _i = 0; _i < this._options.length; _i++) {
571
+ var option = this._options[_i];
572
+
573
+ if (option.value === target.dataset.value) {
574
+ target.classList.add('multiselect__options--selected');
575
+ target.setAttribute('style', style.multiselect__options_selected);
576
+ this._selectedOptions = [].concat((0, _toConsumableArray2["default"])(this._selectedOptions), [option]);
577
+
578
+ this._addOptionToList(option, _i);
579
+
580
+ this._handleClearSelectionBtn();
581
+
582
+ this._handlePlaceholder();
583
+
584
+ return dispatchEvent && this._dispatchEvent({
585
+ action: 'ADD_OPTION',
586
+ value: target.dataset.value,
587
+ selection: this._selectedOptions
588
+ });
589
+ }
590
+ }
591
+ }
592
+ /**
593
+ * Shows the placeholder if no options are selected.
594
+ * @private
595
+ */
596
+
597
+ }, {
598
+ key: "_handlePlaceholder",
599
+ value: function _handlePlaceholder() {
600
+ this._domElements.input.placeholder = this._placeholder;
601
+ }
602
+ }, {
603
+ key: "_initSelectedList",
604
+ value: function _initSelectedList() {
605
+ var _this5 = this;
606
+
607
+ var hasItemsSelected = false;
608
+
609
+ var _loop2 = function _loop2(i) {
610
+ var option = _this5._options[i];
611
+
612
+ if (option.selected) {
613
+ hasItemsSelected = true;
614
+
615
+ var target = _this5._domElements.options.find(function (el) {
616
+ return el.dataset.value === option.value;
617
+ });
618
+
619
+ target.classList.add('multiselect__options--selected');
620
+ target.setAttribute('style', style.multiselect__options_selected);
621
+ _this5._selectedOptions = [].concat((0, _toConsumableArray2["default"])(_this5._selectedOptions), [option]);
622
+
623
+ _this5._addOptionToList(option, i);
624
+ }
625
+ };
626
+
627
+ for (var i = 0; i < this._options.length; i++) {
628
+ _loop2(i);
629
+ }
630
+
631
+ if (hasItemsSelected) {
632
+ this._handleClearSelectionBtn();
633
+ }
634
+
635
+ this._handlePlaceholder();
636
+ }
637
+ /**
638
+ * Process the custom template.
639
+ * @param { string } template
640
+ * @private
641
+ */
642
+
643
+ }, {
644
+ key: "_processTemplate",
645
+ value: function _processTemplate(template, index) {
646
+ var processedTemplate = template;
647
+ var objAttr = template.match(/\$\{(\w+)\}/g).map(function (e) {
648
+ return e.replace(/\$\{|\}/g, '');
649
+ });
650
+
651
+ for (var i = 0; i < objAttr.length; i++) {
652
+ var _this$_data$index$att;
653
+
654
+ var attr = objAttr[i]; // eslint-disable-next-line no-useless-escape
655
+
656
+ processedTemplate = processedTemplate.replace("${".concat(attr, "}"), (_this$_data$index$att = this._data[index][attr]) !== null && _this$_data$index$att !== void 0 ? _this$_data$index$att : '');
657
+ }
658
+
659
+ return processedTemplate;
660
+ }
661
+ }, {
662
+ key: "_removeAllArrowSelected",
663
+ value: function _removeAllArrowSelected() {
664
+ var className = 'arrow-selected';
665
+
666
+ var target = this._domElements.options.find(function (el) {
667
+ return el.classList.contains(className);
668
+ });
669
+
670
+ target && target.classList.remove(className) && target.setAttribute('style', style.multiselect__options_ul_li);
671
+ }
672
+ /**
673
+ * Removes an option from the list.
674
+ * @param { string } value
675
+ * @private
676
+ */
677
+
678
+ }, {
679
+ key: "_removeOptionFromList",
680
+ value: function _removeOptionFromList(value) {
681
+ var optionDom = this._multiselect.querySelector("span[data-value=\"".concat(value, "\"]"));
682
+
683
+ optionDom && optionDom.parentNode && optionDom.parentNode.removeChild(optionDom);
684
+ }
685
+ /**
686
+ * Renders the multiselect options list view.
687
+ * @private
688
+ */
689
+
690
+ }, {
691
+ key: "_renderOptionsList",
692
+ value: function _renderOptionsList() {
693
+ var _this6 = this;
694
+
695
+ var html = "\n <div class=\"multiselect__options\" style=\"".concat(style.multiselect__options, "\">\n <ul style=\"").concat(style.multiselect__options_ul, "\">\n ").concat(this._options.length > 0 && !this._itemTemplate ? this._options.map(function (option) {
696
+ return "\n <li data-value=\"".concat(option.value, "\" style=\"").concat(style.multiselect__options_ul_li, "\">").concat(option.text, "</li>\n ");
697
+ }).join('') : '', "\n\n ").concat(this._options.length > 0 && this._itemTemplate ? this._options.map(function (option, index) {
698
+ return "\n <li data-value=\"".concat(option.value, "\" style=\"").concat(style.multiselect__options_ul_li, "\">").concat(_this6._processTemplate(_this6._itemTemplate, index), "</li>\n ");
699
+ }).join('') : '', "\n ").concat(this._showNoData(this._options.length === 0), "\n </ul>\n </div>\n ");
700
+
701
+ this._multiselect.insertAdjacentHTML('beforeend', html);
702
+ }
703
+ /**
704
+ * Renders the multiselect view.
705
+ * @private
706
+ */
707
+
708
+ }, {
709
+ key: "_renderMultiselect",
710
+ value: function _renderMultiselect() {
711
+ this._select.style.display = 'none';
712
+
713
+ var id = 'iconic-' + this._generateId(20); // Timea created dedicated div element because previous code was not rendering
714
+
715
+
716
+ this._multiselect = document.createElement('div');
717
+
718
+ this._multiselect.setAttribute('id', id);
719
+
720
+ this._multiselect.setAttribute('class', 'multiselect__container');
721
+
722
+ this._multiselect.setAttribute('style', style.multiselect__container);
723
+
724
+ var html = "\n <div class=\"multiselect__wrapper\" style=\"".concat(style.multiselect__wrapper, "\">\n <input class=\"multiselect__input\" style=\"").concat(style.multiselect__input, "\" placeholder=\"").concat(this._placeholder, "\" />\n </div>\n <span style=\"display: none;\" class=\"multiselect__clear-btn\" style=\"").concat(style.multiselect__clear_btn, "\">").concat(this._cross, "</span>\n ");
725
+ this._multiselect.innerHTML = html;
726
+
727
+ this._selectContainer.appendChild(this._multiselect);
728
+ }
729
+ /**
730
+ * ScrollIntoView - This small utility reproduces the behavior of .scrollIntoView({ block: "nearest", inline: "nearest" })
731
+ * This is for IE compatibility without a need of a polyfill
732
+ * @private
733
+ */
734
+
735
+ }, {
736
+ key: "_scrollIntoView",
737
+ value: function _scrollIntoView(parent, child) {
738
+ var rectParent = parent.getBoundingClientRect();
739
+ var rectChild = child.getBoundingClientRect(); // Detect if not visible at top and then scroll to the top
740
+
741
+ if (!(rectParent.top < rectChild.bottom - child.offsetHeight)) {
742
+ parent.scrollTop = child.clientHeight + (child.offsetTop - child.offsetHeight);
743
+ } // Detect if not visible at bottom and then scroll to the bottom
744
+
745
+
746
+ if (!(rectParent.bottom > rectChild.top + child.offsetHeight)) {
747
+ parent.scrollTop = child.clientHeight + (child.offsetTop - child.offsetHeight) - (parent.offsetHeight - (child.offsetHeight + (child.offsetHeight - child.clientHeight)));
748
+ }
749
+ }
750
+ /**
751
+ * Shows a no data message.
752
+ * @param { boolean } condition
753
+ * @private
754
+ */
755
+
756
+ }, {
757
+ key: "_showNoData",
758
+ value: function _showNoData(condition) {
759
+ return condition ? "<p class=\"multiselect__options--no-data\" style=\"".concat(style.multiselect__options_ul_p_multiselect__options_no_data, "\">").concat(this._noData, "</p>") : '';
760
+ }
761
+ /**
762
+ * Shows a no results message.
763
+ * @param { boolean } condition
764
+ * @private
765
+ */
766
+
767
+ }, {
768
+ key: "_showNoResults",
769
+ value: function _showNoResults(condition) {
770
+ var dom = this._multiselect.querySelector('.multiselect__options--no-results');
771
+
772
+ if (condition) {
773
+ var html = "<p class=\"multiselect__options--no-results\" style=\"".concat(style.multiselect__options_ul_p_multiselect__options_no_results, "\">").concat(this._noResults, "</p>");
774
+ !dom && this._domElements.optionsContainerList.insertAdjacentHTML('beforeend', html);
775
+ } else {
776
+ dom && dom.parentNode && dom.parentNode.removeChild(dom);
777
+ }
778
+ }
779
+ }]);
780
+ return IconicMultiSelect;
781
+ }();
782
+
783
+ exports.IconicMultiSelect = IconicMultiSelect;
784
+ //# sourceMappingURL=multiSelect.js.map