@watermarkinsights/ripple 5.6.0-8 → 5.6.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 (210) hide show
  1. package/dist/cjs/{chartFunctions-995023b1.js → chartFunctions-6fd43417.js} +1 -1
  2. package/dist/cjs/{functions-e24249e6.js → functions-04149f6d.js} +0 -6
  3. package/dist/cjs/{global-9662b435.js → global-4a315ae6.js} +1 -1
  4. package/dist/cjs/index-e86c28b6.js +0 -12
  5. package/dist/cjs/{intl-5aeba788.js → intl-b1e99809.js} +1 -1
  6. package/dist/cjs/loader.cjs.js +2 -2
  7. package/dist/cjs/priv-calendar.cjs.entry.js +1 -1
  8. package/dist/cjs/priv-chart-popover.cjs.entry.js +1 -1
  9. package/dist/cjs/ripple.cjs.js +2 -2
  10. package/dist/cjs/wm-action-menu_2.cjs.entry.js +1 -1
  11. package/dist/cjs/wm-button.cjs.entry.js +1 -1
  12. package/dist/cjs/wm-chart.cjs.entry.js +3 -3
  13. package/dist/cjs/wm-date-range.cjs.entry.js +1 -1
  14. package/dist/cjs/wm-datepicker.cjs.entry.js +1 -1
  15. package/dist/cjs/wm-file.cjs.entry.js +1 -1
  16. package/dist/cjs/wm-input.cjs.entry.js +2 -2
  17. package/dist/cjs/wm-line-chart.cjs.entry.js +10 -25
  18. package/dist/cjs/wm-modal-header.cjs.entry.js +2 -2
  19. package/dist/cjs/wm-modal.cjs.entry.js +1 -1
  20. package/dist/cjs/wm-navigation_3.cjs.entry.js +2 -2
  21. package/dist/cjs/wm-navigator.cjs.entry.js +1 -1
  22. package/dist/cjs/wm-option_2.cjs.entry.js +338 -33
  23. package/dist/cjs/wm-pagination.cjs.entry.js +1 -1
  24. package/dist/cjs/wm-progress-indicator_3.cjs.entry.js +2 -2
  25. package/dist/cjs/wm-search.cjs.entry.js +2 -2
  26. package/dist/cjs/wm-snackbar.cjs.entry.js +2 -2
  27. package/dist/cjs/wm-tab-item_3.cjs.entry.js +1 -1
  28. package/dist/cjs/wm-tag-input.cjs.entry.js +2 -2
  29. package/dist/cjs/wm-tag-option.cjs.entry.js +1 -1
  30. package/dist/cjs/wm-textarea.cjs.entry.js +2 -2
  31. package/dist/cjs/wm-timepicker.cjs.entry.js +1 -1
  32. package/dist/cjs/wm-toggletip.cjs.entry.js +1 -1
  33. package/dist/cjs/wm-uploader.cjs.entry.js +2 -2
  34. package/dist/collection/collection-manifest.json +2 -5
  35. package/dist/collection/components/charts/wm-line-chart/wm-line-chart.js +7 -22
  36. package/dist/collection/components/wm-option/wm-option.js +9 -35
  37. package/dist/collection/components/wm-option/wm-option.spec.js +1 -1
  38. package/dist/collection/components/{selects/wm-select → wm-select}/wm-select.css +74 -0
  39. package/dist/collection/components/{selects/wm-select → wm-select}/wm-select.js +383 -16
  40. package/dist/collection/components/{selects/wm-select → wm-select}/wm-select.spec.js +62 -62
  41. package/dist/collection/global/functions.js +0 -5
  42. package/dist/esm/{chartFunctions-dfcb1edf.js → chartFunctions-f5eb7f59.js} +1 -1
  43. package/dist/esm/{functions-b791a892.js → functions-cf37f81f.js} +1 -6
  44. package/dist/esm/{global-f1582c2f.js → global-016b76a8.js} +1 -1
  45. package/dist/esm/index-558b5a82.js +0 -12
  46. package/dist/esm/{intl-f2f7ce8b.js → intl-c72b75dc.js} +1 -1
  47. package/dist/esm/loader.js +2 -2
  48. package/dist/esm/priv-calendar.entry.js +1 -1
  49. package/dist/esm/priv-chart-popover.entry.js +1 -1
  50. package/dist/esm/ripple.js +2 -2
  51. package/dist/esm/wm-action-menu_2.entry.js +1 -1
  52. package/dist/esm/wm-button.entry.js +1 -1
  53. package/dist/esm/wm-chart.entry.js +3 -3
  54. package/dist/esm/wm-date-range.entry.js +1 -1
  55. package/dist/esm/wm-datepicker.entry.js +1 -1
  56. package/dist/esm/wm-file.entry.js +1 -1
  57. package/dist/esm/wm-input.entry.js +2 -2
  58. package/dist/esm/wm-line-chart.entry.js +10 -25
  59. package/dist/esm/wm-modal-header.entry.js +2 -2
  60. package/dist/esm/wm-modal.entry.js +1 -1
  61. package/dist/esm/wm-navigation_3.entry.js +2 -2
  62. package/dist/esm/wm-navigator.entry.js +1 -1
  63. package/dist/esm/wm-option_2.entry.js +338 -33
  64. package/dist/esm/wm-pagination.entry.js +1 -1
  65. package/dist/esm/wm-progress-indicator_3.entry.js +2 -2
  66. package/dist/esm/wm-search.entry.js +2 -2
  67. package/dist/esm/wm-snackbar.entry.js +2 -2
  68. package/dist/esm/wm-tab-item_3.entry.js +1 -1
  69. package/dist/esm/wm-tag-input.entry.js +2 -2
  70. package/dist/esm/wm-tag-option.entry.js +1 -1
  71. package/dist/esm/wm-textarea.entry.js +2 -2
  72. package/dist/esm/wm-timepicker.entry.js +1 -1
  73. package/dist/esm/wm-toggletip.entry.js +1 -1
  74. package/dist/esm/wm-uploader.entry.js +2 -2
  75. package/dist/esm-es5/{chartFunctions-dfcb1edf.js → chartFunctions-f5eb7f59.js} +1 -1
  76. package/dist/esm-es5/{functions-b791a892.js → functions-cf37f81f.js} +1 -1
  77. package/dist/esm-es5/global-016b76a8.js +1 -0
  78. package/dist/esm-es5/index-558b5a82.js +1 -1
  79. package/dist/esm-es5/{intl-f2f7ce8b.js → intl-c72b75dc.js} +1 -1
  80. package/dist/esm-es5/loader.js +1 -1
  81. package/dist/esm-es5/priv-calendar.entry.js +1 -1
  82. package/dist/esm-es5/priv-chart-popover.entry.js +1 -1
  83. package/dist/esm-es5/ripple.js +1 -1
  84. package/dist/esm-es5/wm-action-menu_2.entry.js +1 -1
  85. package/dist/esm-es5/wm-button.entry.js +1 -1
  86. package/dist/esm-es5/wm-chart.entry.js +1 -1
  87. package/dist/esm-es5/wm-date-range.entry.js +1 -1
  88. package/dist/esm-es5/wm-datepicker.entry.js +1 -1
  89. package/dist/esm-es5/wm-file.entry.js +1 -1
  90. package/dist/esm-es5/wm-input.entry.js +1 -1
  91. package/dist/esm-es5/wm-line-chart.entry.js +1 -1
  92. package/dist/esm-es5/wm-modal-header.entry.js +1 -1
  93. package/dist/esm-es5/wm-modal.entry.js +1 -1
  94. package/dist/esm-es5/wm-navigation_3.entry.js +1 -1
  95. package/dist/esm-es5/wm-navigator.entry.js +1 -1
  96. package/dist/esm-es5/wm-option_2.entry.js +1 -1
  97. package/dist/esm-es5/wm-pagination.entry.js +1 -1
  98. package/dist/esm-es5/wm-progress-indicator_3.entry.js +1 -1
  99. package/dist/esm-es5/wm-search.entry.js +1 -1
  100. package/dist/esm-es5/wm-snackbar.entry.js +1 -1
  101. package/dist/esm-es5/wm-tab-item_3.entry.js +1 -1
  102. package/dist/esm-es5/wm-tag-input.entry.js +1 -1
  103. package/dist/esm-es5/wm-tag-option.entry.js +1 -1
  104. package/dist/esm-es5/wm-textarea.entry.js +1 -1
  105. package/dist/esm-es5/wm-timepicker.entry.js +1 -1
  106. package/dist/esm-es5/wm-toggletip.entry.js +1 -1
  107. package/dist/esm-es5/wm-uploader.entry.js +1 -1
  108. package/dist/ripple/{p-c1e3c2fb.entry.js → p-04f9a60a.entry.js} +1 -1
  109. package/dist/ripple/{p-41550baa.entry.js → p-0b570b66.entry.js} +1 -1
  110. package/dist/ripple/{p-5300b15d.entry.js → p-0d05b4a9.entry.js} +1 -1
  111. package/dist/ripple/p-11aaef56.system.entry.js +1 -0
  112. package/dist/ripple/{p-b01f9998.system.entry.js → p-120dbdc8.system.entry.js} +1 -1
  113. package/dist/ripple/{p-f24572f5.entry.js → p-1aef4b40.entry.js} +1 -1
  114. package/dist/ripple/{p-13f51c06.entry.js → p-20a800a7.entry.js} +1 -1
  115. package/dist/ripple/{p-236af552.entry.js → p-24103be5.entry.js} +1 -1
  116. package/dist/ripple/{p-1389302e.system.entry.js → p-2ccf8450.system.entry.js} +1 -1
  117. package/dist/ripple/{p-6cc07645.system.entry.js → p-2d0bcc88.system.entry.js} +1 -1
  118. package/dist/ripple/{p-0b1c6965.system.entry.js → p-2d0e4020.system.entry.js} +1 -1
  119. package/dist/ripple/{p-215793a4.entry.js → p-31094930.entry.js} +1 -1
  120. package/dist/ripple/{p-1e625a5e.entry.js → p-3ea0e27c.entry.js} +1 -1
  121. package/dist/ripple/{p-db9657eb.system.entry.js → p-446e0b2c.system.entry.js} +1 -1
  122. package/dist/ripple/{p-72165bd2.entry.js → p-451433a6.entry.js} +1 -1
  123. package/dist/ripple/p-481a9e2f.system.js +1 -0
  124. package/dist/ripple/{p-45f9ad09.entry.js → p-508362c5.entry.js} +1 -1
  125. package/dist/ripple/{p-3deaf4d9.system.entry.js → p-53519eed.system.entry.js} +1 -1
  126. package/dist/ripple/p-55668879.system.js +1 -0
  127. package/dist/ripple/p-5967bd2a.system.entry.js +1 -0
  128. package/dist/ripple/{p-5a9e3108.system.entry.js → p-5db92638.system.entry.js} +1 -1
  129. package/dist/ripple/{p-3e415c49.system.entry.js → p-5f793375.system.entry.js} +1 -1
  130. package/dist/ripple/p-6636a40b.system.entry.js +1 -0
  131. package/dist/ripple/{p-f90e4094.entry.js → p-6f4c4231.entry.js} +1 -1
  132. package/dist/ripple/{p-828adbf1.system.js → p-74032162.system.js} +1 -1
  133. package/dist/ripple/{p-5284791c.entry.js → p-762429a8.entry.js} +1 -1
  134. package/dist/ripple/{p-16f65bf4.js → p-76825602.js} +1 -1
  135. package/dist/ripple/{p-c47fab48.entry.js → p-76d53189.entry.js} +1 -1
  136. package/dist/ripple/{p-fa4f1030.system.entry.js → p-7f483c55.system.entry.js} +1 -1
  137. package/dist/ripple/{p-a3c01e10.system.entry.js → p-7fdcce90.system.entry.js} +1 -1
  138. package/dist/ripple/{p-cad0c5f9.system.entry.js → p-8008f0f2.system.entry.js} +1 -1
  139. package/dist/ripple/{p-3d50db36.entry.js → p-86d81e42.entry.js} +1 -1
  140. package/dist/ripple/{p-f2101a0d.entry.js → p-8a11ee6f.entry.js} +1 -1
  141. package/dist/ripple/{p-c2e00d4a.system.entry.js → p-8b272d80.system.entry.js} +1 -1
  142. package/dist/ripple/{p-885c3527.entry.js → p-9603168d.entry.js} +1 -1
  143. package/dist/ripple/{p-f40e1468.system.entry.js → p-97f276aa.system.entry.js} +1 -1
  144. package/dist/ripple/{p-749597da.system.entry.js → p-984287f7.system.entry.js} +1 -1
  145. package/dist/ripple/{p-ff1ed90f.entry.js → p-9b75d56c.entry.js} +1 -1
  146. package/dist/ripple/{p-a0ecb6d7.system.entry.js → p-9df3574d.system.entry.js} +1 -1
  147. package/dist/ripple/p-a40b0af9.system.js +1 -0
  148. package/dist/ripple/p-a895f1ef.entry.js +1 -0
  149. package/dist/ripple/{p-e081fdc2.system.entry.js → p-ae4460f2.system.entry.js} +1 -1
  150. package/dist/ripple/{p-b9dbf1f4.entry.js → p-bd142645.entry.js} +1 -1
  151. package/dist/ripple/{p-aea13873.entry.js → p-c61366fd.entry.js} +1 -1
  152. package/dist/ripple/{p-ca971eac.system.entry.js → p-c9200deb.system.entry.js} +1 -1
  153. package/dist/ripple/{p-6d129ef8.system.entry.js → p-cd51ee87.system.entry.js} +1 -1
  154. package/dist/ripple/{p-465d44f0.system.entry.js → p-ce8c6180.system.entry.js} +1 -1
  155. package/dist/ripple/{p-84ba5b74.entry.js → p-d0387d35.entry.js} +1 -1
  156. package/dist/ripple/{p-ed1f6b8d.system.entry.js → p-d8994408.system.entry.js} +1 -1
  157. package/dist/ripple/{p-eddbcb21.js → p-db190563.js} +1 -1
  158. package/dist/ripple/{p-83be63f6.entry.js → p-db8917e4.entry.js} +1 -1
  159. package/dist/ripple/{p-505eca1c.system.entry.js → p-dc7a6037.system.entry.js} +1 -1
  160. package/dist/ripple/p-dfd1b720.entry.js +1 -0
  161. package/dist/ripple/{p-df157138.entry.js → p-e3899e1f.entry.js} +1 -1
  162. package/dist/ripple/{p-30b905eb.system.entry.js → p-ed1971ff.system.entry.js} +1 -1
  163. package/dist/ripple/{p-2e79fa49.entry.js → p-f177d841.entry.js} +1 -1
  164. package/dist/ripple/{p-149a22bf.entry.js → p-f4b64ded.entry.js} +1 -1
  165. package/dist/ripple/p-f9494a9d.js +1 -0
  166. package/dist/ripple/{p-21d372ed.js → p-fb229776.js} +1 -1
  167. package/dist/ripple/{p-81c2df85.system.js → p-fb751343.system.js} +1 -1
  168. package/dist/ripple/{p-c853e185.system.entry.js → p-ffa15c47.system.entry.js} +1 -1
  169. package/dist/ripple/ripple.esm.js +1 -1
  170. package/dist/ripple/ripple.js +1 -1
  171. package/dist/types/components/charts/wm-line-chart/wm-line-chart.d.ts +1 -1
  172. package/dist/types/components/wm-option/wm-option.d.ts +39 -0
  173. package/dist/types/components/wm-select/wm-select.d.ts +96 -0
  174. package/dist/types/components.d.ts +2 -148
  175. package/dist/types/global/functions.d.ts +0 -1
  176. package/package.json +2 -2
  177. package/dist/cjs/priv-option-list.cjs.entry.js +0 -384
  178. package/dist/cjs/wm-nested-select.cjs.entry.js +0 -295
  179. package/dist/cjs/wm-optgroup.cjs.entry.js +0 -56
  180. package/dist/collection/components/selects/priv-option-list/priv-option-list.css +0 -104
  181. package/dist/collection/components/selects/priv-option-list/priv-option-list.js +0 -714
  182. package/dist/collection/components/selects/wm-nested-select/wm-nested-select.css +0 -378
  183. package/dist/collection/components/selects/wm-nested-select/wm-nested-select.js +0 -581
  184. package/dist/collection/components/selects/wm-optgroup/wm-optgroup.css +0 -77
  185. package/dist/collection/components/selects/wm-optgroup/wm-optgroup.js +0 -197
  186. package/dist/collection/dev/nested-select.js +0 -62
  187. package/dist/esm/priv-option-list.entry.js +0 -380
  188. package/dist/esm/wm-nested-select.entry.js +0 -291
  189. package/dist/esm/wm-optgroup.entry.js +0 -52
  190. package/dist/esm-es5/global-f1582c2f.js +0 -1
  191. package/dist/esm-es5/priv-option-list.entry.js +0 -1
  192. package/dist/esm-es5/wm-nested-select.entry.js +0 -1
  193. package/dist/esm-es5/wm-optgroup.entry.js +0 -1
  194. package/dist/ripple/p-104c0e9b.system.entry.js +0 -1
  195. package/dist/ripple/p-17c8aac1.system.entry.js +0 -1
  196. package/dist/ripple/p-24ba754f.entry.js +0 -1
  197. package/dist/ripple/p-2fb58947.entry.js +0 -1
  198. package/dist/ripple/p-4564a101.system.entry.js +0 -1
  199. package/dist/ripple/p-4ca5ed96.entry.js +0 -1
  200. package/dist/ripple/p-50388b6f.system.entry.js +0 -1
  201. package/dist/ripple/p-5b9babd9.system.entry.js +0 -1
  202. package/dist/ripple/p-8835adfb.entry.js +0 -1
  203. package/dist/ripple/p-ae82b3d2.system.js +0 -1
  204. package/dist/ripple/p-ba422994.entry.js +0 -1
  205. package/dist/ripple/p-bfeb6ef8.system.js +0 -1
  206. package/dist/ripple/p-cf2121f3.system.entry.js +0 -1
  207. package/dist/ripple/p-cf55659f.js +0 -1
  208. package/dist/ripple/p-f6fd623f.system.js +0 -1
  209. package/dist/types/components/selects/wm-select/wm-select.d.ts +0 -53
  210. /package/dist/collection/components/{selects/wm-select → wm-select}/wm-select.e2e.js +0 -0
@@ -1,384 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-e86c28b6.js');
6
- const functions = require('./functions-e24249e6.js');
7
-
8
- const privOptionListCss = ".search{-webkit-box-sizing:border-box;box-sizing:border-box;border-bottom:2px solid;border-color:var(--wmcolor-select-option-border);padding:1.25rem}.search .searchfield-wrapper{-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:2.75rem;width:100%;padding:0 0.75rem;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;border:1px solid;border-color:var(--wmcolor-select-search-border)}.search .searchfield-wrapper:focus,.search .searchfield-wrapper.focus{outline:2px solid var(--wmcolor-input-border-focus);border-color:var(--wmcolor-input-border-focus)}.search .searchfield{width:100%;border:none;outline:none;font-family:inherit;font-size:0.875rem;margin-left:0.25rem}.search .icon:before{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\\f349\";color:var(--wmcolor-select-search-icon);font-size:1.12rem}.search-results-message{padding:1.25rem;color:var(--wmcolor-select-searchresults-text);font-size:0.875rem;font-style:italic}.select-all{width:100%;cursor:pointer;padding:1.25rem;border:none;margin:0;border-bottom:2px solid;border-color:var(--wmcolor-select-selectall-border);background:var(--wmcolor-select-selectall-background);font-family:inherit;font-size:inherit;text-align:left;text-align:start;font-weight:500;color:var(--wmcolor-select-selectall-text);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.select-all:hover,.select-all:focus{outline:none;background:#f4f4f4}";
9
-
10
- const PrivOptionList = class {
11
- constructor(hostRef) {
12
- index.registerInstance(this, hostRef);
13
- this.optionListSearchChanged = index.createEvent(this, "optionListSearchChanged", 7);
14
- this.optionListCloseRequested = index.createEvent(this, "optionListCloseRequested", 7);
15
- this.optionListAllSelected = index.createEvent(this, "optionListAllSelected", 7);
16
- this.optionListAllDeselected = index.createEvent(this, "optionListAllDeselected", 7);
17
- this.searchIndex = 0;
18
- this.keysSoFar = "";
19
- this.selectAllMessage = functions.intl.formatMessage({
20
- id: "select.selectAll",
21
- defaultMessage: "Select All",
22
- });
23
- this.deselectAllMessage = functions.intl.formatMessage({
24
- id: "select.deselectAll",
25
- defaultMessage: "Deselect All",
26
- });
27
- this.allOptionsSelectedMessage = functions.intl.formatMessage({
28
- id: "select.allOptionsSelected",
29
- defaultMessage: "All options selected",
30
- });
31
- this.allOptionsDeselectedMessage = functions.intl.formatMessage({
32
- id: "select.allOptionsDeselected",
33
- defaultMessage: "All options deselected",
34
- });
35
- this.debouncedSearch = functions.debounce(() => {
36
- this.searchTerm = this.searchFieldEl.value;
37
- this.optionListSearchChanged.emit({ searchTerm: this.searchTerm });
38
- if (this.filteredOptions.length) {
39
- this.announce(this.resultsFoundMessage);
40
- }
41
- else {
42
- this.announce(this.noResultsFoundMessage);
43
- }
44
- }, 150);
45
- this.debouncedClearKeysSoFar = functions.debounce(() => {
46
- this.keysSoFar = "";
47
- }, 500);
48
- this.multiple = false;
49
- this.search = false;
50
- this.selectAll = false;
51
- this.searchPlaceholder = undefined;
52
- this.maxHeight = undefined;
53
- this.announcement = "";
54
- this.searchTerm = "";
55
- }
56
- get childOptions() {
57
- return Array.from(this.el.getRootNode().host.querySelectorAll("wm-option"));
58
- }
59
- get cloneOptions() {
60
- return Array.from(this.el.querySelectorAll("wm-option"));
61
- }
62
- get allOptionEls() {
63
- // this includes both slotted wm-options and internally created wm-options
64
- return this.cloneOptions.concat(this.childOptions);
65
- }
66
- get visibleOptionEls() {
67
- return this.allOptionEls.filter((option) => !option.classList.contains("hidden") && !option.classList.contains("filtered-out"));
68
- }
69
- //////////////////////////////////////
70
- // for search variants
71
- get filteredOptions() {
72
- return this.childOptions.filter((option) => { var _a; return (_a = option.textContent) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(this.searchTerm.toLowerCase()); });
73
- }
74
- //////////////////////////////////////
75
- //////////////////////////////////////
76
- // for multiselect button text
77
- get selectedOptions() {
78
- return Array.from(this.el.querySelectorAll("wm-option")).filter((x) => x.selected);
79
- }
80
- get visibleSelectAllButton() {
81
- return this.selectAll && this.multiple && this.searchTerm === "";
82
- }
83
- get allSelected() {
84
- return this.childOptions.every((option) => option.selected);
85
- }
86
- //////////////////////////////////////
87
- get resultsFoundMessage() {
88
- return functions.intl.formatMessage({
89
- id: "select.searchResultsFound",
90
- defaultMessage: "{numResults, plural, one {1 option found} other {# options found}}",
91
- description: "The message read by the screen reader, indicating how many results a search returned",
92
- }, { numResults: this.filteredOptions.length });
93
- }
94
- get noResultsFoundMessage() {
95
- return functions.intl.formatMessage({
96
- id: "select.noSearchResults",
97
- defaultMessage: "No results found. Please try your search again.",
98
- description: "The message displayed when no options pass the search filter",
99
- });
100
- }
101
- findAndFocusOption(ev) {
102
- const letterPressed = ev.detail.letter.toLowerCase();
103
- const optionPressed = ev.detail.optionEl;
104
- if (!this.keysSoFar && letterPressed == " ") {
105
- // if the first key entered is space, treat as a click. Otherwise include in
106
- optionPressed.click();
107
- }
108
- else {
109
- if (!this.keysSoFar) {
110
- // if first character entered, set currently focused option as the starting index for the search
111
- this.visibleOptionEls.forEach((option, idx) => {
112
- if (option.focused) {
113
- this.searchIndex = idx;
114
- }
115
- });
116
- }
117
- this.keysSoFar += letterPressed;
118
- let nextMatch = this.findMatchInRange(this.visibleOptionEls, this.searchIndex + 1, this.visibleOptionEls.length);
119
- if (!nextMatch) {
120
- // if match can't be found from starting option downwards, search from top
121
- nextMatch = this.findMatchInRange(this.visibleOptionEls, 0, this.searchIndex);
122
- }
123
- if (nextMatch) {
124
- // findMatchInRange still might have returned null, only focus if match found
125
- this.focusOption(nextMatch);
126
- }
127
- this.debouncedClearKeysSoFar();
128
- }
129
- }
130
- handleOptionSelection(ev) {
131
- this.focusOption(ev.detail);
132
- }
133
- handleChildUp(ev) {
134
- this.moveUp(ev.detail);
135
- }
136
- handleChildDown(ev) {
137
- this.moveDown(ev.detail);
138
- }
139
- moveToFirstOption() {
140
- this.focusOption(this.visibleOptionEls[0]);
141
- }
142
- moveToLastOption() {
143
- this.focusOption(this.visibleOptionEls[this.visibleOptionEls.length - 1]);
144
- }
145
- handleOptionCloneSelection(ev) {
146
- const correspondingOption = this.findCorrespondingOption(ev.detail);
147
- correspondingOption.click();
148
- }
149
- componentDidLoad() {
150
- if (this.multiple) {
151
- this.updateOptionVisibility();
152
- }
153
- // Dev can overwrite the max-height rule set in the Sass file
154
- if (this.maxHeight) {
155
- // this.listboxEl.style.maxHeight = this.maxHeight;
156
- this.listboxEl.style.maxHeight = this.maxHeight;
157
- }
158
- }
159
- async handleChildChange(_) {
160
- if (this.multiple) {
161
- // on update of wm-options selected state, rerender to update clones state
162
- index.forceUpdate(this.el);
163
- }
164
- }
165
- async clearSearch() {
166
- this.searchFieldEl.value = "";
167
- this.searchTerm = "";
168
- this.optionListSearchChanged.emit({ searchTerm: this.searchTerm });
169
- }
170
- async focusOption(option) {
171
- this.allOptionEls.forEach((i) => (i.focused = i === option));
172
- // option must be scrolledIntoView before focused
173
- // if focus is called first the option might be positioned incorrectly (in the center of the dropdown) and scrollIntoView didload do nothing as the option will already be in view
174
- option.scrollIntoView({ block: "nearest" });
175
- // scrollIntoView does not work when the container of the element it's called on is not rendered to the page (in our case the dropdown is still closed and has transform: scaleY(0))
176
- // when opening the dropdown, scrollIntoView must be delayed to a point where the browser recognizes content within it as able to be scrolled to
177
- // in Safari in particular, the soonest this seems to happen is 20ms. The longest we can wait before any jumping in the open dropdown is noticeable is 60ms
178
- window.setTimeout(() => option.scrollIntoView({ block: "nearest" }), 60);
179
- option.focus();
180
- }
181
- async handleInitialFocus(optionToSelect) {
182
- switch (optionToSelect) {
183
- case "next":
184
- // search variant focuses search field
185
- // all others focus option "after" last selected option (this can be the first option)
186
- if (this.search) {
187
- this.searchFieldEl.focus();
188
- this.listboxEl.scrollTop = 0;
189
- }
190
- else {
191
- this.moveDown(this.visibleOptionEls.filter((x) => x.selected).slice(-1)[0]);
192
- }
193
- break;
194
- case "previous":
195
- // search variant focuses last option
196
- // all others focus option "above" first selected option (this can be the last option)
197
- if (this.search) {
198
- this.focusOption(this.visibleOptionEls[this.visibleOptionEls.length - 1]);
199
- }
200
- else {
201
- this.moveUp(this.visibleOptionEls.filter((x) => x.selected)[0]);
202
- }
203
- break;
204
- default:
205
- // search variant focuses search field
206
- // all others focus the selected option
207
- // if no option is selected (empty multiselect), focuses first option
208
- if (this.search) {
209
- this.searchFieldEl.focus();
210
- this.listboxEl.scrollTop = 0;
211
- }
212
- else if (this.selectedOptions.length > 0) {
213
- this.focusOption(this.visibleOptionEls.filter((x) => x.selected)[0]);
214
- }
215
- else {
216
- this.focusOption(this.visibleOptionEls[0]);
217
- }
218
- break;
219
- }
220
- }
221
- async unfocusAll() {
222
- this.allOptionEls.map((i) => (i.focused = false));
223
- }
224
- findMatchInRange(list, startIndex, endIndex) {
225
- let match = null;
226
- let optionsInRange = list.slice(startIndex, endIndex);
227
- // Find the first option starting with the keysSoFar substring, searching in
228
- // the specified range of options
229
- optionsInRange.forEach((option) => {
230
- const label = option.textContent;
231
- if (!match && label && label.toLowerCase().startsWith(this.keysSoFar)) {
232
- match = option;
233
- }
234
- });
235
- return match;
236
- }
237
- findCorrespondingOption(el) {
238
- // if clone, returns the child wm-option
239
- // if child wm-option, returns clone
240
- const isClone = el.classList.contains("clone");
241
- return isClone
242
- ? this.childOptions[this.cloneOptions.indexOf(el)]
243
- : this.cloneOptions[this.childOptions.indexOf(el)];
244
- }
245
- handleSearchFieldBlur(ev) {
246
- this.searchFieldWrapperEl.classList.remove("focus");
247
- if (functions.isElOrChild(this.el, ev.relatedTarget)) {
248
- // do not emit a blur event when moving from searchfield to options
249
- ev.stopPropagation();
250
- }
251
- }
252
- // on search field or select all. keydown on options is handled via events.
253
- handleKeyDown(ev) {
254
- const el = ev.target;
255
- switch (ev.key) {
256
- case "ArrowDown":
257
- ev.preventDefault();
258
- this.moveDown(ev.target);
259
- break;
260
- case "ArrowUp":
261
- ev.preventDefault();
262
- this.moveUp(ev.target);
263
- break;
264
- case "Escape":
265
- ev.preventDefault();
266
- this.close();
267
- break;
268
- case "Enter":
269
- if (el === this.selectAllEl) {
270
- ev.preventDefault();
271
- this.handleSelectAllClick();
272
- this.close();
273
- }
274
- break;
275
- case " ":
276
- if (el === this.selectAllEl) {
277
- ev.preventDefault();
278
- this.handleSelectAllClick();
279
- }
280
- break;
281
- }
282
- }
283
- close() {
284
- if (this.multiple) {
285
- this.updateOptionVisibility();
286
- }
287
- this.optionListCloseRequested.emit(); // what actually happens when a close is requested is determined by the parent
288
- }
289
- handleSelectAllClick() {
290
- this.allSelected ? this.deselectAllOptions() : this.selectAllOptions();
291
- }
292
- selectAllOptions() {
293
- this.announce(this.allOptionsSelectedMessage);
294
- this.optionListAllSelected.emit();
295
- }
296
- deselectAllOptions() {
297
- this.announce(this.allOptionsDeselectedMessage);
298
- this.optionListAllDeselected.emit();
299
- }
300
- moveUp(el) {
301
- const focusableEls = this.visibleOptionEls;
302
- if (this.selectAllEl) {
303
- focusableEls.unshift(this.selectAllEl);
304
- }
305
- if (this.searchFieldEl) {
306
- focusableEls.unshift(this.searchFieldEl);
307
- }
308
- const prevEl = focusableEls[focusableEls.indexOf(el) - 1] || focusableEls[focusableEls.length - 1];
309
- if (prevEl) {
310
- this.focusOption(prevEl);
311
- }
312
- }
313
- moveDown(el) {
314
- const focusableEls = this.visibleOptionEls;
315
- if (this.selectAllEl) {
316
- focusableEls.unshift(this.selectAllEl);
317
- }
318
- if (this.searchFieldEl) {
319
- focusableEls.unshift(this.searchFieldEl);
320
- }
321
- const nextEl = focusableEls[focusableEls.indexOf(el) + 1] || focusableEls[0];
322
- if (nextEl) {
323
- this.focusOption(nextEl);
324
- }
325
- }
326
- async updateOptionVisibility() {
327
- // this runs for search multiselects, where selected options are rendered at the top of the dropdown list
328
- // slotted wm-options are hidden if selected, and clone wm-options are made visible if selected
329
- this.childOptions.forEach((option, idx) => {
330
- const cloneOption = this.cloneOptions[idx];
331
- if (option.selected) {
332
- option.classList.add("hidden");
333
- cloneOption.classList.remove("hidden");
334
- }
335
- else {
336
- option.classList.remove("hidden");
337
- cloneOption.classList.add("hidden");
338
- }
339
- });
340
- // find last visible clone option and apply .last class
341
- const visibleCloneOptions = this.visibleOptionEls.filter((option) => option.classList.contains("clone"));
342
- // if all options are clones, nothing to separate from
343
- const allClones = visibleCloneOptions.length === this.visibleOptionEls.length;
344
- visibleCloneOptions.forEach((option, idx) => {
345
- if (!allClones && idx === visibleCloneOptions.length - 1) {
346
- option.classList.add("last");
347
- }
348
- else {
349
- option.classList.remove("last");
350
- }
351
- });
352
- }
353
- announce(message) {
354
- // \u00A0 is a non-breaking space character, which causes the message to be read as a new one
355
- if (this.liveRegionEl.textContent === message) {
356
- message += "\u00A0";
357
- }
358
- this.announcement = message;
359
- }
360
- renderSearchField() {
361
- return (index.h("div", { class: "search" }, index.h("div", { class: "searchfield-wrapper", ref: (el) => (this.searchFieldWrapperEl = el) }, index.h("div", { class: "icon" }), index.h("input", { ref: (el) => (this.searchFieldEl = el), class: "searchfield", role: "combobox", "aria-controls": "list",
362
- // aria-expanded={this.isExpanded ? "true" : "false"}
363
- onKeyDown: (ev) => this.handleKeyDown(ev), onFocus: () => this.searchFieldWrapperEl.classList.add("focus"), onBlur: (ev) => this.handleSearchFieldBlur(ev), onInput: () => this.debouncedSearch(), placeholder: this.searchPlaceholder }))));
364
- }
365
- renderSearchFailedMessage() {
366
- return index.h("div", { class: "search-results-message" }, this.noResultsFoundMessage);
367
- }
368
- renderSelectAllButton() {
369
- return (index.h("button", { ref: (el) => (this.selectAllEl = el), class: "select-all", onClick: () => this.handleSelectAllClick(), onKeyDown: (ev) => this.handleKeyDown(ev), tabindex: "-1" }, this.allSelected ? this.deselectAllMessage : this.selectAllMessage));
370
- }
371
- renderCloneOptions() {
372
- return Array.from(this.childOptions).map((o) => {
373
- const option = o;
374
- return (index.h("wm-option", { class: "clone", subinfo: option.subinfo, selected: option.selected }, option.textContent));
375
- });
376
- }
377
- render() {
378
- return (index.h("div", { class: "list-wrapper" }, this.search && this.renderSearchField(), this.visibleSelectAllButton && this.renderSelectAllButton(), index.h("div", { id: "list", class: "options-wrapper", tabindex: -1, role: "listbox", "aria-multiselectable": this.multiple ? "true" : null, "aria-labelledby": "label", ref: (el) => (this.listboxEl = el) }, this.searchTerm && this.filteredOptions.length === 0 && this.renderSearchFailedMessage(), this.multiple && this.renderCloneOptions(), index.h("slot", null)), index.h("div", { id: "optionlist-announcement", "aria-live": "polite", "aria-atomic": "true", class: "sr-only", ref: (el) => (this.liveRegionEl = el) }, this.announcement)));
379
- }
380
- get el() { return index.getElement(this); }
381
- };
382
- PrivOptionList.style = privOptionListCss;
383
-
384
- exports.priv_option_list = PrivOptionList;