@bravobit/bb-foundation 0.16.3 → 0.20.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 (426) hide show
  1. package/README.md +47 -47
  2. package/auth/bravobit-bb-foundation-auth.d.ts +5 -5
  3. package/auth/lib/auth.interceptor.d.ts +21 -21
  4. package/auth/lib/auth.module.d.ts +15 -15
  5. package/auth/lib/auth.service.d.ts +59 -59
  6. package/auth/lib/auth.session.d.ts +34 -34
  7. package/auth/lib/directives/authenticated.directive.d.ts +14 -14
  8. package/auth/lib/directives/permission.directive.d.ts +24 -24
  9. package/auth/lib/directives/role.directive.d.ts +16 -16
  10. package/auth/lib/guards/anonymous.guard.d.ts +11 -11
  11. package/auth/lib/guards/authenticated.guard.d.ts +11 -11
  12. package/auth/lib/helpers/jwt.helper.d.ts +8 -8
  13. package/auth/lib/helpers/mapper.helper.d.ts +23 -23
  14. package/auth/lib/interfaces/config.interface.d.ts +12 -12
  15. package/auth/lib/interfaces/mapper.interface.d.ts +19 -19
  16. package/auth/lib/interfaces/provider.interface.d.ts +16 -16
  17. package/auth/lib/interfaces/token.interface.d.ts +11 -11
  18. package/auth/lib/permissions.service.d.ts +14 -14
  19. package/auth/lib/providers/email.provider.d.ts +15 -15
  20. package/auth/lib/providers/verify.provider.d.ts +13 -13
  21. package/auth/lib/tokens/use-authorization.token.d.ts +2 -2
  22. package/auth/public_api.d.ts +18 -18
  23. package/bravobit-bb-foundation.d.ts +5 -5
  24. package/collections/bravobit-bb-foundation-collections.d.ts +5 -5
  25. package/collections/lib/collection.d.ts +43 -43
  26. package/collections/lib/collections.module.d.ts +10 -10
  27. package/collections/lib/components/collections-pager/collections-pager.component.d.ts +34 -34
  28. package/collections/lib/components/collections-viewer/collections-viewer.component.d.ts +12 -12
  29. package/collections/lib/components/collections.directive.d.ts +17 -17
  30. package/collections/lib/interfaces/collection.interface.d.ts +26 -26
  31. package/collections/lib/providers/api-collection.provider.d.ts +17 -15
  32. package/collections/lib/providers/collection.provider.d.ts +6 -6
  33. package/collections/lib/providers/local-collection.provider.d.ts +8 -8
  34. package/collections/public_api.d.ts +9 -9
  35. package/controls/bravobit-bb-foundation-controls.d.ts +5 -5
  36. package/controls/lib/checkbox/checkbox/checkbox.component.d.ts +47 -47
  37. package/controls/lib/checkbox/checkbox-group/checkbox-group.component.d.ts +18 -18
  38. package/controls/lib/checkbox/checkbox.module.d.ts +9 -9
  39. package/controls/lib/controls.module.d.ts +7 -7
  40. package/controls/public_api.d.ts +4 -4
  41. package/dashboard/bravobit-bb-foundation-dashboard.d.ts +5 -5
  42. package/dashboard/lib/dashboard/dashboard.component.d.ts +19 -19
  43. package/dashboard/lib/dashboard-header/dashboard-header.component.d.ts +11 -11
  44. package/dashboard/lib/dashboard-menu/dashboard-menu.component.d.ts +9 -9
  45. package/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.d.ts +11 -11
  46. package/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.d.ts +21 -21
  47. package/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.d.ts +27 -27
  48. package/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.d.ts +16 -16
  49. package/dashboard/lib/dashboard.module.d.ts +16 -16
  50. package/dashboard/public_api.d.ts +8 -8
  51. package/dialog/bravobit-bb-foundation-dialog.d.ts +5 -5
  52. package/dialog/lib/dialog-actions/dialog-actions.component.d.ts +5 -5
  53. package/dialog/lib/dialog-confirm/dialog-confirm.component.d.ts +16 -16
  54. package/dialog/lib/dialog-container/dialog-container.component.d.ts +24 -24
  55. package/dialog/lib/dialog-header/dialog-header.component.d.ts +9 -9
  56. package/dialog/lib/dialog-link/dialog-link.component.d.ts +5 -5
  57. package/dialog/lib/dialog-modal/dialog-modal.component.d.ts +12 -12
  58. package/dialog/lib/dialog-overlay/dialog-overlay.component.d.ts +22 -22
  59. package/dialog/lib/dialog.injector.d.ts +8 -8
  60. package/dialog/lib/dialog.insertion.d.ts +8 -8
  61. package/dialog/lib/dialog.interfaces.d.ts +3 -3
  62. package/dialog/lib/dialog.module.d.ts +19 -19
  63. package/dialog/lib/dialog.ref.d.ts +8 -8
  64. package/dialog/lib/dialog.service.d.ts +19 -19
  65. package/dialog/public_api.d.ts +9 -9
  66. package/elements/bravobit-bb-foundation-elements.d.ts +5 -5
  67. package/elements/lib/avatar/avatar.component.d.ts +25 -25
  68. package/elements/lib/button/button.component.d.ts +23 -23
  69. package/elements/lib/checkbox/checkbox.component.d.ts +27 -27
  70. package/elements/lib/date-picker/date-picker.component.d.ts +69 -69
  71. package/elements/lib/directives/addon.directive.d.ts +9 -9
  72. package/elements/lib/directives/autosize.directive.d.ts +18 -18
  73. package/elements/lib/directives/focus-trap.directive.d.ts +17 -17
  74. package/elements/lib/directives/focus.directive.d.ts +14 -14
  75. package/elements/lib/directives/form-submit.directive.d.ts +17 -17
  76. package/elements/lib/directives/input.directive.d.ts +38 -38
  77. package/elements/lib/directives/template.directive.d.ts +10 -10
  78. package/elements/lib/dropdown/dropdown.component.d.ts +21 -21
  79. package/elements/lib/elements.interfaces.d.ts +25 -25
  80. package/elements/lib/elements.module.d.ts +116 -116
  81. package/elements/lib/file-picker/file-picker.component.d.ts +49 -49
  82. package/elements/lib/form-control/form-control.component.d.ts +21 -21
  83. package/elements/lib/form-error/form-error.component.d.ts +29 -29
  84. package/elements/lib/form-group/form-group.component.d.ts +10 -10
  85. package/elements/lib/icon/icon.component.d.ts +22 -22
  86. package/elements/lib/image-picker/image-picker.component.d.ts +38 -38
  87. package/elements/lib/pipes/file-image.pipe.d.ts +13 -13
  88. package/elements/lib/pipes/file-size.pipe.d.ts +8 -8
  89. package/elements/lib/pipes/relative-time.pipe.d.ts +19 -19
  90. package/elements/lib/spinner/spinner.component.d.ts +12 -12
  91. package/elements/lib/tag/tag.component.d.ts +7 -7
  92. package/elements/public_api.d.ts +25 -25
  93. package/esm2020/auth/bravobit-bb-foundation-auth.mjs +4 -4
  94. package/esm2020/auth/lib/auth.interceptor.mjs +93 -94
  95. package/esm2020/auth/lib/auth.module.mjs +54 -54
  96. package/esm2020/auth/lib/auth.service.mjs +281 -276
  97. package/esm2020/auth/lib/auth.session.mjs +131 -131
  98. package/esm2020/auth/lib/directives/authenticated.directive.mjs +31 -31
  99. package/esm2020/auth/lib/directives/permission.directive.mjs +80 -80
  100. package/esm2020/auth/lib/directives/role.directive.mjs +37 -37
  101. package/esm2020/auth/lib/guards/anonymous.guard.mjs +34 -34
  102. package/esm2020/auth/lib/guards/authenticated.guard.mjs +35 -35
  103. package/esm2020/auth/lib/helpers/jwt.helper.mjs +69 -69
  104. package/esm2020/auth/lib/helpers/mapper.helper.mjs +35 -35
  105. package/esm2020/auth/lib/interfaces/config.interface.mjs +3 -3
  106. package/esm2020/auth/lib/interfaces/mapper.interface.mjs +2 -2
  107. package/esm2020/auth/lib/interfaces/provider.interface.mjs +2 -2
  108. package/esm2020/auth/lib/interfaces/token.interface.mjs +2 -2
  109. package/esm2020/auth/lib/permissions.service.mjs +56 -56
  110. package/esm2020/auth/lib/providers/email.provider.mjs +25 -25
  111. package/esm2020/auth/lib/providers/verify.provider.mjs +19 -19
  112. package/esm2020/auth/lib/tokens/use-authorization.token.mjs +3 -3
  113. package/esm2020/auth/public_api.mjs +19 -19
  114. package/esm2020/bravobit-bb-foundation.mjs +4 -4
  115. package/esm2020/collections/bravobit-bb-foundation-collections.mjs +4 -4
  116. package/esm2020/collections/lib/collection.mjs +102 -102
  117. package/esm2020/collections/lib/collections.module.mjs +54 -54
  118. package/esm2020/collections/lib/components/collections-pager/collections-pager.component.mjs +123 -123
  119. package/esm2020/collections/lib/components/collections-viewer/collections-viewer.component.mjs +31 -31
  120. package/esm2020/collections/lib/components/collections.directive.mjs +43 -43
  121. package/esm2020/collections/lib/interfaces/collection.interface.mjs +2 -2
  122. package/esm2020/collections/lib/providers/api-collection.provider.mjs +71 -71
  123. package/esm2020/collections/lib/providers/collection.provider.mjs +13 -13
  124. package/esm2020/collections/lib/providers/local-collection.provider.mjs +16 -16
  125. package/esm2020/collections/public_api.mjs +10 -10
  126. package/esm2020/controls/bravobit-bb-foundation-controls.mjs +4 -4
  127. package/esm2020/controls/lib/checkbox/checkbox/checkbox.component.mjs +153 -153
  128. package/esm2020/controls/lib/checkbox/checkbox-group/checkbox-group.component.mjs +48 -48
  129. package/esm2020/controls/lib/checkbox/checkbox.module.mjs +19 -19
  130. package/esm2020/controls/lib/controls.module.mjs +16 -16
  131. package/esm2020/controls/public_api.mjs +5 -5
  132. package/esm2020/dashboard/bravobit-bb-foundation-dashboard.mjs +4 -4
  133. package/esm2020/dashboard/lib/dashboard/dashboard.component.mjs +56 -56
  134. package/esm2020/dashboard/lib/dashboard-header/dashboard-header.component.mjs +30 -30
  135. package/esm2020/dashboard/lib/dashboard-menu/dashboard-menu.component.mjs +31 -31
  136. package/esm2020/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.mjs +29 -29
  137. package/esm2020/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.mjs +75 -75
  138. package/esm2020/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.mjs +99 -99
  139. package/esm2020/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.mjs +62 -62
  140. package/esm2020/dashboard/lib/dashboard.module.mjs +47 -47
  141. package/esm2020/dashboard/public_api.mjs +9 -9
  142. package/esm2020/dialog/bravobit-bb-foundation-dialog.mjs +4 -4
  143. package/esm2020/dialog/lib/dialog-actions/dialog-actions.component.mjs +12 -12
  144. package/esm2020/dialog/lib/dialog-confirm/dialog-confirm.component.mjs +37 -37
  145. package/esm2020/dialog/lib/dialog-container/dialog-container.component.mjs +153 -153
  146. package/esm2020/dialog/lib/dialog-header/dialog-header.component.mjs +25 -25
  147. package/esm2020/dialog/lib/dialog-link/dialog-link.component.mjs +11 -11
  148. package/esm2020/dialog/lib/dialog-modal/dialog-modal.component.mjs +46 -46
  149. package/esm2020/dialog/lib/dialog-overlay/dialog-overlay.component.mjs +134 -134
  150. package/esm2020/dialog/lib/dialog.injector.mjs +18 -18
  151. package/esm2020/dialog/lib/dialog.insertion.mjs +16 -16
  152. package/esm2020/dialog/lib/dialog.interfaces.mjs +3 -3
  153. package/esm2020/dialog/lib/dialog.module.mjs +70 -70
  154. package/esm2020/dialog/lib/dialog.ref.mjs +22 -22
  155. package/esm2020/dialog/lib/dialog.service.mjs +77 -77
  156. package/esm2020/dialog/public_api.mjs +10 -10
  157. package/esm2020/elements/bravobit-bb-foundation-elements.mjs +4 -4
  158. package/esm2020/elements/lib/avatar/avatar.component.mjs +145 -142
  159. package/esm2020/elements/lib/button/button.component.mjs +61 -61
  160. package/esm2020/elements/lib/checkbox/checkbox.component.mjs +73 -73
  161. package/esm2020/elements/lib/date-picker/date-picker.component.mjs +304 -304
  162. package/esm2020/elements/lib/directives/addon.directive.mjs +29 -29
  163. package/esm2020/elements/lib/directives/autosize.directive.mjs +72 -72
  164. package/esm2020/elements/lib/directives/focus-trap.directive.mjs +77 -77
  165. package/esm2020/elements/lib/directives/focus.directive.mjs +39 -39
  166. package/esm2020/elements/lib/directives/form-submit.directive.mjs +50 -50
  167. package/esm2020/elements/lib/directives/input.directive.mjs +136 -136
  168. package/esm2020/elements/lib/directives/template.directive.mjs +28 -28
  169. package/esm2020/elements/lib/dropdown/dropdown.component.mjs +100 -100
  170. package/esm2020/elements/lib/elements.interfaces.mjs +4 -4
  171. package/esm2020/elements/lib/elements.module.mjs +177 -177
  172. package/esm2020/elements/lib/file-picker/file-picker.component.mjs +236 -236
  173. package/esm2020/elements/lib/form-control/form-control.component.mjs +49 -49
  174. package/esm2020/elements/lib/form-error/form-error.component.mjs +108 -108
  175. package/esm2020/elements/lib/form-group/form-group.component.mjs +18 -18
  176. package/esm2020/elements/lib/icon/icon.component.mjs +102 -102
  177. package/esm2020/elements/lib/image-picker/image-picker.component.mjs +106 -106
  178. package/esm2020/elements/lib/pipes/file-image.pipe.mjs +42 -42
  179. package/esm2020/elements/lib/pipes/file-size.pipe.mjs +28 -28
  180. package/esm2020/elements/lib/pipes/relative-time.pipe.mjs +94 -94
  181. package/esm2020/elements/lib/spinner/spinner.component.mjs +25 -25
  182. package/esm2020/elements/lib/tag/tag.component.mjs +18 -18
  183. package/esm2020/elements/public_api.mjs +26 -26
  184. package/esm2020/http/bravobit-bb-foundation-http.mjs +4 -4
  185. package/esm2020/http/lib/classes/http.config.mjs +29 -29
  186. package/esm2020/http/lib/classes/http.error.mjs +20 -20
  187. package/esm2020/http/lib/http.interfaces.mjs +2 -2
  188. package/esm2020/http/lib/http.module.mjs +43 -43
  189. package/esm2020/http/lib/interceptors/base-url.interceptor.mjs +50 -50
  190. package/esm2020/http/lib/interceptors/error.interceptor.mjs +32 -32
  191. package/esm2020/http/public_api.mjs +7 -7
  192. package/esm2020/lib/core/miscellaneous/regex.mjs +5 -5
  193. package/esm2020/lib/core/miscellaneous/validator.mjs +85 -85
  194. package/esm2020/lib/core/mixins/can-disable.mjs +16 -16
  195. package/esm2020/lib/core/mixins/can-hide-errors.mjs +16 -16
  196. package/esm2020/lib/core/mixins/can-load.mjs +16 -16
  197. package/esm2020/lib/core/mixins/constructor.mjs +2 -2
  198. package/esm2020/lib/core/mixins/has-error.mjs +16 -16
  199. package/esm2020/lib/core/mixins/is-focused.mjs +16 -16
  200. package/esm2020/lib/core/mixins/is-grouped.mjs +16 -16
  201. package/esm2020/lib/core/mixins/is-readonly.mjs +16 -16
  202. package/esm2020/lib/core/mixins/is-required.mjs +16 -16
  203. package/esm2020/lib/core/services/clipboard.service.mjs +70 -70
  204. package/esm2020/lib/core/services/exif.service.mjs +163 -163
  205. package/esm2020/lib/core/services/file-loader.service.mjs +87 -87
  206. package/esm2020/lib/core/services/image-converter.service.mjs +123 -123
  207. package/esm2020/lib/core/services/languages.service.mjs +74 -74
  208. package/esm2020/lib/core/services/network.service.mjs +55 -55
  209. package/esm2020/lib/core/services/patch.service.mjs +63 -63
  210. package/esm2020/lib/core/services/platform.service.mjs +42 -42
  211. package/esm2020/lib/core/tokens/accept-language.token.mjs +3 -3
  212. package/esm2020/lib/core/tokens/base-url.token.mjs +3 -3
  213. package/esm2020/lib/core/tokens/cookie.token.mjs +3 -3
  214. package/esm2020/lib/core/tokens/location.token.mjs +6 -6
  215. package/esm2020/lib/core/tokens/navigator.token.mjs +6 -6
  216. package/esm2020/lib/core/tokens/window.token.mjs +12 -12
  217. package/esm2020/localize/bravobit-bb-foundation-localize.mjs +4 -4
  218. package/esm2020/localize/lib/functions/date.function.mjs +18 -18
  219. package/esm2020/localize/lib/functions/lowercase.function.mjs +13 -13
  220. package/esm2020/localize/lib/functions/uppercase.function.mjs +13 -13
  221. package/esm2020/localize/lib/handlers/missing.handler.mjs +15 -17
  222. package/esm2020/localize/lib/interfaces/config.interfaces.mjs +7 -10
  223. package/esm2020/localize/lib/interfaces/functions.interfaces.mjs +8 -8
  224. package/esm2020/localize/lib/interfaces/handlers.interfaces.mjs +2 -2
  225. package/esm2020/localize/lib/interfaces/options.interfaces.mjs +6 -6
  226. package/esm2020/localize/lib/localizations/dutch.localization.mjs +45 -53
  227. package/esm2020/localize/lib/localizations/english.localization.mjs +45 -53
  228. package/esm2020/localize/lib/localize.dictionary.mjs +26 -135
  229. package/esm2020/localize/lib/localize.module.mjs +71 -69
  230. package/esm2020/localize/lib/localize.pipe.mjs +49 -49
  231. package/esm2020/localize/lib/localize.service.mjs +205 -277
  232. package/esm2020/localize/lib/views/localize-string/localize-string.component.mjs +88 -88
  233. package/esm2020/localize/lib/views/localize-template-or-string.directive.mjs +28 -28
  234. package/esm2020/localize/lib/views/localize-template.directive.mjs +21 -21
  235. package/esm2020/localize/public_api.mjs +17 -18
  236. package/esm2020/notifications/bravobit-bb-foundation-notifications.mjs +4 -4
  237. package/esm2020/notifications/lib/notifications-item/notifications-item.component.mjs +100 -100
  238. package/esm2020/notifications/lib/notifications-list/notifications-list.component.mjs +47 -47
  239. package/esm2020/notifications/lib/notifications.animations.mjs +28 -28
  240. package/esm2020/notifications/lib/notifications.injector.mjs +18 -18
  241. package/esm2020/notifications/lib/notifications.interfaces.mjs +20 -20
  242. package/esm2020/notifications/lib/notifications.module.mjs +30 -30
  243. package/esm2020/notifications/lib/notifications.service.mjs +145 -145
  244. package/esm2020/notifications/public_api.mjs +4 -4
  245. package/esm2020/public_api.mjs +29 -29
  246. package/esm2020/recaptcha/bravobit-bb-foundation-recaptcha.mjs +4 -4
  247. package/esm2020/recaptcha/lib/recaptcha/recaptcha.component.mjs +185 -185
  248. package/esm2020/recaptcha/lib/recaptcha-loader.service.mjs +90 -90
  249. package/esm2020/recaptcha/lib/recaptcha.interface.mjs +3 -3
  250. package/esm2020/recaptcha/lib/recaptcha.module.mjs +27 -27
  251. package/esm2020/recaptcha/public_api.mjs +5 -5
  252. package/esm2020/rxjs/bravobit-bb-foundation-rxjs.mjs +4 -4
  253. package/esm2020/rxjs/lib/operators/combine-latest-map.operator.mjs +10 -10
  254. package/esm2020/rxjs/lib/operators/filter-nil.operator.mjs +5 -5
  255. package/esm2020/rxjs/public_api.mjs +3 -3
  256. package/esm2020/storage/bravobit-bb-foundation-storage.mjs +4 -4
  257. package/esm2020/storage/lib/interfaces/attributes.interface.mjs +2 -2
  258. package/esm2020/storage/lib/interfaces/memory.interface.mjs +2 -2
  259. package/esm2020/storage/lib/interfaces/strategy.interface.mjs +2 -2
  260. package/esm2020/storage/lib/storage.service.mjs +109 -109
  261. package/esm2020/storage/lib/strategies/cookie-storage.strategy.mjs +142 -142
  262. package/esm2020/storage/lib/strategies/memory-storage.strategy.mjs +56 -56
  263. package/esm2020/storage/lib/strategies/polyfill-storage.strategy.mjs +102 -102
  264. package/esm2020/storage/public_api.mjs +8 -8
  265. package/esm2020/table/bravobit-bb-foundation-table.mjs +4 -4
  266. package/esm2020/table/lib/components/table/table.component.mjs +191 -191
  267. package/esm2020/table/lib/components/table-cell/table-cell.component.mjs +11 -11
  268. package/esm2020/table/lib/components/table-header-cell/table-header-cell.component.mjs +131 -131
  269. package/esm2020/table/lib/components/table-pager/table-pager.component.mjs +136 -136
  270. package/esm2020/table/lib/data/datasource.data.mjs +32 -32
  271. package/esm2020/table/lib/data/generic.data.mjs +72 -72
  272. package/esm2020/table/lib/interfaces/datasource.interface.mjs +2 -2
  273. package/esm2020/table/lib/interfaces/table.interfaces.mjs +2 -2
  274. package/esm2020/table/lib/table.module.mjs +42 -42
  275. package/esm2020/table/public_api.mjs +10 -10
  276. package/fesm2015/bravobit-bb-foundation-auth.mjs +930 -926
  277. package/fesm2015/bravobit-bb-foundation-auth.mjs.map +1 -1
  278. package/fesm2015/bravobit-bb-foundation-collections.mjs +423 -423
  279. package/fesm2015/bravobit-bb-foundation-collections.mjs.map +1 -1
  280. package/fesm2015/bravobit-bb-foundation-controls.mjs +216 -216
  281. package/fesm2015/bravobit-bb-foundation-controls.mjs.map +1 -1
  282. package/fesm2015/bravobit-bb-foundation-dashboard.mjs +382 -382
  283. package/fesm2015/bravobit-bb-foundation-dashboard.mjs.map +1 -1
  284. package/fesm2015/bravobit-bb-foundation-dialog.mjs +542 -542
  285. package/fesm2015/bravobit-bb-foundation-dialog.mjs.map +1 -1
  286. package/fesm2015/bravobit-bb-foundation-elements.mjs +1971 -1968
  287. package/fesm2015/bravobit-bb-foundation-elements.mjs.map +1 -1
  288. package/fesm2015/bravobit-bb-foundation-http.mjs +156 -156
  289. package/fesm2015/bravobit-bb-foundation-http.mjs.map +1 -1
  290. package/fesm2015/bravobit-bb-foundation-localize.mjs +611 -805
  291. package/fesm2015/bravobit-bb-foundation-localize.mjs.map +1 -1
  292. package/fesm2015/bravobit-bb-foundation-notifications.mjs +348 -348
  293. package/fesm2015/bravobit-bb-foundation-notifications.mjs.map +1 -1
  294. package/fesm2015/bravobit-bb-foundation-recaptcha.mjs +290 -290
  295. package/fesm2015/bravobit-bb-foundation-recaptcha.mjs.map +1 -1
  296. package/fesm2015/bravobit-bb-foundation-rxjs.mjs +7 -7
  297. package/fesm2015/bravobit-bb-foundation-rxjs.mjs.map +1 -1
  298. package/fesm2015/bravobit-bb-foundation-storage.mjs +401 -401
  299. package/fesm2015/bravobit-bb-foundation-storage.mjs.map +1 -1
  300. package/fesm2015/bravobit-bb-foundation-table.mjs +571 -571
  301. package/fesm2015/bravobit-bb-foundation-table.mjs.map +1 -1
  302. package/fesm2015/bravobit-bb-foundation.mjs +860 -860
  303. package/fesm2015/bravobit-bb-foundation.mjs.map +1 -1
  304. package/fesm2020/bravobit-bb-foundation-auth.mjs +882 -878
  305. package/fesm2020/bravobit-bb-foundation-auth.mjs.map +1 -1
  306. package/fesm2020/bravobit-bb-foundation-collections.mjs +413 -413
  307. package/fesm2020/bravobit-bb-foundation-collections.mjs.map +1 -1
  308. package/fesm2020/bravobit-bb-foundation-controls.mjs +214 -214
  309. package/fesm2020/bravobit-bb-foundation-controls.mjs.map +1 -1
  310. package/fesm2020/bravobit-bb-foundation-dashboard.mjs +370 -370
  311. package/fesm2020/bravobit-bb-foundation-dashboard.mjs.map +1 -1
  312. package/fesm2020/bravobit-bb-foundation-dialog.mjs +541 -541
  313. package/fesm2020/bravobit-bb-foundation-dialog.mjs.map +1 -1
  314. package/fesm2020/bravobit-bb-foundation-elements.mjs +1928 -1925
  315. package/fesm2020/bravobit-bb-foundation-elements.mjs.map +1 -1
  316. package/fesm2020/bravobit-bb-foundation-http.mjs +148 -148
  317. package/fesm2020/bravobit-bb-foundation-http.mjs.map +1 -1
  318. package/fesm2020/bravobit-bb-foundation-localize.mjs +590 -792
  319. package/fesm2020/bravobit-bb-foundation-localize.mjs.map +1 -1
  320. package/fesm2020/bravobit-bb-foundation-notifications.mjs +346 -346
  321. package/fesm2020/bravobit-bb-foundation-notifications.mjs.map +1 -1
  322. package/fesm2020/bravobit-bb-foundation-recaptcha.mjs +280 -280
  323. package/fesm2020/bravobit-bb-foundation-recaptcha.mjs.map +1 -1
  324. package/fesm2020/bravobit-bb-foundation-rxjs.mjs +10 -10
  325. package/fesm2020/bravobit-bb-foundation-rxjs.mjs.map +1 -1
  326. package/fesm2020/bravobit-bb-foundation-storage.mjs +396 -396
  327. package/fesm2020/bravobit-bb-foundation-storage.mjs.map +1 -1
  328. package/fesm2020/bravobit-bb-foundation-table.mjs +560 -560
  329. package/fesm2020/bravobit-bb-foundation-table.mjs.map +1 -1
  330. package/fesm2020/bravobit-bb-foundation.mjs +832 -832
  331. package/fesm2020/bravobit-bb-foundation.mjs.map +1 -1
  332. package/http/bravobit-bb-foundation-http.d.ts +5 -5
  333. package/http/lib/classes/http.config.d.ts +9 -9
  334. package/http/lib/classes/http.error.d.ts +7 -7
  335. package/http/lib/http.interfaces.d.ts +12 -12
  336. package/http/lib/http.module.d.ts +15 -15
  337. package/http/lib/interceptors/base-url.interceptor.d.ts +15 -15
  338. package/http/lib/interceptors/error.interceptor.d.ts +11 -11
  339. package/http/public_api.d.ts +6 -6
  340. package/lib/core/miscellaneous/regex.d.ts +4 -4
  341. package/lib/core/miscellaneous/validator.d.ts +13 -13
  342. package/lib/core/mixins/can-disable.d.ts +6 -6
  343. package/lib/core/mixins/can-hide-errors.d.ts +6 -6
  344. package/lib/core/mixins/can-load.d.ts +6 -6
  345. package/lib/core/mixins/constructor.d.ts +1 -1
  346. package/lib/core/mixins/has-error.d.ts +6 -6
  347. package/lib/core/mixins/is-focused.d.ts +6 -6
  348. package/lib/core/mixins/is-grouped.d.ts +6 -6
  349. package/lib/core/mixins/is-readonly.d.ts +6 -6
  350. package/lib/core/mixins/is-required.d.ts +6 -6
  351. package/lib/core/services/clipboard.service.d.ts +18 -18
  352. package/lib/core/services/exif.service.d.ts +15 -15
  353. package/lib/core/services/file-loader.service.d.ts +13 -13
  354. package/lib/core/services/image-converter.service.d.ts +21 -21
  355. package/lib/core/services/languages.service.d.ts +16 -16
  356. package/lib/core/services/network.service.d.ts +14 -14
  357. package/lib/core/services/patch.service.d.ts +16 -16
  358. package/lib/core/services/platform.service.d.ts +18 -18
  359. package/lib/core/tokens/accept-language.token.d.ts +2 -2
  360. package/lib/core/tokens/base-url.token.d.ts +2 -2
  361. package/lib/core/tokens/cookie.token.d.ts +2 -2
  362. package/lib/core/tokens/location.token.d.ts +2 -2
  363. package/lib/core/tokens/navigator.token.d.ts +2 -2
  364. package/lib/core/tokens/window.token.d.ts +2 -2
  365. package/localize/bravobit-bb-foundation-localize.d.ts +5 -5
  366. package/localize/lib/functions/date.function.d.ts +5 -5
  367. package/localize/lib/functions/lowercase.function.d.ts +5 -5
  368. package/localize/lib/functions/uppercase.function.d.ts +5 -5
  369. package/localize/lib/handlers/missing.handler.d.ts +6 -6
  370. package/localize/lib/interfaces/config.interfaces.d.ts +18 -8
  371. package/localize/lib/interfaces/functions.interfaces.d.ts +9 -9
  372. package/localize/lib/interfaces/handlers.interfaces.d.ts +6 -6
  373. package/localize/lib/interfaces/options.interfaces.d.ts +10 -10
  374. package/localize/lib/localizations/dutch.localization.d.ts +44 -51
  375. package/localize/lib/localizations/english.localization.d.ts +44 -51
  376. package/localize/lib/localize.dictionary.d.ts +7 -24
  377. package/localize/lib/localize.module.d.ts +17 -18
  378. package/localize/lib/localize.pipe.d.ts +12 -12
  379. package/localize/lib/localize.service.d.ts +40 -51
  380. package/localize/lib/views/localize-string/localize-string.component.d.ts +23 -23
  381. package/localize/lib/views/localize-template-or-string.directive.d.ts +10 -10
  382. package/localize/lib/views/localize-template.directive.d.ts +9 -9
  383. package/localize/public_api.d.ts +16 -17
  384. package/notifications/bravobit-bb-foundation-notifications.d.ts +5 -5
  385. package/notifications/lib/notifications-item/notifications-item.component.d.ts +34 -34
  386. package/notifications/lib/notifications-list/notifications-list.component.d.ts +16 -16
  387. package/notifications/lib/notifications.animations.d.ts +1 -1
  388. package/notifications/lib/notifications.injector.d.ts +8 -8
  389. package/notifications/lib/notifications.interfaces.d.ts +49 -49
  390. package/notifications/lib/notifications.module.d.ts +13 -13
  391. package/notifications/lib/notifications.service.d.ts +34 -34
  392. package/notifications/public_api.d.ts +3 -3
  393. package/package.json +6 -6
  394. package/public_api.d.ts +25 -25
  395. package/recaptcha/bravobit-bb-foundation-recaptcha.d.ts +5 -5
  396. package/recaptcha/lib/recaptcha/recaptcha.component.d.ts +47 -47
  397. package/recaptcha/lib/recaptcha-loader.service.d.ts +22 -22
  398. package/recaptcha/lib/recaptcha.interface.d.ts +14 -14
  399. package/recaptcha/lib/recaptcha.module.d.ts +10 -10
  400. package/recaptcha/public_api.d.ts +4 -4
  401. package/rxjs/bravobit-bb-foundation-rxjs.d.ts +5 -5
  402. package/rxjs/lib/operators/combine-latest-map.operator.d.ts +8 -8
  403. package/rxjs/lib/operators/filter-nil.operator.d.ts +1 -1
  404. package/rxjs/public_api.d.ts +2 -2
  405. package/storage/bravobit-bb-foundation-storage.d.ts +5 -5
  406. package/storage/lib/interfaces/attributes.interface.d.ts +13 -13
  407. package/storage/lib/interfaces/memory.interface.d.ts +7 -7
  408. package/storage/lib/interfaces/strategy.interface.d.ts +17 -17
  409. package/storage/lib/storage.service.d.ts +26 -26
  410. package/storage/lib/strategies/cookie-storage.strategy.d.ts +20 -20
  411. package/storage/lib/strategies/memory-storage.strategy.d.ts +11 -11
  412. package/storage/lib/strategies/polyfill-storage.strategy.d.ts +15 -15
  413. package/storage/public_api.d.ts +7 -7
  414. package/table/bravobit-bb-foundation-table.d.ts +5 -5
  415. package/table/lib/components/table/table.component.d.ts +56 -56
  416. package/table/lib/components/table-cell/table-cell.component.d.ts +5 -5
  417. package/table/lib/components/table-header-cell/table-header-cell.component.d.ts +29 -29
  418. package/table/lib/components/table-pager/table-pager.component.d.ts +41 -41
  419. package/table/lib/data/datasource.data.d.ts +14 -14
  420. package/table/lib/data/generic.data.d.ts +23 -23
  421. package/table/lib/interfaces/datasource.interface.d.ts +17 -17
  422. package/table/lib/interfaces/table.interfaces.d.ts +1 -1
  423. package/table/lib/table.module.d.ts +14 -14
  424. package/table/public_api.d.ts +9 -9
  425. package/esm2020/localize/lib/interfaces/dictionary.interfaces.mjs +0 -8
  426. package/localize/lib/interfaces/dictionary.interfaces.d.ts +0 -12
@@ -9,2029 +9,2032 @@ import * as i1$1 from '@bravobit/bb-foundation';
9
9
  import { mixinDisabled, mixinLoad, mixinGrouped, mixinFocused, mixinReadonly, mixinRequired, mixinError, mixinHideErrors } from '@bravobit/bb-foundation';
10
10
  import * as i5 from '@angular/forms';
11
11
  import { NG_VALUE_ACCESSOR, NgControl, NG_VALIDATORS, Validators, FormGroup, FormControl, ReactiveFormsModule } from '@angular/forms';
12
- import { map, mapTo, startWith, distinctUntilChanged, shareReplay, tap, delay } from 'rxjs/operators';
12
+ import { map, startWith, distinctUntilChanged, shareReplay, tap, delay } from 'rxjs/operators';
13
13
  import * as i4 from '@bravobit/bb-foundation/localize';
14
14
  import { LocalizeModule } from '@bravobit/bb-foundation/localize';
15
15
  import * as i2 from '@angular/platform-browser';
16
16
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
17
17
 
18
- class BbDropdown {
19
- constructor(_elementRef) {
20
- this._elementRef = _elementRef;
21
- // State.
22
- this.visible$ = new BehaviorSubject(false);
23
- }
24
- toggle() {
25
- return this.visible$.next(!this.visible$.getValue());
26
- }
27
- close() {
28
- return this.visible$.next(false);
29
- }
30
- onDocumentClick(target) {
31
- var _a, _b;
32
- if (!target) {
33
- return;
34
- }
35
- if ((_b = (_a = this._elementRef) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.contains(target)) {
36
- return;
37
- }
38
- return this.close();
39
- }
40
- }
41
- BbDropdown.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbDropdown, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
42
- BbDropdown.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbDropdown, selector: "bb-dropdown", host: { listeners: { "document:click": "onDocumentClick($event.target)" }, classAttribute: "bb-dropdown" }, ngImport: i0, template: "<button (click)=\"toggle()\"\n [class.opened]=\"visible$ | async\"\n type=\"button\">\n <ng-content></ng-content>\n</button>\n\n<div *ngIf=\"visible$ | async\"\n [@dropdownMenuAnimation]=\"true\"\n class=\"bb-dropdown-menu\"\n role=\"list\">\n <ng-content select=\"[bbDropdownItem], hr\"></ng-content>\n</div>\n", styles: [".bb-dropdown{position:relative;display:inline-block}.bb-dropdown.right>.bb-dropdown-menu{right:0;left:auto;transform-origin:top right}.bb-dropdown-menu{left:0;top:100%;padding:0;z-index:10;display:block;margin:10px 0 0;border-radius:4px;position:absolute;list-style-type:none;background-color:#fff;border:1px solid #cccccc;transform-origin:top left;box-shadow:0 0 6px #0000001a}.bb-dropdown-menu:after{width:0;top:-5px;height:0;right:5px;content:\"\";position:absolute;border-style:solid;border-width:0 10px 5px 10px;border-color:transparent transparent #d9d9d9 transparent}.bb-dropdown-menu>hr{margin:0;height:1px;border:none;background-color:#ccc}.bb-dropdown-item{width:100%;border:none;line-height:1;display:block;cursor:pointer;text-align:left;font-weight:500;-webkit-user-select:none;user-select:none;padding:12px 20px;white-space:nowrap;text-decoration:none;color:#676767!important;background-color:transparent;transition:background-color .25s cubic-bezier(0,0,.2,1)}.bb-dropdown-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.bb-dropdown-item:hover{background-color:#f6f6f6}.bb-dropdown-item:focus{box-shadow:0 0 0 3px #dce0e980}.bb-dropdown-item:active{background-color:#f0f0f0}\n"], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i1.AsyncPipe }, animations: [
43
- trigger('dropdownMenuAnimation', [
44
- transition(':enter', [
45
- // 1. Set the initial state.
46
- style({ opacity: 0, transform: 'scale(0.9)' }),
47
- // 2. Start the animation to show the item.
48
- animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 1, transform: 'scale(1)' }))
49
- ]),
50
- transition(':leave', [
51
- // 1. Set the initial state.
52
- style({ opacity: 1, transform: 'scale(1)' }),
53
- // 2. Start the animation to hide the item.
54
- animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 0, transform: 'scale(0.9)' }))
55
- ])
56
- ])
57
- ], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
58
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbDropdown, decorators: [{
59
- type: Component,
60
- args: [{ selector: 'bb-dropdown', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { 'class': 'bb-dropdown' }, preserveWhitespaces: false, animations: [
61
- trigger('dropdownMenuAnimation', [
62
- transition(':enter', [
63
- // 1. Set the initial state.
64
- style({ opacity: 0, transform: 'scale(0.9)' }),
65
- // 2. Start the animation to show the item.
66
- animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 1, transform: 'scale(1)' }))
67
- ]),
68
- transition(':leave', [
69
- // 1. Set the initial state.
70
- style({ opacity: 1, transform: 'scale(1)' }),
71
- // 2. Start the animation to hide the item.
72
- animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 0, transform: 'scale(0.9)' }))
73
- ])
74
- ])
75
- ], template: "<button (click)=\"toggle()\"\n [class.opened]=\"visible$ | async\"\n type=\"button\">\n <ng-content></ng-content>\n</button>\n\n<div *ngIf=\"visible$ | async\"\n [@dropdownMenuAnimation]=\"true\"\n class=\"bb-dropdown-menu\"\n role=\"list\">\n <ng-content select=\"[bbDropdownItem], hr\"></ng-content>\n</div>\n", styles: [".bb-dropdown{position:relative;display:inline-block}.bb-dropdown.right>.bb-dropdown-menu{right:0;left:auto;transform-origin:top right}.bb-dropdown-menu{left:0;top:100%;padding:0;z-index:10;display:block;margin:10px 0 0;border-radius:4px;position:absolute;list-style-type:none;background-color:#fff;border:1px solid #cccccc;transform-origin:top left;box-shadow:0 0 6px #0000001a}.bb-dropdown-menu:after{width:0;top:-5px;height:0;right:5px;content:\"\";position:absolute;border-style:solid;border-width:0 10px 5px 10px;border-color:transparent transparent #d9d9d9 transparent}.bb-dropdown-menu>hr{margin:0;height:1px;border:none;background-color:#ccc}.bb-dropdown-item{width:100%;border:none;line-height:1;display:block;cursor:pointer;text-align:left;font-weight:500;-webkit-user-select:none;user-select:none;padding:12px 20px;white-space:nowrap;text-decoration:none;color:#676767!important;background-color:transparent;transition:background-color .25s cubic-bezier(0,0,.2,1)}.bb-dropdown-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.bb-dropdown-item:hover{background-color:#f6f6f6}.bb-dropdown-item:focus{box-shadow:0 0 0 3px #dce0e980}.bb-dropdown-item:active{background-color:#f0f0f0}\n"] }]
76
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { onDocumentClick: [{
77
- type: HostListener,
78
- args: ['document:click', ['$event.target']]
79
- }] } });
80
- class BbDropdownItem {
81
- constructor(_parent) {
82
- this._parent = _parent;
83
- // Inputs.
84
- this.closeOnClick = true;
85
- }
86
- onClick() {
87
- var _a;
88
- if (!this.closeOnClick) {
89
- return;
90
- }
91
- (_a = this._parent) === null || _a === void 0 ? void 0 : _a.close();
92
- }
93
- }
94
- BbDropdownItem.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbDropdownItem, deps: [{ token: BbDropdown, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
95
- BbDropdownItem.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.0", type: BbDropdownItem, selector: "[bbDropdownItem]", inputs: { closeOnClick: "closeOnClick" }, host: { listeners: { "click": "onClick()" }, classAttribute: "bb-dropdown-item" }, ngImport: i0 });
96
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbDropdownItem, decorators: [{
97
- type: Directive,
98
- args: [{
99
- selector: '[bbDropdownItem]',
100
- host: {
101
- 'class': 'bb-dropdown-item'
102
- }
103
- }]
104
- }], ctorParameters: function () {
105
- return [{ type: BbDropdown, decorators: [{
106
- type: Optional
107
- }, {
108
- type: Host
109
- }] }];
110
- }, propDecorators: { closeOnClick: [{
111
- type: Input
112
- }], onClick: [{
113
- type: HostListener,
114
- args: ['click']
18
+ class BbDropdown {
19
+ constructor(_elementRef) {
20
+ this._elementRef = _elementRef;
21
+ // State.
22
+ this.visible$ = new BehaviorSubject(false);
23
+ }
24
+ toggle() {
25
+ return this.visible$.next(!this.visible$.getValue());
26
+ }
27
+ close() {
28
+ return this.visible$.next(false);
29
+ }
30
+ onDocumentClick(target) {
31
+ var _a, _b;
32
+ if (!target) {
33
+ return;
34
+ }
35
+ if ((_b = (_a = this._elementRef) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.contains(target)) {
36
+ return;
37
+ }
38
+ return this.close();
39
+ }
40
+ }
41
+ BbDropdown.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbDropdown, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
42
+ BbDropdown.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.6", type: BbDropdown, selector: "bb-dropdown", host: { listeners: { "document:click": "onDocumentClick($event.target)" }, classAttribute: "bb-dropdown" }, ngImport: i0, template: "<button (click)=\"toggle()\"\r\n [class.opened]=\"visible$ | async\"\r\n type=\"button\">\r\n <ng-content></ng-content>\r\n</button>\r\n\r\n<div *ngIf=\"visible$ | async\"\r\n [@dropdownMenuAnimation]=\"true\"\r\n class=\"bb-dropdown-menu\"\r\n role=\"list\">\r\n <ng-content select=\"[bbDropdownItem], hr\"></ng-content>\r\n</div>\r\n", styles: [".bb-dropdown{position:relative;display:inline-block}.bb-dropdown.right>.bb-dropdown-menu{right:0;left:auto;transform-origin:top right}.bb-dropdown-menu{left:0;top:100%;padding:0;z-index:10;display:block;margin:10px 0 0;border-radius:4px;position:absolute;list-style-type:none;background-color:#fff;border:1px solid #cccccc;transform-origin:top left;box-shadow:0 0 6px #0000001a}.bb-dropdown-menu:after{width:0;top:-5px;height:0;right:5px;content:\"\";position:absolute;border-style:solid;border-width:0 10px 5px 10px;border-color:transparent transparent #d9d9d9 transparent}.bb-dropdown-menu>hr{margin:0;height:1px;border:none;background-color:#ccc}.bb-dropdown-item{width:100%;border:none;line-height:1;display:block;cursor:pointer;text-align:left;font-weight:500;-webkit-user-select:none;user-select:none;padding:12px 20px;white-space:nowrap;text-decoration:none;color:#676767!important;background-color:transparent;transition:background-color .25s cubic-bezier(0,0,.2,1)}.bb-dropdown-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.bb-dropdown-item:hover{background-color:#f6f6f6}.bb-dropdown-item:focus{box-shadow:0 0 0 3px #dce0e980}.bb-dropdown-item:active{background-color:#f0f0f0}\n"], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i1.AsyncPipe }, animations: [
43
+ trigger('dropdownMenuAnimation', [
44
+ transition(':enter', [
45
+ // 1. Set the initial state.
46
+ style({ opacity: 0, transform: 'scale(0.9)' }),
47
+ // 2. Start the animation to show the item.
48
+ animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 1, transform: 'scale(1)' }))
49
+ ]),
50
+ transition(':leave', [
51
+ // 1. Set the initial state.
52
+ style({ opacity: 1, transform: 'scale(1)' }),
53
+ // 2. Start the animation to hide the item.
54
+ animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 0, transform: 'scale(0.9)' }))
55
+ ])
56
+ ])
57
+ ], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
58
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbDropdown, decorators: [{
59
+ type: Component,
60
+ args: [{ selector: 'bb-dropdown', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { 'class': 'bb-dropdown' }, preserveWhitespaces: false, animations: [
61
+ trigger('dropdownMenuAnimation', [
62
+ transition(':enter', [
63
+ // 1. Set the initial state.
64
+ style({ opacity: 0, transform: 'scale(0.9)' }),
65
+ // 2. Start the animation to show the item.
66
+ animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 1, transform: 'scale(1)' }))
67
+ ]),
68
+ transition(':leave', [
69
+ // 1. Set the initial state.
70
+ style({ opacity: 1, transform: 'scale(1)' }),
71
+ // 2. Start the animation to hide the item.
72
+ animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 0, transform: 'scale(0.9)' }))
73
+ ])
74
+ ])
75
+ ], template: "<button (click)=\"toggle()\"\r\n [class.opened]=\"visible$ | async\"\r\n type=\"button\">\r\n <ng-content></ng-content>\r\n</button>\r\n\r\n<div *ngIf=\"visible$ | async\"\r\n [@dropdownMenuAnimation]=\"true\"\r\n class=\"bb-dropdown-menu\"\r\n role=\"list\">\r\n <ng-content select=\"[bbDropdownItem], hr\"></ng-content>\r\n</div>\r\n", styles: [".bb-dropdown{position:relative;display:inline-block}.bb-dropdown.right>.bb-dropdown-menu{right:0;left:auto;transform-origin:top right}.bb-dropdown-menu{left:0;top:100%;padding:0;z-index:10;display:block;margin:10px 0 0;border-radius:4px;position:absolute;list-style-type:none;background-color:#fff;border:1px solid #cccccc;transform-origin:top left;box-shadow:0 0 6px #0000001a}.bb-dropdown-menu:after{width:0;top:-5px;height:0;right:5px;content:\"\";position:absolute;border-style:solid;border-width:0 10px 5px 10px;border-color:transparent transparent #d9d9d9 transparent}.bb-dropdown-menu>hr{margin:0;height:1px;border:none;background-color:#ccc}.bb-dropdown-item{width:100%;border:none;line-height:1;display:block;cursor:pointer;text-align:left;font-weight:500;-webkit-user-select:none;user-select:none;padding:12px 20px;white-space:nowrap;text-decoration:none;color:#676767!important;background-color:transparent;transition:background-color .25s cubic-bezier(0,0,.2,1)}.bb-dropdown-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.bb-dropdown-item:hover{background-color:#f6f6f6}.bb-dropdown-item:focus{box-shadow:0 0 0 3px #dce0e980}.bb-dropdown-item:active{background-color:#f0f0f0}\n"] }]
76
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { onDocumentClick: [{
77
+ type: HostListener,
78
+ args: ['document:click', ['$event.target']]
79
+ }] } });
80
+ class BbDropdownItem {
81
+ constructor(_parent) {
82
+ this._parent = _parent;
83
+ // Inputs.
84
+ this.closeOnClick = true;
85
+ }
86
+ onClick() {
87
+ var _a;
88
+ if (!this.closeOnClick) {
89
+ return;
90
+ }
91
+ (_a = this._parent) === null || _a === void 0 ? void 0 : _a.close();
92
+ }
93
+ }
94
+ BbDropdownItem.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbDropdownItem, deps: [{ token: BbDropdown, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
95
+ BbDropdownItem.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.6", type: BbDropdownItem, selector: "[bbDropdownItem]", inputs: { closeOnClick: "closeOnClick" }, host: { listeners: { "click": "onClick()" }, classAttribute: "bb-dropdown-item" }, ngImport: i0 });
96
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbDropdownItem, decorators: [{
97
+ type: Directive,
98
+ args: [{
99
+ selector: '[bbDropdownItem]',
100
+ host: {
101
+ 'class': 'bb-dropdown-item'
102
+ }
103
+ }]
104
+ }], ctorParameters: function () {
105
+ return [{ type: BbDropdown, decorators: [{
106
+ type: Optional
107
+ }, {
108
+ type: Host
109
+ }] }];
110
+ }, propDecorators: { closeOnClick: [{
111
+ type: Input
112
+ }], onClick: [{
113
+ type: HostListener,
114
+ args: ['click']
115
115
  }] } });
116
116
 
117
- const ELEMENTS_ICONS = new InjectionToken('elements_icons');
117
+ const ELEMENTS_ICONS = new InjectionToken('elements_icons');
118
118
  const ELEMENTS_ERRORS = new InjectionToken('elements_errors');
119
119
 
120
- class BbSpinnerBase {
121
- }
122
- const BbSpinnerMixinBase = mixinDisabled(BbSpinnerBase);
123
- class BbSpinner extends BbSpinnerMixinBase {
124
- constructor() {
125
- super(...arguments);
126
- // Inputs.
127
- this.color = '#303f9f';
128
- this.alt = 'Loading...';
129
- }
130
- }
131
- BbSpinner.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbSpinner, deps: null, target: i0.ɵɵFactoryTarget.Component });
132
- BbSpinner.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbSpinner, selector: "bb-spinner", inputs: { color: "color", alt: "alt", disabled: "disabled" }, host: { classAttribute: "bb-spinner" }, usesInheritance: true, ngImport: i0, template: "<!--\n The spinner element.\n\n This element contains a circle with a 25% bar that spins\n indefinitely. The border color can be set via the \"color\"\n property.\n-->\n<div class=\"bb-spinner-container\">\n <div [style.border-left-color]=\"color\"\n [class.disabled]=\"disabled\"\n class=\"bb-spinner-loader\"\n aria-live=\"assertive\"\n role=\"alert\">\n {{ alt }}\n </div>\n <ng-content select=\"img\"></ng-content>\n</div>\n\n<!--\n The content of the spinner.\n\n This element contains the content of the spinner. The user\n can set the content inside the tag.\n-->\n<span class=\"bb-spinner-content\">\n <ng-content></ng-content>\n</span>\n", styles: [".bb-spinner{color:#565656;padding:20px 0;text-align:center;align-items:center;display:inline-flex;flex-direction:column;justify-content:center}.bb-spinner.block{display:flex}.bb-spinner.inverse .bb-spinner-loader{border-color:#ffffff26}.bb-spinner.inverse .bb-spinner-content{color:#ffffff80}.bb-spinner.small .bb-spinner-loader,.bb-spinner.small .bb-spinner-loader:after{width:20px;height:20px;min-width:20px;min-height:20px}.bb-spinner.small .bb-spinner-loader{border-width:2px}.bb-spinner.small .bb-spinner-content{font-size:12px}.bb-spinner.medium .bb-spinner-loader,.bb-spinner.medium .bb-spinner-loader:after{width:60px;height:60px;min-width:60px;min-height:60px}.bb-spinner.medium .bb-spinner-loader{border-width:4px}.bb-spinner.medium .bb-spinner-content{font-size:16px}.bb-spinner.large .bb-spinner-loader,.bb-spinner.large .bb-spinner-loader:after{width:100px;height:100px;min-width:100px;min-height:100px}.bb-spinner.large .bb-spinner-loader{border-width:6px}.bb-spinner.large .bb-spinner-content{font-size:20px}.bb-spinner.horizontal{text-align:left;flex-direction:row}.bb-spinner.horizontal .bb-spinner-content:not(:empty){margin-left:10px;margin-top:0}.bb-spinner.vertical{text-align:center;flex-direction:column}.bb-spinner.vertical .bb-spinner-content:not(:empty){margin-left:0;margin-top:10px}.bb-spinner-container{display:flex;position:relative}.bb-spinner-container>img{top:20%;left:20%;width:60%;height:60%;position:absolute}.bb-spinner-loader{margin:0;padding:0;overflow:hidden;text-indent:100%;color:transparent;position:relative;display:inline-block;vertical-align:middle;border:4px solid #f2f4f6;animation:1s linear infinite spin}.bb-spinner-loader,.bb-spinner-loader:after{width:60px;height:60px;min-width:60px;min-height:60px;border-radius:50%}.bb-spinner-loader.disabled{cursor:default;-webkit-user-select:none;user-select:none;pointer-events:none;animation-play-state:paused}.bb-spinner-content:not(:empty){font-size:16px;margin-top:10px;font-weight:500}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
133
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbSpinner, decorators: [{
134
- type: Component,
135
- args: [{ selector: 'bb-spinner', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { 'class': 'bb-spinner' }, inputs: ['color', 'alt', 'disabled'], preserveWhitespaces: false, template: "<!--\n The spinner element.\n\n This element contains a circle with a 25% bar that spins\n indefinitely. The border color can be set via the \"color\"\n property.\n-->\n<div class=\"bb-spinner-container\">\n <div [style.border-left-color]=\"color\"\n [class.disabled]=\"disabled\"\n class=\"bb-spinner-loader\"\n aria-live=\"assertive\"\n role=\"alert\">\n {{ alt }}\n </div>\n <ng-content select=\"img\"></ng-content>\n</div>\n\n<!--\n The content of the spinner.\n\n This element contains the content of the spinner. The user\n can set the content inside the tag.\n-->\n<span class=\"bb-spinner-content\">\n <ng-content></ng-content>\n</span>\n", styles: [".bb-spinner{color:#565656;padding:20px 0;text-align:center;align-items:center;display:inline-flex;flex-direction:column;justify-content:center}.bb-spinner.block{display:flex}.bb-spinner.inverse .bb-spinner-loader{border-color:#ffffff26}.bb-spinner.inverse .bb-spinner-content{color:#ffffff80}.bb-spinner.small .bb-spinner-loader,.bb-spinner.small .bb-spinner-loader:after{width:20px;height:20px;min-width:20px;min-height:20px}.bb-spinner.small .bb-spinner-loader{border-width:2px}.bb-spinner.small .bb-spinner-content{font-size:12px}.bb-spinner.medium .bb-spinner-loader,.bb-spinner.medium .bb-spinner-loader:after{width:60px;height:60px;min-width:60px;min-height:60px}.bb-spinner.medium .bb-spinner-loader{border-width:4px}.bb-spinner.medium .bb-spinner-content{font-size:16px}.bb-spinner.large .bb-spinner-loader,.bb-spinner.large .bb-spinner-loader:after{width:100px;height:100px;min-width:100px;min-height:100px}.bb-spinner.large .bb-spinner-loader{border-width:6px}.bb-spinner.large .bb-spinner-content{font-size:20px}.bb-spinner.horizontal{text-align:left;flex-direction:row}.bb-spinner.horizontal .bb-spinner-content:not(:empty){margin-left:10px;margin-top:0}.bb-spinner.vertical{text-align:center;flex-direction:column}.bb-spinner.vertical .bb-spinner-content:not(:empty){margin-left:0;margin-top:10px}.bb-spinner-container{display:flex;position:relative}.bb-spinner-container>img{top:20%;left:20%;width:60%;height:60%;position:absolute}.bb-spinner-loader{margin:0;padding:0;overflow:hidden;text-indent:100%;color:transparent;position:relative;display:inline-block;vertical-align:middle;border:4px solid #f2f4f6;animation:1s linear infinite spin}.bb-spinner-loader,.bb-spinner-loader:after{width:60px;height:60px;min-width:60px;min-height:60px;border-radius:50%}.bb-spinner-loader.disabled{cursor:default;-webkit-user-select:none;user-select:none;pointer-events:none;animation-play-state:paused}.bb-spinner-content:not(:empty){font-size:16px;margin-top:10px;font-weight:500}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"] }]
136
- }], propDecorators: { color: [{
137
- type: Input
138
- }], alt: [{
139
- type: Input
120
+ class BbSpinnerBase {
121
+ }
122
+ const BbSpinnerMixinBase = mixinDisabled(BbSpinnerBase);
123
+ class BbSpinner extends BbSpinnerMixinBase {
124
+ constructor() {
125
+ super(...arguments);
126
+ // Inputs.
127
+ this.color = '#303f9f';
128
+ this.alt = 'Loading...';
129
+ }
130
+ }
131
+ BbSpinner.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbSpinner, deps: null, target: i0.ɵɵFactoryTarget.Component });
132
+ BbSpinner.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.6", type: BbSpinner, selector: "bb-spinner", inputs: { color: "color", alt: "alt", disabled: "disabled" }, host: { classAttribute: "bb-spinner" }, usesInheritance: true, ngImport: i0, template: "<!--\r\n The spinner element.\r\n\r\n This element contains a circle with a 25% bar that spins\r\n indefinitely. The border color can be set via the \"color\"\r\n property.\r\n-->\r\n<div class=\"bb-spinner-container\">\r\n <div [style.border-left-color]=\"color\"\r\n [class.disabled]=\"disabled\"\r\n class=\"bb-spinner-loader\"\r\n aria-live=\"assertive\"\r\n role=\"alert\">\r\n {{ alt }}\r\n </div>\r\n <ng-content select=\"img\"></ng-content>\r\n</div>\r\n\r\n<!--\r\n The content of the spinner.\r\n\r\n This element contains the content of the spinner. The user\r\n can set the content inside the tag.\r\n-->\r\n<span class=\"bb-spinner-content\">\r\n <ng-content></ng-content>\r\n</span>\r\n", styles: [".bb-spinner{color:#565656;padding:20px 0;text-align:center;align-items:center;display:inline-flex;flex-direction:column;justify-content:center}.bb-spinner.block{display:flex}.bb-spinner.inverse .bb-spinner-loader{border-color:#ffffff26}.bb-spinner.inverse .bb-spinner-content{color:#ffffff80}.bb-spinner.small .bb-spinner-loader,.bb-spinner.small .bb-spinner-loader:after{width:20px;height:20px;min-width:20px;min-height:20px}.bb-spinner.small .bb-spinner-loader{border-width:2px}.bb-spinner.small .bb-spinner-content{font-size:12px}.bb-spinner.medium .bb-spinner-loader,.bb-spinner.medium .bb-spinner-loader:after{width:60px;height:60px;min-width:60px;min-height:60px}.bb-spinner.medium .bb-spinner-loader{border-width:4px}.bb-spinner.medium .bb-spinner-content{font-size:16px}.bb-spinner.large .bb-spinner-loader,.bb-spinner.large .bb-spinner-loader:after{width:100px;height:100px;min-width:100px;min-height:100px}.bb-spinner.large .bb-spinner-loader{border-width:6px}.bb-spinner.large .bb-spinner-content{font-size:20px}.bb-spinner.horizontal{text-align:left;flex-direction:row}.bb-spinner.horizontal .bb-spinner-content:not(:empty){margin-left:10px;margin-top:0}.bb-spinner.vertical{text-align:center;flex-direction:column}.bb-spinner.vertical .bb-spinner-content:not(:empty){margin-left:0;margin-top:10px}.bb-spinner-container{display:flex;position:relative}.bb-spinner-container>img{top:20%;left:20%;width:60%;height:60%;position:absolute}.bb-spinner-loader{margin:0;padding:0;overflow:hidden;text-indent:100%;color:transparent;position:relative;display:inline-block;vertical-align:middle;border:4px solid #f2f4f6;animation:1s linear infinite spin}.bb-spinner-loader,.bb-spinner-loader:after{width:60px;height:60px;min-width:60px;min-height:60px;border-radius:50%}.bb-spinner-loader.disabled{cursor:default;-webkit-user-select:none;user-select:none;pointer-events:none;animation-play-state:paused}.bb-spinner-content:not(:empty){font-size:16px;margin-top:10px;font-weight:500}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
133
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbSpinner, decorators: [{
134
+ type: Component,
135
+ args: [{ selector: 'bb-spinner', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { 'class': 'bb-spinner' }, inputs: ['color', 'alt', 'disabled'], preserveWhitespaces: false, template: "<!--\r\n The spinner element.\r\n\r\n This element contains a circle with a 25% bar that spins\r\n indefinitely. The border color can be set via the \"color\"\r\n property.\r\n-->\r\n<div class=\"bb-spinner-container\">\r\n <div [style.border-left-color]=\"color\"\r\n [class.disabled]=\"disabled\"\r\n class=\"bb-spinner-loader\"\r\n aria-live=\"assertive\"\r\n role=\"alert\">\r\n {{ alt }}\r\n </div>\r\n <ng-content select=\"img\"></ng-content>\r\n</div>\r\n\r\n<!--\r\n The content of the spinner.\r\n\r\n This element contains the content of the spinner. The user\r\n can set the content inside the tag.\r\n-->\r\n<span class=\"bb-spinner-content\">\r\n <ng-content></ng-content>\r\n</span>\r\n", styles: [".bb-spinner{color:#565656;padding:20px 0;text-align:center;align-items:center;display:inline-flex;flex-direction:column;justify-content:center}.bb-spinner.block{display:flex}.bb-spinner.inverse .bb-spinner-loader{border-color:#ffffff26}.bb-spinner.inverse .bb-spinner-content{color:#ffffff80}.bb-spinner.small .bb-spinner-loader,.bb-spinner.small .bb-spinner-loader:after{width:20px;height:20px;min-width:20px;min-height:20px}.bb-spinner.small .bb-spinner-loader{border-width:2px}.bb-spinner.small .bb-spinner-content{font-size:12px}.bb-spinner.medium .bb-spinner-loader,.bb-spinner.medium .bb-spinner-loader:after{width:60px;height:60px;min-width:60px;min-height:60px}.bb-spinner.medium .bb-spinner-loader{border-width:4px}.bb-spinner.medium .bb-spinner-content{font-size:16px}.bb-spinner.large .bb-spinner-loader,.bb-spinner.large .bb-spinner-loader:after{width:100px;height:100px;min-width:100px;min-height:100px}.bb-spinner.large .bb-spinner-loader{border-width:6px}.bb-spinner.large .bb-spinner-content{font-size:20px}.bb-spinner.horizontal{text-align:left;flex-direction:row}.bb-spinner.horizontal .bb-spinner-content:not(:empty){margin-left:10px;margin-top:0}.bb-spinner.vertical{text-align:center;flex-direction:column}.bb-spinner.vertical .bb-spinner-content:not(:empty){margin-left:0;margin-top:10px}.bb-spinner-container{display:flex;position:relative}.bb-spinner-container>img{top:20%;left:20%;width:60%;height:60%;position:absolute}.bb-spinner-loader{margin:0;padding:0;overflow:hidden;text-indent:100%;color:transparent;position:relative;display:inline-block;vertical-align:middle;border:4px solid #f2f4f6;animation:1s linear infinite spin}.bb-spinner-loader,.bb-spinner-loader:after{width:60px;height:60px;min-width:60px;min-height:60px;border-radius:50%}.bb-spinner-loader.disabled{cursor:default;-webkit-user-select:none;user-select:none;pointer-events:none;animation-play-state:paused}.bb-spinner-content:not(:empty){font-size:16px;margin-top:10px;font-weight:500}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"] }]
136
+ }], propDecorators: { color: [{
137
+ type: Input
138
+ }], alt: [{
139
+ type: Input
140
140
  }] } });
141
141
 
142
- class BbButtonBase {
143
- constructor(_elementRef) {
144
- this._elementRef = _elementRef;
145
- }
146
- }
147
- const BbButtonMixinBase = mixinDisabled(mixinLoad(BbButtonBase));
148
- class BbButton extends BbButtonMixinBase {
149
- constructor(_elementRef) {
150
- super(_elementRef);
151
- }
152
- get nativeElement() {
153
- return this._elementRef.nativeElement;
154
- }
155
- focus() {
156
- this.nativeElement && this.nativeElement.focus();
157
- }
158
- }
159
- BbButton.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbButton, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
160
- BbButton.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbButton, selector: "button[bb-button]", inputs: { disabled: "disabled", loading: "loading" }, host: { properties: { "class.loading": "loading", "attr.disabled": "disabled || loading || null" }, classAttribute: "bb-button" }, exportAs: ["bbButton"], usesInheritance: true, ngImport: i0, template: "<bb-spinner [class.visible]=\"loading\"\n class=\"bb-button-spinner small\">\n</bb-spinner>\n\n<ng-content></ng-content>\n", styles: [".bb-button{height:38px;padding:0 8px;cursor:pointer;font-size:16px;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;font-style:normal;border-radius:4px;text-align:center;align-items:center;display:inline-flex;text-decoration:none;justify-content:center;background-color:#fff;color:#2d3c4d!important;border:1px solid #d4d8e1;transition-duration:.2s;box-shadow:0 6px 6px -6px #0000001a;transition-timing-function:cubic-bezier(0,0,.2,1);transition-property:padding-left,background-color,box-shadow}.bb-button:hover{background-color:#fcfcfb}.bb-button:focus,.bb-button:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #dce0e980}.bb-button.full{width:100%}.bb-button.full.loading{padding-left:42px}.bb-button.primary{border-color:#2f2b85;color:#fff!important;background-color:#5b53ff}.bb-button.primary:hover{background-color:#564ee6}.bb-button.primary:focus,.bb-button.primary:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #5b53ff80}.bb-button.destructive{border-color:#8f2020;color:#fff!important;background-color:#d32f2f}.bb-button.destructive:hover{background-color:#c32929}.bb-button.destructive:focus,.bb-button.destructive:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #d32f2f80}.bb-button:disabled,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button:disabled:active,.bb-button[disabled],.bb-button[disabled]:focus,.bb-button[disabled]:hover,.bb-button[disabled]:active,.bb-button.loading,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button.loading:active{opacity:.4;cursor:default;box-shadow:none}.bb-button-spinner{width:0;opacity:0;overflow:hidden;visibility:hidden;padding:0!important;transition:width .2s cubic-bezier(0,0,.2,1),opacity .1s cubic-bezier(0,0,.2,1)}.bb-button-spinner.visible{opacity:1;width:20px;margin-right:8px;visibility:visible}.bb-button.loading.full>.bb-button-spinner{left:8px;margin-right:0;position:absolute}\n"], components: [{ type: BbSpinner, selector: "bb-spinner", inputs: ["color", "alt", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
161
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbButton, decorators: [{
162
- type: Component,
163
- args: [{ selector: 'button[bb-button]', exportAs: 'bbButton', host: {
164
- 'class': 'bb-button',
165
- '[class.loading]': 'loading',
166
- '[attr.disabled]': 'disabled || loading || null'
167
- }, inputs: ['disabled', 'loading'], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<bb-spinner [class.visible]=\"loading\"\n class=\"bb-button-spinner small\">\n</bb-spinner>\n\n<ng-content></ng-content>\n", styles: [".bb-button{height:38px;padding:0 8px;cursor:pointer;font-size:16px;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;font-style:normal;border-radius:4px;text-align:center;align-items:center;display:inline-flex;text-decoration:none;justify-content:center;background-color:#fff;color:#2d3c4d!important;border:1px solid #d4d8e1;transition-duration:.2s;box-shadow:0 6px 6px -6px #0000001a;transition-timing-function:cubic-bezier(0,0,.2,1);transition-property:padding-left,background-color,box-shadow}.bb-button:hover{background-color:#fcfcfb}.bb-button:focus,.bb-button:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #dce0e980}.bb-button.full{width:100%}.bb-button.full.loading{padding-left:42px}.bb-button.primary{border-color:#2f2b85;color:#fff!important;background-color:#5b53ff}.bb-button.primary:hover{background-color:#564ee6}.bb-button.primary:focus,.bb-button.primary:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #5b53ff80}.bb-button.destructive{border-color:#8f2020;color:#fff!important;background-color:#d32f2f}.bb-button.destructive:hover{background-color:#c32929}.bb-button.destructive:focus,.bb-button.destructive:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #d32f2f80}.bb-button:disabled,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button:disabled:active,.bb-button[disabled],.bb-button[disabled]:focus,.bb-button[disabled]:hover,.bb-button[disabled]:active,.bb-button.loading,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button.loading:active{opacity:.4;cursor:default;box-shadow:none}.bb-button-spinner{width:0;opacity:0;overflow:hidden;visibility:hidden;padding:0!important;transition:width .2s cubic-bezier(0,0,.2,1),opacity .1s cubic-bezier(0,0,.2,1)}.bb-button-spinner.visible{opacity:1;width:20px;margin-right:8px;visibility:visible}.bb-button.loading.full>.bb-button-spinner{left:8px;margin-right:0;position:absolute}\n"] }]
168
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
169
- class BbAnchor extends BbButton {
170
- constructor(_elementRef) {
171
- super(_elementRef);
172
- }
173
- stopDisabledEvents(event) {
174
- // If the button is not disabled (and not loading) let all events pass.
175
- if (!this.disabled && !this.loading) {
176
- return;
177
- }
178
- // If the button is disabled and/or loading stop
179
- // the event from bubbling up.
180
- event.preventDefault();
181
- event.stopImmediatePropagation();
182
- }
183
- }
184
- BbAnchor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbAnchor, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
185
- BbAnchor.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbAnchor, selector: "a[bb-button]", inputs: { disabled: "disabled", loading: "loading", tabIndex: "tabIndex" }, host: { listeners: { "click": "stopDisabledEvents($event)" }, properties: { "attr.tabindex": "(disabled || loading) ? -1 : (tabIndex || 0)", "attr.disabled": "disabled || loading || null", "attr.aria-disabled": "(disabled || loading).toString()" }, classAttribute: "bb-button" }, exportAs: ["bbButton", "bbAnchor"], usesInheritance: true, ngImport: i0, template: "<bb-spinner [class.visible]=\"loading\"\n class=\"bb-button-spinner small\">\n</bb-spinner>\n\n<ng-content></ng-content>\n", styles: [".bb-button{height:38px;padding:0 8px;cursor:pointer;font-size:16px;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;font-style:normal;border-radius:4px;text-align:center;align-items:center;display:inline-flex;text-decoration:none;justify-content:center;background-color:#fff;color:#2d3c4d!important;border:1px solid #d4d8e1;transition-duration:.2s;box-shadow:0 6px 6px -6px #0000001a;transition-timing-function:cubic-bezier(0,0,.2,1);transition-property:padding-left,background-color,box-shadow}.bb-button:hover{background-color:#fcfcfb}.bb-button:focus,.bb-button:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #dce0e980}.bb-button.full{width:100%}.bb-button.full.loading{padding-left:42px}.bb-button.primary{border-color:#2f2b85;color:#fff!important;background-color:#5b53ff}.bb-button.primary:hover{background-color:#564ee6}.bb-button.primary:focus,.bb-button.primary:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #5b53ff80}.bb-button.destructive{border-color:#8f2020;color:#fff!important;background-color:#d32f2f}.bb-button.destructive:hover{background-color:#c32929}.bb-button.destructive:focus,.bb-button.destructive:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #d32f2f80}.bb-button:disabled,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button:disabled:active,.bb-button[disabled],.bb-button[disabled]:focus,.bb-button[disabled]:hover,.bb-button[disabled]:active,.bb-button.loading,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button.loading:active{opacity:.4;cursor:default;box-shadow:none}.bb-button-spinner{width:0;opacity:0;overflow:hidden;visibility:hidden;padding:0!important;transition:width .2s cubic-bezier(0,0,.2,1),opacity .1s cubic-bezier(0,0,.2,1)}.bb-button-spinner.visible{opacity:1;width:20px;margin-right:8px;visibility:visible}.bb-button.loading.full>.bb-button-spinner{left:8px;margin-right:0;position:absolute}\n"], components: [{ type: BbSpinner, selector: "bb-spinner", inputs: ["color", "alt", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
186
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbAnchor, decorators: [{
187
- type: Component,
188
- args: [{ selector: 'a[bb-button]', exportAs: 'bbButton, bbAnchor', host: {
189
- 'class': 'bb-button',
190
- '[attr.tabindex]': '(disabled || loading) ? -1 : (tabIndex || 0)',
191
- '[attr.disabled]': 'disabled || loading || null',
192
- '[attr.aria-disabled]': '(disabled || loading).toString()',
193
- '(click)': 'stopDisabledEvents($event)'
194
- }, inputs: ['disabled', 'loading'], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<bb-spinner [class.visible]=\"loading\"\n class=\"bb-button-spinner small\">\n</bb-spinner>\n\n<ng-content></ng-content>\n", styles: [".bb-button{height:38px;padding:0 8px;cursor:pointer;font-size:16px;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;font-style:normal;border-radius:4px;text-align:center;align-items:center;display:inline-flex;text-decoration:none;justify-content:center;background-color:#fff;color:#2d3c4d!important;border:1px solid #d4d8e1;transition-duration:.2s;box-shadow:0 6px 6px -6px #0000001a;transition-timing-function:cubic-bezier(0,0,.2,1);transition-property:padding-left,background-color,box-shadow}.bb-button:hover{background-color:#fcfcfb}.bb-button:focus,.bb-button:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #dce0e980}.bb-button.full{width:100%}.bb-button.full.loading{padding-left:42px}.bb-button.primary{border-color:#2f2b85;color:#fff!important;background-color:#5b53ff}.bb-button.primary:hover{background-color:#564ee6}.bb-button.primary:focus,.bb-button.primary:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #5b53ff80}.bb-button.destructive{border-color:#8f2020;color:#fff!important;background-color:#d32f2f}.bb-button.destructive:hover{background-color:#c32929}.bb-button.destructive:focus,.bb-button.destructive:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #d32f2f80}.bb-button:disabled,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button:disabled:active,.bb-button[disabled],.bb-button[disabled]:focus,.bb-button[disabled]:hover,.bb-button[disabled]:active,.bb-button.loading,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button.loading:active{opacity:.4;cursor:default;box-shadow:none}.bb-button-spinner{width:0;opacity:0;overflow:hidden;visibility:hidden;padding:0!important;transition:width .2s cubic-bezier(0,0,.2,1),opacity .1s cubic-bezier(0,0,.2,1)}.bb-button-spinner.visible{opacity:1;width:20px;margin-right:8px;visibility:visible}.bb-button.loading.full>.bb-button-spinner{left:8px;margin-right:0;position:absolute}\n"] }]
195
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { tabIndex: [{
196
- type: Input
142
+ class BbButtonBase {
143
+ constructor(_elementRef) {
144
+ this._elementRef = _elementRef;
145
+ }
146
+ }
147
+ const BbButtonMixinBase = mixinDisabled(mixinLoad(BbButtonBase));
148
+ class BbButton extends BbButtonMixinBase {
149
+ constructor(_elementRef) {
150
+ super(_elementRef);
151
+ }
152
+ get nativeElement() {
153
+ return this._elementRef.nativeElement;
154
+ }
155
+ focus() {
156
+ this.nativeElement && this.nativeElement.focus();
157
+ }
158
+ }
159
+ BbButton.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbButton, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
160
+ BbButton.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.6", type: BbButton, selector: "button[bb-button]", inputs: { disabled: "disabled", loading: "loading" }, host: { properties: { "class.loading": "loading", "attr.disabled": "disabled || loading || null" }, classAttribute: "bb-button" }, exportAs: ["bbButton"], usesInheritance: true, ngImport: i0, template: "<bb-spinner [class.visible]=\"loading\"\r\n class=\"bb-button-spinner small\">\r\n</bb-spinner>\r\n\r\n<ng-content></ng-content>\r\n", styles: [".bb-button{height:38px;padding:0 8px;cursor:pointer;font-size:16px;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;font-style:normal;border-radius:4px;text-align:center;align-items:center;display:inline-flex;text-decoration:none;justify-content:center;background-color:#fff;color:#2d3c4d!important;border:1px solid #d4d8e1;transition-duration:.2s;box-shadow:0 6px 6px -6px #0000001a;transition-timing-function:cubic-bezier(0,0,.2,1);transition-property:padding-left,background-color,box-shadow}.bb-button:hover{background-color:#fcfcfb}.bb-button:focus,.bb-button:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #dce0e980}.bb-button.full{width:100%}.bb-button.full.loading{padding-left:42px}.bb-button.primary{border-color:#2f2b85;color:#fff!important;background-color:#5b53ff}.bb-button.primary:hover{background-color:#564ee6}.bb-button.primary:focus,.bb-button.primary:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #5b53ff80}.bb-button.destructive{border-color:#8f2020;color:#fff!important;background-color:#d32f2f}.bb-button.destructive:hover{background-color:#c32929}.bb-button.destructive:focus,.bb-button.destructive:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #d32f2f80}.bb-button:disabled,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button:disabled:active,.bb-button[disabled],.bb-button[disabled]:focus,.bb-button[disabled]:hover,.bb-button[disabled]:active,.bb-button.loading,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button.loading:active{opacity:.4;cursor:default;box-shadow:none}.bb-button-spinner{width:0;opacity:0;overflow:hidden;visibility:hidden;padding:0!important;transition:width .2s cubic-bezier(0,0,.2,1),opacity .1s cubic-bezier(0,0,.2,1)}.bb-button-spinner.visible{opacity:1;width:20px;margin-right:8px;visibility:visible}.bb-button.loading.full>.bb-button-spinner{left:8px;margin-right:0;position:absolute}\n"], components: [{ type: BbSpinner, selector: "bb-spinner", inputs: ["color", "alt", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
161
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbButton, decorators: [{
162
+ type: Component,
163
+ args: [{ selector: 'button[bb-button]', exportAs: 'bbButton', host: {
164
+ 'class': 'bb-button',
165
+ '[class.loading]': 'loading',
166
+ '[attr.disabled]': 'disabled || loading || null'
167
+ }, inputs: ['disabled', 'loading'], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<bb-spinner [class.visible]=\"loading\"\r\n class=\"bb-button-spinner small\">\r\n</bb-spinner>\r\n\r\n<ng-content></ng-content>\r\n", styles: [".bb-button{height:38px;padding:0 8px;cursor:pointer;font-size:16px;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;font-style:normal;border-radius:4px;text-align:center;align-items:center;display:inline-flex;text-decoration:none;justify-content:center;background-color:#fff;color:#2d3c4d!important;border:1px solid #d4d8e1;transition-duration:.2s;box-shadow:0 6px 6px -6px #0000001a;transition-timing-function:cubic-bezier(0,0,.2,1);transition-property:padding-left,background-color,box-shadow}.bb-button:hover{background-color:#fcfcfb}.bb-button:focus,.bb-button:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #dce0e980}.bb-button.full{width:100%}.bb-button.full.loading{padding-left:42px}.bb-button.primary{border-color:#2f2b85;color:#fff!important;background-color:#5b53ff}.bb-button.primary:hover{background-color:#564ee6}.bb-button.primary:focus,.bb-button.primary:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #5b53ff80}.bb-button.destructive{border-color:#8f2020;color:#fff!important;background-color:#d32f2f}.bb-button.destructive:hover{background-color:#c32929}.bb-button.destructive:focus,.bb-button.destructive:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #d32f2f80}.bb-button:disabled,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button:disabled:active,.bb-button[disabled],.bb-button[disabled]:focus,.bb-button[disabled]:hover,.bb-button[disabled]:active,.bb-button.loading,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button.loading:active{opacity:.4;cursor:default;box-shadow:none}.bb-button-spinner{width:0;opacity:0;overflow:hidden;visibility:hidden;padding:0!important;transition:width .2s cubic-bezier(0,0,.2,1),opacity .1s cubic-bezier(0,0,.2,1)}.bb-button-spinner.visible{opacity:1;width:20px;margin-right:8px;visibility:visible}.bb-button.loading.full>.bb-button-spinner{left:8px;margin-right:0;position:absolute}\n"] }]
168
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
169
+ class BbAnchor extends BbButton {
170
+ constructor(_elementRef) {
171
+ super(_elementRef);
172
+ }
173
+ stopDisabledEvents(event) {
174
+ // If the button is not disabled (and not loading) let all events pass.
175
+ if (!this.disabled && !this.loading) {
176
+ return;
177
+ }
178
+ // If the button is disabled and/or loading stop
179
+ // the event from bubbling up.
180
+ event.preventDefault();
181
+ event.stopImmediatePropagation();
182
+ }
183
+ }
184
+ BbAnchor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbAnchor, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
185
+ BbAnchor.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.6", type: BbAnchor, selector: "a[bb-button]", inputs: { disabled: "disabled", loading: "loading", tabIndex: "tabIndex" }, host: { listeners: { "click": "stopDisabledEvents($event)" }, properties: { "attr.tabindex": "(disabled || loading) ? -1 : (tabIndex || 0)", "attr.disabled": "disabled || loading || null", "attr.aria-disabled": "(disabled || loading).toString()" }, classAttribute: "bb-button" }, exportAs: ["bbButton", "bbAnchor"], usesInheritance: true, ngImport: i0, template: "<bb-spinner [class.visible]=\"loading\"\r\n class=\"bb-button-spinner small\">\r\n</bb-spinner>\r\n\r\n<ng-content></ng-content>\r\n", styles: [".bb-button{height:38px;padding:0 8px;cursor:pointer;font-size:16px;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;font-style:normal;border-radius:4px;text-align:center;align-items:center;display:inline-flex;text-decoration:none;justify-content:center;background-color:#fff;color:#2d3c4d!important;border:1px solid #d4d8e1;transition-duration:.2s;box-shadow:0 6px 6px -6px #0000001a;transition-timing-function:cubic-bezier(0,0,.2,1);transition-property:padding-left,background-color,box-shadow}.bb-button:hover{background-color:#fcfcfb}.bb-button:focus,.bb-button:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #dce0e980}.bb-button.full{width:100%}.bb-button.full.loading{padding-left:42px}.bb-button.primary{border-color:#2f2b85;color:#fff!important;background-color:#5b53ff}.bb-button.primary:hover{background-color:#564ee6}.bb-button.primary:focus,.bb-button.primary:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #5b53ff80}.bb-button.destructive{border-color:#8f2020;color:#fff!important;background-color:#d32f2f}.bb-button.destructive:hover{background-color:#c32929}.bb-button.destructive:focus,.bb-button.destructive:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #d32f2f80}.bb-button:disabled,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button:disabled:active,.bb-button[disabled],.bb-button[disabled]:focus,.bb-button[disabled]:hover,.bb-button[disabled]:active,.bb-button.loading,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button.loading:active{opacity:.4;cursor:default;box-shadow:none}.bb-button-spinner{width:0;opacity:0;overflow:hidden;visibility:hidden;padding:0!important;transition:width .2s cubic-bezier(0,0,.2,1),opacity .1s cubic-bezier(0,0,.2,1)}.bb-button-spinner.visible{opacity:1;width:20px;margin-right:8px;visibility:visible}.bb-button.loading.full>.bb-button-spinner{left:8px;margin-right:0;position:absolute}\n"], components: [{ type: BbSpinner, selector: "bb-spinner", inputs: ["color", "alt", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
186
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbAnchor, decorators: [{
187
+ type: Component,
188
+ args: [{ selector: 'a[bb-button]', exportAs: 'bbButton, bbAnchor', host: {
189
+ 'class': 'bb-button',
190
+ '[attr.tabindex]': '(disabled || loading) ? -1 : (tabIndex || 0)',
191
+ '[attr.disabled]': 'disabled || loading || null',
192
+ '[attr.aria-disabled]': '(disabled || loading).toString()',
193
+ '(click)': 'stopDisabledEvents($event)'
194
+ }, inputs: ['disabled', 'loading'], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<bb-spinner [class.visible]=\"loading\"\r\n class=\"bb-button-spinner small\">\r\n</bb-spinner>\r\n\r\n<ng-content></ng-content>\r\n", styles: [".bb-button{height:38px;padding:0 8px;cursor:pointer;font-size:16px;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;font-style:normal;border-radius:4px;text-align:center;align-items:center;display:inline-flex;text-decoration:none;justify-content:center;background-color:#fff;color:#2d3c4d!important;border:1px solid #d4d8e1;transition-duration:.2s;box-shadow:0 6px 6px -6px #0000001a;transition-timing-function:cubic-bezier(0,0,.2,1);transition-property:padding-left,background-color,box-shadow}.bb-button:hover{background-color:#fcfcfb}.bb-button:focus,.bb-button:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #dce0e980}.bb-button.full{width:100%}.bb-button.full.loading{padding-left:42px}.bb-button.primary{border-color:#2f2b85;color:#fff!important;background-color:#5b53ff}.bb-button.primary:hover{background-color:#564ee6}.bb-button.primary:focus,.bb-button.primary:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #5b53ff80}.bb-button.destructive{border-color:#8f2020;color:#fff!important;background-color:#d32f2f}.bb-button.destructive:hover{background-color:#c32929}.bb-button.destructive:focus,.bb-button.destructive:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #d32f2f80}.bb-button:disabled,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button:disabled:active,.bb-button[disabled],.bb-button[disabled]:focus,.bb-button[disabled]:hover,.bb-button[disabled]:active,.bb-button.loading,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button.loading:active{opacity:.4;cursor:default;box-shadow:none}.bb-button-spinner{width:0;opacity:0;overflow:hidden;visibility:hidden;padding:0!important;transition:width .2s cubic-bezier(0,0,.2,1),opacity .1s cubic-bezier(0,0,.2,1)}.bb-button-spinner.visible{opacity:1;width:20px;margin-right:8px;visibility:visible}.bb-button.loading.full>.bb-button-spinner{left:8px;margin-right:0;position:absolute}\n"] }]
195
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { tabIndex: [{
196
+ type: Input
197
197
  }] } });
198
198
 
199
- class BbImagePickerBase {
200
- }
201
- const BbImagePickerMixinBase = mixinDisabled(mixinGrouped(BbImagePickerBase));
202
- class BbImagePicker extends BbImagePickerMixinBase {
203
- constructor(_converter) {
204
- super();
205
- this._converter = _converter;
206
- // Inputs.
207
- this.label = null;
208
- this.placeholder = null;
209
- this.styleDimensions = null;
210
- this.cropDimensions = null;
211
- // Form.
212
- this._value$ = new BehaviorSubject(null);
213
- this.valueChange = new EventEmitter();
214
- this.onTouchedCallback = () => {
215
- };
216
- this.onChangeCallback = () => {
217
- };
218
- }
219
- get value() {
220
- return this._value$.getValue();
221
- }
222
- set value(value) {
223
- this._value$.next(value);
224
- this.valueChange.emit(value);
225
- }
226
- get image() {
227
- return this._value$.pipe(map(value => value || this.placeholder), map(value => value ? `url(${value})` : null));
228
- }
229
- onFileChange(event) {
230
- return __awaiter(this, void 0, void 0, function* () {
231
- // Grab the file from the event.
232
- const file = event.target.files[0];
233
- // Check if the file exists.
234
- if (!file || this.disabled) {
235
- return;
236
- }
237
- try {
238
- this.value = yield this._converter.toDataUri(file, this.cropDimensions);
239
- }
240
- catch (error) {
241
- this.value = null;
242
- }
243
- this.onChangeCallback(this.value);
244
- if (this.fileInput && this.fileInput.nativeElement) {
245
- this.fileInput.nativeElement.value = '';
246
- }
247
- });
248
- }
249
- openFilePicker() {
250
- if (this.disabled) {
251
- return;
252
- }
253
- // Execute a click on the file input.
254
- this.fileInput
255
- && this.fileInput.nativeElement
256
- && this.fileInput.nativeElement.click
257
- && this.fileInput.nativeElement.click();
258
- }
259
- writeValue(value) {
260
- this.value = value;
261
- }
262
- registerOnChange(method) {
263
- this.onChangeCallback = method;
264
- }
265
- registerOnTouched(method) {
266
- this.onTouchedCallback = method;
267
- }
268
- setDisabledState(isDisabled) {
269
- this.disabled = isDisabled;
270
- }
271
- }
272
- BbImagePicker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbImagePicker, deps: [{ token: i1$1.ImageConverter }], target: i0.ɵɵFactoryTarget.Component });
273
- BbImagePicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbImagePicker, selector: "bb-image-picker", inputs: { grouped: "grouped", disabled: "disabled", label: "label", placeholder: "placeholder", styleDimensions: "styleDimensions", cropDimensions: "cropDimensions", value: "value" }, outputs: { valueChange: "valueChange" }, host: { properties: { "class.disabled": "disabled", "class.grouped": "grouped" }, classAttribute: "bb-image-picker" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbImagePicker), multi: true }], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<!-- The input that can open the file picker. -->\n<input #fileInput\n (change)=\"onFileChange($event)\"\n class=\"bb-image-picker-input\"\n type=\"file\"\n tabindex=\"-1\"\n accept=\"image/*\">\n\n<span [style.width]=\"styleDimensions?.width || '100%'\"\n [style.height]=\"styleDimensions?.height || '215px'\"\n [style.background-image]=\"image | async\"\n class=\"bb-image-input-image\">\n </span>\n\n<button *ngIf=\"label as labelText\"\n (click)=\"openFilePicker()\"\n bb-button\n class=\"bb-image-input-button\"\n type=\"button\">\n {{ labelText }}\n</button>\n", styles: [".bb-image-picker{display:flex;align-items:center;flex-direction:column}.bb-image-picker.circle>.bb-image-input-image{border-radius:50%}.bb-image-picker.grouped{margin-bottom:20px}.bb-image-picker.disabled{opacity:.5;cursor:default;-webkit-user-select:none;user-select:none;pointer-events:none}.bb-image-picker-input{opacity:0;z-index:-1;width:.1px;height:.1px;overflow:hidden;position:absolute}.bb-image-input-image{display:flex;cursor:default;position:relative;border-radius:4px;align-items:center;justify-content:center;background:rgba(0,0,0,.2) url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7) center center/cover no-repeat}.bb-image-input-button{margin-top:10px}\n"], components: [{ type: BbButton, selector: "button[bb-button]", inputs: ["disabled", "loading"], exportAs: ["bbButton"] }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i1.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
274
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbImagePicker, decorators: [{
275
- type: Component,
276
- args: [{ selector: 'bb-image-picker', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
277
- 'class': 'bb-image-picker',
278
- '[class.disabled]': 'disabled',
279
- '[class.grouped]': 'grouped'
280
- }, inputs: ['grouped', 'disabled'], providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbImagePicker), multi: true }], preserveWhitespaces: false, template: "<!-- The input that can open the file picker. -->\n<input #fileInput\n (change)=\"onFileChange($event)\"\n class=\"bb-image-picker-input\"\n type=\"file\"\n tabindex=\"-1\"\n accept=\"image/*\">\n\n<span [style.width]=\"styleDimensions?.width || '100%'\"\n [style.height]=\"styleDimensions?.height || '215px'\"\n [style.background-image]=\"image | async\"\n class=\"bb-image-input-image\">\n </span>\n\n<button *ngIf=\"label as labelText\"\n (click)=\"openFilePicker()\"\n bb-button\n class=\"bb-image-input-button\"\n type=\"button\">\n {{ labelText }}\n</button>\n", styles: [".bb-image-picker{display:flex;align-items:center;flex-direction:column}.bb-image-picker.circle>.bb-image-input-image{border-radius:50%}.bb-image-picker.grouped{margin-bottom:20px}.bb-image-picker.disabled{opacity:.5;cursor:default;-webkit-user-select:none;user-select:none;pointer-events:none}.bb-image-picker-input{opacity:0;z-index:-1;width:.1px;height:.1px;overflow:hidden;position:absolute}.bb-image-input-image{display:flex;cursor:default;position:relative;border-radius:4px;align-items:center;justify-content:center;background:rgba(0,0,0,.2) url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7) center center/cover no-repeat}.bb-image-input-button{margin-top:10px}\n"] }]
281
- }], ctorParameters: function () { return [{ type: i1$1.ImageConverter }]; }, propDecorators: { fileInput: [{
282
- type: ViewChild,
283
- args: ['fileInput', { static: true }]
284
- }], label: [{
285
- type: Input
286
- }], placeholder: [{
287
- type: Input
288
- }], styleDimensions: [{
289
- type: Input
290
- }], cropDimensions: [{
291
- type: Input
292
- }], value: [{
293
- type: Input
294
- }], valueChange: [{
295
- type: Output
199
+ class BbImagePickerBase {
200
+ }
201
+ const BbImagePickerMixinBase = mixinDisabled(mixinGrouped(BbImagePickerBase));
202
+ class BbImagePicker extends BbImagePickerMixinBase {
203
+ constructor(_converter) {
204
+ super();
205
+ this._converter = _converter;
206
+ // Inputs.
207
+ this.label = null;
208
+ this.placeholder = null;
209
+ this.styleDimensions = null;
210
+ this.cropDimensions = null;
211
+ // Form.
212
+ this._value$ = new BehaviorSubject(null);
213
+ this.valueChange = new EventEmitter();
214
+ this.onTouchedCallback = () => {
215
+ };
216
+ this.onChangeCallback = () => {
217
+ };
218
+ }
219
+ get value() {
220
+ return this._value$.getValue();
221
+ }
222
+ set value(value) {
223
+ this._value$.next(value);
224
+ this.valueChange.emit(value);
225
+ }
226
+ get image() {
227
+ return this._value$.pipe(map(value => value || this.placeholder), map(value => value ? `url(${value})` : null));
228
+ }
229
+ onFileChange(event) {
230
+ return __awaiter(this, void 0, void 0, function* () {
231
+ // Grab the file from the event.
232
+ const file = event.target.files[0];
233
+ // Check if the file exists.
234
+ if (!file || this.disabled) {
235
+ return;
236
+ }
237
+ try {
238
+ this.value = yield this._converter.toDataUri(file, this.cropDimensions);
239
+ }
240
+ catch (error) {
241
+ this.value = null;
242
+ }
243
+ this.onChangeCallback(this.value);
244
+ if (this.fileInput && this.fileInput.nativeElement) {
245
+ this.fileInput.nativeElement.value = '';
246
+ }
247
+ });
248
+ }
249
+ openFilePicker() {
250
+ if (this.disabled) {
251
+ return;
252
+ }
253
+ // Execute a click on the file input.
254
+ this.fileInput
255
+ && this.fileInput.nativeElement
256
+ && this.fileInput.nativeElement.click
257
+ && this.fileInput.nativeElement.click();
258
+ }
259
+ writeValue(value) {
260
+ this.value = value;
261
+ }
262
+ registerOnChange(method) {
263
+ this.onChangeCallback = method;
264
+ }
265
+ registerOnTouched(method) {
266
+ this.onTouchedCallback = method;
267
+ }
268
+ setDisabledState(isDisabled) {
269
+ this.disabled = isDisabled;
270
+ }
271
+ }
272
+ BbImagePicker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbImagePicker, deps: [{ token: i1$1.ImageConverter }], target: i0.ɵɵFactoryTarget.Component });
273
+ BbImagePicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.6", type: BbImagePicker, selector: "bb-image-picker", inputs: { grouped: "grouped", disabled: "disabled", label: "label", placeholder: "placeholder", styleDimensions: "styleDimensions", cropDimensions: "cropDimensions", value: "value" }, outputs: { valueChange: "valueChange" }, host: { properties: { "class.disabled": "disabled", "class.grouped": "grouped" }, classAttribute: "bb-image-picker" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbImagePicker), multi: true }], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<!-- The input that can open the file picker. -->\r\n<input #fileInput\r\n (change)=\"onFileChange($event)\"\r\n class=\"bb-image-picker-input\"\r\n type=\"file\"\r\n tabindex=\"-1\"\r\n accept=\"image/*\">\r\n\r\n<span [style.width]=\"styleDimensions?.width || '100%'\"\r\n [style.height]=\"styleDimensions?.height || '215px'\"\r\n [style.background-image]=\"image | async\"\r\n class=\"bb-image-input-image\">\r\n </span>\r\n\r\n<button *ngIf=\"label as labelText\"\r\n (click)=\"openFilePicker()\"\r\n bb-button\r\n class=\"bb-image-input-button\"\r\n type=\"button\">\r\n {{ labelText }}\r\n</button>\r\n", styles: [".bb-image-picker{display:flex;align-items:center;flex-direction:column}.bb-image-picker.circle>.bb-image-input-image{border-radius:50%}.bb-image-picker.grouped{margin-bottom:20px}.bb-image-picker.disabled{opacity:.5;cursor:default;-webkit-user-select:none;user-select:none;pointer-events:none}.bb-image-picker-input{opacity:0;z-index:-1;width:.1px;height:.1px;overflow:hidden;position:absolute}.bb-image-input-image{display:flex;cursor:default;position:relative;border-radius:4px;align-items:center;justify-content:center;background:rgba(0,0,0,.2) url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7) center center/cover no-repeat}.bb-image-input-button{margin-top:10px}\n"], components: [{ type: BbButton, selector: "button[bb-button]", inputs: ["disabled", "loading"], exportAs: ["bbButton"] }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i1.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
274
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbImagePicker, decorators: [{
275
+ type: Component,
276
+ args: [{ selector: 'bb-image-picker', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
277
+ 'class': 'bb-image-picker',
278
+ '[class.disabled]': 'disabled',
279
+ '[class.grouped]': 'grouped'
280
+ }, inputs: ['grouped', 'disabled'], providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbImagePicker), multi: true }], preserveWhitespaces: false, template: "<!-- The input that can open the file picker. -->\r\n<input #fileInput\r\n (change)=\"onFileChange($event)\"\r\n class=\"bb-image-picker-input\"\r\n type=\"file\"\r\n tabindex=\"-1\"\r\n accept=\"image/*\">\r\n\r\n<span [style.width]=\"styleDimensions?.width || '100%'\"\r\n [style.height]=\"styleDimensions?.height || '215px'\"\r\n [style.background-image]=\"image | async\"\r\n class=\"bb-image-input-image\">\r\n </span>\r\n\r\n<button *ngIf=\"label as labelText\"\r\n (click)=\"openFilePicker()\"\r\n bb-button\r\n class=\"bb-image-input-button\"\r\n type=\"button\">\r\n {{ labelText }}\r\n</button>\r\n", styles: [".bb-image-picker{display:flex;align-items:center;flex-direction:column}.bb-image-picker.circle>.bb-image-input-image{border-radius:50%}.bb-image-picker.grouped{margin-bottom:20px}.bb-image-picker.disabled{opacity:.5;cursor:default;-webkit-user-select:none;user-select:none;pointer-events:none}.bb-image-picker-input{opacity:0;z-index:-1;width:.1px;height:.1px;overflow:hidden;position:absolute}.bb-image-input-image{display:flex;cursor:default;position:relative;border-radius:4px;align-items:center;justify-content:center;background:rgba(0,0,0,.2) url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7) center center/cover no-repeat}.bb-image-input-button{margin-top:10px}\n"] }]
281
+ }], ctorParameters: function () { return [{ type: i1$1.ImageConverter }]; }, propDecorators: { fileInput: [{
282
+ type: ViewChild,
283
+ args: ['fileInput', { static: true }]
284
+ }], label: [{
285
+ type: Input
286
+ }], placeholder: [{
287
+ type: Input
288
+ }], styleDimensions: [{
289
+ type: Input
290
+ }], cropDimensions: [{
291
+ type: Input
292
+ }], value: [{
293
+ type: Input
294
+ }], valueChange: [{
295
+ type: Output
296
296
  }] } });
297
297
 
298
- class BbFormSubmit {
299
- constructor(_host, _formDirective) {
300
- this._host = _host;
301
- this._formDirective = _formDirective;
302
- }
303
- ngOnInit() {
304
- // Submit changes.
305
- const regularSubmitChanges$ = fromEvent(this.nativeElement, 'submit').pipe(mapTo(true));
306
- // Reactive form submit changes.
307
- const reactiveSubmitChanges$ = this.reactiveSubmitChanges();
308
- // Reset changes.
309
- const resetChanges$ = fromEvent(this.nativeElement, 'reset').pipe(mapTo(false));
310
- // Listen to the submit status.
311
- this.submitStatus$ = merge(regularSubmitChanges$, reactiveSubmitChanges$, resetChanges$).pipe(startWith(false), distinctUntilChanged(), shareReplay(1));
312
- }
313
- submit() {
314
- var _a, _b;
315
- (_b = (_a = this._formDirective) === null || _a === void 0 ? void 0 : _a.ngSubmit) === null || _b === void 0 ? void 0 : _b.emit();
316
- }
317
- reset() {
318
- var _a;
319
- return (_a = this.nativeElement) === null || _a === void 0 ? void 0 : _a.reset();
320
- }
321
- get nativeElement() {
322
- var _a;
323
- return (_a = this._host) === null || _a === void 0 ? void 0 : _a.nativeElement;
324
- }
325
- reactiveSubmitChanges() {
326
- if (!this._formDirective) {
327
- return EMPTY;
328
- }
329
- return this._formDirective.ngSubmit.pipe(mapTo(true));
330
- }
331
- }
332
- BbFormSubmit.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFormSubmit, deps: [{ token: i0.ElementRef }, { token: i5.FormGroupDirective, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Directive });
333
- BbFormSubmit.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.0", type: BbFormSubmit, selector: "form", exportAs: ["bbForm"], ngImport: i0 });
334
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFormSubmit, decorators: [{
335
- type: Directive,
336
- args: [{
337
- selector: 'form',
338
- exportAs: 'bbForm'
339
- }]
340
- }], ctorParameters: function () {
341
- return [{ type: i0.ElementRef }, { type: i5.FormGroupDirective, decorators: [{
342
- type: Optional
343
- }, {
344
- type: Self
345
- }] }];
298
+ class BbFormSubmit {
299
+ constructor(_host, _formDirective) {
300
+ this._host = _host;
301
+ this._formDirective = _formDirective;
302
+ }
303
+ ngOnInit() {
304
+ // Submit changes.
305
+ const regularSubmitChanges$ = fromEvent(this.nativeElement, 'submit').pipe(map(() => true));
306
+ // Reactive form submit changes.
307
+ const reactiveSubmitChanges$ = this.reactiveSubmitChanges();
308
+ // Reset changes.
309
+ const resetChanges$ = fromEvent(this.nativeElement, 'reset').pipe(map(() => false));
310
+ // Listen to the submit status.
311
+ this.submitStatus$ = merge(regularSubmitChanges$, reactiveSubmitChanges$, resetChanges$).pipe(startWith(false), distinctUntilChanged(), shareReplay(1));
312
+ }
313
+ submit() {
314
+ var _a, _b;
315
+ (_b = (_a = this._formDirective) === null || _a === void 0 ? void 0 : _a.ngSubmit) === null || _b === void 0 ? void 0 : _b.emit();
316
+ }
317
+ reset() {
318
+ var _a;
319
+ return (_a = this.nativeElement) === null || _a === void 0 ? void 0 : _a.reset();
320
+ }
321
+ get nativeElement() {
322
+ var _a;
323
+ return (_a = this._host) === null || _a === void 0 ? void 0 : _a.nativeElement;
324
+ }
325
+ reactiveSubmitChanges() {
326
+ if (!this._formDirective) {
327
+ return EMPTY;
328
+ }
329
+ return this._formDirective.ngSubmit.pipe(map(() => true));
330
+ }
331
+ }
332
+ BbFormSubmit.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbFormSubmit, deps: [{ token: i0.ElementRef }, { token: i5.FormGroupDirective, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Directive });
333
+ BbFormSubmit.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.6", type: BbFormSubmit, selector: "form", exportAs: ["bbForm"], ngImport: i0 });
334
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbFormSubmit, decorators: [{
335
+ type: Directive,
336
+ args: [{
337
+ selector: 'form',
338
+ exportAs: 'bbForm'
339
+ }]
340
+ }], ctorParameters: function () {
341
+ return [{ type: i0.ElementRef }, { type: i5.FormGroupDirective, decorators: [{
342
+ type: Optional
343
+ }, {
344
+ type: Self
345
+ }] }];
346
346
  } });
347
347
 
348
- class BbFormError {
349
- constructor(_form, _control, _errors) {
350
- this._form = _form;
351
- this._control = _control;
352
- this._errors = _errors;
353
- // Outputs.
354
- this.errorChange = new EventEmitter();
355
- // Subscriptions.
356
- this._ngControl = null;
357
- }
358
- // Inputs.
359
- set control(value) {
360
- this._ngControl = value;
361
- }
362
- get control() {
363
- return this._ngControl;
364
- }
365
- ngOnInit() {
366
- // Set the control if it was not set before.
367
- if (!this.control) {
368
- this.control = this._control;
369
- }
370
- // Listen for the submit changes
371
- const submitStatus$ = this.submitStatusChanges();
372
- // An observable that emits error changes.
373
- const errorChanges$ = this.statusChanges().pipe(map(() => this.getError(this.control.errors)), distinctUntilChanged(), map(error => typeof error === 'string' ? { token: error } : error));
374
- // Whenever the user submitted the form we want to
375
- // listen for any error changes.
376
- this.error$ = combineLatest([submitStatus$, errorChanges$]).pipe(map(([submitted, error]) => {
377
- // If not submitted return null.
378
- if (!submitted) {
379
- return null;
380
- }
381
- // Return the error if submitted.
382
- return error;
383
- }), tap(value => this.errorChange.emit(value)));
384
- }
385
- getError(errors) {
386
- // Validate the errors exist.
387
- if (!errors) {
388
- return null;
389
- }
390
- // Get the first error in the errors.
391
- const [errorName] = Object.keys(errors);
392
- const error = errors[errorName];
393
- // Validate the error exists.
394
- if (!error) {
395
- return null;
396
- }
397
- // Map the arrays into a object so we can
398
- // access the functions by a key-lookup.
399
- const errorFunctions = this._errors.reduce((previous, current) => (Object.assign(Object.assign({}, previous), current)), {});
400
- // Get the error function.
401
- const errorFunction = errorFunctions[errorName] || errorFunctions['unknown'];
402
- // Validate the error function exists.
403
- if (!errorFunction) {
404
- return null;
405
- }
406
- // Return the parsed error.
407
- return errorFunction(error);
408
- }
409
- submitStatusChanges() {
410
- if (!this._form) {
411
- return of(true);
412
- }
413
- return this._form.submitStatus$;
414
- }
415
- statusChanges() {
416
- if (!this.control) {
417
- return EMPTY;
418
- }
419
- if (!this.control.statusChanges) {
420
- return EMPTY;
421
- }
422
- return this.control.statusChanges.pipe(startWith(this.control.status), delay(0));
423
- }
424
- }
425
- BbFormError.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFormError, deps: [{ token: BbFormSubmit, optional: true }, { token: i5.NgControl, optional: true }, { token: ELEMENTS_ERRORS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
426
- BbFormError.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbFormError, selector: "bb-form-error", inputs: { control: "control" }, outputs: { errorChange: "errorChange" }, host: { classAttribute: "bb-form-error" }, ngImport: i0, template: "<ng-container *ngIf=\"error$ | async as error\">\n <p *ngIf=\"error?.token | bbLocalize:{optional: true, data: error?.data} as message\"\n class=\"bb-form-error-message\">\n {{ message }}\n </p>\n</ng-container>", styles: [".bb-form-error{display:block}.bb-form-error-message{color:#c23934;display:block;font-size:13px;margin-top:4px}\n"], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i1.AsyncPipe, "bbLocalize": i4.BbLocalize }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
427
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFormError, decorators: [{
428
- type: Component,
429
- args: [{ selector: 'bb-form-error', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
430
- 'class': 'bb-form-error'
431
- }, preserveWhitespaces: false, template: "<ng-container *ngIf=\"error$ | async as error\">\n <p *ngIf=\"error?.token | bbLocalize:{optional: true, data: error?.data} as message\"\n class=\"bb-form-error-message\">\n {{ message }}\n </p>\n</ng-container>", styles: [".bb-form-error{display:block}.bb-form-error-message{color:#c23934;display:block;font-size:13px;margin-top:4px}\n"] }]
432
- }], ctorParameters: function () {
433
- return [{ type: BbFormSubmit, decorators: [{
434
- type: Optional
435
- }] }, { type: i5.NgControl, decorators: [{
436
- type: Optional
437
- }] }, { type: undefined, decorators: [{
438
- type: Optional
439
- }, {
440
- type: Inject,
441
- args: [ELEMENTS_ERRORS]
442
- }] }];
443
- }, propDecorators: { control: [{
444
- type: Input
445
- }], errorChange: [{
446
- type: Output
348
+ class BbFormError {
349
+ constructor(_form, _control, _errors) {
350
+ this._form = _form;
351
+ this._control = _control;
352
+ this._errors = _errors;
353
+ // Outputs.
354
+ this.errorChange = new EventEmitter();
355
+ // Subscriptions.
356
+ this._ngControl = null;
357
+ }
358
+ // Inputs.
359
+ set control(value) {
360
+ this._ngControl = value;
361
+ }
362
+ get control() {
363
+ return this._ngControl;
364
+ }
365
+ ngOnInit() {
366
+ // Set the control if it was not set before.
367
+ if (!this.control) {
368
+ this.control = this._control;
369
+ }
370
+ // Listen for the submit changes
371
+ const submitStatus$ = this.submitStatusChanges();
372
+ // An observable that emits error changes.
373
+ const errorChanges$ = this.statusChanges().pipe(map(() => this.getError(this.control.errors)), distinctUntilChanged(), map(error => typeof error === 'string' ? { token: error } : error));
374
+ // Whenever the user submitted the form we want to
375
+ // listen for any error changes.
376
+ this.error$ = combineLatest([submitStatus$, errorChanges$]).pipe(map(([submitted, error]) => {
377
+ // If not submitted return null.
378
+ if (!submitted) {
379
+ return null;
380
+ }
381
+ // Return the error if submitted.
382
+ return error;
383
+ }), tap(value => this.errorChange.emit(value)));
384
+ }
385
+ getError(errors) {
386
+ // Validate the errors exist.
387
+ if (!errors) {
388
+ return null;
389
+ }
390
+ // Get the first error in the errors.
391
+ const [errorName] = Object.keys(errors);
392
+ const error = errors[errorName];
393
+ // Validate the error exists.
394
+ if (!error) {
395
+ return null;
396
+ }
397
+ // Map the arrays into a object so we can
398
+ // access the functions by a key-lookup.
399
+ const errorFunctions = this._errors.reduce((previous, current) => (Object.assign(Object.assign({}, previous), current)), {});
400
+ // Get the error function.
401
+ const errorFunction = errorFunctions[errorName] || errorFunctions['unknown'];
402
+ // Validate the error function exists.
403
+ if (!errorFunction) {
404
+ return null;
405
+ }
406
+ // Return the parsed error.
407
+ return errorFunction(error);
408
+ }
409
+ submitStatusChanges() {
410
+ if (!this._form) {
411
+ return of(true);
412
+ }
413
+ return this._form.submitStatus$;
414
+ }
415
+ statusChanges() {
416
+ if (!this.control) {
417
+ return EMPTY;
418
+ }
419
+ if (!this.control.statusChanges) {
420
+ return EMPTY;
421
+ }
422
+ return this.control.statusChanges.pipe(startWith(this.control.status), delay(0));
423
+ }
424
+ }
425
+ BbFormError.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbFormError, deps: [{ token: BbFormSubmit, optional: true }, { token: i5.NgControl, optional: true }, { token: ELEMENTS_ERRORS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
426
+ BbFormError.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.6", type: BbFormError, selector: "bb-form-error", inputs: { control: "control" }, outputs: { errorChange: "errorChange" }, host: { classAttribute: "bb-form-error" }, ngImport: i0, template: "<ng-container *ngIf=\"error$ | async as error\">\r\n <p *ngIf=\"error?.token | bbLocalize:{optional: true, data: error?.data} as message\"\r\n class=\"bb-form-error-message\">\r\n {{ message }}\r\n </p>\r\n</ng-container>", styles: [".bb-form-error{display:block}.bb-form-error-message{color:#c23934;display:block;font-size:13px;margin-top:4px}\n"], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i1.AsyncPipe, "bbLocalize": i4.BbLocalize }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
427
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbFormError, decorators: [{
428
+ type: Component,
429
+ args: [{ selector: 'bb-form-error', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
430
+ 'class': 'bb-form-error'
431
+ }, preserveWhitespaces: false, template: "<ng-container *ngIf=\"error$ | async as error\">\r\n <p *ngIf=\"error?.token | bbLocalize:{optional: true, data: error?.data} as message\"\r\n class=\"bb-form-error-message\">\r\n {{ message }}\r\n </p>\r\n</ng-container>", styles: [".bb-form-error{display:block}.bb-form-error-message{color:#c23934;display:block;font-size:13px;margin-top:4px}\n"] }]
432
+ }], ctorParameters: function () {
433
+ return [{ type: BbFormSubmit, decorators: [{
434
+ type: Optional
435
+ }] }, { type: i5.NgControl, decorators: [{
436
+ type: Optional
437
+ }] }, { type: undefined, decorators: [{
438
+ type: Optional
439
+ }, {
440
+ type: Inject,
441
+ args: [ELEMENTS_ERRORS]
442
+ }] }];
443
+ }, propDecorators: { control: [{
444
+ type: Input
445
+ }], errorChange: [{
446
+ type: Output
447
447
  }] } });
448
448
 
449
- class BbTemplate {
450
- constructor(_templateRef, _viewContainerRef) {
451
- this._templateRef = _templateRef;
452
- this._viewContainerRef = _viewContainerRef;
453
- }
454
- set bbTemplate(content) {
455
- // Get the template.
456
- const template = content instanceof TemplateRef
457
- ? content
458
- : this._templateRef;
459
- // Clear the view container ref and create the view.
460
- this._viewContainerRef.clear();
461
- this._viewContainerRef.createEmbeddedView(template);
462
- }
463
- }
464
- BbTemplate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbTemplate, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
465
- BbTemplate.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.0", type: BbTemplate, selector: "[bbTemplate]", inputs: { bbTemplate: "bbTemplate" }, ngImport: i0 });
466
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbTemplate, decorators: [{
467
- type: Directive,
468
- args: [{
469
- selector: '[bbTemplate]'
470
- }]
471
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { bbTemplate: [{
472
- type: Input
449
+ class BbTemplate {
450
+ constructor(_templateRef, _viewContainerRef) {
451
+ this._templateRef = _templateRef;
452
+ this._viewContainerRef = _viewContainerRef;
453
+ }
454
+ set bbTemplate(content) {
455
+ // Get the template.
456
+ const template = content instanceof TemplateRef
457
+ ? content
458
+ : this._templateRef;
459
+ // Clear the view container ref and create the view.
460
+ this._viewContainerRef.clear();
461
+ this._viewContainerRef.createEmbeddedView(template);
462
+ }
463
+ }
464
+ BbTemplate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbTemplate, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
465
+ BbTemplate.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.6", type: BbTemplate, selector: "[bbTemplate]", inputs: { bbTemplate: "bbTemplate" }, ngImport: i0 });
466
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbTemplate, decorators: [{
467
+ type: Directive,
468
+ args: [{
469
+ selector: '[bbTemplate]'
470
+ }]
471
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { bbTemplate: [{
472
+ type: Input
473
473
  }] } });
474
474
 
475
- let nextUniqueId$2 = 0;
476
- class BbFormControlBase {
477
- }
478
- const BbFormControlMixinBase = mixinDisabled(mixinFocused(mixinReadonly(mixinGrouped(mixinRequired(mixinError(mixinHideErrors(BbFormControlBase)))))));
479
- class BbFormControl extends BbFormControlMixinBase {
480
- constructor() {
481
- super(...arguments);
482
- // Inputs.
483
- this.label = null;
484
- this.hint = null;
485
- // Data.
486
- this.arrow = false;
487
- // Data.
488
- this.labelId = `bb-form-control-${nextUniqueId$2++}`;
489
- }
490
- onErrorChange(error) {
491
- this.error = !!error;
492
- }
493
- }
494
- BbFormControl.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFormControl, deps: null, target: i0.ɵɵFactoryTarget.Component });
495
- BbFormControl.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbFormControl, selector: "bb-form-control", inputs: { grouped: "grouped", hideErrors: "hideErrors", label: "label", hint: "hint" }, host: { properties: { "class.readonly": "readonly", "class.required": "required", "class.disabled": "disabled", "class.focused": "focused", "class.grouped": "grouped", "class.arrow": "arrow", "class.error": "error" }, classAttribute: "bb-form-control" }, queries: [{ propertyName: "ngControl", first: true, predicate: NgControl, descendants: true }], usesInheritance: true, ngImport: i0, template: "<!-- Label of the form control. -->\n<label *ngIf=\"label as labelContent\"\n [attr.for]=\"labelId\"\n class=\"bb-form-control-label\">\n <ng-template [bbTemplate]=\"labelContent\">\n {{ labelContent }}\n </ng-template>\n</label>\n\n<!-- The input with the addons. -->\n<div class=\"bb-form-control-container\">\n <ng-content select=\"[bbPrefix]\"></ng-content>\n <ng-content select=\"[bbInput]\"></ng-content>\n <ng-content select=\"[bbSuffix]\"></ng-content>\n</div>\n\n<!-- The error component. -->\n<bb-form-error *ngIf=\"!hideErrors\"\n [control]=\"ngControl\"\n (errorChange)=\"onErrorChange($event)\">\n</bb-form-error>\n\n<!-- The form control hint. -->\n<p *ngIf=\"hint as hintContent\"\n class=\"bb-form-control-hint\">\n <ng-template [bbTemplate]=\"hintContent\">\n {{ hintContent }}\n </ng-template>\n</p>\n", styles: [".bb-form-control{color:#2d3c4d;display:block}.bb-form-control>.bb-form-control-container>*.bb-prefix,.bb-form-control>.bb-form-control-container>*.bb-suffix{margin:0 8px;color:#b4b4b4;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control.grouped{margin-bottom:20px}.bb-form-control.small{max-width:240px}.bb-form-control.medium{max-width:480px}.bb-form-control.large{max-width:720px}.bb-form-control.required>.bb-form-control-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bb-form-control.disabled>.bb-form-control-container{cursor:default;pointer-events:none;background-color:#cccccca3}.bb-form-control.disabled>.bb-form-control-container>input,.bb-form-control.disabled>.bb-form-control-container>textarea,.bb-form-control.disabled>.bb-form-control-container>select{color:#aaa}.bb-form-control.readonly>.bb-form-control-container{cursor:default;border:1px dotted #bdc4c9}.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container{background-color:#fff;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #007bff33}.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container>input::placeholder,.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container>textarea::placeholder{color:#b4b4b4;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control.error>.bb-form-control-label{color:#c23934}.bb-form-control.error>.bb-form-control-hint{display:none}.bb-form-control.error>.bb-form-control-container{border:1px solid #962b26;background-color:#c2393440!important;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #c2393466!important}.bb-form-control.error>.bb-form-control-container>*.bb-prefix,.bb-form-control.error>.bb-form-control-container>.bb-suffix{color:#c23934}.bb-form-control.error>.bb-form-control-container>input::placeholder,.bb-form-control.error>.bb-form-control-container>textarea::placeholder{color:#c2393466!important}.bb-form-control.arrow>.bb-form-control-container:after{top:0;right:0;bottom:0;width:20px;content:\"\";height:36px;display:flex;min-width:20px;position:absolute;pointer-events:none;background-repeat:no-repeat;background-position:calc(100% - 8px) center;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAGCAYAAAAYLBS/AAAACXBIWXMAAAsSAAALEgHS3X78AAAAWUlEQVQYlY3QsQ2DMAAEwMMTsAkrZInvWY3WXiIjJJtkA1OBRCIRf/nSffFTrXXGE4uxbCXJBw+8R0CStcAg3JKsUI7mDzzBBd3AC4Cp9/4z21o7znl9A9gBAf4fpjLTwkUAAAAASUVORK5CYII=)}.bb-form-control-container{width:100%;display:flex;overflow:hidden;position:relative;border-radius:3px;align-items:center;border:1px solid #b6bbc1;background-color:#fff8ff;transition-duration:.25s;transition-property:background-color,box-shadow;transition-timing-function:cubic-bezier(0,0,.2,1);box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a}.bb-form-control-container>input::placeholder,.bb-form-control-container>textarea::placeholder{color:#d2d2d2;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control-container>input,.bb-form-control-container>textarea,.bb-form-control-container>select{margin:0;width:100%;border:none;color:#3d464d;font-size:16px;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:transparent}.bb-form-control-container>input,.bb-form-control-container>select{height:36px;padding:0 8px}.bb-form-control-container>select{padding-right:28px}.bb-form-control-container>select>::-ms-expand{display:none}.bb-form-control-container>input::-ms-clear,.bb-form-control-container>input::-ms-reveal{width:0;height:0;display:none}.bb-form-control-container>input::-webkit-search-decoration,.bb-form-control-container>input::-webkit-search-cancel-button,.bb-form-control-container>input::-webkit-search-results-button,.bb-form-control-container>input::-webkit-search-results-decoration{display:none}.bb-form-control-container>textarea{resize:none;padding:8px}.bb-form-control-label{color:#000;display:block;position:relative;margin-bottom:4px;transition:color 30ms cubic-bezier(0,0,.2,1)}.bb-form-control-error,.bb-form-control-hint{display:block;font-size:13px;margin-top:4px}.bb-form-control-error{color:#c23934}.bb-form-control-hint{color:#738694}\n"], components: [{ type: BbFormError, selector: "bb-form-error", inputs: ["control"], outputs: ["errorChange"] }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: BbTemplate, selector: "[bbTemplate]", inputs: ["bbTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
496
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFormControl, decorators: [{
497
- type: Component,
498
- args: [{ selector: 'bb-form-control', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
499
- 'class': 'bb-form-control',
500
- '[class.readonly]': 'readonly',
501
- '[class.required]': 'required',
502
- '[class.disabled]': 'disabled',
503
- '[class.focused]': 'focused',
504
- '[class.grouped]': 'grouped',
505
- '[class.arrow]': 'arrow',
506
- '[class.error]': 'error'
507
- }, inputs: ['grouped', 'hideErrors'], preserveWhitespaces: false, template: "<!-- Label of the form control. -->\n<label *ngIf=\"label as labelContent\"\n [attr.for]=\"labelId\"\n class=\"bb-form-control-label\">\n <ng-template [bbTemplate]=\"labelContent\">\n {{ labelContent }}\n </ng-template>\n</label>\n\n<!-- The input with the addons. -->\n<div class=\"bb-form-control-container\">\n <ng-content select=\"[bbPrefix]\"></ng-content>\n <ng-content select=\"[bbInput]\"></ng-content>\n <ng-content select=\"[bbSuffix]\"></ng-content>\n</div>\n\n<!-- The error component. -->\n<bb-form-error *ngIf=\"!hideErrors\"\n [control]=\"ngControl\"\n (errorChange)=\"onErrorChange($event)\">\n</bb-form-error>\n\n<!-- The form control hint. -->\n<p *ngIf=\"hint as hintContent\"\n class=\"bb-form-control-hint\">\n <ng-template [bbTemplate]=\"hintContent\">\n {{ hintContent }}\n </ng-template>\n</p>\n", styles: [".bb-form-control{color:#2d3c4d;display:block}.bb-form-control>.bb-form-control-container>*.bb-prefix,.bb-form-control>.bb-form-control-container>*.bb-suffix{margin:0 8px;color:#b4b4b4;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control.grouped{margin-bottom:20px}.bb-form-control.small{max-width:240px}.bb-form-control.medium{max-width:480px}.bb-form-control.large{max-width:720px}.bb-form-control.required>.bb-form-control-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bb-form-control.disabled>.bb-form-control-container{cursor:default;pointer-events:none;background-color:#cccccca3}.bb-form-control.disabled>.bb-form-control-container>input,.bb-form-control.disabled>.bb-form-control-container>textarea,.bb-form-control.disabled>.bb-form-control-container>select{color:#aaa}.bb-form-control.readonly>.bb-form-control-container{cursor:default;border:1px dotted #bdc4c9}.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container{background-color:#fff;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #007bff33}.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container>input::placeholder,.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container>textarea::placeholder{color:#b4b4b4;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control.error>.bb-form-control-label{color:#c23934}.bb-form-control.error>.bb-form-control-hint{display:none}.bb-form-control.error>.bb-form-control-container{border:1px solid #962b26;background-color:#c2393440!important;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #c2393466!important}.bb-form-control.error>.bb-form-control-container>*.bb-prefix,.bb-form-control.error>.bb-form-control-container>.bb-suffix{color:#c23934}.bb-form-control.error>.bb-form-control-container>input::placeholder,.bb-form-control.error>.bb-form-control-container>textarea::placeholder{color:#c2393466!important}.bb-form-control.arrow>.bb-form-control-container:after{top:0;right:0;bottom:0;width:20px;content:\"\";height:36px;display:flex;min-width:20px;position:absolute;pointer-events:none;background-repeat:no-repeat;background-position:calc(100% - 8px) center;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAGCAYAAAAYLBS/AAAACXBIWXMAAAsSAAALEgHS3X78AAAAWUlEQVQYlY3QsQ2DMAAEwMMTsAkrZInvWY3WXiIjJJtkA1OBRCIRf/nSffFTrXXGE4uxbCXJBw+8R0CStcAg3JKsUI7mDzzBBd3AC4Cp9/4z21o7znl9A9gBAf4fpjLTwkUAAAAASUVORK5CYII=)}.bb-form-control-container{width:100%;display:flex;overflow:hidden;position:relative;border-radius:3px;align-items:center;border:1px solid #b6bbc1;background-color:#fff8ff;transition-duration:.25s;transition-property:background-color,box-shadow;transition-timing-function:cubic-bezier(0,0,.2,1);box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a}.bb-form-control-container>input::placeholder,.bb-form-control-container>textarea::placeholder{color:#d2d2d2;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control-container>input,.bb-form-control-container>textarea,.bb-form-control-container>select{margin:0;width:100%;border:none;color:#3d464d;font-size:16px;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:transparent}.bb-form-control-container>input,.bb-form-control-container>select{height:36px;padding:0 8px}.bb-form-control-container>select{padding-right:28px}.bb-form-control-container>select>::-ms-expand{display:none}.bb-form-control-container>input::-ms-clear,.bb-form-control-container>input::-ms-reveal{width:0;height:0;display:none}.bb-form-control-container>input::-webkit-search-decoration,.bb-form-control-container>input::-webkit-search-cancel-button,.bb-form-control-container>input::-webkit-search-results-button,.bb-form-control-container>input::-webkit-search-results-decoration{display:none}.bb-form-control-container>textarea{resize:none;padding:8px}.bb-form-control-label{color:#000;display:block;position:relative;margin-bottom:4px;transition:color 30ms cubic-bezier(0,0,.2,1)}.bb-form-control-error,.bb-form-control-hint{display:block;font-size:13px;margin-top:4px}.bb-form-control-error{color:#c23934}.bb-form-control-hint{color:#738694}\n"] }]
508
- }], propDecorators: { ngControl: [{
509
- type: ContentChild,
510
- args: [NgControl]
511
- }], label: [{
512
- type: Input
513
- }], hint: [{
514
- type: Input
475
+ let nextUniqueId$2 = 0;
476
+ class BbFormControlBase {
477
+ }
478
+ const BbFormControlMixinBase = mixinDisabled(mixinFocused(mixinReadonly(mixinGrouped(mixinRequired(mixinError(mixinHideErrors(BbFormControlBase)))))));
479
+ class BbFormControl extends BbFormControlMixinBase {
480
+ constructor() {
481
+ super(...arguments);
482
+ // Inputs.
483
+ this.label = null;
484
+ this.hint = null;
485
+ // Data.
486
+ this.arrow = false;
487
+ // Data.
488
+ this.labelId = `bb-form-control-${nextUniqueId$2++}`;
489
+ }
490
+ onErrorChange(error) {
491
+ this.error = !!error;
492
+ }
493
+ }
494
+ BbFormControl.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbFormControl, deps: null, target: i0.ɵɵFactoryTarget.Component });
495
+ BbFormControl.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.6", type: BbFormControl, selector: "bb-form-control", inputs: { grouped: "grouped", hideErrors: "hideErrors", label: "label", hint: "hint" }, host: { properties: { "class.readonly": "readonly", "class.required": "required", "class.disabled": "disabled", "class.focused": "focused", "class.grouped": "grouped", "class.arrow": "arrow", "class.error": "error" }, classAttribute: "bb-form-control" }, queries: [{ propertyName: "ngControl", first: true, predicate: NgControl, descendants: true }], usesInheritance: true, ngImport: i0, template: "<!-- Label of the form control. -->\r\n<label *ngIf=\"label as labelContent\"\r\n [attr.for]=\"labelId\"\r\n class=\"bb-form-control-label\">\r\n <ng-template [bbTemplate]=\"labelContent\">\r\n {{ labelContent }}\r\n </ng-template>\r\n</label>\r\n\r\n<!-- The input with the addons. -->\r\n<div class=\"bb-form-control-container\">\r\n <ng-content select=\"[bbPrefix]\"></ng-content>\r\n <ng-content select=\"[bbInput]\"></ng-content>\r\n <ng-content select=\"[bbSuffix]\"></ng-content>\r\n</div>\r\n\r\n<!-- The error component. -->\r\n<bb-form-error *ngIf=\"!hideErrors\"\r\n [control]=\"ngControl\"\r\n (errorChange)=\"onErrorChange($event)\">\r\n</bb-form-error>\r\n\r\n<!-- The form control hint. -->\r\n<p *ngIf=\"hint as hintContent\"\r\n class=\"bb-form-control-hint\">\r\n <ng-template [bbTemplate]=\"hintContent\">\r\n {{ hintContent }}\r\n </ng-template>\r\n</p>\r\n", styles: [".bb-form-control{color:#2d3c4d;display:block}.bb-form-control>.bb-form-control-container>*.bb-prefix,.bb-form-control>.bb-form-control-container>*.bb-suffix{margin:0 8px;color:#b4b4b4;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control.grouped{margin-bottom:20px}.bb-form-control.small{max-width:240px}.bb-form-control.medium{max-width:480px}.bb-form-control.large{max-width:720px}.bb-form-control.required>.bb-form-control-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bb-form-control.disabled>.bb-form-control-container{cursor:default;pointer-events:none;background-color:#cccccca3}.bb-form-control.disabled>.bb-form-control-container>input,.bb-form-control.disabled>.bb-form-control-container>textarea,.bb-form-control.disabled>.bb-form-control-container>select{color:#aaa}.bb-form-control.readonly>.bb-form-control-container{cursor:default;border:1px dotted #bdc4c9}.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container{background-color:#fff;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #007bff33}.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container>input::placeholder,.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container>textarea::placeholder{color:#b4b4b4;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control.error>.bb-form-control-label{color:#c23934}.bb-form-control.error>.bb-form-control-hint{display:none}.bb-form-control.error>.bb-form-control-container{border:1px solid #962b26;background-color:#c2393440!important;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #c2393466!important}.bb-form-control.error>.bb-form-control-container>*.bb-prefix,.bb-form-control.error>.bb-form-control-container>.bb-suffix{color:#c23934}.bb-form-control.error>.bb-form-control-container>input::placeholder,.bb-form-control.error>.bb-form-control-container>textarea::placeholder{color:#c2393466!important}.bb-form-control.arrow>.bb-form-control-container:after{top:0;right:0;bottom:0;width:20px;content:\"\";height:36px;display:flex;min-width:20px;position:absolute;pointer-events:none;background-repeat:no-repeat;background-position:calc(100% - 8px) center;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAGCAYAAAAYLBS/AAAACXBIWXMAAAsSAAALEgHS3X78AAAAWUlEQVQYlY3QsQ2DMAAEwMMTsAkrZInvWY3WXiIjJJtkA1OBRCIRf/nSffFTrXXGE4uxbCXJBw+8R0CStcAg3JKsUI7mDzzBBd3AC4Cp9/4z21o7znl9A9gBAf4fpjLTwkUAAAAASUVORK5CYII=)}.bb-form-control-container{width:100%;display:flex;overflow:hidden;position:relative;border-radius:3px;align-items:center;border:1px solid #b6bbc1;background-color:#fff8ff;transition-duration:.25s;transition-property:background-color,box-shadow;transition-timing-function:cubic-bezier(0,0,.2,1);box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a}.bb-form-control-container>input::placeholder,.bb-form-control-container>textarea::placeholder{color:#d2d2d2;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control-container>input,.bb-form-control-container>textarea,.bb-form-control-container>select{margin:0;width:100%;border:none;color:#3d464d;font-size:16px;-webkit-appearance:none;appearance:none;background-color:transparent}.bb-form-control-container>input,.bb-form-control-container>select{height:36px;padding:0 8px}.bb-form-control-container>select{padding-right:28px}.bb-form-control-container>select>::-ms-expand{display:none}.bb-form-control-container>input::-ms-clear,.bb-form-control-container>input::-ms-reveal{width:0;height:0;display:none}.bb-form-control-container>input::-webkit-search-decoration,.bb-form-control-container>input::-webkit-search-cancel-button,.bb-form-control-container>input::-webkit-search-results-button,.bb-form-control-container>input::-webkit-search-results-decoration{display:none}.bb-form-control-container>textarea{resize:none;padding:8px}.bb-form-control-label{color:#000;display:block;position:relative;margin-bottom:4px;transition:color 30ms cubic-bezier(0,0,.2,1)}.bb-form-control-error,.bb-form-control-hint{display:block;font-size:13px;margin-top:4px}.bb-form-control-error{color:#c23934}.bb-form-control-hint{color:#738694}\n"], components: [{ type: BbFormError, selector: "bb-form-error", inputs: ["control"], outputs: ["errorChange"] }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: BbTemplate, selector: "[bbTemplate]", inputs: ["bbTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
496
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbFormControl, decorators: [{
497
+ type: Component,
498
+ args: [{ selector: 'bb-form-control', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
499
+ 'class': 'bb-form-control',
500
+ '[class.readonly]': 'readonly',
501
+ '[class.required]': 'required',
502
+ '[class.disabled]': 'disabled',
503
+ '[class.focused]': 'focused',
504
+ '[class.grouped]': 'grouped',
505
+ '[class.arrow]': 'arrow',
506
+ '[class.error]': 'error'
507
+ }, inputs: ['grouped', 'hideErrors'], preserveWhitespaces: false, template: "<!-- Label of the form control. -->\r\n<label *ngIf=\"label as labelContent\"\r\n [attr.for]=\"labelId\"\r\n class=\"bb-form-control-label\">\r\n <ng-template [bbTemplate]=\"labelContent\">\r\n {{ labelContent }}\r\n </ng-template>\r\n</label>\r\n\r\n<!-- The input with the addons. -->\r\n<div class=\"bb-form-control-container\">\r\n <ng-content select=\"[bbPrefix]\"></ng-content>\r\n <ng-content select=\"[bbInput]\"></ng-content>\r\n <ng-content select=\"[bbSuffix]\"></ng-content>\r\n</div>\r\n\r\n<!-- The error component. -->\r\n<bb-form-error *ngIf=\"!hideErrors\"\r\n [control]=\"ngControl\"\r\n (errorChange)=\"onErrorChange($event)\">\r\n</bb-form-error>\r\n\r\n<!-- The form control hint. -->\r\n<p *ngIf=\"hint as hintContent\"\r\n class=\"bb-form-control-hint\">\r\n <ng-template [bbTemplate]=\"hintContent\">\r\n {{ hintContent }}\r\n </ng-template>\r\n</p>\r\n", styles: [".bb-form-control{color:#2d3c4d;display:block}.bb-form-control>.bb-form-control-container>*.bb-prefix,.bb-form-control>.bb-form-control-container>*.bb-suffix{margin:0 8px;color:#b4b4b4;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control.grouped{margin-bottom:20px}.bb-form-control.small{max-width:240px}.bb-form-control.medium{max-width:480px}.bb-form-control.large{max-width:720px}.bb-form-control.required>.bb-form-control-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bb-form-control.disabled>.bb-form-control-container{cursor:default;pointer-events:none;background-color:#cccccca3}.bb-form-control.disabled>.bb-form-control-container>input,.bb-form-control.disabled>.bb-form-control-container>textarea,.bb-form-control.disabled>.bb-form-control-container>select{color:#aaa}.bb-form-control.readonly>.bb-form-control-container{cursor:default;border:1px dotted #bdc4c9}.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container{background-color:#fff;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #007bff33}.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container>input::placeholder,.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container>textarea::placeholder{color:#b4b4b4;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control.error>.bb-form-control-label{color:#c23934}.bb-form-control.error>.bb-form-control-hint{display:none}.bb-form-control.error>.bb-form-control-container{border:1px solid #962b26;background-color:#c2393440!important;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #c2393466!important}.bb-form-control.error>.bb-form-control-container>*.bb-prefix,.bb-form-control.error>.bb-form-control-container>.bb-suffix{color:#c23934}.bb-form-control.error>.bb-form-control-container>input::placeholder,.bb-form-control.error>.bb-form-control-container>textarea::placeholder{color:#c2393466!important}.bb-form-control.arrow>.bb-form-control-container:after{top:0;right:0;bottom:0;width:20px;content:\"\";height:36px;display:flex;min-width:20px;position:absolute;pointer-events:none;background-repeat:no-repeat;background-position:calc(100% - 8px) center;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAGCAYAAAAYLBS/AAAACXBIWXMAAAsSAAALEgHS3X78AAAAWUlEQVQYlY3QsQ2DMAAEwMMTsAkrZInvWY3WXiIjJJtkA1OBRCIRf/nSffFTrXXGE4uxbCXJBw+8R0CStcAg3JKsUI7mDzzBBd3AC4Cp9/4z21o7znl9A9gBAf4fpjLTwkUAAAAASUVORK5CYII=)}.bb-form-control-container{width:100%;display:flex;overflow:hidden;position:relative;border-radius:3px;align-items:center;border:1px solid #b6bbc1;background-color:#fff8ff;transition-duration:.25s;transition-property:background-color,box-shadow;transition-timing-function:cubic-bezier(0,0,.2,1);box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a}.bb-form-control-container>input::placeholder,.bb-form-control-container>textarea::placeholder{color:#d2d2d2;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control-container>input,.bb-form-control-container>textarea,.bb-form-control-container>select{margin:0;width:100%;border:none;color:#3d464d;font-size:16px;-webkit-appearance:none;appearance:none;background-color:transparent}.bb-form-control-container>input,.bb-form-control-container>select{height:36px;padding:0 8px}.bb-form-control-container>select{padding-right:28px}.bb-form-control-container>select>::-ms-expand{display:none}.bb-form-control-container>input::-ms-clear,.bb-form-control-container>input::-ms-reveal{width:0;height:0;display:none}.bb-form-control-container>input::-webkit-search-decoration,.bb-form-control-container>input::-webkit-search-cancel-button,.bb-form-control-container>input::-webkit-search-results-button,.bb-form-control-container>input::-webkit-search-results-decoration{display:none}.bb-form-control-container>textarea{resize:none;padding:8px}.bb-form-control-label{color:#000;display:block;position:relative;margin-bottom:4px;transition:color 30ms cubic-bezier(0,0,.2,1)}.bb-form-control-error,.bb-form-control-hint{display:block;font-size:13px;margin-top:4px}.bb-form-control-error{color:#c23934}.bb-form-control-hint{color:#738694}\n"] }]
508
+ }], propDecorators: { ngControl: [{
509
+ type: ContentChild,
510
+ args: [NgControl]
511
+ }], label: [{
512
+ type: Input
513
+ }], hint: [{
514
+ type: Input
515
515
  }] } });
516
516
 
517
- class BbFileImage {
518
- constructor(_platform, _image, _sanitizer) {
519
- this._platform = _platform;
520
- this._image = _image;
521
- this._sanitizer = _sanitizer;
522
- }
523
- transform(file) {
524
- return __awaiter(this, void 0, void 0, function* () {
525
- // If the file is not a file return.
526
- if (!this._platform.isBrowser || !(file instanceof File)) {
527
- return null;
528
- }
529
- return this._image.fileToImage(file, [
530
- 'image/png',
531
- 'image/jpeg',
532
- 'image/gif',
533
- 'image/svg+xml'
534
- ]).then(image => {
535
- if (!image) {
536
- return null;
537
- }
538
- return {
539
- background: this._sanitizer.bypassSecurityTrustStyle(`url(${image.src})`),
540
- aspectRatio: image.height / image.width
541
- };
542
- }).catch(() => {
543
- return null;
544
- });
545
- });
546
- }
547
- }
548
- BbFileImage.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFileImage, deps: [{ token: i1$1.Platform }, { token: i1$1.ImageConverter }, { token: i2.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
549
- BbFileImage.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFileImage, name: "bbFileImage" });
550
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFileImage, decorators: [{
551
- type: Pipe,
552
- args: [{
553
- name: 'bbFileImage'
554
- }]
517
+ class BbFileImage {
518
+ constructor(_platform, _image, _sanitizer) {
519
+ this._platform = _platform;
520
+ this._image = _image;
521
+ this._sanitizer = _sanitizer;
522
+ }
523
+ transform(file) {
524
+ return __awaiter(this, void 0, void 0, function* () {
525
+ // If the file is not a file return.
526
+ if (!this._platform.isBrowser || !(file instanceof File)) {
527
+ return null;
528
+ }
529
+ return this._image.fileToImage(file, [
530
+ 'image/png',
531
+ 'image/jpeg',
532
+ 'image/gif',
533
+ 'image/svg+xml'
534
+ ]).then(image => {
535
+ if (!image) {
536
+ return null;
537
+ }
538
+ return {
539
+ background: this._sanitizer.bypassSecurityTrustStyle(`url(${image.src})`),
540
+ aspectRatio: image.height / image.width
541
+ };
542
+ }).catch(() => {
543
+ return null;
544
+ });
545
+ });
546
+ }
547
+ }
548
+ BbFileImage.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbFileImage, deps: [{ token: i1$1.Platform }, { token: i1$1.ImageConverter }, { token: i2.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
549
+ BbFileImage.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbFileImage, name: "bbFileImage" });
550
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbFileImage, decorators: [{
551
+ type: Pipe,
552
+ args: [{
553
+ name: 'bbFileImage'
554
+ }]
555
555
  }], ctorParameters: function () { return [{ type: i1$1.Platform }, { type: i1$1.ImageConverter }, { type: i2.DomSanitizer }]; } });
556
556
 
557
- class BbFileSize {
558
- constructor() {
559
- this.format = (value, decimals = 2) => {
560
- if (value === 0) {
561
- return '0 Bytes';
562
- }
563
- const k = 1024;
564
- const dm = decimals < 0 ? 0 : decimals;
565
- const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
566
- const index = Math.floor(Math.log(value) / Math.log(k));
567
- return parseFloat((value / Math.pow(k, index)).toFixed(dm)) + ' ' + sizes[index];
568
- };
569
- }
570
- transform(value) {
571
- return this.format(value);
572
- }
573
- }
574
- BbFileSize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFileSize, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
575
- BbFileSize.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFileSize, name: "bbFileSize" });
576
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFileSize, decorators: [{
577
- type: Pipe,
578
- args: [{
579
- name: 'bbFileSize'
580
- }]
557
+ class BbFileSize {
558
+ constructor() {
559
+ this.format = (value, decimals = 2) => {
560
+ if (value === 0) {
561
+ return '0 Bytes';
562
+ }
563
+ const k = 1024;
564
+ const dm = decimals < 0 ? 0 : decimals;
565
+ const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
566
+ const index = Math.floor(Math.log(value) / Math.log(k));
567
+ return parseFloat((value / Math.pow(k, index)).toFixed(dm)) + ' ' + sizes[index];
568
+ };
569
+ }
570
+ transform(value) {
571
+ return this.format(value);
572
+ }
573
+ }
574
+ BbFileSize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbFileSize, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
575
+ BbFileSize.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbFileSize, name: "bbFileSize" });
576
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbFileSize, decorators: [{
577
+ type: Pipe,
578
+ args: [{
579
+ name: 'bbFileSize'
580
+ }]
581
581
  }] });
582
582
 
583
- let nextUniqueId$1 = 0;
584
- class BbFilePickerBase {
585
- }
586
- const BbFilePickerMixinBase$1 = mixinRequired(mixinDisabled(mixinGrouped(mixinError(mixinHideErrors(BbFilePickerBase)))));
587
- class BbFilePicker extends BbFilePickerMixinBase$1 {
588
- constructor() {
589
- super(...arguments);
590
- // Inputs.
591
- this.label = null;
592
- this.hint = null;
593
- this.accept = null;
594
- this.showImages = true;
595
- this.allowDragging = true;
596
- // State.
597
- this.labelId = `bb-file-picker-${nextUniqueId$1++}`;
598
- this.hovered = false;
599
- this.value$ = new BehaviorSubject({});
600
- this.valueChange = new EventEmitter();
601
- this.onTouchedCallback = () => {
602
- };
603
- this.onChangeCallback = () => {
604
- };
605
- this.saveFile = (files) => {
606
- // Validate the files exist.
607
- if (!files) {
608
- return;
609
- }
610
- // Retrieve the first file.
611
- const file = files[0];
612
- // Validate the first file exists.
613
- if (!file) {
614
- return;
615
- }
616
- // Save the file.
617
- this.value = file;
618
- };
619
- this.getFileListFromEvent = (event) => {
620
- const element = event.target;
621
- if (!element) {
622
- return null;
623
- }
624
- return element.files;
625
- };
626
- this.preventDefault = (event) => {
627
- event.preventDefault();
628
- event.stopPropagation();
629
- };
630
- }
631
- get value() {
632
- const { file } = this.value$.getValue();
633
- return file;
634
- }
635
- set value(value) {
636
- this.value$.next({ file: value });
637
- this.valueChange.emit(value);
638
- }
639
- onDrag(event, isHovered) {
640
- // Validate the input can support drag.
641
- if (!this.allowDragging || this.disabled) {
642
- return;
643
- }
644
- // Prevent the default event action
645
- // and start the hovering.
646
- this.preventDefault(event);
647
- this.hovered = isHovered;
648
- }
649
- onDrop(event) {
650
- // Validate the input can support drag.
651
- if (!this.allowDragging || this.disabled) {
652
- return;
653
- }
654
- // Prevent the default event action
655
- // and stop the hovering.
656
- this.preventDefault(event);
657
- this.hovered = false;
658
- // Save the file.
659
- this.saveFile(event['dataTransfer'].files);
660
- // Run the on change callback.
661
- this.onChangeCallback(this.value);
662
- }
663
- onButtonPressed(file) {
664
- if (file) {
665
- this.value = null;
666
- this.onChangeCallback(this.value);
667
- return;
668
- }
669
- return this.openFilePicker();
670
- }
671
- openFilePicker() {
672
- return this.fileInput
673
- && this.fileInput.nativeElement
674
- && this.fileInput.nativeElement.click
675
- && this.fileInput.nativeElement.click();
676
- }
677
- onFileChange(event) {
678
- // Validate the input is not disabled.
679
- if (this.disabled) {
680
- return;
681
- }
682
- // Extract the file from the event.
683
- const fileList = this.getFileListFromEvent(event);
684
- // Save the file.
685
- this.saveFile(fileList);
686
- // Run the on change callback.
687
- this.onChangeCallback(this.value);
688
- // Clear the file input.
689
- if (this.fileInput && this.fileInput.nativeElement) {
690
- this.fileInput.nativeElement.value = '';
691
- }
692
- }
693
- writeValue(value) {
694
- this.value = value;
695
- }
696
- registerOnChange(method) {
697
- this.onChangeCallback = method;
698
- }
699
- registerOnTouched(method) {
700
- this.onTouchedCallback = method;
701
- }
702
- setDisabledState(isDisabled) {
703
- this.disabled = isDisabled;
704
- }
705
- onErrorChange(error) {
706
- this.error = !!error;
707
- }
708
- validate({ value }) {
709
- if (value === null || value === undefined) {
710
- return null;
711
- }
712
- const regexString = (this.accept || '*')
713
- .replace(/\*/g, '.\*')
714
- .replace(/,/g, '|');
715
- const mimeTypeRegex = new RegExp(regexString);
716
- const isNotValid = (typeof File === 'undefined') || !(value instanceof File) || !mimeTypeRegex.test(value === null || value === void 0 ? void 0 : value.type);
717
- return isNotValid && {
718
- invalidFileType: true
719
- };
720
- }
721
- }
722
- BbFilePicker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFilePicker, deps: null, target: i0.ɵɵFactoryTarget.Component });
723
- BbFilePicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbFilePicker, selector: "bb-file-picker", inputs: { disabled: "disabled", hideErrors: "hideErrors", grouped: "grouped", required: "required", label: "label", hint: "hint", accept: "accept", showImages: "showImages", allowDragging: "allowDragging", value: "value" }, outputs: { valueChange: "valueChange" }, host: { listeners: { "dragover": "onDrag($event,true)", "dragleave": "onDrag($event,false)", "drop": "onDrop($event)" }, properties: { "class.required": "required", "class.disabled": "disabled", "class.grouped": "grouped", "class.hovered": "hovered", "class.error": "error" }, classAttribute: "bb-file-picker" }, providers: [
724
- {
725
- provide: NG_VALUE_ACCESSOR,
726
- useExisting: forwardRef(() => BbFilePicker),
727
- multi: true
728
- },
729
- {
730
- provide: NG_VALIDATORS,
731
- useExisting: BbFilePicker,
732
- multi: true
733
- }
734
- ], queries: [{ propertyName: "extraTemplate", first: true, predicate: ["extra"], descendants: true }], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<!-- The label of the input. -->\n<label *ngIf=\"label as labelContent\"\n [for]=\"labelId\"\n class=\"bb-file-picker-label\">\n <ng-template [bbTemplate]=\"labelContent\">\n {{ labelContent }}\n </ng-template>\n</label>\n\n<!-- The input that can open the file picker. -->\n<input #fileInput\n [accept]=\"accept\"\n [disabled]=\"disabled\"\n (change)=\"onFileChange($event)\"\n class=\"bb-file-picker-input\"\n type=\"file\"\n tabindex=\"-1\">\n\n<div *ngIf=\"value$ | async as data\"\n class=\"bb-file-picker-wrapper\">\n <!-- The button that accepts files. -->\n <div class=\"bb-file-picker-container\">\n <button [class.destructive]=\"!!data?.file\"\n [class.standalone]=\"!allowDragging\"\n [disabled]=\"disabled\"\n [id]=\"labelId\"\n (click)=\"onButtonPressed(data?.file)\"\n type=\"button\"\n class=\"bb-file-picker-button\">\n <ng-container *ngTemplateOutlet=\"data?.file ? closeIcon : uploadIcon\"></ng-container>\n {{ (data?.file ? 'file-picker.remove' : 'file-picker.choose') | bbLocalize }}\n </button>\n <div *ngIf=\"allowDragging\"\n class=\"bb-file-picker-zone\">\n {{ 'file-picker.drop' | bbLocalize }}\n </div>\n </div>\n\n <ng-container *ngIf=\"!!extraTemplate\">\n <ng-container *ngTemplateOutlet=\"extraTemplate; context: {$implicit: data?.file}\"></ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"showImages\">\n <div *ngIf=\"data?.file | bbFileImage | async as image\"\n class=\"bb-file-picker-image-container\">\n <div class=\"bb-file-picker-image-wrapper\">\n <div [@bbFilePickerImageAnimation]=\"true\"\n [style.padding-top.%]=\"image?.aspectRatio * 100\"\n [style.background-image]=\"image?.background\"\n class=\"bb-file-picker-image\">\n </div>\n </div>\n </div>\n </ng-container>\n\n <!-- Extra information of the file. -->\n <div [class.visible]=\"!!data?.file\"\n class=\"bb-file-picker-info\">\n <span *ngIf=\"data?.file?.name as name\">{{ name }}</span>\n <span *ngIf=\"data?.file?.size as size\">{{ size | bbFileSize }}</span>\n </div>\n</div>\n\n<bb-form-error *ngIf=\"!hideErrors\"\n (errorChange)=\"onErrorChange($event)\">\n</bb-form-error>\n\n<!-- The file picker hint. -->\n<p *ngIf=\"hint as hintContent\"\n class=\"bb-file-picker-hint\">\n <ng-template [bbTemplate]=\"hintContent\">\n {{ hintContent }}\n </ng-template>\n</p>\n\n<!-- Upload icon. -->\n<ng-template #uploadIcon>\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n class=\"bb-file-picker-icon\"\n width=\"24\"\n height=\"24\">\n <path fill=\"currentColor\"\n d=\"M2 12.5C2 9.46 4.46 7 7.5 7H18c2.21 0 4 1.79 4 4s-1.79 4-4 4H9.5a2.5 2.5 0 010-5H17v2H9.41c-.55 0-.55 1 0 1H18c1.1 0 2-.9 2-2s-.9-2-2-2H7.5C5.57 9 4 10.57 4 12.5S5.57 16 7.5 16H17v2H7.5C4.46 18 2 15.54 2 12.5z\"></path>\n <path fill=\"none\" d=\"M0 0h24v24H0V0z\"></path>\n </svg>\n</ng-template>\n\n<!-- Close icon. -->\n<ng-template #closeIcon>\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n class=\"bb-file-picker-icon\"\n width=\"24\"\n height=\"24\">\n <path fill=\"currentColor\"\n d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\"></path>\n <path d=\"M0 0h24v24H0z\" fill=\"none\"></path>\n </svg>\n</ng-template>\n", styles: [".bb-file-picker{display:block}.bb-file-picker.disabled>.bb-file-picker-wrapper{cursor:default;background-color:#cccccca3}.bb-file-picker.grouped{margin-bottom:20px}.bb-file-picker.full>.bb-file-picker-wrapper{width:100%}.bb-file-picker:not(.disabled) .bb-file-picker-button{background-color:#fff}.bb-file-picker:not(.disabled):focus>.bb-file-picker-wrapper,.bb-file-picker:not(.disabled).hovered>.bb-file-picker-wrapper{box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #007bff33}.bb-file-picker.required>.bb-file-picker-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bb-file-picker.error>.bb-file-picker-label{color:#c23934}.bb-file-picker.error>.bb-file-picker-hint{display:none}.bb-file-picker.error>.bb-file-picker-wrapper{border:1px solid #962b26;background-color:#c2393440!important;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #c2393466!important}.bb-file-picker.error .bb-file-picker-button{background-color:transparent}.bb-file-picker-wrapper{max-width:100%;-webkit-user-select:none;user-select:none;border-radius:3px;display:inline-flex;flex-direction:column;border:1px solid #b6bbc1;background-color:#fff8ff;transition:box-shadow .2s cubic-bezier(0,0,.2,1);box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a}.bb-file-picker-label{color:#000;display:block;position:relative;margin-bottom:4px}.bb-file-picker-input{opacity:0;z-index:-1;width:.1px;height:.1px;overflow:hidden;position:absolute}.bb-file-picker-container{min-height:38px;display:inline-flex}.bb-file-picker-button{margin:0;z-index:1;border:none;color:#2196f3;line-height:1;cursor:pointer;padding:0 12px;-webkit-appearance:none;-moz-appearance:none;appearance:none;font-weight:500;align-items:center;white-space:nowrap;display:inline-flex;border-top-left-radius:3px;border-bottom-left-radius:3px;border-right:1px solid #b6bbc1;background-color:#ffffff80;transition:box-shadow .2s cubic-bezier(0,0,.2,1)}.bb-file-picker-button:focus{box-shadow:0 0 0 3px #007bff33}.bb-file-picker-button:disabled{cursor:default}.bb-file-picker-button.destructive{color:#f55656}.bb-file-picker-button.standalone{width:100%;border-right:none;border-top-right-radius:3px;border-bottom-right-radius:3px}.bb-file-picker-icon{margin-right:4px}.bb-file-picker-zone{flex:1;color:#848f99;font-size:14px;padding:8px 12px;line-height:18px;align-items:center;display:inline-flex;justify-content:center}.bb-file-picker-info{height:0;color:#848f99;padding:0 12px;overflow:hidden;line-height:36px;align-items:center;display:inline-flex;background-color:#fff8ff;border-top:0 solid #b6bbc1;transition:height .2s cubic-bezier(0,0,.2,1)}.bb-file-picker-info.visible{height:38px;border-top-width:1px}.bb-file-picker-info>span{opacity:.4;max-width:100%;font-size:14px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.bb-file-picker-info>span:first-child{flex:1}.bb-file-picker-info>span:last-child{margin-left:12px}.bb-file-picker-image-container{overflow:hidden;border-top:1px solid #b6bbc1}.bb-file-picker-image-wrapper{width:100%;max-width:40%;margin:20px auto}.bb-file-picker-image{width:100%;display:flex;overflow:hidden;position:relative;border-radius:4px;will-change:opacity;background-size:cover;background-position:center;background-repeat:no-repeat}.bb-file-picker-hint{display:block;color:#738694;font-size:13px;margin-top:4px}\n"], components: [{ type: BbFormError, selector: "bb-form-error", inputs: ["control"], outputs: ["errorChange"] }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: BbTemplate, selector: "[bbTemplate]", inputs: ["bbTemplate"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "async": i1.AsyncPipe, "bbLocalize": i4.BbLocalize, "bbFileImage": BbFileImage, "bbFileSize": BbFileSize }, animations: [
735
- trigger('bbFilePickerImageAnimation', [
736
- transition(':enter', [
737
- style({ opacity: 0 }),
738
- animate('200ms', style({ opacity: 1 }))
739
- ]),
740
- transition(':leave', [
741
- animate('200ms', style({ opacity: 0 }))
742
- ])
743
- ])
744
- ], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
745
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFilePicker, decorators: [{
746
- type: Component,
747
- args: [{ selector: 'bb-file-picker', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
748
- {
749
- provide: NG_VALUE_ACCESSOR,
750
- useExisting: forwardRef(() => BbFilePicker),
751
- multi: true
752
- },
753
- {
754
- provide: NG_VALIDATORS,
755
- useExisting: BbFilePicker,
756
- multi: true
757
- }
758
- ], host: {
759
- 'class': 'bb-file-picker',
760
- '[class.required]': 'required',
761
- '[class.disabled]': 'disabled',
762
- '[class.grouped]': 'grouped',
763
- '[class.hovered]': 'hovered',
764
- '[class.error]': 'error'
765
- }, animations: [
766
- trigger('bbFilePickerImageAnimation', [
767
- transition(':enter', [
768
- style({ opacity: 0 }),
769
- animate('200ms', style({ opacity: 1 }))
770
- ]),
771
- transition(':leave', [
772
- animate('200ms', style({ opacity: 0 }))
773
- ])
774
- ])
775
- ], inputs: ['disabled', 'hideErrors', 'grouped', 'required'], preserveWhitespaces: false, template: "<!-- The label of the input. -->\n<label *ngIf=\"label as labelContent\"\n [for]=\"labelId\"\n class=\"bb-file-picker-label\">\n <ng-template [bbTemplate]=\"labelContent\">\n {{ labelContent }}\n </ng-template>\n</label>\n\n<!-- The input that can open the file picker. -->\n<input #fileInput\n [accept]=\"accept\"\n [disabled]=\"disabled\"\n (change)=\"onFileChange($event)\"\n class=\"bb-file-picker-input\"\n type=\"file\"\n tabindex=\"-1\">\n\n<div *ngIf=\"value$ | async as data\"\n class=\"bb-file-picker-wrapper\">\n <!-- The button that accepts files. -->\n <div class=\"bb-file-picker-container\">\n <button [class.destructive]=\"!!data?.file\"\n [class.standalone]=\"!allowDragging\"\n [disabled]=\"disabled\"\n [id]=\"labelId\"\n (click)=\"onButtonPressed(data?.file)\"\n type=\"button\"\n class=\"bb-file-picker-button\">\n <ng-container *ngTemplateOutlet=\"data?.file ? closeIcon : uploadIcon\"></ng-container>\n {{ (data?.file ? 'file-picker.remove' : 'file-picker.choose') | bbLocalize }}\n </button>\n <div *ngIf=\"allowDragging\"\n class=\"bb-file-picker-zone\">\n {{ 'file-picker.drop' | bbLocalize }}\n </div>\n </div>\n\n <ng-container *ngIf=\"!!extraTemplate\">\n <ng-container *ngTemplateOutlet=\"extraTemplate; context: {$implicit: data?.file}\"></ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"showImages\">\n <div *ngIf=\"data?.file | bbFileImage | async as image\"\n class=\"bb-file-picker-image-container\">\n <div class=\"bb-file-picker-image-wrapper\">\n <div [@bbFilePickerImageAnimation]=\"true\"\n [style.padding-top.%]=\"image?.aspectRatio * 100\"\n [style.background-image]=\"image?.background\"\n class=\"bb-file-picker-image\">\n </div>\n </div>\n </div>\n </ng-container>\n\n <!-- Extra information of the file. -->\n <div [class.visible]=\"!!data?.file\"\n class=\"bb-file-picker-info\">\n <span *ngIf=\"data?.file?.name as name\">{{ name }}</span>\n <span *ngIf=\"data?.file?.size as size\">{{ size | bbFileSize }}</span>\n </div>\n</div>\n\n<bb-form-error *ngIf=\"!hideErrors\"\n (errorChange)=\"onErrorChange($event)\">\n</bb-form-error>\n\n<!-- The file picker hint. -->\n<p *ngIf=\"hint as hintContent\"\n class=\"bb-file-picker-hint\">\n <ng-template [bbTemplate]=\"hintContent\">\n {{ hintContent }}\n </ng-template>\n</p>\n\n<!-- Upload icon. -->\n<ng-template #uploadIcon>\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n class=\"bb-file-picker-icon\"\n width=\"24\"\n height=\"24\">\n <path fill=\"currentColor\"\n d=\"M2 12.5C2 9.46 4.46 7 7.5 7H18c2.21 0 4 1.79 4 4s-1.79 4-4 4H9.5a2.5 2.5 0 010-5H17v2H9.41c-.55 0-.55 1 0 1H18c1.1 0 2-.9 2-2s-.9-2-2-2H7.5C5.57 9 4 10.57 4 12.5S5.57 16 7.5 16H17v2H7.5C4.46 18 2 15.54 2 12.5z\"></path>\n <path fill=\"none\" d=\"M0 0h24v24H0V0z\"></path>\n </svg>\n</ng-template>\n\n<!-- Close icon. -->\n<ng-template #closeIcon>\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n class=\"bb-file-picker-icon\"\n width=\"24\"\n height=\"24\">\n <path fill=\"currentColor\"\n d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\"></path>\n <path d=\"M0 0h24v24H0z\" fill=\"none\"></path>\n </svg>\n</ng-template>\n", styles: [".bb-file-picker{display:block}.bb-file-picker.disabled>.bb-file-picker-wrapper{cursor:default;background-color:#cccccca3}.bb-file-picker.grouped{margin-bottom:20px}.bb-file-picker.full>.bb-file-picker-wrapper{width:100%}.bb-file-picker:not(.disabled) .bb-file-picker-button{background-color:#fff}.bb-file-picker:not(.disabled):focus>.bb-file-picker-wrapper,.bb-file-picker:not(.disabled).hovered>.bb-file-picker-wrapper{box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #007bff33}.bb-file-picker.required>.bb-file-picker-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bb-file-picker.error>.bb-file-picker-label{color:#c23934}.bb-file-picker.error>.bb-file-picker-hint{display:none}.bb-file-picker.error>.bb-file-picker-wrapper{border:1px solid #962b26;background-color:#c2393440!important;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #c2393466!important}.bb-file-picker.error .bb-file-picker-button{background-color:transparent}.bb-file-picker-wrapper{max-width:100%;-webkit-user-select:none;user-select:none;border-radius:3px;display:inline-flex;flex-direction:column;border:1px solid #b6bbc1;background-color:#fff8ff;transition:box-shadow .2s cubic-bezier(0,0,.2,1);box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a}.bb-file-picker-label{color:#000;display:block;position:relative;margin-bottom:4px}.bb-file-picker-input{opacity:0;z-index:-1;width:.1px;height:.1px;overflow:hidden;position:absolute}.bb-file-picker-container{min-height:38px;display:inline-flex}.bb-file-picker-button{margin:0;z-index:1;border:none;color:#2196f3;line-height:1;cursor:pointer;padding:0 12px;-webkit-appearance:none;-moz-appearance:none;appearance:none;font-weight:500;align-items:center;white-space:nowrap;display:inline-flex;border-top-left-radius:3px;border-bottom-left-radius:3px;border-right:1px solid #b6bbc1;background-color:#ffffff80;transition:box-shadow .2s cubic-bezier(0,0,.2,1)}.bb-file-picker-button:focus{box-shadow:0 0 0 3px #007bff33}.bb-file-picker-button:disabled{cursor:default}.bb-file-picker-button.destructive{color:#f55656}.bb-file-picker-button.standalone{width:100%;border-right:none;border-top-right-radius:3px;border-bottom-right-radius:3px}.bb-file-picker-icon{margin-right:4px}.bb-file-picker-zone{flex:1;color:#848f99;font-size:14px;padding:8px 12px;line-height:18px;align-items:center;display:inline-flex;justify-content:center}.bb-file-picker-info{height:0;color:#848f99;padding:0 12px;overflow:hidden;line-height:36px;align-items:center;display:inline-flex;background-color:#fff8ff;border-top:0 solid #b6bbc1;transition:height .2s cubic-bezier(0,0,.2,1)}.bb-file-picker-info.visible{height:38px;border-top-width:1px}.bb-file-picker-info>span{opacity:.4;max-width:100%;font-size:14px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.bb-file-picker-info>span:first-child{flex:1}.bb-file-picker-info>span:last-child{margin-left:12px}.bb-file-picker-image-container{overflow:hidden;border-top:1px solid #b6bbc1}.bb-file-picker-image-wrapper{width:100%;max-width:40%;margin:20px auto}.bb-file-picker-image{width:100%;display:flex;overflow:hidden;position:relative;border-radius:4px;will-change:opacity;background-size:cover;background-position:center;background-repeat:no-repeat}.bb-file-picker-hint{display:block;color:#738694;font-size:13px;margin-top:4px}\n"] }]
776
- }], propDecorators: { fileInput: [{
777
- type: ViewChild,
778
- args: ['fileInput', { static: true }]
779
- }], extraTemplate: [{
780
- type: ContentChild,
781
- args: ['extra']
782
- }], label: [{
783
- type: Input
784
- }], hint: [{
785
- type: Input
786
- }], accept: [{
787
- type: Input
788
- }], showImages: [{
789
- type: Input
790
- }], allowDragging: [{
791
- type: Input
792
- }], value: [{
793
- type: Input
794
- }], valueChange: [{
795
- type: Output
796
- }], onDrag: [{
797
- type: HostListener,
798
- args: ['dragover', ['$event', 'true']]
799
- }, {
800
- type: HostListener,
801
- args: ['dragleave', ['$event', 'false']]
802
- }], onDrop: [{
803
- type: HostListener,
804
- args: ['drop', ['$event']]
583
+ let nextUniqueId$1 = 0;
584
+ class BbFilePickerBase {
585
+ }
586
+ const BbFilePickerMixinBase$1 = mixinRequired(mixinDisabled(mixinGrouped(mixinError(mixinHideErrors(BbFilePickerBase)))));
587
+ class BbFilePicker extends BbFilePickerMixinBase$1 {
588
+ constructor() {
589
+ super(...arguments);
590
+ // Inputs.
591
+ this.label = null;
592
+ this.hint = null;
593
+ this.accept = null;
594
+ this.showImages = true;
595
+ this.allowDragging = true;
596
+ // State.
597
+ this.labelId = `bb-file-picker-${nextUniqueId$1++}`;
598
+ this.hovered = false;
599
+ this.value$ = new BehaviorSubject({});
600
+ this.valueChange = new EventEmitter();
601
+ this.onTouchedCallback = () => {
602
+ };
603
+ this.onChangeCallback = () => {
604
+ };
605
+ this.saveFile = (files) => {
606
+ // Validate the files exist.
607
+ if (!files) {
608
+ return;
609
+ }
610
+ // Retrieve the first file.
611
+ const file = files[0];
612
+ // Validate the first file exists.
613
+ if (!file) {
614
+ return;
615
+ }
616
+ // Save the file.
617
+ this.value = file;
618
+ };
619
+ this.getFileListFromEvent = (event) => {
620
+ const element = event.target;
621
+ if (!element) {
622
+ return null;
623
+ }
624
+ return element.files;
625
+ };
626
+ this.preventDefault = (event) => {
627
+ event.preventDefault();
628
+ event.stopPropagation();
629
+ };
630
+ }
631
+ get value() {
632
+ const { file } = this.value$.getValue();
633
+ return file;
634
+ }
635
+ set value(value) {
636
+ this.value$.next({ file: value });
637
+ this.valueChange.emit(value);
638
+ }
639
+ onDrag(event, isHovered) {
640
+ // Validate the input can support drag.
641
+ if (!this.allowDragging || this.disabled) {
642
+ return;
643
+ }
644
+ // Prevent the default event action
645
+ // and start the hovering.
646
+ this.preventDefault(event);
647
+ this.hovered = isHovered;
648
+ }
649
+ onDrop(event) {
650
+ // Validate the input can support drag.
651
+ if (!this.allowDragging || this.disabled) {
652
+ return;
653
+ }
654
+ // Prevent the default event action
655
+ // and stop the hovering.
656
+ this.preventDefault(event);
657
+ this.hovered = false;
658
+ // Save the file.
659
+ this.saveFile(event['dataTransfer'].files);
660
+ // Run the on change callback.
661
+ this.onChangeCallback(this.value);
662
+ }
663
+ onButtonPressed(file) {
664
+ if (file) {
665
+ this.value = null;
666
+ this.onChangeCallback(this.value);
667
+ return;
668
+ }
669
+ return this.openFilePicker();
670
+ }
671
+ openFilePicker() {
672
+ return this.fileInput
673
+ && this.fileInput.nativeElement
674
+ && this.fileInput.nativeElement.click
675
+ && this.fileInput.nativeElement.click();
676
+ }
677
+ onFileChange(event) {
678
+ // Validate the input is not disabled.
679
+ if (this.disabled) {
680
+ return;
681
+ }
682
+ // Extract the file from the event.
683
+ const fileList = this.getFileListFromEvent(event);
684
+ // Save the file.
685
+ this.saveFile(fileList);
686
+ // Run the on change callback.
687
+ this.onChangeCallback(this.value);
688
+ // Clear the file input.
689
+ if (this.fileInput && this.fileInput.nativeElement) {
690
+ this.fileInput.nativeElement.value = '';
691
+ }
692
+ }
693
+ writeValue(value) {
694
+ this.value = value;
695
+ }
696
+ registerOnChange(method) {
697
+ this.onChangeCallback = method;
698
+ }
699
+ registerOnTouched(method) {
700
+ this.onTouchedCallback = method;
701
+ }
702
+ setDisabledState(isDisabled) {
703
+ this.disabled = isDisabled;
704
+ }
705
+ onErrorChange(error) {
706
+ this.error = !!error;
707
+ }
708
+ validate({ value }) {
709
+ if (value === null || value === undefined) {
710
+ return null;
711
+ }
712
+ const regexString = (this.accept || '*')
713
+ .replace(/\*/g, '.\*')
714
+ .replace(/,/g, '|');
715
+ const mimeTypeRegex = new RegExp(regexString);
716
+ const isNotValid = (typeof File === 'undefined') || !(value instanceof File) || !mimeTypeRegex.test(value === null || value === void 0 ? void 0 : value.type);
717
+ return isNotValid && {
718
+ invalidFileType: true
719
+ };
720
+ }
721
+ }
722
+ BbFilePicker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbFilePicker, deps: null, target: i0.ɵɵFactoryTarget.Component });
723
+ BbFilePicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.6", type: BbFilePicker, selector: "bb-file-picker", inputs: { disabled: "disabled", hideErrors: "hideErrors", grouped: "grouped", required: "required", label: "label", hint: "hint", accept: "accept", showImages: "showImages", allowDragging: "allowDragging", value: "value" }, outputs: { valueChange: "valueChange" }, host: { listeners: { "dragover": "onDrag($event,true)", "dragleave": "onDrag($event,false)", "drop": "onDrop($event)" }, properties: { "class.required": "required", "class.disabled": "disabled", "class.grouped": "grouped", "class.hovered": "hovered", "class.error": "error" }, classAttribute: "bb-file-picker" }, providers: [
724
+ {
725
+ provide: NG_VALUE_ACCESSOR,
726
+ useExisting: forwardRef(() => BbFilePicker),
727
+ multi: true
728
+ },
729
+ {
730
+ provide: NG_VALIDATORS,
731
+ useExisting: BbFilePicker,
732
+ multi: true
733
+ }
734
+ ], queries: [{ propertyName: "extraTemplate", first: true, predicate: ["extra"], descendants: true }], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<!-- The label of the input. -->\r\n<label *ngIf=\"label as labelContent\"\r\n [for]=\"labelId\"\r\n class=\"bb-file-picker-label\">\r\n <ng-template [bbTemplate]=\"labelContent\">\r\n {{ labelContent }}\r\n </ng-template>\r\n</label>\r\n\r\n<!-- The input that can open the file picker. -->\r\n<input #fileInput\r\n [accept]=\"accept\"\r\n [disabled]=\"disabled\"\r\n (change)=\"onFileChange($event)\"\r\n class=\"bb-file-picker-input\"\r\n type=\"file\"\r\n tabindex=\"-1\">\r\n\r\n<div *ngIf=\"value$ | async as data\"\r\n class=\"bb-file-picker-wrapper\">\r\n <!-- The button that accepts files. -->\r\n <div class=\"bb-file-picker-container\">\r\n <button [class.destructive]=\"!!data?.file\"\r\n [class.standalone]=\"!allowDragging\"\r\n [disabled]=\"disabled\"\r\n [id]=\"labelId\"\r\n (click)=\"onButtonPressed(data?.file)\"\r\n type=\"button\"\r\n class=\"bb-file-picker-button\">\r\n <ng-container *ngTemplateOutlet=\"data?.file ? closeIcon : uploadIcon\"></ng-container>\r\n {{ (data?.file ? 'file-picker.remove' : 'file-picker.choose') | bbLocalize }}\r\n </button>\r\n <div *ngIf=\"allowDragging\"\r\n class=\"bb-file-picker-zone\">\r\n {{ 'file-picker.drop' | bbLocalize }}\r\n </div>\r\n </div>\r\n\r\n <ng-container *ngIf=\"!!extraTemplate\">\r\n <ng-container *ngTemplateOutlet=\"extraTemplate; context: {$implicit: data?.file}\"></ng-container>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"showImages\">\r\n <div *ngIf=\"data?.file | bbFileImage | async as image\"\r\n class=\"bb-file-picker-image-container\">\r\n <div class=\"bb-file-picker-image-wrapper\">\r\n <div [@bbFilePickerImageAnimation]=\"true\"\r\n [style.padding-top.%]=\"image?.aspectRatio * 100\"\r\n [style.background-image]=\"image?.background\"\r\n class=\"bb-file-picker-image\">\r\n </div>\r\n </div>\r\n </div>\r\n </ng-container>\r\n\r\n <!-- Extra information of the file. -->\r\n <div [class.visible]=\"!!data?.file\"\r\n class=\"bb-file-picker-info\">\r\n <span *ngIf=\"data?.file?.name as name\">{{ name }}</span>\r\n <span *ngIf=\"data?.file?.size as size\">{{ size | bbFileSize }}</span>\r\n </div>\r\n</div>\r\n\r\n<bb-form-error *ngIf=\"!hideErrors\"\r\n (errorChange)=\"onErrorChange($event)\">\r\n</bb-form-error>\r\n\r\n<!-- The file picker hint. -->\r\n<p *ngIf=\"hint as hintContent\"\r\n class=\"bb-file-picker-hint\">\r\n <ng-template [bbTemplate]=\"hintContent\">\r\n {{ hintContent }}\r\n </ng-template>\r\n</p>\r\n\r\n<!-- Upload icon. -->\r\n<ng-template #uploadIcon>\r\n <svg xmlns=\"http://www.w3.org/2000/svg\"\r\n class=\"bb-file-picker-icon\"\r\n width=\"24\"\r\n height=\"24\">\r\n <path fill=\"currentColor\"\r\n d=\"M2 12.5C2 9.46 4.46 7 7.5 7H18c2.21 0 4 1.79 4 4s-1.79 4-4 4H9.5a2.5 2.5 0 010-5H17v2H9.41c-.55 0-.55 1 0 1H18c1.1 0 2-.9 2-2s-.9-2-2-2H7.5C5.57 9 4 10.57 4 12.5S5.57 16 7.5 16H17v2H7.5C4.46 18 2 15.54 2 12.5z\"></path>\r\n <path fill=\"none\" d=\"M0 0h24v24H0V0z\"></path>\r\n </svg>\r\n</ng-template>\r\n\r\n<!-- Close icon. -->\r\n<ng-template #closeIcon>\r\n <svg xmlns=\"http://www.w3.org/2000/svg\"\r\n class=\"bb-file-picker-icon\"\r\n width=\"24\"\r\n height=\"24\">\r\n <path fill=\"currentColor\"\r\n d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\"></path>\r\n <path d=\"M0 0h24v24H0z\" fill=\"none\"></path>\r\n </svg>\r\n</ng-template>\r\n", styles: [".bb-file-picker{display:block}.bb-file-picker.disabled>.bb-file-picker-wrapper{cursor:default;background-color:#cccccca3}.bb-file-picker.grouped{margin-bottom:20px}.bb-file-picker.full>.bb-file-picker-wrapper{width:100%}.bb-file-picker:not(.disabled) .bb-file-picker-button{background-color:#fff}.bb-file-picker:not(.disabled):focus>.bb-file-picker-wrapper,.bb-file-picker:not(.disabled).hovered>.bb-file-picker-wrapper{box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #007bff33}.bb-file-picker.required>.bb-file-picker-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bb-file-picker.error>.bb-file-picker-label{color:#c23934}.bb-file-picker.error>.bb-file-picker-hint{display:none}.bb-file-picker.error>.bb-file-picker-wrapper{border:1px solid #962b26;background-color:#c2393440!important;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #c2393466!important}.bb-file-picker.error .bb-file-picker-button{background-color:transparent}.bb-file-picker-wrapper{max-width:100%;-webkit-user-select:none;user-select:none;border-radius:3px;display:inline-flex;flex-direction:column;border:1px solid #b6bbc1;background-color:#fff8ff;transition:box-shadow .2s cubic-bezier(0,0,.2,1);box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a}.bb-file-picker-label{color:#000;display:block;position:relative;margin-bottom:4px}.bb-file-picker-input{opacity:0;z-index:-1;width:.1px;height:.1px;overflow:hidden;position:absolute}.bb-file-picker-container{min-height:38px;display:inline-flex}.bb-file-picker-button{margin:0;z-index:1;border:none;color:#2196f3;line-height:1;cursor:pointer;padding:0 12px;-webkit-appearance:none;appearance:none;font-weight:500;align-items:center;white-space:nowrap;display:inline-flex;border-top-left-radius:3px;border-bottom-left-radius:3px;border-right:1px solid #b6bbc1;background-color:#ffffff80;transition:box-shadow .2s cubic-bezier(0,0,.2,1)}.bb-file-picker-button:focus{box-shadow:0 0 0 3px #007bff33}.bb-file-picker-button:disabled{cursor:default}.bb-file-picker-button.destructive{color:#f55656}.bb-file-picker-button.standalone{width:100%;border-right:none;border-top-right-radius:3px;border-bottom-right-radius:3px}.bb-file-picker-icon{margin-right:4px}.bb-file-picker-zone{flex:1;color:#848f99;font-size:14px;padding:8px 12px;line-height:18px;align-items:center;display:inline-flex;justify-content:center}.bb-file-picker-info{height:0;color:#848f99;padding:0 12px;overflow:hidden;line-height:36px;align-items:center;display:inline-flex;background-color:#fff8ff;border-top:0 solid #b6bbc1;transition:height .2s cubic-bezier(0,0,.2,1)}.bb-file-picker-info.visible{height:38px;border-top-width:1px}.bb-file-picker-info>span{opacity:.4;max-width:100%;font-size:14px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.bb-file-picker-info>span:first-child{flex:1}.bb-file-picker-info>span:last-child{margin-left:12px}.bb-file-picker-image-container{overflow:hidden;border-top:1px solid #b6bbc1}.bb-file-picker-image-wrapper{width:100%;max-width:40%;margin:20px auto}.bb-file-picker-image{width:100%;display:flex;overflow:hidden;position:relative;border-radius:4px;will-change:opacity;background-size:cover;background-position:center;background-repeat:no-repeat}.bb-file-picker-hint{display:block;color:#738694;font-size:13px;margin-top:4px}\n"], components: [{ type: BbFormError, selector: "bb-form-error", inputs: ["control"], outputs: ["errorChange"] }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: BbTemplate, selector: "[bbTemplate]", inputs: ["bbTemplate"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "async": i1.AsyncPipe, "bbLocalize": i4.BbLocalize, "bbFileImage": BbFileImage, "bbFileSize": BbFileSize }, animations: [
735
+ trigger('bbFilePickerImageAnimation', [
736
+ transition(':enter', [
737
+ style({ opacity: 0 }),
738
+ animate('200ms', style({ opacity: 1 }))
739
+ ]),
740
+ transition(':leave', [
741
+ animate('200ms', style({ opacity: 0 }))
742
+ ])
743
+ ])
744
+ ], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
745
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbFilePicker, decorators: [{
746
+ type: Component,
747
+ args: [{ selector: 'bb-file-picker', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
748
+ {
749
+ provide: NG_VALUE_ACCESSOR,
750
+ useExisting: forwardRef(() => BbFilePicker),
751
+ multi: true
752
+ },
753
+ {
754
+ provide: NG_VALIDATORS,
755
+ useExisting: BbFilePicker,
756
+ multi: true
757
+ }
758
+ ], host: {
759
+ 'class': 'bb-file-picker',
760
+ '[class.required]': 'required',
761
+ '[class.disabled]': 'disabled',
762
+ '[class.grouped]': 'grouped',
763
+ '[class.hovered]': 'hovered',
764
+ '[class.error]': 'error'
765
+ }, animations: [
766
+ trigger('bbFilePickerImageAnimation', [
767
+ transition(':enter', [
768
+ style({ opacity: 0 }),
769
+ animate('200ms', style({ opacity: 1 }))
770
+ ]),
771
+ transition(':leave', [
772
+ animate('200ms', style({ opacity: 0 }))
773
+ ])
774
+ ])
775
+ ], inputs: ['disabled', 'hideErrors', 'grouped', 'required'], preserveWhitespaces: false, template: "<!-- The label of the input. -->\r\n<label *ngIf=\"label as labelContent\"\r\n [for]=\"labelId\"\r\n class=\"bb-file-picker-label\">\r\n <ng-template [bbTemplate]=\"labelContent\">\r\n {{ labelContent }}\r\n </ng-template>\r\n</label>\r\n\r\n<!-- The input that can open the file picker. -->\r\n<input #fileInput\r\n [accept]=\"accept\"\r\n [disabled]=\"disabled\"\r\n (change)=\"onFileChange($event)\"\r\n class=\"bb-file-picker-input\"\r\n type=\"file\"\r\n tabindex=\"-1\">\r\n\r\n<div *ngIf=\"value$ | async as data\"\r\n class=\"bb-file-picker-wrapper\">\r\n <!-- The button that accepts files. -->\r\n <div class=\"bb-file-picker-container\">\r\n <button [class.destructive]=\"!!data?.file\"\r\n [class.standalone]=\"!allowDragging\"\r\n [disabled]=\"disabled\"\r\n [id]=\"labelId\"\r\n (click)=\"onButtonPressed(data?.file)\"\r\n type=\"button\"\r\n class=\"bb-file-picker-button\">\r\n <ng-container *ngTemplateOutlet=\"data?.file ? closeIcon : uploadIcon\"></ng-container>\r\n {{ (data?.file ? 'file-picker.remove' : 'file-picker.choose') | bbLocalize }}\r\n </button>\r\n <div *ngIf=\"allowDragging\"\r\n class=\"bb-file-picker-zone\">\r\n {{ 'file-picker.drop' | bbLocalize }}\r\n </div>\r\n </div>\r\n\r\n <ng-container *ngIf=\"!!extraTemplate\">\r\n <ng-container *ngTemplateOutlet=\"extraTemplate; context: {$implicit: data?.file}\"></ng-container>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"showImages\">\r\n <div *ngIf=\"data?.file | bbFileImage | async as image\"\r\n class=\"bb-file-picker-image-container\">\r\n <div class=\"bb-file-picker-image-wrapper\">\r\n <div [@bbFilePickerImageAnimation]=\"true\"\r\n [style.padding-top.%]=\"image?.aspectRatio * 100\"\r\n [style.background-image]=\"image?.background\"\r\n class=\"bb-file-picker-image\">\r\n </div>\r\n </div>\r\n </div>\r\n </ng-container>\r\n\r\n <!-- Extra information of the file. -->\r\n <div [class.visible]=\"!!data?.file\"\r\n class=\"bb-file-picker-info\">\r\n <span *ngIf=\"data?.file?.name as name\">{{ name }}</span>\r\n <span *ngIf=\"data?.file?.size as size\">{{ size | bbFileSize }}</span>\r\n </div>\r\n</div>\r\n\r\n<bb-form-error *ngIf=\"!hideErrors\"\r\n (errorChange)=\"onErrorChange($event)\">\r\n</bb-form-error>\r\n\r\n<!-- The file picker hint. -->\r\n<p *ngIf=\"hint as hintContent\"\r\n class=\"bb-file-picker-hint\">\r\n <ng-template [bbTemplate]=\"hintContent\">\r\n {{ hintContent }}\r\n </ng-template>\r\n</p>\r\n\r\n<!-- Upload icon. -->\r\n<ng-template #uploadIcon>\r\n <svg xmlns=\"http://www.w3.org/2000/svg\"\r\n class=\"bb-file-picker-icon\"\r\n width=\"24\"\r\n height=\"24\">\r\n <path fill=\"currentColor\"\r\n d=\"M2 12.5C2 9.46 4.46 7 7.5 7H18c2.21 0 4 1.79 4 4s-1.79 4-4 4H9.5a2.5 2.5 0 010-5H17v2H9.41c-.55 0-.55 1 0 1H18c1.1 0 2-.9 2-2s-.9-2-2-2H7.5C5.57 9 4 10.57 4 12.5S5.57 16 7.5 16H17v2H7.5C4.46 18 2 15.54 2 12.5z\"></path>\r\n <path fill=\"none\" d=\"M0 0h24v24H0V0z\"></path>\r\n </svg>\r\n</ng-template>\r\n\r\n<!-- Close icon. -->\r\n<ng-template #closeIcon>\r\n <svg xmlns=\"http://www.w3.org/2000/svg\"\r\n class=\"bb-file-picker-icon\"\r\n width=\"24\"\r\n height=\"24\">\r\n <path fill=\"currentColor\"\r\n d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\"></path>\r\n <path d=\"M0 0h24v24H0z\" fill=\"none\"></path>\r\n </svg>\r\n</ng-template>\r\n", styles: [".bb-file-picker{display:block}.bb-file-picker.disabled>.bb-file-picker-wrapper{cursor:default;background-color:#cccccca3}.bb-file-picker.grouped{margin-bottom:20px}.bb-file-picker.full>.bb-file-picker-wrapper{width:100%}.bb-file-picker:not(.disabled) .bb-file-picker-button{background-color:#fff}.bb-file-picker:not(.disabled):focus>.bb-file-picker-wrapper,.bb-file-picker:not(.disabled).hovered>.bb-file-picker-wrapper{box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #007bff33}.bb-file-picker.required>.bb-file-picker-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bb-file-picker.error>.bb-file-picker-label{color:#c23934}.bb-file-picker.error>.bb-file-picker-hint{display:none}.bb-file-picker.error>.bb-file-picker-wrapper{border:1px solid #962b26;background-color:#c2393440!important;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #c2393466!important}.bb-file-picker.error .bb-file-picker-button{background-color:transparent}.bb-file-picker-wrapper{max-width:100%;-webkit-user-select:none;user-select:none;border-radius:3px;display:inline-flex;flex-direction:column;border:1px solid #b6bbc1;background-color:#fff8ff;transition:box-shadow .2s cubic-bezier(0,0,.2,1);box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a}.bb-file-picker-label{color:#000;display:block;position:relative;margin-bottom:4px}.bb-file-picker-input{opacity:0;z-index:-1;width:.1px;height:.1px;overflow:hidden;position:absolute}.bb-file-picker-container{min-height:38px;display:inline-flex}.bb-file-picker-button{margin:0;z-index:1;border:none;color:#2196f3;line-height:1;cursor:pointer;padding:0 12px;-webkit-appearance:none;appearance:none;font-weight:500;align-items:center;white-space:nowrap;display:inline-flex;border-top-left-radius:3px;border-bottom-left-radius:3px;border-right:1px solid #b6bbc1;background-color:#ffffff80;transition:box-shadow .2s cubic-bezier(0,0,.2,1)}.bb-file-picker-button:focus{box-shadow:0 0 0 3px #007bff33}.bb-file-picker-button:disabled{cursor:default}.bb-file-picker-button.destructive{color:#f55656}.bb-file-picker-button.standalone{width:100%;border-right:none;border-top-right-radius:3px;border-bottom-right-radius:3px}.bb-file-picker-icon{margin-right:4px}.bb-file-picker-zone{flex:1;color:#848f99;font-size:14px;padding:8px 12px;line-height:18px;align-items:center;display:inline-flex;justify-content:center}.bb-file-picker-info{height:0;color:#848f99;padding:0 12px;overflow:hidden;line-height:36px;align-items:center;display:inline-flex;background-color:#fff8ff;border-top:0 solid #b6bbc1;transition:height .2s cubic-bezier(0,0,.2,1)}.bb-file-picker-info.visible{height:38px;border-top-width:1px}.bb-file-picker-info>span{opacity:.4;max-width:100%;font-size:14px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.bb-file-picker-info>span:first-child{flex:1}.bb-file-picker-info>span:last-child{margin-left:12px}.bb-file-picker-image-container{overflow:hidden;border-top:1px solid #b6bbc1}.bb-file-picker-image-wrapper{width:100%;max-width:40%;margin:20px auto}.bb-file-picker-image{width:100%;display:flex;overflow:hidden;position:relative;border-radius:4px;will-change:opacity;background-size:cover;background-position:center;background-repeat:no-repeat}.bb-file-picker-hint{display:block;color:#738694;font-size:13px;margin-top:4px}\n"] }]
776
+ }], propDecorators: { fileInput: [{
777
+ type: ViewChild,
778
+ args: ['fileInput', { static: true }]
779
+ }], extraTemplate: [{
780
+ type: ContentChild,
781
+ args: ['extra']
782
+ }], label: [{
783
+ type: Input
784
+ }], hint: [{
785
+ type: Input
786
+ }], accept: [{
787
+ type: Input
788
+ }], showImages: [{
789
+ type: Input
790
+ }], allowDragging: [{
791
+ type: Input
792
+ }], value: [{
793
+ type: Input
794
+ }], valueChange: [{
795
+ type: Output
796
+ }], onDrag: [{
797
+ type: HostListener,
798
+ args: ['dragover', ['$event', 'true']]
799
+ }, {
800
+ type: HostListener,
801
+ args: ['dragleave', ['$event', 'false']]
802
+ }], onDrop: [{
803
+ type: HostListener,
804
+ args: ['drop', ['$event']]
805
805
  }] } });
806
806
 
807
- class BbSelect {
808
- constructor(_elementRef, _ngControl, _formControl) {
809
- this._elementRef = _elementRef;
810
- this._ngControl = _ngControl;
811
- this._formControl = _formControl;
812
- this.hasArrow = true;
813
- this._disabled = false;
814
- this._required = false;
815
- }
816
- ngOnInit() {
817
- // Set an arrow on the form control if
818
- // it requires one.
819
- this._formControl.arrow = this.hasArrow;
820
- }
821
- ngDoCheck() {
822
- if (this._ngControl) {
823
- this.disabled = this._ngControl.disabled;
824
- }
825
- }
826
- ngOnDestroy() {
827
- var _a;
828
- (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
829
- }
830
- focus() {
831
- var _a, _b;
832
- return (_b = (_a = this._elementRef) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.focus();
833
- }
834
- setFocus(hasFocus) {
835
- if (!this._formControl) {
836
- return;
837
- }
838
- this._formControl.focused = hasFocus;
839
- }
840
- get id() {
841
- var _a, _b;
842
- return (_b = (_a = this._formControl) === null || _a === void 0 ? void 0 : _a.labelId) !== null && _b !== void 0 ? _b : null;
843
- }
844
- get disabled() {
845
- if (this._ngControl && this._ngControl.disabled !== null) {
846
- return this._ngControl.disabled;
847
- }
848
- return this._disabled;
849
- }
850
- set disabled(newValue) {
851
- this._disabled = coerceBooleanProperty(newValue);
852
- if (!this._formControl) {
853
- return;
854
- }
855
- this._formControl.disabled = this._disabled;
856
- }
857
- get required() {
858
- return this._required;
859
- }
860
- set required(newValue) {
861
- this._required = coerceBooleanProperty(newValue);
862
- if (!this._formControl) {
863
- return;
864
- }
865
- this._formControl.required = this._required;
866
- }
867
- }
868
- BbSelect.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbSelect, deps: [{ token: i0.ElementRef }, { token: i5.NgControl, optional: true, self: true }, { token: BbFormControl, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
869
- BbSelect.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.0", type: BbSelect, selector: "select[bbInput]", inputs: { disabled: "disabled", required: "required" }, host: { listeners: { "focus": "setFocus(true)", "blur": "setFocus(false)" }, properties: { "disabled": "disabled", "attr.id": "this.id" } }, ngImport: i0 });
870
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbSelect, decorators: [{
871
- type: Directive,
872
- args: [{
873
- selector: 'select[bbInput]',
874
- host: {
875
- '[disabled]': 'disabled',
876
- '(focus)': 'setFocus(true)',
877
- '(blur)': 'setFocus(false)'
878
- }
879
- }]
880
- }], ctorParameters: function () {
881
- return [{ type: i0.ElementRef }, { type: i5.NgControl, decorators: [{
882
- type: Optional
883
- }, {
884
- type: Self
885
- }] }, { type: BbFormControl, decorators: [{
886
- type: Optional
887
- }, {
888
- type: Host
889
- }] }];
890
- }, propDecorators: { id: [{
891
- type: HostBinding,
892
- args: ['attr.id']
893
- }], disabled: [{
894
- type: Input
895
- }], required: [{
896
- type: Input
897
- }] } });
898
- class BbInput extends BbSelect {
899
- constructor(_elementRef, _ngControl, _formControl) {
900
- super(_elementRef, _ngControl, _formControl);
901
- this._elementRef = _elementRef;
902
- this._ngControl = _ngControl;
903
- this._formControl = _formControl;
904
- this.hasArrow = false;
905
- this._readonly = false;
906
- }
907
- get readonly() {
908
- return this._readonly;
909
- }
910
- set readonly(newValue) {
911
- this._readonly = coerceBooleanProperty(newValue);
912
- if (!this._formControl) {
913
- return;
914
- }
915
- this._formControl.readonly = this._readonly;
916
- }
917
- }
918
- BbInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbInput, deps: [{ token: i0.ElementRef }, { token: i5.NgControl, optional: true, self: true }, { token: BbFormControl, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
919
- BbInput.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.0", type: BbInput, selector: "input[bbInput], textarea[bbInput]", inputs: { readonly: "readonly" }, host: { listeners: { "focus": "setFocus(true)", "blur": "setFocus(false)" }, properties: { "disabled": "disabled", "readonly": "readonly" } }, usesInheritance: true, ngImport: i0 });
920
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbInput, decorators: [{
921
- type: Directive,
922
- args: [{
923
- selector: 'input[bbInput], textarea[bbInput]',
924
- host: {
925
- '[disabled]': 'disabled',
926
- '[readonly]': 'readonly',
927
- '(focus)': 'setFocus(true)',
928
- '(blur)': 'setFocus(false)'
929
- }
930
- }]
931
- }], ctorParameters: function () {
932
- return [{ type: i0.ElementRef }, { type: i5.NgControl, decorators: [{
933
- type: Optional
934
- }, {
935
- type: Self
936
- }] }, { type: BbFormControl, decorators: [{
937
- type: Optional
938
- }, {
939
- type: Host
940
- }] }];
941
- }, propDecorators: { readonly: [{
942
- type: Input
807
+ class BbSelect {
808
+ constructor(_elementRef, _ngControl, _formControl) {
809
+ this._elementRef = _elementRef;
810
+ this._ngControl = _ngControl;
811
+ this._formControl = _formControl;
812
+ this.hasArrow = true;
813
+ this._disabled = false;
814
+ this._required = false;
815
+ }
816
+ ngOnInit() {
817
+ // Set an arrow on the form control if
818
+ // it requires one.
819
+ this._formControl.arrow = this.hasArrow;
820
+ }
821
+ ngDoCheck() {
822
+ if (this._ngControl) {
823
+ this.disabled = this._ngControl.disabled;
824
+ }
825
+ }
826
+ ngOnDestroy() {
827
+ var _a;
828
+ (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
829
+ }
830
+ focus() {
831
+ var _a, _b;
832
+ return (_b = (_a = this._elementRef) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.focus();
833
+ }
834
+ setFocus(hasFocus) {
835
+ if (!this._formControl) {
836
+ return;
837
+ }
838
+ this._formControl.focused = hasFocus;
839
+ }
840
+ get id() {
841
+ var _a, _b;
842
+ return (_b = (_a = this._formControl) === null || _a === void 0 ? void 0 : _a.labelId) !== null && _b !== void 0 ? _b : null;
843
+ }
844
+ get disabled() {
845
+ if (this._ngControl && this._ngControl.disabled !== null) {
846
+ return this._ngControl.disabled;
847
+ }
848
+ return this._disabled;
849
+ }
850
+ set disabled(newValue) {
851
+ this._disabled = coerceBooleanProperty(newValue);
852
+ if (!this._formControl) {
853
+ return;
854
+ }
855
+ this._formControl.disabled = this._disabled;
856
+ }
857
+ get required() {
858
+ return this._required;
859
+ }
860
+ set required(newValue) {
861
+ this._required = coerceBooleanProperty(newValue);
862
+ if (!this._formControl) {
863
+ return;
864
+ }
865
+ this._formControl.required = this._required;
866
+ }
867
+ }
868
+ BbSelect.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbSelect, deps: [{ token: i0.ElementRef }, { token: i5.NgControl, optional: true, self: true }, { token: BbFormControl, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
869
+ BbSelect.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.6", type: BbSelect, selector: "select[bbInput]", inputs: { disabled: "disabled", required: "required" }, host: { listeners: { "focus": "setFocus(true)", "blur": "setFocus(false)" }, properties: { "disabled": "disabled", "attr.id": "this.id" } }, ngImport: i0 });
870
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbSelect, decorators: [{
871
+ type: Directive,
872
+ args: [{
873
+ selector: 'select[bbInput]',
874
+ host: {
875
+ '[disabled]': 'disabled',
876
+ '(focus)': 'setFocus(true)',
877
+ '(blur)': 'setFocus(false)'
878
+ }
879
+ }]
880
+ }], ctorParameters: function () {
881
+ return [{ type: i0.ElementRef }, { type: i5.NgControl, decorators: [{
882
+ type: Optional
883
+ }, {
884
+ type: Self
885
+ }] }, { type: BbFormControl, decorators: [{
886
+ type: Optional
887
+ }, {
888
+ type: Host
889
+ }] }];
890
+ }, propDecorators: { id: [{
891
+ type: HostBinding,
892
+ args: ['attr.id']
893
+ }], disabled: [{
894
+ type: Input
895
+ }], required: [{
896
+ type: Input
897
+ }] } });
898
+ class BbInput extends BbSelect {
899
+ constructor(_elementRef, _ngControl, _formControl) {
900
+ super(_elementRef, _ngControl, _formControl);
901
+ this._elementRef = _elementRef;
902
+ this._ngControl = _ngControl;
903
+ this._formControl = _formControl;
904
+ this.hasArrow = false;
905
+ this._readonly = false;
906
+ }
907
+ get readonly() {
908
+ return this._readonly;
909
+ }
910
+ set readonly(newValue) {
911
+ this._readonly = coerceBooleanProperty(newValue);
912
+ if (!this._formControl) {
913
+ return;
914
+ }
915
+ this._formControl.readonly = this._readonly;
916
+ }
917
+ }
918
+ BbInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbInput, deps: [{ token: i0.ElementRef }, { token: i5.NgControl, optional: true, self: true }, { token: BbFormControl, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
919
+ BbInput.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.6", type: BbInput, selector: "input[bbInput], textarea[bbInput]", inputs: { readonly: "readonly" }, host: { listeners: { "focus": "setFocus(true)", "blur": "setFocus(false)" }, properties: { "disabled": "disabled", "readonly": "readonly" } }, usesInheritance: true, ngImport: i0 });
920
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbInput, decorators: [{
921
+ type: Directive,
922
+ args: [{
923
+ selector: 'input[bbInput], textarea[bbInput]',
924
+ host: {
925
+ '[disabled]': 'disabled',
926
+ '[readonly]': 'readonly',
927
+ '(focus)': 'setFocus(true)',
928
+ '(blur)': 'setFocus(false)'
929
+ }
930
+ }]
931
+ }], ctorParameters: function () {
932
+ return [{ type: i0.ElementRef }, { type: i5.NgControl, decorators: [{
933
+ type: Optional
934
+ }, {
935
+ type: Self
936
+ }] }, { type: BbFormControl, decorators: [{
937
+ type: Optional
938
+ }, {
939
+ type: Host
940
+ }] }];
941
+ }, propDecorators: { readonly: [{
942
+ type: Input
943
943
  }] } });
944
944
 
945
- class BbDatePickerBase {
946
- }
947
- const BbFilePickerMixinBase = mixinRequired(mixinReadonly(mixinDisabled(mixinGrouped(mixinError(mixinHideErrors(BbDatePickerBase))))));
948
- class BbDatePicker extends BbFilePickerMixinBase {
949
- constructor(_localeId) {
950
- super();
951
- this._localeId = _localeId;
952
- // Readonly data.
953
- this._yearRegex = /^(10|[1-9][0-9])\d{2}$/; // Note: 1000 - 9999
954
- // Inputs.
955
- this.label = null;
956
- this.hint = null;
957
- this.dayPlaceholder = 'dd';
958
- this.monthPlaceholder = 'mm';
959
- this.yearPlaceholder = 'yyyy';
960
- this.trackByValue = (_, item) => item === null || item === void 0 ? void 0 : item.value;
961
- this.years$ = new BehaviorSubject(null);
962
- this.valueChange = new EventEmitter();
963
- // Subscriptions.
964
- this._subscription = new Subscription();
965
- this.onTouchedCallback = () => {
966
- };
967
- this.onChangeCallback = () => {
968
- };
969
- this.formToDateString = ({ year, month, day }) => {
970
- var _a;
971
- if ((_a = this.form) === null || _a === void 0 ? void 0 : _a.invalid) {
972
- return null;
973
- }
974
- const prefixedMonth = this.padString(`${month}`, 2, '0');
975
- const prefixedDay = this.padString(`${day}`, 2, '0');
976
- return [year, prefixedMonth, prefixedDay].join('-');
977
- };
978
- this.parseYearFormat = (value) => {
979
- var _a, _b, _c, _d, _e, _f;
980
- // Transform the value to a definitive string.
981
- const yearString = `${value}`;
982
- const currentFullYear = new Date().getFullYear();
983
- // Handle default "current" syntax.
984
- if (yearString === 'current') {
985
- return currentFullYear;
986
- }
987
- // Handle "current + {amount}" syntax.
988
- if (/^current\s?\+\s?\d+$/.test(yearString)) {
989
- const amount = (_c = Number((_b = (_a = yearString === null || yearString === void 0 ? void 0 : yearString.split('+')) === null || _a === void 0 ? void 0 : _a[1]) === null || _b === void 0 ? void 0 : _b.trim())) !== null && _c !== void 0 ? _c : 0;
990
- return currentFullYear + amount;
991
- }
992
- // Handle "current - {amount}" syntax.
993
- if (/^current\s?-\s?\d+$/.test(yearString)) {
994
- const amount = (_f = Number((_e = (_d = yearString === null || yearString === void 0 ? void 0 : yearString.split('-')) === null || _d === void 0 ? void 0 : _d[1]) === null || _e === void 0 ? void 0 : _e.trim())) !== null && _f !== void 0 ? _f : 0;
995
- return currentFullYear - amount;
996
- }
997
- // Handling the default number case.
998
- if (/^[0-9]{4}$/.test(yearString)) {
999
- return Number(yearString);
1000
- }
1001
- // We could not parse it.
1002
- return null;
1003
- };
1004
- this.getDaysInMonth = (month = null, year = null) => {
1005
- var _a;
1006
- if (((_a = this.form) === null || _a === void 0 ? void 0 : _a.invalid) || month === null || year === null) {
1007
- return 31;
1008
- }
1009
- const parsedYear = parseInt(year, 10);
1010
- return new Date(parsedYear, month, 0).getDate();
1011
- };
1012
- this.isValidDateString = (value) => {
1013
- return typeof value === 'string' && /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/.test(value);
1014
- };
1015
- this.padString = (value, maxLength, fillString = '0') => {
1016
- const count = maxLength - value.length;
1017
- for (let index = 0; index < count; index++) {
1018
- value = `${fillString}${value}`;
1019
- }
1020
- return value;
1021
- };
1022
- }
1023
- set years(value) {
1024
- this.parseYears(value);
1025
- }
1026
- get value() {
1027
- var _a;
1028
- return this.formToDateString((_a = this.form) === null || _a === void 0 ? void 0 : _a.value);
1029
- }
1030
- set value(value) {
1031
- this.parseDateStringInForm(value);
1032
- this.valueChange.emit(this.value);
1033
- }
1034
- ngOnInit() {
1035
- this.composeForm();
1036
- this.getData();
1037
- this.handleChanges();
1038
- }
1039
- ngOnDestroy() {
1040
- var _a;
1041
- (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
1042
- }
1043
- writeValue(value) {
1044
- this.parseDateStringInForm(value);
1045
- }
1046
- registerOnChange(method) {
1047
- this.onChangeCallback = method;
1048
- }
1049
- registerOnTouched(method) {
1050
- this.onTouchedCallback = method;
1051
- }
1052
- setDisabledState(isDisabled) {
1053
- var _a, _b;
1054
- this.disabled = isDisabled;
1055
- if (this.disabled) {
1056
- (_a = this.form) === null || _a === void 0 ? void 0 : _a.disable();
1057
- }
1058
- else {
1059
- (_b = this.form) === null || _b === void 0 ? void 0 : _b.enable();
1060
- }
1061
- }
1062
- onErrorChange(error) {
1063
- this.error = !!error;
1064
- }
1065
- validate({ value }) {
1066
- if (value === null || value === undefined) {
1067
- return null;
1068
- }
1069
- const data = this.parseDateString(value);
1070
- const date = new Date(data === null || data === void 0 ? void 0 : data.year, (data === null || data === void 0 ? void 0 : data.month) - 1, data === null || data === void 0 ? void 0 : data.day);
1071
- const maxDays = this.getDaysInMonth(data === null || data === void 0 ? void 0 : data.month, `${data === null || data === void 0 ? void 0 : data.year}`);
1072
- const isInvalidDate = date.toString() === 'Invalid Date';
1073
- const exceededMaxDays = (data === null || data === void 0 ? void 0 : data.day) > maxDays;
1074
- return (isInvalidDate || exceededMaxDays) && {
1075
- invalidDate: true
1076
- };
1077
- }
1078
- handleChanges() {
1079
- const dateOrNull$ = this.form.valueChanges.pipe(map(value => this.formToDateString(value)), distinctUntilChanged());
1080
- const subscription = dateOrNull$.subscribe(() => {
1081
- this.valueChange.emit(this.value);
1082
- this.onChangeCallback(this.value);
1083
- });
1084
- this._subscription.add(subscription);
1085
- }
1086
- getData() {
1087
- const years$ = this.years$.asObservable();
1088
- const months$ = this.getMonthData();
1089
- const days$ = this.getDayData();
1090
- this.data$ = combineLatest([years$, months$, days$]).pipe(map(([years, months, days]) => ({ years, months, days })), tap(data => { var _a; return this.verifyListData((_a = data === null || data === void 0 ? void 0 : data.days) === null || _a === void 0 ? void 0 : _a.length, data === null || data === void 0 ? void 0 : data.years); }));
1091
- }
1092
- verifyListData(maxDays, years) {
1093
- const dayControl = this.form.get('day');
1094
- if ((dayControl === null || dayControl === void 0 ? void 0 : dayControl.value) !== null && (dayControl === null || dayControl === void 0 ? void 0 : dayControl.value) > maxDays) {
1095
- dayControl.patchValue(maxDays);
1096
- }
1097
- const yearControl = this.form.get('year');
1098
- if (years !== null && (yearControl === null || yearControl === void 0 ? void 0 : yearControl.value) !== null && this._yearRegex.test(yearControl === null || yearControl === void 0 ? void 0 : yearControl.value)) {
1099
- const selectedYear = Number(yearControl === null || yearControl === void 0 ? void 0 : yearControl.value);
1100
- const firstYear = Math.min(...years);
1101
- const lastYear = Math.max(...years);
1102
- if (selectedYear < firstYear || selectedYear > lastYear) {
1103
- Promise.resolve().then(() => yearControl.patchValue(null));
1104
- }
1105
- }
1106
- }
1107
- getDayData() {
1108
- var _a;
1109
- const count$ = this.form.valueChanges.pipe(startWith((_a = this.form) === null || _a === void 0 ? void 0 : _a.value), map(({ month, year }) => this.getDaysInMonth(month, year)), distinctUntilChanged());
1110
- return count$.pipe(map(count => Array(count).fill(0).map((_, index) => ({
1111
- label: `${index + 1}`,
1112
- value: index + 1
1113
- }))));
1114
- }
1115
- getMonthData() {
1116
- const array = Array(12).fill(0).map((_, month) => {
1117
- const date = new Date(2000, month, 1);
1118
- const label = formatDate(date, 'LLLL', this._localeId);
1119
- return { label, value: month + 1 };
1120
- });
1121
- return of(array);
1122
- }
1123
- composeForm() {
1124
- const { required, pattern, minLength, maxLength } = Validators;
1125
- const yearPattern = pattern(this._yearRegex);
1126
- const yearValidators = [required, yearPattern, minLength(4), maxLength(4)];
1127
- this.form = new FormGroup({
1128
- day: new FormControl(null, required),
1129
- month: new FormControl(null, required),
1130
- year: new FormControl(null, yearValidators)
1131
- });
1132
- }
1133
- parseDateStringInForm(value) {
1134
- var _a, _b;
1135
- // If the date string was not a valid format, reset the form.
1136
- if (!this.isValidDateString(value)) {
1137
- if (value !== null) {
1138
- (_a = this.form) === null || _a === void 0 ? void 0 : _a.reset({ year: null, month: null, day: null }, { emitEvent: false });
1139
- }
1140
- return;
1141
- }
1142
- // Parse the date string and save in the form.
1143
- const data = this.parseDateString(value);
1144
- const year = (data === null || data === void 0 ? void 0 : data.year) !== null && (data === null || data === void 0 ? void 0 : data.year) !== undefined
1145
- ? this.padString(`${data === null || data === void 0 ? void 0 : data.year}`, 4, '0')
1146
- : null;
1147
- const formData = Object.assign(Object.assign({}, (data !== null && data !== void 0 ? data : {})), { year });
1148
- (_b = this.form) === null || _b === void 0 ? void 0 : _b.patchValue(formData, { emitEvent: false });
1149
- }
1150
- parseDateString(value) {
1151
- if (!this.isValidDateString(value)) {
1152
- return null;
1153
- }
1154
- // Parse the date string.
1155
- const [year, month, day] = value === null || value === void 0 ? void 0 : value.split('-');
1156
- return {
1157
- day: day ? parseInt(day, 10) : null,
1158
- month: month ? parseInt(month, 10) : null,
1159
- year: year ? parseInt(year, 10) : null
1160
- };
1161
- }
1162
- parseYears(values) {
1163
- if (!values) {
1164
- return this.years$.next(null);
1165
- }
1166
- // Parse the values to years (in numbers).
1167
- const [first, last] = values;
1168
- const firstYear = this.parseYearFormat(first);
1169
- const lastYear = this.parseYearFormat(last);
1170
- // Check cases in where we cannot parse.
1171
- if (firstYear === null || lastYear === null) {
1172
- return this.years$.next(null);
1173
- }
1174
- const difference = firstYear - lastYear;
1175
- const absoluteDifference = Math.abs(difference) + 1;
1176
- // Create an array with years.
1177
- const years = Array(absoluteDifference)
1178
- .fill(0)
1179
- .map((_, index) => difference < 0 ? (firstYear + index) : (firstYear - index));
1180
- // Validate we have one or more years.
1181
- if ((years === null || years === void 0 ? void 0 : years.length) <= 0) {
1182
- return this.years$.next(null);
1183
- }
1184
- // Push the years.
1185
- return this.years$.next(years);
1186
- }
1187
- }
1188
- BbDatePicker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbDatePicker, deps: [{ token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Component });
1189
- BbDatePicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbDatePicker, selector: "bb-date-picker", inputs: { required: "required", readonly: "readonly", disabled: "disabled", grouped: "grouped", hideErrors: "hideErrors", label: "label", hint: "hint", dayPlaceholder: "dayPlaceholder", monthPlaceholder: "monthPlaceholder", yearPlaceholder: "yearPlaceholder", years: "years", value: "value" }, outputs: { valueChange: "valueChange" }, host: { properties: { "class.required": "required", "class.readonly": "readonly", "class.disabled": "disabled", "class.grouped": "grouped", "class.error": "error" }, classAttribute: "bb-date-picker" }, providers: [
1190
- {
1191
- provide: NG_VALUE_ACCESSOR,
1192
- useExisting: forwardRef(() => BbDatePicker),
1193
- multi: true
1194
- },
1195
- {
1196
- provide: NG_VALIDATORS,
1197
- useExisting: BbDatePicker,
1198
- multi: true
1199
- }
1200
- ], usesInheritance: true, ngImport: i0, template: "<!-- Label of the date picker. -->\n<label *ngIf=\"label as labelContent\"\n class=\"bb-date-picker-label\">\n <ng-template [bbTemplate]=\"labelContent\">\n {{ labelContent }}\n </ng-template>\n</label>\n\n<!-- The form containing the year/month/day fields. -->\n<form *ngIf=\"data$ | async as data\"\n [formGroup]=\"form\"\n class=\"bb-date-picker-container\"\n novalidate>\n <div class=\"bb-date-picker-item\">\n <bb-form-control hideErrors>\n <select [class.has-value]=\"!!form?.get('day')?.value\"\n bbInput\n autocomplete=\"off\"\n formControlName=\"day\">\n <option [ngValue]=\"null\">{{ dayPlaceholder }}</option>\n <option *ngFor=\"let day of data?.days; trackBy: trackByValue\"\n [ngValue]=\"day?.value\">\n {{ day?.label }}\n </option>\n </select>\n </bb-form-control>\n </div>\n <div class=\"bb-date-picker-item\">\n <bb-form-control hideErrors>\n <select [class.has-value]=\"!!form?.get('month')?.value\"\n bbInput\n autocomplete=\"off\"\n formControlName=\"month\">\n <option [ngValue]=\"null\">{{ monthPlaceholder }}</option>\n <option *ngFor=\"let month of data?.months; trackBy: trackByValue\"\n [ngValue]=\"month?.value\">\n {{ month?.label }}\n </option>\n </select>\n </bb-form-control>\n </div>\n <div class=\"bb-date-picker-item\">\n <bb-form-control hideErrors>\n <select *ngIf=\"data?.years?.length > 0; else defaultYearInputTemplate\"\n [class.has-value]=\"!!form?.get('year')?.value\"\n bbInput\n autocomplete=\"off\"\n formControlName=\"year\">\n <option [ngValue]=\"null\">{{ yearPlaceholder }}</option>\n <option *ngFor=\"let year of data?.years\"\n [value]=\"year\">\n {{ year }}\n </option>\n </select>\n\n <ng-template #defaultYearInputTemplate>\n <input [placeholder]=\"yearPlaceholder\"\n bbInput\n type=\"text\"\n inputmode=\"numeric\"\n minlength=\"4\"\n maxlength=\"4\"\n pattern=\"^[0-9]{4}$\"\n formControlName=\"year\"\n autocomplete=\"off\">\n </ng-template>\n </bb-form-control>\n </div>\n</form>\n\n<!-- The date picker error. -->\n<bb-form-error *ngIf=\"!hideErrors\"\n (errorChange)=\"onErrorChange($event)\">\n</bb-form-error>\n\n<!-- The date picker hint. -->\n<p *ngIf=\"hint as hintContent\"\n class=\"bb-date-picker-hint\">\n <ng-template [bbTemplate]=\"hintContent\">\n {{ hintContent }}\n </ng-template>\n</p>\n", styles: [".bb-date-picker{display:block}.bb-date-picker.required>.bb-date-picker-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bb-date-picker.readonly{pointer-events:none}.bb-date-picker.readonly .bb-form-control-container{cursor:default;border:1px dotted #bdc4c9;background-color:#f9f9f9!important}.bb-date-picker.readonly .bb-form-control-container>select:disabled{opacity:1}.bb-date-picker.grouped{margin-bottom:20px}.bb-date-picker.error>.bb-date-picker-label{color:#c23934}.bb-date-picker.error .bb-form-control-container{border:1px solid #962b26;background-color:#c2393440!important;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #c2393466!important}.bb-date-picker-label{color:#000;display:block;font-size:16px;font-weight:500;margin-bottom:4px}.bb-date-picker-container{display:flex}.bb-date-picker-item{flex:1}.bb-date-picker-item>bb-form-control.focused{z-index:1;position:relative}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select>option:first-child{color:#d2d2d2}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select:not(.has-value){color:#d2d2d2}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select:not(.has-value)>option:not(:first-child){color:#000}.bb-date-picker-item:not(:first-child):not(:last-child) .bb-form-control-container{border-radius:0!important}.bb-date-picker-item:first-child .bb-form-control-container{border-right:none!important;border-top-right-radius:0!important;border-bottom-right-radius:0!important}.bb-date-picker-item:last-child .bb-form-control-container{border-left:none!important;border-top-left-radius:0!important;border-bottom-left-radius:0!important}.bb-date-picker-hint{display:block;color:#738694;font-size:13px;margin-top:4px;pointer-events:all}\n"], components: [{ type: BbFormControl, selector: "bb-form-control", inputs: ["grouped", "hideErrors", "label", "hint"] }, { type: BbFormError, selector: "bb-form-error", inputs: ["control"], outputs: ["errorChange"] }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: BbTemplate, selector: "[bbTemplate]", inputs: ["bbTemplate"] }, { type: i5.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i5.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: BbFormSubmit, selector: "form", exportAs: ["bbForm"] }, { type: i5.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: BbSelect, selector: "select[bbInput]", inputs: ["disabled", "required"] }, { type: i5.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i5.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i5.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: BbInput, selector: "input[bbInput], textarea[bbInput]", inputs: ["readonly"] }, { type: i5.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i5.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { type: i5.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { type: i5.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }], pipes: { "async": i1.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1201
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbDatePicker, decorators: [{
1202
- type: Component,
1203
- args: [{ selector: 'bb-date-picker', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
1204
- {
1205
- provide: NG_VALUE_ACCESSOR,
1206
- useExisting: forwardRef(() => BbDatePicker),
1207
- multi: true
1208
- },
1209
- {
1210
- provide: NG_VALIDATORS,
1211
- useExisting: BbDatePicker,
1212
- multi: true
1213
- }
1214
- ], host: {
1215
- 'class': 'bb-date-picker',
1216
- '[class.required]': 'required',
1217
- '[class.readonly]': 'readonly',
1218
- '[class.disabled]': 'disabled',
1219
- '[class.grouped]': 'grouped',
1220
- '[class.error]': 'error'
1221
- }, inputs: ['required', 'readonly', 'disabled', 'grouped', 'hideErrors'], preserveWhitespaces: false, template: "<!-- Label of the date picker. -->\n<label *ngIf=\"label as labelContent\"\n class=\"bb-date-picker-label\">\n <ng-template [bbTemplate]=\"labelContent\">\n {{ labelContent }}\n </ng-template>\n</label>\n\n<!-- The form containing the year/month/day fields. -->\n<form *ngIf=\"data$ | async as data\"\n [formGroup]=\"form\"\n class=\"bb-date-picker-container\"\n novalidate>\n <div class=\"bb-date-picker-item\">\n <bb-form-control hideErrors>\n <select [class.has-value]=\"!!form?.get('day')?.value\"\n bbInput\n autocomplete=\"off\"\n formControlName=\"day\">\n <option [ngValue]=\"null\">{{ dayPlaceholder }}</option>\n <option *ngFor=\"let day of data?.days; trackBy: trackByValue\"\n [ngValue]=\"day?.value\">\n {{ day?.label }}\n </option>\n </select>\n </bb-form-control>\n </div>\n <div class=\"bb-date-picker-item\">\n <bb-form-control hideErrors>\n <select [class.has-value]=\"!!form?.get('month')?.value\"\n bbInput\n autocomplete=\"off\"\n formControlName=\"month\">\n <option [ngValue]=\"null\">{{ monthPlaceholder }}</option>\n <option *ngFor=\"let month of data?.months; trackBy: trackByValue\"\n [ngValue]=\"month?.value\">\n {{ month?.label }}\n </option>\n </select>\n </bb-form-control>\n </div>\n <div class=\"bb-date-picker-item\">\n <bb-form-control hideErrors>\n <select *ngIf=\"data?.years?.length > 0; else defaultYearInputTemplate\"\n [class.has-value]=\"!!form?.get('year')?.value\"\n bbInput\n autocomplete=\"off\"\n formControlName=\"year\">\n <option [ngValue]=\"null\">{{ yearPlaceholder }}</option>\n <option *ngFor=\"let year of data?.years\"\n [value]=\"year\">\n {{ year }}\n </option>\n </select>\n\n <ng-template #defaultYearInputTemplate>\n <input [placeholder]=\"yearPlaceholder\"\n bbInput\n type=\"text\"\n inputmode=\"numeric\"\n minlength=\"4\"\n maxlength=\"4\"\n pattern=\"^[0-9]{4}$\"\n formControlName=\"year\"\n autocomplete=\"off\">\n </ng-template>\n </bb-form-control>\n </div>\n</form>\n\n<!-- The date picker error. -->\n<bb-form-error *ngIf=\"!hideErrors\"\n (errorChange)=\"onErrorChange($event)\">\n</bb-form-error>\n\n<!-- The date picker hint. -->\n<p *ngIf=\"hint as hintContent\"\n class=\"bb-date-picker-hint\">\n <ng-template [bbTemplate]=\"hintContent\">\n {{ hintContent }}\n </ng-template>\n</p>\n", styles: [".bb-date-picker{display:block}.bb-date-picker.required>.bb-date-picker-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bb-date-picker.readonly{pointer-events:none}.bb-date-picker.readonly .bb-form-control-container{cursor:default;border:1px dotted #bdc4c9;background-color:#f9f9f9!important}.bb-date-picker.readonly .bb-form-control-container>select:disabled{opacity:1}.bb-date-picker.grouped{margin-bottom:20px}.bb-date-picker.error>.bb-date-picker-label{color:#c23934}.bb-date-picker.error .bb-form-control-container{border:1px solid #962b26;background-color:#c2393440!important;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #c2393466!important}.bb-date-picker-label{color:#000;display:block;font-size:16px;font-weight:500;margin-bottom:4px}.bb-date-picker-container{display:flex}.bb-date-picker-item{flex:1}.bb-date-picker-item>bb-form-control.focused{z-index:1;position:relative}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select>option:first-child{color:#d2d2d2}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select:not(.has-value){color:#d2d2d2}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select:not(.has-value)>option:not(:first-child){color:#000}.bb-date-picker-item:not(:first-child):not(:last-child) .bb-form-control-container{border-radius:0!important}.bb-date-picker-item:first-child .bb-form-control-container{border-right:none!important;border-top-right-radius:0!important;border-bottom-right-radius:0!important}.bb-date-picker-item:last-child .bb-form-control-container{border-left:none!important;border-top-left-radius:0!important;border-bottom-left-radius:0!important}.bb-date-picker-hint{display:block;color:#738694;font-size:13px;margin-top:4px;pointer-events:all}\n"] }]
1222
- }], ctorParameters: function () {
1223
- return [{ type: undefined, decorators: [{
1224
- type: Inject,
1225
- args: [LOCALE_ID]
1226
- }] }];
1227
- }, propDecorators: { label: [{
1228
- type: Input
1229
- }], hint: [{
1230
- type: Input
1231
- }], dayPlaceholder: [{
1232
- type: Input
1233
- }], monthPlaceholder: [{
1234
- type: Input
1235
- }], yearPlaceholder: [{
1236
- type: Input
1237
- }], years: [{
1238
- type: Input
1239
- }], value: [{
1240
- type: Input
1241
- }], valueChange: [{
1242
- type: Output
945
+ class BbDatePickerBase {
946
+ }
947
+ const BbFilePickerMixinBase = mixinRequired(mixinReadonly(mixinDisabled(mixinGrouped(mixinError(mixinHideErrors(BbDatePickerBase))))));
948
+ class BbDatePicker extends BbFilePickerMixinBase {
949
+ constructor(_localeId) {
950
+ super();
951
+ this._localeId = _localeId;
952
+ // Readonly data.
953
+ this._yearRegex = /^(10|[1-9][0-9])\d{2}$/; // Note: 1000 - 9999
954
+ // Inputs.
955
+ this.label = null;
956
+ this.hint = null;
957
+ this.dayPlaceholder = 'dd';
958
+ this.monthPlaceholder = 'mm';
959
+ this.yearPlaceholder = 'yyyy';
960
+ this.trackByValue = (_, item) => item === null || item === void 0 ? void 0 : item.value;
961
+ this.years$ = new BehaviorSubject(null);
962
+ this.valueChange = new EventEmitter();
963
+ // Subscriptions.
964
+ this._subscription = new Subscription();
965
+ this.onTouchedCallback = () => {
966
+ };
967
+ this.onChangeCallback = () => {
968
+ };
969
+ this.formToDateString = ({ year, month, day }) => {
970
+ var _a;
971
+ if ((_a = this.form) === null || _a === void 0 ? void 0 : _a.invalid) {
972
+ return null;
973
+ }
974
+ const prefixedMonth = this.padString(`${month}`, 2, '0');
975
+ const prefixedDay = this.padString(`${day}`, 2, '0');
976
+ return [year, prefixedMonth, prefixedDay].join('-');
977
+ };
978
+ this.parseYearFormat = (value) => {
979
+ var _a, _b, _c, _d, _e, _f;
980
+ // Transform the value to a definitive string.
981
+ const yearString = `${value}`;
982
+ const currentFullYear = new Date().getFullYear();
983
+ // Handle default "current" syntax.
984
+ if (yearString === 'current') {
985
+ return currentFullYear;
986
+ }
987
+ // Handle "current + {amount}" syntax.
988
+ if (/^current\s?\+\s?\d+$/.test(yearString)) {
989
+ const amount = (_c = Number((_b = (_a = yearString === null || yearString === void 0 ? void 0 : yearString.split('+')) === null || _a === void 0 ? void 0 : _a[1]) === null || _b === void 0 ? void 0 : _b.trim())) !== null && _c !== void 0 ? _c : 0;
990
+ return currentFullYear + amount;
991
+ }
992
+ // Handle "current - {amount}" syntax.
993
+ if (/^current\s?-\s?\d+$/.test(yearString)) {
994
+ const amount = (_f = Number((_e = (_d = yearString === null || yearString === void 0 ? void 0 : yearString.split('-')) === null || _d === void 0 ? void 0 : _d[1]) === null || _e === void 0 ? void 0 : _e.trim())) !== null && _f !== void 0 ? _f : 0;
995
+ return currentFullYear - amount;
996
+ }
997
+ // Handling the default number case.
998
+ if (/^[0-9]{4}$/.test(yearString)) {
999
+ return Number(yearString);
1000
+ }
1001
+ // We could not parse it.
1002
+ return null;
1003
+ };
1004
+ this.getDaysInMonth = (month = null, year = null) => {
1005
+ var _a;
1006
+ if (((_a = this.form) === null || _a === void 0 ? void 0 : _a.invalid) || month === null || year === null) {
1007
+ return 31;
1008
+ }
1009
+ const parsedYear = parseInt(year, 10);
1010
+ return new Date(parsedYear, month, 0).getDate();
1011
+ };
1012
+ this.isValidDateString = (value) => {
1013
+ return typeof value === 'string' && /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/.test(value);
1014
+ };
1015
+ this.padString = (value, maxLength, fillString = '0') => {
1016
+ const count = maxLength - value.length;
1017
+ for (let index = 0; index < count; index++) {
1018
+ value = `${fillString}${value}`;
1019
+ }
1020
+ return value;
1021
+ };
1022
+ }
1023
+ set years(value) {
1024
+ this.parseYears(value);
1025
+ }
1026
+ get value() {
1027
+ var _a;
1028
+ return this.formToDateString((_a = this.form) === null || _a === void 0 ? void 0 : _a.value);
1029
+ }
1030
+ set value(value) {
1031
+ this.parseDateStringInForm(value);
1032
+ this.valueChange.emit(this.value);
1033
+ }
1034
+ ngOnInit() {
1035
+ this.composeForm();
1036
+ this.getData();
1037
+ this.handleChanges();
1038
+ }
1039
+ ngOnDestroy() {
1040
+ var _a;
1041
+ (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
1042
+ }
1043
+ writeValue(value) {
1044
+ this.parseDateStringInForm(value);
1045
+ }
1046
+ registerOnChange(method) {
1047
+ this.onChangeCallback = method;
1048
+ }
1049
+ registerOnTouched(method) {
1050
+ this.onTouchedCallback = method;
1051
+ }
1052
+ setDisabledState(isDisabled) {
1053
+ var _a, _b;
1054
+ this.disabled = isDisabled;
1055
+ if (this.disabled) {
1056
+ (_a = this.form) === null || _a === void 0 ? void 0 : _a.disable();
1057
+ }
1058
+ else {
1059
+ (_b = this.form) === null || _b === void 0 ? void 0 : _b.enable();
1060
+ }
1061
+ }
1062
+ onErrorChange(error) {
1063
+ this.error = !!error;
1064
+ }
1065
+ validate({ value }) {
1066
+ if (value === null || value === undefined) {
1067
+ return null;
1068
+ }
1069
+ const data = this.parseDateString(value);
1070
+ const date = new Date(data === null || data === void 0 ? void 0 : data.year, (data === null || data === void 0 ? void 0 : data.month) - 1, data === null || data === void 0 ? void 0 : data.day);
1071
+ const maxDays = this.getDaysInMonth(data === null || data === void 0 ? void 0 : data.month, `${data === null || data === void 0 ? void 0 : data.year}`);
1072
+ const isInvalidDate = date.toString() === 'Invalid Date';
1073
+ const exceededMaxDays = (data === null || data === void 0 ? void 0 : data.day) > maxDays;
1074
+ return (isInvalidDate || exceededMaxDays) && {
1075
+ invalidDate: true
1076
+ };
1077
+ }
1078
+ handleChanges() {
1079
+ const dateOrNull$ = this.form.valueChanges.pipe(map(value => this.formToDateString(value)), distinctUntilChanged());
1080
+ const subscription = dateOrNull$.subscribe(() => {
1081
+ this.valueChange.emit(this.value);
1082
+ this.onChangeCallback(this.value);
1083
+ });
1084
+ this._subscription.add(subscription);
1085
+ }
1086
+ getData() {
1087
+ const years$ = this.years$.asObservable();
1088
+ const months$ = this.getMonthData();
1089
+ const days$ = this.getDayData();
1090
+ this.data$ = combineLatest([years$, months$, days$]).pipe(map(([years, months, days]) => ({ years, months, days })), tap(data => { var _a; return this.verifyListData((_a = data === null || data === void 0 ? void 0 : data.days) === null || _a === void 0 ? void 0 : _a.length, data === null || data === void 0 ? void 0 : data.years); }));
1091
+ }
1092
+ verifyListData(maxDays, years) {
1093
+ const dayControl = this.form.get('day');
1094
+ if ((dayControl === null || dayControl === void 0 ? void 0 : dayControl.value) !== null && (dayControl === null || dayControl === void 0 ? void 0 : dayControl.value) > maxDays) {
1095
+ dayControl.patchValue(maxDays);
1096
+ }
1097
+ const yearControl = this.form.get('year');
1098
+ if (years !== null && (yearControl === null || yearControl === void 0 ? void 0 : yearControl.value) !== null && this._yearRegex.test(yearControl === null || yearControl === void 0 ? void 0 : yearControl.value)) {
1099
+ const selectedYear = Number(yearControl === null || yearControl === void 0 ? void 0 : yearControl.value);
1100
+ const firstYear = Math.min(...years);
1101
+ const lastYear = Math.max(...years);
1102
+ if (selectedYear < firstYear || selectedYear > lastYear) {
1103
+ Promise.resolve().then(() => yearControl.patchValue(null));
1104
+ }
1105
+ }
1106
+ }
1107
+ getDayData() {
1108
+ var _a;
1109
+ const count$ = this.form.valueChanges.pipe(startWith((_a = this.form) === null || _a === void 0 ? void 0 : _a.value), map(({ month, year }) => this.getDaysInMonth(month, year)), distinctUntilChanged());
1110
+ return count$.pipe(map(count => Array(count).fill(0).map((_, index) => ({
1111
+ label: `${index + 1}`,
1112
+ value: index + 1
1113
+ }))));
1114
+ }
1115
+ getMonthData() {
1116
+ const array = Array(12).fill(0).map((_, month) => {
1117
+ const date = new Date(2000, month, 1);
1118
+ const label = formatDate(date, 'LLLL', this._localeId);
1119
+ return { label, value: month + 1 };
1120
+ });
1121
+ return of(array);
1122
+ }
1123
+ composeForm() {
1124
+ const { required, pattern, minLength, maxLength } = Validators;
1125
+ const yearPattern = pattern(this._yearRegex);
1126
+ const yearValidators = [required, yearPattern, minLength(4), maxLength(4)];
1127
+ this.form = new FormGroup({
1128
+ day: new FormControl(null, required),
1129
+ month: new FormControl(null, required),
1130
+ year: new FormControl(null, yearValidators)
1131
+ });
1132
+ }
1133
+ parseDateStringInForm(value) {
1134
+ var _a, _b;
1135
+ // If the date string was not a valid format, reset the form.
1136
+ if (!this.isValidDateString(value)) {
1137
+ if (value !== null) {
1138
+ (_a = this.form) === null || _a === void 0 ? void 0 : _a.reset({ year: null, month: null, day: null }, { emitEvent: false });
1139
+ }
1140
+ return;
1141
+ }
1142
+ // Parse the date string and save in the form.
1143
+ const data = this.parseDateString(value);
1144
+ const year = (data === null || data === void 0 ? void 0 : data.year) !== null && (data === null || data === void 0 ? void 0 : data.year) !== undefined
1145
+ ? this.padString(`${data === null || data === void 0 ? void 0 : data.year}`, 4, '0')
1146
+ : null;
1147
+ const formData = Object.assign(Object.assign({}, (data !== null && data !== void 0 ? data : {})), { year });
1148
+ (_b = this.form) === null || _b === void 0 ? void 0 : _b.patchValue(formData, { emitEvent: false });
1149
+ }
1150
+ parseDateString(value) {
1151
+ if (!this.isValidDateString(value)) {
1152
+ return null;
1153
+ }
1154
+ // Parse the date string.
1155
+ const [year, month, day] = value === null || value === void 0 ? void 0 : value.split('-');
1156
+ return {
1157
+ day: day ? parseInt(day, 10) : null,
1158
+ month: month ? parseInt(month, 10) : null,
1159
+ year: year ? parseInt(year, 10) : null
1160
+ };
1161
+ }
1162
+ parseYears(values) {
1163
+ if (!values) {
1164
+ return this.years$.next(null);
1165
+ }
1166
+ // Parse the values to years (in numbers).
1167
+ const [first, last] = values;
1168
+ const firstYear = this.parseYearFormat(first);
1169
+ const lastYear = this.parseYearFormat(last);
1170
+ // Check cases in where we cannot parse.
1171
+ if (firstYear === null || lastYear === null) {
1172
+ return this.years$.next(null);
1173
+ }
1174
+ const difference = firstYear - lastYear;
1175
+ const absoluteDifference = Math.abs(difference) + 1;
1176
+ // Create an array with years.
1177
+ const years = Array(absoluteDifference)
1178
+ .fill(0)
1179
+ .map((_, index) => difference < 0 ? (firstYear + index) : (firstYear - index));
1180
+ // Validate we have one or more years.
1181
+ if ((years === null || years === void 0 ? void 0 : years.length) <= 0) {
1182
+ return this.years$.next(null);
1183
+ }
1184
+ // Push the years.
1185
+ return this.years$.next(years);
1186
+ }
1187
+ }
1188
+ BbDatePicker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbDatePicker, deps: [{ token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Component });
1189
+ BbDatePicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.6", type: BbDatePicker, selector: "bb-date-picker", inputs: { required: "required", readonly: "readonly", disabled: "disabled", grouped: "grouped", hideErrors: "hideErrors", label: "label", hint: "hint", dayPlaceholder: "dayPlaceholder", monthPlaceholder: "monthPlaceholder", yearPlaceholder: "yearPlaceholder", years: "years", value: "value" }, outputs: { valueChange: "valueChange" }, host: { properties: { "class.required": "required", "class.readonly": "readonly", "class.disabled": "disabled", "class.grouped": "grouped", "class.error": "error" }, classAttribute: "bb-date-picker" }, providers: [
1190
+ {
1191
+ provide: NG_VALUE_ACCESSOR,
1192
+ useExisting: forwardRef(() => BbDatePicker),
1193
+ multi: true
1194
+ },
1195
+ {
1196
+ provide: NG_VALIDATORS,
1197
+ useExisting: BbDatePicker,
1198
+ multi: true
1199
+ }
1200
+ ], usesInheritance: true, ngImport: i0, template: "<!-- Label of the date picker. -->\r\n<label *ngIf=\"label as labelContent\"\r\n class=\"bb-date-picker-label\">\r\n <ng-template [bbTemplate]=\"labelContent\">\r\n {{ labelContent }}\r\n </ng-template>\r\n</label>\r\n\r\n<!-- The form containing the year/month/day fields. -->\r\n<form *ngIf=\"data$ | async as data\"\r\n [formGroup]=\"form\"\r\n class=\"bb-date-picker-container\"\r\n novalidate>\r\n <div class=\"bb-date-picker-item\">\r\n <bb-form-control hideErrors>\r\n <select [class.has-value]=\"!!form?.get('day')?.value\"\r\n bbInput\r\n autocomplete=\"off\"\r\n formControlName=\"day\">\r\n <option [ngValue]=\"null\">{{ dayPlaceholder }}</option>\r\n <option *ngFor=\"let day of data?.days; trackBy: trackByValue\"\r\n [ngValue]=\"day?.value\">\r\n {{ day?.label }}\r\n </option>\r\n </select>\r\n </bb-form-control>\r\n </div>\r\n <div class=\"bb-date-picker-item\">\r\n <bb-form-control hideErrors>\r\n <select [class.has-value]=\"!!form?.get('month')?.value\"\r\n bbInput\r\n autocomplete=\"off\"\r\n formControlName=\"month\">\r\n <option [ngValue]=\"null\">{{ monthPlaceholder }}</option>\r\n <option *ngFor=\"let month of data?.months; trackBy: trackByValue\"\r\n [ngValue]=\"month?.value\">\r\n {{ month?.label }}\r\n </option>\r\n </select>\r\n </bb-form-control>\r\n </div>\r\n <div class=\"bb-date-picker-item\">\r\n <bb-form-control hideErrors>\r\n <select *ngIf=\"data?.years?.length > 0; else defaultYearInputTemplate\"\r\n [class.has-value]=\"!!form?.get('year')?.value\"\r\n bbInput\r\n autocomplete=\"off\"\r\n formControlName=\"year\">\r\n <option [ngValue]=\"null\">{{ yearPlaceholder }}</option>\r\n <option *ngFor=\"let year of data?.years\"\r\n [value]=\"year\">\r\n {{ year }}\r\n </option>\r\n </select>\r\n\r\n <ng-template #defaultYearInputTemplate>\r\n <input [placeholder]=\"yearPlaceholder\"\r\n bbInput\r\n type=\"text\"\r\n inputmode=\"numeric\"\r\n minlength=\"4\"\r\n maxlength=\"4\"\r\n pattern=\"^[0-9]{4}$\"\r\n formControlName=\"year\"\r\n autocomplete=\"off\">\r\n </ng-template>\r\n </bb-form-control>\r\n </div>\r\n</form>\r\n\r\n<!-- The date picker error. -->\r\n<bb-form-error *ngIf=\"!hideErrors\"\r\n (errorChange)=\"onErrorChange($event)\">\r\n</bb-form-error>\r\n\r\n<!-- The date picker hint. -->\r\n<p *ngIf=\"hint as hintContent\"\r\n class=\"bb-date-picker-hint\">\r\n <ng-template [bbTemplate]=\"hintContent\">\r\n {{ hintContent }}\r\n </ng-template>\r\n</p>\r\n", styles: [".bb-date-picker{display:block}.bb-date-picker.required>.bb-date-picker-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bb-date-picker.readonly{pointer-events:none}.bb-date-picker.readonly .bb-form-control-container{cursor:default;border:1px dotted #bdc4c9;background-color:#f9f9f9!important}.bb-date-picker.readonly .bb-form-control-container>select:disabled{opacity:1}.bb-date-picker.grouped{margin-bottom:20px}.bb-date-picker.error>.bb-date-picker-label{color:#c23934}.bb-date-picker.error .bb-form-control-container{border:1px solid #962b26;background-color:#c2393440!important;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #c2393466!important}.bb-date-picker-label{color:#000;display:block;font-size:16px;font-weight:500;margin-bottom:4px}.bb-date-picker-container{display:flex}.bb-date-picker-item{flex:1}.bb-date-picker-item>bb-form-control.focused{z-index:1;position:relative}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select>option:first-child{color:#d2d2d2}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select:not(.has-value){color:#d2d2d2}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select:not(.has-value)>option:not(:first-child){color:#000}.bb-date-picker-item:not(:first-child):not(:last-child) .bb-form-control-container{border-radius:0!important}.bb-date-picker-item:first-child .bb-form-control-container{border-right:none!important;border-top-right-radius:0!important;border-bottom-right-radius:0!important}.bb-date-picker-item:last-child .bb-form-control-container{border-left:none!important;border-top-left-radius:0!important;border-bottom-left-radius:0!important}.bb-date-picker-hint{display:block;color:#738694;font-size:13px;margin-top:4px;pointer-events:all}\n"], components: [{ type: BbFormControl, selector: "bb-form-control", inputs: ["grouped", "hideErrors", "label", "hint"] }, { type: BbFormError, selector: "bb-form-error", inputs: ["control"], outputs: ["errorChange"] }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: BbTemplate, selector: "[bbTemplate]", inputs: ["bbTemplate"] }, { type: i5.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i5.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: BbFormSubmit, selector: "form", exportAs: ["bbForm"] }, { type: i5.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: BbSelect, selector: "select[bbInput]", inputs: ["disabled", "required"] }, { type: i5.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i5.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i5.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: BbInput, selector: "input[bbInput], textarea[bbInput]", inputs: ["readonly"] }, { type: i5.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i5.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { type: i5.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { type: i5.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }], pipes: { "async": i1.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1201
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbDatePicker, decorators: [{
1202
+ type: Component,
1203
+ args: [{ selector: 'bb-date-picker', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
1204
+ {
1205
+ provide: NG_VALUE_ACCESSOR,
1206
+ useExisting: forwardRef(() => BbDatePicker),
1207
+ multi: true
1208
+ },
1209
+ {
1210
+ provide: NG_VALIDATORS,
1211
+ useExisting: BbDatePicker,
1212
+ multi: true
1213
+ }
1214
+ ], host: {
1215
+ 'class': 'bb-date-picker',
1216
+ '[class.required]': 'required',
1217
+ '[class.readonly]': 'readonly',
1218
+ '[class.disabled]': 'disabled',
1219
+ '[class.grouped]': 'grouped',
1220
+ '[class.error]': 'error'
1221
+ }, inputs: ['required', 'readonly', 'disabled', 'grouped', 'hideErrors'], preserveWhitespaces: false, template: "<!-- Label of the date picker. -->\r\n<label *ngIf=\"label as labelContent\"\r\n class=\"bb-date-picker-label\">\r\n <ng-template [bbTemplate]=\"labelContent\">\r\n {{ labelContent }}\r\n </ng-template>\r\n</label>\r\n\r\n<!-- The form containing the year/month/day fields. -->\r\n<form *ngIf=\"data$ | async as data\"\r\n [formGroup]=\"form\"\r\n class=\"bb-date-picker-container\"\r\n novalidate>\r\n <div class=\"bb-date-picker-item\">\r\n <bb-form-control hideErrors>\r\n <select [class.has-value]=\"!!form?.get('day')?.value\"\r\n bbInput\r\n autocomplete=\"off\"\r\n formControlName=\"day\">\r\n <option [ngValue]=\"null\">{{ dayPlaceholder }}</option>\r\n <option *ngFor=\"let day of data?.days; trackBy: trackByValue\"\r\n [ngValue]=\"day?.value\">\r\n {{ day?.label }}\r\n </option>\r\n </select>\r\n </bb-form-control>\r\n </div>\r\n <div class=\"bb-date-picker-item\">\r\n <bb-form-control hideErrors>\r\n <select [class.has-value]=\"!!form?.get('month')?.value\"\r\n bbInput\r\n autocomplete=\"off\"\r\n formControlName=\"month\">\r\n <option [ngValue]=\"null\">{{ monthPlaceholder }}</option>\r\n <option *ngFor=\"let month of data?.months; trackBy: trackByValue\"\r\n [ngValue]=\"month?.value\">\r\n {{ month?.label }}\r\n </option>\r\n </select>\r\n </bb-form-control>\r\n </div>\r\n <div class=\"bb-date-picker-item\">\r\n <bb-form-control hideErrors>\r\n <select *ngIf=\"data?.years?.length > 0; else defaultYearInputTemplate\"\r\n [class.has-value]=\"!!form?.get('year')?.value\"\r\n bbInput\r\n autocomplete=\"off\"\r\n formControlName=\"year\">\r\n <option [ngValue]=\"null\">{{ yearPlaceholder }}</option>\r\n <option *ngFor=\"let year of data?.years\"\r\n [value]=\"year\">\r\n {{ year }}\r\n </option>\r\n </select>\r\n\r\n <ng-template #defaultYearInputTemplate>\r\n <input [placeholder]=\"yearPlaceholder\"\r\n bbInput\r\n type=\"text\"\r\n inputmode=\"numeric\"\r\n minlength=\"4\"\r\n maxlength=\"4\"\r\n pattern=\"^[0-9]{4}$\"\r\n formControlName=\"year\"\r\n autocomplete=\"off\">\r\n </ng-template>\r\n </bb-form-control>\r\n </div>\r\n</form>\r\n\r\n<!-- The date picker error. -->\r\n<bb-form-error *ngIf=\"!hideErrors\"\r\n (errorChange)=\"onErrorChange($event)\">\r\n</bb-form-error>\r\n\r\n<!-- The date picker hint. -->\r\n<p *ngIf=\"hint as hintContent\"\r\n class=\"bb-date-picker-hint\">\r\n <ng-template [bbTemplate]=\"hintContent\">\r\n {{ hintContent }}\r\n </ng-template>\r\n</p>\r\n", styles: [".bb-date-picker{display:block}.bb-date-picker.required>.bb-date-picker-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bb-date-picker.readonly{pointer-events:none}.bb-date-picker.readonly .bb-form-control-container{cursor:default;border:1px dotted #bdc4c9;background-color:#f9f9f9!important}.bb-date-picker.readonly .bb-form-control-container>select:disabled{opacity:1}.bb-date-picker.grouped{margin-bottom:20px}.bb-date-picker.error>.bb-date-picker-label{color:#c23934}.bb-date-picker.error .bb-form-control-container{border:1px solid #962b26;background-color:#c2393440!important;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #c2393466!important}.bb-date-picker-label{color:#000;display:block;font-size:16px;font-weight:500;margin-bottom:4px}.bb-date-picker-container{display:flex}.bb-date-picker-item{flex:1}.bb-date-picker-item>bb-form-control.focused{z-index:1;position:relative}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select>option:first-child{color:#d2d2d2}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select:not(.has-value){color:#d2d2d2}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select:not(.has-value)>option:not(:first-child){color:#000}.bb-date-picker-item:not(:first-child):not(:last-child) .bb-form-control-container{border-radius:0!important}.bb-date-picker-item:first-child .bb-form-control-container{border-right:none!important;border-top-right-radius:0!important;border-bottom-right-radius:0!important}.bb-date-picker-item:last-child .bb-form-control-container{border-left:none!important;border-top-left-radius:0!important;border-bottom-left-radius:0!important}.bb-date-picker-hint{display:block;color:#738694;font-size:13px;margin-top:4px;pointer-events:all}\n"] }]
1222
+ }], ctorParameters: function () {
1223
+ return [{ type: undefined, decorators: [{
1224
+ type: Inject,
1225
+ args: [LOCALE_ID]
1226
+ }] }];
1227
+ }, propDecorators: { label: [{
1228
+ type: Input
1229
+ }], hint: [{
1230
+ type: Input
1231
+ }], dayPlaceholder: [{
1232
+ type: Input
1233
+ }], monthPlaceholder: [{
1234
+ type: Input
1235
+ }], yearPlaceholder: [{
1236
+ type: Input
1237
+ }], years: [{
1238
+ type: Input
1239
+ }], value: [{
1240
+ type: Input
1241
+ }], valueChange: [{
1242
+ type: Output
1243
1243
  }] } });
1244
1244
 
1245
- class BbSuffix {
1246
- }
1247
- BbSuffix.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbSuffix, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1248
- BbSuffix.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.0", type: BbSuffix, selector: "[bbSuffix]", host: { classAttribute: "bb-suffix" }, ngImport: i0 });
1249
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbSuffix, decorators: [{
1250
- type: Directive,
1251
- args: [{
1252
- selector: '[bbSuffix]',
1253
- host: {
1254
- 'class': 'bb-suffix'
1255
- }
1256
- }]
1257
- }] });
1258
- class BbPrefix {
1259
- }
1260
- BbPrefix.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbPrefix, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1261
- BbPrefix.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.0", type: BbPrefix, selector: "[bbPrefix]", host: { classAttribute: "bb-prefix" }, ngImport: i0 });
1262
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbPrefix, decorators: [{
1263
- type: Directive,
1264
- args: [{
1265
- selector: '[bbPrefix]',
1266
- host: {
1267
- 'class': 'bb-prefix'
1268
- }
1269
- }]
1245
+ class BbSuffix {
1246
+ }
1247
+ BbSuffix.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbSuffix, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1248
+ BbSuffix.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.6", type: BbSuffix, selector: "[bbSuffix]", host: { classAttribute: "bb-suffix" }, ngImport: i0 });
1249
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbSuffix, decorators: [{
1250
+ type: Directive,
1251
+ args: [{
1252
+ selector: '[bbSuffix]',
1253
+ host: {
1254
+ 'class': 'bb-suffix'
1255
+ }
1256
+ }]
1257
+ }] });
1258
+ class BbPrefix {
1259
+ }
1260
+ BbPrefix.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbPrefix, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1261
+ BbPrefix.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.6", type: BbPrefix, selector: "[bbPrefix]", host: { classAttribute: "bb-prefix" }, ngImport: i0 });
1262
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbPrefix, decorators: [{
1263
+ type: Directive,
1264
+ args: [{
1265
+ selector: '[bbPrefix]',
1266
+ host: {
1267
+ 'class': 'bb-prefix'
1268
+ }
1269
+ }]
1270
1270
  }] });
1271
1271
 
1272
- class BbFormGroupBase {
1273
- }
1274
- const BbFormGroupMixinBase = mixinGrouped(BbFormGroupBase);
1275
- class BbFormGroup extends BbFormGroupMixinBase {
1276
- }
1277
- BbFormGroup.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFormGroup, deps: null, target: i0.ɵɵFactoryTarget.Component });
1278
- BbFormGroup.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbFormGroup, selector: "bb-form-group", inputs: { grouped: "grouped" }, host: { properties: { "class.grouped": "grouped" }, classAttribute: "bb-form-group" }, usesInheritance: true, ngImport: i0, template: "<ng-content></ng-content>\n", styles: [".bb-form-group{width:100%;display:flex;flex-wrap:wrap;margin-top:-10px}.bb-form-group>*{margin-top:10px}.bb-form-group>*:not(:first-child){margin-left:10px}.bb-form-group.start{justify-content:flex-start}.bb-form-group.end{justify-content:flex-end}.bb-form-group.vertical{flex-direction:column;justify-content:normal}.bb-form-group.vertical>*{margin-left:0}.bb-form-group.vertical.start{align-items:flex-start}.bb-form-group.vertical.end{align-items:flex-end}.bb-form-group.grouped{margin-bottom:20px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1279
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFormGroup, decorators: [{
1280
- type: Component,
1281
- args: [{ selector: 'bb-form-group', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
1282
- 'class': 'bb-form-group',
1283
- '[class.grouped]': 'grouped'
1284
- }, inputs: ['grouped'], preserveWhitespaces: false, template: "<ng-content></ng-content>\n", styles: [".bb-form-group{width:100%;display:flex;flex-wrap:wrap;margin-top:-10px}.bb-form-group>*{margin-top:10px}.bb-form-group>*:not(:first-child){margin-left:10px}.bb-form-group.start{justify-content:flex-start}.bb-form-group.end{justify-content:flex-end}.bb-form-group.vertical{flex-direction:column;justify-content:normal}.bb-form-group.vertical>*{margin-left:0}.bb-form-group.vertical.start{align-items:flex-start}.bb-form-group.vertical.end{align-items:flex-end}.bb-form-group.grouped{margin-bottom:20px}\n"] }]
1272
+ class BbFormGroupBase {
1273
+ }
1274
+ const BbFormGroupMixinBase = mixinGrouped(BbFormGroupBase);
1275
+ class BbFormGroup extends BbFormGroupMixinBase {
1276
+ }
1277
+ BbFormGroup.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbFormGroup, deps: null, target: i0.ɵɵFactoryTarget.Component });
1278
+ BbFormGroup.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.6", type: BbFormGroup, selector: "bb-form-group", inputs: { grouped: "grouped" }, host: { properties: { "class.grouped": "grouped" }, classAttribute: "bb-form-group" }, usesInheritance: true, ngImport: i0, template: "<ng-content></ng-content>\r\n", styles: [".bb-form-group{width:100%;display:flex;flex-wrap:wrap;margin-top:-10px}.bb-form-group>*{margin-top:10px}.bb-form-group>*:not(:first-child){margin-left:10px}.bb-form-group.start{justify-content:flex-start}.bb-form-group.end{justify-content:flex-end}.bb-form-group.vertical{flex-direction:column;justify-content:normal}.bb-form-group.vertical>*{margin-left:0}.bb-form-group.vertical.start{align-items:flex-start}.bb-form-group.vertical.end{align-items:flex-end}.bb-form-group.grouped{margin-bottom:20px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1279
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbFormGroup, decorators: [{
1280
+ type: Component,
1281
+ args: [{ selector: 'bb-form-group', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
1282
+ 'class': 'bb-form-group',
1283
+ '[class.grouped]': 'grouped'
1284
+ }, inputs: ['grouped'], preserveWhitespaces: false, template: "<ng-content></ng-content>\r\n", styles: [".bb-form-group{width:100%;display:flex;flex-wrap:wrap;margin-top:-10px}.bb-form-group>*{margin-top:10px}.bb-form-group>*:not(:first-child){margin-left:10px}.bb-form-group.start{justify-content:flex-start}.bb-form-group.end{justify-content:flex-end}.bb-form-group.vertical{flex-direction:column;justify-content:normal}.bb-form-group.vertical>*{margin-left:0}.bb-form-group.vertical.start{align-items:flex-start}.bb-form-group.vertical.end{align-items:flex-end}.bb-form-group.grouped{margin-bottom:20px}\n"] }]
1285
1285
  }] });
1286
1286
 
1287
- class BbFocusTrap {
1288
- constructor(_platform, _elementRef) {
1289
- this._platform = _platform;
1290
- this._elementRef = _elementRef;
1291
- this._focusableElements = [
1292
- 'a[href]',
1293
- 'area[href]',
1294
- 'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',
1295
- 'select:not([disabled]):not([aria-hidden])',
1296
- 'textarea:not([disabled]):not([aria-hidden])',
1297
- 'button:not([disabled]):not([aria-hidden])',
1298
- 'iframe',
1299
- 'object',
1300
- 'embed',
1301
- '[contenteditable]',
1302
- '[tabindex]:not([tabindex^="-"])'
1303
- ];
1304
- this.focus = (element) => {
1305
- return element && element.focus && element.focus();
1306
- };
1307
- this.isTabEvent = (event) => {
1308
- return event.key === 'Tab' || event.keyCode === 9;
1309
- };
1310
- }
1311
- onKeydown(event) {
1312
- // Validate it is a tab event.
1313
- if (!this.isTabEvent(event)) {
1314
- return;
1315
- }
1316
- // Trap the focus inside the element.
1317
- return this.trapFocus(event);
1318
- }
1319
- trapFocus(event) {
1320
- // Validate that the DOM is available.
1321
- if (!this._platform.isBrowser) {
1322
- return;
1323
- }
1324
- // Get all focusable nodes.
1325
- const focusableNodes = this.getFocusableNodes();
1326
- // Focus the first available element if the focus
1327
- // is not in the modal.
1328
- if (!this.element.contains(document.activeElement)) {
1329
- return this.focus(focusableNodes[0]);
1330
- }
1331
- const focusedItemIndex = focusableNodes.indexOf(document.activeElement);
1332
- if (event.shiftKey && focusedItemIndex === 0) {
1333
- this.focus(focusableNodes[focusableNodes.length - 1]);
1334
- return event.preventDefault();
1335
- }
1336
- if (!event.shiftKey && focusedItemIndex === focusableNodes.length - 1) {
1337
- this.focus(focusableNodes[0]);
1338
- return event.preventDefault();
1339
- }
1340
- }
1341
- get element() {
1342
- return this._elementRef.nativeElement;
1343
- }
1344
- getFocusableNodes() {
1345
- const nodes = this.element.querySelectorAll(this._focusableElements);
1346
- return Array(...nodes);
1347
- }
1348
- }
1349
- BbFocusTrap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFocusTrap, deps: [{ token: i1$1.Platform }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1350
- BbFocusTrap.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.0", type: BbFocusTrap, selector: "[bbFocusTrap]", host: { listeners: { "keydown": "onKeydown($event)" } }, ngImport: i0 });
1351
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFocusTrap, decorators: [{
1352
- type: Directive,
1353
- args: [{
1354
- selector: '[bbFocusTrap]'
1355
- }]
1356
- }], ctorParameters: function () { return [{ type: i1$1.Platform }, { type: i0.ElementRef }]; }, propDecorators: { onKeydown: [{
1357
- type: HostListener,
1358
- args: ['keydown', ['$event']]
1287
+ class BbFocusTrap {
1288
+ constructor(_platform, _elementRef) {
1289
+ this._platform = _platform;
1290
+ this._elementRef = _elementRef;
1291
+ this._focusableElements = [
1292
+ 'a[href]',
1293
+ 'area[href]',
1294
+ 'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',
1295
+ 'select:not([disabled]):not([aria-hidden])',
1296
+ 'textarea:not([disabled]):not([aria-hidden])',
1297
+ 'button:not([disabled]):not([aria-hidden])',
1298
+ 'iframe',
1299
+ 'object',
1300
+ 'embed',
1301
+ '[contenteditable]',
1302
+ '[tabindex]:not([tabindex^="-"])'
1303
+ ];
1304
+ this.focus = (element) => {
1305
+ return element && element.focus && element.focus();
1306
+ };
1307
+ this.isTabEvent = (event) => {
1308
+ return event.key === 'Tab' || event.keyCode === 9;
1309
+ };
1310
+ }
1311
+ onKeydown(event) {
1312
+ // Validate it is a tab event.
1313
+ if (!this.isTabEvent(event)) {
1314
+ return;
1315
+ }
1316
+ // Trap the focus inside the element.
1317
+ return this.trapFocus(event);
1318
+ }
1319
+ trapFocus(event) {
1320
+ // Validate that the DOM is available.
1321
+ if (!this._platform.isBrowser) {
1322
+ return;
1323
+ }
1324
+ // Get all focusable nodes.
1325
+ const focusableNodes = this.getFocusableNodes();
1326
+ // Focus the first available element if the focus
1327
+ // is not in the modal.
1328
+ if (!this.element.contains(document.activeElement)) {
1329
+ return this.focus(focusableNodes[0]);
1330
+ }
1331
+ const focusedItemIndex = focusableNodes.indexOf(document.activeElement);
1332
+ if (event.shiftKey && focusedItemIndex === 0) {
1333
+ this.focus(focusableNodes[focusableNodes.length - 1]);
1334
+ return event.preventDefault();
1335
+ }
1336
+ if (!event.shiftKey && focusedItemIndex === focusableNodes.length - 1) {
1337
+ this.focus(focusableNodes[0]);
1338
+ return event.preventDefault();
1339
+ }
1340
+ }
1341
+ get element() {
1342
+ return this._elementRef.nativeElement;
1343
+ }
1344
+ getFocusableNodes() {
1345
+ const nodes = this.element.querySelectorAll(this._focusableElements);
1346
+ return Array(...nodes);
1347
+ }
1348
+ }
1349
+ BbFocusTrap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbFocusTrap, deps: [{ token: i1$1.Platform }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1350
+ BbFocusTrap.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.6", type: BbFocusTrap, selector: "[bbFocusTrap]", host: { listeners: { "keydown": "onKeydown($event)" } }, ngImport: i0 });
1351
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbFocusTrap, decorators: [{
1352
+ type: Directive,
1353
+ args: [{
1354
+ selector: '[bbFocusTrap]'
1355
+ }]
1356
+ }], ctorParameters: function () { return [{ type: i1$1.Platform }, { type: i0.ElementRef }]; }, propDecorators: { onKeydown: [{
1357
+ type: HostListener,
1358
+ args: ['keydown', ['$event']]
1359
1359
  }] } });
1360
1360
 
1361
- class BbAutosize {
1362
- constructor(_renderer, _elementRef) {
1363
- this._renderer = _renderer;
1364
- this._elementRef = _elementRef;
1365
- // Min/max heights for the textarea.
1366
- this.minHeight = null;
1367
- this.maxHeight = null;
1368
- this.rows = 1;
1369
- }
1370
- get element() {
1371
- var _a;
1372
- return (_a = this._elementRef) === null || _a === void 0 ? void 0 : _a.nativeElement;
1373
- }
1374
- ngAfterViewInit() {
1375
- // Update the styles after the DOM has loaded.
1376
- this.updateStyles();
1377
- }
1378
- onWindowResize() {
1379
- // Update the styles when the window is resized.
1380
- this.updateStyles();
1381
- }
1382
- onInputReceived() {
1383
- // Update the styles after the textarea received input.
1384
- this.updateStyles();
1385
- }
1386
- updateStyles() {
1387
- var _a, _b, _c;
1388
- // Validate the element exists.
1389
- if (!this.element) {
1390
- return;
1391
- }
1392
- // Calculate border height which is not included in the scroll height.
1393
- const borderHeight = ((_a = this.element) === null || _a === void 0 ? void 0 : _a.offsetHeight) - ((_b = this.element) === null || _b === void 0 ? void 0 : _b.clientHeight);
1394
- // Reset textarea height to auto that correctly calculate the new height.
1395
- this.setHeight('auto');
1396
- // Set new height.
1397
- this.setHeight(`${((_c = this.element) === null || _c === void 0 ? void 0 : _c.scrollHeight) + borderHeight}px`);
1398
- }
1399
- setHeight(value) {
1400
- this._renderer.setStyle(this.element, 'height', value);
1401
- }
1402
- }
1403
- BbAutosize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbAutosize, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1404
- BbAutosize.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.0", type: BbAutosize, selector: "textarea[bbAutosize]", inputs: { minHeight: "minHeight", maxHeight: "maxHeight", rows: "rows" }, host: { listeners: { "window:resize": "onWindowResize()", "input": "onInputReceived()" }, properties: { "style.min-height": "this.minHeight", "style.max-height": "this.maxHeight", "rows": "this.rows" } }, ngImport: i0 });
1405
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbAutosize, decorators: [{
1406
- type: Directive,
1407
- args: [{
1408
- selector: 'textarea[bbAutosize]'
1409
- }]
1410
- }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { minHeight: [{
1411
- type: Input
1412
- }, {
1413
- type: HostBinding,
1414
- args: ['style.min-height']
1415
- }], maxHeight: [{
1416
- type: Input
1417
- }, {
1418
- type: HostBinding,
1419
- args: ['style.max-height']
1420
- }], rows: [{
1421
- type: Input
1422
- }, {
1423
- type: HostBinding,
1424
- args: ['rows']
1425
- }], onWindowResize: [{
1426
- type: HostListener,
1427
- args: ['window:resize']
1428
- }], onInputReceived: [{
1429
- type: HostListener,
1430
- args: ['input']
1361
+ class BbAutosize {
1362
+ constructor(_renderer, _elementRef) {
1363
+ this._renderer = _renderer;
1364
+ this._elementRef = _elementRef;
1365
+ // Min/max heights for the textarea.
1366
+ this.minHeight = null;
1367
+ this.maxHeight = null;
1368
+ this.rows = 1;
1369
+ }
1370
+ get element() {
1371
+ var _a;
1372
+ return (_a = this._elementRef) === null || _a === void 0 ? void 0 : _a.nativeElement;
1373
+ }
1374
+ ngAfterViewInit() {
1375
+ // Update the styles after the DOM has loaded.
1376
+ this.updateStyles();
1377
+ }
1378
+ onWindowResize() {
1379
+ // Update the styles when the window is resized.
1380
+ this.updateStyles();
1381
+ }
1382
+ onInputReceived() {
1383
+ // Update the styles after the textarea received input.
1384
+ this.updateStyles();
1385
+ }
1386
+ updateStyles() {
1387
+ var _a, _b, _c;
1388
+ // Validate the element exists.
1389
+ if (!this.element) {
1390
+ return;
1391
+ }
1392
+ // Calculate border height which is not included in the scroll height.
1393
+ const borderHeight = ((_a = this.element) === null || _a === void 0 ? void 0 : _a.offsetHeight) - ((_b = this.element) === null || _b === void 0 ? void 0 : _b.clientHeight);
1394
+ // Reset textarea height to auto that correctly calculate the new height.
1395
+ this.setHeight('auto');
1396
+ // Set new height.
1397
+ this.setHeight(`${((_c = this.element) === null || _c === void 0 ? void 0 : _c.scrollHeight) + borderHeight}px`);
1398
+ }
1399
+ setHeight(value) {
1400
+ this._renderer.setStyle(this.element, 'height', value);
1401
+ }
1402
+ }
1403
+ BbAutosize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbAutosize, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1404
+ BbAutosize.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.6", type: BbAutosize, selector: "textarea[bbAutosize]", inputs: { minHeight: "minHeight", maxHeight: "maxHeight", rows: "rows" }, host: { listeners: { "window:resize": "onWindowResize()", "input": "onInputReceived()" }, properties: { "style.min-height": "this.minHeight", "style.max-height": "this.maxHeight", "rows": "this.rows" } }, ngImport: i0 });
1405
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbAutosize, decorators: [{
1406
+ type: Directive,
1407
+ args: [{
1408
+ selector: 'textarea[bbAutosize]'
1409
+ }]
1410
+ }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { minHeight: [{
1411
+ type: Input
1412
+ }, {
1413
+ type: HostBinding,
1414
+ args: ['style.min-height']
1415
+ }], maxHeight: [{
1416
+ type: Input
1417
+ }, {
1418
+ type: HostBinding,
1419
+ args: ['style.max-height']
1420
+ }], rows: [{
1421
+ type: Input
1422
+ }, {
1423
+ type: HostBinding,
1424
+ args: ['rows']
1425
+ }], onWindowResize: [{
1426
+ type: HostListener,
1427
+ args: ['window:resize']
1428
+ }], onInputReceived: [{
1429
+ type: HostListener,
1430
+ args: ['input']
1431
1431
  }] } });
1432
1432
 
1433
- class BbRelativeTime {
1434
- constructor(_localize, _localeId) {
1435
- this._localize = _localize;
1436
- this._localeId = _localeId;
1437
- this.isValidDate = (date) => {
1438
- return typeof date === 'object' &&
1439
- typeof date.getTime === 'function' &&
1440
- !isNaN(date.getTime());
1441
- };
1442
- this.parseAsDate = (value) => {
1443
- // Add a Z after the date so
1444
- // it is treated as a UTC date.
1445
- if (typeof value === 'string' && /^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/.test(value)) {
1446
- return new Date(`${value}Z`);
1447
- }
1448
- // Return the regular parsed date.
1449
- return new Date(value);
1450
- };
1451
- this.isToday = (date) => {
1452
- const today = new Date();
1453
- return (date === null || date === void 0 ? void 0 : date.getDate()) === (today === null || today === void 0 ? void 0 : today.getDate()) &&
1454
- (date === null || date === void 0 ? void 0 : date.getMonth()) === (today === null || today === void 0 ? void 0 : today.getMonth()) &&
1455
- (date === null || date === void 0 ? void 0 : date.getFullYear()) === (today === null || today === void 0 ? void 0 : today.getFullYear());
1456
- };
1457
- this.isYesterday = (date) => {
1458
- var _a, _b;
1459
- const yesterday = new Date((_a = new Date()) === null || _a === void 0 ? void 0 : _a.setDate(((_b = new Date()) === null || _b === void 0 ? void 0 : _b.getDate()) - 1));
1460
- return (date === null || date === void 0 ? void 0 : date.getDate()) === (yesterday === null || yesterday === void 0 ? void 0 : yesterday.getDate()) &&
1461
- (date === null || date === void 0 ? void 0 : date.getMonth()) === (yesterday === null || yesterday === void 0 ? void 0 : yesterday.getMonth()) &&
1462
- (date === null || date === void 0 ? void 0 : date.getFullYear()) === (yesterday === null || yesterday === void 0 ? void 0 : yesterday.getFullYear());
1463
- };
1464
- this.isTomorrow = (date) => {
1465
- var _a, _b;
1466
- const tomorrow = new Date((_a = new Date()) === null || _a === void 0 ? void 0 : _a.setDate(((_b = new Date()) === null || _b === void 0 ? void 0 : _b.getDate()) + 1));
1467
- return (date === null || date === void 0 ? void 0 : date.getDate()) === (tomorrow === null || tomorrow === void 0 ? void 0 : tomorrow.getDate()) &&
1468
- (date === null || date === void 0 ? void 0 : date.getMonth()) === (tomorrow === null || tomorrow === void 0 ? void 0 : tomorrow.getMonth()) &&
1469
- (date === null || date === void 0 ? void 0 : date.getFullYear()) === (tomorrow === null || tomorrow === void 0 ? void 0 : tomorrow.getFullYear());
1470
- };
1471
- this._datePipe = new DatePipe(this._localeId);
1472
- }
1473
- transform(value) {
1474
- // Parse the value to a date object.
1475
- const date = this.parseAsDate(value);
1476
- // Check if the date is valid.
1477
- if (!this.isValidDate(date)) {
1478
- return value;
1479
- }
1480
- // Return the formatted date.
1481
- return this.format(date);
1482
- }
1483
- format(date) {
1484
- // It happens tomorrow.
1485
- if (this.isTomorrow(date)) {
1486
- return this.formatString(date, 'times.tomorrow_at', 'shortTime');
1487
- }
1488
- // It happened today.
1489
- if (this.isToday(date)) {
1490
- return this.formatString(date, 'times.today_at', 'shortTime');
1491
- }
1492
- // It happened yesterday.
1493
- if (this.isYesterday(date)) {
1494
- return this.formatString(date, 'times.yesterday_at', 'shortTime');
1495
- }
1496
- // Just return the date.
1497
- return this.formatString(date);
1498
- }
1499
- formatString(date, token, format) {
1500
- // Just return the parsed date.
1501
- if (!this._localize || !token || !format) {
1502
- return this._datePipe.transform(date, 'mediumDate');
1503
- }
1504
- // Return the translated formatting.
1505
- return this._localize.translate({
1506
- token: token,
1507
- data: { date: this._datePipe.transform(date, format) }
1508
- });
1509
- }
1510
- }
1511
- BbRelativeTime.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbRelativeTime, deps: [{ token: i4.Localize, optional: true }, { token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Pipe });
1512
- BbRelativeTime.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbRelativeTime, name: "bbRelativeTime" });
1513
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbRelativeTime, decorators: [{
1514
- type: Pipe,
1515
- args: [{
1516
- name: 'bbRelativeTime'
1517
- }]
1518
- }], ctorParameters: function () {
1519
- return [{ type: i4.Localize, decorators: [{
1520
- type: Optional
1521
- }] }, { type: undefined, decorators: [{
1522
- type: Inject,
1523
- args: [LOCALE_ID]
1524
- }] }];
1433
+ class BbRelativeTime {
1434
+ constructor(_localize, _localeId) {
1435
+ this._localize = _localize;
1436
+ this._localeId = _localeId;
1437
+ this.isValidDate = (date) => {
1438
+ return typeof date === 'object' &&
1439
+ typeof date.getTime === 'function' &&
1440
+ !isNaN(date.getTime());
1441
+ };
1442
+ this.parseAsDate = (value) => {
1443
+ // Add a Z after the date so
1444
+ // it is treated as a UTC date.
1445
+ if (typeof value === 'string' && /^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/.test(value)) {
1446
+ return new Date(`${value}Z`);
1447
+ }
1448
+ // Return the regular parsed date.
1449
+ return new Date(value);
1450
+ };
1451
+ this.isToday = (date) => {
1452
+ const today = new Date();
1453
+ return (date === null || date === void 0 ? void 0 : date.getDate()) === (today === null || today === void 0 ? void 0 : today.getDate()) &&
1454
+ (date === null || date === void 0 ? void 0 : date.getMonth()) === (today === null || today === void 0 ? void 0 : today.getMonth()) &&
1455
+ (date === null || date === void 0 ? void 0 : date.getFullYear()) === (today === null || today === void 0 ? void 0 : today.getFullYear());
1456
+ };
1457
+ this.isYesterday = (date) => {
1458
+ var _a, _b;
1459
+ const yesterday = new Date((_a = new Date()) === null || _a === void 0 ? void 0 : _a.setDate(((_b = new Date()) === null || _b === void 0 ? void 0 : _b.getDate()) - 1));
1460
+ return (date === null || date === void 0 ? void 0 : date.getDate()) === (yesterday === null || yesterday === void 0 ? void 0 : yesterday.getDate()) &&
1461
+ (date === null || date === void 0 ? void 0 : date.getMonth()) === (yesterday === null || yesterday === void 0 ? void 0 : yesterday.getMonth()) &&
1462
+ (date === null || date === void 0 ? void 0 : date.getFullYear()) === (yesterday === null || yesterday === void 0 ? void 0 : yesterday.getFullYear());
1463
+ };
1464
+ this.isTomorrow = (date) => {
1465
+ var _a, _b;
1466
+ const tomorrow = new Date((_a = new Date()) === null || _a === void 0 ? void 0 : _a.setDate(((_b = new Date()) === null || _b === void 0 ? void 0 : _b.getDate()) + 1));
1467
+ return (date === null || date === void 0 ? void 0 : date.getDate()) === (tomorrow === null || tomorrow === void 0 ? void 0 : tomorrow.getDate()) &&
1468
+ (date === null || date === void 0 ? void 0 : date.getMonth()) === (tomorrow === null || tomorrow === void 0 ? void 0 : tomorrow.getMonth()) &&
1469
+ (date === null || date === void 0 ? void 0 : date.getFullYear()) === (tomorrow === null || tomorrow === void 0 ? void 0 : tomorrow.getFullYear());
1470
+ };
1471
+ this._datePipe = new DatePipe(this._localeId);
1472
+ }
1473
+ transform(value) {
1474
+ // Parse the value to a date object.
1475
+ const date = this.parseAsDate(value);
1476
+ // Check if the date is valid.
1477
+ if (!this.isValidDate(date)) {
1478
+ return value;
1479
+ }
1480
+ // Return the formatted date.
1481
+ return this.format(date);
1482
+ }
1483
+ format(date) {
1484
+ // It happens tomorrow.
1485
+ if (this.isTomorrow(date)) {
1486
+ return this.formatString(date, 'times.tomorrow_at', 'shortTime');
1487
+ }
1488
+ // It happened today.
1489
+ if (this.isToday(date)) {
1490
+ return this.formatString(date, 'times.today_at', 'shortTime');
1491
+ }
1492
+ // It happened yesterday.
1493
+ if (this.isYesterday(date)) {
1494
+ return this.formatString(date, 'times.yesterday_at', 'shortTime');
1495
+ }
1496
+ // Just return the date.
1497
+ return this.formatString(date);
1498
+ }
1499
+ formatString(date, token, format) {
1500
+ // Just return the parsed date.
1501
+ if (!this._localize || !token || !format) {
1502
+ return this._datePipe.transform(date, 'mediumDate');
1503
+ }
1504
+ // Return the translated formatting.
1505
+ return this._localize.translate({
1506
+ token: token,
1507
+ data: { date: this._datePipe.transform(date, format) }
1508
+ });
1509
+ }
1510
+ }
1511
+ BbRelativeTime.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbRelativeTime, deps: [{ token: i4.Localize, optional: true }, { token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Pipe });
1512
+ BbRelativeTime.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbRelativeTime, name: "bbRelativeTime" });
1513
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbRelativeTime, decorators: [{
1514
+ type: Pipe,
1515
+ args: [{
1516
+ name: 'bbRelativeTime'
1517
+ }]
1518
+ }], ctorParameters: function () {
1519
+ return [{ type: i4.Localize, decorators: [{
1520
+ type: Optional
1521
+ }] }, { type: undefined, decorators: [{
1522
+ type: Inject,
1523
+ args: [LOCALE_ID]
1524
+ }] }];
1525
1525
  } });
1526
1526
 
1527
- let nextUniqueId = 0;
1528
- class BbCheckboxBase {
1529
- }
1530
- const BbCheckboxMixinBase = mixinDisabled(mixinGrouped(BbCheckboxBase));
1531
- class BbCheckbox extends BbCheckboxMixinBase {
1532
- constructor(_changeDetection) {
1533
- super();
1534
- this._changeDetection = _changeDetection;
1535
- // Data.
1536
- this.labelId = `bb-checkbox-${nextUniqueId++}`;
1537
- this._checked = false;
1538
- // Methods.
1539
- this.onChange = () => {
1540
- };
1541
- this.onTouched = () => {
1542
- };
1543
- }
1544
- get checked() {
1545
- return this._checked;
1546
- }
1547
- set checked(value) {
1548
- this._checked = coerceBooleanProperty(value);
1549
- this._changeDetection.markForCheck();
1550
- }
1551
- registerOnChange(fn) {
1552
- this.onChange = fn;
1553
- }
1554
- registerOnTouched(fn) {
1555
- this.onTouched = fn;
1556
- }
1557
- setDisabledState(isDisabled) {
1558
- this.disabled = isDisabled;
1559
- this._changeDetection.markForCheck();
1560
- }
1561
- writeValue(newValue) {
1562
- this.checked = newValue;
1563
- }
1564
- onInteractionEvent(event) {
1565
- // Stop the propagation to prevent it from bubbling up.
1566
- event.stopPropagation();
1567
- }
1568
- onInputClick(event) {
1569
- // Stop the propagation to prevent it from bubbling up.
1570
- event.stopPropagation();
1571
- // Toggle the value.
1572
- this.checked = !this.checked;
1573
- // Emit the change event.
1574
- this.onChange && this.onChange(this.checked);
1575
- }
1576
- }
1577
- BbCheckbox.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbCheckbox, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1578
- BbCheckbox.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbCheckbox, selector: "bb-checkbox", inputs: { grouped: "grouped", disabled: "disabled", tabIndex: "tabIndex", checked: "checked" }, host: { properties: { "class.grouped": "grouped" }, classAttribute: "bb-checkbox" }, providers: [
1579
- { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbCheckbox), multi: true }
1580
- ], usesInheritance: true, ngImport: i0, template: "<input [id]=\"labelId\"\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n (change)=\"onInteractionEvent($event)\"\n (click)=\"onInputClick($event)\"\n class=\"bb-checkbox-input\"\n tabindex=\"-1\"\n type=\"checkbox\">\n\n<label [for]=\"labelId\"\n [attr.tabindex]=\"disabled ? -1 : (tabIndex || 0)\"\n (keyup.space)=\"onInputClick($event)\"\n class=\"bb-checkbox-label\">\n <span>\n <svg width=\"12px\"\n height=\"10px\"\n viewbox=\"0 0 12 10\">\n <polyline points=\"1.5 6 4.5 9 10.5 1\"></polyline>\n </svg>\n </span>\n <span>\n <ng-content></ng-content>\n </span>\n</label>\n", styles: [".bb-checkbox{display:block}.bb-checkbox+.bb-checkbox{margin-top:5px}.bb-checkbox.grouped{margin-bottom:20px}.bb-checkbox-input{display:none}.bb-checkbox-label{margin:0;display:flex;cursor:pointer;-webkit-user-select:none;user-select:none}.bb-checkbox-label>span{display:inline-block;vertical-align:middle;transform:translate(0)}.bb-checkbox-label>span:first-child{width:18px;height:18px;min-width:18px;min-height:18px;position:relative;border-radius:3px;vertical-align:middle;border:1px solid #bdc4c9;transition:all .2s ease}.bb-checkbox-label>span:last-child{padding-left:8px}.bb-checkbox-label>span:first-child>svg{top:3px;left:2px;fill:none;stroke:#fff;stroke-width:2;position:absolute;stroke-linecap:round;transition-delay:.1s;stroke-linejoin:round;stroke-dasharray:16px;stroke-dashoffset:16px;transition:all .3s ease;transform:translate(0)}.bb-checkbox-input:not(:disabled):not(:checked)+.bb-checkbox-label:focus>span:first-child{box-shadow:0 0 0 3px #decdcd80}.bb-checkbox-input:not(:disabled):checked+.bb-checkbox-label:focus>span:first-child{box-shadow:0 0 0 3px #5b53ff80}.bb-checkbox-input:checked+.bb-checkbox-label>span:first-child{border-color:#5b53ff;background-color:#5b53ff}.bb-checkbox-input:checked+.bb-checkbox-label>span:first-child>svg{stroke-dashoffset:0}.bb-checkbox-input:disabled+.bb-checkbox-label{cursor:default;pointer-events:none}.bb-checkbox-input:disabled:checked+.bb-checkbox-label>span:first-child{border-color:#cccccca3;background-color:#cccccca3}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1581
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbCheckbox, decorators: [{
1582
- type: Component,
1583
- args: [{ selector: 'bb-checkbox', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
1584
- { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbCheckbox), multi: true }
1585
- ], host: {
1586
- 'class': 'bb-checkbox',
1587
- '[class.grouped]': 'grouped'
1588
- }, inputs: ['grouped', 'disabled'], preserveWhitespaces: false, template: "<input [id]=\"labelId\"\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n (change)=\"onInteractionEvent($event)\"\n (click)=\"onInputClick($event)\"\n class=\"bb-checkbox-input\"\n tabindex=\"-1\"\n type=\"checkbox\">\n\n<label [for]=\"labelId\"\n [attr.tabindex]=\"disabled ? -1 : (tabIndex || 0)\"\n (keyup.space)=\"onInputClick($event)\"\n class=\"bb-checkbox-label\">\n <span>\n <svg width=\"12px\"\n height=\"10px\"\n viewbox=\"0 0 12 10\">\n <polyline points=\"1.5 6 4.5 9 10.5 1\"></polyline>\n </svg>\n </span>\n <span>\n <ng-content></ng-content>\n </span>\n</label>\n", styles: [".bb-checkbox{display:block}.bb-checkbox+.bb-checkbox{margin-top:5px}.bb-checkbox.grouped{margin-bottom:20px}.bb-checkbox-input{display:none}.bb-checkbox-label{margin:0;display:flex;cursor:pointer;-webkit-user-select:none;user-select:none}.bb-checkbox-label>span{display:inline-block;vertical-align:middle;transform:translate(0)}.bb-checkbox-label>span:first-child{width:18px;height:18px;min-width:18px;min-height:18px;position:relative;border-radius:3px;vertical-align:middle;border:1px solid #bdc4c9;transition:all .2s ease}.bb-checkbox-label>span:last-child{padding-left:8px}.bb-checkbox-label>span:first-child>svg{top:3px;left:2px;fill:none;stroke:#fff;stroke-width:2;position:absolute;stroke-linecap:round;transition-delay:.1s;stroke-linejoin:round;stroke-dasharray:16px;stroke-dashoffset:16px;transition:all .3s ease;transform:translate(0)}.bb-checkbox-input:not(:disabled):not(:checked)+.bb-checkbox-label:focus>span:first-child{box-shadow:0 0 0 3px #decdcd80}.bb-checkbox-input:not(:disabled):checked+.bb-checkbox-label:focus>span:first-child{box-shadow:0 0 0 3px #5b53ff80}.bb-checkbox-input:checked+.bb-checkbox-label>span:first-child{border-color:#5b53ff;background-color:#5b53ff}.bb-checkbox-input:checked+.bb-checkbox-label>span:first-child>svg{stroke-dashoffset:0}.bb-checkbox-input:disabled+.bb-checkbox-label{cursor:default;pointer-events:none}.bb-checkbox-input:disabled:checked+.bb-checkbox-label>span:first-child{border-color:#cccccca3;background-color:#cccccca3}\n"] }]
1589
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { tabIndex: [{
1590
- type: Input
1591
- }], checked: [{
1592
- type: Input
1527
+ let nextUniqueId = 0;
1528
+ class BbCheckboxBase {
1529
+ }
1530
+ const BbCheckboxMixinBase = mixinDisabled(mixinGrouped(BbCheckboxBase));
1531
+ class BbCheckbox extends BbCheckboxMixinBase {
1532
+ constructor(_changeDetection) {
1533
+ super();
1534
+ this._changeDetection = _changeDetection;
1535
+ // Data.
1536
+ this.labelId = `bb-checkbox-${nextUniqueId++}`;
1537
+ this._checked = false;
1538
+ // Methods.
1539
+ this.onChange = () => {
1540
+ };
1541
+ this.onTouched = () => {
1542
+ };
1543
+ }
1544
+ get checked() {
1545
+ return this._checked;
1546
+ }
1547
+ set checked(value) {
1548
+ this._checked = coerceBooleanProperty(value);
1549
+ this._changeDetection.markForCheck();
1550
+ }
1551
+ registerOnChange(fn) {
1552
+ this.onChange = fn;
1553
+ }
1554
+ registerOnTouched(fn) {
1555
+ this.onTouched = fn;
1556
+ }
1557
+ setDisabledState(isDisabled) {
1558
+ this.disabled = isDisabled;
1559
+ this._changeDetection.markForCheck();
1560
+ }
1561
+ writeValue(newValue) {
1562
+ this.checked = newValue;
1563
+ }
1564
+ onInteractionEvent(event) {
1565
+ // Stop the propagation to prevent it from bubbling up.
1566
+ event.stopPropagation();
1567
+ }
1568
+ onInputClick(event) {
1569
+ // Stop the propagation to prevent it from bubbling up.
1570
+ event.stopPropagation();
1571
+ // Toggle the value.
1572
+ this.checked = !this.checked;
1573
+ // Emit the change event.
1574
+ this.onChange && this.onChange(this.checked);
1575
+ }
1576
+ }
1577
+ BbCheckbox.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbCheckbox, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1578
+ BbCheckbox.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.6", type: BbCheckbox, selector: "bb-checkbox", inputs: { grouped: "grouped", disabled: "disabled", tabIndex: "tabIndex", checked: "checked" }, host: { properties: { "class.grouped": "grouped" }, classAttribute: "bb-checkbox" }, providers: [
1579
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbCheckbox), multi: true }
1580
+ ], usesInheritance: true, ngImport: i0, template: "<input [id]=\"labelId\"\r\n [checked]=\"checked\"\r\n [disabled]=\"disabled\"\r\n (change)=\"onInteractionEvent($event)\"\r\n (click)=\"onInputClick($event)\"\r\n class=\"bb-checkbox-input\"\r\n tabindex=\"-1\"\r\n type=\"checkbox\">\r\n\r\n<label [for]=\"labelId\"\r\n [attr.tabindex]=\"disabled ? -1 : (tabIndex || 0)\"\r\n (keyup.space)=\"onInputClick($event)\"\r\n class=\"bb-checkbox-label\">\r\n <span>\r\n <svg width=\"12px\"\r\n height=\"10px\"\r\n viewbox=\"0 0 12 10\">\r\n <polyline points=\"1.5 6 4.5 9 10.5 1\"></polyline>\r\n </svg>\r\n </span>\r\n <span>\r\n <ng-content></ng-content>\r\n </span>\r\n</label>\r\n", styles: [".bb-checkbox{display:block}.bb-checkbox+.bb-checkbox{margin-top:5px}.bb-checkbox.grouped{margin-bottom:20px}.bb-checkbox-input{display:none}.bb-checkbox-label{margin:0;display:flex;cursor:pointer;-webkit-user-select:none;user-select:none}.bb-checkbox-label>span{display:inline-block;vertical-align:middle;transform:translate(0)}.bb-checkbox-label>span:first-child{width:18px;height:18px;min-width:18px;min-height:18px;position:relative;border-radius:3px;vertical-align:middle;border:1px solid #bdc4c9;transition:all .2s ease}.bb-checkbox-label>span:last-child{padding-left:8px}.bb-checkbox-label>span:first-child>svg{top:3px;left:2px;fill:none;stroke:#fff;stroke-width:2;position:absolute;stroke-linecap:round;transition-delay:.1s;stroke-linejoin:round;stroke-dasharray:16px;stroke-dashoffset:16px;transition:all .3s ease;transform:translate(0)}.bb-checkbox-input:not(:disabled):not(:checked)+.bb-checkbox-label:focus>span:first-child{box-shadow:0 0 0 3px #decdcd80}.bb-checkbox-input:not(:disabled):checked+.bb-checkbox-label:focus>span:first-child{box-shadow:0 0 0 3px #5b53ff80}.bb-checkbox-input:checked+.bb-checkbox-label>span:first-child{border-color:#5b53ff;background-color:#5b53ff}.bb-checkbox-input:checked+.bb-checkbox-label>span:first-child>svg{stroke-dashoffset:0}.bb-checkbox-input:disabled+.bb-checkbox-label{cursor:default;pointer-events:none}.bb-checkbox-input:disabled:checked+.bb-checkbox-label>span:first-child{border-color:#cccccca3;background-color:#cccccca3}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1581
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbCheckbox, decorators: [{
1582
+ type: Component,
1583
+ args: [{ selector: 'bb-checkbox', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
1584
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbCheckbox), multi: true }
1585
+ ], host: {
1586
+ 'class': 'bb-checkbox',
1587
+ '[class.grouped]': 'grouped'
1588
+ }, inputs: ['grouped', 'disabled'], preserveWhitespaces: false, template: "<input [id]=\"labelId\"\r\n [checked]=\"checked\"\r\n [disabled]=\"disabled\"\r\n (change)=\"onInteractionEvent($event)\"\r\n (click)=\"onInputClick($event)\"\r\n class=\"bb-checkbox-input\"\r\n tabindex=\"-1\"\r\n type=\"checkbox\">\r\n\r\n<label [for]=\"labelId\"\r\n [attr.tabindex]=\"disabled ? -1 : (tabIndex || 0)\"\r\n (keyup.space)=\"onInputClick($event)\"\r\n class=\"bb-checkbox-label\">\r\n <span>\r\n <svg width=\"12px\"\r\n height=\"10px\"\r\n viewbox=\"0 0 12 10\">\r\n <polyline points=\"1.5 6 4.5 9 10.5 1\"></polyline>\r\n </svg>\r\n </span>\r\n <span>\r\n <ng-content></ng-content>\r\n </span>\r\n</label>\r\n", styles: [".bb-checkbox{display:block}.bb-checkbox+.bb-checkbox{margin-top:5px}.bb-checkbox.grouped{margin-bottom:20px}.bb-checkbox-input{display:none}.bb-checkbox-label{margin:0;display:flex;cursor:pointer;-webkit-user-select:none;user-select:none}.bb-checkbox-label>span{display:inline-block;vertical-align:middle;transform:translate(0)}.bb-checkbox-label>span:first-child{width:18px;height:18px;min-width:18px;min-height:18px;position:relative;border-radius:3px;vertical-align:middle;border:1px solid #bdc4c9;transition:all .2s ease}.bb-checkbox-label>span:last-child{padding-left:8px}.bb-checkbox-label>span:first-child>svg{top:3px;left:2px;fill:none;stroke:#fff;stroke-width:2;position:absolute;stroke-linecap:round;transition-delay:.1s;stroke-linejoin:round;stroke-dasharray:16px;stroke-dashoffset:16px;transition:all .3s ease;transform:translate(0)}.bb-checkbox-input:not(:disabled):not(:checked)+.bb-checkbox-label:focus>span:first-child{box-shadow:0 0 0 3px #decdcd80}.bb-checkbox-input:not(:disabled):checked+.bb-checkbox-label:focus>span:first-child{box-shadow:0 0 0 3px #5b53ff80}.bb-checkbox-input:checked+.bb-checkbox-label>span:first-child{border-color:#5b53ff;background-color:#5b53ff}.bb-checkbox-input:checked+.bb-checkbox-label>span:first-child>svg{stroke-dashoffset:0}.bb-checkbox-input:disabled+.bb-checkbox-label{cursor:default;pointer-events:none}.bb-checkbox-input:disabled:checked+.bb-checkbox-label>span:first-child{border-color:#cccccca3;background-color:#cccccca3}\n"] }]
1589
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { tabIndex: [{
1590
+ type: Input
1591
+ }], checked: [{
1592
+ type: Input
1593
1593
  }] } });
1594
1594
 
1595
- class BbFocus {
1596
- constructor(_zone, _platform, _elementRef) {
1597
- this._zone = _zone;
1598
- this._platform = _platform;
1599
- this._elementRef = _elementRef;
1600
- }
1601
- get nativeElement() {
1602
- return this._elementRef.nativeElement;
1603
- }
1604
- ngAfterViewInit() {
1605
- // Run the method outside the Angular zone.
1606
- this._zone.runOutsideAngular(() => this.focus());
1607
- }
1608
- focus() {
1609
- // Check if set timeout exists and the user is
1610
- // using the site on desktop devices.
1611
- if (!this._platform.isDesktop || !setTimeout) {
1612
- return;
1613
- }
1614
- // Check if the element and the focus method exist, if so focus the element.
1615
- if (!this.nativeElement || !this.nativeElement.focus) {
1616
- return;
1617
- }
1618
- // Execute the focus method in a timeout.
1619
- setTimeout(() => this.nativeElement.focus(), 0);
1620
- }
1621
- }
1622
- BbFocus.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFocus, deps: [{ token: i0.NgZone }, { token: i1$1.Platform }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1623
- BbFocus.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.0", type: BbFocus, selector: "[bbFocus]", ngImport: i0 });
1624
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFocus, decorators: [{
1625
- type: Directive,
1626
- args: [{
1627
- selector: '[bbFocus]'
1628
- }]
1595
+ class BbFocus {
1596
+ constructor(_zone, _platform, _elementRef) {
1597
+ this._zone = _zone;
1598
+ this._platform = _platform;
1599
+ this._elementRef = _elementRef;
1600
+ }
1601
+ get nativeElement() {
1602
+ return this._elementRef.nativeElement;
1603
+ }
1604
+ ngAfterViewInit() {
1605
+ // Run the method outside the Angular zone.
1606
+ this._zone.runOutsideAngular(() => this.focus());
1607
+ }
1608
+ focus() {
1609
+ // Check if set timeout exists and the user is
1610
+ // using the site on desktop devices.
1611
+ if (!this._platform.isDesktop || !setTimeout) {
1612
+ return;
1613
+ }
1614
+ // Check if the element and the focus method exist, if so focus the element.
1615
+ if (!this.nativeElement || !this.nativeElement.focus) {
1616
+ return;
1617
+ }
1618
+ // Execute the focus method in a timeout.
1619
+ setTimeout(() => this.nativeElement.focus(), 0);
1620
+ }
1621
+ }
1622
+ BbFocus.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbFocus, deps: [{ token: i0.NgZone }, { token: i1$1.Platform }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1623
+ BbFocus.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.6", type: BbFocus, selector: "[bbFocus]", ngImport: i0 });
1624
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbFocus, decorators: [{
1625
+ type: Directive,
1626
+ args: [{
1627
+ selector: '[bbFocus]'
1628
+ }]
1629
1629
  }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i1$1.Platform }, { type: i0.ElementRef }]; } });
1630
1630
 
1631
- class BbAvatar {
1632
- constructor() {
1633
- // Inputs.
1634
- this.size = 40;
1635
- // State.
1636
- this.state$ = new BehaviorSubject('initials');
1637
- // Data.
1638
- this._src = null;
1639
- this._title = null;
1640
- this._initials = '!';
1641
- this._color = 'rgb(255, 255, 255)';
1642
- this._backgroundColor = 'rgb(66, 66, 66)';
1643
- this.toRGb = (value) => {
1644
- const baseRed = 128;
1645
- const baseGreen = 128;
1646
- const baseBlue = 128;
1647
- let seed = value.charCodeAt(0) ^ value.charCodeAt(1);
1648
- const rand_1 = Math.abs((Math.sin(seed++) * 10000)) % 256;
1649
- const rand_2 = Math.abs((Math.sin(seed++) * 10000)) % 256;
1650
- const rand_3 = Math.abs((Math.sin(seed++) * 10000)) % 256;
1651
- const r = Math.round((rand_1 + baseRed) / 2);
1652
- const g = Math.round((rand_2 + baseGreen) / 2);
1653
- const b = Math.round((rand_3 + baseBlue) / 2);
1654
- return { r, g, b };
1655
- };
1656
- this.getInitials = (name) => {
1657
- // Get all the initials.
1658
- const names = (name || '').split(' ');
1659
- const initials = names.map(name => name.charAt(0).toUpperCase());
1660
- // Check if there are any initials.
1661
- if (initials.length <= 0) {
1662
- return null;
1663
- }
1664
- // Get the first and last initials.
1665
- if (initials.length > 1) {
1666
- return `${initials[0]}${initials[initials.length - 1]}`;
1667
- }
1668
- // Get only the first initial.
1669
- return initials[0];
1670
- };
1671
- this.parseColorFormat = (value) => {
1672
- var _a;
1673
- // Hex 3 values.
1674
- let match = value.match(/^#([0-9a-f]{3})$/i);
1675
- if (match && match[1]) {
1676
- const r = parseInt(match[1].charAt(0), 16) * 0x11;
1677
- const g = parseInt(match[1].charAt(1), 16) * 0x11;
1678
- const b = parseInt(match[1].charAt(2), 16) * 0x11;
1679
- return { r, g, b };
1680
- }
1681
- // Hex 6 values.
1682
- match = value.match(/^#([0-9a-f]{6})$/i);
1683
- if (match && match[1]) {
1684
- const r = parseInt(match[1].substr(0, 2), 16);
1685
- const g = parseInt(match[1].substr(2, 2), 16);
1686
- const b = parseInt(match[1].substr(4, 2), 16);
1687
- return { r, g, b };
1688
- }
1689
- // Rgb values.
1690
- match = value.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);
1691
- if (match) {
1692
- const r = parseInt(match[1], 10);
1693
- const g = parseInt(match[2], 10);
1694
- const b = parseInt(match[3], 10);
1695
- return { r, g, b };
1696
- }
1697
- // Not a supported color format.
1698
- (_a = console === null || console === void 0 ? void 0 : console.warn) === null || _a === void 0 ? void 0 : _a.call(console, `BbAvatar: Unsupported tintColor "${value}" was used.`);
1699
- return null;
1700
- };
1701
- }
1702
- set src(value) {
1703
- this._src = value;
1704
- if (this._src) {
1705
- this.state$.next('image');
1706
- }
1707
- }
1708
- set title(value) {
1709
- // Set the title and the initials.
1710
- this._title = value || '!';
1711
- this._initials = this.getInitials(this._title);
1712
- // Generate the colors based on the name.
1713
- const { r, g, b } = this.toRGb(this._title);
1714
- this.setColors(r, g, b);
1715
- }
1716
- set tintColor(value) {
1717
- const result = this.parseColorFormat(value);
1718
- if (!result) {
1719
- return;
1720
- }
1721
- const { r, g, b } = result;
1722
- this.setColors(r, g, b);
1723
- }
1724
- get src() {
1725
- return this._src;
1726
- }
1727
- get color() {
1728
- return this._color;
1729
- }
1730
- get backgroundColor() {
1731
- return this._backgroundColor;
1732
- }
1733
- get title() {
1734
- return this._title;
1735
- }
1736
- get initials() {
1737
- return this._initials;
1738
- }
1739
- setColors(red, green, blue) {
1740
- this._color = `rgb(${red},${green},${blue})`;
1741
- this._backgroundColor = `rgba(${red},${green},${blue}, 0.25)`;
1742
- }
1743
- }
1744
- BbAvatar.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbAvatar, deps: [], target: i0.ɵɵFactoryTarget.Component });
1745
- BbAvatar.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbAvatar, selector: "bb-avatar", inputs: { size: "size", src: "src", title: "title", tintColor: "tintColor" }, host: { attributes: { "role": "img" }, properties: { "style.width.px": "size", "style.height.px": "size", "style.font-size.px": "size / 2", "style.color": "color", "style.background-color": "backgroundColor", "attr.title": "this.title" }, classAttribute: "bb-avatar" }, ngImport: i0, template: "<ng-container [ngSwitch]=\"state$ | async\">\n <!-- Image. -->\n <ng-container *ngSwitchCase=\"'image'\">\n <img [src]=\"src\"\n [alt]=\"initials\"\n (error)=\"state$?.next('initials')\"\n class=\"bb-avatar-image\">\n </ng-container>\n\n <!-- Default initials fallback. -->\n <ng-container *ngSwitchDefault>\n {{ initials }}\n </ng-container>\n</ng-container>\n", styles: [".bb-avatar{line-height:1;font-size:18px;overflow:hidden;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;border-radius:50%;align-items:center;display:inline-flex;justify-content:center}.bb-avatar.rounded{border-radius:4px}.bb-avatar.square{border-radius:0}.bb-avatar-image{width:100%;height:100%;object-fit:cover;position:absolute}\n"], directives: [{ type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i1.NgSwitchDefault, selector: "[ngSwitchDefault]" }], pipes: { "async": i1.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1746
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbAvatar, decorators: [{
1747
- type: Component,
1748
- args: [{ selector: 'bb-avatar', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, host: {
1749
- 'class': 'bb-avatar',
1750
- 'role': 'img',
1751
- '[style.width.px]': 'size',
1752
- '[style.height.px]': 'size',
1753
- '[style.font-size.px]': 'size / 2',
1754
- '[style.color]': 'color',
1755
- '[style.background-color]': 'backgroundColor'
1756
- }, template: "<ng-container [ngSwitch]=\"state$ | async\">\n <!-- Image. -->\n <ng-container *ngSwitchCase=\"'image'\">\n <img [src]=\"src\"\n [alt]=\"initials\"\n (error)=\"state$?.next('initials')\"\n class=\"bb-avatar-image\">\n </ng-container>\n\n <!-- Default initials fallback. -->\n <ng-container *ngSwitchDefault>\n {{ initials }}\n </ng-container>\n</ng-container>\n", styles: [".bb-avatar{line-height:1;font-size:18px;overflow:hidden;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;border-radius:50%;align-items:center;display:inline-flex;justify-content:center}.bb-avatar.rounded{border-radius:4px}.bb-avatar.square{border-radius:0}.bb-avatar-image{width:100%;height:100%;object-fit:cover;position:absolute}\n"] }]
1757
- }], propDecorators: { size: [{
1758
- type: Input
1759
- }], src: [{
1760
- type: Input
1761
- }], title: [{
1762
- type: Input
1763
- }, {
1764
- type: HostBinding,
1765
- args: ['attr.title']
1766
- }], tintColor: [{
1767
- type: Input
1631
+ class BbAvatar {
1632
+ constructor() {
1633
+ // Inputs.
1634
+ this.size = 40;
1635
+ // State.
1636
+ this.state$ = new BehaviorSubject('initials');
1637
+ // Data.
1638
+ this._src = null;
1639
+ this._title = null;
1640
+ this._initials = '!';
1641
+ this._color = 'rgb(255, 255, 255)';
1642
+ this._backgroundColor = 'rgb(66, 66, 66)';
1643
+ this.toRGb = (value) => {
1644
+ const baseRed = 128;
1645
+ const baseGreen = 128;
1646
+ const baseBlue = 128;
1647
+ let seed = value.charCodeAt(0) ^ value.charCodeAt(1);
1648
+ const rand_1 = Math.abs((Math.sin(seed++) * 10000)) % 256;
1649
+ const rand_2 = Math.abs((Math.sin(seed++) * 10000)) % 256;
1650
+ const rand_3 = Math.abs((Math.sin(seed++) * 10000)) % 256;
1651
+ const r = Math.round((rand_1 + baseRed) / 2);
1652
+ const g = Math.round((rand_2 + baseGreen) / 2);
1653
+ const b = Math.round((rand_3 + baseBlue) / 2);
1654
+ return { r, g, b };
1655
+ };
1656
+ this.getInitials = (name) => {
1657
+ // Get all the initials.
1658
+ const names = (name || '').split(' ');
1659
+ const initials = names.map(name => name.charAt(0).toUpperCase());
1660
+ // Check if there are any initials.
1661
+ if (initials.length <= 0) {
1662
+ return null;
1663
+ }
1664
+ // Get the first and last initials.
1665
+ if (initials.length > 1) {
1666
+ return `${initials[0]}${initials[initials.length - 1]}`;
1667
+ }
1668
+ // Get only the first initial.
1669
+ return initials[0];
1670
+ };
1671
+ this.parseColorFormat = (value) => {
1672
+ var _a;
1673
+ if (!value) {
1674
+ return null;
1675
+ }
1676
+ // Hex 3 values.
1677
+ let match = value.match(/^#([0-9a-f]{3})$/i);
1678
+ if (match && match[1]) {
1679
+ const r = parseInt(match[1].charAt(0), 16) * 0x11;
1680
+ const g = parseInt(match[1].charAt(1), 16) * 0x11;
1681
+ const b = parseInt(match[1].charAt(2), 16) * 0x11;
1682
+ return { r, g, b };
1683
+ }
1684
+ // Hex 6 values.
1685
+ match = value.match(/^#([0-9a-f]{6})$/i);
1686
+ if (match && match[1]) {
1687
+ const r = parseInt(match[1].substr(0, 2), 16);
1688
+ const g = parseInt(match[1].substr(2, 2), 16);
1689
+ const b = parseInt(match[1].substr(4, 2), 16);
1690
+ return { r, g, b };
1691
+ }
1692
+ // Rgb values.
1693
+ match = value.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);
1694
+ if (match) {
1695
+ const r = parseInt(match[1], 10);
1696
+ const g = parseInt(match[2], 10);
1697
+ const b = parseInt(match[3], 10);
1698
+ return { r, g, b };
1699
+ }
1700
+ // Not a supported color format.
1701
+ (_a = console === null || console === void 0 ? void 0 : console.warn) === null || _a === void 0 ? void 0 : _a.call(console, `BbAvatar: Unsupported tintColor "${value}" was used.`);
1702
+ return null;
1703
+ };
1704
+ }
1705
+ set src(value) {
1706
+ this._src = value;
1707
+ if (this._src) {
1708
+ this.state$.next('image');
1709
+ }
1710
+ }
1711
+ set title(value) {
1712
+ // Set the title and the initials.
1713
+ this._title = value || '!';
1714
+ this._initials = this.getInitials(this._title);
1715
+ // Generate the colors based on the name.
1716
+ const { r, g, b } = this.toRGb(this._title);
1717
+ this.setColors(r, g, b);
1718
+ }
1719
+ set tintColor(value) {
1720
+ const result = this.parseColorFormat(value);
1721
+ if (!result) {
1722
+ return;
1723
+ }
1724
+ const { r, g, b } = result;
1725
+ this.setColors(r, g, b);
1726
+ }
1727
+ get src() {
1728
+ return this._src;
1729
+ }
1730
+ get color() {
1731
+ return this._color;
1732
+ }
1733
+ get backgroundColor() {
1734
+ return this._backgroundColor;
1735
+ }
1736
+ get title() {
1737
+ return this._title;
1738
+ }
1739
+ get initials() {
1740
+ return this._initials;
1741
+ }
1742
+ setColors(red, green, blue) {
1743
+ this._color = `rgb(${red},${green},${blue})`;
1744
+ this._backgroundColor = `rgba(${red},${green},${blue}, 0.25)`;
1745
+ }
1746
+ }
1747
+ BbAvatar.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbAvatar, deps: [], target: i0.ɵɵFactoryTarget.Component });
1748
+ BbAvatar.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.6", type: BbAvatar, selector: "bb-avatar", inputs: { size: "size", src: "src", title: "title", tintColor: "tintColor" }, host: { attributes: { "role": "img" }, properties: { "style.width.px": "size", "style.height.px": "size", "style.font-size.px": "size / 2", "style.color": "color", "style.background-color": "backgroundColor", "attr.title": "this.title" }, classAttribute: "bb-avatar" }, ngImport: i0, template: "<ng-container [ngSwitch]=\"state$ | async\">\r\n <!-- Image. -->\r\n <ng-container *ngSwitchCase=\"'image'\">\r\n <img [src]=\"src\"\r\n [alt]=\"initials\"\r\n (error)=\"state$?.next('initials')\"\r\n class=\"bb-avatar-image\">\r\n </ng-container>\r\n\r\n <!-- Default initials fallback. -->\r\n <ng-container *ngSwitchDefault>\r\n {{ initials }}\r\n </ng-container>\r\n</ng-container>\r\n", styles: [".bb-avatar{line-height:1;font-size:18px;overflow:hidden;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;border-radius:50%;align-items:center;display:inline-flex;justify-content:center}.bb-avatar.rounded{border-radius:4px}.bb-avatar.square{border-radius:0}.bb-avatar-image{width:100%;height:100%;object-fit:cover;position:absolute}\n"], directives: [{ type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i1.NgSwitchDefault, selector: "[ngSwitchDefault]" }], pipes: { "async": i1.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1749
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbAvatar, decorators: [{
1750
+ type: Component,
1751
+ args: [{ selector: 'bb-avatar', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, host: {
1752
+ 'class': 'bb-avatar',
1753
+ 'role': 'img',
1754
+ '[style.width.px]': 'size',
1755
+ '[style.height.px]': 'size',
1756
+ '[style.font-size.px]': 'size / 2',
1757
+ '[style.color]': 'color',
1758
+ '[style.background-color]': 'backgroundColor'
1759
+ }, template: "<ng-container [ngSwitch]=\"state$ | async\">\r\n <!-- Image. -->\r\n <ng-container *ngSwitchCase=\"'image'\">\r\n <img [src]=\"src\"\r\n [alt]=\"initials\"\r\n (error)=\"state$?.next('initials')\"\r\n class=\"bb-avatar-image\">\r\n </ng-container>\r\n\r\n <!-- Default initials fallback. -->\r\n <ng-container *ngSwitchDefault>\r\n {{ initials }}\r\n </ng-container>\r\n</ng-container>\r\n", styles: [".bb-avatar{line-height:1;font-size:18px;overflow:hidden;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;border-radius:50%;align-items:center;display:inline-flex;justify-content:center}.bb-avatar.rounded{border-radius:4px}.bb-avatar.square{border-radius:0}.bb-avatar-image{width:100%;height:100%;object-fit:cover;position:absolute}\n"] }]
1760
+ }], propDecorators: { size: [{
1761
+ type: Input
1762
+ }], src: [{
1763
+ type: Input
1764
+ }], title: [{
1765
+ type: Input
1766
+ }, {
1767
+ type: HostBinding,
1768
+ args: ['attr.title']
1769
+ }], tintColor: [{
1770
+ type: Input
1768
1771
  }] } });
1769
1772
 
1770
- class BbIcon {
1771
- constructor(_registry) {
1772
- this._registry = _registry;
1773
- // Data.
1774
- this._src = null;
1775
- // State.
1776
- this.state$ = new BehaviorSubject(null);
1777
- this.alt = null;
1778
- this.size = 24;
1779
- this._ariaHidden = true;
1780
- this.warn = (content) => {
1781
- return console && console.warn && console.warn(content);
1782
- };
1783
- }
1784
- set src(newValue) {
1785
- this.state$.next(this.convert(newValue));
1786
- this._src = newValue;
1787
- }
1788
- get src() {
1789
- return this._src;
1790
- }
1791
- set ariaHidden(newValue) {
1792
- this._ariaHidden = coerceBooleanProperty(newValue);
1793
- }
1794
- get ariaHidden() {
1795
- return this._ariaHidden;
1796
- }
1797
- convert(src) {
1798
- const [namespace, value] = (src || '').split(':');
1799
- const onError = () => {
1800
- this.warn(`ElementsModule: The icon with src "${src}" could not be rendered correctly; Did you put a correct src attribute?`);
1801
- return { type: 'unknown' };
1802
- };
1803
- if (!namespace || !value || !this._registry) {
1804
- return onError();
1805
- }
1806
- // Try to find a image icon.
1807
- const imageIcon = this.findImageIcon(namespace, value);
1808
- if (imageIcon) {
1809
- return imageIcon;
1810
- }
1811
- // Try to find a font icon.
1812
- const fontIcon = this.findFontIcon(namespace, value);
1813
- if (fontIcon) {
1814
- return fontIcon;
1815
- }
1816
- // Return the on error function.
1817
- return onError();
1818
- }
1819
- findImageIcon(namespace, value) {
1820
- const data = this._registry.find(item => item['namespace'] === namespace && item['name'] === value);
1821
- if (!data) {
1822
- return null;
1823
- }
1824
- return { type: data['type'], src: data['src'] };
1825
- }
1826
- findFontIcon(namespace, content) {
1827
- const data = this._registry.find(item => item['namespace'] === namespace);
1828
- if (!data) {
1829
- return null;
1830
- }
1831
- const uses = data['uses'];
1832
- if (uses === 'data-attribute') {
1833
- return { type: data['type'], className: data['className'], attribute: content };
1834
- }
1835
- return { type: data['type'], className: data['className'], content };
1836
- }
1837
- }
1838
- BbIcon.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbIcon, deps: [{ token: ELEMENTS_ICONS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1839
- BbIcon.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbIcon, selector: "bb-icon", inputs: { alt: "alt", size: "size", src: "src", ariaHidden: "ariaHidden" }, host: { properties: { "attr.aria-hidden": "ariaHidden", "style.width.px": "size", "style.height.px": "size", "style.min-width.px": "size", "style.min-height.px": "size", "style.font-size.px": "size" }, classAttribute: "bb-icon" }, ngImport: i0, template: "<ng-container *ngIf=\"state$ | async as data\"\n [ngSwitch]=\"data?.type\">\n <i *ngSwitchCase=\"'font'\"\n [attr.data-icon]=\"data?.attribute\"\n [class]=\"data?.className\">\n {{ data?.content }}\n </i>\n <img *ngSwitchCase=\"'image'\"\n [src]=\"data?.src\"\n [alt]=\"alt\">\n <svg *ngSwitchCase=\"'unknown'\"\n viewBox=\"0 0 1 1\">\n <rect x=\"0\" y=\"0\" width=\"1\" height=\"1\" fill=\"#c5c5c5\"></rect>\n </svg>\n</ng-container>\n", styles: [".bb-icon{display:flex;-webkit-user-select:none;user-select:none;align-items:center;justify-content:center}.bb-icon>i{font-size:inherit}.bb-icon>img,.bb-icon>svg{width:100%;height:100%;display:flex}\n"], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }], pipes: { "async": i1.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1840
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbIcon, decorators: [{
1841
- type: Component,
1842
- args: [{ selector: 'bb-icon', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
1843
- 'class': 'bb-icon',
1844
- '[attr.aria-hidden]': 'ariaHidden',
1845
- '[style.width.px]': 'size',
1846
- '[style.height.px]': 'size',
1847
- '[style.min-width.px]': 'size',
1848
- '[style.min-height.px]': 'size',
1849
- '[style.font-size.px]': 'size'
1850
- }, preserveWhitespaces: false, template: "<ng-container *ngIf=\"state$ | async as data\"\n [ngSwitch]=\"data?.type\">\n <i *ngSwitchCase=\"'font'\"\n [attr.data-icon]=\"data?.attribute\"\n [class]=\"data?.className\">\n {{ data?.content }}\n </i>\n <img *ngSwitchCase=\"'image'\"\n [src]=\"data?.src\"\n [alt]=\"alt\">\n <svg *ngSwitchCase=\"'unknown'\"\n viewBox=\"0 0 1 1\">\n <rect x=\"0\" y=\"0\" width=\"1\" height=\"1\" fill=\"#c5c5c5\"></rect>\n </svg>\n</ng-container>\n", styles: [".bb-icon{display:flex;-webkit-user-select:none;user-select:none;align-items:center;justify-content:center}.bb-icon>i{font-size:inherit}.bb-icon>img,.bb-icon>svg{width:100%;height:100%;display:flex}\n"] }]
1851
- }], ctorParameters: function () {
1852
- return [{ type: undefined, decorators: [{
1853
- type: Optional
1854
- }, {
1855
- type: Inject,
1856
- args: [ELEMENTS_ICONS]
1857
- }] }];
1858
- }, propDecorators: { alt: [{
1859
- type: Input
1860
- }], size: [{
1861
- type: Input
1862
- }], src: [{
1863
- type: Input
1864
- }], ariaHidden: [{
1865
- type: Input
1773
+ class BbIcon {
1774
+ constructor(_registry) {
1775
+ this._registry = _registry;
1776
+ // Data.
1777
+ this._src = null;
1778
+ // State.
1779
+ this.state$ = new BehaviorSubject(null);
1780
+ this.alt = null;
1781
+ this.size = 24;
1782
+ this._ariaHidden = true;
1783
+ this.warn = (content) => {
1784
+ return console && console.warn && console.warn(content);
1785
+ };
1786
+ }
1787
+ set src(newValue) {
1788
+ this.state$.next(this.convert(newValue));
1789
+ this._src = newValue;
1790
+ }
1791
+ get src() {
1792
+ return this._src;
1793
+ }
1794
+ set ariaHidden(newValue) {
1795
+ this._ariaHidden = coerceBooleanProperty(newValue);
1796
+ }
1797
+ get ariaHidden() {
1798
+ return this._ariaHidden;
1799
+ }
1800
+ convert(src) {
1801
+ const [namespace, value] = (src || '').split(':');
1802
+ const onError = () => {
1803
+ this.warn(`ElementsModule: The icon with src "${src}" could not be rendered correctly; Did you put a correct src attribute?`);
1804
+ return { type: 'unknown' };
1805
+ };
1806
+ if (!namespace || !value || !this._registry) {
1807
+ return onError();
1808
+ }
1809
+ // Try to find a image icon.
1810
+ const imageIcon = this.findImageIcon(namespace, value);
1811
+ if (imageIcon) {
1812
+ return imageIcon;
1813
+ }
1814
+ // Try to find a font icon.
1815
+ const fontIcon = this.findFontIcon(namespace, value);
1816
+ if (fontIcon) {
1817
+ return fontIcon;
1818
+ }
1819
+ // Return the on error function.
1820
+ return onError();
1821
+ }
1822
+ findImageIcon(namespace, value) {
1823
+ const data = this._registry.find(item => item['namespace'] === namespace && item['name'] === value);
1824
+ if (!data) {
1825
+ return null;
1826
+ }
1827
+ return { type: data['type'], src: data['src'] };
1828
+ }
1829
+ findFontIcon(namespace, content) {
1830
+ const data = this._registry.find(item => item['namespace'] === namespace);
1831
+ if (!data) {
1832
+ return null;
1833
+ }
1834
+ const uses = data['uses'];
1835
+ if (uses === 'data-attribute') {
1836
+ return { type: data['type'], className: data['className'], attribute: content };
1837
+ }
1838
+ return { type: data['type'], className: data['className'], content };
1839
+ }
1840
+ }
1841
+ BbIcon.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbIcon, deps: [{ token: ELEMENTS_ICONS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1842
+ BbIcon.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.6", type: BbIcon, selector: "bb-icon", inputs: { alt: "alt", size: "size", src: "src", ariaHidden: "ariaHidden" }, host: { properties: { "attr.aria-hidden": "ariaHidden", "style.width.px": "size", "style.height.px": "size", "style.min-width.px": "size", "style.min-height.px": "size", "style.font-size.px": "size" }, classAttribute: "bb-icon" }, ngImport: i0, template: "<ng-container *ngIf=\"state$ | async as data\"\r\n [ngSwitch]=\"data?.type\">\r\n <i *ngSwitchCase=\"'font'\"\r\n [attr.data-icon]=\"data?.attribute\"\r\n [class]=\"data?.className\">\r\n {{ data?.content }}\r\n </i>\r\n <img *ngSwitchCase=\"'image'\"\r\n [src]=\"data?.src\"\r\n [alt]=\"alt\">\r\n <svg *ngSwitchCase=\"'unknown'\"\r\n viewBox=\"0 0 1 1\">\r\n <rect x=\"0\" y=\"0\" width=\"1\" height=\"1\" fill=\"#c5c5c5\"></rect>\r\n </svg>\r\n</ng-container>\r\n", styles: [".bb-icon{display:flex;-webkit-user-select:none;user-select:none;align-items:center;justify-content:center}.bb-icon>i{font-size:inherit}.bb-icon>img,.bb-icon>svg{width:100%;height:100%;display:flex}\n"], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }], pipes: { "async": i1.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1843
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbIcon, decorators: [{
1844
+ type: Component,
1845
+ args: [{ selector: 'bb-icon', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
1846
+ 'class': 'bb-icon',
1847
+ '[attr.aria-hidden]': 'ariaHidden',
1848
+ '[style.width.px]': 'size',
1849
+ '[style.height.px]': 'size',
1850
+ '[style.min-width.px]': 'size',
1851
+ '[style.min-height.px]': 'size',
1852
+ '[style.font-size.px]': 'size'
1853
+ }, preserveWhitespaces: false, template: "<ng-container *ngIf=\"state$ | async as data\"\r\n [ngSwitch]=\"data?.type\">\r\n <i *ngSwitchCase=\"'font'\"\r\n [attr.data-icon]=\"data?.attribute\"\r\n [class]=\"data?.className\">\r\n {{ data?.content }}\r\n </i>\r\n <img *ngSwitchCase=\"'image'\"\r\n [src]=\"data?.src\"\r\n [alt]=\"alt\">\r\n <svg *ngSwitchCase=\"'unknown'\"\r\n viewBox=\"0 0 1 1\">\r\n <rect x=\"0\" y=\"0\" width=\"1\" height=\"1\" fill=\"#c5c5c5\"></rect>\r\n </svg>\r\n</ng-container>\r\n", styles: [".bb-icon{display:flex;-webkit-user-select:none;user-select:none;align-items:center;justify-content:center}.bb-icon>i{font-size:inherit}.bb-icon>img,.bb-icon>svg{width:100%;height:100%;display:flex}\n"] }]
1854
+ }], ctorParameters: function () {
1855
+ return [{ type: undefined, decorators: [{
1856
+ type: Optional
1857
+ }, {
1858
+ type: Inject,
1859
+ args: [ELEMENTS_ICONS]
1860
+ }] }];
1861
+ }, propDecorators: { alt: [{
1862
+ type: Input
1863
+ }], size: [{
1864
+ type: Input
1865
+ }], src: [{
1866
+ type: Input
1867
+ }], ariaHidden: [{
1868
+ type: Input
1866
1869
  }] } });
1867
1870
 
1868
- class BbTag {
1869
- constructor() {
1870
- // Outputs.
1871
- this.onClose = new EventEmitter();
1872
- }
1873
- }
1874
- BbTag.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbTag, deps: [], target: i0.ɵɵFactoryTarget.Component });
1875
- BbTag.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbTag, selector: "bb-tag", outputs: { onClose: "onClose" }, host: { classAttribute: "bb-tag" }, ngImport: i0, template: "<ng-content></ng-content>\n\n<button *ngIf=\"onClose?.observers?.length > 0\"\n (click)=\"onClose.emit()\"\n type=\"button\">\n Close\n</button>", styles: [".bb-tag{cursor:default;padding:0 7px;font-size:12px;list-style:none;line-height:20px;border-radius:4px;white-space:nowrap;display:inline-block;color:#000000a6;border:1px solid #d9d9d9;background-color:#fafafa;font-variant:tabular-nums;font-feature-settings:\"tnum\"}.bb-tag:not(:last-child){margin-right:8px}\n"], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1876
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbTag, decorators: [{
1877
- type: Component,
1878
- args: [{ selector: 'bb-tag', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, host: { 'class': 'bb-tag' }, template: "<ng-content></ng-content>\n\n<button *ngIf=\"onClose?.observers?.length > 0\"\n (click)=\"onClose.emit()\"\n type=\"button\">\n Close\n</button>", styles: [".bb-tag{cursor:default;padding:0 7px;font-size:12px;list-style:none;line-height:20px;border-radius:4px;white-space:nowrap;display:inline-block;color:#000000a6;border:1px solid #d9d9d9;background-color:#fafafa;font-variant:tabular-nums;font-feature-settings:\"tnum\"}.bb-tag:not(:last-child){margin-right:8px}\n"] }]
1879
- }], propDecorators: { onClose: [{
1880
- type: Output
1871
+ class BbTag {
1872
+ constructor() {
1873
+ // Outputs.
1874
+ this.onClose = new EventEmitter();
1875
+ }
1876
+ }
1877
+ BbTag.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbTag, deps: [], target: i0.ɵɵFactoryTarget.Component });
1878
+ BbTag.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.6", type: BbTag, selector: "bb-tag", outputs: { onClose: "onClose" }, host: { classAttribute: "bb-tag" }, ngImport: i0, template: "<ng-content></ng-content>\r\n\r\n<button *ngIf=\"onClose?.observed\"\r\n (click)=\"onClose.emit()\"\r\n type=\"button\">\r\n Close\r\n</button>", styles: [".bb-tag{cursor:default;padding:0 7px;font-size:12px;list-style:none;line-height:20px;border-radius:4px;white-space:nowrap;display:inline-block;color:#000000a6;border:1px solid #d9d9d9;background-color:#fafafa;font-variant:tabular-nums;font-feature-settings:\"tnum\"}.bb-tag:not(:last-child){margin-right:8px}\n"], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1879
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbTag, decorators: [{
1880
+ type: Component,
1881
+ args: [{ selector: 'bb-tag', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, host: { 'class': 'bb-tag' }, template: "<ng-content></ng-content>\r\n\r\n<button *ngIf=\"onClose?.observed\"\r\n (click)=\"onClose.emit()\"\r\n type=\"button\">\r\n Close\r\n</button>", styles: [".bb-tag{cursor:default;padding:0 7px;font-size:12px;list-style:none;line-height:20px;border-radius:4px;white-space:nowrap;display:inline-block;color:#000000a6;border:1px solid #d9d9d9;background-color:#fafafa;font-variant:tabular-nums;font-feature-settings:\"tnum\"}.bb-tag:not(:last-child){margin-right:8px}\n"] }]
1882
+ }], propDecorators: { onClose: [{
1883
+ type: Output
1881
1884
  }] } });
1882
1885
 
1883
- const DECLARATIONS_EXPORTS = [
1884
- // Directives.
1885
- BbTemplate,
1886
- BbFormError,
1887
- BbFormSubmit,
1888
- BbInput,
1889
- BbSelect,
1890
- BbFocus,
1891
- BbFocusTrap,
1892
- BbAutosize,
1893
- BbPrefix,
1894
- BbSuffix,
1895
- // Pipes.
1896
- BbFileSize,
1897
- BbFileImage,
1898
- BbRelativeTime,
1899
- // Components.
1900
- BbButton,
1901
- BbAnchor,
1902
- BbSpinner,
1903
- BbIcon,
1904
- BbFormControl,
1905
- BbFormGroup,
1906
- BbCheckbox,
1907
- BbDropdown,
1908
- BbDropdownItem,
1909
- BbTag,
1910
- BbAvatar,
1911
- BbFilePicker,
1912
- BbImagePicker,
1913
- BbDatePicker
1914
- ];
1915
- class ElementsModule {
1916
- static forRoot() {
1917
- return {
1918
- ngModule: ElementsModule,
1919
- providers: [
1920
- { provide: ELEMENTS_ERRORS, useFactory: getErrors, multi: true },
1921
- ELEMENTS_MATERIAL_ICON
1922
- ]
1923
- };
1924
- }
1925
- }
1926
- ElementsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: ElementsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1927
- ElementsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: ElementsModule, declarations: [
1928
- // Directives.
1929
- BbTemplate,
1930
- BbFormError,
1931
- BbFormSubmit,
1932
- BbInput,
1933
- BbSelect,
1934
- BbFocus,
1935
- BbFocusTrap,
1936
- BbAutosize,
1937
- BbPrefix,
1938
- BbSuffix,
1939
- // Pipes.
1940
- BbFileSize,
1941
- BbFileImage,
1942
- BbRelativeTime,
1943
- // Components.
1944
- BbButton,
1945
- BbAnchor,
1946
- BbSpinner,
1947
- BbIcon,
1948
- BbFormControl,
1949
- BbFormGroup,
1950
- BbCheckbox,
1951
- BbDropdown,
1952
- BbDropdownItem,
1953
- BbTag,
1954
- BbAvatar,
1955
- BbFilePicker,
1956
- BbImagePicker,
1957
- BbDatePicker
1958
- ], imports: [CommonModule, ReactiveFormsModule, LocalizeModule], exports: [
1959
- // Directives.
1960
- BbTemplate,
1961
- BbFormError,
1962
- BbFormSubmit,
1963
- BbInput,
1964
- BbSelect,
1965
- BbFocus,
1966
- BbFocusTrap,
1967
- BbAutosize,
1968
- BbPrefix,
1969
- BbSuffix,
1970
- // Pipes.
1971
- BbFileSize,
1972
- BbFileImage,
1973
- BbRelativeTime,
1974
- // Components.
1975
- BbButton,
1976
- BbAnchor,
1977
- BbSpinner,
1978
- BbIcon,
1979
- BbFormControl,
1980
- BbFormGroup,
1981
- BbCheckbox,
1982
- BbDropdown,
1983
- BbDropdownItem,
1984
- BbTag,
1985
- BbAvatar,
1986
- BbFilePicker,
1987
- BbImagePicker,
1988
- BbDatePicker
1989
- ] });
1990
- ElementsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: ElementsModule, imports: [[CommonModule, ReactiveFormsModule, LocalizeModule]] });
1991
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: ElementsModule, decorators: [{
1992
- type: NgModule,
1993
- args: [{
1994
- imports: [CommonModule, ReactiveFormsModule, LocalizeModule],
1995
- declarations: [...DECLARATIONS_EXPORTS],
1996
- exports: [...DECLARATIONS_EXPORTS]
1997
- }]
1998
- }] });
1999
- const ELEMENTS_MATERIAL_ICON = {
2000
- provide: ELEMENTS_ICONS,
2001
- useValue: { namespace: 'material', className: 'material-icons', uses: 'content', type: 'font' },
2002
- multi: true
2003
- };
2004
- function getErrors() {
2005
- const data = {
2006
- unknown: () => 'form-control-errors.unknown',
2007
- required: () => 'form-control-errors.required',
2008
- pattern: () => 'form-control-errors.pattern',
2009
- email: () => 'form-control-errors.email',
2010
- emailTaken: () => 'form-control-errors.emailTaken',
2011
- passwordMatch: () => 'form-control-errors.passwordMatch',
2012
- confirm: () => 'form-control-errors.confirm',
2013
- fullNumber: () => 'form-control-errors.fullNumber',
2014
- min: ({ min }) => ({ token: 'form-control-errors.min', data: { min } }),
2015
- max: ({ max }) => ({ token: 'form-control-errors.max', data: { max } }),
2016
- maxFileSize: ({ maxSize }) => ({ token: 'form-control-errors.maxFileSize', data: { maxSize } }),
2017
- minDate: ({ date }) => ({ token: 'form-control-errors.minDate', data: { date } }),
2018
- maxDate: ({ date }) => ({ token: 'form-control-errors.maxDate', data: { date } }),
2019
- invalidDate: () => 'form-control-errors.invalidDate',
2020
- invalidFileType: () => 'form-control-errors.invalidFileType',
2021
- minlength: ({ requiredLength, actualLength }) => ({
2022
- token: 'form-control-errors.minlength',
2023
- data: { requiredLength, actualLength }
2024
- }),
2025
- maxlength: ({ requiredLength, actualLength }) => ({
2026
- token: 'form-control-errors.maxlength',
2027
- data: { requiredLength, actualLength }
2028
- })
2029
- };
2030
- return data;
1886
+ const DECLARATIONS_EXPORTS = [
1887
+ // Directives.
1888
+ BbTemplate,
1889
+ BbFormError,
1890
+ BbFormSubmit,
1891
+ BbInput,
1892
+ BbSelect,
1893
+ BbFocus,
1894
+ BbFocusTrap,
1895
+ BbAutosize,
1896
+ BbPrefix,
1897
+ BbSuffix,
1898
+ // Pipes.
1899
+ BbFileSize,
1900
+ BbFileImage,
1901
+ BbRelativeTime,
1902
+ // Components.
1903
+ BbButton,
1904
+ BbAnchor,
1905
+ BbSpinner,
1906
+ BbIcon,
1907
+ BbFormControl,
1908
+ BbFormGroup,
1909
+ BbCheckbox,
1910
+ BbDropdown,
1911
+ BbDropdownItem,
1912
+ BbTag,
1913
+ BbAvatar,
1914
+ BbFilePicker,
1915
+ BbImagePicker,
1916
+ BbDatePicker
1917
+ ];
1918
+ class ElementsModule {
1919
+ static forRoot() {
1920
+ return {
1921
+ ngModule: ElementsModule,
1922
+ providers: [
1923
+ { provide: ELEMENTS_ERRORS, useFactory: getErrors, multi: true },
1924
+ ELEMENTS_MATERIAL_ICON
1925
+ ]
1926
+ };
1927
+ }
1928
+ }
1929
+ ElementsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: ElementsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1930
+ ElementsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: ElementsModule, declarations: [
1931
+ // Directives.
1932
+ BbTemplate,
1933
+ BbFormError,
1934
+ BbFormSubmit,
1935
+ BbInput,
1936
+ BbSelect,
1937
+ BbFocus,
1938
+ BbFocusTrap,
1939
+ BbAutosize,
1940
+ BbPrefix,
1941
+ BbSuffix,
1942
+ // Pipes.
1943
+ BbFileSize,
1944
+ BbFileImage,
1945
+ BbRelativeTime,
1946
+ // Components.
1947
+ BbButton,
1948
+ BbAnchor,
1949
+ BbSpinner,
1950
+ BbIcon,
1951
+ BbFormControl,
1952
+ BbFormGroup,
1953
+ BbCheckbox,
1954
+ BbDropdown,
1955
+ BbDropdownItem,
1956
+ BbTag,
1957
+ BbAvatar,
1958
+ BbFilePicker,
1959
+ BbImagePicker,
1960
+ BbDatePicker
1961
+ ], imports: [CommonModule, ReactiveFormsModule, LocalizeModule], exports: [
1962
+ // Directives.
1963
+ BbTemplate,
1964
+ BbFormError,
1965
+ BbFormSubmit,
1966
+ BbInput,
1967
+ BbSelect,
1968
+ BbFocus,
1969
+ BbFocusTrap,
1970
+ BbAutosize,
1971
+ BbPrefix,
1972
+ BbSuffix,
1973
+ // Pipes.
1974
+ BbFileSize,
1975
+ BbFileImage,
1976
+ BbRelativeTime,
1977
+ // Components.
1978
+ BbButton,
1979
+ BbAnchor,
1980
+ BbSpinner,
1981
+ BbIcon,
1982
+ BbFormControl,
1983
+ BbFormGroup,
1984
+ BbCheckbox,
1985
+ BbDropdown,
1986
+ BbDropdownItem,
1987
+ BbTag,
1988
+ BbAvatar,
1989
+ BbFilePicker,
1990
+ BbImagePicker,
1991
+ BbDatePicker
1992
+ ] });
1993
+ ElementsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: ElementsModule, imports: [[CommonModule, ReactiveFormsModule, LocalizeModule]] });
1994
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: ElementsModule, decorators: [{
1995
+ type: NgModule,
1996
+ args: [{
1997
+ imports: [CommonModule, ReactiveFormsModule, LocalizeModule],
1998
+ declarations: [...DECLARATIONS_EXPORTS],
1999
+ exports: [...DECLARATIONS_EXPORTS]
2000
+ }]
2001
+ }] });
2002
+ const ELEMENTS_MATERIAL_ICON = {
2003
+ provide: ELEMENTS_ICONS,
2004
+ useValue: { namespace: 'material', className: 'material-icons', uses: 'content', type: 'font' },
2005
+ multi: true
2006
+ };
2007
+ function getErrors() {
2008
+ const data = {
2009
+ unknown: () => 'form-control-errors.unknown',
2010
+ required: () => 'form-control-errors.required',
2011
+ pattern: () => 'form-control-errors.pattern',
2012
+ email: () => 'form-control-errors.email',
2013
+ emailTaken: () => 'form-control-errors.emailTaken',
2014
+ passwordMatch: () => 'form-control-errors.passwordMatch',
2015
+ confirm: () => 'form-control-errors.confirm',
2016
+ fullNumber: () => 'form-control-errors.fullNumber',
2017
+ min: ({ min }) => ({ token: 'form-control-errors.min', data: { min } }),
2018
+ max: ({ max }) => ({ token: 'form-control-errors.max', data: { max } }),
2019
+ maxFileSize: ({ maxSize }) => ({ token: 'form-control-errors.maxFileSize', data: { maxSize } }),
2020
+ minDate: ({ date }) => ({ token: 'form-control-errors.minDate', data: { date } }),
2021
+ maxDate: ({ date }) => ({ token: 'form-control-errors.maxDate', data: { date } }),
2022
+ invalidDate: () => 'form-control-errors.invalidDate',
2023
+ invalidFileType: () => 'form-control-errors.invalidFileType',
2024
+ minlength: ({ requiredLength, actualLength }) => ({
2025
+ token: 'form-control-errors.minlength',
2026
+ data: { requiredLength, actualLength }
2027
+ }),
2028
+ maxlength: ({ requiredLength, actualLength }) => ({
2029
+ token: 'form-control-errors.maxlength',
2030
+ data: { requiredLength, actualLength }
2031
+ })
2032
+ };
2033
+ return data;
2031
2034
  }
2032
2035
 
2033
- /**
2034
- * Generated bundle index. Do not edit.
2036
+ /**
2037
+ * Generated bundle index. Do not edit.
2035
2038
  */
2036
2039
 
2037
2040
  export { BbAnchor, BbAutosize, BbAvatar, BbButton, BbCheckbox, BbDatePicker, BbDropdown, BbDropdownItem, BbFileImage, BbFilePicker, BbFileSize, BbFocus, BbFocusTrap, BbFormControl, BbFormError, BbFormGroup, BbFormSubmit, BbIcon, BbImagePicker, BbInput, BbPrefix, BbRelativeTime, BbSelect, BbSpinner, BbSuffix, BbTag, BbTemplate, ELEMENTS_ERRORS, ELEMENTS_ICONS, ELEMENTS_MATERIAL_ICON, ElementsModule, getErrors };