@taiga-ui/core 4.52.0-canary.91aeb4a → 4.52.0-canary.9471234

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 (318) hide show
  1. package/README.md +1 -1
  2. package/classes/accessors.d.ts +2 -2
  3. package/components/calendar/calendar-sheet.component.d.ts +1 -1
  4. package/components/calendar/calendar-sheet.options.d.ts +1 -3
  5. package/{pipes/calendar-sheet → components/calendar}/calendar-sheet.pipe.d.ts +2 -2
  6. package/components/calendar/calendar-spin.component.d.ts +1 -0
  7. package/components/calendar/calendar-year.component.d.ts +1 -1
  8. package/components/calendar/calendar.options.d.ts +9 -0
  9. package/components/calendar/index.d.ts +3 -0
  10. package/{pipes/order-week-days → components/calendar}/order-week-days.pipe.d.ts +1 -1
  11. package/components/data-list/data-list.component.d.ts +7 -11
  12. package/components/data-list/data-list.d.ts +3 -4
  13. package/components/data-list/data-list.tokens.d.ts +1 -23
  14. package/components/data-list/index.d.ts +3 -4
  15. package/components/data-list/opt-group.directive.d.ts +2 -2
  16. package/components/data-list/option-content.directive.d.ts +14 -0
  17. package/components/data-list/option-with-value.directive.d.ts +9 -0
  18. package/components/data-list/option.directive.d.ts +19 -0
  19. package/components/icon/icon.component.d.ts +2 -2
  20. package/components/index.d.ts +2 -4
  21. package/components/input/index.d.ts +2 -0
  22. package/components/input/input.d.ts +5 -0
  23. package/components/input/input.directive.d.ts +29 -0
  24. package/components/label/label.directive.d.ts +1 -1
  25. package/components/link/index.d.ts +0 -1
  26. package/components/link/link.directive.d.ts +8 -6
  27. package/components/loader/loader.options.d.ts +1 -3
  28. package/components/notification/index.d.ts +3 -0
  29. package/components/notification/notification.component.d.ts +14 -0
  30. package/components/notification/notification.d.ts +3 -0
  31. package/components/notification/notification.directive.d.ts +5 -6
  32. package/components/notification/notification.options.d.ts +10 -7
  33. package/components/notification/notification.service.d.ts +17 -0
  34. package/components/root/root.component.d.ts +1 -1
  35. package/components/scrollbar/scroll-ref.directive.d.ts +2 -0
  36. package/components/scrollbar/scrollbar.component.d.ts +1 -5
  37. package/components/spin-button/spin-button.component.d.ts +1 -1
  38. package/components/textfield/index.d.ts +0 -1
  39. package/components/textfield/select-like.directive.d.ts +1 -0
  40. package/components/textfield/textfield-multi/textfield-item.component.d.ts +3 -2
  41. package/components/textfield/textfield-multi/textfield-multi.component.d.ts +8 -13
  42. package/components/textfield/textfield.component.d.ts +20 -33
  43. package/components/textfield/textfield.d.ts +2 -3
  44. package/directives/appearance/appearance.directive.d.ts +1 -1
  45. package/directives/appearance/appearance.options.d.ts +1 -2
  46. package/directives/button-x/button-x.directive.d.ts +6 -0
  47. package/directives/button-x/index.d.ts +1 -0
  48. package/directives/date-format/date-format.directive.d.ts +3 -7
  49. package/directives/group/group.directive.d.ts +7 -7
  50. package/directives/group/group.options.d.ts +1 -3
  51. package/directives/index.d.ts +1 -5
  52. package/directives/items-handlers/items-handlers.directive.d.ts +5 -9
  53. package/directives/items-handlers/items-handlers.tokens.d.ts +4 -4
  54. package/directives/number-format/number-format.directive.d.ts +3 -7
  55. package/fesm2022/taiga-ui-core-classes.mjs +9 -11
  56. package/fesm2022/taiga-ui-core-classes.mjs.map +1 -1
  57. package/fesm2022/taiga-ui-core-components-button.mjs +7 -7
  58. package/fesm2022/taiga-ui-core-components-button.mjs.map +1 -1
  59. package/fesm2022/taiga-ui-core-components-calendar.mjs +138 -37
  60. package/fesm2022/taiga-ui-core-components-calendar.mjs.map +1 -1
  61. package/fesm2022/taiga-ui-core-components-cell.mjs +7 -7
  62. package/fesm2022/taiga-ui-core-components-cell.mjs.map +1 -1
  63. package/fesm2022/taiga-ui-core-components-data-list.mjs +111 -280
  64. package/fesm2022/taiga-ui-core-components-data-list.mjs.map +1 -1
  65. package/fesm2022/taiga-ui-core-components-error.mjs +12 -11
  66. package/fesm2022/taiga-ui-core-components-error.mjs.map +1 -1
  67. package/fesm2022/taiga-ui-core-components-expand.mjs +3 -3
  68. package/fesm2022/taiga-ui-core-components-icon.mjs +10 -11
  69. package/fesm2022/taiga-ui-core-components-icon.mjs.map +1 -1
  70. package/fesm2022/taiga-ui-core-components-input.mjs +100 -0
  71. package/fesm2022/taiga-ui-core-components-input.mjs.map +1 -0
  72. package/fesm2022/taiga-ui-core-components-label.mjs +11 -13
  73. package/fesm2022/taiga-ui-core-components-label.mjs.map +1 -1
  74. package/fesm2022/taiga-ui-core-components-link.mjs +13 -28
  75. package/fesm2022/taiga-ui-core-components-link.mjs.map +1 -1
  76. package/fesm2022/taiga-ui-core-components-loader.mjs +10 -16
  77. package/fesm2022/taiga-ui-core-components-loader.mjs.map +1 -1
  78. package/fesm2022/taiga-ui-core-components-notification.mjs +99 -29
  79. package/fesm2022/taiga-ui-core-components-notification.mjs.map +1 -1
  80. package/fesm2022/taiga-ui-core-components-root.mjs +11 -15
  81. package/fesm2022/taiga-ui-core-components-root.mjs.map +1 -1
  82. package/fesm2022/taiga-ui-core-components-scrollbar.mjs +45 -54
  83. package/fesm2022/taiga-ui-core-components-scrollbar.mjs.map +1 -1
  84. package/fesm2022/taiga-ui-core-components-spin-button.mjs +6 -6
  85. package/fesm2022/taiga-ui-core-components-spin-button.mjs.map +1 -1
  86. package/fesm2022/taiga-ui-core-components-textfield.mjs +130 -291
  87. package/fesm2022/taiga-ui-core-components-textfield.mjs.map +1 -1
  88. package/fesm2022/{taiga-ui-core-directives-title.mjs → taiga-ui-core-components-title.mjs} +8 -8
  89. package/fesm2022/{taiga-ui-core-directives-title.mjs.map → taiga-ui-core-components-title.mjs.map} +1 -1
  90. package/fesm2022/taiga-ui-core-components.mjs +2 -4
  91. package/fesm2022/taiga-ui-core-components.mjs.map +1 -1
  92. package/fesm2022/taiga-ui-core-directives-appearance.mjs +16 -16
  93. package/fesm2022/taiga-ui-core-directives-appearance.mjs.map +1 -1
  94. package/fesm2022/taiga-ui-core-directives-button-x.mjs +51 -0
  95. package/fesm2022/taiga-ui-core-directives-button-x.mjs.map +1 -0
  96. package/fesm2022/taiga-ui-core-directives-date-format.mjs +26 -20
  97. package/fesm2022/taiga-ui-core-directives-date-format.mjs.map +1 -1
  98. package/fesm2022/taiga-ui-core-directives-group.mjs +23 -35
  99. package/fesm2022/taiga-ui-core-directives-group.mjs.map +1 -1
  100. package/fesm2022/taiga-ui-core-directives-icons.mjs +12 -12
  101. package/fesm2022/taiga-ui-core-directives-icons.mjs.map +1 -1
  102. package/fesm2022/taiga-ui-core-directives-items-handlers.mjs +16 -40
  103. package/fesm2022/taiga-ui-core-directives-items-handlers.mjs.map +1 -1
  104. package/fesm2022/taiga-ui-core-directives-number-format.mjs +32 -20
  105. package/fesm2022/taiga-ui-core-directives-number-format.mjs.map +1 -1
  106. package/fesm2022/taiga-ui-core-directives.mjs +1 -5
  107. package/fesm2022/taiga-ui-core-directives.mjs.map +1 -1
  108. package/fesm2022/taiga-ui-core-pipes-format-number.mjs +21 -15
  109. package/fesm2022/taiga-ui-core-pipes-format-number.mjs.map +1 -1
  110. package/fesm2022/taiga-ui-core-pipes.mjs +0 -7
  111. package/fesm2022/taiga-ui-core-pipes.mjs.map +1 -1
  112. package/fesm2022/taiga-ui-core-portals-alert.mjs +73 -0
  113. package/fesm2022/taiga-ui-core-portals-alert.mjs.map +1 -0
  114. package/fesm2022/taiga-ui-core-portals-dialog.mjs +159 -0
  115. package/fesm2022/taiga-ui-core-portals-dialog.mjs.map +1 -0
  116. package/fesm2022/{taiga-ui-core-directives-dropdown.mjs → taiga-ui-core-portals-dropdown.mjs} +224 -352
  117. package/fesm2022/taiga-ui-core-portals-dropdown.mjs.map +1 -0
  118. package/fesm2022/{taiga-ui-core-directives-hint.mjs → taiga-ui-core-portals-hint.mjs} +105 -164
  119. package/fesm2022/taiga-ui-core-portals-hint.mjs.map +1 -0
  120. package/fesm2022/taiga-ui-core-portals-modal.mjs +89 -0
  121. package/fesm2022/taiga-ui-core-portals-modal.mjs.map +1 -0
  122. package/fesm2022/{taiga-ui-core-directives-popup.mjs → taiga-ui-core-portals-popup.mjs} +11 -11
  123. package/fesm2022/taiga-ui-core-portals-popup.mjs.map +1 -0
  124. package/fesm2022/taiga-ui-core-portals.mjs +11 -0
  125. package/fesm2022/taiga-ui-core-portals.mjs.map +1 -0
  126. package/fesm2022/taiga-ui-core-services.mjs +16 -80
  127. package/fesm2022/taiga-ui-core-services.mjs.map +1 -1
  128. package/fesm2022/taiga-ui-core-tokens.mjs +51 -60
  129. package/fesm2022/taiga-ui-core-tokens.mjs.map +1 -1
  130. package/fesm2022/taiga-ui-core-utils-format.mjs +1 -22
  131. package/fesm2022/taiga-ui-core-utils-format.mjs.map +1 -1
  132. package/fesm2022/taiga-ui-core-utils-miscellaneous.mjs +19 -19
  133. package/fesm2022/taiga-ui-core-utils-miscellaneous.mjs.map +1 -1
  134. package/fesm2022/taiga-ui-core.mjs +1 -1
  135. package/index.d.ts +1 -1
  136. package/package.json +47 -72
  137. package/pipes/format-number/format-number.pipe.d.ts +6 -4
  138. package/pipes/index.d.ts +0 -7
  139. package/{directives/notification/notification.directive.d.ts → portals/alert/alert.directive.d.ts} +3 -3
  140. package/{directives/notification/notification.service.d.ts → portals/alert/alert.service.d.ts} +3 -3
  141. package/portals/alert/index.d.ts +2 -0
  142. package/{components → portals}/dialog/dialog.component.d.ts +2 -3
  143. package/{components → portals}/dialog/dialog.options.d.ts +2 -3
  144. package/{components → portals}/dialog/dialog.providers.d.ts +1 -2
  145. package/{components → portals}/dialog/dialog.service.d.ts +1 -1
  146. package/{components → portals}/dialog/index.d.ts +0 -1
  147. package/portals/dropdown/dropdown-close.directive.d.ts +15 -0
  148. package/{directives → portals}/dropdown/dropdown-context.directive.d.ts +0 -1
  149. package/{directives → portals}/dropdown/dropdown-hover.directive.d.ts +5 -10
  150. package/{directives → portals}/dropdown/dropdown-hover.options.d.ts +1 -3
  151. package/{directives → portals}/dropdown/dropdown-manual.directive.d.ts +2 -2
  152. package/portals/dropdown/dropdown-open.directive.d.ts +29 -0
  153. package/{directives → portals}/dropdown/dropdown-options.directive.d.ts +1 -5
  154. package/{directives → portals}/dropdown/dropdown-position-sided.directive.d.ts +3 -3
  155. package/{directives → portals}/dropdown/dropdown-position.directive.d.ts +6 -6
  156. package/{directives → portals}/dropdown/dropdown-selection.directive.d.ts +4 -5
  157. package/{directives → portals}/dropdown/dropdown.bindings.d.ts +0 -1
  158. package/{directives → portals}/dropdown/dropdown.d.ts +1 -2
  159. package/{directives → portals}/dropdown/dropdown.directive.d.ts +5 -6
  160. package/{directives → portals}/dropdown/index.d.ts +1 -1
  161. package/portals/hint/hint-options.directive.d.ts +17 -0
  162. package/{directives → portals}/hint/hint-position.directive.d.ts +5 -5
  163. package/{directives → portals}/hint/hint.d.ts +1 -2
  164. package/{directives → portals}/hint/hint.directive.d.ts +2 -2
  165. package/portals/index.d.ts +6 -0
  166. package/{components → portals}/modal/modal.component.d.ts +3 -3
  167. package/{components → portals}/modal/modal.service.d.ts +3 -3
  168. package/services/index.d.ts +0 -3
  169. package/styles/components/appearance.less +5 -0
  170. package/styles/components/button.less +10 -20
  171. package/styles/components/icon.less +11 -0
  172. package/styles/components/icons.less +2 -1
  173. package/styles/components/label.less +3 -12
  174. package/styles/components/link.less +9 -24
  175. package/styles/components/notification.less +31 -65
  176. package/styles/components/textfield.less +130 -211
  177. package/styles/components/title.less +8 -8
  178. package/styles/mixins/appearance.less +11 -26
  179. package/styles/mixins/appearance.scss +9 -24
  180. package/styles/mixins/date-picker.less +1 -1
  181. package/styles/mixins/mixins.less +0 -5
  182. package/styles/mixins/mixins.scss +0 -5
  183. package/styles/mixins/picker.less +1 -1
  184. package/styles/mixins/picker.scss +1 -1
  185. package/styles/mixins/slider.less +4 -10
  186. package/styles/mixins/slider.scss +23 -22
  187. package/styles/taiga-ui-local.less +0 -1
  188. package/styles/taiga-ui-local.scss +0 -1
  189. package/styles/taiga-ui-theme.less +0 -1
  190. package/styles/theme/appearance/outline.less +9 -18
  191. package/styles/theme/appearance/primary.less +2 -4
  192. package/styles/theme/appearance/secondary.less +6 -14
  193. package/styles/theme/appearance/status.less +0 -4
  194. package/styles/theme/appearance/table.less +36 -35
  195. package/styles/theme/appearance/textfield.less +26 -27
  196. package/styles/theme/appearance.less +0 -1
  197. package/styles/theme/variables.less +16 -19
  198. package/styles/variables/media.less +13 -18
  199. package/styles/variables/media.scss +13 -13
  200. package/tokens/breakpoint.d.ts +4 -0
  201. package/tokens/common-icons.d.ts +3 -3
  202. package/tokens/date-format.d.ts +2 -3
  203. package/tokens/icons.d.ts +0 -4
  204. package/tokens/index.d.ts +1 -4
  205. package/tokens/number-format.d.ts +2 -3
  206. package/types/direction.d.ts +1 -1
  207. package/types/index.d.ts +0 -2
  208. package/types/point.d.ts +1 -1
  209. package/types/size.d.ts +0 -11
  210. package/utils/format/index.d.ts +0 -1
  211. package/utils/miscellaneous/font-scaling.d.ts +2 -1
  212. package/utils/miscellaneous/get-duration.d.ts +2 -0
  213. package/utils/miscellaneous/index.d.ts +1 -1
  214. package/animations/animations.d.ts +0 -109
  215. package/animations/index.d.ts +0 -1
  216. package/components/alert/alert.component.d.ts +0 -14
  217. package/components/alert/alert.directive.d.ts +0 -8
  218. package/components/alert/alert.interfaces.d.ts +0 -13
  219. package/components/alert/alert.service.d.ts +0 -11
  220. package/components/alert/alert.tokens.d.ts +0 -6
  221. package/components/alert/index.d.ts +0 -5
  222. package/components/data-list/data-list.directive.d.ts +0 -7
  223. package/components/data-list/option/option-content.d.ts +0 -16
  224. package/components/data-list/option/option-legacy.component.d.ts +0 -24
  225. package/components/data-list/option/option.directive.d.ts +0 -27
  226. package/components/dialog/active-zone-adapter.directive.d.ts +0 -11
  227. package/components/dialog/dialogs.component.d.ts +0 -8
  228. package/components/header/header.directive.d.ts +0 -17
  229. package/components/header/index.d.ts +0 -1
  230. package/components/link/link.options.d.ts +0 -12
  231. package/components/textfield/textfield.directive.d.ts +0 -35
  232. package/directives/dropdown/dropdown-open-legacy.directive.d.ts +0 -12
  233. package/directives/dropdown/dropdown-open.directive.d.ts +0 -33
  234. package/directives/hint/hint-options.directive.d.ts +0 -36
  235. package/directives/notification/index.d.ts +0 -2
  236. package/fesm2022/taiga-ui-core-animations.mjs +0 -370
  237. package/fesm2022/taiga-ui-core-animations.mjs.map +0 -1
  238. package/fesm2022/taiga-ui-core-components-alert.mjs +0 -110
  239. package/fesm2022/taiga-ui-core-components-alert.mjs.map +0 -1
  240. package/fesm2022/taiga-ui-core-components-dialog.mjs +0 -227
  241. package/fesm2022/taiga-ui-core-components-dialog.mjs.map +0 -1
  242. package/fesm2022/taiga-ui-core-components-header.mjs +0 -42
  243. package/fesm2022/taiga-ui-core-components-header.mjs.map +0 -1
  244. package/fesm2022/taiga-ui-core-components-modal.mjs +0 -89
  245. package/fesm2022/taiga-ui-core-components-modal.mjs.map +0 -1
  246. package/fesm2022/taiga-ui-core-directives-dropdown.mjs.map +0 -1
  247. package/fesm2022/taiga-ui-core-directives-hint.mjs.map +0 -1
  248. package/fesm2022/taiga-ui-core-directives-notification.mjs +0 -73
  249. package/fesm2022/taiga-ui-core-directives-notification.mjs.map +0 -1
  250. package/fesm2022/taiga-ui-core-directives-popup.mjs.map +0 -1
  251. package/fesm2022/taiga-ui-core-pipes-auto-color.mjs +0 -25
  252. package/fesm2022/taiga-ui-core-pipes-auto-color.mjs.map +0 -1
  253. package/fesm2022/taiga-ui-core-pipes-calendar-sheet.mjs +0 -94
  254. package/fesm2022/taiga-ui-core-pipes-calendar-sheet.mjs.map +0 -1
  255. package/fesm2022/taiga-ui-core-pipes-flag.mjs +0 -32
  256. package/fesm2022/taiga-ui-core-pipes-flag.mjs.map +0 -1
  257. package/fesm2022/taiga-ui-core-pipes-format-date.mjs +0 -28
  258. package/fesm2022/taiga-ui-core-pipes-format-date.mjs.map +0 -1
  259. package/fesm2022/taiga-ui-core-pipes-initials.mjs +0 -29
  260. package/fesm2022/taiga-ui-core-pipes-initials.mjs.map +0 -1
  261. package/fesm2022/taiga-ui-core-pipes-month.mjs +0 -30
  262. package/fesm2022/taiga-ui-core-pipes-month.mjs.map +0 -1
  263. package/fesm2022/taiga-ui-core-pipes-order-week-days.mjs +0 -36
  264. package/fesm2022/taiga-ui-core-pipes-order-week-days.mjs.map +0 -1
  265. package/pipes/auto-color/auto-color.pipe.d.ts +0 -7
  266. package/pipes/auto-color/index.d.ts +0 -1
  267. package/pipes/calendar-sheet/index.d.ts +0 -1
  268. package/pipes/calendar-sheet/utils.d.ts +0 -20
  269. package/pipes/flag/flag.pipe.d.ts +0 -14
  270. package/pipes/flag/index.d.ts +0 -1
  271. package/pipes/format-date/format-date.pipe.d.ts +0 -9
  272. package/pipes/format-date/index.d.ts +0 -1
  273. package/pipes/initials/index.d.ts +0 -1
  274. package/pipes/initials/initials.pipe.d.ts +0 -7
  275. package/pipes/month/index.d.ts +0 -1
  276. package/pipes/month/month.pipe.d.ts +0 -10
  277. package/pipes/order-week-days/index.d.ts +0 -1
  278. package/services/breakpoint.service.d.ts +0 -16
  279. package/services/dark-theme.service.d.ts +0 -10
  280. package/services/format-date.service.d.ts +0 -8
  281. package/styles/mixins/wrapper.less +0 -64
  282. package/styles/mixins/wrapper.scss +0 -61
  283. package/styles/theme/appearance/opposite.less +0 -17
  284. package/styles/theme/wrapper.less +0 -211
  285. package/tokens/day-type-handler.d.ts +0 -7
  286. package/tokens/first-day-of-week.d.ts +0 -5
  287. package/tokens/scroll-ref.d.ts +0 -2
  288. package/tokens/spin-icons.d.ts +0 -6
  289. package/types/range-state.d.ts +0 -4
  290. package/types/value-content-context.d.ts +0 -4
  291. package/utils/format/string-hash-to-hsl.d.ts +0 -6
  292. package/utils/miscellaneous/to-animation-options.d.ts +0 -4
  293. /package/{directives → components}/title/index.d.ts +0 -0
  294. /package/{directives → components}/title/title.directive.d.ts +0 -0
  295. /package/{components → portals}/dialog/dialog.directive.d.ts +0 -0
  296. /package/{components → portals}/dialog/dialog.factory.d.ts +0 -0
  297. /package/{directives → portals}/dropdown/dropdown-content.directive.d.ts +0 -0
  298. /package/{directives → portals}/dropdown/dropdown-limit-width.d.ts +0 -0
  299. /package/{directives → portals}/dropdown/dropdown.component.d.ts +0 -0
  300. /package/{directives → portals}/dropdown/dropdown.driver.d.ts +0 -0
  301. /package/{directives → portals}/dropdown/dropdown.providers.d.ts +0 -0
  302. /package/{directives → portals}/dropdown/with-dropdown-open.directive.d.ts +0 -0
  303. /package/{directives → portals}/hint/hint-describe.directive.d.ts +0 -0
  304. /package/{directives → portals}/hint/hint-driver.directive.d.ts +0 -0
  305. /package/{directives → portals}/hint/hint-host.directive.d.ts +0 -0
  306. /package/{directives → portals}/hint/hint-hover.directive.d.ts +0 -0
  307. /package/{directives → portals}/hint/hint-manual.directive.d.ts +0 -0
  308. /package/{directives → portals}/hint/hint-overflow.directive.d.ts +0 -0
  309. /package/{directives → portals}/hint/hint-pointer.directive.d.ts +0 -0
  310. /package/{directives → portals}/hint/hint-unstyled.component.d.ts +0 -0
  311. /package/{directives → portals}/hint/hint.component.d.ts +0 -0
  312. /package/{directives → portals}/hint/hint.providers.d.ts +0 -0
  313. /package/{directives → portals}/hint/index.d.ts +0 -0
  314. /package/{components → portals}/modal/index.d.ts +0 -0
  315. /package/{directives → portals}/popup/index.d.ts +0 -0
  316. /package/{directives → portals}/popup/popup.directive.d.ts +0 -0
  317. /package/{directives → portals}/popup/popup.service.d.ts +0 -0
  318. /package/{directives → portals}/popup/popups.component.d.ts +0 -0
@@ -1,42 +1,41 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, Directive, InjectionToken, Optional, Self, SkipSelf, inject, Input, EventEmitter, Output, ChangeDetectorRef, INJECTOR, signal, TemplateRef, computed, ChangeDetectionStrategy, Component, PLATFORM_ID, ElementRef, ContentChild, ViewContainerRef } from '@angular/core';
3
- import { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';
2
+ import { Injectable, Directive, InjectionToken, Optional, Self, SkipSelf, inject, ChangeDetectorRef, effect, signal, INJECTOR, input, computed, TemplateRef, forwardRef, ChangeDetectionStrategy, Component, PLATFORM_ID, contentChild, ElementRef, model, ViewContainerRef } from '@angular/core';
3
+ import { outputFromObservable, takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';
4
4
  import { EMPTY_CLIENT_RECT, TUI_TRUE_HANDLER, CHAR_ZERO_WIDTH_SPACE, CHAR_NO_BREAK_SPACE } from '@taiga-ui/cdk/constants';
5
5
  import * as i1 from '@taiga-ui/cdk/directives/active-zone';
6
6
  import { TuiActiveZone } from '@taiga-ui/cdk/directives/active-zone';
7
7
  import * as i2 from '@taiga-ui/cdk/directives/animated';
8
8
  import { TuiAnimated } from '@taiga-ui/cdk/directives/animated';
9
- import { tuiInjectElement, tuiGetActualTarget, tuiPointToClientRect, tuiIsElement, tuiIsHTMLElement, tuiIsElementEditable, tuiIsTextNode, tuiIsTextfield } from '@taiga-ui/cdk/utils/dom';
9
+ import { tuiInjectElement, tuiGetActualTarget, tuiPointToClientRect, tuiIsElement, tuiIsElementEditable, tuiIsHTMLElement, tuiIsTextNode, tuiIsTextfield } from '@taiga-ui/cdk/utils/dom';
10
10
  import { tuiClamp } from '@taiga-ui/cdk/utils/math';
11
- import { tuiProvide, tuiPure, tuiPx, tuiProvideOptions, tuiIsString, tuiDirectiveBinding } from '@taiga-ui/cdk/utils/miscellaneous';
12
- import { TuiDriverDirective, TuiPositionAccessor, tuiFallbackAccessor, TuiRectAccessor, tuiAsRectAccessor, tuiAsVehicle, tuiPositionAccessorFor, tuiRectAccessorFor, tuiAsDriver, TuiDriver, tuiAsPositionAccessor } from '@taiga-ui/core/classes';
11
+ import { tuiPx, tuiSetSignal, tuiIsString } from '@taiga-ui/cdk/utils/miscellaneous';
12
+ import { TuiDriverDirective, TuiPositionAccessor, tuiFallbackAccessor, TuiRectAccessor, tuiAsVehicle, tuiPositionAccessorFor, tuiRectAccessorFor, tuiAsDriver, tuiAsRectAccessor, TuiDriver, tuiAsPositionAccessor } from '@taiga-ui/core/classes';
13
13
  import { TuiScrollbar } from '@taiga-ui/core/components/scrollbar';
14
14
  import { TuiVisualViewportService, TuiPositionService } from '@taiga-ui/core/services';
15
15
  import { TUI_VIEWPORT, TUI_DARK_MODE, TUI_SELECTION_STREAM } from '@taiga-ui/core/tokens';
16
16
  import { PolymorpheusComponent, PolymorpheusTemplate, PolymorpheusOutlet } from '@taiga-ui/polymorpheus';
17
- import { BehaviorSubject, Subject, throttleTime, takeWhile, map, merge, filter, fromEvent, switchMap, delay, startWith, takeUntil, distinctUntilChanged, of, tap, share, combineLatest } from 'rxjs';
17
+ import { BehaviorSubject, Subject, distinctUntilChanged, throttleTime, takeWhile, map, merge, filter, EMPTY, switchMap, delay, startWith, takeUntil, fromEvent, of, tap, share, combineLatest } from 'rxjs';
18
18
  import { coerceArray } from '@angular/cdk/coercion';
19
- import { tuiZonefreeScheduler, tuiTypedFromEvent, tuiZonefree, tuiIfMap, tuiCloseWatcher, tuiZonefull, tuiWatch, tuiZoneOptimized } from '@taiga-ui/cdk/observables';
20
- import { TuiPopupService } from '@taiga-ui/core/directives/popup';
21
- import { tuiOverrideOptions, tuiCheckFixedPosition, tuiGetWordRange } from '@taiga-ui/core/utils';
22
- import { __decorate } from 'tslib';
19
+ import { tuiZonefreeScheduler, tuiTypedFromEvent, tuiZoneOptimized, tuiIfMap, tuiCloseWatcher, tuiStopPropagation } from '@taiga-ui/cdk/observables';
20
+ import { TuiPopupService } from '@taiga-ui/core/portals/popup';
21
+ import { tuiCheckFixedPosition, tuiGetWordRange } from '@taiga-ui/core/utils/dom';
22
+ import { tuiProvide, tuiCreateOptions, tuiDirectiveBinding } from '@taiga-ui/cdk/utils/di';
23
+ import { tuiOverrideOptions, tuiIsEditingKey } from '@taiga-ui/core/utils/miscellaneous';
23
24
  import { isPlatformBrowser, DOCUMENT } from '@angular/common';
24
- import { TUI_IS_TOUCH, TUI_RANGE } from '@taiga-ui/cdk/tokens';
25
- import { shouldCall } from '@taiga-ui/event-plugins';
25
+ import { WA_IS_TOUCH } from '@ng-web-apis/platform';
26
26
  import * as i1$1 from '@taiga-ui/cdk/directives/obscured';
27
27
  import { TuiObscured } from '@taiga-ui/cdk/directives/obscured';
28
- import { tuiIsKeyboardFocusable, tuiGetClosestFocusable, tuiIsFocusedIn, tuiGetFocused } from '@taiga-ui/cdk/utils/focus';
29
- import { tuiIsEditingKey, tuiOverrideOptions as tuiOverrideOptions$1 } from '@taiga-ui/core/utils/miscellaneous';
28
+ import { tuiIsFocusable, tuiGetClosestFocusable, tuiIsFocusedIn, tuiGetFocused } from '@taiga-ui/cdk/utils/focus';
30
29
 
31
30
  class TuiDropdownDriver extends BehaviorSubject {
32
31
  constructor() {
33
32
  super(false);
34
33
  this.type = 'dropdown';
35
34
  }
36
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownDriver, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
37
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownDriver }); }
35
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownDriver, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
36
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownDriver }); }
38
37
  }
39
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownDriver, decorators: [{
38
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownDriver, decorators: [{
40
39
  type: Injectable
41
40
  }], ctorParameters: () => [] });
42
41
  class TuiDropdownDriverDirective extends TuiDriverDirective {
@@ -44,14 +43,11 @@ class TuiDropdownDriverDirective extends TuiDriverDirective {
44
43
  super(...arguments);
45
44
  this.type = 'dropdown';
46
45
  }
47
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownDriverDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
48
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: TuiDropdownDriverDirective, isStandalone: true, usesInheritance: true, ngImport: i0 }); }
46
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownDriverDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
47
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.17", type: TuiDropdownDriverDirective, isStandalone: true, usesInheritance: true, ngImport: i0 }); }
49
48
  }
50
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownDriverDirective, decorators: [{
51
- type: Directive,
52
- args: [{
53
- standalone: true,
54
- }]
49
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownDriverDirective, decorators: [{
50
+ type: Directive
55
51
  }] });
56
52
 
57
53
  /**
@@ -62,9 +58,8 @@ const TUI_DROPDOWN_COMPONENT = new InjectionToken(ngDevMode ? 'TUI_DROPDOWN_COMP
62
58
  });
63
59
  const TUI_DROPDOWN_CONTEXT = new InjectionToken(ngDevMode ? 'TUI_DROPDOWN_CONTEXT' : '');
64
60
 
65
- /** Default values for dropdown options */
66
61
  const TUI_DROPDOWN_DEFAULT_OPTIONS = {
67
- align: 'left',
62
+ align: 'start',
68
63
  direction: null,
69
64
  limitWidth: 'auto',
70
65
  maxHeight: 400,
@@ -72,9 +67,6 @@ const TUI_DROPDOWN_DEFAULT_OPTIONS = {
72
67
  offset: 4,
73
68
  appearance: '',
74
69
  };
75
- /**
76
- * Default parameters for dropdown directive
77
- */
78
70
  const TUI_DROPDOWN_OPTIONS = new InjectionToken(ngDevMode ? 'TUI_DROPDOWN_OPTIONS' : '', {
79
71
  factory: () => TUI_DROPDOWN_DEFAULT_OPTIONS,
80
72
  });
@@ -97,38 +89,25 @@ class TuiDropdownOptionsDirective {
97
89
  this.maxHeight = this.options.maxHeight;
98
90
  this.offset = this.options.offset;
99
91
  }
100
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownOptionsDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
101
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: TuiDropdownOptionsDirective, isStandalone: true, selector: "[tuiDropdownAlign], [tuiDropdownAppearance], [tuiDropdownDirection], [tuiDropdownLimitWidth], [tuiDropdownMinHeight], [tuiDropdownMaxHeight], [tuiDropdownOffset]", inputs: { align: ["tuiDropdownAlign", "align"], appearance: ["tuiDropdownAppearance", "appearance"], direction: ["tuiDropdownDirection", "direction"], limitWidth: ["tuiDropdownLimitWidth", "limitWidth"], minHeight: ["tuiDropdownMinHeight", "minHeight"], maxHeight: ["tuiDropdownMaxHeight", "maxHeight"], offset: ["tuiDropdownOffset", "offset"] }, providers: [tuiProvide(TUI_DROPDOWN_OPTIONS, TuiDropdownOptionsDirective)], ngImport: i0 }); }
92
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownOptionsDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
93
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.17", type: TuiDropdownOptionsDirective, isStandalone: true, selector: "[tuiDropdownAlign], [tuiDropdownAppearance], [tuiDropdownDirection], [tuiDropdownLimitWidth], [tuiDropdownMinHeight], [tuiDropdownMaxHeight], [tuiDropdownOffset]", inputs: { align: ["tuiDropdownAlign", "align"], appearance: ["tuiDropdownAppearance", "appearance"], direction: ["tuiDropdownDirection", "direction"], limitWidth: ["tuiDropdownLimitWidth", "limitWidth"], minHeight: ["tuiDropdownMinHeight", "minHeight"], maxHeight: ["tuiDropdownMaxHeight", "maxHeight"], offset: ["tuiDropdownOffset", "offset"] }, providers: [tuiProvide(TUI_DROPDOWN_OPTIONS, TuiDropdownOptionsDirective)], ngImport: i0 }); }
102
94
  }
103
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownOptionsDirective, decorators: [{
95
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownOptionsDirective, decorators: [{
104
96
  type: Directive,
105
97
  args: [{
106
- standalone: true,
107
98
  selector: '[tuiDropdownAlign], [tuiDropdownAppearance], [tuiDropdownDirection], [tuiDropdownLimitWidth], [tuiDropdownMinHeight], [tuiDropdownMaxHeight], [tuiDropdownOffset]',
99
+ inputs: [
100
+ 'align: tuiDropdownAlign',
101
+ 'appearance: tuiDropdownAppearance',
102
+ 'direction: tuiDropdownDirection',
103
+ 'limitWidth: tuiDropdownLimitWidth',
104
+ 'minHeight: tuiDropdownMinHeight',
105
+ 'maxHeight: tuiDropdownMaxHeight',
106
+ 'offset: tuiDropdownOffset',
107
+ ],
108
108
  providers: [tuiProvide(TUI_DROPDOWN_OPTIONS, TuiDropdownOptionsDirective)],
109
109
  }]
110
- }], propDecorators: { align: [{
111
- type: Input,
112
- args: ['tuiDropdownAlign']
113
- }], appearance: [{
114
- type: Input,
115
- args: ['tuiDropdownAppearance']
116
- }], direction: [{
117
- type: Input,
118
- args: ['tuiDropdownDirection']
119
- }], limitWidth: [{
120
- type: Input,
121
- args: ['tuiDropdownLimitWidth']
122
- }], minHeight: [{
123
- type: Input,
124
- args: ['tuiDropdownMinHeight']
125
- }], maxHeight: [{
126
- type: Input,
127
- args: ['tuiDropdownMaxHeight']
128
- }], offset: [{
129
- type: Input,
130
- args: ['tuiDropdownOffset']
131
- }] } });
110
+ }] });
132
111
 
133
112
  class TuiDropdownPosition extends TuiPositionAccessor {
134
113
  constructor() {
@@ -136,18 +115,16 @@ class TuiDropdownPosition extends TuiPositionAccessor {
136
115
  this.el = tuiInjectElement();
137
116
  this.options = inject(TUI_DROPDOWN_OPTIONS);
138
117
  this.viewport = inject(TUI_VIEWPORT);
139
- this.directionChange = new EventEmitter();
118
+ this.direction = new Subject();
140
119
  this.type = 'dropdown';
141
- this.accessor = tuiFallbackAccessor('dropdown')(inject(TuiRectAccessor), inject(TuiDropdownDirective, { optional: true }));
142
- }
143
- emitDirection(direction) {
144
- this.directionChange.emit(direction);
120
+ this.accessor = tuiFallbackAccessor('dropdown')(inject(TuiRectAccessor, { optional: true }), { getClientRect: () => this.el.getBoundingClientRect() });
121
+ this.tuiDropdownDirectionChange = outputFromObservable(this.direction.pipe(distinctUntilChanged()));
145
122
  }
146
123
  getPosition({ width, height }) {
147
124
  if (!width && !height) {
148
125
  this.previous = undefined;
149
126
  }
150
- const hostRect = this.accessor?.getClientRect() ?? EMPTY_CLIENT_RECT;
127
+ const hostRect = this.accessor.getClientRect();
151
128
  const viewportRect = this.viewport.getClientRect();
152
129
  const { minHeight, direction, offset, limitWidth } = this.options;
153
130
  const align = this.getAlign(this.options.align);
@@ -177,42 +154,38 @@ class TuiDropdownPosition extends TuiPositionAccessor {
177
154
  const better = available.top > available.bottom ? 'top' : 'bottom';
178
155
  if ((available[previous] > minHeight && direction) ||
179
156
  available[previous] > height) {
180
- this.emitDirection(previous);
181
- return [position[previous], position[align]];
157
+ this.direction.next(previous);
158
+ return [position[align], position[previous]];
182
159
  }
183
160
  this.previous = better;
184
- this.emitDirection(better);
185
- return [position[better], position[align]];
161
+ this.direction.next(better);
162
+ return [position[align], position[better]];
186
163
  }
187
164
  getAlign(align) {
188
165
  const rtl = this.el.matches('[dir="rtl"] :scope');
189
- if (rtl && align === 'left') {
166
+ if (rtl && align === 'start') {
190
167
  return 'right';
191
168
  }
192
- return rtl && align === 'right' ? 'left' : align;
169
+ if (rtl && align === 'end') {
170
+ return 'left';
171
+ }
172
+ if (align === 'center') {
173
+ return 'center';
174
+ }
175
+ return align === 'end' ? 'right' : 'left';
193
176
  }
194
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownPosition, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
195
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: TuiDropdownPosition, isStandalone: true, outputs: { directionChange: "tuiDropdownDirectionChange" }, usesInheritance: true, ngImport: i0 }); }
177
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownPosition, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
178
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.17", type: TuiDropdownPosition, isStandalone: true, outputs: { tuiDropdownDirectionChange: "tuiDropdownDirectionChange" }, usesInheritance: true, ngImport: i0 }); }
196
179
  }
197
- __decorate([
198
- tuiPure
199
- ], TuiDropdownPosition.prototype, "emitDirection", null);
200
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownPosition, decorators: [{
201
- type: Directive,
202
- args: [{
203
- standalone: true,
204
- }]
205
- }], propDecorators: { directionChange: [{
206
- type: Output,
207
- args: ['tuiDropdownDirectionChange']
208
- }], emitDirection: [] } });
180
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownPosition, decorators: [{
181
+ type: Directive
182
+ }] });
209
183
 
210
184
  class TuiDropdownDirective {
211
185
  constructor() {
212
186
  this.refresh$ = new Subject();
213
187
  this.service = inject(TuiPopupService);
214
188
  this.cdr = inject(ChangeDetectorRef);
215
- // TODO: think of a better solution later
216
189
  this.drivers = coerceArray(inject(TuiDropdownDriver, { self: true, optional: true }));
217
190
  this.sub = this.refresh$
218
191
  .pipe(throttleTime(0, tuiZonefreeScheduler()), takeUntilDestroyed())
@@ -220,33 +193,25 @@ class TuiDropdownDirective {
220
193
  this.ref()?.changeDetectorRef.detectChanges();
221
194
  this.ref()?.changeDetectorRef.markForCheck();
222
195
  });
196
+ this.autoClose = effect(() => {
197
+ if (!this.content()) {
198
+ this.toggle(false);
199
+ }
200
+ });
201
+ this.ref = signal(null);
223
202
  this.el = tuiInjectElement();
224
203
  this.type = 'dropdown';
225
204
  this.component = new PolymorpheusComponent(inject(TUI_DROPDOWN_COMPONENT), inject(INJECTOR));
226
- this.ref = signal(null);
227
- // TODO(v5): rename to `content`
228
- // eslint-disable-next-line @typescript-eslint/naming-convention
229
- this._content = signal(null);
230
- }
231
- set tuiDropdown(content) {
232
- this._content.set(content instanceof TemplateRef
233
- ? new PolymorpheusTemplate(content, this.cdr)
234
- : content);
235
- if (!this._content()) {
236
- this.toggle(false);
237
- }
205
+ this.tuiDropdown = input();
206
+ this.content = computed((content = this.tuiDropdown()) => {
207
+ return content instanceof TemplateRef
208
+ ? new PolymorpheusTemplate(content, this.cdr)
209
+ : content;
210
+ });
238
211
  }
239
212
  get position() {
240
213
  return tuiCheckFixedPosition(this.el) ? 'fixed' : 'absolute';
241
214
  }
242
- // TODO(v5): delete
243
- get content() {
244
- return this._content();
245
- }
246
- // TODO(v5): delete
247
- set content(x) {
248
- this._content.set(x);
249
- }
250
215
  ngAfterViewChecked() {
251
216
  this.refresh$.next();
252
217
  }
@@ -258,32 +223,25 @@ class TuiDropdownDirective {
258
223
  }
259
224
  toggle(show) {
260
225
  const ref = this.ref();
261
- if (show && this._content() && !ref) {
226
+ if (show && this.content() && !ref) {
262
227
  this.ref.set(this.service.add(this.component));
263
228
  }
264
229
  else if (!show && ref) {
265
230
  this.ref.set(null);
266
231
  ref.destroy();
267
232
  }
268
- this.drivers.forEach((driver) => driver?.next(show));
269
233
  // TODO: Remove in v5, only needed in Angular 16
270
234
  this.cdr.markForCheck();
235
+ this.drivers.forEach((driver) => driver?.next(show));
271
236
  }
272
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
273
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: TuiDropdownDirective, isStandalone: true, selector: "[tuiDropdown]:not(ng-container):not(ng-template)", inputs: { tuiDropdown: "tuiDropdown" }, host: { properties: { "class.tui-dropdown-open": "ref()" } }, providers: [
274
- tuiAsRectAccessor(TuiDropdownDirective),
275
- tuiAsVehicle(TuiDropdownDirective),
276
- ], exportAs: ["tuiDropdown"], hostDirectives: [{ directive: TuiDropdownDriverDirective }, { directive: TuiDropdownPosition, outputs: ["tuiDropdownDirectionChange", "tuiDropdownDirectionChange"] }], ngImport: i0 }); }
237
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
238
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.17", type: TuiDropdownDirective, isStandalone: true, selector: "[tuiDropdown]:not(ng-container):not(ng-template)", inputs: { tuiDropdown: { classPropertyName: "tuiDropdown", publicName: "tuiDropdown", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.tui-dropdown-open": "ref()" } }, providers: [tuiAsVehicle(TuiDropdownDirective)], exportAs: ["tuiDropdown"], hostDirectives: [{ directive: TuiDropdownDriverDirective }, { directive: TuiDropdownPosition, outputs: ["tuiDropdownDirectionChange", "tuiDropdownDirectionChange"] }], ngImport: i0 }); }
277
239
  }
278
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownDirective, decorators: [{
240
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownDirective, decorators: [{
279
241
  type: Directive,
280
242
  args: [{
281
- standalone: true,
282
243
  selector: '[tuiDropdown]:not(ng-container):not(ng-template)',
283
- providers: [
284
- tuiAsRectAccessor(TuiDropdownDirective),
285
- tuiAsVehicle(TuiDropdownDirective),
286
- ],
244
+ providers: [tuiAsVehicle(TuiDropdownDirective)],
287
245
  exportAs: 'tuiDropdown',
288
246
  hostDirectives: [
289
247
  TuiDropdownDriverDirective,
@@ -296,9 +254,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
296
254
  '[class.tui-dropdown-open]': 'ref()',
297
255
  },
298
256
  }]
299
- }], propDecorators: { tuiDropdown: [{
300
- type: Input
301
- }] } });
257
+ }] });
302
258
 
303
259
  /**
304
260
  * @description:
@@ -312,7 +268,7 @@ class TuiDropdownComponent {
312
268
  this.viewport = inject(TUI_VIEWPORT);
313
269
  this.vvs = inject(TuiVisualViewportService);
314
270
  this.styles$ = inject(TuiPositionService).pipe(takeWhile(() => this.directive.el.isConnected &&
315
- !!this.directive.el.getBoundingClientRect().height), map((v) => (this.position === 'fixed' ? this.vvs.correct(v) : v)), map(([top, left]) => this.getStyles(left, top)), takeUntilDestroyed());
271
+ !!this.directive.el.getBoundingClientRect().height), map((v) => (this.position === 'fixed' ? this.vvs.correct(v) : v)), map((point) => this.getStyles(...point)), takeUntilDestroyed());
316
272
  this.options = inject(TUI_DROPDOWN_OPTIONS);
317
273
  this.directive = inject(TuiDropdownDirective);
318
274
  this.context = inject(TUI_DROPDOWN_CONTEXT, { optional: true });
@@ -351,92 +307,83 @@ class TuiDropdownComponent {
351
307
  maxWidth: tuiPx(Math.round(viewport.width) - 16), // 8px min gap from each side
352
308
  };
353
309
  }
354
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
355
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: TuiDropdownComponent, isStandalone: true, selector: "tui-dropdown", host: { properties: { "attr.data-appearance": "options.appearance", "attr.tuiTheme": "theme()" } }, providers: [
310
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
311
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: TuiDropdownComponent, isStandalone: true, selector: "tui-dropdown", host: { properties: { "attr.data-appearance": "options.appearance", "attr.tuiTheme": "theme()" } }, providers: [
356
312
  TuiPositionService,
357
313
  tuiPositionAccessorFor('dropdown', TuiDropdownPosition),
358
- tuiRectAccessorFor('dropdown', TuiDropdownDirective),
359
- ], hostDirectives: [{ directive: i1.TuiActiveZone }, { directive: i2.TuiAnimated }], ngImport: i0, template: "<tui-scrollbar class=\"t-scroll\">\n <div\n *polymorpheusOutlet=\"directive._content() as text; context: {$implicit: close}\"\n class=\"t-primitive\"\n >\n {{ text }}\n </div>\n</tui-scrollbar>\n", styles: [":host{position:absolute;display:flex;box-shadow:var(--tui-shadow-medium);color:var(--tui-text-primary);background:var(--tui-background-elevation-3);border-radius:var(--tui-radius-m);overflow:hidden;border:1px solid var(--tui-border-normal);box-sizing:border-box;isolation:isolate;pointer-events:auto;--tui-from: translateY(-1rem)}:host.tui-enter,:host.tui-leave{animation-name:tuiFade,tuiSlide}:host:not([style*=top]){visibility:hidden}.t-scroll{flex-grow:1;max-inline-size:100%;inline-size:max-content;overscroll-behavior:none}.t-primitive{padding:1rem}\n"], dependencies: [{ kind: "directive", type: PolymorpheusOutlet, selector: "[polymorpheusOutlet]", inputs: ["polymorpheusOutlet", "polymorpheusOutletContext"] }, { kind: "component", type: TuiScrollbar, selector: "tui-scrollbar", inputs: ["hidden"] }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
314
+ tuiRectAccessorFor('dropdown', forwardRef(() => TuiDropdownDirective)),
315
+ ], hostDirectives: [{ directive: i1.TuiActiveZone }, { directive: i2.TuiAnimated }], ngImport: i0, template: "<tui-scrollbar class=\"t-scroll\">\n <div\n *polymorpheusOutlet=\"directive.content() as text; context: {$implicit: close}\"\n class=\"t-primitive\"\n >\n {{ text }}\n </div>\n</tui-scrollbar>\n", styles: [":host{position:absolute;display:flex;box-shadow:var(--tui-shadow-medium);color:var(--tui-text-primary);background:var(--tui-background-elevation-3);border-radius:var(--tui-radius-m);overflow:hidden;border:1px solid var(--tui-border-normal);box-sizing:border-box;isolation:isolate;pointer-events:auto;--tui-from: translateY(-1rem)}:host.tui-enter,:host.tui-leave{animation-name:tuiFade,tuiSlide}:host:not([style*=top]){visibility:hidden}.t-scroll{flex-grow:1;max-inline-size:100%;inline-size:max-content;overscroll-behavior:none}.t-primitive{padding:1rem}\n"], dependencies: [{ kind: "directive", type: PolymorpheusOutlet, selector: "[polymorpheusOutlet]", inputs: ["polymorpheusOutlet", "polymorpheusOutletContext"] }, { kind: "component", type: TuiScrollbar, selector: "tui-scrollbar" }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
360
316
  }
361
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownComponent, decorators: [{
317
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownComponent, decorators: [{
362
318
  type: Component,
363
319
  args: [{ selector: 'tui-dropdown', imports: [PolymorpheusOutlet, TuiScrollbar], changeDetection: ChangeDetectionStrategy.Default, providers: [
364
320
  TuiPositionService,
365
321
  tuiPositionAccessorFor('dropdown', TuiDropdownPosition),
366
- tuiRectAccessorFor('dropdown', TuiDropdownDirective),
322
+ tuiRectAccessorFor('dropdown', forwardRef(() => TuiDropdownDirective)),
367
323
  ], hostDirectives: [TuiActiveZone, TuiAnimated], host: {
368
324
  '[attr.data-appearance]': 'options.appearance',
369
325
  '[attr.tuiTheme]': 'theme()',
370
- }, template: "<tui-scrollbar class=\"t-scroll\">\n <div\n *polymorpheusOutlet=\"directive._content() as text; context: {$implicit: close}\"\n class=\"t-primitive\"\n >\n {{ text }}\n </div>\n</tui-scrollbar>\n", styles: [":host{position:absolute;display:flex;box-shadow:var(--tui-shadow-medium);color:var(--tui-text-primary);background:var(--tui-background-elevation-3);border-radius:var(--tui-radius-m);overflow:hidden;border:1px solid var(--tui-border-normal);box-sizing:border-box;isolation:isolate;pointer-events:auto;--tui-from: translateY(-1rem)}:host.tui-enter,:host.tui-leave{animation-name:tuiFade,tuiSlide}:host:not([style*=top]){visibility:hidden}.t-scroll{flex-grow:1;max-inline-size:100%;inline-size:max-content;overscroll-behavior:none}.t-primitive{padding:1rem}\n"] }]
326
+ }, template: "<tui-scrollbar class=\"t-scroll\">\n <div\n *polymorpheusOutlet=\"directive.content() as text; context: {$implicit: close}\"\n class=\"t-primitive\"\n >\n {{ text }}\n </div>\n</tui-scrollbar>\n", styles: [":host{position:absolute;display:flex;box-shadow:var(--tui-shadow-medium);color:var(--tui-text-primary);background:var(--tui-background-elevation-3);border-radius:var(--tui-radius-m);overflow:hidden;border:1px solid var(--tui-border-normal);box-sizing:border-box;isolation:isolate;pointer-events:auto;--tui-from: translateY(-1rem)}:host.tui-enter,:host.tui-leave{animation-name:tuiFade,tuiSlide}:host:not([style*=top]){visibility:hidden}.t-scroll{flex-grow:1;max-inline-size:100%;inline-size:max-content;overscroll-behavior:none}.t-primitive{padding:1rem}\n"] }]
371
327
  }] });
372
328
 
373
329
  class TuiDropdownContent {
374
330
  constructor() {
375
331
  this.directive = inject(TuiDropdownDirective);
376
- this.directive.tuiDropdown = inject(TemplateRef);
332
+ tuiSetSignal(this.directive.tuiDropdown, inject(TemplateRef));
377
333
  if (isPlatformBrowser(inject(PLATFORM_ID)) &&
378
334
  this.directive.el.matches(':focus-within')) {
379
335
  this.directive.toggle(true);
380
336
  }
381
337
  }
382
338
  ngOnDestroy() {
383
- this.directive.tuiDropdown = null;
339
+ tuiSetSignal(this.directive.tuiDropdown, null);
384
340
  }
385
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownContent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
386
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: TuiDropdownContent, isStandalone: true, selector: "ng-template[tuiDropdown]", ngImport: i0 }); }
341
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownContent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
342
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.17", type: TuiDropdownContent, isStandalone: true, selector: "ng-template[tuiDropdown]", ngImport: i0 }); }
387
343
  }
388
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownContent, decorators: [{
344
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownContent, decorators: [{
389
345
  type: Directive,
390
346
  args: [{
391
- standalone: true,
392
347
  selector: 'ng-template[tuiDropdown]',
393
348
  }]
394
349
  }], ctorParameters: () => [] });
395
350
 
396
- function activeZoneFilter(event) {
397
- return (!event ||
398
- (this.driver.value && !this.activeZone.contains(tuiGetActualTarget(event))));
399
- }
400
351
  class TuiDropdownContext extends TuiRectAccessor {
401
352
  constructor() {
402
353
  super(...arguments);
403
- this.isTouch = inject(TUI_IS_TOUCH);
354
+ this.isTouch = inject(WA_IS_TOUCH);
404
355
  this.currentRect = EMPTY_CLIENT_RECT;
405
356
  this.userSelect = computed(() => (this.isTouch() ? 'none' : null));
406
357
  this.activeZone = inject(TuiActiveZone);
407
358
  this.driver = inject(TuiDropdownDriver);
408
359
  this.doc = inject(DOCUMENT);
409
- this.sub = merge(tuiTypedFromEvent(this.doc, 'pointerdown'), tuiTypedFromEvent(this.doc, 'contextmenu', { capture: true }))
410
- .pipe(tuiZonefree(), takeUntilDestroyed())
411
- .subscribe((event) => this.closeDropdown(event));
360
+ this.sub = merge(tuiTypedFromEvent(this.doc, 'pointerdown'), tuiTypedFromEvent(this.doc, 'keydown').pipe(filter(({ key }) => key === 'Escape')), tuiTypedFromEvent(this.doc, 'contextmenu', { capture: true }))
361
+ .pipe(filter((event) => this.driver.value &&
362
+ !this.activeZone.contains(tuiGetActualTarget(event))), tuiZoneOptimized(), takeUntilDestroyed())
363
+ .subscribe(() => {
364
+ this.driver.next(false);
365
+ this.currentRect = EMPTY_CLIENT_RECT;
366
+ });
412
367
  this.type = 'dropdown';
413
368
  }
414
369
  getClientRect() {
415
370
  return this.currentRect;
416
371
  }
417
- closeDropdown(_event) {
418
- this.driver.next(false);
419
- this.currentRect = EMPTY_CLIENT_RECT;
420
- }
421
372
  onContextMenu(x, y) {
422
373
  this.currentRect = tuiPointToClientRect(x, y);
423
374
  this.driver.next(true);
424
375
  }
425
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownContext, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
426
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: TuiDropdownContext, isStandalone: true, selector: "[tuiDropdownContext]", host: { listeners: { "document:keydown.esc": "closeDropdown()", "longtap": "onContextMenu($event.detail.clientX, $event.detail.clientY)" }, properties: { "style.user-select": "userSelect()", "style.-webkit-user-select": "userSelect()", "style.-webkit-touch-callout": "userSelect()" } }, providers: [
376
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownContext, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
377
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.17", type: TuiDropdownContext, isStandalone: true, selector: "[tuiDropdownContext]", host: { listeners: { "longtap": "onContextMenu($event.detail.clientX, $event.detail.clientY)" }, properties: { "style.user-select": "userSelect()", "style.-webkit-user-select": "userSelect()", "style.-webkit-touch-callout": "userSelect()" } }, providers: [
427
378
  TuiActiveZone,
428
379
  TuiDropdownDriver,
429
380
  tuiAsDriver(TuiDropdownDriver),
430
381
  tuiAsRectAccessor(TuiDropdownContext),
431
382
  ], usesInheritance: true, ngImport: i0 }); }
432
383
  }
433
- __decorate([
434
- shouldCall(activeZoneFilter)
435
- ], TuiDropdownContext.prototype, "closeDropdown", null);
436
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownContext, decorators: [{
384
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownContext, decorators: [{
437
385
  type: Directive,
438
386
  args: [{
439
- standalone: true,
440
387
  selector: '[tuiDropdownContext]',
441
388
  providers: [
442
389
  TuiActiveZone,
@@ -448,11 +395,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
448
395
  '[style.user-select]': 'userSelect()',
449
396
  '[style.-webkit-user-select]': 'userSelect()',
450
397
  '[style.-webkit-touch-callout]': 'userSelect()',
451
- '(document:keydown.esc)': 'closeDropdown()',
452
398
  '(longtap)': 'onContextMenu($event.detail.clientX, $event.detail.clientY)',
453
399
  },
454
400
  }]
455
- }], propDecorators: { closeDropdown: [] } });
401
+ }] });
456
402
 
457
403
  /** Default values for hint options */
458
404
  const TUI_DROPDOWN_HOVER_DEFAULT_OPTIONS = {
@@ -462,48 +408,58 @@ const TUI_DROPDOWN_HOVER_DEFAULT_OPTIONS = {
462
408
  /**
463
409
  * Default parameters for dropdown hover directive
464
410
  */
465
- const TUI_DROPDOWN_HOVER_OPTIONS = new InjectionToken(ngDevMode ? 'TUI_DROPDOWN_HOVER_OPTIONS' : '', {
466
- factory: () => TUI_DROPDOWN_HOVER_DEFAULT_OPTIONS,
467
- });
468
- function tuiDropdownHoverOptionsProvider(options) {
469
- return tuiProvideOptions(TUI_DROPDOWN_HOVER_OPTIONS, options, TUI_DROPDOWN_HOVER_DEFAULT_OPTIONS);
470
- }
411
+ const [TUI_DROPDOWN_HOVER_OPTIONS, tuiDropdownHoverOptionsProvider] = tuiCreateOptions(TUI_DROPDOWN_HOVER_DEFAULT_OPTIONS);
471
412
 
472
- function shouldClose(event) {
473
- return (
474
- // @ts-ignore
475
- typeof CloseWatcher === 'undefined' &&
476
- // ?. for auto fill events
477
- event.key?.toLowerCase() === 'escape' &&
478
- this.tuiDropdownEnabled &&
479
- !!this.tuiDropdownOpen &&
480
- !this['dropdown']()?.nextElementSibling);
413
+ class TuiDropdownClose {
414
+ constructor() {
415
+ this.el = tuiInjectElement();
416
+ this.ref = inject(TuiDropdownDirective).ref;
417
+ this.open = inject(TuiDropdownOpen);
418
+ this.obscured = inject(TuiObscured);
419
+ this.activeZone = inject(TuiActiveZone);
420
+ this.tuiDropdownClose = outputFromObservable(merge(inject(TuiDropdownDriver).pipe(tuiIfMap(() => merge(tuiCloseWatcher(), this.obscured.tuiObscured$.pipe(filter(Boolean)), this.activeZone.tuiActiveZoneChange.pipe(filter((a) => !a)), tuiTypedFromEvent(this.el, 'focusin').pipe(filter((event) => !this.open.host.contains(tuiGetActualTarget(event)) ||
421
+ !this.ref()))))),
422
+ // @ts-ignore
423
+ typeof CloseWatcher === 'undefined'
424
+ ? tuiTypedFromEvent(inject(DOCUMENT), 'keydown', { capture: true }).pipe(filter(({ key }) => key === 'Escape' &&
425
+ this.open.open() &&
426
+ !this.ref()?.location.nativeElement?.nextElementSibling), tuiStopPropagation())
427
+ : EMPTY));
428
+ }
429
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownClose, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
430
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.17", type: TuiDropdownClose, isStandalone: true, outputs: { tuiDropdownClose: "tuiDropdownClose" }, ngImport: i0 }); }
481
431
  }
432
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownClose, decorators: [{
433
+ type: Directive
434
+ }] });
435
+
482
436
  class TuiDropdownOpen {
483
437
  constructor() {
438
+ this.dropdownHost = contentChild('tuiDropdownHost', {
439
+ descendants: true,
440
+ read: ElementRef,
441
+ });
484
442
  this.directive = inject(TuiDropdownDirective);
485
443
  this.el = tuiInjectElement();
486
444
  this.obscured = inject(TuiObscured);
487
- this.activeZone = inject(TuiActiveZone);
488
- this.dropdown = computed(() => this.directive.ref()?.location.nativeElement);
489
- this.tuiDropdownEnabled = true;
490
- this.tuiDropdownOpen = false;
491
- this.tuiDropdownOpenChange = new EventEmitter();
492
- // TODO: make it private when all legacy controls will be deleted from @taiga-ui/legacy (5.0)
493
445
  this.driver = inject(TuiDropdownDriver);
494
- this.sub = this.driver
495
- .pipe(tuiIfMap(() => merge(tuiCloseWatcher(), this.obscured.tuiObscured.pipe(filter(Boolean)), this.activeZone.tuiActiveZoneChange.pipe(filter((a) => !a)), fromEvent(this.el, 'focusin').pipe(filter((event) => !this.host.contains(tuiGetActualTarget(event)) ||
496
- !this.directive.ref())))), tuiZonefull(), tuiWatch(), takeUntilDestroyed())
497
- .subscribe(() => this.toggle(false));
498
- this.sync = this.driver.pipe(takeUntilDestroyed()).subscribe((open) => {
499
- if (open !== this.tuiDropdownOpen) {
500
- this.update(open);
501
- }
502
- });
446
+ this.dropdown = computed(() => this.directive.ref()?.location.nativeElement);
447
+ this.enabled = input(true, { alias: 'tuiDropdownEnabled' });
448
+ this.open = model(false, { alias: 'tuiDropdownOpen' });
449
+ this.driveEffect = effect(() => this.drive(this.open()));
450
+ this.syncSub = this.driver
451
+ .pipe(filter((open) => open !== this.open()), takeUntilDestroyed())
452
+ .subscribe((open) => this.update(open));
453
+ this.keydownSub = tuiTypedFromEvent(inject(DOCUMENT), 'keydown')
454
+ .pipe(takeUntilDestroyed())
455
+ .subscribe((event) => this.onKeydown(event));
503
456
  }
504
- ngOnChanges() {
505
- this.drive(!!this.tuiDropdownOpen);
506
- this.tuiDropdownOpenChange.emit(!!this.tuiDropdownOpen);
457
+ get host() {
458
+ const initial = this.dropdownHost()?.nativeElement || this.el;
459
+ const focusable = tuiIsFocusable(initial)
460
+ ? initial
461
+ : tuiGetClosestFocusable({ initial, root: this.el });
462
+ return this.dropdownHost()?.nativeElement || focusable || this.el;
507
463
  }
508
464
  toggle(open) {
509
465
  if (this.focused && !open) {
@@ -511,25 +467,27 @@ class TuiDropdownOpen {
511
467
  }
512
468
  this.update(open);
513
469
  }
514
- onEsc(event) {
515
- event.preventDefault();
516
- this.toggle(false);
517
- }
518
470
  onClick(target) {
519
471
  if (!this.editable && this.host.contains(target)) {
520
- this.update(!this.tuiDropdownOpen);
472
+ this.update(!this.open());
521
473
  }
522
474
  }
523
475
  onArrow(event, up) {
524
476
  if (!tuiIsElement(event.target) ||
525
477
  !this.host.contains(event.target) ||
526
- !this.tuiDropdownEnabled ||
527
- !this.directive._content()) {
478
+ !this.enabled() ||
479
+ !this.directive.content()) {
528
480
  return;
529
481
  }
530
482
  event.preventDefault();
531
483
  this.focusDropdown(up);
532
484
  }
485
+ get editable() {
486
+ return tuiIsElementEditable(this.host);
487
+ }
488
+ get focused() {
489
+ return tuiIsFocusedIn(this.host) || tuiIsFocusedIn(this.dropdown());
490
+ }
533
491
  onKeydown(event) {
534
492
  const target = tuiGetActualTarget(event);
535
493
  if (!event.defaultPrevented &&
@@ -541,29 +499,15 @@ class TuiDropdownOpen {
541
499
  this.host.focus({ preventScroll: true });
542
500
  }
543
501
  }
544
- get host() {
545
- const initial = this.dropdownHost?.nativeElement || this.el;
546
- const focusable = tuiIsKeyboardFocusable(initial)
547
- ? initial
548
- : tuiGetClosestFocusable({ initial, root: this.el });
549
- return this.dropdownHost?.nativeElement || focusable || this.el;
550
- }
551
- get editable() {
552
- return tuiIsElementEditable(this.host);
553
- }
554
- get focused() {
555
- return tuiIsFocusedIn(this.host) || tuiIsFocusedIn(this.dropdown());
556
- }
557
502
  update(open) {
558
- if (open && !this.tuiDropdownEnabled) {
503
+ if (open && !this.enabled()) {
559
504
  return this.drive();
560
505
  }
561
- this.tuiDropdownOpen = open;
562
- this.tuiDropdownOpenChange.emit(open);
506
+ this.open.set(open);
563
507
  this.drive();
564
508
  }
565
- drive(open = !!this.tuiDropdownOpen && this.tuiDropdownEnabled) {
566
- this.obscured.tuiObscuredEnabled = open;
509
+ drive(open = this.open() && this.enabled()) {
510
+ tuiSetSignal(this.obscured.tuiObscuredEnabled, open);
567
511
  this.driver.next(open);
568
512
  }
569
513
  focusDropdown(previous) {
@@ -579,20 +523,20 @@ class TuiDropdownOpen {
579
523
  child.remove();
580
524
  focusable?.focus();
581
525
  }
582
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownOpen, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
583
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: TuiDropdownOpen, isStandalone: true, selector: "[tuiDropdown][tuiDropdownOpen],[tuiDropdown][tuiDropdownOpenChange]", inputs: { tuiDropdownEnabled: "tuiDropdownEnabled", tuiDropdownOpen: "tuiDropdownOpen" }, outputs: { tuiDropdownOpenChange: "tuiDropdownOpenChange" }, host: { listeners: { "click": "onClick($event.target)", "keydown.arrowDown": "onArrow($event, false)", "keydown.arrowUp": "onArrow($event, true)", "document:keydown.zoneless.capture": "onEsc($event)", "document:keydown.zoneless": "onKeydown($event)", "tuiActiveZoneChange": "0" } }, providers: [TuiDropdownDriver, tuiAsDriver(TuiDropdownDriver)], queries: [{ propertyName: "dropdownHost", first: true, predicate: ["tuiDropdownHost"], descendants: true, read: ElementRef }], usesOnChanges: true, hostDirectives: [{ directive: i1$1.TuiObscured }, { directive: i1.TuiActiveZone, inputs: ["tuiActiveZoneParent", "tuiActiveZoneParent"], outputs: ["tuiActiveZoneChange", "tuiActiveZoneChange"] }], ngImport: i0 }); }
526
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownOpen, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
527
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.17", type: TuiDropdownOpen, isStandalone: true, selector: "[tuiDropdown][tuiDropdownAuto],[tuiDropdown][tuiDropdownOpen],[tuiDropdown][tuiDropdownOpenChange]", inputs: { enabled: { classPropertyName: "enabled", publicName: "tuiDropdownEnabled", isSignal: true, isRequired: false, transformFunction: null }, open: { classPropertyName: "open", publicName: "tuiDropdownOpen", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "tuiDropdownOpenChange" }, host: { listeners: { "click": "onClick($event.target)", "keydown.arrowDown": "onArrow($event, false)", "keydown.arrowUp": "onArrow($event, true)", "tuiActiveZoneChange": "0", "tuiDropdownClose": "toggle(false)" } }, providers: [TuiDropdownDriver, tuiAsDriver(TuiDropdownDriver)], queries: [{ propertyName: "dropdownHost", first: true, predicate: ["tuiDropdownHost"], descendants: true, read: ElementRef, isSignal: true }], hostDirectives: [{ directive: i1$1.TuiObscured }, { directive: TuiDropdownClose, outputs: ["tuiDropdownClose", "tuiDropdownClose"] }, { directive: i1.TuiActiveZone, inputs: ["tuiActiveZoneParent", "tuiActiveZoneParent"], outputs: ["tuiActiveZoneChange", "tuiActiveZoneChange"] }], ngImport: i0 }); }
584
528
  }
585
- __decorate([
586
- shouldCall(shouldClose)
587
- ], TuiDropdownOpen.prototype, "onEsc", null);
588
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownOpen, decorators: [{
529
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownOpen, decorators: [{
589
530
  type: Directive,
590
531
  args: [{
591
- standalone: true,
592
- selector: '[tuiDropdown][tuiDropdownOpen],[tuiDropdown][tuiDropdownOpenChange]',
532
+ selector: '[tuiDropdown][tuiDropdownAuto],[tuiDropdown][tuiDropdownOpen],[tuiDropdown][tuiDropdownOpenChange]',
593
533
  providers: [TuiDropdownDriver, tuiAsDriver(TuiDropdownDriver)],
594
534
  hostDirectives: [
595
535
  TuiObscured,
536
+ {
537
+ directive: TuiDropdownClose,
538
+ outputs: ['tuiDropdownClose'],
539
+ },
596
540
  {
597
541
  directive: TuiActiveZone,
598
542
  inputs: ['tuiActiveZoneParent'],
@@ -603,43 +547,37 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
603
547
  '(click)': 'onClick($event.target)',
604
548
  '(keydown.arrowDown)': 'onArrow($event, false)',
605
549
  '(keydown.arrowUp)': 'onArrow($event, true)',
606
- '(document:keydown.zoneless.capture)': 'onEsc($event)',
607
- '(document:keydown.zoneless)': 'onKeydown($event)',
608
550
  // TODO: Necessary because startWith(false) + distinctUntilChanged() in TuiActiveZone, think of better solution
609
551
  '(tuiActiveZoneChange)': '0',
552
+ '(tuiDropdownClose)': 'toggle(false)',
610
553
  },
611
554
  }]
612
- }], propDecorators: { dropdownHost: [{
613
- type: ContentChild,
614
- args: ['tuiDropdownHost', { descendants: true, read: ElementRef }]
615
- }], tuiDropdownEnabled: [{
616
- type: Input
617
- }], tuiDropdownOpen: [{
618
- type: Input
619
- }], tuiDropdownOpenChange: [{
620
- type: Output
621
- }], onEsc: [] } });
555
+ }] });
622
556
 
623
557
  class TuiDropdownHover extends TuiDriver {
624
558
  constructor() {
625
559
  super((subscriber) => this.stream$.subscribe(subscriber));
560
+ this.dropdownHost = contentChild('tuiDropdownHost', {
561
+ descendants: true,
562
+ read: ElementRef,
563
+ });
564
+ this.hovered = false;
626
565
  this.el = tuiInjectElement();
627
566
  this.doc = inject(DOCUMENT);
628
567
  this.options = inject(TUI_DROPDOWN_HOVER_OPTIONS);
629
568
  this.activeZone = inject(TuiActiveZone);
630
569
  this.open = inject(TuiDropdownOpen, { optional: true });
570
+ this.stream$ = merge(
631
571
  /**
632
572
  * Dropdown can be removed not only via click/touch –
633
573
  * swipe on mobile devices removes dropdown sheet without triggering new mouseover / mouseout events.
634
574
  */
635
- this.dropdownExternalRemoval$ = toObservable(inject(TuiDropdownDirective).ref).pipe(filter((x) => !x && this.hovered));
636
- this.stream$ = merge(this.dropdownExternalRemoval$.pipe(switchMap(() => tuiTypedFromEvent(this.doc, 'pointerdown').pipe(map(tuiGetActualTarget), delay(this.hideDelay), startWith(null), takeUntil(fromEvent(this.doc, 'mouseover'))))), tuiTypedFromEvent(this.doc, 'mouseover').pipe(map(tuiGetActualTarget)), tuiTypedFromEvent(this.doc, 'mouseout').pipe(map((e) => e.relatedTarget))).pipe(map((element) => tuiIsElement(element) && this.isHovered(element)), distinctUntilChanged(), switchMap((v) => of(v).pipe(delay(v ? this.showDelay : this.hideDelay))), tuiZoneOptimized(), tap((hovered) => {
575
+ toObservable(inject(TuiDropdownDirective).ref).pipe(filter((x) => !x && this.hovered), switchMap(() => tuiTypedFromEvent(this.doc, 'pointerdown').pipe(map(tuiGetActualTarget), delay(this.tuiDropdownHideDelay()), startWith(null), takeUntil(fromEvent(this.doc, 'mouseover'))))), tuiTypedFromEvent(this.doc, 'mouseover').pipe(map(tuiGetActualTarget)), tuiTypedFromEvent(this.doc, 'mouseout').pipe(map((e) => e.relatedTarget))).pipe(map((element) => tuiIsElement(element) && this.isHovered(element)), distinctUntilChanged(), switchMap((v) => of(v).pipe(delay(v ? this.tuiDropdownShowDelay() : this.tuiDropdownHideDelay()))), tuiZoneOptimized(), tap((hovered) => {
637
576
  this.hovered = hovered;
638
577
  this.open?.toggle(hovered);
639
578
  }), share());
640
- this.showDelay = this.options.showDelay;
641
- this.hideDelay = this.options.hideDelay;
642
- this.hovered = false;
579
+ this.tuiDropdownShowDelay = input(this.options.showDelay);
580
+ this.tuiDropdownHideDelay = input(this.options.hideDelay);
643
581
  this.type = 'dropdown';
644
582
  }
645
583
  onClick(event) {
@@ -648,85 +586,43 @@ class TuiDropdownHover extends TuiDriver {
648
586
  }
649
587
  }
650
588
  isHovered(element) {
651
- const host = this.dropdownHost?.nativeElement || this.el;
589
+ const host = this.dropdownHost()?.nativeElement || this.el;
652
590
  const hovered = host.contains(element);
653
591
  const child = !this.el.contains(element) && this.activeZone.contains(element);
654
592
  return hovered || child;
655
593
  }
656
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownHover, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
657
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: TuiDropdownHover, isStandalone: true, selector: "[tuiDropdownHover]", inputs: { showDelay: ["tuiDropdownShowDelay", "showDelay"], hideDelay: ["tuiDropdownHideDelay", "hideDelay"] }, host: { listeners: { "click.capture": "onClick($event)" } }, providers: [TuiActiveZone, tuiAsDriver(TuiDropdownHover)], queries: [{ propertyName: "dropdownHost", first: true, predicate: ["tuiDropdownHost"], descendants: true, read: ElementRef }], usesInheritance: true, ngImport: i0 }); }
594
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownHover, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
595
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.17", type: TuiDropdownHover, isStandalone: true, selector: "[tuiDropdownHover]", inputs: { tuiDropdownShowDelay: { classPropertyName: "tuiDropdownShowDelay", publicName: "tuiDropdownShowDelay", isSignal: true, isRequired: false, transformFunction: null }, tuiDropdownHideDelay: { classPropertyName: "tuiDropdownHideDelay", publicName: "tuiDropdownHideDelay", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click.capture": "onClick($event)" } }, providers: [TuiActiveZone, tuiAsDriver(TuiDropdownHover)], queries: [{ propertyName: "dropdownHost", first: true, predicate: ["tuiDropdownHost"], descendants: true, read: ElementRef, isSignal: true }], usesInheritance: true, ngImport: i0 }); }
658
596
  }
659
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownHover, decorators: [{
597
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownHover, decorators: [{
660
598
  type: Directive,
661
599
  args: [{
662
- standalone: true,
663
600
  selector: '[tuiDropdownHover]',
664
601
  providers: [TuiActiveZone, tuiAsDriver(TuiDropdownHover)],
665
602
  host: {
666
603
  '(click.capture)': 'onClick($event)',
667
604
  },
668
605
  }]
669
- }], ctorParameters: () => [], propDecorators: { dropdownHost: [{
670
- type: ContentChild,
671
- args: ['tuiDropdownHost', { descendants: true, read: ElementRef }]
672
- }], showDelay: [{
673
- type: Input,
674
- args: ['tuiDropdownShowDelay']
675
- }], hideDelay: [{
676
- type: Input,
677
- args: ['tuiDropdownHideDelay']
678
- }] } });
606
+ }], ctorParameters: () => [] });
679
607
 
680
608
  class TuiDropdownManual {
681
609
  constructor() {
682
610
  this.driver = inject(TuiDropdownDriver);
683
- this.tuiDropdownManual = false;
611
+ this.tuiDropdownManual = input(false);
684
612
  }
685
613
  ngOnChanges() {
686
- this.driver.next(!!this.tuiDropdownManual);
614
+ this.driver.next(!!this.tuiDropdownManual());
687
615
  }
688
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownManual, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
689
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: TuiDropdownManual, isStandalone: true, selector: "[tuiDropdownManual]", inputs: { tuiDropdownManual: "tuiDropdownManual" }, providers: [TuiDropdownDriver, tuiAsDriver(TuiDropdownDriver)], usesOnChanges: true, ngImport: i0 }); }
616
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownManual, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
617
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.17", type: TuiDropdownManual, isStandalone: true, selector: "[tuiDropdownManual]", inputs: { tuiDropdownManual: { classPropertyName: "tuiDropdownManual", publicName: "tuiDropdownManual", isSignal: true, isRequired: false, transformFunction: null } }, providers: [TuiDropdownDriver, tuiAsDriver(TuiDropdownDriver)], usesOnChanges: true, ngImport: i0 }); }
690
618
  }
691
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownManual, decorators: [{
619
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownManual, decorators: [{
692
620
  type: Directive,
693
621
  args: [{
694
- standalone: true,
695
622
  selector: '[tuiDropdownManual]',
696
623
  providers: [TuiDropdownDriver, tuiAsDriver(TuiDropdownDriver)],
697
624
  }]
698
- }], propDecorators: { tuiDropdownManual: [{
699
- type: Input
700
- }] } });
701
-
702
- /**
703
- * @deprecated TODO: remove in v.5 when legacy controls are dropped
704
- */
705
- class TuiDropdownOpenLegacy {
706
- constructor() {
707
- this.openStateSub = new Subject();
708
- this.tuiDropdownOpenChange = this.openStateSub.pipe(distinctUntilChanged());
709
- }
710
- set tuiDropdownOpen(open) {
711
- this.emitOpenChange(open);
712
- }
713
- emitOpenChange(open) {
714
- this.openStateSub.next(open);
715
- }
716
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownOpenLegacy, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
717
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: TuiDropdownOpenLegacy, isStandalone: true, selector: "[tuiDropdownOpen]:not([tuiDropdown]),[tuiDropdownOpenChange]:not([tuiDropdown])", inputs: { tuiDropdownOpen: "tuiDropdownOpen" }, outputs: { tuiDropdownOpenChange: "tuiDropdownOpenChange" }, ngImport: i0 }); }
718
- }
719
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownOpenLegacy, decorators: [{
720
- type: Directive,
721
- args: [{
722
- standalone: true,
723
- selector: '[tuiDropdownOpen]:not([tuiDropdown]),[tuiDropdownOpenChange]:not([tuiDropdown])',
724
- }]
725
- }], propDecorators: { tuiDropdownOpenChange: [{
726
- type: Output
727
- }], tuiDropdownOpen: [{
728
- type: Input
729
- }] } });
625
+ }] });
730
626
 
731
627
  class TuiDropdownPositionSided extends TuiPositionAccessor {
732
628
  constructor() {
@@ -735,12 +631,12 @@ class TuiDropdownPositionSided extends TuiPositionAccessor {
735
631
  this.viewport = inject(TUI_VIEWPORT);
736
632
  this.vertical = inject(TuiDropdownPosition);
737
633
  this.previous = this.options.direction || 'bottom';
738
- this.tuiDropdownSided = '';
739
- this.tuiDropdownSidedOffset = 4;
634
+ this.tuiDropdownSided = input('');
635
+ this.tuiDropdownSidedOffset = input(4);
740
636
  this.type = 'dropdown';
741
637
  }
742
638
  getPosition(rect) {
743
- if (this.tuiDropdownSided === false) {
639
+ if (this.tuiDropdownSided() === false) {
744
640
  return this.vertical.getPosition(rect);
745
641
  }
746
642
  const { height, width } = rect;
@@ -756,38 +652,33 @@ class TuiDropdownPositionSided extends TuiPositionAccessor {
756
652
  bottom: viewport.bottom - hostRect.top,
757
653
  };
758
654
  const position = {
759
- top: hostRect.bottom - height + this.tuiDropdownSidedOffset + 1, // 1 for border
655
+ top: hostRect.bottom - height + this.tuiDropdownSidedOffset() + 1, // 1 for border
760
656
  left: hostRect.left - width - offset,
761
657
  right: hostRect.right + offset,
762
- bottom: hostRect.top - this.tuiDropdownSidedOffset - 1, // 1 for border
658
+ bottom: hostRect.top - this.tuiDropdownSidedOffset() - 1, // 1 for border
763
659
  };
764
660
  const better = available.top > available.bottom ? 'top' : 'bottom';
765
661
  const maxLeft = available.left > available.right ? position.left : position.right;
766
662
  const left = available[align] > width ? position[align] : maxLeft;
767
663
  if ((available[this.previous] > height && direction) ||
768
664
  this.previous === better) {
769
- this.vertical.emitDirection(this.previous);
770
- return [position[this.previous], left];
665
+ this.vertical.direction.next(this.previous);
666
+ return [left, position[this.previous]];
771
667
  }
772
668
  this.previous = better;
773
- this.vertical.emitDirection(better);
774
- return [position[better], left];
669
+ this.vertical.direction.next(better);
670
+ return [left, position[better]];
775
671
  }
776
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownPositionSided, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
777
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: TuiDropdownPositionSided, isStandalone: true, selector: "[tuiDropdownSided]", inputs: { tuiDropdownSided: "tuiDropdownSided", tuiDropdownSidedOffset: "tuiDropdownSidedOffset" }, providers: [TuiDropdownPosition, tuiAsPositionAccessor(TuiDropdownPositionSided)], usesInheritance: true, ngImport: i0 }); }
672
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownPositionSided, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
673
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.17", type: TuiDropdownPositionSided, isStandalone: true, selector: "[tuiDropdownSided]", inputs: { tuiDropdownSided: { classPropertyName: "tuiDropdownSided", publicName: "tuiDropdownSided", isSignal: true, isRequired: false, transformFunction: null }, tuiDropdownSidedOffset: { classPropertyName: "tuiDropdownSidedOffset", publicName: "tuiDropdownSidedOffset", isSignal: true, isRequired: false, transformFunction: null } }, providers: [TuiDropdownPosition, tuiAsPositionAccessor(TuiDropdownPositionSided)], usesInheritance: true, ngImport: i0 }); }
778
674
  }
779
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownPositionSided, decorators: [{
675
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownPositionSided, decorators: [{
780
676
  type: Directive,
781
677
  args: [{
782
- standalone: true,
783
678
  selector: '[tuiDropdownSided]',
784
679
  providers: [TuiDropdownPosition, tuiAsPositionAccessor(TuiDropdownPositionSided)],
785
680
  }]
786
- }], propDecorators: { tuiDropdownSided: [{
787
- type: Input
788
- }], tuiDropdownSidedOffset: [{
789
- type: Input
790
- }] } });
681
+ }] });
791
682
 
792
683
  class TuiDropdownSelection extends TuiDriver {
793
684
  constructor() {
@@ -796,9 +687,9 @@ class TuiDropdownSelection extends TuiDriver {
796
687
  this.vcr = inject(ViewContainerRef);
797
688
  this.dropdown = inject(TuiDropdownDirective);
798
689
  this.el = tuiInjectElement();
799
- this.handler$ = new BehaviorSubject(TUI_TRUE_HANDLER);
690
+ this.handler = computed((visible = this.tuiDropdownSelection()) => tuiIsString(visible) ? TUI_TRUE_HANDLER : visible);
800
691
  this.stream$ = combineLatest([
801
- this.handler$,
692
+ toObservable(this.handler),
802
693
  inject(TUI_SELECTION_STREAM).pipe(map(() => this.getRange()), filter((range) => this.isValid(range)), distinctUntilChanged((x, y) => x.startOffset === y.startOffset &&
803
694
  x.endOffset === y.endOffset &&
804
695
  x.commonAncestorContainer === y.commonAncestorContainer)),
@@ -810,17 +701,15 @@ class TuiDropdownSelection extends TuiDriver {
810
701
  : this.range;
811
702
  return (contained && handler(this.range)) || this.inDropdown(range);
812
703
  }));
813
- this.range = inject(TUI_RANGE);
814
- this.position = 'selection';
704
+ this.range = isPlatformBrowser(inject(PLATFORM_ID))
705
+ ? new Range()
706
+ : {};
815
707
  this.type = 'dropdown';
816
- }
817
- set tuiDropdownSelection(visible) {
818
- if (!tuiIsString(visible)) {
819
- this.handler$.next(visible);
820
- }
708
+ this.tuiDropdownSelection = input('');
709
+ this.tuiDropdownSelectionPosition = input('selection');
821
710
  }
822
711
  getClientRect() {
823
- switch (this.position) {
712
+ switch (this.tuiDropdownSelectionPosition()) {
824
713
  case 'tag': {
825
714
  const { commonAncestorContainer } = this.range;
826
715
  const element = tuiIsElement(commonAncestorContainer)
@@ -911,28 +800,22 @@ class TuiDropdownSelection extends TuiDriver {
911
800
  this.ghost = ghost;
912
801
  return ghost;
913
802
  }
914
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownSelection, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
915
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: TuiDropdownSelection, isStandalone: true, selector: "[tuiDropdownSelection]", inputs: { position: ["tuiDropdownSelectionPosition", "position"], tuiDropdownSelection: "tuiDropdownSelection" }, providers: [
803
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownSelection, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
804
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.17", type: TuiDropdownSelection, isStandalone: true, selector: "[tuiDropdownSelection]", inputs: { tuiDropdownSelection: { classPropertyName: "tuiDropdownSelection", publicName: "tuiDropdownSelection", isSignal: true, isRequired: false, transformFunction: null }, tuiDropdownSelectionPosition: { classPropertyName: "tuiDropdownSelectionPosition", publicName: "tuiDropdownSelectionPosition", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
916
805
  tuiAsDriver(TuiDropdownSelection),
917
806
  tuiAsRectAccessor(TuiDropdownSelection),
918
807
  ], usesInheritance: true, ngImport: i0 }); }
919
808
  }
920
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownSelection, decorators: [{
809
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownSelection, decorators: [{
921
810
  type: Directive,
922
811
  args: [{
923
- standalone: true,
924
812
  selector: '[tuiDropdownSelection]',
925
813
  providers: [
926
814
  tuiAsDriver(TuiDropdownSelection),
927
815
  tuiAsRectAccessor(TuiDropdownSelection),
928
816
  ],
929
817
  }]
930
- }], ctorParameters: () => [], propDecorators: { position: [{
931
- type: Input,
932
- args: ['tuiDropdownSelectionPosition']
933
- }], tuiDropdownSelection: [{
934
- type: Input
935
- }] } });
818
+ }], ctorParameters: () => [] });
936
819
 
937
820
  const TuiDropdown = [
938
821
  TuiDropdownOptionsDirective,
@@ -940,7 +823,6 @@ const TuiDropdown = [
940
823
  TuiDropdownDirective,
941
824
  TuiDropdownComponent,
942
825
  TuiDropdownOpen,
943
- TuiDropdownOpenLegacy,
944
826
  TuiDropdownManual,
945
827
  TuiDropdownHover,
946
828
  TuiDropdownContent,
@@ -954,28 +836,20 @@ function tuiDropdown(value) {
954
836
  return tuiDirectiveBinding(TuiDropdownDirective, 'tuiDropdown', value, {});
955
837
  }
956
838
  function tuiDropdownEnabled(value) {
957
- return tuiDirectiveBinding(TuiDropdownOpen, 'tuiDropdownEnabled', value, {});
958
- }
959
- function tuiDropdownOpen() {
960
- const open = tuiDirectiveBinding(TuiDropdownOpen, 'tuiDropdownOpen', false, {});
961
- inject(TuiDropdownOpen)
962
- .tuiDropdownOpenChange.pipe(takeUntilDestroyed())
963
- .subscribe((value) => open.set(value));
964
- return open;
839
+ return tuiDirectiveBinding(TuiDropdownOpen, 'enabled', value, {});
965
840
  }
966
841
 
967
842
  class TuiDropdownFixed {
968
843
  constructor() {
969
- const override = tuiOverrideOptions$1({ limitWidth: 'fixed' }, TUI_DROPDOWN_DEFAULT_OPTIONS);
844
+ const override = tuiOverrideOptions({ limitWidth: 'fixed' }, TUI_DROPDOWN_DEFAULT_OPTIONS);
970
845
  override(inject(TUI_DROPDOWN_OPTIONS, { self: true, optional: true }), null);
971
846
  }
972
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownFixed, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
973
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: TuiDropdownFixed, isStandalone: true, providers: [tuiDropdownOptionsProvider({})], ngImport: i0 }); }
847
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownFixed, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
848
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.17", type: TuiDropdownFixed, isStandalone: true, providers: [tuiDropdownOptionsProvider({})], ngImport: i0 }); }
974
849
  }
975
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownFixed, decorators: [{
850
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownFixed, decorators: [{
976
851
  type: Directive,
977
852
  args: [{
978
- standalone: true,
979
853
  providers: [tuiDropdownOptionsProvider({})],
980
854
  }]
981
855
  }], ctorParameters: () => [] });
@@ -987,22 +861,20 @@ class TuiDropdownAuto {
987
861
  */
988
862
  inject(TUI_DROPDOWN_OPTIONS).limitWidth = 'auto';
989
863
  }
990
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownAuto, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
991
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: TuiDropdownAuto, isStandalone: true, ngImport: i0 }); }
864
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownAuto, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
865
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.17", type: TuiDropdownAuto, isStandalone: true, ngImport: i0 }); }
992
866
  }
993
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDropdownAuto, decorators: [{
994
- type: Directive,
995
- args: [{ standalone: true }]
867
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiDropdownAuto, decorators: [{
868
+ type: Directive
996
869
  }], ctorParameters: () => [] });
997
870
 
998
871
  class TuiWithDropdownOpen {
999
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiWithDropdownOpen, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1000
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: TuiWithDropdownOpen, isStandalone: true, hostDirectives: [{ directive: TuiDropdownOpen, inputs: ["tuiDropdownOpen", "open", "tuiDropdownEnabled", "tuiDropdownEnabled"], outputs: ["tuiDropdownOpenChange", "openChange"] }], ngImport: i0 }); }
872
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiWithDropdownOpen, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
873
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.17", type: TuiWithDropdownOpen, isStandalone: true, hostDirectives: [{ directive: TuiDropdownOpen, inputs: ["tuiDropdownOpen", "open", "tuiDropdownEnabled", "tuiDropdownEnabled"], outputs: ["tuiDropdownOpenChange", "openChange"] }], ngImport: i0 }); }
1001
874
  }
1002
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiWithDropdownOpen, decorators: [{
875
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiWithDropdownOpen, decorators: [{
1003
876
  type: Directive,
1004
877
  args: [{
1005
- standalone: true,
1006
878
  hostDirectives: [
1007
879
  {
1008
880
  directive: TuiDropdownOpen,
@@ -1017,5 +889,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
1017
889
  * Generated bundle index. Do not edit.
1018
890
  */
1019
891
 
1020
- export { TUI_DROPDOWN_COMPONENT, TUI_DROPDOWN_CONTEXT, TUI_DROPDOWN_DEFAULT_OPTIONS, TUI_DROPDOWN_HOVER_DEFAULT_OPTIONS, TUI_DROPDOWN_HOVER_OPTIONS, TUI_DROPDOWN_OPTIONS, TuiDropdown, TuiDropdownAuto, TuiDropdownComponent, TuiDropdownContent, TuiDropdownContext, TuiDropdownDirective, TuiDropdownDriver, TuiDropdownDriverDirective, TuiDropdownFixed, TuiDropdownHover, TuiDropdownManual, TuiDropdownOpen, TuiDropdownOpenLegacy, TuiDropdownOptionsDirective, TuiDropdownPosition, TuiDropdownPositionSided, TuiDropdownSelection, TuiWithDropdownOpen, tuiDropdown, tuiDropdownEnabled, tuiDropdownHoverOptionsProvider, tuiDropdownOpen, tuiDropdownOptionsProvider };
1021
- //# sourceMappingURL=taiga-ui-core-directives-dropdown.mjs.map
892
+ export { TUI_DROPDOWN_COMPONENT, TUI_DROPDOWN_CONTEXT, TUI_DROPDOWN_DEFAULT_OPTIONS, TUI_DROPDOWN_HOVER_DEFAULT_OPTIONS, TUI_DROPDOWN_HOVER_OPTIONS, TUI_DROPDOWN_OPTIONS, TuiDropdown, TuiDropdownAuto, TuiDropdownClose, TuiDropdownComponent, TuiDropdownContent, TuiDropdownContext, TuiDropdownDirective, TuiDropdownDriver, TuiDropdownDriverDirective, TuiDropdownFixed, TuiDropdownHover, TuiDropdownManual, TuiDropdownOpen, TuiDropdownOptionsDirective, TuiDropdownPosition, TuiDropdownPositionSided, TuiDropdownSelection, TuiWithDropdownOpen, tuiDropdown, tuiDropdownEnabled, tuiDropdownHoverOptionsProvider, tuiDropdownOptionsProvider };
893
+ //# sourceMappingURL=taiga-ui-core-portals-dropdown.mjs.map