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