@watermarkinsights/ripple 5.3.0-2 → 5.3.0-4

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 (221) hide show
  1. package/dist/cjs/{chartFunctions-246529c5.js → chartFunctions-0238043b.js} +3 -3
  2. package/dist/cjs/{functions-be4156cf.js → functions-3be85c6d.js} +2 -0
  3. package/dist/cjs/{global-6b1a23e9.js → global-6a36ad09.js} +1 -1
  4. package/dist/cjs/{index-f8ef86de.js → index-e86c28b6.js} +60 -1
  5. package/dist/cjs/{intl-a13884e8.js → intl-567eb9d8.js} +1 -1
  6. package/dist/cjs/loader.cjs.js +3 -3
  7. package/dist/cjs/priv-calendar.cjs.entry.js +64 -48
  8. package/dist/cjs/priv-chart-popover.cjs.entry.js +2 -2
  9. package/dist/cjs/priv-navigator-button.cjs.entry.js +1 -1
  10. package/dist/cjs/priv-navigator-item.cjs.entry.js +1 -1
  11. package/dist/cjs/ripple.cjs.js +3 -3
  12. package/dist/cjs/wm-action-menu_2.cjs.entry.js +2 -2
  13. package/dist/cjs/wm-button.cjs.entry.js +2 -2
  14. package/dist/cjs/wm-chart-slice.cjs.entry.js +1 -1
  15. package/dist/cjs/wm-chart.cjs.entry.js +4 -4
  16. package/dist/cjs/wm-date-range.cjs.entry.js +37 -13
  17. package/dist/cjs/wm-datepicker.cjs.entry.js +12 -9
  18. package/dist/cjs/wm-file-list.cjs.entry.js +1 -1
  19. package/dist/cjs/wm-file.cjs.entry.js +2 -2
  20. package/dist/cjs/wm-input.cjs.entry.js +3 -3
  21. package/dist/cjs/wm-line-chart.cjs.entry.js +4 -4
  22. package/dist/cjs/wm-modal-footer.cjs.entry.js +1 -1
  23. package/dist/cjs/wm-modal-header.cjs.entry.js +3 -3
  24. package/dist/cjs/wm-modal.cjs.entry.js +3 -3
  25. package/dist/cjs/wm-navigation_3.cjs.entry.js +3 -3
  26. package/dist/cjs/wm-navigator.cjs.entry.js +2 -2
  27. package/dist/cjs/wm-option_2.cjs.entry.js +3 -3
  28. package/dist/cjs/wm-pagination.cjs.entry.js +2 -2
  29. package/dist/cjs/wm-progress-indicator_3.cjs.entry.js +3 -3
  30. package/dist/cjs/wm-search.cjs.entry.js +3 -3
  31. package/dist/cjs/wm-snackbar.cjs.entry.js +3 -3
  32. package/dist/cjs/wm-tab-item_3.cjs.entry.js +2 -2
  33. package/dist/cjs/wm-tag-input.cjs.entry.js +3 -3
  34. package/dist/cjs/wm-tag-option.cjs.entry.js +2 -2
  35. package/dist/cjs/wm-textarea.cjs.entry.js +3 -3
  36. package/dist/cjs/wm-timepicker.cjs.entry.js +2 -2
  37. package/dist/cjs/wm-toggletip.cjs.entry.js +2 -2
  38. package/dist/cjs/wm-uploader.cjs.entry.js +3 -3
  39. package/dist/cjs/wm-wrapper.cjs.entry.js +1 -1
  40. package/dist/collection/components/charts/chartFunctions.js +1 -1
  41. package/dist/collection/components/datepickers/datepicker.css +47 -5
  42. package/dist/collection/components/datepickers/priv-calendar/priv-calendar.css +92 -56
  43. package/dist/collection/components/datepickers/priv-calendar/priv-calendar.js +61 -45
  44. package/dist/collection/components/datepickers/wm-date-range.js +50 -19
  45. package/dist/collection/components/datepickers/wm-datepicker.js +14 -6
  46. package/dist/collection/components/wm-modal/wm-modal.css +0 -1
  47. package/dist/collection/dev/modal.js +15 -45
  48. package/dist/collection/global/functions.js +1 -1
  49. package/dist/esm/{chartFunctions-e2554a36.js → chartFunctions-036fdb89.js} +3 -3
  50. package/dist/esm/{functions-f65dbb96.js → functions-46843ea0.js} +1 -1
  51. package/dist/esm/{global-b3bbb95e.js → global-bcdca57d.js} +1 -1
  52. package/dist/esm/{index-f164fbca.js → index-558b5a82.js} +60 -2
  53. package/dist/esm/{intl-f7f77de7.js → intl-8b8740b9.js} +1 -1
  54. package/dist/esm/loader.js +4 -4
  55. package/dist/esm/priv-calendar.entry.js +64 -48
  56. package/dist/esm/priv-chart-popover.entry.js +2 -2
  57. package/dist/esm/priv-navigator-button.entry.js +1 -1
  58. package/dist/esm/priv-navigator-item.entry.js +1 -1
  59. package/dist/esm/ripple.js +4 -4
  60. package/dist/esm/wm-action-menu_2.entry.js +2 -2
  61. package/dist/esm/wm-button.entry.js +2 -2
  62. package/dist/esm/wm-chart-slice.entry.js +1 -1
  63. package/dist/esm/wm-chart.entry.js +4 -4
  64. package/dist/esm/wm-date-range.entry.js +37 -13
  65. package/dist/esm/wm-datepicker.entry.js +12 -9
  66. package/dist/esm/wm-file-list.entry.js +1 -1
  67. package/dist/esm/wm-file.entry.js +2 -2
  68. package/dist/esm/wm-input.entry.js +3 -3
  69. package/dist/esm/wm-line-chart.entry.js +4 -4
  70. package/dist/esm/wm-modal-footer.entry.js +1 -1
  71. package/dist/esm/wm-modal-header.entry.js +3 -3
  72. package/dist/esm/wm-modal.entry.js +3 -3
  73. package/dist/esm/wm-navigation_3.entry.js +3 -3
  74. package/dist/esm/wm-navigator.entry.js +2 -2
  75. package/dist/esm/wm-option_2.entry.js +3 -3
  76. package/dist/esm/wm-pagination.entry.js +2 -2
  77. package/dist/esm/wm-progress-indicator_3.entry.js +3 -3
  78. package/dist/esm/wm-search.entry.js +3 -3
  79. package/dist/esm/wm-snackbar.entry.js +3 -3
  80. package/dist/esm/wm-tab-item_3.entry.js +2 -2
  81. package/dist/esm/wm-tag-input.entry.js +3 -3
  82. package/dist/esm/wm-tag-option.entry.js +2 -2
  83. package/dist/esm/wm-textarea.entry.js +3 -3
  84. package/dist/esm/wm-timepicker.entry.js +2 -2
  85. package/dist/esm/wm-toggletip.entry.js +2 -2
  86. package/dist/esm/wm-uploader.entry.js +3 -3
  87. package/dist/esm/wm-wrapper.entry.js +1 -1
  88. package/dist/esm-es5/{chartFunctions-e2554a36.js → chartFunctions-036fdb89.js} +1 -1
  89. package/dist/esm-es5/{functions-f65dbb96.js → functions-46843ea0.js} +1 -1
  90. package/dist/esm-es5/{global-b3bbb95e.js → global-bcdca57d.js} +1 -1
  91. package/dist/esm-es5/index-558b5a82.js +1 -0
  92. package/dist/esm-es5/{intl-f7f77de7.js → intl-8b8740b9.js} +1 -1
  93. package/dist/esm-es5/loader.js +1 -1
  94. package/dist/esm-es5/priv-calendar.entry.js +1 -1
  95. package/dist/esm-es5/priv-chart-popover.entry.js +1 -1
  96. package/dist/esm-es5/priv-navigator-button.entry.js +1 -1
  97. package/dist/esm-es5/priv-navigator-item.entry.js +1 -1
  98. package/dist/esm-es5/ripple.js +1 -1
  99. package/dist/esm-es5/wm-action-menu_2.entry.js +1 -1
  100. package/dist/esm-es5/wm-button.entry.js +1 -1
  101. package/dist/esm-es5/wm-chart-slice.entry.js +1 -1
  102. package/dist/esm-es5/wm-chart.entry.js +1 -1
  103. package/dist/esm-es5/wm-date-range.entry.js +1 -1
  104. package/dist/esm-es5/wm-datepicker.entry.js +1 -1
  105. package/dist/esm-es5/wm-file-list.entry.js +1 -1
  106. package/dist/esm-es5/wm-file.entry.js +1 -1
  107. package/dist/esm-es5/wm-input.entry.js +1 -1
  108. package/dist/esm-es5/wm-line-chart.entry.js +1 -1
  109. package/dist/esm-es5/wm-modal-footer.entry.js +1 -1
  110. package/dist/esm-es5/wm-modal-header.entry.js +1 -1
  111. package/dist/esm-es5/wm-modal.entry.js +1 -1
  112. package/dist/esm-es5/wm-navigation_3.entry.js +1 -1
  113. package/dist/esm-es5/wm-navigator.entry.js +1 -1
  114. package/dist/esm-es5/wm-option_2.entry.js +1 -1
  115. package/dist/esm-es5/wm-pagination.entry.js +1 -1
  116. package/dist/esm-es5/wm-progress-indicator_3.entry.js +1 -1
  117. package/dist/esm-es5/wm-search.entry.js +1 -1
  118. package/dist/esm-es5/wm-snackbar.entry.js +1 -1
  119. package/dist/esm-es5/wm-tab-item_3.entry.js +1 -1
  120. package/dist/esm-es5/wm-tag-input.entry.js +1 -1
  121. package/dist/esm-es5/wm-tag-option.entry.js +1 -1
  122. package/dist/esm-es5/wm-textarea.entry.js +1 -1
  123. package/dist/esm-es5/wm-timepicker.entry.js +1 -1
  124. package/dist/esm-es5/wm-toggletip.entry.js +1 -1
  125. package/dist/esm-es5/wm-uploader.entry.js +1 -1
  126. package/dist/esm-es5/wm-wrapper.entry.js +1 -1
  127. package/dist/ripple/{p-5dbad2ff.entry.js → p-09a31f0c.entry.js} +1 -1
  128. package/dist/ripple/{p-ae8ad491.entry.js → p-0dc51fad.entry.js} +1 -1
  129. package/dist/ripple/{p-c38f2a00.system.entry.js → p-0ea8609b.system.entry.js} +1 -1
  130. package/dist/ripple/{p-ae32eb8d.system.js → p-1ac66a15.system.js} +1 -1
  131. package/dist/ripple/{p-eb649319.system.js → p-1c32dc29.system.js} +1 -1
  132. package/dist/ripple/{p-2bac4b4e.system.entry.js → p-240124b0.system.entry.js} +1 -1
  133. package/dist/ripple/{p-ef3fe609.system.entry.js → p-26fbc7f5.system.entry.js} +1 -1
  134. package/dist/ripple/{p-45126063.system.entry.js → p-294b38ca.system.entry.js} +1 -1
  135. package/dist/ripple/{p-76d2dada.entry.js → p-2b05bf05.entry.js} +1 -1
  136. package/dist/ripple/{p-3db9e0d8.system.entry.js → p-2ba7e68e.system.entry.js} +1 -1
  137. package/dist/ripple/{p-d88d806e.js → p-2de2c954.js} +1 -1
  138. package/dist/ripple/{p-b0579a2a.system.entry.js → p-311923b2.system.entry.js} +1 -1
  139. package/dist/ripple/p-3183bba8.entry.js +1 -0
  140. package/dist/ripple/{p-04bf6c89.entry.js → p-31976813.entry.js} +1 -1
  141. package/dist/ripple/{p-7e56da2e.system.entry.js → p-32bf3f5b.system.entry.js} +1 -1
  142. package/dist/ripple/{p-2197287c.entry.js → p-33679b9d.entry.js} +1 -1
  143. package/dist/ripple/p-34b5830f.system.js +1 -0
  144. package/dist/ripple/{p-30a9ba6e.entry.js → p-3568472c.entry.js} +1 -1
  145. package/dist/ripple/{p-d265a41e.entry.js → p-359d45dc.entry.js} +1 -1
  146. package/dist/ripple/{p-98120733.entry.js → p-3a44e1c8.entry.js} +1 -1
  147. package/dist/ripple/{p-8f38dc86.entry.js → p-42d1c301.entry.js} +1 -1
  148. package/dist/ripple/{p-4e616347.entry.js → p-45abd8fe.entry.js} +1 -1
  149. package/dist/ripple/{p-3a070f35.entry.js → p-48e09589.entry.js} +1 -1
  150. package/dist/ripple/{p-d325a37b.entry.js → p-4b0d5b98.entry.js} +1 -1
  151. package/dist/ripple/{p-ff80aadd.system.entry.js → p-4e56f3f5.system.entry.js} +1 -1
  152. package/dist/ripple/{p-780d4673.system.entry.js → p-5029fcd8.system.entry.js} +1 -1
  153. package/dist/ripple/p-54922aa3.system.entry.js +1 -0
  154. package/dist/ripple/p-568c595f.js +2 -0
  155. package/dist/ripple/{p-c717d895.entry.js → p-591918a4.entry.js} +1 -1
  156. package/dist/ripple/p-5b9de05a.system.entry.js +1 -0
  157. package/dist/ripple/{p-5a04c222.entry.js → p-5d9bccfb.entry.js} +1 -1
  158. package/dist/ripple/p-61bcfba6.system.js +1 -0
  159. package/dist/ripple/{p-0b77b2a1.entry.js → p-624a2812.entry.js} +1 -1
  160. package/dist/ripple/{p-f6f29a56.entry.js → p-62a8f09c.entry.js} +1 -1
  161. package/dist/ripple/{p-92c1ff36.system.entry.js → p-64e929d6.system.entry.js} +1 -1
  162. package/dist/ripple/{p-a99b05de.system.entry.js → p-65d26233.system.entry.js} +1 -1
  163. package/dist/ripple/p-685db40b.entry.js +1 -0
  164. package/dist/ripple/{p-7a9ffbcb.system.entry.js → p-79106e23.system.entry.js} +1 -1
  165. package/dist/ripple/p-7e6f5a1e.system.entry.js +1 -0
  166. package/dist/ripple/{p-625aeeec.system.entry.js → p-8029af07.system.entry.js} +1 -1
  167. package/dist/ripple/{p-79af9baf.entry.js → p-8159cdf5.entry.js} +1 -1
  168. package/dist/ripple/{p-7573a2fa.entry.js → p-822618d7.entry.js} +1 -1
  169. package/dist/ripple/{p-11383396.system.entry.js → p-86d655fb.system.entry.js} +1 -1
  170. package/dist/ripple/{p-cda6c77e.entry.js → p-884294c6.entry.js} +1 -1
  171. package/dist/ripple/{p-25446670.entry.js → p-88ebddd7.entry.js} +1 -1
  172. package/dist/ripple/{p-f93858ad.system.entry.js → p-8fbddb6c.system.entry.js} +1 -1
  173. package/dist/ripple/{p-63fabfed.entry.js → p-902a54c5.entry.js} +1 -1
  174. package/dist/ripple/{p-8081f931.system.entry.js → p-a152cf3a.system.entry.js} +1 -1
  175. package/dist/ripple/{p-19dec591.entry.js → p-a37cf34a.entry.js} +1 -1
  176. package/dist/ripple/p-ab8d78cc.system.js +2 -0
  177. package/dist/ripple/p-b516b418.entry.js +1 -0
  178. package/dist/ripple/{p-9d8c2a52.system.entry.js → p-b7ead395.system.entry.js} +1 -1
  179. package/dist/ripple/{p-109684b1.entry.js → p-bc5e9d24.entry.js} +1 -1
  180. package/dist/ripple/{p-635f40b1.entry.js → p-c4b9d46d.entry.js} +1 -1
  181. package/dist/ripple/{p-379fe53e.entry.js → p-c885c7f9.entry.js} +1 -1
  182. package/dist/ripple/{p-88406560.system.entry.js → p-c91b10f3.system.entry.js} +1 -1
  183. package/dist/ripple/{p-577ea283.system.entry.js → p-c9543950.system.entry.js} +1 -1
  184. package/dist/ripple/{p-7144d185.system.entry.js → p-cacfbaf1.system.entry.js} +1 -1
  185. package/dist/ripple/{p-22e6104e.entry.js → p-cc4a429b.entry.js} +1 -1
  186. package/dist/ripple/{p-dcfdbd30.entry.js → p-ce9a8bd1.entry.js} +1 -1
  187. package/dist/ripple/{p-32cf6907.system.entry.js → p-d24882a7.system.entry.js} +1 -1
  188. package/dist/ripple/{p-84926b89.system.entry.js → p-d33d6e96.system.entry.js} +1 -1
  189. package/dist/ripple/{p-5bbf7fdc.system.js → p-d4b209ec.system.js} +1 -1
  190. package/dist/ripple/{p-5b2c1bd1.js → p-d79fdf0b.js} +1 -1
  191. package/dist/ripple/p-d837c1f5.js +1 -0
  192. package/dist/ripple/{p-48a6acfa.system.entry.js → p-df1a11f1.system.entry.js} +1 -1
  193. package/dist/ripple/p-df2560f3.system.entry.js +1 -0
  194. package/dist/ripple/{p-b0f14557.system.entry.js → p-e3bcdde8.system.entry.js} +1 -1
  195. package/dist/ripple/{p-c51293e2.entry.js → p-e83a98d3.entry.js} +1 -1
  196. package/dist/ripple/{p-ba751ca4.js → p-e995f7f0.js} +1 -1
  197. package/dist/ripple/{p-1cb6b37e.entry.js → p-eaac6bcd.entry.js} +1 -1
  198. package/dist/ripple/p-f67fd802.system.entry.js +1 -0
  199. package/dist/ripple/{p-c8873e0c.system.entry.js → p-fe8d02c3.system.entry.js} +1 -1
  200. package/dist/ripple/{p-d7c47dc0.system.entry.js → p-ff23d5e2.system.entry.js} +1 -1
  201. package/dist/ripple/{p-bd27ded2.system.entry.js → p-ffb31979.system.entry.js} +1 -1
  202. package/dist/ripple/ripple.esm.js +1 -1
  203. package/dist/ripple/ripple.js +1 -1
  204. package/dist/types/components/datepickers/wm-datepicker.d.ts +2 -2
  205. package/dist/types/components.d.ts +4 -4
  206. package/dist/types/global/functions.d.ts +6 -0
  207. package/package.json +1 -1
  208. package/dist/esm-es5/index-f164fbca.js +0 -1
  209. package/dist/ripple/p-0fe97e85.system.js +0 -2
  210. package/dist/ripple/p-24d88d8d.system.entry.js +0 -1
  211. package/dist/ripple/p-41e8a079.entry.js +0 -1
  212. package/dist/ripple/p-4272aa37.system.js +0 -1
  213. package/dist/ripple/p-4de51706.js +0 -2
  214. package/dist/ripple/p-6dc3ee86.system.js +0 -1
  215. package/dist/ripple/p-720b6ab0.entry.js +0 -1
  216. package/dist/ripple/p-7f4b4071.system.entry.js +0 -1
  217. package/dist/ripple/p-9c6d6b26.system.entry.js +0 -1
  218. package/dist/ripple/p-ca9d9447.system.entry.js +0 -1
  219. package/dist/ripple/p-ce5455a3.system.entry.js +0 -1
  220. package/dist/ripple/p-f79a6e32.js +0 -1
  221. package/dist/ripple/p-fc7e5296.entry.js +0 -1
@@ -1 +1 @@
1
- import{r as registerInstance,c as createEvent,h,g as getElement}from"./index-f164fbca.js";import{t as toBool,a as handleDisabledAttribute,b as triggerFormSubmit}from"./functions-f65dbb96.js";import{g as globalMessages}from"./intl-f7f77de7.js";var wmInputCss=':host{font-family:inherit;width:100%}:host *{-webkit-box-sizing:border-box;box-sizing:border-box}:host .wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-size:0.875rem}:host .wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}:host .wrapper .label .required{color:var(--wmcolor-text-required)}:host .wrapper.label-left{-ms-flex-direction:row;flex-direction:row}:host .wrapper.label-left .label-wrapper{line-height:2.5rem}:host .wrapper.label-left .label-wrapper .label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:2.5rem;white-space:normal;margin-bottom:0;margin-right:0.75rem}:host .wrapper.label-none label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .wrapper.invalid .label{color:var(--wmcolor-text-error)}:host .wrapper.invalid .label:after{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:"\\f026";margin-left:0.3125rem}[dir=RTL] :host .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}:host .wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}:host .wrapper .inner-wrapper{width:100%}:host .wrapper .text-after-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:8px}:host .wrapper .text-after{-ms-flex:0 1 fit-content;flex:0 1 fit-content}:host .wrapper .inputfield-wrapper{height:2.5rem;min-width:6.25rem;border:1px solid var(--wmcolor-input-border);-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;display:-ms-flexbox;display:flex}:host .wrapper .inputfield-wrapper.disabled{background-color:var(--wmcolor-input-background-disabled);color:var(--wmcolor-input-text-disabled)}:host .wrapper .inputfield-wrapper.disabled .symbol{background:none}:host .wrapper .symbol{display:-ms-flexbox;display:flex;background-color:var(--wmcolor-input-unit-background);-ms-flex:0 0 44px;flex:0 0 44px;padding-inline:8px;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}:host .wrapper .character-count{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;min-width:5rem;background-color:var(--wmcolor-input-charcount-background);font-size:0.875rem;font-weight:500;-ms-flex-item-align:stretch;align-self:stretch}:host .wrapper input{-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;border:none;font-family:inherit;font-size:0.875rem;height:100%;-ms-flex:1;flex:1;padding:0.75rem 1rem;width:100%}:host .wrapper input:focus{outline:none}:host .wrapper input[type=number]{padding-right:0}:host .wrapper .info{font-style:italic;line-height:100%;margin:4px 0}:host .wrapper.invalid .inputfield-wrapper{-webkit-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);-moz-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);box-shadow:0 0 0 1px var(--wmcolor-input-border-error);border-color:var(--wmcolor-input-border-error)}:host .wrapper.invalid .error-message{display:block;font-style:italic;color:var(--wmcolor-text-error);font-size:0.875rem;line-height:100%}:host .wrapper.invalid .error-message:not(:empty){margin-top:0.25rem}:host .wrapper:focus .inputfield-wrapper,:host .wrapper.focus .inputfield-wrapper{outline:2px solid var(--wmcolor-input-border-focus);border-color:var(--wmcolor-input-border-focus)}:host .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}';var Input=function(){function t(t){registerInstance(this,t);this.wmInputValueChanged=createEvent(this,"wmInputValueChanged",7);this.previousValue="";this.label=undefined;this.labelPosition="top";this.value="";this.disabled=false;this.info=undefined;this.inputWidth="";this.placeholder="";this.requiredField=false;this.errorMessage=undefined;this.characterLimit=undefined;this.symbolBefore=undefined;this.symbolAfter=undefined;this.textAfter=undefined;this.type="text";this.step=1;this.min=undefined;this.max=undefined;this.isSubmit=false;this.announcement=""}t.prototype.getInputWidth=function(){return this.inputWidth?{width:this.inputWidth}:{flex:"1"}};Object.defineProperty(t.prototype,"charCount",{get:function(){return this.value.length},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"isDisabled",{get:function(){return toBool(this.disabled)},enumerable:false,configurable:true});t.prototype.componentWillLoad=function(){if(!this.label){console.error("wm-input requires the label property")}handleDisabledAttribute(this.el,this.isDisabled)};t.prototype.componentDidLoad=function(){this.previousValue=this.inputEl.value};t.prototype.handleDisabledChange=function(){handleDisabledAttribute(this.el,this.isDisabled)};t.prototype.announceError=function(){var t=this;if(this.errorMessage){setTimeout((function(){return t.announce(t.errorMessage)}),100)}};t.prototype.handleInput=function(t){this.value=t.target.value;if(this.characterLimit&&this.charCount>=this.characterLimit-5){this.announce(this.generateCharacterLimitWarning(this.charCount,this.characterLimit))}};t.prototype.handleKeyDown=function(t){var e=t.ctrlKey||t.metaKey||t.altKey;var r=/^.$/.test(t.key)&&!e;var i=r&&this.characterLimit&&this.inputEl.value.length>=this.characterLimit;if(i){this.announce(this.generateCharacterLimitWarning(this.charCount,this.characterLimit))}if(t.key==="Enter"){this.isSubmit&&triggerFormSubmit(this.el.closest("form"))}};t.prototype.handleBlur=function(){if(this.value!==this.previousValue){this.wmInputValueChanged.emit({value:this.value})}this.previousValue=this.value;this.inputWrapperEl.classList.remove("focus")};t.prototype.handleFocus=function(){this.inputWrapperEl.classList.add("focus")};t.prototype.announce=function(t){if(this.liveRegionEl.textContent===t){t+=" "}this.announcement=t};t.prototype.generateCharacterLimitWarning=function(t,e){var r=globalMessages.getCharactersEntered(t,e);if(t>=e){r+=" ".concat(globalMessages.characterLimitReached)}return r};t.prototype.descriptors=function(){return this.symbolBefore||this.symbolAfter||this.textAfter?"symbol-before inputfield symbol-after text-after info error":"info error"};t.prototype.render=function(){var t=this;return h("div",{class:"wrapper label-".concat(this.labelPosition," ").concat(this.errorMessage?"invalid":""),ref:function(e){return t.inputWrapperEl=e}},h("div",{class:"label-wrapper"},h("label",{htmlFor:"inputfield",class:"label"},this.label,this.characterLimit&&h("span",{class:"sr-only"}," ",globalMessages.getCharacterLimit(this.characterLimit)),this.requiredField&&h("span",{class:"required","aria-hidden":"true"},"*"))),h("div",{class:"inner-wrapper"},h("div",{class:"text-after-wrapper"},h("div",{class:"inputfield-wrapper ".concat(this.isDisabled?"disabled":""),style:this.getInputWidth()},this.symbolBefore&&h("span",{class:"symbol",id:"symbol-before"},this.symbolBefore),h("input",{ref:function(e){return t.inputEl=e},id:"inputfield",disabled:this.isDisabled,"aria-describedby":this.descriptors(),onInput:function(e){return t.handleInput(e)},onKeyDown:function(e){return t.handleKeyDown(e)},onBlur:function(){return t.handleBlur()},onFocus:function(){return t.handleFocus()},placeholder:this.placeholder,autocomplete:"off","aria-required":this.requiredField?"true":null,maxLength:this.characterLimit||undefined,type:this.type,step:this.step,max:this.max,min:this.min,value:this.el.value}),this.symbolAfter&&h("span",{class:"symbol",id:"symbol-after"},this.symbolAfter),this.characterLimit&&typeof this.characterLimit==="number"?h("div",{class:"character-count"},this.charCount,"/",this.characterLimit):""),this.textAfter&&h("span",{class:"text-after",id:"text-after"},this.textAfter)),this.info&&h("div",{id:"info",class:"info"},this.info),h("div",{id:"error",class:"error-message"},this.errorMessage),h("div",{class:"sr-only","aria-live":"polite","aria-atomic":"true",ref:function(e){return t.liveRegionEl=e}},this.announcement)))};Object.defineProperty(t,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{disabled:["handleDisabledChange"],errorMessage:["announceError"]}},enumerable:false,configurable:true});return t}();Input.style=wmInputCss;export{Input as wm_input};
1
+ import{r as registerInstance,c as createEvent,h,g as getElement}from"./index-558b5a82.js";import{t as toBool,a as handleDisabledAttribute,b as triggerFormSubmit}from"./functions-46843ea0.js";import{g as globalMessages}from"./intl-8b8740b9.js";var wmInputCss=':host{font-family:inherit;width:100%}:host *{-webkit-box-sizing:border-box;box-sizing:border-box}:host .wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-size:0.875rem}:host .wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}:host .wrapper .label .required{color:var(--wmcolor-text-required)}:host .wrapper.label-left{-ms-flex-direction:row;flex-direction:row}:host .wrapper.label-left .label-wrapper{line-height:2.5rem}:host .wrapper.label-left .label-wrapper .label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:2.5rem;white-space:normal;margin-bottom:0;margin-right:0.75rem}:host .wrapper.label-none label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .wrapper.invalid .label{color:var(--wmcolor-text-error)}:host .wrapper.invalid .label:after{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:"\\f026";margin-left:0.3125rem}[dir=RTL] :host .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}:host .wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}:host .wrapper .inner-wrapper{width:100%}:host .wrapper .text-after-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:8px}:host .wrapper .text-after{-ms-flex:0 1 fit-content;flex:0 1 fit-content}:host .wrapper .inputfield-wrapper{height:2.5rem;min-width:6.25rem;border:1px solid var(--wmcolor-input-border);-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;display:-ms-flexbox;display:flex}:host .wrapper .inputfield-wrapper.disabled{background-color:var(--wmcolor-input-background-disabled);color:var(--wmcolor-input-text-disabled)}:host .wrapper .inputfield-wrapper.disabled .symbol{background:none}:host .wrapper .symbol{display:-ms-flexbox;display:flex;background-color:var(--wmcolor-input-unit-background);-ms-flex:0 0 44px;flex:0 0 44px;padding-inline:8px;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}:host .wrapper .character-count{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;min-width:5rem;background-color:var(--wmcolor-input-charcount-background);font-size:0.875rem;font-weight:500;-ms-flex-item-align:stretch;align-self:stretch}:host .wrapper input{-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;border:none;font-family:inherit;font-size:0.875rem;height:100%;-ms-flex:1;flex:1;padding:0.75rem 1rem;width:100%}:host .wrapper input:focus{outline:none}:host .wrapper input[type=number]{padding-right:0}:host .wrapper .info{font-style:italic;line-height:100%;margin:4px 0}:host .wrapper.invalid .inputfield-wrapper{-webkit-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);-moz-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);box-shadow:0 0 0 1px var(--wmcolor-input-border-error);border-color:var(--wmcolor-input-border-error)}:host .wrapper.invalid .error-message{display:block;font-style:italic;color:var(--wmcolor-text-error);font-size:0.875rem;line-height:100%}:host .wrapper.invalid .error-message:not(:empty){margin-top:0.25rem}:host .wrapper:focus .inputfield-wrapper,:host .wrapper.focus .inputfield-wrapper{outline:2px solid var(--wmcolor-input-border-focus);border-color:var(--wmcolor-input-border-focus)}:host .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}';var Input=function(){function t(t){registerInstance(this,t);this.wmInputValueChanged=createEvent(this,"wmInputValueChanged",7);this.previousValue="";this.label=undefined;this.labelPosition="top";this.value="";this.disabled=false;this.info=undefined;this.inputWidth="";this.placeholder="";this.requiredField=false;this.errorMessage=undefined;this.characterLimit=undefined;this.symbolBefore=undefined;this.symbolAfter=undefined;this.textAfter=undefined;this.type="text";this.step=1;this.min=undefined;this.max=undefined;this.isSubmit=false;this.announcement=""}t.prototype.getInputWidth=function(){return this.inputWidth?{width:this.inputWidth}:{flex:"1"}};Object.defineProperty(t.prototype,"charCount",{get:function(){return this.value.length},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"isDisabled",{get:function(){return toBool(this.disabled)},enumerable:false,configurable:true});t.prototype.componentWillLoad=function(){if(!this.label){console.error("wm-input requires the label property")}handleDisabledAttribute(this.el,this.isDisabled)};t.prototype.componentDidLoad=function(){this.previousValue=this.inputEl.value};t.prototype.handleDisabledChange=function(){handleDisabledAttribute(this.el,this.isDisabled)};t.prototype.announceError=function(){var t=this;if(this.errorMessage){setTimeout((function(){return t.announce(t.errorMessage)}),100)}};t.prototype.handleInput=function(t){this.value=t.target.value;if(this.characterLimit&&this.charCount>=this.characterLimit-5){this.announce(this.generateCharacterLimitWarning(this.charCount,this.characterLimit))}};t.prototype.handleKeyDown=function(t){var e=t.ctrlKey||t.metaKey||t.altKey;var r=/^.$/.test(t.key)&&!e;var i=r&&this.characterLimit&&this.inputEl.value.length>=this.characterLimit;if(i){this.announce(this.generateCharacterLimitWarning(this.charCount,this.characterLimit))}if(t.key==="Enter"){this.isSubmit&&triggerFormSubmit(this.el.closest("form"))}};t.prototype.handleBlur=function(){if(this.value!==this.previousValue){this.wmInputValueChanged.emit({value:this.value})}this.previousValue=this.value;this.inputWrapperEl.classList.remove("focus")};t.prototype.handleFocus=function(){this.inputWrapperEl.classList.add("focus")};t.prototype.announce=function(t){if(this.liveRegionEl.textContent===t){t+=" "}this.announcement=t};t.prototype.generateCharacterLimitWarning=function(t,e){var r=globalMessages.getCharactersEntered(t,e);if(t>=e){r+=" ".concat(globalMessages.characterLimitReached)}return r};t.prototype.descriptors=function(){return this.symbolBefore||this.symbolAfter||this.textAfter?"symbol-before inputfield symbol-after text-after info error":"info error"};t.prototype.render=function(){var t=this;return h("div",{class:"wrapper label-".concat(this.labelPosition," ").concat(this.errorMessage?"invalid":""),ref:function(e){return t.inputWrapperEl=e}},h("div",{class:"label-wrapper"},h("label",{htmlFor:"inputfield",class:"label"},this.label,this.characterLimit&&h("span",{class:"sr-only"}," ",globalMessages.getCharacterLimit(this.characterLimit)),this.requiredField&&h("span",{class:"required","aria-hidden":"true"},"*"))),h("div",{class:"inner-wrapper"},h("div",{class:"text-after-wrapper"},h("div",{class:"inputfield-wrapper ".concat(this.isDisabled?"disabled":""),style:this.getInputWidth()},this.symbolBefore&&h("span",{class:"symbol",id:"symbol-before"},this.symbolBefore),h("input",{ref:function(e){return t.inputEl=e},id:"inputfield",disabled:this.isDisabled,"aria-describedby":this.descriptors(),onInput:function(e){return t.handleInput(e)},onKeyDown:function(e){return t.handleKeyDown(e)},onBlur:function(){return t.handleBlur()},onFocus:function(){return t.handleFocus()},placeholder:this.placeholder,autocomplete:"off","aria-required":this.requiredField?"true":null,maxLength:this.characterLimit||undefined,type:this.type,step:this.step,max:this.max,min:this.min,value:this.el.value}),this.symbolAfter&&h("span",{class:"symbol",id:"symbol-after"},this.symbolAfter),this.characterLimit&&typeof this.characterLimit==="number"?h("div",{class:"character-count"},this.charCount,"/",this.characterLimit):""),this.textAfter&&h("span",{class:"text-after",id:"text-after"},this.textAfter)),this.info&&h("div",{id:"info",class:"info"},this.info),h("div",{id:"error",class:"error-message"},this.errorMessage),h("div",{class:"sr-only","aria-live":"polite","aria-atomic":"true",ref:function(e){return t.liveRegionEl=e}},this.announcement)))};Object.defineProperty(t,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{disabled:["handleDisabledChange"],errorMessage:["announceError"]}},enumerable:false,configurable:true});return t}();Input.style=wmInputCss;export{Input as wm_input};
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(t,i,e,r){function n(t){return t instanceof e?t:new e((function(i){i(t)}))}return new(e||(e=Promise))((function(e,o){function a(t){try{l(r.next(t))}catch(t){o(t)}}function s(t){try{l(r["throw"](t))}catch(t){o(t)}}function l(t){t.done?e(t.value):n(t.value).then(a,s)}l((r=r.apply(t,i||[])).next())}))};var __generator=this&&this.__generator||function(t,i){var e={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,n,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(t){return function(i){return l([t,i])}}function l(s){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(e=0)),e)try{if(r=1,n&&(o=s[0]&2?n["return"]:s[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;if(n=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:e.label++;return{value:s[1],done:false};case 5:e.label++;n=s[1];s=[0];continue;case 7:s=e.ops.pop();e.trys.pop();continue;default:if(!(o=e.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){e=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){e.label=s[1];break}if(s[0]===6&&e.label<o[1]){e.label=o[1];o=s;break}if(o&&e.label<o[2]){e.label=o[2];e.ops.push(s);break}if(o[2])e.ops.pop();e.trys.pop();continue}s=i.call(t,e)}catch(t){s=[6,t];n=0}finally{r=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{r as registerInstance,f as forceUpdate,h,H as Host,g as getElement}from"./index-f164fbca.js";import{d as debounce,C as transposeMatrix,x as csvToArray,D as wrapAround,E as getSmallestSkipInterval,F as calcPercentageInRange}from"./functions-f65dbb96.js";import{n as abbrNumber,o as getInterval}from"./chartFunctions-e2554a36.js";import{l as lineChartMessages,c as chartMessages,g as globalMessages}from"./intl-f7f77de7.js";var wmLineChartCss=':host{--wmcolor-linechart-currentposition:var(--wmcolor-lavender);--wmcolor-linechart-delta-text-negative:var(--wmcolor-text-negative);--wmcolor-linechart-delta-text-positive:var(--wmcolor-text-positive);--wmcolor-linechart-gridline:var(--wmcolor-chart-gridline);--wmcolor-linechart-highlight-background:var(--wmcolor-background-highlight);--wmcolor-linechart-popover-background:var(--wmcolor-chart-popover-background);display:block;height:500px;width:100%;font-size:14px;overflow-y:visible;overflow-x:auto}:host .component-wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;min-width:562px;width:100%;height:100%;outline:none}:host .icon{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;position:relative;color:var(--iconColor);-webkit-transform:var(--translation, unset);transform:var(--translation, unset)}:host .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:var(--icon);padding:0 3px;z-index:1}:host .icon:after{color:white;position:absolute;left:3px;-webkit-transform:scale(180%);transform:scale(180%);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:var(--icon);z-index:0}:host .legend{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:8px 16px;margin-top:4px;margin-bottom:16px}:host .legend .legend-label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;cursor:default;font-weight:600}:host .legend .legend-label.faded{opacity:0.3}:host .legend .legend-label .icon{margin-right:4px}:host .legend .visibility-toggle{margin-left:4px}:host .chart-wrapper{position:relative;-ms-flex-positive:1;flex-grow:1;display:grid;grid-template-columns:auto auto 1fr;grid-template-rows:1fr auto auto;margin-right:16px}:host .chart-label{font-size:14px;font-weight:600}:host .chart-label.--y-axis{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;width:var(--labelWidth);align-self:center;margin-right:16px;grid-area:1/1/2/2;-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto}:host .chart-label.--x-axis{margin-top:16px;text-align:center;grid-area:3/3/4/4}:host .y-intervals{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:justify;justify-content:space-between;grid-area:1/2/2/3;margin-right:4px}:host .y-intervals .y-interval{text-align:right}:host .x-intervals{display:grid;grid-template-columns:var(--columns);grid-area:2/3/3/4;line-height:1;margin-top:4px}:host .x-intervals .x-interval{text-align:center}:host .x-intervals .x-interval:first-child{text-align:left}:host .x-intervals .x-interval:last-child{text-align:right}:host .x-intervals .x-interval.hidden{visibility:hidden}:host .plot-area{position:relative;grid-area:1/3/2/4;background-image:linear-gradient(90deg, var(--wmcolor-linechart-gridline) 1px, transparent 1px);border-bottom:1px solid var(--wmcolor-linechart-gridline);background-size:var(--backgroundSize)}:host .plot-area.right-border{border-right:1px solid var(--wmcolor-linechart-gridline)}:host .line{position:absolute;width:100%;height:100%}:host .line .icon{position:absolute;-webkit-transform:var(--translation);transform:var(--translation);left:var(--xPosition);top:var(--yPosition);z-index:1}:host .line .icon:focus{z-index:2;outline:none}:host .line .icon:focus:before{outline:3px solid var(--wmcolor-interactive-focus);outline-offset:0;border-radius:3px}:host .line .line-svg{height:100%;width:100%}:host .line.faded{opacity:0.3}:host .line.focused{z-index:1}:host .line.hidden{visibility:hidden}:host .hover-area-wrapper{position:absolute;width:100%;height:100%;top:0;left:0;display:grid;grid-template-rows:1fr;grid-template-columns:var(--columns)}:host .hover-indicator{-webkit-box-sizing:border-box;box-sizing:border-box;position:absolute;height:100%;width:2px;border:1px solid var(--wmcolor-linechart-currentposition);-webkit-transform:translateX(-50%);transform:translateX(-50%);left:var(--xPosition);grid-column:3/4;grid-row:1/2;pointer-events:none}:host .popover{width:-webkit-max-content;width:-moz-max-content;width:max-content;max-width:400px;background-color:var(--wmcolor-linechart-popover-background);position:absolute;top:var(--topPosition, 0);left:var(--leftPosition, unset);right:var(--rightPosition, unset);padding:16px;border-radius:5px;-webkit-box-shadow:0px 2px 10px 0px rgba(0, 0, 0, 0.09);box-shadow:0px 2px 10px 0px rgba(0, 0, 0, 0.09);-webkit-transform:translateY(-50%);transform:translateY(-50%);line-height:1;z-index:3;grid-column:3/4;grid-row:1/2;pointer-events:none;-webkit-box-sizing:border-box;box-sizing:border-box}:host .popover .title{font-size:16px;font-weight:600}:host .popover .comparison-title{font-style:italic;margin-top:4px}:host .popover .unit{font-size:12px;font-weight:600}:host .popover .unit.--x{margin-left:4px}:host .popover .popover-table{margin-top:16px}:host .popover .popover-table .popover-row{line-height:1}:host .popover .popover-table .popover-row:not(:last-child) td{padding-bottom:8px}:host .popover .popover-table .popover-row .row-label{font-weight:600;padding-right:16px;overflow-wrap:anywhere}:host .popover .popover-table .popover-row .row-label .icon{margin-right:4px}:host .popover .popover-table .popover-row .row-value,:host .popover .popover-table .popover-row .delta{text-align:right;white-space:nowrap}:host .popover .popover-table .popover-row .delta{padding-left:12px;font-weight:600}:host .popover .popover-table .popover-row .delta.--positive{color:var(--wmcolor-linechart-delta-text-positive)}:host .popover .popover-table .popover-row .delta.--negative{color:var(--wmcolor-linechart-delta-text-negative)}:host .highlight{position:absolute;height:100%;background-color:color-mix(in srgb, var(--wmcolor-linechart-highlight-background) 60%, transparent);left:var(--startPercentage);right:var(--endPercentage)}:host .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}';var LineChart=function(){function t(t){var i=this;registerInstance(this,t);this.minTickWidth=120;this.popoverData=[];this.focusedDataPoint=[0,0];this.dataPointMatrix=[];this.xIntervals=[];this.displayedXIntervals=[];this.yIntervals=[];this.lineStyles=[{color:"#8b86ca",icon:"f536"},{color:"#2e1b46",icon:"f12f"},{color:"#0089e4",icon:"f763"},{color:"#088000",icon:"f4ce"},{color:"#ea8500",icon:"f70a"},{color:"#d54f41",icon:"f536"},{color:"#146ca9",icon:"f6ff"}];this.debouncedResize=debounce((function(){return __awaiter(i,void 0,void 0,(function(){return __generator(this,(function(t){this.displayedXIntervals=this.determineDisplayedXIntervals();return[2]}))}))}),100);this.label=undefined;this.description="";this.xAxisLabel=undefined;this.yAxisLabel=undefined;this.lineData=undefined;this.units="null,null";this.labelWidth="120px";this.highlightQualifier="highlighted";this.highlightStart=undefined;this.highlightEnd=undefined;this.visibilityToggles=false;this.showDeltas=false;this.yRange=undefined;this.parsedLineData={};this.popoverIndex=-1;this.focusedLine=-1;this.hiddenLines=[];this.isTabbing=false;this.intervalSkip=0;this.announcement=""}t.prototype.parseData=function(){var t=this;this.parsedLineData=JSON.parse(this.lineData);this.yIntervals=this.calcYIntervals().reverse();this.xIntervals=Object.keys(Object.values(this.parsedLineData)[0]);this.displayedXIntervals=this.determineDisplayedXIntervals();this.dataPointMatrix=Object.entries(this.parsedLineData).map((function(i){return t.buildLineDataPointDetails(i[0],i[1])}));this.popoverData=transposeMatrix(this.dataPointMatrix)};t.prototype.handleIntervalSkip=function(){this.parseData()};Object.defineProperty(t.prototype,"hasPartialInterval",{get:function(){return this.intervalSkip>0&&this.xIntervals.length%2===0},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"parsedUnits",{get:function(){return csvToArray(this.units).map((function(t){return t==="null"?null:t}))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"visibilityToggleEls",{get:function(){return this.legendEl.querySelectorAll("wm-button")},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"lineEls",{get:function(){return this.plotAreaEl.querySelectorAll(".line")},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"firstVisibleLineIdx",{get:function(){var t=0;while(this.hiddenLines.includes(t)){t++}return t<this.dataPointMatrix.length?t:-1},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"pointEls",{get:function(){return this.plotAreaEl.querySelectorAll(".point")},enumerable:false,configurable:true});t.prototype.toggleTabbingOn=function(){this.isTabbing=true};t.prototype.toggleTabbingOff=function(){this.isTabbing=false};t.prototype.componentWillLoad=function(){this.parseData()};t.prototype.componentDidLoad=function(){var t=this;var i=new ResizeObserver((function(){return t.debouncedResize()}));i.observe(this.el)};t.prototype.handleVisibilityToggleKeydown=function(t,i){switch(t.key){case"Tab":if(!t.shiftKey&&this.firstVisibleLineIdx!==-1){t.preventDefault();this.announce(this.lineFocusMessage(this.firstVisibleLineIdx));this.focusDataPoint(this.firstVisibleLineIdx,0)}break;case"ArrowUp":case"ArrowLeft":t.preventDefault();var e=wrapAround(i,-1,this.dataPointMatrix.length-1);this.visibilityToggleEls[e].focus();break;case"ArrowDown":case"ArrowRight":t.preventDefault();var r=wrapAround(i,1,this.dataPointMatrix.length-1);this.visibilityToggleEls[r].focus();break}};t.prototype.handleDataPointKeydown=function(t){var i=this.focusedDataPoint,e=i[0],r=i[1];var n=this.lineEls[e].querySelectorAll(".point").length;var o=this.dataPointMatrix.length;switch(t.key){case"Tab":if(t.shiftKey&&this.visibilityToggles){t.preventDefault();this.visibilityToggleEls[0].focus()}break;case"ArrowUp":t.preventDefault();var a=e;do{a=wrapAround(a,-1,o-1)}while(this.hiddenLines.includes(a));this.announce(this.lineFocusMessage(a));this.focusDataPoint(a,r);break;case"ArrowDown":t.preventDefault();var s=e;do{s=wrapAround(s,1,o-1)}while(this.hiddenLines.includes(s));this.announce(this.lineFocusMessage(s));this.focusDataPoint(s,r);break;case"ArrowLeft":t.preventDefault();var l=wrapAround(r,-1,n-1);this.focusDataPoint(e,l);break;case"ArrowRight":t.preventDefault();var h=wrapAround(r,1,n-1);this.focusDataPoint(e,h);break}};t.prototype.announce=function(t){if(this.liveRegionEl.textContent===t){t+=" "}this.announcement=t};t.prototype.lineFocusMessage=function(t){var i=this.dataPointMatrix[t][0].lineLabel;var e=this.dataPointMatrix[t].filter((function(t){return t.yValue!==null})).length;return"".concat(i,", line ").concat(t+1," of ").concat(this.dataPointMatrix.length," with ").concat(e," data points")};t.prototype.focusDataPoint=function(t,i){var e=this.lineEls[t];var r=e.querySelectorAll(".point")[i];this.pointEls.forEach((function(t){return t.tabIndex=-1}));r.tabIndex=0;r.focus();this.focusedDataPoint=[t,i]};t.prototype.focusDataPointByEl=function(t){var i=parseInt(t.dataset.lineidx);var e=Array.from(t.parentElement.querySelectorAll(".point")).indexOf(t);this.pointEls.forEach((function(t){return t.tabIndex=-1}));t.tabIndex=0;t.focus();this.focusedDataPoint=[i,e]};t.prototype.calcYIntervals=function(){var t=[];if(this.yRange){t=csvToArray(this.yRange).map((function(t){return parseInt(t)}))}else{var i=[];var e=Object.values(this.parsedLineData).flat();e.forEach((function(t){return i.push.apply(i,Object.values(t))}));var r=i.filter((function(t){return t!==null}));var n=Math.min.apply(Math,r);var o=Math.max.apply(Math,r);var a=getInterval(o-n,4);var s=a;while(n%a!==0&&s>0){n--;s--}a=getInterval(o-n,4);var l=n;while(l<=o+a){t.push(l);l+=a}}return t};t.prototype.determineDisplayedXIntervals=function(){var t=this.plotAreaEl&&this.plotAreaEl.clientWidth>0?Math.round(this.plotAreaEl.clientWidth/this.minTickWidth):this.xIntervals.length;var i=getSmallestSkipInterval(this.xIntervals,t),e=i.skipInterval,r=i.skippedList;this.intervalSkip=e;return r};t.prototype.buildLineDataPointDetails=function(t,i){var e=this;var r=[];var n=Object.entries(i);var o;n.forEach((function(i,a){var s=i[0],l=i[1];var h=100/(n.length-1)*a;var c=l===null?null:100-calcPercentageInRange(l,e.yIntervals[e.yIntervals.length-1],e.yIntervals[0]);if(a===0){h+=e.plotAreaEl&&e.plotAreaEl.clientWidth>0?8/e.plotAreaEl.clientWidth*100:1}if(s===e.highlightStart&&!o){o=true}r.push({lineLabel:t,xValue:s,yValue:l,xPositionPercent:h,yPositionPercent:c,highlighted:o});if(s===e.highlightEnd&&o){o=false}}));return r};t.prototype.toggleLineVisibility=function(t){if(this.hiddenLines.includes(t)){this.hiddenLines=this.hiddenLines.filter((function(i){return i!==t}))}else{this.hiddenLines.push(t)}forceUpdate(this.el)};t.prototype.resetDataPointFocus=function(){this.popoverIndex=-1;this.pointEls.forEach((function(t){return t.tabIndex=-1}));if(this.firstVisibleLineIdx!==-1){var t=this.lineEls[this.firstVisibleLineIdx];var i=t.querySelectorAll(".point")[0];i.tabIndex=0;this.focusedDataPoint=[this.firstVisibleLineIdx,0]}};t.prototype.calcDelta=function(t,i){var e;if(t.yValue===null||i.yValue===null){e=lineChartMessages.noData}else if(t.yValue==i.yValue){e="0%"}else if(i.yValue==0){e="-"}else{var r=(t.yValue-i.yValue)/i.yValue*100;var n=Math.round(r*100)/100;e="".concat(n>0?"+":"").concat(n,"%")}return e};t.prototype.renderLegend=function(){var t=this;var i=Object.keys(this.parsedLineData);return h("div",{ref:function(i){return t.legendEl=i},class:"legend"},i.map((function(i,e){var r=t.hiddenLines.includes(e);var n=t.focusedLine!==-1&&t.focusedLine!==e;return h("div",{id:"legend-label-".concat(e),class:"legend-label ".concat(n?"faded":""),onMouseEnter:function(){return t.focusedLine=r?-1:e},onMouseLeave:function(){return t.focusedLine=-1}},t.renderIcon(e),i,t.visibilityToggles&&t.renderVisibilityToggle(i,e,r))})))};t.prototype.renderVisibilityToggle=function(t,i,e){var r=this;return h("wm-button",{id:"visibility-button-".concat(i),class:"visibility-toggle","label-for-identical-buttons":"".concat(i===0?"Toggle line visibility list with ".concat(this.dataPointMatrix.length," items"):""," ").concat(e?globalMessages.show:globalMessages.hide," ").concat(t," toggle ").concat(e?"pressed":""),"button-type":"navigational",tooltip:e?globalMessages.show:globalMessages.hide,tooltipPosition:"bottom",icon:e?"f209":"f208",onClick:function(){return r.toggleLineVisibility(i)},onKeyDown:function(t){return r.handleVisibilityToggleKeydown(t,i)},onFocus:function(){return r.popoverIndex=-1}})};t.prototype.renderIcon=function(t){var i=this.lineStyles[t],e=i.color,r=i.icon;var n={"--iconColor":e,"--icon":'"\\'.concat(r,'"'),"--translation":t===5?"rotate(180deg)":"unset"};return h("span",{class:"icon",style:n})};t.prototype.renderXIntervals=function(){var t=this;var i={"--columns":".5fr repeat(".concat(this.xIntervals.length-2,", 1fr) .5fr")};return h("div",{class:"x-intervals",style:i},this.xIntervals.map((function(i){return h("span",{class:"x-interval ".concat(t.displayedXIntervals.includes(i)?"":"hidden")},i)})))};t.prototype.renderYIntervals=function(){var t=this;return h("div",{ref:function(i){return t.yIntervalsEl=i},class:"y-intervals"},this.yIntervals.map((function(t){return h("span",{class:"y-interval"},abbrNumber(t))})))};t.prototype.renderData=function(){var t=this;return this.dataPointMatrix.map((function(i,e){var r=t.focusedLine===e?"focused":"faded";var n=t.hiddenLines.includes(e);return h("div",{class:"line ".concat(t.focusedLine!==-1?r:""," ").concat(n?"hidden":"")},t.renderLines(e),t.renderPoints(e))}))};t.prototype.renderPoints=function(t){var i=this;var e=this.dataPointMatrix[t];return h("div",{class:"line-icons"},e.map((function(r,n){var o=r.lineLabel,a=r.xValue,s=r.yValue,l=r.xPositionPercent,c=r.yPositionPercent,u=r.highlighted;if(s!==null){var p=i.lineStyles[t],f=p.color,v=p.icon;var d=t===0&&n===0?0:undefined;var g={"--icon":'"\\'.concat(v,'"'),"--iconColor":f,"--xPosition":l+"%","--yPosition":c+"%","--translation":t===5?"translate(-50%, -50%) rotate(180deg)":"translate(-50%, -50%)"};var b="".concat(o," ").concat(u?i.highlightQualifier:""," ").concat(i.xAxisLabel," ").concat(a+(i.parsedUnits[0]?i.parsedUnits[0]:""),", ").concat(i.yAxisLabel,": ").concat(s+(i.parsedUnits[1]?i.parsedUnits[1]:""));if(i.showDeltas&&n>0){var x=e[n-1];var m=lineChartMessages.getChangeSince(x.xValue);b+=", ".concat(m," ").concat(i.calcDelta(r,x))}return h("span",{id:"".concat(o,"-").concat(n),role:"img","aria-label":b,tabIndex:d,class:"point icon",style:g,"data-lineidx":t,"data-xvalue":a,onKeyDown:function(t){return i.handleDataPointKeydown(t)},onFocus:function(){return i.popoverIndex=n},onClick:function(t){return i.focusDataPointByEl(t.target)},onMouseEnter:function(){return i.popoverIndex=n}})}})))};t.prototype.renderLines=function(t){var i=this;var e=this.dataPointMatrix[t];return h("svg",{class:"line-svg"},e.map((function(r,n){var o=r.yValue!==null&&n!==e.length-1&&e[n+1].yValue!==null;if(o){var a=i.lineStyles[t].color;var s=r.xPositionPercent,l=r.yPositionPercent;var c=e[n+1],u=c.xPositionPercent,p=c.yPositionPercent;return h("line",{x1:s+"%",y1:l+"%",x2:u+"%",y2:p+"%",stroke:a,"stroke-width":"2px"})}})))};t.prototype.renderHoverAreas=function(){var t=this;var i={"--columns":".5fr repeat(".concat(this.xIntervals.length-2,", 1fr) .5fr")};return h("div",{class:"hover-area-wrapper",style:i,onMouseLeave:function(){return t.popoverIndex=-1}},this.xIntervals.map((function(i,e){return h("div",{onMouseEnter:function(){return t.popoverIndex=e}})})))};t.prototype.renderPopover=function(){var t=this;var i=this.popoverData&&this.popoverData[this.popoverIndex]&&this.plotAreaEl.querySelector('.point[data-xvalue="'.concat(this.dataPointMatrix[0][this.popoverIndex].xValue,'"]'));if(!i){return""}var e=this.popoverData[this.popoverIndex];var r=e[0].xPositionPercent;var n=e.map((function(t){return t.yPositionPercent})).filter((function(t){return t!==null}));var o=n.reduce((function(t,i){return t+i}),0)/n.length;var a=this.plotAreaEl.querySelector('.point[data-xvalue="'.concat(this.dataPointMatrix[0][this.popoverIndex].xValue,'"]'));var s=this.el.getBoundingClientRect();var l=a.getBoundingClientRect();var c=s.right-l.right;var u=l.left-s.left;var p=c>=(this.popoverEl?Math.min(this.popoverEl.clientWidth,400):400);var f=u>=(this.popoverEl?Math.min(this.popoverEl.clientWidth,400):400);var v=8/this.plotAreaEl.clientWidth*100;var d={"--leftPosition":p?r+v+"%":"unset","--rightPosition":f?100-r+v+"%":"unset","--topPosition":o+"%",transform:"translateY(-50%)"};if(!f&&!p){var g="0px - ".concat(this.labelWidth," - 20px - ").concat(this.yIntervalsEl.clientWidth+"px"," + ").concat(this.el.scrollLeft+"px"," + 2px");d={"--leftPosition":"0%","--topPosition":"0%",maxWidth:Math.min(this.el.clientWidth-2,400)+"px",transform:"translateX(calc(".concat(g,"))")}}return h("div",{ref:function(i){return t.popoverEl=i},class:"popover",style:d},h("div",{class:"title"},e[0].xValue,this.parsedUnits[0]&&h("span",{class:"unit --x"},"(",this.parsedUnits[0],")")),this.showDeltas&&this.popoverIndex>0&&h("div",{class:"comparison-title"},lineChartMessages.getChangeSince(this.popoverData[this.popoverIndex-1][0].xValue)),this.renderPopoverTable())};t.prototype.renderPopoverTable=function(){var t=this;var i=this.popoverData[this.popoverIndex];return h("table",{class:"popover-table"},i.map((function(i,e){if(!t.hiddenLines.includes(e)){var r=i.lineLabel,n=i.yValue;var o=t.popoverIndex>0?t.popoverData[t.popoverIndex-1][e]:null;var a=n!==null?(new Intl.NumberFormat).format(n):null;return h("tr",{class:"popover-row"},h("td",null,t.renderIcon(e)),h("td",{class:"row-label"},r),h("td",{class:"row-value"},n===null?lineChartMessages.noData:a,n!==null&&t.parsedUnits[1]&&h("span",{class:"unit --y"},t.parsedUnits[1])),t.showDeltas&&o&&t.renderDeltas(i,o))}})))};t.prototype.renderDeltas=function(t,i){var e=this.calcDelta(t,i);var r=e.toString()[0]=="+"||e=="-"?"positive":e.toString()[0]=="-"?"negative":"";return i&&h("td",{class:"delta --".concat(r)},e)};t.prototype.renderHoverIndicator=function(){var t=this.dataPointMatrix.length>0&&this.dataPointMatrix[0][this.popoverIndex];if(!t){return""}var i=this.dataPointMatrix[0][this.popoverIndex].xPositionPercent;var e={"--xPosition":i+"%"};return h("div",{class:"hover-indicator",style:e})};t.prototype.renderHighlight=function(){var t=this.dataPointMatrix[0][this.xIntervals.indexOf(this.highlightStart)].xPositionPercent;var i=this.highlightEnd?100-this.dataPointMatrix[0][this.xIntervals.indexOf(this.highlightEnd)].xPositionPercent:0;var e={"--startPercentage":t+"%","--endPercentage":i+"%"};return h("div",{class:"highlight",style:e})};t.prototype.render=function(){var t=this;return h(Host,{onBlur:function(){return t.resetDataPointFocus()},onMouseLeave:function(){return t.popoverIndex=-1}},h("div",{class:"component-wrapper",role:"application","aria-roledescription":chartMessages.interactiveChart,"aria-label":this.label,"aria-describedby":"chart-description"},this.renderLegend(),h("div",{class:"chart-wrapper"},h("div",{class:"chart-label --y-axis",style:{"--labelWidth":this.labelWidth}},this.yAxisLabel,this.parsedUnits[1]&&" (".concat(this.parsedUnits[1],")")),this.renderYIntervals(),h("div",{ref:function(i){return t.plotAreaEl=i},class:"plot-area ".concat(this.hasPartialInterval?"":"right-border"),style:{"--backgroundSize":"".concat(this.dataPointMatrix[0][this.xIntervals.indexOf(this.displayedXIntervals[1])].xPositionPercent,"%")}},this.highlightStart&&this.renderHighlight(),this.renderData(),this.renderHoverAreas()),this.popoverIndex!==-1&&this.renderHoverIndicator(),this.popoverIndex!==-1&&this.renderPopover(),this.renderXIntervals(),h("div",{class:"chart-label --x-axis"},this.xAxisLabel,this.parsedUnits[0]&&" (".concat(this.parsedUnits[0],")"))),h("div",{id:"chart-description",class:"sr-only"},"".concat(lineChartMessages.instructions," ").concat(this.description)),h("div",{ref:function(i){return t.liveRegionEl=i},"aria-live":"polite",class:"sr-only"},this.announcement)))};Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{lineData:["parseData"],intervalSkip:["handleIntervalSkip"]}},enumerable:false,configurable:true});return t}();LineChart.style=wmLineChartCss;export{LineChart as wm_line_chart};
1
+ var __awaiter=this&&this.__awaiter||function(t,i,e,r){function n(t){return t instanceof e?t:new e((function(i){i(t)}))}return new(e||(e=Promise))((function(e,o){function a(t){try{l(r.next(t))}catch(t){o(t)}}function s(t){try{l(r["throw"](t))}catch(t){o(t)}}function l(t){t.done?e(t.value):n(t.value).then(a,s)}l((r=r.apply(t,i||[])).next())}))};var __generator=this&&this.__generator||function(t,i){var e={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,n,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(t){return function(i){return l([t,i])}}function l(s){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(e=0)),e)try{if(r=1,n&&(o=s[0]&2?n["return"]:s[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;if(n=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:e.label++;return{value:s[1],done:false};case 5:e.label++;n=s[1];s=[0];continue;case 7:s=e.ops.pop();e.trys.pop();continue;default:if(!(o=e.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){e=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){e.label=s[1];break}if(s[0]===6&&e.label<o[1]){e.label=o[1];o=s;break}if(o&&e.label<o[2]){e.label=o[2];e.ops.push(s);break}if(o[2])e.ops.pop();e.trys.pop();continue}s=i.call(t,e)}catch(t){s=[6,t];n=0}finally{r=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{r as registerInstance,f as forceUpdate,h,H as Host,g as getElement}from"./index-558b5a82.js";import{d as debounce,E as transposeMatrix,x as csvToArray,F as wrapAround,G as getSmallestSkipInterval,H as calcPercentageInRange}from"./functions-46843ea0.js";import{n as abbrNumber,o as getInterval}from"./chartFunctions-036fdb89.js";import{l as lineChartMessages,c as chartMessages,g as globalMessages}from"./intl-8b8740b9.js";var wmLineChartCss=':host{--wmcolor-linechart-currentposition:var(--wmcolor-lavender);--wmcolor-linechart-delta-text-negative:var(--wmcolor-text-negative);--wmcolor-linechart-delta-text-positive:var(--wmcolor-text-positive);--wmcolor-linechart-gridline:var(--wmcolor-chart-gridline);--wmcolor-linechart-highlight-background:var(--wmcolor-background-highlight);--wmcolor-linechart-popover-background:var(--wmcolor-chart-popover-background);display:block;height:500px;width:100%;font-size:14px;overflow-y:visible;overflow-x:auto}:host .component-wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;min-width:562px;width:100%;height:100%;outline:none}:host .icon{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;position:relative;color:var(--iconColor);-webkit-transform:var(--translation, unset);transform:var(--translation, unset)}:host .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:var(--icon);padding:0 3px;z-index:1}:host .icon:after{color:white;position:absolute;left:3px;-webkit-transform:scale(180%);transform:scale(180%);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:var(--icon);z-index:0}:host .legend{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:8px 16px;margin-top:4px;margin-bottom:16px}:host .legend .legend-label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;cursor:default;font-weight:600}:host .legend .legend-label.faded{opacity:0.3}:host .legend .legend-label .icon{margin-right:4px}:host .legend .visibility-toggle{margin-left:4px}:host .chart-wrapper{position:relative;-ms-flex-positive:1;flex-grow:1;display:grid;grid-template-columns:auto auto 1fr;grid-template-rows:1fr auto auto;margin-right:16px}:host .chart-label{font-size:14px;font-weight:600}:host .chart-label.--y-axis{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;width:var(--labelWidth);align-self:center;margin-right:16px;grid-area:1/1/2/2;-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto}:host .chart-label.--x-axis{margin-top:16px;text-align:center;grid-area:3/3/4/4}:host .y-intervals{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:justify;justify-content:space-between;grid-area:1/2/2/3;margin-right:4px}:host .y-intervals .y-interval{text-align:right}:host .x-intervals{display:grid;grid-template-columns:var(--columns);grid-area:2/3/3/4;line-height:1;margin-top:4px}:host .x-intervals .x-interval{text-align:center}:host .x-intervals .x-interval:first-child{text-align:left}:host .x-intervals .x-interval:last-child{text-align:right}:host .x-intervals .x-interval.hidden{visibility:hidden}:host .plot-area{position:relative;grid-area:1/3/2/4;background-image:linear-gradient(90deg, var(--wmcolor-linechart-gridline) 1px, transparent 1px);border-bottom:1px solid var(--wmcolor-linechart-gridline);background-size:var(--backgroundSize)}:host .plot-area.right-border{border-right:1px solid var(--wmcolor-linechart-gridline)}:host .line{position:absolute;width:100%;height:100%}:host .line .icon{position:absolute;-webkit-transform:var(--translation);transform:var(--translation);left:var(--xPosition);top:var(--yPosition);z-index:1}:host .line .icon:focus{z-index:2;outline:none}:host .line .icon:focus:before{outline:3px solid var(--wmcolor-interactive-focus);outline-offset:0;border-radius:3px}:host .line .line-svg{height:100%;width:100%}:host .line.faded{opacity:0.3}:host .line.focused{z-index:1}:host .line.hidden{visibility:hidden}:host .hover-area-wrapper{position:absolute;width:100%;height:100%;top:0;left:0;display:grid;grid-template-rows:1fr;grid-template-columns:var(--columns)}:host .hover-indicator{-webkit-box-sizing:border-box;box-sizing:border-box;position:absolute;height:100%;width:2px;border:1px solid var(--wmcolor-linechart-currentposition);-webkit-transform:translateX(-50%);transform:translateX(-50%);left:var(--xPosition);grid-column:3/4;grid-row:1/2;pointer-events:none}:host .popover{width:-webkit-max-content;width:-moz-max-content;width:max-content;max-width:400px;background-color:var(--wmcolor-linechart-popover-background);position:absolute;top:var(--topPosition, 0);left:var(--leftPosition, unset);right:var(--rightPosition, unset);padding:16px;border-radius:5px;-webkit-box-shadow:0px 2px 10px 0px rgba(0, 0, 0, 0.09);box-shadow:0px 2px 10px 0px rgba(0, 0, 0, 0.09);-webkit-transform:translateY(-50%);transform:translateY(-50%);line-height:1;z-index:3;grid-column:3/4;grid-row:1/2;pointer-events:none;-webkit-box-sizing:border-box;box-sizing:border-box}:host .popover .title{font-size:16px;font-weight:600}:host .popover .comparison-title{font-style:italic;margin-top:4px}:host .popover .unit{font-size:12px;font-weight:600}:host .popover .unit.--x{margin-left:4px}:host .popover .popover-table{margin-top:16px}:host .popover .popover-table .popover-row{line-height:1}:host .popover .popover-table .popover-row:not(:last-child) td{padding-bottom:8px}:host .popover .popover-table .popover-row .row-label{font-weight:600;padding-right:16px;overflow-wrap:anywhere}:host .popover .popover-table .popover-row .row-label .icon{margin-right:4px}:host .popover .popover-table .popover-row .row-value,:host .popover .popover-table .popover-row .delta{text-align:right;white-space:nowrap}:host .popover .popover-table .popover-row .delta{padding-left:12px;font-weight:600}:host .popover .popover-table .popover-row .delta.--positive{color:var(--wmcolor-linechart-delta-text-positive)}:host .popover .popover-table .popover-row .delta.--negative{color:var(--wmcolor-linechart-delta-text-negative)}:host .highlight{position:absolute;height:100%;background-color:color-mix(in srgb, var(--wmcolor-linechart-highlight-background) 60%, transparent);left:var(--startPercentage);right:var(--endPercentage)}:host .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}';var LineChart=function(){function t(t){var i=this;registerInstance(this,t);this.minTickWidth=120;this.popoverData=[];this.focusedDataPoint=[0,0];this.dataPointMatrix=[];this.xIntervals=[];this.displayedXIntervals=[];this.yIntervals=[];this.lineStyles=[{color:"#8b86ca",icon:"f536"},{color:"#2e1b46",icon:"f12f"},{color:"#0089e4",icon:"f763"},{color:"#088000",icon:"f4ce"},{color:"#ea8500",icon:"f70a"},{color:"#d54f41",icon:"f536"},{color:"#146ca9",icon:"f6ff"}];this.debouncedResize=debounce((function(){return __awaiter(i,void 0,void 0,(function(){return __generator(this,(function(t){this.displayedXIntervals=this.determineDisplayedXIntervals();return[2]}))}))}),100);this.label=undefined;this.description="";this.xAxisLabel=undefined;this.yAxisLabel=undefined;this.lineData=undefined;this.units="null,null";this.labelWidth="120px";this.highlightQualifier="highlighted";this.highlightStart=undefined;this.highlightEnd=undefined;this.visibilityToggles=false;this.showDeltas=false;this.yRange=undefined;this.parsedLineData={};this.popoverIndex=-1;this.focusedLine=-1;this.hiddenLines=[];this.isTabbing=false;this.intervalSkip=0;this.announcement=""}t.prototype.parseData=function(){var t=this;this.parsedLineData=JSON.parse(this.lineData);this.yIntervals=this.calcYIntervals().reverse();this.xIntervals=Object.keys(Object.values(this.parsedLineData)[0]);this.displayedXIntervals=this.determineDisplayedXIntervals();this.dataPointMatrix=Object.entries(this.parsedLineData).map((function(i){return t.buildLineDataPointDetails(i[0],i[1])}));this.popoverData=transposeMatrix(this.dataPointMatrix)};t.prototype.handleIntervalSkip=function(){this.parseData()};Object.defineProperty(t.prototype,"hasPartialInterval",{get:function(){return this.intervalSkip>0&&this.xIntervals.length%2===0},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"parsedUnits",{get:function(){return csvToArray(this.units).map((function(t){return t==="null"?null:t}))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"visibilityToggleEls",{get:function(){return this.legendEl.querySelectorAll("wm-button")},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"lineEls",{get:function(){return this.plotAreaEl.querySelectorAll(".line")},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"firstVisibleLineIdx",{get:function(){var t=0;while(this.hiddenLines.includes(t)){t++}return t<this.dataPointMatrix.length?t:-1},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"pointEls",{get:function(){return this.plotAreaEl.querySelectorAll(".point")},enumerable:false,configurable:true});t.prototype.toggleTabbingOn=function(){this.isTabbing=true};t.prototype.toggleTabbingOff=function(){this.isTabbing=false};t.prototype.componentWillLoad=function(){this.parseData()};t.prototype.componentDidLoad=function(){var t=this;var i=new ResizeObserver((function(){return t.debouncedResize()}));i.observe(this.el)};t.prototype.handleVisibilityToggleKeydown=function(t,i){switch(t.key){case"Tab":if(!t.shiftKey&&this.firstVisibleLineIdx!==-1){t.preventDefault();this.announce(this.lineFocusMessage(this.firstVisibleLineIdx));this.focusDataPoint(this.firstVisibleLineIdx,0)}break;case"ArrowUp":case"ArrowLeft":t.preventDefault();var e=wrapAround(i,-1,this.dataPointMatrix.length-1);this.visibilityToggleEls[e].focus();break;case"ArrowDown":case"ArrowRight":t.preventDefault();var r=wrapAround(i,1,this.dataPointMatrix.length-1);this.visibilityToggleEls[r].focus();break}};t.prototype.handleDataPointKeydown=function(t){var i=this.focusedDataPoint,e=i[0],r=i[1];var n=this.lineEls[e].querySelectorAll(".point").length;var o=this.dataPointMatrix.length;switch(t.key){case"Tab":if(t.shiftKey&&this.visibilityToggles){t.preventDefault();this.visibilityToggleEls[0].focus()}break;case"ArrowUp":t.preventDefault();var a=e;do{a=wrapAround(a,-1,o-1)}while(this.hiddenLines.includes(a));this.announce(this.lineFocusMessage(a));this.focusDataPoint(a,r);break;case"ArrowDown":t.preventDefault();var s=e;do{s=wrapAround(s,1,o-1)}while(this.hiddenLines.includes(s));this.announce(this.lineFocusMessage(s));this.focusDataPoint(s,r);break;case"ArrowLeft":t.preventDefault();var l=wrapAround(r,-1,n-1);this.focusDataPoint(e,l);break;case"ArrowRight":t.preventDefault();var h=wrapAround(r,1,n-1);this.focusDataPoint(e,h);break}};t.prototype.announce=function(t){if(this.liveRegionEl.textContent===t){t+=" "}this.announcement=t};t.prototype.lineFocusMessage=function(t){var i=this.dataPointMatrix[t][0].lineLabel;var e=this.dataPointMatrix[t].filter((function(t){return t.yValue!==null})).length;return"".concat(i,", line ").concat(t+1," of ").concat(this.dataPointMatrix.length," with ").concat(e," data points")};t.prototype.focusDataPoint=function(t,i){var e=this.lineEls[t];var r=e.querySelectorAll(".point")[i];this.pointEls.forEach((function(t){return t.tabIndex=-1}));r.tabIndex=0;r.focus();this.focusedDataPoint=[t,i]};t.prototype.focusDataPointByEl=function(t){var i=parseInt(t.dataset.lineidx);var e=Array.from(t.parentElement.querySelectorAll(".point")).indexOf(t);this.pointEls.forEach((function(t){return t.tabIndex=-1}));t.tabIndex=0;t.focus();this.focusedDataPoint=[i,e]};t.prototype.calcYIntervals=function(){var t=[];if(this.yRange){t=csvToArray(this.yRange).map((function(t){return parseInt(t)}))}else{var i=[];var e=Object.values(this.parsedLineData).flat();e.forEach((function(t){return i.push.apply(i,Object.values(t))}));var r=i.filter((function(t){return t!==null}));var n=Math.min.apply(Math,r);var o=Math.max.apply(Math,r);var a=getInterval(o-n,4);var s=a;while(n%a!==0&&s>0){n--;s--}a=getInterval(o-n,4);var l=n;while(l<=o+a){t.push(l);l+=a}}return t};t.prototype.determineDisplayedXIntervals=function(){var t=this.plotAreaEl&&this.plotAreaEl.clientWidth>0?Math.round(this.plotAreaEl.clientWidth/this.minTickWidth):this.xIntervals.length;var i=getSmallestSkipInterval(this.xIntervals,t),e=i.skipInterval,r=i.skippedList;this.intervalSkip=e;return r};t.prototype.buildLineDataPointDetails=function(t,i){var e=this;var r=[];var n=Object.entries(i);var o;n.forEach((function(i,a){var s=i[0],l=i[1];var h=100/(n.length-1)*a;var c=l===null?null:100-calcPercentageInRange(l,e.yIntervals[e.yIntervals.length-1],e.yIntervals[0]);if(a===0){h+=e.plotAreaEl&&e.plotAreaEl.clientWidth>0?8/e.plotAreaEl.clientWidth*100:1}if(s===e.highlightStart&&!o){o=true}r.push({lineLabel:t,xValue:s,yValue:l,xPositionPercent:h,yPositionPercent:c,highlighted:o});if(s===e.highlightEnd&&o){o=false}}));return r};t.prototype.toggleLineVisibility=function(t){if(this.hiddenLines.includes(t)){this.hiddenLines=this.hiddenLines.filter((function(i){return i!==t}))}else{this.hiddenLines.push(t)}forceUpdate(this.el)};t.prototype.resetDataPointFocus=function(){this.popoverIndex=-1;this.pointEls.forEach((function(t){return t.tabIndex=-1}));if(this.firstVisibleLineIdx!==-1){var t=this.lineEls[this.firstVisibleLineIdx];var i=t.querySelectorAll(".point")[0];i.tabIndex=0;this.focusedDataPoint=[this.firstVisibleLineIdx,0]}};t.prototype.calcDelta=function(t,i){var e;if(t.yValue===null||i.yValue===null){e=lineChartMessages.noData}else if(t.yValue==i.yValue){e="0%"}else if(i.yValue==0){e="-"}else{var r=(t.yValue-i.yValue)/i.yValue*100;var n=Math.round(r*100)/100;e="".concat(n>0?"+":"").concat(n,"%")}return e};t.prototype.renderLegend=function(){var t=this;var i=Object.keys(this.parsedLineData);return h("div",{ref:function(i){return t.legendEl=i},class:"legend"},i.map((function(i,e){var r=t.hiddenLines.includes(e);var n=t.focusedLine!==-1&&t.focusedLine!==e;return h("div",{id:"legend-label-".concat(e),class:"legend-label ".concat(n?"faded":""),onMouseEnter:function(){return t.focusedLine=r?-1:e},onMouseLeave:function(){return t.focusedLine=-1}},t.renderIcon(e),i,t.visibilityToggles&&t.renderVisibilityToggle(i,e,r))})))};t.prototype.renderVisibilityToggle=function(t,i,e){var r=this;return h("wm-button",{id:"visibility-button-".concat(i),class:"visibility-toggle","label-for-identical-buttons":"".concat(i===0?"Toggle line visibility list with ".concat(this.dataPointMatrix.length," items"):""," ").concat(e?globalMessages.show:globalMessages.hide," ").concat(t," toggle ").concat(e?"pressed":""),"button-type":"navigational",tooltip:e?globalMessages.show:globalMessages.hide,tooltipPosition:"bottom",icon:e?"f209":"f208",onClick:function(){return r.toggleLineVisibility(i)},onKeyDown:function(t){return r.handleVisibilityToggleKeydown(t,i)},onFocus:function(){return r.popoverIndex=-1}})};t.prototype.renderIcon=function(t){var i=this.lineStyles[t],e=i.color,r=i.icon;var n={"--iconColor":e,"--icon":'"\\'.concat(r,'"'),"--translation":t===5?"rotate(180deg)":"unset"};return h("span",{class:"icon",style:n})};t.prototype.renderXIntervals=function(){var t=this;var i={"--columns":".5fr repeat(".concat(this.xIntervals.length-2,", 1fr) .5fr")};return h("div",{class:"x-intervals",style:i},this.xIntervals.map((function(i){return h("span",{class:"x-interval ".concat(t.displayedXIntervals.includes(i)?"":"hidden")},i)})))};t.prototype.renderYIntervals=function(){var t=this;return h("div",{ref:function(i){return t.yIntervalsEl=i},class:"y-intervals"},this.yIntervals.map((function(t){return h("span",{class:"y-interval"},abbrNumber(t))})))};t.prototype.renderData=function(){var t=this;return this.dataPointMatrix.map((function(i,e){var r=t.focusedLine===e?"focused":"faded";var n=t.hiddenLines.includes(e);return h("div",{class:"line ".concat(t.focusedLine!==-1?r:""," ").concat(n?"hidden":"")},t.renderLines(e),t.renderPoints(e))}))};t.prototype.renderPoints=function(t){var i=this;var e=this.dataPointMatrix[t];return h("div",{class:"line-icons"},e.map((function(r,n){var o=r.lineLabel,a=r.xValue,s=r.yValue,l=r.xPositionPercent,c=r.yPositionPercent,u=r.highlighted;if(s!==null){var p=i.lineStyles[t],f=p.color,v=p.icon;var d=t===0&&n===0?0:undefined;var g={"--icon":'"\\'.concat(v,'"'),"--iconColor":f,"--xPosition":l+"%","--yPosition":c+"%","--translation":t===5?"translate(-50%, -50%) rotate(180deg)":"translate(-50%, -50%)"};var b="".concat(o," ").concat(u?i.highlightQualifier:""," ").concat(i.xAxisLabel," ").concat(a+(i.parsedUnits[0]?i.parsedUnits[0]:""),", ").concat(i.yAxisLabel,": ").concat(s+(i.parsedUnits[1]?i.parsedUnits[1]:""));if(i.showDeltas&&n>0){var x=e[n-1];var m=lineChartMessages.getChangeSince(x.xValue);b+=", ".concat(m," ").concat(i.calcDelta(r,x))}return h("span",{id:"".concat(o,"-").concat(n),role:"img","aria-label":b,tabIndex:d,class:"point icon",style:g,"data-lineidx":t,"data-xvalue":a,onKeyDown:function(t){return i.handleDataPointKeydown(t)},onFocus:function(){return i.popoverIndex=n},onClick:function(t){return i.focusDataPointByEl(t.target)},onMouseEnter:function(){return i.popoverIndex=n}})}})))};t.prototype.renderLines=function(t){var i=this;var e=this.dataPointMatrix[t];return h("svg",{class:"line-svg"},e.map((function(r,n){var o=r.yValue!==null&&n!==e.length-1&&e[n+1].yValue!==null;if(o){var a=i.lineStyles[t].color;var s=r.xPositionPercent,l=r.yPositionPercent;var c=e[n+1],u=c.xPositionPercent,p=c.yPositionPercent;return h("line",{x1:s+"%",y1:l+"%",x2:u+"%",y2:p+"%",stroke:a,"stroke-width":"2px"})}})))};t.prototype.renderHoverAreas=function(){var t=this;var i={"--columns":".5fr repeat(".concat(this.xIntervals.length-2,", 1fr) .5fr")};return h("div",{class:"hover-area-wrapper",style:i,onMouseLeave:function(){return t.popoverIndex=-1}},this.xIntervals.map((function(i,e){return h("div",{onMouseEnter:function(){return t.popoverIndex=e}})})))};t.prototype.renderPopover=function(){var t=this;var i=this.popoverData&&this.popoverData[this.popoverIndex]&&this.plotAreaEl.querySelector('.point[data-xvalue="'.concat(this.dataPointMatrix[0][this.popoverIndex].xValue,'"]'));if(!i){return""}var e=this.popoverData[this.popoverIndex];var r=e[0].xPositionPercent;var n=e.map((function(t){return t.yPositionPercent})).filter((function(t){return t!==null}));var o=n.reduce((function(t,i){return t+i}),0)/n.length;var a=this.plotAreaEl.querySelector('.point[data-xvalue="'.concat(this.dataPointMatrix[0][this.popoverIndex].xValue,'"]'));var s=this.el.getBoundingClientRect();var l=a.getBoundingClientRect();var c=s.right-l.right;var u=l.left-s.left;var p=c>=(this.popoverEl?Math.min(this.popoverEl.clientWidth,400):400);var f=u>=(this.popoverEl?Math.min(this.popoverEl.clientWidth,400):400);var v=8/this.plotAreaEl.clientWidth*100;var d={"--leftPosition":p?r+v+"%":"unset","--rightPosition":f?100-r+v+"%":"unset","--topPosition":o+"%",transform:"translateY(-50%)"};if(!f&&!p){var g="0px - ".concat(this.labelWidth," - 20px - ").concat(this.yIntervalsEl.clientWidth+"px"," + ").concat(this.el.scrollLeft+"px"," + 2px");d={"--leftPosition":"0%","--topPosition":"0%",maxWidth:Math.min(this.el.clientWidth-2,400)+"px",transform:"translateX(calc(".concat(g,"))")}}return h("div",{ref:function(i){return t.popoverEl=i},class:"popover",style:d},h("div",{class:"title"},e[0].xValue,this.parsedUnits[0]&&h("span",{class:"unit --x"},"(",this.parsedUnits[0],")")),this.showDeltas&&this.popoverIndex>0&&h("div",{class:"comparison-title"},lineChartMessages.getChangeSince(this.popoverData[this.popoverIndex-1][0].xValue)),this.renderPopoverTable())};t.prototype.renderPopoverTable=function(){var t=this;var i=this.popoverData[this.popoverIndex];return h("table",{class:"popover-table"},i.map((function(i,e){if(!t.hiddenLines.includes(e)){var r=i.lineLabel,n=i.yValue;var o=t.popoverIndex>0?t.popoverData[t.popoverIndex-1][e]:null;var a=n!==null?(new Intl.NumberFormat).format(n):null;return h("tr",{class:"popover-row"},h("td",null,t.renderIcon(e)),h("td",{class:"row-label"},r),h("td",{class:"row-value"},n===null?lineChartMessages.noData:a,n!==null&&t.parsedUnits[1]&&h("span",{class:"unit --y"},t.parsedUnits[1])),t.showDeltas&&o&&t.renderDeltas(i,o))}})))};t.prototype.renderDeltas=function(t,i){var e=this.calcDelta(t,i);var r=e.toString()[0]=="+"||e=="-"?"positive":e.toString()[0]=="-"?"negative":"";return i&&h("td",{class:"delta --".concat(r)},e)};t.prototype.renderHoverIndicator=function(){var t=this.dataPointMatrix.length>0&&this.dataPointMatrix[0][this.popoverIndex];if(!t){return""}var i=this.dataPointMatrix[0][this.popoverIndex].xPositionPercent;var e={"--xPosition":i+"%"};return h("div",{class:"hover-indicator",style:e})};t.prototype.renderHighlight=function(){var t=this.dataPointMatrix[0][this.xIntervals.indexOf(this.highlightStart)].xPositionPercent;var i=this.highlightEnd?100-this.dataPointMatrix[0][this.xIntervals.indexOf(this.highlightEnd)].xPositionPercent:0;var e={"--startPercentage":t+"%","--endPercentage":i+"%"};return h("div",{class:"highlight",style:e})};t.prototype.render=function(){var t=this;return h(Host,{onBlur:function(){return t.resetDataPointFocus()},onMouseLeave:function(){return t.popoverIndex=-1}},h("div",{class:"component-wrapper",role:"application","aria-roledescription":chartMessages.interactiveChart,"aria-label":this.label,"aria-describedby":"chart-description"},this.renderLegend(),h("div",{class:"chart-wrapper"},h("div",{class:"chart-label --y-axis",style:{"--labelWidth":this.labelWidth}},this.yAxisLabel,this.parsedUnits[1]&&" (".concat(this.parsedUnits[1],")")),this.renderYIntervals(),h("div",{ref:function(i){return t.plotAreaEl=i},class:"plot-area ".concat(this.hasPartialInterval?"":"right-border"),style:{"--backgroundSize":"".concat(this.dataPointMatrix[0][this.xIntervals.indexOf(this.displayedXIntervals[1])].xPositionPercent,"%")}},this.highlightStart&&this.renderHighlight(),this.renderData(),this.renderHoverAreas()),this.popoverIndex!==-1&&this.renderHoverIndicator(),this.popoverIndex!==-1&&this.renderPopover(),this.renderXIntervals(),h("div",{class:"chart-label --x-axis"},this.xAxisLabel,this.parsedUnits[0]&&" (".concat(this.parsedUnits[0],")"))),h("div",{id:"chart-description",class:"sr-only"},"".concat(lineChartMessages.instructions," ").concat(this.description)),h("div",{ref:function(i){return t.liveRegionEl=i},"aria-live":"polite",class:"sr-only"},this.announcement)))};Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{lineData:["parseData"],intervalSkip:["handleIntervalSkip"]}},enumerable:false,configurable:true});return t}();LineChart.style=wmLineChartCss;export{LineChart as wm_line_chart};
@@ -1 +1 @@
1
- import{r as registerInstance,h,g as getElement}from"./index-f164fbca.js";var wmModalFooterCss="wm-modal-footer{display:block;-webkit-border-radius:0px 0px 5px 5px;-moz-border-radius:0px 0px 5px 5px;-ms-border-radius:0px 0px 5px 5px;border-radius:0px 0px 5px 5px}wm-modal-footer .wm-wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}@media only screen and (max-width: 650px){wm-modal-footer .wm-wrapper.footer-text{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:start;align-items:flex-start}}wm-modal-footer .wm-wrapper wm-button+wm-button{margin-left:1rem}wm-modal-footer .wm-wrapper .wm-info{font-size:0.875rem;font-style:italic}@media only screen and (max-width: 650px){wm-modal-footer .wm-wrapper .wm-info{padding-bottom:0.625rem}}wm-modal-footer .wm-wrapper .wm-info:focus{outline:none}";var ModalFooter=function(){function e(e){registerInstance(this,e);this.secondaryText="";this.primaryText="";this.infoText="";this.primaryActionDisabled=false;this.deleteStyle=false}e.prototype.componentWillLoad=function(){var e=this;var t=this.el.closest("wm-modal");this.uid=t.uid;t.addEventListener("focusLastElement",(function(){e.lastElement.focus()}))};e.prototype.emitParentPrimaryEvent=function(){var e=this.el.closest("wm-modal");if(e){e.emitPrimaryEvent()}};e.prototype.emitParentSecondaryEvent=function(){var e=this.el.closest("wm-modal");if(e){e.emitSecondaryEvent()}};e.prototype.render=function(){var e=this;return h("div",{class:"wm-wrapper ".concat(this.infoText?" footer-text":"")},h("div",{class:"wm-info","aria-live":"polite"},this.infoText),h("div",{class:"wm-button-collection"},this.secondaryText&&h("wm-button",{onClick:function(){return e.emitParentSecondaryEvent()},id:"wm-secondary-".concat(this.uid),ref:function(t){return e.primaryActionDisabled?e.lastElement=t:undefined}},this.secondaryText),h("wm-button",{"button-type":this.deleteStyle?"secondary":"primary","permanently-delete":this.deleteStyle,onClick:function(){return e.emitParentPrimaryEvent()},disabled:this.primaryActionDisabled,id:"wm-primary-".concat(this.uid),ref:function(t){return!e.primaryActionDisabled?e.lastElement=t:undefined}},this.primaryText)))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();ModalFooter.style=wmModalFooterCss;export{ModalFooter as wm_modal_footer};
1
+ import{r as registerInstance,h,g as getElement}from"./index-558b5a82.js";var wmModalFooterCss="wm-modal-footer{display:block;-webkit-border-radius:0px 0px 5px 5px;-moz-border-radius:0px 0px 5px 5px;-ms-border-radius:0px 0px 5px 5px;border-radius:0px 0px 5px 5px}wm-modal-footer .wm-wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}@media only screen and (max-width: 650px){wm-modal-footer .wm-wrapper.footer-text{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:start;align-items:flex-start}}wm-modal-footer .wm-wrapper wm-button+wm-button{margin-left:1rem}wm-modal-footer .wm-wrapper .wm-info{font-size:0.875rem;font-style:italic}@media only screen and (max-width: 650px){wm-modal-footer .wm-wrapper .wm-info{padding-bottom:0.625rem}}wm-modal-footer .wm-wrapper .wm-info:focus{outline:none}";var ModalFooter=function(){function e(e){registerInstance(this,e);this.secondaryText="";this.primaryText="";this.infoText="";this.primaryActionDisabled=false;this.deleteStyle=false}e.prototype.componentWillLoad=function(){var e=this;var t=this.el.closest("wm-modal");this.uid=t.uid;t.addEventListener("focusLastElement",(function(){e.lastElement.focus()}))};e.prototype.emitParentPrimaryEvent=function(){var e=this.el.closest("wm-modal");if(e){e.emitPrimaryEvent()}};e.prototype.emitParentSecondaryEvent=function(){var e=this.el.closest("wm-modal");if(e){e.emitSecondaryEvent()}};e.prototype.render=function(){var e=this;return h("div",{class:"wm-wrapper ".concat(this.infoText?" footer-text":"")},h("div",{class:"wm-info","aria-live":"polite"},this.infoText),h("div",{class:"wm-button-collection"},this.secondaryText&&h("wm-button",{onClick:function(){return e.emitParentSecondaryEvent()},id:"wm-secondary-".concat(this.uid),ref:function(t){return e.primaryActionDisabled?e.lastElement=t:undefined}},this.secondaryText),h("wm-button",{"button-type":this.deleteStyle?"secondary":"primary","permanently-delete":this.deleteStyle,onClick:function(){return e.emitParentPrimaryEvent()},disabled:this.primaryActionDisabled,id:"wm-primary-".concat(this.uid),ref:function(t){return!e.primaryActionDisabled?e.lastElement=t:undefined}},this.primaryText)))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();ModalFooter.style=wmModalFooterCss;export{ModalFooter as wm_modal_footer};
@@ -1 +1 @@
1
- import{r as registerInstance,h,H as Host,g as getElement}from"./index-f164fbca.js";import{g as globalMessages}from"./intl-f7f77de7.js";import"./functions-f65dbb96.js";var wmModalHeaderCss="wm-modal-header{display:block;-webkit-border-radius:5px 5px 0 0px;-moz-border-radius:5px 5px 0 0px;-ms-border-radius:5px 5px 0 0px;border-radius:5px 5px 0 0px}wm-modal-header .wm-wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}wm-modal-header .wm-wrapper .title{margin:0;font-weight:600;font-size:1.125rem;color:var(--wmcolor-modal-heading);line-height:normal}wm-modal-header .wm-wrapper .title .subtitle{display:block;font-size:0.875rem;font-weight:normal}wm-modal-header .wm-wrapper .title:focus{outline:none}";var ModalHeader=function(){function e(e){registerInstance(this,e);this.heading="";this.subheading=""}e.prototype.componentWillLoad=function(){var e=this;var t=this.el.closest("wm-modal");this.uid=t.uid;t.addEventListener("focusFirstElement",(function(){e.closeButtonEl.focus()}))};e.prototype.emitParentCloseEvent=function(){var e=this.el.closest("wm-modal");e.emitCloseEvent()};e.prototype.render=function(){var e=this;return h(Host,null,h("div",{class:"wm-wrapper"},h("div",null,h("h2",{class:"title",id:"wm-modal-heading-text-".concat(this.uid)},this.heading,h("span",{class:"subtitle"},this.subheading))),h("wm-button",{"button-type":"navigational",icon:"f156",tooltip:globalMessages.close,"tooltip-position":"left",id:"wm-modal-close-".concat(this.uid),ref:function(t){return e.closeButtonEl=t},onClick:function(){return e.emitParentCloseEvent()}})))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();ModalHeader.style=wmModalHeaderCss;export{ModalHeader as wm_modal_header};
1
+ import{r as registerInstance,h,H as Host,g as getElement}from"./index-558b5a82.js";import{g as globalMessages}from"./intl-8b8740b9.js";import"./functions-46843ea0.js";var wmModalHeaderCss="wm-modal-header{display:block;-webkit-border-radius:5px 5px 0 0px;-moz-border-radius:5px 5px 0 0px;-ms-border-radius:5px 5px 0 0px;border-radius:5px 5px 0 0px}wm-modal-header .wm-wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}wm-modal-header .wm-wrapper .title{margin:0;font-weight:600;font-size:1.125rem;color:var(--wmcolor-modal-heading);line-height:normal}wm-modal-header .wm-wrapper .title .subtitle{display:block;font-size:0.875rem;font-weight:normal}wm-modal-header .wm-wrapper .title:focus{outline:none}";var ModalHeader=function(){function e(e){registerInstance(this,e);this.heading="";this.subheading=""}e.prototype.componentWillLoad=function(){var e=this;var t=this.el.closest("wm-modal");this.uid=t.uid;t.addEventListener("focusFirstElement",(function(){e.closeButtonEl.focus()}))};e.prototype.emitParentCloseEvent=function(){var e=this.el.closest("wm-modal");e.emitCloseEvent()};e.prototype.render=function(){var e=this;return h(Host,null,h("div",{class:"wm-wrapper"},h("div",null,h("h2",{class:"title",id:"wm-modal-heading-text-".concat(this.uid)},this.heading,h("span",{class:"subtitle"},this.subheading))),h("wm-button",{"button-type":"navigational",icon:"f156",tooltip:globalMessages.close,"tooltip-position":"left",id:"wm-modal-close-".concat(this.uid),ref:function(t){return e.closeButtonEl=t},onClick:function(){return e.emitParentCloseEvent()}})))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();ModalHeader.style=wmModalHeaderCss;export{ModalHeader as wm_modal_header};
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(t,o,e,n){function i(t){return t instanceof e?t:new e((function(o){o(t)}))}return new(e||(e=Promise))((function(e,r){function a(t){try{s(n.next(t))}catch(t){r(t)}}function d(t){try{s(n["throw"](t))}catch(t){r(t)}}function s(t){t.done?e(t.value):i(t.value).then(a,d)}s((n=n.apply(t,o||[])).next())}))};var __generator=this&&this.__generator||function(t,o){var e={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,i,r,a;return a={next:d(0),throw:d(1),return:d(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function d(t){return function(o){return s([t,o])}}function s(d){if(n)throw new TypeError("Generator is already executing.");while(a&&(a=0,d[0]&&(e=0)),e)try{if(n=1,i&&(r=d[0]&2?i["return"]:d[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,d[1])).done)return r;if(i=0,r)d=[d[0]&2,r.value];switch(d[0]){case 0:case 1:r=d;break;case 4:e.label++;return{value:d[1],done:false};case 5:e.label++;i=d[1];d=[0];continue;case 7:d=e.ops.pop();e.trys.pop();continue;default:if(!(r=e.trys,r=r.length>0&&r[r.length-1])&&(d[0]===6||d[0]===2)){e=0;continue}if(d[0]===3&&(!r||d[1]>r[0]&&d[1]<r[3])){e.label=d[1];break}if(d[0]===6&&e.label<r[1]){e.label=r[1];r=d;break}if(r&&e.label<r[2]){e.label=r[2];e.ops.push(d);break}if(r[2])e.ops.pop();e.trys.pop();continue}d=o.call(t,e)}catch(t){d=[6,t];i=0}finally{n=r=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,g as getElement}from"./index-f164fbca.js";import{g as generateId}from"./functions-f65dbb96.js";var wmModalCss="wm-modal{--wmcolor-modal-background:var(--wmcolor-background);--wmcolor-modal-border:var(--wmcolor-border);--wmcolor-modal-heading:var(--wmcolor-text);--wmcolor-modal-overlay:var(--wmcolor-overlay)}wm-modal *{-webkit-box-sizing:border-box;box-sizing:border-box}wm-modal dialog{color:inherit;overflow:hidden;padding:0;width:80vw;max-width:750px;max-height:80vh;-webkit-border-radius:5px 5px 5px 5px;-moz-border-radius:5px 5px 5px 5px;-ms-border-radius:5px 5px 5px 5px;border-radius:5px 5px 5px 5px;border:none;background:var(--wmcolor-modal-background)}wm-modal dialog>:not(wm-modal-header):not(wm-modal-footer){max-height:calc(80vh - 166px)}wm-modal dialog::-webkit-backdrop{background:rgba(25, 25, 25, 0.4)}wm-modal dialog::-ms-backdrop{background:rgba(25, 25, 25, 0.4)}wm-modal dialog::backdrop{background:rgba(25, 25, 25, 0.4)}wm-modal dialog[open]{-webkit-box-shadow:0px 11px 15px 0px rgba(0, 0, 0, 0.2), 0px 9px 46px 8px rgba(0, 0, 0, 0.12), 0px 24px 38px 3px rgba(0, 0, 0, 0.14);-moz-box-shadow:0px 11px 15px 0px rgba(0, 0, 0, 0.2), 0px 9px 46px 8px rgba(0, 0, 0, 0.12), 0px 24px 38px 3px rgba(0, 0, 0, 0.14);box-shadow:0px 11px 15px 0px rgba(0, 0, 0, 0.2), 0px 9px 46px 8px rgba(0, 0, 0, 0.12), 0px 24px 38px 3px rgba(0, 0, 0, 0.14)}wm-modal dialog.wm-modal>wm-modal-header{border-bottom:1px solid var(--wmcolor-modal-border)}wm-modal dialog.wm-modal>wm-modal-footer{border-top:1px solid var(--wmcolor-modal-border)}@media only screen and (max-width: 768px){wm-modal dialog.wm-modal{height:100%;max-height:none;max-width:none;width:100vw}wm-modal dialog.wm-modal>*{max-width:none;width:100vw}wm-modal dialog.wm-modal>*:not(wm-modal-header):not(wm-modal-footer){max-height:none;height:calc(100vh - 166px)}}wm-modal dialog.wm-dialog>:not(wm-modal-header):not(wm-modal-footer):not(.wm-tooltip){padding:0 1.875rem 1.25rem 1.875rem;font-size:0.875rem;border:none}wm-modal wm-modal-header,wm-modal wm-modal-footer{padding:1.25rem 1.875rem;width:100%}wm-modal .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important;top:0;left:0}";var Modal=function(){function t(t){registerInstance(this,t);this.focusLastElement=createEvent(this,"focusLastElement",3);this.focusFirstElement=createEvent(this,"focusFirstElement",3);this.wmModalCloseTriggered=createEvent(this,"wmModalCloseTriggered",3);this.wmModalPrimaryTriggered=createEvent(this,"wmModalPrimaryTriggered",7);this.wmModalSecondaryTriggered=createEvent(this,"wmModalSecondaryTriggered",7);this.open=false;this.elementToFocus="";this.modalType="modal";this.uid=undefined;this.returnFocusEl=undefined}Object.defineProperty(t.prototype,"closeButtonEl",{get:function(){return this.el.querySelector("#wm-modal-close-".concat(this.uid))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"focusOnOpenEl",{get:function(){var t=null;if(this.elementToFocus==="primary"||this.elementToFocus==="secondary"){t=this.el.querySelector("#wm-".concat(this.elementToFocus,"-").concat(this.uid))}else if(this.elementToFocus){t=this.el.querySelector("#"+this.elementToFocus);!t&&console.warn("Ripple Component Library: The modal component couldn't find an element matching the id you passed for 'elementToFocus' (".concat(this.elementToFocus,"). It will fall back to the default and focus the close button when the modal opens."))}return t},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"hasBrowserPopoverSupport",{get:function(){var t=document.getElementById("wm-tooltip");return t?!!t.showPopover:false},enumerable:false,configurable:true});t.prototype.toggleModal=function(){this.open?this.showModal():this.hideModal()};t.prototype.handleDialogClose=function(){if(this.open){this.wmModalCloseTriggered.emit()}this.open=false};t.prototype.showModal=function(){this.returnFocusEl=document.activeElement;this.setAriaDescribedbyOnModal();document.body.style.overflow="hidden";this.dialogEl.showModal();if(this.focusOnOpenEl){this.focusOnOpenEl.focus()}};t.prototype.hideModal=function(){var t=this;document.body.style.overflow="visible";this.dialogEl.close();setTimeout((function(){if(t.returnFocusEl&&document.activeElement===document.body){if(t.returnFocusEl.tagName==="WM-MENUITEM"){t.returnFocusEl=t.returnFocusEl.parentElement}t.returnFocusEl.focus()}}),20)};t.prototype.componentWillLoad=function(){var t=this;if(this.elementToFocus==="primary"||this.elementToFocus==="secondary"){if(!this.el.id){console.error("For accessibility purposes you need to set the modal content wrapper's id to 'content-[id of wm-modal].")}}this.el.focus=function(){if(t.focusOnOpenEl){t.focusOnOpenEl.focus()}else{t.closeButtonEl.focus()}};this.uid=this.el.id?this.el.id:generateId()};t.prototype.componentDidLoad=function(){var t=this;if(this.open){this.showModal()}this.dialogEl.addEventListener("close",(function(){return t.handleDialogClose()}))};t.prototype.emitCloseEvent=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.wmModalCloseTriggered.emit();return[2]}))}))};t.prototype.emitPrimaryEvent=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.wmModalPrimaryTriggered.emit();return[2]}))}))};t.prototype.emitSecondaryEvent=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.wmModalSecondaryTriggered.emit();return[2]}))}))};t.prototype.handleKeyDown=function(t){if(t.key=="Escape"){t.stopPropagation()}};t.prototype.setAriaDescribedbyOnModal=function(){var t=document.getElementById("content-".concat(this.uid));if(!t){console.warn("Ripple Component Library: The element containing the body of the modal must include an id in the format 'content-[id of modal]' for accessibility purposes.")}else{this.el.setAttribute("aria-describedby","wm-modal-heading-text-".concat(this.uid," content-").concat(this.uid))}};t.prototype.render=function(){var t=this;return h("dialog",{class:"".concat("wm-"+this.modalType),ref:function(o){return t.dialogEl=o},onKeyDown:function(o){return t.handleKeyDown(o)}},h("div",{class:"tabtrap sr-only",tabindex:"0",onFocus:function(o){var e=o.relatedTarget&&o.relatedTarget==t.closeButtonEl;e?t.focusLastElement.emit():t.focusFirstElement.emit()}}),!this.hasBrowserPopoverSupport&&h("div",{class:"wm-tooltip"}),h("slot",null),h("div",{class:"tabtrap sr-only",tabindex:"0",onFocus:function(){t.focusFirstElement.emit()}}))};Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{open:["toggleModal"]}},enumerable:false,configurable:true});return t}();Modal.style=wmModalCss;export{Modal as wm_modal};
1
+ var __awaiter=this&&this.__awaiter||function(t,o,e,n){function i(t){return t instanceof e?t:new e((function(o){o(t)}))}return new(e||(e=Promise))((function(e,r){function a(t){try{s(n.next(t))}catch(t){r(t)}}function d(t){try{s(n["throw"](t))}catch(t){r(t)}}function s(t){t.done?e(t.value):i(t.value).then(a,d)}s((n=n.apply(t,o||[])).next())}))};var __generator=this&&this.__generator||function(t,o){var e={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,i,r,a;return a={next:d(0),throw:d(1),return:d(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function d(t){return function(o){return s([t,o])}}function s(d){if(n)throw new TypeError("Generator is already executing.");while(a&&(a=0,d[0]&&(e=0)),e)try{if(n=1,i&&(r=d[0]&2?i["return"]:d[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,d[1])).done)return r;if(i=0,r)d=[d[0]&2,r.value];switch(d[0]){case 0:case 1:r=d;break;case 4:e.label++;return{value:d[1],done:false};case 5:e.label++;i=d[1];d=[0];continue;case 7:d=e.ops.pop();e.trys.pop();continue;default:if(!(r=e.trys,r=r.length>0&&r[r.length-1])&&(d[0]===6||d[0]===2)){e=0;continue}if(d[0]===3&&(!r||d[1]>r[0]&&d[1]<r[3])){e.label=d[1];break}if(d[0]===6&&e.label<r[1]){e.label=r[1];r=d;break}if(r&&e.label<r[2]){e.label=r[2];e.ops.push(d);break}if(r[2])e.ops.pop();e.trys.pop();continue}d=o.call(t,e)}catch(t){d=[6,t];i=0}finally{n=r=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,g as getElement}from"./index-558b5a82.js";import{g as generateId}from"./functions-46843ea0.js";var wmModalCss="wm-modal{--wmcolor-modal-background:var(--wmcolor-background);--wmcolor-modal-border:var(--wmcolor-border);--wmcolor-modal-heading:var(--wmcolor-text);--wmcolor-modal-overlay:var(--wmcolor-overlay)}wm-modal *{-webkit-box-sizing:border-box;box-sizing:border-box}wm-modal dialog{color:inherit;padding:0;width:80vw;max-width:750px;max-height:80vh;-webkit-border-radius:5px 5px 5px 5px;-moz-border-radius:5px 5px 5px 5px;-ms-border-radius:5px 5px 5px 5px;border-radius:5px 5px 5px 5px;border:none;background:var(--wmcolor-modal-background)}wm-modal dialog>:not(wm-modal-header):not(wm-modal-footer){max-height:calc(80vh - 166px)}wm-modal dialog::-webkit-backdrop{background:rgba(25, 25, 25, 0.4)}wm-modal dialog::-ms-backdrop{background:rgba(25, 25, 25, 0.4)}wm-modal dialog::backdrop{background:rgba(25, 25, 25, 0.4)}wm-modal dialog[open]{-webkit-box-shadow:0px 11px 15px 0px rgba(0, 0, 0, 0.2), 0px 9px 46px 8px rgba(0, 0, 0, 0.12), 0px 24px 38px 3px rgba(0, 0, 0, 0.14);-moz-box-shadow:0px 11px 15px 0px rgba(0, 0, 0, 0.2), 0px 9px 46px 8px rgba(0, 0, 0, 0.12), 0px 24px 38px 3px rgba(0, 0, 0, 0.14);box-shadow:0px 11px 15px 0px rgba(0, 0, 0, 0.2), 0px 9px 46px 8px rgba(0, 0, 0, 0.12), 0px 24px 38px 3px rgba(0, 0, 0, 0.14)}wm-modal dialog.wm-modal>wm-modal-header{border-bottom:1px solid var(--wmcolor-modal-border)}wm-modal dialog.wm-modal>wm-modal-footer{border-top:1px solid var(--wmcolor-modal-border)}@media only screen and (max-width: 768px){wm-modal dialog.wm-modal{height:100%;max-height:none;max-width:none;width:100vw}wm-modal dialog.wm-modal>*{max-width:none;width:100vw}wm-modal dialog.wm-modal>*:not(wm-modal-header):not(wm-modal-footer){max-height:none;height:calc(100vh - 166px)}}wm-modal dialog.wm-dialog>:not(wm-modal-header):not(wm-modal-footer):not(.wm-tooltip){padding:0 1.875rem 1.25rem 1.875rem;font-size:0.875rem;border:none}wm-modal wm-modal-header,wm-modal wm-modal-footer{padding:1.25rem 1.875rem;width:100%}wm-modal .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important;top:0;left:0}";var Modal=function(){function t(t){registerInstance(this,t);this.focusLastElement=createEvent(this,"focusLastElement",3);this.focusFirstElement=createEvent(this,"focusFirstElement",3);this.wmModalCloseTriggered=createEvent(this,"wmModalCloseTriggered",3);this.wmModalPrimaryTriggered=createEvent(this,"wmModalPrimaryTriggered",7);this.wmModalSecondaryTriggered=createEvent(this,"wmModalSecondaryTriggered",7);this.open=false;this.elementToFocus="";this.modalType="modal";this.uid=undefined;this.returnFocusEl=undefined}Object.defineProperty(t.prototype,"closeButtonEl",{get:function(){return this.el.querySelector("#wm-modal-close-".concat(this.uid))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"focusOnOpenEl",{get:function(){var t=null;if(this.elementToFocus==="primary"||this.elementToFocus==="secondary"){t=this.el.querySelector("#wm-".concat(this.elementToFocus,"-").concat(this.uid))}else if(this.elementToFocus){t=this.el.querySelector("#"+this.elementToFocus);!t&&console.warn("Ripple Component Library: The modal component couldn't find an element matching the id you passed for 'elementToFocus' (".concat(this.elementToFocus,"). It will fall back to the default and focus the close button when the modal opens."))}return t},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"hasBrowserPopoverSupport",{get:function(){var t=document.getElementById("wm-tooltip");return t?!!t.showPopover:false},enumerable:false,configurable:true});t.prototype.toggleModal=function(){this.open?this.showModal():this.hideModal()};t.prototype.handleDialogClose=function(){if(this.open){this.wmModalCloseTriggered.emit()}this.open=false};t.prototype.showModal=function(){this.returnFocusEl=document.activeElement;this.setAriaDescribedbyOnModal();document.body.style.overflow="hidden";this.dialogEl.showModal();if(this.focusOnOpenEl){this.focusOnOpenEl.focus()}};t.prototype.hideModal=function(){var t=this;document.body.style.overflow="visible";this.dialogEl.close();setTimeout((function(){if(t.returnFocusEl&&document.activeElement===document.body){if(t.returnFocusEl.tagName==="WM-MENUITEM"){t.returnFocusEl=t.returnFocusEl.parentElement}t.returnFocusEl.focus()}}),20)};t.prototype.componentWillLoad=function(){var t=this;if(this.elementToFocus==="primary"||this.elementToFocus==="secondary"){if(!this.el.id){console.error("For accessibility purposes you need to set the modal content wrapper's id to 'content-[id of wm-modal].")}}this.el.focus=function(){if(t.focusOnOpenEl){t.focusOnOpenEl.focus()}else{t.closeButtonEl.focus()}};this.uid=this.el.id?this.el.id:generateId()};t.prototype.componentDidLoad=function(){var t=this;if(this.open){this.showModal()}this.dialogEl.addEventListener("close",(function(){return t.handleDialogClose()}))};t.prototype.emitCloseEvent=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.wmModalCloseTriggered.emit();return[2]}))}))};t.prototype.emitPrimaryEvent=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.wmModalPrimaryTriggered.emit();return[2]}))}))};t.prototype.emitSecondaryEvent=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.wmModalSecondaryTriggered.emit();return[2]}))}))};t.prototype.handleKeyDown=function(t){if(t.key=="Escape"){t.stopPropagation()}};t.prototype.setAriaDescribedbyOnModal=function(){var t=document.getElementById("content-".concat(this.uid));if(!t){console.warn("Ripple Component Library: The element containing the body of the modal must include an id in the format 'content-[id of modal]' for accessibility purposes.")}else{this.el.setAttribute("aria-describedby","wm-modal-heading-text-".concat(this.uid," content-").concat(this.uid))}};t.prototype.render=function(){var t=this;return h("dialog",{class:"".concat("wm-"+this.modalType),ref:function(o){return t.dialogEl=o},onKeyDown:function(o){return t.handleKeyDown(o)}},h("div",{class:"tabtrap sr-only",tabindex:"0",onFocus:function(o){var e=o.relatedTarget&&o.relatedTarget==t.closeButtonEl;e?t.focusLastElement.emit():t.focusFirstElement.emit()}}),!this.hasBrowserPopoverSupport&&h("div",{class:"wm-tooltip"}),h("slot",null),h("div",{class:"tabtrap sr-only",tabindex:"0",onFocus:function(){t.focusFirstElement.emit()}}))};Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{open:["toggleModal"]}},enumerable:false,configurable:true});return t}();Modal.style=wmModalCss;export{Modal as wm_modal};
@@ -1 +1 @@
1
- import{r as registerInstance,c as createEvent,h,H as Host,g as getElement,f as forceUpdate}from"./index-f164fbca.js";import{i as intl,z as throttle,h as hideTooltip,s as showTooltip}from"./functions-f65dbb96.js";import{g as globalMessages}from"./intl-f7f77de7.js";var wmNavigationCss=":host{--wmcolor-navigation-background-hover:var(--wmcolor-interactive-background-hover);--wmcolor-navigation-background-selected:var(--wmcolor-background-selected);--wmcolor-navigation-background:var(--wmcolor-background);--wmcolor-navigation-border-selected:var(--wmcolor-interactive);--wmcolor-navigation-focus:var(--wmcolor-interactive-focus);--wmcolor-navigation-icon-selected:var(--wmcolor-interactive);--wmcolor-navigation-icon:var(--wmcolor-icon);--wmcolor-navigation-text-selected:var(--wmcolor-interactive);z-index:10}:host([aria-expanded=true]){z-index:5000}.tray{-webkit-box-shadow:0 0 14px 0 rgba(0, 0, 0, 0.14);-moz-box-shadow:0 0 14px 0 rgba(0, 0, 0, 0.14);box-shadow:0 0 14px 0 rgba(0, 0, 0, 0.14);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;width:7.5625rem;background-color:var(--wmcolor-navigation-background);overflow-x:hidden;overflow-y:auto;-webkit-overflow-scrolling:touch;font-size:0.875rem;height:100%}.navlist{margin:0;padding:0}.toggle-wrapper{display:none}@media screen and (max-width: 1023px){.tray{-ms-transition:transform 0.33s ease;-webkit-transition:transform 0.33s ease;-moz-transition:transform 0.33s ease;-webkit-transition:-webkit-transform 0.33s ease;transition:-webkit-transform 0.33s ease;transition:transform 0.33s ease;transition:transform 0.33s ease, -webkit-transform 0.33s ease;position:fixed;top:0;bottom:0;left:0;-webkit-transform:translateX(-100%);transform:translateX(-100%)}.tray ul{visibility:hidden}.tray .toggle-wrapper{display:inline-block;min-height:5rem;width:100%;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}:host([aria-expanded=true]) .tray{-webkit-transform:translateX(0);transform:translateX(0)}:host([aria-expanded=true]) .tray ul{visibility:visible}.overlay{width:100vw;height:100vh;max-width:none;max-height:none;position:fixed !important;top:0;bottom:0;left:0;right:0;-webkit-transform:translate(0%, 0%);transform:translate(0%, 0%);background-color:rgba(25, 25, 25, 0.4);-ms-transition:opacity 0.5s ease-out;-webkit-transition:opacity 0.5s ease-out;-moz-transition:opacity 0.5s ease-out;transition:opacity 0.5s ease-out}}";var Navigation=function(){function t(t){var i=this;registerInstance(this,t);this.wmNavigationStateChanged=createEvent(this,"wmNavigationStateChanged",7);this.mainNavigationMessage=intl.formatMessage({id:"navigation.mainNavigation",defaultMessage:"Main",description:"Label describing the site navigation, for screen reader users"});this.throttledRerender=throttle((function(){return forceUpdate(i.el)}),50);this.open=false}Object.defineProperty(t.prototype,"isCollapsible",{get:function(){return window.innerWidth<1024},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"ariaExpanded",{get:function(){return this.isCollapsible?this.open.toString():undefined},enumerable:false,configurable:true});t.prototype.closeOnEscape=function(t){if(t.key==="Escape"){this.open=false}};t.prototype.handleWindowResize=function(){this.throttledRerender()};t.prototype.handleHamburgerClicked=function(){this.open=!this.open};t.prototype.handleClickOnItem=function(){this.open=false};t.prototype.handleStateChange=function(){if(this.isCollapsible){this.wmNavigationStateChanged.emit();this.open?this.expand():this.collapse()}};t.prototype.componentWillLoad=function(){var t=this;this.el.focus=function(){var i=t.open?t.el.shadowRoot.querySelector(".toggle"):document.querySelector("wm-navigation-hamburger");var e=t.el.querySelector("wm-navigation-item");t.isCollapsible?i.focus():e.focus()};if(this.isCollapsible&&this.open){this.wmNavigationStateChanged.emit();this.expand()}};t.prototype.redirectFocusFromBody=function(t){if(document.activeElement.tagName==="BODY"&&!t.relatedTarget){this.el.focus()}};t.prototype.expand=function(){var t=this;document.body.tabIndex=0;document.body.addEventListener("focus",this.redirectFocusFromBody.bind(this),true);setTimeout((function(){return t.toggleEl.focus()}),250)};t.prototype.collapse=function(){document.body.tabIndex=-1;document.body.removeEventListener("focus",this.redirectFocusFromBody.bind(this));var t=document.querySelector("wm-navigation-hamburger");if(t)t.focus()};t.prototype.focusLastItem=function(){var t=this.el.querySelectorAll("wm-navigation-item");var i=Array.from(t).pop();i.focus()};t.prototype.renderOverlay=function(){var t=this;return h("div",{class:"overlay",onClick:function(){t.open=false}})};t.prototype.render=function(){var t=this;return h(Host,{role:"navigation","aria-expanded":this.ariaExpanded,"aria-label":this.mainNavigationMessage},this.open?this.renderOverlay():"",this.isCollapsible&&h("div",{class:"trapfocus",tabindex:this.open?0:undefined,onFocus:function(){return t.focusLastItem()}}),h("div",{class:"tray"},h("div",{class:"toggle-wrapper"},h("wm-button",{ref:function(i){return t.toggleEl=i},class:"toggle","button-type":"navigational",icon:this.open?"f156":"f35c","icon-size":"2rem",tooltip:this.open?globalMessages.close:globalMessages.open,"tooltip-position":"right",tabIndex:this.open?undefined:-1,onClick:function(){t.open=!t.open}})),h("ul",{class:"navlist"},h("slot",null))),this.isCollapsible&&h("div",{class:"trapfocus",tabindex:this.open?0:undefined,onFocus:function(){return t.toggleEl.focus()}}))};Object.defineProperty(t,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{open:["handleStateChange"]}},enumerable:false,configurable:true});return t}();Navigation.style=wmNavigationCss;var wmNavigationHamburgerCss='button{--wmcolor-navigation-hamburger-background-hover:var(--wmcolor-interactive-background-hover);--wmcolor-navigation-hamburger-icon:var(--wmcolor-interactive);display:none;width:100%;height:100%;border:none;-webkit-box-shadow:none;box-shadow:none;-webkit-transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1);transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1);background-color:transparent;outline:none;padding:0}button:focus-visible{outline:3px solid var(--wmcolor-interactive-focus);outline-offset:0}button:hover{background-color:var(--wmcolor-navigation-hamburger-background-hover)}.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:"\\f35c";font-size:1.5rem;color:var(--wmcolor-navigation-hamburger-icon)}@media screen and (max-width: 1023px){:host{width:3.75rem;height:3.75rem}button{display:initial}}';var NavigationHamburger=function(){function t(t){registerInstance(this,t);this.wmNavigationHamburgerClicked=createEvent(this,"wmNavigationHamburgerClicked",7);this.showNavMessage=intl.formatMessage({id:"navigation.showNavigation",defaultMessage:"Show navigation",description:"For user interface element opening a navigation menu"});this.navId=undefined;this.isTabbing=false;this.open=false}t.prototype.toggleTabbingOn=function(){this.isTabbing=true};t.prototype.toggleTabbingOff=function(){this.isTabbing=false};t.prototype.handleNavigationStateChanged=function(t){this.open=t.target.open};t.prototype.componentWillLoad=function(){if(document.body.classList.contains("wmcl-user-is-tabbing")){this.toggleTabbingOn()}if(!this.navId){console.error("wm-navigation-hamburger: nav-id is a required prop")}};t.prototype.handleClick=function(){hideTooltip();this.wmNavigationHamburgerClicked.emit()};t.prototype.render=function(){var t=this;return h(Host,{class:"hamburger ".concat(this.open?"nav-open":"nav-closed")},h("button",{"aria-expanded":this.open,"aria-label":this.showNavMessage,onMouseEnter:function(){return showTooltip("right",t.el,t.showNavMessage)},onMouseLeave:function(){return hideTooltip()},onFocus:function(){return t.isTabbing&&showTooltip("right",t.el,t.showNavMessage)},onBlur:function(){return hideTooltip()},onClick:function(){return t.handleClick()}},h("span",{class:"icon"})))};Object.defineProperty(t,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();NavigationHamburger.style=wmNavigationHamburgerCss;var wmNavigationItemCss='.link{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;color:inherit;text-decoration:none;min-height:4.5rem;text-align:center;padding:1.25rem 0.5rem;font-weight:500;outline:none;position:relative;background:var(--wmcolor-navigation-background)}.link:hover{background-color:var(--wmcolor-navigation-background-hover)}.link .icon{font-size:1.375rem;color:var(--wmcolor-navigation-icon)}.link .text{font-size:0.875rem}.link:focus-visible{outline:3px solid var(--wmcolor-interactive-focus);outline-offset:-3px}.link.active{background-color:var(--wmcolor-navigation-background-selected)}.link.active:before{content:"";background-color:var(--wmcolor-navigation-border-selected);position:absolute;height:100%;width:5px;left:0}.link.active .text{color:var(--wmcolor-navigation-text-selected)}.link.active .icon{color:var(--wmcolor-navigation-icon-selected)}';var NavigationItem=function(){function t(t){registerInstance(this,t);this.wmNavigationItemClicked=createEvent(this,"wmNavigationItemClicked",7);this.href=undefined;this.text=undefined;this.active=undefined}t.prototype.render=function(){var t=this;return h(Host,{role:"listitem"},h("a",{class:"link ".concat(this.active?"active":""),href:this.href,onClick:function(){return t.wmNavigationItemClicked.emit()}},h("div",{class:"icon","aria-hidden":"true"},h("slot",null)),h("div",{class:"text"},this.text)))};Object.defineProperty(t,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();NavigationItem.style=wmNavigationItemCss;export{Navigation as wm_navigation,NavigationHamburger as wm_navigation_hamburger,NavigationItem as wm_navigation_item};
1
+ import{r as registerInstance,c as createEvent,h,H as Host,g as getElement,f as forceUpdate}from"./index-558b5a82.js";import{i as intl,z as throttle,h as hideTooltip,s as showTooltip}from"./functions-46843ea0.js";import{g as globalMessages}from"./intl-8b8740b9.js";var wmNavigationCss=":host{--wmcolor-navigation-background-hover:var(--wmcolor-interactive-background-hover);--wmcolor-navigation-background-selected:var(--wmcolor-background-selected);--wmcolor-navigation-background:var(--wmcolor-background);--wmcolor-navigation-border-selected:var(--wmcolor-interactive);--wmcolor-navigation-focus:var(--wmcolor-interactive-focus);--wmcolor-navigation-icon-selected:var(--wmcolor-interactive);--wmcolor-navigation-icon:var(--wmcolor-icon);--wmcolor-navigation-text-selected:var(--wmcolor-interactive);z-index:10}:host([aria-expanded=true]){z-index:5000}.tray{-webkit-box-shadow:0 0 14px 0 rgba(0, 0, 0, 0.14);-moz-box-shadow:0 0 14px 0 rgba(0, 0, 0, 0.14);box-shadow:0 0 14px 0 rgba(0, 0, 0, 0.14);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;width:7.5625rem;background-color:var(--wmcolor-navigation-background);overflow-x:hidden;overflow-y:auto;-webkit-overflow-scrolling:touch;font-size:0.875rem;height:100%}.navlist{margin:0;padding:0}.toggle-wrapper{display:none}@media screen and (max-width: 1023px){.tray{-ms-transition:transform 0.33s ease;-webkit-transition:transform 0.33s ease;-moz-transition:transform 0.33s ease;-webkit-transition:-webkit-transform 0.33s ease;transition:-webkit-transform 0.33s ease;transition:transform 0.33s ease;transition:transform 0.33s ease, -webkit-transform 0.33s ease;position:fixed;top:0;bottom:0;left:0;-webkit-transform:translateX(-100%);transform:translateX(-100%)}.tray ul{visibility:hidden}.tray .toggle-wrapper{display:inline-block;min-height:5rem;width:100%;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}:host([aria-expanded=true]) .tray{-webkit-transform:translateX(0);transform:translateX(0)}:host([aria-expanded=true]) .tray ul{visibility:visible}.overlay{width:100vw;height:100vh;max-width:none;max-height:none;position:fixed !important;top:0;bottom:0;left:0;right:0;-webkit-transform:translate(0%, 0%);transform:translate(0%, 0%);background-color:rgba(25, 25, 25, 0.4);-ms-transition:opacity 0.5s ease-out;-webkit-transition:opacity 0.5s ease-out;-moz-transition:opacity 0.5s ease-out;transition:opacity 0.5s ease-out}}";var Navigation=function(){function t(t){var i=this;registerInstance(this,t);this.wmNavigationStateChanged=createEvent(this,"wmNavigationStateChanged",7);this.mainNavigationMessage=intl.formatMessage({id:"navigation.mainNavigation",defaultMessage:"Main",description:"Label describing the site navigation, for screen reader users"});this.throttledRerender=throttle((function(){return forceUpdate(i.el)}),50);this.open=false}Object.defineProperty(t.prototype,"isCollapsible",{get:function(){return window.innerWidth<1024},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"ariaExpanded",{get:function(){return this.isCollapsible?this.open.toString():undefined},enumerable:false,configurable:true});t.prototype.closeOnEscape=function(t){if(t.key==="Escape"){this.open=false}};t.prototype.handleWindowResize=function(){this.throttledRerender()};t.prototype.handleHamburgerClicked=function(){this.open=!this.open};t.prototype.handleClickOnItem=function(){this.open=false};t.prototype.handleStateChange=function(){if(this.isCollapsible){this.wmNavigationStateChanged.emit();this.open?this.expand():this.collapse()}};t.prototype.componentWillLoad=function(){var t=this;this.el.focus=function(){var i=t.open?t.el.shadowRoot.querySelector(".toggle"):document.querySelector("wm-navigation-hamburger");var e=t.el.querySelector("wm-navigation-item");t.isCollapsible?i.focus():e.focus()};if(this.isCollapsible&&this.open){this.wmNavigationStateChanged.emit();this.expand()}};t.prototype.redirectFocusFromBody=function(t){if(document.activeElement.tagName==="BODY"&&!t.relatedTarget){this.el.focus()}};t.prototype.expand=function(){var t=this;document.body.tabIndex=0;document.body.addEventListener("focus",this.redirectFocusFromBody.bind(this),true);setTimeout((function(){return t.toggleEl.focus()}),250)};t.prototype.collapse=function(){document.body.tabIndex=-1;document.body.removeEventListener("focus",this.redirectFocusFromBody.bind(this));var t=document.querySelector("wm-navigation-hamburger");if(t)t.focus()};t.prototype.focusLastItem=function(){var t=this.el.querySelectorAll("wm-navigation-item");var i=Array.from(t).pop();i.focus()};t.prototype.renderOverlay=function(){var t=this;return h("div",{class:"overlay",onClick:function(){t.open=false}})};t.prototype.render=function(){var t=this;return h(Host,{role:"navigation","aria-expanded":this.ariaExpanded,"aria-label":this.mainNavigationMessage},this.open?this.renderOverlay():"",this.isCollapsible&&h("div",{class:"trapfocus",tabindex:this.open?0:undefined,onFocus:function(){return t.focusLastItem()}}),h("div",{class:"tray"},h("div",{class:"toggle-wrapper"},h("wm-button",{ref:function(i){return t.toggleEl=i},class:"toggle","button-type":"navigational",icon:this.open?"f156":"f35c","icon-size":"2rem",tooltip:this.open?globalMessages.close:globalMessages.open,"tooltip-position":"right",tabIndex:this.open?undefined:-1,onClick:function(){t.open=!t.open}})),h("ul",{class:"navlist"},h("slot",null))),this.isCollapsible&&h("div",{class:"trapfocus",tabindex:this.open?0:undefined,onFocus:function(){return t.toggleEl.focus()}}))};Object.defineProperty(t,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{open:["handleStateChange"]}},enumerable:false,configurable:true});return t}();Navigation.style=wmNavigationCss;var wmNavigationHamburgerCss='button{--wmcolor-navigation-hamburger-background-hover:var(--wmcolor-interactive-background-hover);--wmcolor-navigation-hamburger-icon:var(--wmcolor-interactive);display:none;width:100%;height:100%;border:none;-webkit-box-shadow:none;box-shadow:none;-webkit-transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1);transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1);background-color:transparent;outline:none;padding:0}button:focus-visible{outline:3px solid var(--wmcolor-interactive-focus);outline-offset:0}button:hover{background-color:var(--wmcolor-navigation-hamburger-background-hover)}.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:"\\f35c";font-size:1.5rem;color:var(--wmcolor-navigation-hamburger-icon)}@media screen and (max-width: 1023px){:host{width:3.75rem;height:3.75rem}button{display:initial}}';var NavigationHamburger=function(){function t(t){registerInstance(this,t);this.wmNavigationHamburgerClicked=createEvent(this,"wmNavigationHamburgerClicked",7);this.showNavMessage=intl.formatMessage({id:"navigation.showNavigation",defaultMessage:"Show navigation",description:"For user interface element opening a navigation menu"});this.navId=undefined;this.isTabbing=false;this.open=false}t.prototype.toggleTabbingOn=function(){this.isTabbing=true};t.prototype.toggleTabbingOff=function(){this.isTabbing=false};t.prototype.handleNavigationStateChanged=function(t){this.open=t.target.open};t.prototype.componentWillLoad=function(){if(document.body.classList.contains("wmcl-user-is-tabbing")){this.toggleTabbingOn()}if(!this.navId){console.error("wm-navigation-hamburger: nav-id is a required prop")}};t.prototype.handleClick=function(){hideTooltip();this.wmNavigationHamburgerClicked.emit()};t.prototype.render=function(){var t=this;return h(Host,{class:"hamburger ".concat(this.open?"nav-open":"nav-closed")},h("button",{"aria-expanded":this.open,"aria-label":this.showNavMessage,onMouseEnter:function(){return showTooltip("right",t.el,t.showNavMessage)},onMouseLeave:function(){return hideTooltip()},onFocus:function(){return t.isTabbing&&showTooltip("right",t.el,t.showNavMessage)},onBlur:function(){return hideTooltip()},onClick:function(){return t.handleClick()}},h("span",{class:"icon"})))};Object.defineProperty(t,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();NavigationHamburger.style=wmNavigationHamburgerCss;var wmNavigationItemCss='.link{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;color:inherit;text-decoration:none;min-height:4.5rem;text-align:center;padding:1.25rem 0.5rem;font-weight:500;outline:none;position:relative;background:var(--wmcolor-navigation-background)}.link:hover{background-color:var(--wmcolor-navigation-background-hover)}.link .icon{font-size:1.375rem;color:var(--wmcolor-navigation-icon)}.link .text{font-size:0.875rem}.link:focus-visible{outline:3px solid var(--wmcolor-interactive-focus);outline-offset:-3px}.link.active{background-color:var(--wmcolor-navigation-background-selected)}.link.active:before{content:"";background-color:var(--wmcolor-navigation-border-selected);position:absolute;height:100%;width:5px;left:0}.link.active .text{color:var(--wmcolor-navigation-text-selected)}.link.active .icon{color:var(--wmcolor-navigation-icon-selected)}';var NavigationItem=function(){function t(t){registerInstance(this,t);this.wmNavigationItemClicked=createEvent(this,"wmNavigationItemClicked",7);this.href=undefined;this.text=undefined;this.active=undefined}t.prototype.render=function(){var t=this;return h(Host,{role:"listitem"},h("a",{class:"link ".concat(this.active?"active":""),href:this.href,onClick:function(){return t.wmNavigationItemClicked.emit()}},h("div",{class:"icon","aria-hidden":"true"},h("slot",null)),h("div",{class:"text"},this.text)))};Object.defineProperty(t,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();NavigationItem.style=wmNavigationItemCss;export{Navigation as wm_navigation,NavigationHamburger as wm_navigation_hamburger,NavigationItem as wm_navigation_item};
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(t,r,e,i){function n(t){return t instanceof e?t:new e((function(r){r(t)}))}return new(e||(e=Promise))((function(e,a){function o(t){try{c(i.next(t))}catch(t){a(t)}}function s(t){try{c(i["throw"](t))}catch(t){a(t)}}function c(t){t.done?e(t.value):n(t.value).then(o,s)}c((i=i.apply(t,r||[])).next())}))};var __generator=this&&this.__generator||function(t,r){var e={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,n,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(t){return function(r){return c([t,r])}}function c(s){if(i)throw new TypeError("Generator is already executing.");while(o&&(o=0,s[0]&&(e=0)),e)try{if(i=1,n&&(a=s[0]&2?n["return"]:s[0]?n["throw"]||((a=n["return"])&&a.call(n),0):n.next)&&!(a=a.call(n,s[1])).done)return a;if(n=0,a)s=[s[0]&2,a.value];switch(s[0]){case 0:case 1:a=s;break;case 4:e.label++;return{value:s[1],done:false};case 5:e.label++;n=s[1];s=[0];continue;case 7:s=e.ops.pop();e.trys.pop();continue;default:if(!(a=e.trys,a=a.length>0&&a[a.length-1])&&(s[0]===6||s[0]===2)){e=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){e.label=s[1];break}if(s[0]===6&&e.label<a[1]){e.label=a[1];a=s;break}if(a&&e.label<a[2]){e.label=a[2];e.ops.push(s);break}if(a[2])e.ops.pop();e.trys.pop();continue}s=r.call(t,e)}catch(t){s=[6,t];n=0}finally{i=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-f164fbca.js";import{a as getWmMode}from"./interfaces-cc5b177f.js";import{n as snakeCaseToCamelCase,o as getNewIndexToFocus,i as intl}from"./functions-f65dbb96.js";var getRequest=function(t){return __awaiter(void 0,void 0,void 0,(function(){var r;return __generator(this,(function(e){switch(e.label){case 0:return[4,fetch(t)];case 1:r=e.sent();if(!(!!r&&!!r.ok))return[3,3];return[4,r.json()];case 2:return[2,e.sent()];case 3:throw new Error(r.statusText)}}))}))};var wmNavigatorCss=":host{--wmcolor-navigator-background:var(--wmcolor-background);--wmcolor-navigator-header-background:var(--wmcolor-brand-dark);--wmcolor-navigator-header-text:var(--wmcolor-text-ondark);--wmcolor-navigator-item-background-focus:var(--wmcolor-interactive-background-focus);--wmcolor-navigator-item-background-hover:var(--wmcolor-interactive-background-hover);--wmcolor-navigator-item-background:var(--wmcolor-background);--wmcolor-navigator-item-border:var(--wmcolor-border);--wmcolor-navigator-item-text:var(--wmcolor-text);--wmcolor-navigator-user-background:var(--wmcolor-background-readonly);min-width:0;position:relative;display:inline-block}:host .wrapper{overflow:auto;font-size:1.125rem;min-width:13.125rem;width:auto;max-height:80vh;text-align:left;position:absolute;z-index:50;top:100%;right:20px;left:auto;background:var(--wmcolor-navigator-background);letter-spacing:normal;-webkit-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-moz-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-ms-transition:transform 0.25s ease;-webkit-transition:transform 0.25s ease;-moz-transition:transform 0.25s ease;-webkit-transition:-webkit-transform 0.25s ease;transition:-webkit-transform 0.25s ease;transition:transform 0.25s ease;transition:transform 0.25s ease, -webkit-transform 0.25s ease;-ms-transform-origin:center top;-webkit-transform-origin:center top;-moz-transform-origin:center top;transform-origin:center top;-ms-transform:scale(1, 1);-webkit-transform:scale(1, 1);-moz-transform:scale(1, 1);transform:scale(1, 1)}:host .wrapper .user{background:var(--wmcolor-navigator-user-background);padding:0.625rem 1.25rem;font-size:0.875rem}:host .wrapper .user p{margin:0}:host .wrapper .user p:first-child{font-weight:700;text-transform:capitalize}:host .wrapper h2{background:var(--wmcolor-navigator-header-background);color:var(--wmcolor-navigator-header-text);font-weight:700;margin:0;padding:0.625rem 1.25rem;font-size:0.875rem}:host .wrapper [role=listbox]{list-style:none;margin:0;padding-left:0}:host .wrapper.hide{-ms-transform:scale(1, 0);-webkit-transform:scale(1, 0);-moz-transform:scale(1, 0);transform:scale(1, 0)}:host .wrapper.right{right:auto;left:20px}:host img{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:left center;transform-origin:left center;display:block}:host .logout{text-align:center;text-transform:capitalize}priv-navigator-item:focus{outline:none}";var Navigator=function(){function t(t){registerInstance(this,t);this.wmNavigatorLogout=createEvent(this,"wmNavigatorLogout",7);this.retrievedInfo=!this.loadFromUserinfo;this.parsedProducts=[];this.openRight=false;this.userName=undefined;this.email=undefined;this.authType=1;this.connectionName=undefined;this.logoutUrl=undefined;this.products=undefined;this.loadFromUserinfo=false;this.isOpen=false;this.itemIndexToFocus=0}t.prototype.isSafeUrl=function(t){var r=false;var e=["digitalmeasures\\.com","evalkit\\.info","evaluationkit\\.com","evaluationkit\\.info","lat_ams\\.com","livetext\\.com","smartcatalogiq\\.com","smartcatalogiq\\.net","smartcatalogiq\\.us","taskstream\\.com","vialivetext\\.com","watermarkinsights\\.com"];e.forEach((function(e){var i="^https://(.*.)?".concat(e,"(/.*)?$");if(!!t&&t.match(i)){r=true}}));return r};t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:if(!this.userName){console.error("wm-navigator: user-name is a required property.")}return[4,this.parseData()];case 1:t.sent();this.setFocusIndex();return[2]}}))}))};t.prototype.parseData=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(r){switch(r.label){case 0:if(!!!this.loadFromUserinfo)return[3,2];return[4,getRequest("/platform/navigator/userinfo").then((function(r){t.email=r.email;t.currentProductId=r.current_product_id;t.parsedProducts=t.productKeysToCamelCase(r.products);t.logoutUrl=t.logoutUrl?t.logoutUrl:r.logout_url;t.connectionName=t.connectionName?t.connectionName:r.connection_name;if(!!t.email&&!!t.currentProductId){t.retrievedInfo=true}})).catch((function(t){console.error(t)}))];case 1:r.sent();return[3,3];case 2:this.currentProductId=getWmMode(this.el);if(!!this.products){if(typeof this.products==="string"){this.parsedProducts=JSON.parse(this.products)}else{this.parsedProducts=this.products}this.parsedProducts=this.productKeysToCamelCase(this.parsedProducts)}r.label=3;case 3:this.parsedProducts.sort((function(t,r){return t.name<r.name?-1:1}));return[2]}}))}))};t.prototype.productKeysToCamelCase=function(t){t=t.map((function(t){var r=Object.keys(t);var e={};r.forEach((function(r){e[snakeCaseToCamelCase(r)]=t[r]}));return e}));return t};t.prototype.setFocusIndex=function(){if(this.parsedProducts.length>1){var t=this.getProduct(this.currentProductId);if(t){this.itemIndexToFocus=this.parsedProducts.indexOf(t)}}};t.prototype.handleKeys=function(t){switch(t.key){case"Escape":t.preventDefault();this.closeMenu();break;case"ArrowDown":case"ArrowUp":t.preventDefault();if(!this.isOpen){this.itemIndexToFocus=getNewIndexToFocus(this.itemIndexToFocus,t.key,this.navigatorItems.length);this.openMenu()}break}};t.prototype.handleKeydown=function(t){var r=t.detail.key;var e=t.detail.navItem;switch(r){case"Tab":this.closeMenu(false);break;case"Enter":case" ":e.click();break;case"ArrowDown":case"ArrowUp":var i=this.itemIndexToFocus;this.itemIndexToFocus=getNewIndexToFocus(this.itemIndexToFocus,r,this.navigatorItems.length);this.focusItem();this.unfocusItem(i);break}};t.prototype.handleClick=function(t){var r=t.target===this.el||this.el.contains(t.target);if(!r&&this.isOpen){this.closeMenu(false)}};t.prototype.handleButtonClick=function(){this.isOpen?this.closeMenu():this.openMenu()};t.prototype.openMenu=function(){if(this.wrapperEl){var t=this.wrapperEl.clientWidth;var r=this.el.getBoundingClientRect().left;var e=document.documentElement.clientWidth-this.el.getBoundingClientRect().right;this.openRight=t>r&&e>r}this.isOpen=true;this.focusItem()};t.prototype.closeMenu=function(t){var r=this;if(t===void 0){t=true}this.isOpen=false;window.requestAnimationFrame((function(){r.unfocusItem(r.itemIndexToFocus);r.setFocusIndex();if(t){r.buttonFocusHandler()}}))};t.prototype.focusItem=function(){var t=this.navigatorItems[this.itemIndexToFocus];t.tabIndex=0;t.focused=true;window.requestAnimationFrame((function(){return t.focus()}))};t.prototype.unfocusItem=function(t){var r=this.navigatorItems[t];r.tabIndex=-1;r.focused=false};t.prototype.buttonFocusHandler=function(){var t=this.el.shadowRoot.querySelector("priv-navigator-button");var r=t.shadowRoot.querySelector("button");r.focus()};t.prototype.renderUserInfo=function(){return h("div",{class:"user",id:"wm-nav-user","aria-label":intl.formatMessage({id:"navigator.userinfoLabel",defaultMessage:"for {name}, email {email}"},{name:this.userName,email:this.email})},h("p",null,this.userName),h("p",null,this.email))};t.prototype.setAltText=function(){if(this.parsedProducts.length>1){return intl.formatMessage({id:"navigator.userinfoAndProductNavigator",defaultMessage:"User information and product navigator"})}else{return intl.formatMessage({id:"navigator.userinfo",defaultMessage:"User information"})}};t.prototype.renderHeading=function(){return h("h2",null,intl.formatMessage({id:"navigator.watermarkApps",defaultMessage:"Watermark Apps",description:"Applications made by Watermark Insights"}))};t.prototype.renderList=function(){return h("ul",{role:"listbox","aria-label":"".concat(intl.formatMessage({id:"navigator.WatermarkAppNavigation",defaultMessage:"Watermark App Navigation",description:"list of applications by Watermark Insights"})),"aria-describedby":"wm-nav-user"},this.parsedProducts.length>1&&this.renderProductOptions(),this.renderLogoutOption())};t.prototype.renderProductOptions=function(){var t=this;return this.parsedProducts.map((function(r){var e,i,n,a;e=r.name;i=r.iconUrl;a=t.setProductOnClick(r.id);if(!!e&&!!i){n=t.currentProductId===r.id;return h("priv-navigator-item",{selected:n,id:r.id,onClick:a,role:"option","aria-label":e},h("img",{src:i,alt:e}))}}))};t.prototype.setProductOnClick=function(t){var r=this.getProduct(t);if(this.currentProductId===t){return function(){}}else if(r){if(!!this.loadFromUserinfo||this.authType===2){var e=r.linkUrl;if(this.isSafeUrl(e)){return function(){return window.location.href=e}}else{console.error('"'.concat(e,'" is not a safe url'));return}}else if(this.authType===3){var i=this.connectionName?"/?connection_name=".concat(this.connectionName):"";var n=r.samlLinkUrl;if(this.isSafeUrl(n)){return function(){return window.location.href=n+i}}else{console.error('"'.concat(n,'" is not a safe url'));return}}}};t.prototype.renderLogoutOption=function(){return h("priv-navigator-item",{class:"logout",selected:!(this.parsedProducts.length>1),id:"nav-logout",onClick:this.setLogoutOnclick(),role:"option"},h("span",{class:"logout"},intl.formatMessage({id:"navigator.logout",defaultMessage:"Log Out"})))};t.prototype.setLogoutOnclick=function(){var t=this;return function(){t.wmNavigatorLogout.emit();var r=t.logoutUrl;if(t.isSafeUrl(r)){window.location.href=r}else{console.error('"'.concat(r,'" is not a safe url'))}}};Object.defineProperty(t.prototype,"navigatorItems",{get:function(){return Array.from(this.el.shadowRoot.querySelectorAll("priv-navigator-item"))},enumerable:false,configurable:true});t.prototype.getProduct=function(t){return this.parsedProducts.find((function(r){return r.id===t}))};t.prototype.render=function(){var t=this;return this.retrievedInfo?h(Host,null,h("priv-navigator-button",{expanded:this.isOpen,altText:this.setAltText()}),h("div",{class:"wrapper ".concat(this.isOpen?"":"hide"," ").concat(this.openRight?"right":""),ref:function(r){return t.wrapperEl=r}},this.renderUserInfo(),this.parsedProducts.length>1&&this.renderHeading(),this.renderList())):""};Object.defineProperty(t,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{products:["parseData"]}},enumerable:false,configurable:true});return t}();Navigator.style=wmNavigatorCss;export{Navigator as wm_navigator};
1
+ var __awaiter=this&&this.__awaiter||function(t,r,e,i){function n(t){return t instanceof e?t:new e((function(r){r(t)}))}return new(e||(e=Promise))((function(e,a){function o(t){try{c(i.next(t))}catch(t){a(t)}}function s(t){try{c(i["throw"](t))}catch(t){a(t)}}function c(t){t.done?e(t.value):n(t.value).then(o,s)}c((i=i.apply(t,r||[])).next())}))};var __generator=this&&this.__generator||function(t,r){var e={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,n,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(t){return function(r){return c([t,r])}}function c(s){if(i)throw new TypeError("Generator is already executing.");while(o&&(o=0,s[0]&&(e=0)),e)try{if(i=1,n&&(a=s[0]&2?n["return"]:s[0]?n["throw"]||((a=n["return"])&&a.call(n),0):n.next)&&!(a=a.call(n,s[1])).done)return a;if(n=0,a)s=[s[0]&2,a.value];switch(s[0]){case 0:case 1:a=s;break;case 4:e.label++;return{value:s[1],done:false};case 5:e.label++;n=s[1];s=[0];continue;case 7:s=e.ops.pop();e.trys.pop();continue;default:if(!(a=e.trys,a=a.length>0&&a[a.length-1])&&(s[0]===6||s[0]===2)){e=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){e.label=s[1];break}if(s[0]===6&&e.label<a[1]){e.label=a[1];a=s;break}if(a&&e.label<a[2]){e.label=a[2];e.ops.push(s);break}if(a[2])e.ops.pop();e.trys.pop();continue}s=r.call(t,e)}catch(t){s=[6,t];n=0}finally{i=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-558b5a82.js";import{a as getWmMode}from"./interfaces-cc5b177f.js";import{n as snakeCaseToCamelCase,o as getNewIndexToFocus,i as intl}from"./functions-46843ea0.js";var getRequest=function(t){return __awaiter(void 0,void 0,void 0,(function(){var r;return __generator(this,(function(e){switch(e.label){case 0:return[4,fetch(t)];case 1:r=e.sent();if(!(!!r&&!!r.ok))return[3,3];return[4,r.json()];case 2:return[2,e.sent()];case 3:throw new Error(r.statusText)}}))}))};var wmNavigatorCss=":host{--wmcolor-navigator-background:var(--wmcolor-background);--wmcolor-navigator-header-background:var(--wmcolor-brand-dark);--wmcolor-navigator-header-text:var(--wmcolor-text-ondark);--wmcolor-navigator-item-background-focus:var(--wmcolor-interactive-background-focus);--wmcolor-navigator-item-background-hover:var(--wmcolor-interactive-background-hover);--wmcolor-navigator-item-background:var(--wmcolor-background);--wmcolor-navigator-item-border:var(--wmcolor-border);--wmcolor-navigator-item-text:var(--wmcolor-text);--wmcolor-navigator-user-background:var(--wmcolor-background-readonly);min-width:0;position:relative;display:inline-block}:host .wrapper{overflow:auto;font-size:1.125rem;min-width:13.125rem;width:auto;max-height:80vh;text-align:left;position:absolute;z-index:50;top:100%;right:20px;left:auto;background:var(--wmcolor-navigator-background);letter-spacing:normal;-webkit-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-moz-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-ms-transition:transform 0.25s ease;-webkit-transition:transform 0.25s ease;-moz-transition:transform 0.25s ease;-webkit-transition:-webkit-transform 0.25s ease;transition:-webkit-transform 0.25s ease;transition:transform 0.25s ease;transition:transform 0.25s ease, -webkit-transform 0.25s ease;-ms-transform-origin:center top;-webkit-transform-origin:center top;-moz-transform-origin:center top;transform-origin:center top;-ms-transform:scale(1, 1);-webkit-transform:scale(1, 1);-moz-transform:scale(1, 1);transform:scale(1, 1)}:host .wrapper .user{background:var(--wmcolor-navigator-user-background);padding:0.625rem 1.25rem;font-size:0.875rem}:host .wrapper .user p{margin:0}:host .wrapper .user p:first-child{font-weight:700;text-transform:capitalize}:host .wrapper h2{background:var(--wmcolor-navigator-header-background);color:var(--wmcolor-navigator-header-text);font-weight:700;margin:0;padding:0.625rem 1.25rem;font-size:0.875rem}:host .wrapper [role=listbox]{list-style:none;margin:0;padding-left:0}:host .wrapper.hide{-ms-transform:scale(1, 0);-webkit-transform:scale(1, 0);-moz-transform:scale(1, 0);transform:scale(1, 0)}:host .wrapper.right{right:auto;left:20px}:host img{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:left center;transform-origin:left center;display:block}:host .logout{text-align:center;text-transform:capitalize}priv-navigator-item:focus{outline:none}";var Navigator=function(){function t(t){registerInstance(this,t);this.wmNavigatorLogout=createEvent(this,"wmNavigatorLogout",7);this.retrievedInfo=!this.loadFromUserinfo;this.parsedProducts=[];this.openRight=false;this.userName=undefined;this.email=undefined;this.authType=1;this.connectionName=undefined;this.logoutUrl=undefined;this.products=undefined;this.loadFromUserinfo=false;this.isOpen=false;this.itemIndexToFocus=0}t.prototype.isSafeUrl=function(t){var r=false;var e=["digitalmeasures\\.com","evalkit\\.info","evaluationkit\\.com","evaluationkit\\.info","lat_ams\\.com","livetext\\.com","smartcatalogiq\\.com","smartcatalogiq\\.net","smartcatalogiq\\.us","taskstream\\.com","vialivetext\\.com","watermarkinsights\\.com"];e.forEach((function(e){var i="^https://(.*.)?".concat(e,"(/.*)?$");if(!!t&&t.match(i)){r=true}}));return r};t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:if(!this.userName){console.error("wm-navigator: user-name is a required property.")}return[4,this.parseData()];case 1:t.sent();this.setFocusIndex();return[2]}}))}))};t.prototype.parseData=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(r){switch(r.label){case 0:if(!!!this.loadFromUserinfo)return[3,2];return[4,getRequest("/platform/navigator/userinfo").then((function(r){t.email=r.email;t.currentProductId=r.current_product_id;t.parsedProducts=t.productKeysToCamelCase(r.products);t.logoutUrl=t.logoutUrl?t.logoutUrl:r.logout_url;t.connectionName=t.connectionName?t.connectionName:r.connection_name;if(!!t.email&&!!t.currentProductId){t.retrievedInfo=true}})).catch((function(t){console.error(t)}))];case 1:r.sent();return[3,3];case 2:this.currentProductId=getWmMode(this.el);if(!!this.products){if(typeof this.products==="string"){this.parsedProducts=JSON.parse(this.products)}else{this.parsedProducts=this.products}this.parsedProducts=this.productKeysToCamelCase(this.parsedProducts)}r.label=3;case 3:this.parsedProducts.sort((function(t,r){return t.name<r.name?-1:1}));return[2]}}))}))};t.prototype.productKeysToCamelCase=function(t){t=t.map((function(t){var r=Object.keys(t);var e={};r.forEach((function(r){e[snakeCaseToCamelCase(r)]=t[r]}));return e}));return t};t.prototype.setFocusIndex=function(){if(this.parsedProducts.length>1){var t=this.getProduct(this.currentProductId);if(t){this.itemIndexToFocus=this.parsedProducts.indexOf(t)}}};t.prototype.handleKeys=function(t){switch(t.key){case"Escape":t.preventDefault();this.closeMenu();break;case"ArrowDown":case"ArrowUp":t.preventDefault();if(!this.isOpen){this.itemIndexToFocus=getNewIndexToFocus(this.itemIndexToFocus,t.key,this.navigatorItems.length);this.openMenu()}break}};t.prototype.handleKeydown=function(t){var r=t.detail.key;var e=t.detail.navItem;switch(r){case"Tab":this.closeMenu(false);break;case"Enter":case" ":e.click();break;case"ArrowDown":case"ArrowUp":var i=this.itemIndexToFocus;this.itemIndexToFocus=getNewIndexToFocus(this.itemIndexToFocus,r,this.navigatorItems.length);this.focusItem();this.unfocusItem(i);break}};t.prototype.handleClick=function(t){var r=t.target===this.el||this.el.contains(t.target);if(!r&&this.isOpen){this.closeMenu(false)}};t.prototype.handleButtonClick=function(){this.isOpen?this.closeMenu():this.openMenu()};t.prototype.openMenu=function(){if(this.wrapperEl){var t=this.wrapperEl.clientWidth;var r=this.el.getBoundingClientRect().left;var e=document.documentElement.clientWidth-this.el.getBoundingClientRect().right;this.openRight=t>r&&e>r}this.isOpen=true;this.focusItem()};t.prototype.closeMenu=function(t){var r=this;if(t===void 0){t=true}this.isOpen=false;window.requestAnimationFrame((function(){r.unfocusItem(r.itemIndexToFocus);r.setFocusIndex();if(t){r.buttonFocusHandler()}}))};t.prototype.focusItem=function(){var t=this.navigatorItems[this.itemIndexToFocus];t.tabIndex=0;t.focused=true;window.requestAnimationFrame((function(){return t.focus()}))};t.prototype.unfocusItem=function(t){var r=this.navigatorItems[t];r.tabIndex=-1;r.focused=false};t.prototype.buttonFocusHandler=function(){var t=this.el.shadowRoot.querySelector("priv-navigator-button");var r=t.shadowRoot.querySelector("button");r.focus()};t.prototype.renderUserInfo=function(){return h("div",{class:"user",id:"wm-nav-user","aria-label":intl.formatMessage({id:"navigator.userinfoLabel",defaultMessage:"for {name}, email {email}"},{name:this.userName,email:this.email})},h("p",null,this.userName),h("p",null,this.email))};t.prototype.setAltText=function(){if(this.parsedProducts.length>1){return intl.formatMessage({id:"navigator.userinfoAndProductNavigator",defaultMessage:"User information and product navigator"})}else{return intl.formatMessage({id:"navigator.userinfo",defaultMessage:"User information"})}};t.prototype.renderHeading=function(){return h("h2",null,intl.formatMessage({id:"navigator.watermarkApps",defaultMessage:"Watermark Apps",description:"Applications made by Watermark Insights"}))};t.prototype.renderList=function(){return h("ul",{role:"listbox","aria-label":"".concat(intl.formatMessage({id:"navigator.WatermarkAppNavigation",defaultMessage:"Watermark App Navigation",description:"list of applications by Watermark Insights"})),"aria-describedby":"wm-nav-user"},this.parsedProducts.length>1&&this.renderProductOptions(),this.renderLogoutOption())};t.prototype.renderProductOptions=function(){var t=this;return this.parsedProducts.map((function(r){var e,i,n,a;e=r.name;i=r.iconUrl;a=t.setProductOnClick(r.id);if(!!e&&!!i){n=t.currentProductId===r.id;return h("priv-navigator-item",{selected:n,id:r.id,onClick:a,role:"option","aria-label":e},h("img",{src:i,alt:e}))}}))};t.prototype.setProductOnClick=function(t){var r=this.getProduct(t);if(this.currentProductId===t){return function(){}}else if(r){if(!!this.loadFromUserinfo||this.authType===2){var e=r.linkUrl;if(this.isSafeUrl(e)){return function(){return window.location.href=e}}else{console.error('"'.concat(e,'" is not a safe url'));return}}else if(this.authType===3){var i=this.connectionName?"/?connection_name=".concat(this.connectionName):"";var n=r.samlLinkUrl;if(this.isSafeUrl(n)){return function(){return window.location.href=n+i}}else{console.error('"'.concat(n,'" is not a safe url'));return}}}};t.prototype.renderLogoutOption=function(){return h("priv-navigator-item",{class:"logout",selected:!(this.parsedProducts.length>1),id:"nav-logout",onClick:this.setLogoutOnclick(),role:"option"},h("span",{class:"logout"},intl.formatMessage({id:"navigator.logout",defaultMessage:"Log Out"})))};t.prototype.setLogoutOnclick=function(){var t=this;return function(){t.wmNavigatorLogout.emit();var r=t.logoutUrl;if(t.isSafeUrl(r)){window.location.href=r}else{console.error('"'.concat(r,'" is not a safe url'))}}};Object.defineProperty(t.prototype,"navigatorItems",{get:function(){return Array.from(this.el.shadowRoot.querySelectorAll("priv-navigator-item"))},enumerable:false,configurable:true});t.prototype.getProduct=function(t){return this.parsedProducts.find((function(r){return r.id===t}))};t.prototype.render=function(){var t=this;return this.retrievedInfo?h(Host,null,h("priv-navigator-button",{expanded:this.isOpen,altText:this.setAltText()}),h("div",{class:"wrapper ".concat(this.isOpen?"":"hide"," ").concat(this.openRight?"right":""),ref:function(r){return t.wrapperEl=r}},this.renderUserInfo(),this.parsedProducts.length>1&&this.renderHeading(),this.renderList())):""};Object.defineProperty(t,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{products:["parseData"]}},enumerable:false,configurable:true});return t}();Navigator.style=wmNavigatorCss;export{Navigator as wm_navigator};
@@ -1 +1 @@
1
- import{r as registerInstance,c as createEvent,h,H as Host,g as getElement,f as forceUpdate}from"./index-f164fbca.js";import{i as intl,d as debounce,t as toBool,a as handleDisabledAttribute,k as shouldOpenUp,y as getTextDir}from"./functions-f65dbb96.js";import{g as globalMessages}from"./intl-f7f77de7.js";var wmOptionCss=':host(:not(:last-child)){border-bottom:2px solid;border-color:var(--wmcolor-select-option-border)}:host{display:block;cursor:pointer;position:relative;padding:1.25rem;background:var(--wmcolor-select-option-background);font-family:inherit;list-style:none;color:var(--wmcolor-select-option-text);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host:focus,:host.focus{outline:none;background:var(--wmcolor-select-option-background-focus)}:host.icon{color:var(--wmcolor-interactive)}:host .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}.checkbox: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:"\\f131";display:inline-block;margin-right:0.25rem;color:var(--wmcolor-interactive)}:host([aria-selected=true]){background:var(--wmcolor-select-option-background-selected);font-weight:500}:host([aria-selected=true]) .checkbox:before{content:"\\f132"}:host([aria-disabled=true]){color:var(--wmcolor-select-option-text-disabled);background:var(--wmcolor-select-option-background-disabled);cursor:default}:host([aria-disabled=true]) .checkbox:before{color:var(--wmcolor-select-option-text-disabled)}:host([aria-disabled=true]) .subinfo{color:var(--wmcolor-select-option-text-disabled)}:host(.multi-option){background:unset}:host(.clone.last){border-bottom:12px solid;border-color:var(--wmcolor-select-option-border)}:host(.hassubinfo){display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;gap:16px}:host(.hidden),:host(.filtered-out){display:none}.subinfo{font-style:italic}.option-wrapper{display:-ms-flexbox;display:flex}.option-text{display:inline-block}::slotted{font-family:inherit}::slotted(i){font-size:0.875rem}::slotted(i):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;display:inline-block;margin-right:0.625rem;pointer-events:none}:host(:focus){outline:none;background:var(--wmcolor-select-option-background-hover)}:host(:hover){background:var(--wmcolor-select-option-background-hover);outline:none}';var Option=function(){function e(e){registerInstance(this,e);this.wmOptionSelected=createEvent(this,"wmOptionSelected",7);this.wmOptionDeselected=createEvent(this,"wmOptionDeselected",7);this.intCloneClicked=createEvent(this,"intCloneClicked",7);this.wmKeyUpPressed=createEvent(this,"wmKeyUpPressed",7);this.wmKeyDownPressed=createEvent(this,"wmKeyDownPressed",7);this.wmEscKeyPressed=createEvent(this,"wmEscKeyPressed",7);this.wmHomeKeyPressed=createEvent(this,"wmHomeKeyPressed",7);this.wmEndKeyPressed=createEvent(this,"wmEndKeyPressed",7);this.wmEnterKeyPressed=createEvent(this,"wmEnterKeyPressed",7);this.wmLetterPressed=createEvent(this,"wmLetterPressed",7);this.wmOptionBlurred=createEvent(this,"wmOptionBlurred",7);this.value=undefined;this.subinfo=undefined;this.disabled=false;this.selected=false;this.focused=false;this.searchTerm=""}Object.defineProperty(e.prototype,"hostClasses",{get:function(){var e=[];if(this.subinfo){e.push("hassubinfo")}if(this.parentSelectEl.multiple){e.push("multi-option")}if(!this.el.textContent.toLowerCase().includes(this.searchTerm)){e.push("filtered-out")}return e.join(" ")},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"parentSelectEl",{get:function(){var e;return((e=this.el.parentElement)===null||e===void 0?void 0:e.nodeName)!=="WM-SELECT"?this.el.getRootNode().host:this.el.parentElement},enumerable:false,configurable:true});e.prototype.handleKeydown=function(e){switch(e.key){case"ArrowUp":e.preventDefault();this.wmKeyUpPressed.emit(this.el);break;case"ArrowDown":e.preventDefault();this.wmKeyDownPressed.emit(this.el);break;case"Enter":e.preventDefault();if(!this.disabled){this.el.click();this.wmEnterKeyPressed.emit(this.el)}break;case"Escape":e.preventDefault();e.stopPropagation();this.wmEscKeyPressed.emit();break;case"Home":e.preventDefault();this.wmHomeKeyPressed.emit();break;case"End":e.preventDefault();this.wmEndKeyPressed.emit();break;default:if(e.key.length===1){e.preventDefault();this.wmLetterPressed.emit({letter:e.key,optionEl:this.el})}}};e.prototype.handleSelection=function(){if(!this.disabled){if(this.el.classList.contains("clone")){this.intCloneClicked.emit(this.el)}else{if(this.parentSelectEl.multiple){this.selected?this.wmOptionDeselected.emit(this.el):this.wmOptionSelected.emit(this.el)}else{this.wmOptionSelected.emit(this.el)}}}};e.prototype.handleBlur=function(e){this.wmOptionBlurred.emit({relatedTarget:e.relatedTarget})};e.prototype.syncAriaSelected=function(){this.selected?this.el.setAttribute("aria-selected","true"):this.el.setAttribute("aria-selected","false")};e.prototype.syncAriaDisabled=function(){this.disabled?this.el.setAttribute("aria-disabled","true"):this.el.removeAttribute("aria-disabled")};e.prototype.updateDisabledOnClick=function(){if(this.disabled&&this.el.onclick){this.onClickFunc=this.el.onclick;this.el.onclick=null}else if(!this.disabled&&this.onClickFunc){this.el.onclick=this.onClickFunc}};e.prototype.handleSearch=function(e){this.searchTerm=e.detail.searchTerm.toLowerCase();if(this.searchTerm&&this.el.textContent.toLowerCase().includes(this.searchTerm)){var t=this.el.textContent.toLowerCase().indexOf(this.searchTerm);var i=this.el.textContent.slice(0,t);var r=this.el.textContent.slice(t,t+this.searchTerm.length);var o=this.el.textContent.slice(t+this.searchTerm.length);var n=document.createElement("span");n.textContent=i;var s=document.createElement("strong");s.textContent=r;var a=document.createElement("span");a.textContent=o;this.textEl.innerHTML="";this.textEl.appendChild(n);this.textEl.appendChild(s);this.textEl.appendChild(a)}else{this.textEl.textContent=this.el.textContent}};e.prototype.componentWillLoad=function(){var e=this;this.syncAriaSelected();this.syncAriaDisabled();this.updateDisabledOnClick();this.parentSelectEl.addEventListener("wmSelectSearchChanged",(function(t){return e.handleSearch(t)}))};e.prototype.render=function(){var e=this;return h(Host,{role:"option",tabindex:this.focused?0:-1,class:this.hostClasses},h("div",{class:"option-wrapper ".concat(this.parentSelectEl.multiple?"checkbox":"")},h("span",{class:"option-text","aria-hidden":"true",ref:function(t){return e.textEl=t}},this.el.textContent),h("span",{class:"sr-only"},this.el.textContent)),h("div",{class:"subinfo"},this.subinfo))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{selected:["syncAriaSelected"],disabled:["syncAriaDisabled","updateDisabledOnClick"]}},enumerable:false,configurable:true});return e}();Option.style=wmOptionCss;var wmSelectCss=':host{--wmcolor-select-background:var(--wmcolor-background);--wmcolor-select-border:var(--wmcolor-input-border);--wmcolor-select-option-background-disabled:var(--wmcolor-option-background-disabled);--wmcolor-select-option-background-focus:var(--wmcolor-option-background-focus);--wmcolor-select-option-background-hover:var(--wmcolor-option-background-hover);--wmcolor-select-option-background-selected:var(--wmcolor-option-background-selected);--wmcolor-select-option-background:var(--wmcolor-option-background);--wmcolor-select-option-border:var(--wmcolor-option-border);--wmcolor-select-option-text-disabled:var(--wmcolor-option-text-disabled);--wmcolor-select-option-text:var(--wmcolor-option-text);--wmcolor-select-search-border:var(--wmcolor-input-border);--wmcolor-select-search-icon:var(--wmcolor-icon-accent);--wmcolor-select-searchresults-text:var(--wmcolor-text);--wmcolor-select-selectall-background:var(--wmcolor-select-option-background);--wmcolor-select-selectall-border:var(--wmcolor-select-option-border);--wmcolor-select-selectall-text:var(--wmcolor-interactive);--wmcolor-select-text:var(--wmcolor-interactive);position:relative;display:block;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:inherit}:host .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}.wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-size:0.875rem}.wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}.wrapper .label .required{color:var(--wmcolor-text-required)}.wrapper.label-left{-ms-flex-direction:row;flex-direction:row}.wrapper.label-left .label-wrapper{line-height:2.5rem}.wrapper.label-left .label-wrapper .label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:2.5rem;white-space:normal;margin-bottom:0;margin-right:0.75rem}.wrapper.label-none label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}.wrapper.invalid .label{color:var(--wmcolor-text-error)}.wrapper.invalid .label:after{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:"\\f026";margin-left:0.3125rem}[dir=RTL] .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}.wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}.wrapper .button-wrapper{position:relative;-ms-flex:1;flex:1;font-size:1.125rem;color:var(--wmcolor-select-text);min-width:8.75rem}.wrapper .button-wrapper .displayedoption{-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-wrap:nowrap;flex-wrap:nowrap;background:var(--wmcolor-select-background);width:100%;border:solid 1px;border-color:var(--wmcolor-select-border);padding:0 1.875rem 0 0.9375rem;cursor:pointer;height:2.5rem;line-height:normal;font-family:inherit;color:var(--wmcolor-select-text);font-weight:400;font-size:0.875rem;text-transform:none;text-align:left}@media only screen and (max-width: 768px){.wrapper .button-wrapper .displayedoption{height:2.75rem}}.wrapper .button-wrapper .displayedoption: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:"\\f140";position:absolute;right:0.5625rem;pointer-events:none;font-size:1.12rem}.wrapper .button-wrapper .displayedoption:hover:not(:disabled):not(.-disabled):not(.-raised){background:var(--wmcolor-select-background);text-decoration:none}.wrapper .button-wrapper .displayedoption:active{-ms-transform:scale(1, 1) !important;-webkit-transform:scale(1, 1) !important;transform:scale(1, 1) !important}.wrapper .button-wrapper .displayedoption:focus{outline:none}.wrapper .button-wrapper .displayedoption::-moz-focus-inner{border:0}.wrapper .button-wrapper .displayedoption:focus-visible{outline:3px solid var(--wmcolor-interactive-focus);outline-offset:2px}.wrapper .button-wrapper .displayedoption .overflowcontrol{display:block;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;-ms-flex:1;flex:1}.wrapper .button-wrapper .displayedoption .overflowcontrol.hassubinfo{display:-ms-flexbox;display:flex}.wrapper .button-wrapper .displayedoption .overflowcontrol.hassubinfo .button-text{-ms-flex:1;flex:1;text-overflow:ellipsis;overflow:hidden;min-width:0}.wrapper .button-wrapper .displayedoption .overflowcontrol.hassubinfo .subinfo{-ms-flex:none;flex:none;font-style:italic}.wrapper .button-wrapper .displayedoption .overflow-counter{font-weight:bold;margin-left:0.5rem}.wrapper .button-wrapper>.displayedoption[disabled]{color:#6b6b6b;border-color:#8a8a8a;background:#f0f0f0;cursor:default}.wrapper .button-wrapper>.dropdown{-webkit-overflow-scrolling:touch;-webkit-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-moz-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-ms-transition:transform 0.25s ease;-webkit-transition:transform 0.25s ease;-moz-transition:transform 0.25s ease;-webkit-transition:-webkit-transform 0.25s ease;transition:-webkit-transform 0.25s ease;transition:transform 0.25s ease;transition:transform 0.25s ease, -webkit-transform 0.25s ease;-ms-transform:scale(1, 0);-webkit-transform:scale(1, 0);-moz-transform:scale(1, 0);transform:scale(1, 0);-ms-transform-origin:center top;-webkit-transform-origin:center top;-moz-transform-origin:center top;transform-origin:center top;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;position:absolute;top:0;right:0;background:var(--wmcolor-select-option-background);z-index:100;width:100%;font-size:0.875rem}.wrapper .button-wrapper>.dropdown.upwards{top:unset;bottom:calc(100% - 2.5rem);-ms-transform-origin:center bottom;-webkit-transform-origin:center bottom;-moz-transform-origin:center bottom;transform-origin:center bottom}.wrapper .button-wrapper>.dropdown.hidden{visibility:hidden}.wrapper .button-wrapper>.dropdown.open{-ms-transform:scale(1, 1);-webkit-transform:scale(1, 1);-moz-transform:scale(1, 1);transform:scale(1, 1)}.wrapper.invalid .button-wrapper .displayedoption{-webkit-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);-moz-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);box-shadow:0 0 0 1px var(--wmcolor-input-border-error);border-color:var(--wmcolor-input-border-error)}.wrapper .error-message{display:block;font-style:italic;color:var(--wmcolor-text-error);font-size:0.875rem;margin-bottom:0.25rem;top:100%;left:0}.wrapper .error-message:not(:empty){margin-top:0.25rem}.options-wrapper{max-height:12.5rem;overflow:auto}.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}.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}.rtl>.dropdown{-ms-transform-origin:left top;-webkit-transform-origin:left top;-moz-transform-origin:left top;transform-origin:left top;left:0;right:auto}.rtl>.dropdown .option{padding-left:3rem;padding-right:1.25rem}.rtl>.displayedoption{padding:0 0.9375rem 0 1.875rem;text-align:right}.rtl>.displayedoption:before{right:auto;left:0.5625rem}';var Select=function(){function e(e){var t=this;registerInstance(this,e);this.wmSelectDidLoad=createEvent(this,"wmSelectDidLoad",7);this.wmSelectBlurred=createEvent(this,"wmSelectBlurred",7);this.wmSelectSearchChanged=createEvent(this,"wmSelectSearchChanged",7);this.wmSelectAllSelected=createEvent(this,"wmSelectAllSelected",7);this.wmSelectAllDeselected=createEvent(this,"wmSelectAllDeselected",7);this.selectAllMessage=intl.formatMessage({id:"select.selectAll",defaultMessage:"Select All"});this.deselectAllMessage=intl.formatMessage({id:"select.deselectAll",defaultMessage:"Deselect All"});this.allOptionsSelectedMessage=intl.formatMessage({id:"select.allOptionsSelected",defaultMessage:"All options selected"});this.allOptionsDeselectedMessage=intl.formatMessage({id:"select.allOptionsDeselected",defaultMessage:"All options deselected"});this.keysSoFar="";this.searchIndex=0;this.openUp=false;this.overflowCount=0;this.displayedOptions=[];this.debouncedClearKeysSoFar=debounce((function(){t.keysSoFar=""}),500);this.debouncedSearch=debounce((function(){t.wmSelectSearchChanged.emit({searchTerm:t.searchTerm});if(t.filteredOptions.length){t.announce(t.resultsFoundMessage)}else{t.announce(t.noResultsFoundMessage)}}),150);this.disabled=false;this.maxHeight=undefined;this.label=undefined;this.labelPosition="top";this.requiredField=false;this.errorMessage=undefined;this.multiple=false;this.search=false;this.selectAll=false;this.placeholder=intl.formatMessage({id:"select.multiPlaceholder",defaultMessage:"Make a selection",description:"Placeholder text. Use imperative"});this.searchPlaceholder=intl.formatMessage({id:"select.searchPlaceholder",defaultMessage:"Search",description:"Placeholder text. Use imperative"});this.allSelectedMessage=intl.formatMessage({id:"select.allSelected",defaultMessage:"All selected",description:"Text displayed when all options are selected"});this.isExpanded=false;this.announcement=""}Object.defineProperty(e.prototype,"childOptions",{get:function(){return Array.from(this.el.querySelectorAll("wm-option"))},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"cloneOptions",{get:function(){return Array.from(this.el.shadowRoot.querySelectorAll("wm-option"))},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"allOptionEls",{get:function(){return this.cloneOptions.concat(this.childOptions)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"visibleOptionEls",{get:function(){return this.allOptionEls.filter((function(e){return!e.classList.contains("hidden")&&!e.classList.contains("filtered-out")}))},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isDisabled",{get:function(){return toBool(this.disabled)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"searchTerm",{get:function(){return this.searchFieldEl?this.searchFieldEl.value:""},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"filteredOptions",{get:function(){var e=this;return this.childOptions.filter((function(t){var i;return(i=t.textContent)===null||i===void 0?void 0:i.toLowerCase().includes(e.searchTerm.toLowerCase())}))},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"selectedOptions",{get:function(){return Array.from(this.el.querySelectorAll("wm-option")).filter((function(e){return e.selected}))},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"allSelected",{get:function(){return this.childOptions.every((function(e){return e.selected}))},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"visibleSelectAllButton",{get:function(){return this.selectAll&&this.multiple&&this.searchTerm===""},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"resultsFoundMessage",{get:function(){return intl.formatMessage({id:"select.searchResultsFound",defaultMessage:"{numResults, plural, one {1 option found} other {# options found}}",description:"The message read by the screen reader, indicating how many results a search returned"},{numResults:this.filteredOptions.length})},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"noResultsFoundMessage",{get:function(){return intl.formatMessage({id:"select.noSearchResults",defaultMessage:"No results found. Please try your search again.",description:"The message displayed when no options pass the search filter"})},enumerable:false,configurable:true});e.prototype.handleOptionSelection=function(e){this.focusOption(e.detail);if(!this.multiple){this.close()}};e.prototype.handleOptionCloneSelection=function(e){var t=this.findCorrespondingOption(e.detail);t.click()};e.prototype.handleChildEnter=function(){this.close()};e.prototype.handleChildUp=function(e){this.moveUp(e.detail)};e.prototype.handleChildDown=function(e){this.moveDown(e.detail)};e.prototype.moveToFirstOption=function(){this.focusOption(this.visibleOptionEls[0])};e.prototype.moveToLastOption=function(){this.focusOption(this.visibleOptionEls[this.visibleOptionEls.length-1])};e.prototype.closePopupOnEscape=function(){this.close()};e.prototype.handleOptionBlur=function(e){if(!this.isElOrChild(e.detail.relatedTarget)){var t=new CustomEvent("blur");t.relatedTarget=e.detail.relatedTarget;this.el.dispatchEvent(t)}};e.prototype.handleClick=function(e){if(!this.isElOrChild(e.target)){this.close()}};e.prototype.handleSelectAllClick=function(){this.allSelected?this.deselectAllOptions():this.selectAllOptions()};e.prototype.selectAllOptions=function(){this.announce(this.allOptionsSelectedMessage);this.wmSelectAllSelected.emit()};e.prototype.deselectAllOptions=function(){this.announce(this.allOptionsDeselectedMessage);this.wmSelectAllDeselected.emit()};e.prototype.handleButtonBlur=function(e){if(this.isElOrChild(e.relatedTarget)){e.stopPropagation()}};e.prototype.handleSearchFieldBlur=function(e){this.searchFieldWrapperEl.classList.remove("focus");if(this.isElOrChild(e.relatedTarget)){e.stopPropagation()}};e.prototype.handleKey=function(e){switch(e.key){case"ArrowDown":if(this.isExpanded===false){e.preventDefault();this.open("next")}break;case"ArrowUp":if(this.isExpanded===false){e.preventDefault();this.open("previous")}break}};e.prototype.componentWillLoad=function(){var e=this;if(!this.label){console.error("For accessibility purposes, this component requires a label (even if `label-position` is set to `none`).")}if(!this.multiple&&this.selectedOptions.length===0){console.error("wm-select should have one initial option selected")}handleDisabledAttribute(this.el,this.isDisabled);var t=new MutationObserver((function(t){return t.forEach((function(t){return e.handleChildChange(t)}))}));t.observe(this.el,{childList:true,attributes:true,subtree:true,attributeFilter:["selected"]})};e.prototype.handleChildChange=function(e){this.setButtonText();forceUpdate(this.el)};e.prototype.componentDidLoad=function(){this.wmSelectDidLoad.emit();this.dropdownEl.classList.add("hidden");forceUpdate(this.el);if(this.maxHeight){this.listboxEl.style.maxHeight=this.maxHeight}if(this.multiple){this.updateOptionVisibility()}this.setButtonText()};e.prototype.componentWillUpdate=function(){if(this.multiple){var e=this.visibleOptionEls.filter((function(e){return e.classList.contains("clone")}));var t=e.length===this.visibleOptionEls.length;e.forEach((function(i,r){if(!t&&r===e.length-1){i.classList.add("last")}else{i.classList.remove("last")}}))}};e.prototype.moveUp=function(e){var t=this.visibleOptionEls;if(this.selectAllEl){t.unshift(this.selectAllEl)}if(this.searchFieldEl){t.unshift(this.searchFieldEl)}var i=t[t.indexOf(e)-1]||t[t.length-1];if(i){this.focusOption(i)}};e.prototype.moveDown=function(e){var t=this.visibleOptionEls;if(this.selectAllEl){t.unshift(this.selectAllEl)}if(this.searchFieldEl){t.unshift(this.searchFieldEl)}var i=t[t.indexOf(e)+1]||t[0];if(i){this.focusOption(i)}};e.prototype.open=function(e){var t=this;if(!this.isDisabled){var i=this.el.clientHeight;var r=this.buttonEl.clientHeight;this.openUp=shouldOpenUp(this.el,this.dropdownEl.clientHeight,i,r);this.isExpanded=true;this.dropdownEl.classList.remove("hidden");window.requestAnimationFrame((function(){switch(e){case"next":if(t.search){t.searchFieldEl.focus();t.listboxEl.scrollTop=0}else{t.moveDown(t.visibleOptionEls.filter((function(e){return e.selected})).slice(-1)[0])}break;case"previous":if(t.search){t.focusOption(t.visibleOptionEls[t.visibleOptionEls.length-1])}else{t.moveUp(t.visibleOptionEls.filter((function(e){return e.selected}))[0])}break;default:if(t.search){t.searchFieldEl.focus();t.listboxEl.scrollTop=0}else if(t.selectedOptions.length>0){t.focusOption(t.visibleOptionEls.filter((function(e){return e.selected}))[0])}else{t.focusOption(t.visibleOptionEls[0])}break}}))}};e.prototype.close=function(e){var t=this;if(e===void 0){e=true}if(this.isExpanded){this.isExpanded=false;this.allOptionEls.map((function(e){return e.focused=false}));window.setTimeout((function(){t.dropdownEl.classList.add("hidden");if(t.multiple){t.updateOptionVisibility()}if(t.search){t.searchFieldEl.value="";t.wmSelectSearchChanged.emit({searchTerm:t.searchTerm})}if(e){t.buttonEl.focus()}}),150)}};e.prototype.updateOptionVisibility=function(){var e=this;this.childOptions.forEach((function(t,i){var r=e.cloneOptions[i];if(t.selected){t.classList.add("hidden");r.classList.remove("hidden")}else{t.classList.remove("hidden");r.classList.add("hidden")}}))};e.prototype.focusOption=function(e){this.allOptionEls.forEach((function(t){return t.focused=t===e}));e.scrollIntoView({block:"nearest"});window.setTimeout((function(){return e.scrollIntoView({block:"nearest"})}),60);e.focus()};e.prototype.findAndFocusOption=function(e){var t=this;var i=e.detail.letter.toLowerCase();var r=e.detail.optionEl;if(!this.keysSoFar&&i==" "){r.click()}else{if(!this.keysSoFar){this.visibleOptionEls.forEach((function(e,i){if(e.focused){t.searchIndex=i}}))}this.keysSoFar+=i;var o=this.findMatchInRange(this.visibleOptionEls,this.searchIndex+1,this.visibleOptionEls.length);if(!o){o=this.findMatchInRange(this.visibleOptionEls,0,this.searchIndex)}if(o){this.focusOption(o)}this.debouncedClearKeysSoFar()}};e.prototype.findMatchInRange=function(e,t,i){var r=this;var o=null;var n=e.slice(t,i);n.forEach((function(e){var t=e.textContent;if(!o&&t&&t.toLowerCase().startsWith(r.keysSoFar)){o=e}}));return o};e.prototype.findCorrespondingOption=function(e){var t=e.classList.contains("clone");return t?this.childOptions[this.cloneOptions.indexOf(e)]:this.cloneOptions[this.childOptions.indexOf(e)]};e.prototype.isElOrChild=function(e){var t;return e===this.el||this.el.contains(e)||((t=this.el.shadowRoot)===null||t===void 0?void 0:t.contains(e))};e.prototype.announceError=function(){var e=this;if(this.errorMessage){setTimeout((function(){return e.announce(e.errorMessage)}),100)}};e.prototype.handleDisabledChange=function(){handleDisabledAttribute(this.el,this.isDisabled)};e.prototype.handleComponentBlur=function(e){if(!this.el.contains(e.relatedTarget)){this.close(false);this.wmSelectBlurred.emit()}};e.prototype.handleKeyDown=function(e){var t=e.target;switch(e.key){case"ArrowDown":e.preventDefault();this.moveDown(e.target);break;case"ArrowUp":e.preventDefault();this.moveUp(e.target);break;case"Escape":e.preventDefault();this.close();break;case"Enter":if(t===this.selectAllEl){e.preventDefault();this.handleSelectAllClick();this.close()}break;case" ":if(t===this.selectAllEl){e.preventDefault();this.handleSelectAllClick()}break}};e.prototype.setButtonText=function(){var e=this;this.displayedOptions=this.childOptions.filter((function(e){return e.selected})).map((function(t){return!t.classList.contains("hidden")?t:e.findCorrespondingOption(t)}));if(this.multiple){var t=38;var i=window.getComputedStyle(this.buttonEl);var r=parseInt(i.getPropertyValue("padding-left").slice(0,-2));var o=parseInt(i.getPropertyValue("padding-right").slice(0,-2));var n=this.buttonEl.clientWidth-r-o-t;var s=this.displayedOptions.map((function(e){return e.shadowRoot.querySelector(".option-text").clientWidth}));var a=s.reduce((function(e,t){return e+t}),0);this.overflowCount=0;while(a>n&&this.displayedOptions.length>1){this.overflowCount++;a-=s[s.length-1];s.pop();this.displayedOptions.pop()}}};e.prototype.announce=function(e){if(this.liveRegionEl.textContent===e){e+=" "}this.announcement=e};e.prototype.renderButtonText=function(){if(this.multiple&&this.displayedOptions.length<1){return h("span",null,this.placeholder)}else if(this.multiple&&this.allSelected&&this.overflowCount>0){return this.allSelectedMessage}else{return this.displayedOptions.map((function(e,t){return h("span",null,t>0?", ":"",e.textContent)}))}};e.prototype.renderOverflowCount=function(){if(this.overflowCount>0&&!this.allSelected){return h("span",null,h("span",{class:"overflow-counter"},"+",this.overflowCount))}};e.prototype.renderSearchField=function(){var e=this;return h("div",{class:"search"},h("div",{class:"searchfield-wrapper",ref:function(t){return e.searchFieldWrapperEl=t}},h("div",{class:"icon"}),h("input",{ref:function(t){return e.searchFieldEl=t},class:"searchfield",role:"combobox","aria-controls":"list","aria-expanded":this.isExpanded?"true":"false",onKeyDown:function(t){return e.handleKeyDown(t)},onFocus:function(){return e.searchFieldWrapperEl.classList.add("focus")},onBlur:function(t){return e.handleSearchFieldBlur(t)},onInput:function(){return e.debouncedSearch()},placeholder:this.searchPlaceholder})))};e.prototype.renderSearchFailedMessage=function(){return h("div",{class:"search-results-message"},this.noResultsFoundMessage)};e.prototype.renderSelectAllButton=function(){var e=this;return h("button",{ref:function(t){return e.selectAllEl=t},class:"select-all",onClick:function(){return e.handleSelectAllClick()},onKeyDown:function(t){return e.handleKeyDown(t)},tabindex:"-1"},this.allSelected?this.deselectAllMessage:this.selectAllMessage)};e.prototype.renderCloneOptions=function(){return Array.from(this.el.children).map((function(e){var t=e;return h("wm-option",{class:"clone",subinfo:t.subinfo,selected:t.selected},t.textContent)}))};e.prototype.render=function(){var e;var t=this;var i=!this.multiple&&this.selectedOptions.length>0&&this.selectedOptions[0].subinfo;var r=(e={id:"selectbtn"},e["disabled"]=this.isDisabled,e["aria-controls"]="list",e["aria-labelledby"]="label selectbtn",e["aria-describedby"]="error",e["aria-expanded"]=this.isExpanded?"true":"false",e.onClick=function(){return t.isExpanded?t.close():t.open()},e);return h(Host,{onBlur:function(e){return t.handleComponentBlur(e)}},h("div",{class:"wrapper ".concat(getTextDir()," label-").concat(this.labelPosition," ").concat(this.errorMessage?"invalid":"")},h("div",{class:"label-wrapper"},h("label",{class:"label",id:"label",htmlFor:"selectbtn"},this.label,this.requiredField?h("span",{class:"required"},h("span",{class:"sr-only"},globalMessages.requiredField),h("span",{"aria-hidden":"true"},"*")):"")),h("div",{class:"button-wrapper"},h("button",Object.assign({},r,{class:"displayedoption",ref:function(e){return t.buttonEl=e},onBlur:function(e){return t.handleButtonBlur(e)},onFocus:function(){return t.close()}}),h("span",{class:"overflowcontrol ".concat(i?"hassubinfo":"")},h("span",{class:"button-text"},this.renderButtonText()),i&&h("span",{class:"subinfo"},this.selectedOptions[0].subinfo)),this.renderOverflowCount()),h("div",{class:"dropdown ".concat(this.isExpanded?"open":""," ").concat(this.openUp?"upwards":""),ref:function(e){return t.dropdownEl=e}},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:function(e){return t.listboxEl=e}},this.search&&this.filteredOptions.length===0&&this.renderSearchFailedMessage(),this.multiple&&this.renderCloneOptions(),h("slot",null))),h("div",{id:"error",class:this.errorMessage?"error-message":""},this.errorMessage),h("div",{id:"announcement","aria-live":"polite","aria-atomic":"true",class:"sr-only",ref:function(e){return t.liveRegionEl=e}},this.announcement))))};Object.defineProperty(e,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{errorMessage:["announceError"],disabled:["handleDisabledChange"]}},enumerable:false,configurable:true});return e}();Select.style=wmSelectCss;export{Option as wm_option,Select as wm_select};
1
+ import{r as registerInstance,c as createEvent,h,H as Host,g as getElement,f as forceUpdate}from"./index-558b5a82.js";import{i as intl,d as debounce,t as toBool,a as handleDisabledAttribute,k as shouldOpenUp,y as getTextDir}from"./functions-46843ea0.js";import{g as globalMessages}from"./intl-8b8740b9.js";var wmOptionCss=':host(:not(:last-child)){border-bottom:2px solid;border-color:var(--wmcolor-select-option-border)}:host{display:block;cursor:pointer;position:relative;padding:1.25rem;background:var(--wmcolor-select-option-background);font-family:inherit;list-style:none;color:var(--wmcolor-select-option-text);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host:focus,:host.focus{outline:none;background:var(--wmcolor-select-option-background-focus)}:host.icon{color:var(--wmcolor-interactive)}:host .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}.checkbox: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:"\\f131";display:inline-block;margin-right:0.25rem;color:var(--wmcolor-interactive)}:host([aria-selected=true]){background:var(--wmcolor-select-option-background-selected);font-weight:500}:host([aria-selected=true]) .checkbox:before{content:"\\f132"}:host([aria-disabled=true]){color:var(--wmcolor-select-option-text-disabled);background:var(--wmcolor-select-option-background-disabled);cursor:default}:host([aria-disabled=true]) .checkbox:before{color:var(--wmcolor-select-option-text-disabled)}:host([aria-disabled=true]) .subinfo{color:var(--wmcolor-select-option-text-disabled)}:host(.multi-option){background:unset}:host(.clone.last){border-bottom:12px solid;border-color:var(--wmcolor-select-option-border)}:host(.hassubinfo){display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;gap:16px}:host(.hidden),:host(.filtered-out){display:none}.subinfo{font-style:italic}.option-wrapper{display:-ms-flexbox;display:flex}.option-text{display:inline-block}::slotted{font-family:inherit}::slotted(i){font-size:0.875rem}::slotted(i):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;display:inline-block;margin-right:0.625rem;pointer-events:none}:host(:focus){outline:none;background:var(--wmcolor-select-option-background-hover)}:host(:hover){background:var(--wmcolor-select-option-background-hover);outline:none}';var Option=function(){function e(e){registerInstance(this,e);this.wmOptionSelected=createEvent(this,"wmOptionSelected",7);this.wmOptionDeselected=createEvent(this,"wmOptionDeselected",7);this.intCloneClicked=createEvent(this,"intCloneClicked",7);this.wmKeyUpPressed=createEvent(this,"wmKeyUpPressed",7);this.wmKeyDownPressed=createEvent(this,"wmKeyDownPressed",7);this.wmEscKeyPressed=createEvent(this,"wmEscKeyPressed",7);this.wmHomeKeyPressed=createEvent(this,"wmHomeKeyPressed",7);this.wmEndKeyPressed=createEvent(this,"wmEndKeyPressed",7);this.wmEnterKeyPressed=createEvent(this,"wmEnterKeyPressed",7);this.wmLetterPressed=createEvent(this,"wmLetterPressed",7);this.wmOptionBlurred=createEvent(this,"wmOptionBlurred",7);this.value=undefined;this.subinfo=undefined;this.disabled=false;this.selected=false;this.focused=false;this.searchTerm=""}Object.defineProperty(e.prototype,"hostClasses",{get:function(){var e=[];if(this.subinfo){e.push("hassubinfo")}if(this.parentSelectEl.multiple){e.push("multi-option")}if(!this.el.textContent.toLowerCase().includes(this.searchTerm)){e.push("filtered-out")}return e.join(" ")},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"parentSelectEl",{get:function(){var e;return((e=this.el.parentElement)===null||e===void 0?void 0:e.nodeName)!=="WM-SELECT"?this.el.getRootNode().host:this.el.parentElement},enumerable:false,configurable:true});e.prototype.handleKeydown=function(e){switch(e.key){case"ArrowUp":e.preventDefault();this.wmKeyUpPressed.emit(this.el);break;case"ArrowDown":e.preventDefault();this.wmKeyDownPressed.emit(this.el);break;case"Enter":e.preventDefault();if(!this.disabled){this.el.click();this.wmEnterKeyPressed.emit(this.el)}break;case"Escape":e.preventDefault();e.stopPropagation();this.wmEscKeyPressed.emit();break;case"Home":e.preventDefault();this.wmHomeKeyPressed.emit();break;case"End":e.preventDefault();this.wmEndKeyPressed.emit();break;default:if(e.key.length===1){e.preventDefault();this.wmLetterPressed.emit({letter:e.key,optionEl:this.el})}}};e.prototype.handleSelection=function(){if(!this.disabled){if(this.el.classList.contains("clone")){this.intCloneClicked.emit(this.el)}else{if(this.parentSelectEl.multiple){this.selected?this.wmOptionDeselected.emit(this.el):this.wmOptionSelected.emit(this.el)}else{this.wmOptionSelected.emit(this.el)}}}};e.prototype.handleBlur=function(e){this.wmOptionBlurred.emit({relatedTarget:e.relatedTarget})};e.prototype.syncAriaSelected=function(){this.selected?this.el.setAttribute("aria-selected","true"):this.el.setAttribute("aria-selected","false")};e.prototype.syncAriaDisabled=function(){this.disabled?this.el.setAttribute("aria-disabled","true"):this.el.removeAttribute("aria-disabled")};e.prototype.updateDisabledOnClick=function(){if(this.disabled&&this.el.onclick){this.onClickFunc=this.el.onclick;this.el.onclick=null}else if(!this.disabled&&this.onClickFunc){this.el.onclick=this.onClickFunc}};e.prototype.handleSearch=function(e){this.searchTerm=e.detail.searchTerm.toLowerCase();if(this.searchTerm&&this.el.textContent.toLowerCase().includes(this.searchTerm)){var t=this.el.textContent.toLowerCase().indexOf(this.searchTerm);var i=this.el.textContent.slice(0,t);var r=this.el.textContent.slice(t,t+this.searchTerm.length);var o=this.el.textContent.slice(t+this.searchTerm.length);var n=document.createElement("span");n.textContent=i;var s=document.createElement("strong");s.textContent=r;var a=document.createElement("span");a.textContent=o;this.textEl.innerHTML="";this.textEl.appendChild(n);this.textEl.appendChild(s);this.textEl.appendChild(a)}else{this.textEl.textContent=this.el.textContent}};e.prototype.componentWillLoad=function(){var e=this;this.syncAriaSelected();this.syncAriaDisabled();this.updateDisabledOnClick();this.parentSelectEl.addEventListener("wmSelectSearchChanged",(function(t){return e.handleSearch(t)}))};e.prototype.render=function(){var e=this;return h(Host,{role:"option",tabindex:this.focused?0:-1,class:this.hostClasses},h("div",{class:"option-wrapper ".concat(this.parentSelectEl.multiple?"checkbox":"")},h("span",{class:"option-text","aria-hidden":"true",ref:function(t){return e.textEl=t}},this.el.textContent),h("span",{class:"sr-only"},this.el.textContent)),h("div",{class:"subinfo"},this.subinfo))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{selected:["syncAriaSelected"],disabled:["syncAriaDisabled","updateDisabledOnClick"]}},enumerable:false,configurable:true});return e}();Option.style=wmOptionCss;var wmSelectCss=':host{--wmcolor-select-background:var(--wmcolor-background);--wmcolor-select-border:var(--wmcolor-input-border);--wmcolor-select-option-background-disabled:var(--wmcolor-option-background-disabled);--wmcolor-select-option-background-focus:var(--wmcolor-option-background-focus);--wmcolor-select-option-background-hover:var(--wmcolor-option-background-hover);--wmcolor-select-option-background-selected:var(--wmcolor-option-background-selected);--wmcolor-select-option-background:var(--wmcolor-option-background);--wmcolor-select-option-border:var(--wmcolor-option-border);--wmcolor-select-option-text-disabled:var(--wmcolor-option-text-disabled);--wmcolor-select-option-text:var(--wmcolor-option-text);--wmcolor-select-search-border:var(--wmcolor-input-border);--wmcolor-select-search-icon:var(--wmcolor-icon-accent);--wmcolor-select-searchresults-text:var(--wmcolor-text);--wmcolor-select-selectall-background:var(--wmcolor-select-option-background);--wmcolor-select-selectall-border:var(--wmcolor-select-option-border);--wmcolor-select-selectall-text:var(--wmcolor-interactive);--wmcolor-select-text:var(--wmcolor-interactive);position:relative;display:block;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:inherit}:host .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}.wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-size:0.875rem}.wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}.wrapper .label .required{color:var(--wmcolor-text-required)}.wrapper.label-left{-ms-flex-direction:row;flex-direction:row}.wrapper.label-left .label-wrapper{line-height:2.5rem}.wrapper.label-left .label-wrapper .label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:2.5rem;white-space:normal;margin-bottom:0;margin-right:0.75rem}.wrapper.label-none label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}.wrapper.invalid .label{color:var(--wmcolor-text-error)}.wrapper.invalid .label:after{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:"\\f026";margin-left:0.3125rem}[dir=RTL] .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}.wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}.wrapper .button-wrapper{position:relative;-ms-flex:1;flex:1;font-size:1.125rem;color:var(--wmcolor-select-text);min-width:8.75rem}.wrapper .button-wrapper .displayedoption{-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-wrap:nowrap;flex-wrap:nowrap;background:var(--wmcolor-select-background);width:100%;border:solid 1px;border-color:var(--wmcolor-select-border);padding:0 1.875rem 0 0.9375rem;cursor:pointer;height:2.5rem;line-height:normal;font-family:inherit;color:var(--wmcolor-select-text);font-weight:400;font-size:0.875rem;text-transform:none;text-align:left}@media only screen and (max-width: 768px){.wrapper .button-wrapper .displayedoption{height:2.75rem}}.wrapper .button-wrapper .displayedoption: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:"\\f140";position:absolute;right:0.5625rem;pointer-events:none;font-size:1.12rem}.wrapper .button-wrapper .displayedoption:hover:not(:disabled):not(.-disabled):not(.-raised){background:var(--wmcolor-select-background);text-decoration:none}.wrapper .button-wrapper .displayedoption:active{-ms-transform:scale(1, 1) !important;-webkit-transform:scale(1, 1) !important;transform:scale(1, 1) !important}.wrapper .button-wrapper .displayedoption:focus{outline:none}.wrapper .button-wrapper .displayedoption::-moz-focus-inner{border:0}.wrapper .button-wrapper .displayedoption:focus-visible{outline:3px solid var(--wmcolor-interactive-focus);outline-offset:2px}.wrapper .button-wrapper .displayedoption .overflowcontrol{display:block;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;-ms-flex:1;flex:1}.wrapper .button-wrapper .displayedoption .overflowcontrol.hassubinfo{display:-ms-flexbox;display:flex}.wrapper .button-wrapper .displayedoption .overflowcontrol.hassubinfo .button-text{-ms-flex:1;flex:1;text-overflow:ellipsis;overflow:hidden;min-width:0}.wrapper .button-wrapper .displayedoption .overflowcontrol.hassubinfo .subinfo{-ms-flex:none;flex:none;font-style:italic}.wrapper .button-wrapper .displayedoption .overflow-counter{font-weight:bold;margin-left:0.5rem}.wrapper .button-wrapper>.displayedoption[disabled]{color:#6b6b6b;border-color:#8a8a8a;background:#f0f0f0;cursor:default}.wrapper .button-wrapper>.dropdown{-webkit-overflow-scrolling:touch;-webkit-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-moz-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-ms-transition:transform 0.25s ease;-webkit-transition:transform 0.25s ease;-moz-transition:transform 0.25s ease;-webkit-transition:-webkit-transform 0.25s ease;transition:-webkit-transform 0.25s ease;transition:transform 0.25s ease;transition:transform 0.25s ease, -webkit-transform 0.25s ease;-ms-transform:scale(1, 0);-webkit-transform:scale(1, 0);-moz-transform:scale(1, 0);transform:scale(1, 0);-ms-transform-origin:center top;-webkit-transform-origin:center top;-moz-transform-origin:center top;transform-origin:center top;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;position:absolute;top:0;right:0;background:var(--wmcolor-select-option-background);z-index:100;width:100%;font-size:0.875rem}.wrapper .button-wrapper>.dropdown.upwards{top:unset;bottom:calc(100% - 2.5rem);-ms-transform-origin:center bottom;-webkit-transform-origin:center bottom;-moz-transform-origin:center bottom;transform-origin:center bottom}.wrapper .button-wrapper>.dropdown.hidden{visibility:hidden}.wrapper .button-wrapper>.dropdown.open{-ms-transform:scale(1, 1);-webkit-transform:scale(1, 1);-moz-transform:scale(1, 1);transform:scale(1, 1)}.wrapper.invalid .button-wrapper .displayedoption{-webkit-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);-moz-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);box-shadow:0 0 0 1px var(--wmcolor-input-border-error);border-color:var(--wmcolor-input-border-error)}.wrapper .error-message{display:block;font-style:italic;color:var(--wmcolor-text-error);font-size:0.875rem;margin-bottom:0.25rem;top:100%;left:0}.wrapper .error-message:not(:empty){margin-top:0.25rem}.options-wrapper{max-height:12.5rem;overflow:auto}.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}.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}.rtl>.dropdown{-ms-transform-origin:left top;-webkit-transform-origin:left top;-moz-transform-origin:left top;transform-origin:left top;left:0;right:auto}.rtl>.dropdown .option{padding-left:3rem;padding-right:1.25rem}.rtl>.displayedoption{padding:0 0.9375rem 0 1.875rem;text-align:right}.rtl>.displayedoption:before{right:auto;left:0.5625rem}';var Select=function(){function e(e){var t=this;registerInstance(this,e);this.wmSelectDidLoad=createEvent(this,"wmSelectDidLoad",7);this.wmSelectBlurred=createEvent(this,"wmSelectBlurred",7);this.wmSelectSearchChanged=createEvent(this,"wmSelectSearchChanged",7);this.wmSelectAllSelected=createEvent(this,"wmSelectAllSelected",7);this.wmSelectAllDeselected=createEvent(this,"wmSelectAllDeselected",7);this.selectAllMessage=intl.formatMessage({id:"select.selectAll",defaultMessage:"Select All"});this.deselectAllMessage=intl.formatMessage({id:"select.deselectAll",defaultMessage:"Deselect All"});this.allOptionsSelectedMessage=intl.formatMessage({id:"select.allOptionsSelected",defaultMessage:"All options selected"});this.allOptionsDeselectedMessage=intl.formatMessage({id:"select.allOptionsDeselected",defaultMessage:"All options deselected"});this.keysSoFar="";this.searchIndex=0;this.openUp=false;this.overflowCount=0;this.displayedOptions=[];this.debouncedClearKeysSoFar=debounce((function(){t.keysSoFar=""}),500);this.debouncedSearch=debounce((function(){t.wmSelectSearchChanged.emit({searchTerm:t.searchTerm});if(t.filteredOptions.length){t.announce(t.resultsFoundMessage)}else{t.announce(t.noResultsFoundMessage)}}),150);this.disabled=false;this.maxHeight=undefined;this.label=undefined;this.labelPosition="top";this.requiredField=false;this.errorMessage=undefined;this.multiple=false;this.search=false;this.selectAll=false;this.placeholder=intl.formatMessage({id:"select.multiPlaceholder",defaultMessage:"Make a selection",description:"Placeholder text. Use imperative"});this.searchPlaceholder=intl.formatMessage({id:"select.searchPlaceholder",defaultMessage:"Search",description:"Placeholder text. Use imperative"});this.allSelectedMessage=intl.formatMessage({id:"select.allSelected",defaultMessage:"All selected",description:"Text displayed when all options are selected"});this.isExpanded=false;this.announcement=""}Object.defineProperty(e.prototype,"childOptions",{get:function(){return Array.from(this.el.querySelectorAll("wm-option"))},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"cloneOptions",{get:function(){return Array.from(this.el.shadowRoot.querySelectorAll("wm-option"))},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"allOptionEls",{get:function(){return this.cloneOptions.concat(this.childOptions)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"visibleOptionEls",{get:function(){return this.allOptionEls.filter((function(e){return!e.classList.contains("hidden")&&!e.classList.contains("filtered-out")}))},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isDisabled",{get:function(){return toBool(this.disabled)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"searchTerm",{get:function(){return this.searchFieldEl?this.searchFieldEl.value:""},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"filteredOptions",{get:function(){var e=this;return this.childOptions.filter((function(t){var i;return(i=t.textContent)===null||i===void 0?void 0:i.toLowerCase().includes(e.searchTerm.toLowerCase())}))},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"selectedOptions",{get:function(){return Array.from(this.el.querySelectorAll("wm-option")).filter((function(e){return e.selected}))},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"allSelected",{get:function(){return this.childOptions.every((function(e){return e.selected}))},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"visibleSelectAllButton",{get:function(){return this.selectAll&&this.multiple&&this.searchTerm===""},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"resultsFoundMessage",{get:function(){return intl.formatMessage({id:"select.searchResultsFound",defaultMessage:"{numResults, plural, one {1 option found} other {# options found}}",description:"The message read by the screen reader, indicating how many results a search returned"},{numResults:this.filteredOptions.length})},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"noResultsFoundMessage",{get:function(){return intl.formatMessage({id:"select.noSearchResults",defaultMessage:"No results found. Please try your search again.",description:"The message displayed when no options pass the search filter"})},enumerable:false,configurable:true});e.prototype.handleOptionSelection=function(e){this.focusOption(e.detail);if(!this.multiple){this.close()}};e.prototype.handleOptionCloneSelection=function(e){var t=this.findCorrespondingOption(e.detail);t.click()};e.prototype.handleChildEnter=function(){this.close()};e.prototype.handleChildUp=function(e){this.moveUp(e.detail)};e.prototype.handleChildDown=function(e){this.moveDown(e.detail)};e.prototype.moveToFirstOption=function(){this.focusOption(this.visibleOptionEls[0])};e.prototype.moveToLastOption=function(){this.focusOption(this.visibleOptionEls[this.visibleOptionEls.length-1])};e.prototype.closePopupOnEscape=function(){this.close()};e.prototype.handleOptionBlur=function(e){if(!this.isElOrChild(e.detail.relatedTarget)){var t=new CustomEvent("blur");t.relatedTarget=e.detail.relatedTarget;this.el.dispatchEvent(t)}};e.prototype.handleClick=function(e){if(!this.isElOrChild(e.target)){this.close()}};e.prototype.handleSelectAllClick=function(){this.allSelected?this.deselectAllOptions():this.selectAllOptions()};e.prototype.selectAllOptions=function(){this.announce(this.allOptionsSelectedMessage);this.wmSelectAllSelected.emit()};e.prototype.deselectAllOptions=function(){this.announce(this.allOptionsDeselectedMessage);this.wmSelectAllDeselected.emit()};e.prototype.handleButtonBlur=function(e){if(this.isElOrChild(e.relatedTarget)){e.stopPropagation()}};e.prototype.handleSearchFieldBlur=function(e){this.searchFieldWrapperEl.classList.remove("focus");if(this.isElOrChild(e.relatedTarget)){e.stopPropagation()}};e.prototype.handleKey=function(e){switch(e.key){case"ArrowDown":if(this.isExpanded===false){e.preventDefault();this.open("next")}break;case"ArrowUp":if(this.isExpanded===false){e.preventDefault();this.open("previous")}break}};e.prototype.componentWillLoad=function(){var e=this;if(!this.label){console.error("For accessibility purposes, this component requires a label (even if `label-position` is set to `none`).")}if(!this.multiple&&this.selectedOptions.length===0){console.error("wm-select should have one initial option selected")}handleDisabledAttribute(this.el,this.isDisabled);var t=new MutationObserver((function(t){return t.forEach((function(t){return e.handleChildChange(t)}))}));t.observe(this.el,{childList:true,attributes:true,subtree:true,attributeFilter:["selected"]})};e.prototype.handleChildChange=function(e){this.setButtonText();forceUpdate(this.el)};e.prototype.componentDidLoad=function(){this.wmSelectDidLoad.emit();this.dropdownEl.classList.add("hidden");forceUpdate(this.el);if(this.maxHeight){this.listboxEl.style.maxHeight=this.maxHeight}if(this.multiple){this.updateOptionVisibility()}this.setButtonText()};e.prototype.componentWillUpdate=function(){if(this.multiple){var e=this.visibleOptionEls.filter((function(e){return e.classList.contains("clone")}));var t=e.length===this.visibleOptionEls.length;e.forEach((function(i,r){if(!t&&r===e.length-1){i.classList.add("last")}else{i.classList.remove("last")}}))}};e.prototype.moveUp=function(e){var t=this.visibleOptionEls;if(this.selectAllEl){t.unshift(this.selectAllEl)}if(this.searchFieldEl){t.unshift(this.searchFieldEl)}var i=t[t.indexOf(e)-1]||t[t.length-1];if(i){this.focusOption(i)}};e.prototype.moveDown=function(e){var t=this.visibleOptionEls;if(this.selectAllEl){t.unshift(this.selectAllEl)}if(this.searchFieldEl){t.unshift(this.searchFieldEl)}var i=t[t.indexOf(e)+1]||t[0];if(i){this.focusOption(i)}};e.prototype.open=function(e){var t=this;if(!this.isDisabled){var i=this.el.clientHeight;var r=this.buttonEl.clientHeight;this.openUp=shouldOpenUp(this.el,this.dropdownEl.clientHeight,i,r);this.isExpanded=true;this.dropdownEl.classList.remove("hidden");window.requestAnimationFrame((function(){switch(e){case"next":if(t.search){t.searchFieldEl.focus();t.listboxEl.scrollTop=0}else{t.moveDown(t.visibleOptionEls.filter((function(e){return e.selected})).slice(-1)[0])}break;case"previous":if(t.search){t.focusOption(t.visibleOptionEls[t.visibleOptionEls.length-1])}else{t.moveUp(t.visibleOptionEls.filter((function(e){return e.selected}))[0])}break;default:if(t.search){t.searchFieldEl.focus();t.listboxEl.scrollTop=0}else if(t.selectedOptions.length>0){t.focusOption(t.visibleOptionEls.filter((function(e){return e.selected}))[0])}else{t.focusOption(t.visibleOptionEls[0])}break}}))}};e.prototype.close=function(e){var t=this;if(e===void 0){e=true}if(this.isExpanded){this.isExpanded=false;this.allOptionEls.map((function(e){return e.focused=false}));window.setTimeout((function(){t.dropdownEl.classList.add("hidden");if(t.multiple){t.updateOptionVisibility()}if(t.search){t.searchFieldEl.value="";t.wmSelectSearchChanged.emit({searchTerm:t.searchTerm})}if(e){t.buttonEl.focus()}}),150)}};e.prototype.updateOptionVisibility=function(){var e=this;this.childOptions.forEach((function(t,i){var r=e.cloneOptions[i];if(t.selected){t.classList.add("hidden");r.classList.remove("hidden")}else{t.classList.remove("hidden");r.classList.add("hidden")}}))};e.prototype.focusOption=function(e){this.allOptionEls.forEach((function(t){return t.focused=t===e}));e.scrollIntoView({block:"nearest"});window.setTimeout((function(){return e.scrollIntoView({block:"nearest"})}),60);e.focus()};e.prototype.findAndFocusOption=function(e){var t=this;var i=e.detail.letter.toLowerCase();var r=e.detail.optionEl;if(!this.keysSoFar&&i==" "){r.click()}else{if(!this.keysSoFar){this.visibleOptionEls.forEach((function(e,i){if(e.focused){t.searchIndex=i}}))}this.keysSoFar+=i;var o=this.findMatchInRange(this.visibleOptionEls,this.searchIndex+1,this.visibleOptionEls.length);if(!o){o=this.findMatchInRange(this.visibleOptionEls,0,this.searchIndex)}if(o){this.focusOption(o)}this.debouncedClearKeysSoFar()}};e.prototype.findMatchInRange=function(e,t,i){var r=this;var o=null;var n=e.slice(t,i);n.forEach((function(e){var t=e.textContent;if(!o&&t&&t.toLowerCase().startsWith(r.keysSoFar)){o=e}}));return o};e.prototype.findCorrespondingOption=function(e){var t=e.classList.contains("clone");return t?this.childOptions[this.cloneOptions.indexOf(e)]:this.cloneOptions[this.childOptions.indexOf(e)]};e.prototype.isElOrChild=function(e){var t;return e===this.el||this.el.contains(e)||((t=this.el.shadowRoot)===null||t===void 0?void 0:t.contains(e))};e.prototype.announceError=function(){var e=this;if(this.errorMessage){setTimeout((function(){return e.announce(e.errorMessage)}),100)}};e.prototype.handleDisabledChange=function(){handleDisabledAttribute(this.el,this.isDisabled)};e.prototype.handleComponentBlur=function(e){if(!this.el.contains(e.relatedTarget)){this.close(false);this.wmSelectBlurred.emit()}};e.prototype.handleKeyDown=function(e){var t=e.target;switch(e.key){case"ArrowDown":e.preventDefault();this.moveDown(e.target);break;case"ArrowUp":e.preventDefault();this.moveUp(e.target);break;case"Escape":e.preventDefault();this.close();break;case"Enter":if(t===this.selectAllEl){e.preventDefault();this.handleSelectAllClick();this.close()}break;case" ":if(t===this.selectAllEl){e.preventDefault();this.handleSelectAllClick()}break}};e.prototype.setButtonText=function(){var e=this;this.displayedOptions=this.childOptions.filter((function(e){return e.selected})).map((function(t){return!t.classList.contains("hidden")?t:e.findCorrespondingOption(t)}));if(this.multiple){var t=38;var i=window.getComputedStyle(this.buttonEl);var r=parseInt(i.getPropertyValue("padding-left").slice(0,-2));var o=parseInt(i.getPropertyValue("padding-right").slice(0,-2));var n=this.buttonEl.clientWidth-r-o-t;var s=this.displayedOptions.map((function(e){return e.shadowRoot.querySelector(".option-text").clientWidth}));var a=s.reduce((function(e,t){return e+t}),0);this.overflowCount=0;while(a>n&&this.displayedOptions.length>1){this.overflowCount++;a-=s[s.length-1];s.pop();this.displayedOptions.pop()}}};e.prototype.announce=function(e){if(this.liveRegionEl.textContent===e){e+=" "}this.announcement=e};e.prototype.renderButtonText=function(){if(this.multiple&&this.displayedOptions.length<1){return h("span",null,this.placeholder)}else if(this.multiple&&this.allSelected&&this.overflowCount>0){return this.allSelectedMessage}else{return this.displayedOptions.map((function(e,t){return h("span",null,t>0?", ":"",e.textContent)}))}};e.prototype.renderOverflowCount=function(){if(this.overflowCount>0&&!this.allSelected){return h("span",null,h("span",{class:"overflow-counter"},"+",this.overflowCount))}};e.prototype.renderSearchField=function(){var e=this;return h("div",{class:"search"},h("div",{class:"searchfield-wrapper",ref:function(t){return e.searchFieldWrapperEl=t}},h("div",{class:"icon"}),h("input",{ref:function(t){return e.searchFieldEl=t},class:"searchfield",role:"combobox","aria-controls":"list","aria-expanded":this.isExpanded?"true":"false",onKeyDown:function(t){return e.handleKeyDown(t)},onFocus:function(){return e.searchFieldWrapperEl.classList.add("focus")},onBlur:function(t){return e.handleSearchFieldBlur(t)},onInput:function(){return e.debouncedSearch()},placeholder:this.searchPlaceholder})))};e.prototype.renderSearchFailedMessage=function(){return h("div",{class:"search-results-message"},this.noResultsFoundMessage)};e.prototype.renderSelectAllButton=function(){var e=this;return h("button",{ref:function(t){return e.selectAllEl=t},class:"select-all",onClick:function(){return e.handleSelectAllClick()},onKeyDown:function(t){return e.handleKeyDown(t)},tabindex:"-1"},this.allSelected?this.deselectAllMessage:this.selectAllMessage)};e.prototype.renderCloneOptions=function(){return Array.from(this.el.children).map((function(e){var t=e;return h("wm-option",{class:"clone",subinfo:t.subinfo,selected:t.selected},t.textContent)}))};e.prototype.render=function(){var e;var t=this;var i=!this.multiple&&this.selectedOptions.length>0&&this.selectedOptions[0].subinfo;var r=(e={id:"selectbtn"},e["disabled"]=this.isDisabled,e["aria-controls"]="list",e["aria-labelledby"]="label selectbtn",e["aria-describedby"]="error",e["aria-expanded"]=this.isExpanded?"true":"false",e.onClick=function(){return t.isExpanded?t.close():t.open()},e);return h(Host,{onBlur:function(e){return t.handleComponentBlur(e)}},h("div",{class:"wrapper ".concat(getTextDir()," label-").concat(this.labelPosition," ").concat(this.errorMessage?"invalid":"")},h("div",{class:"label-wrapper"},h("label",{class:"label",id:"label",htmlFor:"selectbtn"},this.label,this.requiredField?h("span",{class:"required"},h("span",{class:"sr-only"},globalMessages.requiredField),h("span",{"aria-hidden":"true"},"*")):"")),h("div",{class:"button-wrapper"},h("button",Object.assign({},r,{class:"displayedoption",ref:function(e){return t.buttonEl=e},onBlur:function(e){return t.handleButtonBlur(e)},onFocus:function(){return t.close()}}),h("span",{class:"overflowcontrol ".concat(i?"hassubinfo":"")},h("span",{class:"button-text"},this.renderButtonText()),i&&h("span",{class:"subinfo"},this.selectedOptions[0].subinfo)),this.renderOverflowCount()),h("div",{class:"dropdown ".concat(this.isExpanded?"open":""," ").concat(this.openUp?"upwards":""),ref:function(e){return t.dropdownEl=e}},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:function(e){return t.listboxEl=e}},this.search&&this.filteredOptions.length===0&&this.renderSearchFailedMessage(),this.multiple&&this.renderCloneOptions(),h("slot",null))),h("div",{id:"error",class:this.errorMessage?"error-message":""},this.errorMessage),h("div",{id:"announcement","aria-live":"polite","aria-atomic":"true",class:"sr-only",ref:function(e){return t.liveRegionEl=e}},this.announcement))))};Object.defineProperty(e,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{errorMessage:["announceError"],disabled:["handleDisabledChange"]}},enumerable:false,configurable:true});return e}();Select.style=wmSelectCss;export{Option as wm_option,Select as wm_select};