@ngbase/adk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (355) hide show
  1. package/README.md +57 -0
  2. package/a11y/accessibility-group.d.ts +49 -0
  3. package/a11y/accessibility-item.d.ts +49 -0
  4. package/a11y/accessibility.service.d.ts +17 -0
  5. package/a11y/autofocus.d.ts +12 -0
  6. package/a11y/focus-trap.d.ts +15 -0
  7. package/a11y/index.d.ts +5 -0
  8. package/a11y/public-api.d.ts +4 -0
  9. package/accordion/accordion-content.d.ts +8 -0
  10. package/accordion/accordion-group.d.ts +10 -0
  11. package/accordion/accordion-header.d.ts +7 -0
  12. package/accordion/accordion-item.d.ts +10 -0
  13. package/accordion/index.d.ts +5 -0
  14. package/accordion/public-api.d.ts +4 -0
  15. package/autocomplete/autocomplete-input.d.ts +21 -0
  16. package/autocomplete/autocomplete.d.ts +25 -0
  17. package/autocomplete/index.d.ts +5 -0
  18. package/autocomplete/public-api.d.ts +2 -0
  19. package/avatar/avatar.d.ts +22 -0
  20. package/avatar/index.d.ts +5 -0
  21. package/avatar/public-api.d.ts +1 -0
  22. package/bidi/direction.service.d.ts +14 -0
  23. package/bidi/index.d.ts +5 -0
  24. package/bidi/public-api.d.ts +1 -0
  25. package/breadcrumb/breadcrumb-link.d.ts +7 -0
  26. package/breadcrumb/breadcrumb-separator.d.ts +10 -0
  27. package/breadcrumb/breadcrumb.d.ts +12 -0
  28. package/breadcrumb/breadcrumbs.d.ts +7 -0
  29. package/breadcrumb/index.d.ts +5 -0
  30. package/breadcrumb/public-api.d.ts +4 -0
  31. package/cache/cache-config.d.ts +22 -0
  32. package/cache/cache.d.ts +17 -0
  33. package/cache/cache.interecptor.d.ts +2 -0
  34. package/cache/index.d.ts +5 -0
  35. package/cache/public-api.d.ts +3 -0
  36. package/carousel/carousel-item.d.ts +7 -0
  37. package/carousel/carousel-next.d.ts +8 -0
  38. package/carousel/carousel.d.ts +61 -0
  39. package/carousel/index.d.ts +5 -0
  40. package/carousel/public-api.d.ts +3 -0
  41. package/checkbox/checkbox.d.ts +22 -0
  42. package/checkbox/index.d.ts +5 -0
  43. package/checkbox/public-api.d.ts +1 -0
  44. package/chip/chip-group.d.ts +7 -0
  45. package/chip/chip.d.ts +19 -0
  46. package/chip/index.d.ts +5 -0
  47. package/chip/public-api.d.ts +2 -0
  48. package/clipboard/clipboard.d.ts +7 -0
  49. package/clipboard/index.d.ts +5 -0
  50. package/clipboard/public-api.d.ts +1 -0
  51. package/collections/SelectionModel.d.ts +14 -0
  52. package/collections/index.d.ts +5 -0
  53. package/collections/public-api.d.ts +1 -0
  54. package/color-picker/color-input.d.ts +16 -0
  55. package/color-picker/color-picker-trigger.d.ts +30 -0
  56. package/color-picker/color-picker.d.ts +72 -0
  57. package/color-picker/index.d.ts +5 -0
  58. package/color-picker/public-api.d.ts +3 -0
  59. package/color-picker/utils.d.ts +21 -0
  60. package/cookies/cookie.service.d.ts +32 -0
  61. package/cookies/index.d.ts +5 -0
  62. package/cookies/public-api.d.ts +1 -0
  63. package/datepicker/calendar.d.ts +121 -0
  64. package/datepicker/datepicker-trigger.d.ts +49 -0
  65. package/datepicker/datepicker.d.ts +54 -0
  66. package/datepicker/index.d.ts +5 -0
  67. package/datepicker/native-date-adapter.d.ts +33 -0
  68. package/datepicker/public-api.d.ts +5 -0
  69. package/datepicker/time.d.ts +42 -0
  70. package/dialog/dialog.animation.d.ts +3 -0
  71. package/dialog/dialog.d.ts +49 -0
  72. package/dialog/dialog.service.d.ts +7 -0
  73. package/dialog/index.d.ts +5 -0
  74. package/dialog/public-api.d.ts +3 -0
  75. package/drag/drag-drop.d.ts +37 -0
  76. package/drag/drag-move.d.ts +17 -0
  77. package/drag/drag.d.ts +53 -0
  78. package/drag/index.d.ts +5 -0
  79. package/drag/public-api.d.ts +3 -0
  80. package/fesm2022/ngbase-adk-a11y.mjs +617 -0
  81. package/fesm2022/ngbase-adk-a11y.mjs.map +1 -0
  82. package/fesm2022/ngbase-adk-accordion.mjs +117 -0
  83. package/fesm2022/ngbase-adk-accordion.mjs.map +1 -0
  84. package/fesm2022/ngbase-adk-autocomplete.mjs +150 -0
  85. package/fesm2022/ngbase-adk-autocomplete.mjs.map +1 -0
  86. package/fesm2022/ngbase-adk-avatar.mjs +69 -0
  87. package/fesm2022/ngbase-adk-avatar.mjs.map +1 -0
  88. package/fesm2022/ngbase-adk-bidi.mjs +42 -0
  89. package/fesm2022/ngbase-adk-bidi.mjs.map +1 -0
  90. package/fesm2022/ngbase-adk-breadcrumb.mjs +103 -0
  91. package/fesm2022/ngbase-adk-breadcrumb.mjs.map +1 -0
  92. package/fesm2022/ngbase-adk-cache.mjs +127 -0
  93. package/fesm2022/ngbase-adk-cache.mjs.map +1 -0
  94. package/fesm2022/ngbase-adk-carousel.mjs +337 -0
  95. package/fesm2022/ngbase-adk-carousel.mjs.map +1 -0
  96. package/fesm2022/ngbase-adk-checkbox.mjs +78 -0
  97. package/fesm2022/ngbase-adk-checkbox.mjs.map +1 -0
  98. package/fesm2022/ngbase-adk-chip.mjs +60 -0
  99. package/fesm2022/ngbase-adk-chip.mjs.map +1 -0
  100. package/fesm2022/ngbase-adk-clipboard.mjs +41 -0
  101. package/fesm2022/ngbase-adk-clipboard.mjs.map +1 -0
  102. package/fesm2022/ngbase-adk-collections.mjs +39 -0
  103. package/fesm2022/ngbase-adk-collections.mjs.map +1 -0
  104. package/fesm2022/ngbase-adk-color-picker.mjs +580 -0
  105. package/fesm2022/ngbase-adk-color-picker.mjs.map +1 -0
  106. package/fesm2022/ngbase-adk-cookies.mjs +81 -0
  107. package/fesm2022/ngbase-adk-cookies.mjs.map +1 -0
  108. package/fesm2022/ngbase-adk-datepicker.mjs +1130 -0
  109. package/fesm2022/ngbase-adk-datepicker.mjs.map +1 -0
  110. package/fesm2022/ngbase-adk-dialog.mjs +223 -0
  111. package/fesm2022/ngbase-adk-dialog.mjs.map +1 -0
  112. package/fesm2022/ngbase-adk-drag.mjs +406 -0
  113. package/fesm2022/ngbase-adk-drag.mjs.map +1 -0
  114. package/fesm2022/ngbase-adk-form-field.mjs +364 -0
  115. package/fesm2022/ngbase-adk-form-field.mjs.map +1 -0
  116. package/fesm2022/ngbase-adk-hover-card.mjs +79 -0
  117. package/fesm2022/ngbase-adk-hover-card.mjs.map +1 -0
  118. package/fesm2022/ngbase-adk-icon.mjs +90 -0
  119. package/fesm2022/ngbase-adk-icon.mjs.map +1 -0
  120. package/fesm2022/ngbase-adk-inline-edit.mjs +127 -0
  121. package/fesm2022/ngbase-adk-inline-edit.mjs.map +1 -0
  122. package/fesm2022/ngbase-adk-jwt.mjs +90 -0
  123. package/fesm2022/ngbase-adk-jwt.mjs.map +1 -0
  124. package/fesm2022/ngbase-adk-keys.mjs +219 -0
  125. package/fesm2022/ngbase-adk-keys.mjs.map +1 -0
  126. package/fesm2022/ngbase-adk-layout.mjs +100 -0
  127. package/fesm2022/ngbase-adk-layout.mjs.map +1 -0
  128. package/fesm2022/ngbase-adk-list.mjs +110 -0
  129. package/fesm2022/ngbase-adk-list.mjs.map +1 -0
  130. package/fesm2022/ngbase-adk-mask.mjs +234 -0
  131. package/fesm2022/ngbase-adk-mask.mjs.map +1 -0
  132. package/fesm2022/ngbase-adk-menu.mjs +546 -0
  133. package/fesm2022/ngbase-adk-menu.mjs.map +1 -0
  134. package/fesm2022/ngbase-adk-network.mjs +90 -0
  135. package/fesm2022/ngbase-adk-network.mjs.map +1 -0
  136. package/fesm2022/ngbase-adk-pagination.mjs +187 -0
  137. package/fesm2022/ngbase-adk-pagination.mjs.map +1 -0
  138. package/fesm2022/ngbase-adk-popover.mjs +953 -0
  139. package/fesm2022/ngbase-adk-popover.mjs.map +1 -0
  140. package/fesm2022/ngbase-adk-portal.mjs +279 -0
  141. package/fesm2022/ngbase-adk-portal.mjs.map +1 -0
  142. package/fesm2022/ngbase-adk-progress.mjs +57 -0
  143. package/fesm2022/ngbase-adk-progress.mjs.map +1 -0
  144. package/fesm2022/ngbase-adk-radio.mjs +129 -0
  145. package/fesm2022/ngbase-adk-radio.mjs.map +1 -0
  146. package/fesm2022/ngbase-adk-resizable.mjs +367 -0
  147. package/fesm2022/ngbase-adk-resizable.mjs.map +1 -0
  148. package/fesm2022/ngbase-adk-scroll-area.mjs +232 -0
  149. package/fesm2022/ngbase-adk-scroll-area.mjs.map +1 -0
  150. package/fesm2022/ngbase-adk-select.mjs +599 -0
  151. package/fesm2022/ngbase-adk-select.mjs.map +1 -0
  152. package/fesm2022/ngbase-adk-selectable.mjs +79 -0
  153. package/fesm2022/ngbase-adk-selectable.mjs.map +1 -0
  154. package/fesm2022/ngbase-adk-sidenav.mjs +209 -0
  155. package/fesm2022/ngbase-adk-sidenav.mjs.map +1 -0
  156. package/fesm2022/ngbase-adk-slider.mjs +337 -0
  157. package/fesm2022/ngbase-adk-slider.mjs.map +1 -0
  158. package/fesm2022/ngbase-adk-sonner.mjs +176 -0
  159. package/fesm2022/ngbase-adk-sonner.mjs.map +1 -0
  160. package/fesm2022/ngbase-adk-stepper.mjs +211 -0
  161. package/fesm2022/ngbase-adk-stepper.mjs.map +1 -0
  162. package/fesm2022/ngbase-adk-switch.mjs +115 -0
  163. package/fesm2022/ngbase-adk-switch.mjs.map +1 -0
  164. package/fesm2022/ngbase-adk-table.mjs +348 -0
  165. package/fesm2022/ngbase-adk-table.mjs.map +1 -0
  166. package/fesm2022/ngbase-adk-tabs.mjs +386 -0
  167. package/fesm2022/ngbase-adk-tabs.mjs.map +1 -0
  168. package/fesm2022/ngbase-adk-test.mjs +267 -0
  169. package/fesm2022/ngbase-adk-test.mjs.map +1 -0
  170. package/fesm2022/ngbase-adk-toggle-group.mjs +114 -0
  171. package/fesm2022/ngbase-adk-toggle-group.mjs.map +1 -0
  172. package/fesm2022/ngbase-adk-toggle.mjs +48 -0
  173. package/fesm2022/ngbase-adk-toggle.mjs.map +1 -0
  174. package/fesm2022/ngbase-adk-tooltip.mjs +237 -0
  175. package/fesm2022/ngbase-adk-tooltip.mjs.map +1 -0
  176. package/fesm2022/ngbase-adk-tour.mjs +312 -0
  177. package/fesm2022/ngbase-adk-tour.mjs.map +1 -0
  178. package/fesm2022/ngbase-adk-translate.mjs +162 -0
  179. package/fesm2022/ngbase-adk-translate.mjs.map +1 -0
  180. package/fesm2022/ngbase-adk-tree.mjs +301 -0
  181. package/fesm2022/ngbase-adk-tree.mjs.map +1 -0
  182. package/fesm2022/ngbase-adk-utils.mjs +228 -0
  183. package/fesm2022/ngbase-adk-utils.mjs.map +1 -0
  184. package/fesm2022/ngbase-adk-virtualizer.mjs +198 -0
  185. package/fesm2022/ngbase-adk-virtualizer.mjs.map +1 -0
  186. package/fesm2022/ngbase-adk.mjs +6 -0
  187. package/fesm2022/ngbase-adk.mjs.map +1 -0
  188. package/form-field/auto-height.d.ts +9 -0
  189. package/form-field/error.d.ts +18 -0
  190. package/form-field/form-field.d.ts +14 -0
  191. package/form-field/index.d.ts +5 -0
  192. package/form-field/input.d.ts +16 -0
  193. package/form-field/label.d.ts +7 -0
  194. package/form-field/otp.d.ts +48 -0
  195. package/form-field/public-api.d.ts +6 -0
  196. package/hover-card/hover-card.d.ts +18 -0
  197. package/hover-card/index.d.ts +5 -0
  198. package/hover-card/public-api.d.ts +1 -0
  199. package/icon/icon.d.ts +12 -0
  200. package/icon/icon.service.d.ts +12 -0
  201. package/icon/index.d.ts +5 -0
  202. package/icon/public-api.d.ts +2 -0
  203. package/index.d.ts +5 -0
  204. package/inline-edit/index.d.ts +5 -0
  205. package/inline-edit/inline-edit.d.ts +47 -0
  206. package/inline-edit/public-api.d.ts +1 -0
  207. package/jwt/index.d.ts +5 -0
  208. package/jwt/jwt.service.d.ts +27 -0
  209. package/jwt/public-api.d.ts +1 -0
  210. package/keys/index.d.ts +5 -0
  211. package/keys/keys.service.d.ts +13 -0
  212. package/keys/public-api.d.ts +2 -0
  213. package/keys/shortcuts.service.d.ts +38 -0
  214. package/layout/index.d.ts +5 -0
  215. package/layout/layout.d.ts +16 -0
  216. package/layout/public-api.d.ts +1 -0
  217. package/list/index.d.ts +5 -0
  218. package/list/list.d.ts +20 -0
  219. package/list/list.directive.d.ts +12 -0
  220. package/list/public-api.d.ts +2 -0
  221. package/mask/index.d.ts +5 -0
  222. package/mask/mask-pipe.d.ts +7 -0
  223. package/mask/mask.d.ts +25 -0
  224. package/mask/public-api.d.ts +2 -0
  225. package/menu/context-menu.d.ts +21 -0
  226. package/menu/index.d.ts +5 -0
  227. package/menu/mention.d.ts +18 -0
  228. package/menu/menu-trigger.d.ts +34 -0
  229. package/menu/menu.d.ts +52 -0
  230. package/menu/navigation-menu.d.ts +19 -0
  231. package/menu/public-api.d.ts +5 -0
  232. package/network/index.d.ts +5 -0
  233. package/network/network.interceptor.d.ts +6 -0
  234. package/network/network.service.d.ts +18 -0
  235. package/network/public-api.d.ts +2 -0
  236. package/package.json +247 -0
  237. package/pagination/index.d.ts +5 -0
  238. package/pagination/pagination.d.ts +28 -0
  239. package/pagination/public-api.d.ts +1 -0
  240. package/popover/base-popover.service.d.ts +16 -0
  241. package/popover/index.d.ts +5 -0
  242. package/popover/popover-trigger.d.ts +21 -0
  243. package/popover/popover.d.ts +50 -0
  244. package/popover/popover.service.d.ts +42 -0
  245. package/popover/public-api.d.ts +5 -0
  246. package/popover/utils.d.ts +85 -0
  247. package/portal/dialog-ref.d.ts +71 -0
  248. package/portal/index.d.ts +5 -0
  249. package/portal/portal-base.service.d.ts +19 -0
  250. package/portal/portal-close.directive.d.ts +8 -0
  251. package/portal/portal.component.d.ts +7 -0
  252. package/portal/portal.service.d.ts +16 -0
  253. package/portal/public-api.d.ts +5 -0
  254. package/progress/index.d.ts +5 -0
  255. package/progress/progress.d.ts +13 -0
  256. package/progress/public-api.d.ts +1 -0
  257. package/public-api.d.ts +2 -0
  258. package/radio/index.d.ts +5 -0
  259. package/radio/public-api.d.ts +2 -0
  260. package/radio/radio-group.d.ts +19 -0
  261. package/radio/radio.d.ts +22 -0
  262. package/resizable/index.d.ts +5 -0
  263. package/resizable/public-api.d.ts +2 -0
  264. package/resizable/resizable-group.d.ts +22 -0
  265. package/resizable/resizable.d.ts +50 -0
  266. package/scroll-area/index.d.ts +5 -0
  267. package/scroll-area/public-api.d.ts +1 -0
  268. package/scroll-area/scroll-area.d.ts +56 -0
  269. package/select/index.d.ts +5 -0
  270. package/select/list-selection.d.ts +7 -0
  271. package/select/option-group.d.ts +7 -0
  272. package/select/option.d.ts +25 -0
  273. package/select/public-api.d.ts +6 -0
  274. package/select/select-base.d.ts +64 -0
  275. package/select/select-input.d.ts +23 -0
  276. package/select/select.d.ts +50 -0
  277. package/selectable/index.d.ts +5 -0
  278. package/selectable/public-api.d.ts +2 -0
  279. package/selectable/selectable-item.d.ts +12 -0
  280. package/selectable/selectable.d.ts +19 -0
  281. package/sidenav/index.d.ts +5 -0
  282. package/sidenav/public-api.d.ts +3 -0
  283. package/sidenav/sidenav-header.d.ts +31 -0
  284. package/sidenav/sidenav.d.ts +23 -0
  285. package/sidenav/sidenav.service.d.ts +18 -0
  286. package/slider/index.d.ts +5 -0
  287. package/slider/public-api.d.ts +1 -0
  288. package/slider/slider.d.ts +73 -0
  289. package/sonner/index.d.ts +5 -0
  290. package/sonner/public-api.d.ts +2 -0
  291. package/sonner/sonner.d.ts +24 -0
  292. package/sonner/sonner.service.d.ts +21 -0
  293. package/stepper/animation.d.ts +1 -0
  294. package/stepper/index.d.ts +5 -0
  295. package/stepper/public-api.d.ts +3 -0
  296. package/stepper/step.d.ts +24 -0
  297. package/stepper/stepper.d.ts +26 -0
  298. package/switch/index.d.ts +5 -0
  299. package/switch/public-api.d.ts +1 -0
  300. package/switch/switch.d.ts +44 -0
  301. package/table/body-cell.d.ts +11 -0
  302. package/table/body-row.d.ts +21 -0
  303. package/table/column.d.ts +10 -0
  304. package/table/head-cell.d.ts +12 -0
  305. package/table/head-row.d.ts +21 -0
  306. package/table/index.d.ts +5 -0
  307. package/table/public-api.d.ts +8 -0
  308. package/table/table.d.ts +32 -0
  309. package/tabs/index.d.ts +5 -0
  310. package/tabs/public-api.d.ts +2 -0
  311. package/tabs/tab-group.d.ts +52 -0
  312. package/tabs/tab.d.ts +31 -0
  313. package/test/index.d.ts +5 -0
  314. package/test/public-api.d.ts +1 -0
  315. package/test/utils.d.ts +62 -0
  316. package/toggle/index.d.ts +5 -0
  317. package/toggle/public-api.d.ts +1 -0
  318. package/toggle/toggle.d.ts +13 -0
  319. package/toggle-group/index.d.ts +5 -0
  320. package/toggle-group/public-api.d.ts +2 -0
  321. package/toggle-group/toggle-group.d.ts +25 -0
  322. package/toggle-group/toggle-item.d.ts +14 -0
  323. package/tooltip/index.d.ts +5 -0
  324. package/tooltip/public-api.d.ts +2 -0
  325. package/tooltip/tooltip.d.ts +20 -0
  326. package/tooltip/tooltip.directive.d.ts +34 -0
  327. package/tooltip/tooltip.service.d.ts +26 -0
  328. package/tour/animation.d.ts +2 -0
  329. package/tour/index.d.ts +5 -0
  330. package/tour/public-api.d.ts +5 -0
  331. package/tour/tour-base.d.ts +21 -0
  332. package/tour/tour-step.d.ts +11 -0
  333. package/tour/tour.d.ts +9 -0
  334. package/tour/tour.service.d.ts +30 -0
  335. package/translate/config.d.ts +16 -0
  336. package/translate/index.d.ts +5 -0
  337. package/translate/public-api.d.ts +3 -0
  338. package/translate/translate.d.ts +11 -0
  339. package/translate/translate.service.d.ts +31 -0
  340. package/tree/index.d.ts +5 -0
  341. package/tree/public-api.d.ts +3 -0
  342. package/tree/tree-node.d.ts +28 -0
  343. package/tree/tree-toggle.d.ts +16 -0
  344. package/tree/tree.d.ts +55 -0
  345. package/utils/animation.d.ts +3 -0
  346. package/utils/disposals.d.ts +7 -0
  347. package/utils/index.d.ts +5 -0
  348. package/utils/number-only.d.ts +22 -0
  349. package/utils/public-api.d.ts +6 -0
  350. package/utils/range.pipe.d.ts +7 -0
  351. package/utils/ssr.d.ts +2 -0
  352. package/utils/utils.d.ts +27 -0
  353. package/virtualizer/index.d.ts +5 -0
  354. package/virtualizer/public-api.d.ts +1 -0
  355. package/virtualizer/virtualizer.d.ts +42 -0
@@ -0,0 +1,617 @@
1
+ import { DOCUMENT } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { signal, Injectable, inject, ElementRef, model, input, booleanAttribute, linkedSignal, computed, output, effect, untracked, Directive, ApplicationRef, afterRender } from '@angular/core';
4
+ import { Directionality } from '@ngbase/adk/bidi';
5
+ import { documentListener, isClient } from '@ngbase/adk/utils';
6
+ import { Subject } from 'rxjs';
7
+
8
+ class AccessibilityService {
9
+ constructor() {
10
+ this.groups = signal(new Map());
11
+ this.activeGroupOrder = [];
12
+ this.usingMouse = false;
13
+ documentListener('keydown', () => (this.usingMouse = false), { capture: true });
14
+ documentListener('mousedown', () => (this.usingMouse = true), { capture: true });
15
+ documentListener('mousemove', () => (this.usingMouse = true), { capture: true });
16
+ }
17
+ setActiveGroup(id) {
18
+ // remove id from activeGroupOrder
19
+ const index = this.activeGroupOrder.indexOf(id);
20
+ if (index !== -1) {
21
+ this.activeGroupOrder.splice(index, 1);
22
+ }
23
+ this.activeGroupOrder.push(id);
24
+ // console.log('setActiveGroup', this.activeGroupOrder);
25
+ }
26
+ removeActiveGroup(id) {
27
+ this.activeGroupOrder = this.activeGroupOrder.filter(g => g !== id);
28
+ // console.log('removeActiveGroup', this.activeGroupOrder);
29
+ }
30
+ isActive(key) {
31
+ return this.activeGroupOrder[this.activeGroupOrder.length - 1] === key;
32
+ }
33
+ getPreviousGroup() {
34
+ const id = this.activeGroupOrder[this.activeGroupOrder.length - 2];
35
+ return this.groups().get(id);
36
+ }
37
+ getGroup(key) {
38
+ return this.groups().get(key);
39
+ }
40
+ addGroup(key, group) {
41
+ this.groups.update(x => new Map([...x, [key, group]]));
42
+ this.setActiveGroup(key);
43
+ }
44
+ removeGroup(key) {
45
+ this.groups.update(x => {
46
+ x.delete(key);
47
+ return new Map(x);
48
+ });
49
+ this.removeActiveGroup(key);
50
+ }
51
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: AccessibilityService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
52
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: AccessibilityService, providedIn: 'root' }); }
53
+ }
54
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: AccessibilityService, decorators: [{
55
+ type: Injectable,
56
+ args: [{ providedIn: 'root' }]
57
+ }], ctorParameters: () => [] });
58
+
59
+ class AccessibleGroup {
60
+ constructor() {
61
+ this.allyService = inject(AccessibilityService);
62
+ this.el = inject(ElementRef);
63
+ this.document = inject(DOCUMENT);
64
+ this.dir = inject(Directionality);
65
+ this.ayId = model('');
66
+ this.columns = input();
67
+ this.ariaLabel = input('');
68
+ this.ariaLabelledby = input('');
69
+ this.isPopup = input(false);
70
+ this.loop = input(true);
71
+ this.disabled = input(false, { transform: booleanAttribute });
72
+ this.clickable = model(false);
73
+ this.initialFocus = input(true);
74
+ // Hacky way to make sure the signals are updated
75
+ this._ayId = linkedSignal(this.ayId);
76
+ this._disabled = linkedSignal(this.disabled);
77
+ this._ariaLabel = linkedSignal(this.ariaLabel);
78
+ this._ariaLabelledby = linkedSignal(this.ariaLabelledby);
79
+ this._isPopup = linkedSignal(this.isPopup);
80
+ this._loop = linkedSignal(this.loop);
81
+ this._columns = linkedSignal(this.columns);
82
+ this._initialFocus = linkedSignal(this.initialFocus);
83
+ this.isOn = signal(false);
84
+ this.elements = signal([]);
85
+ this.items = computed(() => {
86
+ const _ = this._ayId() || '';
87
+ const items = this.elements();
88
+ // console.count(`items changed ${this.ayId()}`);
89
+ // Sort items based on their position in the DOM
90
+ items.sort((a, b) => {
91
+ return a.host.nativeElement.compareDocumentPosition(b.host.nativeElement) ===
92
+ Node.DOCUMENT_POSITION_FOLLOWING
93
+ ? -1
94
+ : 1;
95
+ });
96
+ return items;
97
+ });
98
+ this.focusChanged = output();
99
+ this.handleFocusIn = (_) => {
100
+ if (!this.isOn()) {
101
+ // console.log(`focus in ${this._ayId()}`);
102
+ this.on();
103
+ }
104
+ };
105
+ this.handleFocusOut = (event) => {
106
+ if (!this.el.nativeElement.contains(event.relatedTarget)) {
107
+ // console.log(`focus out ${this._ayId()}`);
108
+ this.off();
109
+ }
110
+ };
111
+ this.on = () => {
112
+ this.allyService.setActiveGroup(this._ayId());
113
+ if (this._isPopup()) {
114
+ this.document.querySelectorAll('body > *').forEach(el => {
115
+ if (el.tagName !== 'MEE-PORTAL') {
116
+ el.setAttribute('tabindex', '-1');
117
+ el.setAttribute('aria-hidden', 'true');
118
+ }
119
+ });
120
+ }
121
+ this.document.addEventListener('keydown', this.onKeyDown);
122
+ this.isOn.set(true);
123
+ this.el.nativeElement.tabIndex = -1;
124
+ };
125
+ this.off = () => {
126
+ if (this._isPopup()) {
127
+ this.document.querySelectorAll('body > *').forEach(el => {
128
+ el.removeAttribute('tabindex');
129
+ el.removeAttribute('aria-hidden');
130
+ });
131
+ }
132
+ this.document.removeEventListener('keydown', this.onKeyDown);
133
+ this.isOn.set(false);
134
+ this.el.nativeElement.tabIndex = 0;
135
+ };
136
+ this.onKeyDown = (event) => {
137
+ const items = this.items();
138
+ // this.log('key down', this.ayId(), event.key, items.length);
139
+ if (!items.length || !this.allyService.isActive(this._ayId()))
140
+ return;
141
+ // console.log(`key down ${this.ayId()}`);
142
+ let item = this.focusedItem?.deref();
143
+ // If there is no focused item, then wait for the first key press to focus the item
144
+ if (!item)
145
+ return;
146
+ const currentIndex = item ? items.indexOf(item) : -1;
147
+ let nextIndex = null;
148
+ // Calculate the number of columns in the grid
149
+ // const gridRect = this.el.nativeElement.getBoundingClientRect();
150
+ // const itemWidth = items[0].host.nativeElement.offsetWidth;
151
+ const columns = this._columns() || 1;
152
+ let direction = 'next';
153
+ const isInput = event.target.tagName === 'INPUT';
154
+ // if the direction is rtl, then we need to reverse the direction of the arrow keys
155
+ let key = event.key;
156
+ if (this.dir.isRtl()) {
157
+ if (key === 'ArrowRight')
158
+ key = 'ArrowLeft';
159
+ else if (key === 'ArrowLeft')
160
+ key = 'ArrowRight';
161
+ }
162
+ switch (key) {
163
+ case 'ArrowRight': {
164
+ if (isInput)
165
+ return;
166
+ const expand = item._expandable() && !item._expanded();
167
+ if (item.hasPopup() || expand) {
168
+ if (item.events.observed) {
169
+ item.events.next({ event, type: 'keyRight', item });
170
+ }
171
+ else {
172
+ item.click();
173
+ }
174
+ return;
175
+ }
176
+ nextIndex = (currentIndex + 1) % items.length;
177
+ direction = 'next';
178
+ break;
179
+ }
180
+ case 'ArrowLeft':
181
+ if (isInput)
182
+ return;
183
+ const prevGroup = this.allyService.getPreviousGroup();
184
+ let prevItem = prevGroup?.focusedItem?.deref();
185
+ const isSameGroup = prevGroup?._ayId() === this._ayId();
186
+ const collapse = item._expandable() && item._expanded();
187
+ if ((!isSameGroup && prevItem) || collapse) {
188
+ if (prevItem?.events.observed) {
189
+ prevItem?.events.next({ event, type: 'keyLeft', item });
190
+ }
191
+ else {
192
+ // this click is common between the tree and the menu
193
+ // we need to check if the item is a tree node and if it has children
194
+ item.click();
195
+ }
196
+ return;
197
+ }
198
+ else if (item._expandable()) {
199
+ nextIndex = this.findNextOrPreviousLevelItem(currentIndex, 'previous', items);
200
+ }
201
+ else {
202
+ nextIndex = (currentIndex - 1 + items.length) % items.length;
203
+ }
204
+ direction = 'previous';
205
+ break;
206
+ case 'ArrowDown':
207
+ nextIndex = currentIndex + columns;
208
+ if (nextIndex >= items.length) {
209
+ if (this._loop()) {
210
+ nextIndex = nextIndex % columns; // Wrap to top
211
+ }
212
+ else {
213
+ nextIndex = items.length - 1;
214
+ }
215
+ }
216
+ direction = 'down';
217
+ break;
218
+ case 'ArrowUp':
219
+ nextIndex = currentIndex - columns;
220
+ if (nextIndex < 0) {
221
+ if (this._loop()) {
222
+ nextIndex = items.length - (columns - (currentIndex % columns)); // Wrap to bottom
223
+ }
224
+ else {
225
+ nextIndex = 0;
226
+ }
227
+ }
228
+ direction = 'up';
229
+ break;
230
+ case 'Home':
231
+ nextIndex = this.findNextEnabledItem(Math.floor(currentIndex / columns) * columns, 'next', items);
232
+ direction = 'first';
233
+ break;
234
+ case 'End':
235
+ nextIndex = this.findNextEnabledItem(Math.min(Math.floor(currentIndex / columns) * columns + columns - 1, items.length - 1), 'previous', items);
236
+ direction = 'last';
237
+ break;
238
+ case 'Tab':
239
+ if (this._isPopup()) {
240
+ // this.log('tab', event, this.isPopup());
241
+ event.preventDefault();
242
+ }
243
+ return;
244
+ case 'Enter':
245
+ case ' ':
246
+ if (item && !(event.key === ' ' && isInput)) {
247
+ event.preventDefault();
248
+ event.stopPropagation();
249
+ item.click();
250
+ }
251
+ return;
252
+ default:
253
+ return;
254
+ }
255
+ event.preventDefault();
256
+ event.stopPropagation();
257
+ event.stopImmediatePropagation();
258
+ item?.blur();
259
+ this.focusIndex(nextIndex, direction);
260
+ };
261
+ this.el.nativeElement.style.outline = 'none';
262
+ effect(cleanup => {
263
+ const id = this._ayId();
264
+ if (id) {
265
+ this.allyService.addGroup(id, this);
266
+ cleanup(() => {
267
+ this.off();
268
+ this.allyService.removeGroup(id);
269
+ });
270
+ }
271
+ });
272
+ effect(() => {
273
+ const items = this.items();
274
+ const isOn = this.isOn();
275
+ untracked(() => {
276
+ items.forEach(item => item.blur());
277
+ // console.log('group', this._ayId(), items.length, isOn);
278
+ this.log('focus', items.length, isOn, this._initialFocus());
279
+ let item = this.focusedItem?.deref();
280
+ if (items.length && isOn && this._initialFocus()) {
281
+ if (!item || !items.includes(item)) {
282
+ item = items[0];
283
+ }
284
+ this.focusItem(item);
285
+ }
286
+ });
287
+ });
288
+ effect(() => {
289
+ const isPopup = this._isPopup();
290
+ untracked(() => {
291
+ if (isPopup) {
292
+ this.on();
293
+ }
294
+ else {
295
+ this.el.nativeElement.addEventListener('focusin', this.handleFocusIn);
296
+ this.el.nativeElement.addEventListener('focusout', this.handleFocusOut);
297
+ }
298
+ });
299
+ });
300
+ }
301
+ findNextOrPreviousLevelItem(currentIndex, direction, items) {
302
+ const currentItem = items[currentIndex];
303
+ const currentLevel = currentItem.level();
304
+ const level = Math.max(0, currentLevel + (direction === 'next' ? 1 : -1));
305
+ let index = currentIndex - 1;
306
+ for (let i = index; i >= 0; i--) {
307
+ const nextItem = items[i];
308
+ if (!nextItem._disabled() && !nextItem._skip() && nextItem.level() === level) {
309
+ return i;
310
+ }
311
+ }
312
+ return currentIndex;
313
+ }
314
+ focusItem(item) {
315
+ const previousItem = this.focusedItem?.deref();
316
+ previousItem?.blur();
317
+ const items = this.items();
318
+ this.log('focusItem', item?.host.nativeElement.textContent);
319
+ item = item ?? items.find(item => !item._disabled() && !item._skip());
320
+ this.log('next focusItem', item?.host.nativeElement.textContent);
321
+ if (!item)
322
+ return;
323
+ this.focusIndex(items.indexOf(item));
324
+ }
325
+ focusIndex(nextIndex = 0, direction = 'next') {
326
+ const items = this.items();
327
+ this.log('focusIndex', nextIndex, direction);
328
+ if (nextIndex !== null && nextIndex >= 0 && nextIndex < items.length) {
329
+ let nextItem = items[nextIndex];
330
+ if (nextItem._disabled() || nextItem._skip()) {
331
+ nextIndex = this.getNextItem(nextIndex, items, direction);
332
+ nextItem = items[nextIndex];
333
+ }
334
+ const previousItem = this.focusedItem?.deref();
335
+ this.focusedItem = new WeakRef(nextItem);
336
+ nextItem.focus(!this.allyService.usingMouse && !this._isPopup(), !this.allyService.usingMouse);
337
+ // this.focusCount++;
338
+ if (this.clickable())
339
+ nextItem.click();
340
+ this.focusChanged.emit({ current: nextItem, previous: previousItem });
341
+ }
342
+ }
343
+ // it should start from the current index and move to the next item based on the direction
344
+ // if the current index is the last item, it should move to the first item
345
+ // we should also consider the disabled items
346
+ getNextItem(currentIndex, items, direction) {
347
+ // const filteredItems = items.filter(item => !item.disabled() && !item.skip());
348
+ const len = items.length;
349
+ const step = direction === 'next'
350
+ ? 1
351
+ : direction === 'previous'
352
+ ? -1
353
+ : direction === 'up'
354
+ ? -(this._columns() || 1)
355
+ : this._columns() || 1;
356
+ for (let i = 0; i < len; i++) {
357
+ const nextIndex = (currentIndex + i * step + len) % len;
358
+ // this.log(totalItems, currentIndex, step, nextIndex);
359
+ const item = items[nextIndex];
360
+ if (!item._disabled() && !item._skip()) {
361
+ // this.log({ currentIndex, items, direction });
362
+ return nextIndex;
363
+ }
364
+ }
365
+ return currentIndex;
366
+ }
367
+ findNextEnabledItem(startIndex, direction, items) {
368
+ const step = direction === 'next' ? 1 : -1;
369
+ const endIndex = direction === 'next' ? items.length : -1;
370
+ for (let i = startIndex; i !== endIndex; i += step) {
371
+ if (!items[i]._disabled() && !items[i]._skip()) {
372
+ return i;
373
+ }
374
+ }
375
+ return startIndex; // If no enabled item found, return the starting index
376
+ }
377
+ log(...args) {
378
+ // console.log(...args);
379
+ }
380
+ register(item) {
381
+ this.elements.update(x => [...x, item]);
382
+ }
383
+ unregister(item) {
384
+ this.elements.update(x => x.filter(y => y !== item));
385
+ }
386
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: AccessibleGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
387
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.0", type: AccessibleGroup, isStandalone: true, selector: "[ngbAccessibleGroup]", inputs: { ayId: { classPropertyName: "ayId", publicName: "ayId", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "ariaLabelledby", isSignal: true, isRequired: false, transformFunction: null }, isPopup: { classPropertyName: "isPopup", publicName: "isPopup", isSignal: true, isRequired: false, transformFunction: null }, loop: { classPropertyName: "loop", publicName: "loop", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, clickable: { classPropertyName: "clickable", publicName: "clickable", isSignal: true, isRequired: false, transformFunction: null }, initialFocus: { classPropertyName: "initialFocus", publicName: "initialFocus", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { ayId: "ayIdChange", clickable: "clickableChange", focusChanged: "focusChanged" }, host: { attributes: { "role": "group", "tabindex": "0" }, properties: { "attr.aria-label": "_ariaLabel()", "attr.aria-labelledby": "_ariaLabelledby()", "attr.aria-disabled": "_disabled()" } }, ngImport: i0 }); }
388
+ }
389
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: AccessibleGroup, decorators: [{
390
+ type: Directive,
391
+ args: [{
392
+ selector: '[ngbAccessibleGroup]',
393
+ host: {
394
+ role: 'group',
395
+ '[attr.aria-label]': '_ariaLabel()',
396
+ '[attr.aria-labelledby]': '_ariaLabelledby()',
397
+ '[attr.aria-disabled]': '_disabled()',
398
+ tabindex: '0',
399
+ },
400
+ }]
401
+ }], ctorParameters: () => [] });
402
+
403
+ class AccessibleItem {
404
+ constructor() {
405
+ this.allyService = inject(AccessibilityService);
406
+ this.host = inject(ElementRef);
407
+ this.id = input('');
408
+ this.ayId = input('');
409
+ this.role = input('button');
410
+ this.disabled = input(false, { transform: booleanAttribute });
411
+ this.selected = input(false, { transform: booleanAttribute });
412
+ this.data = input();
413
+ this.skip = input(false, { transform: booleanAttribute });
414
+ this.level = model(0);
415
+ this.expandable = model(false);
416
+ this.expanded = model(false);
417
+ this.selectedChange = output();
418
+ // inputs writable for hacky reasons
419
+ this._disabled = linkedSignal(this.disabled);
420
+ this._selected = linkedSignal(this.selected);
421
+ this._ayId = linkedSignal(this.ayId);
422
+ this._data = linkedSignal(this.data);
423
+ this._id = linkedSignal(this.id);
424
+ this._skip = linkedSignal(this.skip);
425
+ this._expandable = linkedSignal(this.expandable);
426
+ this._expanded = linkedSignal(this.expanded);
427
+ this.group = computed(() => this.allyService.getGroup(this._ayId() || ''));
428
+ this.pressed = signal(false);
429
+ this.hasPopup = computed(() => this.el.getAttribute('aria-haspopup') === 'true');
430
+ this.events = new Subject();
431
+ this.count = 1;
432
+ /**
433
+ * @internal when component is destroyed, we don't want to emit events
434
+ */
435
+ this.isDestroyed = false;
436
+ this.onFocus = () => {
437
+ if (this.allyService.usingMouse) {
438
+ // console.log('using mouse');
439
+ this.group()?.focusItem(this);
440
+ }
441
+ };
442
+ this.blur = () => {
443
+ this.el.tabIndex = -1;
444
+ this.el.removeAttribute('data-focus');
445
+ };
446
+ effect(cleanUp => {
447
+ const group = this.group();
448
+ if (group) {
449
+ group.register(this);
450
+ cleanUp(() => group.unregister(this));
451
+ }
452
+ });
453
+ effect(cleanUp => {
454
+ const el = this.host.nativeElement;
455
+ if (this.group()?._isPopup()) {
456
+ el.addEventListener('mouseenter', this.onFocus);
457
+ cleanUp(() => el.removeEventListener('mouseenter', this.onFocus));
458
+ }
459
+ });
460
+ }
461
+ get el() {
462
+ return this.host.nativeElement;
463
+ }
464
+ focus(focus, isKeyboard) {
465
+ // console.log('focus', focus);
466
+ // console.log('scrollIntoView', isKeyboard);
467
+ if (focus)
468
+ this.el.focus();
469
+ // this.el.classList.add('bg-muted-background');
470
+ this.el.setAttribute('data-focus', 'true');
471
+ if (isKeyboard)
472
+ this.el.scrollIntoView({ block: 'nearest' });
473
+ this.el.tabIndex = 0;
474
+ }
475
+ click() {
476
+ this.el.tabIndex = 0;
477
+ this.el.click();
478
+ this.el.focus();
479
+ // sometimes the click event detroyes the component
480
+ if (!this.isDestroyed) {
481
+ this.selectedChange.emit(this.count++);
482
+ this.events.next({ event: new KeyboardEvent('click'), type: 'click', item: this });
483
+ }
484
+ }
485
+ ngOnDestroy() {
486
+ this.isDestroyed = true;
487
+ }
488
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: AccessibleItem, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
489
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.0", type: AccessibleItem, isStandalone: true, selector: "[ngbAccessibleItem]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, ayId: { classPropertyName: "ayId", publicName: "ayId", isSignal: true, isRequired: false, transformFunction: null }, role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, skip: { classPropertyName: "skip", publicName: "skip", isSignal: true, isRequired: false, transformFunction: null }, level: { classPropertyName: "level", publicName: "level", isSignal: true, isRequired: false, transformFunction: null }, expandable: { classPropertyName: "expandable", publicName: "expandable", isSignal: true, isRequired: false, transformFunction: null }, expanded: { classPropertyName: "expanded", publicName: "expanded", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { level: "levelChange", expandable: "expandableChange", expanded: "expandedChange", selectedChange: "selectedChange" }, host: { listeners: { "click": "onFocus()" }, properties: { "attr.aria-pressed": "pressed()", "attr.aria-disabled": "_disabled() || null", "attr.aria-selected": "_selected()", "tabindex": "_disabled() ? -1 : 0" } }, ngImport: i0 }); }
490
+ }
491
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: AccessibleItem, decorators: [{
492
+ type: Directive,
493
+ args: [{
494
+ selector: '[ngbAccessibleItem]',
495
+ host: {
496
+ '[attr.aria-pressed]': 'pressed()',
497
+ '[attr.aria-disabled]': '_disabled() || null',
498
+ '[attr.aria-selected]': '_selected()',
499
+ '[tabindex]': '_disabled() ? -1 : 0',
500
+ '(click)': 'onFocus()',
501
+ },
502
+ }]
503
+ }], ctorParameters: () => [] });
504
+
505
+ class FocusTrap {
506
+ constructor() {
507
+ this.el = inject(ElementRef);
508
+ this.ngbFocusTrap = input(true, { transform: booleanAttribute });
509
+ this.focusInitial = input(true, { transform: booleanAttribute });
510
+ // hacky way
511
+ this._focusTrap = linkedSignal(this.ngbFocusTrap);
512
+ this._focusInitial = linkedSignal(this.focusInitial);
513
+ this.firstFocusableElement = null;
514
+ this.lastFocusableElement = null;
515
+ this.onKeydown = (event) => {
516
+ if (event.key === 'Tab') {
517
+ if (event.shiftKey) {
518
+ // Shift + Tab
519
+ if (document.activeElement === this.firstFocusableElement) {
520
+ event.preventDefault();
521
+ this.lastFocusableElement?.focus();
522
+ }
523
+ }
524
+ else {
525
+ // Tab
526
+ if (document.activeElement === this.lastFocusableElement) {
527
+ event.preventDefault();
528
+ this.firstFocusableElement?.focus();
529
+ }
530
+ }
531
+ }
532
+ };
533
+ let initialFocus = false;
534
+ effect(cleanup => {
535
+ if (this._focusTrap()) {
536
+ const observer = new MutationObserver(() => this.setFocusableElements());
537
+ observer.observe(this.el.nativeElement, { childList: true, subtree: true });
538
+ // we have call this manually because mutation observer not trigger on initial render
539
+ this.setFocusableElements();
540
+ if (!initialFocus && this._focusInitial()) {
541
+ initialFocus = true;
542
+ // console.log('focusInitial', this.el.nativeElement);
543
+ this.firstFocusableElement?.focus();
544
+ }
545
+ // listen to the keydown event
546
+ this.el.nativeElement.addEventListener('keydown', this.onKeydown);
547
+ cleanup(() => {
548
+ this.el.nativeElement.removeEventListener('keydown', this.onKeydown);
549
+ observer.disconnect();
550
+ });
551
+ }
552
+ });
553
+ }
554
+ setFocusableElements() {
555
+ const focusableElements = this.el.nativeElement.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
556
+ this.firstFocusableElement = focusableElements[0];
557
+ this.lastFocusableElement = focusableElements[focusableElements.length - 1];
558
+ }
559
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: FocusTrap, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
560
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.0", type: FocusTrap, isStandalone: true, selector: "[ngbFocusTrap]", inputs: { ngbFocusTrap: { classPropertyName: "ngbFocusTrap", publicName: "ngbFocusTrap", isSignal: true, isRequired: false, transformFunction: null }, focusInitial: { classPropertyName: "focusInitial", publicName: "focusInitial", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
561
+ }
562
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: FocusTrap, decorators: [{
563
+ type: Directive,
564
+ args: [{
565
+ selector: '[ngbFocusTrap]',
566
+ }]
567
+ }], ctorParameters: () => [] });
568
+
569
+ class Autofocus {
570
+ constructor() {
571
+ this.el = inject(ElementRef);
572
+ this.applicationRef = inject(ApplicationRef);
573
+ this.document = inject(DOCUMENT);
574
+ this.focusDelay = input(300);
575
+ this.isFocused = false;
576
+ if (isClient()) {
577
+ afterRender({
578
+ write: () => {
579
+ // check if element is present in dom
580
+ const isPresent = this.document.contains(this.el.nativeElement);
581
+ if (isPresent && !this.isFocused) {
582
+ this.isFocused = true;
583
+ this.focusElement();
584
+ }
585
+ else if (!isPresent) {
586
+ this.isFocused = false;
587
+ }
588
+ },
589
+ });
590
+ }
591
+ }
592
+ focusElement() {
593
+ const sub = this.applicationRef.isStable.subscribe(res => {
594
+ if (res) {
595
+ sub.unsubscribe();
596
+ setTimeout(() => {
597
+ this.el.nativeElement.focus();
598
+ }, this.focusDelay());
599
+ }
600
+ });
601
+ }
602
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: Autofocus, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
603
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.0", type: Autofocus, isStandalone: true, selector: "[ngbAutofocus]", inputs: { focusDelay: { classPropertyName: "focusDelay", publicName: "focusDelay", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
604
+ }
605
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: Autofocus, decorators: [{
606
+ type: Directive,
607
+ args: [{
608
+ selector: '[ngbAutofocus]',
609
+ }]
610
+ }], ctorParameters: () => [] });
611
+
612
+ /**
613
+ * Generated bundle index. Do not edit.
614
+ */
615
+
616
+ export { AccessibleGroup, AccessibleItem, Autofocus, FocusTrap };
617
+ //# sourceMappingURL=ngbase-adk-a11y.mjs.map