@watermarkinsights/ripple 5.6.0-7 → 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 (208) 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-8b5f83e4.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 +3 -3
  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/wm-option/wm-option.js +9 -35
  36. package/dist/collection/components/wm-option/wm-option.spec.js +1 -1
  37. package/dist/collection/components/{selects/wm-select → wm-select}/wm-select.css +74 -0
  38. package/dist/collection/components/{selects/wm-select → wm-select}/wm-select.js +383 -16
  39. package/dist/collection/components/{selects/wm-select → wm-select}/wm-select.spec.js +62 -62
  40. package/dist/collection/global/functions.js +0 -5
  41. package/dist/esm/{chartFunctions-dfcb1edf.js → chartFunctions-f5eb7f59.js} +1 -1
  42. package/dist/esm/{functions-b791a892.js → functions-cf37f81f.js} +1 -6
  43. package/dist/esm/{global-5c6da026.js → global-016b76a8.js} +1 -1
  44. package/dist/esm/index-558b5a82.js +0 -12
  45. package/dist/esm/{intl-f2f7ce8b.js → intl-c72b75dc.js} +1 -1
  46. package/dist/esm/loader.js +2 -2
  47. package/dist/esm/priv-calendar.entry.js +1 -1
  48. package/dist/esm/priv-chart-popover.entry.js +1 -1
  49. package/dist/esm/ripple.js +2 -2
  50. package/dist/esm/wm-action-menu_2.entry.js +1 -1
  51. package/dist/esm/wm-button.entry.js +1 -1
  52. package/dist/esm/wm-chart.entry.js +3 -3
  53. package/dist/esm/wm-date-range.entry.js +1 -1
  54. package/dist/esm/wm-datepicker.entry.js +1 -1
  55. package/dist/esm/wm-file.entry.js +1 -1
  56. package/dist/esm/wm-input.entry.js +2 -2
  57. package/dist/esm/wm-line-chart.entry.js +3 -3
  58. package/dist/esm/wm-modal-header.entry.js +2 -2
  59. package/dist/esm/wm-modal.entry.js +1 -1
  60. package/dist/esm/wm-navigation_3.entry.js +2 -2
  61. package/dist/esm/wm-navigator.entry.js +1 -1
  62. package/dist/esm/wm-option_2.entry.js +338 -33
  63. package/dist/esm/wm-pagination.entry.js +1 -1
  64. package/dist/esm/wm-progress-indicator_3.entry.js +2 -2
  65. package/dist/esm/wm-search.entry.js +2 -2
  66. package/dist/esm/wm-snackbar.entry.js +2 -2
  67. package/dist/esm/wm-tab-item_3.entry.js +1 -1
  68. package/dist/esm/wm-tag-input.entry.js +2 -2
  69. package/dist/esm/wm-tag-option.entry.js +1 -1
  70. package/dist/esm/wm-textarea.entry.js +2 -2
  71. package/dist/esm/wm-timepicker.entry.js +1 -1
  72. package/dist/esm/wm-toggletip.entry.js +1 -1
  73. package/dist/esm/wm-uploader.entry.js +2 -2
  74. package/dist/esm-es5/{chartFunctions-dfcb1edf.js → chartFunctions-f5eb7f59.js} +1 -1
  75. package/dist/esm-es5/{functions-b791a892.js → functions-cf37f81f.js} +1 -1
  76. package/dist/esm-es5/global-016b76a8.js +1 -0
  77. package/dist/esm-es5/index-558b5a82.js +1 -1
  78. package/dist/esm-es5/{intl-f2f7ce8b.js → intl-c72b75dc.js} +1 -1
  79. package/dist/esm-es5/loader.js +1 -1
  80. package/dist/esm-es5/priv-calendar.entry.js +1 -1
  81. package/dist/esm-es5/priv-chart-popover.entry.js +1 -1
  82. package/dist/esm-es5/ripple.js +1 -1
  83. package/dist/esm-es5/wm-action-menu_2.entry.js +1 -1
  84. package/dist/esm-es5/wm-button.entry.js +1 -1
  85. package/dist/esm-es5/wm-chart.entry.js +1 -1
  86. package/dist/esm-es5/wm-date-range.entry.js +1 -1
  87. package/dist/esm-es5/wm-datepicker.entry.js +1 -1
  88. package/dist/esm-es5/wm-file.entry.js +1 -1
  89. package/dist/esm-es5/wm-input.entry.js +1 -1
  90. package/dist/esm-es5/wm-line-chart.entry.js +1 -1
  91. package/dist/esm-es5/wm-modal-header.entry.js +1 -1
  92. package/dist/esm-es5/wm-modal.entry.js +1 -1
  93. package/dist/esm-es5/wm-navigation_3.entry.js +1 -1
  94. package/dist/esm-es5/wm-navigator.entry.js +1 -1
  95. package/dist/esm-es5/wm-option_2.entry.js +1 -1
  96. package/dist/esm-es5/wm-pagination.entry.js +1 -1
  97. package/dist/esm-es5/wm-progress-indicator_3.entry.js +1 -1
  98. package/dist/esm-es5/wm-search.entry.js +1 -1
  99. package/dist/esm-es5/wm-snackbar.entry.js +1 -1
  100. package/dist/esm-es5/wm-tab-item_3.entry.js +1 -1
  101. package/dist/esm-es5/wm-tag-input.entry.js +1 -1
  102. package/dist/esm-es5/wm-tag-option.entry.js +1 -1
  103. package/dist/esm-es5/wm-textarea.entry.js +1 -1
  104. package/dist/esm-es5/wm-timepicker.entry.js +1 -1
  105. package/dist/esm-es5/wm-toggletip.entry.js +1 -1
  106. package/dist/esm-es5/wm-uploader.entry.js +1 -1
  107. package/dist/ripple/{p-c1e3c2fb.entry.js → p-04f9a60a.entry.js} +1 -1
  108. package/dist/ripple/{p-41550baa.entry.js → p-0b570b66.entry.js} +1 -1
  109. package/dist/ripple/{p-5300b15d.entry.js → p-0d05b4a9.entry.js} +1 -1
  110. package/dist/ripple/p-11aaef56.system.entry.js +1 -0
  111. package/dist/ripple/{p-b01f9998.system.entry.js → p-120dbdc8.system.entry.js} +1 -1
  112. package/dist/ripple/{p-f24572f5.entry.js → p-1aef4b40.entry.js} +1 -1
  113. package/dist/ripple/{p-13f51c06.entry.js → p-20a800a7.entry.js} +1 -1
  114. package/dist/ripple/{p-236af552.entry.js → p-24103be5.entry.js} +1 -1
  115. package/dist/ripple/{p-1389302e.system.entry.js → p-2ccf8450.system.entry.js} +1 -1
  116. package/dist/ripple/{p-6cc07645.system.entry.js → p-2d0bcc88.system.entry.js} +1 -1
  117. package/dist/ripple/{p-0b1c6965.system.entry.js → p-2d0e4020.system.entry.js} +1 -1
  118. package/dist/ripple/{p-215793a4.entry.js → p-31094930.entry.js} +1 -1
  119. package/dist/ripple/{p-1e625a5e.entry.js → p-3ea0e27c.entry.js} +1 -1
  120. package/dist/ripple/{p-db9657eb.system.entry.js → p-446e0b2c.system.entry.js} +1 -1
  121. package/dist/ripple/{p-72165bd2.entry.js → p-451433a6.entry.js} +1 -1
  122. package/dist/ripple/p-481a9e2f.system.js +1 -0
  123. package/dist/ripple/{p-45f9ad09.entry.js → p-508362c5.entry.js} +1 -1
  124. package/dist/ripple/{p-3deaf4d9.system.entry.js → p-53519eed.system.entry.js} +1 -1
  125. package/dist/ripple/p-55668879.system.js +1 -0
  126. package/dist/ripple/{p-725230dd.system.entry.js → p-5967bd2a.system.entry.js} +1 -1
  127. package/dist/ripple/{p-5a9e3108.system.entry.js → p-5db92638.system.entry.js} +1 -1
  128. package/dist/ripple/{p-3e415c49.system.entry.js → p-5f793375.system.entry.js} +1 -1
  129. package/dist/ripple/p-6636a40b.system.entry.js +1 -0
  130. package/dist/ripple/{p-f90e4094.entry.js → p-6f4c4231.entry.js} +1 -1
  131. package/dist/ripple/{p-828adbf1.system.js → p-74032162.system.js} +1 -1
  132. package/dist/ripple/{p-5284791c.entry.js → p-762429a8.entry.js} +1 -1
  133. package/dist/ripple/{p-16f65bf4.js → p-76825602.js} +1 -1
  134. package/dist/ripple/{p-c47fab48.entry.js → p-76d53189.entry.js} +1 -1
  135. package/dist/ripple/{p-fa4f1030.system.entry.js → p-7f483c55.system.entry.js} +1 -1
  136. package/dist/ripple/{p-a3c01e10.system.entry.js → p-7fdcce90.system.entry.js} +1 -1
  137. package/dist/ripple/{p-cad0c5f9.system.entry.js → p-8008f0f2.system.entry.js} +1 -1
  138. package/dist/ripple/{p-3d50db36.entry.js → p-86d81e42.entry.js} +1 -1
  139. package/dist/ripple/{p-f2101a0d.entry.js → p-8a11ee6f.entry.js} +1 -1
  140. package/dist/ripple/{p-c2e00d4a.system.entry.js → p-8b272d80.system.entry.js} +1 -1
  141. package/dist/ripple/{p-885c3527.entry.js → p-9603168d.entry.js} +1 -1
  142. package/dist/ripple/{p-f40e1468.system.entry.js → p-97f276aa.system.entry.js} +1 -1
  143. package/dist/ripple/{p-749597da.system.entry.js → p-984287f7.system.entry.js} +1 -1
  144. package/dist/ripple/{p-ff1ed90f.entry.js → p-9b75d56c.entry.js} +1 -1
  145. package/dist/ripple/{p-a0ecb6d7.system.entry.js → p-9df3574d.system.entry.js} +1 -1
  146. package/dist/ripple/p-a40b0af9.system.js +1 -0
  147. package/dist/ripple/p-a895f1ef.entry.js +1 -0
  148. package/dist/ripple/{p-e081fdc2.system.entry.js → p-ae4460f2.system.entry.js} +1 -1
  149. package/dist/ripple/{p-b9dbf1f4.entry.js → p-bd142645.entry.js} +1 -1
  150. package/dist/ripple/{p-aea13873.entry.js → p-c61366fd.entry.js} +1 -1
  151. package/dist/ripple/{p-ca971eac.system.entry.js → p-c9200deb.system.entry.js} +1 -1
  152. package/dist/ripple/{p-6d129ef8.system.entry.js → p-cd51ee87.system.entry.js} +1 -1
  153. package/dist/ripple/{p-465d44f0.system.entry.js → p-ce8c6180.system.entry.js} +1 -1
  154. package/dist/ripple/{p-84ba5b74.entry.js → p-d0387d35.entry.js} +1 -1
  155. package/dist/ripple/{p-ed1f6b8d.system.entry.js → p-d8994408.system.entry.js} +1 -1
  156. package/dist/ripple/{p-eddbcb21.js → p-db190563.js} +1 -1
  157. package/dist/ripple/{p-83be63f6.entry.js → p-db8917e4.entry.js} +1 -1
  158. package/dist/ripple/{p-505eca1c.system.entry.js → p-dc7a6037.system.entry.js} +1 -1
  159. package/dist/ripple/{p-e687176d.entry.js → p-dfd1b720.entry.js} +1 -1
  160. package/dist/ripple/{p-df157138.entry.js → p-e3899e1f.entry.js} +1 -1
  161. package/dist/ripple/{p-30b905eb.system.entry.js → p-ed1971ff.system.entry.js} +1 -1
  162. package/dist/ripple/{p-2e79fa49.entry.js → p-f177d841.entry.js} +1 -1
  163. package/dist/ripple/{p-149a22bf.entry.js → p-f4b64ded.entry.js} +1 -1
  164. package/dist/ripple/p-f9494a9d.js +1 -0
  165. package/dist/ripple/{p-21d372ed.js → p-fb229776.js} +1 -1
  166. package/dist/ripple/{p-81c2df85.system.js → p-fb751343.system.js} +1 -1
  167. package/dist/ripple/{p-c853e185.system.entry.js → p-ffa15c47.system.entry.js} +1 -1
  168. package/dist/ripple/ripple.esm.js +1 -1
  169. package/dist/ripple/ripple.js +1 -1
  170. package/dist/types/components/wm-option/wm-option.d.ts +1 -2
  171. package/dist/types/components/{selects/priv-option-list/priv-option-list.d.ts → wm-select/wm-select.d.ts} +65 -37
  172. package/dist/types/components.d.ts +2 -148
  173. package/dist/types/global/functions.d.ts +0 -1
  174. package/package.json +2 -2
  175. package/dist/cjs/priv-option-list.cjs.entry.js +0 -384
  176. package/dist/cjs/wm-nested-select.cjs.entry.js +0 -295
  177. package/dist/cjs/wm-optgroup.cjs.entry.js +0 -56
  178. package/dist/collection/components/selects/priv-option-list/priv-option-list.css +0 -104
  179. package/dist/collection/components/selects/priv-option-list/priv-option-list.js +0 -714
  180. package/dist/collection/components/selects/wm-nested-select/wm-nested-select.css +0 -378
  181. package/dist/collection/components/selects/wm-nested-select/wm-nested-select.js +0 -581
  182. package/dist/collection/components/selects/wm-optgroup/wm-optgroup.css +0 -77
  183. package/dist/collection/components/selects/wm-optgroup/wm-optgroup.js +0 -197
  184. package/dist/collection/dev/nested-select.js +0 -62
  185. package/dist/esm/priv-option-list.entry.js +0 -380
  186. package/dist/esm/wm-nested-select.entry.js +0 -291
  187. package/dist/esm/wm-optgroup.entry.js +0 -52
  188. package/dist/esm-es5/global-5c6da026.js +0 -1
  189. package/dist/esm-es5/priv-option-list.entry.js +0 -1
  190. package/dist/esm-es5/wm-nested-select.entry.js +0 -1
  191. package/dist/esm-es5/wm-optgroup.entry.js +0 -1
  192. package/dist/ripple/p-104c0e9b.system.entry.js +0 -1
  193. package/dist/ripple/p-17c8aac1.system.entry.js +0 -1
  194. package/dist/ripple/p-24ba754f.entry.js +0 -1
  195. package/dist/ripple/p-2fb58947.entry.js +0 -1
  196. package/dist/ripple/p-4564a101.system.entry.js +0 -1
  197. package/dist/ripple/p-4ca5ed96.entry.js +0 -1
  198. package/dist/ripple/p-50388b6f.system.entry.js +0 -1
  199. package/dist/ripple/p-5a8e86e9.system.js +0 -1
  200. package/dist/ripple/p-5b9babd9.system.entry.js +0 -1
  201. package/dist/ripple/p-61262e66.js +0 -1
  202. package/dist/ripple/p-8835adfb.entry.js +0 -1
  203. package/dist/ripple/p-aa4a7527.system.js +0 -1
  204. package/dist/ripple/p-ae82b3d2.system.js +0 -1
  205. package/dist/types/components/selects/wm-nested-select/wm-nested-select.d.ts +0 -55
  206. package/dist/types/components/selects/wm-optgroup/wm-optgroup.d.ts +0 -16
  207. package/dist/types/components/selects/wm-select/wm-select.d.ts +0 -53
  208. /package/dist/collection/components/{selects/wm-select → wm-select}/wm-select.e2e.js +0 -0
@@ -1,714 +0,0 @@
1
- import { h, forceUpdate } from "@stencil/core";
2
- import { intl, debounce, isElOrChild } from "../../../global/functions";
3
- export class PrivOptionList {
4
- constructor() {
5
- this.searchIndex = 0;
6
- this.keysSoFar = "";
7
- this.selectAllMessage = intl.formatMessage({
8
- id: "select.selectAll",
9
- defaultMessage: "Select All",
10
- });
11
- this.deselectAllMessage = intl.formatMessage({
12
- id: "select.deselectAll",
13
- defaultMessage: "Deselect All",
14
- });
15
- this.allOptionsSelectedMessage = intl.formatMessage({
16
- id: "select.allOptionsSelected",
17
- defaultMessage: "All options selected",
18
- });
19
- this.allOptionsDeselectedMessage = intl.formatMessage({
20
- id: "select.allOptionsDeselected",
21
- defaultMessage: "All options deselected",
22
- });
23
- this.debouncedSearch = debounce(() => {
24
- this.searchTerm = this.searchFieldEl.value;
25
- this.optionListSearchChanged.emit({ searchTerm: this.searchTerm });
26
- if (this.filteredOptions.length) {
27
- this.announce(this.resultsFoundMessage);
28
- }
29
- else {
30
- this.announce(this.noResultsFoundMessage);
31
- }
32
- }, 150);
33
- this.debouncedClearKeysSoFar = debounce(() => {
34
- this.keysSoFar = "";
35
- }, 500);
36
- this.multiple = false;
37
- this.search = false;
38
- this.selectAll = false;
39
- this.searchPlaceholder = undefined;
40
- this.maxHeight = undefined;
41
- this.announcement = "";
42
- this.searchTerm = "";
43
- }
44
- get childOptions() {
45
- return Array.from(this.el.getRootNode().host.querySelectorAll("wm-option"));
46
- }
47
- get cloneOptions() {
48
- return Array.from(this.el.querySelectorAll("wm-option"));
49
- }
50
- get allOptionEls() {
51
- // this includes both slotted wm-options and internally created wm-options
52
- return this.cloneOptions.concat(this.childOptions);
53
- }
54
- get visibleOptionEls() {
55
- return this.allOptionEls.filter((option) => !option.classList.contains("hidden") && !option.classList.contains("filtered-out"));
56
- }
57
- //////////////////////////////////////
58
- // for search variants
59
- get filteredOptions() {
60
- return this.childOptions.filter((option) => { var _a; return (_a = option.textContent) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(this.searchTerm.toLowerCase()); });
61
- }
62
- //////////////////////////////////////
63
- //////////////////////////////////////
64
- // for multiselect button text
65
- get selectedOptions() {
66
- return Array.from(this.el.querySelectorAll("wm-option")).filter((x) => x.selected);
67
- }
68
- get visibleSelectAllButton() {
69
- return this.selectAll && this.multiple && this.searchTerm === "";
70
- }
71
- get allSelected() {
72
- return this.childOptions.every((option) => option.selected);
73
- }
74
- //////////////////////////////////////
75
- get resultsFoundMessage() {
76
- return intl.formatMessage({
77
- id: "select.searchResultsFound",
78
- defaultMessage: "{numResults, plural, one {1 option found} other {# options found}}",
79
- description: "The message read by the screen reader, indicating how many results a search returned",
80
- }, { numResults: this.filteredOptions.length });
81
- }
82
- get noResultsFoundMessage() {
83
- return intl.formatMessage({
84
- id: "select.noSearchResults",
85
- defaultMessage: "No results found. Please try your search again.",
86
- description: "The message displayed when no options pass the search filter",
87
- });
88
- }
89
- findAndFocusOption(ev) {
90
- const letterPressed = ev.detail.letter.toLowerCase();
91
- const optionPressed = ev.detail.optionEl;
92
- if (!this.keysSoFar && letterPressed == " ") {
93
- // if the first key entered is space, treat as a click. Otherwise include in
94
- optionPressed.click();
95
- }
96
- else {
97
- if (!this.keysSoFar) {
98
- // if first character entered, set currently focused option as the starting index for the search
99
- this.visibleOptionEls.forEach((option, idx) => {
100
- if (option.focused) {
101
- this.searchIndex = idx;
102
- }
103
- });
104
- }
105
- this.keysSoFar += letterPressed;
106
- let nextMatch = this.findMatchInRange(this.visibleOptionEls, this.searchIndex + 1, this.visibleOptionEls.length);
107
- if (!nextMatch) {
108
- // if match can't be found from starting option downwards, search from top
109
- nextMatch = this.findMatchInRange(this.visibleOptionEls, 0, this.searchIndex);
110
- }
111
- if (nextMatch) {
112
- // findMatchInRange still might have returned null, only focus if match found
113
- this.focusOption(nextMatch);
114
- }
115
- this.debouncedClearKeysSoFar();
116
- }
117
- }
118
- handleOptionSelection(ev) {
119
- this.focusOption(ev.detail);
120
- }
121
- handleChildUp(ev) {
122
- this.moveUp(ev.detail);
123
- }
124
- handleChildDown(ev) {
125
- this.moveDown(ev.detail);
126
- }
127
- moveToFirstOption() {
128
- this.focusOption(this.visibleOptionEls[0]);
129
- }
130
- moveToLastOption() {
131
- this.focusOption(this.visibleOptionEls[this.visibleOptionEls.length - 1]);
132
- }
133
- handleOptionCloneSelection(ev) {
134
- const correspondingOption = this.findCorrespondingOption(ev.detail);
135
- correspondingOption.click();
136
- }
137
- componentDidLoad() {
138
- if (this.multiple) {
139
- this.updateOptionVisibility();
140
- }
141
- // Dev can overwrite the max-height rule set in the Sass file
142
- if (this.maxHeight) {
143
- // this.listboxEl.style.maxHeight = this.maxHeight;
144
- this.listboxEl.style.maxHeight = this.maxHeight;
145
- }
146
- }
147
- async handleChildChange(_) {
148
- if (this.multiple) {
149
- // on update of wm-options selected state, rerender to update clones state
150
- forceUpdate(this.el);
151
- }
152
- }
153
- async clearSearch() {
154
- this.searchFieldEl.value = "";
155
- this.searchTerm = "";
156
- this.optionListSearchChanged.emit({ searchTerm: this.searchTerm });
157
- }
158
- async focusOption(option) {
159
- this.allOptionEls.forEach((i) => (i.focused = i === option));
160
- // option must be scrolledIntoView before focused
161
- // 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
162
- option.scrollIntoView({ block: "nearest" });
163
- // 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))
164
- // when opening the dropdown, scrollIntoView must be delayed to a point where the browser recognizes content within it as able to be scrolled to
165
- // 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
166
- window.setTimeout(() => option.scrollIntoView({ block: "nearest" }), 60);
167
- option.focus();
168
- }
169
- async handleInitialFocus(optionToSelect) {
170
- switch (optionToSelect) {
171
- case "next":
172
- // search variant focuses search field
173
- // all others focus option "after" last selected option (this can be the first option)
174
- if (this.search) {
175
- this.searchFieldEl.focus();
176
- this.listboxEl.scrollTop = 0;
177
- }
178
- else {
179
- this.moveDown(this.visibleOptionEls.filter((x) => x.selected).slice(-1)[0]);
180
- }
181
- break;
182
- case "previous":
183
- // search variant focuses last option
184
- // all others focus option "above" first selected option (this can be the last option)
185
- if (this.search) {
186
- this.focusOption(this.visibleOptionEls[this.visibleOptionEls.length - 1]);
187
- }
188
- else {
189
- this.moveUp(this.visibleOptionEls.filter((x) => x.selected)[0]);
190
- }
191
- break;
192
- default:
193
- // search variant focuses search field
194
- // all others focus the selected option
195
- // if no option is selected (empty multiselect), focuses first option
196
- if (this.search) {
197
- this.searchFieldEl.focus();
198
- this.listboxEl.scrollTop = 0;
199
- }
200
- else if (this.selectedOptions.length > 0) {
201
- this.focusOption(this.visibleOptionEls.filter((x) => x.selected)[0]);
202
- }
203
- else {
204
- this.focusOption(this.visibleOptionEls[0]);
205
- }
206
- break;
207
- }
208
- }
209
- async unfocusAll() {
210
- this.allOptionEls.map((i) => (i.focused = false));
211
- }
212
- findMatchInRange(list, startIndex, endIndex) {
213
- let match = null;
214
- let optionsInRange = list.slice(startIndex, endIndex);
215
- // Find the first option starting with the keysSoFar substring, searching in
216
- // the specified range of options
217
- optionsInRange.forEach((option) => {
218
- const label = option.textContent;
219
- if (!match && label && label.toLowerCase().startsWith(this.keysSoFar)) {
220
- match = option;
221
- }
222
- });
223
- return match;
224
- }
225
- findCorrespondingOption(el) {
226
- // if clone, returns the child wm-option
227
- // if child wm-option, returns clone
228
- const isClone = el.classList.contains("clone");
229
- return isClone
230
- ? this.childOptions[this.cloneOptions.indexOf(el)]
231
- : this.cloneOptions[this.childOptions.indexOf(el)];
232
- }
233
- handleSearchFieldBlur(ev) {
234
- this.searchFieldWrapperEl.classList.remove("focus");
235
- if (isElOrChild(this.el, ev.relatedTarget)) {
236
- // do not emit a blur event when moving from searchfield to options
237
- ev.stopPropagation();
238
- }
239
- }
240
- // on search field or select all. keydown on options is handled via events.
241
- handleKeyDown(ev) {
242
- const el = ev.target;
243
- switch (ev.key) {
244
- case "ArrowDown":
245
- ev.preventDefault();
246
- this.moveDown(ev.target);
247
- break;
248
- case "ArrowUp":
249
- ev.preventDefault();
250
- this.moveUp(ev.target);
251
- break;
252
- case "Escape":
253
- ev.preventDefault();
254
- this.close();
255
- break;
256
- case "Enter":
257
- if (el === this.selectAllEl) {
258
- ev.preventDefault();
259
- this.handleSelectAllClick();
260
- this.close();
261
- }
262
- break;
263
- case " ":
264
- if (el === this.selectAllEl) {
265
- ev.preventDefault();
266
- this.handleSelectAllClick();
267
- }
268
- break;
269
- }
270
- }
271
- close() {
272
- if (this.multiple) {
273
- this.updateOptionVisibility();
274
- }
275
- this.optionListCloseRequested.emit(); // what actually happens when a close is requested is determined by the parent
276
- }
277
- handleSelectAllClick() {
278
- this.allSelected ? this.deselectAllOptions() : this.selectAllOptions();
279
- }
280
- selectAllOptions() {
281
- this.announce(this.allOptionsSelectedMessage);
282
- this.optionListAllSelected.emit();
283
- }
284
- deselectAllOptions() {
285
- this.announce(this.allOptionsDeselectedMessage);
286
- this.optionListAllDeselected.emit();
287
- }
288
- moveUp(el) {
289
- const focusableEls = this.visibleOptionEls;
290
- if (this.selectAllEl) {
291
- focusableEls.unshift(this.selectAllEl);
292
- }
293
- if (this.searchFieldEl) {
294
- focusableEls.unshift(this.searchFieldEl);
295
- }
296
- const prevEl = focusableEls[focusableEls.indexOf(el) - 1] || focusableEls[focusableEls.length - 1];
297
- if (prevEl) {
298
- this.focusOption(prevEl);
299
- }
300
- }
301
- moveDown(el) {
302
- const focusableEls = this.visibleOptionEls;
303
- if (this.selectAllEl) {
304
- focusableEls.unshift(this.selectAllEl);
305
- }
306
- if (this.searchFieldEl) {
307
- focusableEls.unshift(this.searchFieldEl);
308
- }
309
- const nextEl = focusableEls[focusableEls.indexOf(el) + 1] || focusableEls[0];
310
- if (nextEl) {
311
- this.focusOption(nextEl);
312
- }
313
- }
314
- async updateOptionVisibility() {
315
- // this runs for search multiselects, where selected options are rendered at the top of the dropdown list
316
- // slotted wm-options are hidden if selected, and clone wm-options are made visible if selected
317
- this.childOptions.forEach((option, idx) => {
318
- const cloneOption = this.cloneOptions[idx];
319
- if (option.selected) {
320
- option.classList.add("hidden");
321
- cloneOption.classList.remove("hidden");
322
- }
323
- else {
324
- option.classList.remove("hidden");
325
- cloneOption.classList.add("hidden");
326
- }
327
- });
328
- // find last visible clone option and apply .last class
329
- const visibleCloneOptions = this.visibleOptionEls.filter((option) => option.classList.contains("clone"));
330
- // if all options are clones, nothing to separate from
331
- const allClones = visibleCloneOptions.length === this.visibleOptionEls.length;
332
- visibleCloneOptions.forEach((option, idx) => {
333
- if (!allClones && idx === visibleCloneOptions.length - 1) {
334
- option.classList.add("last");
335
- }
336
- else {
337
- option.classList.remove("last");
338
- }
339
- });
340
- }
341
- announce(message) {
342
- // \u00A0 is a non-breaking space character, which causes the message to be read as a new one
343
- if (this.liveRegionEl.textContent === message) {
344
- message += "\u00A0";
345
- }
346
- this.announcement = message;
347
- }
348
- renderSearchField() {
349
- return (h("div", { class: "search" }, h("div", { class: "searchfield-wrapper", ref: (el) => (this.searchFieldWrapperEl = el) }, h("div", { class: "icon" }), h("input", { ref: (el) => (this.searchFieldEl = el), class: "searchfield", role: "combobox", "aria-controls": "list",
350
- // aria-expanded={this.isExpanded ? "true" : "false"}
351
- onKeyDown: (ev) => this.handleKeyDown(ev), onFocus: () => this.searchFieldWrapperEl.classList.add("focus"), onBlur: (ev) => this.handleSearchFieldBlur(ev), onInput: () => this.debouncedSearch(), placeholder: this.searchPlaceholder }))));
352
- }
353
- renderSearchFailedMessage() {
354
- return h("div", { class: "search-results-message" }, this.noResultsFoundMessage);
355
- }
356
- renderSelectAllButton() {
357
- return (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));
358
- }
359
- renderCloneOptions() {
360
- return Array.from(this.childOptions).map((o) => {
361
- const option = o;
362
- return (h("wm-option", { class: "clone", subinfo: option.subinfo, selected: option.selected }, option.textContent));
363
- });
364
- }
365
- render() {
366
- return (h("div", { class: "list-wrapper" }, this.search && this.renderSearchField(), this.visibleSelectAllButton && this.renderSelectAllButton(), 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(), h("slot", null)), h("div", { id: "optionlist-announcement", "aria-live": "polite", "aria-atomic": "true", class: "sr-only", ref: (el) => (this.liveRegionEl = el) }, this.announcement)));
367
- }
368
- static get is() { return "priv-option-list"; }
369
- static get originalStyleUrls() {
370
- return {
371
- "$": ["priv-option-list.scss"]
372
- };
373
- }
374
- static get styleUrls() {
375
- return {
376
- "$": ["priv-option-list.css"]
377
- };
378
- }
379
- static get properties() {
380
- return {
381
- "multiple": {
382
- "type": "boolean",
383
- "mutable": false,
384
- "complexType": {
385
- "original": "boolean",
386
- "resolved": "boolean",
387
- "references": {}
388
- },
389
- "required": false,
390
- "optional": false,
391
- "docs": {
392
- "tags": [],
393
- "text": ""
394
- },
395
- "attribute": "multiple",
396
- "reflect": false,
397
- "defaultValue": "false"
398
- },
399
- "search": {
400
- "type": "boolean",
401
- "mutable": false,
402
- "complexType": {
403
- "original": "boolean",
404
- "resolved": "boolean",
405
- "references": {}
406
- },
407
- "required": false,
408
- "optional": false,
409
- "docs": {
410
- "tags": [],
411
- "text": ""
412
- },
413
- "attribute": "search",
414
- "reflect": false,
415
- "defaultValue": "false"
416
- },
417
- "selectAll": {
418
- "type": "boolean",
419
- "mutable": false,
420
- "complexType": {
421
- "original": "boolean",
422
- "resolved": "boolean",
423
- "references": {}
424
- },
425
- "required": false,
426
- "optional": false,
427
- "docs": {
428
- "tags": [],
429
- "text": ""
430
- },
431
- "attribute": "select-all",
432
- "reflect": false,
433
- "defaultValue": "false"
434
- },
435
- "searchPlaceholder": {
436
- "type": "string",
437
- "mutable": false,
438
- "complexType": {
439
- "original": "string",
440
- "resolved": "string | undefined",
441
- "references": {}
442
- },
443
- "required": false,
444
- "optional": true,
445
- "docs": {
446
- "tags": [],
447
- "text": ""
448
- },
449
- "attribute": "search-placeholder",
450
- "reflect": false
451
- },
452
- "maxHeight": {
453
- "type": "string",
454
- "mutable": false,
455
- "complexType": {
456
- "original": "string",
457
- "resolved": "string | undefined",
458
- "references": {}
459
- },
460
- "required": false,
461
- "optional": true,
462
- "docs": {
463
- "tags": [],
464
- "text": ""
465
- },
466
- "attribute": "max-height",
467
- "reflect": false
468
- }
469
- };
470
- }
471
- static get states() {
472
- return {
473
- "announcement": {},
474
- "searchTerm": {}
475
- };
476
- }
477
- static get events() {
478
- return [{
479
- "method": "optionListSearchChanged",
480
- "name": "optionListSearchChanged",
481
- "bubbles": true,
482
- "cancelable": true,
483
- "composed": true,
484
- "docs": {
485
- "tags": [],
486
- "text": ""
487
- },
488
- "complexType": {
489
- "original": "Object",
490
- "resolved": "Object",
491
- "references": {
492
- "Object": {
493
- "location": "global",
494
- "id": "global::Object"
495
- }
496
- }
497
- }
498
- }, {
499
- "method": "optionListCloseRequested",
500
- "name": "optionListCloseRequested",
501
- "bubbles": true,
502
- "cancelable": true,
503
- "composed": true,
504
- "docs": {
505
- "tags": [],
506
- "text": ""
507
- },
508
- "complexType": {
509
- "original": "any",
510
- "resolved": "any",
511
- "references": {}
512
- }
513
- }, {
514
- "method": "optionListAllSelected",
515
- "name": "optionListAllSelected",
516
- "bubbles": true,
517
- "cancelable": true,
518
- "composed": true,
519
- "docs": {
520
- "tags": [],
521
- "text": ""
522
- },
523
- "complexType": {
524
- "original": "any",
525
- "resolved": "any",
526
- "references": {}
527
- }
528
- }, {
529
- "method": "optionListAllDeselected",
530
- "name": "optionListAllDeselected",
531
- "bubbles": true,
532
- "cancelable": true,
533
- "composed": true,
534
- "docs": {
535
- "tags": [],
536
- "text": ""
537
- },
538
- "complexType": {
539
- "original": "any",
540
- "resolved": "any",
541
- "references": {}
542
- }
543
- }];
544
- }
545
- static get methods() {
546
- return {
547
- "handleChildChange": {
548
- "complexType": {
549
- "signature": "(_: MutationRecord) => Promise<void>",
550
- "parameters": [{
551
- "tags": [],
552
- "text": ""
553
- }],
554
- "references": {
555
- "Promise": {
556
- "location": "global",
557
- "id": "global::Promise"
558
- },
559
- "MutationRecord": {
560
- "location": "global",
561
- "id": "global::MutationRecord"
562
- }
563
- },
564
- "return": "Promise<void>"
565
- },
566
- "docs": {
567
- "text": "",
568
- "tags": []
569
- }
570
- },
571
- "clearSearch": {
572
- "complexType": {
573
- "signature": "() => Promise<void>",
574
- "parameters": [],
575
- "references": {
576
- "Promise": {
577
- "location": "global",
578
- "id": "global::Promise"
579
- }
580
- },
581
- "return": "Promise<void>"
582
- },
583
- "docs": {
584
- "text": "",
585
- "tags": []
586
- }
587
- },
588
- "focusOption": {
589
- "complexType": {
590
- "signature": "(option: HTMLElement) => Promise<void>",
591
- "parameters": [{
592
- "tags": [],
593
- "text": ""
594
- }],
595
- "references": {
596
- "Promise": {
597
- "location": "global",
598
- "id": "global::Promise"
599
- },
600
- "HTMLElement": {
601
- "location": "global",
602
- "id": "global::HTMLElement"
603
- }
604
- },
605
- "return": "Promise<void>"
606
- },
607
- "docs": {
608
- "text": "",
609
- "tags": []
610
- }
611
- },
612
- "handleInitialFocus": {
613
- "complexType": {
614
- "signature": "(optionToSelect?: \"next\" | \"previous\") => Promise<void>",
615
- "parameters": [{
616
- "tags": [],
617
- "text": ""
618
- }],
619
- "references": {
620
- "Promise": {
621
- "location": "global",
622
- "id": "global::Promise"
623
- }
624
- },
625
- "return": "Promise<void>"
626
- },
627
- "docs": {
628
- "text": "",
629
- "tags": []
630
- }
631
- },
632
- "unfocusAll": {
633
- "complexType": {
634
- "signature": "() => Promise<void>",
635
- "parameters": [],
636
- "references": {
637
- "Promise": {
638
- "location": "global",
639
- "id": "global::Promise"
640
- }
641
- },
642
- "return": "Promise<void>"
643
- },
644
- "docs": {
645
- "text": "",
646
- "tags": []
647
- }
648
- },
649
- "updateOptionVisibility": {
650
- "complexType": {
651
- "signature": "() => Promise<void>",
652
- "parameters": [],
653
- "references": {
654
- "Promise": {
655
- "location": "global",
656
- "id": "global::Promise"
657
- }
658
- },
659
- "return": "Promise<void>"
660
- },
661
- "docs": {
662
- "text": "",
663
- "tags": []
664
- }
665
- }
666
- };
667
- }
668
- static get elementRef() { return "el"; }
669
- static get listeners() {
670
- return [{
671
- "name": "wmLetterPressed",
672
- "method": "findAndFocusOption",
673
- "target": undefined,
674
- "capture": false,
675
- "passive": false
676
- }, {
677
- "name": "wmOptionSelected",
678
- "method": "handleOptionSelection",
679
- "target": undefined,
680
- "capture": false,
681
- "passive": false
682
- }, {
683
- "name": "wmKeyUpPressed",
684
- "method": "handleChildUp",
685
- "target": undefined,
686
- "capture": false,
687
- "passive": false
688
- }, {
689
- "name": "wmKeyDownPressed",
690
- "method": "handleChildDown",
691
- "target": undefined,
692
- "capture": false,
693
- "passive": false
694
- }, {
695
- "name": "wmHomeKeyPressed",
696
- "method": "moveToFirstOption",
697
- "target": undefined,
698
- "capture": false,
699
- "passive": false
700
- }, {
701
- "name": "wmEndKeyPressed",
702
- "method": "moveToLastOption",
703
- "target": undefined,
704
- "capture": false,
705
- "passive": false
706
- }, {
707
- "name": "intCloneClicked",
708
- "method": "handleOptionCloneSelection",
709
- "target": undefined,
710
- "capture": false,
711
- "passive": false
712
- }];
713
- }
714
- }