@kirbydesign/designsystem 11.11.4 → 12.0.0-dev-286cdc0

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 (291) hide show
  1. package/README.md +7 -0
  2. package/fesm2022/kirbydesign-designsystem-accordion.mjs +246 -135
  3. package/fesm2022/kirbydesign-designsystem-accordion.mjs.map +1 -1
  4. package/fesm2022/kirbydesign-designsystem-action-group.mjs +229 -134
  5. package/fesm2022/kirbydesign-designsystem-action-group.mjs.map +1 -1
  6. package/fesm2022/kirbydesign-designsystem-avatar.mjs +102 -55
  7. package/fesm2022/kirbydesign-designsystem-avatar.mjs.map +1 -1
  8. package/fesm2022/kirbydesign-designsystem-badge.mjs +85 -42
  9. package/fesm2022/kirbydesign-designsystem-badge.mjs.map +1 -1
  10. package/fesm2022/kirbydesign-designsystem-button.mjs +203 -170
  11. package/fesm2022/kirbydesign-designsystem-button.mjs.map +1 -1
  12. package/fesm2022/kirbydesign-designsystem-calendar.mjs +524 -516
  13. package/fesm2022/kirbydesign-designsystem-calendar.mjs.map +1 -1
  14. package/fesm2022/kirbydesign-designsystem-card.mjs +439 -205
  15. package/fesm2022/kirbydesign-designsystem-card.mjs.map +1 -1
  16. package/fesm2022/kirbydesign-designsystem-chart.mjs +1388 -1469
  17. package/fesm2022/kirbydesign-designsystem-chart.mjs.map +1 -1
  18. package/fesm2022/kirbydesign-designsystem-checkbox.mjs +223 -176
  19. package/fesm2022/kirbydesign-designsystem-checkbox.mjs.map +1 -1
  20. package/fesm2022/kirbydesign-designsystem-config.mjs +50 -96
  21. package/fesm2022/kirbydesign-designsystem-config.mjs.map +1 -1
  22. package/fesm2022/kirbydesign-designsystem-data-table.mjs +180 -83
  23. package/fesm2022/kirbydesign-designsystem-data-table.mjs.map +1 -1
  24. package/fesm2022/kirbydesign-designsystem-divider.mjs +46 -19
  25. package/fesm2022/kirbydesign-designsystem-divider.mjs.map +1 -1
  26. package/fesm2022/kirbydesign-designsystem-dropdown.mjs +878 -752
  27. package/fesm2022/kirbydesign-designsystem-dropdown.mjs.map +1 -1
  28. package/fesm2022/kirbydesign-designsystem-empty-state.mjs +175 -91
  29. package/fesm2022/kirbydesign-designsystem-empty-state.mjs.map +1 -1
  30. package/fesm2022/kirbydesign-designsystem-fab-sheet.mjs +213 -85
  31. package/fesm2022/kirbydesign-designsystem-fab-sheet.mjs.map +1 -1
  32. package/fesm2022/kirbydesign-designsystem-flag.mjs +67 -33
  33. package/fesm2022/kirbydesign-designsystem-flag.mjs.map +1 -1
  34. package/fesm2022/kirbydesign-designsystem-form-field.mjs +1260 -891
  35. package/fesm2022/kirbydesign-designsystem-form-field.mjs.map +1 -1
  36. package/fesm2022/kirbydesign-designsystem-gesture.mjs +38 -23
  37. package/fesm2022/kirbydesign-designsystem-gesture.mjs.map +1 -1
  38. package/fesm2022/kirbydesign-designsystem-header.mjs +422 -182
  39. package/fesm2022/kirbydesign-designsystem-header.mjs.map +1 -1
  40. package/fesm2022/kirbydesign-designsystem-helpers-scss.mjs +16 -14
  41. package/fesm2022/kirbydesign-designsystem-helpers-scss.mjs.map +1 -1
  42. package/fesm2022/kirbydesign-designsystem-helpers.mjs +251 -361
  43. package/fesm2022/kirbydesign-designsystem-helpers.mjs.map +1 -1
  44. package/fesm2022/kirbydesign-designsystem-icon.mjs +881 -296
  45. package/fesm2022/kirbydesign-designsystem-icon.mjs.map +1 -1
  46. package/fesm2022/kirbydesign-designsystem-item-group.mjs +52 -23
  47. package/fesm2022/kirbydesign-designsystem-item-group.mjs.map +1 -1
  48. package/fesm2022/kirbydesign-designsystem-item-sliding.mjs +147 -43
  49. package/fesm2022/kirbydesign-designsystem-item-sliding.mjs.map +1 -1
  50. package/fesm2022/kirbydesign-designsystem-item.mjs +395 -151
  51. package/fesm2022/kirbydesign-designsystem-item.mjs.map +1 -1
  52. package/fesm2022/kirbydesign-designsystem-kirby-app.mjs +136 -54
  53. package/fesm2022/kirbydesign-designsystem-kirby-app.mjs.map +1 -1
  54. package/fesm2022/kirbydesign-designsystem-list.mjs +1188 -697
  55. package/fesm2022/kirbydesign-designsystem-list.mjs.map +1 -1
  56. package/fesm2022/kirbydesign-designsystem-loading-overlay.mjs +166 -76
  57. package/fesm2022/kirbydesign-designsystem-loading-overlay.mjs.map +1 -1
  58. package/fesm2022/kirbydesign-designsystem-menu.mjs +420 -311
  59. package/fesm2022/kirbydesign-designsystem-menu.mjs.map +1 -1
  60. package/fesm2022/kirbydesign-designsystem-modal.mjs +2476 -1912
  61. package/fesm2022/kirbydesign-designsystem-modal.mjs.map +1 -1
  62. package/fesm2022/kirbydesign-designsystem-page.mjs +1526 -905
  63. package/fesm2022/kirbydesign-designsystem-page.mjs.map +1 -1
  64. package/fesm2022/kirbydesign-designsystem-popover.mjs +204 -169
  65. package/fesm2022/kirbydesign-designsystem-popover.mjs.map +1 -1
  66. package/fesm2022/kirbydesign-designsystem-progress-circle.mjs +209 -158
  67. package/fesm2022/kirbydesign-designsystem-progress-circle.mjs.map +1 -1
  68. package/fesm2022/kirbydesign-designsystem-radio.mjs +537 -365
  69. package/fesm2022/kirbydesign-designsystem-radio.mjs.map +1 -1
  70. package/fesm2022/kirbydesign-designsystem-range.mjs +207 -150
  71. package/fesm2022/kirbydesign-designsystem-range.mjs.map +1 -1
  72. package/fesm2022/kirbydesign-designsystem-reorder-list.mjs +217 -104
  73. package/fesm2022/kirbydesign-designsystem-reorder-list.mjs.map +1 -1
  74. package/fesm2022/kirbydesign-designsystem-router-outlet.mjs +113 -38
  75. package/fesm2022/kirbydesign-designsystem-router-outlet.mjs.map +1 -1
  76. package/fesm2022/kirbydesign-designsystem-section-header.mjs +56 -18
  77. package/fesm2022/kirbydesign-designsystem-section-header.mjs.map +1 -1
  78. package/fesm2022/kirbydesign-designsystem-segmented-control.mjs +276 -232
  79. package/fesm2022/kirbydesign-designsystem-segmented-control.mjs.map +1 -1
  80. package/fesm2022/kirbydesign-designsystem-shared-floating.mjs +328 -382
  81. package/fesm2022/kirbydesign-designsystem-shared-floating.mjs.map +1 -1
  82. package/fesm2022/kirbydesign-designsystem-shared-portal.mjs +73 -84
  83. package/fesm2022/kirbydesign-designsystem-shared-portal.mjs.map +1 -1
  84. package/fesm2022/kirbydesign-designsystem-shared.mjs +665 -531
  85. package/fesm2022/kirbydesign-designsystem-shared.mjs.map +1 -1
  86. package/fesm2022/kirbydesign-designsystem-slide-button.mjs +140 -91
  87. package/fesm2022/kirbydesign-designsystem-slide-button.mjs.map +1 -1
  88. package/fesm2022/kirbydesign-designsystem-slide.mjs +360 -158
  89. package/fesm2022/kirbydesign-designsystem-slide.mjs.map +1 -1
  90. package/fesm2022/kirbydesign-designsystem-spinner.mjs +90 -32
  91. package/fesm2022/kirbydesign-designsystem-spinner.mjs.map +1 -1
  92. package/fesm2022/kirbydesign-designsystem-tab-navigation.mjs +348 -181
  93. package/fesm2022/kirbydesign-designsystem-tab-navigation.mjs.map +1 -1
  94. package/fesm2022/kirbydesign-designsystem-tabs.mjs +286 -121
  95. package/fesm2022/kirbydesign-designsystem-tabs.mjs.map +1 -1
  96. package/fesm2022/kirbydesign-designsystem-testing-base.mjs +6234 -3164
  97. package/fesm2022/kirbydesign-designsystem-testing-base.mjs.map +1 -1
  98. package/fesm2022/kirbydesign-designsystem-testing-jasmine.mjs +118 -95
  99. package/fesm2022/kirbydesign-designsystem-testing-jasmine.mjs.map +1 -1
  100. package/fesm2022/kirbydesign-designsystem-testing-jest.mjs +128 -101
  101. package/fesm2022/kirbydesign-designsystem-testing-jest.mjs.map +1 -1
  102. package/fesm2022/kirbydesign-designsystem-testing.mjs +236 -243
  103. package/fesm2022/kirbydesign-designsystem-testing.mjs.map +1 -1
  104. package/fesm2022/kirbydesign-designsystem-toast.mjs +98 -62
  105. package/fesm2022/kirbydesign-designsystem-toast.mjs.map +1 -1
  106. package/fesm2022/kirbydesign-designsystem-toggle-button.mjs +155 -127
  107. package/fesm2022/kirbydesign-designsystem-toggle-button.mjs.map +1 -1
  108. package/fesm2022/kirbydesign-designsystem-toggle.mjs +180 -150
  109. package/fesm2022/kirbydesign-designsystem-toggle.mjs.map +1 -1
  110. package/fesm2022/kirbydesign-designsystem-types.mjs +39 -24
  111. package/fesm2022/kirbydesign-designsystem-types.mjs.map +1 -1
  112. package/fesm2022/kirbydesign-designsystem.mjs +516 -407
  113. package/fesm2022/kirbydesign-designsystem.mjs.map +1 -1
  114. package/icons/svg/megaphone.svg +3 -0
  115. package/icons/svg/person-blocked.svg +3 -0
  116. package/icons/svg/person-check.svg +3 -0
  117. package/icons/svg/person-close.svg +3 -0
  118. package/icons/svg/person-cloud.svg +3 -0
  119. package/icons/svg/person-power.svg +3 -0
  120. package/icons/svg/person-warning.svg +3 -0
  121. package/icons/svg/phone-device-pin.svg +3 -0
  122. package/icons/svg/phone-device.svg +3 -2
  123. package/package.json +10 -10
  124. package/readme.md +37 -0
  125. package/types/kirbydesign-designsystem-accordion.d.ts +72 -39
  126. package/types/kirbydesign-designsystem-accordion.d.ts.map +1 -1
  127. package/types/kirbydesign-designsystem-action-group.d.ts +46 -39
  128. package/types/kirbydesign-designsystem-action-group.d.ts.map +1 -1
  129. package/types/kirbydesign-designsystem-avatar.d.ts +62 -26
  130. package/types/kirbydesign-designsystem-avatar.d.ts.map +1 -1
  131. package/types/kirbydesign-designsystem-badge.d.ts +30 -19
  132. package/types/kirbydesign-designsystem-badge.d.ts.map +1 -1
  133. package/types/kirbydesign-designsystem-button.d.ts +70 -45
  134. package/types/kirbydesign-designsystem-button.d.ts.map +1 -1
  135. package/types/kirbydesign-designsystem-calendar.d.ts +193 -132
  136. package/types/kirbydesign-designsystem-calendar.d.ts.map +1 -1
  137. package/types/kirbydesign-designsystem-card.d.ts +130 -66
  138. package/types/kirbydesign-designsystem-card.d.ts.map +1 -1
  139. package/types/kirbydesign-designsystem-chart.d.ts +198 -172
  140. package/types/kirbydesign-designsystem-chart.d.ts.map +1 -1
  141. package/types/kirbydesign-designsystem-checkbox.d.ts +102 -68
  142. package/types/kirbydesign-designsystem-checkbox.d.ts.map +1 -1
  143. package/types/kirbydesign-designsystem-config.d.ts +17 -21
  144. package/types/kirbydesign-designsystem-config.d.ts.map +1 -1
  145. package/types/kirbydesign-designsystem-data-table.d.ts +46 -26
  146. package/types/kirbydesign-designsystem-data-table.d.ts.map +1 -1
  147. package/types/kirbydesign-designsystem-divider.d.ts +11 -9
  148. package/types/kirbydesign-designsystem-divider.d.ts.map +1 -1
  149. package/types/kirbydesign-designsystem-dropdown.d.ts +219 -166
  150. package/types/kirbydesign-designsystem-dropdown.d.ts.map +1 -1
  151. package/types/kirbydesign-designsystem-empty-state.d.ts +58 -35
  152. package/types/kirbydesign-designsystem-empty-state.d.ts.map +1 -1
  153. package/types/kirbydesign-designsystem-fab-sheet.d.ts +34 -28
  154. package/types/kirbydesign-designsystem-fab-sheet.d.ts.map +1 -1
  155. package/types/kirbydesign-designsystem-flag.d.ts +18 -13
  156. package/types/kirbydesign-designsystem-flag.d.ts.map +1 -1
  157. package/types/kirbydesign-designsystem-form-field.d.ts +409 -242
  158. package/types/kirbydesign-designsystem-form-field.d.ts.map +1 -1
  159. package/types/kirbydesign-designsystem-gesture.d.ts +41 -46
  160. package/types/kirbydesign-designsystem-gesture.d.ts.map +1 -1
  161. package/types/kirbydesign-designsystem-header.d.ts +102 -64
  162. package/types/kirbydesign-designsystem-header.d.ts.map +1 -1
  163. package/types/kirbydesign-designsystem-helpers-scss.d.ts +6 -8
  164. package/types/kirbydesign-designsystem-helpers-scss.d.ts.map +1 -1
  165. package/types/kirbydesign-designsystem-helpers.d.ts +83 -97
  166. package/types/kirbydesign-designsystem-helpers.d.ts.map +1 -1
  167. package/types/kirbydesign-designsystem-icon.d.ts +63 -59
  168. package/types/kirbydesign-designsystem-icon.d.ts.map +1 -1
  169. package/types/kirbydesign-designsystem-item-group.d.ts +6 -9
  170. package/types/kirbydesign-designsystem-item-group.d.ts.map +1 -1
  171. package/types/kirbydesign-designsystem-item-sliding.d.ts +30 -26
  172. package/types/kirbydesign-designsystem-item-sliding.d.ts.map +1 -1
  173. package/types/kirbydesign-designsystem-item.d.ts +93 -54
  174. package/types/kirbydesign-designsystem-item.d.ts.map +1 -1
  175. package/types/kirbydesign-designsystem-kirby-app.d.ts +18 -19
  176. package/types/kirbydesign-designsystem-kirby-app.d.ts.map +1 -1
  177. package/types/kirbydesign-designsystem-list.d.ts +392 -263
  178. package/types/kirbydesign-designsystem-list.d.ts.map +1 -1
  179. package/types/kirbydesign-designsystem-loading-overlay.d.ts +35 -24
  180. package/types/kirbydesign-designsystem-loading-overlay.d.ts.map +1 -1
  181. package/types/kirbydesign-designsystem-menu.d.ts +119 -69
  182. package/types/kirbydesign-designsystem-menu.d.ts.map +1 -1
  183. package/types/kirbydesign-designsystem-modal.d.ts +578 -455
  184. package/types/kirbydesign-designsystem-modal.d.ts.map +1 -1
  185. package/types/kirbydesign-designsystem-page.d.ts +308 -226
  186. package/types/kirbydesign-designsystem-page.d.ts.map +1 -1
  187. package/types/kirbydesign-designsystem-popover.d.ts +48 -40
  188. package/types/kirbydesign-designsystem-popover.d.ts.map +1 -1
  189. package/types/kirbydesign-designsystem-progress-circle.d.ts +59 -61
  190. package/types/kirbydesign-designsystem-progress-circle.d.ts.map +1 -1
  191. package/types/kirbydesign-designsystem-radio.d.ts +147 -98
  192. package/types/kirbydesign-designsystem-radio.d.ts.map +1 -1
  193. package/types/kirbydesign-designsystem-range.d.ts +90 -45
  194. package/types/kirbydesign-designsystem-range.d.ts.map +1 -1
  195. package/types/kirbydesign-designsystem-reorder-list.d.ts +44 -32
  196. package/types/kirbydesign-designsystem-reorder-list.d.ts.map +1 -1
  197. package/types/kirbydesign-designsystem-router-outlet.d.ts +23 -18
  198. package/types/kirbydesign-designsystem-router-outlet.d.ts.map +1 -1
  199. package/types/kirbydesign-designsystem-section-header.d.ts +5 -8
  200. package/types/kirbydesign-designsystem-section-header.d.ts.map +1 -1
  201. package/types/kirbydesign-designsystem-segmented-control.d.ts +123 -100
  202. package/types/kirbydesign-designsystem-segmented-control.d.ts.map +1 -1
  203. package/types/kirbydesign-designsystem-shared-floating.d.ts +183 -128
  204. package/types/kirbydesign-designsystem-shared-floating.d.ts.map +1 -1
  205. package/types/kirbydesign-designsystem-shared-portal.d.ts +29 -28
  206. package/types/kirbydesign-designsystem-shared-portal.d.ts.map +1 -1
  207. package/types/kirbydesign-designsystem-shared.d.ts +143 -139
  208. package/types/kirbydesign-designsystem-shared.d.ts.map +1 -1
  209. package/types/kirbydesign-designsystem-slide-button.d.ts +43 -34
  210. package/types/kirbydesign-designsystem-slide-button.d.ts.map +1 -1
  211. package/types/kirbydesign-designsystem-slide.d.ts +80 -59
  212. package/types/kirbydesign-designsystem-slide.d.ts.map +1 -1
  213. package/types/kirbydesign-designsystem-spinner.d.ts +13 -14
  214. package/types/kirbydesign-designsystem-spinner.d.ts.map +1 -1
  215. package/types/kirbydesign-designsystem-tab-navigation.d.ts +78 -55
  216. package/types/kirbydesign-designsystem-tab-navigation.d.ts.map +1 -1
  217. package/types/kirbydesign-designsystem-tabs.d.ts +50 -45
  218. package/types/kirbydesign-designsystem-tabs.d.ts.map +1 -1
  219. package/types/kirbydesign-designsystem-testing-base.d.ts +2435 -815
  220. package/types/kirbydesign-designsystem-testing-base.d.ts.map +1 -1
  221. package/types/kirbydesign-designsystem-testing-jasmine.d.ts +9 -10
  222. package/types/kirbydesign-designsystem-testing-jasmine.d.ts.map +1 -1
  223. package/types/kirbydesign-designsystem-testing-jest.d.ts +9 -10
  224. package/types/kirbydesign-designsystem-testing-jest.d.ts.map +1 -1
  225. package/types/kirbydesign-designsystem-testing.d.ts +52 -58
  226. package/types/kirbydesign-designsystem-testing.d.ts.map +1 -1
  227. package/types/kirbydesign-designsystem-toast.d.ts +25 -31
  228. package/types/kirbydesign-designsystem-toast.d.ts.map +1 -1
  229. package/types/kirbydesign-designsystem-toggle-button.d.ts +62 -56
  230. package/types/kirbydesign-designsystem-toggle-button.d.ts.map +1 -1
  231. package/types/kirbydesign-designsystem-toggle.d.ts +71 -63
  232. package/types/kirbydesign-designsystem-toggle.d.ts.map +1 -1
  233. package/types/kirbydesign-designsystem-types.d.ts +15 -22
  234. package/types/kirbydesign-designsystem-types.d.ts.map +1 -1
  235. package/types/kirbydesign-designsystem.d.ts +135 -123
  236. package/types/kirbydesign-designsystem.d.ts.map +1 -1
  237. package/accordion/package.json +0 -4
  238. package/action-group/package.json +0 -4
  239. package/avatar/package.json +0 -4
  240. package/badge/package.json +0 -4
  241. package/button/package.json +0 -4
  242. package/calendar/package.json +0 -4
  243. package/card/package.json +0 -4
  244. package/chart/package.json +0 -4
  245. package/checkbox/package.json +0 -4
  246. package/config/package.json +0 -4
  247. package/data-table/package.json +0 -4
  248. package/divider/package.json +0 -4
  249. package/dropdown/package.json +0 -4
  250. package/empty-state/package.json +0 -4
  251. package/fab-sheet/package.json +0 -4
  252. package/flag/package.json +0 -4
  253. package/form-field/package.json +0 -4
  254. package/gesture/package.json +0 -4
  255. package/header/package.json +0 -4
  256. package/helpers/package.json +0 -4
  257. package/helpers/scss/package.json +0 -4
  258. package/icon/package.json +0 -4
  259. package/item/package.json +0 -4
  260. package/item-group/package.json +0 -4
  261. package/item-sliding/package.json +0 -4
  262. package/kirby-app/package.json +0 -4
  263. package/list/package.json +0 -4
  264. package/loading-overlay/package.json +0 -4
  265. package/menu/package.json +0 -4
  266. package/modal/package.json +0 -4
  267. package/page/package.json +0 -4
  268. package/popover/package.json +0 -4
  269. package/progress-circle/package.json +0 -4
  270. package/radio/package.json +0 -4
  271. package/range/package.json +0 -4
  272. package/reorder-list/package.json +0 -4
  273. package/router-outlet/package.json +0 -4
  274. package/section-header/package.json +0 -4
  275. package/segmented-control/package.json +0 -4
  276. package/shared/floating/package.json +0 -4
  277. package/shared/package.json +0 -4
  278. package/shared/portal/package.json +0 -4
  279. package/slide/package.json +0 -4
  280. package/slide-button/package.json +0 -4
  281. package/spinner/package.json +0 -4
  282. package/tab-navigation/package.json +0 -4
  283. package/tabs/package.json +0 -4
  284. package/testing/package.json +0 -4
  285. package/testing-base/package.json +0 -4
  286. package/testing-jasmine/package.json +0 -4
  287. package/testing-jest/package.json +0 -4
  288. package/toast/package.json +0 -4
  289. package/toggle/package.json +0 -4
  290. package/toggle-button/package.json +0 -4
  291. package/types/package.json +0 -4
@@ -1,174 +1,209 @@
1
- import * as i0 from '@angular/core';
2
- import { ElementRef, EventEmitter, HostListener, Output, Input, ViewChild, Component } from '@angular/core';
3
- import { DesignTokenHelper } from '@kirbydesign/designsystem/helpers';
4
-
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, ElementRef, EventEmitter, HostListener, Input, Output, RendererStyleFlags2, ViewChild } from "@angular/core";
3
+ import { DesignTokenHelper } from "@kirbydesign/designsystem/helpers";
4
+ function calculateVerticalPopoverPosition({ viewportHeight, targetTop, targetBottom, contentHeight, bodyPadding }) {
5
+ const availableSpaceBelow = viewportHeight - targetBottom;
6
+ const availableSpaceAbove = targetTop;
7
+ const opensUpwards = !(availableSpaceBelow >= contentHeight + bodyPadding) && availableSpaceBelow < availableSpaceAbove;
8
+ const availableSpace = opensUpwards ? availableSpaceAbove : availableSpaceBelow;
9
+ return {
10
+ opensUpwards,
11
+ offsetFromEdge: opensUpwards ? viewportHeight - targetTop : targetBottom,
12
+ availableMaxHeightInDirection: availableSpace - bodyPadding
13
+ };
14
+ }
5
15
  var HorizontalDirection;
6
- (function (HorizontalDirection) {
7
- HorizontalDirection["right"] = "right";
8
- HorizontalDirection["left"] = "left";
16
+ (function(HorizontalDirection) {
17
+ HorizontalDirection["right"] = "right";
18
+ HorizontalDirection["left"] = "left";
9
19
  })(HorizontalDirection || (HorizontalDirection = {}));
10
- class PopoverComponent {
11
- get targetElement() {
12
- if (this.target instanceof ElementRef) {
13
- return this.target.nativeElement;
14
- }
15
- else {
16
- return this.target;
17
- }
18
- }
19
- _onWindowResize() {
20
- this.hide();
21
- }
22
- constructor(elementRef, renderer) {
23
- this.elementRef = elementRef;
24
- this.renderer = renderer;
25
- // removeEventListener same instance of event handler & options
26
- this.preventScrollEventListenerOptions = {
27
- passive: false,
28
- };
29
- this.POPOVER_BODY_PADDING = 12;
30
- this.isShowing = false;
31
- this.openingFrameId = null;
32
- this.popout = HorizontalDirection.right;
33
- this.willHide = new EventEmitter();
34
- this.document = elementRef.nativeElement.ownerDocument;
35
- }
36
- ngAfterViewInit() {
37
- this.placePopoverAboveClosestModal();
38
- this.renderer.removeChild(this.elementRef.nativeElement.parentElement, this.elementRef.nativeElement);
39
- }
40
- ngOnDestroy() {
41
- this.hide();
42
- }
43
- placePopoverAboveClosestModal() {
44
- const closestIonModal = this.elementRef.nativeElement.closest('ion-modal');
45
- if (closestIonModal) {
46
- this.zIndex = parseInt(closestIonModal.style.zIndex) + 1;
47
- this.elementRef.nativeElement.style.zIndex = `${this.zIndex}`;
48
- }
49
- else {
50
- this.zIndex = parseInt(DesignTokenHelper.zLayer('popover'));
51
- }
52
- }
53
- static preventEventOutsidePopover(event) {
54
- if (event.target instanceof HTMLElement) {
55
- const targetIsInPopover = !!event.target.closest('kirby-popover');
56
- if (!targetIsInPopover) {
57
- event.preventDefault();
58
- }
59
- }
60
- }
61
- preventScroll() {
62
- this.isFirstToLockScroll = !this.document.body.classList.contains('backdrop-no-scroll');
63
- if (this.isFirstToLockScroll) {
64
- this.renderer.addClass(this.document.body, 'backdrop-no-scroll');
65
- }
66
- this.disposeTouchMoveListener = this.renderer.listen(this.document, 'touchmove', PopoverComponent.preventEventOutsidePopover, this.preventScrollEventListenerOptions);
67
- }
68
- releaseScroll() {
69
- if (this.isFirstToLockScroll) {
70
- this.renderer.removeClass(this.document.body, 'backdrop-no-scroll');
71
- }
72
- this.disposeTouchMoveListener?.();
73
- }
74
- show() {
75
- this.renderer.addClass(this.elementRef.nativeElement, 'is-opening');
76
- this.renderer.appendChild(this.document.body, this.elementRef.nativeElement);
77
- this.preventScroll();
78
- this.isShowing = true;
79
- this.openingFrameId = requestAnimationFrame(() => {
80
- this.openingFrameId = null;
81
- if (!this.isShowing)
82
- return;
83
- this.positionWrapper();
84
- this.renderer.addClass(this.elementRef.nativeElement, 'is-open');
85
- this.renderer.removeClass(this.elementRef.nativeElement, 'is-opening');
86
- });
87
- }
88
- hide() {
89
- if (!this.isShowing)
90
- return;
91
- if (this.openingFrameId !== null) {
92
- cancelAnimationFrame(this.openingFrameId);
93
- this.openingFrameId = null;
94
- this.renderer.removeClass(this.elementRef.nativeElement, 'is-opening');
95
- }
96
- this.willHide.emit();
97
- this.renderer.removeChild(this.elementRef.nativeElement.parentElement, this.elementRef.nativeElement);
98
- this.releaseScroll();
99
- this.renderer.removeStyle(this.targetElement, 'z-index');
100
- this.renderer.removeStyle(this.targetElement, 'pointer-events');
101
- this.isShowing = false;
102
- }
103
- positionWrapper() {
104
- const targetDimensions = this.targetElement.getBoundingClientRect();
105
- this.renderer.appendChild(this.document.body, this.elementRef.nativeElement);
106
- const wrapperElement = this.wrapperElement.nativeElement;
107
- const wrapperDimensions = wrapperElement.getBoundingClientRect();
108
- const viewport = wrapperElement.ownerDocument.defaultView;
109
- this.positionHorizontally(viewport, wrapperElement, targetDimensions, wrapperDimensions);
110
- this.positionVertically(viewport, wrapperElement, targetDimensions, wrapperDimensions);
111
- }
112
- positionHorizontally(viewPort, wrapperElement, targetDimensions, wrapperDimensions) {
113
- const viewPortWidth = viewPort.innerWidth;
114
- const contentWidth = wrapperDimensions.width;
115
- const availableSpaceRight = viewPortWidth - targetDimensions.left;
116
- const availableSpaceLeft = targetDimensions.right;
117
- const contentCanFitRightOfTarget = availableSpaceRight >= contentWidth + this.POPOVER_BODY_PADDING;
118
- const openRight = contentCanFitRightOfTarget || availableSpaceRight >= availableSpaceLeft;
119
- const [direction, oppositeDirection] = this.popout === HorizontalDirection.left || !openRight
120
- ? ['left', 'right']
121
- : ['right', 'left'];
122
- const pxValue = direction === 'left' ? viewPortWidth - targetDimensions.right : targetDimensions.left;
123
- this.renderer.removeStyle(wrapperElement, direction);
124
- this.renderer.setStyle(wrapperElement, oppositeDirection, `${pxValue}px`);
125
- }
126
- positionVertically(viewPort, wrapperElement, targetDimensions, wrapperDimensions) {
127
- const viewPortHeight = viewPort.innerHeight;
128
- const contentHeight = wrapperDimensions.height;
129
- const availableSpaceDown = viewPortHeight - targetDimensions.bottom;
130
- const availableSpaceUp = targetDimensions.top;
131
- const contentCanFitBelowTarget = availableSpaceDown >= contentHeight + this.POPOVER_BODY_PADDING;
132
- const isAvailableSpaceBelow = contentCanFitBelowTarget || availableSpaceDown >= availableSpaceUp;
133
- const [direction, oppositeDirection] = isAvailableSpaceBelow
134
- ? ['bottom', 'top']
135
- : ['top', 'bottom'];
136
- const pxValue = direction === 'bottom' ? targetDimensions.bottom : viewPortHeight - targetDimensions.top;
137
- this.renderer.removeStyle(wrapperElement, direction);
138
- this.renderer.setStyle(wrapperElement, oppositeDirection, `${pxValue}px`);
139
- if (direction === 'top') {
140
- // Ensure target is elevated above shadows in popover, i.e. content wrapped in Card:
141
- this.renderer.setStyle(this.targetElement, 'z-index', `${this.zIndex + 1}`);
142
- this.renderer.setStyle(this.targetElement, 'pointer-events', 'none');
143
- }
144
- }
145
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: PopoverComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component }); }
146
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.18", type: PopoverComponent, isStandalone: true, selector: "kirby-popover", inputs: { popout: "popout", target: "target" }, outputs: { willHide: "willHide" }, host: { listeners: { "window:resize": "_onWindowResize()" } }, viewQueries: [{ propertyName: "wrapperElement", first: true, predicate: ["wrapper"], descendants: true, read: ElementRef, static: true }], ngImport: i0, template: `
20
+ var PopoverComponent = class PopoverComponent {
21
+ get targetElement() {
22
+ if (this.target instanceof ElementRef) return this.target.nativeElement;
23
+ else return this.target;
24
+ }
25
+ _onWindowResize() {
26
+ this.hide();
27
+ }
28
+ constructor(elementRef, renderer) {
29
+ this.elementRef = elementRef;
30
+ this.renderer = renderer;
31
+ this.preventScrollEventListenerOptions = { passive: false };
32
+ this.POPOVER_BODY_PADDING = 12;
33
+ this.isShowing = false;
34
+ this.openingFrameId = null;
35
+ this.popout = HorizontalDirection.right;
36
+ this.willHide = new EventEmitter();
37
+ this.document = elementRef.nativeElement.ownerDocument;
38
+ }
39
+ ngAfterViewInit() {
40
+ this.placePopoverAboveClosestModal();
41
+ this.renderer.removeChild(this.elementRef.nativeElement.parentElement, this.elementRef.nativeElement);
42
+ }
43
+ ngOnDestroy() {
44
+ this.hide();
45
+ }
46
+ placePopoverAboveClosestModal() {
47
+ const closestIonModal = this.elementRef.nativeElement.closest("ion-modal");
48
+ if (closestIonModal) {
49
+ this.zIndex = parseInt(closestIonModal.style.zIndex) + 1;
50
+ this.elementRef.nativeElement.style.zIndex = `${this.zIndex}`;
51
+ } else this.zIndex = parseInt(DesignTokenHelper.zLayer("popover"));
52
+ }
53
+ static preventEventOutsidePopover(event) {
54
+ if (event.target instanceof HTMLElement) {
55
+ if (!!!event.target.closest("kirby-popover")) event.preventDefault();
56
+ }
57
+ }
58
+ preventScroll() {
59
+ this.isFirstToLockScroll = !this.document.body.classList.contains("backdrop-no-scroll");
60
+ if (this.isFirstToLockScroll) this.renderer.addClass(this.document.body, "backdrop-no-scroll");
61
+ this.disposeTouchMoveListener = this.renderer.listen(this.document, "touchmove", PopoverComponent.preventEventOutsidePopover, this.preventScrollEventListenerOptions);
62
+ }
63
+ releaseScroll() {
64
+ if (this.isFirstToLockScroll) this.renderer.removeClass(this.document.body, "backdrop-no-scroll");
65
+ this.disposeTouchMoveListener?.();
66
+ }
67
+ show() {
68
+ this.renderer.addClass(this.elementRef.nativeElement, "is-opening");
69
+ this.renderer.appendChild(this.document.body, this.elementRef.nativeElement);
70
+ this.preventScroll();
71
+ this.isShowing = true;
72
+ this.openingFrameId = requestAnimationFrame(() => {
73
+ this.openingFrameId = null;
74
+ if (!this.isShowing) return;
75
+ this.positionWrapper();
76
+ this.renderer.addClass(this.elementRef.nativeElement, "is-open");
77
+ this.renderer.removeClass(this.elementRef.nativeElement, "is-opening");
78
+ });
79
+ }
80
+ hide() {
81
+ if (!this.isShowing) return;
82
+ if (this.openingFrameId !== null) {
83
+ cancelAnimationFrame(this.openingFrameId);
84
+ this.openingFrameId = null;
85
+ this.renderer.removeClass(this.elementRef.nativeElement, "is-opening");
86
+ }
87
+ this.willHide.emit();
88
+ this.renderer.removeChild(this.elementRef.nativeElement.parentElement, this.elementRef.nativeElement);
89
+ this.releaseScroll();
90
+ this.renderer.removeStyle(this.targetElement, "z-index");
91
+ this.renderer.removeStyle(this.targetElement, "pointer-events");
92
+ this.isShowing = false;
93
+ }
94
+ positionWrapper() {
95
+ const targetDimensions = this.targetElement.getBoundingClientRect();
96
+ this.renderer.appendChild(this.document.body, this.elementRef.nativeElement);
97
+ const wrapperElement = this.wrapperElement.nativeElement;
98
+ const wrapperDimensions = wrapperElement.getBoundingClientRect();
99
+ const viewport = wrapperElement.ownerDocument.defaultView;
100
+ this.positionHorizontally(viewport, wrapperElement, targetDimensions, wrapperDimensions);
101
+ this.positionVertically(viewport, wrapperElement, targetDimensions, wrapperDimensions);
102
+ }
103
+ positionHorizontally(viewPort, wrapperElement, targetDimensions, wrapperDimensions) {
104
+ const viewPortWidth = viewPort.innerWidth;
105
+ const contentWidth = wrapperDimensions.width;
106
+ const availableSpaceRight = viewPortWidth - targetDimensions.left;
107
+ const availableSpaceLeft = targetDimensions.right;
108
+ const openRight = availableSpaceRight >= contentWidth + this.POPOVER_BODY_PADDING || availableSpaceRight >= availableSpaceLeft;
109
+ const [direction, oppositeDirection] = this.popout === HorizontalDirection.left || !openRight ? ["left", "right"] : ["right", "left"];
110
+ const pxValue = direction === "left" ? viewPortWidth - targetDimensions.right : targetDimensions.left;
111
+ this.renderer.removeStyle(wrapperElement, direction);
112
+ this.renderer.setStyle(wrapperElement, oppositeDirection, `${pxValue}px`);
113
+ }
114
+ positionVertically(viewPort, wrapperElement, targetDimensions, wrapperDimensions) {
115
+ const { opensUpwards, offsetFromEdge, availableMaxHeightInDirection } = calculateVerticalPopoverPosition({
116
+ viewportHeight: viewPort.innerHeight,
117
+ targetTop: targetDimensions.top,
118
+ targetBottom: targetDimensions.bottom,
119
+ contentHeight: wrapperDimensions.height,
120
+ bodyPadding: this.POPOVER_BODY_PADDING
121
+ });
122
+ const anchoredEdge = opensUpwards ? "bottom" : "top";
123
+ const oppositeEdge = opensUpwards ? "top" : "bottom";
124
+ this.renderer.removeStyle(wrapperElement, oppositeEdge);
125
+ this.renderer.setStyle(wrapperElement, anchoredEdge, `${offsetFromEdge}px`);
126
+ this.renderer.setStyle(wrapperElement, "--kirby-popover-available-max-height", `${availableMaxHeightInDirection}px`, RendererStyleFlags2.DashCase);
127
+ if (opensUpwards) {
128
+ this.renderer.setStyle(this.targetElement, "z-index", `${this.zIndex + 1}`);
129
+ this.renderer.setStyle(this.targetElement, "pointer-events", "none");
130
+ }
131
+ }
132
+ static {
133
+ this.ɵfac = i0.ɵɵngDeclareFactory({
134
+ minVersion: "12.0.0",
135
+ version: "22.2.3",
136
+ ngImport: i0,
137
+ type: PopoverComponent,
138
+ deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }],
139
+ target: i0.ɵɵFactoryTarget.Component
140
+ });
141
+ }
142
+ static {
143
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
144
+ minVersion: "14.0.0",
145
+ version: "22.2.3",
146
+ type: PopoverComponent,
147
+ isStandalone: true,
148
+ selector: "kirby-popover",
149
+ inputs: {
150
+ popout: "popout",
151
+ target: "target"
152
+ },
153
+ outputs: { willHide: "willHide" },
154
+ host: { listeners: { "window:resize": "_onWindowResize()" } },
155
+ viewQueries: [{
156
+ propertyName: "wrapperElement",
157
+ first: true,
158
+ predicate: ["wrapper"],
159
+ descendants: true,
160
+ read: ElementRef,
161
+ static: true
162
+ }],
163
+ ngImport: i0,
164
+ template: `
147
165
  <div #wrapper class="wrapper"><ng-content></ng-content></div>
148
- `, isInline: true, styles: [".kirby-line-clamp{display:-webkit-box;-webkit-line-clamp:var(--line-clamp, none);-webkit-box-orient:vertical;overflow:hidden}:host{display:none;position:fixed;inset:0;z-index:850}:host(.is-opening){display:block;visibility:hidden}:host(.is-open){display:block}.wrapper{position:fixed;margin-top:4px;margin-bottom:4px}\n"] }); }
149
- }
150
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: PopoverComponent, decorators: [{
151
- type: Component,
152
- args: [{ selector: 'kirby-popover', template: `
166
+ `,
167
+ isInline: true,
168
+ styles: [":host{display:none;position:fixed;inset:0;z-index:var(--kirby-z-index-popover)}:host(.is-opening){display:block;visibility:hidden}:host(.is-open){display:block}.wrapper{position:fixed;margin-top:var(--kirby-spacing-xxxs);margin-bottom:var(--kirby-spacing-xxxs)}\n"],
169
+ changeDetection: i0.ChangeDetectionStrategy.Eager
170
+ });
171
+ }
172
+ };
173
+ i0.ɵɵngDeclareClassMetadata({
174
+ minVersion: "12.0.0",
175
+ version: "22.2.3",
176
+ ngImport: i0,
177
+ type: PopoverComponent,
178
+ decorators: [{
179
+ type: Component,
180
+ args: [{
181
+ selector: "kirby-popover",
182
+ template: `
153
183
  <div #wrapper class="wrapper"><ng-content></ng-content></div>
154
- `, styles: [".kirby-line-clamp{display:-webkit-box;-webkit-line-clamp:var(--line-clamp, none);-webkit-box-orient:vertical;overflow:hidden}:host{display:none;position:fixed;inset:0;z-index:850}:host(.is-opening){display:block;visibility:hidden}:host(.is-open){display:block}.wrapper{position:fixed;margin-top:4px;margin-bottom:4px}\n"] }]
155
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { wrapperElement: [{
156
- type: ViewChild,
157
- args: ['wrapper', { static: true, read: ElementRef }]
158
- }], popout: [{
159
- type: Input
160
- }], target: [{
161
- type: Input
162
- }], willHide: [{
163
- type: Output
164
- }], _onWindowResize: [{
165
- type: HostListener,
166
- args: ['window:resize']
167
- }] } });
168
-
169
- /**
170
- * Generated bundle index. Do not edit.
171
- */
172
-
184
+ `,
185
+ changeDetection: ChangeDetectionStrategy.Eager,
186
+ styles: [":host{display:none;position:fixed;inset:0;z-index:var(--kirby-z-index-popover)}:host(.is-opening){display:block;visibility:hidden}:host(.is-open){display:block}.wrapper{position:fixed;margin-top:var(--kirby-spacing-xxxs);margin-bottom:var(--kirby-spacing-xxxs)}\n"]
187
+ }]
188
+ }],
189
+ ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }],
190
+ propDecorators: {
191
+ wrapperElement: [{
192
+ type: ViewChild,
193
+ args: ["wrapper", {
194
+ static: true,
195
+ read: ElementRef
196
+ }]
197
+ }],
198
+ popout: [{ type: Input }],
199
+ target: [{ type: Input }],
200
+ willHide: [{ type: Output }],
201
+ _onWindowResize: [{
202
+ type: HostListener,
203
+ args: ["window:resize"]
204
+ }]
205
+ }
206
+ });
173
207
  export { HorizontalDirection, PopoverComponent };
174
- //# sourceMappingURL=kirbydesign-designsystem-popover.mjs.map
208
+
209
+ //# sourceMappingURL=kirbydesign-designsystem-popover.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"kirbydesign-designsystem-popover.mjs","sources":["../../popover/src/popover.component.ts","../../popover/src/kirbydesign-designsystem-popover.ts"],"sourcesContent":["import {\n AfterViewInit,\n Component,\n ElementRef,\n EventEmitter,\n HostListener,\n Input,\n OnDestroy,\n Output,\n Renderer2,\n ViewChild,\n} from '@angular/core';\nimport { EventListenerDisposeFn } from '@kirbydesign/designsystem/types';\nimport { DesignTokenHelper } from '@kirbydesign/designsystem/helpers';\n\nexport enum HorizontalDirection {\n right = 'right',\n left = 'left',\n}\n\n@Component({\n selector: 'kirby-popover',\n template: `\n <div #wrapper class=\"wrapper\"><ng-content></ng-content></div>\n `,\n styleUrls: ['./popover.component.scss'],\n})\nexport class PopoverComponent implements AfterViewInit, OnDestroy {\n // removeEventListener same instance of event handler & options\n private readonly preventScrollEventListenerOptions = {\n passive: false,\n } as EventListenerOptions;\n\n private readonly POPOVER_BODY_PADDING = 12;\n\n private isShowing: boolean = false;\n private isFirstToLockScroll: boolean;\n private zIndex: number;\n private document: Document;\n private openingFrameId: ReturnType<typeof requestAnimationFrame> | null = null;\n\n @ViewChild('wrapper', { static: true, read: ElementRef })\n wrapperElement: ElementRef<HTMLDivElement>;\n\n @Input()\n popout: HorizontalDirection | `${HorizontalDirection}` = HorizontalDirection.right;\n\n @Input()\n target: HTMLElement | ElementRef<HTMLElement>;\n\n @Output()\n willHide = new EventEmitter<void>();\n\n private get targetElement(): HTMLElement {\n if (this.target instanceof ElementRef) {\n return this.target.nativeElement;\n } else {\n return this.target;\n }\n }\n\n @HostListener('window:resize')\n _onWindowResize() {\n this.hide();\n }\n\n private disposeTouchMoveListener: EventListenerDisposeFn;\n\n constructor(\n private elementRef: ElementRef<HTMLElement>,\n private renderer: Renderer2\n ) {\n this.document = elementRef.nativeElement.ownerDocument;\n }\n\n ngAfterViewInit(): void {\n this.placePopoverAboveClosestModal();\n this.renderer.removeChild(\n this.elementRef.nativeElement.parentElement,\n this.elementRef.nativeElement\n );\n }\n\n ngOnDestroy(): void {\n this.hide();\n }\n\n private placePopoverAboveClosestModal() {\n const closestIonModal = this.elementRef.nativeElement.closest('ion-modal');\n if (closestIonModal) {\n this.zIndex = parseInt((closestIonModal as HTMLElement).style.zIndex) + 1;\n this.elementRef.nativeElement.style.zIndex = `${this.zIndex}`;\n } else {\n this.zIndex = parseInt(DesignTokenHelper.zLayer('popover'));\n }\n }\n\n private static preventEventOutsidePopover(event: TouchEvent) {\n if (event.target instanceof HTMLElement) {\n const targetIsInPopover = !!event.target.closest('kirby-popover');\n if (!targetIsInPopover) {\n event.preventDefault();\n }\n }\n }\n\n private preventScroll() {\n this.isFirstToLockScroll = !this.document.body.classList.contains('backdrop-no-scroll');\n if (this.isFirstToLockScroll) {\n this.renderer.addClass(this.document.body, 'backdrop-no-scroll');\n }\n\n this.disposeTouchMoveListener = this.renderer.listen(\n this.document,\n 'touchmove',\n PopoverComponent.preventEventOutsidePopover,\n this.preventScrollEventListenerOptions\n );\n }\n\n private releaseScroll() {\n if (this.isFirstToLockScroll) {\n this.renderer.removeClass(this.document.body, 'backdrop-no-scroll');\n }\n\n this.disposeTouchMoveListener?.();\n }\n\n show() {\n this.renderer.addClass(this.elementRef.nativeElement, 'is-opening');\n this.renderer.appendChild(this.document.body, this.elementRef.nativeElement);\n\n this.preventScroll();\n this.isShowing = true;\n\n this.openingFrameId = requestAnimationFrame(() => {\n this.openingFrameId = null;\n if (!this.isShowing) return;\n this.positionWrapper();\n this.renderer.addClass(this.elementRef.nativeElement, 'is-open');\n this.renderer.removeClass(this.elementRef.nativeElement, 'is-opening');\n });\n }\n\n hide() {\n if (!this.isShowing) return;\n\n if (this.openingFrameId !== null) {\n cancelAnimationFrame(this.openingFrameId);\n this.openingFrameId = null;\n this.renderer.removeClass(this.elementRef.nativeElement, 'is-opening');\n }\n\n this.willHide.emit();\n this.renderer.removeChild(\n this.elementRef.nativeElement.parentElement,\n this.elementRef.nativeElement\n );\n this.releaseScroll();\n\n this.renderer.removeStyle(this.targetElement, 'z-index');\n this.renderer.removeStyle(this.targetElement, 'pointer-events');\n this.isShowing = false;\n }\n\n private positionWrapper() {\n const targetDimensions = this.targetElement.getBoundingClientRect();\n\n this.renderer.appendChild(this.document.body, this.elementRef.nativeElement);\n\n const wrapperElement = this.wrapperElement.nativeElement;\n const wrapperDimensions = wrapperElement.getBoundingClientRect();\n const viewport = wrapperElement.ownerDocument.defaultView;\n this.positionHorizontally(viewport, wrapperElement, targetDimensions, wrapperDimensions);\n this.positionVertically(viewport, wrapperElement, targetDimensions, wrapperDimensions);\n }\n\n private positionHorizontally(\n viewPort: Window,\n wrapperElement: HTMLDivElement,\n targetDimensions: DOMRect,\n wrapperDimensions: DOMRect\n ) {\n const viewPortWidth = viewPort.innerWidth;\n const contentWidth = wrapperDimensions.width;\n const availableSpaceRight = viewPortWidth - targetDimensions.left;\n const availableSpaceLeft = targetDimensions.right;\n const contentCanFitRightOfTarget =\n availableSpaceRight >= contentWidth + this.POPOVER_BODY_PADDING;\n const openRight = contentCanFitRightOfTarget || availableSpaceRight >= availableSpaceLeft;\n\n const [direction, oppositeDirection] =\n this.popout === HorizontalDirection.left || !openRight\n ? ['left', 'right']\n : ['right', 'left'];\n\n const pxValue =\n direction === 'left' ? viewPortWidth - targetDimensions.right : targetDimensions.left;\n\n this.renderer.removeStyle(wrapperElement, direction);\n this.renderer.setStyle(wrapperElement, oppositeDirection, `${pxValue}px`);\n }\n\n private positionVertically(\n viewPort: Window,\n wrapperElement: HTMLDivElement,\n targetDimensions: DOMRect,\n wrapperDimensions: DOMRect\n ) {\n const viewPortHeight = viewPort.innerHeight;\n const contentHeight = wrapperDimensions.height;\n const availableSpaceDown = viewPortHeight - targetDimensions.bottom;\n const availableSpaceUp = targetDimensions.top;\n const contentCanFitBelowTarget =\n availableSpaceDown >= contentHeight + this.POPOVER_BODY_PADDING;\n\n const isAvailableSpaceBelow =\n contentCanFitBelowTarget || availableSpaceDown >= availableSpaceUp;\n const [direction, oppositeDirection] = isAvailableSpaceBelow\n ? ['bottom', 'top']\n : ['top', 'bottom'];\n\n const pxValue =\n direction === 'bottom' ? targetDimensions.bottom : viewPortHeight - targetDimensions.top;\n\n this.renderer.removeStyle(wrapperElement, direction);\n this.renderer.setStyle(wrapperElement, oppositeDirection, `${pxValue}px`);\n\n if (direction === 'top') {\n // Ensure target is elevated above shadows in popover, i.e. content wrapped in Card:\n this.renderer.setStyle(this.targetElement, 'z-index', `${this.zIndex + 1}`);\n this.renderer.setStyle(this.targetElement, 'pointer-events', 'none');\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;IAeY;AAAZ,CAAA,UAAY,mBAAmB,EAAA;AAC7B,IAAA,mBA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A,QAAA,EAnB5C;;AAET,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,iUAAA,CAAA,EAAA,CAAA,CAAA;;4FAGU,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAP5B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,eAAe,EAAA,QAAA,EACf;;AAET,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,iUAAA,CAAA,EAAA;;sBAiBA,SAAS;uBAAC,SAAS,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE;;sBAGvD;;sBAGA;;sBAGA;;sBAWA,YAAY;uBAAC,eAAe;;;AC7D/B;;AAEG;;;;"}
1
+ {"version":3,"file":"kirbydesign-designsystem-popover.mjs","names":[],"sources":["../../popover/src/popover.helper.ts","../../popover/src/popover.component.ts"],"sourcesContent":["export interface VerticalPositionInput {\n viewportHeight: number;\n targetTop: number;\n targetBottom: number;\n contentHeight: number;\n bodyPadding: number;\n}\n\nexport interface VerticalPosition {\n opensUpwards: boolean;\n offsetFromEdge: number;\n availableMaxHeightInDirection: number;\n}\n\nexport function calculateVerticalPopoverPosition({\n viewportHeight,\n targetTop,\n targetBottom,\n contentHeight,\n bodyPadding,\n}: VerticalPositionInput): VerticalPosition {\n const availableSpaceBelow = viewportHeight - targetBottom;\n const availableSpaceAbove = targetTop;\n const contentFitsBelow = availableSpaceBelow >= contentHeight + bodyPadding;\n const opensUpwards = !contentFitsBelow && availableSpaceBelow < availableSpaceAbove;\n\n const availableSpace = opensUpwards ? availableSpaceAbove : availableSpaceBelow;\n const offset = opensUpwards ? viewportHeight - targetTop : targetBottom;\n\n return {\n opensUpwards,\n offsetFromEdge: offset,\n availableMaxHeightInDirection: availableSpace - bodyPadding,\n };\n}\n","import {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n EventEmitter,\n HostListener,\n Input,\n OnDestroy,\n Output,\n Renderer2,\n RendererStyleFlags2,\n ViewChild,\n} from '@angular/core';\nimport { EventListenerDisposeFn } from '@kirbydesign/designsystem/types';\nimport { DesignTokenHelper } from '@kirbydesign/designsystem/helpers';\n\nimport { calculateVerticalPopoverPosition } from './popover.helper';\n\nexport enum HorizontalDirection {\n right = 'right',\n left = 'left',\n}\n\n@Component({\n selector: 'kirby-popover',\n template: `\n <div #wrapper class=\"wrapper\"><ng-content></ng-content></div>\n `,\n styleUrls: ['./popover.component.scss'],\n changeDetection: ChangeDetectionStrategy.Eager,\n})\nexport class PopoverComponent implements AfterViewInit, OnDestroy {\n // removeEventListener same instance of event handler & options\n private readonly preventScrollEventListenerOptions = {\n passive: false,\n } as EventListenerOptions;\n\n private readonly POPOVER_BODY_PADDING = 12;\n\n private isShowing: boolean = false;\n private isFirstToLockScroll: boolean;\n private zIndex: number;\n private document: Document;\n private openingFrameId: ReturnType<typeof requestAnimationFrame> | null = null;\n\n @ViewChild('wrapper', { static: true, read: ElementRef })\n wrapperElement: ElementRef<HTMLDivElement>;\n\n @Input()\n popout: HorizontalDirection | `${HorizontalDirection}` = HorizontalDirection.right;\n\n @Input()\n target: HTMLElement | ElementRef<HTMLElement>;\n\n @Output()\n willHide = new EventEmitter<void>();\n\n private get targetElement(): HTMLElement {\n if (this.target instanceof ElementRef) {\n return this.target.nativeElement;\n } else {\n return this.target;\n }\n }\n\n @HostListener('window:resize')\n _onWindowResize() {\n this.hide();\n }\n\n private disposeTouchMoveListener: EventListenerDisposeFn;\n\n constructor(\n private elementRef: ElementRef<HTMLElement>,\n private renderer: Renderer2\n ) {\n this.document = elementRef.nativeElement.ownerDocument;\n }\n\n ngAfterViewInit(): void {\n this.placePopoverAboveClosestModal();\n this.renderer.removeChild(\n this.elementRef.nativeElement.parentElement,\n this.elementRef.nativeElement\n );\n }\n\n ngOnDestroy(): void {\n this.hide();\n }\n\n private placePopoverAboveClosestModal() {\n const closestIonModal = this.elementRef.nativeElement.closest('ion-modal');\n if (closestIonModal) {\n this.zIndex = parseInt((closestIonModal as HTMLElement).style.zIndex) + 1;\n this.elementRef.nativeElement.style.zIndex = `${this.zIndex}`;\n } else {\n this.zIndex = parseInt(DesignTokenHelper.zLayer('popover'));\n }\n }\n\n private static preventEventOutsidePopover(event: TouchEvent) {\n if (event.target instanceof HTMLElement) {\n const targetIsInPopover = !!event.target.closest('kirby-popover');\n if (!targetIsInPopover) {\n event.preventDefault();\n }\n }\n }\n\n private preventScroll() {\n this.isFirstToLockScroll = !this.document.body.classList.contains('backdrop-no-scroll');\n if (this.isFirstToLockScroll) {\n this.renderer.addClass(this.document.body, 'backdrop-no-scroll');\n }\n\n this.disposeTouchMoveListener = this.renderer.listen(\n this.document,\n 'touchmove',\n PopoverComponent.preventEventOutsidePopover,\n this.preventScrollEventListenerOptions\n );\n }\n\n private releaseScroll() {\n if (this.isFirstToLockScroll) {\n this.renderer.removeClass(this.document.body, 'backdrop-no-scroll');\n }\n\n this.disposeTouchMoveListener?.();\n }\n\n public show() {\n this.renderer.addClass(this.elementRef.nativeElement, 'is-opening');\n this.renderer.appendChild(this.document.body, this.elementRef.nativeElement);\n\n this.preventScroll();\n this.isShowing = true;\n\n this.openingFrameId = requestAnimationFrame(() => {\n this.openingFrameId = null;\n if (!this.isShowing) return;\n this.positionWrapper();\n this.renderer.addClass(this.elementRef.nativeElement, 'is-open');\n this.renderer.removeClass(this.elementRef.nativeElement, 'is-opening');\n });\n }\n\n public hide() {\n if (!this.isShowing) return;\n\n if (this.openingFrameId !== null) {\n cancelAnimationFrame(this.openingFrameId);\n this.openingFrameId = null;\n this.renderer.removeClass(this.elementRef.nativeElement, 'is-opening');\n }\n\n this.willHide.emit();\n this.renderer.removeChild(\n this.elementRef.nativeElement.parentElement,\n this.elementRef.nativeElement\n );\n this.releaseScroll();\n\n this.renderer.removeStyle(this.targetElement, 'z-index');\n this.renderer.removeStyle(this.targetElement, 'pointer-events');\n this.isShowing = false;\n }\n\n private positionWrapper() {\n const targetDimensions = this.targetElement.getBoundingClientRect();\n\n this.renderer.appendChild(this.document.body, this.elementRef.nativeElement);\n\n const wrapperElement = this.wrapperElement.nativeElement;\n const wrapperDimensions = wrapperElement.getBoundingClientRect();\n const viewport = wrapperElement.ownerDocument.defaultView;\n this.positionHorizontally(viewport, wrapperElement, targetDimensions, wrapperDimensions);\n this.positionVertically(viewport, wrapperElement, targetDimensions, wrapperDimensions);\n }\n\n private positionHorizontally(\n viewPort: Window,\n wrapperElement: HTMLDivElement,\n targetDimensions: DOMRect,\n wrapperDimensions: DOMRect\n ) {\n const viewPortWidth = viewPort.innerWidth;\n const contentWidth = wrapperDimensions.width;\n const availableSpaceRight = viewPortWidth - targetDimensions.left;\n const availableSpaceLeft = targetDimensions.right;\n const contentCanFitRightOfTarget =\n availableSpaceRight >= contentWidth + this.POPOVER_BODY_PADDING;\n const openRight = contentCanFitRightOfTarget || availableSpaceRight >= availableSpaceLeft;\n\n const [direction, oppositeDirection] =\n this.popout === HorizontalDirection.left || !openRight\n ? ['left', 'right']\n : ['right', 'left'];\n\n const pxValue =\n direction === 'left' ? viewPortWidth - targetDimensions.right : targetDimensions.left;\n\n this.renderer.removeStyle(wrapperElement, direction);\n this.renderer.setStyle(wrapperElement, oppositeDirection, `${pxValue}px`);\n }\n\n private positionVertically(\n viewPort: Window,\n wrapperElement: HTMLDivElement,\n targetDimensions: DOMRect,\n wrapperDimensions: DOMRect\n ) {\n const { opensUpwards, offsetFromEdge, availableMaxHeightInDirection } =\n calculateVerticalPopoverPosition({\n viewportHeight: viewPort.innerHeight,\n targetTop: targetDimensions.top,\n targetBottom: targetDimensions.bottom,\n contentHeight: wrapperDimensions.height,\n bodyPadding: this.POPOVER_BODY_PADDING,\n });\n\n const anchoredEdge = opensUpwards ? 'bottom' : 'top';\n const oppositeEdge = opensUpwards ? 'top' : 'bottom';\n\n this.renderer.removeStyle(wrapperElement, oppositeEdge);\n this.renderer.setStyle(wrapperElement, anchoredEdge, `${offsetFromEdge}px`);\n\n // Constrain content to the space available in the chosen direction so it can't grow outside the viewport.\n this.renderer.setStyle(\n wrapperElement,\n '--kirby-popover-available-max-height',\n `${availableMaxHeightInDirection}px`,\n RendererStyleFlags2.DashCase\n );\n\n if (opensUpwards) {\n // Ensure target is elevated above shadows in popover, i.e. content wrapped in Card:\n this.renderer.setStyle(this.targetElement, 'z-index', `${this.zIndex + 1}`);\n this.renderer.setStyle(this.targetElement, 'pointer-events', 'none');\n }\n }\n}\n"],"mappings":";;;AAcA,SAAgB,iCAAiC,EAC/C,gBACA,WACA,cACA,eACA,eACsB;CACtB,MAAM,sBAAsB,iBAAiB;CAC7C,MAAM,sBAAsB;CAE5B,MAAM,eAAe,EADI,uBAAuB,gBAAgB,gBACtB,sBAAsB;CAEhE,MAAM,iBAAiB,eAAe,sBAAsB;CAG5D,OAAO;EACL;EACA,gBAJa,eAAe,iBAAiB,YAAY;EAKzD,+BAA+B,iBAAiB;CACjD;AACH;ACfA,IAAY;CAAZ,SAAY,qBAAmB;CAC7B,oBAAA,WAAA;CACA,oBAAA,UAAA;AACF,EAAA,CAHY,wBAAA,sBAAmB,CAAA,EAAA;AAa/B,IAAa,mBAAb,MAAa,iBAAgB;CA0B3B,IAAY,gBAAa;EACvB,IAAI,KAAK,kBAAkB,YACzB,OAAO,KAAK,OAAO;OAEnB,OAAO,KAAK;CAEhB;CAGA,kBAAe;EACb,KAAK,KAAI;CACX;CAIA,YACU,YACA,UAAmB;EADnB,KAAA,aAAA;EACA,KAAA,WAAA;EAzCO,KAAA,oCAAoC,EACnD,SAAS,MACc;EAER,KAAA,uBAAuB;EAEhC,KAAA,YAAqB;EAIrB,KAAA,iBAAkE;EAM1E,KAAA,SAAyD,oBAAoB;EAM7E,KAAA,WAAW,IAAI,aAAY;EAqBzB,KAAK,WAAW,WAAW,cAAc;CAC3C;CAEA,kBAAe;EACb,KAAK,8BAA6B;EAClC,KAAK,SAAS,YACZ,KAAK,WAAW,cAAc,eAC9B,KAAK,WAAW,aAAa;CAEjC;CAEA,cAAW;EAC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