@refinitiv-ui/elements 5.3.3 → 5.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (617) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/lib/accordion/custom-elements.json +49 -0
  3. package/lib/accordion/custom-elements.md +18 -0
  4. package/lib/accordion/index.d.ts +76 -0
  5. package/lib/accordion/index.js +136 -0
  6. package/lib/accordion/themes/halo/dark/index.js +3 -0
  7. package/lib/accordion/themes/halo/light/index.js +3 -0
  8. package/lib/accordion/themes/solar/charcoal/index.js +3 -0
  9. package/lib/accordion/themes/solar/pearl/index.js +3 -0
  10. package/lib/appstate-bar/custom-elements.json +49 -0
  11. package/lib/appstate-bar/custom-elements.md +22 -0
  12. package/lib/appstate-bar/index.d.ts +65 -0
  13. package/lib/appstate-bar/index.js +100 -0
  14. package/lib/appstate-bar/themes/halo/dark/index.js +3 -0
  15. package/lib/appstate-bar/themes/halo/light/index.js +3 -0
  16. package/lib/appstate-bar/themes/solar/charcoal/index.js +3 -0
  17. package/lib/appstate-bar/themes/solar/pearl/index.js +3 -0
  18. package/lib/autosuggest/custom-elements.json +233 -0
  19. package/lib/autosuggest/custom-elements.md +47 -0
  20. package/lib/autosuggest/helpers/types.d.ts +54 -0
  21. package/lib/autosuggest/helpers/types.js +1 -0
  22. package/lib/autosuggest/helpers/utils.d.ts +39 -0
  23. package/lib/autosuggest/helpers/utils.js +75 -0
  24. package/lib/autosuggest/index.d.ts +534 -0
  25. package/lib/autosuggest/index.js +1251 -0
  26. package/lib/autosuggest/themes/halo/dark/index.js +5 -0
  27. package/lib/autosuggest/themes/halo/light/index.js +5 -0
  28. package/lib/autosuggest/themes/solar/charcoal/index.js +5 -0
  29. package/lib/autosuggest/themes/solar/pearl/index.js +5 -0
  30. package/lib/button/custom-elements.json +119 -0
  31. package/lib/button/custom-elements.md +23 -0
  32. package/lib/button/index.d.ts +132 -0
  33. package/lib/button/index.js +223 -0
  34. package/lib/button/themes/halo/dark/index.js +3 -0
  35. package/lib/button/themes/halo/light/index.js +3 -0
  36. package/lib/button/themes/solar/charcoal/index.js +3 -0
  37. package/lib/button/themes/solar/pearl/index.js +3 -0
  38. package/lib/button-bar/custom-elements.json +26 -0
  39. package/lib/button-bar/custom-elements.md +9 -0
  40. package/lib/button-bar/index.d.ts +76 -0
  41. package/lib/button-bar/index.js +155 -0
  42. package/lib/button-bar/themes/halo/dark/index.js +3 -0
  43. package/lib/button-bar/themes/halo/light/index.js +3 -0
  44. package/lib/button-bar/themes/solar/charcoal/index.js +3 -0
  45. package/lib/button-bar/themes/solar/pearl/index.js +3 -0
  46. package/lib/calendar/constants.d.ts +22 -0
  47. package/lib/calendar/constants.js +23 -0
  48. package/lib/calendar/custom-elements.json +199 -0
  49. package/lib/calendar/custom-elements.md +35 -0
  50. package/lib/calendar/index.d.ts +321 -0
  51. package/lib/calendar/index.js +906 -0
  52. package/lib/calendar/locales.d.ts +1 -0
  53. package/lib/calendar/locales.js +40 -0
  54. package/lib/calendar/themes/halo/dark/index.js +3 -0
  55. package/lib/calendar/themes/halo/light/index.js +3 -0
  56. package/lib/calendar/themes/solar/charcoal/index.js +3 -0
  57. package/lib/calendar/themes/solar/pearl/index.js +3 -0
  58. package/lib/calendar/types.d.ts +29 -0
  59. package/lib/calendar/types.js +1 -0
  60. package/lib/calendar/utils.d.ts +42 -0
  61. package/lib/calendar/utils.js +119 -0
  62. package/lib/canvas/custom-elements.json +69 -0
  63. package/lib/canvas/custom-elements.md +27 -0
  64. package/lib/canvas/index.d.ts +100 -0
  65. package/lib/canvas/index.js +172 -0
  66. package/lib/canvas/themes/halo/dark/index.js +2 -0
  67. package/lib/canvas/themes/halo/light/index.js +2 -0
  68. package/lib/canvas/themes/solar/charcoal/index.js +2 -0
  69. package/lib/canvas/themes/solar/pearl/index.js +2 -0
  70. package/lib/card/custom-elements.json +59 -0
  71. package/lib/card/custom-elements.md +24 -0
  72. package/lib/card/helpers/types.d.ts +12 -0
  73. package/lib/card/helpers/types.js +1 -0
  74. package/lib/card/index.d.ts +140 -0
  75. package/lib/card/index.js +246 -0
  76. package/lib/card/themes/halo/dark/index.js +5 -0
  77. package/lib/card/themes/halo/light/index.js +5 -0
  78. package/lib/card/themes/solar/charcoal/index.js +5 -0
  79. package/lib/card/themes/solar/pearl/index.js +5 -0
  80. package/lib/chart/custom-elements.json +42 -0
  81. package/lib/chart/custom-elements.md +16 -0
  82. package/lib/chart/helpers/index.d.ts +2 -0
  83. package/lib/chart/helpers/index.js +2 -0
  84. package/lib/chart/helpers/legend.d.ts +5 -0
  85. package/lib/chart/helpers/legend.js +78 -0
  86. package/lib/chart/helpers/merge.d.ts +15 -0
  87. package/lib/chart/helpers/merge.js +28 -0
  88. package/lib/chart/helpers/types.d.ts +69 -0
  89. package/lib/chart/helpers/types.js +1 -0
  90. package/lib/chart/index.d.ts +187 -0
  91. package/lib/chart/index.js +491 -0
  92. package/lib/chart/plugins/doughnut-center-label.d.ts +3 -0
  93. package/lib/chart/plugins/doughnut-center-label.js +196 -0
  94. package/lib/chart/themes/halo/dark/index.js +4 -0
  95. package/lib/chart/themes/halo/light/index.js +4 -0
  96. package/lib/chart/themes/solar/charcoal/index.js +4 -0
  97. package/lib/chart/themes/solar/pearl/index.js +4 -0
  98. package/lib/checkbox/custom-elements.json +67 -0
  99. package/lib/checkbox/custom-elements.md +18 -0
  100. package/lib/checkbox/index.d.ts +95 -0
  101. package/lib/checkbox/index.js +193 -0
  102. package/lib/checkbox/themes/halo/dark/index.js +4 -0
  103. package/lib/checkbox/themes/halo/light/index.js +4 -0
  104. package/lib/checkbox/themes/solar/charcoal/index.js +4 -0
  105. package/lib/checkbox/themes/solar/pearl/index.js +4 -0
  106. package/lib/clock/custom-elements.json +121 -0
  107. package/lib/clock/custom-elements.md +28 -0
  108. package/lib/clock/index.d.ts +319 -0
  109. package/lib/clock/index.js +581 -0
  110. package/lib/clock/themes/halo/dark/index.js +2 -0
  111. package/lib/clock/themes/halo/light/index.js +2 -0
  112. package/lib/clock/themes/solar/charcoal/index.js +2 -0
  113. package/lib/clock/themes/solar/pearl/index.js +2 -0
  114. package/lib/clock/utils/TickManager.d.ts +14 -0
  115. package/lib/clock/utils/TickManager.js +66 -0
  116. package/lib/clock/utils/timestamps.d.ts +6 -0
  117. package/lib/clock/utils/timestamps.js +6 -0
  118. package/lib/collapse/custom-elements.json +79 -0
  119. package/lib/collapse/custom-elements.md +27 -0
  120. package/lib/collapse/index.d.ts +119 -0
  121. package/lib/collapse/index.js +197 -0
  122. package/lib/collapse/themes/halo/dark/index.js +5 -0
  123. package/lib/collapse/themes/halo/light/index.js +5 -0
  124. package/lib/collapse/themes/solar/charcoal/index.js +5 -0
  125. package/lib/collapse/themes/solar/pearl/index.js +5 -0
  126. package/lib/color-dialog/custom-elements.json +193 -0
  127. package/lib/color-dialog/custom-elements.md +39 -0
  128. package/lib/color-dialog/elements/color-palettes.d.ts +52 -0
  129. package/lib/color-dialog/elements/color-palettes.js +101 -0
  130. package/lib/color-dialog/elements/grayscale-palettes.d.ts +67 -0
  131. package/lib/color-dialog/elements/grayscale-palettes.js +161 -0
  132. package/lib/color-dialog/elements/palettes.d.ts +65 -0
  133. package/lib/color-dialog/elements/palettes.js +132 -0
  134. package/lib/color-dialog/helpers/color-helpers.d.ts +16 -0
  135. package/lib/color-dialog/helpers/color-helpers.js +161 -0
  136. package/lib/color-dialog/helpers/value-model.d.ts +75 -0
  137. package/lib/color-dialog/helpers/value-model.js +141 -0
  138. package/lib/color-dialog/index.d.ts +232 -0
  139. package/lib/color-dialog/index.js +459 -0
  140. package/lib/color-dialog/themes/halo/dark/index.js +7 -0
  141. package/lib/color-dialog/themes/halo/light/index.js +7 -0
  142. package/lib/color-dialog/themes/solar/charcoal/index.js +7 -0
  143. package/lib/color-dialog/themes/solar/pearl/index.js +7 -0
  144. package/lib/combo-box/custom-elements.json +210 -0
  145. package/lib/combo-box/custom-elements.md +35 -0
  146. package/lib/combo-box/helpers/filter.d.ts +10 -0
  147. package/lib/combo-box/helpers/filter.js +29 -0
  148. package/lib/combo-box/helpers/keyboard-event.d.ts +17 -0
  149. package/lib/combo-box/helpers/keyboard-event.js +19 -0
  150. package/lib/combo-box/helpers/types.d.ts +11 -0
  151. package/lib/combo-box/helpers/types.js +1 -0
  152. package/lib/combo-box/index.d.ts +523 -0
  153. package/lib/combo-box/index.js +1146 -0
  154. package/lib/combo-box/themes/halo/dark/index.js +8 -0
  155. package/lib/combo-box/themes/halo/light/index.js +8 -0
  156. package/lib/combo-box/themes/solar/charcoal/index.js +8 -0
  157. package/lib/combo-box/themes/solar/pearl/index.js +8 -0
  158. package/lib/counter/custom-elements.json +35 -0
  159. package/lib/counter/custom-elements.md +11 -0
  160. package/lib/counter/index.d.ts +89 -0
  161. package/lib/counter/index.js +152 -0
  162. package/lib/counter/themes/halo/dark/index.js +3 -0
  163. package/lib/counter/themes/halo/light/index.js +3 -0
  164. package/lib/counter/themes/solar/charcoal/index.js +3 -0
  165. package/lib/counter/themes/solar/pearl/index.js +3 -0
  166. package/lib/counter/utils.d.ts +13 -0
  167. package/lib/counter/utils.js +52 -0
  168. package/lib/datetime-picker/custom-elements.json +333 -0
  169. package/lib/datetime-picker/custom-elements.md +49 -0
  170. package/lib/datetime-picker/index.d.ts +498 -0
  171. package/lib/datetime-picker/index.js +1164 -0
  172. package/lib/datetime-picker/locales.d.ts +8 -0
  173. package/lib/datetime-picker/locales.js +57 -0
  174. package/lib/datetime-picker/themes/halo/dark/index.js +7 -0
  175. package/lib/datetime-picker/themes/halo/light/index.js +7 -0
  176. package/lib/datetime-picker/themes/solar/charcoal/index.js +7 -0
  177. package/lib/datetime-picker/themes/solar/pearl/index.js +7 -0
  178. package/lib/datetime-picker/types.d.ts +3 -0
  179. package/lib/datetime-picker/types.js +1 -0
  180. package/lib/datetime-picker/utils.d.ts +55 -0
  181. package/lib/datetime-picker/utils.js +92 -0
  182. package/lib/dialog/custom-elements.json +136 -0
  183. package/lib/dialog/custom-elements.md +47 -0
  184. package/lib/dialog/draggable-element.d.ts +14 -0
  185. package/lib/dialog/draggable-element.js +221 -0
  186. package/lib/dialog/index.d.ts +199 -0
  187. package/lib/dialog/index.js +331 -0
  188. package/lib/dialog/themes/halo/dark/index.js +7 -0
  189. package/lib/dialog/themes/halo/light/index.js +7 -0
  190. package/lib/dialog/themes/solar/charcoal/index.js +7 -0
  191. package/lib/dialog/themes/solar/pearl/index.js +7 -0
  192. package/lib/email-field/custom-elements.json +199 -0
  193. package/lib/email-field/custom-elements.md +35 -0
  194. package/lib/email-field/index.d.ts +152 -0
  195. package/lib/email-field/index.js +286 -0
  196. package/lib/email-field/themes/halo/dark/index.js +3 -0
  197. package/lib/email-field/themes/halo/light/index.js +3 -0
  198. package/lib/email-field/themes/solar/charcoal/index.js +3 -0
  199. package/lib/email-field/themes/solar/pearl/index.js +3 -0
  200. package/lib/events.d.ts +121 -0
  201. package/lib/events.js +1 -0
  202. package/lib/flag/custom-elements.json +35 -0
  203. package/lib/flag/custom-elements.md +10 -0
  204. package/lib/flag/index.d.ts +94 -0
  205. package/lib/flag/index.js +166 -0
  206. package/lib/flag/themes/halo/dark/index.js +2 -0
  207. package/lib/flag/themes/halo/light/index.js +2 -0
  208. package/lib/flag/themes/solar/charcoal/index.js +2 -0
  209. package/lib/flag/themes/solar/pearl/index.js +2 -0
  210. package/lib/flag/utils/FlagLoader.d.ts +47 -0
  211. package/lib/flag/utils/FlagLoader.js +86 -0
  212. package/lib/header/custom-elements.json +36 -0
  213. package/lib/header/custom-elements.md +18 -0
  214. package/lib/header/index.d.ts +46 -0
  215. package/lib/header/index.js +73 -0
  216. package/lib/header/themes/halo/dark/index.js +2 -0
  217. package/lib/header/themes/halo/light/index.js +2 -0
  218. package/lib/header/themes/solar/charcoal/index.js +2 -0
  219. package/lib/header/themes/solar/pearl/index.js +2 -0
  220. package/lib/heatmap/custom-elements.json +151 -0
  221. package/lib/heatmap/custom-elements.md +26 -0
  222. package/lib/heatmap/helpers/color.d.ts +30 -0
  223. package/lib/heatmap/helpers/color.js +68 -0
  224. package/lib/heatmap/helpers/text.d.ts +26 -0
  225. package/lib/heatmap/helpers/text.js +91 -0
  226. package/lib/heatmap/helpers/track.d.ts +102 -0
  227. package/lib/heatmap/helpers/track.js +160 -0
  228. package/lib/heatmap/helpers/types.d.ts +40 -0
  229. package/lib/heatmap/helpers/types.js +1 -0
  230. package/lib/heatmap/index.d.ts +453 -0
  231. package/lib/heatmap/index.js +1103 -0
  232. package/lib/heatmap/themes/halo/dark/index.js +4 -0
  233. package/lib/heatmap/themes/halo/light/index.js +4 -0
  234. package/lib/heatmap/themes/solar/charcoal/index.js +4 -0
  235. package/lib/heatmap/themes/solar/pearl/index.js +4 -0
  236. package/lib/icon/custom-elements.json +36 -0
  237. package/lib/icon/custom-elements.md +8 -0
  238. package/lib/icon/index.d.ts +88 -0
  239. package/lib/icon/index.js +169 -0
  240. package/lib/icon/themes/halo/dark/index.js +2 -0
  241. package/lib/icon/themes/halo/light/index.js +2 -0
  242. package/lib/icon/themes/solar/charcoal/index.js +2 -0
  243. package/lib/icon/themes/solar/pearl/index.js +2 -0
  244. package/lib/icon/utils/IconLoader.d.ts +52 -0
  245. package/lib/icon/utils/IconLoader.js +93 -0
  246. package/lib/index.d.ts +3 -0
  247. package/lib/index.js +3 -0
  248. package/lib/interactive-chart/custom-elements.json +86 -0
  249. package/lib/interactive-chart/custom-elements.md +32 -0
  250. package/lib/interactive-chart/helpers/merge.d.ts +15 -0
  251. package/lib/interactive-chart/helpers/merge.js +28 -0
  252. package/lib/interactive-chart/helpers/types.d.ts +45 -0
  253. package/lib/interactive-chart/helpers/types.js +6 -0
  254. package/lib/interactive-chart/index.d.ts +380 -0
  255. package/lib/interactive-chart/index.js +1090 -0
  256. package/lib/interactive-chart/themes/halo/dark/index.js +3 -0
  257. package/lib/interactive-chart/themes/halo/light/index.js +3 -0
  258. package/lib/interactive-chart/themes/solar/charcoal/index.js +3 -0
  259. package/lib/interactive-chart/themes/solar/pearl/index.js +3 -0
  260. package/lib/item/custom-elements.json +151 -0
  261. package/lib/item/custom-elements.md +29 -0
  262. package/lib/item/helpers/types.d.ts +57 -0
  263. package/lib/item/helpers/types.js +1 -0
  264. package/lib/item/index.d.ts +158 -0
  265. package/lib/item/index.js +271 -0
  266. package/lib/item/themes/halo/dark/index.js +4 -0
  267. package/lib/item/themes/halo/light/index.js +4 -0
  268. package/lib/item/themes/solar/charcoal/index.js +4 -0
  269. package/lib/item/themes/solar/pearl/index.js +4 -0
  270. package/lib/jsx.d.ts +223 -0
  271. package/lib/label/custom-elements.json +52 -0
  272. package/lib/label/custom-elements.md +11 -0
  273. package/lib/label/index.d.ts +102 -0
  274. package/lib/label/index.js +244 -0
  275. package/lib/label/themes/halo/dark/index.js +3 -0
  276. package/lib/label/themes/halo/light/index.js +3 -0
  277. package/lib/label/themes/solar/charcoal/index.js +3 -0
  278. package/lib/label/themes/solar/pearl/index.js +3 -0
  279. package/lib/layout/custom-elements.json +163 -0
  280. package/lib/layout/custom-elements.md +26 -0
  281. package/lib/layout/index.d.ts +107 -0
  282. package/lib/layout/index.js +212 -0
  283. package/lib/layout/themes/halo/dark/index.js +2 -0
  284. package/lib/layout/themes/halo/light/index.js +2 -0
  285. package/lib/layout/themes/solar/charcoal/index.js +2 -0
  286. package/lib/layout/themes/solar/pearl/index.js +2 -0
  287. package/lib/led-gauge/custom-elements.json +113 -0
  288. package/lib/led-gauge/custom-elements.md +17 -0
  289. package/lib/led-gauge/index.d.ts +143 -0
  290. package/lib/led-gauge/index.js +437 -0
  291. package/lib/led-gauge/themes/halo/dark/index.js +3 -0
  292. package/lib/led-gauge/themes/halo/light/index.js +3 -0
  293. package/lib/led-gauge/themes/solar/charcoal/index.js +3 -0
  294. package/lib/led-gauge/themes/solar/pearl/index.js +3 -0
  295. package/lib/list/custom-elements.json +111 -0
  296. package/lib/list/custom-elements.md +30 -0
  297. package/lib/list/extensible-function.d.ts +8 -0
  298. package/lib/list/extensible-function.js +13 -0
  299. package/lib/list/helpers/list-renderer.d.ts +9 -0
  300. package/lib/list/helpers/list-renderer.js +35 -0
  301. package/lib/list/helpers/types.d.ts +3 -0
  302. package/lib/list/helpers/types.js +1 -0
  303. package/lib/list/index.d.ts +292 -0
  304. package/lib/list/index.js +600 -0
  305. package/lib/list/renderer.d.ts +36 -0
  306. package/lib/list/renderer.js +9 -0
  307. package/lib/list/themes/halo/dark/index.js +3 -0
  308. package/lib/list/themes/halo/light/index.js +3 -0
  309. package/lib/list/themes/solar/charcoal/index.js +3 -0
  310. package/lib/list/themes/solar/pearl/index.js +3 -0
  311. package/lib/loader/custom-elements.json +9 -0
  312. package/lib/loader/custom-elements.md +5 -0
  313. package/lib/loader/index.d.ts +41 -0
  314. package/lib/loader/index.js +61 -0
  315. package/lib/loader/themes/halo/dark/index.js +2 -0
  316. package/lib/loader/themes/halo/light/index.js +2 -0
  317. package/lib/loader/themes/solar/charcoal/index.js +2 -0
  318. package/lib/loader/themes/solar/pearl/index.js +2 -0
  319. package/lib/multi-input/custom-elements.json +238 -0
  320. package/lib/multi-input/custom-elements.md +43 -0
  321. package/lib/multi-input/helpers/types.d.ts +11 -0
  322. package/lib/multi-input/helpers/types.js +1 -0
  323. package/lib/multi-input/index.d.ts +297 -0
  324. package/lib/multi-input/index.js +590 -0
  325. package/lib/multi-input/themes/halo/dark/index.js +4 -0
  326. package/lib/multi-input/themes/halo/light/index.js +4 -0
  327. package/lib/multi-input/themes/solar/charcoal/index.js +4 -0
  328. package/lib/multi-input/themes/solar/pearl/index.js +4 -0
  329. package/lib/notification/custom-elements.json +95 -0
  330. package/lib/notification/custom-elements.md +26 -0
  331. package/lib/notification/elements/notification-tray.d.ts +97 -0
  332. package/lib/notification/elements/notification-tray.js +167 -0
  333. package/lib/notification/elements/notification.d.ts +90 -0
  334. package/lib/notification/elements/notification.js +154 -0
  335. package/lib/notification/helpers/status.d.ts +30 -0
  336. package/lib/notification/helpers/status.js +130 -0
  337. package/lib/notification/helpers/types.d.ts +10 -0
  338. package/lib/notification/helpers/types.js +1 -0
  339. package/lib/notification/index.d.ts +2 -0
  340. package/lib/notification/index.js +2 -0
  341. package/lib/notification/themes/halo/dark/index.js +5 -0
  342. package/lib/notification/themes/halo/light/index.js +5 -0
  343. package/lib/notification/themes/solar/charcoal/index.js +5 -0
  344. package/lib/notification/themes/solar/pearl/index.js +5 -0
  345. package/lib/number-field/custom-elements.json +200 -0
  346. package/lib/number-field/custom-elements.md +37 -0
  347. package/lib/number-field/index.d.ts +294 -0
  348. package/lib/number-field/index.js +707 -0
  349. package/lib/number-field/themes/halo/dark/index.js +3 -0
  350. package/lib/number-field/themes/halo/light/index.js +3 -0
  351. package/lib/number-field/themes/solar/charcoal/index.js +3 -0
  352. package/lib/number-field/themes/solar/pearl/index.js +3 -0
  353. package/lib/overlay/custom-elements.json +345 -0
  354. package/lib/overlay/custom-elements.md +54 -0
  355. package/lib/overlay/elements/overlay-backdrop.d.ts +46 -0
  356. package/lib/overlay/elements/overlay-backdrop.js +64 -0
  357. package/lib/overlay/elements/overlay-viewport.d.ts +40 -0
  358. package/lib/overlay/elements/overlay-viewport.js +52 -0
  359. package/lib/overlay/elements/overlay.d.ts +403 -0
  360. package/lib/overlay/elements/overlay.js +1426 -0
  361. package/lib/overlay/helpers/functions.d.ts +13 -0
  362. package/lib/overlay/helpers/functions.js +16 -0
  363. package/lib/overlay/helpers/types.d.ts +97 -0
  364. package/lib/overlay/helpers/types.js +16 -0
  365. package/lib/overlay/index.d.ts +2 -0
  366. package/lib/overlay/index.js +1 -0
  367. package/lib/overlay/managers/backdrop-manager.d.ts +45 -0
  368. package/lib/overlay/managers/backdrop-manager.js +96 -0
  369. package/lib/overlay/managers/close-manager.d.ts +54 -0
  370. package/lib/overlay/managers/close-manager.js +138 -0
  371. package/lib/overlay/managers/focus-manager.d.ts +71 -0
  372. package/lib/overlay/managers/focus-manager.js +228 -0
  373. package/lib/overlay/managers/interaction-lock-manager.d.ts +138 -0
  374. package/lib/overlay/managers/interaction-lock-manager.js +375 -0
  375. package/lib/overlay/managers/viewport-manager.d.ts +93 -0
  376. package/lib/overlay/managers/viewport-manager.js +211 -0
  377. package/lib/overlay/managers/zindex-manager.d.ts +80 -0
  378. package/lib/overlay/managers/zindex-manager.js +195 -0
  379. package/lib/overlay/themes/halo/dark/index.js +4 -0
  380. package/lib/overlay/themes/halo/light/index.js +4 -0
  381. package/lib/overlay/themes/solar/charcoal/index.js +4 -0
  382. package/lib/overlay/themes/solar/pearl/index.js +4 -0
  383. package/lib/overlay-menu/custom-elements.json +194 -0
  384. package/lib/overlay-menu/custom-elements.md +44 -0
  385. package/lib/overlay-menu/helpers/types.d.ts +8 -0
  386. package/lib/overlay-menu/helpers/types.js +1 -0
  387. package/lib/overlay-menu/index.d.ts +385 -0
  388. package/lib/overlay-menu/index.js +933 -0
  389. package/lib/overlay-menu/managers/menu-manager.d.ts +98 -0
  390. package/lib/overlay-menu/managers/menu-manager.js +240 -0
  391. package/lib/overlay-menu/themes/halo/dark/index.js +5 -0
  392. package/lib/overlay-menu/themes/halo/light/index.js +5 -0
  393. package/lib/overlay-menu/themes/solar/charcoal/index.js +5 -0
  394. package/lib/overlay-menu/themes/solar/pearl/index.js +5 -0
  395. package/lib/pagination/custom-elements.json +93 -0
  396. package/lib/pagination/custom-elements.md +27 -0
  397. package/lib/pagination/helpers/types.d.ts +9 -0
  398. package/lib/pagination/helpers/types.js +1 -0
  399. package/lib/pagination/index.d.ts +207 -0
  400. package/lib/pagination/index.js +398 -0
  401. package/lib/pagination/themes/halo/dark/index.js +6 -0
  402. package/lib/pagination/themes/halo/light/index.js +6 -0
  403. package/lib/pagination/themes/solar/charcoal/index.js +6 -0
  404. package/lib/pagination/themes/solar/pearl/index.js +6 -0
  405. package/lib/panel/custom-elements.json +39 -0
  406. package/lib/panel/custom-elements.md +11 -0
  407. package/lib/panel/index.d.ts +48 -0
  408. package/lib/panel/index.js +74 -0
  409. package/lib/panel/themes/halo/dark/index.js +2 -0
  410. package/lib/panel/themes/halo/light/index.js +2 -0
  411. package/lib/panel/themes/solar/charcoal/index.js +2 -0
  412. package/lib/panel/themes/solar/pearl/index.js +2 -0
  413. package/lib/password-field/custom-elements.json +156 -0
  414. package/lib/password-field/custom-elements.md +31 -0
  415. package/lib/password-field/index.d.ts +141 -0
  416. package/lib/password-field/index.js +258 -0
  417. package/lib/password-field/themes/halo/dark/index.js +3 -0
  418. package/lib/password-field/themes/halo/light/index.js +3 -0
  419. package/lib/password-field/themes/solar/charcoal/index.js +3 -0
  420. package/lib/password-field/themes/solar/pearl/index.js +3 -0
  421. package/lib/pill/custom-elements.json +95 -0
  422. package/lib/pill/custom-elements.md +22 -0
  423. package/lib/pill/index.d.ts +97 -0
  424. package/lib/pill/index.js +160 -0
  425. package/lib/pill/themes/halo/dark/index.js +3 -0
  426. package/lib/pill/themes/halo/light/index.js +3 -0
  427. package/lib/pill/themes/solar/charcoal/index.js +3 -0
  428. package/lib/pill/themes/solar/pearl/index.js +3 -0
  429. package/lib/progress-bar/custom-elements.json +58 -0
  430. package/lib/progress-bar/custom-elements.md +18 -0
  431. package/lib/progress-bar/index.d.ts +82 -0
  432. package/lib/progress-bar/index.js +157 -0
  433. package/lib/progress-bar/themes/halo/dark/index.js +2 -0
  434. package/lib/progress-bar/themes/halo/light/index.js +2 -0
  435. package/lib/progress-bar/themes/solar/charcoal/index.js +2 -0
  436. package/lib/progress-bar/themes/solar/pearl/index.js +2 -0
  437. package/lib/radio-button/custom-elements.json +82 -0
  438. package/lib/radio-button/custom-elements.md +19 -0
  439. package/lib/radio-button/index.d.ts +122 -0
  440. package/lib/radio-button/index.js +257 -0
  441. package/lib/radio-button/radio-button-registry.d.ts +22 -0
  442. package/lib/radio-button/radio-button-registry.js +93 -0
  443. package/lib/radio-button/themes/halo/dark/index.js +3 -0
  444. package/lib/radio-button/themes/halo/light/index.js +3 -0
  445. package/lib/radio-button/themes/solar/charcoal/index.js +3 -0
  446. package/lib/radio-button/themes/solar/pearl/index.js +3 -0
  447. package/lib/rating/custom-elements.json +58 -0
  448. package/lib/rating/custom-elements.md +17 -0
  449. package/lib/rating/index.d.ts +91 -0
  450. package/lib/rating/index.js +157 -0
  451. package/lib/rating/themes/halo/dark/index.js +2 -0
  452. package/lib/rating/themes/halo/light/index.js +2 -0
  453. package/lib/rating/themes/solar/charcoal/index.js +2 -0
  454. package/lib/rating/themes/solar/pearl/index.js +2 -0
  455. package/lib/search-field/custom-elements.json +173 -0
  456. package/lib/search-field/custom-elements.md +33 -0
  457. package/lib/search-field/index.d.ts +134 -0
  458. package/lib/search-field/index.js +253 -0
  459. package/lib/search-field/themes/halo/dark/index.js +3 -0
  460. package/lib/search-field/themes/halo/light/index.js +3 -0
  461. package/lib/search-field/themes/solar/charcoal/index.js +3 -0
  462. package/lib/search-field/themes/solar/pearl/index.js +3 -0
  463. package/lib/select/custom-elements.json +103 -0
  464. package/lib/select/custom-elements.md +24 -0
  465. package/lib/select/helpers/types.d.ts +3 -0
  466. package/lib/select/helpers/types.js +1 -0
  467. package/lib/select/index.d.ts +388 -0
  468. package/lib/select/index.js +942 -0
  469. package/lib/select/themes/halo/dark/index.js +5 -0
  470. package/lib/select/themes/halo/light/index.js +5 -0
  471. package/lib/select/themes/solar/charcoal/index.js +5 -0
  472. package/lib/select/themes/solar/pearl/index.js +5 -0
  473. package/lib/sidebar-layout/custom-elements.json +72 -0
  474. package/lib/sidebar-layout/custom-elements.md +22 -0
  475. package/lib/sidebar-layout/index.d.ts +69 -0
  476. package/lib/sidebar-layout/index.js +134 -0
  477. package/lib/sidebar-layout/themes/halo/dark/index.js +3 -0
  478. package/lib/sidebar-layout/themes/halo/light/index.js +3 -0
  479. package/lib/sidebar-layout/themes/solar/charcoal/index.js +3 -0
  480. package/lib/sidebar-layout/themes/solar/pearl/index.js +3 -0
  481. package/lib/slider/custom-elements.json +181 -0
  482. package/lib/slider/custom-elements.md +28 -0
  483. package/lib/slider/index.d.ts +409 -0
  484. package/lib/slider/index.js +1187 -0
  485. package/lib/slider/themes/halo/dark/index.js +3 -0
  486. package/lib/slider/themes/halo/light/index.js +3 -0
  487. package/lib/slider/themes/solar/charcoal/index.js +3 -0
  488. package/lib/slider/themes/solar/pearl/index.js +3 -0
  489. package/lib/sparkline/custom-elements.json +59 -0
  490. package/lib/sparkline/custom-elements.md +16 -0
  491. package/lib/sparkline/index.d.ts +107 -0
  492. package/lib/sparkline/index.js +186 -0
  493. package/lib/sparkline/themes/halo/dark/index.js +2 -0
  494. package/lib/sparkline/themes/halo/light/index.js +2 -0
  495. package/lib/sparkline/themes/solar/charcoal/index.js +2 -0
  496. package/lib/sparkline/themes/solar/pearl/index.js +2 -0
  497. package/lib/swing-gauge/const.d.ts +22 -0
  498. package/lib/swing-gauge/const.js +26 -0
  499. package/lib/swing-gauge/custom-elements.json +109 -0
  500. package/lib/swing-gauge/custom-elements.md +17 -0
  501. package/lib/swing-gauge/helpers.d.ts +8 -0
  502. package/lib/swing-gauge/helpers.js +105 -0
  503. package/lib/swing-gauge/index.d.ts +294 -0
  504. package/lib/swing-gauge/index.js +762 -0
  505. package/lib/swing-gauge/themes/halo/dark/index.js +3 -0
  506. package/lib/swing-gauge/themes/halo/light/index.js +3 -0
  507. package/lib/swing-gauge/themes/solar/charcoal/index.js +3 -0
  508. package/lib/swing-gauge/themes/solar/pearl/index.js +3 -0
  509. package/lib/swing-gauge/types.d.ts +34 -0
  510. package/lib/swing-gauge/types.js +1 -0
  511. package/lib/tab/custom-elements.json +123 -0
  512. package/lib/tab/custom-elements.md +22 -0
  513. package/lib/tab/index.d.ts +118 -0
  514. package/lib/tab/index.js +208 -0
  515. package/lib/tab/themes/halo/dark/index.js +4 -0
  516. package/lib/tab/themes/halo/light/index.js +4 -0
  517. package/lib/tab/themes/solar/charcoal/index.js +4 -0
  518. package/lib/tab/themes/solar/pearl/index.js +4 -0
  519. package/lib/tab-bar/custom-elements.json +52 -0
  520. package/lib/tab-bar/custom-elements.md +11 -0
  521. package/lib/tab-bar/helpers/animate.d.ts +16 -0
  522. package/lib/tab-bar/helpers/animate.js +53 -0
  523. package/lib/tab-bar/index.d.ts +108 -0
  524. package/lib/tab-bar/index.js +218 -0
  525. package/lib/tab-bar/themes/halo/dark/index.js +4 -0
  526. package/lib/tab-bar/themes/halo/light/index.js +4 -0
  527. package/lib/tab-bar/themes/solar/charcoal/index.js +4 -0
  528. package/lib/tab-bar/themes/solar/pearl/index.js +4 -0
  529. package/lib/text-field/custom-elements.json +210 -0
  530. package/lib/text-field/custom-elements.md +37 -0
  531. package/lib/text-field/index.d.ts +193 -0
  532. package/lib/text-field/index.js +409 -0
  533. package/lib/text-field/themes/halo/dark/index.js +3 -0
  534. package/lib/text-field/themes/halo/light/index.js +3 -0
  535. package/lib/text-field/themes/solar/charcoal/index.js +3 -0
  536. package/lib/text-field/themes/solar/pearl/index.js +3 -0
  537. package/lib/time-picker/custom-elements.json +124 -0
  538. package/lib/time-picker/custom-elements.md +28 -0
  539. package/lib/time-picker/index.d.ts +379 -0
  540. package/lib/time-picker/index.js +775 -0
  541. package/lib/time-picker/themes/halo/dark/index.js +4 -0
  542. package/lib/time-picker/themes/halo/light/index.js +4 -0
  543. package/lib/time-picker/themes/solar/charcoal/index.js +4 -0
  544. package/lib/time-picker/themes/solar/pearl/index.js +4 -0
  545. package/lib/toggle/custom-elements.json +82 -0
  546. package/lib/toggle/custom-elements.md +19 -0
  547. package/lib/toggle/index.d.ts +86 -0
  548. package/lib/toggle/index.js +152 -0
  549. package/lib/toggle/themes/halo/dark/index.js +2 -0
  550. package/lib/toggle/themes/halo/light/index.js +2 -0
  551. package/lib/toggle/themes/solar/charcoal/index.js +2 -0
  552. package/lib/toggle/themes/solar/pearl/index.js +2 -0
  553. package/lib/tooltip/custom-elements.json +62 -0
  554. package/lib/tooltip/custom-elements.md +14 -0
  555. package/lib/tooltip/elements/title-tooltip.d.ts +1 -0
  556. package/lib/tooltip/elements/title-tooltip.js +18 -0
  557. package/lib/tooltip/elements/tooltip-element.d.ts +21 -0
  558. package/lib/tooltip/elements/tooltip-element.js +54 -0
  559. package/lib/tooltip/helpers/overflow-tooltip.d.ts +9 -0
  560. package/lib/tooltip/helpers/overflow-tooltip.js +19 -0
  561. package/lib/tooltip/helpers/renderer.d.ts +8 -0
  562. package/lib/tooltip/helpers/renderer.js +11 -0
  563. package/lib/tooltip/helpers/types.d.ts +23 -0
  564. package/lib/tooltip/helpers/types.js +1 -0
  565. package/lib/tooltip/index.d.ts +232 -0
  566. package/lib/tooltip/index.js +477 -0
  567. package/lib/tooltip/managers/tooltip-manager.d.ts +15 -0
  568. package/lib/tooltip/managers/tooltip-manager.js +140 -0
  569. package/lib/tooltip/themes/halo/dark/index.js +3 -0
  570. package/lib/tooltip/themes/halo/light/index.js +3 -0
  571. package/lib/tooltip/themes/solar/charcoal/index.js +3 -0
  572. package/lib/tooltip/themes/solar/pearl/index.js +3 -0
  573. package/lib/tornado-chart/custom-elements.json +45 -0
  574. package/lib/tornado-chart/custom-elements.md +18 -0
  575. package/lib/tornado-chart/elements/tornado-chart.d.ts +78 -0
  576. package/lib/tornado-chart/elements/tornado-chart.js +122 -0
  577. package/lib/tornado-chart/elements/tornado-item.d.ts +110 -0
  578. package/lib/tornado-chart/elements/tornado-item.js +207 -0
  579. package/lib/tornado-chart/index.d.ts +2 -0
  580. package/lib/tornado-chart/index.js +2 -0
  581. package/lib/tornado-chart/themes/halo/dark/index.js +6 -0
  582. package/lib/tornado-chart/themes/halo/light/index.js +6 -0
  583. package/lib/tornado-chart/themes/solar/charcoal/index.js +6 -0
  584. package/lib/tornado-chart/themes/solar/pearl/index.js +6 -0
  585. package/lib/tree/custom-elements.json +113 -0
  586. package/lib/tree/custom-elements.md +32 -0
  587. package/lib/tree/elements/tree-item.d.ts +96 -0
  588. package/lib/tree/elements/tree-item.js +179 -0
  589. package/lib/tree/elements/tree.d.ts +201 -0
  590. package/lib/tree/elements/tree.js +412 -0
  591. package/lib/tree/helpers/filter.d.ts +8 -0
  592. package/lib/tree/helpers/filter.js +33 -0
  593. package/lib/tree/helpers/renderer.d.ts +5 -0
  594. package/lib/tree/helpers/renderer.js +33 -0
  595. package/lib/tree/helpers/types.d.ts +25 -0
  596. package/lib/tree/helpers/types.js +1 -0
  597. package/lib/tree/index.d.ts +4 -0
  598. package/lib/tree/index.js +3 -0
  599. package/lib/tree/managers/tree-manager.d.ts +248 -0
  600. package/lib/tree/managers/tree-manager.js +395 -0
  601. package/lib/tree/themes/halo/dark/index.js +7 -0
  602. package/lib/tree/themes/halo/light/index.js +7 -0
  603. package/lib/tree/themes/solar/charcoal/index.js +7 -0
  604. package/lib/tree/themes/solar/pearl/index.js +7 -0
  605. package/lib/tree-select/custom-elements.json +107 -0
  606. package/lib/tree-select/custom-elements.md +26 -0
  607. package/lib/tree-select/helpers/types.d.ts +4 -0
  608. package/lib/tree-select/helpers/types.js +1 -0
  609. package/lib/tree-select/index.d.ts +402 -0
  610. package/lib/tree-select/index.js +890 -0
  611. package/lib/tree-select/themes/halo/dark/index.js +12 -0
  612. package/lib/tree-select/themes/halo/light/index.js +12 -0
  613. package/lib/tree-select/themes/solar/charcoal/index.js +12 -0
  614. package/lib/tree-select/themes/solar/pearl/index.js +12 -0
  615. package/lib/version.d.ts +1 -0
  616. package/lib/version.js +1 -0
  617. package/package.json +298 -15
@@ -0,0 +1,1426 @@
1
+ var Overlay_1;
2
+ import { __decorate } from "tslib";
3
+ import { ResponsiveElement, html, css } from '@refinitiv-ui/core';
4
+ import { customElement } from '@refinitiv-ui/core/lib/decorators/custom-element.js';
5
+ import { property } from '@refinitiv-ui/core/lib/decorators/property.js';
6
+ import { VERSION } from '../../version.js';
7
+ import { MicroTaskRunner, AnimationTaskRunner } from '@refinitiv-ui/utils/lib/async.js';
8
+ import { isIE, isEdge } from '@refinitiv-ui/utils/lib/browser.js';
9
+ import { DEFAULT_ALIGN, DEFAULT_TARGET_STRATEGY } from '../helpers/types.js';
10
+ import { valueOrZero, valueOrNull } from '../helpers/functions.js';
11
+ import { applyLock } from '../managers/interaction-lock-manager.js';
12
+ import { register as viewportRegister, deregister as viewportDeregister, getViewAreaInfo } from '../managers/viewport-manager.js';
13
+ import { register as zIndexRegister, deregister as zIndexDeregister, toFront } from '../managers/zindex-manager.js';
14
+ import { register as backdropRegister, deregister as backdropDeregister } from '../managers/backdrop-manager.js';
15
+ import { register as closeRegister, deregister as closeDeregister } from '../managers/close-manager.js';
16
+ import { register as focusableRegister, deregister as focusableDeregister } from '../managers/focus-manager.js';
17
+ /**
18
+ * Possible states of the overlay
19
+ */
20
+ var OpenedState;
21
+ (function (OpenedState) {
22
+ OpenedState[OpenedState["CLOSED"] = 0] = "CLOSED";
23
+ OpenedState[OpenedState["OPENING"] = 1] = "OPENING";
24
+ OpenedState[OpenedState["OPENED"] = 2] = "OPENED";
25
+ OpenedState[OpenedState["CLOSING"] = 3] = "CLOSING"; /* overlay is visible on the screen, but closing animation is still running */
26
+ })(OpenedState || (OpenedState = {}));
27
+ /**
28
+ * A helper function to set or remove attribute based on the value
29
+ * @param overlay Overlay
30
+ * @param name Attribute name
31
+ * @param value If false or empty string attribute is removed
32
+ * @returns {void}
33
+ */
34
+ const toggleAttribute = (overlay, name, value) => {
35
+ if (!value) {
36
+ overlay.removeAttribute(name);
37
+ }
38
+ else {
39
+ overlay.setAttribute(name, typeof value === 'string' ? value : '');
40
+ }
41
+ };
42
+ /**
43
+ * A helper function to filter initial state of boolean change
44
+ * @param newVal New value
45
+ * @param oldVal Old value
46
+ * @returns hasChanged
47
+ */
48
+ const hasBooleanChanged = (newVal, oldVal) => newVal !== !!oldVal;
49
+ /**
50
+ * A helper function to filter initial state of number change
51
+ * @param newVal New value
52
+ * @param oldVal Old value
53
+ * @returns hasChanged
54
+ */
55
+ const hasNumberChanged = (newVal, oldVal) => oldVal === undefined ? false : newVal !== oldVal;
56
+ /**
57
+ * When these properties change render is called
58
+ */
59
+ const shouldUpdateProperties = ['withShadow', 'transparent', 'spacing', 'transitionStyle', 'fullScreen', 'zIndex'];
60
+ /**
61
+ * When these properties change refit is called
62
+ */
63
+ const shouldRefitProperties = ['position', 'x', 'y', 'positionTarget', 'horizontalOffset', 'verticalOffset', 'offset', 'fullScreen', 'noOverlap'];
64
+ /**
65
+ * Element to help building modals, dialogs and other overlay content
66
+ * @fires closed - Dispatched when overlay becomes invisible and close animation finishes
67
+ * @fires opened - Dispatched when the overlay becomes visible and the open animation finishes
68
+ * @fires refit - Dispatched when refit algorithm finishes calculations
69
+ * @fires opened-changed - Dispatched when when open attribute changes internally. Prevent default to stop opening/closing pipeline
70
+ */
71
+ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
72
+ constructor() {
73
+ super(...arguments);
74
+ this.defaultTabIndex = -1;
75
+ this._fullyOpened = OpenedState.CLOSED;
76
+ /**
77
+ * True if the overlay is currently displayed
78
+ */
79
+ this.opened = false;
80
+ /**
81
+ * True to add shadow
82
+ */
83
+ this.withShadow = false;
84
+ /**
85
+ * True to make overlay background transparent
86
+ */
87
+ this.transparent = false;
88
+ /**
89
+ * True to apply spacing for overlay content
90
+ */
91
+ this.spacing = false;
92
+ /**
93
+ * A pixel value that will be added to the position calculated on the horizontal axis.
94
+ * The offset will be applied either to the `left` or `right` depending on the `positionTarget`
95
+ */
96
+ this.horizontalOffset = 0;
97
+ /**
98
+ * A pixel value that will be added to the position calculated on the vertical axis.
99
+ * The offset will be applied either to the `top` or `bottom` depending on the `positionTarget`
100
+ */
101
+ this.verticalOffset = 0;
102
+ /**
103
+ * A pixel value that will be added to the position calculated on the vertical or horizontal axis.
104
+ * The offset is applied dynamically depending on the `positionTarget`
105
+ */
106
+ this.offset = 0;
107
+ /**
108
+ * Set to true to disable canceling the overlay with the ESC key
109
+ */
110
+ this.noCancelOnEscKey = false;
111
+ /**
112
+ * Set to true to disable canceling the overlay by clicking outside it
113
+ */
114
+ this.noCancelOnOutsideClick = false;
115
+ /**
116
+ * Set to true to show overlay in full screen mode
117
+ */
118
+ this.fullScreen = false;
119
+ /**
120
+ * True to not overlap positionTarget
121
+ */
122
+ this.noOverlap = false;
123
+ /**
124
+ * Stop preventing user interaction when overlay is visible
125
+ */
126
+ this.noInteractionLock = false;
127
+ /**
128
+ * True to not apply focus management.
129
+ * The overlay will not limit Tab behaviour or do auto-focusing
130
+ */
131
+ this.noFocusManagement = false;
132
+ /**
133
+ * True to lock position target
134
+ * Valid only if noInteractionLock is false (default)
135
+ */
136
+ this.lockPositionTarget = false;
137
+ /**
138
+ * A list of elements, which are active when overlay is opened
139
+ * Valid only if noInteractionLock is false (default)
140
+ */
141
+ this.interactiveElements = [];
142
+ /**
143
+ * True to show backdrop
144
+ */
145
+ this.withBackdrop = false;
146
+ /**
147
+ * Set to true to disable autofocusing the overlay or open
148
+ */
149
+ this.noAutofocus = false;
150
+ /**
151
+ * Set focus boundary to restrict tabbing. Default's overlay itself.
152
+ * If external focus is required, set to null
153
+ */
154
+ this.focusBoundary = this;
155
+ this._firstResizeDone = false;
156
+ /**
157
+ * Used internally to keep calculated positions
158
+ */
159
+ this.calculated = {};
160
+ this.redrawThrottler = new AnimationTaskRunner();
161
+ /**
162
+ * Ensure that the opened flag gets removed when transition has finished
163
+ * Ensure that transitioned hook is applied when opened
164
+ * @returns {void}
165
+ */
166
+ this.onOpenedChangedAnimationEvent = () => {
167
+ this.animationReady = false;
168
+ this.animationReverse = this.opened;
169
+ if (!this.opened) {
170
+ this.onFullyClosed();
171
+ }
172
+ else {
173
+ this.onFullyOpened();
174
+ }
175
+ };
176
+ this.fitThrottler = new MicroTaskRunner();
177
+ this.resizeHeight = 0; /* stored overlay height */
178
+ this.resizeWidth = 0; /* stored overlay width */
179
+ this.resizedThrottler = new MicroTaskRunner(); /* resize throttler to prevent resize observer loop */
180
+ }
181
+ /**
182
+ * Element version number
183
+ * @returns version number
184
+ */
185
+ static get version() {
186
+ return VERSION;
187
+ }
188
+ /**
189
+ * A `CSSResultGroup` that will be used
190
+ * to style the host, slotted children
191
+ * and the internal template of the element.
192
+ * @return CSS template
193
+ */
194
+ static get styles() {
195
+ return css `
196
+ :host {
197
+ display: inline-block;
198
+ box-sizing: border-box;
199
+ position: fixed;
200
+ touch-action: manipulation;
201
+ outline: none;
202
+ }
203
+
204
+ :host(:not([opened]):not([animation-ready])) {
205
+ display: none !important;
206
+ }
207
+
208
+ :host(:not([first-resize-done])) {
209
+ pointer-events: none !important; /* needs for Mobile to prevent tap while overlay is not yet on the screen */
210
+ opacity: 0 !important; /* visibility does not work in IE11 */
211
+ }
212
+
213
+ :host(:not([animation-ready])) {
214
+ animation: none !important;
215
+ transition: none !important;
216
+ transform: none !important;
217
+ top: 0;
218
+ left: 0;
219
+ }
220
+
221
+ :host([transition-style]) {
222
+ transition-timing-function: ease-out;
223
+ animation-duration: 500ms;
224
+ }
225
+
226
+ :host([transition-style][animation-reverse]) {
227
+ animation-direction: reverse;
228
+ }
229
+
230
+ @keyframes popup-scale {
231
+ from { transform: scale(0, 0); }
232
+ to { transform: scale(1, 1); }
233
+ }
234
+
235
+ @keyframes popup-scale-vertical {
236
+ from { transform: scaleY(0); }
237
+ to { transform: scaleY(1); }
238
+ }
239
+
240
+ @keyframes popup-scale-horizontal {
241
+ from { transform: scaleX(0); }
242
+ to { transform: scaleX(1); }
243
+ }
244
+
245
+ @keyframes popup-scale-fade {
246
+ from { opacity: 0; }
247
+ 58% { opacity: 0.3; }
248
+ to { opacity: 1; }
249
+ }
250
+
251
+ @keyframes popup-fade {
252
+ from { opacity: 0; }
253
+ to { opacity: 1; }
254
+ }
255
+
256
+ /* set origins */
257
+ :host([transition-style="slide-down"]),
258
+ :host([transition-style="slide"][animation-position="bottom"]) {
259
+ transform-origin: center top;
260
+ }
261
+ :host([transition-style="slide-up"]),
262
+ :host([transition-style="slide"][animation-position="top"]) {
263
+ transform-origin: center bottom;
264
+ }
265
+ :host([transition-style="slide-left"]),
266
+ :host([transition-style="slide"][animation-position="left"]) {
267
+ transform-origin: right center;
268
+ }
269
+ :host([transition-style="slide-right"]),
270
+ :host([transition-style="slide"][animation-position="right"]) {
271
+ transform-origin: left center;
272
+ }
273
+ :host([transition-style="slide-right-down"]) {
274
+ transform-origin: left top;
275
+ }
276
+ :host([transition-style="slide-right-up"]) {
277
+ transform-origin: left bottom;
278
+ }
279
+ :host([transition-style="slide-left-down"]) {
280
+ transform-origin: right top;
281
+ }
282
+ :host([transition-style="slide-left-up"]) {
283
+ transform-origin: right bottom;
284
+ }
285
+
286
+ /* set animation names */
287
+ :host([transition-style="slide-right-down"]),
288
+ :host([transition-style="slide-right-up"]),
289
+ :host([transition-style="slide-left-down"]),
290
+ :host([transition-style="slide-left-up"]),
291
+ :host([transition-style="zoom"]) {
292
+ animation-name: popup-scale, popup-scale-fade;
293
+ }
294
+ :host([transition-style="fade"]) {
295
+ animation-name: popup-fade;
296
+ }
297
+ :host([transition-style="slide-down"]),
298
+ :host([transition-style="slide"][animation-position="bottom"]),
299
+ :host([transition-style="slide-up"]),
300
+ :host([transition-style="slide"][animation-position="top"]) {
301
+ animation-name: popup-scale-vertical, popup-scale-fade;
302
+ }
303
+ :host([transition-style="slide-left"]),
304
+ :host([transition-style="slide"][animation-position="left"]),
305
+ :host([transition-style="slide-right"]),
306
+ :host([transition-style="slide"][animation-position="right"]) {
307
+ animation-name: popup-scale-horizontal, popup-scale-fade;
308
+ }
309
+
310
+ /* shadow comes from theme */
311
+ :host([transparent]) {
312
+ -webkit-box-shadow: none !important;
313
+ -moz-box-shadow: none !important;
314
+ box-shadow: none !important;
315
+ background: none !important;
316
+ border-color: transparent !important;
317
+ }
318
+ `;
319
+ }
320
+ /**
321
+ * Set position and align against the attach target.
322
+ * Position may contain a single word or a comma separated list to set the priority.
323
+ * Position is not applied if `attachTarget` is not HTML Element.
324
+ * For instance: `[bottom-middle, top-middle]` - default position is bottom-middle, if cannot fit position top-middle;
325
+ * or `[left, right]` - align is not set, set best position on the left or right
326
+ *
327
+ * Position can be: `top`, `right`, `bottom`, `left`, `center`
328
+ * Align can be: `start`, `middle`, `end`
329
+ *
330
+ * @param value Position value
331
+ */
332
+ set position(value) {
333
+ const oldPosition = this._position;
334
+ if (oldPosition !== value) {
335
+ this._positionStrategy = undefined;
336
+ this._position = value;
337
+ this.requestUpdate('position', oldPosition);
338
+ }
339
+ }
340
+ get position() {
341
+ return this._position;
342
+ }
343
+ /**
344
+ * Get parsed position strategy or the default strategy if none provided
345
+ * @returns positionStrategy as a list of tuples containing position and align
346
+ */
347
+ get positionStrategy() {
348
+ if (this._positionStrategy) {
349
+ return this._positionStrategy;
350
+ }
351
+ if (!this.position) {
352
+ return undefined;
353
+ }
354
+ const positionList = [...this.position];
355
+ const positionStrategy = this._positionStrategy = [];
356
+ while (positionList.length) {
357
+ const position = positionList.shift();
358
+ if (!position) {
359
+ continue;
360
+ }
361
+ const strategy = position.split('-');
362
+ if (!strategy[1]) {
363
+ const defaultAlign = DEFAULT_ALIGN.get(strategy[0]);
364
+ if (!defaultAlign) {
365
+ throw new Error(`ef-overlay: incorrect position provided: ${strategy[0]}`);
366
+ }
367
+ strategy.push(defaultAlign);
368
+ }
369
+ positionStrategy.push(strategy);
370
+ }
371
+ return positionStrategy;
372
+ }
373
+ /**
374
+ * Get position target configuration based on positionTarget and fullScreen properties
375
+ * Used for caching and calculations
376
+ */
377
+ get positionTargetConfig() {
378
+ const { viewHeight, viewWidth, viewOffsetTop, viewOffsetLeft } = this.viewAreaInfo;
379
+ let left;
380
+ let top;
381
+ if (this.fullScreen) { /* keep it for caching only to not break other algorithms */
382
+ return {
383
+ rect: {
384
+ top: 0,
385
+ bottom: 0,
386
+ left: 0,
387
+ right: 0,
388
+ height: viewHeight,
389
+ width: viewWidth
390
+ },
391
+ position: [['center', 'middle']]
392
+ };
393
+ }
394
+ if (this.positionTarget instanceof HTMLElement) {
395
+ const positionTargetElRect = this.positionTarget.getBoundingClientRect();
396
+ return {
397
+ rect: {
398
+ top: positionTargetElRect.top - viewOffsetTop,
399
+ right: positionTargetElRect.right - viewOffsetLeft,
400
+ bottom: positionTargetElRect.bottom - viewOffsetTop,
401
+ left: positionTargetElRect.left - viewOffsetLeft,
402
+ width: positionTargetElRect.width,
403
+ height: positionTargetElRect.height
404
+ },
405
+ position: [...(this.positionStrategy || DEFAULT_TARGET_STRATEGY)]
406
+ };
407
+ }
408
+ const x = this.x || 0;
409
+ const y = this.y || 0;
410
+ let positionTarget = `${typeof this.x === 'number' && this.x >= 0 ? 'left' : 'center'} ${typeof this.y === 'number' && this.y >= 0 ? 'top' : 'center'}`;
411
+ if (typeof this.positionTarget === 'string') {
412
+ positionTarget = this.positionTarget.trim() || positionTarget;
413
+ const positionTargetList = positionTarget.split(' ').slice(0, 2);
414
+ if (positionTargetList.length === 1) {
415
+ positionTargetList.push('center');
416
+ }
417
+ positionTarget = positionTargetList.join(' ');
418
+ }
419
+ let defaultPosition;
420
+ /* istanbul ignore next */
421
+ switch (positionTarget) {
422
+ case 'top left':
423
+ case 'left top':
424
+ left = x;
425
+ top = y;
426
+ defaultPosition = ['bottom', 'start'];
427
+ break;
428
+ case 'top center':
429
+ case 'center top':
430
+ left = viewWidth / 2 + x;
431
+ top = y;
432
+ defaultPosition = ['bottom', 'middle'];
433
+ break;
434
+ case 'top right':
435
+ case 'right top':
436
+ left = viewWidth - x;
437
+ top = y;
438
+ defaultPosition = ['bottom', 'end'];
439
+ break;
440
+ case 'center left':
441
+ case 'left center':
442
+ left = x;
443
+ top = viewHeight / 2 + y;
444
+ defaultPosition = ['right', 'middle'];
445
+ break;
446
+ case 'center right':
447
+ case 'right center':
448
+ left = viewWidth - x;
449
+ top = viewHeight / 2 + y;
450
+ defaultPosition = ['left', 'middle'];
451
+ break;
452
+ case 'bottom left':
453
+ case 'left bottom':
454
+ left = x;
455
+ top = viewHeight - y;
456
+ defaultPosition = ['top', 'start'];
457
+ break;
458
+ case 'bottom center':
459
+ case 'center bottom':
460
+ left = viewWidth / 2 + x;
461
+ top = viewHeight - y;
462
+ defaultPosition = ['top', 'middle'];
463
+ break;
464
+ case 'bottom right':
465
+ case 'right bottom':
466
+ left = viewWidth - x;
467
+ top = viewHeight - y;
468
+ defaultPosition = ['top', 'end'];
469
+ break;
470
+ case 'center center':
471
+ default:
472
+ left = viewWidth / 2 + x;
473
+ top = viewHeight / 2 + y;
474
+ defaultPosition = ['center', 'middle'];
475
+ }
476
+ return {
477
+ rect: {
478
+ top,
479
+ bottom: top,
480
+ left,
481
+ right: left,
482
+ height: 0,
483
+ width: 0
484
+ },
485
+ position: [...(this.positionStrategy || [defaultPosition])]
486
+ };
487
+ }
488
+ /**
489
+ * A hook to reset transition and transform when the overlay is opened.
490
+ * This removes the complexity of calculating specific "transformed"
491
+ * coordinates for descendant elements
492
+ * @param animationReady True to set attribute
493
+ */
494
+ set animationReady(animationReady) {
495
+ toggleAttribute(this, 'animation-ready', animationReady);
496
+ }
497
+ /**
498
+ * Run the animation reverse order when closing
499
+ * @param animationReverse True to set attribute
500
+ */
501
+ set animationReverse(animationReverse) {
502
+ toggleAttribute(this, 'animation-reverse', animationReverse);
503
+ }
504
+ /**
505
+ * Used with dynamic `slide` animation to detect correct animation position
506
+ * @param animationPosition Set animation position
507
+ */
508
+ set animationPosition(animationPosition) {
509
+ toggleAttribute(this, 'animation-position', animationPosition);
510
+ }
511
+ /**
512
+ * Used to set attribute after the initial callback has been fired
513
+ * A function is here to sort IE11 flickering problem
514
+ * @param firstResizeDone True if the initial resize has happened
515
+ */
516
+ set firstResizeDone(firstResizeDone) {
517
+ if (this._firstResizeDone !== firstResizeDone) {
518
+ this._firstResizeDone = firstResizeDone;
519
+ toggleAttribute(this, 'first-resize-done', firstResizeDone);
520
+ }
521
+ }
522
+ get firstResizeDone() {
523
+ return this._firstResizeDone;
524
+ }
525
+ /**
526
+ * All internal opened set events can be stoppable externally
527
+ * Use this instead of setting opened directly
528
+ * Protected method that can be used by managers or subclasses
529
+ * @param opened True if opened
530
+ * @returns {void}
531
+ */
532
+ setOpened(opened) {
533
+ if (this.opened !== opened) {
534
+ if (this.notifyPropertyChange('opened', opened, true)) {
535
+ this.opened = opened;
536
+ }
537
+ }
538
+ }
539
+ disconnectedCallback() {
540
+ this.removeMainRegisters();
541
+ this.onFullyClosed();
542
+ super.disconnectedCallback();
543
+ }
544
+ /**
545
+ * Called when the element’s DOM has been updated and rendered
546
+ * @param changedProperties Properties that has changed
547
+ * @returns shouldUpdate
548
+ */
549
+ shouldUpdate(changedProperties) {
550
+ const isOpened = this.opened;
551
+ const isClosed = !this.opened;
552
+ const opening = changedProperties.has('opened') && isOpened;
553
+ const closing = changedProperties.has('opened') && isClosed;
554
+ this.setRegisters(changedProperties);
555
+ // Should update routing is calling render method. Not every attribute should result in render being called
556
+ let shouldUpdate = opening || closing || !this.hasUpdated || changedProperties.size === 0;
557
+ // Element may need to be updated if other attributes has been changed while the overlay is opened
558
+ if (!shouldUpdate && isOpened) {
559
+ if (shouldUpdateProperties.find(property => changedProperties.has(property))) {
560
+ shouldUpdate = true;
561
+ }
562
+ }
563
+ // refit is separate routine that calls refit method
564
+ // note: refit is called by ResizeCallback as well
565
+ // therefore we check the opened state
566
+ if (opening || closing) {
567
+ this.openedChange();
568
+ }
569
+ else if (this.opened) {
570
+ // Explicitly call hard refit
571
+ if (shouldRefitProperties.find(property => changedProperties.has(property))) {
572
+ this.refit();
573
+ }
574
+ }
575
+ return shouldUpdate;
576
+ }
577
+ /**
578
+ * Run when opened attribute changes.
579
+ * The function must be throttled in animation task to give time an element to be rendered
580
+ * @returns {void}
581
+ */
582
+ openedChange() {
583
+ if (!this.opened) {
584
+ if (this._fullyOpened === OpenedState.OPENED) { /* cannot set to closing if the overlay has not been fully opened */
585
+ this._fullyOpened = OpenedState.CLOSING;
586
+ }
587
+ this.removeMainRegisters();
588
+ if (this.transitionStyle) {
589
+ this.onOpenedChangedAnimation(); /* animation will fully close overlay on animation finish */
590
+ }
591
+ else {
592
+ this.onFullyClosed();
593
+ }
594
+ }
595
+ // These hacks are required in order to solve a problem when IE11 or Edge does not display
596
+ // the component, even if all CSS properties are set correctly
597
+ // The reason of such behaviour is unknown, but may be related to polyfills
598
+ /* istanbul ignore next */
599
+ if (isIE) {
600
+ this.redrawThrottler.schedule(() => this.style.setProperty('clear', 'none'));
601
+ }
602
+ else if (isEdge) {
603
+ this.redrawThrottler.schedule(() => this.updateVariable('--redraw', `${Date.now()}`));
604
+ }
605
+ /*
606
+ https://github.com/juggle/resize-observer/issues/42
607
+
608
+ This event ensures that ResizeObserver picks up resize events
609
+ when overlay is deeply nested inside shadow root.
610
+ TODO: remove this workaround once ResizeObserver handles shadow root scenario
611
+ */
612
+ window.dispatchEvent(new Event('animationiteration'));
613
+ }
614
+ /**
615
+ * This function sets obligatory registers
616
+ * and sets/removes optional registers
617
+ * based on the fact whether the overlay is opened or not
618
+ * or whether the register attribute has changed
619
+ * @param changedProperties Changed properties
620
+ * @returns {void}
621
+ */
622
+ setRegisters(changedProperties) {
623
+ const opened = this.opened;
624
+ const opening = changedProperties.has('opened') && opened;
625
+ /* !!! Obligatory managers cannot be removed here, as this function is synchronous and animations must be taken into account !!! */
626
+ if (opening) {
627
+ // must come first as used by other managers
628
+ zIndexRegister(this);
629
+ viewportRegister(this);
630
+ closeRegister(this, () => {
631
+ this.setOpened(false);
632
+ });
633
+ }
634
+ const enablingFocusManagement = (opening && !this.noFocusManagement) || (opened && changedProperties.get('noFocusManagement'));
635
+ const disablingFocusManagement = opened && changedProperties.get('noFocusManagement') === false;
636
+ if (enablingFocusManagement) {
637
+ focusableRegister(this);
638
+ }
639
+ else if (disablingFocusManagement) {
640
+ focusableDeregister(this);
641
+ }
642
+ if (opening || changedProperties.has('noInteractionLock') || changedProperties.has('lockPositionTarget') || changedProperties.has('interactiveElements')) {
643
+ applyLock();
644
+ }
645
+ const enablingBackdrop = (opening && this.withBackdrop) || (opened && changedProperties.get('withBackdrop') === false);
646
+ const disablingBackdrop = opened && changedProperties.get('withBackdrop');
647
+ if (enablingBackdrop) {
648
+ backdropRegister(this);
649
+ }
650
+ else if (disablingBackdrop) {
651
+ backdropDeregister(this);
652
+ }
653
+ }
654
+ /**
655
+ * This function is called in order to remove overlay from main registers
656
+ * Registers must be removed in correct order, otherwise overlay might behave
657
+ * unexpectedly. All other registers are removed inside onFullyClosed function
658
+ * once animations are finished or on disconnectedCallback
659
+ * @returns {void}
660
+ */
661
+ removeMainRegisters() {
662
+ zIndexDeregister(this);
663
+ viewportDeregister(this);
664
+ closeDeregister(this);
665
+ focusableDeregister(this);
666
+ }
667
+ /**
668
+ * Set and remove animation event listener
669
+ * @returns {void}
670
+ */
671
+ onOpenedChangedAnimation() {
672
+ this.animationPosition = this.calculated.position || 'bottom';
673
+ this.animationReverse = !this.opened;
674
+ this.animationReady = true;
675
+ this.removeEventListener('animationend', this.onOpenedChangedAnimationEvent);
676
+ this.addEventListener('animationend', this.onOpenedChangedAnimationEvent, { once: true });
677
+ }
678
+ /**
679
+ * A helper method to fire opening events
680
+ * @returns {void}
681
+ */
682
+ onFullyOpened() {
683
+ const fullyOpened = this._fullyOpened;
684
+ this._fullyOpened = OpenedState.OPENED;
685
+ if (fullyOpened === OpenedState.OPENING) {
686
+ this.onOpened();
687
+ this.dispatchEvent(new CustomEvent('opened'));
688
+ }
689
+ }
690
+ /**
691
+ * A helper method to deregister element from all listeners
692
+ * once the overlay is fully closed
693
+ * Note: some registries are remove immediately after close
694
+ * @returns {void}
695
+ */
696
+ onFullyClosed() {
697
+ this.firstResizeDone = false;
698
+ applyLock();
699
+ this.resetSizingInfo();
700
+ this.clearCached();
701
+ backdropDeregister(this);
702
+ const fullyOpened = this._fullyOpened;
703
+ this._fullyOpened = OpenedState.CLOSED;
704
+ if (fullyOpened === OpenedState.CLOSING) {
705
+ this.onClosed();
706
+ this.dispatchEvent(new CustomEvent('closed'));
707
+ }
708
+ }
709
+ /**
710
+ * Run when the overlay has opened, initial positioning is done,
711
+ * managers are registered and opening transition has finished
712
+ * @returns {void}
713
+ */
714
+ onOpened() {
715
+ // opened routine
716
+ }
717
+ /**
718
+ * Run when the overlay has closed, managers are de-registered
719
+ * and closing transition has finished
720
+ * @returns {void}
721
+ */
722
+ onClosed() {
723
+ // closed routine
724
+ }
725
+ /**
726
+ * A helper method to set or remove style property if the value is different
727
+ * @param property Property name
728
+ * @param value Property value
729
+ * @returns {void}
730
+ */
731
+ setPropertyIf(property, value) {
732
+ const cached = this.cachedProperties || {};
733
+ this.cachedProperties = cached;
734
+ if (cached[property] === value) {
735
+ return;
736
+ }
737
+ cached[property] = value;
738
+ if (value !== null) {
739
+ this.style.setProperty(property, value);
740
+ }
741
+ else {
742
+ this.style.removeProperty(property);
743
+ }
744
+ }
745
+ /**
746
+ * Cache height and width.
747
+ * Calculating offsetHeight and offsetWidth is expensive,
748
+ * therefore try to use cached version
749
+ * @returns {void}
750
+ */
751
+ setResizeSizingInfo() {
752
+ const { computed: { marginTop, marginRight, marginBottom, marginLeft } } = this.sizingInfo;
753
+ const offsetHeight = this.offsetHeight;
754
+ const offsetWidth = this.offsetWidth;
755
+ this.resizeHeight = offsetHeight ? offsetHeight + valueOrZero(marginTop) + valueOrZero(marginBottom) : 0;
756
+ this.resizeWidth = offsetWidth ? offsetWidth + valueOrZero(marginRight) + valueOrZero(marginLeft) : 0;
757
+ }
758
+ /**
759
+ * Get overlay with and height information
760
+ * Sizing is cached and may not reflect the current
761
+ */
762
+ get sizingRect() {
763
+ return {
764
+ width: this.resizeWidth,
765
+ height: this.resizeHeight
766
+ };
767
+ }
768
+ /**
769
+ * A helper getter to get sizing information for the overlay
770
+ * @returns {Object} sizingInfo
771
+ */
772
+ get sizingInfo() {
773
+ const computeStyle = window.getComputedStyle(this);
774
+ if (!this._sizingInfo) {
775
+ const style = this.style;
776
+ // get minWidth and maxWidth
777
+ this._sizingInfo = {
778
+ computed: {
779
+ minWidth: valueOrNull(computeStyle.minWidth),
780
+ maxWidth: valueOrNull(computeStyle.maxWidth),
781
+ minHeight: valueOrNull(computeStyle.minHeight),
782
+ maxHeight: valueOrNull(computeStyle.maxHeight),
783
+ marginLeft: valueOrNull(computeStyle.marginLeft),
784
+ marginRight: valueOrNull(computeStyle.marginRight),
785
+ marginTop: valueOrNull(computeStyle.marginTop),
786
+ marginBottom: valueOrNull(computeStyle.marginBottom)
787
+ },
788
+ style: {
789
+ minWidth: style.getPropertyValue('min-width'),
790
+ maxWidth: style.getPropertyValue('max-width'),
791
+ minHeight: style.getPropertyValue('min-height'),
792
+ maxHeight: style.getPropertyValue('max-height')
793
+ }
794
+ };
795
+ }
796
+ return this._sizingInfo;
797
+ }
798
+ /**
799
+ * Reset current sizing info to original values
800
+ * @returns {void}
801
+ */
802
+ resetSizingInfo() {
803
+ if (this._sizingInfo) {
804
+ const { style: { minWidth, maxWidth, minHeight, maxHeight } } = this.sizingInfo;
805
+ this.setPropertyIf('min-width', minWidth);
806
+ this.setPropertyIf('max-width', maxWidth);
807
+ this.setPropertyIf('min-height', minHeight);
808
+ this.setPropertyIf('max-height', maxHeight);
809
+ this.setPropertyIf('top', null);
810
+ this.setPropertyIf('left', null);
811
+ this.setPropertyIf('right', null);
812
+ this.setPropertyIf('bottom', null);
813
+ this.setResizeSizingInfo();
814
+ }
815
+ }
816
+ /**
817
+ * Get information of view boundaries for the overlay
818
+ */
819
+ get viewAreaInfo() {
820
+ return getViewAreaInfo(this);
821
+ }
822
+ /**
823
+ * Enforce the overlay to fit the viewArea
824
+ * @param [viewHeight=this._viewAreaInfo.viewHeight] Height to limit to
825
+ * @param [viewWidth=this._viewAreaInfo.viewWidth] Width to limit to
826
+ * @returns {void}
827
+ */
828
+ limitToViewArea(viewHeight, viewWidth) {
829
+ if (!viewHeight || !viewWidth) {
830
+ const viewAreaInfo = this.viewAreaInfo;
831
+ viewHeight = viewHeight || viewAreaInfo.viewHeight;
832
+ viewWidth = viewWidth || viewAreaInfo.viewWidth;
833
+ }
834
+ const viewAreaHeight = viewHeight;
835
+ const viewAreaWidth = viewWidth;
836
+ const computed = this.sizingInfo.computed;
837
+ // max-width & max-height do not include margins
838
+ const maxWidth = viewAreaWidth - valueOrZero(computed.marginLeft) - valueOrZero(computed.marginRight);
839
+ const maxHeight = viewAreaHeight - valueOrZero(computed.marginTop) - valueOrZero(computed.marginBottom);
840
+ // rect might change when changing height and widths. Thus do two runs (which is not brilliant)
841
+ const limit = () => {
842
+ const { width, height } = this.sizingRect;
843
+ let secondRun = false;
844
+ if (computed.minWidth && computed.minWidth > maxWidth) { /* Adjust min-width to always fit */
845
+ this.setPropertyIf('min-width', `${maxWidth}px`);
846
+ secondRun = true;
847
+ }
848
+ if (width > viewAreaWidth) { /* Adjust max-width to always fit */
849
+ this.setPropertyIf('max-width', `${maxWidth}px`);
850
+ secondRun = true;
851
+ }
852
+ if (computed.minHeight && computed.minHeight > maxHeight) { /* Adjust min-height to always fit */
853
+ this.setPropertyIf('min-height', `${maxHeight}px`);
854
+ secondRun = true;
855
+ }
856
+ if (height > viewAreaHeight) { /* Adjust max-height to always fit */
857
+ this.setPropertyIf('max-height', `${maxHeight}px`);
858
+ secondRun = true;
859
+ }
860
+ return secondRun;
861
+ };
862
+ if (limit()) {
863
+ this.setResizeSizingInfo(); /* each resize needs refreshing sizing info */
864
+ limit();
865
+ this.setResizeSizingInfo();
866
+ }
867
+ }
868
+ /**
869
+ * Set top, left, right, bottom to style tag taking into account offset.
870
+ * If property is null or undefined, remove from style tag
871
+ * @param style An object containing top, left, right and/or bottom
872
+ * @returns {void}
873
+ */
874
+ setPositionStyle(style) {
875
+ const { top, left, right, bottom } = style;
876
+ const { offsetTop, offsetLeft, offsetBottom, offsetRight } = this.viewAreaInfo;
877
+ const set = (property, value, offset = 0) => {
878
+ this.setPropertyIf(property, typeof value === 'number' ? `${value + offset}px` : 'auto');
879
+ };
880
+ set('top', top, offsetTop);
881
+ set('left', left, offsetLeft);
882
+ set('right', right, offsetRight);
883
+ set('bottom', bottom, offsetBottom);
884
+ }
885
+ /**
886
+ * This function serves as a safeguard between resize observer and internal logic to prevent resize loop
887
+ * fit setting. Never refits the overlay if previous sizes are the same as last fit size
888
+ * @param clb Callback to run if cache has changed
889
+ * @returns {void}
890
+ */
891
+ refitIfChanged(clb) {
892
+ const getRefitString = () => {
893
+ const positionTargetConfig = this.positionTargetConfig;
894
+ const targetRect = positionTargetConfig.rect;
895
+ const positionList = positionTargetConfig.position;
896
+ const { viewHeight, viewWidth, offsetBottom, offsetTop, offsetRight, offsetLeft } = this.viewAreaInfo;
897
+ return JSON.stringify({
898
+ rect: Object.assign({}, this.sizingRect),
899
+ verticalOffset: this.verticalOffset,
900
+ horizontalOffset: this.horizontalOffset,
901
+ offset: this.offset,
902
+ positionList,
903
+ viewHeight,
904
+ viewWidth,
905
+ offsetBottom,
906
+ offsetTop,
907
+ offsetRight,
908
+ offsetLeft,
909
+ targetRect: {
910
+ height: targetRect.height,
911
+ width: targetRect.width,
912
+ top: targetRect.top,
913
+ bottom: targetRect.bottom,
914
+ left: targetRect.left,
915
+ right: targetRect.right
916
+ }
917
+ });
918
+ };
919
+ const { height, width } = this.sizingRect; /* need this for IE, as width and height is 0 on first render */
920
+ if (this.refitString && this.refitString === getRefitString() || (!height || !width)) {
921
+ return;
922
+ }
923
+ clb();
924
+ this.setResizeSizingInfo();
925
+ this.refitString = getRefitString();
926
+ }
927
+ /**
928
+ * Immediately run fit method without throttling
929
+ * Use carefully as calling this function multiple times has a performance impact
930
+ * @returns {void}
931
+ */
932
+ fitNonThrottled() {
933
+ this.refitIfChanged(() => {
934
+ this.fitPositionTarget();
935
+ this.dispatchEvent(new CustomEvent('refit'));
936
+ });
937
+ }
938
+ /**
939
+ * Fit based on the position target
940
+ * @returns {void}
941
+ */
942
+ fitPositionTarget() {
943
+ this.resetSizingInfo();
944
+ if (this.fullScreen) { /* no need to calculate anything else in full screen mode */
945
+ this.setPositionStyle({
946
+ top: 0,
947
+ left: 0,
948
+ bottom: 0,
949
+ right: 0
950
+ });
951
+ return;
952
+ }
953
+ const Position = 0;
954
+ const Alignment = 1;
955
+ const positionTargetConfig = this.positionTargetConfig;
956
+ const targetRect = positionTargetConfig.rect;
957
+ const positionList = positionTargetConfig.position;
958
+ const horizontalOffset = this.horizontalOffset;
959
+ const verticalOffset = this.verticalOffset;
960
+ const positionHorizontalOffset = horizontalOffset + this.offset; /* these offset are used with optional offset against the target */
961
+ const positionVerticalOffset = verticalOffset + this.offset;
962
+ this.limitToViewArea();
963
+ const { viewHeight, viewWidth } = this.viewAreaInfo;
964
+ const { width, height } = this.sizingRect;
965
+ const calculatedPositionList = [];
966
+ const isOutsideView = targetRect.bottom < 0
967
+ || targetRect.top > viewHeight
968
+ || targetRect.right < 0
969
+ || targetRect.left > viewWidth; /* position target is outside view */
970
+ const canAlignPosition = (isVertical, align) => {
971
+ if (isVertical) {
972
+ let left;
973
+ let right;
974
+ switch (align) {
975
+ case 'start':
976
+ left = targetRect.left + horizontalOffset;
977
+ break;
978
+ case 'end':
979
+ left = targetRect.right - width - horizontalOffset;
980
+ break;
981
+ case 'middle':
982
+ default:
983
+ left = targetRect.left + targetRect.width / 2 - width / 2 + horizontalOffset;
984
+ break;
985
+ }
986
+ const canAlign = left >= 0 && left + width <= viewWidth;
987
+ if (!canAlign) {
988
+ left = left < 0 ? 0 : undefined;
989
+ right = left === undefined ? 0 : undefined;
990
+ }
991
+ return {
992
+ canAlign,
993
+ left,
994
+ right
995
+ };
996
+ }
997
+ let top;
998
+ let bottom;
999
+ switch (align) {
1000
+ case 'start':
1001
+ top = targetRect.top + verticalOffset;
1002
+ break;
1003
+ case 'middle':
1004
+ top = targetRect.top + targetRect.height / 2 - height / 2 + verticalOffset;
1005
+ break;
1006
+ case 'end':
1007
+ default:
1008
+ top = targetRect.bottom - height - verticalOffset;
1009
+ break;
1010
+ // no default
1011
+ }
1012
+ const canAlign = top >= 0 && top + height <= viewHeight;
1013
+ if (!canAlign) {
1014
+ top = top < 0 ? 0 : undefined;
1015
+ bottom = top === undefined ? 0 : undefined;
1016
+ }
1017
+ return {
1018
+ canAlign,
1019
+ top,
1020
+ bottom
1021
+ };
1022
+ };
1023
+ if (isOutsideView) {
1024
+ let position;
1025
+ let top;
1026
+ let bottom;
1027
+ let right;
1028
+ let left;
1029
+ const findAlignMatch = (isVertical, isBefore) => {
1030
+ const positionListLocal = [...positionList];
1031
+ while (positionListLocal.length) {
1032
+ const strategy = positionListLocal.shift();
1033
+ if (!strategy) {
1034
+ continue;
1035
+ }
1036
+ const position = strategy[Position];
1037
+ const align = strategy[Alignment];
1038
+ if ((isVertical && isBefore && position === 'bottom')
1039
+ || (isVertical && !isBefore && position === 'top')
1040
+ || (!isVertical && isBefore && position === 'right')
1041
+ || (!isVertical && !isBefore && position === 'left')) {
1042
+ return align;
1043
+ }
1044
+ }
1045
+ // Just default aligns if valid position is not defined
1046
+ return [...positionList][0][Alignment];
1047
+ };
1048
+ // if target is outside view, it can always be positioned
1049
+ if (targetRect.bottom <= 0) {
1050
+ position = 'bottom';
1051
+ top = 0;
1052
+ }
1053
+ else if (targetRect.top >= viewHeight) {
1054
+ position = 'top';
1055
+ bottom = 0;
1056
+ }
1057
+ if (targetRect.right <= 0) {
1058
+ position = 'right';
1059
+ left = 0;
1060
+ }
1061
+ else if (targetRect.left >= viewWidth) {
1062
+ position = 'left';
1063
+ right = 0;
1064
+ }
1065
+ if (top === undefined && bottom === undefined) { /* position target is outside left or right */
1066
+ // always attach to the middle of the screen
1067
+ const align = findAlignMatch(false, targetRect.right <= 0);
1068
+ const alignPosition = canAlignPosition(false, align);
1069
+ top = alignPosition.top;
1070
+ bottom = alignPosition.bottom;
1071
+ }
1072
+ if (right === undefined && left === undefined) { /* position target is outside top or bottom */
1073
+ const align = findAlignMatch(true, targetRect.bottom <= 0);
1074
+ const alignPosition = canAlignPosition(true, align);
1075
+ left = alignPosition.left;
1076
+ right = alignPosition.right;
1077
+ }
1078
+ this.calculated.position = position;
1079
+ this.setPositionStyle({
1080
+ top,
1081
+ bottom,
1082
+ left,
1083
+ right
1084
+ });
1085
+ return;
1086
+ }
1087
+ while (positionList.length) {
1088
+ const strategy = positionList.shift();
1089
+ if (!strategy) {
1090
+ continue;
1091
+ }
1092
+ const position = strategy[Position];
1093
+ const align = strategy[Alignment];
1094
+ const isVertical = position === 'top' || position === 'bottom' || position === 'center';
1095
+ let canPosition = false;
1096
+ let top;
1097
+ let left;
1098
+ let right;
1099
+ let bottom;
1100
+ let area = -1;
1101
+ switch (position) {
1102
+ case 'bottom':
1103
+ top = targetRect.bottom + positionVerticalOffset;
1104
+ area = Math.min(viewWidth, width) * (viewHeight - targetRect.bottom);
1105
+ canPosition = top >= 0 && top + height <= viewHeight;
1106
+ break;
1107
+ case 'top':
1108
+ bottom = viewHeight - targetRect.top + positionVerticalOffset;
1109
+ area = Math.min(viewWidth, width) * targetRect.top;
1110
+ canPosition = bottom >= 0 && bottom + height <= viewHeight;
1111
+ break;
1112
+ case 'right':
1113
+ left = targetRect.right + positionHorizontalOffset;
1114
+ area = Math.min(viewHeight, height) * (viewWidth - targetRect.right);
1115
+ canPosition = left >= 0 && left + width <= viewWidth;
1116
+ break;
1117
+ case 'left':
1118
+ right = viewWidth - targetRect.left + positionHorizontalOffset;
1119
+ area = Math.min(viewHeight, height) * targetRect.left;
1120
+ canPosition = right >= 0 && right + width <= viewWidth;
1121
+ break;
1122
+ case 'center': /* noOverlap is not valid for center. Center can be always positioned */
1123
+ top = targetRect.top + targetRect.height / 2 - height / 2 + positionVerticalOffset;
1124
+ bottom = top + height > viewHeight ? 0 : undefined;
1125
+ top = top < 0 ? 0 : (bottom === undefined ? top : undefined);
1126
+ canPosition = true; /* no overlap does not make sense here */
1127
+ area = Infinity;
1128
+ break;
1129
+ // no default
1130
+ }
1131
+ const alignPosition = canAlignPosition(isVertical, align);
1132
+ const canAlign = alignPosition.canAlign;
1133
+ if (isVertical) {
1134
+ left = alignPosition.left;
1135
+ right = alignPosition.right;
1136
+ }
1137
+ else {
1138
+ top = alignPosition.top;
1139
+ bottom = alignPosition.bottom;
1140
+ }
1141
+ if (canAlign && canPosition) { /* no need to continue */
1142
+ this.calculated.position = position;
1143
+ this.setPositionStyle({
1144
+ top,
1145
+ left,
1146
+ bottom,
1147
+ right
1148
+ });
1149
+ return;
1150
+ }
1151
+ calculatedPositionList.push({
1152
+ position,
1153
+ align,
1154
+ canPosition,
1155
+ canAlign,
1156
+ top,
1157
+ left,
1158
+ right,
1159
+ bottom,
1160
+ isVertical,
1161
+ area
1162
+ });
1163
+ }
1164
+ // position always takes priority over align
1165
+ for (let i = 0; i < calculatedPositionList.length; i += 1) {
1166
+ const { canPosition, top, left, position, right, bottom } = calculatedPositionList[i];
1167
+ if (canPosition) {
1168
+ this.calculated.position = position;
1169
+ this.setPositionStyle({
1170
+ top,
1171
+ left,
1172
+ right,
1173
+ bottom
1174
+ });
1175
+ return;
1176
+ }
1177
+ }
1178
+ // find position with the most available screen real estate
1179
+ calculatedPositionList.sort((pos1, pos2) => pos2.area - pos1.area);
1180
+ // no-overlap is different
1181
+ // if cannot fit within the position-align, find the best space to position
1182
+ // and restrict within min-height and max-height
1183
+ if (this.noOverlap) {
1184
+ const { position } = calculatedPositionList[0];
1185
+ switch (position) {
1186
+ case 'bottom':
1187
+ this.limitToViewArea(viewHeight - targetRect.bottom - positionVerticalOffset);
1188
+ break;
1189
+ case 'top':
1190
+ this.limitToViewArea(targetRect.top - positionVerticalOffset);
1191
+ break;
1192
+ case 'right':
1193
+ this.limitToViewArea(undefined, viewWidth - targetRect.right - positionHorizontalOffset);
1194
+ break;
1195
+ case 'left':
1196
+ this.limitToViewArea(undefined, targetRect.left - positionHorizontalOffset);
1197
+ break;
1198
+ // no default
1199
+ }
1200
+ }
1201
+ // cannot set position. In this case just take the first calculated position and try to
1202
+ // position and align with the best match
1203
+ const { isVertical, top, position, left, right, bottom } = calculatedPositionList[0];
1204
+ const getNewPosition = () => {
1205
+ if (isVertical) {
1206
+ return position === 'bottom' ? {
1207
+ bottom: 0,
1208
+ top: null
1209
+ } : {
1210
+ bottom: null,
1211
+ top: 0 /* position up-bottom */
1212
+ };
1213
+ }
1214
+ return position === 'right' ? {
1215
+ right: 0,
1216
+ left: null
1217
+ } : {
1218
+ right: null,
1219
+ left: 0 /* position left-right */
1220
+ };
1221
+ };
1222
+ this.calculated.position = position;
1223
+ this.setPositionStyle(Object.assign({
1224
+ top,
1225
+ left,
1226
+ right,
1227
+ bottom
1228
+ }, getNewPosition()));
1229
+ }
1230
+ /**
1231
+ * Clear all cached values.
1232
+ * Run when external changes occur to styles to re-calculate position.
1233
+ * @returns {void}
1234
+ */
1235
+ clearCached() {
1236
+ this.refitString = undefined;
1237
+ this._sizingInfo = undefined;
1238
+ this.cachedProperties = undefined;
1239
+ }
1240
+ /**
1241
+ * Fit the overlay panel
1242
+ * @returns {void}
1243
+ */
1244
+ fit() {
1245
+ this.fitThrottler.schedule(() => {
1246
+ if (!this.opened) {
1247
+ return;
1248
+ }
1249
+ this.fitNonThrottled();
1250
+ });
1251
+ }
1252
+ /**
1253
+ * Clear all cached values and fit the overlay.
1254
+ * Use this function if any of `maxWidth`, `maxHeight`, `minWidth`, `minHeight`, `height` or `width` changed
1255
+ * @returns {void}
1256
+ */
1257
+ refit() {
1258
+ this.resetSizingInfo();
1259
+ this.clearCached();
1260
+ if (this.opened) {
1261
+ this.fit();
1262
+ }
1263
+ }
1264
+ /**
1265
+ * Element resize callback
1266
+ * @param size dimension details
1267
+ * @returns {void}
1268
+ * @private
1269
+ */
1270
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1271
+ resizedCallback(size) {
1272
+ this.resizedThrottler.schedule(() => {
1273
+ if (!this.opened && this._fullyOpened === OpenedState.CLOSED) {
1274
+ // Do nothing on last resized callback
1275
+ return;
1276
+ }
1277
+ this.setResizeSizingInfo();
1278
+ this.fitNonThrottled();
1279
+ if (this.opened && this.firstResizeDone === false) {
1280
+ this.firstResizeDone = true;
1281
+ if (this._fullyOpened === OpenedState.CLOSED) { /* cannot set to opening if the overlay has not been fully closed */
1282
+ this._fullyOpened = OpenedState.OPENING;
1283
+ }
1284
+ if (this.transitionStyle) { /* this must come last when all register actions are completed */
1285
+ this.onOpenedChangedAnimation();
1286
+ }
1287
+ else {
1288
+ this.onFullyOpened();
1289
+ }
1290
+ }
1291
+ });
1292
+ }
1293
+ /**
1294
+ * Move overlay to front of other overlays
1295
+ * @returns {void}
1296
+ */
1297
+ toFront() {
1298
+ toFront(this);
1299
+ applyLock();
1300
+ }
1301
+ /**
1302
+ * Returns true if the overlay is opened and animation is not running.
1303
+ * Returns false if overlay is closed and animation is not running
1304
+ * @readonly
1305
+ */
1306
+ get fullyOpened() {
1307
+ return this._fullyOpened === OpenedState.OPENED;
1308
+ }
1309
+ /**
1310
+ * Returns true if overlay is doing opening or closing transition
1311
+ * @readonly
1312
+ */
1313
+ get transitioning() {
1314
+ return this._fullyOpened === OpenedState.OPENING || this._fullyOpened === OpenedState.CLOSING;
1315
+ }
1316
+ /**
1317
+ * A `TemplateResult` that will be used
1318
+ * to render the updated internal template.
1319
+ * @return Render template
1320
+ */
1321
+ render() {
1322
+ /**
1323
+ * Use JavaScript expressions to include property values in
1324
+ * the element template.
1325
+ */
1326
+ return Overlay_1.Template;
1327
+ }
1328
+ };
1329
+ Overlay.Template = html `<slot></slot>`;
1330
+ __decorate([
1331
+ property({ type: Boolean, reflect: true, hasChanged: hasBooleanChanged })
1332
+ ], Overlay.prototype, "opened", void 0);
1333
+ __decorate([
1334
+ property({ type: Boolean, reflect: true, attribute: 'with-shadow', hasChanged: hasBooleanChanged })
1335
+ ], Overlay.prototype, "withShadow", void 0);
1336
+ __decorate([
1337
+ property({ type: Boolean, reflect: true, hasChanged: hasBooleanChanged })
1338
+ ], Overlay.prototype, "transparent", void 0);
1339
+ __decorate([
1340
+ property({ type: Boolean, reflect: true, hasChanged: hasBooleanChanged })
1341
+ ], Overlay.prototype, "spacing", void 0);
1342
+ __decorate([
1343
+ property({ type: String, reflect: true, attribute: 'transition-style' })
1344
+ ], Overlay.prototype, "transitionStyle", void 0);
1345
+ __decorate([
1346
+ property({ type: Number, attribute: 'z-index' })
1347
+ ], Overlay.prototype, "zIndex", void 0);
1348
+ __decorate([
1349
+ property({ type: Number, hasChanged: hasNumberChanged })
1350
+ ], Overlay.prototype, "x", void 0);
1351
+ __decorate([
1352
+ property({ type: Number, hasChanged: hasNumberChanged })
1353
+ ], Overlay.prototype, "y", void 0);
1354
+ __decorate([
1355
+ property({ attribute: 'position-target' })
1356
+ ], Overlay.prototype, "positionTarget", void 0);
1357
+ __decorate([
1358
+ property({ type: Number, attribute: 'horizontal-offset', hasChanged: hasNumberChanged })
1359
+ ], Overlay.prototype, "horizontalOffset", void 0);
1360
+ __decorate([
1361
+ property({ type: Number, attribute: 'vertical-offset', hasChanged: hasNumberChanged })
1362
+ ], Overlay.prototype, "verticalOffset", void 0);
1363
+ __decorate([
1364
+ property({ type: Number, hasChanged: hasNumberChanged })
1365
+ ], Overlay.prototype, "offset", void 0);
1366
+ __decorate([
1367
+ property({ type: Boolean, attribute: 'no-cancel-on-esc-key', hasChanged: hasBooleanChanged })
1368
+ ], Overlay.prototype, "noCancelOnEscKey", void 0);
1369
+ __decorate([
1370
+ property({ type: Boolean, attribute: 'no-cancel-on-outside-click', hasChanged: hasBooleanChanged })
1371
+ ], Overlay.prototype, "noCancelOnOutsideClick", void 0);
1372
+ __decorate([
1373
+ property({ type: Boolean, reflect: true, attribute: 'full-screen', hasChanged: hasBooleanChanged })
1374
+ ], Overlay.prototype, "fullScreen", void 0);
1375
+ __decorate([
1376
+ property({ type: Boolean, attribute: 'no-overlap', hasChanged: hasBooleanChanged })
1377
+ ], Overlay.prototype, "noOverlap", void 0);
1378
+ __decorate([
1379
+ property({ type: Boolean, attribute: 'no-interaction-lock', hasChanged: hasBooleanChanged })
1380
+ ], Overlay.prototype, "noInteractionLock", void 0);
1381
+ __decorate([
1382
+ property({ type: Boolean, attribute: 'no-focus-management', hasChanged: hasBooleanChanged })
1383
+ ], Overlay.prototype, "noFocusManagement", void 0);
1384
+ __decorate([
1385
+ property({ type: Boolean, attribute: 'lock-position-target', hasChanged: hasBooleanChanged })
1386
+ ], Overlay.prototype, "lockPositionTarget", void 0);
1387
+ __decorate([
1388
+ property({
1389
+ type: Array,
1390
+ attribute: false,
1391
+ hasChanged: (newVal, oldVal) => {
1392
+ if (!oldVal || newVal.length !== oldVal.length) {
1393
+ return true;
1394
+ }
1395
+ return newVal.some(el => !oldVal.includes(el));
1396
+ }
1397
+ })
1398
+ ], Overlay.prototype, "interactiveElements", void 0);
1399
+ __decorate([
1400
+ property({ type: Boolean, attribute: 'with-backdrop', hasChanged: hasBooleanChanged })
1401
+ ], Overlay.prototype, "withBackdrop", void 0);
1402
+ __decorate([
1403
+ property({ type: Boolean, attribute: 'no-autofocus', hasChanged: hasBooleanChanged })
1404
+ ], Overlay.prototype, "noAutofocus", void 0);
1405
+ __decorate([
1406
+ property({
1407
+ type: Array,
1408
+ hasChanged(newVal, oldVal) {
1409
+ return newVal && oldVal ? newVal.join('') === oldVal.join('') : newVal !== oldVal;
1410
+ },
1411
+ converter: {
1412
+ fromAttribute: (value) => {
1413
+ return value.toLocaleLowerCase()
1414
+ .replace(/ /g, '')
1415
+ .replace(/\|/g, ',')
1416
+ .split(',');
1417
+ }
1418
+ }
1419
+ })
1420
+ ], Overlay.prototype, "position", null);
1421
+ Overlay = Overlay_1 = __decorate([
1422
+ customElement('ef-overlay', {
1423
+ alias: 'coral-popup-panel'
1424
+ })
1425
+ ], Overlay);
1426
+ export { Overlay };