@bravobit/bb-foundation 0.14.3 → 0.15.2

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 (413) 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/bundles/bravobit-bb-foundation-auth.umd.js +1400 -1402
  25. package/bundles/bravobit-bb-foundation-auth.umd.js.map +1 -1
  26. package/bundles/bravobit-bb-foundation-collections.umd.js +868 -0
  27. package/bundles/bravobit-bb-foundation-collections.umd.js.map +1 -0
  28. package/bundles/bravobit-bb-foundation-dashboard.umd.js +817 -819
  29. package/bundles/bravobit-bb-foundation-dashboard.umd.js.map +1 -1
  30. package/bundles/bravobit-bb-foundation-dialog.umd.js +649 -651
  31. package/bundles/bravobit-bb-foundation-dialog.umd.js.map +1 -1
  32. package/bundles/bravobit-bb-foundation-elements.umd.js +2651 -2653
  33. package/bundles/bravobit-bb-foundation-elements.umd.js.map +1 -1
  34. package/bundles/bravobit-bb-foundation-http.umd.js +488 -490
  35. package/bundles/bravobit-bb-foundation-http.umd.js.map +1 -1
  36. package/bundles/bravobit-bb-foundation-localize.umd.js +1208 -1210
  37. package/bundles/bravobit-bb-foundation-localize.umd.js.map +1 -1
  38. package/bundles/bravobit-bb-foundation-notifications.umd.js +743 -745
  39. package/bundles/bravobit-bb-foundation-notifications.umd.js.map +1 -1
  40. package/bundles/bravobit-bb-foundation-recaptcha.umd.js +640 -642
  41. package/bundles/bravobit-bb-foundation-recaptcha.umd.js.map +1 -1
  42. package/bundles/bravobit-bb-foundation-rxjs.umd.js +13 -13
  43. package/bundles/bravobit-bb-foundation-rxjs.umd.js.map +1 -1
  44. package/bundles/bravobit-bb-foundation-storage.umd.js +756 -758
  45. package/bundles/bravobit-bb-foundation-storage.umd.js.map +1 -1
  46. package/bundles/bravobit-bb-foundation-table.umd.js +993 -995
  47. package/bundles/bravobit-bb-foundation-table.umd.js.map +1 -1
  48. package/bundles/bravobit-bb-foundation.umd.js +1332 -1334
  49. package/bundles/bravobit-bb-foundation.umd.js.map +1 -1
  50. package/collections/bravobit-bb-foundation-collections.d.ts +5 -0
  51. package/collections/lib/collection.d.ts +43 -0
  52. package/collections/lib/collections.module.d.ts +10 -0
  53. package/collections/lib/components/collections-pager/collections-pager.component.d.ts +34 -0
  54. package/collections/lib/components/collections-viewer/collections-viewer.component.d.ts +12 -0
  55. package/collections/lib/components/collections.directive.d.ts +17 -0
  56. package/collections/lib/interfaces/collection.interface.d.ts +26 -0
  57. package/collections/lib/providers/api-collection.provider.d.ts +15 -0
  58. package/collections/lib/providers/collection.provider.d.ts +6 -0
  59. package/collections/lib/providers/local-collection.provider.d.ts +8 -0
  60. package/collections/package.json +10 -0
  61. package/collections/public_api.d.ts +9 -0
  62. package/dashboard/bravobit-bb-foundation-dashboard.d.ts +5 -5
  63. package/dashboard/lib/dashboard/dashboard.component.d.ts +19 -19
  64. package/dashboard/lib/dashboard-header/dashboard-header.component.d.ts +11 -11
  65. package/dashboard/lib/dashboard-menu/dashboard-menu.component.d.ts +9 -9
  66. package/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.d.ts +11 -11
  67. package/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.d.ts +21 -21
  68. package/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.d.ts +27 -27
  69. package/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.d.ts +16 -16
  70. package/dashboard/lib/dashboard.module.d.ts +16 -16
  71. package/dashboard/public_api.d.ts +8 -8
  72. package/dialog/bravobit-bb-foundation-dialog.d.ts +5 -5
  73. package/dialog/lib/dialog-actions/dialog-actions.component.d.ts +5 -5
  74. package/dialog/lib/dialog-confirm/dialog-confirm.component.d.ts +16 -16
  75. package/dialog/lib/dialog-container/dialog-container.component.d.ts +24 -24
  76. package/dialog/lib/dialog-header/dialog-header.component.d.ts +9 -9
  77. package/dialog/lib/dialog-link/dialog-link.component.d.ts +5 -5
  78. package/dialog/lib/dialog-modal/dialog-modal.component.d.ts +12 -12
  79. package/dialog/lib/dialog-overlay/dialog-overlay.component.d.ts +22 -22
  80. package/dialog/lib/dialog.injector.d.ts +8 -8
  81. package/dialog/lib/dialog.insertion.d.ts +8 -8
  82. package/dialog/lib/dialog.interfaces.d.ts +3 -3
  83. package/dialog/lib/dialog.module.d.ts +19 -19
  84. package/dialog/lib/dialog.ref.d.ts +8 -8
  85. package/dialog/lib/dialog.service.d.ts +19 -19
  86. package/dialog/public_api.d.ts +9 -9
  87. package/elements/bravobit-bb-foundation-elements.d.ts +5 -5
  88. package/elements/lib/avatar/avatar.component.d.ts +25 -25
  89. package/elements/lib/button/button.component.d.ts +23 -23
  90. package/elements/lib/checkbox/checkbox.component.d.ts +27 -27
  91. package/elements/lib/date-picker/date-picker.component.d.ts +69 -69
  92. package/elements/lib/directives/addon.directive.d.ts +9 -9
  93. package/elements/lib/directives/autosize.directive.d.ts +18 -18
  94. package/elements/lib/directives/focus-trap.directive.d.ts +17 -17
  95. package/elements/lib/directives/focus.directive.d.ts +14 -14
  96. package/elements/lib/directives/form-submit.directive.d.ts +17 -17
  97. package/elements/lib/directives/input.directive.d.ts +38 -38
  98. package/elements/lib/directives/template.directive.d.ts +10 -10
  99. package/elements/lib/dropdown/dropdown.component.d.ts +21 -21
  100. package/elements/lib/elements.interfaces.d.ts +25 -25
  101. package/elements/lib/elements.module.d.ts +116 -116
  102. package/elements/lib/file-picker/file-picker.component.d.ts +49 -49
  103. package/elements/lib/form-control/form-control.component.d.ts +21 -21
  104. package/elements/lib/form-error/form-error.component.d.ts +29 -29
  105. package/elements/lib/form-group/form-group.component.d.ts +10 -10
  106. package/elements/lib/icon/icon.component.d.ts +22 -22
  107. package/elements/lib/image-picker/image-picker.component.d.ts +38 -38
  108. package/elements/lib/pipes/file-image.pipe.d.ts +13 -13
  109. package/elements/lib/pipes/file-size.pipe.d.ts +8 -8
  110. package/elements/lib/pipes/relative-time.pipe.d.ts +19 -19
  111. package/elements/lib/spinner/spinner.component.d.ts +12 -12
  112. package/elements/lib/tag/tag.component.d.ts +7 -7
  113. package/elements/public_api.d.ts +25 -25
  114. package/esm2015/auth/bravobit-bb-foundation-auth.js +4 -4
  115. package/esm2015/auth/lib/auth.interceptor.js +95 -95
  116. package/esm2015/auth/lib/auth.module.js +54 -54
  117. package/esm2015/auth/lib/auth.service.js +299 -299
  118. package/esm2015/auth/lib/auth.session.js +136 -136
  119. package/esm2015/auth/lib/directives/authenticated.directive.js +32 -32
  120. package/esm2015/auth/lib/directives/permission.directive.js +81 -81
  121. package/esm2015/auth/lib/directives/role.directive.js +38 -38
  122. package/esm2015/auth/lib/guards/anonymous.guard.js +35 -35
  123. package/esm2015/auth/lib/guards/authenticated.guard.js +36 -36
  124. package/esm2015/auth/lib/helpers/jwt.helper.js +69 -69
  125. package/esm2015/auth/lib/helpers/mapper.helper.js +35 -35
  126. package/esm2015/auth/lib/interfaces/config.interface.js +3 -3
  127. package/esm2015/auth/lib/interfaces/mapper.interface.js +2 -2
  128. package/esm2015/auth/lib/interfaces/provider.interface.js +2 -2
  129. package/esm2015/auth/lib/interfaces/token.interface.js +2 -2
  130. package/esm2015/auth/lib/permissions.service.js +58 -58
  131. package/esm2015/auth/lib/providers/email.provider.js +26 -26
  132. package/esm2015/auth/lib/providers/verify.provider.js +20 -20
  133. package/esm2015/auth/lib/tokens/use-authorization.token.js +3 -3
  134. package/esm2015/auth/public_api.js +19 -19
  135. package/esm2015/bravobit-bb-foundation.js +4 -4
  136. package/esm2015/collections/bravobit-bb-foundation-collections.js +5 -0
  137. package/esm2015/collections/lib/collection.js +104 -0
  138. package/esm2015/collections/lib/collections.module.js +54 -0
  139. package/esm2015/collections/lib/components/collections-pager/collections-pager.component.js +136 -0
  140. package/esm2015/collections/lib/components/collections-viewer/collections-viewer.component.js +39 -0
  141. package/esm2015/collections/lib/components/collections.directive.js +43 -0
  142. package/esm2015/collections/lib/interfaces/collection.interface.js +2 -0
  143. package/esm2015/collections/lib/providers/api-collection.provider.js +69 -0
  144. package/esm2015/collections/lib/providers/collection.provider.js +14 -0
  145. package/esm2015/collections/lib/providers/local-collection.provider.js +16 -0
  146. package/esm2015/collections/public_api.js +10 -0
  147. package/esm2015/dashboard/bravobit-bb-foundation-dashboard.js +4 -4
  148. package/esm2015/dashboard/lib/dashboard/dashboard.component.js +64 -64
  149. package/esm2015/dashboard/lib/dashboard-header/dashboard-header.component.js +41 -41
  150. package/esm2015/dashboard/lib/dashboard-menu/dashboard-menu.component.js +39 -39
  151. package/esm2015/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.js +38 -38
  152. package/esm2015/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.js +83 -83
  153. package/esm2015/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.js +110 -110
  154. package/esm2015/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.js +71 -71
  155. package/esm2015/dashboard/lib/dashboard.module.js +47 -47
  156. package/esm2015/dashboard/public_api.js +9 -9
  157. package/esm2015/dialog/bravobit-bb-foundation-dialog.js +4 -4
  158. package/esm2015/dialog/lib/dialog-actions/dialog-actions.component.js +20 -20
  159. package/esm2015/dialog/lib/dialog-confirm/dialog-confirm.component.js +45 -45
  160. package/esm2015/dialog/lib/dialog-container/dialog-container.component.js +162 -162
  161. package/esm2015/dialog/lib/dialog-header/dialog-header.component.js +33 -33
  162. package/esm2015/dialog/lib/dialog-link/dialog-link.component.js +19 -19
  163. package/esm2015/dialog/lib/dialog-modal/dialog-modal.component.js +54 -54
  164. package/esm2015/dialog/lib/dialog-overlay/dialog-overlay.component.js +143 -143
  165. package/esm2015/dialog/lib/dialog.injector.js +18 -18
  166. package/esm2015/dialog/lib/dialog.insertion.js +16 -16
  167. package/esm2015/dialog/lib/dialog.interfaces.js +3 -3
  168. package/esm2015/dialog/lib/dialog.module.js +74 -74
  169. package/esm2015/dialog/lib/dialog.ref.js +22 -22
  170. package/esm2015/dialog/lib/dialog.service.js +77 -77
  171. package/esm2015/dialog/public_api.js +10 -10
  172. package/esm2015/elements/bravobit-bb-foundation-elements.js +4 -4
  173. package/esm2015/elements/lib/avatar/avatar.component.js +151 -151
  174. package/esm2015/elements/lib/button/button.component.js +79 -79
  175. package/esm2015/elements/lib/checkbox/checkbox.component.js +83 -83
  176. package/esm2015/elements/lib/date-picker/date-picker.component.js +322 -322
  177. package/esm2015/elements/lib/directives/addon.directive.js +29 -29
  178. package/esm2015/elements/lib/directives/autosize.directive.js +74 -74
  179. package/esm2015/elements/lib/directives/focus-trap.directive.js +77 -77
  180. package/esm2015/elements/lib/directives/focus.directive.js +39 -39
  181. package/esm2015/elements/lib/directives/form-submit.directive.js +53 -53
  182. package/esm2015/elements/lib/directives/input.directive.js +139 -139
  183. package/esm2015/elements/lib/directives/template.directive.js +28 -28
  184. package/esm2015/elements/lib/dropdown/dropdown.component.js +111 -111
  185. package/esm2015/elements/lib/elements.interfaces.js +4 -4
  186. package/esm2015/elements/lib/elements.module.js +177 -177
  187. package/esm2015/elements/lib/file-picker/file-picker.component.js +247 -247
  188. package/esm2015/elements/lib/form-control/form-control.component.js +58 -58
  189. package/esm2015/elements/lib/form-error/form-error.component.js +116 -116
  190. package/esm2015/elements/lib/form-group/form-group.component.js +27 -27
  191. package/esm2015/elements/lib/icon/icon.component.js +110 -110
  192. package/esm2015/elements/lib/image-picker/image-picker.component.js +119 -119
  193. package/esm2015/elements/lib/pipes/file-image.pipe.js +45 -45
  194. package/esm2015/elements/lib/pipes/file-size.pipe.js +28 -28
  195. package/esm2015/elements/lib/pipes/relative-time.pipe.js +96 -96
  196. package/esm2015/elements/lib/spinner/spinner.component.js +34 -34
  197. package/esm2015/elements/lib/tag/tag.component.js +26 -26
  198. package/esm2015/elements/public_api.js +26 -26
  199. package/esm2015/http/bravobit-bb-foundation-http.js +4 -4
  200. package/esm2015/http/lib/classes/http.config.js +31 -31
  201. package/esm2015/http/lib/classes/http.error.js +21 -21
  202. package/esm2015/http/lib/http.interfaces.js +2 -2
  203. package/esm2015/http/lib/http.module.js +43 -43
  204. package/esm2015/http/lib/interceptors/base-url.interceptor.js +52 -52
  205. package/esm2015/http/lib/interceptors/error.interceptor.js +33 -33
  206. package/esm2015/http/public_api.js +7 -7
  207. package/esm2015/lib/core/coercions/boolean-coercion.js +4 -4
  208. package/esm2015/lib/core/miscellaneous/regex.js +5 -5
  209. package/esm2015/lib/core/miscellaneous/validator.js +86 -86
  210. package/esm2015/lib/core/mixins/can-disable.js +16 -16
  211. package/esm2015/lib/core/mixins/can-hide-errors.js +16 -16
  212. package/esm2015/lib/core/mixins/can-load.js +16 -16
  213. package/esm2015/lib/core/mixins/constructor.js +2 -2
  214. package/esm2015/lib/core/mixins/has-error.js +16 -16
  215. package/esm2015/lib/core/mixins/is-focused.js +16 -16
  216. package/esm2015/lib/core/mixins/is-grouped.js +16 -16
  217. package/esm2015/lib/core/mixins/is-readonly.js +16 -16
  218. package/esm2015/lib/core/mixins/is-required.js +16 -16
  219. package/esm2015/lib/core/services/clipboard.service.js +72 -72
  220. package/esm2015/lib/core/services/exif.service.js +168 -168
  221. package/esm2015/lib/core/services/file-loader.service.js +90 -90
  222. package/esm2015/lib/core/services/image-converter.service.js +130 -130
  223. package/esm2015/lib/core/services/languages.service.js +74 -74
  224. package/esm2015/lib/core/services/network.service.js +56 -56
  225. package/esm2015/lib/core/services/patch.service.js +65 -65
  226. package/esm2015/lib/core/services/platform.service.js +42 -42
  227. package/esm2015/lib/core/tokens/accept-language.token.js +3 -3
  228. package/esm2015/lib/core/tokens/base-url.token.js +3 -3
  229. package/esm2015/lib/core/tokens/cookie.token.js +3 -3
  230. package/esm2015/lib/core/tokens/location.token.js +6 -6
  231. package/esm2015/lib/core/tokens/navigator.token.js +6 -6
  232. package/esm2015/lib/core/tokens/window.token.js +12 -12
  233. package/esm2015/localize/bravobit-bb-foundation-localize.js +4 -4
  234. package/esm2015/localize/lib/functions/date.function.js +18 -18
  235. package/esm2015/localize/lib/functions/lowercase.function.js +13 -13
  236. package/esm2015/localize/lib/functions/uppercase.function.js +13 -13
  237. package/esm2015/localize/lib/handlers/missing.handler.js +17 -17
  238. package/esm2015/localize/lib/interfaces/config.interfaces.js +10 -10
  239. package/esm2015/localize/lib/interfaces/dictionary.interfaces.js +8 -8
  240. package/esm2015/localize/lib/interfaces/functions.interfaces.js +8 -8
  241. package/esm2015/localize/lib/interfaces/handlers.interfaces.js +2 -2
  242. package/esm2015/localize/lib/interfaces/options.interfaces.js +6 -6
  243. package/esm2015/localize/lib/localizations/dutch.localization.js +53 -53
  244. package/esm2015/localize/lib/localizations/english.localization.js +53 -53
  245. package/esm2015/localize/lib/localize.dictionary.js +137 -137
  246. package/esm2015/localize/lib/localize.module.js +69 -69
  247. package/esm2015/localize/lib/localize.pipe.js +49 -49
  248. package/esm2015/localize/lib/localize.service.js +282 -282
  249. package/esm2015/localize/lib/views/localize-string/localize-string.component.js +99 -99
  250. package/esm2015/localize/lib/views/localize-template-or-string.directive.js +28 -28
  251. package/esm2015/localize/lib/views/localize-template.directive.js +21 -21
  252. package/esm2015/localize/public_api.js +18 -18
  253. package/esm2015/notifications/bravobit-bb-foundation-notifications.js +4 -4
  254. package/esm2015/notifications/lib/notifications-item/notifications-item.component.js +108 -108
  255. package/esm2015/notifications/lib/notifications-list/notifications-list.component.js +56 -56
  256. package/esm2015/notifications/lib/notifications.animations.js +28 -28
  257. package/esm2015/notifications/lib/notifications.injector.js +18 -18
  258. package/esm2015/notifications/lib/notifications.interfaces.js +20 -20
  259. package/esm2015/notifications/lib/notifications.module.js +31 -31
  260. package/esm2015/notifications/lib/notifications.service.js +145 -145
  261. package/esm2015/notifications/public_api.js +4 -4
  262. package/esm2015/public_api.js +30 -30
  263. package/esm2015/recaptcha/bravobit-bb-foundation-recaptcha.js +4 -4
  264. package/esm2015/recaptcha/lib/recaptcha/recaptcha.component.js +199 -199
  265. package/esm2015/recaptcha/lib/recaptcha-loader.service.js +93 -93
  266. package/esm2015/recaptcha/lib/recaptcha.interface.js +3 -3
  267. package/esm2015/recaptcha/lib/recaptcha.module.js +27 -27
  268. package/esm2015/recaptcha/public_api.js +5 -5
  269. package/esm2015/rxjs/bravobit-bb-foundation-rxjs.js +4 -4
  270. package/esm2015/rxjs/lib/operators/combine-latest-map.operator.js +7 -7
  271. package/esm2015/rxjs/lib/operators/filter-nil.operator.js +5 -5
  272. package/esm2015/rxjs/public_api.js +3 -3
  273. package/esm2015/storage/bravobit-bb-foundation-storage.js +4 -4
  274. package/esm2015/storage/lib/interfaces/attributes.interface.js +2 -2
  275. package/esm2015/storage/lib/interfaces/memory.interface.js +2 -2
  276. package/esm2015/storage/lib/interfaces/strategy.interface.js +2 -2
  277. package/esm2015/storage/lib/storage.service.js +111 -111
  278. package/esm2015/storage/lib/strategies/cookie-storage.strategy.js +143 -143
  279. package/esm2015/storage/lib/strategies/memory-storage.strategy.js +56 -56
  280. package/esm2015/storage/lib/strategies/polyfill-storage.strategy.js +102 -102
  281. package/esm2015/storage/public_api.js +8 -8
  282. package/esm2015/table/bravobit-bb-foundation-table.js +4 -4
  283. package/esm2015/table/lib/components/table/table.component.js +183 -183
  284. package/esm2015/table/lib/components/table-cell/table-cell.component.js +19 -19
  285. package/esm2015/table/lib/components/table-header-cell/table-header-cell.component.js +141 -141
  286. package/esm2015/table/lib/components/table-pager/table-pager.component.js +146 -146
  287. package/esm2015/table/lib/data/datasource.data.js +32 -32
  288. package/esm2015/table/lib/data/generic.data.js +73 -73
  289. package/esm2015/table/lib/interfaces/datasource.interface.js +2 -2
  290. package/esm2015/table/lib/interfaces/table.interfaces.js +2 -2
  291. package/esm2015/table/lib/table.module.js +39 -39
  292. package/esm2015/table/public_api.js +10 -10
  293. package/fesm2015/bravobit-bb-foundation-auth.js +915 -915
  294. package/fesm2015/bravobit-bb-foundation-auth.js.map +1 -1
  295. package/fesm2015/bravobit-bb-foundation-collections.js +463 -0
  296. package/fesm2015/bravobit-bb-foundation-collections.js.map +1 -0
  297. package/fesm2015/bravobit-bb-foundation-dashboard.js +434 -434
  298. package/fesm2015/bravobit-bb-foundation-dashboard.js.map +1 -1
  299. package/fesm2015/bravobit-bb-foundation-dialog.js +603 -603
  300. package/fesm2015/bravobit-bb-foundation-dialog.js.map +1 -1
  301. package/fesm2015/bravobit-bb-foundation-elements.js +2076 -2076
  302. package/fesm2015/bravobit-bb-foundation-elements.js.map +1 -1
  303. package/fesm2015/bravobit-bb-foundation-http.js +154 -154
  304. package/fesm2015/bravobit-bb-foundation-http.js.map +1 -1
  305. package/fesm2015/bravobit-bb-foundation-localize.js +796 -796
  306. package/fesm2015/bravobit-bb-foundation-localize.js.map +1 -1
  307. package/fesm2015/bravobit-bb-foundation-notifications.js +364 -364
  308. package/fesm2015/bravobit-bb-foundation-notifications.js.map +1 -1
  309. package/fesm2015/bravobit-bb-foundation-recaptcha.js +297 -297
  310. package/fesm2015/bravobit-bb-foundation-recaptcha.js.map +1 -1
  311. package/fesm2015/bravobit-bb-foundation-rxjs.js +7 -7
  312. package/fesm2015/bravobit-bb-foundation-rxjs.js.map +1 -1
  313. package/fesm2015/bravobit-bb-foundation-storage.js +399 -399
  314. package/fesm2015/bravobit-bb-foundation-storage.js.map +1 -1
  315. package/fesm2015/bravobit-bb-foundation-table.js +578 -578
  316. package/fesm2015/bravobit-bb-foundation-table.js.map +1 -1
  317. package/fesm2015/bravobit-bb-foundation.js +851 -851
  318. package/fesm2015/bravobit-bb-foundation.js.map +1 -1
  319. package/http/bravobit-bb-foundation-http.d.ts +5 -5
  320. package/http/lib/classes/http.config.d.ts +9 -9
  321. package/http/lib/classes/http.error.d.ts +7 -7
  322. package/http/lib/http.interfaces.d.ts +12 -12
  323. package/http/lib/http.module.d.ts +15 -15
  324. package/http/lib/interceptors/base-url.interceptor.d.ts +15 -15
  325. package/http/lib/interceptors/error.interceptor.d.ts +11 -11
  326. package/http/public_api.d.ts +6 -6
  327. package/lib/core/coercions/boolean-coercion.d.ts +1 -1
  328. package/lib/core/miscellaneous/regex.d.ts +4 -4
  329. package/lib/core/miscellaneous/validator.d.ts +13 -13
  330. package/lib/core/mixins/can-disable.d.ts +6 -6
  331. package/lib/core/mixins/can-hide-errors.d.ts +6 -6
  332. package/lib/core/mixins/can-load.d.ts +6 -6
  333. package/lib/core/mixins/constructor.d.ts +1 -1
  334. package/lib/core/mixins/has-error.d.ts +6 -6
  335. package/lib/core/mixins/is-focused.d.ts +6 -6
  336. package/lib/core/mixins/is-grouped.d.ts +6 -6
  337. package/lib/core/mixins/is-readonly.d.ts +6 -6
  338. package/lib/core/mixins/is-required.d.ts +6 -6
  339. package/lib/core/services/clipboard.service.d.ts +18 -18
  340. package/lib/core/services/exif.service.d.ts +15 -15
  341. package/lib/core/services/file-loader.service.d.ts +13 -13
  342. package/lib/core/services/image-converter.service.d.ts +21 -21
  343. package/lib/core/services/languages.service.d.ts +16 -16
  344. package/lib/core/services/network.service.d.ts +14 -14
  345. package/lib/core/services/patch.service.d.ts +16 -16
  346. package/lib/core/services/platform.service.d.ts +18 -18
  347. package/lib/core/tokens/accept-language.token.d.ts +2 -2
  348. package/lib/core/tokens/base-url.token.d.ts +2 -2
  349. package/lib/core/tokens/cookie.token.d.ts +2 -2
  350. package/lib/core/tokens/location.token.d.ts +2 -2
  351. package/lib/core/tokens/navigator.token.d.ts +2 -2
  352. package/lib/core/tokens/window.token.d.ts +2 -2
  353. package/localize/bravobit-bb-foundation-localize.d.ts +5 -5
  354. package/localize/lib/functions/date.function.d.ts +5 -5
  355. package/localize/lib/functions/lowercase.function.d.ts +5 -5
  356. package/localize/lib/functions/uppercase.function.d.ts +5 -5
  357. package/localize/lib/handlers/missing.handler.d.ts +6 -6
  358. package/localize/lib/interfaces/config.interfaces.d.ts +8 -8
  359. package/localize/lib/interfaces/dictionary.interfaces.d.ts +12 -12
  360. package/localize/lib/interfaces/functions.interfaces.d.ts +9 -9
  361. package/localize/lib/interfaces/handlers.interfaces.d.ts +6 -6
  362. package/localize/lib/interfaces/options.interfaces.d.ts +10 -10
  363. package/localize/lib/localizations/dutch.localization.d.ts +51 -51
  364. package/localize/lib/localizations/english.localization.d.ts +51 -51
  365. package/localize/lib/localize.dictionary.d.ts +24 -24
  366. package/localize/lib/localize.module.d.ts +18 -18
  367. package/localize/lib/localize.pipe.d.ts +12 -12
  368. package/localize/lib/localize.service.d.ts +51 -51
  369. package/localize/lib/views/localize-string/localize-string.component.d.ts +23 -23
  370. package/localize/lib/views/localize-template-or-string.directive.d.ts +10 -10
  371. package/localize/lib/views/localize-template.directive.d.ts +9 -9
  372. package/localize/public_api.d.ts +17 -17
  373. package/notifications/bravobit-bb-foundation-notifications.d.ts +5 -5
  374. package/notifications/lib/notifications-item/notifications-item.component.d.ts +34 -34
  375. package/notifications/lib/notifications-list/notifications-list.component.d.ts +16 -16
  376. package/notifications/lib/notifications.animations.d.ts +1 -1
  377. package/notifications/lib/notifications.injector.d.ts +8 -8
  378. package/notifications/lib/notifications.interfaces.d.ts +49 -49
  379. package/notifications/lib/notifications.module.d.ts +13 -13
  380. package/notifications/lib/notifications.service.d.ts +34 -34
  381. package/notifications/public_api.d.ts +3 -3
  382. package/package.json +5 -5
  383. package/public_api.d.ts +26 -26
  384. package/recaptcha/bravobit-bb-foundation-recaptcha.d.ts +5 -5
  385. package/recaptcha/lib/recaptcha/recaptcha.component.d.ts +47 -47
  386. package/recaptcha/lib/recaptcha-loader.service.d.ts +22 -22
  387. package/recaptcha/lib/recaptcha.interface.d.ts +14 -14
  388. package/recaptcha/lib/recaptcha.module.d.ts +10 -16
  389. package/recaptcha/public_api.d.ts +4 -4
  390. package/rxjs/bravobit-bb-foundation-rxjs.d.ts +5 -5
  391. package/rxjs/lib/operators/combine-latest-map.operator.d.ts +8 -8
  392. package/rxjs/lib/operators/filter-nil.operator.d.ts +1 -1
  393. package/rxjs/public_api.d.ts +2 -2
  394. package/storage/bravobit-bb-foundation-storage.d.ts +5 -5
  395. package/storage/lib/interfaces/attributes.interface.d.ts +13 -13
  396. package/storage/lib/interfaces/memory.interface.d.ts +7 -7
  397. package/storage/lib/interfaces/strategy.interface.d.ts +17 -17
  398. package/storage/lib/storage.service.d.ts +26 -26
  399. package/storage/lib/strategies/cookie-storage.strategy.d.ts +20 -20
  400. package/storage/lib/strategies/memory-storage.strategy.d.ts +11 -11
  401. package/storage/lib/strategies/polyfill-storage.strategy.d.ts +15 -15
  402. package/storage/public_api.d.ts +7 -7
  403. package/table/bravobit-bb-foundation-table.d.ts +5 -5
  404. package/table/lib/components/table/table.component.d.ts +48 -48
  405. package/table/lib/components/table-cell/table-cell.component.d.ts +5 -5
  406. package/table/lib/components/table-header-cell/table-header-cell.component.d.ts +29 -29
  407. package/table/lib/components/table-pager/table-pager.component.d.ts +41 -41
  408. package/table/lib/data/datasource.data.d.ts +14 -14
  409. package/table/lib/data/generic.data.d.ts +23 -23
  410. package/table/lib/interfaces/datasource.interface.d.ts +17 -17
  411. package/table/lib/interfaces/table.interfaces.d.ts +1 -1
  412. package/table/lib/table.module.d.ts +14 -14
  413. package/table/public_api.d.ts +9 -9
@@ -14,2132 +14,2132 @@ 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
 
17
- class BbDropdown {
18
- constructor(_elementRef) {
19
- this._elementRef = _elementRef;
20
- // State.
21
- this.visible$ = new BehaviorSubject(false);
22
- }
23
- toggle() {
24
- return this.visible$.next(!this.visible$.getValue());
25
- }
26
- close() {
27
- return this.visible$.next(false);
28
- }
29
- onDocumentClick(target) {
30
- var _a, _b;
31
- if (!target) {
32
- return;
33
- }
34
- if ((_b = (_a = this._elementRef) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.contains(target)) {
35
- return;
36
- }
37
- return this.close();
38
- }
39
- }
40
- BbDropdown.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbDropdown, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
41
- BbDropdown.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.1", 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 #ccc;transform-origin:top left;box-shadow:0 0 6px 0 rgba(0,0,0,.1)}.bb-dropdown-menu:after{width:0;top:-5px;height:0;right:5px;content:\"\";position:absolute;border-color:transparent transparent #d9d9d9;border-style:solid;border-width:0 10px 5px}.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;-moz-user-select:none;-ms-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 rgba(220,224,233,.5)}.bb-dropdown-item:active{background-color:#f0f0f0}"], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i1.AsyncPipe }, animations: [
42
- trigger('dropdownMenuAnimation', [
43
- transition(':enter', [
44
- // 1. Set the initial state.
45
- style({ opacity: 0, transform: 'scale(0.9)' }),
46
- // 2. Start the animation to show the item.
47
- animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 1, transform: 'scale(1)' }))
48
- ]),
49
- transition(':leave', [
50
- // 1. Set the initial state.
51
- style({ opacity: 1, transform: 'scale(1)' }),
52
- // 2. Start the animation to hide the item.
53
- animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 0, transform: 'scale(0.9)' }))
54
- ])
55
- ])
56
- ], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
57
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbDropdown, decorators: [{
58
- type: Component,
59
- args: [{
60
- selector: 'bb-dropdown',
61
- templateUrl: './dropdown.component.html',
62
- styleUrls: ['./dropdown.component.scss'],
63
- changeDetection: ChangeDetectionStrategy.OnPush,
64
- encapsulation: ViewEncapsulation.None,
65
- host: { 'class': 'bb-dropdown' },
66
- preserveWhitespaces: false,
67
- animations: [
68
- trigger('dropdownMenuAnimation', [
69
- transition(':enter', [
70
- // 1. Set the initial state.
71
- style({ opacity: 0, transform: 'scale(0.9)' }),
72
- // 2. Start the animation to show the item.
73
- animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 1, transform: 'scale(1)' }))
74
- ]),
75
- transition(':leave', [
76
- // 1. Set the initial state.
77
- style({ opacity: 1, transform: 'scale(1)' }),
78
- // 2. Start the animation to hide the item.
79
- animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 0, transform: 'scale(0.9)' }))
80
- ])
81
- ])
82
- ]
83
- }]
84
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { onDocumentClick: [{
85
- type: HostListener,
86
- args: ['document:click', ['$event.target']]
87
- }] } });
88
- class BbDropdownItem {
89
- constructor(_parent) {
90
- this._parent = _parent;
91
- // Inputs.
92
- this.closeOnClick = true;
93
- }
94
- onClick() {
95
- var _a;
96
- if (!this.closeOnClick) {
97
- return;
98
- }
99
- (_a = this._parent) === null || _a === void 0 ? void 0 : _a.close();
100
- }
101
- }
102
- BbDropdownItem.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbDropdownItem, deps: [{ token: BbDropdown, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
103
- BbDropdownItem.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.1", type: BbDropdownItem, selector: "[bbDropdownItem]", inputs: { closeOnClick: "closeOnClick" }, host: { listeners: { "click": "onClick()" }, classAttribute: "bb-dropdown-item" }, ngImport: i0 });
104
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbDropdownItem, decorators: [{
105
- type: Directive,
106
- args: [{
107
- selector: '[bbDropdownItem]',
108
- host: {
109
- 'class': 'bb-dropdown-item'
110
- }
111
- }]
112
- }], ctorParameters: function () { return [{ type: BbDropdown, decorators: [{
113
- type: Optional
114
- }, {
115
- type: Host
116
- }] }]; }, propDecorators: { closeOnClick: [{
117
- type: Input
118
- }], onClick: [{
119
- type: HostListener,
120
- args: ['click']
17
+ class BbDropdown {
18
+ constructor(_elementRef) {
19
+ this._elementRef = _elementRef;
20
+ // State.
21
+ this.visible$ = new BehaviorSubject(false);
22
+ }
23
+ toggle() {
24
+ return this.visible$.next(!this.visible$.getValue());
25
+ }
26
+ close() {
27
+ return this.visible$.next(false);
28
+ }
29
+ onDocumentClick(target) {
30
+ var _a, _b;
31
+ if (!target) {
32
+ return;
33
+ }
34
+ if ((_b = (_a = this._elementRef) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.contains(target)) {
35
+ return;
36
+ }
37
+ return this.close();
38
+ }
39
+ }
40
+ BbDropdown.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbDropdown, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
41
+ BbDropdown.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.10", 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;-moz-user-select:none;-ms-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: [
42
+ trigger('dropdownMenuAnimation', [
43
+ transition(':enter', [
44
+ // 1. Set the initial state.
45
+ style({ opacity: 0, transform: 'scale(0.9)' }),
46
+ // 2. Start the animation to show the item.
47
+ animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 1, transform: 'scale(1)' }))
48
+ ]),
49
+ transition(':leave', [
50
+ // 1. Set the initial state.
51
+ style({ opacity: 1, transform: 'scale(1)' }),
52
+ // 2. Start the animation to hide the item.
53
+ animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 0, transform: 'scale(0.9)' }))
54
+ ])
55
+ ])
56
+ ], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
57
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbDropdown, decorators: [{
58
+ type: Component,
59
+ args: [{
60
+ selector: 'bb-dropdown',
61
+ templateUrl: './dropdown.component.html',
62
+ styleUrls: ['./dropdown.component.scss'],
63
+ changeDetection: ChangeDetectionStrategy.OnPush,
64
+ encapsulation: ViewEncapsulation.None,
65
+ host: { 'class': 'bb-dropdown' },
66
+ preserveWhitespaces: false,
67
+ animations: [
68
+ trigger('dropdownMenuAnimation', [
69
+ transition(':enter', [
70
+ // 1. Set the initial state.
71
+ style({ opacity: 0, transform: 'scale(0.9)' }),
72
+ // 2. Start the animation to show the item.
73
+ animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 1, transform: 'scale(1)' }))
74
+ ]),
75
+ transition(':leave', [
76
+ // 1. Set the initial state.
77
+ style({ opacity: 1, transform: 'scale(1)' }),
78
+ // 2. Start the animation to hide the item.
79
+ animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 0, transform: 'scale(0.9)' }))
80
+ ])
81
+ ])
82
+ ]
83
+ }]
84
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { onDocumentClick: [{
85
+ type: HostListener,
86
+ args: ['document:click', ['$event.target']]
87
+ }] } });
88
+ class BbDropdownItem {
89
+ constructor(_parent) {
90
+ this._parent = _parent;
91
+ // Inputs.
92
+ this.closeOnClick = true;
93
+ }
94
+ onClick() {
95
+ var _a;
96
+ if (!this.closeOnClick) {
97
+ return;
98
+ }
99
+ (_a = this._parent) === null || _a === void 0 ? void 0 : _a.close();
100
+ }
101
+ }
102
+ BbDropdownItem.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbDropdownItem, deps: [{ token: BbDropdown, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
103
+ BbDropdownItem.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.10", type: BbDropdownItem, selector: "[bbDropdownItem]", inputs: { closeOnClick: "closeOnClick" }, host: { listeners: { "click": "onClick()" }, classAttribute: "bb-dropdown-item" }, ngImport: i0 });
104
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbDropdownItem, decorators: [{
105
+ type: Directive,
106
+ args: [{
107
+ selector: '[bbDropdownItem]',
108
+ host: {
109
+ 'class': 'bb-dropdown-item'
110
+ }
111
+ }]
112
+ }], ctorParameters: function () { return [{ type: BbDropdown, decorators: [{
113
+ type: Optional
114
+ }, {
115
+ type: Host
116
+ }] }]; }, propDecorators: { closeOnClick: [{
117
+ type: Input
118
+ }], onClick: [{
119
+ type: HostListener,
120
+ args: ['click']
121
121
  }] } });
122
122
 
123
- const ELEMENTS_ICONS = new InjectionToken('elements_icons');
123
+ const ELEMENTS_ICONS = new InjectionToken('elements_icons');
124
124
  const ELEMENTS_ERRORS = new InjectionToken('elements_errors');
125
125
 
126
- class BbSpinnerBase {
127
- }
128
- const BbSpinnerMixinBase = mixinDisabled(BbSpinnerBase);
129
- class BbSpinner extends BbSpinnerMixinBase {
130
- constructor() {
131
- super(...arguments);
132
- // Inputs.
133
- this.color = '#303f9f';
134
- this.alt = 'Loading...';
135
- }
136
- }
137
- BbSpinner.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbSpinner, deps: null, target: i0.ɵɵFactoryTarget.Component });
138
- BbSpinner.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.1", 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:hsla(0,0%,100%,.15)}.bb-spinner.inverse .bb-spinner-content{color:hsla(0,0%,100%,.5)}.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;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite}.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;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;-webkit-animation-play-state:paused;animation-play-state:paused}.bb-spinner-content:not(:empty){font-size:16px;margin-top:10px;font-weight:500}@-webkit-keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
139
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbSpinner, decorators: [{
140
- type: Component,
141
- args: [{
142
- selector: 'bb-spinner',
143
- templateUrl: './spinner.component.html',
144
- styleUrls: ['./spinner.component.scss'],
145
- changeDetection: ChangeDetectionStrategy.OnPush,
146
- encapsulation: ViewEncapsulation.None,
147
- host: { 'class': 'bb-spinner' },
148
- inputs: ['color', 'alt', 'disabled'],
149
- preserveWhitespaces: false
150
- }]
151
- }], propDecorators: { color: [{
152
- type: Input
153
- }], alt: [{
154
- type: Input
126
+ class BbSpinnerBase {
127
+ }
128
+ const BbSpinnerMixinBase = mixinDisabled(BbSpinnerBase);
129
+ class BbSpinner extends BbSpinnerMixinBase {
130
+ constructor() {
131
+ super(...arguments);
132
+ // Inputs.
133
+ this.color = '#303f9f';
134
+ this.alt = 'Loading...';
135
+ }
136
+ }
137
+ BbSpinner.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbSpinner, deps: null, target: i0.ɵɵFactoryTarget.Component });
138
+ BbSpinner.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.10", 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;-webkit-animation:1s linear infinite spin;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;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;-webkit-animation-play-state:paused;animation-play-state:paused}.bb-spinner-content:not(:empty){font-size:16px;margin-top:10px;font-weight:500}@-webkit-keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
139
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbSpinner, decorators: [{
140
+ type: Component,
141
+ args: [{
142
+ selector: 'bb-spinner',
143
+ templateUrl: './spinner.component.html',
144
+ styleUrls: ['./spinner.component.scss'],
145
+ changeDetection: ChangeDetectionStrategy.OnPush,
146
+ encapsulation: ViewEncapsulation.None,
147
+ host: { 'class': 'bb-spinner' },
148
+ inputs: ['color', 'alt', 'disabled'],
149
+ preserveWhitespaces: false
150
+ }]
151
+ }], propDecorators: { color: [{
152
+ type: Input
153
+ }], alt: [{
154
+ type: Input
155
155
  }] } });
156
156
 
157
- class BbButtonBase {
158
- constructor(_elementRef) {
159
- this._elementRef = _elementRef;
160
- }
161
- }
162
- const BbButtonMixinBase = mixinDisabled(mixinLoad(BbButtonBase));
163
- class BbButton extends BbButtonMixinBase {
164
- constructor(_elementRef) {
165
- super(_elementRef);
166
- }
167
- get nativeElement() {
168
- return this._elementRef.nativeElement;
169
- }
170
- focus() {
171
- this.nativeElement && this.nativeElement.focus();
172
- }
173
- }
174
- BbButton.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbButton, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
175
- BbButton.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.1", 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;-moz-user-select:none;-ms-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 rgba(0,0,0,.1);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:active,.bb-button:focus{box-shadow:0 6px 6px -6px rgba(0,0,0,.1),0 0 0 3px rgba(220,224,233,.5)}.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:active,.bb-button.primary:focus{box-shadow:0 6px 6px -6px rgba(0,0,0,.1),0 0 0 3px rgba(91,83,255,.5)}.bb-button.destructive{border-color:#8f2020;color:#fff!important;background-color:#d32f2f}.bb-button.destructive:hover{background-color:#c32929}.bb-button.destructive:active,.bb-button.destructive:focus{box-shadow:0 6px 6px -6px rgba(0,0,0,.1),0 0 0 3px rgba(211,47,47,.5)}.bb-button.loading,.bb-button.loading:active,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button:disabled,.bb-button:disabled:active,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button[disabled],.bb-button[disabled]:active,.bb-button[disabled]:focus,.bb-button[disabled]:hover{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}"], components: [{ type: BbSpinner, selector: "bb-spinner", inputs: ["color", "alt", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
176
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbButton, decorators: [{
177
- type: Component,
178
- args: [{
179
- selector: 'button[bb-button]',
180
- templateUrl: './button.component.html',
181
- styleUrls: ['./button.component.scss'],
182
- exportAs: 'bbButton',
183
- host: {
184
- 'class': 'bb-button',
185
- '[class.loading]': 'loading',
186
- '[attr.disabled]': 'disabled || loading || null'
187
- },
188
- inputs: ['disabled', 'loading'],
189
- encapsulation: ViewEncapsulation.None,
190
- changeDetection: ChangeDetectionStrategy.OnPush
191
- }]
192
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
193
- class BbAnchor extends BbButton {
194
- constructor(_elementRef) {
195
- super(_elementRef);
196
- }
197
- stopDisabledEvents(event) {
198
- // If the button is not disabled (and not loading) let all events pass.
199
- if (!this.disabled && !this.loading) {
200
- return;
201
- }
202
- // If the button is disabled and/or loading stop
203
- // the event from bubbling up.
204
- event.preventDefault();
205
- event.stopImmediatePropagation();
206
- }
207
- }
208
- BbAnchor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbAnchor, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
209
- BbAnchor.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.1", 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;-moz-user-select:none;-ms-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 rgba(0,0,0,.1);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:active,.bb-button:focus{box-shadow:0 6px 6px -6px rgba(0,0,0,.1),0 0 0 3px rgba(220,224,233,.5)}.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:active,.bb-button.primary:focus{box-shadow:0 6px 6px -6px rgba(0,0,0,.1),0 0 0 3px rgba(91,83,255,.5)}.bb-button.destructive{border-color:#8f2020;color:#fff!important;background-color:#d32f2f}.bb-button.destructive:hover{background-color:#c32929}.bb-button.destructive:active,.bb-button.destructive:focus{box-shadow:0 6px 6px -6px rgba(0,0,0,.1),0 0 0 3px rgba(211,47,47,.5)}.bb-button.loading,.bb-button.loading:active,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button:disabled,.bb-button:disabled:active,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button[disabled],.bb-button[disabled]:active,.bb-button[disabled]:focus,.bb-button[disabled]:hover{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}"], components: [{ type: BbSpinner, selector: "bb-spinner", inputs: ["color", "alt", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
210
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbAnchor, decorators: [{
211
- type: Component,
212
- args: [{
213
- selector: 'a[bb-button]',
214
- templateUrl: './button.component.html',
215
- styleUrls: ['./button.component.scss'],
216
- exportAs: 'bbButton, bbAnchor',
217
- host: {
218
- 'class': 'bb-button',
219
- '[attr.tabindex]': '(disabled || loading) ? -1 : (tabIndex || 0)',
220
- '[attr.disabled]': 'disabled || loading || null',
221
- '[attr.aria-disabled]': '(disabled || loading).toString()',
222
- '(click)': 'stopDisabledEvents($event)'
223
- },
224
- inputs: ['disabled', 'loading'],
225
- encapsulation: ViewEncapsulation.None,
226
- changeDetection: ChangeDetectionStrategy.OnPush
227
- }]
228
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { tabIndex: [{
229
- type: Input
157
+ class BbButtonBase {
158
+ constructor(_elementRef) {
159
+ this._elementRef = _elementRef;
160
+ }
161
+ }
162
+ const BbButtonMixinBase = mixinDisabled(mixinLoad(BbButtonBase));
163
+ class BbButton extends BbButtonMixinBase {
164
+ constructor(_elementRef) {
165
+ super(_elementRef);
166
+ }
167
+ get nativeElement() {
168
+ return this._elementRef.nativeElement;
169
+ }
170
+ focus() {
171
+ this.nativeElement && this.nativeElement.focus();
172
+ }
173
+ }
174
+ BbButton.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbButton, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
175
+ BbButton.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.10", 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;-moz-user-select:none;-ms-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 });
176
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbButton, decorators: [{
177
+ type: Component,
178
+ args: [{
179
+ selector: 'button[bb-button]',
180
+ templateUrl: './button.component.html',
181
+ styleUrls: ['./button.component.scss'],
182
+ exportAs: 'bbButton',
183
+ host: {
184
+ 'class': 'bb-button',
185
+ '[class.loading]': 'loading',
186
+ '[attr.disabled]': 'disabled || loading || null'
187
+ },
188
+ inputs: ['disabled', 'loading'],
189
+ encapsulation: ViewEncapsulation.None,
190
+ changeDetection: ChangeDetectionStrategy.OnPush
191
+ }]
192
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
193
+ class BbAnchor extends BbButton {
194
+ constructor(_elementRef) {
195
+ super(_elementRef);
196
+ }
197
+ stopDisabledEvents(event) {
198
+ // If the button is not disabled (and not loading) let all events pass.
199
+ if (!this.disabled && !this.loading) {
200
+ return;
201
+ }
202
+ // If the button is disabled and/or loading stop
203
+ // the event from bubbling up.
204
+ event.preventDefault();
205
+ event.stopImmediatePropagation();
206
+ }
207
+ }
208
+ BbAnchor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbAnchor, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
209
+ BbAnchor.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.10", 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;-moz-user-select:none;-ms-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 });
210
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbAnchor, decorators: [{
211
+ type: Component,
212
+ args: [{
213
+ selector: 'a[bb-button]',
214
+ templateUrl: './button.component.html',
215
+ styleUrls: ['./button.component.scss'],
216
+ exportAs: 'bbButton, bbAnchor',
217
+ host: {
218
+ 'class': 'bb-button',
219
+ '[attr.tabindex]': '(disabled || loading) ? -1 : (tabIndex || 0)',
220
+ '[attr.disabled]': 'disabled || loading || null',
221
+ '[attr.aria-disabled]': '(disabled || loading).toString()',
222
+ '(click)': 'stopDisabledEvents($event)'
223
+ },
224
+ inputs: ['disabled', 'loading'],
225
+ encapsulation: ViewEncapsulation.None,
226
+ changeDetection: ChangeDetectionStrategy.OnPush
227
+ }]
228
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { tabIndex: [{
229
+ type: Input
230
230
  }] } });
231
231
 
232
- class BbImagePickerBase {
233
- }
234
- const BbImagePickerMixinBase = mixinDisabled(mixinGrouped(BbImagePickerBase));
235
- class BbImagePicker extends BbImagePickerMixinBase {
236
- constructor(_converter) {
237
- super();
238
- this._converter = _converter;
239
- // Inputs.
240
- this.label = null;
241
- this.placeholder = null;
242
- this.styleDimensions = null;
243
- this.cropDimensions = null;
244
- // Form.
245
- this._value$ = new BehaviorSubject(null);
246
- this.valueChange = new EventEmitter();
247
- this.onTouchedCallback = () => {
248
- };
249
- this.onChangeCallback = () => {
250
- };
251
- }
252
- get value() {
253
- return this._value$.getValue();
254
- }
255
- set value(value) {
256
- this._value$.next(value);
257
- this.valueChange.emit(value);
258
- }
259
- get image() {
260
- return this._value$.pipe(map(value => value || this.placeholder), map(value => value ? `url(${value})` : null));
261
- }
262
- onFileChange(event) {
263
- return __awaiter(this, void 0, void 0, function* () {
264
- // Grab the file from the event.
265
- const file = event.target.files[0];
266
- // Check if the file exists.
267
- if (!file || this.disabled) {
268
- return;
269
- }
270
- try {
271
- this.value = yield this._converter.toDataUri(file, this.cropDimensions);
272
- }
273
- catch (error) {
274
- this.value = null;
275
- }
276
- this.onChangeCallback(this.value);
277
- if (this.fileInput && this.fileInput.nativeElement) {
278
- this.fileInput.nativeElement.value = '';
279
- }
280
- });
281
- }
282
- openFilePicker() {
283
- if (this.disabled) {
284
- return;
285
- }
286
- // Execute a click on the file input.
287
- this.fileInput
288
- && this.fileInput.nativeElement
289
- && this.fileInput.nativeElement.click
290
- && this.fileInput.nativeElement.click();
291
- }
292
- writeValue(value) {
293
- this.value = value;
294
- }
295
- registerOnChange(method) {
296
- this.onChangeCallback = method;
297
- }
298
- registerOnTouched(method) {
299
- this.onTouchedCallback = method;
300
- }
301
- setDisabledState(isDisabled) {
302
- this.disabled = isDisabled;
303
- }
304
- }
305
- BbImagePicker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbImagePicker, deps: [{ token: i1$1.ImageConverter }], target: i0.ɵɵFactoryTarget.Component });
306
- BbImagePicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.1", 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;-moz-user-select:none;-ms-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) 50%/cover no-repeat}.bb-image-input-button{margin-top:10px}"], 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 });
307
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbImagePicker, decorators: [{
308
- type: Component,
309
- args: [{
310
- selector: 'bb-image-picker',
311
- templateUrl: './image-picker.component.html',
312
- styleUrls: ['./image-picker.component.scss'],
313
- changeDetection: ChangeDetectionStrategy.OnPush,
314
- encapsulation: ViewEncapsulation.None,
315
- host: {
316
- 'class': 'bb-image-picker',
317
- '[class.disabled]': 'disabled',
318
- '[class.grouped]': 'grouped'
319
- },
320
- inputs: ['grouped', 'disabled'],
321
- providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbImagePicker), multi: true }],
322
- preserveWhitespaces: false
323
- }]
324
- }], ctorParameters: function () { return [{ type: i1$1.ImageConverter }]; }, propDecorators: { fileInput: [{
325
- type: ViewChild,
326
- args: ['fileInput', { static: true }]
327
- }], label: [{
328
- type: Input
329
- }], placeholder: [{
330
- type: Input
331
- }], styleDimensions: [{
332
- type: Input
333
- }], cropDimensions: [{
334
- type: Input
335
- }], value: [{
336
- type: Input
337
- }], valueChange: [{
338
- type: Output
232
+ class BbImagePickerBase {
233
+ }
234
+ const BbImagePickerMixinBase = mixinDisabled(mixinGrouped(BbImagePickerBase));
235
+ class BbImagePicker extends BbImagePickerMixinBase {
236
+ constructor(_converter) {
237
+ super();
238
+ this._converter = _converter;
239
+ // Inputs.
240
+ this.label = null;
241
+ this.placeholder = null;
242
+ this.styleDimensions = null;
243
+ this.cropDimensions = null;
244
+ // Form.
245
+ this._value$ = new BehaviorSubject(null);
246
+ this.valueChange = new EventEmitter();
247
+ this.onTouchedCallback = () => {
248
+ };
249
+ this.onChangeCallback = () => {
250
+ };
251
+ }
252
+ get value() {
253
+ return this._value$.getValue();
254
+ }
255
+ set value(value) {
256
+ this._value$.next(value);
257
+ this.valueChange.emit(value);
258
+ }
259
+ get image() {
260
+ return this._value$.pipe(map(value => value || this.placeholder), map(value => value ? `url(${value})` : null));
261
+ }
262
+ onFileChange(event) {
263
+ return __awaiter(this, void 0, void 0, function* () {
264
+ // Grab the file from the event.
265
+ const file = event.target.files[0];
266
+ // Check if the file exists.
267
+ if (!file || this.disabled) {
268
+ return;
269
+ }
270
+ try {
271
+ this.value = yield this._converter.toDataUri(file, this.cropDimensions);
272
+ }
273
+ catch (error) {
274
+ this.value = null;
275
+ }
276
+ this.onChangeCallback(this.value);
277
+ if (this.fileInput && this.fileInput.nativeElement) {
278
+ this.fileInput.nativeElement.value = '';
279
+ }
280
+ });
281
+ }
282
+ openFilePicker() {
283
+ if (this.disabled) {
284
+ return;
285
+ }
286
+ // Execute a click on the file input.
287
+ this.fileInput
288
+ && this.fileInput.nativeElement
289
+ && this.fileInput.nativeElement.click
290
+ && this.fileInput.nativeElement.click();
291
+ }
292
+ writeValue(value) {
293
+ this.value = value;
294
+ }
295
+ registerOnChange(method) {
296
+ this.onChangeCallback = method;
297
+ }
298
+ registerOnTouched(method) {
299
+ this.onTouchedCallback = method;
300
+ }
301
+ setDisabledState(isDisabled) {
302
+ this.disabled = isDisabled;
303
+ }
304
+ }
305
+ BbImagePicker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbImagePicker, deps: [{ token: i1$1.ImageConverter }], target: i0.ɵɵFactoryTarget.Component });
306
+ BbImagePicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.10", 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;-moz-user-select:none;-ms-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 });
307
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbImagePicker, decorators: [{
308
+ type: Component,
309
+ args: [{
310
+ selector: 'bb-image-picker',
311
+ templateUrl: './image-picker.component.html',
312
+ styleUrls: ['./image-picker.component.scss'],
313
+ changeDetection: ChangeDetectionStrategy.OnPush,
314
+ encapsulation: ViewEncapsulation.None,
315
+ host: {
316
+ 'class': 'bb-image-picker',
317
+ '[class.disabled]': 'disabled',
318
+ '[class.grouped]': 'grouped'
319
+ },
320
+ inputs: ['grouped', 'disabled'],
321
+ providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbImagePicker), multi: true }],
322
+ preserveWhitespaces: false
323
+ }]
324
+ }], ctorParameters: function () { return [{ type: i1$1.ImageConverter }]; }, propDecorators: { fileInput: [{
325
+ type: ViewChild,
326
+ args: ['fileInput', { static: true }]
327
+ }], label: [{
328
+ type: Input
329
+ }], placeholder: [{
330
+ type: Input
331
+ }], styleDimensions: [{
332
+ type: Input
333
+ }], cropDimensions: [{
334
+ type: Input
335
+ }], value: [{
336
+ type: Input
337
+ }], valueChange: [{
338
+ type: Output
339
339
  }] } });
340
340
 
341
- class BbFormSubmit {
342
- constructor(_host, _formDirective) {
343
- this._host = _host;
344
- this._formDirective = _formDirective;
345
- }
346
- ngOnInit() {
347
- // Submit changes.
348
- const regularSubmitChanges$ = fromEvent(this.nativeElement, 'submit').pipe(mapTo(true));
349
- // Reactive form submit changes.
350
- const reactiveSubmitChanges$ = this.reactiveSubmitChanges();
351
- // Reset changes.
352
- const resetChanges$ = fromEvent(this.nativeElement, 'reset').pipe(mapTo(false));
353
- // Listen to the submit status.
354
- this.submitStatus$ = merge(regularSubmitChanges$, reactiveSubmitChanges$, resetChanges$).pipe(startWith(false), distinctUntilChanged(), shareReplay(1));
355
- }
356
- submit() {
357
- var _a, _b;
358
- (_b = (_a = this._formDirective) === null || _a === void 0 ? void 0 : _a.ngSubmit) === null || _b === void 0 ? void 0 : _b.emit();
359
- }
360
- reset() {
361
- var _a;
362
- return (_a = this.nativeElement) === null || _a === void 0 ? void 0 : _a.reset();
363
- }
364
- get nativeElement() {
365
- var _a;
366
- return (_a = this._host) === null || _a === void 0 ? void 0 : _a.nativeElement;
367
- }
368
- reactiveSubmitChanges() {
369
- if (!this._formDirective) {
370
- return EMPTY;
371
- }
372
- return this._formDirective.ngSubmit.pipe(mapTo(true));
373
- }
374
- }
375
- BbFormSubmit.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbFormSubmit, deps: [{ token: i0.ElementRef }, { token: i5.FormGroupDirective, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Directive });
376
- BbFormSubmit.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.1", type: BbFormSubmit, selector: "form", exportAs: ["bbForm"], ngImport: i0 });
377
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbFormSubmit, decorators: [{
378
- type: Directive,
379
- args: [{
380
- selector: 'form',
381
- exportAs: 'bbForm'
382
- }]
383
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i5.FormGroupDirective, decorators: [{
384
- type: Optional
385
- }, {
386
- type: Self
341
+ class BbFormSubmit {
342
+ constructor(_host, _formDirective) {
343
+ this._host = _host;
344
+ this._formDirective = _formDirective;
345
+ }
346
+ ngOnInit() {
347
+ // Submit changes.
348
+ const regularSubmitChanges$ = fromEvent(this.nativeElement, 'submit').pipe(mapTo(true));
349
+ // Reactive form submit changes.
350
+ const reactiveSubmitChanges$ = this.reactiveSubmitChanges();
351
+ // Reset changes.
352
+ const resetChanges$ = fromEvent(this.nativeElement, 'reset').pipe(mapTo(false));
353
+ // Listen to the submit status.
354
+ this.submitStatus$ = merge(regularSubmitChanges$, reactiveSubmitChanges$, resetChanges$).pipe(startWith(false), distinctUntilChanged(), shareReplay(1));
355
+ }
356
+ submit() {
357
+ var _a, _b;
358
+ (_b = (_a = this._formDirective) === null || _a === void 0 ? void 0 : _a.ngSubmit) === null || _b === void 0 ? void 0 : _b.emit();
359
+ }
360
+ reset() {
361
+ var _a;
362
+ return (_a = this.nativeElement) === null || _a === void 0 ? void 0 : _a.reset();
363
+ }
364
+ get nativeElement() {
365
+ var _a;
366
+ return (_a = this._host) === null || _a === void 0 ? void 0 : _a.nativeElement;
367
+ }
368
+ reactiveSubmitChanges() {
369
+ if (!this._formDirective) {
370
+ return EMPTY;
371
+ }
372
+ return this._formDirective.ngSubmit.pipe(mapTo(true));
373
+ }
374
+ }
375
+ BbFormSubmit.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbFormSubmit, deps: [{ token: i0.ElementRef }, { token: i5.FormGroupDirective, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Directive });
376
+ BbFormSubmit.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.10", type: BbFormSubmit, selector: "form", exportAs: ["bbForm"], ngImport: i0 });
377
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbFormSubmit, decorators: [{
378
+ type: Directive,
379
+ args: [{
380
+ selector: 'form',
381
+ exportAs: 'bbForm'
382
+ }]
383
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i5.FormGroupDirective, decorators: [{
384
+ type: Optional
385
+ }, {
386
+ type: Self
387
387
  }] }]; } });
388
388
 
389
- class BbFormError {
390
- constructor(_form, _control, _errors) {
391
- this._form = _form;
392
- this._control = _control;
393
- this._errors = _errors;
394
- // Outputs.
395
- this.errorChange = new EventEmitter();
396
- // Subscriptions.
397
- this._ngControl = null;
398
- }
399
- // Inputs.
400
- set control(value) {
401
- this._ngControl = value;
402
- }
403
- get control() {
404
- return this._ngControl;
405
- }
406
- ngOnInit() {
407
- // Set the control if it was not set before.
408
- if (!this.control) {
409
- this.control = this._control;
410
- }
411
- // Listen for the submit changes
412
- const submitStatus$ = this.submitStatusChanges();
413
- // An observable that emits error changes.
414
- const errorChanges$ = this.statusChanges().pipe(map(() => this.getError(this.control.errors)), distinctUntilChanged(), map(error => typeof error === 'string' ? { token: error } : error));
415
- // Whenever the user submitted the form we want to
416
- // listen for any error changes.
417
- this.error$ = combineLatest([submitStatus$, errorChanges$]).pipe(map(([submitted, error]) => {
418
- // If not submitted return null.
419
- if (!submitted) {
420
- return null;
421
- }
422
- // Return the error if submitted.
423
- return error;
424
- }), tap(value => this.errorChange.emit(value)));
425
- }
426
- getError(errors) {
427
- // Validate the errors exist.
428
- if (!errors) {
429
- return null;
430
- }
431
- // Get the first error in the errors.
432
- const [errorName] = Object.keys(errors);
433
- const error = errors[errorName];
434
- // Validate the error exists.
435
- if (!error) {
436
- return null;
437
- }
438
- // Map the arrays into a object so we can
439
- // access the functions by a key-lookup.
440
- const errorFunctions = this._errors.reduce((previous, current) => (Object.assign(Object.assign({}, previous), current)), {});
441
- // Get the error function.
442
- const errorFunction = errorFunctions[errorName] || errorFunctions['unknown'];
443
- // Validate the error function exists.
444
- if (!errorFunction) {
445
- return null;
446
- }
447
- // Return the parsed error.
448
- return errorFunction(error);
449
- }
450
- submitStatusChanges() {
451
- if (!this._form) {
452
- return of(true);
453
- }
454
- return this._form.submitStatus$;
455
- }
456
- statusChanges() {
457
- if (!this.control) {
458
- return EMPTY;
459
- }
460
- if (!this.control.statusChanges) {
461
- return EMPTY;
462
- }
463
- return this.control.statusChanges.pipe(startWith(this.control.status), delay(0));
464
- }
465
- }
466
- BbFormError.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbFormError, deps: [{ token: BbFormSubmit, optional: true }, { token: i5.NgControl, optional: true }, { token: ELEMENTS_ERRORS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
467
- BbFormError.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.1", 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}"], 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 });
468
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbFormError, decorators: [{
469
- type: Component,
470
- args: [{
471
- selector: 'bb-form-error',
472
- templateUrl: './form-error.component.html',
473
- styleUrls: ['./form-error.component.scss'],
474
- changeDetection: ChangeDetectionStrategy.OnPush,
475
- encapsulation: ViewEncapsulation.None,
476
- host: {
477
- 'class': 'bb-form-error'
478
- },
479
- preserveWhitespaces: false
480
- }]
481
- }], ctorParameters: function () { return [{ type: BbFormSubmit, decorators: [{
482
- type: Optional
483
- }] }, { type: i5.NgControl, decorators: [{
484
- type: Optional
485
- }] }, { type: undefined, decorators: [{
486
- type: Optional
487
- }, {
488
- type: Inject,
489
- args: [ELEMENTS_ERRORS]
490
- }] }]; }, propDecorators: { control: [{
491
- type: Input
492
- }], errorChange: [{
493
- type: Output
389
+ class BbFormError {
390
+ constructor(_form, _control, _errors) {
391
+ this._form = _form;
392
+ this._control = _control;
393
+ this._errors = _errors;
394
+ // Outputs.
395
+ this.errorChange = new EventEmitter();
396
+ // Subscriptions.
397
+ this._ngControl = null;
398
+ }
399
+ // Inputs.
400
+ set control(value) {
401
+ this._ngControl = value;
402
+ }
403
+ get control() {
404
+ return this._ngControl;
405
+ }
406
+ ngOnInit() {
407
+ // Set the control if it was not set before.
408
+ if (!this.control) {
409
+ this.control = this._control;
410
+ }
411
+ // Listen for the submit changes
412
+ const submitStatus$ = this.submitStatusChanges();
413
+ // An observable that emits error changes.
414
+ const errorChanges$ = this.statusChanges().pipe(map(() => this.getError(this.control.errors)), distinctUntilChanged(), map(error => typeof error === 'string' ? { token: error } : error));
415
+ // Whenever the user submitted the form we want to
416
+ // listen for any error changes.
417
+ this.error$ = combineLatest([submitStatus$, errorChanges$]).pipe(map(([submitted, error]) => {
418
+ // If not submitted return null.
419
+ if (!submitted) {
420
+ return null;
421
+ }
422
+ // Return the error if submitted.
423
+ return error;
424
+ }), tap(value => this.errorChange.emit(value)));
425
+ }
426
+ getError(errors) {
427
+ // Validate the errors exist.
428
+ if (!errors) {
429
+ return null;
430
+ }
431
+ // Get the first error in the errors.
432
+ const [errorName] = Object.keys(errors);
433
+ const error = errors[errorName];
434
+ // Validate the error exists.
435
+ if (!error) {
436
+ return null;
437
+ }
438
+ // Map the arrays into a object so we can
439
+ // access the functions by a key-lookup.
440
+ const errorFunctions = this._errors.reduce((previous, current) => (Object.assign(Object.assign({}, previous), current)), {});
441
+ // Get the error function.
442
+ const errorFunction = errorFunctions[errorName] || errorFunctions['unknown'];
443
+ // Validate the error function exists.
444
+ if (!errorFunction) {
445
+ return null;
446
+ }
447
+ // Return the parsed error.
448
+ return errorFunction(error);
449
+ }
450
+ submitStatusChanges() {
451
+ if (!this._form) {
452
+ return of(true);
453
+ }
454
+ return this._form.submitStatus$;
455
+ }
456
+ statusChanges() {
457
+ if (!this.control) {
458
+ return EMPTY;
459
+ }
460
+ if (!this.control.statusChanges) {
461
+ return EMPTY;
462
+ }
463
+ return this.control.statusChanges.pipe(startWith(this.control.status), delay(0));
464
+ }
465
+ }
466
+ BbFormError.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbFormError, deps: [{ token: BbFormSubmit, optional: true }, { token: i5.NgControl, optional: true }, { token: ELEMENTS_ERRORS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
467
+ BbFormError.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.10", 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 });
468
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbFormError, decorators: [{
469
+ type: Component,
470
+ args: [{
471
+ selector: 'bb-form-error',
472
+ templateUrl: './form-error.component.html',
473
+ styleUrls: ['./form-error.component.scss'],
474
+ changeDetection: ChangeDetectionStrategy.OnPush,
475
+ encapsulation: ViewEncapsulation.None,
476
+ host: {
477
+ 'class': 'bb-form-error'
478
+ },
479
+ preserveWhitespaces: false
480
+ }]
481
+ }], ctorParameters: function () { return [{ type: BbFormSubmit, decorators: [{
482
+ type: Optional
483
+ }] }, { type: i5.NgControl, decorators: [{
484
+ type: Optional
485
+ }] }, { type: undefined, decorators: [{
486
+ type: Optional
487
+ }, {
488
+ type: Inject,
489
+ args: [ELEMENTS_ERRORS]
490
+ }] }]; }, propDecorators: { control: [{
491
+ type: Input
492
+ }], errorChange: [{
493
+ type: Output
494
494
  }] } });
495
495
 
496
- class BbTemplate {
497
- constructor(_templateRef, _viewContainerRef) {
498
- this._templateRef = _templateRef;
499
- this._viewContainerRef = _viewContainerRef;
500
- }
501
- set bbTemplate(content) {
502
- // Get the template.
503
- const template = content instanceof TemplateRef
504
- ? content
505
- : this._templateRef;
506
- // Clear the view container ref and create the view.
507
- this._viewContainerRef.clear();
508
- this._viewContainerRef.createEmbeddedView(template);
509
- }
510
- }
511
- BbTemplate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbTemplate, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
512
- BbTemplate.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.1", type: BbTemplate, selector: "[bbTemplate]", inputs: { bbTemplate: "bbTemplate" }, ngImport: i0 });
513
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbTemplate, decorators: [{
514
- type: Directive,
515
- args: [{
516
- selector: '[bbTemplate]'
517
- }]
518
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { bbTemplate: [{
519
- type: Input
496
+ class BbTemplate {
497
+ constructor(_templateRef, _viewContainerRef) {
498
+ this._templateRef = _templateRef;
499
+ this._viewContainerRef = _viewContainerRef;
500
+ }
501
+ set bbTemplate(content) {
502
+ // Get the template.
503
+ const template = content instanceof TemplateRef
504
+ ? content
505
+ : this._templateRef;
506
+ // Clear the view container ref and create the view.
507
+ this._viewContainerRef.clear();
508
+ this._viewContainerRef.createEmbeddedView(template);
509
+ }
510
+ }
511
+ BbTemplate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbTemplate, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
512
+ BbTemplate.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.10", type: BbTemplate, selector: "[bbTemplate]", inputs: { bbTemplate: "bbTemplate" }, ngImport: i0 });
513
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbTemplate, decorators: [{
514
+ type: Directive,
515
+ args: [{
516
+ selector: '[bbTemplate]'
517
+ }]
518
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { bbTemplate: [{
519
+ type: Input
520
520
  }] } });
521
521
 
522
- let nextUniqueId$2 = 0;
523
- class BbFormControlBase {
524
- }
525
- const BbFormControlMixinBase = mixinDisabled(mixinFocused(mixinReadonly(mixinGrouped(mixinRequired(mixinError(mixinHideErrors(BbFormControlBase)))))));
526
- class BbFormControl extends BbFormControlMixinBase {
527
- constructor() {
528
- super(...arguments);
529
- // Inputs.
530
- this.label = null;
531
- this.hint = null;
532
- // Data.
533
- this.arrow = false;
534
- // Data.
535
- this.labelId = `bb-form-control-${nextUniqueId$2++}`;
536
- }
537
- onErrorChange(error) {
538
- this.error = !!error;
539
- }
540
- }
541
- BbFormControl.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbFormControl, deps: null, target: i0.ɵɵFactoryTarget.Component });
542
- BbFormControl.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.1", 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:hsla(0,0%,80%,.64)}.bb-form-control.disabled>.bb-form-control-container>input,.bb-form-control.disabled>.bb-form-control-container>select,.bb-form-control.disabled>.bb-form-control-container>textarea{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 0 0 hsla(213,8%,74%,.2),0 6px 6px -6px rgba(0,0,0,.1),0 0 0 3px rgba(0,123,255,.2)}.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container>input::-moz-placeholder,.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container>textarea::-moz-placeholder{color:#b4b4b4;-moz-transition:color .3s cubic-bezier(0,0,.2,1);transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container>input:-ms-input-placeholder,.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container>textarea:-ms-input-placeholder{color:#b4b4b4;-ms-transition:color .3s cubic-bezier(0,0,.2,1);transition:color .3s cubic-bezier(0,0,.2,1)}.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:rgba(194,57,52,.25)!important;box-shadow:inset 0 3px 0 0 hsla(213,8%,74%,.2),0 6px 6px -6px rgba(0,0,0,.1),0 0 0 3px rgba(194,57,52,.4)!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::-moz-placeholder,.bb-form-control.error>.bb-form-control-container>textarea::-moz-placeholder{color:rgba(194,57,52,.4)!important}.bb-form-control.error>.bb-form-control-container>input:-ms-input-placeholder,.bb-form-control.error>.bb-form-control-container>textarea:-ms-input-placeholder{color:rgba(194,57,52,.4)!important}.bb-form-control.error>.bb-form-control-container>input::placeholder,.bb-form-control.error>.bb-form-control-container>textarea::placeholder{color:rgba(194,57,52,.4)!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);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 0 0 hsla(213,8%,74%,.2),0 6px 6px -6px rgba(0,0,0,.1)}.bb-form-control-container>input::-moz-placeholder,.bb-form-control-container>textarea::-moz-placeholder{color:#d2d2d2;-moz-transition:color .3s cubic-bezier(0,0,.2,1);transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control-container>input:-ms-input-placeholder,.bb-form-control-container>textarea:-ms-input-placeholder{color:#d2d2d2;-ms-transition:color .3s cubic-bezier(0,0,.2,1);transition:color .3s cubic-bezier(0,0,.2,1)}.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>select,.bb-form-control-container>textarea{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-cancel-button,.bb-form-control-container>input::-webkit-search-decoration,.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}"], 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 });
543
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbFormControl, decorators: [{
544
- type: Component,
545
- args: [{
546
- selector: 'bb-form-control',
547
- templateUrl: './form-control.component.html',
548
- styleUrls: ['./form-control.component.scss'],
549
- changeDetection: ChangeDetectionStrategy.OnPush,
550
- encapsulation: ViewEncapsulation.None,
551
- host: {
552
- 'class': 'bb-form-control',
553
- '[class.readonly]': 'readonly',
554
- '[class.required]': 'required',
555
- '[class.disabled]': 'disabled',
556
- '[class.focused]': 'focused',
557
- '[class.grouped]': 'grouped',
558
- '[class.arrow]': 'arrow',
559
- '[class.error]': 'error'
560
- },
561
- inputs: ['grouped', 'hideErrors'],
562
- preserveWhitespaces: false
563
- }]
564
- }], propDecorators: { ngControl: [{
565
- type: ContentChild,
566
- args: [NgControl]
567
- }], label: [{
568
- type: Input
569
- }], hint: [{
570
- type: Input
522
+ let nextUniqueId$2 = 0;
523
+ class BbFormControlBase {
524
+ }
525
+ const BbFormControlMixinBase = mixinDisabled(mixinFocused(mixinReadonly(mixinGrouped(mixinRequired(mixinError(mixinHideErrors(BbFormControlBase)))))));
526
+ class BbFormControl extends BbFormControlMixinBase {
527
+ constructor() {
528
+ super(...arguments);
529
+ // Inputs.
530
+ this.label = null;
531
+ this.hint = null;
532
+ // Data.
533
+ this.arrow = false;
534
+ // Data.
535
+ this.labelId = `bb-form-control-${nextUniqueId$2++}`;
536
+ }
537
+ onErrorChange(error) {
538
+ this.error = !!error;
539
+ }
540
+ }
541
+ BbFormControl.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbFormControl, deps: null, target: i0.ɵɵFactoryTarget.Component });
542
+ BbFormControl.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.10", 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::-moz-placeholder,.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container>textarea::-moz-placeholder{color:#b4b4b4;-moz-transition:color .3s cubic-bezier(0,0,.2,1);transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container>input:-ms-input-placeholder,.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container>textarea:-ms-input-placeholder{color:#b4b4b4;-ms-transition:color .3s cubic-bezier(0,0,.2,1);transition:color .3s cubic-bezier(0,0,.2,1)}.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::-moz-placeholder,.bb-form-control.error>.bb-form-control-container>textarea::-moz-placeholder{color:#c2393466!important}.bb-form-control.error>.bb-form-control-container>input:-ms-input-placeholder,.bb-form-control.error>.bb-form-control-container>textarea:-ms-input-placeholder{color:#c2393466!important}.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::-moz-placeholder,.bb-form-control-container>textarea::-moz-placeholder{color:#d2d2d2;-moz-transition:color .3s cubic-bezier(0,0,.2,1);transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control-container>input:-ms-input-placeholder,.bb-form-control-container>textarea:-ms-input-placeholder{color:#d2d2d2;-ms-transition:color .3s cubic-bezier(0,0,.2,1);transition:color .3s cubic-bezier(0,0,.2,1)}.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 });
543
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbFormControl, decorators: [{
544
+ type: Component,
545
+ args: [{
546
+ selector: 'bb-form-control',
547
+ templateUrl: './form-control.component.html',
548
+ styleUrls: ['./form-control.component.scss'],
549
+ changeDetection: ChangeDetectionStrategy.OnPush,
550
+ encapsulation: ViewEncapsulation.None,
551
+ host: {
552
+ 'class': 'bb-form-control',
553
+ '[class.readonly]': 'readonly',
554
+ '[class.required]': 'required',
555
+ '[class.disabled]': 'disabled',
556
+ '[class.focused]': 'focused',
557
+ '[class.grouped]': 'grouped',
558
+ '[class.arrow]': 'arrow',
559
+ '[class.error]': 'error'
560
+ },
561
+ inputs: ['grouped', 'hideErrors'],
562
+ preserveWhitespaces: false
563
+ }]
564
+ }], propDecorators: { ngControl: [{
565
+ type: ContentChild,
566
+ args: [NgControl]
567
+ }], label: [{
568
+ type: Input
569
+ }], hint: [{
570
+ type: Input
571
571
  }] } });
572
572
 
573
- class BbFileImage {
574
- constructor(_platform, _image, _sanitizer) {
575
- this._platform = _platform;
576
- this._image = _image;
577
- this._sanitizer = _sanitizer;
578
- }
579
- transform(file) {
580
- return __awaiter(this, void 0, void 0, function* () {
581
- // If the file is not a file return.
582
- if (!this._platform.isBrowser || !(file instanceof File)) {
583
- return null;
584
- }
585
- return this._image.fileToImage(file, [
586
- 'image/png',
587
- 'image/jpeg',
588
- 'image/gif',
589
- 'image/svg+xml'
590
- ]).then(image => {
591
- if (!image) {
592
- return null;
593
- }
594
- return {
595
- background: this._sanitizer.bypassSecurityTrustStyle(`url(${image.src})`),
596
- aspectRatio: image.height / image.width
597
- };
598
- }).catch(() => {
599
- return null;
600
- });
601
- });
602
- }
603
- }
604
- BbFileImage.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbFileImage, deps: [{ token: i1$1.Platform }, { token: i1$1.ImageConverter }, { token: i2.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
605
- BbFileImage.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbFileImage, name: "bbFileImage" });
606
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbFileImage, decorators: [{
607
- type: Pipe,
608
- args: [{
609
- name: 'bbFileImage'
610
- }]
573
+ class BbFileImage {
574
+ constructor(_platform, _image, _sanitizer) {
575
+ this._platform = _platform;
576
+ this._image = _image;
577
+ this._sanitizer = _sanitizer;
578
+ }
579
+ transform(file) {
580
+ return __awaiter(this, void 0, void 0, function* () {
581
+ // If the file is not a file return.
582
+ if (!this._platform.isBrowser || !(file instanceof File)) {
583
+ return null;
584
+ }
585
+ return this._image.fileToImage(file, [
586
+ 'image/png',
587
+ 'image/jpeg',
588
+ 'image/gif',
589
+ 'image/svg+xml'
590
+ ]).then(image => {
591
+ if (!image) {
592
+ return null;
593
+ }
594
+ return {
595
+ background: this._sanitizer.bypassSecurityTrustStyle(`url(${image.src})`),
596
+ aspectRatio: image.height / image.width
597
+ };
598
+ }).catch(() => {
599
+ return null;
600
+ });
601
+ });
602
+ }
603
+ }
604
+ BbFileImage.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbFileImage, deps: [{ token: i1$1.Platform }, { token: i1$1.ImageConverter }, { token: i2.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
605
+ BbFileImage.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbFileImage, name: "bbFileImage" });
606
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbFileImage, decorators: [{
607
+ type: Pipe,
608
+ args: [{
609
+ name: 'bbFileImage'
610
+ }]
611
611
  }], ctorParameters: function () { return [{ type: i1$1.Platform }, { type: i1$1.ImageConverter }, { type: i2.DomSanitizer }]; } });
612
612
 
613
- class BbFileSize {
614
- constructor() {
615
- this.format = (value, decimals = 2) => {
616
- if (value === 0) {
617
- return '0 Bytes';
618
- }
619
- const k = 1024;
620
- const dm = decimals < 0 ? 0 : decimals;
621
- const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
622
- const index = Math.floor(Math.log(value) / Math.log(k));
623
- return parseFloat((value / Math.pow(k, index)).toFixed(dm)) + ' ' + sizes[index];
624
- };
625
- }
626
- transform(value) {
627
- return this.format(value);
628
- }
629
- }
630
- BbFileSize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbFileSize, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
631
- BbFileSize.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbFileSize, name: "bbFileSize" });
632
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbFileSize, decorators: [{
633
- type: Pipe,
634
- args: [{
635
- name: 'bbFileSize'
636
- }]
613
+ class BbFileSize {
614
+ constructor() {
615
+ this.format = (value, decimals = 2) => {
616
+ if (value === 0) {
617
+ return '0 Bytes';
618
+ }
619
+ const k = 1024;
620
+ const dm = decimals < 0 ? 0 : decimals;
621
+ const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
622
+ const index = Math.floor(Math.log(value) / Math.log(k));
623
+ return parseFloat((value / Math.pow(k, index)).toFixed(dm)) + ' ' + sizes[index];
624
+ };
625
+ }
626
+ transform(value) {
627
+ return this.format(value);
628
+ }
629
+ }
630
+ BbFileSize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbFileSize, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
631
+ BbFileSize.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbFileSize, name: "bbFileSize" });
632
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbFileSize, decorators: [{
633
+ type: Pipe,
634
+ args: [{
635
+ name: 'bbFileSize'
636
+ }]
637
637
  }] });
638
638
 
639
- let nextUniqueId$1 = 0;
640
- class BbFilePickerBase {
641
- }
642
- const BbFilePickerMixinBase$1 = mixinRequired(mixinDisabled(mixinGrouped(mixinError(mixinHideErrors(BbFilePickerBase)))));
643
- class BbFilePicker extends BbFilePickerMixinBase$1 {
644
- constructor() {
645
- super(...arguments);
646
- // Inputs.
647
- this.label = null;
648
- this.hint = null;
649
- this.accept = null;
650
- this.showImages = true;
651
- this.allowDragging = true;
652
- // State.
653
- this.labelId = `bb-file-picker-${nextUniqueId$1++}`;
654
- this.hovered = false;
655
- this.value$ = new BehaviorSubject({});
656
- this.valueChange = new EventEmitter();
657
- this.onTouchedCallback = () => {
658
- };
659
- this.onChangeCallback = () => {
660
- };
661
- this.saveFile = (files) => {
662
- // Validate the files exist.
663
- if (!files) {
664
- return;
665
- }
666
- // Retrieve the first file.
667
- const file = files[0];
668
- // Validate the first file exists.
669
- if (!file) {
670
- return;
671
- }
672
- // Save the file.
673
- this.value = file;
674
- };
675
- this.getFileListFromEvent = (event) => {
676
- const element = event.target;
677
- if (!element) {
678
- return null;
679
- }
680
- return element.files;
681
- };
682
- this.preventDefault = (event) => {
683
- event.preventDefault();
684
- event.stopPropagation();
685
- };
686
- }
687
- get value() {
688
- const { file } = this.value$.getValue();
689
- return file;
690
- }
691
- set value(value) {
692
- this.value$.next({ file: value });
693
- this.valueChange.emit(value);
694
- }
695
- onDrag(event, isHovered) {
696
- // Validate the input can support drag.
697
- if (!this.allowDragging || this.disabled) {
698
- return;
699
- }
700
- // Prevent the default event action
701
- // and start the hovering.
702
- this.preventDefault(event);
703
- this.hovered = isHovered;
704
- }
705
- onDrop(event) {
706
- // Validate the input can support drag.
707
- if (!this.allowDragging || this.disabled) {
708
- return;
709
- }
710
- // Prevent the default event action
711
- // and stop the hovering.
712
- this.preventDefault(event);
713
- this.hovered = false;
714
- // Save the file.
715
- this.saveFile(event['dataTransfer'].files);
716
- // Run the on change callback.
717
- this.onChangeCallback(this.value);
718
- }
719
- onButtonPressed(file) {
720
- if (file) {
721
- this.value = null;
722
- this.onChangeCallback(this.value);
723
- return;
724
- }
725
- return this.openFilePicker();
726
- }
727
- openFilePicker() {
728
- return this.fileInput
729
- && this.fileInput.nativeElement
730
- && this.fileInput.nativeElement.click
731
- && this.fileInput.nativeElement.click();
732
- }
733
- onFileChange(event) {
734
- // Validate the input is not disabled.
735
- if (this.disabled) {
736
- return;
737
- }
738
- // Extract the file from the event.
739
- const fileList = this.getFileListFromEvent(event);
740
- // Save the file.
741
- this.saveFile(fileList);
742
- // Run the on change callback.
743
- this.onChangeCallback(this.value);
744
- // Clear the file input.
745
- if (this.fileInput && this.fileInput.nativeElement) {
746
- this.fileInput.nativeElement.value = '';
747
- }
748
- }
749
- writeValue(value) {
750
- this.value = value;
751
- }
752
- registerOnChange(method) {
753
- this.onChangeCallback = method;
754
- }
755
- registerOnTouched(method) {
756
- this.onTouchedCallback = method;
757
- }
758
- setDisabledState(isDisabled) {
759
- this.disabled = isDisabled;
760
- }
761
- onErrorChange(error) {
762
- this.error = !!error;
763
- }
764
- validate({ value }) {
765
- if (value === null || value === undefined) {
766
- return null;
767
- }
768
- const regexString = (this.accept || '*')
769
- .replace(/\*/g, '.\*')
770
- .replace(/,/g, '|');
771
- const mimeTypeRegex = new RegExp(regexString);
772
- const isNotValid = (typeof File === 'undefined') || !(value instanceof File) || !mimeTypeRegex.test(value === null || value === void 0 ? void 0 : value.type);
773
- return isNotValid && {
774
- invalidFileType: true
775
- };
776
- }
777
- }
778
- BbFilePicker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbFilePicker, deps: null, target: i0.ɵɵFactoryTarget.Component });
779
- BbFilePicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.1", 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: [
780
- {
781
- provide: NG_VALUE_ACCESSOR,
782
- useExisting: forwardRef(() => BbFilePicker),
783
- multi: true
784
- },
785
- {
786
- provide: NG_VALIDATORS,
787
- useExisting: BbFilePicker,
788
- multi: true
789
- }
790
- ], 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:hsla(0,0%,80%,.64)}.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).hovered>.bb-file-picker-wrapper,.bb-file-picker:not(.disabled):focus>.bb-file-picker-wrapper{box-shadow:inset 0 3px 0 0 hsla(213,8%,74%,.2),0 6px 6px -6px rgba(0,0,0,.1),0 0 0 3px rgba(0,123,255,.2)}.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:rgba(194,57,52,.25)!important;box-shadow:inset 0 3px 0 0 hsla(213,8%,74%,.2),0 6px 6px -6px rgba(0,0,0,.1),0 0 0 3px rgba(194,57,52,.4)!important}.bb-file-picker.error .bb-file-picker-button{background-color:transparent}.bb-file-picker-wrapper{max-width:100%;-webkit-user-select:none;-moz-user-select:none;-ms-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 0 0 hsla(213,8%,74%,.2),0 6px 6px -6px rgba(0,0,0,.1)}.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;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:none;border-right:1px solid #b6bbc1;background-color:hsla(0,0%,100%,.5);transition:box-shadow .2s cubic-bezier(0,0,.2,1)}.bb-file-picker-button:focus{box-shadow:0 0 0 3px rgba(0,123,255,.2)}.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;font-size:14px;padding:8px 12px;line-height:18px;justify-content:center}.bb-file-picker-info,.bb-file-picker-zone{color:#848f99;align-items:center;display:inline-flex}.bb-file-picker-info{height:0;padding:0 12px;overflow:hidden;line-height:36px;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:50%;background-repeat:no-repeat}.bb-file-picker-hint{display:block;color:#738694;font-size:13px;margin-top:4px}"], 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: [
791
- trigger('bbFilePickerImageAnimation', [
792
- transition(':enter', [
793
- style({ opacity: 0 }),
794
- animate('200ms', style({ opacity: 1 }))
795
- ]),
796
- transition(':leave', [
797
- animate('200ms', style({ opacity: 0 }))
798
- ])
799
- ])
800
- ], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
801
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbFilePicker, decorators: [{
802
- type: Component,
803
- args: [{
804
- selector: 'bb-file-picker',
805
- templateUrl: './file-picker.component.html',
806
- styleUrls: ['./file-picker.component.scss'],
807
- changeDetection: ChangeDetectionStrategy.OnPush,
808
- encapsulation: ViewEncapsulation.None,
809
- providers: [
810
- {
811
- provide: NG_VALUE_ACCESSOR,
812
- useExisting: forwardRef(() => BbFilePicker),
813
- multi: true
814
- },
815
- {
816
- provide: NG_VALIDATORS,
817
- useExisting: BbFilePicker,
818
- multi: true
819
- }
820
- ],
821
- host: {
822
- 'class': 'bb-file-picker',
823
- '[class.required]': 'required',
824
- '[class.disabled]': 'disabled',
825
- '[class.grouped]': 'grouped',
826
- '[class.hovered]': 'hovered',
827
- '[class.error]': 'error'
828
- },
829
- animations: [
830
- trigger('bbFilePickerImageAnimation', [
831
- transition(':enter', [
832
- style({ opacity: 0 }),
833
- animate('200ms', style({ opacity: 1 }))
834
- ]),
835
- transition(':leave', [
836
- animate('200ms', style({ opacity: 0 }))
837
- ])
838
- ])
839
- ],
840
- inputs: ['disabled', 'hideErrors', 'grouped', 'required'],
841
- preserveWhitespaces: false
842
- }]
843
- }], propDecorators: { fileInput: [{
844
- type: ViewChild,
845
- args: ['fileInput', { static: true }]
846
- }], extraTemplate: [{
847
- type: ContentChild,
848
- args: ['extra']
849
- }], label: [{
850
- type: Input
851
- }], hint: [{
852
- type: Input
853
- }], accept: [{
854
- type: Input
855
- }], showImages: [{
856
- type: Input
857
- }], allowDragging: [{
858
- type: Input
859
- }], value: [{
860
- type: Input
861
- }], valueChange: [{
862
- type: Output
863
- }], onDrag: [{
864
- type: HostListener,
865
- args: ['dragover', ['$event', 'true']]
866
- }, {
867
- type: HostListener,
868
- args: ['dragleave', ['$event', 'false']]
869
- }], onDrop: [{
870
- type: HostListener,
871
- args: ['drop', ['$event']]
639
+ let nextUniqueId$1 = 0;
640
+ class BbFilePickerBase {
641
+ }
642
+ const BbFilePickerMixinBase$1 = mixinRequired(mixinDisabled(mixinGrouped(mixinError(mixinHideErrors(BbFilePickerBase)))));
643
+ class BbFilePicker extends BbFilePickerMixinBase$1 {
644
+ constructor() {
645
+ super(...arguments);
646
+ // Inputs.
647
+ this.label = null;
648
+ this.hint = null;
649
+ this.accept = null;
650
+ this.showImages = true;
651
+ this.allowDragging = true;
652
+ // State.
653
+ this.labelId = `bb-file-picker-${nextUniqueId$1++}`;
654
+ this.hovered = false;
655
+ this.value$ = new BehaviorSubject({});
656
+ this.valueChange = new EventEmitter();
657
+ this.onTouchedCallback = () => {
658
+ };
659
+ this.onChangeCallback = () => {
660
+ };
661
+ this.saveFile = (files) => {
662
+ // Validate the files exist.
663
+ if (!files) {
664
+ return;
665
+ }
666
+ // Retrieve the first file.
667
+ const file = files[0];
668
+ // Validate the first file exists.
669
+ if (!file) {
670
+ return;
671
+ }
672
+ // Save the file.
673
+ this.value = file;
674
+ };
675
+ this.getFileListFromEvent = (event) => {
676
+ const element = event.target;
677
+ if (!element) {
678
+ return null;
679
+ }
680
+ return element.files;
681
+ };
682
+ this.preventDefault = (event) => {
683
+ event.preventDefault();
684
+ event.stopPropagation();
685
+ };
686
+ }
687
+ get value() {
688
+ const { file } = this.value$.getValue();
689
+ return file;
690
+ }
691
+ set value(value) {
692
+ this.value$.next({ file: value });
693
+ this.valueChange.emit(value);
694
+ }
695
+ onDrag(event, isHovered) {
696
+ // Validate the input can support drag.
697
+ if (!this.allowDragging || this.disabled) {
698
+ return;
699
+ }
700
+ // Prevent the default event action
701
+ // and start the hovering.
702
+ this.preventDefault(event);
703
+ this.hovered = isHovered;
704
+ }
705
+ onDrop(event) {
706
+ // Validate the input can support drag.
707
+ if (!this.allowDragging || this.disabled) {
708
+ return;
709
+ }
710
+ // Prevent the default event action
711
+ // and stop the hovering.
712
+ this.preventDefault(event);
713
+ this.hovered = false;
714
+ // Save the file.
715
+ this.saveFile(event['dataTransfer'].files);
716
+ // Run the on change callback.
717
+ this.onChangeCallback(this.value);
718
+ }
719
+ onButtonPressed(file) {
720
+ if (file) {
721
+ this.value = null;
722
+ this.onChangeCallback(this.value);
723
+ return;
724
+ }
725
+ return this.openFilePicker();
726
+ }
727
+ openFilePicker() {
728
+ return this.fileInput
729
+ && this.fileInput.nativeElement
730
+ && this.fileInput.nativeElement.click
731
+ && this.fileInput.nativeElement.click();
732
+ }
733
+ onFileChange(event) {
734
+ // Validate the input is not disabled.
735
+ if (this.disabled) {
736
+ return;
737
+ }
738
+ // Extract the file from the event.
739
+ const fileList = this.getFileListFromEvent(event);
740
+ // Save the file.
741
+ this.saveFile(fileList);
742
+ // Run the on change callback.
743
+ this.onChangeCallback(this.value);
744
+ // Clear the file input.
745
+ if (this.fileInput && this.fileInput.nativeElement) {
746
+ this.fileInput.nativeElement.value = '';
747
+ }
748
+ }
749
+ writeValue(value) {
750
+ this.value = value;
751
+ }
752
+ registerOnChange(method) {
753
+ this.onChangeCallback = method;
754
+ }
755
+ registerOnTouched(method) {
756
+ this.onTouchedCallback = method;
757
+ }
758
+ setDisabledState(isDisabled) {
759
+ this.disabled = isDisabled;
760
+ }
761
+ onErrorChange(error) {
762
+ this.error = !!error;
763
+ }
764
+ validate({ value }) {
765
+ if (value === null || value === undefined) {
766
+ return null;
767
+ }
768
+ const regexString = (this.accept || '*')
769
+ .replace(/\*/g, '.\*')
770
+ .replace(/,/g, '|');
771
+ const mimeTypeRegex = new RegExp(regexString);
772
+ const isNotValid = (typeof File === 'undefined') || !(value instanceof File) || !mimeTypeRegex.test(value === null || value === void 0 ? void 0 : value.type);
773
+ return isNotValid && {
774
+ invalidFileType: true
775
+ };
776
+ }
777
+ }
778
+ BbFilePicker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbFilePicker, deps: null, target: i0.ɵɵFactoryTarget.Component });
779
+ BbFilePicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.10", 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: [
780
+ {
781
+ provide: NG_VALUE_ACCESSOR,
782
+ useExisting: forwardRef(() => BbFilePicker),
783
+ multi: true
784
+ },
785
+ {
786
+ provide: NG_VALIDATORS,
787
+ useExisting: BbFilePicker,
788
+ multi: true
789
+ }
790
+ ], 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;-moz-user-select:none;-ms-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: [
791
+ trigger('bbFilePickerImageAnimation', [
792
+ transition(':enter', [
793
+ style({ opacity: 0 }),
794
+ animate('200ms', style({ opacity: 1 }))
795
+ ]),
796
+ transition(':leave', [
797
+ animate('200ms', style({ opacity: 0 }))
798
+ ])
799
+ ])
800
+ ], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
801
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbFilePicker, decorators: [{
802
+ type: Component,
803
+ args: [{
804
+ selector: 'bb-file-picker',
805
+ templateUrl: './file-picker.component.html',
806
+ styleUrls: ['./file-picker.component.scss'],
807
+ changeDetection: ChangeDetectionStrategy.OnPush,
808
+ encapsulation: ViewEncapsulation.None,
809
+ providers: [
810
+ {
811
+ provide: NG_VALUE_ACCESSOR,
812
+ useExisting: forwardRef(() => BbFilePicker),
813
+ multi: true
814
+ },
815
+ {
816
+ provide: NG_VALIDATORS,
817
+ useExisting: BbFilePicker,
818
+ multi: true
819
+ }
820
+ ],
821
+ host: {
822
+ 'class': 'bb-file-picker',
823
+ '[class.required]': 'required',
824
+ '[class.disabled]': 'disabled',
825
+ '[class.grouped]': 'grouped',
826
+ '[class.hovered]': 'hovered',
827
+ '[class.error]': 'error'
828
+ },
829
+ animations: [
830
+ trigger('bbFilePickerImageAnimation', [
831
+ transition(':enter', [
832
+ style({ opacity: 0 }),
833
+ animate('200ms', style({ opacity: 1 }))
834
+ ]),
835
+ transition(':leave', [
836
+ animate('200ms', style({ opacity: 0 }))
837
+ ])
838
+ ])
839
+ ],
840
+ inputs: ['disabled', 'hideErrors', 'grouped', 'required'],
841
+ preserveWhitespaces: false
842
+ }]
843
+ }], propDecorators: { fileInput: [{
844
+ type: ViewChild,
845
+ args: ['fileInput', { static: true }]
846
+ }], extraTemplate: [{
847
+ type: ContentChild,
848
+ args: ['extra']
849
+ }], label: [{
850
+ type: Input
851
+ }], hint: [{
852
+ type: Input
853
+ }], accept: [{
854
+ type: Input
855
+ }], showImages: [{
856
+ type: Input
857
+ }], allowDragging: [{
858
+ type: Input
859
+ }], value: [{
860
+ type: Input
861
+ }], valueChange: [{
862
+ type: Output
863
+ }], onDrag: [{
864
+ type: HostListener,
865
+ args: ['dragover', ['$event', 'true']]
866
+ }, {
867
+ type: HostListener,
868
+ args: ['dragleave', ['$event', 'false']]
869
+ }], onDrop: [{
870
+ type: HostListener,
871
+ args: ['drop', ['$event']]
872
872
  }] } });
873
873
 
874
- class BbSelect {
875
- constructor(_elementRef, _ngControl, _formControl) {
876
- this._elementRef = _elementRef;
877
- this._ngControl = _ngControl;
878
- this._formControl = _formControl;
879
- this.hasArrow = true;
880
- this._disabled = false;
881
- this._required = false;
882
- }
883
- ngOnInit() {
884
- // Set an arrow on the form control if
885
- // it requires one.
886
- this._formControl.arrow = this.hasArrow;
887
- }
888
- ngDoCheck() {
889
- if (this._ngControl) {
890
- this.disabled = this._ngControl.disabled;
891
- }
892
- }
893
- ngOnDestroy() {
894
- var _a;
895
- (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
896
- }
897
- focus() {
898
- var _a, _b;
899
- return (_b = (_a = this._elementRef) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.focus();
900
- }
901
- setFocus(hasFocus) {
902
- if (!this._formControl) {
903
- return;
904
- }
905
- this._formControl.focused = hasFocus;
906
- }
907
- get id() {
908
- var _a, _b;
909
- return (_b = (_a = this._formControl) === null || _a === void 0 ? void 0 : _a.labelId) !== null && _b !== void 0 ? _b : null;
910
- }
911
- get disabled() {
912
- if (this._ngControl && this._ngControl.disabled !== null) {
913
- return this._ngControl.disabled;
914
- }
915
- return this._disabled;
916
- }
917
- set disabled(newValue) {
918
- this._disabled = coerceBooleanProperty(newValue);
919
- if (!this._formControl) {
920
- return;
921
- }
922
- this._formControl.disabled = this._disabled;
923
- }
924
- get required() {
925
- return this._required;
926
- }
927
- set required(newValue) {
928
- this._required = coerceBooleanProperty(newValue);
929
- if (!this._formControl) {
930
- return;
931
- }
932
- this._formControl.required = this._required;
933
- }
934
- }
935
- BbSelect.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", 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 });
936
- BbSelect.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.1", 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 });
937
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbSelect, decorators: [{
938
- type: Directive,
939
- args: [{
940
- selector: 'select[bbInput]',
941
- host: {
942
- '[disabled]': 'disabled',
943
- '(focus)': 'setFocus(true)',
944
- '(blur)': 'setFocus(false)'
945
- }
946
- }]
947
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i5.NgControl, decorators: [{
948
- type: Optional
949
- }, {
950
- type: Self
951
- }] }, { type: BbFormControl, decorators: [{
952
- type: Optional
953
- }, {
954
- type: Host
955
- }] }]; }, propDecorators: { id: [{
956
- type: HostBinding,
957
- args: ['attr.id']
958
- }], disabled: [{
959
- type: Input
960
- }], required: [{
961
- type: Input
962
- }] } });
963
- class BbInput extends BbSelect {
964
- constructor(_elementRef, _ngControl, _formControl) {
965
- super(_elementRef, _ngControl, _formControl);
966
- this._elementRef = _elementRef;
967
- this._ngControl = _ngControl;
968
- this._formControl = _formControl;
969
- this.hasArrow = false;
970
- this._readonly = false;
971
- }
972
- get readonly() {
973
- return this._readonly;
974
- }
975
- set readonly(newValue) {
976
- this._readonly = coerceBooleanProperty(newValue);
977
- if (!this._formControl) {
978
- return;
979
- }
980
- this._formControl.readonly = this._readonly;
981
- }
982
- }
983
- BbInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", 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 });
984
- BbInput.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.1", 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 });
985
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbInput, decorators: [{
986
- type: Directive,
987
- args: [{
988
- selector: 'input[bbInput], textarea[bbInput]',
989
- host: {
990
- '[disabled]': 'disabled',
991
- '[readonly]': 'readonly',
992
- '(focus)': 'setFocus(true)',
993
- '(blur)': 'setFocus(false)'
994
- }
995
- }]
996
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i5.NgControl, decorators: [{
997
- type: Optional
998
- }, {
999
- type: Self
1000
- }] }, { type: BbFormControl, decorators: [{
1001
- type: Optional
1002
- }, {
1003
- type: Host
1004
- }] }]; }, propDecorators: { readonly: [{
1005
- type: Input
874
+ class BbSelect {
875
+ constructor(_elementRef, _ngControl, _formControl) {
876
+ this._elementRef = _elementRef;
877
+ this._ngControl = _ngControl;
878
+ this._formControl = _formControl;
879
+ this.hasArrow = true;
880
+ this._disabled = false;
881
+ this._required = false;
882
+ }
883
+ ngOnInit() {
884
+ // Set an arrow on the form control if
885
+ // it requires one.
886
+ this._formControl.arrow = this.hasArrow;
887
+ }
888
+ ngDoCheck() {
889
+ if (this._ngControl) {
890
+ this.disabled = this._ngControl.disabled;
891
+ }
892
+ }
893
+ ngOnDestroy() {
894
+ var _a;
895
+ (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
896
+ }
897
+ focus() {
898
+ var _a, _b;
899
+ return (_b = (_a = this._elementRef) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.focus();
900
+ }
901
+ setFocus(hasFocus) {
902
+ if (!this._formControl) {
903
+ return;
904
+ }
905
+ this._formControl.focused = hasFocus;
906
+ }
907
+ get id() {
908
+ var _a, _b;
909
+ return (_b = (_a = this._formControl) === null || _a === void 0 ? void 0 : _a.labelId) !== null && _b !== void 0 ? _b : null;
910
+ }
911
+ get disabled() {
912
+ if (this._ngControl && this._ngControl.disabled !== null) {
913
+ return this._ngControl.disabled;
914
+ }
915
+ return this._disabled;
916
+ }
917
+ set disabled(newValue) {
918
+ this._disabled = coerceBooleanProperty(newValue);
919
+ if (!this._formControl) {
920
+ return;
921
+ }
922
+ this._formControl.disabled = this._disabled;
923
+ }
924
+ get required() {
925
+ return this._required;
926
+ }
927
+ set required(newValue) {
928
+ this._required = coerceBooleanProperty(newValue);
929
+ if (!this._formControl) {
930
+ return;
931
+ }
932
+ this._formControl.required = this._required;
933
+ }
934
+ }
935
+ BbSelect.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", 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 });
936
+ BbSelect.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.10", 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 });
937
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbSelect, decorators: [{
938
+ type: Directive,
939
+ args: [{
940
+ selector: 'select[bbInput]',
941
+ host: {
942
+ '[disabled]': 'disabled',
943
+ '(focus)': 'setFocus(true)',
944
+ '(blur)': 'setFocus(false)'
945
+ }
946
+ }]
947
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i5.NgControl, decorators: [{
948
+ type: Optional
949
+ }, {
950
+ type: Self
951
+ }] }, { type: BbFormControl, decorators: [{
952
+ type: Optional
953
+ }, {
954
+ type: Host
955
+ }] }]; }, propDecorators: { id: [{
956
+ type: HostBinding,
957
+ args: ['attr.id']
958
+ }], disabled: [{
959
+ type: Input
960
+ }], required: [{
961
+ type: Input
962
+ }] } });
963
+ class BbInput extends BbSelect {
964
+ constructor(_elementRef, _ngControl, _formControl) {
965
+ super(_elementRef, _ngControl, _formControl);
966
+ this._elementRef = _elementRef;
967
+ this._ngControl = _ngControl;
968
+ this._formControl = _formControl;
969
+ this.hasArrow = false;
970
+ this._readonly = false;
971
+ }
972
+ get readonly() {
973
+ return this._readonly;
974
+ }
975
+ set readonly(newValue) {
976
+ this._readonly = coerceBooleanProperty(newValue);
977
+ if (!this._formControl) {
978
+ return;
979
+ }
980
+ this._formControl.readonly = this._readonly;
981
+ }
982
+ }
983
+ BbInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", 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 });
984
+ BbInput.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.10", 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 });
985
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbInput, decorators: [{
986
+ type: Directive,
987
+ args: [{
988
+ selector: 'input[bbInput], textarea[bbInput]',
989
+ host: {
990
+ '[disabled]': 'disabled',
991
+ '[readonly]': 'readonly',
992
+ '(focus)': 'setFocus(true)',
993
+ '(blur)': 'setFocus(false)'
994
+ }
995
+ }]
996
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i5.NgControl, decorators: [{
997
+ type: Optional
998
+ }, {
999
+ type: Self
1000
+ }] }, { type: BbFormControl, decorators: [{
1001
+ type: Optional
1002
+ }, {
1003
+ type: Host
1004
+ }] }]; }, propDecorators: { readonly: [{
1005
+ type: Input
1006
1006
  }] } });
1007
1007
 
1008
- class BbDatePickerBase {
1009
- }
1010
- const BbFilePickerMixinBase = mixinRequired(mixinReadonly(mixinDisabled(mixinGrouped(mixinError(mixinHideErrors(BbDatePickerBase))))));
1011
- class BbDatePicker extends BbFilePickerMixinBase {
1012
- constructor(_localeId) {
1013
- super();
1014
- this._localeId = _localeId;
1015
- // Readonly data.
1016
- this._yearRegex = /^(10|[1-9][0-9])\d{2}$/; // Note: 1000 - 9999
1017
- // Inputs.
1018
- this.label = null;
1019
- this.hint = null;
1020
- this.dayPlaceholder = 'dd';
1021
- this.monthPlaceholder = 'mm';
1022
- this.yearPlaceholder = 'yyyy';
1023
- this.trackByValue = (_, item) => item === null || item === void 0 ? void 0 : item.value;
1024
- this.years$ = new BehaviorSubject(null);
1025
- this.valueChange = new EventEmitter();
1026
- // Subscriptions.
1027
- this._subscription = new Subscription();
1028
- this.onTouchedCallback = () => {
1029
- };
1030
- this.onChangeCallback = () => {
1031
- };
1032
- this.formToDateString = ({ year, month, day }) => {
1033
- var _a;
1034
- if ((_a = this.form) === null || _a === void 0 ? void 0 : _a.invalid) {
1035
- return null;
1036
- }
1037
- const prefixedMonth = this.padString(`${month}`, 2, '0');
1038
- const prefixedDay = this.padString(`${day}`, 2, '0');
1039
- return [year, prefixedMonth, prefixedDay].join('-');
1040
- };
1041
- this.parseYearFormat = (value) => {
1042
- var _a, _b, _c, _d, _e, _f;
1043
- // Transform the value to a definitive string.
1044
- const yearString = `${value}`;
1045
- const currentFullYear = new Date().getFullYear();
1046
- // Handle default "current" syntax.
1047
- if (yearString === 'current') {
1048
- return currentFullYear;
1049
- }
1050
- // Handle "current + {amount}" syntax.
1051
- if (/^current\s?\+\s?\d+$/.test(yearString)) {
1052
- 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;
1053
- return currentFullYear + amount;
1054
- }
1055
- // Handle "current - {amount}" syntax.
1056
- if (/^current\s?-\s?\d+$/.test(yearString)) {
1057
- 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;
1058
- return currentFullYear - amount;
1059
- }
1060
- // Handling the default number case.
1061
- if (/^[0-9]{4}$/.test(yearString)) {
1062
- return Number(yearString);
1063
- }
1064
- // We could not parse it.
1065
- return null;
1066
- };
1067
- this.getDaysInMonth = (month = null, year = null) => {
1068
- var _a;
1069
- if (((_a = this.form) === null || _a === void 0 ? void 0 : _a.invalid) || month === null || year === null) {
1070
- return 31;
1071
- }
1072
- const parsedYear = parseInt(year, 10);
1073
- return new Date(parsedYear, month, 0).getDate();
1074
- };
1075
- this.isValidDateString = (value) => {
1076
- return typeof value === 'string' && /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/.test(value);
1077
- };
1078
- this.padString = (value, maxLength, fillString = '0') => {
1079
- const count = maxLength - value.length;
1080
- for (let index = 0; index < count; index++) {
1081
- value = `${fillString}${value}`;
1082
- }
1083
- return value;
1084
- };
1085
- }
1086
- set years(value) {
1087
- this.parseYears(value);
1088
- }
1089
- get value() {
1090
- var _a;
1091
- return this.formToDateString((_a = this.form) === null || _a === void 0 ? void 0 : _a.value);
1092
- }
1093
- set value(value) {
1094
- this.parseDateStringInForm(value);
1095
- this.valueChange.emit(this.value);
1096
- }
1097
- ngOnInit() {
1098
- this.composeForm();
1099
- this.getData();
1100
- this.handleChanges();
1101
- }
1102
- ngOnDestroy() {
1103
- var _a;
1104
- (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
1105
- }
1106
- writeValue(value) {
1107
- this.parseDateStringInForm(value);
1108
- }
1109
- registerOnChange(method) {
1110
- this.onChangeCallback = method;
1111
- }
1112
- registerOnTouched(method) {
1113
- this.onTouchedCallback = method;
1114
- }
1115
- setDisabledState(isDisabled) {
1116
- var _a, _b;
1117
- this.disabled = isDisabled;
1118
- if (this.disabled) {
1119
- (_a = this.form) === null || _a === void 0 ? void 0 : _a.disable();
1120
- }
1121
- else {
1122
- (_b = this.form) === null || _b === void 0 ? void 0 : _b.enable();
1123
- }
1124
- }
1125
- onErrorChange(error) {
1126
- this.error = !!error;
1127
- }
1128
- validate({ value }) {
1129
- if (value === null || value === undefined) {
1130
- return null;
1131
- }
1132
- const data = this.parseDateString(value);
1133
- 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);
1134
- const maxDays = this.getDaysInMonth(data === null || data === void 0 ? void 0 : data.month, `${data === null || data === void 0 ? void 0 : data.year}`);
1135
- const isInvalidDate = date.toString() === 'Invalid Date';
1136
- const exceededMaxDays = (data === null || data === void 0 ? void 0 : data.day) > maxDays;
1137
- return (isInvalidDate || exceededMaxDays) && {
1138
- invalidDate: true
1139
- };
1140
- }
1141
- handleChanges() {
1142
- const dateOrNull$ = this.form.valueChanges.pipe(map(value => this.formToDateString(value)), distinctUntilChanged());
1143
- const subscription = dateOrNull$.subscribe(() => {
1144
- this.valueChange.emit(this.value);
1145
- this.onChangeCallback(this.value);
1146
- });
1147
- this._subscription.add(subscription);
1148
- }
1149
- getData() {
1150
- const years$ = this.years$.asObservable();
1151
- const months$ = this.getMonthData();
1152
- const days$ = this.getDayData();
1153
- 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); }));
1154
- }
1155
- verifyListData(maxDays, years) {
1156
- const dayControl = this.form.get('day');
1157
- if ((dayControl === null || dayControl === void 0 ? void 0 : dayControl.value) !== null && (dayControl === null || dayControl === void 0 ? void 0 : dayControl.value) > maxDays) {
1158
- dayControl.patchValue(maxDays);
1159
- }
1160
- const yearControl = this.form.get('year');
1161
- 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)) {
1162
- const selectedYear = Number(yearControl === null || yearControl === void 0 ? void 0 : yearControl.value);
1163
- const firstYear = Math.min(...years);
1164
- const lastYear = Math.max(...years);
1165
- if (selectedYear < firstYear || selectedYear > lastYear) {
1166
- Promise.resolve().then(() => yearControl.patchValue(null));
1167
- }
1168
- }
1169
- }
1170
- getDayData() {
1171
- var _a;
1172
- 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());
1173
- return count$.pipe(map(count => Array(count).fill(0).map((_, index) => ({
1174
- label: `${index + 1}`,
1175
- value: index + 1
1176
- }))));
1177
- }
1178
- getMonthData() {
1179
- const array = Array(12).fill(0).map((_, month) => {
1180
- const date = new Date(2000, month, 1);
1181
- const label = formatDate(date, 'LLLL', this._localeId);
1182
- return { label, value: month + 1 };
1183
- });
1184
- return of(array);
1185
- }
1186
- composeForm() {
1187
- const { required, pattern, minLength, maxLength } = Validators;
1188
- const yearPattern = pattern(this._yearRegex);
1189
- const yearValidators = [required, yearPattern, minLength(4), maxLength(4)];
1190
- this.form = new FormGroup({
1191
- day: new FormControl(null, required),
1192
- month: new FormControl(null, required),
1193
- year: new FormControl(null, yearValidators)
1194
- });
1195
- }
1196
- parseDateStringInForm(value) {
1197
- var _a, _b;
1198
- // If the date string was not a valid format, reset the form.
1199
- if (!this.isValidDateString(value)) {
1200
- if (value !== null) {
1201
- (_a = this.form) === null || _a === void 0 ? void 0 : _a.reset({ year: null, month: null, day: null }, { emitEvent: false });
1202
- }
1203
- return;
1204
- }
1205
- // Parse the date string and save in the form.
1206
- const data = this.parseDateString(value);
1207
- const year = (data === null || data === void 0 ? void 0 : data.year) !== null && (data === null || data === void 0 ? void 0 : data.year) !== undefined
1208
- ? this.padString(`${data === null || data === void 0 ? void 0 : data.year}`, 4, '0')
1209
- : null;
1210
- const formData = Object.assign(Object.assign({}, (data !== null && data !== void 0 ? data : {})), { year });
1211
- (_b = this.form) === null || _b === void 0 ? void 0 : _b.patchValue(formData, { emitEvent: false });
1212
- }
1213
- parseDateString(value) {
1214
- if (!this.isValidDateString(value)) {
1215
- return null;
1216
- }
1217
- // Parse the date string.
1218
- const [year, month, day] = value === null || value === void 0 ? void 0 : value.split('-');
1219
- return {
1220
- day: day ? parseInt(day, 10) : null,
1221
- month: month ? parseInt(month, 10) : null,
1222
- year: year ? parseInt(year, 10) : null
1223
- };
1224
- }
1225
- parseYears(values) {
1226
- if (!values) {
1227
- return this.years$.next(null);
1228
- }
1229
- // Parse the values to years (in numbers).
1230
- const [first, last] = values;
1231
- const firstYear = this.parseYearFormat(first);
1232
- const lastYear = this.parseYearFormat(last);
1233
- // Check cases in where we cannot parse.
1234
- if (firstYear === null || lastYear === null) {
1235
- return this.years$.next(null);
1236
- }
1237
- const difference = firstYear - lastYear;
1238
- const absoluteDifference = Math.abs(difference) + 1;
1239
- // Create an array with years.
1240
- const years = Array(absoluteDifference)
1241
- .fill(0)
1242
- .map((_, index) => difference < 0 ? (firstYear + index) : (firstYear - index));
1243
- // Validate we have one or more years.
1244
- if ((years === null || years === void 0 ? void 0 : years.length) <= 0) {
1245
- return this.years$.next(null);
1246
- }
1247
- // Push the years.
1248
- return this.years$.next(years);
1249
- }
1250
- }
1251
- BbDatePicker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbDatePicker, deps: [{ token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Component });
1252
- BbDatePicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.1", 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: [
1253
- {
1254
- provide: NG_VALUE_ACCESSOR,
1255
- useExisting: forwardRef(() => BbDatePicker),
1256
- multi: true
1257
- },
1258
- {
1259
- provide: NG_VALIDATORS,
1260
- useExisting: BbDatePicker,
1261
- multi: true
1262
- }
1263
- ], 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:rgba(194,57,52,.25)!important;box-shadow:inset 0 3px 0 0 hsla(213,8%,74%,.2),0 6px 6px -6px rgba(0,0,0,.1),0 0 0 3px rgba(194,57,52,.4)!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:not(.has-value),.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)>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}"], 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: ["disabled", "formControlName", "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 });
1264
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbDatePicker, decorators: [{
1265
- type: Component,
1266
- args: [{
1267
- selector: 'bb-date-picker',
1268
- templateUrl: './date-picker.component.html',
1269
- styleUrls: ['./date-picker.component.scss'],
1270
- changeDetection: ChangeDetectionStrategy.OnPush,
1271
- encapsulation: ViewEncapsulation.None,
1272
- providers: [
1273
- {
1274
- provide: NG_VALUE_ACCESSOR,
1275
- useExisting: forwardRef(() => BbDatePicker),
1276
- multi: true
1277
- },
1278
- {
1279
- provide: NG_VALIDATORS,
1280
- useExisting: BbDatePicker,
1281
- multi: true
1282
- }
1283
- ],
1284
- host: {
1285
- 'class': 'bb-date-picker',
1286
- '[class.required]': 'required',
1287
- '[class.readonly]': 'readonly',
1288
- '[class.disabled]': 'disabled',
1289
- '[class.grouped]': 'grouped',
1290
- '[class.error]': 'error'
1291
- },
1292
- inputs: ['required', 'readonly', 'disabled', 'grouped', 'hideErrors'],
1293
- preserveWhitespaces: false
1294
- }]
1295
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1296
- type: Inject,
1297
- args: [LOCALE_ID]
1298
- }] }]; }, propDecorators: { label: [{
1299
- type: Input
1300
- }], hint: [{
1301
- type: Input
1302
- }], dayPlaceholder: [{
1303
- type: Input
1304
- }], monthPlaceholder: [{
1305
- type: Input
1306
- }], yearPlaceholder: [{
1307
- type: Input
1308
- }], years: [{
1309
- type: Input
1310
- }], value: [{
1311
- type: Input
1312
- }], valueChange: [{
1313
- type: Output
1008
+ class BbDatePickerBase {
1009
+ }
1010
+ const BbFilePickerMixinBase = mixinRequired(mixinReadonly(mixinDisabled(mixinGrouped(mixinError(mixinHideErrors(BbDatePickerBase))))));
1011
+ class BbDatePicker extends BbFilePickerMixinBase {
1012
+ constructor(_localeId) {
1013
+ super();
1014
+ this._localeId = _localeId;
1015
+ // Readonly data.
1016
+ this._yearRegex = /^(10|[1-9][0-9])\d{2}$/; // Note: 1000 - 9999
1017
+ // Inputs.
1018
+ this.label = null;
1019
+ this.hint = null;
1020
+ this.dayPlaceholder = 'dd';
1021
+ this.monthPlaceholder = 'mm';
1022
+ this.yearPlaceholder = 'yyyy';
1023
+ this.trackByValue = (_, item) => item === null || item === void 0 ? void 0 : item.value;
1024
+ this.years$ = new BehaviorSubject(null);
1025
+ this.valueChange = new EventEmitter();
1026
+ // Subscriptions.
1027
+ this._subscription = new Subscription();
1028
+ this.onTouchedCallback = () => {
1029
+ };
1030
+ this.onChangeCallback = () => {
1031
+ };
1032
+ this.formToDateString = ({ year, month, day }) => {
1033
+ var _a;
1034
+ if ((_a = this.form) === null || _a === void 0 ? void 0 : _a.invalid) {
1035
+ return null;
1036
+ }
1037
+ const prefixedMonth = this.padString(`${month}`, 2, '0');
1038
+ const prefixedDay = this.padString(`${day}`, 2, '0');
1039
+ return [year, prefixedMonth, prefixedDay].join('-');
1040
+ };
1041
+ this.parseYearFormat = (value) => {
1042
+ var _a, _b, _c, _d, _e, _f;
1043
+ // Transform the value to a definitive string.
1044
+ const yearString = `${value}`;
1045
+ const currentFullYear = new Date().getFullYear();
1046
+ // Handle default "current" syntax.
1047
+ if (yearString === 'current') {
1048
+ return currentFullYear;
1049
+ }
1050
+ // Handle "current + {amount}" syntax.
1051
+ if (/^current\s?\+\s?\d+$/.test(yearString)) {
1052
+ 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;
1053
+ return currentFullYear + amount;
1054
+ }
1055
+ // Handle "current - {amount}" syntax.
1056
+ if (/^current\s?-\s?\d+$/.test(yearString)) {
1057
+ 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;
1058
+ return currentFullYear - amount;
1059
+ }
1060
+ // Handling the default number case.
1061
+ if (/^[0-9]{4}$/.test(yearString)) {
1062
+ return Number(yearString);
1063
+ }
1064
+ // We could not parse it.
1065
+ return null;
1066
+ };
1067
+ this.getDaysInMonth = (month = null, year = null) => {
1068
+ var _a;
1069
+ if (((_a = this.form) === null || _a === void 0 ? void 0 : _a.invalid) || month === null || year === null) {
1070
+ return 31;
1071
+ }
1072
+ const parsedYear = parseInt(year, 10);
1073
+ return new Date(parsedYear, month, 0).getDate();
1074
+ };
1075
+ this.isValidDateString = (value) => {
1076
+ return typeof value === 'string' && /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/.test(value);
1077
+ };
1078
+ this.padString = (value, maxLength, fillString = '0') => {
1079
+ const count = maxLength - value.length;
1080
+ for (let index = 0; index < count; index++) {
1081
+ value = `${fillString}${value}`;
1082
+ }
1083
+ return value;
1084
+ };
1085
+ }
1086
+ set years(value) {
1087
+ this.parseYears(value);
1088
+ }
1089
+ get value() {
1090
+ var _a;
1091
+ return this.formToDateString((_a = this.form) === null || _a === void 0 ? void 0 : _a.value);
1092
+ }
1093
+ set value(value) {
1094
+ this.parseDateStringInForm(value);
1095
+ this.valueChange.emit(this.value);
1096
+ }
1097
+ ngOnInit() {
1098
+ this.composeForm();
1099
+ this.getData();
1100
+ this.handleChanges();
1101
+ }
1102
+ ngOnDestroy() {
1103
+ var _a;
1104
+ (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
1105
+ }
1106
+ writeValue(value) {
1107
+ this.parseDateStringInForm(value);
1108
+ }
1109
+ registerOnChange(method) {
1110
+ this.onChangeCallback = method;
1111
+ }
1112
+ registerOnTouched(method) {
1113
+ this.onTouchedCallback = method;
1114
+ }
1115
+ setDisabledState(isDisabled) {
1116
+ var _a, _b;
1117
+ this.disabled = isDisabled;
1118
+ if (this.disabled) {
1119
+ (_a = this.form) === null || _a === void 0 ? void 0 : _a.disable();
1120
+ }
1121
+ else {
1122
+ (_b = this.form) === null || _b === void 0 ? void 0 : _b.enable();
1123
+ }
1124
+ }
1125
+ onErrorChange(error) {
1126
+ this.error = !!error;
1127
+ }
1128
+ validate({ value }) {
1129
+ if (value === null || value === undefined) {
1130
+ return null;
1131
+ }
1132
+ const data = this.parseDateString(value);
1133
+ 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);
1134
+ const maxDays = this.getDaysInMonth(data === null || data === void 0 ? void 0 : data.month, `${data === null || data === void 0 ? void 0 : data.year}`);
1135
+ const isInvalidDate = date.toString() === 'Invalid Date';
1136
+ const exceededMaxDays = (data === null || data === void 0 ? void 0 : data.day) > maxDays;
1137
+ return (isInvalidDate || exceededMaxDays) && {
1138
+ invalidDate: true
1139
+ };
1140
+ }
1141
+ handleChanges() {
1142
+ const dateOrNull$ = this.form.valueChanges.pipe(map(value => this.formToDateString(value)), distinctUntilChanged());
1143
+ const subscription = dateOrNull$.subscribe(() => {
1144
+ this.valueChange.emit(this.value);
1145
+ this.onChangeCallback(this.value);
1146
+ });
1147
+ this._subscription.add(subscription);
1148
+ }
1149
+ getData() {
1150
+ const years$ = this.years$.asObservable();
1151
+ const months$ = this.getMonthData();
1152
+ const days$ = this.getDayData();
1153
+ 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); }));
1154
+ }
1155
+ verifyListData(maxDays, years) {
1156
+ const dayControl = this.form.get('day');
1157
+ if ((dayControl === null || dayControl === void 0 ? void 0 : dayControl.value) !== null && (dayControl === null || dayControl === void 0 ? void 0 : dayControl.value) > maxDays) {
1158
+ dayControl.patchValue(maxDays);
1159
+ }
1160
+ const yearControl = this.form.get('year');
1161
+ 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)) {
1162
+ const selectedYear = Number(yearControl === null || yearControl === void 0 ? void 0 : yearControl.value);
1163
+ const firstYear = Math.min(...years);
1164
+ const lastYear = Math.max(...years);
1165
+ if (selectedYear < firstYear || selectedYear > lastYear) {
1166
+ Promise.resolve().then(() => yearControl.patchValue(null));
1167
+ }
1168
+ }
1169
+ }
1170
+ getDayData() {
1171
+ var _a;
1172
+ 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());
1173
+ return count$.pipe(map(count => Array(count).fill(0).map((_, index) => ({
1174
+ label: `${index + 1}`,
1175
+ value: index + 1
1176
+ }))));
1177
+ }
1178
+ getMonthData() {
1179
+ const array = Array(12).fill(0).map((_, month) => {
1180
+ const date = new Date(2000, month, 1);
1181
+ const label = formatDate(date, 'LLLL', this._localeId);
1182
+ return { label, value: month + 1 };
1183
+ });
1184
+ return of(array);
1185
+ }
1186
+ composeForm() {
1187
+ const { required, pattern, minLength, maxLength } = Validators;
1188
+ const yearPattern = pattern(this._yearRegex);
1189
+ const yearValidators = [required, yearPattern, minLength(4), maxLength(4)];
1190
+ this.form = new FormGroup({
1191
+ day: new FormControl(null, required),
1192
+ month: new FormControl(null, required),
1193
+ year: new FormControl(null, yearValidators)
1194
+ });
1195
+ }
1196
+ parseDateStringInForm(value) {
1197
+ var _a, _b;
1198
+ // If the date string was not a valid format, reset the form.
1199
+ if (!this.isValidDateString(value)) {
1200
+ if (value !== null) {
1201
+ (_a = this.form) === null || _a === void 0 ? void 0 : _a.reset({ year: null, month: null, day: null }, { emitEvent: false });
1202
+ }
1203
+ return;
1204
+ }
1205
+ // Parse the date string and save in the form.
1206
+ const data = this.parseDateString(value);
1207
+ const year = (data === null || data === void 0 ? void 0 : data.year) !== null && (data === null || data === void 0 ? void 0 : data.year) !== undefined
1208
+ ? this.padString(`${data === null || data === void 0 ? void 0 : data.year}`, 4, '0')
1209
+ : null;
1210
+ const formData = Object.assign(Object.assign({}, (data !== null && data !== void 0 ? data : {})), { year });
1211
+ (_b = this.form) === null || _b === void 0 ? void 0 : _b.patchValue(formData, { emitEvent: false });
1212
+ }
1213
+ parseDateString(value) {
1214
+ if (!this.isValidDateString(value)) {
1215
+ return null;
1216
+ }
1217
+ // Parse the date string.
1218
+ const [year, month, day] = value === null || value === void 0 ? void 0 : value.split('-');
1219
+ return {
1220
+ day: day ? parseInt(day, 10) : null,
1221
+ month: month ? parseInt(month, 10) : null,
1222
+ year: year ? parseInt(year, 10) : null
1223
+ };
1224
+ }
1225
+ parseYears(values) {
1226
+ if (!values) {
1227
+ return this.years$.next(null);
1228
+ }
1229
+ // Parse the values to years (in numbers).
1230
+ const [first, last] = values;
1231
+ const firstYear = this.parseYearFormat(first);
1232
+ const lastYear = this.parseYearFormat(last);
1233
+ // Check cases in where we cannot parse.
1234
+ if (firstYear === null || lastYear === null) {
1235
+ return this.years$.next(null);
1236
+ }
1237
+ const difference = firstYear - lastYear;
1238
+ const absoluteDifference = Math.abs(difference) + 1;
1239
+ // Create an array with years.
1240
+ const years = Array(absoluteDifference)
1241
+ .fill(0)
1242
+ .map((_, index) => difference < 0 ? (firstYear + index) : (firstYear - index));
1243
+ // Validate we have one or more years.
1244
+ if ((years === null || years === void 0 ? void 0 : years.length) <= 0) {
1245
+ return this.years$.next(null);
1246
+ }
1247
+ // Push the years.
1248
+ return this.years$.next(years);
1249
+ }
1250
+ }
1251
+ BbDatePicker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbDatePicker, deps: [{ token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Component });
1252
+ BbDatePicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.10", 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: [
1253
+ {
1254
+ provide: NG_VALUE_ACCESSOR,
1255
+ useExisting: forwardRef(() => BbDatePicker),
1256
+ multi: true
1257
+ },
1258
+ {
1259
+ provide: NG_VALIDATORS,
1260
+ useExisting: BbDatePicker,
1261
+ multi: true
1262
+ }
1263
+ ], 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: ["disabled", "formControlName", "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 });
1264
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbDatePicker, decorators: [{
1265
+ type: Component,
1266
+ args: [{
1267
+ selector: 'bb-date-picker',
1268
+ templateUrl: './date-picker.component.html',
1269
+ styleUrls: ['./date-picker.component.scss'],
1270
+ changeDetection: ChangeDetectionStrategy.OnPush,
1271
+ encapsulation: ViewEncapsulation.None,
1272
+ providers: [
1273
+ {
1274
+ provide: NG_VALUE_ACCESSOR,
1275
+ useExisting: forwardRef(() => BbDatePicker),
1276
+ multi: true
1277
+ },
1278
+ {
1279
+ provide: NG_VALIDATORS,
1280
+ useExisting: BbDatePicker,
1281
+ multi: true
1282
+ }
1283
+ ],
1284
+ host: {
1285
+ 'class': 'bb-date-picker',
1286
+ '[class.required]': 'required',
1287
+ '[class.readonly]': 'readonly',
1288
+ '[class.disabled]': 'disabled',
1289
+ '[class.grouped]': 'grouped',
1290
+ '[class.error]': 'error'
1291
+ },
1292
+ inputs: ['required', 'readonly', 'disabled', 'grouped', 'hideErrors'],
1293
+ preserveWhitespaces: false
1294
+ }]
1295
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1296
+ type: Inject,
1297
+ args: [LOCALE_ID]
1298
+ }] }]; }, propDecorators: { label: [{
1299
+ type: Input
1300
+ }], hint: [{
1301
+ type: Input
1302
+ }], dayPlaceholder: [{
1303
+ type: Input
1304
+ }], monthPlaceholder: [{
1305
+ type: Input
1306
+ }], yearPlaceholder: [{
1307
+ type: Input
1308
+ }], years: [{
1309
+ type: Input
1310
+ }], value: [{
1311
+ type: Input
1312
+ }], valueChange: [{
1313
+ type: Output
1314
1314
  }] } });
1315
1315
 
1316
- class BbSuffix {
1317
- }
1318
- BbSuffix.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbSuffix, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1319
- BbSuffix.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.1", type: BbSuffix, selector: "[bbSuffix]", host: { classAttribute: "bb-suffix" }, ngImport: i0 });
1320
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbSuffix, decorators: [{
1321
- type: Directive,
1322
- args: [{
1323
- selector: '[bbSuffix]',
1324
- host: {
1325
- 'class': 'bb-suffix'
1326
- }
1327
- }]
1328
- }] });
1329
- class BbPrefix {
1330
- }
1331
- BbPrefix.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbPrefix, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1332
- BbPrefix.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.1", type: BbPrefix, selector: "[bbPrefix]", host: { classAttribute: "bb-prefix" }, ngImport: i0 });
1333
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbPrefix, decorators: [{
1334
- type: Directive,
1335
- args: [{
1336
- selector: '[bbPrefix]',
1337
- host: {
1338
- 'class': 'bb-prefix'
1339
- }
1340
- }]
1316
+ class BbSuffix {
1317
+ }
1318
+ BbSuffix.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbSuffix, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1319
+ BbSuffix.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.10", type: BbSuffix, selector: "[bbSuffix]", host: { classAttribute: "bb-suffix" }, ngImport: i0 });
1320
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbSuffix, decorators: [{
1321
+ type: Directive,
1322
+ args: [{
1323
+ selector: '[bbSuffix]',
1324
+ host: {
1325
+ 'class': 'bb-suffix'
1326
+ }
1327
+ }]
1328
+ }] });
1329
+ class BbPrefix {
1330
+ }
1331
+ BbPrefix.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbPrefix, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1332
+ BbPrefix.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.10", type: BbPrefix, selector: "[bbPrefix]", host: { classAttribute: "bb-prefix" }, ngImport: i0 });
1333
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbPrefix, decorators: [{
1334
+ type: Directive,
1335
+ args: [{
1336
+ selector: '[bbPrefix]',
1337
+ host: {
1338
+ 'class': 'bb-prefix'
1339
+ }
1340
+ }]
1341
1341
  }] });
1342
1342
 
1343
- class BbFormGroupBase {
1344
- }
1345
- const BbFormGroupMixinBase = mixinGrouped(BbFormGroupBase);
1346
- class BbFormGroup extends BbFormGroupMixinBase {
1347
- }
1348
- BbFormGroup.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbFormGroup, deps: null, target: i0.ɵɵFactoryTarget.Component });
1349
- BbFormGroup.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.1", 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}"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1350
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbFormGroup, decorators: [{
1351
- type: Component,
1352
- args: [{
1353
- selector: 'bb-form-group',
1354
- templateUrl: './form-group.component.html',
1355
- styleUrls: ['./form-group.component.scss'],
1356
- changeDetection: ChangeDetectionStrategy.OnPush,
1357
- encapsulation: ViewEncapsulation.None,
1358
- host: {
1359
- 'class': 'bb-form-group',
1360
- '[class.grouped]': 'grouped'
1361
- },
1362
- inputs: ['grouped'],
1363
- preserveWhitespaces: false
1364
- }]
1343
+ class BbFormGroupBase {
1344
+ }
1345
+ const BbFormGroupMixinBase = mixinGrouped(BbFormGroupBase);
1346
+ class BbFormGroup extends BbFormGroupMixinBase {
1347
+ }
1348
+ BbFormGroup.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbFormGroup, deps: null, target: i0.ɵɵFactoryTarget.Component });
1349
+ BbFormGroup.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.10", 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 });
1350
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbFormGroup, decorators: [{
1351
+ type: Component,
1352
+ args: [{
1353
+ selector: 'bb-form-group',
1354
+ templateUrl: './form-group.component.html',
1355
+ styleUrls: ['./form-group.component.scss'],
1356
+ changeDetection: ChangeDetectionStrategy.OnPush,
1357
+ encapsulation: ViewEncapsulation.None,
1358
+ host: {
1359
+ 'class': 'bb-form-group',
1360
+ '[class.grouped]': 'grouped'
1361
+ },
1362
+ inputs: ['grouped'],
1363
+ preserveWhitespaces: false
1364
+ }]
1365
1365
  }] });
1366
1366
 
1367
- class BbFocusTrap {
1368
- constructor(_platform, _elementRef) {
1369
- this._platform = _platform;
1370
- this._elementRef = _elementRef;
1371
- this._focusableElements = [
1372
- 'a[href]',
1373
- 'area[href]',
1374
- 'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',
1375
- 'select:not([disabled]):not([aria-hidden])',
1376
- 'textarea:not([disabled]):not([aria-hidden])',
1377
- 'button:not([disabled]):not([aria-hidden])',
1378
- 'iframe',
1379
- 'object',
1380
- 'embed',
1381
- '[contenteditable]',
1382
- '[tabindex]:not([tabindex^="-"])'
1383
- ];
1384
- this.focus = (element) => {
1385
- return element && element.focus && element.focus();
1386
- };
1387
- this.isTabEvent = (event) => {
1388
- return event.key === 'Tab' || event.keyCode === 9;
1389
- };
1390
- }
1391
- onKeydown(event) {
1392
- // Validate it is a tab event.
1393
- if (!this.isTabEvent(event)) {
1394
- return;
1395
- }
1396
- // Trap the focus inside the element.
1397
- return this.trapFocus(event);
1398
- }
1399
- trapFocus(event) {
1400
- // Validate that the DOM is available.
1401
- if (!this._platform.isBrowser) {
1402
- return;
1403
- }
1404
- // Get all focusable nodes.
1405
- const focusableNodes = this.getFocusableNodes();
1406
- // Focus the first available element if the focus
1407
- // is not in the modal.
1408
- if (!this.element.contains(document.activeElement)) {
1409
- return this.focus(focusableNodes[0]);
1410
- }
1411
- const focusedItemIndex = focusableNodes.indexOf(document.activeElement);
1412
- if (event.shiftKey && focusedItemIndex === 0) {
1413
- this.focus(focusableNodes[focusableNodes.length - 1]);
1414
- return event.preventDefault();
1415
- }
1416
- if (!event.shiftKey && focusedItemIndex === focusableNodes.length - 1) {
1417
- this.focus(focusableNodes[0]);
1418
- return event.preventDefault();
1419
- }
1420
- }
1421
- get element() {
1422
- return this._elementRef.nativeElement;
1423
- }
1424
- getFocusableNodes() {
1425
- const nodes = this.element.querySelectorAll(this._focusableElements);
1426
- return Array(...nodes);
1427
- }
1428
- }
1429
- BbFocusTrap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbFocusTrap, deps: [{ token: i1$1.Platform }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1430
- BbFocusTrap.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.1", type: BbFocusTrap, selector: "[bbFocusTrap]", host: { listeners: { "keydown": "onKeydown($event)" } }, ngImport: i0 });
1431
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbFocusTrap, decorators: [{
1432
- type: Directive,
1433
- args: [{
1434
- selector: '[bbFocusTrap]'
1435
- }]
1436
- }], ctorParameters: function () { return [{ type: i1$1.Platform }, { type: i0.ElementRef }]; }, propDecorators: { onKeydown: [{
1437
- type: HostListener,
1438
- args: ['keydown', ['$event']]
1367
+ class BbFocusTrap {
1368
+ constructor(_platform, _elementRef) {
1369
+ this._platform = _platform;
1370
+ this._elementRef = _elementRef;
1371
+ this._focusableElements = [
1372
+ 'a[href]',
1373
+ 'area[href]',
1374
+ 'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',
1375
+ 'select:not([disabled]):not([aria-hidden])',
1376
+ 'textarea:not([disabled]):not([aria-hidden])',
1377
+ 'button:not([disabled]):not([aria-hidden])',
1378
+ 'iframe',
1379
+ 'object',
1380
+ 'embed',
1381
+ '[contenteditable]',
1382
+ '[tabindex]:not([tabindex^="-"])'
1383
+ ];
1384
+ this.focus = (element) => {
1385
+ return element && element.focus && element.focus();
1386
+ };
1387
+ this.isTabEvent = (event) => {
1388
+ return event.key === 'Tab' || event.keyCode === 9;
1389
+ };
1390
+ }
1391
+ onKeydown(event) {
1392
+ // Validate it is a tab event.
1393
+ if (!this.isTabEvent(event)) {
1394
+ return;
1395
+ }
1396
+ // Trap the focus inside the element.
1397
+ return this.trapFocus(event);
1398
+ }
1399
+ trapFocus(event) {
1400
+ // Validate that the DOM is available.
1401
+ if (!this._platform.isBrowser) {
1402
+ return;
1403
+ }
1404
+ // Get all focusable nodes.
1405
+ const focusableNodes = this.getFocusableNodes();
1406
+ // Focus the first available element if the focus
1407
+ // is not in the modal.
1408
+ if (!this.element.contains(document.activeElement)) {
1409
+ return this.focus(focusableNodes[0]);
1410
+ }
1411
+ const focusedItemIndex = focusableNodes.indexOf(document.activeElement);
1412
+ if (event.shiftKey && focusedItemIndex === 0) {
1413
+ this.focus(focusableNodes[focusableNodes.length - 1]);
1414
+ return event.preventDefault();
1415
+ }
1416
+ if (!event.shiftKey && focusedItemIndex === focusableNodes.length - 1) {
1417
+ this.focus(focusableNodes[0]);
1418
+ return event.preventDefault();
1419
+ }
1420
+ }
1421
+ get element() {
1422
+ return this._elementRef.nativeElement;
1423
+ }
1424
+ getFocusableNodes() {
1425
+ const nodes = this.element.querySelectorAll(this._focusableElements);
1426
+ return Array(...nodes);
1427
+ }
1428
+ }
1429
+ BbFocusTrap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbFocusTrap, deps: [{ token: i1$1.Platform }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1430
+ BbFocusTrap.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.10", type: BbFocusTrap, selector: "[bbFocusTrap]", host: { listeners: { "keydown": "onKeydown($event)" } }, ngImport: i0 });
1431
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbFocusTrap, decorators: [{
1432
+ type: Directive,
1433
+ args: [{
1434
+ selector: '[bbFocusTrap]'
1435
+ }]
1436
+ }], ctorParameters: function () { return [{ type: i1$1.Platform }, { type: i0.ElementRef }]; }, propDecorators: { onKeydown: [{
1437
+ type: HostListener,
1438
+ args: ['keydown', ['$event']]
1439
1439
  }] } });
1440
1440
 
1441
- class BbAutosize {
1442
- constructor(_renderer, _elementRef) {
1443
- this._renderer = _renderer;
1444
- this._elementRef = _elementRef;
1445
- // Min/max heights for the textarea.
1446
- this.minHeight = null;
1447
- this.maxHeight = null;
1448
- this.rows = 1;
1449
- }
1450
- get element() {
1451
- var _a;
1452
- return (_a = this._elementRef) === null || _a === void 0 ? void 0 : _a.nativeElement;
1453
- }
1454
- ngAfterViewInit() {
1455
- // Update the styles after the DOM has loaded.
1456
- this.updateStyles();
1457
- }
1458
- onWindowResize() {
1459
- // Update the styles when the window is resized.
1460
- this.updateStyles();
1461
- }
1462
- onInputReceived() {
1463
- // Update the styles after the textarea received input.
1464
- this.updateStyles();
1465
- }
1466
- updateStyles() {
1467
- var _a, _b, _c;
1468
- // Validate the element exists.
1469
- if (!this.element) {
1470
- return;
1471
- }
1472
- // Calculate border height which is not included in the scroll height.
1473
- const borderHeight = ((_a = this.element) === null || _a === void 0 ? void 0 : _a.offsetHeight) - ((_b = this.element) === null || _b === void 0 ? void 0 : _b.clientHeight);
1474
- // Reset textarea height to auto that correctly calculate the new height.
1475
- this.setHeight('auto');
1476
- // Set new height.
1477
- this.setHeight(`${((_c = this.element) === null || _c === void 0 ? void 0 : _c.scrollHeight) + borderHeight}px`);
1478
- }
1479
- setHeight(value) {
1480
- this._renderer.setStyle(this.element, 'height', value);
1481
- }
1482
- }
1483
- BbAutosize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbAutosize, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1484
- BbAutosize.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.1", 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 });
1485
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbAutosize, decorators: [{
1486
- type: Directive,
1487
- args: [{
1488
- selector: 'textarea[bbAutosize]'
1489
- }]
1490
- }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { minHeight: [{
1491
- type: Input
1492
- }, {
1493
- type: HostBinding,
1494
- args: ['style.min-height']
1495
- }], maxHeight: [{
1496
- type: Input
1497
- }, {
1498
- type: HostBinding,
1499
- args: ['style.max-height']
1500
- }], rows: [{
1501
- type: Input
1502
- }, {
1503
- type: HostBinding,
1504
- args: ['rows']
1505
- }], onWindowResize: [{
1506
- type: HostListener,
1507
- args: ['window:resize']
1508
- }], onInputReceived: [{
1509
- type: HostListener,
1510
- args: ['input']
1441
+ class BbAutosize {
1442
+ constructor(_renderer, _elementRef) {
1443
+ this._renderer = _renderer;
1444
+ this._elementRef = _elementRef;
1445
+ // Min/max heights for the textarea.
1446
+ this.minHeight = null;
1447
+ this.maxHeight = null;
1448
+ this.rows = 1;
1449
+ }
1450
+ get element() {
1451
+ var _a;
1452
+ return (_a = this._elementRef) === null || _a === void 0 ? void 0 : _a.nativeElement;
1453
+ }
1454
+ ngAfterViewInit() {
1455
+ // Update the styles after the DOM has loaded.
1456
+ this.updateStyles();
1457
+ }
1458
+ onWindowResize() {
1459
+ // Update the styles when the window is resized.
1460
+ this.updateStyles();
1461
+ }
1462
+ onInputReceived() {
1463
+ // Update the styles after the textarea received input.
1464
+ this.updateStyles();
1465
+ }
1466
+ updateStyles() {
1467
+ var _a, _b, _c;
1468
+ // Validate the element exists.
1469
+ if (!this.element) {
1470
+ return;
1471
+ }
1472
+ // Calculate border height which is not included in the scroll height.
1473
+ const borderHeight = ((_a = this.element) === null || _a === void 0 ? void 0 : _a.offsetHeight) - ((_b = this.element) === null || _b === void 0 ? void 0 : _b.clientHeight);
1474
+ // Reset textarea height to auto that correctly calculate the new height.
1475
+ this.setHeight('auto');
1476
+ // Set new height.
1477
+ this.setHeight(`${((_c = this.element) === null || _c === void 0 ? void 0 : _c.scrollHeight) + borderHeight}px`);
1478
+ }
1479
+ setHeight(value) {
1480
+ this._renderer.setStyle(this.element, 'height', value);
1481
+ }
1482
+ }
1483
+ BbAutosize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbAutosize, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1484
+ BbAutosize.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.10", 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 });
1485
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbAutosize, decorators: [{
1486
+ type: Directive,
1487
+ args: [{
1488
+ selector: 'textarea[bbAutosize]'
1489
+ }]
1490
+ }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { minHeight: [{
1491
+ type: Input
1492
+ }, {
1493
+ type: HostBinding,
1494
+ args: ['style.min-height']
1495
+ }], maxHeight: [{
1496
+ type: Input
1497
+ }, {
1498
+ type: HostBinding,
1499
+ args: ['style.max-height']
1500
+ }], rows: [{
1501
+ type: Input
1502
+ }, {
1503
+ type: HostBinding,
1504
+ args: ['rows']
1505
+ }], onWindowResize: [{
1506
+ type: HostListener,
1507
+ args: ['window:resize']
1508
+ }], onInputReceived: [{
1509
+ type: HostListener,
1510
+ args: ['input']
1511
1511
  }] } });
1512
1512
 
1513
- class BbRelativeTime {
1514
- constructor(_localize, _localeId) {
1515
- this._localize = _localize;
1516
- this._localeId = _localeId;
1517
- this.isValidDate = (date) => {
1518
- return typeof date === 'object' &&
1519
- typeof date.getTime === 'function' &&
1520
- !isNaN(date.getTime());
1521
- };
1522
- this.parseAsDate = (value) => {
1523
- // Add a Z after the date so
1524
- // it is treated as a UTC date.
1525
- 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)) {
1526
- return new Date(`${value}Z`);
1527
- }
1528
- // Return the regular parsed date.
1529
- return new Date(value);
1530
- };
1531
- this.isToday = (date) => {
1532
- const today = new Date();
1533
- return (date === null || date === void 0 ? void 0 : date.getDate()) === (today === null || today === void 0 ? void 0 : today.getDate()) &&
1534
- (date === null || date === void 0 ? void 0 : date.getMonth()) === (today === null || today === void 0 ? void 0 : today.getMonth()) &&
1535
- (date === null || date === void 0 ? void 0 : date.getFullYear()) === (today === null || today === void 0 ? void 0 : today.getFullYear());
1536
- };
1537
- this.isYesterday = (date) => {
1538
- var _a, _b;
1539
- 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));
1540
- return (date === null || date === void 0 ? void 0 : date.getDate()) === (yesterday === null || yesterday === void 0 ? void 0 : yesterday.getDate()) &&
1541
- (date === null || date === void 0 ? void 0 : date.getMonth()) === (yesterday === null || yesterday === void 0 ? void 0 : yesterday.getMonth()) &&
1542
- (date === null || date === void 0 ? void 0 : date.getFullYear()) === (yesterday === null || yesterday === void 0 ? void 0 : yesterday.getFullYear());
1543
- };
1544
- this.isTomorrow = (date) => {
1545
- var _a, _b;
1546
- 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));
1547
- return (date === null || date === void 0 ? void 0 : date.getDate()) === (tomorrow === null || tomorrow === void 0 ? void 0 : tomorrow.getDate()) &&
1548
- (date === null || date === void 0 ? void 0 : date.getMonth()) === (tomorrow === null || tomorrow === void 0 ? void 0 : tomorrow.getMonth()) &&
1549
- (date === null || date === void 0 ? void 0 : date.getFullYear()) === (tomorrow === null || tomorrow === void 0 ? void 0 : tomorrow.getFullYear());
1550
- };
1551
- this._datePipe = new DatePipe(this._localeId);
1552
- }
1553
- transform(value) {
1554
- // Parse the value to a date object.
1555
- const date = this.parseAsDate(value);
1556
- // Check if the date is valid.
1557
- if (!this.isValidDate(date)) {
1558
- return value;
1559
- }
1560
- // Return the formatted date.
1561
- return this.format(date);
1562
- }
1563
- format(date) {
1564
- // It happens tomorrow.
1565
- if (this.isTomorrow(date)) {
1566
- return this.formatString(date, 'times.tomorrow_at', 'shortTime');
1567
- }
1568
- // It happened today.
1569
- if (this.isToday(date)) {
1570
- return this.formatString(date, 'times.today_at', 'shortTime');
1571
- }
1572
- // It happened yesterday.
1573
- if (this.isYesterday(date)) {
1574
- return this.formatString(date, 'times.yesterday_at', 'shortTime');
1575
- }
1576
- // Just return the date.
1577
- return this.formatString(date);
1578
- }
1579
- formatString(date, token, format) {
1580
- // Just return the parsed date.
1581
- if (!this._localize || !token || !format) {
1582
- return this._datePipe.transform(date, 'mediumDate');
1583
- }
1584
- // Return the translated formatting.
1585
- return this._localize.translate({
1586
- token: token,
1587
- data: { date: this._datePipe.transform(date, format) }
1588
- });
1589
- }
1590
- }
1591
- BbRelativeTime.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbRelativeTime, deps: [{ token: i4.Localize, optional: true }, { token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Pipe });
1592
- BbRelativeTime.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbRelativeTime, name: "bbRelativeTime" });
1593
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbRelativeTime, decorators: [{
1594
- type: Pipe,
1595
- args: [{
1596
- name: 'bbRelativeTime'
1597
- }]
1598
- }], ctorParameters: function () { return [{ type: i4.Localize, decorators: [{
1599
- type: Optional
1600
- }] }, { type: undefined, decorators: [{
1601
- type: Inject,
1602
- args: [LOCALE_ID]
1513
+ class BbRelativeTime {
1514
+ constructor(_localize, _localeId) {
1515
+ this._localize = _localize;
1516
+ this._localeId = _localeId;
1517
+ this.isValidDate = (date) => {
1518
+ return typeof date === 'object' &&
1519
+ typeof date.getTime === 'function' &&
1520
+ !isNaN(date.getTime());
1521
+ };
1522
+ this.parseAsDate = (value) => {
1523
+ // Add a Z after the date so
1524
+ // it is treated as a UTC date.
1525
+ 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)) {
1526
+ return new Date(`${value}Z`);
1527
+ }
1528
+ // Return the regular parsed date.
1529
+ return new Date(value);
1530
+ };
1531
+ this.isToday = (date) => {
1532
+ const today = new Date();
1533
+ return (date === null || date === void 0 ? void 0 : date.getDate()) === (today === null || today === void 0 ? void 0 : today.getDate()) &&
1534
+ (date === null || date === void 0 ? void 0 : date.getMonth()) === (today === null || today === void 0 ? void 0 : today.getMonth()) &&
1535
+ (date === null || date === void 0 ? void 0 : date.getFullYear()) === (today === null || today === void 0 ? void 0 : today.getFullYear());
1536
+ };
1537
+ this.isYesterday = (date) => {
1538
+ var _a, _b;
1539
+ 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));
1540
+ return (date === null || date === void 0 ? void 0 : date.getDate()) === (yesterday === null || yesterday === void 0 ? void 0 : yesterday.getDate()) &&
1541
+ (date === null || date === void 0 ? void 0 : date.getMonth()) === (yesterday === null || yesterday === void 0 ? void 0 : yesterday.getMonth()) &&
1542
+ (date === null || date === void 0 ? void 0 : date.getFullYear()) === (yesterday === null || yesterday === void 0 ? void 0 : yesterday.getFullYear());
1543
+ };
1544
+ this.isTomorrow = (date) => {
1545
+ var _a, _b;
1546
+ 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));
1547
+ return (date === null || date === void 0 ? void 0 : date.getDate()) === (tomorrow === null || tomorrow === void 0 ? void 0 : tomorrow.getDate()) &&
1548
+ (date === null || date === void 0 ? void 0 : date.getMonth()) === (tomorrow === null || tomorrow === void 0 ? void 0 : tomorrow.getMonth()) &&
1549
+ (date === null || date === void 0 ? void 0 : date.getFullYear()) === (tomorrow === null || tomorrow === void 0 ? void 0 : tomorrow.getFullYear());
1550
+ };
1551
+ this._datePipe = new DatePipe(this._localeId);
1552
+ }
1553
+ transform(value) {
1554
+ // Parse the value to a date object.
1555
+ const date = this.parseAsDate(value);
1556
+ // Check if the date is valid.
1557
+ if (!this.isValidDate(date)) {
1558
+ return value;
1559
+ }
1560
+ // Return the formatted date.
1561
+ return this.format(date);
1562
+ }
1563
+ format(date) {
1564
+ // It happens tomorrow.
1565
+ if (this.isTomorrow(date)) {
1566
+ return this.formatString(date, 'times.tomorrow_at', 'shortTime');
1567
+ }
1568
+ // It happened today.
1569
+ if (this.isToday(date)) {
1570
+ return this.formatString(date, 'times.today_at', 'shortTime');
1571
+ }
1572
+ // It happened yesterday.
1573
+ if (this.isYesterday(date)) {
1574
+ return this.formatString(date, 'times.yesterday_at', 'shortTime');
1575
+ }
1576
+ // Just return the date.
1577
+ return this.formatString(date);
1578
+ }
1579
+ formatString(date, token, format) {
1580
+ // Just return the parsed date.
1581
+ if (!this._localize || !token || !format) {
1582
+ return this._datePipe.transform(date, 'mediumDate');
1583
+ }
1584
+ // Return the translated formatting.
1585
+ return this._localize.translate({
1586
+ token: token,
1587
+ data: { date: this._datePipe.transform(date, format) }
1588
+ });
1589
+ }
1590
+ }
1591
+ BbRelativeTime.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbRelativeTime, deps: [{ token: i4.Localize, optional: true }, { token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Pipe });
1592
+ BbRelativeTime.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbRelativeTime, name: "bbRelativeTime" });
1593
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbRelativeTime, decorators: [{
1594
+ type: Pipe,
1595
+ args: [{
1596
+ name: 'bbRelativeTime'
1597
+ }]
1598
+ }], ctorParameters: function () { return [{ type: i4.Localize, decorators: [{
1599
+ type: Optional
1600
+ }] }, { type: undefined, decorators: [{
1601
+ type: Inject,
1602
+ args: [LOCALE_ID]
1603
1603
  }] }]; } });
1604
1604
 
1605
- let nextUniqueId = 0;
1606
- class BbCheckboxBase {
1607
- }
1608
- const BbCheckboxMixinBase = mixinDisabled(mixinGrouped(BbCheckboxBase));
1609
- class BbCheckbox extends BbCheckboxMixinBase {
1610
- constructor(_changeDetection) {
1611
- super();
1612
- this._changeDetection = _changeDetection;
1613
- // Data.
1614
- this.labelId = `bb-checkbox-${nextUniqueId++}`;
1615
- this._checked = false;
1616
- // Methods.
1617
- this.onChange = () => {
1618
- };
1619
- this.onTouched = () => {
1620
- };
1621
- }
1622
- get checked() {
1623
- return this._checked;
1624
- }
1625
- set checked(value) {
1626
- this._checked = coerceBooleanProperty(value);
1627
- this._changeDetection.markForCheck();
1628
- }
1629
- registerOnChange(fn) {
1630
- this.onChange = fn;
1631
- }
1632
- registerOnTouched(fn) {
1633
- this.onTouched = fn;
1634
- }
1635
- setDisabledState(isDisabled) {
1636
- this.disabled = isDisabled;
1637
- this._changeDetection.markForCheck();
1638
- }
1639
- writeValue(newValue) {
1640
- this.checked = newValue;
1641
- }
1642
- onInteractionEvent(event) {
1643
- // Stop the propagation to prevent it from bubbling up.
1644
- event.stopPropagation();
1645
- }
1646
- onInputClick(event) {
1647
- // Stop the propagation to prevent it from bubbling up.
1648
- event.stopPropagation();
1649
- // Toggle the value.
1650
- this.checked = !this.checked;
1651
- // Emit the change event.
1652
- this.onChange && this.onChange(this.checked);
1653
- }
1654
- }
1655
- BbCheckbox.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbCheckbox, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1656
- BbCheckbox.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.1", type: BbCheckbox, selector: "bb-checkbox", inputs: { grouped: "grouped", disabled: "disabled", tabIndex: "tabIndex", checked: "checked" }, host: { properties: { "class.grouped": "grouped" }, classAttribute: "bb-checkbox" }, providers: [
1657
- { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbCheckbox), multi: true }
1658
- ], 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;-moz-user-select:none;-ms-user-select:none;user-select:none}.bb-checkbox-label>span{display:inline-block;vertical-align:middle;transform:translateZ(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:translateZ(0)}.bb-checkbox-input:not(:disabled):not(:checked)+.bb-checkbox-label:focus>span:first-child{box-shadow:0 0 0 3px hsla(0,20%,84%,.5)}.bb-checkbox-input:not(:disabled):checked+.bb-checkbox-label:focus>span:first-child{box-shadow:0 0 0 3px rgba(91,83,255,.5)}.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:hsla(0,0%,80%,.64);background-color:hsla(0,0%,80%,.64)}"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1659
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbCheckbox, decorators: [{
1660
- type: Component,
1661
- args: [{
1662
- selector: 'bb-checkbox',
1663
- templateUrl: './checkbox.component.html',
1664
- styleUrls: ['./checkbox.component.scss'],
1665
- changeDetection: ChangeDetectionStrategy.OnPush,
1666
- encapsulation: ViewEncapsulation.None,
1667
- providers: [
1668
- { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbCheckbox), multi: true }
1669
- ],
1670
- host: {
1671
- 'class': 'bb-checkbox',
1672
- '[class.grouped]': 'grouped'
1673
- },
1674
- inputs: ['grouped', 'disabled'],
1675
- preserveWhitespaces: false
1676
- }]
1677
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { tabIndex: [{
1678
- type: Input
1679
- }], checked: [{
1680
- type: Input
1605
+ let nextUniqueId = 0;
1606
+ class BbCheckboxBase {
1607
+ }
1608
+ const BbCheckboxMixinBase = mixinDisabled(mixinGrouped(BbCheckboxBase));
1609
+ class BbCheckbox extends BbCheckboxMixinBase {
1610
+ constructor(_changeDetection) {
1611
+ super();
1612
+ this._changeDetection = _changeDetection;
1613
+ // Data.
1614
+ this.labelId = `bb-checkbox-${nextUniqueId++}`;
1615
+ this._checked = false;
1616
+ // Methods.
1617
+ this.onChange = () => {
1618
+ };
1619
+ this.onTouched = () => {
1620
+ };
1621
+ }
1622
+ get checked() {
1623
+ return this._checked;
1624
+ }
1625
+ set checked(value) {
1626
+ this._checked = coerceBooleanProperty(value);
1627
+ this._changeDetection.markForCheck();
1628
+ }
1629
+ registerOnChange(fn) {
1630
+ this.onChange = fn;
1631
+ }
1632
+ registerOnTouched(fn) {
1633
+ this.onTouched = fn;
1634
+ }
1635
+ setDisabledState(isDisabled) {
1636
+ this.disabled = isDisabled;
1637
+ this._changeDetection.markForCheck();
1638
+ }
1639
+ writeValue(newValue) {
1640
+ this.checked = newValue;
1641
+ }
1642
+ onInteractionEvent(event) {
1643
+ // Stop the propagation to prevent it from bubbling up.
1644
+ event.stopPropagation();
1645
+ }
1646
+ onInputClick(event) {
1647
+ // Stop the propagation to prevent it from bubbling up.
1648
+ event.stopPropagation();
1649
+ // Toggle the value.
1650
+ this.checked = !this.checked;
1651
+ // Emit the change event.
1652
+ this.onChange && this.onChange(this.checked);
1653
+ }
1654
+ }
1655
+ BbCheckbox.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbCheckbox, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1656
+ BbCheckbox.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.10", type: BbCheckbox, selector: "bb-checkbox", inputs: { grouped: "grouped", disabled: "disabled", tabIndex: "tabIndex", checked: "checked" }, host: { properties: { "class.grouped": "grouped" }, classAttribute: "bb-checkbox" }, providers: [
1657
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbCheckbox), multi: true }
1658
+ ], 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;-moz-user-select:none;-ms-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 });
1659
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbCheckbox, decorators: [{
1660
+ type: Component,
1661
+ args: [{
1662
+ selector: 'bb-checkbox',
1663
+ templateUrl: './checkbox.component.html',
1664
+ styleUrls: ['./checkbox.component.scss'],
1665
+ changeDetection: ChangeDetectionStrategy.OnPush,
1666
+ encapsulation: ViewEncapsulation.None,
1667
+ providers: [
1668
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbCheckbox), multi: true }
1669
+ ],
1670
+ host: {
1671
+ 'class': 'bb-checkbox',
1672
+ '[class.grouped]': 'grouped'
1673
+ },
1674
+ inputs: ['grouped', 'disabled'],
1675
+ preserveWhitespaces: false
1676
+ }]
1677
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { tabIndex: [{
1678
+ type: Input
1679
+ }], checked: [{
1680
+ type: Input
1681
1681
  }] } });
1682
1682
 
1683
- class BbFocus {
1684
- constructor(_zone, _platform, _elementRef) {
1685
- this._zone = _zone;
1686
- this._platform = _platform;
1687
- this._elementRef = _elementRef;
1688
- }
1689
- get nativeElement() {
1690
- return this._elementRef.nativeElement;
1691
- }
1692
- ngAfterViewInit() {
1693
- // Run the method outside the Angular zone.
1694
- this._zone.runOutsideAngular(() => this.focus());
1695
- }
1696
- focus() {
1697
- // Check if set timeout exists and the user is
1698
- // using the site on desktop devices.
1699
- if (!this._platform.isDesktop || !setTimeout) {
1700
- return;
1701
- }
1702
- // Check if the element and the focus method exist, if so focus the element.
1703
- if (!this.nativeElement || !this.nativeElement.focus) {
1704
- return;
1705
- }
1706
- // Execute the focus method in a timeout.
1707
- setTimeout(() => this.nativeElement.focus(), 0);
1708
- }
1709
- }
1710
- BbFocus.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbFocus, deps: [{ token: i0.NgZone }, { token: i1$1.Platform }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1711
- BbFocus.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.1", type: BbFocus, selector: "[bbFocus]", ngImport: i0 });
1712
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbFocus, decorators: [{
1713
- type: Directive,
1714
- args: [{
1715
- selector: '[bbFocus]'
1716
- }]
1683
+ class BbFocus {
1684
+ constructor(_zone, _platform, _elementRef) {
1685
+ this._zone = _zone;
1686
+ this._platform = _platform;
1687
+ this._elementRef = _elementRef;
1688
+ }
1689
+ get nativeElement() {
1690
+ return this._elementRef.nativeElement;
1691
+ }
1692
+ ngAfterViewInit() {
1693
+ // Run the method outside the Angular zone.
1694
+ this._zone.runOutsideAngular(() => this.focus());
1695
+ }
1696
+ focus() {
1697
+ // Check if set timeout exists and the user is
1698
+ // using the site on desktop devices.
1699
+ if (!this._platform.isDesktop || !setTimeout) {
1700
+ return;
1701
+ }
1702
+ // Check if the element and the focus method exist, if so focus the element.
1703
+ if (!this.nativeElement || !this.nativeElement.focus) {
1704
+ return;
1705
+ }
1706
+ // Execute the focus method in a timeout.
1707
+ setTimeout(() => this.nativeElement.focus(), 0);
1708
+ }
1709
+ }
1710
+ BbFocus.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbFocus, deps: [{ token: i0.NgZone }, { token: i1$1.Platform }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1711
+ BbFocus.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.10", type: BbFocus, selector: "[bbFocus]", ngImport: i0 });
1712
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbFocus, decorators: [{
1713
+ type: Directive,
1714
+ args: [{
1715
+ selector: '[bbFocus]'
1716
+ }]
1717
1717
  }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i1$1.Platform }, { type: i0.ElementRef }]; } });
1718
1718
 
1719
- class BbAvatar {
1720
- constructor() {
1721
- // Inputs.
1722
- this.size = 40;
1723
- // State.
1724
- this.state$ = new BehaviorSubject('initials');
1725
- // Data.
1726
- this._src = null;
1727
- this._title = null;
1728
- this._initials = '!';
1729
- this._color = 'rgb(255, 255, 255)';
1730
- this._backgroundColor = 'rgb(66, 66, 66)';
1731
- this.toRGb = (value) => {
1732
- const baseRed = 128;
1733
- const baseGreen = 128;
1734
- const baseBlue = 128;
1735
- let seed = value.charCodeAt(0) ^ value.charCodeAt(1);
1736
- const rand_1 = Math.abs((Math.sin(seed++) * 10000)) % 256;
1737
- const rand_2 = Math.abs((Math.sin(seed++) * 10000)) % 256;
1738
- const rand_3 = Math.abs((Math.sin(seed++) * 10000)) % 256;
1739
- const r = Math.round((rand_1 + baseRed) / 2);
1740
- const g = Math.round((rand_2 + baseGreen) / 2);
1741
- const b = Math.round((rand_3 + baseBlue) / 2);
1742
- return { r, g, b };
1743
- };
1744
- this.getInitials = (name) => {
1745
- // Get all the initials.
1746
- const names = (name || '').split(' ');
1747
- const initials = names.map(name => name.charAt(0).toUpperCase());
1748
- // Check if there are any initials.
1749
- if (initials.length <= 0) {
1750
- return null;
1751
- }
1752
- // Get the first and last initials.
1753
- if (initials.length > 1) {
1754
- return `${initials[0]}${initials[initials.length - 1]}`;
1755
- }
1756
- // Get only the first initial.
1757
- return initials[0];
1758
- };
1759
- this.parseColorFormat = (value) => {
1760
- var _a;
1761
- // Hex 3 values.
1762
- let match = value.match(/^#([0-9a-f]{3})$/i);
1763
- if (match && match[1]) {
1764
- const r = parseInt(match[1].charAt(0), 16) * 0x11;
1765
- const g = parseInt(match[1].charAt(1), 16) * 0x11;
1766
- const b = parseInt(match[1].charAt(2), 16) * 0x11;
1767
- return { r, g, b };
1768
- }
1769
- // Hex 6 values.
1770
- match = value.match(/^#([0-9a-f]{6})$/i);
1771
- if (match && match[1]) {
1772
- const r = parseInt(match[1].substr(0, 2), 16);
1773
- const g = parseInt(match[1].substr(2, 2), 16);
1774
- const b = parseInt(match[1].substr(4, 2), 16);
1775
- return { r, g, b };
1776
- }
1777
- // Rgb values.
1778
- match = value.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);
1779
- if (match) {
1780
- const r = parseInt(match[1], 10);
1781
- const g = parseInt(match[2], 10);
1782
- const b = parseInt(match[3], 10);
1783
- return { r, g, b };
1784
- }
1785
- // Not a supported color format.
1786
- (_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.`);
1787
- return null;
1788
- };
1789
- }
1790
- set src(value) {
1791
- this._src = value;
1792
- if (this._src) {
1793
- this.state$.next('image');
1794
- }
1795
- }
1796
- set title(value) {
1797
- // Set the title and the initials.
1798
- this._title = value || '!';
1799
- this._initials = this.getInitials(this._title);
1800
- // Generate the colors based on the name.
1801
- const { r, g, b } = this.toRGb(this._title);
1802
- this.setColors(r, g, b);
1803
- }
1804
- set tintColor(value) {
1805
- const result = this.parseColorFormat(value);
1806
- if (!result) {
1807
- return;
1808
- }
1809
- const { r, g, b } = result;
1810
- this.setColors(r, g, b);
1811
- }
1812
- get src() {
1813
- return this._src;
1814
- }
1815
- get color() {
1816
- return this._color;
1817
- }
1818
- get backgroundColor() {
1819
- return this._backgroundColor;
1820
- }
1821
- get title() {
1822
- return this._title;
1823
- }
1824
- get initials() {
1825
- return this._initials;
1826
- }
1827
- setColors(red, green, blue) {
1828
- this._color = `rgb(${red},${green},${blue})`;
1829
- this._backgroundColor = `rgba(${red},${green},${blue}, 0.25)`;
1830
- }
1831
- }
1832
- BbAvatar.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbAvatar, deps: [], target: i0.ɵɵFactoryTarget.Component });
1833
- BbAvatar.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.1", 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;-moz-user-select:none;-ms-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%;-o-object-fit:cover;object-fit:cover;position:absolute}"], 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 });
1834
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbAvatar, decorators: [{
1835
- type: Component,
1836
- args: [{
1837
- selector: 'bb-avatar',
1838
- templateUrl: './avatar.component.html',
1839
- styleUrls: ['./avatar.component.scss'],
1840
- changeDetection: ChangeDetectionStrategy.OnPush,
1841
- encapsulation: ViewEncapsulation.None,
1842
- preserveWhitespaces: false,
1843
- host: {
1844
- 'class': 'bb-avatar',
1845
- 'role': 'img',
1846
- '[style.width.px]': 'size',
1847
- '[style.height.px]': 'size',
1848
- '[style.font-size.px]': 'size / 2',
1849
- '[style.color]': 'color',
1850
- '[style.background-color]': 'backgroundColor'
1851
- }
1852
- }]
1853
- }], propDecorators: { size: [{
1854
- type: Input
1855
- }], src: [{
1856
- type: Input
1857
- }], title: [{
1858
- type: Input
1859
- }, {
1860
- type: HostBinding,
1861
- args: ['attr.title']
1862
- }], tintColor: [{
1863
- type: Input
1719
+ class BbAvatar {
1720
+ constructor() {
1721
+ // Inputs.
1722
+ this.size = 40;
1723
+ // State.
1724
+ this.state$ = new BehaviorSubject('initials');
1725
+ // Data.
1726
+ this._src = null;
1727
+ this._title = null;
1728
+ this._initials = '!';
1729
+ this._color = 'rgb(255, 255, 255)';
1730
+ this._backgroundColor = 'rgb(66, 66, 66)';
1731
+ this.toRGb = (value) => {
1732
+ const baseRed = 128;
1733
+ const baseGreen = 128;
1734
+ const baseBlue = 128;
1735
+ let seed = value.charCodeAt(0) ^ value.charCodeAt(1);
1736
+ const rand_1 = Math.abs((Math.sin(seed++) * 10000)) % 256;
1737
+ const rand_2 = Math.abs((Math.sin(seed++) * 10000)) % 256;
1738
+ const rand_3 = Math.abs((Math.sin(seed++) * 10000)) % 256;
1739
+ const r = Math.round((rand_1 + baseRed) / 2);
1740
+ const g = Math.round((rand_2 + baseGreen) / 2);
1741
+ const b = Math.round((rand_3 + baseBlue) / 2);
1742
+ return { r, g, b };
1743
+ };
1744
+ this.getInitials = (name) => {
1745
+ // Get all the initials.
1746
+ const names = (name || '').split(' ');
1747
+ const initials = names.map(name => name.charAt(0).toUpperCase());
1748
+ // Check if there are any initials.
1749
+ if (initials.length <= 0) {
1750
+ return null;
1751
+ }
1752
+ // Get the first and last initials.
1753
+ if (initials.length > 1) {
1754
+ return `${initials[0]}${initials[initials.length - 1]}`;
1755
+ }
1756
+ // Get only the first initial.
1757
+ return initials[0];
1758
+ };
1759
+ this.parseColorFormat = (value) => {
1760
+ var _a;
1761
+ // Hex 3 values.
1762
+ let match = value.match(/^#([0-9a-f]{3})$/i);
1763
+ if (match && match[1]) {
1764
+ const r = parseInt(match[1].charAt(0), 16) * 0x11;
1765
+ const g = parseInt(match[1].charAt(1), 16) * 0x11;
1766
+ const b = parseInt(match[1].charAt(2), 16) * 0x11;
1767
+ return { r, g, b };
1768
+ }
1769
+ // Hex 6 values.
1770
+ match = value.match(/^#([0-9a-f]{6})$/i);
1771
+ if (match && match[1]) {
1772
+ const r = parseInt(match[1].substr(0, 2), 16);
1773
+ const g = parseInt(match[1].substr(2, 2), 16);
1774
+ const b = parseInt(match[1].substr(4, 2), 16);
1775
+ return { r, g, b };
1776
+ }
1777
+ // Rgb values.
1778
+ match = value.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);
1779
+ if (match) {
1780
+ const r = parseInt(match[1], 10);
1781
+ const g = parseInt(match[2], 10);
1782
+ const b = parseInt(match[3], 10);
1783
+ return { r, g, b };
1784
+ }
1785
+ // Not a supported color format.
1786
+ (_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.`);
1787
+ return null;
1788
+ };
1789
+ }
1790
+ set src(value) {
1791
+ this._src = value;
1792
+ if (this._src) {
1793
+ this.state$.next('image');
1794
+ }
1795
+ }
1796
+ set title(value) {
1797
+ // Set the title and the initials.
1798
+ this._title = value || '!';
1799
+ this._initials = this.getInitials(this._title);
1800
+ // Generate the colors based on the name.
1801
+ const { r, g, b } = this.toRGb(this._title);
1802
+ this.setColors(r, g, b);
1803
+ }
1804
+ set tintColor(value) {
1805
+ const result = this.parseColorFormat(value);
1806
+ if (!result) {
1807
+ return;
1808
+ }
1809
+ const { r, g, b } = result;
1810
+ this.setColors(r, g, b);
1811
+ }
1812
+ get src() {
1813
+ return this._src;
1814
+ }
1815
+ get color() {
1816
+ return this._color;
1817
+ }
1818
+ get backgroundColor() {
1819
+ return this._backgroundColor;
1820
+ }
1821
+ get title() {
1822
+ return this._title;
1823
+ }
1824
+ get initials() {
1825
+ return this._initials;
1826
+ }
1827
+ setColors(red, green, blue) {
1828
+ this._color = `rgb(${red},${green},${blue})`;
1829
+ this._backgroundColor = `rgba(${red},${green},${blue}, 0.25)`;
1830
+ }
1831
+ }
1832
+ BbAvatar.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbAvatar, deps: [], target: i0.ɵɵFactoryTarget.Component });
1833
+ BbAvatar.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.10", 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;-moz-user-select:none;-ms-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%;-o-object-fit:cover;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 });
1834
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbAvatar, decorators: [{
1835
+ type: Component,
1836
+ args: [{
1837
+ selector: 'bb-avatar',
1838
+ templateUrl: './avatar.component.html',
1839
+ styleUrls: ['./avatar.component.scss'],
1840
+ changeDetection: ChangeDetectionStrategy.OnPush,
1841
+ encapsulation: ViewEncapsulation.None,
1842
+ preserveWhitespaces: false,
1843
+ host: {
1844
+ 'class': 'bb-avatar',
1845
+ 'role': 'img',
1846
+ '[style.width.px]': 'size',
1847
+ '[style.height.px]': 'size',
1848
+ '[style.font-size.px]': 'size / 2',
1849
+ '[style.color]': 'color',
1850
+ '[style.background-color]': 'backgroundColor'
1851
+ }
1852
+ }]
1853
+ }], propDecorators: { size: [{
1854
+ type: Input
1855
+ }], src: [{
1856
+ type: Input
1857
+ }], title: [{
1858
+ type: Input
1859
+ }, {
1860
+ type: HostBinding,
1861
+ args: ['attr.title']
1862
+ }], tintColor: [{
1863
+ type: Input
1864
1864
  }] } });
1865
1865
 
1866
- class BbIcon {
1867
- constructor(_registry) {
1868
- this._registry = _registry;
1869
- // Data.
1870
- this._src = null;
1871
- // State.
1872
- this.state$ = new BehaviorSubject(null);
1873
- this.alt = null;
1874
- this.size = 24;
1875
- this._ariaHidden = true;
1876
- this.warn = (content) => {
1877
- return console && console.warn && console.warn(content);
1878
- };
1879
- }
1880
- set src(newValue) {
1881
- this.state$.next(this.convert(newValue));
1882
- this._src = newValue;
1883
- }
1884
- get src() {
1885
- return this._src;
1886
- }
1887
- set ariaHidden(newValue) {
1888
- this._ariaHidden = coerceBooleanProperty(newValue);
1889
- }
1890
- get ariaHidden() {
1891
- return this._ariaHidden;
1892
- }
1893
- convert(src) {
1894
- const [namespace, value] = (src || '').split(':');
1895
- const onError = () => {
1896
- this.warn(`ElementsModule: The icon with src "${src}" could not be rendered correctly; Did you put a correct src attribute?`);
1897
- return { type: 'unknown' };
1898
- };
1899
- if (!namespace || !value || !this._registry) {
1900
- return onError();
1901
- }
1902
- // Try to find a image icon.
1903
- const imageIcon = this.findImageIcon(namespace, value);
1904
- if (imageIcon) {
1905
- return imageIcon;
1906
- }
1907
- // Try to find a font icon.
1908
- const fontIcon = this.findFontIcon(namespace, value);
1909
- if (fontIcon) {
1910
- return fontIcon;
1911
- }
1912
- // Return the on error function.
1913
- return onError();
1914
- }
1915
- findImageIcon(namespace, value) {
1916
- const data = this._registry.find(item => item['namespace'] === namespace && item['name'] === value);
1917
- if (!data) {
1918
- return null;
1919
- }
1920
- return { type: data['type'], src: data['src'] };
1921
- }
1922
- findFontIcon(namespace, content) {
1923
- const data = this._registry.find(item => item['namespace'] === namespace);
1924
- if (!data) {
1925
- return null;
1926
- }
1927
- const uses = data['uses'];
1928
- if (uses === 'data-attribute') {
1929
- return { type: data['type'], className: data['className'], attribute: content };
1930
- }
1931
- return { type: data['type'], className: data['className'], content };
1932
- }
1933
- }
1934
- BbIcon.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbIcon, deps: [{ token: ELEMENTS_ICONS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1935
- BbIcon.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.1", 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;-moz-user-select:none;-ms-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}"], 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 });
1936
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbIcon, decorators: [{
1937
- type: Component,
1938
- args: [{
1939
- selector: 'bb-icon',
1940
- templateUrl: './icon.component.html',
1941
- styleUrls: ['./icon.component.scss'],
1942
- changeDetection: ChangeDetectionStrategy.OnPush,
1943
- encapsulation: ViewEncapsulation.None,
1944
- host: {
1945
- 'class': 'bb-icon',
1946
- '[attr.aria-hidden]': 'ariaHidden',
1947
- '[style.width.px]': 'size',
1948
- '[style.height.px]': 'size',
1949
- '[style.min-width.px]': 'size',
1950
- '[style.min-height.px]': 'size',
1951
- '[style.font-size.px]': 'size'
1952
- },
1953
- preserveWhitespaces: false
1954
- }]
1955
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1956
- type: Optional
1957
- }, {
1958
- type: Inject,
1959
- args: [ELEMENTS_ICONS]
1960
- }] }]; }, propDecorators: { alt: [{
1961
- type: Input
1962
- }], size: [{
1963
- type: Input
1964
- }], src: [{
1965
- type: Input
1966
- }], ariaHidden: [{
1967
- type: Input
1866
+ class BbIcon {
1867
+ constructor(_registry) {
1868
+ this._registry = _registry;
1869
+ // Data.
1870
+ this._src = null;
1871
+ // State.
1872
+ this.state$ = new BehaviorSubject(null);
1873
+ this.alt = null;
1874
+ this.size = 24;
1875
+ this._ariaHidden = true;
1876
+ this.warn = (content) => {
1877
+ return console && console.warn && console.warn(content);
1878
+ };
1879
+ }
1880
+ set src(newValue) {
1881
+ this.state$.next(this.convert(newValue));
1882
+ this._src = newValue;
1883
+ }
1884
+ get src() {
1885
+ return this._src;
1886
+ }
1887
+ set ariaHidden(newValue) {
1888
+ this._ariaHidden = coerceBooleanProperty(newValue);
1889
+ }
1890
+ get ariaHidden() {
1891
+ return this._ariaHidden;
1892
+ }
1893
+ convert(src) {
1894
+ const [namespace, value] = (src || '').split(':');
1895
+ const onError = () => {
1896
+ this.warn(`ElementsModule: The icon with src "${src}" could not be rendered correctly; Did you put a correct src attribute?`);
1897
+ return { type: 'unknown' };
1898
+ };
1899
+ if (!namespace || !value || !this._registry) {
1900
+ return onError();
1901
+ }
1902
+ // Try to find a image icon.
1903
+ const imageIcon = this.findImageIcon(namespace, value);
1904
+ if (imageIcon) {
1905
+ return imageIcon;
1906
+ }
1907
+ // Try to find a font icon.
1908
+ const fontIcon = this.findFontIcon(namespace, value);
1909
+ if (fontIcon) {
1910
+ return fontIcon;
1911
+ }
1912
+ // Return the on error function.
1913
+ return onError();
1914
+ }
1915
+ findImageIcon(namespace, value) {
1916
+ const data = this._registry.find(item => item['namespace'] === namespace && item['name'] === value);
1917
+ if (!data) {
1918
+ return null;
1919
+ }
1920
+ return { type: data['type'], src: data['src'] };
1921
+ }
1922
+ findFontIcon(namespace, content) {
1923
+ const data = this._registry.find(item => item['namespace'] === namespace);
1924
+ if (!data) {
1925
+ return null;
1926
+ }
1927
+ const uses = data['uses'];
1928
+ if (uses === 'data-attribute') {
1929
+ return { type: data['type'], className: data['className'], attribute: content };
1930
+ }
1931
+ return { type: data['type'], className: data['className'], content };
1932
+ }
1933
+ }
1934
+ BbIcon.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbIcon, deps: [{ token: ELEMENTS_ICONS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1935
+ BbIcon.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.10", 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;-moz-user-select:none;-ms-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 });
1936
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbIcon, decorators: [{
1937
+ type: Component,
1938
+ args: [{
1939
+ selector: 'bb-icon',
1940
+ templateUrl: './icon.component.html',
1941
+ styleUrls: ['./icon.component.scss'],
1942
+ changeDetection: ChangeDetectionStrategy.OnPush,
1943
+ encapsulation: ViewEncapsulation.None,
1944
+ host: {
1945
+ 'class': 'bb-icon',
1946
+ '[attr.aria-hidden]': 'ariaHidden',
1947
+ '[style.width.px]': 'size',
1948
+ '[style.height.px]': 'size',
1949
+ '[style.min-width.px]': 'size',
1950
+ '[style.min-height.px]': 'size',
1951
+ '[style.font-size.px]': 'size'
1952
+ },
1953
+ preserveWhitespaces: false
1954
+ }]
1955
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1956
+ type: Optional
1957
+ }, {
1958
+ type: Inject,
1959
+ args: [ELEMENTS_ICONS]
1960
+ }] }]; }, propDecorators: { alt: [{
1961
+ type: Input
1962
+ }], size: [{
1963
+ type: Input
1964
+ }], src: [{
1965
+ type: Input
1966
+ }], ariaHidden: [{
1967
+ type: Input
1968
1968
  }] } });
1969
1969
 
1970
- class BbTag {
1971
- constructor() {
1972
- // Outputs.
1973
- this.onClose = new EventEmitter();
1974
- }
1975
- }
1976
- BbTag.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbTag, deps: [], target: i0.ɵɵFactoryTarget.Component });
1977
- BbTag.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.1", 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?.observers?.length > 0\"\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:rgba(0,0,0,.65);border:1px solid #d9d9d9;background-color:#fafafa;font-variant:tabular-nums;font-feature-settings:\"tnum\"}.bb-tag:not(:last-child){margin-right:8px}"], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1978
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: BbTag, decorators: [{
1979
- type: Component,
1980
- args: [{
1981
- selector: 'bb-tag',
1982
- templateUrl: './tag.component.html',
1983
- styleUrls: ['./tag.component.scss'],
1984
- changeDetection: ChangeDetectionStrategy.OnPush,
1985
- encapsulation: ViewEncapsulation.None,
1986
- preserveWhitespaces: false,
1987
- host: { 'class': 'bb-tag' }
1988
- }]
1989
- }], propDecorators: { onClose: [{
1990
- type: Output
1970
+ class BbTag {
1971
+ constructor() {
1972
+ // Outputs.
1973
+ this.onClose = new EventEmitter();
1974
+ }
1975
+ }
1976
+ BbTag.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbTag, deps: [], target: i0.ɵɵFactoryTarget.Component });
1977
+ BbTag.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.10", 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 });
1978
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: BbTag, decorators: [{
1979
+ type: Component,
1980
+ args: [{
1981
+ selector: 'bb-tag',
1982
+ templateUrl: './tag.component.html',
1983
+ styleUrls: ['./tag.component.scss'],
1984
+ changeDetection: ChangeDetectionStrategy.OnPush,
1985
+ encapsulation: ViewEncapsulation.None,
1986
+ preserveWhitespaces: false,
1987
+ host: { 'class': 'bb-tag' }
1988
+ }]
1989
+ }], propDecorators: { onClose: [{
1990
+ type: Output
1991
1991
  }] } });
1992
1992
 
1993
- const DECLARATIONS_EXPORTS = [
1994
- // Directives.
1995
- BbTemplate,
1996
- BbFormError,
1997
- BbFormSubmit,
1998
- BbInput,
1999
- BbSelect,
2000
- BbFocus,
2001
- BbFocusTrap,
2002
- BbAutosize,
2003
- BbPrefix,
2004
- BbSuffix,
2005
- // Pipes.
2006
- BbFileSize,
2007
- BbFileImage,
2008
- BbRelativeTime,
2009
- // Components.
2010
- BbButton,
2011
- BbAnchor,
2012
- BbSpinner,
2013
- BbIcon,
2014
- BbFormControl,
2015
- BbFormGroup,
2016
- BbCheckbox,
2017
- BbDropdown,
2018
- BbDropdownItem,
2019
- BbTag,
2020
- BbAvatar,
2021
- BbFilePicker,
2022
- BbImagePicker,
2023
- BbDatePicker
2024
- ];
2025
- class ElementsModule {
2026
- static forRoot() {
2027
- return {
2028
- ngModule: ElementsModule,
2029
- providers: [
2030
- { provide: ELEMENTS_ERRORS, useFactory: getErrors, multi: true },
2031
- ELEMENTS_MATERIAL_ICON
2032
- ]
2033
- };
2034
- }
2035
- }
2036
- ElementsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: ElementsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2037
- ElementsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: ElementsModule, declarations: [
2038
- // Directives.
2039
- BbTemplate,
2040
- BbFormError,
2041
- BbFormSubmit,
2042
- BbInput,
2043
- BbSelect,
2044
- BbFocus,
2045
- BbFocusTrap,
2046
- BbAutosize,
2047
- BbPrefix,
2048
- BbSuffix,
2049
- // Pipes.
2050
- BbFileSize,
2051
- BbFileImage,
2052
- BbRelativeTime,
2053
- // Components.
2054
- BbButton,
2055
- BbAnchor,
2056
- BbSpinner,
2057
- BbIcon,
2058
- BbFormControl,
2059
- BbFormGroup,
2060
- BbCheckbox,
2061
- BbDropdown,
2062
- BbDropdownItem,
2063
- BbTag,
2064
- BbAvatar,
2065
- BbFilePicker,
2066
- BbImagePicker,
2067
- BbDatePicker], imports: [CommonModule, ReactiveFormsModule, LocalizeModule], exports: [
2068
- // Directives.
2069
- BbTemplate,
2070
- BbFormError,
2071
- BbFormSubmit,
2072
- BbInput,
2073
- BbSelect,
2074
- BbFocus,
2075
- BbFocusTrap,
2076
- BbAutosize,
2077
- BbPrefix,
2078
- BbSuffix,
2079
- // Pipes.
2080
- BbFileSize,
2081
- BbFileImage,
2082
- BbRelativeTime,
2083
- // Components.
2084
- BbButton,
2085
- BbAnchor,
2086
- BbSpinner,
2087
- BbIcon,
2088
- BbFormControl,
2089
- BbFormGroup,
2090
- BbCheckbox,
2091
- BbDropdown,
2092
- BbDropdownItem,
2093
- BbTag,
2094
- BbAvatar,
2095
- BbFilePicker,
2096
- BbImagePicker,
2097
- BbDatePicker] });
2098
- ElementsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: ElementsModule, imports: [[CommonModule, ReactiveFormsModule, LocalizeModule]] });
2099
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0, type: ElementsModule, decorators: [{
2100
- type: NgModule,
2101
- args: [{
2102
- imports: [CommonModule, ReactiveFormsModule, LocalizeModule],
2103
- declarations: [...DECLARATIONS_EXPORTS],
2104
- exports: [...DECLARATIONS_EXPORTS]
2105
- }]
2106
- }] });
2107
- const ELEMENTS_MATERIAL_ICON = {
2108
- provide: ELEMENTS_ICONS,
2109
- useValue: { namespace: 'material', className: 'material-icons', uses: 'content', type: 'font' },
2110
- multi: true
2111
- };
2112
- function getErrors() {
2113
- const data = {
2114
- unknown: () => 'form-control-errors.unknown',
2115
- required: () => 'form-control-errors.required',
2116
- pattern: () => 'form-control-errors.pattern',
2117
- email: () => 'form-control-errors.email',
2118
- emailTaken: () => 'form-control-errors.emailTaken',
2119
- passwordMatch: () => 'form-control-errors.passwordMatch',
2120
- confirm: () => 'form-control-errors.confirm',
2121
- fullNumber: () => 'form-control-errors.fullNumber',
2122
- min: ({ min }) => ({ token: 'form-control-errors.min', data: { min } }),
2123
- max: ({ max }) => ({ token: 'form-control-errors.max', data: { max } }),
2124
- maxFileSize: ({ maxSize }) => ({ token: 'form-control-errors.maxFileSize', data: { maxSize } }),
2125
- minDate: ({ date }) => ({ token: 'form-control-errors.minDate', data: { date } }),
2126
- maxDate: ({ date }) => ({ token: 'form-control-errors.maxDate', data: { date } }),
2127
- invalidDate: () => 'form-control-errors.invalidDate',
2128
- invalidFileType: () => 'form-control-errors.invalidFileType',
2129
- minlength: ({ requiredLength, actualLength }) => ({
2130
- token: 'form-control-errors.minlength',
2131
- data: { requiredLength, actualLength }
2132
- }),
2133
- maxlength: ({ requiredLength, actualLength }) => ({
2134
- token: 'form-control-errors.maxlength',
2135
- data: { requiredLength, actualLength }
2136
- })
2137
- };
2138
- return data;
1993
+ const DECLARATIONS_EXPORTS = [
1994
+ // Directives.
1995
+ BbTemplate,
1996
+ BbFormError,
1997
+ BbFormSubmit,
1998
+ BbInput,
1999
+ BbSelect,
2000
+ BbFocus,
2001
+ BbFocusTrap,
2002
+ BbAutosize,
2003
+ BbPrefix,
2004
+ BbSuffix,
2005
+ // Pipes.
2006
+ BbFileSize,
2007
+ BbFileImage,
2008
+ BbRelativeTime,
2009
+ // Components.
2010
+ BbButton,
2011
+ BbAnchor,
2012
+ BbSpinner,
2013
+ BbIcon,
2014
+ BbFormControl,
2015
+ BbFormGroup,
2016
+ BbCheckbox,
2017
+ BbDropdown,
2018
+ BbDropdownItem,
2019
+ BbTag,
2020
+ BbAvatar,
2021
+ BbFilePicker,
2022
+ BbImagePicker,
2023
+ BbDatePicker
2024
+ ];
2025
+ class ElementsModule {
2026
+ static forRoot() {
2027
+ return {
2028
+ ngModule: ElementsModule,
2029
+ providers: [
2030
+ { provide: ELEMENTS_ERRORS, useFactory: getErrors, multi: true },
2031
+ ELEMENTS_MATERIAL_ICON
2032
+ ]
2033
+ };
2034
+ }
2035
+ }
2036
+ ElementsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: ElementsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2037
+ ElementsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: ElementsModule, declarations: [
2038
+ // Directives.
2039
+ BbTemplate,
2040
+ BbFormError,
2041
+ BbFormSubmit,
2042
+ BbInput,
2043
+ BbSelect,
2044
+ BbFocus,
2045
+ BbFocusTrap,
2046
+ BbAutosize,
2047
+ BbPrefix,
2048
+ BbSuffix,
2049
+ // Pipes.
2050
+ BbFileSize,
2051
+ BbFileImage,
2052
+ BbRelativeTime,
2053
+ // Components.
2054
+ BbButton,
2055
+ BbAnchor,
2056
+ BbSpinner,
2057
+ BbIcon,
2058
+ BbFormControl,
2059
+ BbFormGroup,
2060
+ BbCheckbox,
2061
+ BbDropdown,
2062
+ BbDropdownItem,
2063
+ BbTag,
2064
+ BbAvatar,
2065
+ BbFilePicker,
2066
+ BbImagePicker,
2067
+ BbDatePicker], imports: [CommonModule, ReactiveFormsModule, LocalizeModule], exports: [
2068
+ // Directives.
2069
+ BbTemplate,
2070
+ BbFormError,
2071
+ BbFormSubmit,
2072
+ BbInput,
2073
+ BbSelect,
2074
+ BbFocus,
2075
+ BbFocusTrap,
2076
+ BbAutosize,
2077
+ BbPrefix,
2078
+ BbSuffix,
2079
+ // Pipes.
2080
+ BbFileSize,
2081
+ BbFileImage,
2082
+ BbRelativeTime,
2083
+ // Components.
2084
+ BbButton,
2085
+ BbAnchor,
2086
+ BbSpinner,
2087
+ BbIcon,
2088
+ BbFormControl,
2089
+ BbFormGroup,
2090
+ BbCheckbox,
2091
+ BbDropdown,
2092
+ BbDropdownItem,
2093
+ BbTag,
2094
+ BbAvatar,
2095
+ BbFilePicker,
2096
+ BbImagePicker,
2097
+ BbDatePicker] });
2098
+ ElementsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: ElementsModule, imports: [[CommonModule, ReactiveFormsModule, LocalizeModule]] });
2099
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: ElementsModule, decorators: [{
2100
+ type: NgModule,
2101
+ args: [{
2102
+ imports: [CommonModule, ReactiveFormsModule, LocalizeModule],
2103
+ declarations: [...DECLARATIONS_EXPORTS],
2104
+ exports: [...DECLARATIONS_EXPORTS]
2105
+ }]
2106
+ }] });
2107
+ const ELEMENTS_MATERIAL_ICON = {
2108
+ provide: ELEMENTS_ICONS,
2109
+ useValue: { namespace: 'material', className: 'material-icons', uses: 'content', type: 'font' },
2110
+ multi: true
2111
+ };
2112
+ function getErrors() {
2113
+ const data = {
2114
+ unknown: () => 'form-control-errors.unknown',
2115
+ required: () => 'form-control-errors.required',
2116
+ pattern: () => 'form-control-errors.pattern',
2117
+ email: () => 'form-control-errors.email',
2118
+ emailTaken: () => 'form-control-errors.emailTaken',
2119
+ passwordMatch: () => 'form-control-errors.passwordMatch',
2120
+ confirm: () => 'form-control-errors.confirm',
2121
+ fullNumber: () => 'form-control-errors.fullNumber',
2122
+ min: ({ min }) => ({ token: 'form-control-errors.min', data: { min } }),
2123
+ max: ({ max }) => ({ token: 'form-control-errors.max', data: { max } }),
2124
+ maxFileSize: ({ maxSize }) => ({ token: 'form-control-errors.maxFileSize', data: { maxSize } }),
2125
+ minDate: ({ date }) => ({ token: 'form-control-errors.minDate', data: { date } }),
2126
+ maxDate: ({ date }) => ({ token: 'form-control-errors.maxDate', data: { date } }),
2127
+ invalidDate: () => 'form-control-errors.invalidDate',
2128
+ invalidFileType: () => 'form-control-errors.invalidFileType',
2129
+ minlength: ({ requiredLength, actualLength }) => ({
2130
+ token: 'form-control-errors.minlength',
2131
+ data: { requiredLength, actualLength }
2132
+ }),
2133
+ maxlength: ({ requiredLength, actualLength }) => ({
2134
+ token: 'form-control-errors.maxlength',
2135
+ data: { requiredLength, actualLength }
2136
+ })
2137
+ };
2138
+ return data;
2139
2139
  }
2140
2140
 
2141
- /**
2142
- * Generated bundle index. Do not edit.
2141
+ /**
2142
+ * Generated bundle index. Do not edit.
2143
2143
  */
2144
2144
 
2145
2145
  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 };