@taiga-ui/kit 2.36.0 → 2.38.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 (490) hide show
  1. package/abstract/input-slider.d.ts +30 -7
  2. package/abstract/taiga-ui-kit-abstract.metadata.json +1 -1
  3. package/bundles/taiga-ui-kit-abstract.umd.js +67 -21
  4. package/bundles/taiga-ui-kit-abstract.umd.js.map +1 -1
  5. package/bundles/taiga-ui-kit-abstract.umd.min.js +2 -2
  6. package/bundles/taiga-ui-kit-abstract.umd.min.js.map +1 -1
  7. package/bundles/taiga-ui-kit-components-accordion.umd.js +2 -2
  8. package/bundles/taiga-ui-kit-components-accordion.umd.js.map +1 -1
  9. package/bundles/taiga-ui-kit-components-accordion.umd.min.js +1 -1
  10. package/bundles/taiga-ui-kit-components-accordion.umd.min.js.map +1 -1
  11. package/bundles/taiga-ui-kit-components-arrow.umd.js.map +1 -1
  12. package/bundles/taiga-ui-kit-components-arrow.umd.min.js.map +1 -1
  13. package/bundles/taiga-ui-kit-components-badge.umd.js.map +1 -1
  14. package/bundles/taiga-ui-kit-components-badge.umd.min.js.map +1 -1
  15. package/bundles/taiga-ui-kit-components-badged-content.umd.js +1 -1
  16. package/bundles/taiga-ui-kit-components-badged-content.umd.js.map +1 -1
  17. package/bundles/taiga-ui-kit-components-badged-content.umd.min.js +1 -1
  18. package/bundles/taiga-ui-kit-components-badged-content.umd.min.js.map +1 -1
  19. package/bundles/taiga-ui-kit-components-checkbox.umd.js +2 -2
  20. package/bundles/taiga-ui-kit-components-checkbox.umd.js.map +1 -1
  21. package/bundles/taiga-ui-kit-components-checkbox.umd.min.js +2 -2
  22. package/bundles/taiga-ui-kit-components-checkbox.umd.min.js.map +1 -1
  23. package/bundles/taiga-ui-kit-components-combo-box.umd.js.map +1 -1
  24. package/bundles/taiga-ui-kit-components-combo-box.umd.min.js.map +1 -1
  25. package/bundles/taiga-ui-kit-components-data-list-wrapper.umd.js +4 -4
  26. package/bundles/taiga-ui-kit-components-data-list-wrapper.umd.js.map +1 -1
  27. package/bundles/taiga-ui-kit-components-data-list-wrapper.umd.min.js +2 -2
  28. package/bundles/taiga-ui-kit-components-data-list-wrapper.umd.min.js.map +1 -1
  29. package/bundles/taiga-ui-kit-components-files.umd.js +504 -0
  30. package/bundles/taiga-ui-kit-components-files.umd.js.map +1 -0
  31. package/bundles/taiga-ui-kit-components-files.umd.min.js +16 -0
  32. package/bundles/taiga-ui-kit-components-files.umd.min.js.map +1 -0
  33. package/bundles/taiga-ui-kit-components-input-count.umd.js +2 -2
  34. package/bundles/taiga-ui-kit-components-input-count.umd.js.map +1 -1
  35. package/bundles/taiga-ui-kit-components-input-count.umd.min.js +1 -1
  36. package/bundles/taiga-ui-kit-components-input-count.umd.min.js.map +1 -1
  37. package/bundles/taiga-ui-kit-components-input-date-range.umd.js +3 -1
  38. package/bundles/taiga-ui-kit-components-input-date-range.umd.js.map +1 -1
  39. package/bundles/taiga-ui-kit-components-input-date-range.umd.min.js.map +1 -1
  40. package/bundles/taiga-ui-kit-components-input-date-time.umd.js +1 -1
  41. package/bundles/taiga-ui-kit-components-input-date-time.umd.js.map +1 -1
  42. package/bundles/taiga-ui-kit-components-input-date-time.umd.min.js +1 -1
  43. package/bundles/taiga-ui-kit-components-input-date-time.umd.min.js.map +1 -1
  44. package/bundles/taiga-ui-kit-components-input-date.umd.js +4 -2
  45. package/bundles/taiga-ui-kit-components-input-date.umd.js.map +1 -1
  46. package/bundles/taiga-ui-kit-components-input-date.umd.min.js +1 -1
  47. package/bundles/taiga-ui-kit-components-input-date.umd.min.js.map +1 -1
  48. package/bundles/taiga-ui-kit-components-input-file.umd.js +43 -45
  49. package/bundles/taiga-ui-kit-components-input-file.umd.js.map +1 -1
  50. package/bundles/taiga-ui-kit-components-input-file.umd.min.js +1 -1
  51. package/bundles/taiga-ui-kit-components-input-file.umd.min.js.map +1 -1
  52. package/bundles/taiga-ui-kit-components-input-files.umd.js +498 -0
  53. package/bundles/taiga-ui-kit-components-input-files.umd.js.map +1 -0
  54. package/bundles/taiga-ui-kit-components-input-files.umd.min.js +16 -0
  55. package/bundles/taiga-ui-kit-components-input-files.umd.min.js.map +1 -0
  56. package/bundles/taiga-ui-kit-components-input-number.umd.js +37 -28
  57. package/bundles/taiga-ui-kit-components-input-number.umd.js.map +1 -1
  58. package/bundles/taiga-ui-kit-components-input-number.umd.min.js +2 -2
  59. package/bundles/taiga-ui-kit-components-input-number.umd.min.js.map +1 -1
  60. package/bundles/taiga-ui-kit-components-input-password.umd.js +2 -2
  61. package/bundles/taiga-ui-kit-components-input-password.umd.js.map +1 -1
  62. package/bundles/taiga-ui-kit-components-input-password.umd.min.js +1 -1
  63. package/bundles/taiga-ui-kit-components-input-password.umd.min.js.map +1 -1
  64. package/bundles/taiga-ui-kit-components-input-phone-international.umd.js +20 -8
  65. package/bundles/taiga-ui-kit-components-input-phone-international.umd.js.map +1 -1
  66. package/bundles/taiga-ui-kit-components-input-phone-international.umd.min.js +2 -2
  67. package/bundles/taiga-ui-kit-components-input-phone-international.umd.min.js.map +1 -1
  68. package/bundles/taiga-ui-kit-components-input-phone.umd.js +5 -4
  69. package/bundles/taiga-ui-kit-components-input-phone.umd.js.map +1 -1
  70. package/bundles/taiga-ui-kit-components-input-phone.umd.min.js +1 -1
  71. package/bundles/taiga-ui-kit-components-input-phone.umd.min.js.map +1 -1
  72. package/bundles/taiga-ui-kit-components-input-range.umd.js +26 -4
  73. package/bundles/taiga-ui-kit-components-input-range.umd.js.map +1 -1
  74. package/bundles/taiga-ui-kit-components-input-range.umd.min.js +2 -2
  75. package/bundles/taiga-ui-kit-components-input-range.umd.min.js.map +1 -1
  76. package/bundles/taiga-ui-kit-components-input-slider.umd.js +200 -117
  77. package/bundles/taiga-ui-kit-components-input-slider.umd.js.map +1 -1
  78. package/bundles/taiga-ui-kit-components-input-slider.umd.min.js +2 -2
  79. package/bundles/taiga-ui-kit-components-input-slider.umd.min.js.map +1 -1
  80. package/bundles/taiga-ui-kit-components-input-tag.umd.js +1 -1
  81. package/bundles/taiga-ui-kit-components-input-tag.umd.js.map +1 -1
  82. package/bundles/taiga-ui-kit-components-input-tag.umd.min.js +1 -1
  83. package/bundles/taiga-ui-kit-components-input-tag.umd.min.js.map +1 -1
  84. package/bundles/taiga-ui-kit-components-input-time.umd.js.map +1 -1
  85. package/bundles/taiga-ui-kit-components-input-time.umd.min.js.map +1 -1
  86. package/bundles/taiga-ui-kit-components-input.umd.js.map +1 -1
  87. package/bundles/taiga-ui-kit-components-input.umd.min.js.map +1 -1
  88. package/bundles/taiga-ui-kit-components-line-clamp.umd.js +2 -2
  89. package/bundles/taiga-ui-kit-components-line-clamp.umd.js.map +1 -1
  90. package/bundles/taiga-ui-kit-components-line-clamp.umd.min.js +1 -1
  91. package/bundles/taiga-ui-kit-components-line-clamp.umd.min.js.map +1 -1
  92. package/bundles/taiga-ui-kit-components-multi-select-option.umd.js +2 -2
  93. package/bundles/taiga-ui-kit-components-multi-select-option.umd.js.map +1 -1
  94. package/bundles/taiga-ui-kit-components-multi-select-option.umd.min.js +1 -1
  95. package/bundles/taiga-ui-kit-components-multi-select-option.umd.min.js.map +1 -1
  96. package/bundles/taiga-ui-kit-components-multi-select.umd.js +2 -2
  97. package/bundles/taiga-ui-kit-components-multi-select.umd.js.map +1 -1
  98. package/bundles/taiga-ui-kit-components-multi-select.umd.min.js +1 -1
  99. package/bundles/taiga-ui-kit-components-multi-select.umd.min.js.map +1 -1
  100. package/bundles/taiga-ui-kit-components-pagination.umd.js +1 -1
  101. package/bundles/taiga-ui-kit-components-pagination.umd.js.map +1 -1
  102. package/bundles/taiga-ui-kit-components-pagination.umd.min.js +1 -1
  103. package/bundles/taiga-ui-kit-components-pagination.umd.min.js.map +1 -1
  104. package/bundles/taiga-ui-kit-components-progress.umd.js +1 -1
  105. package/bundles/taiga-ui-kit-components-progress.umd.js.map +1 -1
  106. package/bundles/taiga-ui-kit-components-progress.umd.min.js +1 -1
  107. package/bundles/taiga-ui-kit-components-progress.umd.min.js.map +1 -1
  108. package/bundles/taiga-ui-kit-components-radio.umd.js +1 -1
  109. package/bundles/taiga-ui-kit-components-radio.umd.js.map +1 -1
  110. package/bundles/taiga-ui-kit-components-radio.umd.min.js +1 -1
  111. package/bundles/taiga-ui-kit-components-radio.umd.min.js.map +1 -1
  112. package/bundles/taiga-ui-kit-components-select.umd.js +1 -1
  113. package/bundles/taiga-ui-kit-components-select.umd.js.map +1 -1
  114. package/bundles/taiga-ui-kit-components-select.umd.min.js +1 -1
  115. package/bundles/taiga-ui-kit-components-select.umd.min.js.map +1 -1
  116. package/bundles/taiga-ui-kit-components-slider.umd.js +66 -21
  117. package/bundles/taiga-ui-kit-components-slider.umd.js.map +1 -1
  118. package/bundles/taiga-ui-kit-components-slider.umd.min.js +2 -2
  119. package/bundles/taiga-ui-kit-components-slider.umd.min.js.map +1 -1
  120. package/bundles/taiga-ui-kit-components-text-area.umd.js +2 -2
  121. package/bundles/taiga-ui-kit-components-text-area.umd.js.map +1 -1
  122. package/bundles/taiga-ui-kit-components-text-area.umd.min.js +1 -1
  123. package/bundles/taiga-ui-kit-components-text-area.umd.min.js.map +1 -1
  124. package/bundles/taiga-ui-kit-components-toggle.umd.js +2 -2
  125. package/bundles/taiga-ui-kit-components-toggle.umd.js.map +1 -1
  126. package/bundles/taiga-ui-kit-components-toggle.umd.min.js +1 -1
  127. package/bundles/taiga-ui-kit-components-toggle.umd.min.js.map +1 -1
  128. package/bundles/taiga-ui-kit-components.umd.js +20 -4
  129. package/bundles/taiga-ui-kit-components.umd.js.map +1 -1
  130. package/bundles/taiga-ui-kit-components.umd.min.js +1 -1
  131. package/bundles/taiga-ui-kit-enums.umd.js.map +1 -1
  132. package/bundles/taiga-ui-kit-enums.umd.min.js.map +1 -1
  133. package/bundles/taiga-ui-kit-internal-primitive-calendar-range.umd.js +25 -1
  134. package/bundles/taiga-ui-kit-internal-primitive-calendar-range.umd.js.map +1 -1
  135. package/bundles/taiga-ui-kit-internal-primitive-calendar-range.umd.min.js +2 -2
  136. package/bundles/taiga-ui-kit-internal-primitive-calendar-range.umd.min.js.map +1 -1
  137. package/bundles/taiga-ui-kit-pipes-field-error.umd.js +10 -2
  138. package/bundles/taiga-ui-kit-pipes-field-error.umd.js.map +1 -1
  139. package/bundles/taiga-ui-kit-pipes-field-error.umd.min.js +1 -1
  140. package/bundles/taiga-ui-kit-pipes-field-error.umd.min.js.map +1 -1
  141. package/bundles/taiga-ui-kit-tokens.umd.js +8 -0
  142. package/bundles/taiga-ui-kit-tokens.umd.js.map +1 -1
  143. package/bundles/taiga-ui-kit-tokens.umd.min.js +1 -1
  144. package/bundles/taiga-ui-kit-tokens.umd.min.js.map +1 -1
  145. package/bundles/taiga-ui-kit-utils-files.umd.js +8 -0
  146. package/bundles/taiga-ui-kit-utils-files.umd.js.map +1 -1
  147. package/bundles/taiga-ui-kit-utils-files.umd.min.js +1 -1
  148. package/bundles/taiga-ui-kit-utils-files.umd.min.js.map +1 -1
  149. package/components/accordion/taiga-ui-kit-components-accordion.metadata.json +1 -1
  150. package/components/arrow/arrow-options.d.ts +4 -2
  151. package/components/arrow/taiga-ui-kit-components-arrow.metadata.json +1 -1
  152. package/components/badge/badge.component.d.ts +2 -1
  153. package/components/badge/taiga-ui-kit-components-badge.metadata.json +1 -1
  154. package/components/checkbox/taiga-ui-kit-components-checkbox.metadata.json +1 -1
  155. package/components/combo-box/combo-box.component.d.ts +4 -4
  156. package/components/combo-box/taiga-ui-kit-components-combo-box.metadata.json +1 -1
  157. package/components/data-list-wrapper/taiga-ui-kit-components-data-list-wrapper.metadata.json +1 -1
  158. package/components/files/file/file.component.d.ts +42 -0
  159. package/components/files/files.component.d.ts +12 -0
  160. package/components/files/files.module.d.ts +2 -0
  161. package/components/files/index.d.ts +2 -0
  162. package/components/files/package.json +13 -0
  163. package/components/files/taiga-ui-kit-components-files.d.ts +5 -0
  164. package/components/files/taiga-ui-kit-components-files.metadata.json +1 -0
  165. package/components/index.d.ts +2 -0
  166. package/components/input/input.component.d.ts +2 -2
  167. package/components/input/taiga-ui-kit-components-input.metadata.json +1 -1
  168. package/components/input-count/input-count.component.d.ts +3 -2
  169. package/components/input-count/taiga-ui-kit-components-input-count.metadata.json +1 -1
  170. package/components/input-date/input-date.component.d.ts +5 -3
  171. package/components/input-date/taiga-ui-kit-components-input-date.metadata.json +1 -1
  172. package/components/input-date-range/input-date-range.component.d.ts +3 -2
  173. package/components/input-date-range/taiga-ui-kit-components-input-date-range.metadata.json +1 -1
  174. package/components/input-date-time/input-date-time.component.d.ts +7 -5
  175. package/components/input-date-time/taiga-ui-kit-components-input-date-time.metadata.json +1 -1
  176. package/components/input-file/file/file.component.d.ts +1 -1
  177. package/components/input-file/taiga-ui-kit-components-input-file.metadata.json +1 -1
  178. package/components/input-files/index.d.ts +2 -0
  179. package/components/input-files/input-files.component.d.ts +42 -0
  180. package/components/input-files/input-files.module.d.ts +2 -0
  181. package/components/input-files/package.json +13 -0
  182. package/components/input-files/taiga-ui-kit-components-input-files.d.ts +4 -0
  183. package/components/input-files/taiga-ui-kit-components-input-files.metadata.json +1 -0
  184. package/components/input-number/input-number.component.d.ts +7 -4
  185. package/components/input-number/taiga-ui-kit-components-input-number.metadata.json +1 -1
  186. package/components/input-password/input-password.component.d.ts +4 -3
  187. package/components/input-password/taiga-ui-kit-components-input-password.metadata.json +1 -1
  188. package/components/input-phone/input-phone.component.d.ts +5 -6
  189. package/components/input-phone/taiga-ui-kit-components-input-phone.metadata.json +1 -1
  190. package/components/input-phone-international/input-phone-international.component.d.ts +4 -2
  191. package/components/input-phone-international/taiga-ui-kit-components-input-phone-international.metadata.json +1 -1
  192. package/components/input-range/input-range.component.d.ts +4 -1
  193. package/components/input-range/taiga-ui-kit-components-input-range.metadata.json +1 -1
  194. package/components/input-slider/input-slider.component.d.ts +56 -23
  195. package/components/input-slider/taiga-ui-kit-components-input-slider.metadata.json +1 -1
  196. package/components/input-tag/input-tag.component.d.ts +2 -1
  197. package/components/input-tag/taiga-ui-kit-components-input-tag.metadata.json +1 -1
  198. package/components/input-time/input-time.component.d.ts +2 -2
  199. package/components/input-time/taiga-ui-kit-components-input-time.metadata.json +1 -1
  200. package/components/multi-select/multi-select.component.d.ts +5 -5
  201. package/components/multi-select/taiga-ui-kit-components-multi-select.metadata.json +1 -1
  202. package/components/multi-select-option/taiga-ui-kit-components-multi-select-option.metadata.json +1 -1
  203. package/components/pagination/taiga-ui-kit-components-pagination.metadata.json +1 -1
  204. package/components/progress/utils/calculate-color-segments.d.ts +0 -4
  205. package/components/radio/radio.component.d.ts +1 -1
  206. package/components/radio/taiga-ui-kit-components-radio.metadata.json +1 -1
  207. package/components/select/select.component.d.ts +4 -4
  208. package/components/select/taiga-ui-kit-components-select.metadata.json +1 -1
  209. package/components/slider/slider-key-steps.directive.d.ts +12 -2
  210. package/components/slider/slider-options.d.ts +1 -1
  211. package/components/slider/taiga-ui-kit-components-slider.metadata.json +1 -1
  212. package/components/taiga-ui-kit-components.metadata.json +1 -1
  213. package/components/text-area/taiga-ui-kit-components-text-area.metadata.json +1 -1
  214. package/components/toggle/taiga-ui-kit-components-toggle.metadata.json +1 -1
  215. package/enums/file-state.d.ts +1 -0
  216. package/enums/taiga-ui-kit-enums.metadata.json +1 -1
  217. package/esm2015/abstract/input-slider.js +49 -8
  218. package/esm2015/components/accordion/accordion-item/accordion-item.component.js +1 -1
  219. package/esm2015/components/accordion/accordion.component.js +2 -2
  220. package/esm2015/components/arrow/arrow-options.js +1 -1
  221. package/esm2015/components/badge/badge.component.js +1 -1
  222. package/esm2015/components/badged-content/badged-content.component.js +3 -3
  223. package/esm2015/components/checkbox/checkbox.component.js +3 -3
  224. package/esm2015/components/combo-box/combo-box.component.js +1 -1
  225. package/esm2015/components/data-list-wrapper/data-list-group-wrapper.component.js +3 -3
  226. package/esm2015/components/data-list-wrapper/data-list-wrapper.component.js +3 -3
  227. package/esm2015/components/files/file/file.component.js +164 -0
  228. package/esm2015/components/files/files.component.js +45 -0
  229. package/esm2015/components/files/files.module.js +29 -0
  230. package/esm2015/components/files/index.js +3 -0
  231. package/esm2015/components/files/taiga-ui-kit-components-files.js +6 -0
  232. package/esm2015/components/index.js +3 -1
  233. package/esm2015/components/input/input.component.js +1 -1
  234. package/esm2015/components/input-count/input-count.component.js +3 -3
  235. package/esm2015/components/input-date/input-date.component.js +5 -3
  236. package/esm2015/components/input-date-range/input-date-range.component.js +4 -2
  237. package/esm2015/components/input-date-time/input-date-time.component.js +2 -2
  238. package/esm2015/components/input-file/file/file.component.js +19 -19
  239. package/esm2015/components/input-file/input-file.component.js +7 -7
  240. package/esm2015/components/input-file/input-file.module.js +3 -3
  241. package/esm2015/components/input-files/index.js +3 -0
  242. package/esm2015/components/input-files/input-files.component.js +212 -0
  243. package/esm2015/components/input-files/input-files.module.js +34 -0
  244. package/esm2015/components/input-files/taiga-ui-kit-components-input-files.js +5 -0
  245. package/esm2015/components/input-number/input-number.component.js +25 -19
  246. package/esm2015/components/input-number/input-number.module.js +5 -1
  247. package/esm2015/components/input-password/input-password.component.js +3 -3
  248. package/esm2015/components/input-phone/input-phone.component.js +6 -5
  249. package/esm2015/components/input-phone-international/input-phone-international.component.js +20 -6
  250. package/esm2015/components/input-range/input-range.component.js +25 -7
  251. package/esm2015/components/input-slider/input-slider.component.js +196 -105
  252. package/esm2015/components/input-slider/input-slider.module.js +13 -6
  253. package/esm2015/components/input-tag/input-tag.component.js +2 -2
  254. package/esm2015/components/input-time/input-time.component.js +1 -1
  255. package/esm2015/components/line-clamp/line-clamp.directive.js +4 -4
  256. package/esm2015/components/multi-select/multi-select-group/multi-select-group.component.js +3 -3
  257. package/esm2015/components/multi-select/multi-select.component.js +2 -2
  258. package/esm2015/components/multi-select-option/multi-select-option.component.js +3 -3
  259. package/esm2015/components/pagination/pagination.component.js +2 -2
  260. package/esm2015/components/progress/utils/calculate-color-segments.js +3 -2
  261. package/esm2015/components/radio/radio.component.js +2 -2
  262. package/esm2015/components/select/select.component.js +3 -3
  263. package/esm2015/components/slider/slider-key-steps.directive.js +33 -8
  264. package/esm2015/components/slider/slider-options.js +7 -5
  265. package/esm2015/components/slider/slider.component.js +1 -1
  266. package/esm2015/components/slider/slider.module.js +14 -4
  267. package/esm2015/components/text-area/text-area.component.js +3 -3
  268. package/esm2015/components/toggle/toggle.component.js +3 -3
  269. package/esm2015/enums/file-state.js +1 -1
  270. package/esm2015/internal/primitive-calendar-range/primitive-calendar-range.component.js +26 -2
  271. package/esm2015/pipes/field-error/field-error-content-pipe.js +11 -3
  272. package/esm2015/tokens/i18n.js +7 -1
  273. package/esm2015/utils/files/get-accept-array.js +7 -0
  274. package/esm2015/utils/files/index.js +2 -1
  275. package/esm5/abstract/input-slider.js +67 -20
  276. package/esm5/components/accordion/accordion-item/accordion-item.component.js +1 -1
  277. package/esm5/components/accordion/accordion.component.js +2 -2
  278. package/esm5/components/arrow/arrow-options.js +1 -1
  279. package/esm5/components/badge/badge.component.js +1 -1
  280. package/esm5/components/badged-content/badged-content.component.js +3 -3
  281. package/esm5/components/checkbox/checkbox.component.js +3 -3
  282. package/esm5/components/combo-box/combo-box.component.js +1 -1
  283. package/esm5/components/data-list-wrapper/data-list-group-wrapper.component.js +3 -3
  284. package/esm5/components/data-list-wrapper/data-list-wrapper.component.js +3 -3
  285. package/esm5/components/files/file/file.component.js +213 -0
  286. package/esm5/components/files/files.component.js +50 -0
  287. package/esm5/components/files/files.module.js +32 -0
  288. package/esm5/components/files/index.js +3 -0
  289. package/esm5/components/files/taiga-ui-kit-components-files.js +6 -0
  290. package/esm5/components/index.js +3 -1
  291. package/esm5/components/input/input.component.js +1 -1
  292. package/esm5/components/input-count/input-count.component.js +3 -3
  293. package/esm5/components/input-date/input-date.component.js +5 -3
  294. package/esm5/components/input-date-range/input-date-range.component.js +4 -2
  295. package/esm5/components/input-date-time/input-date-time.component.js +2 -2
  296. package/esm5/components/input-file/file/file.component.js +37 -37
  297. package/esm5/components/input-file/input-file.component.js +7 -9
  298. package/esm5/components/input-file/input-file.module.js +3 -3
  299. package/esm5/components/input-files/index.js +3 -0
  300. package/esm5/components/input-files/input-files.component.js +247 -0
  301. package/esm5/components/input-files/input-files.module.js +37 -0
  302. package/esm5/components/input-files/taiga-ui-kit-components-input-files.js +5 -0
  303. package/esm5/components/input-number/input-number.component.js +35 -27
  304. package/esm5/components/input-number/input-number.module.js +5 -1
  305. package/esm5/components/input-password/input-password.component.js +3 -3
  306. package/esm5/components/input-phone/input-phone.component.js +6 -5
  307. package/esm5/components/input-phone-international/input-phone-international.component.js +21 -9
  308. package/esm5/components/input-range/input-range.component.js +29 -7
  309. package/esm5/components/input-slider/input-slider.component.js +198 -115
  310. package/esm5/components/input-slider/input-slider.module.js +13 -6
  311. package/esm5/components/input-tag/input-tag.component.js +2 -2
  312. package/esm5/components/input-time/input-time.component.js +1 -1
  313. package/esm5/components/line-clamp/line-clamp.directive.js +4 -4
  314. package/esm5/components/multi-select/multi-select-group/multi-select-group.component.js +3 -3
  315. package/esm5/components/multi-select/multi-select.component.js +2 -2
  316. package/esm5/components/multi-select-option/multi-select-option.component.js +3 -3
  317. package/esm5/components/pagination/pagination.component.js +2 -2
  318. package/esm5/components/progress/utils/calculate-color-segments.js +3 -2
  319. package/esm5/components/radio/radio.component.js +2 -2
  320. package/esm5/components/select/select.component.js +3 -3
  321. package/esm5/components/slider/slider-key-steps.directive.js +48 -13
  322. package/esm5/components/slider/slider-options.js +7 -5
  323. package/esm5/components/slider/slider.component.js +1 -1
  324. package/esm5/components/slider/slider.module.js +14 -4
  325. package/esm5/components/text-area/text-area.component.js +3 -3
  326. package/esm5/components/toggle/toggle.component.js +3 -3
  327. package/esm5/enums/file-state.js +1 -1
  328. package/esm5/internal/primitive-calendar-range/primitive-calendar-range.component.js +26 -2
  329. package/esm5/pipes/field-error/field-error-content-pipe.js +11 -3
  330. package/esm5/tokens/i18n.js +7 -1
  331. package/esm5/utils/files/get-accept-array.js +7 -0
  332. package/esm5/utils/files/index.js +2 -1
  333. package/fesm2015/taiga-ui-kit-abstract.js +48 -7
  334. package/fesm2015/taiga-ui-kit-abstract.js.map +1 -1
  335. package/fesm2015/taiga-ui-kit-components-accordion.js +2 -2
  336. package/fesm2015/taiga-ui-kit-components-accordion.js.map +1 -1
  337. package/fesm2015/taiga-ui-kit-components-arrow.js.map +1 -1
  338. package/fesm2015/taiga-ui-kit-components-badge.js.map +1 -1
  339. package/fesm2015/taiga-ui-kit-components-badged-content.js +2 -2
  340. package/fesm2015/taiga-ui-kit-components-badged-content.js.map +1 -1
  341. package/fesm2015/taiga-ui-kit-components-checkbox.js +2 -2
  342. package/fesm2015/taiga-ui-kit-components-checkbox.js.map +1 -1
  343. package/fesm2015/taiga-ui-kit-components-combo-box.js.map +1 -1
  344. package/fesm2015/taiga-ui-kit-components-data-list-wrapper.js +4 -4
  345. package/fesm2015/taiga-ui-kit-components-data-list-wrapper.js.map +1 -1
  346. package/fesm2015/taiga-ui-kit-components-files.js +232 -0
  347. package/fesm2015/taiga-ui-kit-components-files.js.map +1 -0
  348. package/fesm2015/taiga-ui-kit-components-input-count.js +2 -2
  349. package/fesm2015/taiga-ui-kit-components-input-count.js.map +1 -1
  350. package/fesm2015/taiga-ui-kit-components-input-date-range.js +3 -1
  351. package/fesm2015/taiga-ui-kit-components-input-date-range.js.map +1 -1
  352. package/fesm2015/taiga-ui-kit-components-input-date-time.js +1 -1
  353. package/fesm2015/taiga-ui-kit-components-input-date-time.js.map +1 -1
  354. package/fesm2015/taiga-ui-kit-components-input-date.js +4 -2
  355. package/fesm2015/taiga-ui-kit-components-input-date.js.map +1 -1
  356. package/fesm2015/taiga-ui-kit-components-input-file.js +25 -25
  357. package/fesm2015/taiga-ui-kit-components-input-file.js.map +1 -1
  358. package/fesm2015/taiga-ui-kit-components-input-files.js +246 -0
  359. package/fesm2015/taiga-ui-kit-components-input-files.js.map +1 -0
  360. package/fesm2015/taiga-ui-kit-components-input-number.js +27 -18
  361. package/fesm2015/taiga-ui-kit-components-input-number.js.map +1 -1
  362. package/fesm2015/taiga-ui-kit-components-input-password.js +3 -3
  363. package/fesm2015/taiga-ui-kit-components-input-password.js.map +1 -1
  364. package/fesm2015/taiga-ui-kit-components-input-phone-international.js +19 -5
  365. package/fesm2015/taiga-ui-kit-components-input-phone-international.js.map +1 -1
  366. package/fesm2015/taiga-ui-kit-components-input-phone.js +5 -4
  367. package/fesm2015/taiga-ui-kit-components-input-phone.js.map +1 -1
  368. package/fesm2015/taiga-ui-kit-components-input-range.js +23 -5
  369. package/fesm2015/taiga-ui-kit-components-input-range.js.map +1 -1
  370. package/fesm2015/taiga-ui-kit-components-input-slider.js +203 -108
  371. package/fesm2015/taiga-ui-kit-components-input-slider.js.map +1 -1
  372. package/fesm2015/taiga-ui-kit-components-input-tag.js +1 -1
  373. package/fesm2015/taiga-ui-kit-components-input-tag.js.map +1 -1
  374. package/fesm2015/taiga-ui-kit-components-input-time.js.map +1 -1
  375. package/fesm2015/taiga-ui-kit-components-input.js.map +1 -1
  376. package/fesm2015/taiga-ui-kit-components-line-clamp.js +3 -3
  377. package/fesm2015/taiga-ui-kit-components-line-clamp.js.map +1 -1
  378. package/fesm2015/taiga-ui-kit-components-multi-select-option.js +2 -2
  379. package/fesm2015/taiga-ui-kit-components-multi-select-option.js.map +1 -1
  380. package/fesm2015/taiga-ui-kit-components-multi-select.js +2 -2
  381. package/fesm2015/taiga-ui-kit-components-multi-select.js.map +1 -1
  382. package/fesm2015/taiga-ui-kit-components-pagination.js +1 -1
  383. package/fesm2015/taiga-ui-kit-components-pagination.js.map +1 -1
  384. package/fesm2015/taiga-ui-kit-components-progress.js +2 -2
  385. package/fesm2015/taiga-ui-kit-components-progress.js.map +1 -1
  386. package/fesm2015/taiga-ui-kit-components-radio.js +1 -1
  387. package/fesm2015/taiga-ui-kit-components-radio.js.map +1 -1
  388. package/fesm2015/taiga-ui-kit-components-select.js +1 -1
  389. package/fesm2015/taiga-ui-kit-components-select.js.map +1 -1
  390. package/fesm2015/taiga-ui-kit-components-slider.js +51 -16
  391. package/fesm2015/taiga-ui-kit-components-slider.js.map +1 -1
  392. package/fesm2015/taiga-ui-kit-components-text-area.js +2 -2
  393. package/fesm2015/taiga-ui-kit-components-text-area.js.map +1 -1
  394. package/fesm2015/taiga-ui-kit-components-toggle.js +2 -2
  395. package/fesm2015/taiga-ui-kit-components-toggle.js.map +1 -1
  396. package/fesm2015/taiga-ui-kit-components.js +2 -0
  397. package/fesm2015/taiga-ui-kit-components.js.map +1 -1
  398. package/fesm2015/taiga-ui-kit-enums.js.map +1 -1
  399. package/fesm2015/taiga-ui-kit-internal-primitive-calendar-range.js +25 -1
  400. package/fesm2015/taiga-ui-kit-internal-primitive-calendar-range.js.map +1 -1
  401. package/fesm2015/taiga-ui-kit-pipes-field-error.js +10 -2
  402. package/fesm2015/taiga-ui-kit-pipes-field-error.js.map +1 -1
  403. package/fesm2015/taiga-ui-kit-tokens.js +7 -1
  404. package/fesm2015/taiga-ui-kit-tokens.js.map +1 -1
  405. package/fesm2015/taiga-ui-kit-utils-files.js +8 -1
  406. package/fesm2015/taiga-ui-kit-utils-files.js.map +1 -1
  407. package/fesm5/taiga-ui-kit-abstract.js +66 -19
  408. package/fesm5/taiga-ui-kit-abstract.js.map +1 -1
  409. package/fesm5/taiga-ui-kit-components-accordion.js +2 -2
  410. package/fesm5/taiga-ui-kit-components-accordion.js.map +1 -1
  411. package/fesm5/taiga-ui-kit-components-arrow.js.map +1 -1
  412. package/fesm5/taiga-ui-kit-components-badge.js.map +1 -1
  413. package/fesm5/taiga-ui-kit-components-badged-content.js +2 -2
  414. package/fesm5/taiga-ui-kit-components-badged-content.js.map +1 -1
  415. package/fesm5/taiga-ui-kit-components-checkbox.js +2 -2
  416. package/fesm5/taiga-ui-kit-components-checkbox.js.map +1 -1
  417. package/fesm5/taiga-ui-kit-components-combo-box.js.map +1 -1
  418. package/fesm5/taiga-ui-kit-components-data-list-wrapper.js +4 -4
  419. package/fesm5/taiga-ui-kit-components-data-list-wrapper.js.map +1 -1
  420. package/fesm5/taiga-ui-kit-components-files.js +289 -0
  421. package/fesm5/taiga-ui-kit-components-files.js.map +1 -0
  422. package/fesm5/taiga-ui-kit-components-input-count.js +2 -2
  423. package/fesm5/taiga-ui-kit-components-input-count.js.map +1 -1
  424. package/fesm5/taiga-ui-kit-components-input-date-range.js +3 -1
  425. package/fesm5/taiga-ui-kit-components-input-date-range.js.map +1 -1
  426. package/fesm5/taiga-ui-kit-components-input-date-time.js +1 -1
  427. package/fesm5/taiga-ui-kit-components-input-date-time.js.map +1 -1
  428. package/fesm5/taiga-ui-kit-components-input-date.js +4 -2
  429. package/fesm5/taiga-ui-kit-components-input-date.js.map +1 -1
  430. package/fesm5/taiga-ui-kit-components-input-file.js +43 -45
  431. package/fesm5/taiga-ui-kit-components-input-file.js.map +1 -1
  432. package/fesm5/taiga-ui-kit-components-input-files.js +284 -0
  433. package/fesm5/taiga-ui-kit-components-input-files.js.map +1 -0
  434. package/fesm5/taiga-ui-kit-components-input-number.js +37 -26
  435. package/fesm5/taiga-ui-kit-components-input-number.js.map +1 -1
  436. package/fesm5/taiga-ui-kit-components-input-password.js +3 -3
  437. package/fesm5/taiga-ui-kit-components-input-password.js.map +1 -1
  438. package/fesm5/taiga-ui-kit-components-input-phone-international.js +20 -8
  439. package/fesm5/taiga-ui-kit-components-input-phone-international.js.map +1 -1
  440. package/fesm5/taiga-ui-kit-components-input-phone.js +5 -4
  441. package/fesm5/taiga-ui-kit-components-input-phone.js.map +1 -1
  442. package/fesm5/taiga-ui-kit-components-input-range.js +27 -5
  443. package/fesm5/taiga-ui-kit-components-input-range.js.map +1 -1
  444. package/fesm5/taiga-ui-kit-components-input-slider.js +206 -119
  445. package/fesm5/taiga-ui-kit-components-input-slider.js.map +1 -1
  446. package/fesm5/taiga-ui-kit-components-input-tag.js +1 -1
  447. package/fesm5/taiga-ui-kit-components-input-tag.js.map +1 -1
  448. package/fesm5/taiga-ui-kit-components-input-time.js.map +1 -1
  449. package/fesm5/taiga-ui-kit-components-input.js.map +1 -1
  450. package/fesm5/taiga-ui-kit-components-line-clamp.js +3 -3
  451. package/fesm5/taiga-ui-kit-components-line-clamp.js.map +1 -1
  452. package/fesm5/taiga-ui-kit-components-multi-select-option.js +2 -2
  453. package/fesm5/taiga-ui-kit-components-multi-select-option.js.map +1 -1
  454. package/fesm5/taiga-ui-kit-components-multi-select.js +2 -2
  455. package/fesm5/taiga-ui-kit-components-multi-select.js.map +1 -1
  456. package/fesm5/taiga-ui-kit-components-pagination.js +1 -1
  457. package/fesm5/taiga-ui-kit-components-pagination.js.map +1 -1
  458. package/fesm5/taiga-ui-kit-components-progress.js +2 -2
  459. package/fesm5/taiga-ui-kit-components-progress.js.map +1 -1
  460. package/fesm5/taiga-ui-kit-components-radio.js +1 -1
  461. package/fesm5/taiga-ui-kit-components-radio.js.map +1 -1
  462. package/fesm5/taiga-ui-kit-components-select.js +1 -1
  463. package/fesm5/taiga-ui-kit-components-select.js.map +1 -1
  464. package/fesm5/taiga-ui-kit-components-slider.js +66 -21
  465. package/fesm5/taiga-ui-kit-components-slider.js.map +1 -1
  466. package/fesm5/taiga-ui-kit-components-text-area.js +2 -2
  467. package/fesm5/taiga-ui-kit-components-text-area.js.map +1 -1
  468. package/fesm5/taiga-ui-kit-components-toggle.js +2 -2
  469. package/fesm5/taiga-ui-kit-components-toggle.js.map +1 -1
  470. package/fesm5/taiga-ui-kit-components.js +2 -0
  471. package/fesm5/taiga-ui-kit-components.js.map +1 -1
  472. package/fesm5/taiga-ui-kit-enums.js.map +1 -1
  473. package/fesm5/taiga-ui-kit-internal-primitive-calendar-range.js +25 -1
  474. package/fesm5/taiga-ui-kit-internal-primitive-calendar-range.js.map +1 -1
  475. package/fesm5/taiga-ui-kit-pipes-field-error.js +10 -2
  476. package/fesm5/taiga-ui-kit-pipes-field-error.js.map +1 -1
  477. package/fesm5/taiga-ui-kit-tokens.js +7 -1
  478. package/fesm5/taiga-ui-kit-tokens.js.map +1 -1
  479. package/fesm5/taiga-ui-kit-utils-files.js +8 -1
  480. package/fesm5/taiga-ui-kit-utils-files.js.map +1 -1
  481. package/internal/primitive-calendar-range/primitive-calendar-range.component.d.ts +3 -0
  482. package/internal/primitive-calendar-range/taiga-ui-kit-internal-primitive-calendar-range.metadata.json +1 -1
  483. package/package.json +4 -4
  484. package/pipes/field-error/field-error-content-pipe.d.ts +1 -0
  485. package/pipes/field-error/taiga-ui-kit-pipes-field-error.metadata.json +1 -1
  486. package/tokens/i18n.d.ts +2 -0
  487. package/tokens/taiga-ui-kit-tokens.metadata.json +1 -1
  488. package/utils/files/get-accept-array.d.ts +1 -0
  489. package/utils/files/index.d.ts +1 -0
  490. package/utils/files/taiga-ui-kit-utils-files.metadata.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"taiga-ui-kit-components-input-file.js","sources":["ng://@taiga-ui/kit/components/input-file/file/file.component.ts","ng://@taiga-ui/kit/components/input-file/input-file.component.ts","ng://@taiga-ui/kit/components/input-file/input-file.module.ts","ng://@taiga-ui/kit/components/input-file/taiga-ui-kit-components-input-file.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n HostBinding,\n Inject,\n Input,\n Output,\n} from '@angular/core';\nimport {DomSanitizer, SafeValue} from '@angular/platform-browser';\nimport {TUI_IS_MOBILE, tuiDefaultProp, tuiPure} from '@taiga-ui/cdk';\nimport {TuiSizeL} from '@taiga-ui/core';\nimport {TuiFileState} from '@taiga-ui/kit/enums';\nimport {TuiFileLike} from '@taiga-ui/kit/interfaces';\nimport {TUI_DIGITAL_INFORMATION_UNITS, TUI_FILE_TEXTS} from '@taiga-ui/kit/tokens';\nimport {formatSize} from '@taiga-ui/kit/utils/files';\nimport {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';\nimport {Observable, of} from 'rxjs';\nimport {map} from 'rxjs/operators';\n\n// @dynamic\n@Component({\n selector: 'tui-file',\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './file.template.html',\n styleUrls: ['./file.style.less'],\n})\nexport class TuiFileComponent {\n @Input()\n @tuiDefaultProp()\n file: TuiFileLike = {name: ''};\n\n @Input()\n @tuiDefaultProp()\n state: TuiFileState = TuiFileState.Normal;\n\n @Input()\n @tuiDefaultProp()\n size: TuiSizeL = 'm';\n\n @Input()\n @tuiDefaultProp()\n allowDelete = true;\n\n @Input()\n @tuiDefaultProp()\n showSize = true;\n\n @Output()\n readonly fileRemoved = new EventEmitter<void>();\n\n @HostBinding('class._focused')\n focused = false;\n\n constructor(\n @Inject(TUI_IS_MOBILE) readonly isMobile: boolean,\n @Inject(DomSanitizer) private readonly sanitizer: DomSanitizer,\n @Inject(TUI_FILE_TEXTS)\n readonly fileTexts$: Observable<\n Record<'loadingError' | 'preview' | 'remove', string>\n >,\n @Inject(TUI_DIGITAL_INFORMATION_UNITS)\n private readonly units$: Observable<[string, string, string]>,\n ) {}\n\n get preview(): SafeValue {\n return this.isBig ? this.createPreview(this.file, this.sanitizer) : '';\n }\n\n get isBig(): boolean {\n return this.size === 'l';\n }\n\n get isLoading(): boolean {\n return this.state === TuiFileState.Loading;\n }\n\n get isError(): boolean {\n return this.state === TuiFileState.Error;\n }\n\n get isDeleted(): boolean {\n return this.state === TuiFileState.Deleted;\n }\n\n get icon(): string {\n if (this.state === TuiFileState.Normal && this.isBig) {\n return 'tuiIconDefaultDocLarge';\n }\n\n switch (this.state) {\n case TuiFileState.Deleted:\n return 'tuiIconTrashLarge';\n case TuiFileState.Error:\n return 'tuiIconAlertCircleLarge';\n default:\n return 'tuiIconCheckCircleLarge';\n }\n }\n\n @HostBinding('class._link')\n get src(): string {\n return this.file.src || '';\n }\n\n get name(): string {\n return this.file.name.split('.').slice(0, -1).join('.');\n }\n\n get type(): string {\n return '.' + this.file.name.split('.').pop() || '';\n }\n\n get content$(): Observable<PolymorpheusContent> {\n return this.calculateContent$(this.state, this.file, this.fileTexts$);\n }\n\n get fileSize$(): Observable<string | null> {\n return this.calculateFileSize$(this.file, this.units$);\n }\n\n onRemoveClick() {\n this.fileRemoved.emit();\n }\n\n onFocusVisible(focusVisible: boolean) {\n this.focused = focusVisible;\n }\n\n @tuiPure\n private calculateContent$(\n state: TuiFileState,\n file: TuiFileLike,\n fileTexts$: Observable<Record<'loadingError' | 'preview' | 'remove', string>>,\n ): Observable<PolymorpheusContent> {\n return state === TuiFileState.Error && !file.content\n ? fileTexts$.pipe(map(texts => texts.loadingError))\n : of(this.file.content || '');\n }\n\n @tuiPure\n private calculateFileSize$(\n file: TuiFileLike,\n units$: Observable<[string, string, string]>,\n ): Observable<string | null> {\n return units$.pipe(map(units => formatSize(units, file.size)));\n }\n\n @tuiPure\n private createPreview(file: TuiFileLike, sanitizer: DomSanitizer): SafeValue {\n if (file.src) {\n return file.src;\n }\n\n // TODO: iframe warning\n if (file instanceof File && file.type && file.type.startsWith('image/')) {\n return sanitizer.bypassSecurityTrustUrl(URL.createObjectURL(file));\n }\n\n return '';\n }\n}\n","import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n EventEmitter,\n forwardRef,\n Inject,\n Input,\n Optional,\n Output,\n Self,\n ViewChild,\n} from '@angular/core';\nimport {NgControl} from '@angular/forms';\nimport {\n AbstractTuiNullableControl,\n EMPTY_ARRAY,\n isNativeFocused,\n TUI_FOCUSABLE_ITEM_ACCESSOR,\n TUI_IS_MOBILE,\n tuiDefaultProp,\n TuiFocusableElementAccessor,\n TuiNativeFocusableElement,\n tuiPure,\n} from '@taiga-ui/cdk';\nimport {\n MODE_PROVIDER,\n TUI_MODE,\n TuiAppearance,\n TuiBrightness,\n TuiSizeL,\n} from '@taiga-ui/core';\nimport {TuiFileLike} from '@taiga-ui/kit/interfaces';\nimport {TUI_DIGITAL_INFORMATION_UNITS, TUI_INPUT_FILE_TEXTS} from '@taiga-ui/kit/tokens';\nimport {formatSize} from '@taiga-ui/kit/utils/files';\nimport {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';\nimport {Observable, of} from 'rxjs';\nimport {map} from 'rxjs/operators';\n\nconst DEFAULT_MAX_SIZE = 30 * 1000 * 1000; // 30 MB\n\n// @dynamic\n@Component({\n selector: 'tui-input-file',\n templateUrl: './input-file.template.html',\n styleUrls: ['./input-file.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n MODE_PROVIDER,\n {\n provide: TUI_FOCUSABLE_ITEM_ACCESSOR,\n useExisting: forwardRef(() => TuiInputFileComponent),\n },\n ],\n})\nexport class TuiInputFileComponent\n extends AbstractTuiNullableControl<TuiFileLike | ReadonlyArray<TuiFileLike>>\n implements TuiFocusableElementAccessor\n{\n private dataTransfer: DataTransfer | null = null;\n\n @Input()\n @tuiDefaultProp()\n link: PolymorpheusContent = '';\n\n @Input()\n @tuiDefaultProp()\n label: PolymorpheusContent = '';\n\n @Input()\n @tuiDefaultProp()\n accept = '';\n\n @Input()\n @tuiDefaultProp()\n multiple = false;\n\n @Input()\n @tuiDefaultProp()\n size: TuiSizeL = 'm';\n\n @Input()\n @tuiDefaultProp()\n showSize = true;\n\n @Input()\n @tuiDefaultProp()\n maxFileSize = DEFAULT_MAX_SIZE;\n\n @Input()\n @tuiDefaultProp()\n loadingFiles: ReadonlyArray<TuiFileLike> = [];\n\n @Input()\n @tuiDefaultProp()\n rejectedFiles: ReadonlyArray<TuiFileLike> = [];\n\n @Output()\n rejectedFilesChange = new EventEmitter<ReadonlyArray<TuiFileLike>>();\n\n @ViewChild('input')\n readonly input?: ElementRef<HTMLInputElement>;\n\n constructor(\n @Optional()\n @Self()\n @Inject(NgControl)\n control: NgControl | null,\n @Inject(ChangeDetectorRef)\n changeDetectorRef: ChangeDetectorRef,\n @Inject(TUI_IS_MOBILE)\n readonly isMobile: boolean,\n @Inject(TUI_INPUT_FILE_TEXTS)\n readonly inputFileTexts$: Observable<\n Record<\n | 'defaultLabelSingle'\n | 'defaultLabelMultiple'\n | 'defaultLinkSingle'\n | 'defaultLinkMultiple'\n | 'maxSizeRejectionReason'\n | 'formatRejectionReason'\n | 'drop'\n | 'dropMultiple',\n string\n >\n >,\n @Inject(TUI_MODE) readonly mode$: Observable<TuiBrightness | null>,\n @Inject(TUI_DIGITAL_INFORMATION_UNITS)\n readonly units$: Observable<[string, string, string]>,\n ) {\n super(control, changeDetectorRef);\n }\n\n get nativeFocusableElement(): TuiNativeFocusableElement | null {\n return this.input ? this.input.nativeElement : null;\n }\n\n get focused(): boolean {\n return isNativeFocused(this.nativeFocusableElement);\n }\n\n get computedLink$(): Observable<PolymorpheusContent> {\n return this.computeLink$(this.fileDragged, this.multiple, this.link);\n }\n\n get computedLabel$(): Observable<PolymorpheusContent> {\n return this.computeLabel$(\n this.isMobile,\n this.fileDragged,\n this.multiple,\n this.label,\n );\n }\n\n // @bad TODO: refactor after IE is dropped\n get fileDragged(): boolean {\n return (\n !!this.dataTransfer &&\n Array.prototype.indexOf.call(this.dataTransfer.types, 'Files') !== -1\n );\n }\n\n get acceptArray(): readonly string[] {\n return this.getAcceptArray(this.accept);\n }\n\n get arrayValue(): ReadonlyArray<TuiFileLike> {\n return this.getValueArray(this.value);\n }\n\n get readyFiles(): ReadonlyArray<TuiFileLike> {\n return this.getReadyFiles(this.arrayValue, this.loadingFiles);\n }\n\n get computedLoading(): ReadonlyArray<TuiFileLike> {\n return this.getLoadingFiles(this.arrayValue, this.loadingFiles);\n }\n\n get hasFiles(): boolean {\n return !!this.rejectedFiles.length || !!this.arrayValue.length;\n }\n\n onHovered(hovered: boolean) {\n this.updateHovered(hovered);\n }\n\n onFocused(focused: boolean) {\n this.updateFocused(focused);\n }\n\n onPressed(pressed: boolean) {\n this.updatePressed(pressed);\n }\n\n // TODO: refactor i18n messages\n onFilesSelected(\n input: HTMLInputElement,\n texts: Record<'maxSizeRejectionReason' | 'formatRejectionReason', string>,\n units: [string, string, string],\n ) {\n this.processSelectedFiles(input.files, texts, units);\n input.value = '';\n }\n\n onDropped(\n event: DataTransfer,\n texts: Record<'maxSizeRejectionReason' | 'formatRejectionReason', string>,\n units: [string, string, string],\n ) {\n this.processSelectedFiles(event.files, texts, units);\n }\n\n onDragOver(dataTransfer: DataTransfer | null) {\n this.dataTransfer = dataTransfer;\n }\n\n removeFile(removedFile: TuiFileLike) {\n this.updateValue(\n this.multiple ? this.arrayValue.filter(file => file !== removedFile) : null,\n );\n }\n\n removeRejectedFile(removedFile: TuiFileLike) {\n this.updateRejectedFiles(this.rejectedFiles.filter(file => file !== removedFile));\n }\n\n getAppearance(mode: null | unknown): string {\n return mode === null ? '' : TuiAppearance.Outline;\n }\n\n @tuiPure\n private computeLink$(\n fileDragged: boolean,\n multiple: boolean,\n link: PolymorpheusContent,\n ): Observable<PolymorpheusContent> {\n if (fileDragged) {\n return of('');\n }\n\n return this.inputFileTexts$.pipe(\n map(texts =>\n multiple && link === ''\n ? texts.defaultLinkMultiple\n : link || texts.defaultLinkSingle,\n ),\n );\n }\n\n @tuiPure\n private computeLabel$(\n isMobile: boolean,\n fileDragged: boolean,\n multiple: boolean,\n label: PolymorpheusContent,\n ): Observable<PolymorpheusContent> {\n if (isMobile) {\n return of('');\n }\n\n if (fileDragged) {\n return this.inputFileTexts$.pipe(\n map(texts => (multiple ? texts.dropMultiple : texts.drop)),\n );\n }\n\n return this.inputFileTexts$.pipe(\n map(texts =>\n multiple && label === ''\n ? texts.defaultLabelMultiple\n : label || texts.defaultLabelSingle,\n ),\n );\n }\n\n @tuiPure\n private getValueArray(\n value: TuiFileLike | ReadonlyArray<TuiFileLike> | null,\n ): ReadonlyArray<TuiFileLike> {\n if (!value) {\n return EMPTY_ARRAY;\n }\n\n return value instanceof Array ? value : [value];\n }\n\n @tuiPure\n private getReadyFiles(\n value: ReadonlyArray<TuiFileLike>,\n loading: ReadonlyArray<TuiFileLike>,\n ): ReadonlyArray<TuiFileLike> {\n return value.filter(file => loading.indexOf(file) === -1);\n }\n\n @tuiPure\n private getLoadingFiles(\n value: ReadonlyArray<TuiFileLike>,\n loading: ReadonlyArray<TuiFileLike>,\n ): ReadonlyArray<TuiFileLike> {\n return loading.filter(file => value.indexOf(file) !== -1);\n }\n\n @tuiPure\n private getAcceptArray(accept: string): readonly string[] {\n return accept\n .toLowerCase()\n .split(',')\n .map(format => format.trim());\n }\n\n private processSelectedFiles(\n files: FileList | null,\n texts: Record<'maxSizeRejectionReason' | 'formatRejectionReason', string>,\n units: [string, string, string],\n ) {\n // IE11 after selecting a file through the open dialog generates a second event passing an empty FileList.\n if (files === null || files.length === 0) {\n return;\n }\n\n const newFiles = this.multiple ? Array.from(files) : [files[0]];\n const tooBigFiles = newFiles.filter(file => file.size > this.maxFileSize);\n const wrongFormatFiles = newFiles.filter(\n file => !this.isFormatAcceptable(file) && tooBigFiles.indexOf(file) === -1,\n );\n const acceptedFiles = newFiles.filter(\n file =>\n tooBigFiles.indexOf(file) === -1 && wrongFormatFiles.indexOf(file) === -1,\n );\n\n this.updateRejectedFiles([\n ...tooBigFiles.map(file => ({\n name: file.name,\n type: file.type,\n size: file.size,\n content:\n texts.maxSizeRejectionReason + formatSize(units, this.maxFileSize),\n })),\n ...wrongFormatFiles.map(file => ({\n name: file.name,\n type: file.type,\n size: file.size,\n content: texts.formatRejectionReason,\n })),\n ]);\n this.updateValue(\n this.multiple\n ? [...this.arrayValue, ...acceptedFiles]\n : acceptedFiles[0] || null,\n );\n }\n\n private isFormatAcceptable(file: File): boolean {\n if (!this.accept) {\n return true;\n }\n\n const extension = '.' + (file.name.split('.').pop() || '').toLowerCase();\n\n return this.acceptArray.some(\n format =>\n format === extension ||\n format === file.type ||\n (format.split('/')[1] === '*' &&\n file.type.split('/')[0] === format.split('/')[0]),\n );\n }\n\n private updateRejectedFiles(rejectedFiles: ReadonlyArray<TuiFileLike>) {\n this.rejectedFiles = rejectedFiles;\n this.rejectedFilesChange.emit(rejectedFiles);\n }\n}\n","import {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {\n TuiDroppableModule,\n TuiFocusableModule,\n TuiFocusedModule,\n TuiFocusVisibleModule,\n TuiHoveredModule,\n TuiLetModule,\n TuiPressedModule,\n TuiPreventDefaultModule,\n} from '@taiga-ui/cdk';\nimport {\n TuiButtonModule,\n TuiGroupModule,\n TuiLinkModule,\n TuiLoaderModule,\n TuiSvgModule,\n TuiWrapperModule,\n} from '@taiga-ui/core';\nimport {PolymorpheusModule} from '@tinkoff/ng-polymorpheus';\n\nimport {TuiFileComponent} from './file/file.component';\nimport {TuiInputFileComponent} from './input-file.component';\n\n@NgModule({\n imports: [\n CommonModule,\n PolymorpheusModule,\n TuiLetModule,\n TuiFocusedModule,\n TuiFocusVisibleModule,\n TuiPressedModule,\n TuiHoveredModule,\n TuiFocusableModule,\n TuiDroppableModule,\n TuiWrapperModule,\n TuiSvgModule,\n TuiLinkModule,\n TuiLoaderModule,\n TuiButtonModule,\n TuiPreventDefaultModule,\n TuiGroupModule,\n ],\n declarations: [TuiFileComponent, TuiInputFileComponent],\n exports: [TuiInputFileComponent],\n})\nexport class TuiInputFileModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAoBA;;IAkCI,0BACoC,QAAiB,EACV,SAAuB,EAErD,UAER,EAEgB,MAA4C;QAP7B,aAAQ,GAAR,QAAQ,CAAS;QACV,cAAS,GAAT,SAAS,CAAc;QAErD,eAAU,GAAV,UAAU,CAElB;QAEgB,WAAM,GAAN,MAAM,CAAsC;QAhCjE,SAAI,GAAgB,EAAC,IAAI,EAAE,EAAE,EAAC,CAAC;QAI/B,UAAK,yBAAqC;QAI1C,SAAI,GAAa,GAAG,CAAC;QAIrB,gBAAW,GAAG,IAAI,CAAC;QAInB,aAAQ,GAAG,IAAI,CAAC;QAGP,gBAAW,GAAG,IAAI,YAAY,EAAQ,CAAC;QAGhD,YAAO,GAAG,KAAK,CAAC;KAWZ;IAEJ,sBAAI,qCAAO;aAAX;YACI,OAAO,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAA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BACb,eAAe;gBACf,eAAe;gBACf,uBAAuB;gBACvB,cAAc;aACjB;YACD,YAAY,EAAE,CAAC,gBAAgB,EAAE,qBAAqB,CAAC;YACvD,OAAO,EAAE,CAAC,qBAAqB,CAAC;SACnC,CAAC;OACW,kBAAkB,CAAG;IAAD,yBAAC;CAAlC;;AC/CA;;;;;;"}
1
+ {"version":3,"file":"taiga-ui-kit-components-input-file.js","sources":["ng://@taiga-ui/kit/components/input-file/file/file.component.ts","ng://@taiga-ui/kit/components/input-file/input-file.component.ts","ng://@taiga-ui/kit/components/input-file/input-file.module.ts","ng://@taiga-ui/kit/components/input-file/taiga-ui-kit-components-input-file.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n HostBinding,\n Inject,\n Input,\n Output,\n} from '@angular/core';\nimport {DomSanitizer, SafeValue} from '@angular/platform-browser';\nimport {TUI_IS_MOBILE, tuiDefaultProp, tuiPure} from '@taiga-ui/cdk';\nimport {TuiSizeL} from '@taiga-ui/core';\nimport {TuiFileState} from '@taiga-ui/kit/enums';\nimport {TuiFileLike} from '@taiga-ui/kit/interfaces';\nimport {TUI_DIGITAL_INFORMATION_UNITS, TUI_FILE_TEXTS} from '@taiga-ui/kit/tokens';\nimport {formatSize} from '@taiga-ui/kit/utils/files';\nimport {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';\nimport {Observable, of} from 'rxjs';\nimport {map} from 'rxjs/operators';\n\n// @dynamic\n@Component({\n selector: 'tui-file',\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './file.template.html',\n styleUrls: ['./file.style.less'],\n})\nexport class TuiFileOldComponent {\n @Input()\n @tuiDefaultProp()\n file: TuiFileLike = {name: ''};\n\n @Input()\n @tuiDefaultProp()\n state: TuiFileState = TuiFileState.Normal;\n\n @Input()\n @tuiDefaultProp()\n size: TuiSizeL = 'm';\n\n @Input()\n @tuiDefaultProp()\n allowDelete = true;\n\n @Input()\n @tuiDefaultProp()\n showSize = true;\n\n @Output()\n readonly fileRemoved = new EventEmitter<void>();\n\n @HostBinding('class._focused')\n focused = false;\n\n constructor(\n @Inject(TUI_IS_MOBILE) readonly isMobile: boolean,\n @Inject(DomSanitizer) private readonly sanitizer: DomSanitizer,\n @Inject(TUI_FILE_TEXTS)\n readonly fileTexts$: Observable<\n Record<'loadingError' | 'preview' | 'remove', string>\n >,\n @Inject(TUI_DIGITAL_INFORMATION_UNITS)\n private readonly units$: Observable<[string, string, string]>,\n ) {}\n\n get preview(): SafeValue {\n return this.isBig ? this.createPreview(this.file, this.sanitizer) : '';\n }\n\n get isBig(): boolean {\n return this.size === 'l';\n }\n\n get isLoading(): boolean {\n return this.state === TuiFileState.Loading;\n }\n\n get isError(): boolean {\n return this.state === TuiFileState.Error;\n }\n\n get isDeleted(): boolean {\n return this.state === TuiFileState.Deleted;\n }\n\n get icon(): string {\n if (this.state === TuiFileState.Normal && this.isBig) {\n return 'tuiIconDefaultDocLarge';\n }\n\n switch (this.state) {\n case TuiFileState.Deleted:\n return 'tuiIconTrashLarge';\n case TuiFileState.Error:\n return 'tuiIconAlertCircleLarge';\n default:\n return 'tuiIconCheckCircleLarge';\n }\n }\n\n @HostBinding('class._link')\n get src(): string {\n return this.file.src || '';\n }\n\n get name(): string {\n return this.file.name.split('.').slice(0, -1).join('.');\n }\n\n get type(): string {\n return `.${this.file.name.split('.').pop()}` || '';\n }\n\n get content$(): Observable<PolymorpheusContent> {\n return this.calculateContent$(this.state, this.file, this.fileTexts$);\n }\n\n get fileSize$(): Observable<string | null> {\n return this.calculateFileSize$(this.file, this.units$);\n }\n\n onRemoveClick() {\n this.fileRemoved.emit();\n }\n\n onFocusVisible(focusVisible: boolean) {\n this.focused = focusVisible;\n }\n\n @tuiPure\n private calculateContent$(\n state: TuiFileState,\n file: TuiFileLike,\n fileTexts$: Observable<Record<'loadingError' | 'preview' | 'remove', string>>,\n ): Observable<PolymorpheusContent> {\n return state === TuiFileState.Error && !file.content\n ? fileTexts$.pipe(map(texts => texts.loadingError))\n : of(this.file.content || '');\n }\n\n @tuiPure\n private calculateFileSize$(\n file: TuiFileLike,\n units$: Observable<[string, string, string]>,\n ): Observable<string | null> {\n return units$.pipe(map(units => formatSize(units, file.size)));\n }\n\n @tuiPure\n private createPreview(file: TuiFileLike, sanitizer: DomSanitizer): SafeValue {\n if (file.src) {\n return file.src;\n }\n\n // TODO: iframe warning\n if (file instanceof File && file.type && file.type.startsWith('image/')) {\n return sanitizer.bypassSecurityTrustUrl(URL.createObjectURL(file));\n }\n\n return '';\n }\n}\n","import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n EventEmitter,\n forwardRef,\n Inject,\n Input,\n Optional,\n Output,\n Self,\n ViewChild,\n} from '@angular/core';\nimport {NgControl} from '@angular/forms';\nimport {\n AbstractTuiNullableControl,\n EMPTY_ARRAY,\n isNativeFocused,\n TUI_FOCUSABLE_ITEM_ACCESSOR,\n TUI_IS_MOBILE,\n tuiDefaultProp,\n TuiFocusableElementAccessor,\n TuiNativeFocusableElement,\n tuiPure,\n} from '@taiga-ui/cdk';\nimport {\n MODE_PROVIDER,\n TUI_MODE,\n TuiAppearance,\n TuiBrightness,\n TuiSizeL,\n} from '@taiga-ui/core';\nimport {TuiFileLike} from '@taiga-ui/kit/interfaces';\nimport {TUI_DIGITAL_INFORMATION_UNITS, TUI_INPUT_FILE_TEXTS} from '@taiga-ui/kit/tokens';\nimport {formatSize} from '@taiga-ui/kit/utils/files';\nimport {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';\nimport {Observable, of} from 'rxjs';\nimport {map} from 'rxjs/operators';\n\nconst DEFAULT_MAX_SIZE = 30 * 1000 * 1000; // 30 MB\n\n// @dynamic\n@Component({\n selector: 'tui-input-file',\n templateUrl: './input-file.template.html',\n styleUrls: ['./input-file.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n MODE_PROVIDER,\n {\n provide: TUI_FOCUSABLE_ITEM_ACCESSOR,\n useExisting: forwardRef(() => TuiInputFileComponent),\n },\n ],\n})\nexport class TuiInputFileComponent\n extends AbstractTuiNullableControl<TuiFileLike | ReadonlyArray<TuiFileLike>>\n implements TuiFocusableElementAccessor\n{\n private dataTransfer: DataTransfer | null = null;\n\n @Input()\n @tuiDefaultProp()\n link: PolymorpheusContent = '';\n\n @Input()\n @tuiDefaultProp()\n label: PolymorpheusContent = '';\n\n @Input()\n @tuiDefaultProp()\n accept = '';\n\n @Input()\n @tuiDefaultProp()\n multiple = false;\n\n @Input()\n @tuiDefaultProp()\n size: TuiSizeL = 'm';\n\n @Input()\n @tuiDefaultProp()\n showSize = true;\n\n @Input()\n @tuiDefaultProp()\n maxFileSize = DEFAULT_MAX_SIZE;\n\n @Input()\n @tuiDefaultProp()\n loadingFiles: ReadonlyArray<TuiFileLike> = [];\n\n @Input()\n @tuiDefaultProp()\n rejectedFiles: ReadonlyArray<TuiFileLike> = [];\n\n @Output()\n rejectedFilesChange = new EventEmitter<ReadonlyArray<TuiFileLike>>();\n\n @ViewChild('input')\n readonly input?: ElementRef<HTMLInputElement>;\n\n constructor(\n @Optional()\n @Self()\n @Inject(NgControl)\n control: NgControl | null,\n @Inject(ChangeDetectorRef)\n changeDetectorRef: ChangeDetectorRef,\n @Inject(TUI_IS_MOBILE)\n readonly isMobile: boolean,\n @Inject(TUI_INPUT_FILE_TEXTS)\n readonly inputFileTexts$: Observable<\n Record<\n | 'defaultLabelSingle'\n | 'defaultLabelMultiple'\n | 'defaultLinkSingle'\n | 'defaultLinkMultiple'\n | 'maxSizeRejectionReason'\n | 'formatRejectionReason'\n | 'drop'\n | 'dropMultiple',\n string\n >\n >,\n @Inject(TUI_MODE) readonly mode$: Observable<TuiBrightness | null>,\n @Inject(TUI_DIGITAL_INFORMATION_UNITS)\n readonly units$: Observable<[string, string, string]>,\n ) {\n super(control, changeDetectorRef);\n }\n\n get nativeFocusableElement(): TuiNativeFocusableElement | null {\n return this.input ? this.input.nativeElement : null;\n }\n\n get focused(): boolean {\n return isNativeFocused(this.nativeFocusableElement);\n }\n\n get computedLink$(): Observable<PolymorpheusContent> {\n return this.computeLink$(this.fileDragged, this.multiple, this.link);\n }\n\n get computedLabel$(): Observable<PolymorpheusContent> {\n return this.computeLabel$(\n this.isMobile,\n this.fileDragged,\n this.multiple,\n this.label,\n );\n }\n\n // @bad TODO: refactor after IE is dropped\n get fileDragged(): boolean {\n return (\n !!this.dataTransfer &&\n Array.prototype.indexOf.call(this.dataTransfer.types, 'Files') !== -1\n );\n }\n\n get acceptArray(): readonly string[] {\n return this.getAcceptArray(this.accept);\n }\n\n get arrayValue(): ReadonlyArray<TuiFileLike> {\n return this.getValueArray(this.value);\n }\n\n get readyFiles(): ReadonlyArray<TuiFileLike> {\n return this.getReadyFiles(this.arrayValue, this.loadingFiles);\n }\n\n get computedLoading(): ReadonlyArray<TuiFileLike> {\n return this.getLoadingFiles(this.arrayValue, this.loadingFiles);\n }\n\n get hasFiles(): boolean {\n return !!this.rejectedFiles.length || !!this.arrayValue.length;\n }\n\n onHovered(hovered: boolean) {\n this.updateHovered(hovered);\n }\n\n onFocused(focused: boolean) {\n this.updateFocused(focused);\n }\n\n onPressed(pressed: boolean) {\n this.updatePressed(pressed);\n }\n\n // TODO: refactor i18n messages\n onFilesSelected(\n input: HTMLInputElement,\n texts: Record<'maxSizeRejectionReason' | 'formatRejectionReason', string>,\n units: [string, string, string],\n ) {\n this.processSelectedFiles(input.files, texts, units);\n input.value = '';\n }\n\n onDropped(\n event: DataTransfer,\n texts: Record<'maxSizeRejectionReason' | 'formatRejectionReason', string>,\n units: [string, string, string],\n ) {\n this.processSelectedFiles(event.files, texts, units);\n }\n\n onDragOver(dataTransfer: DataTransfer | null) {\n this.dataTransfer = dataTransfer;\n }\n\n removeFile(removedFile: TuiFileLike) {\n this.updateValue(\n this.multiple ? this.arrayValue.filter(file => file !== removedFile) : null,\n );\n }\n\n removeRejectedFile(removedFile: TuiFileLike) {\n this.updateRejectedFiles(this.rejectedFiles.filter(file => file !== removedFile));\n }\n\n getAppearance(mode: null | unknown): string {\n return mode === null ? '' : TuiAppearance.Outline;\n }\n\n @tuiPure\n private computeLink$(\n fileDragged: boolean,\n multiple: boolean,\n link: PolymorpheusContent,\n ): Observable<PolymorpheusContent> {\n if (fileDragged) {\n return of('');\n }\n\n return this.inputFileTexts$.pipe(\n map(texts =>\n multiple && link === ''\n ? texts.defaultLinkMultiple\n : link || texts.defaultLinkSingle,\n ),\n );\n }\n\n @tuiPure\n private computeLabel$(\n isMobile: boolean,\n fileDragged: boolean,\n multiple: boolean,\n label: PolymorpheusContent,\n ): Observable<PolymorpheusContent> {\n if (isMobile) {\n return of('');\n }\n\n if (fileDragged) {\n return this.inputFileTexts$.pipe(\n map(texts => (multiple ? texts.dropMultiple : texts.drop)),\n );\n }\n\n return this.inputFileTexts$.pipe(\n map(texts =>\n multiple && label === ''\n ? texts.defaultLabelMultiple\n : label || texts.defaultLabelSingle,\n ),\n );\n }\n\n @tuiPure\n private getValueArray(\n value: TuiFileLike | ReadonlyArray<TuiFileLike> | null,\n ): ReadonlyArray<TuiFileLike> {\n if (!value) {\n return EMPTY_ARRAY;\n }\n\n return value instanceof Array ? value : [value];\n }\n\n @tuiPure\n private getReadyFiles(\n value: ReadonlyArray<TuiFileLike>,\n loading: ReadonlyArray<TuiFileLike>,\n ): ReadonlyArray<TuiFileLike> {\n return value.filter(file => !loading.includes(file));\n }\n\n @tuiPure\n private getLoadingFiles(\n value: ReadonlyArray<TuiFileLike>,\n loading: ReadonlyArray<TuiFileLike>,\n ): ReadonlyArray<TuiFileLike> {\n return loading.filter(file => value.includes(file));\n }\n\n @tuiPure\n private getAcceptArray(accept: string): readonly string[] {\n return accept\n .toLowerCase()\n .split(',')\n .map(format => format.trim());\n }\n\n private processSelectedFiles(\n files: FileList | null,\n texts: Record<'maxSizeRejectionReason' | 'formatRejectionReason', string>,\n units: [string, string, string],\n ) {\n // IE11 after selecting a file through the open dialog generates a second event passing an empty FileList.\n if (files === null || files.length === 0) {\n return;\n }\n\n const newFiles = this.multiple ? Array.from(files) : [files[0]];\n const tooBigFiles = newFiles.filter(file => file.size > this.maxFileSize);\n const wrongFormatFiles = newFiles.filter(\n file => !this.isFormatAcceptable(file) && !tooBigFiles.includes(file),\n );\n const acceptedFiles = newFiles.filter(\n file => !tooBigFiles.includes(file) && !wrongFormatFiles.includes(file),\n );\n\n this.updateRejectedFiles([\n ...tooBigFiles.map(file => ({\n name: file.name,\n type: file.type,\n size: file.size,\n content:\n texts.maxSizeRejectionReason + formatSize(units, this.maxFileSize),\n })),\n ...wrongFormatFiles.map(file => ({\n name: file.name,\n type: file.type,\n size: file.size,\n content: texts.formatRejectionReason,\n })),\n ]);\n this.updateValue(\n this.multiple\n ? [...this.arrayValue, ...acceptedFiles]\n : acceptedFiles[0] || null,\n );\n }\n\n private isFormatAcceptable(file: File): boolean {\n if (!this.accept) {\n return true;\n }\n\n const extension = `.${(file.name.split('.').pop() || '').toLowerCase()}`;\n\n return this.acceptArray.some(\n format =>\n format === extension ||\n format === file.type ||\n (format.split('/')[1] === '*' &&\n file.type.split('/')[0] === format.split('/')[0]),\n );\n }\n\n private updateRejectedFiles(rejectedFiles: ReadonlyArray<TuiFileLike>) {\n this.rejectedFiles = rejectedFiles;\n this.rejectedFilesChange.emit(rejectedFiles);\n }\n}\n","import {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {\n TuiDroppableModule,\n TuiFocusableModule,\n TuiFocusedModule,\n TuiFocusVisibleModule,\n TuiHoveredModule,\n TuiLetModule,\n TuiPressedModule,\n TuiPreventDefaultModule,\n} from '@taiga-ui/cdk';\nimport {\n TuiButtonModule,\n TuiGroupModule,\n TuiLinkModule,\n TuiLoaderModule,\n TuiSvgModule,\n TuiWrapperModule,\n} from '@taiga-ui/core';\nimport {PolymorpheusModule} from '@tinkoff/ng-polymorpheus';\n\nimport {TuiFileOldComponent} from './file/file.component';\nimport {TuiInputFileComponent} from './input-file.component';\n\n@NgModule({\n imports: [\n CommonModule,\n PolymorpheusModule,\n TuiLetModule,\n TuiFocusedModule,\n TuiFocusVisibleModule,\n TuiPressedModule,\n TuiHoveredModule,\n TuiFocusableModule,\n TuiDroppableModule,\n TuiWrapperModule,\n TuiSvgModule,\n TuiLinkModule,\n TuiLoaderModule,\n TuiButtonModule,\n TuiPreventDefaultModule,\n TuiGroupModule,\n ],\n declarations: [TuiFileOldComponent, TuiInputFileComponent],\n exports: [TuiInputFileComponent],\n})\nexport class TuiInputFileModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAoBA;;IAkCI,6BACoC,QAAiB,EACV,SAAuB,EAErD,UAER,EAEgB,MAA4C;QAP7B,aAAQ,GAAR,QAAQ,CAAS;QACV,cAAS,GAAT,SAAS,CAAc;QAErD,eAAU,GAAV,UAAU,CAElB;QAEgB,WAAM,GAAN,MAAM,CAAsC;QAhCjE,SAAI,GAAgB,EAAC,IAAI,EAAE,EAAE,EAAC,CAAC;QAI/B,UAAK,yBAAqC;QAI1C,SAAI,GAAa,GAAG,CAAC;QAIrB,gBAAW,GAAG,IAAI,CAAC;QAInB,aAAQ,GAAG,IAAI,CAAC;QAGP,gBAAW,GAAG,IAAI,YAAY,EAAQ,CAAC;QAGhD,YAAO,GAAG,KAAK,CAAC;KAWZ;IAEJ,sBAAI,wCAAO;aAAX;YACI,OAAO,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;SAC1E;;;OAAA;IAED,sBAAI,sCAAK;aAAT;YACI,OAAO,IAAI,CAAC,IAAI,KAAK,GAAG,CAAC;SAC5B;;;OAAA;IAED,sBAAI,0CAAS;aAAb;YACI,OAAO,IAAI,CAAC,KAAK,6BAA0B;SAC9C;;;OAAA;IAED,sBAAI,wCAAO;aAAX;YACI,OAAO,IAAI,CAAC,KAAK,yBAAwB;SAC5C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A7PQ,qBAAqB;QAbjC,SAAS,CAAC;YACP,QAAQ,EAAE,gBAAgB;YAC1B,giGAAyC;YAEzC,eAAe,EAAE,uBAAuB,CAAC,MAAM;YAC/C,SAAS,EAAE;gBACP,aAAa;gBACb;oBACI,OAAO,EAAE,2BAA2B;oBACpC,WAAW,EAAE,UAAU,CAAC,cAAM,OAAA,uBAAqB,GAAA,CAAC;iBACvD;aACJ;;SACJ,CAAC;QAkDO,WAAA,QAAQ,EAAE,CAAA;QACV,WAAA,IAAI,EAAE,CAAA;QACN,WAAA,MAAM,CAAC,SAAS,CAAC,CAAA;QAEjB,WAAA,MAAM,CAAC,iBAAiB,CAAC,CAAA;QAEzB,WAAA,MAAM,CAAC,aAAa,CAAC,CAAA;QAErB,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;QAc5B,WAAA,MAAM,CAAC,QAAQ,CAAC,CAAA;QAChB,WAAA,MAAM,CAAC,6BAA6B,CAAC,CAAA;OAxEjC,qBAAqB,CA4TjC;IAAD,4BAAC;CAAA,CA3TW,0BAA0B;;;ICVtC;KAAkC;IAArB,kBAAkB;QAtB9B,QAAQ,CAAC;YACN,OAAO,EAAE;gBACL,YAAY;gBACZ,kBAAkB;gBAClB,YAAY;gBACZ,gBAAgB;gBAChB,qBAAqB;gBACrB,gBAAgB;gBAChB,gBAAgB;gBAChB,kBAAkB;gBAClB,kBAAkB;gBAClB,gBAAgB;gBAChB,YAAY;gBACZ,aAAa;gBACb,eAAe;gBACf,eAAe;gBACf,uBAAuB;gBACvB,cAAc;aACjB;YACD,YAAY,EAAE,CAAC,mBAAmB,EAAE,qBAAqB,CAAC;YAC1D,OAAO,EAAE,CAAC,qBAAqB,CAAC;SACnC,CAAC;OACW,kBAAkB,CAAG;IAAD,yBAAC;CAAlC;;AC/CA;;;;;;"}
@@ -0,0 +1,284 @@
1
+ import { __extends, __spread, __decorate, __param } from 'tslib';
2
+ import { EventEmitter, Optional, Self, Inject, ChangeDetectorRef, ViewChild, Input, Output, Component, ChangeDetectionStrategy, ViewEncapsulation, forwardRef, NgModule } from '@angular/core';
3
+ import { NgControl } from '@angular/forms';
4
+ import { isNativeFocused, EMPTY_ARRAY, TUI_IS_MOBILE, tuiDefaultProp, tuiPure, TUI_FOCUSABLE_ITEM_ACCESSOR, AbstractTuiNullableControl, TuiLetModule, TuiFocusedModule, TuiFocusVisibleModule, TuiPressedModule, TuiHoveredModule, TuiFocusableModule, TuiDroppableModule } from '@taiga-ui/cdk';
5
+ import { MODE_PROVIDER, TuiWrapperModule, TuiSvgModule, TuiLinkModule, TuiLoaderModule, TuiButtonModule, TuiGroupModule } from '@taiga-ui/core';
6
+ import { TUI_INPUT_FILE_TEXTS, TUI_DIGITAL_INFORMATION_UNITS } from '@taiga-ui/kit/tokens';
7
+ import { formatSize, getAcceptArray } from '@taiga-ui/kit/utils/files';
8
+ import { of, Observable } from 'rxjs';
9
+ import { map } from 'rxjs/operators';
10
+ import { CommonModule } from '@angular/common';
11
+ import { PolymorpheusModule } from '@tinkoff/ng-polymorpheus';
12
+
13
+ var DEFAULT_MAX_SIZE = 30 * 1000 * 1000; // 30 MB
14
+ // @dynamic
15
+ var TuiInputFilesComponent = /** @class */ (function (_super) {
16
+ __extends(TuiInputFilesComponent, _super);
17
+ function TuiInputFilesComponent(control, changeDetectorRef, isMobile, inputFileTexts$, units$) {
18
+ var _this = _super.call(this, control, changeDetectorRef) || this;
19
+ _this.isMobile = isMobile;
20
+ _this.inputFileTexts$ = inputFileTexts$;
21
+ _this.units$ = units$;
22
+ _this.dataTransfer = null;
23
+ _this.link = '';
24
+ _this.label = '';
25
+ _this.accept = '';
26
+ _this.multiple = false;
27
+ _this.size = 'm';
28
+ _this.maxFileSize = DEFAULT_MAX_SIZE;
29
+ _this.reject = new EventEmitter();
30
+ return _this;
31
+ }
32
+ TuiInputFilesComponent_1 = TuiInputFilesComponent;
33
+ Object.defineProperty(TuiInputFilesComponent.prototype, "nativeFocusableElement", {
34
+ get: function () {
35
+ var _a;
36
+ return ((_a = this.input) === null || _a === void 0 ? void 0 : _a.nativeElement) || null;
37
+ },
38
+ enumerable: true,
39
+ configurable: true
40
+ });
41
+ Object.defineProperty(TuiInputFilesComponent.prototype, "focused", {
42
+ get: function () {
43
+ return isNativeFocused(this.nativeFocusableElement);
44
+ },
45
+ enumerable: true,
46
+ configurable: true
47
+ });
48
+ Object.defineProperty(TuiInputFilesComponent.prototype, "computedPseudoHovered", {
49
+ get: function () {
50
+ var _a;
51
+ return (_a = this.pseudoHovered) !== null && _a !== void 0 ? _a : (this.fileDragged || null);
52
+ },
53
+ enumerable: true,
54
+ configurable: true
55
+ });
56
+ Object.defineProperty(TuiInputFilesComponent.prototype, "computedLink$", {
57
+ get: function () {
58
+ return this.computeLink$(this.fileDragged, this.multiple, this.link);
59
+ },
60
+ enumerable: true,
61
+ configurable: true
62
+ });
63
+ Object.defineProperty(TuiInputFilesComponent.prototype, "computedLabel$", {
64
+ get: function () {
65
+ return this.computeLabel$(this.isMobile, this.fileDragged, this.multiple, this.label);
66
+ },
67
+ enumerable: true,
68
+ configurable: true
69
+ });
70
+ Object.defineProperty(TuiInputFilesComponent.prototype, "fileDragged", {
71
+ get: function () {
72
+ var _a;
73
+ return !!((_a = this.dataTransfer) === null || _a === void 0 ? void 0 : _a.types.includes('Files'));
74
+ },
75
+ enumerable: true,
76
+ configurable: true
77
+ });
78
+ Object.defineProperty(TuiInputFilesComponent.prototype, "arrayValue", {
79
+ get: function () {
80
+ return this.getValueArray(this.value);
81
+ },
82
+ enumerable: true,
83
+ configurable: true
84
+ });
85
+ TuiInputFilesComponent.prototype.onHovered = function (hovered) {
86
+ this.updateHovered(hovered);
87
+ };
88
+ TuiInputFilesComponent.prototype.onFocused = function (focused) {
89
+ this.updateFocused(focused);
90
+ };
91
+ TuiInputFilesComponent.prototype.onPressed = function (pressed) {
92
+ this.updatePressed(pressed);
93
+ };
94
+ TuiInputFilesComponent.prototype.onFilesSelected = function (input, texts, units) {
95
+ this.processSelectedFiles(input.files, texts, units);
96
+ input.value = '';
97
+ };
98
+ TuiInputFilesComponent.prototype.onDropped = function (event, texts, units) {
99
+ this.processSelectedFiles(event.files, texts, units);
100
+ };
101
+ TuiInputFilesComponent.prototype.onDragOver = function (dataTransfer) {
102
+ this.dataTransfer = dataTransfer;
103
+ };
104
+ TuiInputFilesComponent.prototype.removeFile = function (removedFile) {
105
+ this.updateValue(this.multiple ? this.arrayValue.filter(function (file) { return file !== removedFile; }) : null);
106
+ };
107
+ TuiInputFilesComponent.prototype.computeLink$ = function (fileDragged, multiple, link) {
108
+ return fileDragged
109
+ ? of('')
110
+ : this.inputFileTexts$.pipe(map(function (texts) {
111
+ return multiple && link === ''
112
+ ? texts.defaultLinkMultiple
113
+ : link || texts.defaultLinkSingle;
114
+ }));
115
+ };
116
+ TuiInputFilesComponent.prototype.computeLabel$ = function (isMobile, fileDragged, multiple, label) {
117
+ if (isMobile) {
118
+ return of('');
119
+ }
120
+ if (fileDragged) {
121
+ return this.inputFileTexts$.pipe(map(function (texts) { return (multiple ? texts.dropMultiple : texts.drop); }));
122
+ }
123
+ return this.inputFileTexts$.pipe(map(function (texts) {
124
+ return multiple && label === ''
125
+ ? texts.defaultLabelMultiple
126
+ : label || texts.defaultLabelSingle;
127
+ }));
128
+ };
129
+ TuiInputFilesComponent.prototype.getValueArray = function (value) {
130
+ if (!value) {
131
+ return EMPTY_ARRAY;
132
+ }
133
+ return Array.isArray(value) ? value : [value];
134
+ };
135
+ TuiInputFilesComponent.prototype.processSelectedFiles = function (files, texts, units) {
136
+ var _this = this;
137
+ // IE11 after selecting a file through the open dialog generates a second event passing an empty FileList.
138
+ if (!(files === null || files === void 0 ? void 0 : files.length)) {
139
+ return;
140
+ }
141
+ var newFiles = this.multiple ? Array.from(files) : [files[0]];
142
+ var tooBigFiles = newFiles.filter(function (file) { return file.size > _this.maxFileSize; });
143
+ var wrongFormatFiles = newFiles.filter(function (file) { return !_this.isFormatAcceptable(file) && !tooBigFiles.includes(file); });
144
+ var acceptedFiles = newFiles.filter(function (file) { return !tooBigFiles.includes(file) && !wrongFormatFiles.includes(file); });
145
+ if (tooBigFiles.length || wrongFormatFiles.length) {
146
+ this.rejectFiles(__spread(tooBigFiles.map(function (file) { return ({
147
+ name: file.name,
148
+ type: file.type,
149
+ size: file.size,
150
+ content: texts.maxSizeRejectionReason +
151
+ formatSize(units, _this.maxFileSize),
152
+ }); }), wrongFormatFiles.map(function (file) { return ({
153
+ name: file.name,
154
+ type: file.type,
155
+ size: file.size,
156
+ content: texts.formatRejectionReason,
157
+ }); })));
158
+ }
159
+ this.updateValue(this.multiple
160
+ ? __spread(this.arrayValue, acceptedFiles) : acceptedFiles[0] || null);
161
+ };
162
+ TuiInputFilesComponent.prototype.isFormatAcceptable = function (file) {
163
+ if (!this.accept) {
164
+ return true;
165
+ }
166
+ var extension = "." + (file.name.split('.').pop() || '').toLowerCase();
167
+ return getAcceptArray(this.accept).some(function (format) {
168
+ return format === extension ||
169
+ format === file.type ||
170
+ (format.split('/')[1] === '*' &&
171
+ file.type.split('/')[0] === format.split('/')[0]);
172
+ });
173
+ };
174
+ TuiInputFilesComponent.prototype.rejectFiles = function (rejectedFiles) {
175
+ this.reject.emit(this.multiple ? rejectedFiles : rejectedFiles[0]);
176
+ };
177
+ var TuiInputFilesComponent_1;
178
+ TuiInputFilesComponent.ctorParameters = function () { return [
179
+ { type: NgControl, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NgControl,] }] },
180
+ { type: ChangeDetectorRef, decorators: [{ type: Inject, args: [ChangeDetectorRef,] }] },
181
+ { type: Boolean, decorators: [{ type: Inject, args: [TUI_IS_MOBILE,] }] },
182
+ { type: Observable, decorators: [{ type: Inject, args: [TUI_INPUT_FILE_TEXTS,] }] },
183
+ { type: Observable, decorators: [{ type: Inject, args: [TUI_DIGITAL_INFORMATION_UNITS,] }] }
184
+ ]; };
185
+ __decorate([
186
+ ViewChild('input')
187
+ ], TuiInputFilesComponent.prototype, "input", void 0);
188
+ __decorate([
189
+ Input(),
190
+ tuiDefaultProp()
191
+ ], TuiInputFilesComponent.prototype, "link", void 0);
192
+ __decorate([
193
+ Input(),
194
+ tuiDefaultProp()
195
+ ], TuiInputFilesComponent.prototype, "label", void 0);
196
+ __decorate([
197
+ Input(),
198
+ tuiDefaultProp()
199
+ ], TuiInputFilesComponent.prototype, "accept", void 0);
200
+ __decorate([
201
+ Input(),
202
+ tuiDefaultProp()
203
+ ], TuiInputFilesComponent.prototype, "multiple", void 0);
204
+ __decorate([
205
+ Input(),
206
+ tuiDefaultProp()
207
+ ], TuiInputFilesComponent.prototype, "size", void 0);
208
+ __decorate([
209
+ Input(),
210
+ tuiDefaultProp()
211
+ ], TuiInputFilesComponent.prototype, "maxFileSize", void 0);
212
+ __decorate([
213
+ Output()
214
+ ], TuiInputFilesComponent.prototype, "reject", void 0);
215
+ __decorate([
216
+ tuiPure
217
+ ], TuiInputFilesComponent.prototype, "computeLink$", null);
218
+ __decorate([
219
+ tuiPure
220
+ ], TuiInputFilesComponent.prototype, "computeLabel$", null);
221
+ __decorate([
222
+ tuiPure
223
+ ], TuiInputFilesComponent.prototype, "getValueArray", null);
224
+ TuiInputFilesComponent = TuiInputFilesComponent_1 = __decorate([
225
+ Component({
226
+ selector: 'tui-input-files',
227
+ template: "<tui-wrapper\n appearance=\"input-file\"\n class=\"t-wrapper\"\n [class._mobile]=\"isMobile\"\n [focused]=\"computedFocused\"\n [hovered]=\"computedHovered || fileDragged\"\n [pressed]=\"computedPressed\"\n [disabled]=\"computedDisabled\"\n>\n <label\n *ngIf=\"units$ | async as units\"\n automation-id=\"tui-input-file__label\"\n >\n <a tuiLink>\n <span\n polymorpheus-outlet\n class=\"t-inline\"\n [content]=\"computedLink$ | async\"\n ></span>\n </a>\n <ng-container *ngIf=\"computedLabel$ | async as computedLabel\">\n <span>&nbsp;</span>\n <span\n polymorpheus-outlet\n class=\"t-inline\"\n [content]=\"computedLabel\"\n ></span>\n </ng-container>\n <ng-container *ngIf=\"!readOnly && !computedDisabled\">\n <input\n *ngIf=\"inputFileTexts$ | async as texts\"\n #input\n type=\"file\"\n class=\"t-native\"\n [id]=\"id\"\n [accept]=\"accept\"\n [multiple]=\"multiple\"\n [tuiFocusable]=\"focusable\"\n (change)=\"onFilesSelected(input, texts, units)\"\n (tuiHoveredChange)=\"onHovered($event)\"\n (tuiFocusedChange)=\"onFocused($event)\"\n (tuiPressedChange)=\"onPressed($event)\"\n (tuiDroppableDropped)=\"onDropped($event, texts, units)\"\n (tuiDroppableDragOverChange)=\"onDragOver($event)\"\n (mousedown.prevent.silent)=\"0\"\n />\n </ng-container>\n </label>\n</tui-wrapper>\n",
228
+ changeDetection: ChangeDetectionStrategy.OnPush,
229
+ encapsulation: ViewEncapsulation.None,
230
+ providers: [
231
+ MODE_PROVIDER,
232
+ {
233
+ provide: TUI_FOCUSABLE_ITEM_ACCESSOR,
234
+ useExisting: forwardRef(function () { return TuiInputFilesComponent_1; }),
235
+ },
236
+ ],
237
+ styles: ["tui-input-files{display:block}tui-wrapper[data-appearance=input-file]{display:flex;background:0 0;font:var(--tui-font-text-m);word-wrap:break-word;color:var(--tui-text-02);flex:1;justify-content:center;align-items:center;min-height:var(--tui-height-l);border-radius:var(--tui-radius-m);padding:1rem .5rem;box-sizing:border-box}tui-wrapper[data-appearance=input-file]:after{border:1px dashed;color:var(--tui-link)}tui-wrapper[data-appearance=input-file]._mobile:after{border:1px solid}tui-wrapper[data-appearance=input-file][data-state=hovered]{background:var(--tui-secondary)}tui-wrapper[data-appearance=input-file][data-state=hovered]:after{color:var(--tui-link-hover)}tui-wrapper[data-appearance=input-file][data-state=pressed]{background:var(--tui-secondary-hover)}tui-wrapper[data-appearance=input-file][data-state=disabled]{opacity:var(--tui-disabled-opacity);pointer-events:none}tui-wrapper[data-appearance=input-file][data-state=disabled]:after{color:var(--tui-text-03)}tui-wrapper[data-appearance=input-file]._focused:after{border-style:solid;border-width:2px;color:var(--tui-focus)}tui-wrapper[data-appearance=input-file][data-mode=onDark],tui-wrapper[data-appearance=input-file][data-mode=onDark]._focused:after,tui-wrapper[data-appearance=input-file][data-mode=onDark]:after{color:var(--tui-text-01-night)}tui-wrapper[data-appearance=input-file][data-mode=onDark][data-state=hovered]{background:var(--tui-clear-inverse-hover)}tui-wrapper[data-appearance=input-file][data-mode=onDark][data-state=hovered]:after,tui-wrapper[data-appearance=input-file][data-mode=onDark][data-state=pressed]:after{color:var(--tui-text-03-night)}tui-wrapper[data-appearance=input-file][data-mode=onDark][data-state=pressed]{background:var(--tui-clear-inverse-active)}tui-wrapper[data-appearance=input-file][data-mode=onLight],tui-wrapper[data-appearance=input-file][data-mode=onLight]:after{color:var(--tui-text-01)}tui-wrapper[data-appearance=input-file][data-mode=onLight][data-state=hovered]{background:var(--tui-clear-hover)}tui-wrapper[data-appearance=input-file][data-mode=onLight][data-state=hovered]:after,tui-wrapper[data-appearance=input-file][data-mode=onLight][data-state=pressed]:after{color:var(--tui-text-03)}tui-wrapper[data-appearance=input-file][data-mode=onLight][data-state=pressed]{background:var(--tui-clear-active)}.t-native{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;cursor:pointer}.t-native::-webkit-file-upload-button{display:none}.t-inline{display:inline}"]
238
+ }),
239
+ __param(0, Optional()),
240
+ __param(0, Self()),
241
+ __param(0, Inject(NgControl)),
242
+ __param(1, Inject(ChangeDetectorRef)),
243
+ __param(2, Inject(TUI_IS_MOBILE)),
244
+ __param(3, Inject(TUI_INPUT_FILE_TEXTS)),
245
+ __param(4, Inject(TUI_DIGITAL_INFORMATION_UNITS))
246
+ ], TuiInputFilesComponent);
247
+ return TuiInputFilesComponent;
248
+ }(AbstractTuiNullableControl));
249
+
250
+ var TuiInputFilesModule = /** @class */ (function () {
251
+ function TuiInputFilesModule() {
252
+ }
253
+ TuiInputFilesModule = __decorate([
254
+ NgModule({
255
+ imports: [
256
+ CommonModule,
257
+ PolymorpheusModule,
258
+ TuiLetModule,
259
+ TuiFocusedModule,
260
+ TuiFocusVisibleModule,
261
+ TuiPressedModule,
262
+ TuiHoveredModule,
263
+ TuiFocusableModule,
264
+ TuiDroppableModule,
265
+ TuiWrapperModule,
266
+ TuiSvgModule,
267
+ TuiLinkModule,
268
+ TuiLoaderModule,
269
+ TuiButtonModule,
270
+ TuiGroupModule,
271
+ ],
272
+ declarations: [TuiInputFilesComponent],
273
+ exports: [TuiInputFilesComponent],
274
+ })
275
+ ], TuiInputFilesModule);
276
+ return TuiInputFilesModule;
277
+ }());
278
+
279
+ /**
280
+ * Generated bundle index. Do not edit.
281
+ */
282
+
283
+ export { TuiInputFilesComponent, TuiInputFilesModule };
284
+ //# sourceMappingURL=taiga-ui-kit-components-input-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"taiga-ui-kit-components-input-files.js","sources":["ng://@taiga-ui/kit/components/input-files/input-files.component.ts","ng://@taiga-ui/kit/components/input-files/input-files.module.ts","ng://@taiga-ui/kit/components/input-files/taiga-ui-kit-components-input-files.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n EventEmitter,\n forwardRef,\n Inject,\n Input,\n Optional,\n Output,\n Self,\n ViewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport {NgControl} from '@angular/forms';\nimport {\n AbstractTuiNullableControl,\n EMPTY_ARRAY,\n isNativeFocused,\n TUI_FOCUSABLE_ITEM_ACCESSOR,\n TUI_IS_MOBILE,\n tuiDefaultProp,\n TuiFocusableElementAccessor,\n TuiNativeFocusableElement,\n tuiPure,\n} from '@taiga-ui/cdk';\nimport {MODE_PROVIDER, TuiSizeL} from '@taiga-ui/core';\nimport {TuiFileLike} from '@taiga-ui/kit/interfaces';\nimport {TUI_DIGITAL_INFORMATION_UNITS, TUI_INPUT_FILE_TEXTS} from '@taiga-ui/kit/tokens';\nimport {formatSize, getAcceptArray} from '@taiga-ui/kit/utils/files';\nimport {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';\nimport {Observable, of} from 'rxjs';\nimport {map} from 'rxjs/operators';\n\nconst DEFAULT_MAX_SIZE = 30 * 1000 * 1000; // 30 MB\n\n// @dynamic\n@Component({\n selector: 'tui-input-files',\n templateUrl: './input-files.template.html',\n styleUrls: ['./input-files.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n providers: [\n MODE_PROVIDER,\n {\n provide: TUI_FOCUSABLE_ITEM_ACCESSOR,\n useExisting: forwardRef(() => TuiInputFilesComponent),\n },\n ],\n})\nexport class TuiInputFilesComponent\n extends AbstractTuiNullableControl<TuiFileLike | ReadonlyArray<TuiFileLike>>\n implements TuiFocusableElementAccessor\n{\n @ViewChild('input')\n private readonly input?: ElementRef<HTMLInputElement>;\n\n private dataTransfer: DataTransfer | null = null;\n\n @Input()\n @tuiDefaultProp()\n link: PolymorpheusContent = '';\n\n @Input()\n @tuiDefaultProp()\n label: PolymorpheusContent = '';\n\n @Input()\n @tuiDefaultProp()\n accept = '';\n\n @Input()\n @tuiDefaultProp()\n multiple = false;\n\n @Input()\n @tuiDefaultProp()\n size: TuiSizeL = 'm';\n\n @Input()\n @tuiDefaultProp()\n maxFileSize = DEFAULT_MAX_SIZE;\n\n @Output()\n reject = new EventEmitter<ReadonlyArray<TuiFileLike> | TuiFileLike>();\n\n constructor(\n @Optional()\n @Self()\n @Inject(NgControl)\n control: NgControl | null,\n @Inject(ChangeDetectorRef)\n changeDetectorRef: ChangeDetectorRef,\n @Inject(TUI_IS_MOBILE)\n readonly isMobile: boolean,\n @Inject(TUI_INPUT_FILE_TEXTS)\n readonly inputFileTexts$: Observable<\n Record<\n | 'defaultLabelSingle'\n | 'defaultLabelMultiple'\n | 'defaultLinkSingle'\n | 'defaultLinkMultiple'\n | 'maxSizeRejectionReason'\n | 'formatRejectionReason'\n | 'drop'\n | 'dropMultiple',\n string\n >\n >,\n @Inject(TUI_DIGITAL_INFORMATION_UNITS)\n readonly units$: Observable<[string, string, string]>,\n ) {\n super(control, changeDetectorRef);\n }\n\n get nativeFocusableElement(): TuiNativeFocusableElement | null {\n return this.input?.nativeElement || null;\n }\n\n get focused(): boolean {\n return isNativeFocused(this.nativeFocusableElement);\n }\n\n get computedPseudoHovered(): boolean | null {\n return this.pseudoHovered ?? (this.fileDragged || null);\n }\n\n get computedLink$(): Observable<PolymorpheusContent> {\n return this.computeLink$(this.fileDragged, this.multiple, this.link);\n }\n\n get computedLabel$(): Observable<PolymorpheusContent> {\n return this.computeLabel$(\n this.isMobile,\n this.fileDragged,\n this.multiple,\n this.label,\n );\n }\n\n get fileDragged(): boolean {\n return !!this.dataTransfer?.types.includes('Files');\n }\n\n get arrayValue(): ReadonlyArray<TuiFileLike> {\n return this.getValueArray(this.value);\n }\n\n onHovered(hovered: boolean) {\n this.updateHovered(hovered);\n }\n\n onFocused(focused: boolean) {\n this.updateFocused(focused);\n }\n\n onPressed(pressed: boolean) {\n this.updatePressed(pressed);\n }\n\n onFilesSelected(\n input: HTMLInputElement,\n texts: Record<'maxSizeRejectionReason' | 'formatRejectionReason', string>,\n units: [string, string, string],\n ) {\n this.processSelectedFiles(input.files, texts, units);\n input.value = '';\n }\n\n onDropped(\n event: DataTransfer,\n texts: Record<'maxSizeRejectionReason' | 'formatRejectionReason', string>,\n units: [string, string, string],\n ) {\n this.processSelectedFiles(event.files, texts, units);\n }\n\n onDragOver(dataTransfer: DataTransfer | null) {\n this.dataTransfer = dataTransfer;\n }\n\n removeFile(removedFile: TuiFileLike) {\n this.updateValue(\n this.multiple ? this.arrayValue.filter(file => file !== removedFile) : null,\n );\n }\n\n @tuiPure\n private computeLink$(\n fileDragged: boolean,\n multiple: boolean,\n link: PolymorpheusContent,\n ): Observable<PolymorpheusContent> {\n return fileDragged\n ? of('')\n : this.inputFileTexts$.pipe(\n map(texts =>\n multiple && link === ''\n ? texts.defaultLinkMultiple\n : link || texts.defaultLinkSingle,\n ),\n );\n }\n\n @tuiPure\n private computeLabel$(\n isMobile: boolean,\n fileDragged: boolean,\n multiple: boolean,\n label: PolymorpheusContent,\n ): Observable<PolymorpheusContent> {\n if (isMobile) {\n return of('');\n }\n\n if (fileDragged) {\n return this.inputFileTexts$.pipe(\n map(texts => (multiple ? texts.dropMultiple : texts.drop)),\n );\n }\n\n return this.inputFileTexts$.pipe(\n map(texts =>\n multiple && label === ''\n ? texts.defaultLabelMultiple\n : label || texts.defaultLabelSingle,\n ),\n );\n }\n\n @tuiPure\n private getValueArray(\n value: TuiFileLike | ReadonlyArray<TuiFileLike> | null,\n ): ReadonlyArray<TuiFileLike> {\n if (!value) {\n return EMPTY_ARRAY;\n }\n\n return Array.isArray(value) ? value : [value];\n }\n\n private processSelectedFiles(\n files: FileList | null,\n texts: Record<'maxSizeRejectionReason' | 'formatRejectionReason', string>,\n units: [string, string, string],\n ) {\n // IE11 after selecting a file through the open dialog generates a second event passing an empty FileList.\n if (!files?.length) {\n return;\n }\n\n const newFiles = this.multiple ? Array.from(files) : [files[0]];\n const tooBigFiles = newFiles.filter(file => file.size > this.maxFileSize);\n const wrongFormatFiles = newFiles.filter(\n file => !this.isFormatAcceptable(file) && !tooBigFiles.includes(file),\n );\n const acceptedFiles = newFiles.filter(\n file => !tooBigFiles.includes(file) && !wrongFormatFiles.includes(file),\n );\n\n if (tooBigFiles.length || wrongFormatFiles.length) {\n this.rejectFiles([\n ...tooBigFiles.map(file => ({\n name: file.name,\n type: file.type,\n size: file.size,\n content:\n texts.maxSizeRejectionReason +\n formatSize(units, this.maxFileSize),\n })),\n ...wrongFormatFiles.map(file => ({\n name: file.name,\n type: file.type,\n size: file.size,\n content: texts.formatRejectionReason,\n })),\n ]);\n }\n\n this.updateValue(\n this.multiple\n ? [...this.arrayValue, ...acceptedFiles]\n : acceptedFiles[0] || null,\n );\n }\n\n private isFormatAcceptable(file: File): boolean {\n if (!this.accept) {\n return true;\n }\n\n const extension = `.${(file.name.split('.').pop() || '').toLowerCase()}`;\n\n return getAcceptArray(this.accept).some(\n format =>\n format === extension ||\n format === file.type ||\n (format.split('/')[1] === '*' &&\n file.type.split('/')[0] === format.split('/')[0]),\n );\n }\n\n private rejectFiles(rejectedFiles: ReadonlyArray<TuiFileLike>) {\n this.reject.emit(this.multiple ? rejectedFiles : rejectedFiles[0]);\n }\n}\n","import {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {\n TuiDroppableModule,\n TuiFocusableModule,\n TuiFocusedModule,\n TuiFocusVisibleModule,\n TuiHoveredModule,\n TuiLetModule,\n TuiPressedModule,\n} from '@taiga-ui/cdk';\nimport {\n TuiButtonModule,\n TuiGroupModule,\n TuiLinkModule,\n TuiLoaderModule,\n TuiSvgModule,\n TuiWrapperModule,\n} from '@taiga-ui/core';\nimport {PolymorpheusModule} from '@tinkoff/ng-polymorpheus';\n\nimport {TuiInputFilesComponent} from './input-files.component';\n\n@NgModule({\n imports: [\n CommonModule,\n PolymorpheusModule,\n TuiLetModule,\n TuiFocusedModule,\n TuiFocusVisibleModule,\n TuiPressedModule,\n TuiHoveredModule,\n TuiFocusableModule,\n TuiDroppableModule,\n TuiWrapperModule,\n TuiSvgModule,\n TuiLinkModule,\n TuiLoaderModule,\n TuiButtonModule,\n TuiGroupModule,\n ],\n declarations: [TuiInputFilesComponent],\n exports: [TuiInputFilesComponent],\n})\nexport class TuiInputFilesModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;AAmCA,IAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAE1C;;IAgBY,0CAAoE;IAmC5E,gCAII,OAAyB,EAEzB,iBAAoC,EAE3B,QAAiB,EAEjB,eAYR,EAEQ,MAA4C;QAxBzD,YA0BI,kBAAM,OAAO,EAAE,iBAAiB,CAAC,SACpC;QAnBY,cAAQ,GAAR,QAAQ,CAAS;QAEjB,qBAAe,GAAf,eAAe,CAYvB;QAEQ,YAAM,GAAN,MAAM,CAAsC;QArDjD,kBAAY,GAAwB,IAAI,CAAC;QAIjD,UAAI,GAAwB,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YAE1C,eAAe,EAAE,uBAAuB,CAAC,MAAM;YAC/C,aAAa,EAAE,iBAAiB,CAAC,IAAI;YACrC,SAAS,EAAE;gBACP,aAAa;gBACb;oBACI,OAAO,EAAE,2BAA2B;oBACpC,WAAW,EAAE,UAAU,CAAC,cAAM,OAAA,wBAAsB,GAAA,CAAC;iBACxD;aACJ;;SACJ,CAAC;QAsCO,WAAA,QAAQ,EAAE,CAAA;QACV,WAAA,IAAI,EAAE,CAAA;QACN,WAAA,MAAM,CAAC,SAAS,CAAC,CAAA;QAEjB,WAAA,MAAM,CAAC,iBAAiB,CAAC,CAAA;QAEzB,WAAA,MAAM,CAAC,aAAa,CAAC,CAAA;QAErB,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;QAc5B,WAAA,MAAM,CAAC,6BAA6B,CAAC,CAAA;OA3DjC,sBAAsB,CA+PlC;IAAD,6BAAC;CAAA,CA9PW,0BAA0B;;;ICTtC;KAAmC;IAAtB,mBAAmB;QArB/B,QAAQ,CAAC;YACN,OAAO,EAAE;gBACL,YAAY;gBACZ,kBAAkB;gBAClB,YAAY;gBACZ,gBAAgB;gBAChB,qBAAqB;gBACrB,gBAAgB;gBAChB,gBAAgB;gBAChB,kBAAkB;gBAClB,kBAAkB;gBAClB,gBAAgB;gBAChB,YAAY;gBACZ,aAAa;gBACb,eAAe;gBACf,eAAe;gBACf,cAAc;aACjB;YACD,YAAY,EAAE,CAAC,sBAAsB,CAAC;YACtC,OAAO,EAAE,CAAC,sBAAsB,CAAC;SACpC,CAAC;OACW,mBAAmB,CAAG;IAAD,0BAAC;CAAnC;;AC5CA;;;;;;"}
@@ -1,8 +1,10 @@
1
1
  import { __extends, __decorate, __param } from 'tslib';
2
- import { Optional, Self, Inject, ChangeDetectorRef, ViewChild, Input, HostListener, Component, ChangeDetectionStrategy, forwardRef, Directive, NgModule } from '@angular/core';
2
+ import { Optional, Self, Inject, ChangeDetectorRef, ViewChild, Input, ContentChild, HostListener, Component, ChangeDetectionStrategy, forwardRef, Directive, NgModule } from '@angular/core';
3
3
  import { NgControl } from '@angular/forms';
4
4
  import { tuiDefaultProp, TUI_FOCUSABLE_ITEM_ACCESSOR, AbstractTuiControl, AbstractTuiNullableControl, TuiMapperPipeModule } from '@taiga-ui/cdk';
5
- import { tuiCreateNumberMask, tuiCreateAutoCorrectedNumberPipe, getFractionPartPadded, formatNumber, maskedMoneyValueIsEmpty, maskedNumberStringToNumber, TUI_DECIMAL_SYMBOLS, TUI_NUMBER_FORMAT, TuiPrimitiveTextfieldComponent, TUI_TEXTFIELD_HOST, TuiAbstractTextfieldHost, TuiPrimitiveTextfieldModule, TuiTextfieldControllerModule, TuiTextfieldComponent } from '@taiga-ui/core';
5
+ import { tuiCreateNumberMask, tuiEnableAutoCorrectDecimalSymbol, tuiCreateAutoCorrectedNumberPipe, maskedMoneyValueIsEmpty, maskedNumberStringToNumber, TUI_DECIMAL_SYMBOLS, getFractionPartPadded, formatNumber, TUI_NUMBER_FORMAT, TuiPrimitiveTextfieldComponent, TUI_TEXTFIELD_HOST, TuiAbstractTextfieldHost, TuiPrimitiveTextfieldModule, TuiTextfieldControllerModule, TuiTextfieldComponent } from '@taiga-ui/core';
6
+ import { PolymorpheusOutletComponent, PolymorpheusModule } from '@tinkoff/ng-polymorpheus';
7
+ import { CommonModule } from '@angular/common';
6
8
  import { TuiValueAccessorModule } from '@taiga-ui/kit/directives';
7
9
  import { TextMaskModule } from 'angular2-text-mask';
8
10
 
@@ -19,19 +21,21 @@ var TuiInputNumberComponent = /** @class */ (function (_super) {
19
21
  _this.precision = 2;
20
22
  _this.prefix = '';
21
23
  _this.postfix = '';
22
- _this.mask = function (allowNegative, decimal, decimalLimit, nativeFocusableElement) { return ({
23
- mask: tuiCreateNumberMask({
24
- allowNegative: allowNegative,
25
- decimalLimit: decimalLimit,
26
- allowDecimal: decimal !== 'never',
27
- requireDecimal: decimal === 'always',
28
- autoCorrectDecimalSymbol: false,
29
- decimalSymbol: _this.numberFormat.decimalSeparator,
30
- thousandSymbol: _this.numberFormat.thousandSeparator,
31
- }),
32
- pipe: tuiCreateAutoCorrectedNumberPipe(decimal === 'always' ? decimalLimit : 0, _this.numberFormat.decimalSeparator, _this.numberFormat.thousandSeparator, nativeFocusableElement || undefined, allowNegative),
33
- guide: false,
34
- }); };
24
+ _this.mask = function (allowNegative, decimal, decimalLimit, nativeFocusableElement) {
25
+ return ({
26
+ mask: tuiCreateNumberMask({
27
+ allowNegative: allowNegative,
28
+ decimalLimit: decimalLimit,
29
+ allowDecimal: decimal !== 'never',
30
+ requireDecimal: decimal === 'always',
31
+ decimalSymbol: _this.numberFormat.decimalSeparator,
32
+ thousandSymbol: _this.numberFormat.thousandSeparator,
33
+ autoCorrectDecimalSymbol: tuiEnableAutoCorrectDecimalSymbol(_this.numberFormat),
34
+ }),
35
+ pipe: tuiCreateAutoCorrectedNumberPipe(decimal === 'always' ? decimalLimit : 0, _this.numberFormat.decimalSeparator, _this.numberFormat.thousandSeparator, nativeFocusableElement, allowNegative),
36
+ guide: false,
37
+ });
38
+ };
35
39
  return _this;
36
40
  }
37
41
  TuiInputNumberComponent_1 = TuiInputNumberComponent;
@@ -78,15 +82,7 @@ var TuiInputNumberComponent = /** @class */ (function (_super) {
78
82
  });
79
83
  Object.defineProperty(TuiInputNumberComponent.prototype, "formattedValue", {
80
84
  get: function () {
81
- var value = this.value || 0;
82
- var absValue = Math.abs(value);
83
- var hasFraction = absValue % 1 > 0;
84
- var limit = this.decimal === 'always' || hasFraction ? this.precision : 0;
85
- var fraction = hasFraction ? getFractionPartPadded(value, this.precision) : '';
86
- if (this.focused && this.decimal !== 'always') {
87
- limit = fraction.length;
88
- }
89
- return formatNumber(value, limit, this.numberFormat.decimalSeparator, this.numberFormat.thousandSeparator, this.numberFormat.zeroPadding);
85
+ return this.getFormattedValue(this.value || 0);
90
86
  },
91
87
  enumerable: true,
92
88
  configurable: true
@@ -132,7 +128,7 @@ var TuiInputNumberComponent = /** @class */ (function (_super) {
132
128
  }
133
129
  };
134
130
  TuiInputNumberComponent.prototype.onKeyDown = function (event) {
135
- if (TUI_DECIMAL_SYMBOLS.indexOf(event.key) === -1) {
131
+ if (!TUI_DECIMAL_SYMBOLS.includes(event.key)) {
136
132
  return;
137
133
  }
138
134
  if (this.decimal === 'never') {
@@ -164,6 +160,16 @@ var TuiInputNumberComponent = /** @class */ (function (_super) {
164
160
  TuiInputNumberComponent.prototype.onPressed = function (pressed) {
165
161
  this.updatePressed(pressed);
166
162
  };
163
+ TuiInputNumberComponent.prototype.getFormattedValue = function (value) {
164
+ var absValue = Math.abs(value);
165
+ var hasFraction = absValue % 1 > 0;
166
+ var limit = this.decimal === 'always' || hasFraction ? this.precision : 0;
167
+ var fraction = hasFraction ? getFractionPartPadded(value, this.precision) : '';
168
+ if (this.focused && this.decimal !== 'always') {
169
+ limit = fraction.length;
170
+ }
171
+ return formatNumber(value, limit, this.numberFormat.decimalSeparator, this.numberFormat.thousandSeparator, this.numberFormat.zeroPadding);
172
+ };
167
173
  Object.defineProperty(TuiInputNumberComponent.prototype, "isNativeValueNotFinished", {
168
174
  get: function () {
169
175
  var nativeNumberValue = this.nativeNumberValue;
@@ -247,13 +253,16 @@ var TuiInputNumberComponent = /** @class */ (function (_super) {
247
253
  Input(),
248
254
  tuiDefaultProp()
249
255
  ], TuiInputNumberComponent.prototype, "postfix", void 0);
256
+ __decorate([
257
+ ContentChild(PolymorpheusOutletComponent)
258
+ ], TuiInputNumberComponent.prototype, "polymorpheusValueContent", void 0);
250
259
  __decorate([
251
260
  HostListener('keydown.0', ['$event'])
252
261
  ], TuiInputNumberComponent.prototype, "onZero", null);
253
262
  TuiInputNumberComponent = TuiInputNumberComponent_1 = __decorate([
254
263
  Component({
255
264
  selector: 'tui-input-number',
256
- template: "<tui-primitive-textfield\n tuiValueAccessor\n tuiTextfieldInputMode=\"decimal\"\n class=\"textfield\"\n [pseudoHovered]=\"pseudoHovered\"\n [pseudoFocused]=\"computedFocused\"\n [invalid]=\"computedInvalid\"\n [tuiTextfieldMaxLength]=\"calculatedMaxLength\"\n [readOnly]=\"readOnly\"\n [disabled]=\"computedDisabled\"\n [textMask]=\"isNegativeAllowed | tuiMapper: mask:decimal:precision:nativeFocusableElement\"\n [value]=\"computedValue\"\n [prefix]=\"prefix\"\n [postfix]=\"postfix\"\n [focusable]=\"focusable\"\n (valueChange)=\"onValueChange($event)\"\n (hoveredChange)=\"onHovered($event)\"\n (focusedChange)=\"onFocused($event)\"\n (pressedChange)=\"onPressed($event)\"\n (keydown)=\"onKeyDown($event)\"\n>\n <ng-content></ng-content>\n <ng-content select=\"input\" ngProjectAs=\"input\"></ng-content>\n</tui-primitive-textfield>\n",
265
+ template: "<tui-primitive-textfield\n tuiValueAccessor\n tuiTextfieldInputMode=\"decimal\"\n class=\"textfield\"\n [pseudoHovered]=\"computedHovered\"\n [pseudoFocused]=\"computedFocused\"\n [pseudoPressed]=\"computedPressed\"\n [invalid]=\"computedInvalid\"\n [tuiTextfieldMaxLength]=\"calculatedMaxLength\"\n [readOnly]=\"readOnly\"\n [disabled]=\"computedDisabled\"\n [textMask]=\"isNegativeAllowed | tuiMapper: mask:decimal:precision:nativeFocusableElement\"\n [value]=\"computedValue\"\n [prefix]=\"prefix\"\n [postfix]=\"postfix\"\n [focusable]=\"focusable\"\n (valueChange)=\"onValueChange($event)\"\n (hoveredChange)=\"onHovered($event)\"\n (focusedChange)=\"onFocused($event)\"\n (pressedChange)=\"onPressed($event)\"\n (keydown)=\"onKeyDown($event)\"\n>\n <ng-content></ng-content>\n <ng-content select=\"input\" ngProjectAs=\"input\"></ng-content>\n <div\n *ngIf=\"polymorpheusValueContent\"\n polymorpheus-outlet\n [content]=\"valueContent\"\n ></div>\n</tui-primitive-textfield>\n\n<ng-template #valueContent>\n <ng-content select=\"[polymorpheus-outlet]\"></ng-content>\n</ng-template>\n",
257
266
  changeDetection: ChangeDetectionStrategy.OnPush,
258
267
  providers: [
259
268
  {
@@ -323,11 +332,13 @@ var TuiInputNumberModule = /** @class */ (function () {
323
332
  TuiInputNumberModule = __decorate([
324
333
  NgModule({
325
334
  imports: [
335
+ CommonModule,
326
336
  TextMaskModule,
327
337
  TuiMapperPipeModule,
328
338
  TuiPrimitiveTextfieldModule,
329
339
  TuiTextfieldControllerModule,
330
340
  TuiValueAccessorModule,
341
+ PolymorpheusModule,
331
342
  ],
332
343
  declarations: [TuiInputNumberComponent, TuiInputNumberDirective],
333
344
  exports: [TuiInputNumberComponent, TuiInputNumberDirective, TuiTextfieldComponent],