@bravobit/bb-foundation 0.21.1 → 0.21.4

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 (467) hide show
  1. package/README.md +47 -47
  2. package/auth/index.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/collections/index.d.ts +5 -5
  24. package/collections/lib/collection.d.ts +42 -43
  25. package/collections/lib/collections.module.d.ts +10 -10
  26. package/collections/lib/components/collections-pager/collections-pager.component.d.ts +34 -34
  27. package/collections/lib/components/collections-viewer/collections-viewer.component.d.ts +12 -12
  28. package/collections/lib/components/collections.directive.d.ts +17 -17
  29. package/collections/lib/interfaces/collection.interface.d.ts +27 -26
  30. package/collections/lib/providers/api-collection.provider.d.ts +18 -19
  31. package/collections/lib/providers/collection.provider.d.ts +6 -6
  32. package/collections/lib/providers/local-collection.provider.d.ts +8 -8
  33. package/collections/public_api.d.ts +9 -9
  34. package/controls/index.d.ts +5 -5
  35. package/controls/lib/checkbox/checkbox/checkbox.component.d.ts +47 -47
  36. package/controls/lib/checkbox/checkbox-group/checkbox-group.component.d.ts +22 -22
  37. package/controls/lib/checkbox/checkbox.module.d.ts +9 -9
  38. package/controls/lib/controls.module.d.ts +7 -7
  39. package/controls/public_api.d.ts +4 -4
  40. package/dashboard/index.d.ts +5 -5
  41. package/dashboard/lib/dashboard/dashboard.component.d.ts +19 -19
  42. package/dashboard/lib/dashboard-header/dashboard-header.component.d.ts +11 -11
  43. package/dashboard/lib/dashboard-menu/dashboard-menu.component.d.ts +9 -9
  44. package/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.d.ts +11 -11
  45. package/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.d.ts +21 -21
  46. package/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.d.ts +27 -27
  47. package/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.d.ts +16 -16
  48. package/dashboard/lib/dashboard.module.d.ts +16 -16
  49. package/dashboard/public_api.d.ts +8 -8
  50. package/dialog/index.d.ts +5 -5
  51. package/dialog/lib/dialog-actions/dialog-actions.component.d.ts +5 -5
  52. package/dialog/lib/dialog-confirm/dialog-confirm.component.d.ts +16 -16
  53. package/dialog/lib/dialog-container/dialog-container.component.d.ts +24 -24
  54. package/dialog/lib/dialog-header/dialog-header.component.d.ts +9 -9
  55. package/dialog/lib/dialog-link/dialog-link.component.d.ts +5 -5
  56. package/dialog/lib/dialog-modal/dialog-modal.component.d.ts +12 -12
  57. package/dialog/lib/dialog-overlay/dialog-overlay.component.d.ts +22 -22
  58. package/dialog/lib/dialog.injector.d.ts +8 -8
  59. package/dialog/lib/dialog.insertion.d.ts +8 -8
  60. package/dialog/lib/dialog.interfaces.d.ts +3 -3
  61. package/dialog/lib/dialog.module.d.ts +19 -19
  62. package/dialog/lib/dialog.ref.d.ts +8 -8
  63. package/dialog/lib/dialog.service.d.ts +19 -19
  64. package/dialog/public_api.d.ts +9 -9
  65. package/elements/index.d.ts +5 -5
  66. package/elements/lib/avatar/avatar.component.d.ts +25 -25
  67. package/elements/lib/button/button.component.d.ts +23 -23
  68. package/elements/lib/checkbox/checkbox.component.d.ts +27 -27
  69. package/elements/lib/date-picker/date-picker.component.d.ts +69 -69
  70. package/elements/lib/directives/addon.directive.d.ts +9 -9
  71. package/elements/lib/directives/autosize.directive.d.ts +18 -18
  72. package/elements/lib/directives/focus-trap.directive.d.ts +17 -17
  73. package/elements/lib/directives/focus.directive.d.ts +14 -14
  74. package/elements/lib/directives/form-submit.directive.d.ts +17 -17
  75. package/elements/lib/directives/input.directive.d.ts +38 -38
  76. package/elements/lib/directives/template.directive.d.ts +10 -10
  77. package/elements/lib/dropdown/dropdown.component.d.ts +21 -21
  78. package/elements/lib/elements.interfaces.d.ts +25 -25
  79. package/elements/lib/elements.module.d.ts +116 -116
  80. package/elements/lib/file-picker/file-picker.component.d.ts +49 -49
  81. package/elements/lib/form-control/form-control.component.d.ts +21 -21
  82. package/elements/lib/form-error/form-error.component.d.ts +29 -29
  83. package/elements/lib/form-group/form-group.component.d.ts +10 -10
  84. package/elements/lib/icon/icon.component.d.ts +22 -22
  85. package/elements/lib/image-picker/image-picker.component.d.ts +38 -38
  86. package/elements/lib/pipes/file-image.pipe.d.ts +13 -13
  87. package/elements/lib/pipes/file-size.pipe.d.ts +8 -8
  88. package/elements/lib/pipes/relative-time.pipe.d.ts +19 -19
  89. package/elements/lib/spinner/spinner.component.d.ts +12 -12
  90. package/elements/lib/tag/tag.component.d.ts +7 -7
  91. package/elements/public_api.d.ts +25 -25
  92. package/esm2020/auth/bravobit-bb-foundation-auth.mjs +4 -4
  93. package/esm2020/auth/lib/auth.interceptor.mjs +93 -93
  94. package/esm2020/auth/lib/auth.module.mjs +54 -54
  95. package/esm2020/auth/lib/auth.service.mjs +281 -281
  96. package/esm2020/auth/lib/auth.session.mjs +131 -131
  97. package/esm2020/auth/lib/directives/authenticated.directive.mjs +31 -31
  98. package/esm2020/auth/lib/directives/permission.directive.mjs +80 -80
  99. package/esm2020/auth/lib/directives/role.directive.mjs +37 -37
  100. package/esm2020/auth/lib/guards/anonymous.guard.mjs +34 -34
  101. package/esm2020/auth/lib/guards/authenticated.guard.mjs +35 -35
  102. package/esm2020/auth/lib/helpers/jwt.helper.mjs +69 -69
  103. package/esm2020/auth/lib/helpers/mapper.helper.mjs +35 -35
  104. package/esm2020/auth/lib/interfaces/config.interface.mjs +3 -3
  105. package/esm2020/auth/lib/interfaces/mapper.interface.mjs +2 -2
  106. package/esm2020/auth/lib/interfaces/provider.interface.mjs +2 -2
  107. package/esm2020/auth/lib/interfaces/token.interface.mjs +2 -2
  108. package/esm2020/auth/lib/permissions.service.mjs +56 -56
  109. package/esm2020/auth/lib/providers/email.provider.mjs +25 -25
  110. package/esm2020/auth/lib/providers/verify.provider.mjs +19 -19
  111. package/esm2020/auth/lib/tokens/use-authorization.token.mjs +3 -3
  112. package/esm2020/auth/public_api.mjs +19 -19
  113. package/esm2020/bravobit-bb-foundation.mjs +4 -4
  114. package/esm2020/collections/bravobit-bb-foundation-collections.mjs +4 -4
  115. package/esm2020/collections/lib/collection.mjs +100 -102
  116. package/esm2020/collections/lib/collections.module.mjs +54 -54
  117. package/esm2020/collections/lib/components/collections-pager/collections-pager.component.mjs +123 -123
  118. package/esm2020/collections/lib/components/collections-viewer/collections-viewer.component.mjs +31 -31
  119. package/esm2020/collections/lib/components/collections.directive.mjs +43 -43
  120. package/esm2020/collections/lib/interfaces/collection.interface.mjs +2 -2
  121. package/esm2020/collections/lib/providers/api-collection.provider.mjs +91 -71
  122. package/esm2020/collections/lib/providers/collection.provider.mjs +13 -13
  123. package/esm2020/collections/lib/providers/local-collection.provider.mjs +16 -16
  124. package/esm2020/collections/public_api.mjs +10 -10
  125. package/esm2020/controls/bravobit-bb-foundation-controls.mjs +4 -4
  126. package/esm2020/controls/lib/checkbox/checkbox/checkbox.component.mjs +153 -153
  127. package/esm2020/controls/lib/checkbox/checkbox-group/checkbox-group.component.mjs +61 -61
  128. package/esm2020/controls/lib/checkbox/checkbox.module.mjs +19 -19
  129. package/esm2020/controls/lib/controls.module.mjs +16 -16
  130. package/esm2020/controls/public_api.mjs +5 -5
  131. package/esm2020/dashboard/bravobit-bb-foundation-dashboard.mjs +4 -4
  132. package/esm2020/dashboard/lib/dashboard/dashboard.component.mjs +56 -56
  133. package/esm2020/dashboard/lib/dashboard-header/dashboard-header.component.mjs +30 -30
  134. package/esm2020/dashboard/lib/dashboard-menu/dashboard-menu.component.mjs +31 -31
  135. package/esm2020/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.mjs +29 -29
  136. package/esm2020/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.mjs +75 -75
  137. package/esm2020/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.mjs +99 -99
  138. package/esm2020/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.mjs +62 -62
  139. package/esm2020/dashboard/lib/dashboard.module.mjs +47 -47
  140. package/esm2020/dashboard/public_api.mjs +9 -9
  141. package/esm2020/dialog/bravobit-bb-foundation-dialog.mjs +4 -4
  142. package/esm2020/dialog/lib/dialog-actions/dialog-actions.component.mjs +12 -12
  143. package/esm2020/dialog/lib/dialog-confirm/dialog-confirm.component.mjs +37 -37
  144. package/esm2020/dialog/lib/dialog-container/dialog-container.component.mjs +153 -153
  145. package/esm2020/dialog/lib/dialog-header/dialog-header.component.mjs +25 -25
  146. package/esm2020/dialog/lib/dialog-link/dialog-link.component.mjs +11 -11
  147. package/esm2020/dialog/lib/dialog-modal/dialog-modal.component.mjs +46 -46
  148. package/esm2020/dialog/lib/dialog-overlay/dialog-overlay.component.mjs +134 -134
  149. package/esm2020/dialog/lib/dialog.injector.mjs +18 -18
  150. package/esm2020/dialog/lib/dialog.insertion.mjs +16 -16
  151. package/esm2020/dialog/lib/dialog.interfaces.mjs +3 -3
  152. package/esm2020/dialog/lib/dialog.module.mjs +68 -68
  153. package/esm2020/dialog/lib/dialog.ref.mjs +22 -22
  154. package/esm2020/dialog/lib/dialog.service.mjs +77 -77
  155. package/esm2020/dialog/public_api.mjs +10 -10
  156. package/esm2020/elements/bravobit-bb-foundation-elements.mjs +4 -4
  157. package/esm2020/elements/lib/avatar/avatar.component.mjs +145 -145
  158. package/esm2020/elements/lib/button/button.component.mjs +61 -61
  159. package/esm2020/elements/lib/checkbox/checkbox.component.mjs +73 -73
  160. package/esm2020/elements/lib/date-picker/date-picker.component.mjs +304 -304
  161. package/esm2020/elements/lib/directives/addon.directive.mjs +29 -29
  162. package/esm2020/elements/lib/directives/autosize.directive.mjs +72 -72
  163. package/esm2020/elements/lib/directives/focus-trap.directive.mjs +77 -77
  164. package/esm2020/elements/lib/directives/focus.directive.mjs +39 -39
  165. package/esm2020/elements/lib/directives/form-submit.directive.mjs +50 -50
  166. package/esm2020/elements/lib/directives/input.directive.mjs +136 -136
  167. package/esm2020/elements/lib/directives/template.directive.mjs +28 -28
  168. package/esm2020/elements/lib/dropdown/dropdown.component.mjs +100 -100
  169. package/esm2020/elements/lib/elements.interfaces.mjs +4 -4
  170. package/esm2020/elements/lib/elements.module.mjs +177 -177
  171. package/esm2020/elements/lib/file-picker/file-picker.component.mjs +236 -236
  172. package/esm2020/elements/lib/form-control/form-control.component.mjs +49 -49
  173. package/esm2020/elements/lib/form-error/form-error.component.mjs +108 -108
  174. package/esm2020/elements/lib/form-group/form-group.component.mjs +18 -18
  175. package/esm2020/elements/lib/icon/icon.component.mjs +102 -102
  176. package/esm2020/elements/lib/image-picker/image-picker.component.mjs +106 -106
  177. package/esm2020/elements/lib/pipes/file-image.pipe.mjs +42 -42
  178. package/esm2020/elements/lib/pipes/file-size.pipe.mjs +28 -28
  179. package/esm2020/elements/lib/pipes/relative-time.pipe.mjs +94 -94
  180. package/esm2020/elements/lib/spinner/spinner.component.mjs +25 -25
  181. package/esm2020/elements/lib/tag/tag.component.mjs +18 -18
  182. package/esm2020/elements/public_api.mjs +26 -26
  183. package/esm2020/http/bravobit-bb-foundation-http.mjs +4 -4
  184. package/esm2020/http/lib/classes/http.config.mjs +29 -29
  185. package/esm2020/http/lib/classes/http.error.mjs +20 -20
  186. package/esm2020/http/lib/http.interfaces.mjs +2 -2
  187. package/esm2020/http/lib/http.module.mjs +43 -43
  188. package/esm2020/http/lib/interceptors/base-url.interceptor.mjs +50 -50
  189. package/esm2020/http/lib/interceptors/error.interceptor.mjs +32 -32
  190. package/esm2020/http/public_api.mjs +7 -7
  191. package/esm2020/lib/core/miscellaneous/regex.mjs +5 -5
  192. package/esm2020/lib/core/miscellaneous/validator.mjs +85 -85
  193. package/esm2020/lib/core/mixins/can-disable.mjs +16 -16
  194. package/esm2020/lib/core/mixins/can-hide-errors.mjs +16 -16
  195. package/esm2020/lib/core/mixins/can-load.mjs +16 -16
  196. package/esm2020/lib/core/mixins/constructor.mjs +2 -2
  197. package/esm2020/lib/core/mixins/has-error.mjs +16 -16
  198. package/esm2020/lib/core/mixins/is-focused.mjs +16 -16
  199. package/esm2020/lib/core/mixins/is-grouped.mjs +16 -16
  200. package/esm2020/lib/core/mixins/is-readonly.mjs +16 -16
  201. package/esm2020/lib/core/mixins/is-required.mjs +16 -16
  202. package/esm2020/lib/core/services/clipboard.service.mjs +70 -70
  203. package/esm2020/lib/core/services/exif.service.mjs +163 -163
  204. package/esm2020/lib/core/services/file-loader.service.mjs +87 -87
  205. package/esm2020/lib/core/services/image-converter.service.mjs +123 -123
  206. package/esm2020/lib/core/services/languages.service.mjs +74 -74
  207. package/esm2020/lib/core/services/network.service.mjs +55 -55
  208. package/esm2020/lib/core/services/patch.service.mjs +63 -63
  209. package/esm2020/lib/core/services/platform.service.mjs +42 -42
  210. package/esm2020/lib/core/tokens/accept-language.token.mjs +3 -3
  211. package/esm2020/lib/core/tokens/base-url.token.mjs +3 -3
  212. package/esm2020/lib/core/tokens/cookie.token.mjs +3 -3
  213. package/esm2020/lib/core/tokens/location.token.mjs +6 -6
  214. package/esm2020/lib/core/tokens/navigator.token.mjs +6 -6
  215. package/esm2020/lib/core/tokens/window.token.mjs +12 -12
  216. package/esm2020/localize/bravobit-bb-foundation-localize.mjs +4 -4
  217. package/esm2020/localize/lib/functions/date.function.mjs +18 -18
  218. package/esm2020/localize/lib/functions/lowercase.function.mjs +13 -13
  219. package/esm2020/localize/lib/functions/uppercase.function.mjs +13 -13
  220. package/esm2020/localize/lib/handlers/missing.handler.mjs +15 -15
  221. package/esm2020/localize/lib/interfaces/config.interfaces.mjs +7 -7
  222. package/esm2020/localize/lib/interfaces/functions.interfaces.mjs +8 -8
  223. package/esm2020/localize/lib/interfaces/handlers.interfaces.mjs +2 -2
  224. package/esm2020/localize/lib/interfaces/options.interfaces.mjs +6 -6
  225. package/esm2020/localize/lib/localizations/dutch.localization.mjs +45 -45
  226. package/esm2020/localize/lib/localizations/english.localization.mjs +45 -45
  227. package/esm2020/localize/lib/localize.dictionary.mjs +26 -26
  228. package/esm2020/localize/lib/localize.module.mjs +71 -71
  229. package/esm2020/localize/lib/localize.pipe.mjs +49 -49
  230. package/esm2020/localize/lib/localize.service.mjs +207 -207
  231. package/esm2020/localize/lib/views/localize-string/localize-string.component.mjs +88 -88
  232. package/esm2020/localize/lib/views/localize-template-or-string.directive.mjs +28 -28
  233. package/esm2020/localize/lib/views/localize-template.directive.mjs +21 -21
  234. package/esm2020/localize/public_api.mjs +17 -17
  235. package/esm2020/masking/bravobit-bb-foundation-masking.mjs +4 -4
  236. package/esm2020/masking/lib/directives/currency-mask.directive.mjs +35 -0
  237. package/esm2020/masking/lib/directives/date-mask.directive.mjs +35 -0
  238. package/esm2020/masking/lib/directives/input-mask.directive.mjs +118 -0
  239. package/esm2020/masking/lib/input-mask.interface.mjs +2 -2
  240. package/esm2020/masking/lib/masking.module.mjs +30 -16
  241. package/esm2020/masking/lib/masking.service.mjs +103 -94
  242. package/esm2020/masking/public_api.mjs +7 -5
  243. package/esm2020/notifications/bravobit-bb-foundation-notifications.mjs +4 -4
  244. package/esm2020/notifications/lib/notifications-item/notifications-item.component.mjs +100 -100
  245. package/esm2020/notifications/lib/notifications-list/notifications-list.component.mjs +47 -47
  246. package/esm2020/notifications/lib/notifications.animations.mjs +28 -28
  247. package/esm2020/notifications/lib/notifications.injector.mjs +18 -18
  248. package/esm2020/notifications/lib/notifications.interfaces.mjs +20 -20
  249. package/esm2020/notifications/lib/notifications.module.mjs +30 -30
  250. package/esm2020/notifications/lib/notifications.service.mjs +145 -145
  251. package/esm2020/notifications/public_api.mjs +4 -4
  252. package/esm2020/public_api.mjs +29 -29
  253. package/esm2020/recaptcha/bravobit-bb-foundation-recaptcha.mjs +4 -4
  254. package/esm2020/recaptcha/lib/recaptcha/recaptcha.component.mjs +185 -185
  255. package/esm2020/recaptcha/lib/recaptcha-loader.service.mjs +90 -90
  256. package/esm2020/recaptcha/lib/recaptcha.interface.mjs +3 -3
  257. package/esm2020/recaptcha/lib/recaptcha.module.mjs +27 -27
  258. package/esm2020/recaptcha/public_api.mjs +5 -5
  259. package/esm2020/rxjs/bravobit-bb-foundation-rxjs.mjs +4 -4
  260. package/esm2020/rxjs/lib/observables/get-control-value.observable.mjs +6 -0
  261. package/esm2020/rxjs/lib/operators/combine-latest-map.operator.mjs +10 -10
  262. package/esm2020/rxjs/lib/operators/filter-nil.operator.mjs +5 -5
  263. package/esm2020/rxjs/public_api.mjs +4 -3
  264. package/esm2020/storage/bravobit-bb-foundation-storage.mjs +4 -4
  265. package/esm2020/storage/lib/interfaces/attributes.interface.mjs +2 -2
  266. package/esm2020/storage/lib/interfaces/memory.interface.mjs +2 -2
  267. package/esm2020/storage/lib/interfaces/strategy.interface.mjs +2 -2
  268. package/esm2020/storage/lib/storage.service.mjs +109 -109
  269. package/esm2020/storage/lib/strategies/cookie-storage.strategy.mjs +142 -142
  270. package/esm2020/storage/lib/strategies/memory-storage.strategy.mjs +56 -56
  271. package/esm2020/storage/lib/strategies/polyfill-storage.strategy.mjs +102 -102
  272. package/esm2020/storage/public_api.mjs +8 -8
  273. package/esm2020/table/bravobit-bb-foundation-table.mjs +4 -4
  274. package/esm2020/table/lib/components/table/table.component.mjs +191 -191
  275. package/esm2020/table/lib/components/table-cell/table-cell.component.mjs +11 -11
  276. package/esm2020/table/lib/components/table-header-cell/table-header-cell.component.mjs +131 -131
  277. package/esm2020/table/lib/components/table-pager/table-pager.component.mjs +136 -136
  278. package/esm2020/table/lib/data/datasource.data.mjs +32 -32
  279. package/esm2020/table/lib/data/generic.data.mjs +72 -72
  280. package/esm2020/table/lib/interfaces/datasource.interface.mjs +2 -2
  281. package/esm2020/table/lib/interfaces/table.interfaces.mjs +2 -2
  282. package/esm2020/table/lib/table.module.mjs +42 -42
  283. package/esm2020/table/public_api.mjs +10 -10
  284. package/esm2020/theming/bravobit-bb-foundation-theming.mjs +4 -4
  285. package/esm2020/theming/lib/themes/checkbox-group.theme.mjs +2 -2
  286. package/esm2020/theming/lib/themes/checkbox.theme.mjs +2 -2
  287. package/esm2020/theming/lib/themes/theme.mjs +34 -0
  288. package/esm2020/theming/lib/theming.interface.mjs +3 -3
  289. package/esm2020/theming/lib/theming.module.mjs +38 -38
  290. package/esm2020/theming/lib/theming.service.mjs +77 -100
  291. package/esm2020/theming/public_api.mjs +7 -4
  292. package/fesm2015/bravobit-bb-foundation-auth.mjs +930 -930
  293. package/fesm2015/bravobit-bb-foundation-auth.mjs.map +1 -1
  294. package/fesm2015/bravobit-bb-foundation-collections.mjs +443 -424
  295. package/fesm2015/bravobit-bb-foundation-collections.mjs.map +1 -1
  296. package/fesm2015/bravobit-bb-foundation-controls.mjs +229 -229
  297. package/fesm2015/bravobit-bb-foundation-controls.mjs.map +1 -1
  298. package/fesm2015/bravobit-bb-foundation-dashboard.mjs +382 -382
  299. package/fesm2015/bravobit-bb-foundation-dashboard.mjs.map +1 -1
  300. package/fesm2015/bravobit-bb-foundation-dialog.mjs +540 -540
  301. package/fesm2015/bravobit-bb-foundation-dialog.mjs.map +1 -1
  302. package/fesm2015/bravobit-bb-foundation-elements.mjs +1970 -1970
  303. package/fesm2015/bravobit-bb-foundation-elements.mjs.map +1 -1
  304. package/fesm2015/bravobit-bb-foundation-http.mjs +156 -156
  305. package/fesm2015/bravobit-bb-foundation-http.mjs.map +1 -1
  306. package/fesm2015/bravobit-bb-foundation-localize.mjs +608 -608
  307. package/fesm2015/bravobit-bb-foundation-localize.mjs.map +1 -1
  308. package/fesm2015/bravobit-bb-foundation-masking.mjs +313 -215
  309. package/fesm2015/bravobit-bb-foundation-masking.mjs.map +1 -1
  310. package/fesm2015/bravobit-bb-foundation-notifications.mjs +348 -348
  311. package/fesm2015/bravobit-bb-foundation-notifications.mjs.map +1 -1
  312. package/fesm2015/bravobit-bb-foundation-recaptcha.mjs +290 -290
  313. package/fesm2015/bravobit-bb-foundation-recaptcha.mjs.map +1 -1
  314. package/fesm2015/bravobit-bb-foundation-rxjs.mjs +14 -10
  315. package/fesm2015/bravobit-bb-foundation-rxjs.mjs.map +1 -1
  316. package/fesm2015/bravobit-bb-foundation-storage.mjs +401 -401
  317. package/fesm2015/bravobit-bb-foundation-storage.mjs.map +1 -1
  318. package/fesm2015/bravobit-bb-foundation-table.mjs +571 -571
  319. package/fesm2015/bravobit-bb-foundation-table.mjs.map +1 -1
  320. package/fesm2015/bravobit-bb-foundation-theming.mjs +151 -140
  321. package/fesm2015/bravobit-bb-foundation-theming.mjs.map +1 -1
  322. package/fesm2015/bravobit-bb-foundation.mjs +859 -859
  323. package/fesm2015/bravobit-bb-foundation.mjs.map +1 -1
  324. package/fesm2020/bravobit-bb-foundation-auth.mjs +882 -882
  325. package/fesm2020/bravobit-bb-foundation-auth.mjs.map +1 -1
  326. package/fesm2020/bravobit-bb-foundation-collections.mjs +432 -414
  327. package/fesm2020/bravobit-bb-foundation-collections.mjs.map +1 -1
  328. package/fesm2020/bravobit-bb-foundation-controls.mjs +227 -227
  329. package/fesm2020/bravobit-bb-foundation-controls.mjs.map +1 -1
  330. package/fesm2020/bravobit-bb-foundation-dashboard.mjs +370 -370
  331. package/fesm2020/bravobit-bb-foundation-dashboard.mjs.map +1 -1
  332. package/fesm2020/bravobit-bb-foundation-dialog.mjs +539 -539
  333. package/fesm2020/bravobit-bb-foundation-dialog.mjs.map +1 -1
  334. package/fesm2020/bravobit-bb-foundation-elements.mjs +1927 -1927
  335. package/fesm2020/bravobit-bb-foundation-elements.mjs.map +1 -1
  336. package/fesm2020/bravobit-bb-foundation-http.mjs +148 -148
  337. package/fesm2020/bravobit-bb-foundation-http.mjs.map +1 -1
  338. package/fesm2020/bravobit-bb-foundation-localize.mjs +587 -587
  339. package/fesm2020/bravobit-bb-foundation-localize.mjs.map +1 -1
  340. package/fesm2020/bravobit-bb-foundation-masking.mjs +295 -204
  341. package/fesm2020/bravobit-bb-foundation-masking.mjs.map +1 -1
  342. package/fesm2020/bravobit-bb-foundation-notifications.mjs +346 -346
  343. package/fesm2020/bravobit-bb-foundation-notifications.mjs.map +1 -1
  344. package/fesm2020/bravobit-bb-foundation-recaptcha.mjs +280 -280
  345. package/fesm2020/bravobit-bb-foundation-recaptcha.mjs.map +1 -1
  346. package/fesm2020/bravobit-bb-foundation-rxjs.mjs +17 -13
  347. package/fesm2020/bravobit-bb-foundation-rxjs.mjs.map +1 -1
  348. package/fesm2020/bravobit-bb-foundation-storage.mjs +396 -396
  349. package/fesm2020/bravobit-bb-foundation-storage.mjs.map +1 -1
  350. package/fesm2020/bravobit-bb-foundation-table.mjs +560 -560
  351. package/fesm2020/bravobit-bb-foundation-table.mjs.map +1 -1
  352. package/fesm2020/bravobit-bb-foundation-theming.mjs +141 -130
  353. package/fesm2020/bravobit-bb-foundation-theming.mjs.map +1 -1
  354. package/fesm2020/bravobit-bb-foundation.mjs +831 -831
  355. package/fesm2020/bravobit-bb-foundation.mjs.map +1 -1
  356. package/http/index.d.ts +5 -5
  357. package/http/lib/classes/http.config.d.ts +9 -9
  358. package/http/lib/classes/http.error.d.ts +7 -7
  359. package/http/lib/http.interfaces.d.ts +12 -12
  360. package/http/lib/http.module.d.ts +15 -15
  361. package/http/lib/interceptors/base-url.interceptor.d.ts +15 -15
  362. package/http/lib/interceptors/error.interceptor.d.ts +11 -11
  363. package/http/public_api.d.ts +6 -6
  364. package/index.d.ts +5 -5
  365. package/lib/core/miscellaneous/regex.d.ts +4 -4
  366. package/lib/core/miscellaneous/validator.d.ts +13 -13
  367. package/lib/core/mixins/can-disable.d.ts +6 -6
  368. package/lib/core/mixins/can-hide-errors.d.ts +6 -6
  369. package/lib/core/mixins/can-load.d.ts +6 -6
  370. package/lib/core/mixins/constructor.d.ts +1 -1
  371. package/lib/core/mixins/has-error.d.ts +6 -6
  372. package/lib/core/mixins/is-focused.d.ts +6 -6
  373. package/lib/core/mixins/is-grouped.d.ts +6 -6
  374. package/lib/core/mixins/is-readonly.d.ts +6 -6
  375. package/lib/core/mixins/is-required.d.ts +6 -6
  376. package/lib/core/services/clipboard.service.d.ts +18 -18
  377. package/lib/core/services/exif.service.d.ts +15 -15
  378. package/lib/core/services/file-loader.service.d.ts +13 -13
  379. package/lib/core/services/image-converter.service.d.ts +21 -21
  380. package/lib/core/services/languages.service.d.ts +16 -16
  381. package/lib/core/services/network.service.d.ts +14 -14
  382. package/lib/core/services/patch.service.d.ts +16 -16
  383. package/lib/core/services/platform.service.d.ts +18 -18
  384. package/lib/core/tokens/accept-language.token.d.ts +2 -2
  385. package/lib/core/tokens/base-url.token.d.ts +2 -2
  386. package/lib/core/tokens/cookie.token.d.ts +2 -2
  387. package/lib/core/tokens/location.token.d.ts +2 -2
  388. package/lib/core/tokens/navigator.token.d.ts +2 -2
  389. package/lib/core/tokens/window.token.d.ts +2 -2
  390. package/localize/index.d.ts +5 -5
  391. package/localize/lib/functions/date.function.d.ts +5 -5
  392. package/localize/lib/functions/lowercase.function.d.ts +5 -5
  393. package/localize/lib/functions/uppercase.function.d.ts +5 -5
  394. package/localize/lib/handlers/missing.handler.d.ts +6 -6
  395. package/localize/lib/interfaces/config.interfaces.d.ts +18 -18
  396. package/localize/lib/interfaces/functions.interfaces.d.ts +9 -9
  397. package/localize/lib/interfaces/handlers.interfaces.d.ts +6 -6
  398. package/localize/lib/interfaces/options.interfaces.d.ts +10 -10
  399. package/localize/lib/localizations/dutch.localization.d.ts +44 -44
  400. package/localize/lib/localizations/english.localization.d.ts +44 -44
  401. package/localize/lib/localize.dictionary.d.ts +7 -7
  402. package/localize/lib/localize.module.d.ts +17 -17
  403. package/localize/lib/localize.pipe.d.ts +12 -12
  404. package/localize/lib/localize.service.d.ts +40 -40
  405. package/localize/lib/views/localize-string/localize-string.component.d.ts +23 -23
  406. package/localize/lib/views/localize-template-or-string.directive.d.ts +10 -10
  407. package/localize/lib/views/localize-template.directive.d.ts +9 -9
  408. package/localize/public_api.d.ts +16 -16
  409. package/masking/index.d.ts +5 -5
  410. package/masking/lib/directives/currency-mask.directive.d.ts +17 -0
  411. package/masking/lib/directives/date-mask.directive.d.ts +17 -0
  412. package/masking/lib/{input-mask.directive.d.ts → directives/input-mask.directive.d.ts} +38 -36
  413. package/masking/lib/input-mask.interface.d.ts +19 -20
  414. package/masking/lib/masking.module.d.ts +9 -7
  415. package/masking/lib/masking.service.d.ts +12 -12
  416. package/masking/public_api.d.ts +6 -4
  417. package/notifications/index.d.ts +5 -5
  418. package/notifications/lib/notifications-item/notifications-item.component.d.ts +34 -34
  419. package/notifications/lib/notifications-list/notifications-list.component.d.ts +16 -16
  420. package/notifications/lib/notifications.animations.d.ts +1 -1
  421. package/notifications/lib/notifications.injector.d.ts +8 -8
  422. package/notifications/lib/notifications.interfaces.d.ts +49 -49
  423. package/notifications/lib/notifications.module.d.ts +13 -13
  424. package/notifications/lib/notifications.service.d.ts +34 -34
  425. package/notifications/public_api.d.ts +3 -3
  426. package/package.json +1 -1
  427. package/public_api.d.ts +25 -25
  428. package/recaptcha/index.d.ts +5 -5
  429. package/recaptcha/lib/recaptcha/recaptcha.component.d.ts +47 -47
  430. package/recaptcha/lib/recaptcha-loader.service.d.ts +22 -22
  431. package/recaptcha/lib/recaptcha.interface.d.ts +14 -14
  432. package/recaptcha/lib/recaptcha.module.d.ts +10 -10
  433. package/recaptcha/public_api.d.ts +4 -4
  434. package/rxjs/index.d.ts +5 -5
  435. package/rxjs/lib/observables/get-control-value.observable.d.ts +3 -0
  436. package/rxjs/lib/operators/combine-latest-map.operator.d.ts +8 -8
  437. package/rxjs/lib/operators/filter-nil.operator.d.ts +1 -1
  438. package/rxjs/public_api.d.ts +3 -2
  439. package/storage/index.d.ts +5 -5
  440. package/storage/lib/interfaces/attributes.interface.d.ts +13 -13
  441. package/storage/lib/interfaces/memory.interface.d.ts +7 -7
  442. package/storage/lib/interfaces/strategy.interface.d.ts +17 -17
  443. package/storage/lib/storage.service.d.ts +26 -26
  444. package/storage/lib/strategies/cookie-storage.strategy.d.ts +20 -20
  445. package/storage/lib/strategies/memory-storage.strategy.d.ts +11 -11
  446. package/storage/lib/strategies/polyfill-storage.strategy.d.ts +15 -15
  447. package/storage/public_api.d.ts +7 -7
  448. package/table/index.d.ts +5 -5
  449. package/table/lib/components/table/table.component.d.ts +56 -56
  450. package/table/lib/components/table-cell/table-cell.component.d.ts +5 -5
  451. package/table/lib/components/table-header-cell/table-header-cell.component.d.ts +29 -29
  452. package/table/lib/components/table-pager/table-pager.component.d.ts +41 -41
  453. package/table/lib/data/datasource.data.d.ts +14 -14
  454. package/table/lib/data/generic.data.d.ts +23 -23
  455. package/table/lib/interfaces/datasource.interface.d.ts +17 -17
  456. package/table/lib/interfaces/table.interfaces.d.ts +1 -1
  457. package/table/lib/table.module.d.ts +14 -14
  458. package/table/public_api.d.ts +9 -9
  459. package/theming/index.d.ts +5 -5
  460. package/theming/lib/themes/checkbox-group.theme.d.ts +5 -5
  461. package/theming/lib/themes/checkbox.theme.d.ts +19 -19
  462. package/theming/lib/themes/theme.d.ts +12 -0
  463. package/theming/lib/theming.interface.d.ts +15 -14
  464. package/theming/lib/theming.module.d.ts +13 -13
  465. package/theming/lib/theming.service.d.ts +22 -24
  466. package/theming/public_api.d.ts +6 -3
  467. package/esm2020/masking/lib/input-mask.directive.mjs +0 -110
@@ -14,1983 +14,1983 @@ import { LocalizeModule } from '@bravobit/bb-foundation/localize';
14
14
  import * as i2$1 from '@angular/platform-browser';
15
15
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
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
- if (!target) {
31
- return;
32
- }
33
- if (this._elementRef?.nativeElement?.contains(target)) {
34
- return;
35
- }
36
- return this.close();
37
- }
38
- }
39
- BbDropdown.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbDropdown, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
40
- BbDropdown.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.3", type: BbDropdown, selector: "bb-dropdown", host: { listeners: { "document:click": "onDocumentClick($event.target)" }, classAttribute: "bb-dropdown" }, ngImport: i0, template: "<button (click)=\"toggle()\"\r\n [class.opened]=\"visible$ | async\"\r\n type=\"button\">\r\n <ng-content></ng-content>\r\n</button>\r\n\r\n<div *ngIf=\"visible$ | async\"\r\n [@dropdownMenuAnimation]=\"true\"\r\n class=\"bb-dropdown-menu\"\r\n role=\"list\">\r\n <ng-content select=\"[bbDropdownItem], hr\"></ng-content>\r\n</div>\r\n", styles: [".bb-dropdown{position:relative;display:inline-block}.bb-dropdown.right>.bb-dropdown-menu{right:0;left:auto;transform-origin:top right}.bb-dropdown-menu{left:0;top:100%;padding:0;z-index:10;display:block;margin:10px 0 0;border-radius:4px;position:absolute;list-style-type:none;background-color:#fff;border:1px solid #cccccc;transform-origin:top left;box-shadow:0 0 6px #0000001a}.bb-dropdown-menu:after{width:0;top:-5px;height:0;right:5px;content:\"\";position:absolute;border-style:solid;border-width:0 10px 5px 10px;border-color:transparent transparent #d9d9d9 transparent}.bb-dropdown-menu>hr{margin:0;height:1px;border:none;background-color:#ccc}.bb-dropdown-item{width:100%;border:none;line-height:1;display:block;cursor:pointer;text-align:left;font-weight:500;-webkit-user-select:none;user-select:none;padding:12px 20px;white-space:nowrap;text-decoration:none;color:#676767!important;background-color:transparent;transition:background-color .25s cubic-bezier(0,0,.2,1)}.bb-dropdown-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.bb-dropdown-item:hover{background-color:#f6f6f6}.bb-dropdown-item:focus{box-shadow:0 0 0 3px #dce0e980}.bb-dropdown-item:active{background-color:#f0f0f0}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], animations: [
41
- trigger('dropdownMenuAnimation', [
42
- transition(':enter', [
43
- // 1. Set the initial state.
44
- style({ opacity: 0, transform: 'scale(0.9)' }),
45
- // 2. Start the animation to show the item.
46
- animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 1, transform: 'scale(1)' }))
47
- ]),
48
- transition(':leave', [
49
- // 1. Set the initial state.
50
- style({ opacity: 1, transform: 'scale(1)' }),
51
- // 2. Start the animation to hide the item.
52
- animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 0, transform: 'scale(0.9)' }))
53
- ])
54
- ])
55
- ], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
56
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbDropdown, decorators: [{
57
- type: Component,
58
- args: [{ selector: 'bb-dropdown', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { 'class': 'bb-dropdown' }, preserveWhitespaces: false, animations: [
59
- trigger('dropdownMenuAnimation', [
60
- transition(':enter', [
61
- // 1. Set the initial state.
62
- style({ opacity: 0, transform: 'scale(0.9)' }),
63
- // 2. Start the animation to show the item.
64
- animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 1, transform: 'scale(1)' }))
65
- ]),
66
- transition(':leave', [
67
- // 1. Set the initial state.
68
- style({ opacity: 1, transform: 'scale(1)' }),
69
- // 2. Start the animation to hide the item.
70
- animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 0, transform: 'scale(0.9)' }))
71
- ])
72
- ])
73
- ], template: "<button (click)=\"toggle()\"\r\n [class.opened]=\"visible$ | async\"\r\n type=\"button\">\r\n <ng-content></ng-content>\r\n</button>\r\n\r\n<div *ngIf=\"visible$ | async\"\r\n [@dropdownMenuAnimation]=\"true\"\r\n class=\"bb-dropdown-menu\"\r\n role=\"list\">\r\n <ng-content select=\"[bbDropdownItem], hr\"></ng-content>\r\n</div>\r\n", styles: [".bb-dropdown{position:relative;display:inline-block}.bb-dropdown.right>.bb-dropdown-menu{right:0;left:auto;transform-origin:top right}.bb-dropdown-menu{left:0;top:100%;padding:0;z-index:10;display:block;margin:10px 0 0;border-radius:4px;position:absolute;list-style-type:none;background-color:#fff;border:1px solid #cccccc;transform-origin:top left;box-shadow:0 0 6px #0000001a}.bb-dropdown-menu:after{width:0;top:-5px;height:0;right:5px;content:\"\";position:absolute;border-style:solid;border-width:0 10px 5px 10px;border-color:transparent transparent #d9d9d9 transparent}.bb-dropdown-menu>hr{margin:0;height:1px;border:none;background-color:#ccc}.bb-dropdown-item{width:100%;border:none;line-height:1;display:block;cursor:pointer;text-align:left;font-weight:500;-webkit-user-select:none;user-select:none;padding:12px 20px;white-space:nowrap;text-decoration:none;color:#676767!important;background-color:transparent;transition:background-color .25s cubic-bezier(0,0,.2,1)}.bb-dropdown-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.bb-dropdown-item:hover{background-color:#f6f6f6}.bb-dropdown-item:focus{box-shadow:0 0 0 3px #dce0e980}.bb-dropdown-item:active{background-color:#f0f0f0}\n"] }]
74
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { onDocumentClick: [{
75
- type: HostListener,
76
- args: ['document:click', ['$event.target']]
77
- }] } });
78
- class BbDropdownItem {
79
- constructor(_parent) {
80
- this._parent = _parent;
81
- // Inputs.
82
- this.closeOnClick = true;
83
- }
84
- onClick() {
85
- if (!this.closeOnClick) {
86
- return;
87
- }
88
- this._parent?.close();
89
- }
90
- }
91
- BbDropdownItem.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbDropdownItem, deps: [{ token: BbDropdown, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
92
- BbDropdownItem.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.3", type: BbDropdownItem, selector: "[bbDropdownItem]", inputs: { closeOnClick: "closeOnClick" }, host: { listeners: { "click": "onClick()" }, classAttribute: "bb-dropdown-item" }, ngImport: i0 });
93
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbDropdownItem, decorators: [{
94
- type: Directive,
95
- args: [{
96
- selector: '[bbDropdownItem]',
97
- host: {
98
- 'class': 'bb-dropdown-item'
99
- }
100
- }]
101
- }], ctorParameters: function () { return [{ type: BbDropdown, decorators: [{
102
- type: Optional
103
- }, {
104
- type: Host
105
- }] }]; }, propDecorators: { closeOnClick: [{
106
- type: Input
107
- }], onClick: [{
108
- type: HostListener,
109
- 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
+ if (!target) {
31
+ return;
32
+ }
33
+ if (this._elementRef?.nativeElement?.contains(target)) {
34
+ return;
35
+ }
36
+ return this.close();
37
+ }
38
+ }
39
+ BbDropdown.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbDropdown, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
40
+ BbDropdown.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.4", type: BbDropdown, selector: "bb-dropdown", host: { listeners: { "document:click": "onDocumentClick($event.target)" }, classAttribute: "bb-dropdown" }, ngImport: i0, template: "<button (click)=\"toggle()\"\n [class.opened]=\"visible$ | async\"\n type=\"button\">\n <ng-content></ng-content>\n</button>\n\n<div *ngIf=\"visible$ | async\"\n [@dropdownMenuAnimation]=\"true\"\n class=\"bb-dropdown-menu\"\n role=\"list\">\n <ng-content select=\"[bbDropdownItem], hr\"></ng-content>\n</div>\n", styles: [".bb-dropdown{position:relative;display:inline-block}.bb-dropdown.right>.bb-dropdown-menu{right:0;left:auto;transform-origin:top right}.bb-dropdown-menu{left:0;top:100%;padding:0;z-index:10;display:block;margin:10px 0 0;border-radius:4px;position:absolute;list-style-type:none;background-color:#fff;border:1px solid #cccccc;transform-origin:top left;box-shadow:0 0 6px #0000001a}.bb-dropdown-menu:after{width:0;top:-5px;height:0;right:5px;content:\"\";position:absolute;border-style:solid;border-width:0 10px 5px 10px;border-color:transparent transparent #d9d9d9 transparent}.bb-dropdown-menu>hr{margin:0;height:1px;border:none;background-color:#ccc}.bb-dropdown-item{width:100%;border:none;line-height:1;display:block;cursor:pointer;text-align:left;font-weight:500;-webkit-user-select:none;user-select:none;padding:12px 20px;white-space:nowrap;text-decoration:none;color:#676767!important;background-color:transparent;transition:background-color .25s cubic-bezier(0,0,.2,1)}.bb-dropdown-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.bb-dropdown-item:hover{background-color:#f6f6f6}.bb-dropdown-item:focus{box-shadow:0 0 0 3px #dce0e980}.bb-dropdown-item:active{background-color:#f0f0f0}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], animations: [
41
+ trigger('dropdownMenuAnimation', [
42
+ transition(':enter', [
43
+ // 1. Set the initial state.
44
+ style({ opacity: 0, transform: 'scale(0.9)' }),
45
+ // 2. Start the animation to show the item.
46
+ animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 1, transform: 'scale(1)' }))
47
+ ]),
48
+ transition(':leave', [
49
+ // 1. Set the initial state.
50
+ style({ opacity: 1, transform: 'scale(1)' }),
51
+ // 2. Start the animation to hide the item.
52
+ animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 0, transform: 'scale(0.9)' }))
53
+ ])
54
+ ])
55
+ ], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
56
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbDropdown, decorators: [{
57
+ type: Component,
58
+ args: [{ selector: 'bb-dropdown', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { 'class': 'bb-dropdown' }, preserveWhitespaces: false, animations: [
59
+ trigger('dropdownMenuAnimation', [
60
+ transition(':enter', [
61
+ // 1. Set the initial state.
62
+ style({ opacity: 0, transform: 'scale(0.9)' }),
63
+ // 2. Start the animation to show the item.
64
+ animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 1, transform: 'scale(1)' }))
65
+ ]),
66
+ transition(':leave', [
67
+ // 1. Set the initial state.
68
+ style({ opacity: 1, transform: 'scale(1)' }),
69
+ // 2. Start the animation to hide the item.
70
+ animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 0, transform: 'scale(0.9)' }))
71
+ ])
72
+ ])
73
+ ], template: "<button (click)=\"toggle()\"\n [class.opened]=\"visible$ | async\"\n type=\"button\">\n <ng-content></ng-content>\n</button>\n\n<div *ngIf=\"visible$ | async\"\n [@dropdownMenuAnimation]=\"true\"\n class=\"bb-dropdown-menu\"\n role=\"list\">\n <ng-content select=\"[bbDropdownItem], hr\"></ng-content>\n</div>\n", styles: [".bb-dropdown{position:relative;display:inline-block}.bb-dropdown.right>.bb-dropdown-menu{right:0;left:auto;transform-origin:top right}.bb-dropdown-menu{left:0;top:100%;padding:0;z-index:10;display:block;margin:10px 0 0;border-radius:4px;position:absolute;list-style-type:none;background-color:#fff;border:1px solid #cccccc;transform-origin:top left;box-shadow:0 0 6px #0000001a}.bb-dropdown-menu:after{width:0;top:-5px;height:0;right:5px;content:\"\";position:absolute;border-style:solid;border-width:0 10px 5px 10px;border-color:transparent transparent #d9d9d9 transparent}.bb-dropdown-menu>hr{margin:0;height:1px;border:none;background-color:#ccc}.bb-dropdown-item{width:100%;border:none;line-height:1;display:block;cursor:pointer;text-align:left;font-weight:500;-webkit-user-select:none;user-select:none;padding:12px 20px;white-space:nowrap;text-decoration:none;color:#676767!important;background-color:transparent;transition:background-color .25s cubic-bezier(0,0,.2,1)}.bb-dropdown-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.bb-dropdown-item:hover{background-color:#f6f6f6}.bb-dropdown-item:focus{box-shadow:0 0 0 3px #dce0e980}.bb-dropdown-item:active{background-color:#f0f0f0}\n"] }]
74
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { onDocumentClick: [{
75
+ type: HostListener,
76
+ args: ['document:click', ['$event.target']]
77
+ }] } });
78
+ class BbDropdownItem {
79
+ constructor(_parent) {
80
+ this._parent = _parent;
81
+ // Inputs.
82
+ this.closeOnClick = true;
83
+ }
84
+ onClick() {
85
+ if (!this.closeOnClick) {
86
+ return;
87
+ }
88
+ this._parent?.close();
89
+ }
90
+ }
91
+ BbDropdownItem.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbDropdownItem, deps: [{ token: BbDropdown, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
92
+ BbDropdownItem.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.4", type: BbDropdownItem, selector: "[bbDropdownItem]", inputs: { closeOnClick: "closeOnClick" }, host: { listeners: { "click": "onClick()" }, classAttribute: "bb-dropdown-item" }, ngImport: i0 });
93
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbDropdownItem, decorators: [{
94
+ type: Directive,
95
+ args: [{
96
+ selector: '[bbDropdownItem]',
97
+ host: {
98
+ 'class': 'bb-dropdown-item'
99
+ }
100
+ }]
101
+ }], ctorParameters: function () { return [{ type: BbDropdown, decorators: [{
102
+ type: Optional
103
+ }, {
104
+ type: Host
105
+ }] }]; }, propDecorators: { closeOnClick: [{
106
+ type: Input
107
+ }], onClick: [{
108
+ type: HostListener,
109
+ args: ['click']
110
110
  }] } });
111
111
 
112
- const ELEMENTS_ICONS = new InjectionToken('elements_icons');
112
+ const ELEMENTS_ICONS = new InjectionToken('elements_icons');
113
113
  const ELEMENTS_ERRORS = new InjectionToken('elements_errors');
114
114
 
115
- class BbSpinnerBase {
116
- }
117
- const BbSpinnerMixinBase = mixinDisabled(BbSpinnerBase);
118
- class BbSpinner extends BbSpinnerMixinBase {
119
- constructor() {
120
- super(...arguments);
121
- // Inputs.
122
- this.color = '#303f9f';
123
- this.alt = 'Loading...';
124
- }
125
- }
126
- BbSpinner.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbSpinner, deps: null, target: i0.ɵɵFactoryTarget.Component });
127
- BbSpinner.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.3", type: BbSpinner, selector: "bb-spinner", inputs: { color: "color", alt: "alt", disabled: "disabled" }, host: { classAttribute: "bb-spinner" }, usesInheritance: true, ngImport: i0, template: "<!--\r\n The spinner element.\r\n\r\n This element contains a circle with a 25% bar that spins\r\n indefinitely. The border color can be set via the \"color\"\r\n property.\r\n-->\r\n<div class=\"bb-spinner-container\">\r\n <div [style.border-left-color]=\"color\"\r\n [class.disabled]=\"disabled\"\r\n class=\"bb-spinner-loader\"\r\n aria-live=\"assertive\"\r\n role=\"alert\">\r\n {{ alt }}\r\n </div>\r\n <ng-content select=\"img\"></ng-content>\r\n</div>\r\n\r\n<!--\r\n The content of the spinner.\r\n\r\n This element contains the content of the spinner. The user\r\n can set the content inside the tag.\r\n-->\r\n<span class=\"bb-spinner-content\">\r\n <ng-content></ng-content>\r\n</span>\r\n", styles: [".bb-spinner{color:#565656;padding:20px 0;text-align:center;align-items:center;display:inline-flex;flex-direction:column;justify-content:center}.bb-spinner.block{display:flex}.bb-spinner.inverse .bb-spinner-loader{border-color:#ffffff26}.bb-spinner.inverse .bb-spinner-content{color:#ffffff80}.bb-spinner.small .bb-spinner-loader,.bb-spinner.small .bb-spinner-loader:after{width:20px;height:20px;min-width:20px;min-height:20px}.bb-spinner.small .bb-spinner-loader{border-width:2px}.bb-spinner.small .bb-spinner-content{font-size:12px}.bb-spinner.medium .bb-spinner-loader,.bb-spinner.medium .bb-spinner-loader:after{width:60px;height:60px;min-width:60px;min-height:60px}.bb-spinner.medium .bb-spinner-loader{border-width:4px}.bb-spinner.medium .bb-spinner-content{font-size:16px}.bb-spinner.large .bb-spinner-loader,.bb-spinner.large .bb-spinner-loader:after{width:100px;height:100px;min-width:100px;min-height:100px}.bb-spinner.large .bb-spinner-loader{border-width:6px}.bb-spinner.large .bb-spinner-content{font-size:20px}.bb-spinner.horizontal{text-align:left;flex-direction:row}.bb-spinner.horizontal .bb-spinner-content:not(:empty){margin-left:10px;margin-top:0}.bb-spinner.vertical{text-align:center;flex-direction:column}.bb-spinner.vertical .bb-spinner-content:not(:empty){margin-left:0;margin-top:10px}.bb-spinner-container{display:flex;position:relative}.bb-spinner-container>img{top:20%;left:20%;width:60%;height:60%;position:absolute}.bb-spinner-loader{margin:0;padding:0;overflow:hidden;text-indent:100%;color:transparent;position:relative;display:inline-block;vertical-align:middle;border:4px solid #f2f4f6;animation:1s linear infinite spin}.bb-spinner-loader,.bb-spinner-loader:after{width:60px;height:60px;min-width:60px;min-height:60px;border-radius:50%}.bb-spinner-loader.disabled{cursor:default;-webkit-user-select:none;user-select:none;pointer-events:none;animation-play-state:paused}.bb-spinner-content:not(:empty){font-size:16px;margin-top:10px;font-weight:500}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
128
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbSpinner, decorators: [{
129
- type: Component,
130
- args: [{ selector: 'bb-spinner', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { 'class': 'bb-spinner' }, inputs: ['color', 'alt', 'disabled'], preserveWhitespaces: false, template: "<!--\r\n The spinner element.\r\n\r\n This element contains a circle with a 25% bar that spins\r\n indefinitely. The border color can be set via the \"color\"\r\n property.\r\n-->\r\n<div class=\"bb-spinner-container\">\r\n <div [style.border-left-color]=\"color\"\r\n [class.disabled]=\"disabled\"\r\n class=\"bb-spinner-loader\"\r\n aria-live=\"assertive\"\r\n role=\"alert\">\r\n {{ alt }}\r\n </div>\r\n <ng-content select=\"img\"></ng-content>\r\n</div>\r\n\r\n<!--\r\n The content of the spinner.\r\n\r\n This element contains the content of the spinner. The user\r\n can set the content inside the tag.\r\n-->\r\n<span class=\"bb-spinner-content\">\r\n <ng-content></ng-content>\r\n</span>\r\n", styles: [".bb-spinner{color:#565656;padding:20px 0;text-align:center;align-items:center;display:inline-flex;flex-direction:column;justify-content:center}.bb-spinner.block{display:flex}.bb-spinner.inverse .bb-spinner-loader{border-color:#ffffff26}.bb-spinner.inverse .bb-spinner-content{color:#ffffff80}.bb-spinner.small .bb-spinner-loader,.bb-spinner.small .bb-spinner-loader:after{width:20px;height:20px;min-width:20px;min-height:20px}.bb-spinner.small .bb-spinner-loader{border-width:2px}.bb-spinner.small .bb-spinner-content{font-size:12px}.bb-spinner.medium .bb-spinner-loader,.bb-spinner.medium .bb-spinner-loader:after{width:60px;height:60px;min-width:60px;min-height:60px}.bb-spinner.medium .bb-spinner-loader{border-width:4px}.bb-spinner.medium .bb-spinner-content{font-size:16px}.bb-spinner.large .bb-spinner-loader,.bb-spinner.large .bb-spinner-loader:after{width:100px;height:100px;min-width:100px;min-height:100px}.bb-spinner.large .bb-spinner-loader{border-width:6px}.bb-spinner.large .bb-spinner-content{font-size:20px}.bb-spinner.horizontal{text-align:left;flex-direction:row}.bb-spinner.horizontal .bb-spinner-content:not(:empty){margin-left:10px;margin-top:0}.bb-spinner.vertical{text-align:center;flex-direction:column}.bb-spinner.vertical .bb-spinner-content:not(:empty){margin-left:0;margin-top:10px}.bb-spinner-container{display:flex;position:relative}.bb-spinner-container>img{top:20%;left:20%;width:60%;height:60%;position:absolute}.bb-spinner-loader{margin:0;padding:0;overflow:hidden;text-indent:100%;color:transparent;position:relative;display:inline-block;vertical-align:middle;border:4px solid #f2f4f6;animation:1s linear infinite spin}.bb-spinner-loader,.bb-spinner-loader:after{width:60px;height:60px;min-width:60px;min-height:60px;border-radius:50%}.bb-spinner-loader.disabled{cursor:default;-webkit-user-select:none;user-select:none;pointer-events:none;animation-play-state:paused}.bb-spinner-content:not(:empty){font-size:16px;margin-top:10px;font-weight:500}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"] }]
131
- }], propDecorators: { color: [{
132
- type: Input
133
- }], alt: [{
134
- type: Input
115
+ class BbSpinnerBase {
116
+ }
117
+ const BbSpinnerMixinBase = mixinDisabled(BbSpinnerBase);
118
+ class BbSpinner extends BbSpinnerMixinBase {
119
+ constructor() {
120
+ super(...arguments);
121
+ // Inputs.
122
+ this.color = '#303f9f';
123
+ this.alt = 'Loading...';
124
+ }
125
+ }
126
+ BbSpinner.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbSpinner, deps: null, target: i0.ɵɵFactoryTarget.Component });
127
+ BbSpinner.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.4", type: BbSpinner, selector: "bb-spinner", inputs: { color: "color", alt: "alt", disabled: "disabled" }, host: { classAttribute: "bb-spinner" }, usesInheritance: true, ngImport: i0, template: "<!--\n The spinner element.\n\n This element contains a circle with a 25% bar that spins\n indefinitely. The border color can be set via the \"color\"\n property.\n-->\n<div class=\"bb-spinner-container\">\n <div [style.border-left-color]=\"color\"\n [class.disabled]=\"disabled\"\n class=\"bb-spinner-loader\"\n aria-live=\"assertive\"\n role=\"alert\">\n {{ alt }}\n </div>\n <ng-content select=\"img\"></ng-content>\n</div>\n\n<!--\n The content of the spinner.\n\n This element contains the content of the spinner. The user\n can set the content inside the tag.\n-->\n<span class=\"bb-spinner-content\">\n <ng-content></ng-content>\n</span>\n", styles: [".bb-spinner{color:#565656;padding:20px 0;text-align:center;align-items:center;display:inline-flex;flex-direction:column;justify-content:center}.bb-spinner.block{display:flex}.bb-spinner.inverse .bb-spinner-loader{border-color:#ffffff26}.bb-spinner.inverse .bb-spinner-content{color:#ffffff80}.bb-spinner.small .bb-spinner-loader,.bb-spinner.small .bb-spinner-loader:after{width:20px;height:20px;min-width:20px;min-height:20px}.bb-spinner.small .bb-spinner-loader{border-width:2px}.bb-spinner.small .bb-spinner-content{font-size:12px}.bb-spinner.medium .bb-spinner-loader,.bb-spinner.medium .bb-spinner-loader:after{width:60px;height:60px;min-width:60px;min-height:60px}.bb-spinner.medium .bb-spinner-loader{border-width:4px}.bb-spinner.medium .bb-spinner-content{font-size:16px}.bb-spinner.large .bb-spinner-loader,.bb-spinner.large .bb-spinner-loader:after{width:100px;height:100px;min-width:100px;min-height:100px}.bb-spinner.large .bb-spinner-loader{border-width:6px}.bb-spinner.large .bb-spinner-content{font-size:20px}.bb-spinner.horizontal{text-align:left;flex-direction:row}.bb-spinner.horizontal .bb-spinner-content:not(:empty){margin-left:10px;margin-top:0}.bb-spinner.vertical{text-align:center;flex-direction:column}.bb-spinner.vertical .bb-spinner-content:not(:empty){margin-left:0;margin-top:10px}.bb-spinner-container{display:flex;position:relative}.bb-spinner-container>img{top:20%;left:20%;width:60%;height:60%;position:absolute}.bb-spinner-loader{margin:0;padding:0;overflow:hidden;text-indent:100%;color:transparent;position:relative;display:inline-block;vertical-align:middle;border:4px solid #f2f4f6;animation:1s linear infinite spin}.bb-spinner-loader,.bb-spinner-loader:after{width:60px;height:60px;min-width:60px;min-height:60px;border-radius:50%}.bb-spinner-loader.disabled{cursor:default;-webkit-user-select:none;user-select:none;pointer-events:none;animation-play-state:paused}.bb-spinner-content:not(:empty){font-size:16px;margin-top:10px;font-weight:500}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
128
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbSpinner, decorators: [{
129
+ type: Component,
130
+ args: [{ selector: 'bb-spinner', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { 'class': 'bb-spinner' }, inputs: ['color', 'alt', 'disabled'], preserveWhitespaces: false, template: "<!--\n The spinner element.\n\n This element contains a circle with a 25% bar that spins\n indefinitely. The border color can be set via the \"color\"\n property.\n-->\n<div class=\"bb-spinner-container\">\n <div [style.border-left-color]=\"color\"\n [class.disabled]=\"disabled\"\n class=\"bb-spinner-loader\"\n aria-live=\"assertive\"\n role=\"alert\">\n {{ alt }}\n </div>\n <ng-content select=\"img\"></ng-content>\n</div>\n\n<!--\n The content of the spinner.\n\n This element contains the content of the spinner. The user\n can set the content inside the tag.\n-->\n<span class=\"bb-spinner-content\">\n <ng-content></ng-content>\n</span>\n", styles: [".bb-spinner{color:#565656;padding:20px 0;text-align:center;align-items:center;display:inline-flex;flex-direction:column;justify-content:center}.bb-spinner.block{display:flex}.bb-spinner.inverse .bb-spinner-loader{border-color:#ffffff26}.bb-spinner.inverse .bb-spinner-content{color:#ffffff80}.bb-spinner.small .bb-spinner-loader,.bb-spinner.small .bb-spinner-loader:after{width:20px;height:20px;min-width:20px;min-height:20px}.bb-spinner.small .bb-spinner-loader{border-width:2px}.bb-spinner.small .bb-spinner-content{font-size:12px}.bb-spinner.medium .bb-spinner-loader,.bb-spinner.medium .bb-spinner-loader:after{width:60px;height:60px;min-width:60px;min-height:60px}.bb-spinner.medium .bb-spinner-loader{border-width:4px}.bb-spinner.medium .bb-spinner-content{font-size:16px}.bb-spinner.large .bb-spinner-loader,.bb-spinner.large .bb-spinner-loader:after{width:100px;height:100px;min-width:100px;min-height:100px}.bb-spinner.large .bb-spinner-loader{border-width:6px}.bb-spinner.large .bb-spinner-content{font-size:20px}.bb-spinner.horizontal{text-align:left;flex-direction:row}.bb-spinner.horizontal .bb-spinner-content:not(:empty){margin-left:10px;margin-top:0}.bb-spinner.vertical{text-align:center;flex-direction:column}.bb-spinner.vertical .bb-spinner-content:not(:empty){margin-left:0;margin-top:10px}.bb-spinner-container{display:flex;position:relative}.bb-spinner-container>img{top:20%;left:20%;width:60%;height:60%;position:absolute}.bb-spinner-loader{margin:0;padding:0;overflow:hidden;text-indent:100%;color:transparent;position:relative;display:inline-block;vertical-align:middle;border:4px solid #f2f4f6;animation:1s linear infinite spin}.bb-spinner-loader,.bb-spinner-loader:after{width:60px;height:60px;min-width:60px;min-height:60px;border-radius:50%}.bb-spinner-loader.disabled{cursor:default;-webkit-user-select:none;user-select:none;pointer-events:none;animation-play-state:paused}.bb-spinner-content:not(:empty){font-size:16px;margin-top:10px;font-weight:500}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"] }]
131
+ }], propDecorators: { color: [{
132
+ type: Input
133
+ }], alt: [{
134
+ type: Input
135
135
  }] } });
136
136
 
137
- class BbButtonBase {
138
- constructor(_elementRef) {
139
- this._elementRef = _elementRef;
140
- }
141
- }
142
- const BbButtonMixinBase = mixinDisabled(mixinLoad(BbButtonBase));
143
- class BbButton extends BbButtonMixinBase {
144
- constructor(_elementRef) {
145
- super(_elementRef);
146
- }
147
- get nativeElement() {
148
- return this._elementRef.nativeElement;
149
- }
150
- focus() {
151
- this.nativeElement && this.nativeElement.focus();
152
- }
153
- }
154
- BbButton.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbButton, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
155
- BbButton.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.3", type: BbButton, selector: "button[bb-button]", inputs: { disabled: "disabled", loading: "loading" }, host: { properties: { "class.loading": "loading", "attr.disabled": "disabled || loading || null" }, classAttribute: "bb-button" }, exportAs: ["bbButton"], usesInheritance: true, ngImport: i0, template: "<bb-spinner [class.visible]=\"loading\"\r\n class=\"bb-button-spinner small\">\r\n</bb-spinner>\r\n\r\n<ng-content></ng-content>\r\n", styles: [".bb-button{height:38px;padding:0 8px;cursor:pointer;font-size:16px;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;font-style:normal;border-radius:4px;text-align:center;align-items:center;display:inline-flex;text-decoration:none;justify-content:center;background-color:#fff;color:#2d3c4d!important;border:1px solid #d4d8e1;transition-duration:.2s;box-shadow:0 6px 6px -6px #0000001a;transition-timing-function:cubic-bezier(0,0,.2,1);transition-property:padding-left,background-color,box-shadow}.bb-button:hover{background-color:#fcfcfb}.bb-button:focus,.bb-button:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #dce0e980}.bb-button.full{width:100%}.bb-button.full.loading{padding-left:42px}.bb-button.primary{border-color:#2f2b85;color:#fff!important;background-color:#5b53ff}.bb-button.primary:hover{background-color:#564ee6}.bb-button.primary:focus,.bb-button.primary:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #5b53ff80}.bb-button.destructive{border-color:#8f2020;color:#fff!important;background-color:#d32f2f}.bb-button.destructive:hover{background-color:#c32929}.bb-button.destructive:focus,.bb-button.destructive:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #d32f2f80}.bb-button:disabled,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button:disabled:active,.bb-button[disabled],.bb-button[disabled]:focus,.bb-button[disabled]:hover,.bb-button[disabled]:active,.bb-button.loading,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button.loading:active{opacity:.4;cursor:default;box-shadow:none}.bb-button-spinner{width:0;opacity:0;overflow:hidden;visibility:hidden;padding:0!important;transition:width .2s cubic-bezier(0,0,.2,1),opacity .1s cubic-bezier(0,0,.2,1)}.bb-button-spinner.visible{opacity:1;width:20px;margin-right:8px;visibility:visible}.bb-button.loading.full>.bb-button-spinner{left:8px;margin-right:0;position:absolute}\n"], dependencies: [{ kind: "component", type: BbSpinner, selector: "bb-spinner", inputs: ["color", "alt", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
156
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbButton, decorators: [{
157
- type: Component,
158
- args: [{ selector: 'button[bb-button]', exportAs: 'bbButton', host: {
159
- 'class': 'bb-button',
160
- '[class.loading]': 'loading',
161
- '[attr.disabled]': 'disabled || loading || null'
162
- }, inputs: ['disabled', 'loading'], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<bb-spinner [class.visible]=\"loading\"\r\n class=\"bb-button-spinner small\">\r\n</bb-spinner>\r\n\r\n<ng-content></ng-content>\r\n", styles: [".bb-button{height:38px;padding:0 8px;cursor:pointer;font-size:16px;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;font-style:normal;border-radius:4px;text-align:center;align-items:center;display:inline-flex;text-decoration:none;justify-content:center;background-color:#fff;color:#2d3c4d!important;border:1px solid #d4d8e1;transition-duration:.2s;box-shadow:0 6px 6px -6px #0000001a;transition-timing-function:cubic-bezier(0,0,.2,1);transition-property:padding-left,background-color,box-shadow}.bb-button:hover{background-color:#fcfcfb}.bb-button:focus,.bb-button:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #dce0e980}.bb-button.full{width:100%}.bb-button.full.loading{padding-left:42px}.bb-button.primary{border-color:#2f2b85;color:#fff!important;background-color:#5b53ff}.bb-button.primary:hover{background-color:#564ee6}.bb-button.primary:focus,.bb-button.primary:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #5b53ff80}.bb-button.destructive{border-color:#8f2020;color:#fff!important;background-color:#d32f2f}.bb-button.destructive:hover{background-color:#c32929}.bb-button.destructive:focus,.bb-button.destructive:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #d32f2f80}.bb-button:disabled,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button:disabled:active,.bb-button[disabled],.bb-button[disabled]:focus,.bb-button[disabled]:hover,.bb-button[disabled]:active,.bb-button.loading,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button.loading:active{opacity:.4;cursor:default;box-shadow:none}.bb-button-spinner{width:0;opacity:0;overflow:hidden;visibility:hidden;padding:0!important;transition:width .2s cubic-bezier(0,0,.2,1),opacity .1s cubic-bezier(0,0,.2,1)}.bb-button-spinner.visible{opacity:1;width:20px;margin-right:8px;visibility:visible}.bb-button.loading.full>.bb-button-spinner{left:8px;margin-right:0;position:absolute}\n"] }]
163
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
164
- class BbAnchor extends BbButton {
165
- constructor(_elementRef) {
166
- super(_elementRef);
167
- }
168
- stopDisabledEvents(event) {
169
- // If the button is not disabled (and not loading) let all events pass.
170
- if (!this.disabled && !this.loading) {
171
- return;
172
- }
173
- // If the button is disabled and/or loading stop
174
- // the event from bubbling up.
175
- event.preventDefault();
176
- event.stopImmediatePropagation();
177
- }
178
- }
179
- BbAnchor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbAnchor, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
180
- BbAnchor.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.3", type: BbAnchor, selector: "a[bb-button]", inputs: { disabled: "disabled", loading: "loading", tabIndex: "tabIndex" }, host: { listeners: { "click": "stopDisabledEvents($event)" }, properties: { "attr.tabindex": "(disabled || loading) ? -1 : (tabIndex || 0)", "attr.disabled": "disabled || loading || null", "attr.aria-disabled": "(disabled || loading).toString()" }, classAttribute: "bb-button" }, exportAs: ["bbButton", "bbAnchor"], usesInheritance: true, ngImport: i0, template: "<bb-spinner [class.visible]=\"loading\"\r\n class=\"bb-button-spinner small\">\r\n</bb-spinner>\r\n\r\n<ng-content></ng-content>\r\n", styles: [".bb-button{height:38px;padding:0 8px;cursor:pointer;font-size:16px;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;font-style:normal;border-radius:4px;text-align:center;align-items:center;display:inline-flex;text-decoration:none;justify-content:center;background-color:#fff;color:#2d3c4d!important;border:1px solid #d4d8e1;transition-duration:.2s;box-shadow:0 6px 6px -6px #0000001a;transition-timing-function:cubic-bezier(0,0,.2,1);transition-property:padding-left,background-color,box-shadow}.bb-button:hover{background-color:#fcfcfb}.bb-button:focus,.bb-button:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #dce0e980}.bb-button.full{width:100%}.bb-button.full.loading{padding-left:42px}.bb-button.primary{border-color:#2f2b85;color:#fff!important;background-color:#5b53ff}.bb-button.primary:hover{background-color:#564ee6}.bb-button.primary:focus,.bb-button.primary:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #5b53ff80}.bb-button.destructive{border-color:#8f2020;color:#fff!important;background-color:#d32f2f}.bb-button.destructive:hover{background-color:#c32929}.bb-button.destructive:focus,.bb-button.destructive:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #d32f2f80}.bb-button:disabled,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button:disabled:active,.bb-button[disabled],.bb-button[disabled]:focus,.bb-button[disabled]:hover,.bb-button[disabled]:active,.bb-button.loading,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button.loading:active{opacity:.4;cursor:default;box-shadow:none}.bb-button-spinner{width:0;opacity:0;overflow:hidden;visibility:hidden;padding:0!important;transition:width .2s cubic-bezier(0,0,.2,1),opacity .1s cubic-bezier(0,0,.2,1)}.bb-button-spinner.visible{opacity:1;width:20px;margin-right:8px;visibility:visible}.bb-button.loading.full>.bb-button-spinner{left:8px;margin-right:0;position:absolute}\n"], dependencies: [{ kind: "component", type: BbSpinner, selector: "bb-spinner", inputs: ["color", "alt", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
181
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbAnchor, decorators: [{
182
- type: Component,
183
- args: [{ selector: 'a[bb-button]', exportAs: 'bbButton, bbAnchor', host: {
184
- 'class': 'bb-button',
185
- '[attr.tabindex]': '(disabled || loading) ? -1 : (tabIndex || 0)',
186
- '[attr.disabled]': 'disabled || loading || null',
187
- '[attr.aria-disabled]': '(disabled || loading).toString()',
188
- '(click)': 'stopDisabledEvents($event)'
189
- }, inputs: ['disabled', 'loading'], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<bb-spinner [class.visible]=\"loading\"\r\n class=\"bb-button-spinner small\">\r\n</bb-spinner>\r\n\r\n<ng-content></ng-content>\r\n", styles: [".bb-button{height:38px;padding:0 8px;cursor:pointer;font-size:16px;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;font-style:normal;border-radius:4px;text-align:center;align-items:center;display:inline-flex;text-decoration:none;justify-content:center;background-color:#fff;color:#2d3c4d!important;border:1px solid #d4d8e1;transition-duration:.2s;box-shadow:0 6px 6px -6px #0000001a;transition-timing-function:cubic-bezier(0,0,.2,1);transition-property:padding-left,background-color,box-shadow}.bb-button:hover{background-color:#fcfcfb}.bb-button:focus,.bb-button:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #dce0e980}.bb-button.full{width:100%}.bb-button.full.loading{padding-left:42px}.bb-button.primary{border-color:#2f2b85;color:#fff!important;background-color:#5b53ff}.bb-button.primary:hover{background-color:#564ee6}.bb-button.primary:focus,.bb-button.primary:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #5b53ff80}.bb-button.destructive{border-color:#8f2020;color:#fff!important;background-color:#d32f2f}.bb-button.destructive:hover{background-color:#c32929}.bb-button.destructive:focus,.bb-button.destructive:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #d32f2f80}.bb-button:disabled,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button:disabled:active,.bb-button[disabled],.bb-button[disabled]:focus,.bb-button[disabled]:hover,.bb-button[disabled]:active,.bb-button.loading,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button.loading:active{opacity:.4;cursor:default;box-shadow:none}.bb-button-spinner{width:0;opacity:0;overflow:hidden;visibility:hidden;padding:0!important;transition:width .2s cubic-bezier(0,0,.2,1),opacity .1s cubic-bezier(0,0,.2,1)}.bb-button-spinner.visible{opacity:1;width:20px;margin-right:8px;visibility:visible}.bb-button.loading.full>.bb-button-spinner{left:8px;margin-right:0;position:absolute}\n"] }]
190
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { tabIndex: [{
191
- type: Input
137
+ class BbButtonBase {
138
+ constructor(_elementRef) {
139
+ this._elementRef = _elementRef;
140
+ }
141
+ }
142
+ const BbButtonMixinBase = mixinDisabled(mixinLoad(BbButtonBase));
143
+ class BbButton extends BbButtonMixinBase {
144
+ constructor(_elementRef) {
145
+ super(_elementRef);
146
+ }
147
+ get nativeElement() {
148
+ return this._elementRef.nativeElement;
149
+ }
150
+ focus() {
151
+ this.nativeElement && this.nativeElement.focus();
152
+ }
153
+ }
154
+ BbButton.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbButton, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
155
+ BbButton.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.4", type: BbButton, selector: "button[bb-button]", inputs: { disabled: "disabled", loading: "loading" }, host: { properties: { "class.loading": "loading", "attr.disabled": "disabled || loading || null" }, classAttribute: "bb-button" }, exportAs: ["bbButton"], usesInheritance: true, ngImport: i0, template: "<bb-spinner [class.visible]=\"loading\"\n class=\"bb-button-spinner small\">\n</bb-spinner>\n\n<ng-content></ng-content>\n", styles: [".bb-button{height:38px;padding:0 8px;cursor:pointer;font-size:16px;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;font-style:normal;border-radius:4px;text-align:center;align-items:center;display:inline-flex;text-decoration:none;justify-content:center;background-color:#fff;color:#2d3c4d!important;border:1px solid #d4d8e1;transition-duration:.2s;box-shadow:0 6px 6px -6px #0000001a;transition-timing-function:cubic-bezier(0,0,.2,1);transition-property:padding-left,background-color,box-shadow}.bb-button:hover{background-color:#fcfcfb}.bb-button:focus,.bb-button:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #dce0e980}.bb-button.full{width:100%}.bb-button.full.loading{padding-left:42px}.bb-button.primary{border-color:#2f2b85;color:#fff!important;background-color:#5b53ff}.bb-button.primary:hover{background-color:#564ee6}.bb-button.primary:focus,.bb-button.primary:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #5b53ff80}.bb-button.destructive{border-color:#8f2020;color:#fff!important;background-color:#d32f2f}.bb-button.destructive:hover{background-color:#c32929}.bb-button.destructive:focus,.bb-button.destructive:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #d32f2f80}.bb-button:disabled,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button:disabled:active,.bb-button[disabled],.bb-button[disabled]:focus,.bb-button[disabled]:hover,.bb-button[disabled]:active,.bb-button.loading,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button.loading:active{opacity:.4;cursor:default;box-shadow:none}.bb-button-spinner{width:0;opacity:0;overflow:hidden;visibility:hidden;padding:0!important;transition:width .2s cubic-bezier(0,0,.2,1),opacity .1s cubic-bezier(0,0,.2,1)}.bb-button-spinner.visible{opacity:1;width:20px;margin-right:8px;visibility:visible}.bb-button.loading.full>.bb-button-spinner{left:8px;margin-right:0;position:absolute}\n"], dependencies: [{ kind: "component", type: BbSpinner, selector: "bb-spinner", inputs: ["color", "alt", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
156
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbButton, decorators: [{
157
+ type: Component,
158
+ args: [{ selector: 'button[bb-button]', exportAs: 'bbButton', host: {
159
+ 'class': 'bb-button',
160
+ '[class.loading]': 'loading',
161
+ '[attr.disabled]': 'disabled || loading || null'
162
+ }, inputs: ['disabled', 'loading'], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<bb-spinner [class.visible]=\"loading\"\n class=\"bb-button-spinner small\">\n</bb-spinner>\n\n<ng-content></ng-content>\n", styles: [".bb-button{height:38px;padding:0 8px;cursor:pointer;font-size:16px;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;font-style:normal;border-radius:4px;text-align:center;align-items:center;display:inline-flex;text-decoration:none;justify-content:center;background-color:#fff;color:#2d3c4d!important;border:1px solid #d4d8e1;transition-duration:.2s;box-shadow:0 6px 6px -6px #0000001a;transition-timing-function:cubic-bezier(0,0,.2,1);transition-property:padding-left,background-color,box-shadow}.bb-button:hover{background-color:#fcfcfb}.bb-button:focus,.bb-button:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #dce0e980}.bb-button.full{width:100%}.bb-button.full.loading{padding-left:42px}.bb-button.primary{border-color:#2f2b85;color:#fff!important;background-color:#5b53ff}.bb-button.primary:hover{background-color:#564ee6}.bb-button.primary:focus,.bb-button.primary:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #5b53ff80}.bb-button.destructive{border-color:#8f2020;color:#fff!important;background-color:#d32f2f}.bb-button.destructive:hover{background-color:#c32929}.bb-button.destructive:focus,.bb-button.destructive:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #d32f2f80}.bb-button:disabled,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button:disabled:active,.bb-button[disabled],.bb-button[disabled]:focus,.bb-button[disabled]:hover,.bb-button[disabled]:active,.bb-button.loading,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button.loading:active{opacity:.4;cursor:default;box-shadow:none}.bb-button-spinner{width:0;opacity:0;overflow:hidden;visibility:hidden;padding:0!important;transition:width .2s cubic-bezier(0,0,.2,1),opacity .1s cubic-bezier(0,0,.2,1)}.bb-button-spinner.visible{opacity:1;width:20px;margin-right:8px;visibility:visible}.bb-button.loading.full>.bb-button-spinner{left:8px;margin-right:0;position:absolute}\n"] }]
163
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
164
+ class BbAnchor extends BbButton {
165
+ constructor(_elementRef) {
166
+ super(_elementRef);
167
+ }
168
+ stopDisabledEvents(event) {
169
+ // If the button is not disabled (and not loading) let all events pass.
170
+ if (!this.disabled && !this.loading) {
171
+ return;
172
+ }
173
+ // If the button is disabled and/or loading stop
174
+ // the event from bubbling up.
175
+ event.preventDefault();
176
+ event.stopImmediatePropagation();
177
+ }
178
+ }
179
+ BbAnchor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbAnchor, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
180
+ BbAnchor.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.4", type: BbAnchor, selector: "a[bb-button]", inputs: { disabled: "disabled", loading: "loading", tabIndex: "tabIndex" }, host: { listeners: { "click": "stopDisabledEvents($event)" }, properties: { "attr.tabindex": "(disabled || loading) ? -1 : (tabIndex || 0)", "attr.disabled": "disabled || loading || null", "attr.aria-disabled": "(disabled || loading).toString()" }, classAttribute: "bb-button" }, exportAs: ["bbButton", "bbAnchor"], usesInheritance: true, ngImport: i0, template: "<bb-spinner [class.visible]=\"loading\"\n class=\"bb-button-spinner small\">\n</bb-spinner>\n\n<ng-content></ng-content>\n", styles: [".bb-button{height:38px;padding:0 8px;cursor:pointer;font-size:16px;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;font-style:normal;border-radius:4px;text-align:center;align-items:center;display:inline-flex;text-decoration:none;justify-content:center;background-color:#fff;color:#2d3c4d!important;border:1px solid #d4d8e1;transition-duration:.2s;box-shadow:0 6px 6px -6px #0000001a;transition-timing-function:cubic-bezier(0,0,.2,1);transition-property:padding-left,background-color,box-shadow}.bb-button:hover{background-color:#fcfcfb}.bb-button:focus,.bb-button:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #dce0e980}.bb-button.full{width:100%}.bb-button.full.loading{padding-left:42px}.bb-button.primary{border-color:#2f2b85;color:#fff!important;background-color:#5b53ff}.bb-button.primary:hover{background-color:#564ee6}.bb-button.primary:focus,.bb-button.primary:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #5b53ff80}.bb-button.destructive{border-color:#8f2020;color:#fff!important;background-color:#d32f2f}.bb-button.destructive:hover{background-color:#c32929}.bb-button.destructive:focus,.bb-button.destructive:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #d32f2f80}.bb-button:disabled,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button:disabled:active,.bb-button[disabled],.bb-button[disabled]:focus,.bb-button[disabled]:hover,.bb-button[disabled]:active,.bb-button.loading,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button.loading:active{opacity:.4;cursor:default;box-shadow:none}.bb-button-spinner{width:0;opacity:0;overflow:hidden;visibility:hidden;padding:0!important;transition:width .2s cubic-bezier(0,0,.2,1),opacity .1s cubic-bezier(0,0,.2,1)}.bb-button-spinner.visible{opacity:1;width:20px;margin-right:8px;visibility:visible}.bb-button.loading.full>.bb-button-spinner{left:8px;margin-right:0;position:absolute}\n"], dependencies: [{ kind: "component", type: BbSpinner, selector: "bb-spinner", inputs: ["color", "alt", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
181
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbAnchor, decorators: [{
182
+ type: Component,
183
+ args: [{ selector: 'a[bb-button]', exportAs: 'bbButton, bbAnchor', host: {
184
+ 'class': 'bb-button',
185
+ '[attr.tabindex]': '(disabled || loading) ? -1 : (tabIndex || 0)',
186
+ '[attr.disabled]': 'disabled || loading || null',
187
+ '[attr.aria-disabled]': '(disabled || loading).toString()',
188
+ '(click)': 'stopDisabledEvents($event)'
189
+ }, inputs: ['disabled', 'loading'], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<bb-spinner [class.visible]=\"loading\"\n class=\"bb-button-spinner small\">\n</bb-spinner>\n\n<ng-content></ng-content>\n", styles: [".bb-button{height:38px;padding:0 8px;cursor:pointer;font-size:16px;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;font-style:normal;border-radius:4px;text-align:center;align-items:center;display:inline-flex;text-decoration:none;justify-content:center;background-color:#fff;color:#2d3c4d!important;border:1px solid #d4d8e1;transition-duration:.2s;box-shadow:0 6px 6px -6px #0000001a;transition-timing-function:cubic-bezier(0,0,.2,1);transition-property:padding-left,background-color,box-shadow}.bb-button:hover{background-color:#fcfcfb}.bb-button:focus,.bb-button:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #dce0e980}.bb-button.full{width:100%}.bb-button.full.loading{padding-left:42px}.bb-button.primary{border-color:#2f2b85;color:#fff!important;background-color:#5b53ff}.bb-button.primary:hover{background-color:#564ee6}.bb-button.primary:focus,.bb-button.primary:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #5b53ff80}.bb-button.destructive{border-color:#8f2020;color:#fff!important;background-color:#d32f2f}.bb-button.destructive:hover{background-color:#c32929}.bb-button.destructive:focus,.bb-button.destructive:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #d32f2f80}.bb-button:disabled,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button:disabled:active,.bb-button[disabled],.bb-button[disabled]:focus,.bb-button[disabled]:hover,.bb-button[disabled]:active,.bb-button.loading,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button.loading:active{opacity:.4;cursor:default;box-shadow:none}.bb-button-spinner{width:0;opacity:0;overflow:hidden;visibility:hidden;padding:0!important;transition:width .2s cubic-bezier(0,0,.2,1),opacity .1s cubic-bezier(0,0,.2,1)}.bb-button-spinner.visible{opacity:1;width:20px;margin-right:8px;visibility:visible}.bb-button.loading.full>.bb-button-spinner{left:8px;margin-right:0;position:absolute}\n"] }]
190
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { tabIndex: [{
191
+ type: Input
192
192
  }] } });
193
193
 
194
- class BbImagePickerBase {
195
- }
196
- const BbImagePickerMixinBase = mixinDisabled(mixinGrouped(BbImagePickerBase));
197
- class BbImagePicker extends BbImagePickerMixinBase {
198
- constructor(_converter) {
199
- super();
200
- this._converter = _converter;
201
- // Inputs.
202
- this.label = null;
203
- this.placeholder = null;
204
- this.styleDimensions = null;
205
- this.cropDimensions = null;
206
- // Form.
207
- this._value$ = new BehaviorSubject(null);
208
- this.valueChange = new EventEmitter();
209
- this.onTouchedCallback = () => {
210
- };
211
- this.onChangeCallback = () => {
212
- };
213
- }
214
- get value() {
215
- return this._value$.getValue();
216
- }
217
- set value(value) {
218
- this._value$.next(value);
219
- this.valueChange.emit(value);
220
- }
221
- get image() {
222
- return this._value$.pipe(map(value => value || this.placeholder), map(value => value ? `url(${value})` : null));
223
- }
224
- async onFileChange(event) {
225
- // Grab the file from the event.
226
- const file = event.target.files[0];
227
- // Check if the file exists.
228
- if (!file || this.disabled) {
229
- return;
230
- }
231
- try {
232
- this.value = await this._converter.toDataUri(file, this.cropDimensions);
233
- }
234
- catch (error) {
235
- this.value = null;
236
- }
237
- this.onChangeCallback(this.value);
238
- if (this.fileInput && this.fileInput.nativeElement) {
239
- this.fileInput.nativeElement.value = '';
240
- }
241
- }
242
- openFilePicker() {
243
- if (this.disabled) {
244
- return;
245
- }
246
- // Execute a click on the file input.
247
- this.fileInput
248
- && this.fileInput.nativeElement
249
- && this.fileInput.nativeElement.click
250
- && this.fileInput.nativeElement.click();
251
- }
252
- writeValue(value) {
253
- this.value = value;
254
- }
255
- registerOnChange(method) {
256
- this.onChangeCallback = method;
257
- }
258
- registerOnTouched(method) {
259
- this.onTouchedCallback = method;
260
- }
261
- setDisabledState(isDisabled) {
262
- this.disabled = isDisabled;
263
- }
264
- }
265
- BbImagePicker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbImagePicker, deps: [{ token: i1$1.ImageConverter }], target: i0.ɵɵFactoryTarget.Component });
266
- BbImagePicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.3", type: BbImagePicker, selector: "bb-image-picker", inputs: { grouped: "grouped", disabled: "disabled", label: "label", placeholder: "placeholder", styleDimensions: "styleDimensions", cropDimensions: "cropDimensions", value: "value" }, outputs: { valueChange: "valueChange" }, host: { properties: { "class.disabled": "disabled", "class.grouped": "grouped" }, classAttribute: "bb-image-picker" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbImagePicker), multi: true }], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<!-- The input that can open the file picker. -->\r\n<input #fileInput\r\n (change)=\"onFileChange($event)\"\r\n class=\"bb-image-picker-input\"\r\n type=\"file\"\r\n tabindex=\"-1\"\r\n accept=\"image/*\">\r\n\r\n<span [style.width]=\"styleDimensions?.width || '100%'\"\r\n [style.height]=\"styleDimensions?.height || '215px'\"\r\n [style.background-image]=\"image | async\"\r\n class=\"bb-image-input-image\">\r\n </span>\r\n\r\n<button *ngIf=\"label as labelText\"\r\n (click)=\"openFilePicker()\"\r\n bb-button\r\n class=\"bb-image-input-button\"\r\n type=\"button\">\r\n {{ labelText }}\r\n</button>\r\n", styles: [".bb-image-picker{display:flex;align-items:center;flex-direction:column}.bb-image-picker.circle>.bb-image-input-image{border-radius:50%}.bb-image-picker.grouped{margin-bottom:20px}.bb-image-picker.disabled{opacity:.5;cursor:default;-webkit-user-select:none;user-select:none;pointer-events:none}.bb-image-picker-input{opacity:0;z-index:-1;width:.1px;height:.1px;overflow:hidden;position:absolute}.bb-image-input-image{display:flex;cursor:default;position:relative;border-radius:4px;align-items:center;justify-content:center;background:rgba(0,0,0,.2) url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7) center center/cover no-repeat}.bb-image-input-button{margin-top:10px}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: BbButton, selector: "button[bb-button]", inputs: ["disabled", "loading"], exportAs: ["bbButton"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
267
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbImagePicker, decorators: [{
268
- type: Component,
269
- args: [{ selector: 'bb-image-picker', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
270
- 'class': 'bb-image-picker',
271
- '[class.disabled]': 'disabled',
272
- '[class.grouped]': 'grouped'
273
- }, inputs: ['grouped', 'disabled'], providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbImagePicker), multi: true }], preserveWhitespaces: false, template: "<!-- The input that can open the file picker. -->\r\n<input #fileInput\r\n (change)=\"onFileChange($event)\"\r\n class=\"bb-image-picker-input\"\r\n type=\"file\"\r\n tabindex=\"-1\"\r\n accept=\"image/*\">\r\n\r\n<span [style.width]=\"styleDimensions?.width || '100%'\"\r\n [style.height]=\"styleDimensions?.height || '215px'\"\r\n [style.background-image]=\"image | async\"\r\n class=\"bb-image-input-image\">\r\n </span>\r\n\r\n<button *ngIf=\"label as labelText\"\r\n (click)=\"openFilePicker()\"\r\n bb-button\r\n class=\"bb-image-input-button\"\r\n type=\"button\">\r\n {{ labelText }}\r\n</button>\r\n", styles: [".bb-image-picker{display:flex;align-items:center;flex-direction:column}.bb-image-picker.circle>.bb-image-input-image{border-radius:50%}.bb-image-picker.grouped{margin-bottom:20px}.bb-image-picker.disabled{opacity:.5;cursor:default;-webkit-user-select:none;user-select:none;pointer-events:none}.bb-image-picker-input{opacity:0;z-index:-1;width:.1px;height:.1px;overflow:hidden;position:absolute}.bb-image-input-image{display:flex;cursor:default;position:relative;border-radius:4px;align-items:center;justify-content:center;background:rgba(0,0,0,.2) url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7) center center/cover no-repeat}.bb-image-input-button{margin-top:10px}\n"] }]
274
- }], ctorParameters: function () { return [{ type: i1$1.ImageConverter }]; }, propDecorators: { fileInput: [{
275
- type: ViewChild,
276
- args: ['fileInput', { static: true }]
277
- }], label: [{
278
- type: Input
279
- }], placeholder: [{
280
- type: Input
281
- }], styleDimensions: [{
282
- type: Input
283
- }], cropDimensions: [{
284
- type: Input
285
- }], value: [{
286
- type: Input
287
- }], valueChange: [{
288
- type: Output
194
+ class BbImagePickerBase {
195
+ }
196
+ const BbImagePickerMixinBase = mixinDisabled(mixinGrouped(BbImagePickerBase));
197
+ class BbImagePicker extends BbImagePickerMixinBase {
198
+ constructor(_converter) {
199
+ super();
200
+ this._converter = _converter;
201
+ // Inputs.
202
+ this.label = null;
203
+ this.placeholder = null;
204
+ this.styleDimensions = null;
205
+ this.cropDimensions = null;
206
+ // Form.
207
+ this._value$ = new BehaviorSubject(null);
208
+ this.valueChange = new EventEmitter();
209
+ this.onTouchedCallback = () => {
210
+ };
211
+ this.onChangeCallback = () => {
212
+ };
213
+ }
214
+ get value() {
215
+ return this._value$.getValue();
216
+ }
217
+ set value(value) {
218
+ this._value$.next(value);
219
+ this.valueChange.emit(value);
220
+ }
221
+ get image() {
222
+ return this._value$.pipe(map(value => value || this.placeholder), map(value => value ? `url(${value})` : null));
223
+ }
224
+ async onFileChange(event) {
225
+ // Grab the file from the event.
226
+ const file = event.target.files[0];
227
+ // Check if the file exists.
228
+ if (!file || this.disabled) {
229
+ return;
230
+ }
231
+ try {
232
+ this.value = await this._converter.toDataUri(file, this.cropDimensions);
233
+ }
234
+ catch (error) {
235
+ this.value = null;
236
+ }
237
+ this.onChangeCallback(this.value);
238
+ if (this.fileInput && this.fileInput.nativeElement) {
239
+ this.fileInput.nativeElement.value = '';
240
+ }
241
+ }
242
+ openFilePicker() {
243
+ if (this.disabled) {
244
+ return;
245
+ }
246
+ // Execute a click on the file input.
247
+ this.fileInput
248
+ && this.fileInput.nativeElement
249
+ && this.fileInput.nativeElement.click
250
+ && this.fileInput.nativeElement.click();
251
+ }
252
+ writeValue(value) {
253
+ this.value = value;
254
+ }
255
+ registerOnChange(method) {
256
+ this.onChangeCallback = method;
257
+ }
258
+ registerOnTouched(method) {
259
+ this.onTouchedCallback = method;
260
+ }
261
+ setDisabledState(isDisabled) {
262
+ this.disabled = isDisabled;
263
+ }
264
+ }
265
+ BbImagePicker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbImagePicker, deps: [{ token: i1$1.ImageConverter }], target: i0.ɵɵFactoryTarget.Component });
266
+ BbImagePicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.4", type: BbImagePicker, selector: "bb-image-picker", inputs: { grouped: "grouped", disabled: "disabled", label: "label", placeholder: "placeholder", styleDimensions: "styleDimensions", cropDimensions: "cropDimensions", value: "value" }, outputs: { valueChange: "valueChange" }, host: { properties: { "class.disabled": "disabled", "class.grouped": "grouped" }, classAttribute: "bb-image-picker" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbImagePicker), multi: true }], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<!-- The input that can open the file picker. -->\n<input #fileInput\n (change)=\"onFileChange($event)\"\n class=\"bb-image-picker-input\"\n type=\"file\"\n tabindex=\"-1\"\n accept=\"image/*\">\n\n<span [style.width]=\"styleDimensions?.width || '100%'\"\n [style.height]=\"styleDimensions?.height || '215px'\"\n [style.background-image]=\"image | async\"\n class=\"bb-image-input-image\">\n </span>\n\n<button *ngIf=\"label as labelText\"\n (click)=\"openFilePicker()\"\n bb-button\n class=\"bb-image-input-button\"\n type=\"button\">\n {{ labelText }}\n</button>\n", styles: [".bb-image-picker{display:flex;align-items:center;flex-direction:column}.bb-image-picker.circle>.bb-image-input-image{border-radius:50%}.bb-image-picker.grouped{margin-bottom:20px}.bb-image-picker.disabled{opacity:.5;cursor:default;-webkit-user-select:none;user-select:none;pointer-events:none}.bb-image-picker-input{opacity:0;z-index:-1;width:.1px;height:.1px;overflow:hidden;position:absolute}.bb-image-input-image{display:flex;cursor:default;position:relative;border-radius:4px;align-items:center;justify-content:center;background:rgba(0,0,0,.2) url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7) center center/cover no-repeat}.bb-image-input-button{margin-top:10px}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: BbButton, selector: "button[bb-button]", inputs: ["disabled", "loading"], exportAs: ["bbButton"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
267
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbImagePicker, decorators: [{
268
+ type: Component,
269
+ args: [{ selector: 'bb-image-picker', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
270
+ 'class': 'bb-image-picker',
271
+ '[class.disabled]': 'disabled',
272
+ '[class.grouped]': 'grouped'
273
+ }, inputs: ['grouped', 'disabled'], providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbImagePicker), multi: true }], preserveWhitespaces: false, template: "<!-- The input that can open the file picker. -->\n<input #fileInput\n (change)=\"onFileChange($event)\"\n class=\"bb-image-picker-input\"\n type=\"file\"\n tabindex=\"-1\"\n accept=\"image/*\">\n\n<span [style.width]=\"styleDimensions?.width || '100%'\"\n [style.height]=\"styleDimensions?.height || '215px'\"\n [style.background-image]=\"image | async\"\n class=\"bb-image-input-image\">\n </span>\n\n<button *ngIf=\"label as labelText\"\n (click)=\"openFilePicker()\"\n bb-button\n class=\"bb-image-input-button\"\n type=\"button\">\n {{ labelText }}\n</button>\n", styles: [".bb-image-picker{display:flex;align-items:center;flex-direction:column}.bb-image-picker.circle>.bb-image-input-image{border-radius:50%}.bb-image-picker.grouped{margin-bottom:20px}.bb-image-picker.disabled{opacity:.5;cursor:default;-webkit-user-select:none;user-select:none;pointer-events:none}.bb-image-picker-input{opacity:0;z-index:-1;width:.1px;height:.1px;overflow:hidden;position:absolute}.bb-image-input-image{display:flex;cursor:default;position:relative;border-radius:4px;align-items:center;justify-content:center;background:rgba(0,0,0,.2) url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7) center center/cover no-repeat}.bb-image-input-button{margin-top:10px}\n"] }]
274
+ }], ctorParameters: function () { return [{ type: i1$1.ImageConverter }]; }, propDecorators: { fileInput: [{
275
+ type: ViewChild,
276
+ args: ['fileInput', { static: true }]
277
+ }], label: [{
278
+ type: Input
279
+ }], placeholder: [{
280
+ type: Input
281
+ }], styleDimensions: [{
282
+ type: Input
283
+ }], cropDimensions: [{
284
+ type: Input
285
+ }], value: [{
286
+ type: Input
287
+ }], valueChange: [{
288
+ type: Output
289
289
  }] } });
290
290
 
291
- class BbTemplate {
292
- constructor(_templateRef, _viewContainerRef) {
293
- this._templateRef = _templateRef;
294
- this._viewContainerRef = _viewContainerRef;
295
- }
296
- set bbTemplate(content) {
297
- // Get the template.
298
- const template = content instanceof TemplateRef
299
- ? content
300
- : this._templateRef;
301
- // Clear the view container ref and create the view.
302
- this._viewContainerRef.clear();
303
- this._viewContainerRef.createEmbeddedView(template);
304
- }
305
- }
306
- BbTemplate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbTemplate, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
307
- BbTemplate.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.3", type: BbTemplate, selector: "[bbTemplate]", inputs: { bbTemplate: "bbTemplate" }, ngImport: i0 });
308
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbTemplate, decorators: [{
309
- type: Directive,
310
- args: [{
311
- selector: '[bbTemplate]'
312
- }]
313
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { bbTemplate: [{
314
- type: Input
291
+ class BbTemplate {
292
+ constructor(_templateRef, _viewContainerRef) {
293
+ this._templateRef = _templateRef;
294
+ this._viewContainerRef = _viewContainerRef;
295
+ }
296
+ set bbTemplate(content) {
297
+ // Get the template.
298
+ const template = content instanceof TemplateRef
299
+ ? content
300
+ : this._templateRef;
301
+ // Clear the view container ref and create the view.
302
+ this._viewContainerRef.clear();
303
+ this._viewContainerRef.createEmbeddedView(template);
304
+ }
305
+ }
306
+ BbTemplate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbTemplate, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
307
+ BbTemplate.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.4", type: BbTemplate, selector: "[bbTemplate]", inputs: { bbTemplate: "bbTemplate" }, ngImport: i0 });
308
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbTemplate, decorators: [{
309
+ type: Directive,
310
+ args: [{
311
+ selector: '[bbTemplate]'
312
+ }]
313
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { bbTemplate: [{
314
+ type: Input
315
315
  }] } });
316
316
 
317
- class BbFormSubmit {
318
- constructor(_host, _formDirective) {
319
- this._host = _host;
320
- this._formDirective = _formDirective;
321
- }
322
- ngOnInit() {
323
- // Submit changes.
324
- const regularSubmitChanges$ = fromEvent(this.nativeElement, 'submit').pipe(map(() => true));
325
- // Reactive form submit changes.
326
- const reactiveSubmitChanges$ = this.reactiveSubmitChanges();
327
- // Reset changes.
328
- const resetChanges$ = fromEvent(this.nativeElement, 'reset').pipe(map(() => false));
329
- // Listen to the submit status.
330
- this.submitStatus$ = merge(regularSubmitChanges$, reactiveSubmitChanges$, resetChanges$).pipe(startWith(false), distinctUntilChanged(), shareReplay(1));
331
- }
332
- submit() {
333
- this._formDirective?.ngSubmit?.emit();
334
- }
335
- reset() {
336
- return this.nativeElement?.reset();
337
- }
338
- get nativeElement() {
339
- return this._host?.nativeElement;
340
- }
341
- reactiveSubmitChanges() {
342
- if (!this._formDirective) {
343
- return EMPTY;
344
- }
345
- return this._formDirective.ngSubmit.pipe(map(() => true));
346
- }
347
- }
348
- BbFormSubmit.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbFormSubmit, deps: [{ token: i0.ElementRef }, { token: i2.FormGroupDirective, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Directive });
349
- BbFormSubmit.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.3", type: BbFormSubmit, selector: "form", exportAs: ["bbForm"], ngImport: i0 });
350
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbFormSubmit, decorators: [{
351
- type: Directive,
352
- args: [{
353
- selector: 'form',
354
- exportAs: 'bbForm'
355
- }]
356
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i2.FormGroupDirective, decorators: [{
357
- type: Optional
358
- }, {
359
- type: Self
317
+ class BbFormSubmit {
318
+ constructor(_host, _formDirective) {
319
+ this._host = _host;
320
+ this._formDirective = _formDirective;
321
+ }
322
+ ngOnInit() {
323
+ // Submit changes.
324
+ const regularSubmitChanges$ = fromEvent(this.nativeElement, 'submit').pipe(map(() => true));
325
+ // Reactive form submit changes.
326
+ const reactiveSubmitChanges$ = this.reactiveSubmitChanges();
327
+ // Reset changes.
328
+ const resetChanges$ = fromEvent(this.nativeElement, 'reset').pipe(map(() => false));
329
+ // Listen to the submit status.
330
+ this.submitStatus$ = merge(regularSubmitChanges$, reactiveSubmitChanges$, resetChanges$).pipe(startWith(false), distinctUntilChanged(), shareReplay(1));
331
+ }
332
+ submit() {
333
+ this._formDirective?.ngSubmit?.emit();
334
+ }
335
+ reset() {
336
+ return this.nativeElement?.reset();
337
+ }
338
+ get nativeElement() {
339
+ return this._host?.nativeElement;
340
+ }
341
+ reactiveSubmitChanges() {
342
+ if (!this._formDirective) {
343
+ return EMPTY;
344
+ }
345
+ return this._formDirective.ngSubmit.pipe(map(() => true));
346
+ }
347
+ }
348
+ BbFormSubmit.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbFormSubmit, deps: [{ token: i0.ElementRef }, { token: i2.FormGroupDirective, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Directive });
349
+ BbFormSubmit.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.4", type: BbFormSubmit, selector: "form", exportAs: ["bbForm"], ngImport: i0 });
350
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbFormSubmit, decorators: [{
351
+ type: Directive,
352
+ args: [{
353
+ selector: 'form',
354
+ exportAs: 'bbForm'
355
+ }]
356
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i2.FormGroupDirective, decorators: [{
357
+ type: Optional
358
+ }, {
359
+ type: Self
360
360
  }] }]; } });
361
361
 
362
- class BbFormError {
363
- constructor(_form, _control, _errors) {
364
- this._form = _form;
365
- this._control = _control;
366
- this._errors = _errors;
367
- // Outputs.
368
- this.errorChange = new EventEmitter();
369
- // Subscriptions.
370
- this._ngControl = null;
371
- }
372
- // Inputs.
373
- set control(value) {
374
- this._ngControl = value;
375
- }
376
- get control() {
377
- return this._ngControl;
378
- }
379
- ngOnInit() {
380
- // Set the control if it was not set before.
381
- if (!this.control) {
382
- this.control = this._control;
383
- }
384
- // Listen for the submit changes
385
- const submitStatus$ = this.submitStatusChanges();
386
- // An observable that emits error changes.
387
- const errorChanges$ = this.statusChanges().pipe(map(() => this.getError(this.control.errors)), distinctUntilChanged(), map(error => typeof error === 'string' ? { token: error } : error));
388
- // Whenever the user submitted the form we want to
389
- // listen for any error changes.
390
- this.error$ = combineLatest([submitStatus$, errorChanges$]).pipe(map(([submitted, error]) => {
391
- // If not submitted return null.
392
- if (!submitted) {
393
- return null;
394
- }
395
- // Return the error if submitted.
396
- return error;
397
- }), tap(value => this.errorChange.emit(value)));
398
- }
399
- getError(errors) {
400
- // Validate the errors exist.
401
- if (!errors) {
402
- return null;
403
- }
404
- // Get the first error in the errors.
405
- const [errorName] = Object.keys(errors);
406
- const error = errors[errorName];
407
- // Validate the error exists.
408
- if (!error) {
409
- return null;
410
- }
411
- // Map the arrays into a object so we can
412
- // access the functions by a key-lookup.
413
- const errorFunctions = this._errors.reduce((previous, current) => ({ ...previous, ...current }), {});
414
- // Get the error function.
415
- const errorFunction = errorFunctions[errorName] || errorFunctions['unknown'];
416
- // Validate the error function exists.
417
- if (!errorFunction) {
418
- return null;
419
- }
420
- // Return the parsed error.
421
- return errorFunction(error);
422
- }
423
- submitStatusChanges() {
424
- if (!this._form) {
425
- return of(true);
426
- }
427
- return this._form.submitStatus$;
428
- }
429
- statusChanges() {
430
- if (!this.control) {
431
- return EMPTY;
432
- }
433
- if (!this.control.statusChanges) {
434
- return EMPTY;
435
- }
436
- return this.control.statusChanges.pipe(startWith(this.control.status), delay(0));
437
- }
438
- }
439
- BbFormError.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbFormError, deps: [{ token: BbFormSubmit, optional: true }, { token: i2.NgControl, optional: true }, { token: ELEMENTS_ERRORS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
440
- BbFormError.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.3", type: BbFormError, selector: "bb-form-error", inputs: { control: "control" }, outputs: { errorChange: "errorChange" }, host: { classAttribute: "bb-form-error" }, ngImport: i0, template: "<ng-container *ngIf=\"error$ | async as error\">\r\n <p *ngIf=\"error?.token | bbLocalize:{optional: true, data: error?.data} as message\"\r\n class=\"bb-form-error-message\">\r\n {{ message }}\r\n </p>\r\n</ng-container>", styles: [".bb-form-error{display:block}.bb-form-error-message{color:#c23934;display:block;font-size:13px;margin-top:4px}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.BbLocalize, name: "bbLocalize" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
441
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbFormError, decorators: [{
442
- type: Component,
443
- args: [{ selector: 'bb-form-error', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
444
- 'class': 'bb-form-error'
445
- }, preserveWhitespaces: false, template: "<ng-container *ngIf=\"error$ | async as error\">\r\n <p *ngIf=\"error?.token | bbLocalize:{optional: true, data: error?.data} as message\"\r\n class=\"bb-form-error-message\">\r\n {{ message }}\r\n </p>\r\n</ng-container>", styles: [".bb-form-error{display:block}.bb-form-error-message{color:#c23934;display:block;font-size:13px;margin-top:4px}\n"] }]
446
- }], ctorParameters: function () { return [{ type: BbFormSubmit, decorators: [{
447
- type: Optional
448
- }] }, { type: i2.NgControl, decorators: [{
449
- type: Optional
450
- }] }, { type: undefined, decorators: [{
451
- type: Optional
452
- }, {
453
- type: Inject,
454
- args: [ELEMENTS_ERRORS]
455
- }] }]; }, propDecorators: { control: [{
456
- type: Input
457
- }], errorChange: [{
458
- type: Output
362
+ class BbFormError {
363
+ constructor(_form, _control, _errors) {
364
+ this._form = _form;
365
+ this._control = _control;
366
+ this._errors = _errors;
367
+ // Outputs.
368
+ this.errorChange = new EventEmitter();
369
+ // Subscriptions.
370
+ this._ngControl = null;
371
+ }
372
+ // Inputs.
373
+ set control(value) {
374
+ this._ngControl = value;
375
+ }
376
+ get control() {
377
+ return this._ngControl;
378
+ }
379
+ ngOnInit() {
380
+ // Set the control if it was not set before.
381
+ if (!this.control) {
382
+ this.control = this._control;
383
+ }
384
+ // Listen for the submit changes
385
+ const submitStatus$ = this.submitStatusChanges();
386
+ // An observable that emits error changes.
387
+ const errorChanges$ = this.statusChanges().pipe(map(() => this.getError(this.control.errors)), distinctUntilChanged(), map(error => typeof error === 'string' ? { token: error } : error));
388
+ // Whenever the user submitted the form we want to
389
+ // listen for any error changes.
390
+ this.error$ = combineLatest([submitStatus$, errorChanges$]).pipe(map(([submitted, error]) => {
391
+ // If not submitted return null.
392
+ if (!submitted) {
393
+ return null;
394
+ }
395
+ // Return the error if submitted.
396
+ return error;
397
+ }), tap(value => this.errorChange.emit(value)));
398
+ }
399
+ getError(errors) {
400
+ // Validate the errors exist.
401
+ if (!errors) {
402
+ return null;
403
+ }
404
+ // Get the first error in the errors.
405
+ const [errorName] = Object.keys(errors);
406
+ const error = errors[errorName];
407
+ // Validate the error exists.
408
+ if (!error) {
409
+ return null;
410
+ }
411
+ // Map the arrays into a object so we can
412
+ // access the functions by a key-lookup.
413
+ const errorFunctions = this._errors.reduce((previous, current) => ({ ...previous, ...current }), {});
414
+ // Get the error function.
415
+ const errorFunction = errorFunctions[errorName] || errorFunctions['unknown'];
416
+ // Validate the error function exists.
417
+ if (!errorFunction) {
418
+ return null;
419
+ }
420
+ // Return the parsed error.
421
+ return errorFunction(error);
422
+ }
423
+ submitStatusChanges() {
424
+ if (!this._form) {
425
+ return of(true);
426
+ }
427
+ return this._form.submitStatus$;
428
+ }
429
+ statusChanges() {
430
+ if (!this.control) {
431
+ return EMPTY;
432
+ }
433
+ if (!this.control.statusChanges) {
434
+ return EMPTY;
435
+ }
436
+ return this.control.statusChanges.pipe(startWith(this.control.status), delay(0));
437
+ }
438
+ }
439
+ BbFormError.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbFormError, deps: [{ token: BbFormSubmit, optional: true }, { token: i2.NgControl, optional: true }, { token: ELEMENTS_ERRORS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
440
+ BbFormError.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.4", 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"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.BbLocalize, name: "bbLocalize" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
441
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbFormError, decorators: [{
442
+ type: Component,
443
+ args: [{ selector: 'bb-form-error', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
444
+ 'class': 'bb-form-error'
445
+ }, preserveWhitespaces: false, template: "<ng-container *ngIf=\"error$ | async as error\">\n <p *ngIf=\"error?.token | bbLocalize:{optional: true, data: error?.data} as message\"\n class=\"bb-form-error-message\">\n {{ message }}\n </p>\n</ng-container>", styles: [".bb-form-error{display:block}.bb-form-error-message{color:#c23934;display:block;font-size:13px;margin-top:4px}\n"] }]
446
+ }], ctorParameters: function () { return [{ type: BbFormSubmit, decorators: [{
447
+ type: Optional
448
+ }] }, { type: i2.NgControl, decorators: [{
449
+ type: Optional
450
+ }] }, { type: undefined, decorators: [{
451
+ type: Optional
452
+ }, {
453
+ type: Inject,
454
+ args: [ELEMENTS_ERRORS]
455
+ }] }]; }, propDecorators: { control: [{
456
+ type: Input
457
+ }], errorChange: [{
458
+ type: Output
459
459
  }] } });
460
460
 
461
- let nextUniqueId$2 = 0;
462
- class BbFormControlBase {
463
- }
464
- const BbFormControlMixinBase = mixinDisabled(mixinFocused(mixinReadonly(mixinGrouped(mixinRequired(mixinError(mixinHideErrors(BbFormControlBase)))))));
465
- class BbFormControl extends BbFormControlMixinBase {
466
- constructor() {
467
- super(...arguments);
468
- // Inputs.
469
- this.label = null;
470
- this.hint = null;
471
- // Data.
472
- this.arrow = false;
473
- // Data.
474
- this.labelId = `bb-form-control-${nextUniqueId$2++}`;
475
- }
476
- onErrorChange(error) {
477
- this.error = !!error;
478
- }
479
- }
480
- BbFormControl.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbFormControl, deps: null, target: i0.ɵɵFactoryTarget.Component });
481
- BbFormControl.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.3", type: BbFormControl, selector: "bb-form-control", inputs: { grouped: "grouped", hideErrors: "hideErrors", label: "label", hint: "hint" }, host: { properties: { "class.readonly": "readonly", "class.required": "required", "class.disabled": "disabled", "class.focused": "focused", "class.grouped": "grouped", "class.arrow": "arrow", "class.error": "error" }, classAttribute: "bb-form-control" }, queries: [{ propertyName: "ngControl", first: true, predicate: NgControl, descendants: true }], usesInheritance: true, ngImport: i0, template: "<!-- Label of the form control. -->\r\n<label *ngIf=\"label as labelContent\"\r\n [attr.for]=\"labelId\"\r\n class=\"bb-form-control-label\">\r\n <ng-template [bbTemplate]=\"labelContent\">\r\n {{ labelContent }}\r\n </ng-template>\r\n</label>\r\n\r\n<!-- The input with the addons. -->\r\n<div class=\"bb-form-control-container\">\r\n <ng-content select=\"[bbPrefix]\"></ng-content>\r\n <ng-content select=\"[bbInput]\"></ng-content>\r\n <ng-content select=\"[bbSuffix]\"></ng-content>\r\n</div>\r\n\r\n<!-- The error component. -->\r\n<bb-form-error *ngIf=\"!hideErrors\"\r\n [control]=\"ngControl\"\r\n (errorChange)=\"onErrorChange($event)\">\r\n</bb-form-error>\r\n\r\n<!-- The form control hint. -->\r\n<p *ngIf=\"hint as hintContent\"\r\n class=\"bb-form-control-hint\">\r\n <ng-template [bbTemplate]=\"hintContent\">\r\n {{ hintContent }}\r\n </ng-template>\r\n</p>\r\n", styles: [".bb-form-control{color:#2d3c4d;display:block}.bb-form-control>.bb-form-control-container>*.bb-prefix,.bb-form-control>.bb-form-control-container>*.bb-suffix{margin:0 8px;color:#b4b4b4;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control.grouped{margin-bottom:20px}.bb-form-control.small{max-width:240px}.bb-form-control.medium{max-width:480px}.bb-form-control.large{max-width:720px}.bb-form-control.required>.bb-form-control-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bb-form-control.disabled>.bb-form-control-container{cursor:default;pointer-events:none;background-color:#cccccca3}.bb-form-control.disabled>.bb-form-control-container>input,.bb-form-control.disabled>.bb-form-control-container>textarea,.bb-form-control.disabled>.bb-form-control-container>select{color:#aaa}.bb-form-control.readonly>.bb-form-control-container{cursor:default;border:1px dotted #bdc4c9}.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container{background-color:#fff;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #007bff33}.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container>input::placeholder,.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container>textarea::placeholder{color:#b4b4b4;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control.error>.bb-form-control-label{color:#c23934}.bb-form-control.error>.bb-form-control-hint{display:none}.bb-form-control.error>.bb-form-control-container{border:1px solid #962b26;background-color:#c2393440!important;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #c2393466!important}.bb-form-control.error>.bb-form-control-container>*.bb-prefix,.bb-form-control.error>.bb-form-control-container>.bb-suffix{color:#c23934}.bb-form-control.error>.bb-form-control-container>input::placeholder,.bb-form-control.error>.bb-form-control-container>textarea::placeholder{color:#c2393466!important}.bb-form-control.arrow>.bb-form-control-container:after{top:0;right:0;bottom:0;width:20px;content:\"\";height:36px;display:flex;min-width:20px;position:absolute;pointer-events:none;background-repeat:no-repeat;background-position:calc(100% - 8px) center;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAGCAYAAAAYLBS/AAAACXBIWXMAAAsSAAALEgHS3X78AAAAWUlEQVQYlY3QsQ2DMAAEwMMTsAkrZInvWY3WXiIjJJtkA1OBRCIRf/nSffFTrXXGE4uxbCXJBw+8R0CStcAg3JKsUI7mDzzBBd3AC4Cp9/4z21o7znl9A9gBAf4fpjLTwkUAAAAASUVORK5CYII=)}.bb-form-control-container{width:100%;display:flex;overflow:hidden;position:relative;border-radius:3px;align-items:center;border:1px solid #b6bbc1;background-color:#fff8ff;transition-duration:.25s;transition-property:background-color,box-shadow;transition-timing-function:cubic-bezier(0,0,.2,1);box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a}.bb-form-control-container>input::placeholder,.bb-form-control-container>textarea::placeholder{color:#d2d2d2;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control-container>input,.bb-form-control-container>textarea,.bb-form-control-container>select{margin:0;width:100%;border:none;color:#3d464d;font-size:16px;-webkit-appearance:none;appearance:none;background-color:transparent}.bb-form-control-container>input,.bb-form-control-container>select{height:36px;padding:0 8px}.bb-form-control-container>select{padding-right:28px}.bb-form-control-container>select>::-ms-expand{display:none}.bb-form-control-container>input::-ms-clear,.bb-form-control-container>input::-ms-reveal{width:0;height:0;display:none}.bb-form-control-container>input::-webkit-search-decoration,.bb-form-control-container>input::-webkit-search-cancel-button,.bb-form-control-container>input::-webkit-search-results-button,.bb-form-control-container>input::-webkit-search-results-decoration{display:none}.bb-form-control-container>textarea{resize:none;padding:8px}.bb-form-control-label{color:#000;display:block;position:relative;margin-bottom:4px;transition:color 30ms cubic-bezier(0,0,.2,1)}.bb-form-control-error,.bb-form-control-hint{display:block;font-size:13px;margin-top:4px}.bb-form-control-error{color:#c23934}.bb-form-control-hint{color:#738694}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: BbTemplate, selector: "[bbTemplate]", inputs: ["bbTemplate"] }, { kind: "component", type: BbFormError, selector: "bb-form-error", inputs: ["control"], outputs: ["errorChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
482
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbFormControl, decorators: [{
483
- type: Component,
484
- args: [{ selector: 'bb-form-control', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
485
- 'class': 'bb-form-control',
486
- '[class.readonly]': 'readonly',
487
- '[class.required]': 'required',
488
- '[class.disabled]': 'disabled',
489
- '[class.focused]': 'focused',
490
- '[class.grouped]': 'grouped',
491
- '[class.arrow]': 'arrow',
492
- '[class.error]': 'error'
493
- }, inputs: ['grouped', 'hideErrors'], preserveWhitespaces: false, template: "<!-- Label of the form control. -->\r\n<label *ngIf=\"label as labelContent\"\r\n [attr.for]=\"labelId\"\r\n class=\"bb-form-control-label\">\r\n <ng-template [bbTemplate]=\"labelContent\">\r\n {{ labelContent }}\r\n </ng-template>\r\n</label>\r\n\r\n<!-- The input with the addons. -->\r\n<div class=\"bb-form-control-container\">\r\n <ng-content select=\"[bbPrefix]\"></ng-content>\r\n <ng-content select=\"[bbInput]\"></ng-content>\r\n <ng-content select=\"[bbSuffix]\"></ng-content>\r\n</div>\r\n\r\n<!-- The error component. -->\r\n<bb-form-error *ngIf=\"!hideErrors\"\r\n [control]=\"ngControl\"\r\n (errorChange)=\"onErrorChange($event)\">\r\n</bb-form-error>\r\n\r\n<!-- The form control hint. -->\r\n<p *ngIf=\"hint as hintContent\"\r\n class=\"bb-form-control-hint\">\r\n <ng-template [bbTemplate]=\"hintContent\">\r\n {{ hintContent }}\r\n </ng-template>\r\n</p>\r\n", styles: [".bb-form-control{color:#2d3c4d;display:block}.bb-form-control>.bb-form-control-container>*.bb-prefix,.bb-form-control>.bb-form-control-container>*.bb-suffix{margin:0 8px;color:#b4b4b4;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control.grouped{margin-bottom:20px}.bb-form-control.small{max-width:240px}.bb-form-control.medium{max-width:480px}.bb-form-control.large{max-width:720px}.bb-form-control.required>.bb-form-control-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bb-form-control.disabled>.bb-form-control-container{cursor:default;pointer-events:none;background-color:#cccccca3}.bb-form-control.disabled>.bb-form-control-container>input,.bb-form-control.disabled>.bb-form-control-container>textarea,.bb-form-control.disabled>.bb-form-control-container>select{color:#aaa}.bb-form-control.readonly>.bb-form-control-container{cursor:default;border:1px dotted #bdc4c9}.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container{background-color:#fff;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #007bff33}.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container>input::placeholder,.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container>textarea::placeholder{color:#b4b4b4;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control.error>.bb-form-control-label{color:#c23934}.bb-form-control.error>.bb-form-control-hint{display:none}.bb-form-control.error>.bb-form-control-container{border:1px solid #962b26;background-color:#c2393440!important;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #c2393466!important}.bb-form-control.error>.bb-form-control-container>*.bb-prefix,.bb-form-control.error>.bb-form-control-container>.bb-suffix{color:#c23934}.bb-form-control.error>.bb-form-control-container>input::placeholder,.bb-form-control.error>.bb-form-control-container>textarea::placeholder{color:#c2393466!important}.bb-form-control.arrow>.bb-form-control-container:after{top:0;right:0;bottom:0;width:20px;content:\"\";height:36px;display:flex;min-width:20px;position:absolute;pointer-events:none;background-repeat:no-repeat;background-position:calc(100% - 8px) center;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAGCAYAAAAYLBS/AAAACXBIWXMAAAsSAAALEgHS3X78AAAAWUlEQVQYlY3QsQ2DMAAEwMMTsAkrZInvWY3WXiIjJJtkA1OBRCIRf/nSffFTrXXGE4uxbCXJBw+8R0CStcAg3JKsUI7mDzzBBd3AC4Cp9/4z21o7znl9A9gBAf4fpjLTwkUAAAAASUVORK5CYII=)}.bb-form-control-container{width:100%;display:flex;overflow:hidden;position:relative;border-radius:3px;align-items:center;border:1px solid #b6bbc1;background-color:#fff8ff;transition-duration:.25s;transition-property:background-color,box-shadow;transition-timing-function:cubic-bezier(0,0,.2,1);box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a}.bb-form-control-container>input::placeholder,.bb-form-control-container>textarea::placeholder{color:#d2d2d2;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control-container>input,.bb-form-control-container>textarea,.bb-form-control-container>select{margin:0;width:100%;border:none;color:#3d464d;font-size:16px;-webkit-appearance:none;appearance:none;background-color:transparent}.bb-form-control-container>input,.bb-form-control-container>select{height:36px;padding:0 8px}.bb-form-control-container>select{padding-right:28px}.bb-form-control-container>select>::-ms-expand{display:none}.bb-form-control-container>input::-ms-clear,.bb-form-control-container>input::-ms-reveal{width:0;height:0;display:none}.bb-form-control-container>input::-webkit-search-decoration,.bb-form-control-container>input::-webkit-search-cancel-button,.bb-form-control-container>input::-webkit-search-results-button,.bb-form-control-container>input::-webkit-search-results-decoration{display:none}.bb-form-control-container>textarea{resize:none;padding:8px}.bb-form-control-label{color:#000;display:block;position:relative;margin-bottom:4px;transition:color 30ms cubic-bezier(0,0,.2,1)}.bb-form-control-error,.bb-form-control-hint{display:block;font-size:13px;margin-top:4px}.bb-form-control-error{color:#c23934}.bb-form-control-hint{color:#738694}\n"] }]
494
- }], propDecorators: { ngControl: [{
495
- type: ContentChild,
496
- args: [NgControl]
497
- }], label: [{
498
- type: Input
499
- }], hint: [{
500
- type: Input
461
+ let nextUniqueId$2 = 0;
462
+ class BbFormControlBase {
463
+ }
464
+ const BbFormControlMixinBase = mixinDisabled(mixinFocused(mixinReadonly(mixinGrouped(mixinRequired(mixinError(mixinHideErrors(BbFormControlBase)))))));
465
+ class BbFormControl extends BbFormControlMixinBase {
466
+ constructor() {
467
+ super(...arguments);
468
+ // Inputs.
469
+ this.label = null;
470
+ this.hint = null;
471
+ // Data.
472
+ this.arrow = false;
473
+ // Data.
474
+ this.labelId = `bb-form-control-${nextUniqueId$2++}`;
475
+ }
476
+ onErrorChange(error) {
477
+ this.error = !!error;
478
+ }
479
+ }
480
+ BbFormControl.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbFormControl, deps: null, target: i0.ɵɵFactoryTarget.Component });
481
+ BbFormControl.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.4", type: BbFormControl, selector: "bb-form-control", inputs: { grouped: "grouped", hideErrors: "hideErrors", label: "label", hint: "hint" }, host: { properties: { "class.readonly": "readonly", "class.required": "required", "class.disabled": "disabled", "class.focused": "focused", "class.grouped": "grouped", "class.arrow": "arrow", "class.error": "error" }, classAttribute: "bb-form-control" }, queries: [{ propertyName: "ngControl", first: true, predicate: NgControl, descendants: true }], usesInheritance: true, ngImport: i0, template: "<!-- Label of the form control. -->\n<label *ngIf=\"label as labelContent\"\n [attr.for]=\"labelId\"\n class=\"bb-form-control-label\">\n <ng-template [bbTemplate]=\"labelContent\">\n {{ labelContent }}\n </ng-template>\n</label>\n\n<!-- The input with the addons. -->\n<div class=\"bb-form-control-container\">\n <ng-content select=\"[bbPrefix]\"></ng-content>\n <ng-content select=\"[bbInput]\"></ng-content>\n <ng-content select=\"[bbSuffix]\"></ng-content>\n</div>\n\n<!-- The error component. -->\n<bb-form-error *ngIf=\"!hideErrors\"\n [control]=\"ngControl\"\n (errorChange)=\"onErrorChange($event)\">\n</bb-form-error>\n\n<!-- The form control hint. -->\n<p *ngIf=\"hint as hintContent\"\n class=\"bb-form-control-hint\">\n <ng-template [bbTemplate]=\"hintContent\">\n {{ hintContent }}\n </ng-template>\n</p>\n", styles: [".bb-form-control{color:#2d3c4d;display:block}.bb-form-control>.bb-form-control-container>*.bb-prefix,.bb-form-control>.bb-form-control-container>*.bb-suffix{margin:0 8px;color:#b4b4b4;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control.grouped{margin-bottom:20px}.bb-form-control.small{max-width:240px}.bb-form-control.medium{max-width:480px}.bb-form-control.large{max-width:720px}.bb-form-control.required>.bb-form-control-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bb-form-control.disabled>.bb-form-control-container{cursor:default;pointer-events:none;background-color:#cccccca3}.bb-form-control.disabled>.bb-form-control-container>input,.bb-form-control.disabled>.bb-form-control-container>textarea,.bb-form-control.disabled>.bb-form-control-container>select{color:#aaa}.bb-form-control.readonly>.bb-form-control-container{cursor:default;border:1px dotted #bdc4c9}.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container{background-color:#fff;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #007bff33}.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container>input::placeholder,.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container>textarea::placeholder{color:#b4b4b4;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control.error>.bb-form-control-label{color:#c23934}.bb-form-control.error>.bb-form-control-hint{display:none}.bb-form-control.error>.bb-form-control-container{border:1px solid #962b26;background-color:#c2393440!important;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #c2393466!important}.bb-form-control.error>.bb-form-control-container>*.bb-prefix,.bb-form-control.error>.bb-form-control-container>.bb-suffix{color:#c23934}.bb-form-control.error>.bb-form-control-container>input::placeholder,.bb-form-control.error>.bb-form-control-container>textarea::placeholder{color:#c2393466!important}.bb-form-control.arrow>.bb-form-control-container:after{top:0;right:0;bottom:0;width:20px;content:\"\";height:36px;display:flex;min-width:20px;position:absolute;pointer-events:none;background-repeat:no-repeat;background-position:calc(100% - 8px) center;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAGCAYAAAAYLBS/AAAACXBIWXMAAAsSAAALEgHS3X78AAAAWUlEQVQYlY3QsQ2DMAAEwMMTsAkrZInvWY3WXiIjJJtkA1OBRCIRf/nSffFTrXXGE4uxbCXJBw+8R0CStcAg3JKsUI7mDzzBBd3AC4Cp9/4z21o7znl9A9gBAf4fpjLTwkUAAAAASUVORK5CYII=)}.bb-form-control-container{width:100%;display:flex;overflow:hidden;position:relative;border-radius:3px;align-items:center;border:1px solid #b6bbc1;background-color:#fff8ff;transition-duration:.25s;transition-property:background-color,box-shadow;transition-timing-function:cubic-bezier(0,0,.2,1);box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a}.bb-form-control-container>input::placeholder,.bb-form-control-container>textarea::placeholder{color:#d2d2d2;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control-container>input,.bb-form-control-container>textarea,.bb-form-control-container>select{margin:0;width:100%;border:none;color:#3d464d;font-size:16px;-webkit-appearance:none;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"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: BbTemplate, selector: "[bbTemplate]", inputs: ["bbTemplate"] }, { kind: "component", type: BbFormError, selector: "bb-form-error", inputs: ["control"], outputs: ["errorChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
482
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbFormControl, decorators: [{
483
+ type: Component,
484
+ args: [{ selector: 'bb-form-control', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
485
+ 'class': 'bb-form-control',
486
+ '[class.readonly]': 'readonly',
487
+ '[class.required]': 'required',
488
+ '[class.disabled]': 'disabled',
489
+ '[class.focused]': 'focused',
490
+ '[class.grouped]': 'grouped',
491
+ '[class.arrow]': 'arrow',
492
+ '[class.error]': 'error'
493
+ }, inputs: ['grouped', 'hideErrors'], preserveWhitespaces: false, template: "<!-- Label of the form control. -->\n<label *ngIf=\"label as labelContent\"\n [attr.for]=\"labelId\"\n class=\"bb-form-control-label\">\n <ng-template [bbTemplate]=\"labelContent\">\n {{ labelContent }}\n </ng-template>\n</label>\n\n<!-- The input with the addons. -->\n<div class=\"bb-form-control-container\">\n <ng-content select=\"[bbPrefix]\"></ng-content>\n <ng-content select=\"[bbInput]\"></ng-content>\n <ng-content select=\"[bbSuffix]\"></ng-content>\n</div>\n\n<!-- The error component. -->\n<bb-form-error *ngIf=\"!hideErrors\"\n [control]=\"ngControl\"\n (errorChange)=\"onErrorChange($event)\">\n</bb-form-error>\n\n<!-- The form control hint. -->\n<p *ngIf=\"hint as hintContent\"\n class=\"bb-form-control-hint\">\n <ng-template [bbTemplate]=\"hintContent\">\n {{ hintContent }}\n </ng-template>\n</p>\n", styles: [".bb-form-control{color:#2d3c4d;display:block}.bb-form-control>.bb-form-control-container>*.bb-prefix,.bb-form-control>.bb-form-control-container>*.bb-suffix{margin:0 8px;color:#b4b4b4;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control.grouped{margin-bottom:20px}.bb-form-control.small{max-width:240px}.bb-form-control.medium{max-width:480px}.bb-form-control.large{max-width:720px}.bb-form-control.required>.bb-form-control-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bb-form-control.disabled>.bb-form-control-container{cursor:default;pointer-events:none;background-color:#cccccca3}.bb-form-control.disabled>.bb-form-control-container>input,.bb-form-control.disabled>.bb-form-control-container>textarea,.bb-form-control.disabled>.bb-form-control-container>select{color:#aaa}.bb-form-control.readonly>.bb-form-control-container{cursor:default;border:1px dotted #bdc4c9}.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container{background-color:#fff;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #007bff33}.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container>input::placeholder,.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container>textarea::placeholder{color:#b4b4b4;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control.error>.bb-form-control-label{color:#c23934}.bb-form-control.error>.bb-form-control-hint{display:none}.bb-form-control.error>.bb-form-control-container{border:1px solid #962b26;background-color:#c2393440!important;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #c2393466!important}.bb-form-control.error>.bb-form-control-container>*.bb-prefix,.bb-form-control.error>.bb-form-control-container>.bb-suffix{color:#c23934}.bb-form-control.error>.bb-form-control-container>input::placeholder,.bb-form-control.error>.bb-form-control-container>textarea::placeholder{color:#c2393466!important}.bb-form-control.arrow>.bb-form-control-container:after{top:0;right:0;bottom:0;width:20px;content:\"\";height:36px;display:flex;min-width:20px;position:absolute;pointer-events:none;background-repeat:no-repeat;background-position:calc(100% - 8px) center;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAGCAYAAAAYLBS/AAAACXBIWXMAAAsSAAALEgHS3X78AAAAWUlEQVQYlY3QsQ2DMAAEwMMTsAkrZInvWY3WXiIjJJtkA1OBRCIRf/nSffFTrXXGE4uxbCXJBw+8R0CStcAg3JKsUI7mDzzBBd3AC4Cp9/4z21o7znl9A9gBAf4fpjLTwkUAAAAASUVORK5CYII=)}.bb-form-control-container{width:100%;display:flex;overflow:hidden;position:relative;border-radius:3px;align-items:center;border:1px solid #b6bbc1;background-color:#fff8ff;transition-duration:.25s;transition-property:background-color,box-shadow;transition-timing-function:cubic-bezier(0,0,.2,1);box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a}.bb-form-control-container>input::placeholder,.bb-form-control-container>textarea::placeholder{color:#d2d2d2;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control-container>input,.bb-form-control-container>textarea,.bb-form-control-container>select{margin:0;width:100%;border:none;color:#3d464d;font-size:16px;-webkit-appearance:none;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"] }]
494
+ }], propDecorators: { ngControl: [{
495
+ type: ContentChild,
496
+ args: [NgControl]
497
+ }], label: [{
498
+ type: Input
499
+ }], hint: [{
500
+ type: Input
501
501
  }] } });
502
502
 
503
- class BbFileSize {
504
- constructor() {
505
- this.format = (value, decimals = 2) => {
506
- if (value === 0) {
507
- return '0 Bytes';
508
- }
509
- const k = 1024;
510
- const dm = decimals < 0 ? 0 : decimals;
511
- const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
512
- const index = Math.floor(Math.log(value) / Math.log(k));
513
- return parseFloat((value / Math.pow(k, index)).toFixed(dm)) + ' ' + sizes[index];
514
- };
515
- }
516
- transform(value) {
517
- return this.format(value);
518
- }
519
- }
520
- BbFileSize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbFileSize, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
521
- BbFileSize.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.3", ngImport: i0, type: BbFileSize, name: "bbFileSize" });
522
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbFileSize, decorators: [{
523
- type: Pipe,
524
- args: [{
525
- name: 'bbFileSize'
526
- }]
503
+ class BbFileSize {
504
+ constructor() {
505
+ this.format = (value, decimals = 2) => {
506
+ if (value === 0) {
507
+ return '0 Bytes';
508
+ }
509
+ const k = 1024;
510
+ const dm = decimals < 0 ? 0 : decimals;
511
+ const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
512
+ const index = Math.floor(Math.log(value) / Math.log(k));
513
+ return parseFloat((value / Math.pow(k, index)).toFixed(dm)) + ' ' + sizes[index];
514
+ };
515
+ }
516
+ transform(value) {
517
+ return this.format(value);
518
+ }
519
+ }
520
+ BbFileSize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbFileSize, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
521
+ BbFileSize.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.4", ngImport: i0, type: BbFileSize, name: "bbFileSize" });
522
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbFileSize, decorators: [{
523
+ type: Pipe,
524
+ args: [{
525
+ name: 'bbFileSize'
526
+ }]
527
527
  }] });
528
528
 
529
- class BbFileImage {
530
- constructor(_platform, _image, _sanitizer) {
531
- this._platform = _platform;
532
- this._image = _image;
533
- this._sanitizer = _sanitizer;
534
- }
535
- async transform(file) {
536
- // If the file is not a file return.
537
- if (!this._platform.isBrowser || !(file instanceof File)) {
538
- return null;
539
- }
540
- return this._image.fileToImage(file, [
541
- 'image/png',
542
- 'image/jpeg',
543
- 'image/gif',
544
- 'image/svg+xml'
545
- ]).then(image => {
546
- if (!image) {
547
- return null;
548
- }
549
- return {
550
- background: this._sanitizer.bypassSecurityTrustStyle(`url(${image.src})`),
551
- aspectRatio: image.height / image.width
552
- };
553
- }).catch(() => {
554
- return null;
555
- });
556
- }
557
- }
558
- BbFileImage.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbFileImage, deps: [{ token: i1$1.Platform }, { token: i1$1.ImageConverter }, { token: i2$1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
559
- BbFileImage.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.3", ngImport: i0, type: BbFileImage, name: "bbFileImage" });
560
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbFileImage, decorators: [{
561
- type: Pipe,
562
- args: [{
563
- name: 'bbFileImage'
564
- }]
529
+ class BbFileImage {
530
+ constructor(_platform, _image, _sanitizer) {
531
+ this._platform = _platform;
532
+ this._image = _image;
533
+ this._sanitizer = _sanitizer;
534
+ }
535
+ async transform(file) {
536
+ // If the file is not a file return.
537
+ if (!this._platform.isBrowser || !(file instanceof File)) {
538
+ return null;
539
+ }
540
+ return this._image.fileToImage(file, [
541
+ 'image/png',
542
+ 'image/jpeg',
543
+ 'image/gif',
544
+ 'image/svg+xml'
545
+ ]).then(image => {
546
+ if (!image) {
547
+ return null;
548
+ }
549
+ return {
550
+ background: this._sanitizer.bypassSecurityTrustStyle(`url(${image.src})`),
551
+ aspectRatio: image.height / image.width
552
+ };
553
+ }).catch(() => {
554
+ return null;
555
+ });
556
+ }
557
+ }
558
+ BbFileImage.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbFileImage, deps: [{ token: i1$1.Platform }, { token: i1$1.ImageConverter }, { token: i2$1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
559
+ BbFileImage.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.4", ngImport: i0, type: BbFileImage, name: "bbFileImage" });
560
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbFileImage, decorators: [{
561
+ type: Pipe,
562
+ args: [{
563
+ name: 'bbFileImage'
564
+ }]
565
565
  }], ctorParameters: function () { return [{ type: i1$1.Platform }, { type: i1$1.ImageConverter }, { type: i2$1.DomSanitizer }]; } });
566
566
 
567
- let nextUniqueId$1 = 0;
568
- class BbFilePickerBase {
569
- }
570
- const BbFilePickerMixinBase$1 = mixinRequired(mixinDisabled(mixinGrouped(mixinError(mixinHideErrors(BbFilePickerBase)))));
571
- class BbFilePicker extends BbFilePickerMixinBase$1 {
572
- constructor() {
573
- super(...arguments);
574
- // Inputs.
575
- this.label = null;
576
- this.hint = null;
577
- this.accept = null;
578
- this.showImages = true;
579
- this.allowDragging = true;
580
- // State.
581
- this.labelId = `bb-file-picker-${nextUniqueId$1++}`;
582
- this.hovered = false;
583
- this.value$ = new BehaviorSubject({});
584
- this.valueChange = new EventEmitter();
585
- this.onTouchedCallback = () => {
586
- };
587
- this.onChangeCallback = () => {
588
- };
589
- this.saveFile = (files) => {
590
- // Validate the files exist.
591
- if (!files) {
592
- return;
593
- }
594
- // Retrieve the first file.
595
- const file = files[0];
596
- // Validate the first file exists.
597
- if (!file) {
598
- return;
599
- }
600
- // Save the file.
601
- this.value = file;
602
- };
603
- this.getFileListFromEvent = (event) => {
604
- const element = event.target;
605
- if (!element) {
606
- return null;
607
- }
608
- return element.files;
609
- };
610
- this.preventDefault = (event) => {
611
- event.preventDefault();
612
- event.stopPropagation();
613
- };
614
- }
615
- get value() {
616
- const { file } = this.value$.getValue();
617
- return file;
618
- }
619
- set value(value) {
620
- this.value$.next({ file: value });
621
- this.valueChange.emit(value);
622
- }
623
- onDrag(event, isHovered) {
624
- // Validate the input can support drag.
625
- if (!this.allowDragging || this.disabled) {
626
- return;
627
- }
628
- // Prevent the default event action
629
- // and start the hovering.
630
- this.preventDefault(event);
631
- this.hovered = isHovered;
632
- }
633
- onDrop(event) {
634
- // Validate the input can support drag.
635
- if (!this.allowDragging || this.disabled) {
636
- return;
637
- }
638
- // Prevent the default event action
639
- // and stop the hovering.
640
- this.preventDefault(event);
641
- this.hovered = false;
642
- // Save the file.
643
- this.saveFile(event['dataTransfer'].files);
644
- // Run the on change callback.
645
- this.onChangeCallback(this.value);
646
- }
647
- onButtonPressed(file) {
648
- if (file) {
649
- this.value = null;
650
- this.onChangeCallback(this.value);
651
- return;
652
- }
653
- return this.openFilePicker();
654
- }
655
- openFilePicker() {
656
- return this.fileInput
657
- && this.fileInput.nativeElement
658
- && this.fileInput.nativeElement.click
659
- && this.fileInput.nativeElement.click();
660
- }
661
- onFileChange(event) {
662
- // Validate the input is not disabled.
663
- if (this.disabled) {
664
- return;
665
- }
666
- // Extract the file from the event.
667
- const fileList = this.getFileListFromEvent(event);
668
- // Save the file.
669
- this.saveFile(fileList);
670
- // Run the on change callback.
671
- this.onChangeCallback(this.value);
672
- // Clear the file input.
673
- if (this.fileInput && this.fileInput.nativeElement) {
674
- this.fileInput.nativeElement.value = '';
675
- }
676
- }
677
- writeValue(value) {
678
- this.value = value;
679
- }
680
- registerOnChange(method) {
681
- this.onChangeCallback = method;
682
- }
683
- registerOnTouched(method) {
684
- this.onTouchedCallback = method;
685
- }
686
- setDisabledState(isDisabled) {
687
- this.disabled = isDisabled;
688
- }
689
- onErrorChange(error) {
690
- this.error = !!error;
691
- }
692
- validate({ value }) {
693
- if (value === null || value === undefined) {
694
- return null;
695
- }
696
- const regexString = (this.accept || '*')
697
- .replace(/\*/g, '.\*')
698
- .replace(/,/g, '|');
699
- const mimeTypeRegex = new RegExp(regexString);
700
- const isNotValid = (typeof File === 'undefined') || !(value instanceof File) || !mimeTypeRegex.test(value?.type);
701
- return isNotValid && {
702
- invalidFileType: true
703
- };
704
- }
705
- }
706
- BbFilePicker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbFilePicker, deps: null, target: i0.ɵɵFactoryTarget.Component });
707
- BbFilePicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.3", 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: [
708
- {
709
- provide: NG_VALUE_ACCESSOR,
710
- useExisting: forwardRef(() => BbFilePicker),
711
- multi: true
712
- },
713
- {
714
- provide: NG_VALIDATORS,
715
- useExisting: BbFilePicker,
716
- multi: true
717
- }
718
- ], queries: [{ propertyName: "extraTemplate", first: true, predicate: ["extra"], descendants: true }], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<!-- The label of the input. -->\r\n<label *ngIf=\"label as labelContent\"\r\n [for]=\"labelId\"\r\n class=\"bb-file-picker-label\">\r\n <ng-template [bbTemplate]=\"labelContent\">\r\n {{ labelContent }}\r\n </ng-template>\r\n</label>\r\n\r\n<!-- The input that can open the file picker. -->\r\n<input #fileInput\r\n [accept]=\"accept\"\r\n [disabled]=\"disabled\"\r\n (change)=\"onFileChange($event)\"\r\n class=\"bb-file-picker-input\"\r\n type=\"file\"\r\n tabindex=\"-1\">\r\n\r\n<div *ngIf=\"value$ | async as data\"\r\n class=\"bb-file-picker-wrapper\">\r\n <!-- The button that accepts files. -->\r\n <div class=\"bb-file-picker-container\">\r\n <button [class.destructive]=\"!!data?.file\"\r\n [class.standalone]=\"!allowDragging\"\r\n [disabled]=\"disabled\"\r\n [id]=\"labelId\"\r\n (click)=\"onButtonPressed(data?.file)\"\r\n type=\"button\"\r\n class=\"bb-file-picker-button\">\r\n <ng-container *ngTemplateOutlet=\"data?.file ? closeIcon : uploadIcon\"></ng-container>\r\n {{ (data?.file ? 'file-picker.remove' : 'file-picker.choose') | bbLocalize }}\r\n </button>\r\n <div *ngIf=\"allowDragging\"\r\n class=\"bb-file-picker-zone\">\r\n {{ 'file-picker.drop' | bbLocalize }}\r\n </div>\r\n </div>\r\n\r\n <ng-container *ngIf=\"!!extraTemplate\">\r\n <ng-container *ngTemplateOutlet=\"extraTemplate; context: {$implicit: data?.file}\"></ng-container>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"showImages\">\r\n <div *ngIf=\"data?.file | bbFileImage | async as image\"\r\n class=\"bb-file-picker-image-container\">\r\n <div class=\"bb-file-picker-image-wrapper\">\r\n <div [@bbFilePickerImageAnimation]=\"true\"\r\n [style.padding-top.%]=\"image?.aspectRatio * 100\"\r\n [style.background-image]=\"image?.background\"\r\n class=\"bb-file-picker-image\">\r\n </div>\r\n </div>\r\n </div>\r\n </ng-container>\r\n\r\n <!-- Extra information of the file. -->\r\n <div [class.visible]=\"!!data?.file\"\r\n class=\"bb-file-picker-info\">\r\n <span *ngIf=\"data?.file?.name as name\">{{ name }}</span>\r\n <span *ngIf=\"data?.file?.size as size\">{{ size | bbFileSize }}</span>\r\n </div>\r\n</div>\r\n\r\n<bb-form-error *ngIf=\"!hideErrors\"\r\n (errorChange)=\"onErrorChange($event)\">\r\n</bb-form-error>\r\n\r\n<!-- The file picker hint. -->\r\n<p *ngIf=\"hint as hintContent\"\r\n class=\"bb-file-picker-hint\">\r\n <ng-template [bbTemplate]=\"hintContent\">\r\n {{ hintContent }}\r\n </ng-template>\r\n</p>\r\n\r\n<!-- Upload icon. -->\r\n<ng-template #uploadIcon>\r\n <svg xmlns=\"http://www.w3.org/2000/svg\"\r\n class=\"bb-file-picker-icon\"\r\n width=\"24\"\r\n height=\"24\">\r\n <path fill=\"currentColor\"\r\n d=\"M2 12.5C2 9.46 4.46 7 7.5 7H18c2.21 0 4 1.79 4 4s-1.79 4-4 4H9.5a2.5 2.5 0 010-5H17v2H9.41c-.55 0-.55 1 0 1H18c1.1 0 2-.9 2-2s-.9-2-2-2H7.5C5.57 9 4 10.57 4 12.5S5.57 16 7.5 16H17v2H7.5C4.46 18 2 15.54 2 12.5z\"></path>\r\n <path fill=\"none\" d=\"M0 0h24v24H0V0z\"></path>\r\n </svg>\r\n</ng-template>\r\n\r\n<!-- Close icon. -->\r\n<ng-template #closeIcon>\r\n <svg xmlns=\"http://www.w3.org/2000/svg\"\r\n class=\"bb-file-picker-icon\"\r\n width=\"24\"\r\n height=\"24\">\r\n <path fill=\"currentColor\"\r\n d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\"></path>\r\n <path d=\"M0 0h24v24H0z\" fill=\"none\"></path>\r\n </svg>\r\n</ng-template>\r\n", styles: [".bb-file-picker{display:block}.bb-file-picker.disabled>.bb-file-picker-wrapper{cursor:default;background-color:#cccccca3}.bb-file-picker.grouped{margin-bottom:20px}.bb-file-picker.full>.bb-file-picker-wrapper{width:100%}.bb-file-picker:not(.disabled) .bb-file-picker-button{background-color:#fff}.bb-file-picker:not(.disabled):focus>.bb-file-picker-wrapper,.bb-file-picker:not(.disabled).hovered>.bb-file-picker-wrapper{box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #007bff33}.bb-file-picker.required>.bb-file-picker-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bb-file-picker.error>.bb-file-picker-label{color:#c23934}.bb-file-picker.error>.bb-file-picker-hint{display:none}.bb-file-picker.error>.bb-file-picker-wrapper{border:1px solid #962b26;background-color:#c2393440!important;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #c2393466!important}.bb-file-picker.error .bb-file-picker-button{background-color:transparent}.bb-file-picker-wrapper{max-width:100%;-webkit-user-select:none;user-select:none;border-radius:3px;display:inline-flex;flex-direction:column;border:1px solid #b6bbc1;background-color:#fff8ff;transition:box-shadow .2s cubic-bezier(0,0,.2,1);box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a}.bb-file-picker-label{color:#000;display:block;position:relative;margin-bottom:4px}.bb-file-picker-input{opacity:0;z-index:-1;width:.1px;height:.1px;overflow:hidden;position:absolute}.bb-file-picker-container{min-height:38px;display:inline-flex}.bb-file-picker-button{margin:0;z-index:1;border:none;color:#2196f3;line-height:1;cursor:pointer;padding:0 12px;-webkit-appearance:none;appearance:none;font-weight:500;align-items:center;white-space:nowrap;display:inline-flex;border-top-left-radius:3px;border-bottom-left-radius:3px;border-right:1px solid #b6bbc1;background-color:#ffffff80;transition:box-shadow .2s cubic-bezier(0,0,.2,1)}.bb-file-picker-button:focus{box-shadow:0 0 0 3px #007bff33}.bb-file-picker-button:disabled{cursor:default}.bb-file-picker-button.destructive{color:#f55656}.bb-file-picker-button.standalone{width:100%;border-right:none;border-top-right-radius:3px;border-bottom-right-radius:3px}.bb-file-picker-icon{margin-right:4px}.bb-file-picker-zone{flex:1;color:#848f99;font-size:14px;padding:8px 12px;line-height:18px;align-items:center;display:inline-flex;justify-content:center}.bb-file-picker-info{height:0;color:#848f99;padding:0 12px;overflow:hidden;line-height:36px;align-items:center;display:inline-flex;background-color:#fff8ff;border-top:0 solid #b6bbc1;transition:height .2s cubic-bezier(0,0,.2,1)}.bb-file-picker-info.visible{height:38px;border-top-width:1px}.bb-file-picker-info>span{opacity:.4;max-width:100%;font-size:14px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.bb-file-picker-info>span:first-child{flex:1}.bb-file-picker-info>span:last-child{margin-left:12px}.bb-file-picker-image-container{overflow:hidden;border-top:1px solid #b6bbc1}.bb-file-picker-image-wrapper{width:100%;max-width:40%;margin:20px auto}.bb-file-picker-image{width:100%;display:flex;overflow:hidden;position:relative;border-radius:4px;will-change:opacity;background-size:cover;background-position:center;background-repeat:no-repeat}.bb-file-picker-hint{display:block;color:#738694;font-size:13px;margin-top:4px}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: BbTemplate, selector: "[bbTemplate]", inputs: ["bbTemplate"] }, { kind: "component", type: BbFormError, selector: "bb-form-error", inputs: ["control"], outputs: ["errorChange"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.BbLocalize, name: "bbLocalize" }, { kind: "pipe", type: BbFileSize, name: "bbFileSize" }, { kind: "pipe", type: BbFileImage, name: "bbFileImage" }], animations: [
719
- trigger('bbFilePickerImageAnimation', [
720
- transition(':enter', [
721
- style({ opacity: 0 }),
722
- animate('200ms', style({ opacity: 1 }))
723
- ]),
724
- transition(':leave', [
725
- animate('200ms', style({ opacity: 0 }))
726
- ])
727
- ])
728
- ], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
729
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbFilePicker, decorators: [{
730
- type: Component,
731
- args: [{ selector: 'bb-file-picker', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
732
- {
733
- provide: NG_VALUE_ACCESSOR,
734
- useExisting: forwardRef(() => BbFilePicker),
735
- multi: true
736
- },
737
- {
738
- provide: NG_VALIDATORS,
739
- useExisting: BbFilePicker,
740
- multi: true
741
- }
742
- ], host: {
743
- 'class': 'bb-file-picker',
744
- '[class.required]': 'required',
745
- '[class.disabled]': 'disabled',
746
- '[class.grouped]': 'grouped',
747
- '[class.hovered]': 'hovered',
748
- '[class.error]': 'error'
749
- }, animations: [
750
- trigger('bbFilePickerImageAnimation', [
751
- transition(':enter', [
752
- style({ opacity: 0 }),
753
- animate('200ms', style({ opacity: 1 }))
754
- ]),
755
- transition(':leave', [
756
- animate('200ms', style({ opacity: 0 }))
757
- ])
758
- ])
759
- ], inputs: ['disabled', 'hideErrors', 'grouped', 'required'], preserveWhitespaces: false, template: "<!-- The label of the input. -->\r\n<label *ngIf=\"label as labelContent\"\r\n [for]=\"labelId\"\r\n class=\"bb-file-picker-label\">\r\n <ng-template [bbTemplate]=\"labelContent\">\r\n {{ labelContent }}\r\n </ng-template>\r\n</label>\r\n\r\n<!-- The input that can open the file picker. -->\r\n<input #fileInput\r\n [accept]=\"accept\"\r\n [disabled]=\"disabled\"\r\n (change)=\"onFileChange($event)\"\r\n class=\"bb-file-picker-input\"\r\n type=\"file\"\r\n tabindex=\"-1\">\r\n\r\n<div *ngIf=\"value$ | async as data\"\r\n class=\"bb-file-picker-wrapper\">\r\n <!-- The button that accepts files. -->\r\n <div class=\"bb-file-picker-container\">\r\n <button [class.destructive]=\"!!data?.file\"\r\n [class.standalone]=\"!allowDragging\"\r\n [disabled]=\"disabled\"\r\n [id]=\"labelId\"\r\n (click)=\"onButtonPressed(data?.file)\"\r\n type=\"button\"\r\n class=\"bb-file-picker-button\">\r\n <ng-container *ngTemplateOutlet=\"data?.file ? closeIcon : uploadIcon\"></ng-container>\r\n {{ (data?.file ? 'file-picker.remove' : 'file-picker.choose') | bbLocalize }}\r\n </button>\r\n <div *ngIf=\"allowDragging\"\r\n class=\"bb-file-picker-zone\">\r\n {{ 'file-picker.drop' | bbLocalize }}\r\n </div>\r\n </div>\r\n\r\n <ng-container *ngIf=\"!!extraTemplate\">\r\n <ng-container *ngTemplateOutlet=\"extraTemplate; context: {$implicit: data?.file}\"></ng-container>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"showImages\">\r\n <div *ngIf=\"data?.file | bbFileImage | async as image\"\r\n class=\"bb-file-picker-image-container\">\r\n <div class=\"bb-file-picker-image-wrapper\">\r\n <div [@bbFilePickerImageAnimation]=\"true\"\r\n [style.padding-top.%]=\"image?.aspectRatio * 100\"\r\n [style.background-image]=\"image?.background\"\r\n class=\"bb-file-picker-image\">\r\n </div>\r\n </div>\r\n </div>\r\n </ng-container>\r\n\r\n <!-- Extra information of the file. -->\r\n <div [class.visible]=\"!!data?.file\"\r\n class=\"bb-file-picker-info\">\r\n <span *ngIf=\"data?.file?.name as name\">{{ name }}</span>\r\n <span *ngIf=\"data?.file?.size as size\">{{ size | bbFileSize }}</span>\r\n </div>\r\n</div>\r\n\r\n<bb-form-error *ngIf=\"!hideErrors\"\r\n (errorChange)=\"onErrorChange($event)\">\r\n</bb-form-error>\r\n\r\n<!-- The file picker hint. -->\r\n<p *ngIf=\"hint as hintContent\"\r\n class=\"bb-file-picker-hint\">\r\n <ng-template [bbTemplate]=\"hintContent\">\r\n {{ hintContent }}\r\n </ng-template>\r\n</p>\r\n\r\n<!-- Upload icon. -->\r\n<ng-template #uploadIcon>\r\n <svg xmlns=\"http://www.w3.org/2000/svg\"\r\n class=\"bb-file-picker-icon\"\r\n width=\"24\"\r\n height=\"24\">\r\n <path fill=\"currentColor\"\r\n d=\"M2 12.5C2 9.46 4.46 7 7.5 7H18c2.21 0 4 1.79 4 4s-1.79 4-4 4H9.5a2.5 2.5 0 010-5H17v2H9.41c-.55 0-.55 1 0 1H18c1.1 0 2-.9 2-2s-.9-2-2-2H7.5C5.57 9 4 10.57 4 12.5S5.57 16 7.5 16H17v2H7.5C4.46 18 2 15.54 2 12.5z\"></path>\r\n <path fill=\"none\" d=\"M0 0h24v24H0V0z\"></path>\r\n </svg>\r\n</ng-template>\r\n\r\n<!-- Close icon. -->\r\n<ng-template #closeIcon>\r\n <svg xmlns=\"http://www.w3.org/2000/svg\"\r\n class=\"bb-file-picker-icon\"\r\n width=\"24\"\r\n height=\"24\">\r\n <path fill=\"currentColor\"\r\n d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\"></path>\r\n <path d=\"M0 0h24v24H0z\" fill=\"none\"></path>\r\n </svg>\r\n</ng-template>\r\n", styles: [".bb-file-picker{display:block}.bb-file-picker.disabled>.bb-file-picker-wrapper{cursor:default;background-color:#cccccca3}.bb-file-picker.grouped{margin-bottom:20px}.bb-file-picker.full>.bb-file-picker-wrapper{width:100%}.bb-file-picker:not(.disabled) .bb-file-picker-button{background-color:#fff}.bb-file-picker:not(.disabled):focus>.bb-file-picker-wrapper,.bb-file-picker:not(.disabled).hovered>.bb-file-picker-wrapper{box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #007bff33}.bb-file-picker.required>.bb-file-picker-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bb-file-picker.error>.bb-file-picker-label{color:#c23934}.bb-file-picker.error>.bb-file-picker-hint{display:none}.bb-file-picker.error>.bb-file-picker-wrapper{border:1px solid #962b26;background-color:#c2393440!important;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #c2393466!important}.bb-file-picker.error .bb-file-picker-button{background-color:transparent}.bb-file-picker-wrapper{max-width:100%;-webkit-user-select:none;user-select:none;border-radius:3px;display:inline-flex;flex-direction:column;border:1px solid #b6bbc1;background-color:#fff8ff;transition:box-shadow .2s cubic-bezier(0,0,.2,1);box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a}.bb-file-picker-label{color:#000;display:block;position:relative;margin-bottom:4px}.bb-file-picker-input{opacity:0;z-index:-1;width:.1px;height:.1px;overflow:hidden;position:absolute}.bb-file-picker-container{min-height:38px;display:inline-flex}.bb-file-picker-button{margin:0;z-index:1;border:none;color:#2196f3;line-height:1;cursor:pointer;padding:0 12px;-webkit-appearance:none;appearance:none;font-weight:500;align-items:center;white-space:nowrap;display:inline-flex;border-top-left-radius:3px;border-bottom-left-radius:3px;border-right:1px solid #b6bbc1;background-color:#ffffff80;transition:box-shadow .2s cubic-bezier(0,0,.2,1)}.bb-file-picker-button:focus{box-shadow:0 0 0 3px #007bff33}.bb-file-picker-button:disabled{cursor:default}.bb-file-picker-button.destructive{color:#f55656}.bb-file-picker-button.standalone{width:100%;border-right:none;border-top-right-radius:3px;border-bottom-right-radius:3px}.bb-file-picker-icon{margin-right:4px}.bb-file-picker-zone{flex:1;color:#848f99;font-size:14px;padding:8px 12px;line-height:18px;align-items:center;display:inline-flex;justify-content:center}.bb-file-picker-info{height:0;color:#848f99;padding:0 12px;overflow:hidden;line-height:36px;align-items:center;display:inline-flex;background-color:#fff8ff;border-top:0 solid #b6bbc1;transition:height .2s cubic-bezier(0,0,.2,1)}.bb-file-picker-info.visible{height:38px;border-top-width:1px}.bb-file-picker-info>span{opacity:.4;max-width:100%;font-size:14px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.bb-file-picker-info>span:first-child{flex:1}.bb-file-picker-info>span:last-child{margin-left:12px}.bb-file-picker-image-container{overflow:hidden;border-top:1px solid #b6bbc1}.bb-file-picker-image-wrapper{width:100%;max-width:40%;margin:20px auto}.bb-file-picker-image{width:100%;display:flex;overflow:hidden;position:relative;border-radius:4px;will-change:opacity;background-size:cover;background-position:center;background-repeat:no-repeat}.bb-file-picker-hint{display:block;color:#738694;font-size:13px;margin-top:4px}\n"] }]
760
- }], propDecorators: { fileInput: [{
761
- type: ViewChild,
762
- args: ['fileInput', { static: true }]
763
- }], extraTemplate: [{
764
- type: ContentChild,
765
- args: ['extra']
766
- }], label: [{
767
- type: Input
768
- }], hint: [{
769
- type: Input
770
- }], accept: [{
771
- type: Input
772
- }], showImages: [{
773
- type: Input
774
- }], allowDragging: [{
775
- type: Input
776
- }], value: [{
777
- type: Input
778
- }], valueChange: [{
779
- type: Output
780
- }], onDrag: [{
781
- type: HostListener,
782
- args: ['dragover', ['$event', 'true']]
783
- }, {
784
- type: HostListener,
785
- args: ['dragleave', ['$event', 'false']]
786
- }], onDrop: [{
787
- type: HostListener,
788
- args: ['drop', ['$event']]
567
+ let nextUniqueId$1 = 0;
568
+ class BbFilePickerBase {
569
+ }
570
+ const BbFilePickerMixinBase$1 = mixinRequired(mixinDisabled(mixinGrouped(mixinError(mixinHideErrors(BbFilePickerBase)))));
571
+ class BbFilePicker extends BbFilePickerMixinBase$1 {
572
+ constructor() {
573
+ super(...arguments);
574
+ // Inputs.
575
+ this.label = null;
576
+ this.hint = null;
577
+ this.accept = null;
578
+ this.showImages = true;
579
+ this.allowDragging = true;
580
+ // State.
581
+ this.labelId = `bb-file-picker-${nextUniqueId$1++}`;
582
+ this.hovered = false;
583
+ this.value$ = new BehaviorSubject({});
584
+ this.valueChange = new EventEmitter();
585
+ this.onTouchedCallback = () => {
586
+ };
587
+ this.onChangeCallback = () => {
588
+ };
589
+ this.saveFile = (files) => {
590
+ // Validate the files exist.
591
+ if (!files) {
592
+ return;
593
+ }
594
+ // Retrieve the first file.
595
+ const file = files[0];
596
+ // Validate the first file exists.
597
+ if (!file) {
598
+ return;
599
+ }
600
+ // Save the file.
601
+ this.value = file;
602
+ };
603
+ this.getFileListFromEvent = (event) => {
604
+ const element = event.target;
605
+ if (!element) {
606
+ return null;
607
+ }
608
+ return element.files;
609
+ };
610
+ this.preventDefault = (event) => {
611
+ event.preventDefault();
612
+ event.stopPropagation();
613
+ };
614
+ }
615
+ get value() {
616
+ const { file } = this.value$.getValue();
617
+ return file;
618
+ }
619
+ set value(value) {
620
+ this.value$.next({ file: value });
621
+ this.valueChange.emit(value);
622
+ }
623
+ onDrag(event, isHovered) {
624
+ // Validate the input can support drag.
625
+ if (!this.allowDragging || this.disabled) {
626
+ return;
627
+ }
628
+ // Prevent the default event action
629
+ // and start the hovering.
630
+ this.preventDefault(event);
631
+ this.hovered = isHovered;
632
+ }
633
+ onDrop(event) {
634
+ // Validate the input can support drag.
635
+ if (!this.allowDragging || this.disabled) {
636
+ return;
637
+ }
638
+ // Prevent the default event action
639
+ // and stop the hovering.
640
+ this.preventDefault(event);
641
+ this.hovered = false;
642
+ // Save the file.
643
+ this.saveFile(event['dataTransfer'].files);
644
+ // Run the on change callback.
645
+ this.onChangeCallback(this.value);
646
+ }
647
+ onButtonPressed(file) {
648
+ if (file) {
649
+ this.value = null;
650
+ this.onChangeCallback(this.value);
651
+ return;
652
+ }
653
+ return this.openFilePicker();
654
+ }
655
+ openFilePicker() {
656
+ return this.fileInput
657
+ && this.fileInput.nativeElement
658
+ && this.fileInput.nativeElement.click
659
+ && this.fileInput.nativeElement.click();
660
+ }
661
+ onFileChange(event) {
662
+ // Validate the input is not disabled.
663
+ if (this.disabled) {
664
+ return;
665
+ }
666
+ // Extract the file from the event.
667
+ const fileList = this.getFileListFromEvent(event);
668
+ // Save the file.
669
+ this.saveFile(fileList);
670
+ // Run the on change callback.
671
+ this.onChangeCallback(this.value);
672
+ // Clear the file input.
673
+ if (this.fileInput && this.fileInput.nativeElement) {
674
+ this.fileInput.nativeElement.value = '';
675
+ }
676
+ }
677
+ writeValue(value) {
678
+ this.value = value;
679
+ }
680
+ registerOnChange(method) {
681
+ this.onChangeCallback = method;
682
+ }
683
+ registerOnTouched(method) {
684
+ this.onTouchedCallback = method;
685
+ }
686
+ setDisabledState(isDisabled) {
687
+ this.disabled = isDisabled;
688
+ }
689
+ onErrorChange(error) {
690
+ this.error = !!error;
691
+ }
692
+ validate({ value }) {
693
+ if (value === null || value === undefined) {
694
+ return null;
695
+ }
696
+ const regexString = (this.accept || '*')
697
+ .replace(/\*/g, '.\*')
698
+ .replace(/,/g, '|');
699
+ const mimeTypeRegex = new RegExp(regexString);
700
+ const isNotValid = (typeof File === 'undefined') || !(value instanceof File) || !mimeTypeRegex.test(value?.type);
701
+ return isNotValid && {
702
+ invalidFileType: true
703
+ };
704
+ }
705
+ }
706
+ BbFilePicker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbFilePicker, deps: null, target: i0.ɵɵFactoryTarget.Component });
707
+ BbFilePicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.4", 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: [
708
+ {
709
+ provide: NG_VALUE_ACCESSOR,
710
+ useExisting: forwardRef(() => BbFilePicker),
711
+ multi: true
712
+ },
713
+ {
714
+ provide: NG_VALIDATORS,
715
+ useExisting: BbFilePicker,
716
+ multi: true
717
+ }
718
+ ], queries: [{ propertyName: "extraTemplate", first: true, predicate: ["extra"], descendants: true }], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<!-- The label of the input. -->\n<label *ngIf=\"label as labelContent\"\n [for]=\"labelId\"\n class=\"bb-file-picker-label\">\n <ng-template [bbTemplate]=\"labelContent\">\n {{ labelContent }}\n </ng-template>\n</label>\n\n<!-- The input that can open the file picker. -->\n<input #fileInput\n [accept]=\"accept\"\n [disabled]=\"disabled\"\n (change)=\"onFileChange($event)\"\n class=\"bb-file-picker-input\"\n type=\"file\"\n tabindex=\"-1\">\n\n<div *ngIf=\"value$ | async as data\"\n class=\"bb-file-picker-wrapper\">\n <!-- The button that accepts files. -->\n <div class=\"bb-file-picker-container\">\n <button [class.destructive]=\"!!data?.file\"\n [class.standalone]=\"!allowDragging\"\n [disabled]=\"disabled\"\n [id]=\"labelId\"\n (click)=\"onButtonPressed(data?.file)\"\n type=\"button\"\n class=\"bb-file-picker-button\">\n <ng-container *ngTemplateOutlet=\"data?.file ? closeIcon : uploadIcon\"></ng-container>\n {{ (data?.file ? 'file-picker.remove' : 'file-picker.choose') | bbLocalize }}\n </button>\n <div *ngIf=\"allowDragging\"\n class=\"bb-file-picker-zone\">\n {{ 'file-picker.drop' | bbLocalize }}\n </div>\n </div>\n\n <ng-container *ngIf=\"!!extraTemplate\">\n <ng-container *ngTemplateOutlet=\"extraTemplate; context: {$implicit: data?.file}\"></ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"showImages\">\n <div *ngIf=\"data?.file | bbFileImage | async as image\"\n class=\"bb-file-picker-image-container\">\n <div class=\"bb-file-picker-image-wrapper\">\n <div [@bbFilePickerImageAnimation]=\"true\"\n [style.padding-top.%]=\"image?.aspectRatio * 100\"\n [style.background-image]=\"image?.background\"\n class=\"bb-file-picker-image\">\n </div>\n </div>\n </div>\n </ng-container>\n\n <!-- Extra information of the file. -->\n <div [class.visible]=\"!!data?.file\"\n class=\"bb-file-picker-info\">\n <span *ngIf=\"data?.file?.name as name\">{{ name }}</span>\n <span *ngIf=\"data?.file?.size as size\">{{ size | bbFileSize }}</span>\n </div>\n</div>\n\n<bb-form-error *ngIf=\"!hideErrors\"\n (errorChange)=\"onErrorChange($event)\">\n</bb-form-error>\n\n<!-- The file picker hint. -->\n<p *ngIf=\"hint as hintContent\"\n class=\"bb-file-picker-hint\">\n <ng-template [bbTemplate]=\"hintContent\">\n {{ hintContent }}\n </ng-template>\n</p>\n\n<!-- Upload icon. -->\n<ng-template #uploadIcon>\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n class=\"bb-file-picker-icon\"\n width=\"24\"\n height=\"24\">\n <path fill=\"currentColor\"\n d=\"M2 12.5C2 9.46 4.46 7 7.5 7H18c2.21 0 4 1.79 4 4s-1.79 4-4 4H9.5a2.5 2.5 0 010-5H17v2H9.41c-.55 0-.55 1 0 1H18c1.1 0 2-.9 2-2s-.9-2-2-2H7.5C5.57 9 4 10.57 4 12.5S5.57 16 7.5 16H17v2H7.5C4.46 18 2 15.54 2 12.5z\"></path>\n <path fill=\"none\" d=\"M0 0h24v24H0V0z\"></path>\n </svg>\n</ng-template>\n\n<!-- Close icon. -->\n<ng-template #closeIcon>\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n class=\"bb-file-picker-icon\"\n width=\"24\"\n height=\"24\">\n <path fill=\"currentColor\"\n d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\"></path>\n <path d=\"M0 0h24v24H0z\" fill=\"none\"></path>\n </svg>\n</ng-template>\n", styles: [".bb-file-picker{display:block}.bb-file-picker.disabled>.bb-file-picker-wrapper{cursor:default;background-color:#cccccca3}.bb-file-picker.grouped{margin-bottom:20px}.bb-file-picker.full>.bb-file-picker-wrapper{width:100%}.bb-file-picker:not(.disabled) .bb-file-picker-button{background-color:#fff}.bb-file-picker:not(.disabled):focus>.bb-file-picker-wrapper,.bb-file-picker:not(.disabled).hovered>.bb-file-picker-wrapper{box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #007bff33}.bb-file-picker.required>.bb-file-picker-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bb-file-picker.error>.bb-file-picker-label{color:#c23934}.bb-file-picker.error>.bb-file-picker-hint{display:none}.bb-file-picker.error>.bb-file-picker-wrapper{border:1px solid #962b26;background-color:#c2393440!important;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #c2393466!important}.bb-file-picker.error .bb-file-picker-button{background-color:transparent}.bb-file-picker-wrapper{max-width:100%;-webkit-user-select:none;user-select:none;border-radius:3px;display:inline-flex;flex-direction:column;border:1px solid #b6bbc1;background-color:#fff8ff;transition:box-shadow .2s cubic-bezier(0,0,.2,1);box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a}.bb-file-picker-label{color:#000;display:block;position:relative;margin-bottom:4px}.bb-file-picker-input{opacity:0;z-index:-1;width:.1px;height:.1px;overflow:hidden;position:absolute}.bb-file-picker-container{min-height:38px;display:inline-flex}.bb-file-picker-button{margin:0;z-index:1;border:none;color:#2196f3;line-height:1;cursor:pointer;padding:0 12px;-webkit-appearance:none;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"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: BbTemplate, selector: "[bbTemplate]", inputs: ["bbTemplate"] }, { kind: "component", type: BbFormError, selector: "bb-form-error", inputs: ["control"], outputs: ["errorChange"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.BbLocalize, name: "bbLocalize" }, { kind: "pipe", type: BbFileSize, name: "bbFileSize" }, { kind: "pipe", type: BbFileImage, name: "bbFileImage" }], animations: [
719
+ trigger('bbFilePickerImageAnimation', [
720
+ transition(':enter', [
721
+ style({ opacity: 0 }),
722
+ animate('200ms', style({ opacity: 1 }))
723
+ ]),
724
+ transition(':leave', [
725
+ animate('200ms', style({ opacity: 0 }))
726
+ ])
727
+ ])
728
+ ], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
729
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbFilePicker, decorators: [{
730
+ type: Component,
731
+ args: [{ selector: 'bb-file-picker', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
732
+ {
733
+ provide: NG_VALUE_ACCESSOR,
734
+ useExisting: forwardRef(() => BbFilePicker),
735
+ multi: true
736
+ },
737
+ {
738
+ provide: NG_VALIDATORS,
739
+ useExisting: BbFilePicker,
740
+ multi: true
741
+ }
742
+ ], host: {
743
+ 'class': 'bb-file-picker',
744
+ '[class.required]': 'required',
745
+ '[class.disabled]': 'disabled',
746
+ '[class.grouped]': 'grouped',
747
+ '[class.hovered]': 'hovered',
748
+ '[class.error]': 'error'
749
+ }, animations: [
750
+ trigger('bbFilePickerImageAnimation', [
751
+ transition(':enter', [
752
+ style({ opacity: 0 }),
753
+ animate('200ms', style({ opacity: 1 }))
754
+ ]),
755
+ transition(':leave', [
756
+ animate('200ms', style({ opacity: 0 }))
757
+ ])
758
+ ])
759
+ ], inputs: ['disabled', 'hideErrors', 'grouped', 'required'], preserveWhitespaces: false, template: "<!-- The label of the input. -->\n<label *ngIf=\"label as labelContent\"\n [for]=\"labelId\"\n class=\"bb-file-picker-label\">\n <ng-template [bbTemplate]=\"labelContent\">\n {{ labelContent }}\n </ng-template>\n</label>\n\n<!-- The input that can open the file picker. -->\n<input #fileInput\n [accept]=\"accept\"\n [disabled]=\"disabled\"\n (change)=\"onFileChange($event)\"\n class=\"bb-file-picker-input\"\n type=\"file\"\n tabindex=\"-1\">\n\n<div *ngIf=\"value$ | async as data\"\n class=\"bb-file-picker-wrapper\">\n <!-- The button that accepts files. -->\n <div class=\"bb-file-picker-container\">\n <button [class.destructive]=\"!!data?.file\"\n [class.standalone]=\"!allowDragging\"\n [disabled]=\"disabled\"\n [id]=\"labelId\"\n (click)=\"onButtonPressed(data?.file)\"\n type=\"button\"\n class=\"bb-file-picker-button\">\n <ng-container *ngTemplateOutlet=\"data?.file ? closeIcon : uploadIcon\"></ng-container>\n {{ (data?.file ? 'file-picker.remove' : 'file-picker.choose') | bbLocalize }}\n </button>\n <div *ngIf=\"allowDragging\"\n class=\"bb-file-picker-zone\">\n {{ 'file-picker.drop' | bbLocalize }}\n </div>\n </div>\n\n <ng-container *ngIf=\"!!extraTemplate\">\n <ng-container *ngTemplateOutlet=\"extraTemplate; context: {$implicit: data?.file}\"></ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"showImages\">\n <div *ngIf=\"data?.file | bbFileImage | async as image\"\n class=\"bb-file-picker-image-container\">\n <div class=\"bb-file-picker-image-wrapper\">\n <div [@bbFilePickerImageAnimation]=\"true\"\n [style.padding-top.%]=\"image?.aspectRatio * 100\"\n [style.background-image]=\"image?.background\"\n class=\"bb-file-picker-image\">\n </div>\n </div>\n </div>\n </ng-container>\n\n <!-- Extra information of the file. -->\n <div [class.visible]=\"!!data?.file\"\n class=\"bb-file-picker-info\">\n <span *ngIf=\"data?.file?.name as name\">{{ name }}</span>\n <span *ngIf=\"data?.file?.size as size\">{{ size | bbFileSize }}</span>\n </div>\n</div>\n\n<bb-form-error *ngIf=\"!hideErrors\"\n (errorChange)=\"onErrorChange($event)\">\n</bb-form-error>\n\n<!-- The file picker hint. -->\n<p *ngIf=\"hint as hintContent\"\n class=\"bb-file-picker-hint\">\n <ng-template [bbTemplate]=\"hintContent\">\n {{ hintContent }}\n </ng-template>\n</p>\n\n<!-- Upload icon. -->\n<ng-template #uploadIcon>\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n class=\"bb-file-picker-icon\"\n width=\"24\"\n height=\"24\">\n <path fill=\"currentColor\"\n d=\"M2 12.5C2 9.46 4.46 7 7.5 7H18c2.21 0 4 1.79 4 4s-1.79 4-4 4H9.5a2.5 2.5 0 010-5H17v2H9.41c-.55 0-.55 1 0 1H18c1.1 0 2-.9 2-2s-.9-2-2-2H7.5C5.57 9 4 10.57 4 12.5S5.57 16 7.5 16H17v2H7.5C4.46 18 2 15.54 2 12.5z\"></path>\n <path fill=\"none\" d=\"M0 0h24v24H0V0z\"></path>\n </svg>\n</ng-template>\n\n<!-- Close icon. -->\n<ng-template #closeIcon>\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n class=\"bb-file-picker-icon\"\n width=\"24\"\n height=\"24\">\n <path fill=\"currentColor\"\n d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\"></path>\n <path d=\"M0 0h24v24H0z\" fill=\"none\"></path>\n </svg>\n</ng-template>\n", styles: [".bb-file-picker{display:block}.bb-file-picker.disabled>.bb-file-picker-wrapper{cursor:default;background-color:#cccccca3}.bb-file-picker.grouped{margin-bottom:20px}.bb-file-picker.full>.bb-file-picker-wrapper{width:100%}.bb-file-picker:not(.disabled) .bb-file-picker-button{background-color:#fff}.bb-file-picker:not(.disabled):focus>.bb-file-picker-wrapper,.bb-file-picker:not(.disabled).hovered>.bb-file-picker-wrapper{box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #007bff33}.bb-file-picker.required>.bb-file-picker-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bb-file-picker.error>.bb-file-picker-label{color:#c23934}.bb-file-picker.error>.bb-file-picker-hint{display:none}.bb-file-picker.error>.bb-file-picker-wrapper{border:1px solid #962b26;background-color:#c2393440!important;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #c2393466!important}.bb-file-picker.error .bb-file-picker-button{background-color:transparent}.bb-file-picker-wrapper{max-width:100%;-webkit-user-select:none;user-select:none;border-radius:3px;display:inline-flex;flex-direction:column;border:1px solid #b6bbc1;background-color:#fff8ff;transition:box-shadow .2s cubic-bezier(0,0,.2,1);box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a}.bb-file-picker-label{color:#000;display:block;position:relative;margin-bottom:4px}.bb-file-picker-input{opacity:0;z-index:-1;width:.1px;height:.1px;overflow:hidden;position:absolute}.bb-file-picker-container{min-height:38px;display:inline-flex}.bb-file-picker-button{margin:0;z-index:1;border:none;color:#2196f3;line-height:1;cursor:pointer;padding:0 12px;-webkit-appearance:none;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"] }]
760
+ }], propDecorators: { fileInput: [{
761
+ type: ViewChild,
762
+ args: ['fileInput', { static: true }]
763
+ }], extraTemplate: [{
764
+ type: ContentChild,
765
+ args: ['extra']
766
+ }], label: [{
767
+ type: Input
768
+ }], hint: [{
769
+ type: Input
770
+ }], accept: [{
771
+ type: Input
772
+ }], showImages: [{
773
+ type: Input
774
+ }], allowDragging: [{
775
+ type: Input
776
+ }], value: [{
777
+ type: Input
778
+ }], valueChange: [{
779
+ type: Output
780
+ }], onDrag: [{
781
+ type: HostListener,
782
+ args: ['dragover', ['$event', 'true']]
783
+ }, {
784
+ type: HostListener,
785
+ args: ['dragleave', ['$event', 'false']]
786
+ }], onDrop: [{
787
+ type: HostListener,
788
+ args: ['drop', ['$event']]
789
789
  }] } });
790
790
 
791
- class BbSelect {
792
- constructor(_elementRef, _ngControl, _formControl) {
793
- this._elementRef = _elementRef;
794
- this._ngControl = _ngControl;
795
- this._formControl = _formControl;
796
- this.hasArrow = true;
797
- this._disabled = false;
798
- this._required = false;
799
- }
800
- ngOnInit() {
801
- // Set an arrow on the form control if
802
- // it requires one.
803
- this._formControl.arrow = this.hasArrow;
804
- }
805
- ngDoCheck() {
806
- if (this._ngControl) {
807
- this.disabled = this._ngControl.disabled;
808
- }
809
- }
810
- ngOnDestroy() {
811
- this._subscription?.unsubscribe();
812
- }
813
- focus() {
814
- return this._elementRef?.nativeElement?.focus();
815
- }
816
- setFocus(hasFocus) {
817
- if (!this._formControl) {
818
- return;
819
- }
820
- this._formControl.focused = hasFocus;
821
- }
822
- get id() {
823
- return this._formControl?.labelId ?? null;
824
- }
825
- get disabled() {
826
- if (this._ngControl && this._ngControl.disabled !== null) {
827
- return this._ngControl.disabled;
828
- }
829
- return this._disabled;
830
- }
831
- set disabled(newValue) {
832
- this._disabled = coerceBooleanProperty(newValue);
833
- if (!this._formControl) {
834
- return;
835
- }
836
- this._formControl.disabled = this._disabled;
837
- }
838
- get required() {
839
- return this._required;
840
- }
841
- set required(newValue) {
842
- this._required = coerceBooleanProperty(newValue);
843
- if (!this._formControl) {
844
- return;
845
- }
846
- this._formControl.required = this._required;
847
- }
848
- }
849
- BbSelect.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbSelect, deps: [{ token: i0.ElementRef }, { token: i2.NgControl, optional: true, self: true }, { token: BbFormControl, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
850
- BbSelect.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.3", 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 });
851
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbSelect, decorators: [{
852
- type: Directive,
853
- args: [{
854
- selector: 'select[bbInput]',
855
- host: {
856
- '[disabled]': 'disabled',
857
- '(focus)': 'setFocus(true)',
858
- '(blur)': 'setFocus(false)'
859
- }
860
- }]
861
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i2.NgControl, decorators: [{
862
- type: Optional
863
- }, {
864
- type: Self
865
- }] }, { type: BbFormControl, decorators: [{
866
- type: Optional
867
- }, {
868
- type: Host
869
- }] }]; }, propDecorators: { id: [{
870
- type: HostBinding,
871
- args: ['attr.id']
872
- }], disabled: [{
873
- type: Input
874
- }], required: [{
875
- type: Input
876
- }] } });
877
- class BbInput extends BbSelect {
878
- constructor(_elementRef, _ngControl, _formControl) {
879
- super(_elementRef, _ngControl, _formControl);
880
- this._elementRef = _elementRef;
881
- this._ngControl = _ngControl;
882
- this._formControl = _formControl;
883
- this.hasArrow = false;
884
- this._readonly = false;
885
- }
886
- get readonly() {
887
- return this._readonly;
888
- }
889
- set readonly(newValue) {
890
- this._readonly = coerceBooleanProperty(newValue);
891
- if (!this._formControl) {
892
- return;
893
- }
894
- this._formControl.readonly = this._readonly;
895
- }
896
- }
897
- BbInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbInput, deps: [{ token: i0.ElementRef }, { token: i2.NgControl, optional: true, self: true }, { token: BbFormControl, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
898
- BbInput.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.3", 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 });
899
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbInput, decorators: [{
900
- type: Directive,
901
- args: [{
902
- selector: 'input[bbInput], textarea[bbInput]',
903
- host: {
904
- '[disabled]': 'disabled',
905
- '[readonly]': 'readonly',
906
- '(focus)': 'setFocus(true)',
907
- '(blur)': 'setFocus(false)'
908
- }
909
- }]
910
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i2.NgControl, decorators: [{
911
- type: Optional
912
- }, {
913
- type: Self
914
- }] }, { type: BbFormControl, decorators: [{
915
- type: Optional
916
- }, {
917
- type: Host
918
- }] }]; }, propDecorators: { readonly: [{
919
- type: Input
791
+ class BbSelect {
792
+ constructor(_elementRef, _ngControl, _formControl) {
793
+ this._elementRef = _elementRef;
794
+ this._ngControl = _ngControl;
795
+ this._formControl = _formControl;
796
+ this.hasArrow = true;
797
+ this._disabled = false;
798
+ this._required = false;
799
+ }
800
+ ngOnInit() {
801
+ // Set an arrow on the form control if
802
+ // it requires one.
803
+ this._formControl.arrow = this.hasArrow;
804
+ }
805
+ ngDoCheck() {
806
+ if (this._ngControl) {
807
+ this.disabled = this._ngControl.disabled;
808
+ }
809
+ }
810
+ ngOnDestroy() {
811
+ this._subscription?.unsubscribe();
812
+ }
813
+ focus() {
814
+ return this._elementRef?.nativeElement?.focus();
815
+ }
816
+ setFocus(hasFocus) {
817
+ if (!this._formControl) {
818
+ return;
819
+ }
820
+ this._formControl.focused = hasFocus;
821
+ }
822
+ get id() {
823
+ return this._formControl?.labelId ?? null;
824
+ }
825
+ get disabled() {
826
+ if (this._ngControl && this._ngControl.disabled !== null) {
827
+ return this._ngControl.disabled;
828
+ }
829
+ return this._disabled;
830
+ }
831
+ set disabled(newValue) {
832
+ this._disabled = coerceBooleanProperty(newValue);
833
+ if (!this._formControl) {
834
+ return;
835
+ }
836
+ this._formControl.disabled = this._disabled;
837
+ }
838
+ get required() {
839
+ return this._required;
840
+ }
841
+ set required(newValue) {
842
+ this._required = coerceBooleanProperty(newValue);
843
+ if (!this._formControl) {
844
+ return;
845
+ }
846
+ this._formControl.required = this._required;
847
+ }
848
+ }
849
+ BbSelect.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbSelect, deps: [{ token: i0.ElementRef }, { token: i2.NgControl, optional: true, self: true }, { token: BbFormControl, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
850
+ BbSelect.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.4", 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 });
851
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbSelect, decorators: [{
852
+ type: Directive,
853
+ args: [{
854
+ selector: 'select[bbInput]',
855
+ host: {
856
+ '[disabled]': 'disabled',
857
+ '(focus)': 'setFocus(true)',
858
+ '(blur)': 'setFocus(false)'
859
+ }
860
+ }]
861
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i2.NgControl, decorators: [{
862
+ type: Optional
863
+ }, {
864
+ type: Self
865
+ }] }, { type: BbFormControl, decorators: [{
866
+ type: Optional
867
+ }, {
868
+ type: Host
869
+ }] }]; }, propDecorators: { id: [{
870
+ type: HostBinding,
871
+ args: ['attr.id']
872
+ }], disabled: [{
873
+ type: Input
874
+ }], required: [{
875
+ type: Input
876
+ }] } });
877
+ class BbInput extends BbSelect {
878
+ constructor(_elementRef, _ngControl, _formControl) {
879
+ super(_elementRef, _ngControl, _formControl);
880
+ this._elementRef = _elementRef;
881
+ this._ngControl = _ngControl;
882
+ this._formControl = _formControl;
883
+ this.hasArrow = false;
884
+ this._readonly = false;
885
+ }
886
+ get readonly() {
887
+ return this._readonly;
888
+ }
889
+ set readonly(newValue) {
890
+ this._readonly = coerceBooleanProperty(newValue);
891
+ if (!this._formControl) {
892
+ return;
893
+ }
894
+ this._formControl.readonly = this._readonly;
895
+ }
896
+ }
897
+ BbInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbInput, deps: [{ token: i0.ElementRef }, { token: i2.NgControl, optional: true, self: true }, { token: BbFormControl, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
898
+ BbInput.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.4", 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 });
899
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbInput, decorators: [{
900
+ type: Directive,
901
+ args: [{
902
+ selector: 'input[bbInput], textarea[bbInput]',
903
+ host: {
904
+ '[disabled]': 'disabled',
905
+ '[readonly]': 'readonly',
906
+ '(focus)': 'setFocus(true)',
907
+ '(blur)': 'setFocus(false)'
908
+ }
909
+ }]
910
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i2.NgControl, decorators: [{
911
+ type: Optional
912
+ }, {
913
+ type: Self
914
+ }] }, { type: BbFormControl, decorators: [{
915
+ type: Optional
916
+ }, {
917
+ type: Host
918
+ }] }]; }, propDecorators: { readonly: [{
919
+ type: Input
920
920
  }] } });
921
921
 
922
- class BbDatePickerBase {
923
- }
924
- const BbFilePickerMixinBase = mixinRequired(mixinReadonly(mixinDisabled(mixinGrouped(mixinError(mixinHideErrors(BbDatePickerBase))))));
925
- class BbDatePicker extends BbFilePickerMixinBase {
926
- constructor(_localeId) {
927
- super();
928
- this._localeId = _localeId;
929
- // Readonly data.
930
- this._yearRegex = /^(10|[1-9][0-9])\d{2}$/; // Note: 1000 - 9999
931
- // Inputs.
932
- this.label = null;
933
- this.hint = null;
934
- this.dayPlaceholder = 'dd';
935
- this.monthPlaceholder = 'mm';
936
- this.yearPlaceholder = 'yyyy';
937
- this.trackByValue = (_, item) => item?.value;
938
- this.years$ = new BehaviorSubject(null);
939
- this.valueChange = new EventEmitter();
940
- // Subscriptions.
941
- this._subscription = new Subscription();
942
- this.onTouchedCallback = () => {
943
- };
944
- this.onChangeCallback = () => {
945
- };
946
- this.formToDateString = ({ year, month, day }) => {
947
- if (this.form?.invalid) {
948
- return null;
949
- }
950
- const prefixedMonth = this.padString(`${month}`, 2, '0');
951
- const prefixedDay = this.padString(`${day}`, 2, '0');
952
- return [year, prefixedMonth, prefixedDay].join('-');
953
- };
954
- this.parseYearFormat = (value) => {
955
- // Transform the value to a definitive string.
956
- const yearString = `${value}`;
957
- const currentFullYear = new Date().getFullYear();
958
- // Handle default "current" syntax.
959
- if (yearString === 'current') {
960
- return currentFullYear;
961
- }
962
- // Handle "current + {amount}" syntax.
963
- if (/^current\s?\+\s?\d+$/.test(yearString)) {
964
- const amount = Number(yearString?.split('+')?.[1]?.trim()) ?? 0;
965
- return currentFullYear + amount;
966
- }
967
- // Handle "current - {amount}" syntax.
968
- if (/^current\s?-\s?\d+$/.test(yearString)) {
969
- const amount = Number(yearString?.split('-')?.[1]?.trim()) ?? 0;
970
- return currentFullYear - amount;
971
- }
972
- // Handling the default number case.
973
- if (/^[0-9]{4}$/.test(yearString)) {
974
- return Number(yearString);
975
- }
976
- // We could not parse it.
977
- return null;
978
- };
979
- this.getDaysInMonth = (month = null, year = null) => {
980
- if (this.form?.invalid || month === null || year === null) {
981
- return 31;
982
- }
983
- const parsedYear = parseInt(year, 10);
984
- return new Date(parsedYear, month, 0).getDate();
985
- };
986
- this.isValidDateString = (value) => {
987
- return typeof value === 'string' && /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/.test(value);
988
- };
989
- this.padString = (value, maxLength, fillString = '0') => {
990
- const count = maxLength - value.length;
991
- for (let index = 0; index < count; index++) {
992
- value = `${fillString}${value}`;
993
- }
994
- return value;
995
- };
996
- }
997
- set years(value) {
998
- this.parseYears(value);
999
- }
1000
- get value() {
1001
- return this.formToDateString(this.form?.value);
1002
- }
1003
- set value(value) {
1004
- this.parseDateStringInForm(value);
1005
- this.valueChange.emit(this.value);
1006
- }
1007
- ngOnInit() {
1008
- this.composeForm();
1009
- this.getData();
1010
- this.handleChanges();
1011
- }
1012
- ngOnDestroy() {
1013
- this._subscription?.unsubscribe();
1014
- }
1015
- writeValue(value) {
1016
- this.parseDateStringInForm(value);
1017
- }
1018
- registerOnChange(method) {
1019
- this.onChangeCallback = method;
1020
- }
1021
- registerOnTouched(method) {
1022
- this.onTouchedCallback = method;
1023
- }
1024
- setDisabledState(isDisabled) {
1025
- this.disabled = isDisabled;
1026
- if (this.disabled) {
1027
- this.form?.disable();
1028
- }
1029
- else {
1030
- this.form?.enable();
1031
- }
1032
- }
1033
- onErrorChange(error) {
1034
- this.error = !!error;
1035
- }
1036
- validate({ value }) {
1037
- if (value === null || value === undefined) {
1038
- return null;
1039
- }
1040
- const data = this.parseDateString(value);
1041
- const date = new Date(data?.year, data?.month - 1, data?.day);
1042
- const maxDays = this.getDaysInMonth(data?.month, `${data?.year}`);
1043
- const isInvalidDate = date.toString() === 'Invalid Date';
1044
- const exceededMaxDays = data?.day > maxDays;
1045
- return (isInvalidDate || exceededMaxDays) && {
1046
- invalidDate: true
1047
- };
1048
- }
1049
- handleChanges() {
1050
- const dateOrNull$ = this.form.valueChanges.pipe(map(value => this.formToDateString(value)), distinctUntilChanged());
1051
- const subscription = dateOrNull$.subscribe(() => {
1052
- this.valueChange.emit(this.value);
1053
- this.onChangeCallback(this.value);
1054
- });
1055
- this._subscription.add(subscription);
1056
- }
1057
- getData() {
1058
- const years$ = this.years$.asObservable();
1059
- const months$ = this.getMonthData();
1060
- const days$ = this.getDayData();
1061
- this.data$ = combineLatest([years$, months$, days$]).pipe(map(([years, months, days]) => ({ years, months, days })), tap(data => this.verifyListData(data?.days?.length, data?.years)));
1062
- }
1063
- verifyListData(maxDays, years) {
1064
- const dayControl = this.form.get('day');
1065
- if (dayControl?.value !== null && dayControl?.value > maxDays) {
1066
- dayControl.patchValue(maxDays);
1067
- }
1068
- const yearControl = this.form.get('year');
1069
- if (years !== null && yearControl?.value !== null && this._yearRegex.test(yearControl?.value)) {
1070
- const selectedYear = Number(yearControl?.value);
1071
- const firstYear = Math.min(...years);
1072
- const lastYear = Math.max(...years);
1073
- if (selectedYear < firstYear || selectedYear > lastYear) {
1074
- Promise.resolve().then(() => yearControl.patchValue(null));
1075
- }
1076
- }
1077
- }
1078
- getDayData() {
1079
- const count$ = this.form.valueChanges.pipe(startWith(this.form?.value), map(({ month, year }) => this.getDaysInMonth(month, year)), distinctUntilChanged());
1080
- return count$.pipe(map(count => Array(count).fill(0).map((_, index) => ({
1081
- label: `${index + 1}`,
1082
- value: index + 1
1083
- }))));
1084
- }
1085
- getMonthData() {
1086
- const array = Array(12).fill(0).map((_, month) => {
1087
- const date = new Date(2000, month, 1);
1088
- const label = formatDate(date, 'LLLL', this._localeId);
1089
- return { label, value: month + 1 };
1090
- });
1091
- return of(array);
1092
- }
1093
- composeForm() {
1094
- const { required, pattern, minLength, maxLength } = Validators;
1095
- const yearPattern = pattern(this._yearRegex);
1096
- const yearValidators = [required, yearPattern, minLength(4), maxLength(4)];
1097
- this.form = new FormGroup({
1098
- day: new FormControl(null, required),
1099
- month: new FormControl(null, required),
1100
- year: new FormControl(null, yearValidators)
1101
- });
1102
- }
1103
- parseDateStringInForm(value) {
1104
- // If the date string was not a valid format, reset the form.
1105
- if (!this.isValidDateString(value)) {
1106
- if (value !== null) {
1107
- this.form?.reset({ year: null, month: null, day: null }, { emitEvent: false });
1108
- }
1109
- return;
1110
- }
1111
- // Parse the date string and save in the form.
1112
- const data = this.parseDateString(value);
1113
- const year = data?.year !== null && data?.year !== undefined
1114
- ? this.padString(`${data?.year}`, 4, '0')
1115
- : null;
1116
- const formData = { ...(data ?? {}), year };
1117
- this.form?.patchValue(formData, { emitEvent: false });
1118
- }
1119
- parseDateString(value) {
1120
- if (!this.isValidDateString(value)) {
1121
- return null;
1122
- }
1123
- // Parse the date string.
1124
- const [year, month, day] = value?.split('-');
1125
- return {
1126
- day: day ? parseInt(day, 10) : null,
1127
- month: month ? parseInt(month, 10) : null,
1128
- year: year ? parseInt(year, 10) : null
1129
- };
1130
- }
1131
- parseYears(values) {
1132
- if (!values) {
1133
- return this.years$.next(null);
1134
- }
1135
- // Parse the values to years (in numbers).
1136
- const [first, last] = values;
1137
- const firstYear = this.parseYearFormat(first);
1138
- const lastYear = this.parseYearFormat(last);
1139
- // Check cases in where we cannot parse.
1140
- if (firstYear === null || lastYear === null) {
1141
- return this.years$.next(null);
1142
- }
1143
- const difference = firstYear - lastYear;
1144
- const absoluteDifference = Math.abs(difference) + 1;
1145
- // Create an array with years.
1146
- const years = Array(absoluteDifference)
1147
- .fill(0)
1148
- .map((_, index) => difference < 0 ? (firstYear + index) : (firstYear - index));
1149
- // Validate we have one or more years.
1150
- if (years?.length <= 0) {
1151
- return this.years$.next(null);
1152
- }
1153
- // Push the years.
1154
- return this.years$.next(years);
1155
- }
1156
- }
1157
- BbDatePicker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbDatePicker, deps: [{ token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Component });
1158
- BbDatePicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.3", 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: [
1159
- {
1160
- provide: NG_VALUE_ACCESSOR,
1161
- useExisting: forwardRef(() => BbDatePicker),
1162
- multi: true
1163
- },
1164
- {
1165
- provide: NG_VALIDATORS,
1166
- useExisting: BbDatePicker,
1167
- multi: true
1168
- }
1169
- ], usesInheritance: true, ngImport: i0, template: "<!-- Label of the date picker. -->\r\n<label *ngIf=\"label as labelContent\"\r\n class=\"bb-date-picker-label\">\r\n <ng-template [bbTemplate]=\"labelContent\">\r\n {{ labelContent }}\r\n </ng-template>\r\n</label>\r\n\r\n<!-- The form containing the year/month/day fields. -->\r\n<form *ngIf=\"data$ | async as data\"\r\n [formGroup]=\"form\"\r\n class=\"bb-date-picker-container\"\r\n novalidate>\r\n <div class=\"bb-date-picker-item\">\r\n <bb-form-control hideErrors>\r\n <select [class.has-value]=\"!!form?.get('day')?.value\"\r\n bbInput\r\n autocomplete=\"off\"\r\n formControlName=\"day\">\r\n <option [ngValue]=\"null\">{{ dayPlaceholder }}</option>\r\n <option *ngFor=\"let day of data?.days; trackBy: trackByValue\"\r\n [ngValue]=\"day?.value\">\r\n {{ day?.label }}\r\n </option>\r\n </select>\r\n </bb-form-control>\r\n </div>\r\n <div class=\"bb-date-picker-item\">\r\n <bb-form-control hideErrors>\r\n <select [class.has-value]=\"!!form?.get('month')?.value\"\r\n bbInput\r\n autocomplete=\"off\"\r\n formControlName=\"month\">\r\n <option [ngValue]=\"null\">{{ monthPlaceholder }}</option>\r\n <option *ngFor=\"let month of data?.months; trackBy: trackByValue\"\r\n [ngValue]=\"month?.value\">\r\n {{ month?.label }}\r\n </option>\r\n </select>\r\n </bb-form-control>\r\n </div>\r\n <div class=\"bb-date-picker-item\">\r\n <bb-form-control hideErrors>\r\n <select *ngIf=\"data?.years?.length > 0; else defaultYearInputTemplate\"\r\n [class.has-value]=\"!!form?.get('year')?.value\"\r\n bbInput\r\n autocomplete=\"off\"\r\n formControlName=\"year\">\r\n <option [ngValue]=\"null\">{{ yearPlaceholder }}</option>\r\n <option *ngFor=\"let year of data?.years\"\r\n [value]=\"year\">\r\n {{ year }}\r\n </option>\r\n </select>\r\n\r\n <ng-template #defaultYearInputTemplate>\r\n <input [placeholder]=\"yearPlaceholder\"\r\n bbInput\r\n type=\"text\"\r\n inputmode=\"numeric\"\r\n minlength=\"4\"\r\n maxlength=\"4\"\r\n pattern=\"^[0-9]{4}$\"\r\n formControlName=\"year\"\r\n autocomplete=\"off\">\r\n </ng-template>\r\n </bb-form-control>\r\n </div>\r\n</form>\r\n\r\n<!-- The date picker error. -->\r\n<bb-form-error *ngIf=\"!hideErrors\"\r\n (errorChange)=\"onErrorChange($event)\">\r\n</bb-form-error>\r\n\r\n<!-- The date picker hint. -->\r\n<p *ngIf=\"hint as hintContent\"\r\n class=\"bb-date-picker-hint\">\r\n <ng-template [bbTemplate]=\"hintContent\">\r\n {{ hintContent }}\r\n </ng-template>\r\n</p>\r\n", styles: [".bb-date-picker{display:block}.bb-date-picker.required>.bb-date-picker-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bb-date-picker.readonly{pointer-events:none}.bb-date-picker.readonly .bb-form-control-container{cursor:default;border:1px dotted #bdc4c9;background-color:#f9f9f9!important}.bb-date-picker.readonly .bb-form-control-container>select:disabled{opacity:1}.bb-date-picker.grouped{margin-bottom:20px}.bb-date-picker.error>.bb-date-picker-label{color:#c23934}.bb-date-picker.error .bb-form-control-container{border:1px solid #962b26;background-color:#c2393440!important;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #c2393466!important}.bb-date-picker-label{color:#000;display:block;font-size:16px;font-weight:500;margin-bottom:4px}.bb-date-picker-container{display:flex}.bb-date-picker-item{flex:1}.bb-date-picker-item>bb-form-control.focused{z-index:1;position:relative}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select>option:first-child{color:#d2d2d2}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select:not(.has-value){color:#d2d2d2}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select:not(.has-value)>option:not(:first-child){color:#000}.bb-date-picker-item:not(:first-child):not(:last-child) .bb-form-control-container{border-radius:0!important}.bb-date-picker-item:first-child .bb-form-control-container{border-right:none!important;border-top-right-radius:0!important;border-bottom-right-radius:0!important}.bb-date-picker-item:last-child .bb-form-control-container{border-left:none!important;border-top-left-radius:0!important;border-bottom-left-radius:0!important}.bb-date-picker-hint{display:block;color:#738694;font-size:13px;margin-top:4px;pointer-events:all}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { kind: "directive", type: i2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: BbTemplate, selector: "[bbTemplate]", inputs: ["bbTemplate"] }, { kind: "component", type: BbFormError, selector: "bb-form-error", inputs: ["control"], outputs: ["errorChange"] }, { kind: "directive", type: BbFormSubmit, selector: "form", exportAs: ["bbForm"] }, { kind: "directive", type: BbInput, selector: "input[bbInput], textarea[bbInput]", inputs: ["readonly"] }, { kind: "directive", type: BbSelect, selector: "select[bbInput]", inputs: ["disabled", "required"] }, { kind: "component", type: BbFormControl, selector: "bb-form-control", inputs: ["grouped", "hideErrors", "label", "hint"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1170
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbDatePicker, decorators: [{
1171
- type: Component,
1172
- args: [{ selector: 'bb-date-picker', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
1173
- {
1174
- provide: NG_VALUE_ACCESSOR,
1175
- useExisting: forwardRef(() => BbDatePicker),
1176
- multi: true
1177
- },
1178
- {
1179
- provide: NG_VALIDATORS,
1180
- useExisting: BbDatePicker,
1181
- multi: true
1182
- }
1183
- ], host: {
1184
- 'class': 'bb-date-picker',
1185
- '[class.required]': 'required',
1186
- '[class.readonly]': 'readonly',
1187
- '[class.disabled]': 'disabled',
1188
- '[class.grouped]': 'grouped',
1189
- '[class.error]': 'error'
1190
- }, inputs: ['required', 'readonly', 'disabled', 'grouped', 'hideErrors'], preserveWhitespaces: false, template: "<!-- Label of the date picker. -->\r\n<label *ngIf=\"label as labelContent\"\r\n class=\"bb-date-picker-label\">\r\n <ng-template [bbTemplate]=\"labelContent\">\r\n {{ labelContent }}\r\n </ng-template>\r\n</label>\r\n\r\n<!-- The form containing the year/month/day fields. -->\r\n<form *ngIf=\"data$ | async as data\"\r\n [formGroup]=\"form\"\r\n class=\"bb-date-picker-container\"\r\n novalidate>\r\n <div class=\"bb-date-picker-item\">\r\n <bb-form-control hideErrors>\r\n <select [class.has-value]=\"!!form?.get('day')?.value\"\r\n bbInput\r\n autocomplete=\"off\"\r\n formControlName=\"day\">\r\n <option [ngValue]=\"null\">{{ dayPlaceholder }}</option>\r\n <option *ngFor=\"let day of data?.days; trackBy: trackByValue\"\r\n [ngValue]=\"day?.value\">\r\n {{ day?.label }}\r\n </option>\r\n </select>\r\n </bb-form-control>\r\n </div>\r\n <div class=\"bb-date-picker-item\">\r\n <bb-form-control hideErrors>\r\n <select [class.has-value]=\"!!form?.get('month')?.value\"\r\n bbInput\r\n autocomplete=\"off\"\r\n formControlName=\"month\">\r\n <option [ngValue]=\"null\">{{ monthPlaceholder }}</option>\r\n <option *ngFor=\"let month of data?.months; trackBy: trackByValue\"\r\n [ngValue]=\"month?.value\">\r\n {{ month?.label }}\r\n </option>\r\n </select>\r\n </bb-form-control>\r\n </div>\r\n <div class=\"bb-date-picker-item\">\r\n <bb-form-control hideErrors>\r\n <select *ngIf=\"data?.years?.length > 0; else defaultYearInputTemplate\"\r\n [class.has-value]=\"!!form?.get('year')?.value\"\r\n bbInput\r\n autocomplete=\"off\"\r\n formControlName=\"year\">\r\n <option [ngValue]=\"null\">{{ yearPlaceholder }}</option>\r\n <option *ngFor=\"let year of data?.years\"\r\n [value]=\"year\">\r\n {{ year }}\r\n </option>\r\n </select>\r\n\r\n <ng-template #defaultYearInputTemplate>\r\n <input [placeholder]=\"yearPlaceholder\"\r\n bbInput\r\n type=\"text\"\r\n inputmode=\"numeric\"\r\n minlength=\"4\"\r\n maxlength=\"4\"\r\n pattern=\"^[0-9]{4}$\"\r\n formControlName=\"year\"\r\n autocomplete=\"off\">\r\n </ng-template>\r\n </bb-form-control>\r\n </div>\r\n</form>\r\n\r\n<!-- The date picker error. -->\r\n<bb-form-error *ngIf=\"!hideErrors\"\r\n (errorChange)=\"onErrorChange($event)\">\r\n</bb-form-error>\r\n\r\n<!-- The date picker hint. -->\r\n<p *ngIf=\"hint as hintContent\"\r\n class=\"bb-date-picker-hint\">\r\n <ng-template [bbTemplate]=\"hintContent\">\r\n {{ hintContent }}\r\n </ng-template>\r\n</p>\r\n", styles: [".bb-date-picker{display:block}.bb-date-picker.required>.bb-date-picker-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bb-date-picker.readonly{pointer-events:none}.bb-date-picker.readonly .bb-form-control-container{cursor:default;border:1px dotted #bdc4c9;background-color:#f9f9f9!important}.bb-date-picker.readonly .bb-form-control-container>select:disabled{opacity:1}.bb-date-picker.grouped{margin-bottom:20px}.bb-date-picker.error>.bb-date-picker-label{color:#c23934}.bb-date-picker.error .bb-form-control-container{border:1px solid #962b26;background-color:#c2393440!important;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #c2393466!important}.bb-date-picker-label{color:#000;display:block;font-size:16px;font-weight:500;margin-bottom:4px}.bb-date-picker-container{display:flex}.bb-date-picker-item{flex:1}.bb-date-picker-item>bb-form-control.focused{z-index:1;position:relative}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select>option:first-child{color:#d2d2d2}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select:not(.has-value){color:#d2d2d2}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select:not(.has-value)>option:not(:first-child){color:#000}.bb-date-picker-item:not(:first-child):not(:last-child) .bb-form-control-container{border-radius:0!important}.bb-date-picker-item:first-child .bb-form-control-container{border-right:none!important;border-top-right-radius:0!important;border-bottom-right-radius:0!important}.bb-date-picker-item:last-child .bb-form-control-container{border-left:none!important;border-top-left-radius:0!important;border-bottom-left-radius:0!important}.bb-date-picker-hint{display:block;color:#738694;font-size:13px;margin-top:4px;pointer-events:all}\n"] }]
1191
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1192
- type: Inject,
1193
- args: [LOCALE_ID]
1194
- }] }]; }, propDecorators: { label: [{
1195
- type: Input
1196
- }], hint: [{
1197
- type: Input
1198
- }], dayPlaceholder: [{
1199
- type: Input
1200
- }], monthPlaceholder: [{
1201
- type: Input
1202
- }], yearPlaceholder: [{
1203
- type: Input
1204
- }], years: [{
1205
- type: Input
1206
- }], value: [{
1207
- type: Input
1208
- }], valueChange: [{
1209
- type: Output
922
+ class BbDatePickerBase {
923
+ }
924
+ const BbFilePickerMixinBase = mixinRequired(mixinReadonly(mixinDisabled(mixinGrouped(mixinError(mixinHideErrors(BbDatePickerBase))))));
925
+ class BbDatePicker extends BbFilePickerMixinBase {
926
+ constructor(_localeId) {
927
+ super();
928
+ this._localeId = _localeId;
929
+ // Readonly data.
930
+ this._yearRegex = /^(10|[1-9][0-9])\d{2}$/; // Note: 1000 - 9999
931
+ // Inputs.
932
+ this.label = null;
933
+ this.hint = null;
934
+ this.dayPlaceholder = 'dd';
935
+ this.monthPlaceholder = 'mm';
936
+ this.yearPlaceholder = 'yyyy';
937
+ this.trackByValue = (_, item) => item?.value;
938
+ this.years$ = new BehaviorSubject(null);
939
+ this.valueChange = new EventEmitter();
940
+ // Subscriptions.
941
+ this._subscription = new Subscription();
942
+ this.onTouchedCallback = () => {
943
+ };
944
+ this.onChangeCallback = () => {
945
+ };
946
+ this.formToDateString = ({ year, month, day }) => {
947
+ if (this.form?.invalid) {
948
+ return null;
949
+ }
950
+ const prefixedMonth = this.padString(`${month}`, 2, '0');
951
+ const prefixedDay = this.padString(`${day}`, 2, '0');
952
+ return [year, prefixedMonth, prefixedDay].join('-');
953
+ };
954
+ this.parseYearFormat = (value) => {
955
+ // Transform the value to a definitive string.
956
+ const yearString = `${value}`;
957
+ const currentFullYear = new Date().getFullYear();
958
+ // Handle default "current" syntax.
959
+ if (yearString === 'current') {
960
+ return currentFullYear;
961
+ }
962
+ // Handle "current + {amount}" syntax.
963
+ if (/^current\s?\+\s?\d+$/.test(yearString)) {
964
+ const amount = Number(yearString?.split('+')?.[1]?.trim()) ?? 0;
965
+ return currentFullYear + amount;
966
+ }
967
+ // Handle "current - {amount}" syntax.
968
+ if (/^current\s?-\s?\d+$/.test(yearString)) {
969
+ const amount = Number(yearString?.split('-')?.[1]?.trim()) ?? 0;
970
+ return currentFullYear - amount;
971
+ }
972
+ // Handling the default number case.
973
+ if (/^[0-9]{4}$/.test(yearString)) {
974
+ return Number(yearString);
975
+ }
976
+ // We could not parse it.
977
+ return null;
978
+ };
979
+ this.getDaysInMonth = (month = null, year = null) => {
980
+ if (this.form?.invalid || month === null || year === null) {
981
+ return 31;
982
+ }
983
+ const parsedYear = parseInt(year, 10);
984
+ return new Date(parsedYear, month, 0).getDate();
985
+ };
986
+ this.isValidDateString = (value) => {
987
+ return typeof value === 'string' && /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/.test(value);
988
+ };
989
+ this.padString = (value, maxLength, fillString = '0') => {
990
+ const count = maxLength - value.length;
991
+ for (let index = 0; index < count; index++) {
992
+ value = `${fillString}${value}`;
993
+ }
994
+ return value;
995
+ };
996
+ }
997
+ set years(value) {
998
+ this.parseYears(value);
999
+ }
1000
+ get value() {
1001
+ return this.formToDateString(this.form?.value);
1002
+ }
1003
+ set value(value) {
1004
+ this.parseDateStringInForm(value);
1005
+ this.valueChange.emit(this.value);
1006
+ }
1007
+ ngOnInit() {
1008
+ this.composeForm();
1009
+ this.getData();
1010
+ this.handleChanges();
1011
+ }
1012
+ ngOnDestroy() {
1013
+ this._subscription?.unsubscribe();
1014
+ }
1015
+ writeValue(value) {
1016
+ this.parseDateStringInForm(value);
1017
+ }
1018
+ registerOnChange(method) {
1019
+ this.onChangeCallback = method;
1020
+ }
1021
+ registerOnTouched(method) {
1022
+ this.onTouchedCallback = method;
1023
+ }
1024
+ setDisabledState(isDisabled) {
1025
+ this.disabled = isDisabled;
1026
+ if (this.disabled) {
1027
+ this.form?.disable();
1028
+ }
1029
+ else {
1030
+ this.form?.enable();
1031
+ }
1032
+ }
1033
+ onErrorChange(error) {
1034
+ this.error = !!error;
1035
+ }
1036
+ validate({ value }) {
1037
+ if (value === null || value === undefined) {
1038
+ return null;
1039
+ }
1040
+ const data = this.parseDateString(value);
1041
+ const date = new Date(data?.year, data?.month - 1, data?.day);
1042
+ const maxDays = this.getDaysInMonth(data?.month, `${data?.year}`);
1043
+ const isInvalidDate = date.toString() === 'Invalid Date';
1044
+ const exceededMaxDays = data?.day > maxDays;
1045
+ return (isInvalidDate || exceededMaxDays) && {
1046
+ invalidDate: true
1047
+ };
1048
+ }
1049
+ handleChanges() {
1050
+ const dateOrNull$ = this.form.valueChanges.pipe(map(value => this.formToDateString(value)), distinctUntilChanged());
1051
+ const subscription = dateOrNull$.subscribe(() => {
1052
+ this.valueChange.emit(this.value);
1053
+ this.onChangeCallback(this.value);
1054
+ });
1055
+ this._subscription.add(subscription);
1056
+ }
1057
+ getData() {
1058
+ const years$ = this.years$.asObservable();
1059
+ const months$ = this.getMonthData();
1060
+ const days$ = this.getDayData();
1061
+ this.data$ = combineLatest([years$, months$, days$]).pipe(map(([years, months, days]) => ({ years, months, days })), tap(data => this.verifyListData(data?.days?.length, data?.years)));
1062
+ }
1063
+ verifyListData(maxDays, years) {
1064
+ const dayControl = this.form.get('day');
1065
+ if (dayControl?.value !== null && dayControl?.value > maxDays) {
1066
+ dayControl.patchValue(maxDays);
1067
+ }
1068
+ const yearControl = this.form.get('year');
1069
+ if (years !== null && yearControl?.value !== null && this._yearRegex.test(yearControl?.value)) {
1070
+ const selectedYear = Number(yearControl?.value);
1071
+ const firstYear = Math.min(...years);
1072
+ const lastYear = Math.max(...years);
1073
+ if (selectedYear < firstYear || selectedYear > lastYear) {
1074
+ Promise.resolve().then(() => yearControl.patchValue(null));
1075
+ }
1076
+ }
1077
+ }
1078
+ getDayData() {
1079
+ const count$ = this.form.valueChanges.pipe(startWith(this.form?.value), map(({ month, year }) => this.getDaysInMonth(month, year)), distinctUntilChanged());
1080
+ return count$.pipe(map(count => Array(count).fill(0).map((_, index) => ({
1081
+ label: `${index + 1}`,
1082
+ value: index + 1
1083
+ }))));
1084
+ }
1085
+ getMonthData() {
1086
+ const array = Array(12).fill(0).map((_, month) => {
1087
+ const date = new Date(2000, month, 1);
1088
+ const label = formatDate(date, 'LLLL', this._localeId);
1089
+ return { label, value: month + 1 };
1090
+ });
1091
+ return of(array);
1092
+ }
1093
+ composeForm() {
1094
+ const { required, pattern, minLength, maxLength } = Validators;
1095
+ const yearPattern = pattern(this._yearRegex);
1096
+ const yearValidators = [required, yearPattern, minLength(4), maxLength(4)];
1097
+ this.form = new FormGroup({
1098
+ day: new FormControl(null, required),
1099
+ month: new FormControl(null, required),
1100
+ year: new FormControl(null, yearValidators)
1101
+ });
1102
+ }
1103
+ parseDateStringInForm(value) {
1104
+ // If the date string was not a valid format, reset the form.
1105
+ if (!this.isValidDateString(value)) {
1106
+ if (value !== null) {
1107
+ this.form?.reset({ year: null, month: null, day: null }, { emitEvent: false });
1108
+ }
1109
+ return;
1110
+ }
1111
+ // Parse the date string and save in the form.
1112
+ const data = this.parseDateString(value);
1113
+ const year = data?.year !== null && data?.year !== undefined
1114
+ ? this.padString(`${data?.year}`, 4, '0')
1115
+ : null;
1116
+ const formData = { ...(data ?? {}), year };
1117
+ this.form?.patchValue(formData, { emitEvent: false });
1118
+ }
1119
+ parseDateString(value) {
1120
+ if (!this.isValidDateString(value)) {
1121
+ return null;
1122
+ }
1123
+ // Parse the date string.
1124
+ const [year, month, day] = value?.split('-');
1125
+ return {
1126
+ day: day ? parseInt(day, 10) : null,
1127
+ month: month ? parseInt(month, 10) : null,
1128
+ year: year ? parseInt(year, 10) : null
1129
+ };
1130
+ }
1131
+ parseYears(values) {
1132
+ if (!values) {
1133
+ return this.years$.next(null);
1134
+ }
1135
+ // Parse the values to years (in numbers).
1136
+ const [first, last] = values;
1137
+ const firstYear = this.parseYearFormat(first);
1138
+ const lastYear = this.parseYearFormat(last);
1139
+ // Check cases in where we cannot parse.
1140
+ if (firstYear === null || lastYear === null) {
1141
+ return this.years$.next(null);
1142
+ }
1143
+ const difference = firstYear - lastYear;
1144
+ const absoluteDifference = Math.abs(difference) + 1;
1145
+ // Create an array with years.
1146
+ const years = Array(absoluteDifference)
1147
+ .fill(0)
1148
+ .map((_, index) => difference < 0 ? (firstYear + index) : (firstYear - index));
1149
+ // Validate we have one or more years.
1150
+ if (years?.length <= 0) {
1151
+ return this.years$.next(null);
1152
+ }
1153
+ // Push the years.
1154
+ return this.years$.next(years);
1155
+ }
1156
+ }
1157
+ BbDatePicker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbDatePicker, deps: [{ token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Component });
1158
+ BbDatePicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.4", 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: [
1159
+ {
1160
+ provide: NG_VALUE_ACCESSOR,
1161
+ useExisting: forwardRef(() => BbDatePicker),
1162
+ multi: true
1163
+ },
1164
+ {
1165
+ provide: NG_VALIDATORS,
1166
+ useExisting: BbDatePicker,
1167
+ multi: true
1168
+ }
1169
+ ], 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"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { kind: "directive", type: i2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: BbTemplate, selector: "[bbTemplate]", inputs: ["bbTemplate"] }, { kind: "component", type: BbFormError, selector: "bb-form-error", inputs: ["control"], outputs: ["errorChange"] }, { kind: "directive", type: BbFormSubmit, selector: "form", exportAs: ["bbForm"] }, { kind: "directive", type: BbInput, selector: "input[bbInput], textarea[bbInput]", inputs: ["readonly"] }, { kind: "directive", type: BbSelect, selector: "select[bbInput]", inputs: ["disabled", "required"] }, { kind: "component", type: BbFormControl, selector: "bb-form-control", inputs: ["grouped", "hideErrors", "label", "hint"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1170
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbDatePicker, decorators: [{
1171
+ type: Component,
1172
+ args: [{ selector: 'bb-date-picker', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
1173
+ {
1174
+ provide: NG_VALUE_ACCESSOR,
1175
+ useExisting: forwardRef(() => BbDatePicker),
1176
+ multi: true
1177
+ },
1178
+ {
1179
+ provide: NG_VALIDATORS,
1180
+ useExisting: BbDatePicker,
1181
+ multi: true
1182
+ }
1183
+ ], host: {
1184
+ 'class': 'bb-date-picker',
1185
+ '[class.required]': 'required',
1186
+ '[class.readonly]': 'readonly',
1187
+ '[class.disabled]': 'disabled',
1188
+ '[class.grouped]': 'grouped',
1189
+ '[class.error]': 'error'
1190
+ }, inputs: ['required', 'readonly', 'disabled', 'grouped', 'hideErrors'], preserveWhitespaces: false, template: "<!-- Label of the date picker. -->\n<label *ngIf=\"label as labelContent\"\n class=\"bb-date-picker-label\">\n <ng-template [bbTemplate]=\"labelContent\">\n {{ labelContent }}\n </ng-template>\n</label>\n\n<!-- The form containing the year/month/day fields. -->\n<form *ngIf=\"data$ | async as data\"\n [formGroup]=\"form\"\n class=\"bb-date-picker-container\"\n novalidate>\n <div class=\"bb-date-picker-item\">\n <bb-form-control hideErrors>\n <select [class.has-value]=\"!!form?.get('day')?.value\"\n bbInput\n autocomplete=\"off\"\n formControlName=\"day\">\n <option [ngValue]=\"null\">{{ dayPlaceholder }}</option>\n <option *ngFor=\"let day of data?.days; trackBy: trackByValue\"\n [ngValue]=\"day?.value\">\n {{ day?.label }}\n </option>\n </select>\n </bb-form-control>\n </div>\n <div class=\"bb-date-picker-item\">\n <bb-form-control hideErrors>\n <select [class.has-value]=\"!!form?.get('month')?.value\"\n bbInput\n autocomplete=\"off\"\n formControlName=\"month\">\n <option [ngValue]=\"null\">{{ monthPlaceholder }}</option>\n <option *ngFor=\"let month of data?.months; trackBy: trackByValue\"\n [ngValue]=\"month?.value\">\n {{ month?.label }}\n </option>\n </select>\n </bb-form-control>\n </div>\n <div class=\"bb-date-picker-item\">\n <bb-form-control hideErrors>\n <select *ngIf=\"data?.years?.length > 0; else defaultYearInputTemplate\"\n [class.has-value]=\"!!form?.get('year')?.value\"\n bbInput\n autocomplete=\"off\"\n formControlName=\"year\">\n <option [ngValue]=\"null\">{{ yearPlaceholder }}</option>\n <option *ngFor=\"let year of data?.years\"\n [value]=\"year\">\n {{ year }}\n </option>\n </select>\n\n <ng-template #defaultYearInputTemplate>\n <input [placeholder]=\"yearPlaceholder\"\n bbInput\n type=\"text\"\n inputmode=\"numeric\"\n minlength=\"4\"\n maxlength=\"4\"\n pattern=\"^[0-9]{4}$\"\n formControlName=\"year\"\n autocomplete=\"off\">\n </ng-template>\n </bb-form-control>\n </div>\n</form>\n\n<!-- The date picker error. -->\n<bb-form-error *ngIf=\"!hideErrors\"\n (errorChange)=\"onErrorChange($event)\">\n</bb-form-error>\n\n<!-- The date picker hint. -->\n<p *ngIf=\"hint as hintContent\"\n class=\"bb-date-picker-hint\">\n <ng-template [bbTemplate]=\"hintContent\">\n {{ hintContent }}\n </ng-template>\n</p>\n", styles: [".bb-date-picker{display:block}.bb-date-picker.required>.bb-date-picker-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bb-date-picker.readonly{pointer-events:none}.bb-date-picker.readonly .bb-form-control-container{cursor:default;border:1px dotted #bdc4c9;background-color:#f9f9f9!important}.bb-date-picker.readonly .bb-form-control-container>select:disabled{opacity:1}.bb-date-picker.grouped{margin-bottom:20px}.bb-date-picker.error>.bb-date-picker-label{color:#c23934}.bb-date-picker.error .bb-form-control-container{border:1px solid #962b26;background-color:#c2393440!important;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #c2393466!important}.bb-date-picker-label{color:#000;display:block;font-size:16px;font-weight:500;margin-bottom:4px}.bb-date-picker-container{display:flex}.bb-date-picker-item{flex:1}.bb-date-picker-item>bb-form-control.focused{z-index:1;position:relative}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select>option:first-child{color:#d2d2d2}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select:not(.has-value){color:#d2d2d2}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select:not(.has-value)>option:not(:first-child){color:#000}.bb-date-picker-item:not(:first-child):not(:last-child) .bb-form-control-container{border-radius:0!important}.bb-date-picker-item:first-child .bb-form-control-container{border-right:none!important;border-top-right-radius:0!important;border-bottom-right-radius:0!important}.bb-date-picker-item:last-child .bb-form-control-container{border-left:none!important;border-top-left-radius:0!important;border-bottom-left-radius:0!important}.bb-date-picker-hint{display:block;color:#738694;font-size:13px;margin-top:4px;pointer-events:all}\n"] }]
1191
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1192
+ type: Inject,
1193
+ args: [LOCALE_ID]
1194
+ }] }]; }, propDecorators: { label: [{
1195
+ type: Input
1196
+ }], hint: [{
1197
+ type: Input
1198
+ }], dayPlaceholder: [{
1199
+ type: Input
1200
+ }], monthPlaceholder: [{
1201
+ type: Input
1202
+ }], yearPlaceholder: [{
1203
+ type: Input
1204
+ }], years: [{
1205
+ type: Input
1206
+ }], value: [{
1207
+ type: Input
1208
+ }], valueChange: [{
1209
+ type: Output
1210
1210
  }] } });
1211
1211
 
1212
- class BbSuffix {
1213
- }
1214
- BbSuffix.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbSuffix, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1215
- BbSuffix.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.3", type: BbSuffix, selector: "[bbSuffix]", host: { classAttribute: "bb-suffix" }, ngImport: i0 });
1216
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbSuffix, decorators: [{
1217
- type: Directive,
1218
- args: [{
1219
- selector: '[bbSuffix]',
1220
- host: {
1221
- 'class': 'bb-suffix'
1222
- }
1223
- }]
1224
- }] });
1225
- class BbPrefix {
1226
- }
1227
- BbPrefix.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbPrefix, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1228
- BbPrefix.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.3", type: BbPrefix, selector: "[bbPrefix]", host: { classAttribute: "bb-prefix" }, ngImport: i0 });
1229
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbPrefix, decorators: [{
1230
- type: Directive,
1231
- args: [{
1232
- selector: '[bbPrefix]',
1233
- host: {
1234
- 'class': 'bb-prefix'
1235
- }
1236
- }]
1212
+ class BbSuffix {
1213
+ }
1214
+ BbSuffix.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbSuffix, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1215
+ BbSuffix.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.4", type: BbSuffix, selector: "[bbSuffix]", host: { classAttribute: "bb-suffix" }, ngImport: i0 });
1216
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbSuffix, decorators: [{
1217
+ type: Directive,
1218
+ args: [{
1219
+ selector: '[bbSuffix]',
1220
+ host: {
1221
+ 'class': 'bb-suffix'
1222
+ }
1223
+ }]
1224
+ }] });
1225
+ class BbPrefix {
1226
+ }
1227
+ BbPrefix.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbPrefix, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1228
+ BbPrefix.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.4", type: BbPrefix, selector: "[bbPrefix]", host: { classAttribute: "bb-prefix" }, ngImport: i0 });
1229
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbPrefix, decorators: [{
1230
+ type: Directive,
1231
+ args: [{
1232
+ selector: '[bbPrefix]',
1233
+ host: {
1234
+ 'class': 'bb-prefix'
1235
+ }
1236
+ }]
1237
1237
  }] });
1238
1238
 
1239
- class BbFormGroupBase {
1240
- }
1241
- const BbFormGroupMixinBase = mixinGrouped(BbFormGroupBase);
1242
- class BbFormGroup extends BbFormGroupMixinBase {
1243
- }
1244
- BbFormGroup.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbFormGroup, deps: null, target: i0.ɵɵFactoryTarget.Component });
1245
- BbFormGroup.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.3", type: BbFormGroup, selector: "bb-form-group", inputs: { grouped: "grouped" }, host: { properties: { "class.grouped": "grouped" }, classAttribute: "bb-form-group" }, usesInheritance: true, ngImport: i0, template: "<ng-content></ng-content>\r\n", styles: [".bb-form-group{width:100%;display:flex;flex-wrap:wrap;margin-top:-10px}.bb-form-group>*{margin-top:10px}.bb-form-group>*:not(:first-child){margin-left:10px}.bb-form-group.start{justify-content:flex-start}.bb-form-group.end{justify-content:flex-end}.bb-form-group.vertical{flex-direction:column;justify-content:normal}.bb-form-group.vertical>*{margin-left:0}.bb-form-group.vertical.start{align-items:flex-start}.bb-form-group.vertical.end{align-items:flex-end}.bb-form-group.grouped{margin-bottom:20px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1246
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbFormGroup, decorators: [{
1247
- type: Component,
1248
- args: [{ selector: 'bb-form-group', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
1249
- 'class': 'bb-form-group',
1250
- '[class.grouped]': 'grouped'
1251
- }, inputs: ['grouped'], preserveWhitespaces: false, template: "<ng-content></ng-content>\r\n", styles: [".bb-form-group{width:100%;display:flex;flex-wrap:wrap;margin-top:-10px}.bb-form-group>*{margin-top:10px}.bb-form-group>*:not(:first-child){margin-left:10px}.bb-form-group.start{justify-content:flex-start}.bb-form-group.end{justify-content:flex-end}.bb-form-group.vertical{flex-direction:column;justify-content:normal}.bb-form-group.vertical>*{margin-left:0}.bb-form-group.vertical.start{align-items:flex-start}.bb-form-group.vertical.end{align-items:flex-end}.bb-form-group.grouped{margin-bottom:20px}\n"] }]
1239
+ class BbFormGroupBase {
1240
+ }
1241
+ const BbFormGroupMixinBase = mixinGrouped(BbFormGroupBase);
1242
+ class BbFormGroup extends BbFormGroupMixinBase {
1243
+ }
1244
+ BbFormGroup.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbFormGroup, deps: null, target: i0.ɵɵFactoryTarget.Component });
1245
+ BbFormGroup.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.4", 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 });
1246
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbFormGroup, decorators: [{
1247
+ type: Component,
1248
+ args: [{ selector: 'bb-form-group', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
1249
+ 'class': 'bb-form-group',
1250
+ '[class.grouped]': 'grouped'
1251
+ }, inputs: ['grouped'], preserveWhitespaces: false, template: "<ng-content></ng-content>\n", styles: [".bb-form-group{width:100%;display:flex;flex-wrap:wrap;margin-top:-10px}.bb-form-group>*{margin-top:10px}.bb-form-group>*:not(:first-child){margin-left:10px}.bb-form-group.start{justify-content:flex-start}.bb-form-group.end{justify-content:flex-end}.bb-form-group.vertical{flex-direction:column;justify-content:normal}.bb-form-group.vertical>*{margin-left:0}.bb-form-group.vertical.start{align-items:flex-start}.bb-form-group.vertical.end{align-items:flex-end}.bb-form-group.grouped{margin-bottom:20px}\n"] }]
1252
1252
  }] });
1253
1253
 
1254
- class BbFocusTrap {
1255
- constructor(_platform, _elementRef) {
1256
- this._platform = _platform;
1257
- this._elementRef = _elementRef;
1258
- this._focusableElements = [
1259
- 'a[href]',
1260
- 'area[href]',
1261
- 'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',
1262
- 'select:not([disabled]):not([aria-hidden])',
1263
- 'textarea:not([disabled]):not([aria-hidden])',
1264
- 'button:not([disabled]):not([aria-hidden])',
1265
- 'iframe',
1266
- 'object',
1267
- 'embed',
1268
- '[contenteditable]',
1269
- '[tabindex]:not([tabindex^="-"])'
1270
- ];
1271
- this.focus = (element) => {
1272
- return element && element.focus && element.focus();
1273
- };
1274
- this.isTabEvent = (event) => {
1275
- return event.key === 'Tab' || event.keyCode === 9;
1276
- };
1277
- }
1278
- onKeydown(event) {
1279
- // Validate it is a tab event.
1280
- if (!this.isTabEvent(event)) {
1281
- return;
1282
- }
1283
- // Trap the focus inside the element.
1284
- return this.trapFocus(event);
1285
- }
1286
- trapFocus(event) {
1287
- // Validate that the DOM is available.
1288
- if (!this._platform.isBrowser) {
1289
- return;
1290
- }
1291
- // Get all focusable nodes.
1292
- const focusableNodes = this.getFocusableNodes();
1293
- // Focus the first available element if the focus
1294
- // is not in the modal.
1295
- if (!this.element.contains(document.activeElement)) {
1296
- return this.focus(focusableNodes[0]);
1297
- }
1298
- const focusedItemIndex = focusableNodes.indexOf(document.activeElement);
1299
- if (event.shiftKey && focusedItemIndex === 0) {
1300
- this.focus(focusableNodes[focusableNodes.length - 1]);
1301
- return event.preventDefault();
1302
- }
1303
- if (!event.shiftKey && focusedItemIndex === focusableNodes.length - 1) {
1304
- this.focus(focusableNodes[0]);
1305
- return event.preventDefault();
1306
- }
1307
- }
1308
- get element() {
1309
- return this._elementRef.nativeElement;
1310
- }
1311
- getFocusableNodes() {
1312
- const nodes = this.element.querySelectorAll(this._focusableElements);
1313
- return Array(...nodes);
1314
- }
1315
- }
1316
- BbFocusTrap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbFocusTrap, deps: [{ token: i1$1.Platform }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1317
- BbFocusTrap.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.3", type: BbFocusTrap, selector: "[bbFocusTrap]", host: { listeners: { "keydown": "onKeydown($event)" } }, ngImport: i0 });
1318
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbFocusTrap, decorators: [{
1319
- type: Directive,
1320
- args: [{
1321
- selector: '[bbFocusTrap]'
1322
- }]
1323
- }], ctorParameters: function () { return [{ type: i1$1.Platform }, { type: i0.ElementRef }]; }, propDecorators: { onKeydown: [{
1324
- type: HostListener,
1325
- args: ['keydown', ['$event']]
1254
+ class BbFocusTrap {
1255
+ constructor(_platform, _elementRef) {
1256
+ this._platform = _platform;
1257
+ this._elementRef = _elementRef;
1258
+ this._focusableElements = [
1259
+ 'a[href]',
1260
+ 'area[href]',
1261
+ 'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',
1262
+ 'select:not([disabled]):not([aria-hidden])',
1263
+ 'textarea:not([disabled]):not([aria-hidden])',
1264
+ 'button:not([disabled]):not([aria-hidden])',
1265
+ 'iframe',
1266
+ 'object',
1267
+ 'embed',
1268
+ '[contenteditable]',
1269
+ '[tabindex]:not([tabindex^="-"])'
1270
+ ];
1271
+ this.focus = (element) => {
1272
+ return element && element.focus && element.focus();
1273
+ };
1274
+ this.isTabEvent = (event) => {
1275
+ return event.key === 'Tab' || event.keyCode === 9;
1276
+ };
1277
+ }
1278
+ onKeydown(event) {
1279
+ // Validate it is a tab event.
1280
+ if (!this.isTabEvent(event)) {
1281
+ return;
1282
+ }
1283
+ // Trap the focus inside the element.
1284
+ return this.trapFocus(event);
1285
+ }
1286
+ trapFocus(event) {
1287
+ // Validate that the DOM is available.
1288
+ if (!this._platform.isBrowser) {
1289
+ return;
1290
+ }
1291
+ // Get all focusable nodes.
1292
+ const focusableNodes = this.getFocusableNodes();
1293
+ // Focus the first available element if the focus
1294
+ // is not in the modal.
1295
+ if (!this.element.contains(document.activeElement)) {
1296
+ return this.focus(focusableNodes[0]);
1297
+ }
1298
+ const focusedItemIndex = focusableNodes.indexOf(document.activeElement);
1299
+ if (event.shiftKey && focusedItemIndex === 0) {
1300
+ this.focus(focusableNodes[focusableNodes.length - 1]);
1301
+ return event.preventDefault();
1302
+ }
1303
+ if (!event.shiftKey && focusedItemIndex === focusableNodes.length - 1) {
1304
+ this.focus(focusableNodes[0]);
1305
+ return event.preventDefault();
1306
+ }
1307
+ }
1308
+ get element() {
1309
+ return this._elementRef.nativeElement;
1310
+ }
1311
+ getFocusableNodes() {
1312
+ const nodes = this.element.querySelectorAll(this._focusableElements);
1313
+ return Array(...nodes);
1314
+ }
1315
+ }
1316
+ BbFocusTrap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbFocusTrap, deps: [{ token: i1$1.Platform }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1317
+ BbFocusTrap.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.4", type: BbFocusTrap, selector: "[bbFocusTrap]", host: { listeners: { "keydown": "onKeydown($event)" } }, ngImport: i0 });
1318
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbFocusTrap, decorators: [{
1319
+ type: Directive,
1320
+ args: [{
1321
+ selector: '[bbFocusTrap]'
1322
+ }]
1323
+ }], ctorParameters: function () { return [{ type: i1$1.Platform }, { type: i0.ElementRef }]; }, propDecorators: { onKeydown: [{
1324
+ type: HostListener,
1325
+ args: ['keydown', ['$event']]
1326
1326
  }] } });
1327
1327
 
1328
- class BbAutosize {
1329
- constructor(_renderer, _elementRef) {
1330
- this._renderer = _renderer;
1331
- this._elementRef = _elementRef;
1332
- // Min/max heights for the textarea.
1333
- this.minHeight = null;
1334
- this.maxHeight = null;
1335
- this.rows = 1;
1336
- }
1337
- get element() {
1338
- return this._elementRef?.nativeElement;
1339
- }
1340
- ngAfterViewInit() {
1341
- // Update the styles after the DOM has loaded.
1342
- this.updateStyles();
1343
- }
1344
- onWindowResize() {
1345
- // Update the styles when the window is resized.
1346
- this.updateStyles();
1347
- }
1348
- onInputReceived() {
1349
- // Update the styles after the textarea received input.
1350
- this.updateStyles();
1351
- }
1352
- updateStyles() {
1353
- // Validate the element exists.
1354
- if (!this.element) {
1355
- return;
1356
- }
1357
- // Calculate border height which is not included in the scroll height.
1358
- const borderHeight = this.element?.offsetHeight - this.element?.clientHeight;
1359
- // Reset textarea height to auto that correctly calculate the new height.
1360
- this.setHeight('auto');
1361
- // Set new height.
1362
- this.setHeight(`${this.element?.scrollHeight + borderHeight}px`);
1363
- }
1364
- setHeight(value) {
1365
- this._renderer.setStyle(this.element, 'height', value);
1366
- }
1367
- }
1368
- BbAutosize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbAutosize, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1369
- BbAutosize.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.3", 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 });
1370
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbAutosize, decorators: [{
1371
- type: Directive,
1372
- args: [{
1373
- selector: 'textarea[bbAutosize]'
1374
- }]
1375
- }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { minHeight: [{
1376
- type: Input
1377
- }, {
1378
- type: HostBinding,
1379
- args: ['style.min-height']
1380
- }], maxHeight: [{
1381
- type: Input
1382
- }, {
1383
- type: HostBinding,
1384
- args: ['style.max-height']
1385
- }], rows: [{
1386
- type: Input
1387
- }, {
1388
- type: HostBinding,
1389
- args: ['rows']
1390
- }], onWindowResize: [{
1391
- type: HostListener,
1392
- args: ['window:resize']
1393
- }], onInputReceived: [{
1394
- type: HostListener,
1395
- args: ['input']
1328
+ class BbAutosize {
1329
+ constructor(_renderer, _elementRef) {
1330
+ this._renderer = _renderer;
1331
+ this._elementRef = _elementRef;
1332
+ // Min/max heights for the textarea.
1333
+ this.minHeight = null;
1334
+ this.maxHeight = null;
1335
+ this.rows = 1;
1336
+ }
1337
+ get element() {
1338
+ return this._elementRef?.nativeElement;
1339
+ }
1340
+ ngAfterViewInit() {
1341
+ // Update the styles after the DOM has loaded.
1342
+ this.updateStyles();
1343
+ }
1344
+ onWindowResize() {
1345
+ // Update the styles when the window is resized.
1346
+ this.updateStyles();
1347
+ }
1348
+ onInputReceived() {
1349
+ // Update the styles after the textarea received input.
1350
+ this.updateStyles();
1351
+ }
1352
+ updateStyles() {
1353
+ // Validate the element exists.
1354
+ if (!this.element) {
1355
+ return;
1356
+ }
1357
+ // Calculate border height which is not included in the scroll height.
1358
+ const borderHeight = this.element?.offsetHeight - this.element?.clientHeight;
1359
+ // Reset textarea height to auto that correctly calculate the new height.
1360
+ this.setHeight('auto');
1361
+ // Set new height.
1362
+ this.setHeight(`${this.element?.scrollHeight + borderHeight}px`);
1363
+ }
1364
+ setHeight(value) {
1365
+ this._renderer.setStyle(this.element, 'height', value);
1366
+ }
1367
+ }
1368
+ BbAutosize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbAutosize, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1369
+ BbAutosize.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.4", 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 });
1370
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbAutosize, decorators: [{
1371
+ type: Directive,
1372
+ args: [{
1373
+ selector: 'textarea[bbAutosize]'
1374
+ }]
1375
+ }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { minHeight: [{
1376
+ type: Input
1377
+ }, {
1378
+ type: HostBinding,
1379
+ args: ['style.min-height']
1380
+ }], maxHeight: [{
1381
+ type: Input
1382
+ }, {
1383
+ type: HostBinding,
1384
+ args: ['style.max-height']
1385
+ }], rows: [{
1386
+ type: Input
1387
+ }, {
1388
+ type: HostBinding,
1389
+ args: ['rows']
1390
+ }], onWindowResize: [{
1391
+ type: HostListener,
1392
+ args: ['window:resize']
1393
+ }], onInputReceived: [{
1394
+ type: HostListener,
1395
+ args: ['input']
1396
1396
  }] } });
1397
1397
 
1398
- class BbRelativeTime {
1399
- constructor(_localize, _localeId) {
1400
- this._localize = _localize;
1401
- this._localeId = _localeId;
1402
- this.isValidDate = (date) => {
1403
- return typeof date === 'object' &&
1404
- typeof date.getTime === 'function' &&
1405
- !isNaN(date.getTime());
1406
- };
1407
- this.parseAsDate = (value) => {
1408
- // Add a Z after the date so
1409
- // it is treated as a UTC date.
1410
- 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)) {
1411
- return new Date(`${value}Z`);
1412
- }
1413
- // Return the regular parsed date.
1414
- return new Date(value);
1415
- };
1416
- this.isToday = (date) => {
1417
- const today = new Date();
1418
- return date?.getDate() === today?.getDate() &&
1419
- date?.getMonth() === today?.getMonth() &&
1420
- date?.getFullYear() === today?.getFullYear();
1421
- };
1422
- this.isYesterday = (date) => {
1423
- const yesterday = new Date(new Date()?.setDate(new Date()?.getDate() - 1));
1424
- return date?.getDate() === yesterday?.getDate() &&
1425
- date?.getMonth() === yesterday?.getMonth() &&
1426
- date?.getFullYear() === yesterday?.getFullYear();
1427
- };
1428
- this.isTomorrow = (date) => {
1429
- const tomorrow = new Date(new Date()?.setDate(new Date()?.getDate() + 1));
1430
- return date?.getDate() === tomorrow?.getDate() &&
1431
- date?.getMonth() === tomorrow?.getMonth() &&
1432
- date?.getFullYear() === tomorrow?.getFullYear();
1433
- };
1434
- this._datePipe = new DatePipe(this._localeId);
1435
- }
1436
- transform(value) {
1437
- // Parse the value to a date object.
1438
- const date = this.parseAsDate(value);
1439
- // Check if the date is valid.
1440
- if (!this.isValidDate(date)) {
1441
- return value;
1442
- }
1443
- // Return the formatted date.
1444
- return this.format(date);
1445
- }
1446
- format(date) {
1447
- // It happens tomorrow.
1448
- if (this.isTomorrow(date)) {
1449
- return this.formatString(date, 'times.tomorrow_at', 'shortTime');
1450
- }
1451
- // It happened today.
1452
- if (this.isToday(date)) {
1453
- return this.formatString(date, 'times.today_at', 'shortTime');
1454
- }
1455
- // It happened yesterday.
1456
- if (this.isYesterday(date)) {
1457
- return this.formatString(date, 'times.yesterday_at', 'shortTime');
1458
- }
1459
- // Just return the date.
1460
- return this.formatString(date);
1461
- }
1462
- formatString(date, token, format) {
1463
- // Just return the parsed date.
1464
- if (!this._localize || !token || !format) {
1465
- return this._datePipe.transform(date, 'mediumDate');
1466
- }
1467
- // Return the translated formatting.
1468
- return this._localize.translate({
1469
- token: token,
1470
- data: { date: this._datePipe.transform(date, format) }
1471
- });
1472
- }
1473
- }
1474
- BbRelativeTime.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbRelativeTime, deps: [{ token: i4.Localize, optional: true }, { token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Pipe });
1475
- BbRelativeTime.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.3", ngImport: i0, type: BbRelativeTime, name: "bbRelativeTime" });
1476
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbRelativeTime, decorators: [{
1477
- type: Pipe,
1478
- args: [{
1479
- name: 'bbRelativeTime'
1480
- }]
1481
- }], ctorParameters: function () { return [{ type: i4.Localize, decorators: [{
1482
- type: Optional
1483
- }] }, { type: undefined, decorators: [{
1484
- type: Inject,
1485
- args: [LOCALE_ID]
1398
+ class BbRelativeTime {
1399
+ constructor(_localize, _localeId) {
1400
+ this._localize = _localize;
1401
+ this._localeId = _localeId;
1402
+ this.isValidDate = (date) => {
1403
+ return typeof date === 'object' &&
1404
+ typeof date.getTime === 'function' &&
1405
+ !isNaN(date.getTime());
1406
+ };
1407
+ this.parseAsDate = (value) => {
1408
+ // Add a Z after the date so
1409
+ // it is treated as a UTC date.
1410
+ 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)) {
1411
+ return new Date(`${value}Z`);
1412
+ }
1413
+ // Return the regular parsed date.
1414
+ return new Date(value);
1415
+ };
1416
+ this.isToday = (date) => {
1417
+ const today = new Date();
1418
+ return date?.getDate() === today?.getDate() &&
1419
+ date?.getMonth() === today?.getMonth() &&
1420
+ date?.getFullYear() === today?.getFullYear();
1421
+ };
1422
+ this.isYesterday = (date) => {
1423
+ const yesterday = new Date(new Date()?.setDate(new Date()?.getDate() - 1));
1424
+ return date?.getDate() === yesterday?.getDate() &&
1425
+ date?.getMonth() === yesterday?.getMonth() &&
1426
+ date?.getFullYear() === yesterday?.getFullYear();
1427
+ };
1428
+ this.isTomorrow = (date) => {
1429
+ const tomorrow = new Date(new Date()?.setDate(new Date()?.getDate() + 1));
1430
+ return date?.getDate() === tomorrow?.getDate() &&
1431
+ date?.getMonth() === tomorrow?.getMonth() &&
1432
+ date?.getFullYear() === tomorrow?.getFullYear();
1433
+ };
1434
+ this._datePipe = new DatePipe(this._localeId);
1435
+ }
1436
+ transform(value) {
1437
+ // Parse the value to a date object.
1438
+ const date = this.parseAsDate(value);
1439
+ // Check if the date is valid.
1440
+ if (!this.isValidDate(date)) {
1441
+ return value;
1442
+ }
1443
+ // Return the formatted date.
1444
+ return this.format(date);
1445
+ }
1446
+ format(date) {
1447
+ // It happens tomorrow.
1448
+ if (this.isTomorrow(date)) {
1449
+ return this.formatString(date, 'times.tomorrow_at', 'shortTime');
1450
+ }
1451
+ // It happened today.
1452
+ if (this.isToday(date)) {
1453
+ return this.formatString(date, 'times.today_at', 'shortTime');
1454
+ }
1455
+ // It happened yesterday.
1456
+ if (this.isYesterday(date)) {
1457
+ return this.formatString(date, 'times.yesterday_at', 'shortTime');
1458
+ }
1459
+ // Just return the date.
1460
+ return this.formatString(date);
1461
+ }
1462
+ formatString(date, token, format) {
1463
+ // Just return the parsed date.
1464
+ if (!this._localize || !token || !format) {
1465
+ return this._datePipe.transform(date, 'mediumDate');
1466
+ }
1467
+ // Return the translated formatting.
1468
+ return this._localize.translate({
1469
+ token: token,
1470
+ data: { date: this._datePipe.transform(date, format) }
1471
+ });
1472
+ }
1473
+ }
1474
+ BbRelativeTime.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbRelativeTime, deps: [{ token: i4.Localize, optional: true }, { token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Pipe });
1475
+ BbRelativeTime.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.4", ngImport: i0, type: BbRelativeTime, name: "bbRelativeTime" });
1476
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbRelativeTime, decorators: [{
1477
+ type: Pipe,
1478
+ args: [{
1479
+ name: 'bbRelativeTime'
1480
+ }]
1481
+ }], ctorParameters: function () { return [{ type: i4.Localize, decorators: [{
1482
+ type: Optional
1483
+ }] }, { type: undefined, decorators: [{
1484
+ type: Inject,
1485
+ args: [LOCALE_ID]
1486
1486
  }] }]; } });
1487
1487
 
1488
- let nextUniqueId = 0;
1489
- class BbCheckboxBase {
1490
- }
1491
- const BbCheckboxMixinBase = mixinDisabled(mixinGrouped(BbCheckboxBase));
1492
- class BbCheckbox extends BbCheckboxMixinBase {
1493
- constructor(_changeDetection) {
1494
- super();
1495
- this._changeDetection = _changeDetection;
1496
- // Data.
1497
- this.labelId = `bb-checkbox-${nextUniqueId++}`;
1498
- this._checked = false;
1499
- // Methods.
1500
- this.onChange = () => {
1501
- };
1502
- this.onTouched = () => {
1503
- };
1504
- }
1505
- get checked() {
1506
- return this._checked;
1507
- }
1508
- set checked(value) {
1509
- this._checked = coerceBooleanProperty(value);
1510
- this._changeDetection.markForCheck();
1511
- }
1512
- registerOnChange(fn) {
1513
- this.onChange = fn;
1514
- }
1515
- registerOnTouched(fn) {
1516
- this.onTouched = fn;
1517
- }
1518
- setDisabledState(isDisabled) {
1519
- this.disabled = isDisabled;
1520
- this._changeDetection.markForCheck();
1521
- }
1522
- writeValue(newValue) {
1523
- this.checked = newValue;
1524
- }
1525
- onInteractionEvent(event) {
1526
- // Stop the propagation to prevent it from bubbling up.
1527
- event.stopPropagation();
1528
- }
1529
- onInputClick(event) {
1530
- // Stop the propagation to prevent it from bubbling up.
1531
- event.stopPropagation();
1532
- // Toggle the value.
1533
- this.checked = !this.checked;
1534
- // Emit the change event.
1535
- this.onChange && this.onChange(this.checked);
1536
- }
1537
- }
1538
- BbCheckbox.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbCheckbox, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1539
- BbCheckbox.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.3", type: BbCheckbox, selector: "bb-checkbox", inputs: { grouped: "grouped", disabled: "disabled", tabIndex: "tabIndex", checked: "checked" }, host: { properties: { "class.grouped": "grouped" }, classAttribute: "bb-checkbox" }, providers: [
1540
- { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbCheckbox), multi: true }
1541
- ], usesInheritance: true, ngImport: i0, template: "<input [id]=\"labelId\"\r\n [checked]=\"checked\"\r\n [disabled]=\"disabled\"\r\n (change)=\"onInteractionEvent($event)\"\r\n (click)=\"onInputClick($event)\"\r\n class=\"bb-checkbox-input\"\r\n tabindex=\"-1\"\r\n type=\"checkbox\">\r\n\r\n<label [for]=\"labelId\"\r\n [attr.tabindex]=\"disabled ? -1 : (tabIndex || 0)\"\r\n (keyup.space)=\"onInputClick($event)\"\r\n class=\"bb-checkbox-label\">\r\n <span>\r\n <svg width=\"12px\"\r\n height=\"10px\"\r\n viewbox=\"0 0 12 10\">\r\n <polyline points=\"1.5 6 4.5 9 10.5 1\"></polyline>\r\n </svg>\r\n </span>\r\n <span>\r\n <ng-content></ng-content>\r\n </span>\r\n</label>\r\n", styles: [".bb-checkbox{display:block}.bb-checkbox+.bb-checkbox{margin-top:5px}.bb-checkbox.grouped{margin-bottom:20px}.bb-checkbox-input{display:none}.bb-checkbox-label{margin:0;display:flex;cursor:pointer;-webkit-user-select:none;user-select:none}.bb-checkbox-label>span{display:inline-block;vertical-align:middle;transform: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 #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 });
1542
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbCheckbox, decorators: [{
1543
- type: Component,
1544
- args: [{ selector: 'bb-checkbox', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
1545
- { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbCheckbox), multi: true }
1546
- ], host: {
1547
- 'class': 'bb-checkbox',
1548
- '[class.grouped]': 'grouped'
1549
- }, inputs: ['grouped', 'disabled'], preserveWhitespaces: false, template: "<input [id]=\"labelId\"\r\n [checked]=\"checked\"\r\n [disabled]=\"disabled\"\r\n (change)=\"onInteractionEvent($event)\"\r\n (click)=\"onInputClick($event)\"\r\n class=\"bb-checkbox-input\"\r\n tabindex=\"-1\"\r\n type=\"checkbox\">\r\n\r\n<label [for]=\"labelId\"\r\n [attr.tabindex]=\"disabled ? -1 : (tabIndex || 0)\"\r\n (keyup.space)=\"onInputClick($event)\"\r\n class=\"bb-checkbox-label\">\r\n <span>\r\n <svg width=\"12px\"\r\n height=\"10px\"\r\n viewbox=\"0 0 12 10\">\r\n <polyline points=\"1.5 6 4.5 9 10.5 1\"></polyline>\r\n </svg>\r\n </span>\r\n <span>\r\n <ng-content></ng-content>\r\n </span>\r\n</label>\r\n", styles: [".bb-checkbox{display:block}.bb-checkbox+.bb-checkbox{margin-top:5px}.bb-checkbox.grouped{margin-bottom:20px}.bb-checkbox-input{display:none}.bb-checkbox-label{margin:0;display:flex;cursor:pointer;-webkit-user-select:none;user-select:none}.bb-checkbox-label>span{display:inline-block;vertical-align:middle;transform: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 #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"] }]
1550
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { tabIndex: [{
1551
- type: Input
1552
- }], checked: [{
1553
- type: Input
1488
+ let nextUniqueId = 0;
1489
+ class BbCheckboxBase {
1490
+ }
1491
+ const BbCheckboxMixinBase = mixinDisabled(mixinGrouped(BbCheckboxBase));
1492
+ class BbCheckbox extends BbCheckboxMixinBase {
1493
+ constructor(_changeDetection) {
1494
+ super();
1495
+ this._changeDetection = _changeDetection;
1496
+ // Data.
1497
+ this.labelId = `bb-checkbox-${nextUniqueId++}`;
1498
+ this._checked = false;
1499
+ // Methods.
1500
+ this.onChange = () => {
1501
+ };
1502
+ this.onTouched = () => {
1503
+ };
1504
+ }
1505
+ get checked() {
1506
+ return this._checked;
1507
+ }
1508
+ set checked(value) {
1509
+ this._checked = coerceBooleanProperty(value);
1510
+ this._changeDetection.markForCheck();
1511
+ }
1512
+ registerOnChange(fn) {
1513
+ this.onChange = fn;
1514
+ }
1515
+ registerOnTouched(fn) {
1516
+ this.onTouched = fn;
1517
+ }
1518
+ setDisabledState(isDisabled) {
1519
+ this.disabled = isDisabled;
1520
+ this._changeDetection.markForCheck();
1521
+ }
1522
+ writeValue(newValue) {
1523
+ this.checked = newValue;
1524
+ }
1525
+ onInteractionEvent(event) {
1526
+ // Stop the propagation to prevent it from bubbling up.
1527
+ event.stopPropagation();
1528
+ }
1529
+ onInputClick(event) {
1530
+ // Stop the propagation to prevent it from bubbling up.
1531
+ event.stopPropagation();
1532
+ // Toggle the value.
1533
+ this.checked = !this.checked;
1534
+ // Emit the change event.
1535
+ this.onChange && this.onChange(this.checked);
1536
+ }
1537
+ }
1538
+ BbCheckbox.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbCheckbox, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1539
+ BbCheckbox.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.4", type: BbCheckbox, selector: "bb-checkbox", inputs: { grouped: "grouped", disabled: "disabled", tabIndex: "tabIndex", checked: "checked" }, host: { properties: { "class.grouped": "grouped" }, classAttribute: "bb-checkbox" }, providers: [
1540
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbCheckbox), multi: true }
1541
+ ], usesInheritance: true, ngImport: i0, template: "<input [id]=\"labelId\"\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n (change)=\"onInteractionEvent($event)\"\n (click)=\"onInputClick($event)\"\n class=\"bb-checkbox-input\"\n tabindex=\"-1\"\n type=\"checkbox\">\n\n<label [for]=\"labelId\"\n [attr.tabindex]=\"disabled ? -1 : (tabIndex || 0)\"\n (keyup.space)=\"onInputClick($event)\"\n class=\"bb-checkbox-label\">\n <span>\n <svg width=\"12px\"\n height=\"10px\"\n viewbox=\"0 0 12 10\">\n <polyline points=\"1.5 6 4.5 9 10.5 1\"></polyline>\n </svg>\n </span>\n <span>\n <ng-content></ng-content>\n </span>\n</label>\n", styles: [".bb-checkbox{display:block}.bb-checkbox+.bb-checkbox{margin-top:5px}.bb-checkbox.grouped{margin-bottom:20px}.bb-checkbox-input{display:none}.bb-checkbox-label{margin:0;display:flex;cursor:pointer;-webkit-user-select:none;user-select:none}.bb-checkbox-label>span{display:inline-block;vertical-align:middle;transform: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 #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 });
1542
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbCheckbox, decorators: [{
1543
+ type: Component,
1544
+ args: [{ selector: 'bb-checkbox', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
1545
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbCheckbox), multi: true }
1546
+ ], host: {
1547
+ 'class': 'bb-checkbox',
1548
+ '[class.grouped]': 'grouped'
1549
+ }, inputs: ['grouped', 'disabled'], preserveWhitespaces: false, template: "<input [id]=\"labelId\"\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n (change)=\"onInteractionEvent($event)\"\n (click)=\"onInputClick($event)\"\n class=\"bb-checkbox-input\"\n tabindex=\"-1\"\n type=\"checkbox\">\n\n<label [for]=\"labelId\"\n [attr.tabindex]=\"disabled ? -1 : (tabIndex || 0)\"\n (keyup.space)=\"onInputClick($event)\"\n class=\"bb-checkbox-label\">\n <span>\n <svg width=\"12px\"\n height=\"10px\"\n viewbox=\"0 0 12 10\">\n <polyline points=\"1.5 6 4.5 9 10.5 1\"></polyline>\n </svg>\n </span>\n <span>\n <ng-content></ng-content>\n </span>\n</label>\n", styles: [".bb-checkbox{display:block}.bb-checkbox+.bb-checkbox{margin-top:5px}.bb-checkbox.grouped{margin-bottom:20px}.bb-checkbox-input{display:none}.bb-checkbox-label{margin:0;display:flex;cursor:pointer;-webkit-user-select:none;user-select:none}.bb-checkbox-label>span{display:inline-block;vertical-align:middle;transform: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 #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"] }]
1550
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { tabIndex: [{
1551
+ type: Input
1552
+ }], checked: [{
1553
+ type: Input
1554
1554
  }] } });
1555
1555
 
1556
- class BbFocus {
1557
- constructor(_zone, _platform, _elementRef) {
1558
- this._zone = _zone;
1559
- this._platform = _platform;
1560
- this._elementRef = _elementRef;
1561
- }
1562
- get nativeElement() {
1563
- return this._elementRef.nativeElement;
1564
- }
1565
- ngAfterViewInit() {
1566
- // Run the method outside the Angular zone.
1567
- this._zone.runOutsideAngular(() => this.focus());
1568
- }
1569
- focus() {
1570
- // Check if set timeout exists and the user is
1571
- // using the site on desktop devices.
1572
- if (!this._platform.isDesktop || !setTimeout) {
1573
- return;
1574
- }
1575
- // Check if the element and the focus method exist, if so focus the element.
1576
- if (!this.nativeElement || !this.nativeElement.focus) {
1577
- return;
1578
- }
1579
- // Execute the focus method in a timeout.
1580
- setTimeout(() => this.nativeElement.focus(), 0);
1581
- }
1582
- }
1583
- BbFocus.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbFocus, deps: [{ token: i0.NgZone }, { token: i1$1.Platform }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1584
- BbFocus.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.3", type: BbFocus, selector: "[bbFocus]", ngImport: i0 });
1585
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbFocus, decorators: [{
1586
- type: Directive,
1587
- args: [{
1588
- selector: '[bbFocus]'
1589
- }]
1556
+ class BbFocus {
1557
+ constructor(_zone, _platform, _elementRef) {
1558
+ this._zone = _zone;
1559
+ this._platform = _platform;
1560
+ this._elementRef = _elementRef;
1561
+ }
1562
+ get nativeElement() {
1563
+ return this._elementRef.nativeElement;
1564
+ }
1565
+ ngAfterViewInit() {
1566
+ // Run the method outside the Angular zone.
1567
+ this._zone.runOutsideAngular(() => this.focus());
1568
+ }
1569
+ focus() {
1570
+ // Check if set timeout exists and the user is
1571
+ // using the site on desktop devices.
1572
+ if (!this._platform.isDesktop || !setTimeout) {
1573
+ return;
1574
+ }
1575
+ // Check if the element and the focus method exist, if so focus the element.
1576
+ if (!this.nativeElement || !this.nativeElement.focus) {
1577
+ return;
1578
+ }
1579
+ // Execute the focus method in a timeout.
1580
+ setTimeout(() => this.nativeElement.focus(), 0);
1581
+ }
1582
+ }
1583
+ BbFocus.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbFocus, deps: [{ token: i0.NgZone }, { token: i1$1.Platform }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1584
+ BbFocus.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.4", type: BbFocus, selector: "[bbFocus]", ngImport: i0 });
1585
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbFocus, decorators: [{
1586
+ type: Directive,
1587
+ args: [{
1588
+ selector: '[bbFocus]'
1589
+ }]
1590
1590
  }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i1$1.Platform }, { type: i0.ElementRef }]; } });
1591
1591
 
1592
- class BbAvatar {
1593
- constructor() {
1594
- // Inputs.
1595
- this.size = 40;
1596
- // State.
1597
- this.state$ = new BehaviorSubject('initials');
1598
- // Data.
1599
- this._src = null;
1600
- this._title = null;
1601
- this._initials = '!';
1602
- this._color = 'rgb(255, 255, 255)';
1603
- this._backgroundColor = 'rgb(66, 66, 66)';
1604
- this.toRGb = (value) => {
1605
- const baseRed = 128;
1606
- const baseGreen = 128;
1607
- const baseBlue = 128;
1608
- let seed = value.charCodeAt(0) ^ value.charCodeAt(1);
1609
- const rand_1 = Math.abs((Math.sin(seed++) * 10000)) % 256;
1610
- const rand_2 = Math.abs((Math.sin(seed++) * 10000)) % 256;
1611
- const rand_3 = Math.abs((Math.sin(seed++) * 10000)) % 256;
1612
- const r = Math.round((rand_1 + baseRed) / 2);
1613
- const g = Math.round((rand_2 + baseGreen) / 2);
1614
- const b = Math.round((rand_3 + baseBlue) / 2);
1615
- return { r, g, b };
1616
- };
1617
- this.getInitials = (name) => {
1618
- // Get all the initials.
1619
- const names = (name || '').split(' ');
1620
- const initials = names.map(name => name.charAt(0).toUpperCase());
1621
- // Check if there are any initials.
1622
- if (initials.length <= 0) {
1623
- return null;
1624
- }
1625
- // Get the first and last initials.
1626
- if (initials.length > 1) {
1627
- return `${initials[0]}${initials[initials.length - 1]}`;
1628
- }
1629
- // Get only the first initial.
1630
- return initials[0];
1631
- };
1632
- this.parseColorFormat = (value) => {
1633
- if (!value) {
1634
- return null;
1635
- }
1636
- // Hex 3 values.
1637
- let match = value.match(/^#([0-9a-f]{3})$/i);
1638
- if (match && match[1]) {
1639
- const r = parseInt(match[1].charAt(0), 16) * 0x11;
1640
- const g = parseInt(match[1].charAt(1), 16) * 0x11;
1641
- const b = parseInt(match[1].charAt(2), 16) * 0x11;
1642
- return { r, g, b };
1643
- }
1644
- // Hex 6 values.
1645
- match = value.match(/^#([0-9a-f]{6})$/i);
1646
- if (match && match[1]) {
1647
- const r = parseInt(match[1].substr(0, 2), 16);
1648
- const g = parseInt(match[1].substr(2, 2), 16);
1649
- const b = parseInt(match[1].substr(4, 2), 16);
1650
- return { r, g, b };
1651
- }
1652
- // Rgb values.
1653
- match = value.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);
1654
- if (match) {
1655
- const r = parseInt(match[1], 10);
1656
- const g = parseInt(match[2], 10);
1657
- const b = parseInt(match[3], 10);
1658
- return { r, g, b };
1659
- }
1660
- // Not a supported color format.
1661
- console?.warn?.(`BbAvatar: Unsupported tintColor "${value}" was used.`);
1662
- return null;
1663
- };
1664
- }
1665
- set src(value) {
1666
- this._src = value;
1667
- if (this._src) {
1668
- this.state$.next('image');
1669
- }
1670
- }
1671
- set title(value) {
1672
- // Set the title and the initials.
1673
- this._title = value || '!';
1674
- this._initials = this.getInitials(this._title);
1675
- // Generate the colors based on the name.
1676
- const { r, g, b } = this.toRGb(this._title);
1677
- this.setColors(r, g, b);
1678
- }
1679
- set tintColor(value) {
1680
- const result = this.parseColorFormat(value);
1681
- if (!result) {
1682
- return;
1683
- }
1684
- const { r, g, b } = result;
1685
- this.setColors(r, g, b);
1686
- }
1687
- get src() {
1688
- return this._src;
1689
- }
1690
- get color() {
1691
- return this._color;
1692
- }
1693
- get backgroundColor() {
1694
- return this._backgroundColor;
1695
- }
1696
- get title() {
1697
- return this._title;
1698
- }
1699
- get initials() {
1700
- return this._initials;
1701
- }
1702
- setColors(red, green, blue) {
1703
- this._color = `rgb(${red},${green},${blue})`;
1704
- this._backgroundColor = `rgba(${red},${green},${blue}, 0.25)`;
1705
- }
1706
- }
1707
- BbAvatar.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbAvatar, deps: [], target: i0.ɵɵFactoryTarget.Component });
1708
- BbAvatar.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.3", type: BbAvatar, selector: "bb-avatar", inputs: { size: "size", src: "src", title: "title", tintColor: "tintColor" }, host: { attributes: { "role": "img" }, properties: { "style.width.px": "size", "style.height.px": "size", "style.font-size.px": "size / 2", "style.color": "color", "style.background-color": "backgroundColor", "attr.title": "this.title" }, classAttribute: "bb-avatar" }, ngImport: i0, template: "<ng-container [ngSwitch]=\"state$ | async\">\r\n <!-- Image. -->\r\n <ng-container *ngSwitchCase=\"'image'\">\r\n <img [src]=\"src\"\r\n [alt]=\"initials\"\r\n (error)=\"state$?.next('initials')\"\r\n class=\"bb-avatar-image\">\r\n </ng-container>\r\n\r\n <!-- Default initials fallback. -->\r\n <ng-container *ngSwitchDefault>\r\n {{ initials }}\r\n </ng-container>\r\n</ng-container>\r\n", styles: [".bb-avatar{line-height:1;font-size:18px;overflow:hidden;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;border-radius:50%;align-items:center;display:inline-flex;justify-content:center}.bb-avatar.rounded{border-radius:4px}.bb-avatar.square{border-radius:0}.bb-avatar-image{width:100%;height:100%;object-fit:cover;position:absolute}\n"], dependencies: [{ kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1709
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbAvatar, decorators: [{
1710
- type: Component,
1711
- args: [{ selector: 'bb-avatar', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, host: {
1712
- 'class': 'bb-avatar',
1713
- 'role': 'img',
1714
- '[style.width.px]': 'size',
1715
- '[style.height.px]': 'size',
1716
- '[style.font-size.px]': 'size / 2',
1717
- '[style.color]': 'color',
1718
- '[style.background-color]': 'backgroundColor'
1719
- }, template: "<ng-container [ngSwitch]=\"state$ | async\">\r\n <!-- Image. -->\r\n <ng-container *ngSwitchCase=\"'image'\">\r\n <img [src]=\"src\"\r\n [alt]=\"initials\"\r\n (error)=\"state$?.next('initials')\"\r\n class=\"bb-avatar-image\">\r\n </ng-container>\r\n\r\n <!-- Default initials fallback. -->\r\n <ng-container *ngSwitchDefault>\r\n {{ initials }}\r\n </ng-container>\r\n</ng-container>\r\n", styles: [".bb-avatar{line-height:1;font-size:18px;overflow:hidden;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;border-radius:50%;align-items:center;display:inline-flex;justify-content:center}.bb-avatar.rounded{border-radius:4px}.bb-avatar.square{border-radius:0}.bb-avatar-image{width:100%;height:100%;object-fit:cover;position:absolute}\n"] }]
1720
- }], propDecorators: { size: [{
1721
- type: Input
1722
- }], src: [{
1723
- type: Input
1724
- }], title: [{
1725
- type: Input
1726
- }, {
1727
- type: HostBinding,
1728
- args: ['attr.title']
1729
- }], tintColor: [{
1730
- type: Input
1592
+ class BbAvatar {
1593
+ constructor() {
1594
+ // Inputs.
1595
+ this.size = 40;
1596
+ // State.
1597
+ this.state$ = new BehaviorSubject('initials');
1598
+ // Data.
1599
+ this._src = null;
1600
+ this._title = null;
1601
+ this._initials = '!';
1602
+ this._color = 'rgb(255, 255, 255)';
1603
+ this._backgroundColor = 'rgb(66, 66, 66)';
1604
+ this.toRGb = (value) => {
1605
+ const baseRed = 128;
1606
+ const baseGreen = 128;
1607
+ const baseBlue = 128;
1608
+ let seed = value.charCodeAt(0) ^ value.charCodeAt(1);
1609
+ const rand_1 = Math.abs((Math.sin(seed++) * 10000)) % 256;
1610
+ const rand_2 = Math.abs((Math.sin(seed++) * 10000)) % 256;
1611
+ const rand_3 = Math.abs((Math.sin(seed++) * 10000)) % 256;
1612
+ const r = Math.round((rand_1 + baseRed) / 2);
1613
+ const g = Math.round((rand_2 + baseGreen) / 2);
1614
+ const b = Math.round((rand_3 + baseBlue) / 2);
1615
+ return { r, g, b };
1616
+ };
1617
+ this.getInitials = (name) => {
1618
+ // Get all the initials.
1619
+ const names = (name || '').split(' ');
1620
+ const initials = names.map(name => name.charAt(0).toUpperCase());
1621
+ // Check if there are any initials.
1622
+ if (initials.length <= 0) {
1623
+ return null;
1624
+ }
1625
+ // Get the first and last initials.
1626
+ if (initials.length > 1) {
1627
+ return `${initials[0]}${initials[initials.length - 1]}`;
1628
+ }
1629
+ // Get only the first initial.
1630
+ return initials[0];
1631
+ };
1632
+ this.parseColorFormat = (value) => {
1633
+ if (!value) {
1634
+ return null;
1635
+ }
1636
+ // Hex 3 values.
1637
+ let match = value.match(/^#([0-9a-f]{3})$/i);
1638
+ if (match && match[1]) {
1639
+ const r = parseInt(match[1].charAt(0), 16) * 0x11;
1640
+ const g = parseInt(match[1].charAt(1), 16) * 0x11;
1641
+ const b = parseInt(match[1].charAt(2), 16) * 0x11;
1642
+ return { r, g, b };
1643
+ }
1644
+ // Hex 6 values.
1645
+ match = value.match(/^#([0-9a-f]{6})$/i);
1646
+ if (match && match[1]) {
1647
+ const r = parseInt(match[1].substr(0, 2), 16);
1648
+ const g = parseInt(match[1].substr(2, 2), 16);
1649
+ const b = parseInt(match[1].substr(4, 2), 16);
1650
+ return { r, g, b };
1651
+ }
1652
+ // Rgb values.
1653
+ match = value.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);
1654
+ if (match) {
1655
+ const r = parseInt(match[1], 10);
1656
+ const g = parseInt(match[2], 10);
1657
+ const b = parseInt(match[3], 10);
1658
+ return { r, g, b };
1659
+ }
1660
+ // Not a supported color format.
1661
+ console?.warn?.(`BbAvatar: Unsupported tintColor "${value}" was used.`);
1662
+ return null;
1663
+ };
1664
+ }
1665
+ set src(value) {
1666
+ this._src = value;
1667
+ if (this._src) {
1668
+ this.state$.next('image');
1669
+ }
1670
+ }
1671
+ set title(value) {
1672
+ // Set the title and the initials.
1673
+ this._title = value || '!';
1674
+ this._initials = this.getInitials(this._title);
1675
+ // Generate the colors based on the name.
1676
+ const { r, g, b } = this.toRGb(this._title);
1677
+ this.setColors(r, g, b);
1678
+ }
1679
+ set tintColor(value) {
1680
+ const result = this.parseColorFormat(value);
1681
+ if (!result) {
1682
+ return;
1683
+ }
1684
+ const { r, g, b } = result;
1685
+ this.setColors(r, g, b);
1686
+ }
1687
+ get src() {
1688
+ return this._src;
1689
+ }
1690
+ get color() {
1691
+ return this._color;
1692
+ }
1693
+ get backgroundColor() {
1694
+ return this._backgroundColor;
1695
+ }
1696
+ get title() {
1697
+ return this._title;
1698
+ }
1699
+ get initials() {
1700
+ return this._initials;
1701
+ }
1702
+ setColors(red, green, blue) {
1703
+ this._color = `rgb(${red},${green},${blue})`;
1704
+ this._backgroundColor = `rgba(${red},${green},${blue}, 0.25)`;
1705
+ }
1706
+ }
1707
+ BbAvatar.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbAvatar, deps: [], target: i0.ɵɵFactoryTarget.Component });
1708
+ BbAvatar.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.4", type: BbAvatar, selector: "bb-avatar", inputs: { size: "size", src: "src", title: "title", tintColor: "tintColor" }, host: { attributes: { "role": "img" }, properties: { "style.width.px": "size", "style.height.px": "size", "style.font-size.px": "size / 2", "style.color": "color", "style.background-color": "backgroundColor", "attr.title": "this.title" }, classAttribute: "bb-avatar" }, ngImport: i0, template: "<ng-container [ngSwitch]=\"state$ | async\">\n <!-- Image. -->\n <ng-container *ngSwitchCase=\"'image'\">\n <img [src]=\"src\"\n [alt]=\"initials\"\n (error)=\"state$?.next('initials')\"\n class=\"bb-avatar-image\">\n </ng-container>\n\n <!-- Default initials fallback. -->\n <ng-container *ngSwitchDefault>\n {{ initials }}\n </ng-container>\n</ng-container>\n", styles: [".bb-avatar{line-height:1;font-size:18px;overflow:hidden;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;border-radius:50%;align-items:center;display:inline-flex;justify-content:center}.bb-avatar.rounded{border-radius:4px}.bb-avatar.square{border-radius:0}.bb-avatar-image{width:100%;height:100%;object-fit:cover;position:absolute}\n"], dependencies: [{ kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1709
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbAvatar, decorators: [{
1710
+ type: Component,
1711
+ args: [{ selector: 'bb-avatar', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, host: {
1712
+ 'class': 'bb-avatar',
1713
+ 'role': 'img',
1714
+ '[style.width.px]': 'size',
1715
+ '[style.height.px]': 'size',
1716
+ '[style.font-size.px]': 'size / 2',
1717
+ '[style.color]': 'color',
1718
+ '[style.background-color]': 'backgroundColor'
1719
+ }, template: "<ng-container [ngSwitch]=\"state$ | async\">\n <!-- Image. -->\n <ng-container *ngSwitchCase=\"'image'\">\n <img [src]=\"src\"\n [alt]=\"initials\"\n (error)=\"state$?.next('initials')\"\n class=\"bb-avatar-image\">\n </ng-container>\n\n <!-- Default initials fallback. -->\n <ng-container *ngSwitchDefault>\n {{ initials }}\n </ng-container>\n</ng-container>\n", styles: [".bb-avatar{line-height:1;font-size:18px;overflow:hidden;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;border-radius:50%;align-items:center;display:inline-flex;justify-content:center}.bb-avatar.rounded{border-radius:4px}.bb-avatar.square{border-radius:0}.bb-avatar-image{width:100%;height:100%;object-fit:cover;position:absolute}\n"] }]
1720
+ }], propDecorators: { size: [{
1721
+ type: Input
1722
+ }], src: [{
1723
+ type: Input
1724
+ }], title: [{
1725
+ type: Input
1726
+ }, {
1727
+ type: HostBinding,
1728
+ args: ['attr.title']
1729
+ }], tintColor: [{
1730
+ type: Input
1731
1731
  }] } });
1732
1732
 
1733
- class BbIcon {
1734
- constructor(_registry) {
1735
- this._registry = _registry;
1736
- // Data.
1737
- this._src = null;
1738
- // State.
1739
- this.state$ = new BehaviorSubject(null);
1740
- this.alt = null;
1741
- this.size = 24;
1742
- this._ariaHidden = true;
1743
- this.warn = (content) => {
1744
- return console && console.warn && console.warn(content);
1745
- };
1746
- }
1747
- set src(newValue) {
1748
- this.state$.next(this.convert(newValue));
1749
- this._src = newValue;
1750
- }
1751
- get src() {
1752
- return this._src;
1753
- }
1754
- set ariaHidden(newValue) {
1755
- this._ariaHidden = coerceBooleanProperty(newValue);
1756
- }
1757
- get ariaHidden() {
1758
- return this._ariaHidden;
1759
- }
1760
- convert(src) {
1761
- const [namespace, value] = (src || '').split(':');
1762
- const onError = () => {
1763
- this.warn(`ElementsModule: The icon with src "${src}" could not be rendered correctly; Did you put a correct src attribute?`);
1764
- return { type: 'unknown' };
1765
- };
1766
- if (!namespace || !value || !this._registry) {
1767
- return onError();
1768
- }
1769
- // Try to find a image icon.
1770
- const imageIcon = this.findImageIcon(namespace, value);
1771
- if (imageIcon) {
1772
- return imageIcon;
1773
- }
1774
- // Try to find a font icon.
1775
- const fontIcon = this.findFontIcon(namespace, value);
1776
- if (fontIcon) {
1777
- return fontIcon;
1778
- }
1779
- // Return the on error function.
1780
- return onError();
1781
- }
1782
- findImageIcon(namespace, value) {
1783
- const data = this._registry.find(item => item['namespace'] === namespace && item['name'] === value);
1784
- if (!data) {
1785
- return null;
1786
- }
1787
- return { type: data['type'], src: data['src'] };
1788
- }
1789
- findFontIcon(namespace, content) {
1790
- const data = this._registry.find(item => item['namespace'] === namespace);
1791
- if (!data) {
1792
- return null;
1793
- }
1794
- const uses = data['uses'];
1795
- if (uses === 'data-attribute') {
1796
- return { type: data['type'], className: data['className'], attribute: content };
1797
- }
1798
- return { type: data['type'], className: data['className'], content };
1799
- }
1800
- }
1801
- BbIcon.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbIcon, deps: [{ token: ELEMENTS_ICONS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1802
- BbIcon.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.3", type: BbIcon, selector: "bb-icon", inputs: { alt: "alt", size: "size", src: "src", ariaHidden: "ariaHidden" }, host: { properties: { "attr.aria-hidden": "ariaHidden", "style.width.px": "size", "style.height.px": "size", "style.min-width.px": "size", "style.min-height.px": "size", "style.font-size.px": "size" }, classAttribute: "bb-icon" }, ngImport: i0, template: "<ng-container *ngIf=\"state$ | async as data\"\r\n [ngSwitch]=\"data?.type\">\r\n <i *ngSwitchCase=\"'font'\"\r\n [attr.data-icon]=\"data?.attribute\"\r\n [class]=\"data?.className\">\r\n {{ data?.content }}\r\n </i>\r\n <img *ngSwitchCase=\"'image'\"\r\n [src]=\"data?.src\"\r\n [alt]=\"alt\">\r\n <svg *ngSwitchCase=\"'unknown'\"\r\n viewBox=\"0 0 1 1\">\r\n <rect x=\"0\" y=\"0\" width=\"1\" height=\"1\" fill=\"#c5c5c5\"></rect>\r\n </svg>\r\n</ng-container>\r\n", styles: [".bb-icon{display:flex;-webkit-user-select:none;user-select:none;align-items:center;justify-content:center}.bb-icon>i{font-size:inherit}.bb-icon>img,.bb-icon>svg{width:100%;height:100%;display:flex}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1803
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbIcon, decorators: [{
1804
- type: Component,
1805
- args: [{ selector: 'bb-icon', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
1806
- 'class': 'bb-icon',
1807
- '[attr.aria-hidden]': 'ariaHidden',
1808
- '[style.width.px]': 'size',
1809
- '[style.height.px]': 'size',
1810
- '[style.min-width.px]': 'size',
1811
- '[style.min-height.px]': 'size',
1812
- '[style.font-size.px]': 'size'
1813
- }, preserveWhitespaces: false, template: "<ng-container *ngIf=\"state$ | async as data\"\r\n [ngSwitch]=\"data?.type\">\r\n <i *ngSwitchCase=\"'font'\"\r\n [attr.data-icon]=\"data?.attribute\"\r\n [class]=\"data?.className\">\r\n {{ data?.content }}\r\n </i>\r\n <img *ngSwitchCase=\"'image'\"\r\n [src]=\"data?.src\"\r\n [alt]=\"alt\">\r\n <svg *ngSwitchCase=\"'unknown'\"\r\n viewBox=\"0 0 1 1\">\r\n <rect x=\"0\" y=\"0\" width=\"1\" height=\"1\" fill=\"#c5c5c5\"></rect>\r\n </svg>\r\n</ng-container>\r\n", styles: [".bb-icon{display:flex;-webkit-user-select:none;user-select:none;align-items:center;justify-content:center}.bb-icon>i{font-size:inherit}.bb-icon>img,.bb-icon>svg{width:100%;height:100%;display:flex}\n"] }]
1814
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1815
- type: Optional
1816
- }, {
1817
- type: Inject,
1818
- args: [ELEMENTS_ICONS]
1819
- }] }]; }, propDecorators: { alt: [{
1820
- type: Input
1821
- }], size: [{
1822
- type: Input
1823
- }], src: [{
1824
- type: Input
1825
- }], ariaHidden: [{
1826
- type: Input
1733
+ class BbIcon {
1734
+ constructor(_registry) {
1735
+ this._registry = _registry;
1736
+ // Data.
1737
+ this._src = null;
1738
+ // State.
1739
+ this.state$ = new BehaviorSubject(null);
1740
+ this.alt = null;
1741
+ this.size = 24;
1742
+ this._ariaHidden = true;
1743
+ this.warn = (content) => {
1744
+ return console && console.warn && console.warn(content);
1745
+ };
1746
+ }
1747
+ set src(newValue) {
1748
+ this.state$.next(this.convert(newValue));
1749
+ this._src = newValue;
1750
+ }
1751
+ get src() {
1752
+ return this._src;
1753
+ }
1754
+ set ariaHidden(newValue) {
1755
+ this._ariaHidden = coerceBooleanProperty(newValue);
1756
+ }
1757
+ get ariaHidden() {
1758
+ return this._ariaHidden;
1759
+ }
1760
+ convert(src) {
1761
+ const [namespace, value] = (src || '').split(':');
1762
+ const onError = () => {
1763
+ this.warn(`ElementsModule: The icon with src "${src}" could not be rendered correctly; Did you put a correct src attribute?`);
1764
+ return { type: 'unknown' };
1765
+ };
1766
+ if (!namespace || !value || !this._registry) {
1767
+ return onError();
1768
+ }
1769
+ // Try to find a image icon.
1770
+ const imageIcon = this.findImageIcon(namespace, value);
1771
+ if (imageIcon) {
1772
+ return imageIcon;
1773
+ }
1774
+ // Try to find a font icon.
1775
+ const fontIcon = this.findFontIcon(namespace, value);
1776
+ if (fontIcon) {
1777
+ return fontIcon;
1778
+ }
1779
+ // Return the on error function.
1780
+ return onError();
1781
+ }
1782
+ findImageIcon(namespace, value) {
1783
+ const data = this._registry.find(item => item['namespace'] === namespace && item['name'] === value);
1784
+ if (!data) {
1785
+ return null;
1786
+ }
1787
+ return { type: data['type'], src: data['src'] };
1788
+ }
1789
+ findFontIcon(namespace, content) {
1790
+ const data = this._registry.find(item => item['namespace'] === namespace);
1791
+ if (!data) {
1792
+ return null;
1793
+ }
1794
+ const uses = data['uses'];
1795
+ if (uses === 'data-attribute') {
1796
+ return { type: data['type'], className: data['className'], attribute: content };
1797
+ }
1798
+ return { type: data['type'], className: data['className'], content };
1799
+ }
1800
+ }
1801
+ BbIcon.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbIcon, deps: [{ token: ELEMENTS_ICONS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1802
+ BbIcon.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.4", type: BbIcon, selector: "bb-icon", inputs: { alt: "alt", size: "size", src: "src", ariaHidden: "ariaHidden" }, host: { properties: { "attr.aria-hidden": "ariaHidden", "style.width.px": "size", "style.height.px": "size", "style.min-width.px": "size", "style.min-height.px": "size", "style.font-size.px": "size" }, classAttribute: "bb-icon" }, ngImport: i0, template: "<ng-container *ngIf=\"state$ | async as data\"\n [ngSwitch]=\"data?.type\">\n <i *ngSwitchCase=\"'font'\"\n [attr.data-icon]=\"data?.attribute\"\n [class]=\"data?.className\">\n {{ data?.content }}\n </i>\n <img *ngSwitchCase=\"'image'\"\n [src]=\"data?.src\"\n [alt]=\"alt\">\n <svg *ngSwitchCase=\"'unknown'\"\n viewBox=\"0 0 1 1\">\n <rect x=\"0\" y=\"0\" width=\"1\" height=\"1\" fill=\"#c5c5c5\"></rect>\n </svg>\n</ng-container>\n", styles: [".bb-icon{display:flex;-webkit-user-select:none;user-select:none;align-items:center;justify-content:center}.bb-icon>i{font-size:inherit}.bb-icon>img,.bb-icon>svg{width:100%;height:100%;display:flex}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1803
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbIcon, decorators: [{
1804
+ type: Component,
1805
+ args: [{ selector: 'bb-icon', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
1806
+ 'class': 'bb-icon',
1807
+ '[attr.aria-hidden]': 'ariaHidden',
1808
+ '[style.width.px]': 'size',
1809
+ '[style.height.px]': 'size',
1810
+ '[style.min-width.px]': 'size',
1811
+ '[style.min-height.px]': 'size',
1812
+ '[style.font-size.px]': 'size'
1813
+ }, preserveWhitespaces: false, template: "<ng-container *ngIf=\"state$ | async as data\"\n [ngSwitch]=\"data?.type\">\n <i *ngSwitchCase=\"'font'\"\n [attr.data-icon]=\"data?.attribute\"\n [class]=\"data?.className\">\n {{ data?.content }}\n </i>\n <img *ngSwitchCase=\"'image'\"\n [src]=\"data?.src\"\n [alt]=\"alt\">\n <svg *ngSwitchCase=\"'unknown'\"\n viewBox=\"0 0 1 1\">\n <rect x=\"0\" y=\"0\" width=\"1\" height=\"1\" fill=\"#c5c5c5\"></rect>\n </svg>\n</ng-container>\n", styles: [".bb-icon{display:flex;-webkit-user-select:none;user-select:none;align-items:center;justify-content:center}.bb-icon>i{font-size:inherit}.bb-icon>img,.bb-icon>svg{width:100%;height:100%;display:flex}\n"] }]
1814
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1815
+ type: Optional
1816
+ }, {
1817
+ type: Inject,
1818
+ args: [ELEMENTS_ICONS]
1819
+ }] }]; }, propDecorators: { alt: [{
1820
+ type: Input
1821
+ }], size: [{
1822
+ type: Input
1823
+ }], src: [{
1824
+ type: Input
1825
+ }], ariaHidden: [{
1826
+ type: Input
1827
1827
  }] } });
1828
1828
 
1829
- class BbTag {
1830
- constructor() {
1831
- // Outputs.
1832
- this.onClose = new EventEmitter();
1833
- }
1834
- }
1835
- BbTag.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbTag, deps: [], target: i0.ɵɵFactoryTarget.Component });
1836
- BbTag.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.3", type: BbTag, selector: "bb-tag", outputs: { onClose: "onClose" }, host: { classAttribute: "bb-tag" }, ngImport: i0, template: "<ng-content></ng-content>\r\n\r\n<button *ngIf=\"onClose?.observed\"\r\n (click)=\"onClose.emit()\"\r\n type=\"button\">\r\n Close\r\n</button>", styles: [".bb-tag{cursor:default;padding:0 7px;font-size:12px;list-style:none;line-height:20px;border-radius:4px;white-space:nowrap;display:inline-block;color:#000000a6;border:1px solid #d9d9d9;background-color:#fafafa;font-variant:tabular-nums;font-feature-settings:\"tnum\"}.bb-tag:not(:last-child){margin-right:8px}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1837
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: BbTag, decorators: [{
1838
- type: Component,
1839
- args: [{ selector: 'bb-tag', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, host: { 'class': 'bb-tag' }, template: "<ng-content></ng-content>\r\n\r\n<button *ngIf=\"onClose?.observed\"\r\n (click)=\"onClose.emit()\"\r\n type=\"button\">\r\n Close\r\n</button>", styles: [".bb-tag{cursor:default;padding:0 7px;font-size:12px;list-style:none;line-height:20px;border-radius:4px;white-space:nowrap;display:inline-block;color:#000000a6;border:1px solid #d9d9d9;background-color:#fafafa;font-variant:tabular-nums;font-feature-settings:\"tnum\"}.bb-tag:not(:last-child){margin-right:8px}\n"] }]
1840
- }], propDecorators: { onClose: [{
1841
- type: Output
1829
+ class BbTag {
1830
+ constructor() {
1831
+ // Outputs.
1832
+ this.onClose = new EventEmitter();
1833
+ }
1834
+ }
1835
+ BbTag.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbTag, deps: [], target: i0.ɵɵFactoryTarget.Component });
1836
+ BbTag.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.4", type: BbTag, selector: "bb-tag", outputs: { onClose: "onClose" }, host: { classAttribute: "bb-tag" }, ngImport: i0, template: "<ng-content></ng-content>\n\n<button *ngIf=\"onClose?.observed\"\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"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1837
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: BbTag, decorators: [{
1838
+ type: Component,
1839
+ args: [{ selector: 'bb-tag', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, host: { 'class': 'bb-tag' }, template: "<ng-content></ng-content>\n\n<button *ngIf=\"onClose?.observed\"\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"] }]
1840
+ }], propDecorators: { onClose: [{
1841
+ type: Output
1842
1842
  }] } });
1843
1843
 
1844
- const DECLARATIONS_EXPORTS = [
1845
- // Directives.
1846
- BbTemplate,
1847
- BbFormError,
1848
- BbFormSubmit,
1849
- BbInput,
1850
- BbSelect,
1851
- BbFocus,
1852
- BbFocusTrap,
1853
- BbAutosize,
1854
- BbPrefix,
1855
- BbSuffix,
1856
- // Pipes.
1857
- BbFileSize,
1858
- BbFileImage,
1859
- BbRelativeTime,
1860
- // Components.
1861
- BbButton,
1862
- BbAnchor,
1863
- BbSpinner,
1864
- BbIcon,
1865
- BbFormControl,
1866
- BbFormGroup,
1867
- BbCheckbox,
1868
- BbDropdown,
1869
- BbDropdownItem,
1870
- BbTag,
1871
- BbAvatar,
1872
- BbFilePicker,
1873
- BbImagePicker,
1874
- BbDatePicker
1875
- ];
1876
- class ElementsModule {
1877
- static forRoot() {
1878
- return {
1879
- ngModule: ElementsModule,
1880
- providers: [
1881
- { provide: ELEMENTS_ERRORS, useFactory: getErrors, multi: true },
1882
- ELEMENTS_MATERIAL_ICON
1883
- ]
1884
- };
1885
- }
1886
- }
1887
- ElementsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: ElementsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1888
- ElementsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.3", ngImport: i0, type: ElementsModule, declarations: [
1889
- // Directives.
1890
- BbTemplate,
1891
- BbFormError,
1892
- BbFormSubmit,
1893
- BbInput,
1894
- BbSelect,
1895
- BbFocus,
1896
- BbFocusTrap,
1897
- BbAutosize,
1898
- BbPrefix,
1899
- BbSuffix,
1900
- // Pipes.
1901
- BbFileSize,
1902
- BbFileImage,
1903
- BbRelativeTime,
1904
- // Components.
1905
- BbButton,
1906
- BbAnchor,
1907
- BbSpinner,
1908
- BbIcon,
1909
- BbFormControl,
1910
- BbFormGroup,
1911
- BbCheckbox,
1912
- BbDropdown,
1913
- BbDropdownItem,
1914
- BbTag,
1915
- BbAvatar,
1916
- BbFilePicker,
1917
- BbImagePicker,
1918
- BbDatePicker], imports: [CommonModule, ReactiveFormsModule, LocalizeModule], exports: [
1919
- // Directives.
1920
- BbTemplate,
1921
- BbFormError,
1922
- BbFormSubmit,
1923
- BbInput,
1924
- BbSelect,
1925
- BbFocus,
1926
- BbFocusTrap,
1927
- BbAutosize,
1928
- BbPrefix,
1929
- BbSuffix,
1930
- // Pipes.
1931
- BbFileSize,
1932
- BbFileImage,
1933
- BbRelativeTime,
1934
- // Components.
1935
- BbButton,
1936
- BbAnchor,
1937
- BbSpinner,
1938
- BbIcon,
1939
- BbFormControl,
1940
- BbFormGroup,
1941
- BbCheckbox,
1942
- BbDropdown,
1943
- BbDropdownItem,
1944
- BbTag,
1945
- BbAvatar,
1946
- BbFilePicker,
1947
- BbImagePicker,
1948
- BbDatePicker] });
1949
- ElementsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: ElementsModule, imports: [CommonModule, ReactiveFormsModule, LocalizeModule] });
1950
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: ElementsModule, decorators: [{
1951
- type: NgModule,
1952
- args: [{
1953
- imports: [CommonModule, ReactiveFormsModule, LocalizeModule],
1954
- declarations: [...DECLARATIONS_EXPORTS],
1955
- exports: [...DECLARATIONS_EXPORTS]
1956
- }]
1957
- }] });
1958
- const ELEMENTS_MATERIAL_ICON = {
1959
- provide: ELEMENTS_ICONS,
1960
- useValue: { namespace: 'material', className: 'material-icons', uses: 'content', type: 'font' },
1961
- multi: true
1962
- };
1963
- function getErrors() {
1964
- const data = {
1965
- unknown: () => 'form-control-errors.unknown',
1966
- required: () => 'form-control-errors.required',
1967
- pattern: () => 'form-control-errors.pattern',
1968
- email: () => 'form-control-errors.email',
1969
- emailTaken: () => 'form-control-errors.emailTaken',
1970
- passwordMatch: () => 'form-control-errors.passwordMatch',
1971
- confirm: () => 'form-control-errors.confirm',
1972
- fullNumber: () => 'form-control-errors.fullNumber',
1973
- min: ({ min }) => ({ token: 'form-control-errors.min', data: { min } }),
1974
- max: ({ max }) => ({ token: 'form-control-errors.max', data: { max } }),
1975
- maxFileSize: ({ maxSize }) => ({ token: 'form-control-errors.maxFileSize', data: { maxSize } }),
1976
- minDate: ({ date }) => ({ token: 'form-control-errors.minDate', data: { date } }),
1977
- maxDate: ({ date }) => ({ token: 'form-control-errors.maxDate', data: { date } }),
1978
- invalidDate: () => 'form-control-errors.invalidDate',
1979
- invalidFileType: () => 'form-control-errors.invalidFileType',
1980
- minlength: ({ requiredLength, actualLength }) => ({
1981
- token: 'form-control-errors.minlength',
1982
- data: { requiredLength, actualLength }
1983
- }),
1984
- maxlength: ({ requiredLength, actualLength }) => ({
1985
- token: 'form-control-errors.maxlength',
1986
- data: { requiredLength, actualLength }
1987
- })
1988
- };
1989
- return data;
1844
+ const DECLARATIONS_EXPORTS = [
1845
+ // Directives.
1846
+ BbTemplate,
1847
+ BbFormError,
1848
+ BbFormSubmit,
1849
+ BbInput,
1850
+ BbSelect,
1851
+ BbFocus,
1852
+ BbFocusTrap,
1853
+ BbAutosize,
1854
+ BbPrefix,
1855
+ BbSuffix,
1856
+ // Pipes.
1857
+ BbFileSize,
1858
+ BbFileImage,
1859
+ BbRelativeTime,
1860
+ // Components.
1861
+ BbButton,
1862
+ BbAnchor,
1863
+ BbSpinner,
1864
+ BbIcon,
1865
+ BbFormControl,
1866
+ BbFormGroup,
1867
+ BbCheckbox,
1868
+ BbDropdown,
1869
+ BbDropdownItem,
1870
+ BbTag,
1871
+ BbAvatar,
1872
+ BbFilePicker,
1873
+ BbImagePicker,
1874
+ BbDatePicker
1875
+ ];
1876
+ class ElementsModule {
1877
+ static forRoot() {
1878
+ return {
1879
+ ngModule: ElementsModule,
1880
+ providers: [
1881
+ { provide: ELEMENTS_ERRORS, useFactory: getErrors, multi: true },
1882
+ ELEMENTS_MATERIAL_ICON
1883
+ ]
1884
+ };
1885
+ }
1886
+ }
1887
+ ElementsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: ElementsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1888
+ ElementsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.4", ngImport: i0, type: ElementsModule, declarations: [
1889
+ // Directives.
1890
+ BbTemplate,
1891
+ BbFormError,
1892
+ BbFormSubmit,
1893
+ BbInput,
1894
+ BbSelect,
1895
+ BbFocus,
1896
+ BbFocusTrap,
1897
+ BbAutosize,
1898
+ BbPrefix,
1899
+ BbSuffix,
1900
+ // Pipes.
1901
+ BbFileSize,
1902
+ BbFileImage,
1903
+ BbRelativeTime,
1904
+ // Components.
1905
+ BbButton,
1906
+ BbAnchor,
1907
+ BbSpinner,
1908
+ BbIcon,
1909
+ BbFormControl,
1910
+ BbFormGroup,
1911
+ BbCheckbox,
1912
+ BbDropdown,
1913
+ BbDropdownItem,
1914
+ BbTag,
1915
+ BbAvatar,
1916
+ BbFilePicker,
1917
+ BbImagePicker,
1918
+ BbDatePicker], imports: [CommonModule, ReactiveFormsModule, LocalizeModule], exports: [
1919
+ // Directives.
1920
+ BbTemplate,
1921
+ BbFormError,
1922
+ BbFormSubmit,
1923
+ BbInput,
1924
+ BbSelect,
1925
+ BbFocus,
1926
+ BbFocusTrap,
1927
+ BbAutosize,
1928
+ BbPrefix,
1929
+ BbSuffix,
1930
+ // Pipes.
1931
+ BbFileSize,
1932
+ BbFileImage,
1933
+ BbRelativeTime,
1934
+ // Components.
1935
+ BbButton,
1936
+ BbAnchor,
1937
+ BbSpinner,
1938
+ BbIcon,
1939
+ BbFormControl,
1940
+ BbFormGroup,
1941
+ BbCheckbox,
1942
+ BbDropdown,
1943
+ BbDropdownItem,
1944
+ BbTag,
1945
+ BbAvatar,
1946
+ BbFilePicker,
1947
+ BbImagePicker,
1948
+ BbDatePicker] });
1949
+ ElementsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: ElementsModule, imports: [CommonModule, ReactiveFormsModule, LocalizeModule] });
1950
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: ElementsModule, decorators: [{
1951
+ type: NgModule,
1952
+ args: [{
1953
+ imports: [CommonModule, ReactiveFormsModule, LocalizeModule],
1954
+ declarations: [...DECLARATIONS_EXPORTS],
1955
+ exports: [...DECLARATIONS_EXPORTS]
1956
+ }]
1957
+ }] });
1958
+ const ELEMENTS_MATERIAL_ICON = {
1959
+ provide: ELEMENTS_ICONS,
1960
+ useValue: { namespace: 'material', className: 'material-icons', uses: 'content', type: 'font' },
1961
+ multi: true
1962
+ };
1963
+ function getErrors() {
1964
+ const data = {
1965
+ unknown: () => 'form-control-errors.unknown',
1966
+ required: () => 'form-control-errors.required',
1967
+ pattern: () => 'form-control-errors.pattern',
1968
+ email: () => 'form-control-errors.email',
1969
+ emailTaken: () => 'form-control-errors.emailTaken',
1970
+ passwordMatch: () => 'form-control-errors.passwordMatch',
1971
+ confirm: () => 'form-control-errors.confirm',
1972
+ fullNumber: () => 'form-control-errors.fullNumber',
1973
+ min: ({ min }) => ({ token: 'form-control-errors.min', data: { min } }),
1974
+ max: ({ max }) => ({ token: 'form-control-errors.max', data: { max } }),
1975
+ maxFileSize: ({ maxSize }) => ({ token: 'form-control-errors.maxFileSize', data: { maxSize } }),
1976
+ minDate: ({ date }) => ({ token: 'form-control-errors.minDate', data: { date } }),
1977
+ maxDate: ({ date }) => ({ token: 'form-control-errors.maxDate', data: { date } }),
1978
+ invalidDate: () => 'form-control-errors.invalidDate',
1979
+ invalidFileType: () => 'form-control-errors.invalidFileType',
1980
+ minlength: ({ requiredLength, actualLength }) => ({
1981
+ token: 'form-control-errors.minlength',
1982
+ data: { requiredLength, actualLength }
1983
+ }),
1984
+ maxlength: ({ requiredLength, actualLength }) => ({
1985
+ token: 'form-control-errors.maxlength',
1986
+ data: { requiredLength, actualLength }
1987
+ })
1988
+ };
1989
+ return data;
1990
1990
  }
1991
1991
 
1992
- /**
1993
- * Generated bundle index. Do not edit.
1992
+ /**
1993
+ * Generated bundle index. Do not edit.
1994
1994
  */
1995
1995
 
1996
1996
  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 };