ng-primitives 0.89.0 → 0.91.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 (389) hide show
  1. package/a11y/index.d.ts +98 -3
  2. package/accordion/index.d.ts +361 -7
  3. package/ai/index.d.ts +238 -16
  4. package/autofill/index.d.ts +62 -1
  5. package/avatar/index.d.ts +155 -5
  6. package/breadcrumbs/index.d.ts +200 -7
  7. package/button/index.d.ts +39 -3
  8. package/checkbox/index.d.ts +137 -2
  9. package/combobox/index.d.ts +414 -8
  10. package/common/index.d.ts +31 -4
  11. package/date-picker/index.d.ts +714 -18
  12. package/date-time/index.d.ts +289 -3
  13. package/date-time-luxon/index.d.ts +31 -1
  14. package/dialog/index.d.ts +253 -9
  15. package/fesm2022/ng-primitives-a11y.mjs +42 -58
  16. package/fesm2022/ng-primitives-a11y.mjs.map +1 -1
  17. package/fesm2022/ng-primitives-accordion.mjs +249 -225
  18. package/fesm2022/ng-primitives-accordion.mjs.map +1 -1
  19. package/fesm2022/ng-primitives-ai.mjs +61 -58
  20. package/fesm2022/ng-primitives-ai.mjs.map +1 -1
  21. package/fesm2022/ng-primitives-autofill.mjs +55 -38
  22. package/fesm2022/ng-primitives-autofill.mjs.map +1 -1
  23. package/fesm2022/ng-primitives-avatar.mjs +105 -145
  24. package/fesm2022/ng-primitives-avatar.mjs.map +1 -1
  25. package/fesm2022/ng-primitives-breadcrumbs.mjs +106 -49
  26. package/fesm2022/ng-primitives-breadcrumbs.mjs.map +1 -1
  27. package/fesm2022/ng-primitives-button.mjs +20 -42
  28. package/fesm2022/ng-primitives-button.mjs.map +1 -1
  29. package/fesm2022/ng-primitives-checkbox.mjs +110 -84
  30. package/fesm2022/ng-primitives-checkbox.mjs.map +1 -1
  31. package/fesm2022/ng-primitives-combobox.mjs +82 -78
  32. package/fesm2022/ng-primitives-combobox.mjs.map +1 -1
  33. package/fesm2022/ng-primitives-common.mjs +5 -5
  34. package/fesm2022/ng-primitives-common.mjs.map +1 -1
  35. package/fesm2022/ng-primitives-date-picker.mjs +119 -112
  36. package/fesm2022/ng-primitives-date-picker.mjs.map +1 -1
  37. package/fesm2022/ng-primitives-dialog.mjs +48 -47
  38. package/fesm2022/ng-primitives-dialog.mjs.map +1 -1
  39. package/fesm2022/ng-primitives-file-upload.mjs +56 -48
  40. package/fesm2022/ng-primitives-file-upload.mjs.map +1 -1
  41. package/fesm2022/ng-primitives-focus-trap.mjs +9 -8
  42. package/fesm2022/ng-primitives-focus-trap.mjs.map +1 -1
  43. package/fesm2022/ng-primitives-form-field.mjs +97 -64
  44. package/fesm2022/ng-primitives-form-field.mjs.map +1 -1
  45. package/fesm2022/ng-primitives-input-otp.mjs +44 -43
  46. package/fesm2022/ng-primitives-input-otp.mjs.map +1 -1
  47. package/fesm2022/ng-primitives-input.mjs +38 -54
  48. package/fesm2022/ng-primitives-input.mjs.map +1 -1
  49. package/fesm2022/ng-primitives-interactions.mjs +59 -54
  50. package/fesm2022/ng-primitives-interactions.mjs.map +1 -1
  51. package/fesm2022/ng-primitives-internal.mjs +14 -14
  52. package/fesm2022/ng-primitives-internal.mjs.map +1 -1
  53. package/fesm2022/ng-primitives-listbox.mjs +52 -50
  54. package/fesm2022/ng-primitives-listbox.mjs.map +1 -1
  55. package/fesm2022/ng-primitives-menu.mjs +86 -72
  56. package/fesm2022/ng-primitives-menu.mjs.map +1 -1
  57. package/fesm2022/ng-primitives-meter.mjs +38 -35
  58. package/fesm2022/ng-primitives-meter.mjs.map +1 -1
  59. package/fesm2022/ng-primitives-pagination.mjs +83 -74
  60. package/fesm2022/ng-primitives-pagination.mjs.map +1 -1
  61. package/fesm2022/ng-primitives-popover.mjs +67 -60
  62. package/fesm2022/ng-primitives-popover.mjs.map +1 -1
  63. package/fesm2022/ng-primitives-portal.mjs +11 -12
  64. package/fesm2022/ng-primitives-portal.mjs.map +1 -1
  65. package/fesm2022/ng-primitives-progress.mjs +43 -40
  66. package/fesm2022/ng-primitives-progress.mjs.map +1 -1
  67. package/fesm2022/ng-primitives-radio.mjs +35 -33
  68. package/fesm2022/ng-primitives-radio.mjs.map +1 -1
  69. package/fesm2022/ng-primitives-resize.mjs +4 -4
  70. package/fesm2022/ng-primitives-resize.mjs.map +1 -1
  71. package/fesm2022/ng-primitives-roving-focus.mjs +264 -237
  72. package/fesm2022/ng-primitives-roving-focus.mjs.map +1 -1
  73. package/fesm2022/ng-primitives-search.mjs +9 -9
  74. package/fesm2022/ng-primitives-search.mjs.map +1 -1
  75. package/fesm2022/ng-primitives-select.mjs +73 -69
  76. package/fesm2022/ng-primitives-select.mjs.map +1 -1
  77. package/fesm2022/ng-primitives-separator.mjs +7 -7
  78. package/fesm2022/ng-primitives-separator.mjs.map +1 -1
  79. package/fesm2022/ng-primitives-slider.mjs +287 -253
  80. package/fesm2022/ng-primitives-slider.mjs.map +1 -1
  81. package/fesm2022/ng-primitives-state.mjs +173 -3
  82. package/fesm2022/ng-primitives-state.mjs.map +1 -1
  83. package/fesm2022/ng-primitives-switch.mjs +105 -101
  84. package/fesm2022/ng-primitives-switch.mjs.map +1 -1
  85. package/fesm2022/ng-primitives-tabs.mjs +48 -43
  86. package/fesm2022/ng-primitives-tabs.mjs.map +1 -1
  87. package/fesm2022/ng-primitives-textarea.mjs +33 -41
  88. package/fesm2022/ng-primitives-textarea.mjs.map +1 -1
  89. package/fesm2022/ng-primitives-toast.mjs +19 -19
  90. package/fesm2022/ng-primitives-toast.mjs.map +1 -1
  91. package/fesm2022/ng-primitives-toggle-group.mjs +160 -159
  92. package/fesm2022/ng-primitives-toggle-group.mjs.map +1 -1
  93. package/fesm2022/ng-primitives-toggle.mjs +81 -68
  94. package/fesm2022/ng-primitives-toggle.mjs.map +1 -1
  95. package/fesm2022/ng-primitives-toolbar.mjs +31 -40
  96. package/fesm2022/ng-primitives-toolbar.mjs.map +1 -1
  97. package/fesm2022/ng-primitives-tooltip.mjs +68 -60
  98. package/fesm2022/ng-primitives-tooltip.mjs.map +1 -1
  99. package/fesm2022/ng-primitives-utils.mjs +50 -37
  100. package/fesm2022/ng-primitives-utils.mjs.map +1 -1
  101. package/file-upload/index.d.ts +148 -4
  102. package/focus-trap/index.d.ts +98 -2
  103. package/form-field/index.d.ts +266 -7
  104. package/index.d.ts +2 -2
  105. package/input/index.d.ts +84 -2
  106. package/input-otp/index.d.ts +247 -4
  107. package/interactions/index.d.ts +295 -16
  108. package/internal/index.d.ts +201 -10
  109. package/listbox/index.d.ts +209 -6
  110. package/menu/index.d.ts +297 -8
  111. package/meter/index.d.ts +67 -6
  112. package/package.json +28 -28
  113. package/pagination/index.d.ts +211 -7
  114. package/popover/index.d.ts +224 -5
  115. package/portal/index.d.ts +389 -6
  116. package/progress/index.d.ts +124 -6
  117. package/radio/index.d.ts +140 -5
  118. package/resize/index.d.ts +29 -1
  119. package/roving-focus/index.d.ts +154 -4
  120. package/schematics/ng-add/schema.d.ts +0 -1
  121. package/schematics/ng-generate/__snapshots__/index.spec.ts.snap +1 -1
  122. package/schematics/ng-generate/templates/checkbox/checkbox.__fileSuffix@dasherize__.ts.template +2 -2
  123. package/schematics/ng-generate/templates/slider/slider.__fileSuffix@dasherize__.ts.template +6 -3
  124. package/schematics/ng-generate/templates/switch/switch.__fileSuffix@dasherize__.ts.template +2 -2
  125. package/schematics/ng-generate/templates/toggle/toggle.__fileSuffix@dasherize__.ts.template +2 -2
  126. package/schematics/ng-generate/templates/toggle-group/toggle-group.__fileSuffix@dasherize__.ts.template +2 -2
  127. package/schematics/ng-generate/templates/toolbar/toolbar.__fileSuffix@dasherize__.ts.template +1 -1
  128. package/search/index.d.ts +66 -3
  129. package/select/index.d.ts +341 -8
  130. package/separator/index.d.ts +30 -2
  131. package/slider/index.d.ts +471 -10
  132. package/state/index.d.ts +68 -11
  133. package/switch/index.d.ts +151 -3
  134. package/tabs/index.d.ts +222 -7
  135. package/textarea/index.d.ts +87 -2
  136. package/toast/index.d.ts +219 -4
  137. package/toggle/index.d.ts +98 -2
  138. package/toggle-group/index.d.ts +168 -5
  139. package/toolbar/index.d.ts +43 -2
  140. package/tooltip/index.d.ts +214 -5
  141. package/utils/index.d.ts +170 -9
  142. package/a11y/active-descendant/active-descendant.d.ts +0 -42
  143. package/a11y/visually-hidden/visually-hidden-state.d.ts +0 -17
  144. package/a11y/visually-hidden/visually-hidden.d.ts +0 -50
  145. package/accordion/accordion/accordion-state.d.ts +0 -17
  146. package/accordion/accordion/accordion.d.ts +0 -50
  147. package/accordion/accordion-content/accordion-content.d.ts +0 -40
  148. package/accordion/accordion-item/accordion-item-state.d.ts +0 -17
  149. package/accordion/accordion-item/accordion-item.d.ts +0 -50
  150. package/accordion/accordion-trigger/accordion-trigger.d.ts +0 -31
  151. package/accordion/config/accordion-config.d.ts +0 -32
  152. package/ai/prompt-composer/prompt-composer-state.d.ts +0 -17
  153. package/ai/prompt-composer/prompt-composer.d.ts +0 -23
  154. package/ai/prompt-composer-dictation/prompt-composer-dictation-state.d.ts +0 -17
  155. package/ai/prompt-composer-dictation/prompt-composer-dictation.d.ts +0 -29
  156. package/ai/prompt-composer-input/prompt-composer-input-state.d.ts +0 -17
  157. package/ai/prompt-composer-input/prompt-composer-input.d.ts +0 -16
  158. package/ai/prompt-composer-submit/prompt-composer-submit-state.d.ts +0 -17
  159. package/ai/prompt-composer-submit/prompt-composer-submit.d.ts +0 -15
  160. package/ai/thread/thread-state.d.ts +0 -17
  161. package/ai/thread/thread.d.ts +0 -23
  162. package/ai/thread-message/thread-message-state.d.ts +0 -17
  163. package/ai/thread-message/thread-message.d.ts +0 -11
  164. package/ai/thread-suggestion/thread-suggestion-state.d.ts +0 -17
  165. package/ai/thread-suggestion/thread-suggestion.d.ts +0 -14
  166. package/ai/thread-viewport/thread-viewport-state.d.ts +0 -17
  167. package/ai/thread-viewport/thread-viewport.d.ts +0 -34
  168. package/autofill/autofill/autofill.d.ts +0 -19
  169. package/avatar/avatar/avatar-state.d.ts +0 -17
  170. package/avatar/avatar/avatar.d.ts +0 -29
  171. package/avatar/avatar-fallback/avatar-fallback.d.ts +0 -37
  172. package/avatar/avatar-image/avatar-image.d.ts +0 -27
  173. package/avatar/config/avatar-config.d.ts +0 -21
  174. package/breadcrumbs/breadcrumb-ellipsis/breadcrumb-ellipsis.d.ts +0 -8
  175. package/breadcrumbs/breadcrumb-item/breadcrumb-item.d.ts +0 -8
  176. package/breadcrumbs/breadcrumb-link/breadcrumb-link.d.ts +0 -9
  177. package/breadcrumbs/breadcrumb-list/breadcrumb-list.d.ts +0 -8
  178. package/breadcrumbs/breadcrumb-page/breadcrumb-page.d.ts +0 -8
  179. package/breadcrumbs/breadcrumb-separator/breadcrumb-separator.d.ts +0 -8
  180. package/breadcrumbs/breadcrumbs/breadcrumbs.d.ts +0 -8
  181. package/button/button/button-state.d.ts +0 -17
  182. package/button/button/button.d.ts +0 -15
  183. package/button/button/setup-button.d.ts +0 -15
  184. package/checkbox/checkbox/checkbox-state.d.ts +0 -17
  185. package/checkbox/checkbox/checkbox.d.ts +0 -45
  186. package/combobox/combobox/combobox-state.d.ts +0 -17
  187. package/combobox/combobox/combobox.d.ts +0 -222
  188. package/combobox/combobox-button/combobox-button.d.ts +0 -18
  189. package/combobox/combobox-dropdown/combobox-dropdown.d.ts +0 -21
  190. package/combobox/combobox-input/combobox-input.d.ts +0 -36
  191. package/combobox/combobox-option/combobox-option.d.ts +0 -51
  192. package/combobox/combobox-portal/combobox-portal.d.ts +0 -37
  193. package/combobox/config/combobox-config.d.ts +0 -28
  194. package/combobox/utils.d.ts +0 -9
  195. package/common/header/header-token.d.ts +0 -10
  196. package/common/header/header.d.ts +0 -13
  197. package/common/types/orientation.d.ts +0 -1
  198. package/common/types/selection.d.ts +0 -1
  199. package/date-picker/config/date-picker-config.d.ts +0 -22
  200. package/date-picker/date-picker/date-picker-first-day-of-week.d.ts +0 -29
  201. package/date-picker/date-picker/date-picker-state.d.ts +0 -9
  202. package/date-picker/date-picker/date-picker.d.ts +0 -129
  203. package/date-picker/date-picker-cell/date-picker-cell.d.ts +0 -20
  204. package/date-picker/date-picker-cell-render/date-picker-cell-render-token.d.ts +0 -12
  205. package/date-picker/date-picker-cell-render/date-picker-cell-render.d.ts +0 -39
  206. package/date-picker/date-picker-date-button/date-picker-date-button-token.d.ts +0 -7
  207. package/date-picker/date-picker-date-button/date-picker-date-button.d.ts +0 -114
  208. package/date-picker/date-picker-grid/date-picker-grid.d.ts +0 -16
  209. package/date-picker/date-picker-label/date-picker-label-token.d.ts +0 -7
  210. package/date-picker/date-picker-label/date-picker-label.d.ts +0 -20
  211. package/date-picker/date-picker-next-month/date-picker-next-month.d.ts +0 -34
  212. package/date-picker/date-picker-previous-month/date-picker-previous-month.d.ts +0 -34
  213. package/date-picker/date-picker-row-render/date-picker-row-render-token.d.ts +0 -12
  214. package/date-picker/date-picker-row-render/date-picker-row-render.d.ts +0 -65
  215. package/date-picker/date-range-picker/date-range-picker-state.d.ts +0 -19
  216. package/date-picker/date-range-picker/date-range-picker.d.ts +0 -149
  217. package/date-time/date-adapter/date-adapter-token.d.ts +0 -11
  218. package/date-time/date-adapter/date-adapter.d.ts +0 -169
  219. package/date-time/native-date-adapter/native-date-adapter.d.ts +0 -106
  220. package/date-time-luxon/luxon-date-adapter/luxon-date-adapter.d.ts +0 -28
  221. package/dialog/config/dialog-config.d.ts +0 -41
  222. package/dialog/dialog/dialog-ref.d.ts +0 -45
  223. package/dialog/dialog/dialog-state.d.ts +0 -17
  224. package/dialog/dialog/dialog.d.ts +0 -37
  225. package/dialog/dialog/dialog.service.d.ts +0 -69
  226. package/dialog/dialog-description/dialog-description.d.ts +0 -12
  227. package/dialog/dialog-overlay/dialog-overlay.d.ts +0 -16
  228. package/dialog/dialog-title/dialog-title.d.ts +0 -12
  229. package/dialog/dialog-trigger/dialog-trigger.d.ts +0 -26
  230. package/file-upload/file-dropzone/file-drop-filter.d.ts +0 -2
  231. package/file-upload/file-dropzone/file-dropzone-state.d.ts +0 -17
  232. package/file-upload/file-dropzone/file-dropzone.d.ts +0 -55
  233. package/file-upload/file-upload/file-upload-state.d.ts +0 -17
  234. package/file-upload/file-upload/file-upload.d.ts +0 -72
  235. package/focus-trap/focus-trap/focus-trap-state.d.ts +0 -17
  236. package/focus-trap/focus-trap/focus-trap.d.ts +0 -85
  237. package/form-field/description/description.d.ts +0 -17
  238. package/form-field/error/error.d.ts +0 -32
  239. package/form-field/form-control/form-control-state.d.ts +0 -17
  240. package/form-field/form-control/form-control.d.ts +0 -44
  241. package/form-field/form-field/form-field-state.d.ts +0 -17
  242. package/form-field/form-field/form-field.d.ts +0 -119
  243. package/form-field/label/label.d.ts +0 -30
  244. package/input/input/input-state.d.ts +0 -17
  245. package/input/input/input.d.ts +0 -34
  246. package/input-otp/input-otp/input-otp-state.d.ts +0 -17
  247. package/input-otp/input-otp/input-otp.d.ts +0 -133
  248. package/input-otp/input-otp-input/input-otp-input.d.ts +0 -57
  249. package/input-otp/input-otp-slot/input-otp-slot.d.ts +0 -45
  250. package/interactions/config/interactions-config.d.ts +0 -30
  251. package/interactions/focus/focus-interaction.d.ts +0 -14
  252. package/interactions/focus/focus.d.ts +0 -19
  253. package/interactions/focus-visible/focus-visible-interaction.d.ts +0 -12
  254. package/interactions/focus-visible/focus-visible.d.ts +0 -19
  255. package/interactions/hover/hover-interaction.d.ts +0 -17
  256. package/interactions/hover/hover.d.ts +0 -31
  257. package/interactions/interactions/interactions.d.ts +0 -20
  258. package/interactions/move/move.d.ts +0 -114
  259. package/interactions/press/press-interaction.d.ts +0 -14
  260. package/interactions/press/press.d.ts +0 -26
  261. package/internal/exit-animation/exit-animation-manager.d.ts +0 -17
  262. package/internal/exit-animation/exit-animation.d.ts +0 -26
  263. package/internal/signals/explicit-effect.d.ts +0 -19
  264. package/internal/style-injector/style-injector.d.ts +0 -44
  265. package/internal/utilities/dom-removal.d.ts +0 -6
  266. package/internal/utilities/element-ref.d.ts +0 -6
  267. package/internal/utilities/mutation-observer.d.ts +0 -39
  268. package/internal/utilities/overflow.d.ts +0 -13
  269. package/internal/utilities/resize.d.ts +0 -31
  270. package/internal/utilities/scrolling.d.ts +0 -1
  271. package/listbox/listbox/listbox-state.d.ts +0 -17
  272. package/listbox/listbox/listbox.d.ts +0 -101
  273. package/listbox/listbox-header/listbox-header.d.ts +0 -9
  274. package/listbox/listbox-option/listbox-option.d.ts +0 -68
  275. package/listbox/listbox-section/listbox-section.d.ts +0 -9
  276. package/listbox/listbox-trigger/listbox-trigger.d.ts +0 -13
  277. package/menu/config/menu-config.d.ts +0 -44
  278. package/menu/menu/menu-token.d.ts +0 -11
  279. package/menu/menu/menu.d.ts +0 -22
  280. package/menu/menu-item/menu-item.d.ts +0 -30
  281. package/menu/menu-trigger/menu-trigger-state.d.ts +0 -17
  282. package/menu/menu-trigger/menu-trigger.d.ts +0 -98
  283. package/menu/submenu-trigger/submenu-trigger-state.d.ts +0 -17
  284. package/menu/submenu-trigger/submenu-trigger.d.ts +0 -88
  285. package/meter/meter/meter-state.d.ts +0 -17
  286. package/meter/meter/meter.d.ts +0 -27
  287. package/meter/meter-indicator/meter-indicator.d.ts +0 -7
  288. package/meter/meter-label/meter-label.d.ts +0 -10
  289. package/meter/meter-track/meter-track.d.ts +0 -5
  290. package/meter/meter-value/meter-value.d.ts +0 -5
  291. package/pagination/pagination/pagination-state.d.ts +0 -17
  292. package/pagination/pagination/pagination.d.ts +0 -45
  293. package/pagination/pagination-button/pagination-button.d.ts +0 -39
  294. package/pagination/pagination-first/pagination-first.d.ts +0 -28
  295. package/pagination/pagination-last/pagination-last.d.ts +0 -28
  296. package/pagination/pagination-next/pagination-next.d.ts +0 -31
  297. package/pagination/pagination-previous/pagination-previous.d.ts +0 -31
  298. package/popover/config/popover-config.d.ts +0 -64
  299. package/popover/popover/popover.d.ts +0 -18
  300. package/popover/popover-arrow/popover-arrow.d.ts +0 -6
  301. package/popover/popover-trigger/popover-trigger-state.d.ts +0 -19
  302. package/popover/popover-trigger/popover-trigger.d.ts +0 -128
  303. package/portal/offset.d.ts +0 -39
  304. package/portal/overlay-arrow.d.ts +0 -1
  305. package/portal/overlay-token.d.ts +0 -12
  306. package/portal/overlay.d.ts +0 -214
  307. package/portal/portal.d.ts +0 -94
  308. package/portal/scroll-strategy.d.ts +0 -23
  309. package/progress/progress/progress-state.d.ts +0 -17
  310. package/progress/progress/progress.d.ts +0 -61
  311. package/progress/progress-indicator/progress-indicator.d.ts +0 -17
  312. package/progress/progress-label/progress-label.d.ts +0 -14
  313. package/progress/progress-track/progress-track.d.ts +0 -9
  314. package/progress/progress-value/progress-value.d.ts +0 -9
  315. package/radio/radio-group/radio-group-state.d.ts +0 -18
  316. package/radio/radio-group/radio-group.d.ts +0 -54
  317. package/radio/radio-indicator/radio-indicator.d.ts +0 -21
  318. package/radio/radio-item/radio-item-state.d.ts +0 -18
  319. package/radio/radio-item/radio-item.d.ts +0 -45
  320. package/resize/resize/resize.d.ts +0 -26
  321. package/roving-focus/roving-focus-group/roving-focus-group-state.d.ts +0 -17
  322. package/roving-focus/roving-focus-group/roving-focus-group-token.d.ts +0 -21
  323. package/roving-focus/roving-focus-group/roving-focus-group.d.ts +0 -94
  324. package/roving-focus/roving-focus-item/roving-focus-item.d.ts +0 -53
  325. package/search/search/search-state.d.ts +0 -17
  326. package/search/search/search.d.ts +0 -36
  327. package/search/search-clear/search-clear.d.ts +0 -16
  328. package/select/config/select-config.d.ts +0 -28
  329. package/select/native-select/native-select-state.d.ts +0 -17
  330. package/select/native-select/native-select.d.ts +0 -22
  331. package/select/select/select-state.d.ts +0 -17
  332. package/select/select/select.d.ts +0 -172
  333. package/select/select-dropdown/select-dropdown.d.ts +0 -17
  334. package/select/select-option/select-option.d.ts +0 -51
  335. package/select/select-portal/select-portal.d.ts +0 -37
  336. package/separator/config/separator-config.d.ts +0 -22
  337. package/separator/separator/separator.d.ts +0 -11
  338. package/slider/range-slider/range-slider/range-slider-state.d.ts +0 -17
  339. package/slider/range-slider/range-slider/range-slider.d.ts +0 -115
  340. package/slider/range-slider/range-slider-range/range-slider-range.d.ts +0 -12
  341. package/slider/range-slider/range-slider-thumb/range-slider-thumb.d.ts +0 -44
  342. package/slider/range-slider/range-slider-track/range-slider-track.d.ts +0 -22
  343. package/slider/slider/slider-state.d.ts +0 -17
  344. package/slider/slider/slider.d.ts +0 -58
  345. package/slider/slider-range/slider-range.d.ts +0 -12
  346. package/slider/slider-thumb/slider-thumb.d.ts +0 -29
  347. package/slider/slider-track/slider-track.d.ts +0 -22
  348. package/switch/switch/switch-state.d.ts +0 -17
  349. package/switch/switch/switch.d.ts +0 -49
  350. package/switch/switch-thumb/switch-thumb.d.ts +0 -13
  351. package/tabs/config/tabs-config.d.ts +0 -32
  352. package/tabs/tab-button/tab-button.d.ts +0 -59
  353. package/tabs/tab-list/tab-list.d.ts +0 -12
  354. package/tabs/tab-panel/tab-panel-token.d.ts +0 -8
  355. package/tabs/tab-panel/tab-panel.d.ts +0 -38
  356. package/tabs/tabset/tabset-state.d.ts +0 -17
  357. package/tabs/tabset/tabset.d.ts +0 -71
  358. package/textarea/textarea/textarea-state.d.ts +0 -17
  359. package/textarea/textarea/textarea.d.ts +0 -19
  360. package/toast/config/toast-config.d.ts +0 -70
  361. package/toast/toast/toast-context.d.ts +0 -3
  362. package/toast/toast/toast-manager.d.ts +0 -49
  363. package/toast/toast/toast-options.d.ts +0 -34
  364. package/toast/toast/toast-timer.d.ts +0 -14
  365. package/toast/toast/toast.d.ts +0 -72
  366. package/toggle/toggle/toggle-state.d.ts +0 -17
  367. package/toggle/toggle/toggle.d.ts +0 -44
  368. package/toggle-group/config/toggle-group-config.d.ts +0 -32
  369. package/toggle-group/toggle-group/toggle-group-state.d.ts +0 -17
  370. package/toggle-group/toggle-group/toggle-group.d.ts +0 -64
  371. package/toggle-group/toggle-group-item/toggle-group-item-state.d.ts +0 -17
  372. package/toggle-group/toggle-group-item/toggle-group-item.d.ts +0 -34
  373. package/toolbar/toolbar/toolbar-state.d.ts +0 -17
  374. package/toolbar/toolbar/toolbar.d.ts +0 -20
  375. package/tooltip/config/tooltip-config.d.ts +0 -59
  376. package/tooltip/tooltip/tooltip.d.ts +0 -17
  377. package/tooltip/tooltip-arrow/tooltip-arrow.d.ts +0 -6
  378. package/tooltip/tooltip-text-content/tooltip-text-content.component.d.ts +0 -14
  379. package/tooltip/tooltip-trigger/tooltip-trigger-state.d.ts +0 -17
  380. package/tooltip/tooltip-trigger/tooltip-trigger.d.ts +0 -126
  381. package/utils/forms/providers.d.ts +0 -6
  382. package/utils/forms/status.d.ts +0 -16
  383. package/utils/forms/types.d.ts +0 -8
  384. package/utils/helpers/attributes.d.ts +0 -2
  385. package/utils/helpers/disposables.d.ts +0 -40
  386. package/utils/helpers/unique-id.d.ts +0 -6
  387. package/utils/helpers/validators.d.ts +0 -51
  388. package/utils/observables/take-until-destroyed.d.ts +0 -10
  389. package/utils/signals/index.d.ts +0 -22
@@ -1,9 +1,8 @@
1
1
  import { coerceStringArray } from '@angular/cdk/coercion';
2
2
  import * as i0 from '@angular/core';
3
- import { inject, ElementRef, input, booleanAttribute, output, signal, HostListener, Directive } from '@angular/core';
3
+ import { inject, ElementRef, input, booleanAttribute, output, signal, HostListener, Directive, DOCUMENT } from '@angular/core';
4
4
  import { ngpHoverInteraction, ngpInteractions } from 'ng-primitives/interactions';
5
5
  import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
6
- import { DOCUMENT } from '@angular/common';
7
6
 
8
7
  function fileDropFilter(fileList, acceptedTypes, multiple) {
9
8
  const validFiles = Array.from(fileList).filter(file => isFileTypeAccepted(file, acceptedTypes));
@@ -64,31 +63,35 @@ class NgpFileDropzone {
64
63
  * The accepted file types. This can be an array of strings or a comma-separated string.
65
64
  * Accepted types can either be file extensions (e.g. `.jpg`) or MIME types (e.g. `image/jpeg`).
66
65
  */
67
- this.fileTypes = input(undefined, {
68
- alias: 'ngpFileDropzoneFileTypes',
69
- transform: types => coerceStringArray(types, ','),
70
- });
66
+ this.fileTypes = input(undefined, ...(ngDevMode ? [{ debugName: "fileTypes", alias: 'ngpFileDropzoneFileTypes',
67
+ transform: types => coerceStringArray(types, ',') }] : [{
68
+ alias: 'ngpFileDropzoneFileTypes',
69
+ transform: types => coerceStringArray(types, ','),
70
+ }]));
71
71
  /**
72
72
  * Whether to allow multiple files to be selected.
73
73
  */
74
- this.multiple = input(false, {
75
- alias: 'ngpFileDropzoneMultiple',
76
- transform: booleanAttribute,
77
- });
74
+ this.multiple = input(false, ...(ngDevMode ? [{ debugName: "multiple", alias: 'ngpFileDropzoneMultiple',
75
+ transform: booleanAttribute }] : [{
76
+ alias: 'ngpFileDropzoneMultiple',
77
+ transform: booleanAttribute,
78
+ }]));
78
79
  /**
79
80
  * Whether to allow the user to select directories.
80
81
  */
81
- this.directory = input(false, {
82
- alias: 'ngpFileDropzoneDirectory',
83
- transform: booleanAttribute,
84
- });
82
+ this.directory = input(false, ...(ngDevMode ? [{ debugName: "directory", alias: 'ngpFileDropzoneDirectory',
83
+ transform: booleanAttribute }] : [{
84
+ alias: 'ngpFileDropzoneDirectory',
85
+ transform: booleanAttribute,
86
+ }]));
85
87
  /**
86
88
  * Whether the file upload is disabled.
87
89
  */
88
- this.disabled = input(false, {
89
- alias: 'ngpFileDropzoneDisabled',
90
- transform: booleanAttribute,
91
- });
90
+ this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", alias: 'ngpFileDropzoneDisabled',
91
+ transform: booleanAttribute }] : [{
92
+ alias: 'ngpFileDropzoneDisabled',
93
+ transform: booleanAttribute,
94
+ }]));
92
95
  /**
93
96
  * Emits when the user selects files.
94
97
  */
@@ -110,7 +113,7 @@ class NgpFileDropzone {
110
113
  /**
111
114
  * Whether the user is currently dragging a file over the file upload.
112
115
  */
113
- this.isDragOver = signal(false);
116
+ this.isDragOver = signal(false, ...(ngDevMode ? [{ debugName: "isDragOver" }] : []));
114
117
  /**
115
118
  * The file upload state.
116
119
  */
@@ -165,10 +168,10 @@ class NgpFileDropzone {
165
168
  }
166
169
  }
167
170
  }
168
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpFileDropzone, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
169
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.11", type: NgpFileDropzone, isStandalone: true, selector: "[ngpFileDropzone]", inputs: { fileTypes: { classPropertyName: "fileTypes", publicName: "ngpFileDropzoneFileTypes", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "ngpFileDropzoneMultiple", isSignal: true, isRequired: false, transformFunction: null }, directory: { classPropertyName: "directory", publicName: "ngpFileDropzoneDirectory", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpFileDropzoneDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "ngpFileDropzoneSelected", rejected: "ngpFileDropzoneRejected", dragOver: "ngpFileDropzoneDragOver" }, host: { listeners: { "dragenter": "onDragEnter($event)", "dragover": "onDragOver($event)", "dragleave": "onDragLeave($event)", "drop": "onDrop($event)" }, properties: { "attr.data-dragover": "isDragOver() ? \"\" : null", "attr.data-disabled": "disabled() ? \"\" : null" } }, providers: [provideFileDropzoneState()], exportAs: ["ngpFileDropzone"], ngImport: i0 }); }
171
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpFileDropzone, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
172
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.9", type: NgpFileDropzone, isStandalone: true, selector: "[ngpFileDropzone]", inputs: { fileTypes: { classPropertyName: "fileTypes", publicName: "ngpFileDropzoneFileTypes", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "ngpFileDropzoneMultiple", isSignal: true, isRequired: false, transformFunction: null }, directory: { classPropertyName: "directory", publicName: "ngpFileDropzoneDirectory", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpFileDropzoneDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "ngpFileDropzoneSelected", rejected: "ngpFileDropzoneRejected", dragOver: "ngpFileDropzoneDragOver" }, host: { listeners: { "dragenter": "onDragEnter($event)", "dragover": "onDragOver($event)", "dragleave": "onDragLeave($event)", "drop": "onDrop($event)" }, properties: { "attr.data-dragover": "isDragOver() ? \"\" : null", "attr.data-disabled": "disabled() ? \"\" : null" } }, providers: [provideFileDropzoneState()], exportAs: ["ngpFileDropzone"], ngImport: i0 }); }
170
173
  }
171
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpFileDropzone, decorators: [{
174
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpFileDropzone, decorators: [{
172
175
  type: Directive,
173
176
  args: [{
174
177
  selector: '[ngpFileDropzone]',
@@ -179,7 +182,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImpo
179
182
  '[attr.data-disabled]': 'disabled() ? "" : null',
180
183
  },
181
184
  }]
182
- }], ctorParameters: () => [], propDecorators: { onDragEnter: [{
185
+ }], ctorParameters: () => [], propDecorators: { fileTypes: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpFileDropzoneFileTypes", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpFileDropzoneMultiple", required: false }] }], directory: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpFileDropzoneDirectory", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpFileDropzoneDisabled", required: false }] }], selected: [{ type: i0.Output, args: ["ngpFileDropzoneSelected"] }], rejected: [{ type: i0.Output, args: ["ngpFileDropzoneRejected"] }], dragOver: [{ type: i0.Output, args: ["ngpFileDropzoneDragOver"] }], onDragEnter: [{
183
186
  type: HostListener,
184
187
  args: ['dragenter', ['$event']]
185
188
  }], onDragOver: [{
@@ -227,38 +230,43 @@ class NgpFileUpload {
227
230
  * The accepted file types. This can be an array of strings or a comma-separated string.
228
231
  * Accepted types can either be file extensions (e.g. `.jpg`) or MIME types (e.g. `image/jpeg`).
229
232
  */
230
- this.fileTypes = input(undefined, {
231
- alias: 'ngpFileUploadFileTypes',
232
- transform: types => coerceStringArray(types, ','),
233
- });
233
+ this.fileTypes = input(undefined, ...(ngDevMode ? [{ debugName: "fileTypes", alias: 'ngpFileUploadFileTypes',
234
+ transform: types => coerceStringArray(types, ',') }] : [{
235
+ alias: 'ngpFileUploadFileTypes',
236
+ transform: types => coerceStringArray(types, ','),
237
+ }]));
234
238
  /**
235
239
  * Whether to allow multiple files to be selected.
236
240
  */
237
- this.multiple = input(false, {
238
- alias: 'ngpFileUploadMultiple',
239
- transform: booleanAttribute,
240
- });
241
+ this.multiple = input(false, ...(ngDevMode ? [{ debugName: "multiple", alias: 'ngpFileUploadMultiple',
242
+ transform: booleanAttribute }] : [{
243
+ alias: 'ngpFileUploadMultiple',
244
+ transform: booleanAttribute,
245
+ }]));
241
246
  /**
242
247
  * Whether to allow the user to select directories.
243
248
  */
244
- this.directory = input(false, {
245
- alias: 'ngpFileUploadDirectory',
246
- transform: booleanAttribute,
247
- });
249
+ this.directory = input(false, ...(ngDevMode ? [{ debugName: "directory", alias: 'ngpFileUploadDirectory',
250
+ transform: booleanAttribute }] : [{
251
+ alias: 'ngpFileUploadDirectory',
252
+ transform: booleanAttribute,
253
+ }]));
248
254
  /**
249
255
  * Whether drag-and-drop is enabled.
250
256
  */
251
- this.dragAndDrop = input(true, {
252
- alias: 'ngpFileUploadDragDrop',
253
- transform: booleanAttribute,
254
- });
257
+ this.dragAndDrop = input(true, ...(ngDevMode ? [{ debugName: "dragAndDrop", alias: 'ngpFileUploadDragDrop',
258
+ transform: booleanAttribute }] : [{
259
+ alias: 'ngpFileUploadDragDrop',
260
+ transform: booleanAttribute,
261
+ }]));
255
262
  /**
256
263
  * Whether the file upload is disabled.
257
264
  */
258
- this.disabled = input(false, {
259
- alias: 'ngpFileUploadDisabled',
260
- transform: booleanAttribute,
261
- });
265
+ this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", alias: 'ngpFileUploadDisabled',
266
+ transform: booleanAttribute }] : [{
267
+ alias: 'ngpFileUploadDisabled',
268
+ transform: booleanAttribute,
269
+ }]));
262
270
  /**
263
271
  * Emits when the user selects files.
264
272
  */
@@ -286,7 +294,7 @@ class NgpFileUpload {
286
294
  /**
287
295
  * Whether the user is currently dragging a file over the file upload.
288
296
  */
289
- this.isDragOver = signal(false);
297
+ this.isDragOver = signal(false, ...(ngDevMode ? [{ debugName: "isDragOver" }] : []));
290
298
  /**
291
299
  * Store the file input element.
292
300
  */
@@ -370,10 +378,10 @@ class NgpFileUpload {
370
378
  }
371
379
  }
372
380
  }
373
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpFileUpload, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
374
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.11", type: NgpFileUpload, isStandalone: true, selector: "[ngpFileUpload]", inputs: { fileTypes: { classPropertyName: "fileTypes", publicName: "ngpFileUploadFileTypes", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "ngpFileUploadMultiple", isSignal: true, isRequired: false, transformFunction: null }, directory: { classPropertyName: "directory", publicName: "ngpFileUploadDirectory", isSignal: true, isRequired: false, transformFunction: null }, dragAndDrop: { classPropertyName: "dragAndDrop", publicName: "ngpFileUploadDragDrop", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpFileUploadDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "ngpFileUploadSelected", canceled: "ngpFileUploadCanceled", rejected: "ngpFileUploadRejected", dragOver: "ngpFileUploadDragOver" }, host: { listeners: { "click": "showFileDialog()", "dragenter": "onDragEnter($event)", "dragover": "onDragOver($event)", "dragleave": "onDragLeave($event)", "drop": "onDrop($event)" }, properties: { "attr.data-disabled": "state.disabled() ? \"\" : null", "attr.data-dragover": "isDragOver() ? \"\" : null" } }, providers: [provideFileUploadState()], exportAs: ["ngpFileUpload"], ngImport: i0 }); }
381
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpFileUpload, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
382
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.9", type: NgpFileUpload, isStandalone: true, selector: "[ngpFileUpload]", inputs: { fileTypes: { classPropertyName: "fileTypes", publicName: "ngpFileUploadFileTypes", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "ngpFileUploadMultiple", isSignal: true, isRequired: false, transformFunction: null }, directory: { classPropertyName: "directory", publicName: "ngpFileUploadDirectory", isSignal: true, isRequired: false, transformFunction: null }, dragAndDrop: { classPropertyName: "dragAndDrop", publicName: "ngpFileUploadDragDrop", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpFileUploadDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "ngpFileUploadSelected", canceled: "ngpFileUploadCanceled", rejected: "ngpFileUploadRejected", dragOver: "ngpFileUploadDragOver" }, host: { listeners: { "click": "showFileDialog()", "dragenter": "onDragEnter($event)", "dragover": "onDragOver($event)", "dragleave": "onDragLeave($event)", "drop": "onDrop($event)" }, properties: { "attr.data-disabled": "state.disabled() ? \"\" : null", "attr.data-dragover": "isDragOver() ? \"\" : null" } }, providers: [provideFileUploadState()], exportAs: ["ngpFileUpload"], ngImport: i0 }); }
375
383
  }
376
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpFileUpload, decorators: [{
384
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpFileUpload, decorators: [{
377
385
  type: Directive,
378
386
  args: [{
379
387
  selector: '[ngpFileUpload]',
@@ -384,7 +392,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImpo
384
392
  '[attr.data-dragover]': 'isDragOver() ? "" : null',
385
393
  },
386
394
  }]
387
- }], ctorParameters: () => [], propDecorators: { showFileDialog: [{
395
+ }], ctorParameters: () => [], propDecorators: { fileTypes: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpFileUploadFileTypes", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpFileUploadMultiple", required: false }] }], directory: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpFileUploadDirectory", required: false }] }], dragAndDrop: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpFileUploadDragDrop", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpFileUploadDisabled", required: false }] }], selected: [{ type: i0.Output, args: ["ngpFileUploadSelected"] }], canceled: [{ type: i0.Output, args: ["ngpFileUploadCanceled"] }], rejected: [{ type: i0.Output, args: ["ngpFileUploadRejected"] }], dragOver: [{ type: i0.Output, args: ["ngpFileUploadDragOver"] }], showFileDialog: [{
388
396
  type: HostListener,
389
397
  args: ['click']
390
398
  }], onDragEnter: [{
@@ -1 +1 @@
1
- {"version":3,"file":"ng-primitives-file-upload.mjs","sources":["../../../../packages/ng-primitives/file-upload/src/file-dropzone/file-drop-filter.ts","../../../../packages/ng-primitives/file-upload/src/file-dropzone/file-dropzone-state.ts","../../../../packages/ng-primitives/file-upload/src/file-dropzone/file-dropzone.ts","../../../../packages/ng-primitives/file-upload/src/file-upload/file-upload-state.ts","../../../../packages/ng-primitives/file-upload/src/file-upload/file-upload.ts","../../../../packages/ng-primitives/file-upload/src/ng-primitives-file-upload.ts"],"sourcesContent":["export function fileDropFilter(\n fileList: FileList,\n acceptedTypes: string[] | undefined,\n multiple: boolean,\n) {\n const validFiles = Array.from(fileList).filter(file => isFileTypeAccepted(file, acceptedTypes));\n\n const limitedFiles = multiple ? validFiles : validFiles.slice(0, 1);\n\n return limitedFiles.length > 0 ? filesToFileList(limitedFiles) : null;\n}\n\nexport function isFileTypeAccepted(file: File, acceptedTypes: string[] | undefined) {\n // allow all file types if no types are specified\n if (!acceptedTypes || acceptedTypes.length === 0) return true;\n\n const mimeType = file.type;\n const fileName = file.name.toLowerCase();\n\n return acceptedTypes.some(type => {\n type = type.toLowerCase();\n\n if (type.startsWith('.')) {\n return fileName.endsWith(type);\n }\n\n if (type.endsWith('/*')) {\n const baseType = type.replace('/*', '');\n return mimeType.startsWith(baseType);\n }\n\n return mimeType === type;\n });\n}\n\nfunction filesToFileList(files: File[]): FileList {\n const dataTransfer = new DataTransfer();\n files.forEach(file => dataTransfer.items.add(file));\n return dataTransfer.files;\n}\n","import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpFileDropzone } from './file-dropzone';\n\n/**\n * The state token for the FileDropzone primitive.\n */\nexport const NgpFileDropzoneStateToken = createStateToken<NgpFileDropzone>('FileDropzone');\n\n/**\n * Provides the FileDropzone state.\n */\nexport const provideFileDropzoneState = createStateProvider(NgpFileDropzoneStateToken);\n\n/**\n * Injects the FileDropzone state.\n */\nexport const injectFileDropzoneState =\n createStateInjector<NgpFileDropzone>(NgpFileDropzoneStateToken);\n\n/**\n * The FileDropzone state registration function.\n */\nexport const fileDropzoneState = createState(NgpFileDropzoneStateToken);\n","import { BooleanInput, coerceStringArray } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n Directive,\n ElementRef,\n HostListener,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\nimport { ngpHoverInteraction } from 'ng-primitives/interactions';\nimport { fileDropFilter } from './file-drop-filter';\nimport { fileDropzoneState, provideFileDropzoneState } from './file-dropzone-state';\n\n/**\n * Capture files dropped on the element.\n */\n@Directive({\n selector: '[ngpFileDropzone]',\n exportAs: 'ngpFileDropzone',\n providers: [provideFileDropzoneState()],\n host: {\n '[attr.data-dragover]': 'isDragOver() ? \"\" : null',\n '[attr.data-disabled]': 'disabled() ? \"\" : null',\n },\n})\nexport class NgpFileDropzone {\n /**\n * Access the host element.\n */\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * The accepted file types. This can be an array of strings or a comma-separated string.\n * Accepted types can either be file extensions (e.g. `.jpg`) or MIME types (e.g. `image/jpeg`).\n */\n readonly fileTypes = input<string[], string | string[]>(undefined, {\n alias: 'ngpFileDropzoneFileTypes',\n transform: types => coerceStringArray(types, ','),\n });\n\n /**\n * Whether to allow multiple files to be selected.\n */\n readonly multiple = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileDropzoneMultiple',\n transform: booleanAttribute,\n });\n\n /**\n * Whether to allow the user to select directories.\n */\n readonly directory = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileDropzoneDirectory',\n transform: booleanAttribute,\n });\n\n /**\n * Whether the file upload is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileDropzoneDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Emits when the user selects files.\n */\n readonly selected = output<FileList | null>({\n alias: 'ngpFileDropzoneSelected',\n });\n\n /**\n * Emits when uploaded files are rejected because they do not match the allowed {@link fileTypes}.\n */\n readonly rejected = output<void>({\n alias: 'ngpFileDropzoneRejected',\n });\n\n /**\n * Emits when the user drags a file over the file upload.\n */\n readonly dragOver = output<boolean>({\n alias: 'ngpFileDropzoneDragOver',\n });\n\n /**\n * Whether the user is currently dragging a file over the file upload.\n */\n protected readonly isDragOver = signal<boolean>(false);\n\n /**\n * The file upload state.\n */\n private readonly state = fileDropzoneState<NgpFileDropzone>(this);\n\n constructor() {\n ngpHoverInteraction({ disabled: this.state.disabled });\n }\n\n @HostListener('dragenter', ['$event'])\n protected onDragEnter(event: DragEvent): void {\n if (this.state.disabled()) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n this.isDragOver.set(true);\n this.dragOver.emit(true);\n }\n\n @HostListener('dragover', ['$event'])\n protected onDragOver(event: DragEvent): void {\n if (this.state.disabled()) {\n return;\n }\n\n event.stopPropagation();\n event.preventDefault();\n this.isDragOver.set(true);\n }\n\n @HostListener('dragleave', ['$event'])\n protected onDragLeave(event: DragEvent): void {\n if (this.state.disabled() || !this.isDragOver()) {\n return;\n }\n\n // if the element we are dragging over is a child of the file upload, ignore the event\n if (this.elementRef.nativeElement.contains(event.relatedTarget as Node)) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n this.isDragOver.set(false);\n this.dragOver.emit(false);\n }\n\n @HostListener('drop', ['$event'])\n protected onDrop(event: DragEvent): void {\n if (this.state.disabled()) {\n return;\n }\n\n event.preventDefault();\n this.isDragOver.set(false);\n this.dragOver.emit(false);\n\n const fileList = event.dataTransfer?.files;\n if (fileList) {\n const filteredFiles = fileDropFilter(fileList, this.state.fileTypes(), this.state.multiple());\n\n if (filteredFiles) {\n this.selected.emit(filteredFiles);\n } else {\n this.rejected.emit();\n }\n }\n }\n}\n","import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpFileUpload } from './file-upload';\n\n/**\n * The state token for the FileUpload primitive.\n */\nexport const NgpFileUploadStateToken = createStateToken<NgpFileUpload>('FileUpload');\n\n/**\n * Provides the FileUpload state.\n */\nexport const provideFileUploadState = createStateProvider(NgpFileUploadStateToken);\n\n/**\n * Injects the FileUpload state.\n */\nexport const injectFileUploadState = createStateInjector<NgpFileUpload>(NgpFileUploadStateToken);\n\n/**\n * The FileUpload state registration function.\n */\nexport const fileUploadState = createState(NgpFileUploadStateToken);\n","import { BooleanInput, coerceStringArray } from '@angular/cdk/coercion';\nimport { DOCUMENT } from '@angular/common';\nimport {\n booleanAttribute,\n Directive,\n ElementRef,\n HostListener,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\nimport { ngpInteractions } from 'ng-primitives/interactions';\nimport { fileDropFilter } from '../file-dropzone/file-drop-filter';\nimport { fileUploadState, provideFileUploadState } from './file-upload-state';\n\n/**\n * A directive that allows you to turn any element into a file upload trigger.\n */\n@Directive({\n selector: '[ngpFileUpload]',\n exportAs: 'ngpFileUpload',\n providers: [provideFileUploadState()],\n host: {\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n '[attr.data-dragover]': 'isDragOver() ? \"\" : null',\n },\n})\nexport class NgpFileUpload {\n /**\n * Access the document\n */\n private readonly document = inject<Document>(DOCUMENT);\n\n /**\n * Access the host element.\n */\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * The accepted file types. This can be an array of strings or a comma-separated string.\n * Accepted types can either be file extensions (e.g. `.jpg`) or MIME types (e.g. `image/jpeg`).\n */\n readonly fileTypes = input<string[], string | string[]>(undefined, {\n alias: 'ngpFileUploadFileTypes',\n transform: types => coerceStringArray(types, ','),\n });\n\n /**\n * Whether to allow multiple files to be selected.\n */\n readonly multiple = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileUploadMultiple',\n transform: booleanAttribute,\n });\n\n /**\n * Whether to allow the user to select directories.\n */\n readonly directory = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileUploadDirectory',\n transform: booleanAttribute,\n });\n\n /**\n * Whether drag-and-drop is enabled.\n */\n readonly dragAndDrop = input<boolean, BooleanInput>(true, {\n alias: 'ngpFileUploadDragDrop',\n transform: booleanAttribute,\n });\n\n /**\n * Whether the file upload is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileUploadDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Emits when the user selects files.\n */\n readonly selected = output<FileList | null>({\n alias: 'ngpFileUploadSelected',\n });\n\n /**\n * Emits when the user cancel the file selection.\n */\n readonly canceled = output<void>({\n alias: 'ngpFileUploadCanceled',\n });\n\n /**\n * Emits when uploaded files are rejected because they do not match the allowed {@link fileTypes}.\n */\n readonly rejected = output<void>({\n alias: 'ngpFileUploadRejected',\n });\n\n /**\n * Emits when the user drags a file over the file upload.\n */\n readonly dragOver = output<boolean>({\n alias: 'ngpFileUploadDragOver',\n });\n\n /**\n * Whether the user is currently dragging a file over the file upload.\n */\n protected readonly isDragOver = signal<boolean>(false);\n\n /**\n * Store the file input element.\n */\n private input: HTMLInputElement = this.document.createElement('input');\n\n /**\n * The file upload state.\n */\n protected readonly state = fileUploadState<NgpFileUpload>(this);\n\n constructor() {\n ngpInteractions({\n hover: true,\n press: true,\n focusVisible: true,\n disabled: this.state.disabled,\n });\n this.input.type = 'file';\n this.input.style.display = 'none';\n this.input.addEventListener('change', () => {\n this.selected.emit(this.input.files);\n // clear the input value to allow re-uploading the same file\n this.input.value = '';\n });\n this.input.addEventListener('cancel', () => this.canceled.emit());\n }\n\n @HostListener('click')\n protected showFileDialog(): void {\n if (this.state.disabled()) {\n return;\n }\n\n const fileTypes = this.state.fileTypes()?.join(',');\n\n if (fileTypes) {\n this.input.accept = fileTypes;\n }\n\n this.input.multiple = this.state.multiple();\n this.input.webkitdirectory = this.state.directory();\n this.input.click();\n }\n\n @HostListener('dragenter', ['$event'])\n protected onDragEnter(event: DragEvent): void {\n if (this.state.disabled() || !this.state.dragAndDrop()) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n this.isDragOver.set(true);\n this.dragOver.emit(true);\n }\n\n @HostListener('dragover', ['$event'])\n protected onDragOver(event: DragEvent): void {\n if (this.state.disabled() || !this.state.dragAndDrop()) {\n return;\n }\n\n event.stopPropagation();\n event.preventDefault();\n this.isDragOver.set(true);\n }\n\n @HostListener('dragleave', ['$event'])\n protected onDragLeave(event: DragEvent): void {\n if (this.state.disabled() || !this.state.dragAndDrop() || !this.isDragOver()) {\n return;\n }\n\n // if the element we are dragging over is a child of the file upload, ignore the event\n if (this.elementRef.nativeElement.contains(event.relatedTarget as Node)) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n this.isDragOver.set(false);\n this.dragOver.emit(false);\n }\n\n @HostListener('drop', ['$event'])\n protected onDrop(event: DragEvent): void {\n if (this.state.disabled() || !this.state.dragAndDrop()) {\n return;\n }\n\n event.preventDefault();\n this.isDragOver.set(false);\n this.dragOver.emit(false);\n\n const fileList = event.dataTransfer?.files;\n if (fileList) {\n const filteredFiles = fileDropFilter(fileList, this.state.fileTypes(), this.state.multiple());\n\n if (filteredFiles) {\n this.selected.emit(filteredFiles);\n } else {\n this.rejected.emit();\n }\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;SAAgB,cAAc,CAC5B,QAAkB,EAClB,aAAmC,EACnC,QAAiB,EAAA;IAEjB,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,kBAAkB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;AAE/F,IAAA,MAAM,YAAY,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;AAEnE,IAAA,OAAO,YAAY,CAAC,MAAM,GAAG,CAAC,GAAG,eAAe,CAAC,YAAY,CAAC,GAAG,IAAI;AACvE;AAEM,SAAU,kBAAkB,CAAC,IAAU,EAAE,aAAmC,EAAA;;AAEhF,IAAA,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC;AAAE,QAAA,OAAO,IAAI;AAE7D,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI;IAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;AAExC,IAAA,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,IAAG;AAC/B,QAAA,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE;AAEzB,QAAA,IAAI,IAAI,CAAC,UAAU,CAAC,G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AA,CAAA;kBATzB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,iBAAiB;AAC3B,oBAAA,QAAQ,EAAE,eAAe;AACzB,oBAAA,SAAS,EAAE,CAAC,sBAAsB,EAAE,CAAC;AACrC,oBAAA,IAAI,EAAE;AACJ,wBAAA,sBAAsB,EAAE,8BAA8B;AACtD,wBAAA,sBAAsB,EAAE,0BAA0B;AACnD,qBAAA;AACF,iBAAA;wDAkHW,cAAc,EAAA,CAAA;sBADvB,YAAY;uBAAC,OAAO;gBAkBX,WAAW,EAAA,CAAA;sBADpB,YAAY;uBAAC,WAAW,EAAE,CAAC,QAAQ,CAAC;gBAa3B,UAAU,EAAA,CAAA;sBADnB,YAAY;uBAAC,UAAU,EAAE,CAAC,QAAQ,CAAC;gBAY1B,WAAW,EAAA,CAAA;sBADpB,YAAY;uBAAC,WAAW,EAAE,CAAC,QAAQ,CAAC;gBAkB3B,MAAM,EAAA,CAAA;sBADf,YAAY;uBAAC,MAAM,EAAE,CAAC,QAAQ,CAAC;;;ACrMlC;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-primitives-file-upload.mjs","sources":["../../../../packages/ng-primitives/file-upload/src/file-dropzone/file-drop-filter.ts","../../../../packages/ng-primitives/file-upload/src/file-dropzone/file-dropzone-state.ts","../../../../packages/ng-primitives/file-upload/src/file-dropzone/file-dropzone.ts","../../../../packages/ng-primitives/file-upload/src/file-upload/file-upload-state.ts","../../../../packages/ng-primitives/file-upload/src/file-upload/file-upload.ts","../../../../packages/ng-primitives/file-upload/src/ng-primitives-file-upload.ts"],"sourcesContent":["export function fileDropFilter(\n fileList: FileList,\n acceptedTypes: string[] | undefined,\n multiple: boolean,\n) {\n const validFiles = Array.from(fileList).filter(file => isFileTypeAccepted(file, acceptedTypes));\n\n const limitedFiles = multiple ? validFiles : validFiles.slice(0, 1);\n\n return limitedFiles.length > 0 ? filesToFileList(limitedFiles) : null;\n}\n\nexport function isFileTypeAccepted(file: File, acceptedTypes: string[] | undefined) {\n // allow all file types if no types are specified\n if (!acceptedTypes || acceptedTypes.length === 0) return true;\n\n const mimeType = file.type;\n const fileName = file.name.toLowerCase();\n\n return acceptedTypes.some(type => {\n type = type.toLowerCase();\n\n if (type.startsWith('.')) {\n return fileName.endsWith(type);\n }\n\n if (type.endsWith('/*')) {\n const baseType = type.replace('/*', '');\n return mimeType.startsWith(baseType);\n }\n\n return mimeType === type;\n });\n}\n\nfunction filesToFileList(files: File[]): FileList {\n const dataTransfer = new DataTransfer();\n files.forEach(file => dataTransfer.items.add(file));\n return dataTransfer.files;\n}\n","import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpFileDropzone } from './file-dropzone';\n\n/**\n * The state token for the FileDropzone primitive.\n */\nexport const NgpFileDropzoneStateToken = createStateToken<NgpFileDropzone>('FileDropzone');\n\n/**\n * Provides the FileDropzone state.\n */\nexport const provideFileDropzoneState = createStateProvider(NgpFileDropzoneStateToken);\n\n/**\n * Injects the FileDropzone state.\n */\nexport const injectFileDropzoneState =\n createStateInjector<NgpFileDropzone>(NgpFileDropzoneStateToken);\n\n/**\n * The FileDropzone state registration function.\n */\nexport const fileDropzoneState = createState(NgpFileDropzoneStateToken);\n","import { BooleanInput, coerceStringArray } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n Directive,\n ElementRef,\n HostListener,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\nimport { ngpHoverInteraction } from 'ng-primitives/interactions';\nimport { fileDropFilter } from './file-drop-filter';\nimport { fileDropzoneState, provideFileDropzoneState } from './file-dropzone-state';\n\n/**\n * Capture files dropped on the element.\n */\n@Directive({\n selector: '[ngpFileDropzone]',\n exportAs: 'ngpFileDropzone',\n providers: [provideFileDropzoneState()],\n host: {\n '[attr.data-dragover]': 'isDragOver() ? \"\" : null',\n '[attr.data-disabled]': 'disabled() ? \"\" : null',\n },\n})\nexport class NgpFileDropzone {\n /**\n * Access the host element.\n */\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * The accepted file types. This can be an array of strings or a comma-separated string.\n * Accepted types can either be file extensions (e.g. `.jpg`) or MIME types (e.g. `image/jpeg`).\n */\n readonly fileTypes = input<string[], string | string[]>(undefined, {\n alias: 'ngpFileDropzoneFileTypes',\n transform: types => coerceStringArray(types, ','),\n });\n\n /**\n * Whether to allow multiple files to be selected.\n */\n readonly multiple = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileDropzoneMultiple',\n transform: booleanAttribute,\n });\n\n /**\n * Whether to allow the user to select directories.\n */\n readonly directory = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileDropzoneDirectory',\n transform: booleanAttribute,\n });\n\n /**\n * Whether the file upload is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileDropzoneDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Emits when the user selects files.\n */\n readonly selected = output<FileList | null>({\n alias: 'ngpFileDropzoneSelected',\n });\n\n /**\n * Emits when uploaded files are rejected because they do not match the allowed {@link fileTypes}.\n */\n readonly rejected = output<void>({\n alias: 'ngpFileDropzoneRejected',\n });\n\n /**\n * Emits when the user drags a file over the file upload.\n */\n readonly dragOver = output<boolean>({\n alias: 'ngpFileDropzoneDragOver',\n });\n\n /**\n * Whether the user is currently dragging a file over the file upload.\n */\n protected readonly isDragOver = signal<boolean>(false);\n\n /**\n * The file upload state.\n */\n private readonly state = fileDropzoneState<NgpFileDropzone>(this);\n\n constructor() {\n ngpHoverInteraction({ disabled: this.state.disabled });\n }\n\n @HostListener('dragenter', ['$event'])\n protected onDragEnter(event: DragEvent): void {\n if (this.state.disabled()) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n this.isDragOver.set(true);\n this.dragOver.emit(true);\n }\n\n @HostListener('dragover', ['$event'])\n protected onDragOver(event: DragEvent): void {\n if (this.state.disabled()) {\n return;\n }\n\n event.stopPropagation();\n event.preventDefault();\n this.isDragOver.set(true);\n }\n\n @HostListener('dragleave', ['$event'])\n protected onDragLeave(event: DragEvent): void {\n if (this.state.disabled() || !this.isDragOver()) {\n return;\n }\n\n // if the element we are dragging over is a child of the file upload, ignore the event\n if (this.elementRef.nativeElement.contains(event.relatedTarget as Node)) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n this.isDragOver.set(false);\n this.dragOver.emit(false);\n }\n\n @HostListener('drop', ['$event'])\n protected onDrop(event: DragEvent): void {\n if (this.state.disabled()) {\n return;\n }\n\n event.preventDefault();\n this.isDragOver.set(false);\n this.dragOver.emit(false);\n\n const fileList = event.dataTransfer?.files;\n if (fileList) {\n const filteredFiles = fileDropFilter(fileList, this.state.fileTypes(), this.state.multiple());\n\n if (filteredFiles) {\n this.selected.emit(filteredFiles);\n } else {\n this.rejected.emit();\n }\n }\n }\n}\n","import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpFileUpload } from './file-upload';\n\n/**\n * The state token for the FileUpload primitive.\n */\nexport const NgpFileUploadStateToken = createStateToken<NgpFileUpload>('FileUpload');\n\n/**\n * Provides the FileUpload state.\n */\nexport const provideFileUploadState = createStateProvider(NgpFileUploadStateToken);\n\n/**\n * Injects the FileUpload state.\n */\nexport const injectFileUploadState = createStateInjector<NgpFileUpload>(NgpFileUploadStateToken);\n\n/**\n * The FileUpload state registration function.\n */\nexport const fileUploadState = createState(NgpFileUploadStateToken);\n","import { BooleanInput, coerceStringArray } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n Directive,\n ElementRef,\n HostListener,\n inject,\n input,\n output,\n signal,\n DOCUMENT,\n} from '@angular/core';\nimport { ngpInteractions } from 'ng-primitives/interactions';\nimport { fileDropFilter } from '../file-dropzone/file-drop-filter';\nimport { fileUploadState, provideFileUploadState } from './file-upload-state';\n\n/**\n * A directive that allows you to turn any element into a file upload trigger.\n */\n@Directive({\n selector: '[ngpFileUpload]',\n exportAs: 'ngpFileUpload',\n providers: [provideFileUploadState()],\n host: {\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n '[attr.data-dragover]': 'isDragOver() ? \"\" : null',\n },\n})\nexport class NgpFileUpload {\n /**\n * Access the document\n */\n private readonly document = inject<Document>(DOCUMENT);\n\n /**\n * Access the host element.\n */\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * The accepted file types. This can be an array of strings or a comma-separated string.\n * Accepted types can either be file extensions (e.g. `.jpg`) or MIME types (e.g. `image/jpeg`).\n */\n readonly fileTypes = input<string[], string | string[]>(undefined, {\n alias: 'ngpFileUploadFileTypes',\n transform: types => coerceStringArray(types, ','),\n });\n\n /**\n * Whether to allow multiple files to be selected.\n */\n readonly multiple = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileUploadMultiple',\n transform: booleanAttribute,\n });\n\n /**\n * Whether to allow the user to select directories.\n */\n readonly directory = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileUploadDirectory',\n transform: booleanAttribute,\n });\n\n /**\n * Whether drag-and-drop is enabled.\n */\n readonly dragAndDrop = input<boolean, BooleanInput>(true, {\n alias: 'ngpFileUploadDragDrop',\n transform: booleanAttribute,\n });\n\n /**\n * Whether the file upload is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileUploadDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Emits when the user selects files.\n */\n readonly selected = output<FileList | null>({\n alias: 'ngpFileUploadSelected',\n });\n\n /**\n * Emits when the user cancel the file selection.\n */\n readonly canceled = output<void>({\n alias: 'ngpFileUploadCanceled',\n });\n\n /**\n * Emits when uploaded files are rejected because they do not match the allowed {@link fileTypes}.\n */\n readonly rejected = output<void>({\n alias: 'ngpFileUploadRejected',\n });\n\n /**\n * Emits when the user drags a file over the file upload.\n */\n readonly dragOver = output<boolean>({\n alias: 'ngpFileUploadDragOver',\n });\n\n /**\n * Whether the user is currently dragging a file over the file upload.\n */\n protected readonly isDragOver = signal<boolean>(false);\n\n /**\n * Store the file input element.\n */\n private input: HTMLInputElement = this.document.createElement('input');\n\n /**\n * The file upload state.\n */\n protected readonly state = fileUploadState<NgpFileUpload>(this);\n\n constructor() {\n ngpInteractions({\n hover: true,\n press: true,\n focusVisible: true,\n disabled: this.state.disabled,\n });\n this.input.type = 'file';\n this.input.style.display = 'none';\n this.input.addEventListener('change', () => {\n this.selected.emit(this.input.files);\n // clear the input value to allow re-uploading the same file\n this.input.value = '';\n });\n this.input.addEventListener('cancel', () => this.canceled.emit());\n }\n\n @HostListener('click')\n protected showFileDialog(): void {\n if (this.state.disabled()) {\n return;\n }\n\n const fileTypes = this.state.fileTypes()?.join(',');\n\n if (fileTypes) {\n this.input.accept = fileTypes;\n }\n\n this.input.multiple = this.state.multiple();\n this.input.webkitdirectory = this.state.directory();\n this.input.click();\n }\n\n @HostListener('dragenter', ['$event'])\n protected onDragEnter(event: DragEvent): void {\n if (this.state.disabled() || !this.state.dragAndDrop()) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n this.isDragOver.set(true);\n this.dragOver.emit(true);\n }\n\n @HostListener('dragover', ['$event'])\n protected onDragOver(event: DragEvent): void {\n if (this.state.disabled() || !this.state.dragAndDrop()) {\n return;\n }\n\n event.stopPropagation();\n event.preventDefault();\n this.isDragOver.set(true);\n }\n\n @HostListener('dragleave', ['$event'])\n protected onDragLeave(event: DragEvent): void {\n if (this.state.disabled() || !this.state.dragAndDrop() || !this.isDragOver()) {\n return;\n }\n\n // if the element we are dragging over is a child of the file upload, ignore the event\n if (this.elementRef.nativeElement.contains(event.relatedTarget as Node)) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n this.isDragOver.set(false);\n this.dragOver.emit(false);\n }\n\n @HostListener('drop', ['$event'])\n protected onDrop(event: DragEvent): void {\n if (this.state.disabled() || !this.state.dragAndDrop()) {\n return;\n }\n\n event.preventDefault();\n this.isDragOver.set(false);\n this.dragOver.emit(false);\n\n const fileList = event.dataTransfer?.files;\n if (fileList) {\n const filteredFiles = fileDropFilter(fileList, this.state.fileTypes(), this.state.multiple());\n\n if (filteredFiles) {\n this.selected.emit(filteredFiles);\n } else {\n this.rejected.emit();\n }\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;SAAgB,cAAc,CAC5B,QAAkB,EAClB,aAAmC,EACnC,QAAiB,EAAA;IAEjB,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,kBAAkB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;AAE/F,IAAA,MAAM,YAAY,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;AAEnE,IAAA,OAAO,YAAY,CAAC,MAAM,GAAG,CAAC,GAAG,eAAe,CAAC,YAAY,CAAC,GAAG,IAAI;AACvE;AAEM,SAAU,kBAAkB,CAAC,IAAU,EAAE,aAAmC,EAAA;;AAEhF,IAAA,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC;AAAE,QAAA,OAAO,IAAI;AAE7D,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI;IAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;AAExC,IAAA,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,IAAG;AAC/B,QAAA,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE;AAEzB,QAAA,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;AACxB,YAAA,OAAO,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC;QAChC;AAEA,QAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YACvB,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;AACvC,YAAA,OAAO,QA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I,EAAE;AACJ,wBAAA,sBAAsB,EAAE,8BAA8B;AACtD,wBAAA,sBAAsB,EAAE,0BAA0B;AACnD,qBAAA;AACF,iBAAA;;sBAiHE,YAAY;uBAAC,OAAO;;sBAiBpB,YAAY;uBAAC,WAAW,EAAE,CAAC,QAAQ,CAAC;;sBAYpC,YAAY;uBAAC,UAAU,EAAE,CAAC,QAAQ,CAAC;;sBAWnC,YAAY;uBAAC,WAAW,EAAE,CAAC,QAAQ,CAAC;;sBAiBpC,YAAY;uBAAC,MAAM,EAAE,CAAC,QAAQ,CAAC;;;ACrMlC;;AAEG;;;;"}
@@ -125,10 +125,11 @@ class NgpFocusTrap {
125
125
  /**
126
126
  * Whether the focus trap is disabled.
127
127
  */
128
- this.disabled = input(false, {
129
- alias: 'ngpFocusTrapDisabled',
130
- transform: booleanAttribute,
131
- });
128
+ this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", alias: 'ngpFocusTrapDisabled',
129
+ transform: booleanAttribute }] : [{
130
+ alias: 'ngpFocusTrapDisabled',
131
+ transform: booleanAttribute,
132
+ }]));
132
133
  /**
133
134
  * The focus trap state.
134
135
  */
@@ -291,10 +292,10 @@ class NgpFocusTrap {
291
292
  }
292
293
  }
293
294
  }
294
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpFocusTrap, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
295
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.11", type: NgpFocusTrap, isStandalone: true, selector: "[ngpFocusTrap]", inputs: { disabled: { classPropertyName: "disabled", publicName: "ngpFocusTrapDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "keydown": "handleKeyDown($event)" }, properties: { "attr.tabindex": "-1", "attr.data-focus-trap": "!disabled() ? \"\" : null" } }, providers: [provideFocusTrapState()], exportAs: ["ngpFocusTrap"], ngImport: i0 }); }
295
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpFocusTrap, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
296
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.9", type: NgpFocusTrap, isStandalone: true, selector: "[ngpFocusTrap]", inputs: { disabled: { classPropertyName: "disabled", publicName: "ngpFocusTrapDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "keydown": "handleKeyDown($event)" }, properties: { "attr.tabindex": "-1", "attr.data-focus-trap": "!disabled() ? \"\" : null" } }, providers: [provideFocusTrapState()], exportAs: ["ngpFocusTrap"], ngImport: i0 }); }
296
297
  }
297
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpFocusTrap, decorators: [{
298
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpFocusTrap, decorators: [{
298
299
  type: Directive,
299
300
  args: [{
300
301
  selector: '[ngpFocusTrap]',
@@ -305,7 +306,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImpo
305
306
  '[attr.data-focus-trap]': '!disabled() ? "" : null',
306
307
  },
307
308
  }]
308
- }], ctorParameters: () => [], propDecorators: { handleKeyDown: [{
309
+ }], ctorParameters: () => [], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpFocusTrapDisabled", required: false }] }], handleKeyDown: [{
309
310
  type: HostListener,
310
311
  args: ['keydown', ['$event']]
311
312
  }] } });
@@ -1 +1 @@
1
- {"version":3,"file":"ng-primitives-focus-trap.mjs","sources":["../../../../packages/ng-primitives/focus-trap/src/focus-trap/focus-trap-state.ts","../../../../packages/ng-primitives/focus-trap/src/focus-trap/focus-trap.ts","../../../../packages/ng-primitives/focus-trap/src/ng-primitives-focus-trap.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpFocusTrap } from './focus-trap';\n\n/**\n * The state token for the FocusTrap primitive.\n */\nexport const NgpFocusTrapStateToken = createStateToken<NgpFocusTrap>('FocusTrap');\n\n/**\n * Provides the FocusTrap state.\n */\nexport const provideFocusTrapState = createStateProvider(NgpFocusTrapStateToken);\n\n/**\n * Injects the FocusTrap state.\n */\nexport const injectFocusTrapState = createStateInjector<NgpFocusTrap>(NgpFocusTrapStateToken);\n\n/**\n * The FocusTrap state registration function.\n */\nexport const focusTrapState = createState(NgpFocusTrapStateToken);\n","import { FocusMonitor, InteractivityChecker } from '@angular/cdk/a11y';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport {\n afterNextRender,\n booleanAttribute,\n Directive,\n ElementRef,\n HostListener,\n inject,\n Injector,\n input,\n NgZone,\n OnDestroy,\n OnInit,\n} from '@angular/core';\nimport { NgpOverlay } from 'ng-primitives/portal';\nimport { safeTakeUntilDestroyed } from 'ng-primitives/utils';\nimport { focusTrapState, provideFocusTrapState } from './focus-trap-state';\n\n/**\n * This implementation is based on the Radix UI FocusScope:\n * https://github.com/radix-ui/primitives/blob/main/packages/react/focus-scope/src/FocusScope.tsx#L306\n */\n\nclass FocusTrap {\n /**\n * Whether the focus trap is active.\n */\n active: boolean = false;\n\n /**\n * Activates the focus trap.\n */\n activate(): void {\n this.active = true;\n }\n\n /**\n * Deactivates the focus trap.\n */\n deactivate(): void {\n this.active = false;\n }\n}\n\nclass FocusTrapStack {\n /**\n * The stack of focus traps.\n */\n private readonly stack: FocusTrap[] = [];\n\n /**\n * Adds a focus trap to the stack.\n */\n add(focusTrap: FocusTrap): void {\n // deactivate the previous focus trap\n this.stack.forEach(t => t.deactivate());\n\n // add the new focus trap and activate it\n this.stack.push(focusTrap);\n focusTrap.activate();\n }\n\n /**\n * Removes a focus trap from the stack.\n */\n remove(focusTrap: FocusTrap): void {\n // remove the focus trap\n const index = this.stack.indexOf(focusTrap);\n\n if (index >= 0) {\n this.stack.splice(index, 1);\n }\n\n // activate the previous focus trap\n const previous = this.stack[this.stack.length - 1];\n\n if (previous) {\n previous.activate();\n }\n }\n}\n\n// create a global stack of focus traps\nconst focusTrapStack = new FocusTrapStack();\n\n/**\n * The `NgpFocusTrap` directive traps focus within the host element.\n */\n@Directive({\n selector: '[ngpFocusTrap]',\n exportAs: 'ngpFocusTrap',\n providers: [provideFocusTrapState()],\n host: {\n '[attr.tabindex]': '-1',\n '[attr.data-focus-trap]': '!disabled() ? \"\" : null',\n },\n})\nexport class NgpFocusTrap implements OnInit, OnDestroy {\n /**\n * Access any parent overlay.\n */\n private readonly overlay = inject(NgpOverlay, { optional: true });\n\n /**\n * Create a new focus trap.\n */\n private readonly focusTrap = new FocusTrap();\n\n /**\n * Access the injector.\n */\n private readonly injector = inject(Injector);\n\n /**\n * Access the focus monitor.\n */\n private readonly focusMonitor = inject(FocusMonitor);\n\n /**\n * Access the interactivity checker.\n */\n private readonly interactivityChecker = inject(InteractivityChecker);\n\n /**\n * Get the focus trap container element.\n */\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Access NgZone to run the focus trap events outside of Angular's zone.\n */\n private readonly ngZone = inject(NgZone);\n\n /**\n * Store the mutation observer.\n */\n private mutationObserver: MutationObserver | null = null;\n\n /**\n * Store the last focused element.\n */\n private lastFocusedElement: HTMLElement | null = null;\n\n /**\n * Whether the focus trap is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpFocusTrapDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * The focus trap state.\n */\n protected readonly state = focusTrapState<NgpFocusTrap>(this);\n\n constructor() {\n // if this is used within an overlay we must disable the focus trap as soon as the overlay is closing\n this.overlay?.closing\n .pipe(safeTakeUntilDestroyed())\n .subscribe(() => this.focusTrap.deactivate());\n }\n\n ngOnInit(): void {\n focusTrapStack.add(this.focusTrap);\n\n this.mutationObserver = new MutationObserver(this.handleMutations.bind(this));\n\n // setup event listeners\n this.ngZone.runOutsideAngular(() => {\n this.mutationObserver!.observe(this.elementRef.nativeElement, {\n childList: true,\n subtree: true,\n });\n document.addEventListener('focusin', this.handleFocusIn.bind(this));\n document.addEventListener('focusout', this.handleFocusOut.bind(this));\n });\n\n const previouslyFocusedElement = document.activeElement as HTMLElement | null;\n const hasFocusedCandidate = this.elementRef.nativeElement.contains(previouslyFocusedElement);\n\n if (!hasFocusedCandidate) {\n // we do this to ensure the content is rendered before we try to find the first focusable element\n // and focus it\n afterNextRender(\n {\n write: () => {\n this.focusFirst();\n\n // if the focus didn't change, focus the container\n if (document.activeElement === previouslyFocusedElement) {\n this.focus(this.elementRef.nativeElement);\n }\n },\n },\n { injector: this.injector },\n );\n }\n }\n\n ngOnDestroy(): void {\n focusTrapStack.remove(this.focusTrap);\n this.mutationObserver?.disconnect();\n this.mutationObserver = null;\n this.focusTrap.deactivate();\n }\n\n private handleFocusIn(event: FocusEvent): void {\n if (!this.focusTrap.active || this.state.disabled()) {\n return;\n }\n\n const target = event.target as HTMLElement | null;\n\n if (this.elementRef.nativeElement.contains(target)) {\n this.lastFocusedElement = target;\n } else {\n this.focus(this.lastFocusedElement);\n }\n }\n\n /**\n * Handles the `focusout` event.\n */\n private handleFocusOut(event: FocusEvent) {\n if (!this.focusTrap.active || this.state.disabled() || event.relatedTarget === null) {\n return;\n }\n\n const relatedTarget = event.relatedTarget as HTMLElement;\n\n if (!this.elementRef.nativeElement.contains(relatedTarget)) {\n this.focus(this.lastFocusedElement);\n }\n }\n\n /**\n * If the focused element gets removed from the DOM, browsers move focus back to the document.body.\n * We move focus to the container to keep focus trapped correctly.\n */\n private handleMutations(mutations: MutationRecord[]): void {\n const focusedElement = document.activeElement as HTMLElement | null;\n\n if (focusedElement !== document.body) {\n return;\n }\n\n for (const mutation of mutations) {\n if (mutation.removedNodes.length > 0) {\n this.focus(this.elementRef.nativeElement);\n }\n }\n }\n\n /**\n * Handles the `keydown` event.\n */\n @HostListener('keydown', ['$event'])\n protected handleKeyDown(event: KeyboardEvent): void {\n if (!this.focusTrap.active || this.state.disabled()) {\n return;\n }\n\n const isTabKey = event.key === 'Tab' && !event.altKey && !event.ctrlKey && !event.metaKey;\n const focusedElement = document.activeElement as HTMLElement | null;\n\n if (isTabKey && focusedElement) {\n const container = event.currentTarget as HTMLElement;\n const [first, last] = this.getTabbableEdges(container);\n const hasTabbableElementsInside = first && last;\n\n // we can only wrap focus if we have tabbable edges\n if (!hasTabbableElementsInside) {\n if (focusedElement === container) {\n event.preventDefault();\n }\n } else {\n if (!event.shiftKey && focusedElement === last) {\n event.preventDefault();\n this.focus(first);\n } else if (event.shiftKey && focusedElement === first) {\n event.preventDefault();\n this.focus(last);\n }\n }\n }\n }\n\n /**\n * Returns the first and last tabbable elements inside a container.\n */\n private getTabbableEdges(container: HTMLElement) {\n const candidates = this.getTabbableCandidates(container);\n const first = this.findVisible(candidates);\n const last = this.findVisible(candidates.reverse());\n return [first, last] as const;\n }\n\n /**\n * Returns a list of potential focusable elements inside a container.\n */\n private getTabbableCandidates(container: HTMLElement) {\n const nodes: HTMLElement[] = [];\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode: (node: HTMLElement) =>\n this.interactivityChecker.isFocusable(node)\n ? NodeFilter.FILTER_ACCEPT\n : NodeFilter.FILTER_SKIP,\n });\n while (walker.nextNode()) {\n nodes.push(walker.currentNode as HTMLElement);\n }\n return nodes;\n }\n\n /**\n * Returns the first visible element in a list..\n */\n private findVisible(elements: HTMLElement[]) {\n return elements.find(element => this.interactivityChecker.isVisible(element)) ?? null;\n }\n\n private focus(element: HTMLElement | null): void {\n if (!element) {\n return;\n }\n // Its not great that we are relying on an internal API here, but we need to in order to\n // try and best determine the focus origin when it is programmatically closed by the user.\n this.focusMonitor.focusVia(element, (this.focusMonitor as any)._lastFocusOrigin, {\n preventScroll: true,\n });\n }\n\n private focusFirst(): void {\n const previouslyFocusedElement = document.activeElement;\n\n for (const candidate of this.getTabbableCandidates(this.elementRef.nativeElement)) {\n this.focus(candidate);\n\n if (document.activeElement !== previouslyFocusedElement) {\n return;\n }\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAQA;;AAEG;AACI,MAAM,sBAAsB,GAAG,gBAAgB,CAAe,WAAW,CAAC;AAEjF;;AAEG;MACU,qBAAqB,GAAG,mBAAmB,CAAC,sBAAsB;AAE/E;;AAEG;MACU,oBAAoB,GAAG,mBAAmB,CAAe,sBAAsB;AAE5F;;AAEG;AACI,MAAM,cAAc,GAAG,WAAW,CAAC,sBAAsB,CAAC;;ACPjE;;;AAGG;AAEH,MAAM,SAAS,CAAA;AAAf,IAAA,WAAA,GAAA;AACE;;AAEG;QACH,IAAA,CAAA,MAAM,GAAY,KAAK;IAezB;AAbE;;AAEG;IACH,QAAQ,GAAA;AACN,QAAA,IAAI,CAAC,MAAM,GAAG,IAAI;IACpB;AAEA;;AAEG;IACH,UAAU,GAAA;AACR,QAAA,IAAI,CAAC,MAAM,GAAG,KAAK;IACrB;AACD;AAED,MAAM,cAAc,CAAA;AAApB,IAAA,WAAA,GAAA;AACE;;AAEG;QACc,IAAA,CAAA,KAAK,GAAgB,EAAE;IAgC1C;AA9BE;;AAEG;AACH,IAAA,GAAG,CAAC,SAAoB,EAAA;;AAEtB,QAAA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;;AAGvC,QAAA,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;QAC1B,SAAS,CAAC,QAAQ,EAAE;IACtB;AAEA;;AAEG;AACH,IAAA,MAAM,CAAC,SAAoB,EAAA;;QAEzB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;AAE3C,QAAA,IAAI,KAAK,IAAI,CAAC,EAAE;YACd,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC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AAE;AACJ,wBAAA,iBAAiB,EAAE,IAAI;AACvB,wBAAA,wBAAwB,EAAE,yBAAyB;AACpD,qBAAA;AACF,iBAAA;wDAkKW,aAAa,EAAA,CAAA;sBADtB,YAAY;uBAAC,SAAS,EAAE,CAAC,QAAQ,CAAC;;;AClQrC;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-primitives-focus-trap.mjs","sources":["../../../../packages/ng-primitives/focus-trap/src/focus-trap/focus-trap-state.ts","../../../../packages/ng-primitives/focus-trap/src/focus-trap/focus-trap.ts","../../../../packages/ng-primitives/focus-trap/src/ng-primitives-focus-trap.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpFocusTrap } from './focus-trap';\n\n/**\n * The state token for the FocusTrap primitive.\n */\nexport const NgpFocusTrapStateToken = createStateToken<NgpFocusTrap>('FocusTrap');\n\n/**\n * Provides the FocusTrap state.\n */\nexport const provideFocusTrapState = createStateProvider(NgpFocusTrapStateToken);\n\n/**\n * Injects the FocusTrap state.\n */\nexport const injectFocusTrapState = createStateInjector<NgpFocusTrap>(NgpFocusTrapStateToken);\n\n/**\n * The FocusTrap state registration function.\n */\nexport const focusTrapState = createState(NgpFocusTrapStateToken);\n","import { FocusMonitor, InteractivityChecker } from '@angular/cdk/a11y';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport {\n afterNextRender,\n booleanAttribute,\n Directive,\n ElementRef,\n HostListener,\n inject,\n Injector,\n input,\n NgZone,\n OnDestroy,\n OnInit,\n} from '@angular/core';\nimport { NgpOverlay } from 'ng-primitives/portal';\nimport { safeTakeUntilDestroyed } from 'ng-primitives/utils';\nimport { focusTrapState, provideFocusTrapState } from './focus-trap-state';\n\n/**\n * This implementation is based on the Radix UI FocusScope:\n * https://github.com/radix-ui/primitives/blob/main/packages/react/focus-scope/src/FocusScope.tsx#L306\n */\n\nclass FocusTrap {\n /**\n * Whether the focus trap is active.\n */\n active: boolean = false;\n\n /**\n * Activates the focus trap.\n */\n activate(): void {\n this.active = true;\n }\n\n /**\n * Deactivates the focus trap.\n */\n deactivate(): void {\n this.active = false;\n }\n}\n\nclass FocusTrapStack {\n /**\n * The stack of focus traps.\n */\n private readonly stack: FocusTrap[] = [];\n\n /**\n * Adds a focus trap to the stack.\n */\n add(focusTrap: FocusTrap): void {\n // deactivate the previous focus trap\n this.stack.forEach(t => t.deactivate());\n\n // add the new focus trap and activate it\n this.stack.push(focusTrap);\n focusTrap.activate();\n }\n\n /**\n * Removes a focus trap from the stack.\n */\n remove(focusTrap: FocusTrap): void {\n // remove the focus trap\n const index = this.stack.indexOf(focusTrap);\n\n if (index >= 0) {\n this.stack.splice(index, 1);\n }\n\n // activate the previous focus trap\n const previous = this.stack[this.stack.length - 1];\n\n if (previous) {\n previous.activate();\n }\n }\n}\n\n// create a global stack of focus traps\nconst focusTrapStack = new FocusTrapStack();\n\n/**\n * The `NgpFocusTrap` directive traps focus within the host element.\n */\n@Directive({\n selector: '[ngpFocusTrap]',\n exportAs: 'ngpFocusTrap',\n providers: [provideFocusTrapState()],\n host: {\n '[attr.tabindex]': '-1',\n '[attr.data-focus-trap]': '!disabled() ? \"\" : null',\n },\n})\nexport class NgpFocusTrap implements OnInit, OnDestroy {\n /**\n * Access any parent overlay.\n */\n private readonly overlay = inject(NgpOverlay, { optional: true });\n\n /**\n * Create a new focus trap.\n */\n private readonly focusTrap = new FocusTrap();\n\n /**\n * Access the injector.\n */\n private readonly injector = inject(Injector);\n\n /**\n * Access the focus monitor.\n */\n private readonly focusMonitor = inject(FocusMonitor);\n\n /**\n * Access the interactivity checker.\n */\n private readonly interactivityChecker = inject(InteractivityChecker);\n\n /**\n * Get the focus trap container element.\n */\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Access NgZone to run the focus trap events outside of Angular's zone.\n */\n private readonly ngZone = inject(NgZone);\n\n /**\n * Store the mutation observer.\n */\n private mutationObserver: MutationObserver | null = null;\n\n /**\n * Store the last focused element.\n */\n private lastFocusedElement: HTMLElement | null = null;\n\n /**\n * Whether the focus trap is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpFocusTrapDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * The focus trap state.\n */\n protected readonly state = focusTrapState<NgpFocusTrap>(this);\n\n constructor() {\n // if this is used within an overlay we must disable the focus trap as soon as the overlay is closing\n this.overlay?.closing\n .pipe(safeTakeUntilDestroyed())\n .subscribe(() => this.focusTrap.deactivate());\n }\n\n ngOnInit(): void {\n focusTrapStack.add(this.focusTrap);\n\n this.mutationObserver = new MutationObserver(this.handleMutations.bind(this));\n\n // setup event listeners\n this.ngZone.runOutsideAngular(() => {\n this.mutationObserver!.observe(this.elementRef.nativeElement, {\n childList: true,\n subtree: true,\n });\n document.addEventListener('focusin', this.handleFocusIn.bind(this));\n document.addEventListener('focusout', this.handleFocusOut.bind(this));\n });\n\n const previouslyFocusedElement = document.activeElement as HTMLElement | null;\n const hasFocusedCandidate = this.elementRef.nativeElement.contains(previouslyFocusedElement);\n\n if (!hasFocusedCandidate) {\n // we do this to ensure the content is rendered before we try to find the first focusable element\n // and focus it\n afterNextRender(\n {\n write: () => {\n this.focusFirst();\n\n // if the focus didn't change, focus the container\n if (document.activeElement === previouslyFocusedElement) {\n this.focus(this.elementRef.nativeElement);\n }\n },\n },\n { injector: this.injector },\n );\n }\n }\n\n ngOnDestroy(): void {\n focusTrapStack.remove(this.focusTrap);\n this.mutationObserver?.disconnect();\n this.mutationObserver = null;\n this.focusTrap.deactivate();\n }\n\n private handleFocusIn(event: FocusEvent): void {\n if (!this.focusTrap.active || this.state.disabled()) {\n return;\n }\n\n const target = event.target as HTMLElement | null;\n\n if (this.elementRef.nativeElement.contains(target)) {\n this.lastFocusedElement = target;\n } else {\n this.focus(this.lastFocusedElement);\n }\n }\n\n /**\n * Handles the `focusout` event.\n */\n private handleFocusOut(event: FocusEvent) {\n if (!this.focusTrap.active || this.state.disabled() || event.relatedTarget === null) {\n return;\n }\n\n const relatedTarget = event.relatedTarget as HTMLElement;\n\n if (!this.elementRef.nativeElement.contains(relatedTarget)) {\n this.focus(this.lastFocusedElement);\n }\n }\n\n /**\n * If the focused element gets removed from the DOM, browsers move focus back to the document.body.\n * We move focus to the container to keep focus trapped correctly.\n */\n private handleMutations(mutations: MutationRecord[]): void {\n const focusedElement = document.activeElement as HTMLElement | null;\n\n if (focusedElement !== document.body) {\n return;\n }\n\n for (const mutation of mutations) {\n if (mutation.removedNodes.length > 0) {\n this.focus(this.elementRef.nativeElement);\n }\n }\n }\n\n /**\n * Handles the `keydown` event.\n */\n @HostListener('keydown', ['$event'])\n protected handleKeyDown(event: KeyboardEvent): void {\n if (!this.focusTrap.active || this.state.disabled()) {\n return;\n }\n\n const isTabKey = event.key === 'Tab' && !event.altKey && !event.ctrlKey && !event.metaKey;\n const focusedElement = document.activeElement as HTMLElement | null;\n\n if (isTabKey && focusedElement) {\n const container = event.currentTarget as HTMLElement;\n const [first, last] = this.getTabbableEdges(container);\n const hasTabbableElementsInside = first && last;\n\n // we can only wrap focus if we have tabbable edges\n if (!hasTabbableElementsInside) {\n if (focusedElement === container) {\n event.preventDefault();\n }\n } else {\n if (!event.shiftKey && focusedElement === last) {\n event.preventDefault();\n this.focus(first);\n } else if (event.shiftKey && focusedElement === first) {\n event.preventDefault();\n this.focus(last);\n }\n }\n }\n }\n\n /**\n * Returns the first and last tabbable elements inside a container.\n */\n private getTabbableEdges(container: HTMLElement) {\n const candidates = this.getTabbableCandidates(container);\n const first = this.findVisible(candidates);\n const last = this.findVisible(candidates.reverse());\n return [first, last] as const;\n }\n\n /**\n * Returns a list of potential focusable elements inside a container.\n */\n private getTabbableCandidates(container: HTMLElement) {\n const nodes: HTMLElement[] = [];\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode: (node: HTMLElement) =>\n this.interactivityChecker.isFocusable(node)\n ? NodeFilter.FILTER_ACCEPT\n : NodeFilter.FILTER_SKIP,\n });\n while (walker.nextNode()) {\n nodes.push(walker.currentNode as HTMLElement);\n }\n return nodes;\n }\n\n /**\n * Returns the first visible element in a list..\n */\n private findVisible(elements: HTMLElement[]) {\n return elements.find(element => this.interactivityChecker.isVisible(element)) ?? null;\n }\n\n private focus(element: HTMLElement | null): void {\n if (!element) {\n return;\n }\n // Its not great that we are relying on an internal API here, but we need to in order to\n // try and best determine the focus origin when it is programmatically closed by the user.\n this.focusMonitor.focusVia(element, (this.focusMonitor as any)._lastFocusOrigin, {\n preventScroll: true,\n });\n }\n\n private focusFirst(): void {\n const previouslyFocusedElement = document.activeElement;\n\n for (const candidate of this.getTabbableCandidates(this.elementRef.nativeElement)) {\n this.focus(candidate);\n\n if (document.activeElement !== previouslyFocusedElement) {\n return;\n }\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAQA;;AAEG;AACI,MAAM,sBAAsB,GAAG,gBAAgB,CAAe,WAAW,CAAC;AAEjF;;AAEG;MACU,qBAAqB,GAAG,mBAAmB,CAAC,sBAAsB;AAE/E;;AAEG;MACU,oBAAoB,GAAG,mBAAmB,CAAe,sBAAsB;AAE5F;;AAEG;AACI,MAAM,cAAc,GAAG,WAAW,CAAC,sBAAsB,CAAC;;ACPjE;;;AAGG;AAEH,MAAM,SAAS,CAAA;AAAf,IAAA,WAAA,GAAA;AACE;;AAEG;QACH,IAAA,CAAA,MAAM,GAAY,KAAK;IAezB;AAbE;;AAEG;IACH,QAAQ,GAAA;AACN,QAAA,IAAI,CAAC,MAAM,GAAG,IAAI;IACpB;AAEA;;AAEG;IACH,UAAU,GAAA;AACR,QAAA,IAAI,CAAC,MAAM,GAAG,KAAK;IACrB;AACD;AAED,MAAM,cAAc,CAAA;AAApB,IAAA,WAAA,GAAA;AACE;;AAEG;QACc,IAAA,CAAA,KAAK,GAAgB,EAAE;IAgC1C;AA9BE;;AAEG;AACH,IAAA,GAAG,CAAC,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