@bravobit/bb-foundation 0.15.6 → 0.16.3

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 (388) hide show
  1. package/auth/lib/auth.interceptor.d.ts +1 -1
  2. package/auth/lib/auth.service.d.ts +1 -1
  3. package/auth/package.json +5 -5
  4. package/collections/lib/collection.d.ts +1 -1
  5. package/collections/package.json +5 -5
  6. package/controls/bravobit-bb-foundation-controls.d.ts +5 -0
  7. package/controls/lib/checkbox/checkbox/checkbox.component.d.ts +47 -0
  8. package/controls/lib/checkbox/checkbox-group/checkbox-group.component.d.ts +18 -0
  9. package/controls/lib/checkbox/checkbox.module.d.ts +9 -0
  10. package/controls/lib/controls.module.d.ts +7 -0
  11. package/controls/package.json +10 -0
  12. package/controls/public_api.d.ts +4 -0
  13. package/dashboard/package.json +5 -5
  14. package/dialog/package.json +5 -5
  15. package/elements/package.json +5 -5
  16. package/{esm2015/auth/bravobit-bb-foundation-auth.js → esm2020/auth/bravobit-bb-foundation-auth.mjs} +0 -0
  17. package/esm2020/auth/lib/auth.interceptor.mjs +94 -0
  18. package/{esm2015/auth/lib/auth.module.js → esm2020/auth/lib/auth.module.mjs} +5 -5
  19. package/esm2020/auth/lib/auth.service.mjs +276 -0
  20. package/esm2020/auth/lib/auth.session.mjs +131 -0
  21. package/{esm2015/auth/lib/directives/authenticated.directive.js → esm2020/auth/lib/directives/authenticated.directive.mjs} +5 -6
  22. package/esm2020/auth/lib/directives/permission.directive.mjs +80 -0
  23. package/esm2020/auth/lib/directives/role.directive.mjs +37 -0
  24. package/esm2020/auth/lib/guards/anonymous.guard.mjs +34 -0
  25. package/esm2020/auth/lib/guards/authenticated.guard.mjs +35 -0
  26. package/{esm2015/auth/lib/helpers/jwt.helper.js → esm2020/auth/lib/helpers/jwt.helper.mjs} +3 -3
  27. package/{esm2015/auth/lib/helpers/mapper.helper.js → esm2020/auth/lib/helpers/mapper.helper.mjs} +4 -4
  28. package/{esm2015/auth/lib/interfaces/config.interface.js → esm2020/auth/lib/interfaces/config.interface.mjs} +0 -0
  29. package/{esm2015/auth/lib/interfaces/mapper.interface.js → esm2020/auth/lib/interfaces/mapper.interface.mjs} +0 -0
  30. package/{esm2015/auth/lib/interfaces/provider.interface.js → esm2020/auth/lib/interfaces/provider.interface.mjs} +0 -0
  31. package/{esm2015/auth/lib/interfaces/token.interface.js → esm2020/auth/lib/interfaces/token.interface.mjs} +0 -0
  32. package/esm2020/auth/lib/permissions.service.mjs +56 -0
  33. package/esm2020/auth/lib/providers/email.provider.mjs +25 -0
  34. package/esm2020/auth/lib/providers/verify.provider.mjs +19 -0
  35. package/{esm2015/auth/lib/tokens/use-authorization.token.js → esm2020/auth/lib/tokens/use-authorization.token.mjs} +0 -0
  36. package/{esm2015/auth/public_api.js → esm2020/auth/public_api.mjs} +0 -0
  37. package/{esm2015/bravobit-bb-foundation.js → esm2020/bravobit-bb-foundation.mjs} +0 -0
  38. package/{esm2015/collections/bravobit-bb-foundation-collections.js → esm2020/collections/bravobit-bb-foundation-collections.mjs} +0 -0
  39. package/esm2020/collections/lib/collection.mjs +102 -0
  40. package/{esm2015/collections/lib/collections.module.js → esm2020/collections/lib/collections.module.mjs} +5 -5
  41. package/esm2020/collections/lib/components/collections-pager/collections-pager.component.mjs +123 -0
  42. package/esm2020/collections/lib/components/collections-viewer/collections-viewer.component.mjs +31 -0
  43. package/{esm2015/collections/lib/components/collections.directive.js → esm2020/collections/lib/components/collections.directive.mjs} +13 -13
  44. package/{esm2015/collections/lib/interfaces/collection.interface.js → esm2020/collections/lib/interfaces/collection.interface.mjs} +0 -0
  45. package/esm2020/collections/lib/providers/api-collection.provider.mjs +71 -0
  46. package/esm2020/collections/lib/providers/collection.provider.mjs +13 -0
  47. package/{esm2015/collections/lib/providers/local-collection.provider.js → esm2020/collections/lib/providers/local-collection.provider.mjs} +0 -0
  48. package/{esm2015/collections/public_api.js → esm2020/collections/public_api.mjs} +0 -0
  49. package/esm2020/controls/bravobit-bb-foundation-controls.mjs +5 -0
  50. package/esm2020/controls/lib/checkbox/checkbox/checkbox.component.mjs +153 -0
  51. package/esm2020/controls/lib/checkbox/checkbox-group/checkbox-group.component.mjs +48 -0
  52. package/esm2020/controls/lib/checkbox/checkbox.module.mjs +19 -0
  53. package/esm2020/controls/lib/controls.module.mjs +16 -0
  54. package/esm2020/controls/public_api.mjs +5 -0
  55. package/{esm2015/dashboard/bravobit-bb-foundation-dashboard.js → esm2020/dashboard/bravobit-bb-foundation-dashboard.mjs} +0 -0
  56. package/esm2020/dashboard/lib/dashboard/dashboard.component.mjs +56 -0
  57. package/esm2020/dashboard/lib/dashboard-header/dashboard-header.component.mjs +30 -0
  58. package/esm2020/dashboard/lib/dashboard-menu/dashboard-menu.component.mjs +31 -0
  59. package/esm2020/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.mjs +29 -0
  60. package/esm2020/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.mjs +75 -0
  61. package/esm2020/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.mjs +99 -0
  62. package/esm2020/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.mjs +62 -0
  63. package/{esm2015/dashboard/lib/dashboard.module.js → esm2020/dashboard/lib/dashboard.module.mjs} +5 -5
  64. package/{esm2015/dashboard/public_api.js → esm2020/dashboard/public_api.mjs} +0 -0
  65. package/{esm2015/dialog/bravobit-bb-foundation-dialog.js → esm2020/dialog/bravobit-bb-foundation-dialog.mjs} +0 -0
  66. package/esm2020/dialog/lib/dialog-actions/dialog-actions.component.mjs +12 -0
  67. package/esm2020/dialog/lib/dialog-confirm/dialog-confirm.component.mjs +37 -0
  68. package/{esm2015/dialog/lib/dialog-container/dialog-container.component.js → esm2020/dialog/lib/dialog-container/dialog-container.component.mjs} +6 -15
  69. package/esm2020/dialog/lib/dialog-header/dialog-header.component.mjs +25 -0
  70. package/esm2020/dialog/lib/dialog-link/dialog-link.component.mjs +11 -0
  71. package/esm2020/dialog/lib/dialog-modal/dialog-modal.component.mjs +46 -0
  72. package/esm2020/dialog/lib/dialog-overlay/dialog-overlay.component.mjs +134 -0
  73. package/{esm2015/dialog/lib/dialog.injector.js → esm2020/dialog/lib/dialog.injector.mjs} +0 -0
  74. package/{esm2015/dialog/lib/dialog.insertion.js → esm2020/dialog/lib/dialog.insertion.mjs} +4 -4
  75. package/{esm2015/dialog/lib/dialog.interfaces.js → esm2020/dialog/lib/dialog.interfaces.mjs} +0 -0
  76. package/{esm2015/dialog/lib/dialog.module.js → esm2020/dialog/lib/dialog.module.mjs} +5 -9
  77. package/{esm2015/dialog/lib/dialog.ref.js → esm2020/dialog/lib/dialog.ref.mjs} +0 -0
  78. package/{esm2015/dialog/lib/dialog.service.js → esm2020/dialog/lib/dialog.service.mjs} +5 -5
  79. package/{esm2015/dialog/public_api.js → esm2020/dialog/public_api.mjs} +0 -0
  80. package/{esm2015/elements/bravobit-bb-foundation-elements.js → esm2020/elements/bravobit-bb-foundation-elements.mjs} +0 -0
  81. package/esm2020/elements/lib/avatar/avatar.component.mjs +142 -0
  82. package/esm2020/elements/lib/button/button.component.mjs +61 -0
  83. package/esm2020/elements/lib/checkbox/checkbox.component.mjs +73 -0
  84. package/esm2020/elements/lib/date-picker/date-picker.component.mjs +304 -0
  85. package/{esm2015/elements/lib/directives/addon.directive.js → esm2020/elements/lib/directives/addon.directive.mjs} +7 -7
  86. package/esm2020/elements/lib/directives/autosize.directive.mjs +72 -0
  87. package/{esm2015/elements/lib/directives/focus-trap.directive.js → esm2020/elements/lib/directives/focus-trap.directive.mjs} +4 -4
  88. package/{esm2015/elements/lib/directives/focus.directive.js → esm2020/elements/lib/directives/focus.directive.mjs} +4 -4
  89. package/esm2020/elements/lib/directives/form-submit.directive.mjs +50 -0
  90. package/esm2020/elements/lib/directives/input.directive.mjs +136 -0
  91. package/{esm2015/elements/lib/directives/template.directive.js → esm2020/elements/lib/directives/template.directive.mjs} +4 -4
  92. package/esm2020/elements/lib/dropdown/dropdown.component.mjs +100 -0
  93. package/{esm2015/elements/lib/elements.interfaces.js → esm2020/elements/lib/elements.interfaces.mjs} +0 -0
  94. package/{esm2015/elements/lib/elements.module.js → esm2020/elements/lib/elements.module.mjs} +5 -5
  95. package/esm2020/elements/lib/file-picker/file-picker.component.mjs +236 -0
  96. package/esm2020/elements/lib/form-control/form-control.component.mjs +49 -0
  97. package/esm2020/elements/lib/form-error/form-error.component.mjs +108 -0
  98. package/esm2020/elements/lib/form-group/form-group.component.mjs +18 -0
  99. package/esm2020/elements/lib/icon/icon.component.mjs +102 -0
  100. package/esm2020/elements/lib/image-picker/image-picker.component.mjs +106 -0
  101. package/esm2020/elements/lib/pipes/file-image.pipe.mjs +42 -0
  102. package/{esm2015/elements/lib/pipes/file-size.pipe.js → esm2020/elements/lib/pipes/file-size.pipe.mjs} +4 -4
  103. package/esm2020/elements/lib/pipes/relative-time.pipe.mjs +94 -0
  104. package/esm2020/elements/lib/spinner/spinner.component.mjs +25 -0
  105. package/esm2020/elements/lib/tag/tag.component.mjs +18 -0
  106. package/{esm2015/elements/public_api.js → esm2020/elements/public_api.mjs} +0 -0
  107. package/{esm2015/http/bravobit-bb-foundation-http.js → esm2020/http/bravobit-bb-foundation-http.mjs} +0 -0
  108. package/esm2020/http/lib/classes/http.config.mjs +29 -0
  109. package/esm2020/http/lib/classes/http.error.mjs +20 -0
  110. package/{esm2015/http/lib/http.interfaces.js → esm2020/http/lib/http.interfaces.mjs} +0 -0
  111. package/{esm2015/http/lib/http.module.js → esm2020/http/lib/http.module.mjs} +5 -5
  112. package/esm2020/http/lib/interceptors/base-url.interceptor.mjs +50 -0
  113. package/esm2020/http/lib/interceptors/error.interceptor.mjs +32 -0
  114. package/{esm2015/http/public_api.js → esm2020/http/public_api.mjs} +0 -0
  115. package/{esm2015/lib/core/miscellaneous/regex.js → esm2020/lib/core/miscellaneous/regex.mjs} +0 -0
  116. package/esm2020/lib/core/miscellaneous/validator.mjs +85 -0
  117. package/esm2020/lib/core/mixins/can-disable.mjs +16 -0
  118. package/{esm2015/lib/core/mixins/can-hide-errors.js → esm2020/lib/core/mixins/can-hide-errors.mjs} +2 -2
  119. package/esm2020/lib/core/mixins/can-load.mjs +16 -0
  120. package/{esm2015/lib/core/mixins/constructor.js → esm2020/lib/core/mixins/constructor.mjs} +0 -0
  121. package/esm2020/lib/core/mixins/has-error.mjs +16 -0
  122. package/esm2020/lib/core/mixins/is-focused.mjs +16 -0
  123. package/esm2020/lib/core/mixins/is-grouped.mjs +16 -0
  124. package/esm2020/lib/core/mixins/is-readonly.mjs +16 -0
  125. package/esm2020/lib/core/mixins/is-required.mjs +16 -0
  126. package/esm2020/lib/core/services/clipboard.service.mjs +70 -0
  127. package/esm2020/lib/core/services/exif.service.mjs +163 -0
  128. package/esm2020/lib/core/services/file-loader.service.mjs +87 -0
  129. package/esm2020/lib/core/services/image-converter.service.mjs +123 -0
  130. package/{esm2015/lib/core/services/languages.service.js → esm2020/lib/core/services/languages.service.mjs} +4 -4
  131. package/{esm2015/lib/core/services/network.service.js → esm2020/lib/core/services/network.service.mjs} +5 -6
  132. package/esm2020/lib/core/services/patch.service.mjs +63 -0
  133. package/{esm2015/lib/core/services/platform.service.js → esm2020/lib/core/services/platform.service.mjs} +5 -5
  134. package/{esm2015/lib/core/tokens/accept-language.token.js → esm2020/lib/core/tokens/accept-language.token.mjs} +0 -0
  135. package/{esm2015/lib/core/tokens/base-url.token.js → esm2020/lib/core/tokens/base-url.token.mjs} +0 -0
  136. package/{esm2015/lib/core/tokens/cookie.token.js → esm2020/lib/core/tokens/cookie.token.mjs} +0 -0
  137. package/{esm2015/lib/core/tokens/location.token.js → esm2020/lib/core/tokens/location.token.mjs} +0 -0
  138. package/{esm2015/lib/core/tokens/navigator.token.js → esm2020/lib/core/tokens/navigator.token.mjs} +0 -0
  139. package/{esm2015/lib/core/tokens/window.token.js → esm2020/lib/core/tokens/window.token.mjs} +0 -0
  140. package/{esm2015/localize/bravobit-bb-foundation-localize.js → esm2020/localize/bravobit-bb-foundation-localize.mjs} +0 -0
  141. package/{esm2015/localize/lib/functions/date.function.js → esm2020/localize/lib/functions/date.function.mjs} +0 -0
  142. package/{esm2015/localize/lib/functions/lowercase.function.js → esm2020/localize/lib/functions/lowercase.function.mjs} +0 -0
  143. package/{esm2015/localize/lib/functions/uppercase.function.js → esm2020/localize/lib/functions/uppercase.function.mjs} +0 -0
  144. package/{esm2015/localize/lib/handlers/missing.handler.js → esm2020/localize/lib/handlers/missing.handler.mjs} +0 -0
  145. package/{esm2015/localize/lib/interfaces/config.interfaces.js → esm2020/localize/lib/interfaces/config.interfaces.mjs} +0 -0
  146. package/{esm2015/localize/lib/interfaces/dictionary.interfaces.js → esm2020/localize/lib/interfaces/dictionary.interfaces.mjs} +0 -0
  147. package/{esm2015/localize/lib/interfaces/functions.interfaces.js → esm2020/localize/lib/interfaces/functions.interfaces.mjs} +0 -0
  148. package/{esm2015/localize/lib/interfaces/handlers.interfaces.js → esm2020/localize/lib/interfaces/handlers.interfaces.mjs} +0 -0
  149. package/{esm2015/localize/lib/interfaces/options.interfaces.js → esm2020/localize/lib/interfaces/options.interfaces.mjs} +0 -0
  150. package/{esm2015/localize/lib/localizations/dutch.localization.js → esm2020/localize/lib/localizations/dutch.localization.mjs} +0 -0
  151. package/{esm2015/localize/lib/localizations/english.localization.js → esm2020/localize/lib/localizations/english.localization.mjs} +0 -0
  152. package/esm2020/localize/lib/localize.dictionary.mjs +135 -0
  153. package/{esm2015/localize/lib/localize.module.js → esm2020/localize/lib/localize.module.mjs} +5 -5
  154. package/{esm2015/localize/lib/localize.pipe.js → esm2020/localize/lib/localize.pipe.mjs} +5 -5
  155. package/esm2020/localize/lib/localize.service.mjs +277 -0
  156. package/esm2020/localize/lib/views/localize-string/localize-string.component.mjs +88 -0
  157. package/{esm2015/localize/lib/views/localize-template-or-string.directive.js → esm2020/localize/lib/views/localize-template-or-string.directive.mjs} +4 -4
  158. package/{esm2015/localize/lib/views/localize-template.directive.js → esm2020/localize/lib/views/localize-template.directive.mjs} +4 -4
  159. package/{esm2015/localize/public_api.js → esm2020/localize/public_api.mjs} +0 -0
  160. package/{esm2015/notifications/bravobit-bb-foundation-notifications.js → esm2020/notifications/bravobit-bb-foundation-notifications.mjs} +0 -0
  161. package/esm2020/notifications/lib/notifications-item/notifications-item.component.mjs +100 -0
  162. package/esm2020/notifications/lib/notifications-list/notifications-list.component.mjs +47 -0
  163. package/{esm2015/notifications/lib/notifications.animations.js → esm2020/notifications/lib/notifications.animations.mjs} +0 -0
  164. package/{esm2015/notifications/lib/notifications.injector.js → esm2020/notifications/lib/notifications.injector.mjs} +0 -0
  165. package/{esm2015/notifications/lib/notifications.interfaces.js → esm2020/notifications/lib/notifications.interfaces.mjs} +0 -0
  166. package/{esm2015/notifications/lib/notifications.module.js → esm2020/notifications/lib/notifications.module.mjs} +6 -7
  167. package/{esm2015/notifications/lib/notifications.service.js → esm2020/notifications/lib/notifications.service.mjs} +5 -5
  168. package/{esm2015/notifications/public_api.js → esm2020/notifications/public_api.mjs} +0 -0
  169. package/{esm2015/public_api.js → esm2020/public_api.mjs} +1 -2
  170. package/{esm2015/recaptcha/bravobit-bb-foundation-recaptcha.js → esm2020/recaptcha/bravobit-bb-foundation-recaptcha.mjs} +0 -0
  171. package/esm2020/recaptcha/lib/recaptcha/recaptcha.component.mjs +185 -0
  172. package/esm2020/recaptcha/lib/recaptcha-loader.service.mjs +90 -0
  173. package/{esm2015/recaptcha/lib/recaptcha.interface.js → esm2020/recaptcha/lib/recaptcha.interface.mjs} +0 -0
  174. package/{esm2015/recaptcha/lib/recaptcha.module.js → esm2020/recaptcha/lib/recaptcha.module.mjs} +5 -5
  175. package/{esm2015/recaptcha/public_api.js → esm2020/recaptcha/public_api.mjs} +0 -0
  176. package/{esm2015/rxjs/bravobit-bb-foundation-rxjs.js → esm2020/rxjs/bravobit-bb-foundation-rxjs.mjs} +0 -0
  177. package/esm2020/rxjs/lib/operators/combine-latest-map.operator.mjs +10 -0
  178. package/{esm2015/rxjs/lib/operators/filter-nil.operator.js → esm2020/rxjs/lib/operators/filter-nil.operator.mjs} +0 -0
  179. package/{esm2015/rxjs/public_api.js → esm2020/rxjs/public_api.mjs} +0 -0
  180. package/{esm2015/storage/bravobit-bb-foundation-storage.js → esm2020/storage/bravobit-bb-foundation-storage.mjs} +0 -0
  181. package/{esm2015/storage/lib/interfaces/attributes.interface.js → esm2020/storage/lib/interfaces/attributes.interface.mjs} +0 -0
  182. package/{esm2015/storage/lib/interfaces/memory.interface.js → esm2020/storage/lib/interfaces/memory.interface.mjs} +0 -0
  183. package/{esm2015/storage/lib/interfaces/strategy.interface.js → esm2020/storage/lib/interfaces/strategy.interface.mjs} +0 -0
  184. package/esm2020/storage/lib/storage.service.mjs +109 -0
  185. package/esm2020/storage/lib/strategies/cookie-storage.strategy.mjs +142 -0
  186. package/{esm2015/storage/lib/strategies/memory-storage.strategy.js → esm2020/storage/lib/strategies/memory-storage.strategy.mjs} +2 -2
  187. package/esm2020/storage/lib/strategies/polyfill-storage.strategy.mjs +102 -0
  188. package/{esm2015/storage/public_api.js → esm2020/storage/public_api.mjs} +0 -0
  189. package/{esm2015/table/bravobit-bb-foundation-table.js → esm2020/table/bravobit-bb-foundation-table.mjs} +0 -0
  190. package/esm2020/table/lib/components/table/table.component.mjs +191 -0
  191. package/esm2020/table/lib/components/table-cell/table-cell.component.mjs +11 -0
  192. package/esm2020/table/lib/components/table-header-cell/table-header-cell.component.mjs +131 -0
  193. package/esm2020/table/lib/components/table-pager/table-pager.component.mjs +136 -0
  194. package/esm2020/table/lib/data/datasource.data.mjs +32 -0
  195. package/esm2020/table/lib/data/generic.data.mjs +72 -0
  196. package/{esm2015/table/lib/interfaces/datasource.interface.js → esm2020/table/lib/interfaces/datasource.interface.mjs} +0 -0
  197. package/{esm2015/table/lib/interfaces/table.interfaces.js → esm2020/table/lib/interfaces/table.interfaces.mjs} +0 -0
  198. package/{esm2015/table/lib/table.module.js → esm2020/table/lib/table.module.mjs} +5 -5
  199. package/{esm2015/table/public_api.js → esm2020/table/public_api.mjs} +0 -0
  200. package/fesm2015/{bravobit-bb-foundation-auth.js → bravobit-bb-foundation-auth.mjs} +79 -68
  201. package/fesm2015/bravobit-bb-foundation-auth.mjs.map +1 -0
  202. package/fesm2015/{bravobit-bb-foundation-collections.js → bravobit-bb-foundation-collections.mjs} +45 -57
  203. package/fesm2015/bravobit-bb-foundation-collections.mjs.map +1 -0
  204. package/fesm2015/bravobit-bb-foundation-controls.mjs +235 -0
  205. package/fesm2015/bravobit-bb-foundation-controls.mjs.map +1 -0
  206. package/fesm2015/bravobit-bb-foundation-dashboard.mjs +416 -0
  207. package/fesm2015/bravobit-bb-foundation-dashboard.mjs.map +1 -0
  208. package/fesm2015/{bravobit-bb-foundation-dialog.js → bravobit-bb-foundation-dialog.mjs} +45 -106
  209. package/fesm2015/bravobit-bb-foundation-dialog.mjs.map +1 -0
  210. package/fesm2015/{bravobit-bb-foundation-elements.js → bravobit-bb-foundation-elements.mjs} +195 -303
  211. package/fesm2015/bravobit-bb-foundation-elements.mjs.map +1 -0
  212. package/fesm2015/{bravobit-bb-foundation-http.js → bravobit-bb-foundation-http.mjs} +18 -16
  213. package/fesm2015/bravobit-bb-foundation-http.mjs.map +1 -0
  214. package/fesm2015/{bravobit-bb-foundation-localize.js → bravobit-bb-foundation-localize.mjs} +63 -69
  215. package/fesm2015/bravobit-bb-foundation-localize.mjs.map +1 -0
  216. package/fesm2015/bravobit-bb-foundation-notifications.mjs +377 -0
  217. package/fesm2015/bravobit-bb-foundation-notifications.mjs.map +1 -0
  218. package/fesm2015/{bravobit-bb-foundation-recaptcha.js → bravobit-bb-foundation-recaptcha.mjs} +40 -47
  219. package/fesm2015/bravobit-bb-foundation-recaptcha.mjs.map +1 -0
  220. package/fesm2015/{bravobit-bb-foundation-rxjs.js → bravobit-bb-foundation-rxjs.mjs} +1 -1
  221. package/fesm2015/bravobit-bb-foundation-rxjs.mjs.map +1 -0
  222. package/fesm2015/{bravobit-bb-foundation-storage.js → bravobit-bb-foundation-storage.mjs} +12 -10
  223. package/fesm2015/bravobit-bb-foundation-storage.mjs.map +1 -0
  224. package/fesm2015/bravobit-bb-foundation-table.mjs +603 -0
  225. package/fesm2015/bravobit-bb-foundation-table.mjs.map +1 -0
  226. package/fesm2015/{bravobit-bb-foundation.js → bravobit-bb-foundation.mjs} +76 -69
  227. package/fesm2015/bravobit-bb-foundation.mjs.map +1 -0
  228. package/fesm2020/bravobit-bb-foundation-auth.mjs +928 -0
  229. package/fesm2020/bravobit-bb-foundation-auth.mjs.map +1 -0
  230. package/fesm2020/bravobit-bb-foundation-collections.mjs +441 -0
  231. package/fesm2020/bravobit-bb-foundation-collections.mjs.map +1 -0
  232. package/fesm2020/bravobit-bb-foundation-controls.mjs +233 -0
  233. package/fesm2020/bravobit-bb-foundation-controls.mjs.map +1 -0
  234. package/fesm2020/bravobit-bb-foundation-dashboard.mjs +404 -0
  235. package/fesm2020/bravobit-bb-foundation-dashboard.mjs.map +1 -0
  236. package/fesm2020/bravobit-bb-foundation-dialog.mjs +584 -0
  237. package/fesm2020/bravobit-bb-foundation-dialog.mjs.map +1 -0
  238. package/fesm2020/bravobit-bb-foundation-elements.mjs +1994 -0
  239. package/fesm2020/bravobit-bb-foundation-elements.mjs.map +1 -0
  240. package/fesm2020/bravobit-bb-foundation-http.mjs +168 -0
  241. package/fesm2020/bravobit-bb-foundation-http.mjs.map +1 -0
  242. package/fesm2020/bravobit-bb-foundation-localize.mjs +832 -0
  243. package/fesm2020/bravobit-bb-foundation-localize.mjs.map +1 -0
  244. package/fesm2020/bravobit-bb-foundation-notifications.mjs +375 -0
  245. package/fesm2020/bravobit-bb-foundation-notifications.mjs.map +1 -0
  246. package/fesm2020/bravobit-bb-foundation-recaptcha.mjs +300 -0
  247. package/fesm2020/bravobit-bb-foundation-recaptcha.mjs.map +1 -0
  248. package/fesm2020/bravobit-bb-foundation-rxjs.mjs +21 -0
  249. package/fesm2020/bravobit-bb-foundation-rxjs.mjs.map +1 -0
  250. package/fesm2020/bravobit-bb-foundation-storage.mjs +413 -0
  251. package/fesm2020/bravobit-bb-foundation-storage.mjs.map +1 -0
  252. package/fesm2020/bravobit-bb-foundation-table.mjs +592 -0
  253. package/fesm2020/bravobit-bb-foundation-table.mjs.map +1 -0
  254. package/fesm2020/bravobit-bb-foundation.mjs +892 -0
  255. package/fesm2020/bravobit-bb-foundation.mjs.map +1 -0
  256. package/http/package.json +5 -5
  257. package/localize/package.json +5 -5
  258. package/notifications/package.json +5 -5
  259. package/package.json +126 -8
  260. package/public_api.d.ts +0 -1
  261. package/recaptcha/package.json +5 -5
  262. package/rxjs/package.json +5 -5
  263. package/storage/package.json +5 -5
  264. package/table/package.json +5 -5
  265. package/bundles/bravobit-bb-foundation-auth.umd.js +0 -1483
  266. package/bundles/bravobit-bb-foundation-auth.umd.js.map +0 -1
  267. package/bundles/bravobit-bb-foundation-collections.umd.js +0 -868
  268. package/bundles/bravobit-bb-foundation-collections.umd.js.map +0 -1
  269. package/bundles/bravobit-bb-foundation-dashboard.umd.js +0 -876
  270. package/bundles/bravobit-bb-foundation-dashboard.umd.js.map +0 -1
  271. package/bundles/bravobit-bb-foundation-dialog.umd.js +0 -716
  272. package/bundles/bravobit-bb-foundation-dialog.umd.js.map +0 -1
  273. package/bundles/bravobit-bb-foundation-elements.umd.js +0 -2768
  274. package/bundles/bravobit-bb-foundation-elements.umd.js.map +0 -1
  275. package/bundles/bravobit-bb-foundation-http.umd.js +0 -535
  276. package/bundles/bravobit-bb-foundation-http.umd.js.map +0 -1
  277. package/bundles/bravobit-bb-foundation-localize.umd.js +0 -1292
  278. package/bundles/bravobit-bb-foundation-localize.umd.js.map +0 -1
  279. package/bundles/bravobit-bb-foundation-notifications.umd.js +0 -794
  280. package/bundles/bravobit-bb-foundation-notifications.umd.js.map +0 -1
  281. package/bundles/bravobit-bb-foundation-recaptcha.umd.js +0 -683
  282. package/bundles/bravobit-bb-foundation-recaptcha.umd.js.map +0 -1
  283. package/bundles/bravobit-bb-foundation-rxjs.umd.js +0 -29
  284. package/bundles/bravobit-bb-foundation-rxjs.umd.js.map +0 -1
  285. package/bundles/bravobit-bb-foundation-storage.umd.js +0 -799
  286. package/bundles/bravobit-bb-foundation-storage.umd.js.map +0 -1
  287. package/bundles/bravobit-bb-foundation-table.umd.js +0 -1084
  288. package/bundles/bravobit-bb-foundation-table.umd.js.map +0 -1
  289. package/bundles/bravobit-bb-foundation.umd.js +0 -1440
  290. package/bundles/bravobit-bb-foundation.umd.js.map +0 -1
  291. package/esm2015/auth/lib/auth.interceptor.js +0 -95
  292. package/esm2015/auth/lib/auth.service.js +0 -299
  293. package/esm2015/auth/lib/auth.session.js +0 -136
  294. package/esm2015/auth/lib/directives/permission.directive.js +0 -81
  295. package/esm2015/auth/lib/directives/role.directive.js +0 -38
  296. package/esm2015/auth/lib/guards/anonymous.guard.js +0 -35
  297. package/esm2015/auth/lib/guards/authenticated.guard.js +0 -36
  298. package/esm2015/auth/lib/permissions.service.js +0 -58
  299. package/esm2015/auth/lib/providers/email.provider.js +0 -26
  300. package/esm2015/auth/lib/providers/verify.provider.js +0 -20
  301. package/esm2015/collections/lib/collection.js +0 -104
  302. package/esm2015/collections/lib/components/collections-pager/collections-pager.component.js +0 -136
  303. package/esm2015/collections/lib/components/collections-viewer/collections-viewer.component.js +0 -39
  304. package/esm2015/collections/lib/providers/api-collection.provider.js +0 -69
  305. package/esm2015/collections/lib/providers/collection.provider.js +0 -14
  306. package/esm2015/dashboard/lib/dashboard/dashboard.component.js +0 -64
  307. package/esm2015/dashboard/lib/dashboard-header/dashboard-header.component.js +0 -41
  308. package/esm2015/dashboard/lib/dashboard-menu/dashboard-menu.component.js +0 -39
  309. package/esm2015/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.js +0 -38
  310. package/esm2015/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.js +0 -83
  311. package/esm2015/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.js +0 -110
  312. package/esm2015/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.js +0 -71
  313. package/esm2015/dialog/lib/dialog-actions/dialog-actions.component.js +0 -20
  314. package/esm2015/dialog/lib/dialog-confirm/dialog-confirm.component.js +0 -45
  315. package/esm2015/dialog/lib/dialog-header/dialog-header.component.js +0 -33
  316. package/esm2015/dialog/lib/dialog-link/dialog-link.component.js +0 -19
  317. package/esm2015/dialog/lib/dialog-modal/dialog-modal.component.js +0 -54
  318. package/esm2015/dialog/lib/dialog-overlay/dialog-overlay.component.js +0 -143
  319. package/esm2015/elements/lib/avatar/avatar.component.js +0 -151
  320. package/esm2015/elements/lib/button/button.component.js +0 -79
  321. package/esm2015/elements/lib/checkbox/checkbox.component.js +0 -83
  322. package/esm2015/elements/lib/date-picker/date-picker.component.js +0 -322
  323. package/esm2015/elements/lib/directives/autosize.directive.js +0 -74
  324. package/esm2015/elements/lib/directives/form-submit.directive.js +0 -53
  325. package/esm2015/elements/lib/directives/input.directive.js +0 -139
  326. package/esm2015/elements/lib/dropdown/dropdown.component.js +0 -111
  327. package/esm2015/elements/lib/file-picker/file-picker.component.js +0 -247
  328. package/esm2015/elements/lib/form-control/form-control.component.js +0 -58
  329. package/esm2015/elements/lib/form-error/form-error.component.js +0 -116
  330. package/esm2015/elements/lib/form-group/form-group.component.js +0 -27
  331. package/esm2015/elements/lib/icon/icon.component.js +0 -110
  332. package/esm2015/elements/lib/image-picker/image-picker.component.js +0 -119
  333. package/esm2015/elements/lib/pipes/file-image.pipe.js +0 -45
  334. package/esm2015/elements/lib/pipes/relative-time.pipe.js +0 -96
  335. package/esm2015/elements/lib/spinner/spinner.component.js +0 -34
  336. package/esm2015/elements/lib/tag/tag.component.js +0 -26
  337. package/esm2015/http/lib/classes/http.config.js +0 -31
  338. package/esm2015/http/lib/classes/http.error.js +0 -21
  339. package/esm2015/http/lib/interceptors/base-url.interceptor.js +0 -52
  340. package/esm2015/http/lib/interceptors/error.interceptor.js +0 -33
  341. package/esm2015/lib/core/coercions/boolean-coercion.js +0 -4
  342. package/esm2015/lib/core/miscellaneous/validator.js +0 -86
  343. package/esm2015/lib/core/mixins/can-disable.js +0 -16
  344. package/esm2015/lib/core/mixins/can-load.js +0 -16
  345. package/esm2015/lib/core/mixins/has-error.js +0 -16
  346. package/esm2015/lib/core/mixins/is-focused.js +0 -16
  347. package/esm2015/lib/core/mixins/is-grouped.js +0 -16
  348. package/esm2015/lib/core/mixins/is-readonly.js +0 -16
  349. package/esm2015/lib/core/mixins/is-required.js +0 -16
  350. package/esm2015/lib/core/services/clipboard.service.js +0 -72
  351. package/esm2015/lib/core/services/exif.service.js +0 -168
  352. package/esm2015/lib/core/services/file-loader.service.js +0 -90
  353. package/esm2015/lib/core/services/image-converter.service.js +0 -130
  354. package/esm2015/lib/core/services/patch.service.js +0 -65
  355. package/esm2015/localize/lib/localize.dictionary.js +0 -137
  356. package/esm2015/localize/lib/localize.service.js +0 -282
  357. package/esm2015/localize/lib/views/localize-string/localize-string.component.js +0 -99
  358. package/esm2015/notifications/lib/notifications-item/notifications-item.component.js +0 -108
  359. package/esm2015/notifications/lib/notifications-list/notifications-list.component.js +0 -56
  360. package/esm2015/recaptcha/lib/recaptcha/recaptcha.component.js +0 -199
  361. package/esm2015/recaptcha/lib/recaptcha-loader.service.js +0 -93
  362. package/esm2015/rxjs/lib/operators/combine-latest-map.operator.js +0 -7
  363. package/esm2015/storage/lib/storage.service.js +0 -111
  364. package/esm2015/storage/lib/strategies/cookie-storage.strategy.js +0 -143
  365. package/esm2015/storage/lib/strategies/polyfill-storage.strategy.js +0 -102
  366. package/esm2015/table/lib/components/table/table.component.js +0 -204
  367. package/esm2015/table/lib/components/table-cell/table-cell.component.js +0 -19
  368. package/esm2015/table/lib/components/table-header-cell/table-header-cell.component.js +0 -143
  369. package/esm2015/table/lib/components/table-pager/table-pager.component.js +0 -146
  370. package/esm2015/table/lib/data/datasource.data.js +0 -32
  371. package/esm2015/table/lib/data/generic.data.js +0 -73
  372. package/fesm2015/bravobit-bb-foundation-auth.js.map +0 -1
  373. package/fesm2015/bravobit-bb-foundation-collections.js.map +0 -1
  374. package/fesm2015/bravobit-bb-foundation-dashboard.js +0 -468
  375. package/fesm2015/bravobit-bb-foundation-dashboard.js.map +0 -1
  376. package/fesm2015/bravobit-bb-foundation-dialog.js.map +0 -1
  377. package/fesm2015/bravobit-bb-foundation-elements.js.map +0 -1
  378. package/fesm2015/bravobit-bb-foundation-http.js.map +0 -1
  379. package/fesm2015/bravobit-bb-foundation-localize.js.map +0 -1
  380. package/fesm2015/bravobit-bb-foundation-notifications.js +0 -393
  381. package/fesm2015/bravobit-bb-foundation-notifications.js.map +0 -1
  382. package/fesm2015/bravobit-bb-foundation-recaptcha.js.map +0 -1
  383. package/fesm2015/bravobit-bb-foundation-rxjs.js.map +0 -1
  384. package/fesm2015/bravobit-bb-foundation-storage.js.map +0 -1
  385. package/fesm2015/bravobit-bb-foundation-table.js +0 -636
  386. package/fesm2015/bravobit-bb-foundation-table.js.map +0 -1
  387. package/fesm2015/bravobit-bb-foundation.js.map +0 -1
  388. package/lib/core/coercions/boolean-coercion.d.ts +0 -1
@@ -0,0 +1,1994 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Component, ChangeDetectionStrategy, ViewEncapsulation, HostListener, Directive, Optional, Host, Input, InjectionToken, EventEmitter, forwardRef, ViewChild, Output, Self, Inject, TemplateRef, ContentChild, Pipe, HostBinding, LOCALE_ID, NgModule } from '@angular/core';
3
+ import { trigger, transition, style, animate } from '@angular/animations';
4
+ import { BehaviorSubject, fromEvent, merge, EMPTY, combineLatest, of, Subscription } from 'rxjs';
5
+ import * as i1 from '@angular/common';
6
+ import { formatDate, DatePipe, CommonModule } from '@angular/common';
7
+ import * as i1$1 from '@bravobit/bb-foundation';
8
+ import { mixinDisabled, mixinLoad, mixinGrouped, mixinFocused, mixinReadonly, mixinRequired, mixinError, mixinHideErrors } from '@bravobit/bb-foundation';
9
+ import * as i5 from '@angular/forms';
10
+ import { NG_VALUE_ACCESSOR, NgControl, NG_VALIDATORS, Validators, FormGroup, FormControl, ReactiveFormsModule } from '@angular/forms';
11
+ import { map, mapTo, startWith, distinctUntilChanged, shareReplay, tap, delay } from 'rxjs/operators';
12
+ import * as i4 from '@bravobit/bb-foundation/localize';
13
+ import { LocalizeModule } from '@bravobit/bb-foundation/localize';
14
+ import * as i2 from '@angular/platform-browser';
15
+ import { coerceBooleanProperty } from '@angular/cdk/coercion';
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: "13.1.0", ngImport: i0, type: BbDropdown, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
40
+ BbDropdown.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbDropdown, selector: "bb-dropdown", host: { listeners: { "document:click": "onDocumentClick($event.target)" }, classAttribute: "bb-dropdown" }, ngImport: i0, template: "<button (click)=\"toggle()\"\n [class.opened]=\"visible$ | async\"\n type=\"button\">\n <ng-content></ng-content>\n</button>\n\n<div *ngIf=\"visible$ | async\"\n [@dropdownMenuAnimation]=\"true\"\n class=\"bb-dropdown-menu\"\n role=\"list\">\n <ng-content select=\"[bbDropdownItem], hr\"></ng-content>\n</div>\n", styles: [".bb-dropdown{position:relative;display:inline-block}.bb-dropdown.right>.bb-dropdown-menu{right:0;left:auto;transform-origin:top right}.bb-dropdown-menu{left:0;top:100%;padding:0;z-index:10;display:block;margin:10px 0 0;border-radius:4px;position:absolute;list-style-type:none;background-color:#fff;border:1px solid #cccccc;transform-origin:top left;box-shadow:0 0 6px #0000001a}.bb-dropdown-menu:after{width:0;top:-5px;height:0;right:5px;content:\"\";position:absolute;border-style:solid;border-width:0 10px 5px 10px;border-color:transparent transparent #d9d9d9 transparent}.bb-dropdown-menu>hr{margin:0;height:1px;border:none;background-color:#ccc}.bb-dropdown-item{width:100%;border:none;line-height:1;display:block;cursor:pointer;text-align:left;font-weight:500;-webkit-user-select:none;user-select:none;padding:12px 20px;white-space:nowrap;text-decoration:none;color:#676767!important;background-color:transparent;transition:background-color .25s cubic-bezier(0,0,.2,1)}.bb-dropdown-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.bb-dropdown-item:hover{background-color:#f6f6f6}.bb-dropdown-item:focus{box-shadow:0 0 0 3px #dce0e980}.bb-dropdown-item:active{background-color:#f0f0f0}\n"], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i1.AsyncPipe }, animations: [
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: "13.1.0", 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: "13.1.0", ngImport: i0, type: BbDropdownItem, deps: [{ token: BbDropdown, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
92
+ BbDropdownItem.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.0", type: BbDropdownItem, selector: "[bbDropdownItem]", inputs: { closeOnClick: "closeOnClick" }, host: { listeners: { "click": "onClick()" }, classAttribute: "bb-dropdown-item" }, ngImport: i0 });
93
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", 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
+ }] } });
111
+
112
+ const ELEMENTS_ICONS = new InjectionToken('elements_icons');
113
+ const ELEMENTS_ERRORS = new InjectionToken('elements_errors');
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: "13.1.0", ngImport: i0, type: BbSpinner, deps: null, target: i0.ɵɵFactoryTarget.Component });
127
+ BbSpinner.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbSpinner, selector: "bb-spinner", inputs: { color: "color", alt: "alt", disabled: "disabled" }, host: { classAttribute: "bb-spinner" }, usesInheritance: true, ngImport: i0, template: "<!--\n The spinner element.\n\n This element contains a circle with a 25% bar that spins\n indefinitely. The border color can be set via the \"color\"\n property.\n-->\n<div class=\"bb-spinner-container\">\n <div [style.border-left-color]=\"color\"\n [class.disabled]=\"disabled\"\n class=\"bb-spinner-loader\"\n aria-live=\"assertive\"\n role=\"alert\">\n {{ alt }}\n </div>\n <ng-content select=\"img\"></ng-content>\n</div>\n\n<!--\n The content of the spinner.\n\n This element contains the content of the spinner. The user\n can set the content inside the tag.\n-->\n<span class=\"bb-spinner-content\">\n <ng-content></ng-content>\n</span>\n", styles: [".bb-spinner{color:#565656;padding:20px 0;text-align:center;align-items:center;display:inline-flex;flex-direction:column;justify-content:center}.bb-spinner.block{display:flex}.bb-spinner.inverse .bb-spinner-loader{border-color:#ffffff26}.bb-spinner.inverse .bb-spinner-content{color:#ffffff80}.bb-spinner.small .bb-spinner-loader,.bb-spinner.small .bb-spinner-loader:after{width:20px;height:20px;min-width:20px;min-height:20px}.bb-spinner.small .bb-spinner-loader{border-width:2px}.bb-spinner.small .bb-spinner-content{font-size:12px}.bb-spinner.medium .bb-spinner-loader,.bb-spinner.medium .bb-spinner-loader:after{width:60px;height:60px;min-width:60px;min-height:60px}.bb-spinner.medium .bb-spinner-loader{border-width:4px}.bb-spinner.medium .bb-spinner-content{font-size:16px}.bb-spinner.large .bb-spinner-loader,.bb-spinner.large .bb-spinner-loader:after{width:100px;height:100px;min-width:100px;min-height:100px}.bb-spinner.large .bb-spinner-loader{border-width:6px}.bb-spinner.large .bb-spinner-content{font-size:20px}.bb-spinner.horizontal{text-align:left;flex-direction:row}.bb-spinner.horizontal .bb-spinner-content:not(:empty){margin-left:10px;margin-top:0}.bb-spinner.vertical{text-align:center;flex-direction:column}.bb-spinner.vertical .bb-spinner-content:not(:empty){margin-left:0;margin-top:10px}.bb-spinner-container{display:flex;position:relative}.bb-spinner-container>img{top:20%;left:20%;width:60%;height:60%;position:absolute}.bb-spinner-loader{margin:0;padding:0;overflow:hidden;text-indent:100%;color:transparent;position:relative;display:inline-block;vertical-align:middle;border:4px solid #f2f4f6;animation:1s linear infinite spin}.bb-spinner-loader,.bb-spinner-loader:after{width:60px;height:60px;min-width:60px;min-height:60px;border-radius:50%}.bb-spinner-loader.disabled{cursor:default;-webkit-user-select:none;user-select:none;pointer-events:none;animation-play-state:paused}.bb-spinner-content:not(:empty){font-size:16px;margin-top:10px;font-weight:500}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
128
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", 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
+ }] } });
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: "13.1.0", ngImport: i0, type: BbButton, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
155
+ BbButton.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbButton, selector: "button[bb-button]", inputs: { disabled: "disabled", loading: "loading" }, host: { properties: { "class.loading": "loading", "attr.disabled": "disabled || loading || null" }, classAttribute: "bb-button" }, exportAs: ["bbButton"], usesInheritance: true, ngImport: i0, template: "<bb-spinner [class.visible]=\"loading\"\n class=\"bb-button-spinner small\">\n</bb-spinner>\n\n<ng-content></ng-content>\n", styles: [".bb-button{height:38px;padding:0 8px;cursor:pointer;font-size:16px;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;font-style:normal;border-radius:4px;text-align:center;align-items:center;display:inline-flex;text-decoration:none;justify-content:center;background-color:#fff;color:#2d3c4d!important;border:1px solid #d4d8e1;transition-duration:.2s;box-shadow:0 6px 6px -6px #0000001a;transition-timing-function:cubic-bezier(0,0,.2,1);transition-property:padding-left,background-color,box-shadow}.bb-button:hover{background-color:#fcfcfb}.bb-button:focus,.bb-button:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #dce0e980}.bb-button.full{width:100%}.bb-button.full.loading{padding-left:42px}.bb-button.primary{border-color:#2f2b85;color:#fff!important;background-color:#5b53ff}.bb-button.primary:hover{background-color:#564ee6}.bb-button.primary:focus,.bb-button.primary:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #5b53ff80}.bb-button.destructive{border-color:#8f2020;color:#fff!important;background-color:#d32f2f}.bb-button.destructive:hover{background-color:#c32929}.bb-button.destructive:focus,.bb-button.destructive:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #d32f2f80}.bb-button:disabled,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button:disabled:active,.bb-button[disabled],.bb-button[disabled]:focus,.bb-button[disabled]:hover,.bb-button[disabled]:active,.bb-button.loading,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button.loading:active{opacity:.4;cursor:default;box-shadow:none}.bb-button-spinner{width:0;opacity:0;overflow:hidden;visibility:hidden;padding:0!important;transition:width .2s cubic-bezier(0,0,.2,1),opacity .1s cubic-bezier(0,0,.2,1)}.bb-button-spinner.visible{opacity:1;width:20px;margin-right:8px;visibility:visible}.bb-button.loading.full>.bb-button-spinner{left:8px;margin-right:0;position:absolute}\n"], components: [{ type: BbSpinner, selector: "bb-spinner", inputs: ["color", "alt", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
156
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", 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: "13.1.0", ngImport: i0, type: BbAnchor, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
180
+ BbAnchor.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbAnchor, selector: "a[bb-button]", inputs: { disabled: "disabled", loading: "loading", tabIndex: "tabIndex" }, host: { listeners: { "click": "stopDisabledEvents($event)" }, properties: { "attr.tabindex": "(disabled || loading) ? -1 : (tabIndex || 0)", "attr.disabled": "disabled || loading || null", "attr.aria-disabled": "(disabled || loading).toString()" }, classAttribute: "bb-button" }, exportAs: ["bbButton", "bbAnchor"], usesInheritance: true, ngImport: i0, template: "<bb-spinner [class.visible]=\"loading\"\n class=\"bb-button-spinner small\">\n</bb-spinner>\n\n<ng-content></ng-content>\n", styles: [".bb-button{height:38px;padding:0 8px;cursor:pointer;font-size:16px;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;font-style:normal;border-radius:4px;text-align:center;align-items:center;display:inline-flex;text-decoration:none;justify-content:center;background-color:#fff;color:#2d3c4d!important;border:1px solid #d4d8e1;transition-duration:.2s;box-shadow:0 6px 6px -6px #0000001a;transition-timing-function:cubic-bezier(0,0,.2,1);transition-property:padding-left,background-color,box-shadow}.bb-button:hover{background-color:#fcfcfb}.bb-button:focus,.bb-button:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #dce0e980}.bb-button.full{width:100%}.bb-button.full.loading{padding-left:42px}.bb-button.primary{border-color:#2f2b85;color:#fff!important;background-color:#5b53ff}.bb-button.primary:hover{background-color:#564ee6}.bb-button.primary:focus,.bb-button.primary:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #5b53ff80}.bb-button.destructive{border-color:#8f2020;color:#fff!important;background-color:#d32f2f}.bb-button.destructive:hover{background-color:#c32929}.bb-button.destructive:focus,.bb-button.destructive:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #d32f2f80}.bb-button:disabled,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button:disabled:active,.bb-button[disabled],.bb-button[disabled]:focus,.bb-button[disabled]:hover,.bb-button[disabled]:active,.bb-button.loading,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button.loading:active{opacity:.4;cursor:default;box-shadow:none}.bb-button-spinner{width:0;opacity:0;overflow:hidden;visibility:hidden;padding:0!important;transition:width .2s cubic-bezier(0,0,.2,1),opacity .1s cubic-bezier(0,0,.2,1)}.bb-button-spinner.visible{opacity:1;width:20px;margin-right:8px;visibility:visible}.bb-button.loading.full>.bb-button-spinner{left:8px;margin-right:0;position:absolute}\n"], components: [{ type: BbSpinner, selector: "bb-spinner", inputs: ["color", "alt", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
181
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", 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
+ }] } });
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: "13.1.0", ngImport: i0, type: BbImagePicker, deps: [{ token: i1$1.ImageConverter }], target: i0.ɵɵFactoryTarget.Component });
266
+ BbImagePicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbImagePicker, selector: "bb-image-picker", inputs: { grouped: "grouped", disabled: "disabled", label: "label", placeholder: "placeholder", styleDimensions: "styleDimensions", cropDimensions: "cropDimensions", value: "value" }, outputs: { valueChange: "valueChange" }, host: { properties: { "class.disabled": "disabled", "class.grouped": "grouped" }, classAttribute: "bb-image-picker" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbImagePicker), multi: true }], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<!-- The input that can open the file picker. -->\n<input #fileInput\n (change)=\"onFileChange($event)\"\n class=\"bb-image-picker-input\"\n type=\"file\"\n tabindex=\"-1\"\n accept=\"image/*\">\n\n<span [style.width]=\"styleDimensions?.width || '100%'\"\n [style.height]=\"styleDimensions?.height || '215px'\"\n [style.background-image]=\"image | async\"\n class=\"bb-image-input-image\">\n </span>\n\n<button *ngIf=\"label as labelText\"\n (click)=\"openFilePicker()\"\n bb-button\n class=\"bb-image-input-button\"\n type=\"button\">\n {{ labelText }}\n</button>\n", styles: [".bb-image-picker{display:flex;align-items:center;flex-direction:column}.bb-image-picker.circle>.bb-image-input-image{border-radius:50%}.bb-image-picker.grouped{margin-bottom:20px}.bb-image-picker.disabled{opacity:.5;cursor:default;-webkit-user-select:none;user-select:none;pointer-events:none}.bb-image-picker-input{opacity:0;z-index:-1;width:.1px;height:.1px;overflow:hidden;position:absolute}.bb-image-input-image{display:flex;cursor:default;position:relative;border-radius:4px;align-items:center;justify-content:center;background:rgba(0,0,0,.2) url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7) center center/cover no-repeat}.bb-image-input-button{margin-top:10px}\n"], components: [{ type: BbButton, selector: "button[bb-button]", inputs: ["disabled", "loading"], exportAs: ["bbButton"] }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i1.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
267
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", 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
+ }] } });
290
+
291
+ class BbFormSubmit {
292
+ constructor(_host, _formDirective) {
293
+ this._host = _host;
294
+ this._formDirective = _formDirective;
295
+ }
296
+ ngOnInit() {
297
+ // Submit changes.
298
+ const regularSubmitChanges$ = fromEvent(this.nativeElement, 'submit').pipe(mapTo(true));
299
+ // Reactive form submit changes.
300
+ const reactiveSubmitChanges$ = this.reactiveSubmitChanges();
301
+ // Reset changes.
302
+ const resetChanges$ = fromEvent(this.nativeElement, 'reset').pipe(mapTo(false));
303
+ // Listen to the submit status.
304
+ this.submitStatus$ = merge(regularSubmitChanges$, reactiveSubmitChanges$, resetChanges$).pipe(startWith(false), distinctUntilChanged(), shareReplay(1));
305
+ }
306
+ submit() {
307
+ this._formDirective?.ngSubmit?.emit();
308
+ }
309
+ reset() {
310
+ return this.nativeElement?.reset();
311
+ }
312
+ get nativeElement() {
313
+ return this._host?.nativeElement;
314
+ }
315
+ reactiveSubmitChanges() {
316
+ if (!this._formDirective) {
317
+ return EMPTY;
318
+ }
319
+ return this._formDirective.ngSubmit.pipe(mapTo(true));
320
+ }
321
+ }
322
+ BbFormSubmit.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFormSubmit, deps: [{ token: i0.ElementRef }, { token: i5.FormGroupDirective, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Directive });
323
+ BbFormSubmit.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.0", type: BbFormSubmit, selector: "form", exportAs: ["bbForm"], ngImport: i0 });
324
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFormSubmit, decorators: [{
325
+ type: Directive,
326
+ args: [{
327
+ selector: 'form',
328
+ exportAs: 'bbForm'
329
+ }]
330
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i5.FormGroupDirective, decorators: [{
331
+ type: Optional
332
+ }, {
333
+ type: Self
334
+ }] }]; } });
335
+
336
+ class BbFormError {
337
+ constructor(_form, _control, _errors) {
338
+ this._form = _form;
339
+ this._control = _control;
340
+ this._errors = _errors;
341
+ // Outputs.
342
+ this.errorChange = new EventEmitter();
343
+ // Subscriptions.
344
+ this._ngControl = null;
345
+ }
346
+ // Inputs.
347
+ set control(value) {
348
+ this._ngControl = value;
349
+ }
350
+ get control() {
351
+ return this._ngControl;
352
+ }
353
+ ngOnInit() {
354
+ // Set the control if it was not set before.
355
+ if (!this.control) {
356
+ this.control = this._control;
357
+ }
358
+ // Listen for the submit changes
359
+ const submitStatus$ = this.submitStatusChanges();
360
+ // An observable that emits error changes.
361
+ const errorChanges$ = this.statusChanges().pipe(map(() => this.getError(this.control.errors)), distinctUntilChanged(), map(error => typeof error === 'string' ? { token: error } : error));
362
+ // Whenever the user submitted the form we want to
363
+ // listen for any error changes.
364
+ this.error$ = combineLatest([submitStatus$, errorChanges$]).pipe(map(([submitted, error]) => {
365
+ // If not submitted return null.
366
+ if (!submitted) {
367
+ return null;
368
+ }
369
+ // Return the error if submitted.
370
+ return error;
371
+ }), tap(value => this.errorChange.emit(value)));
372
+ }
373
+ getError(errors) {
374
+ // Validate the errors exist.
375
+ if (!errors) {
376
+ return null;
377
+ }
378
+ // Get the first error in the errors.
379
+ const [errorName] = Object.keys(errors);
380
+ const error = errors[errorName];
381
+ // Validate the error exists.
382
+ if (!error) {
383
+ return null;
384
+ }
385
+ // Map the arrays into a object so we can
386
+ // access the functions by a key-lookup.
387
+ const errorFunctions = this._errors.reduce((previous, current) => ({ ...previous, ...current }), {});
388
+ // Get the error function.
389
+ const errorFunction = errorFunctions[errorName] || errorFunctions['unknown'];
390
+ // Validate the error function exists.
391
+ if (!errorFunction) {
392
+ return null;
393
+ }
394
+ // Return the parsed error.
395
+ return errorFunction(error);
396
+ }
397
+ submitStatusChanges() {
398
+ if (!this._form) {
399
+ return of(true);
400
+ }
401
+ return this._form.submitStatus$;
402
+ }
403
+ statusChanges() {
404
+ if (!this.control) {
405
+ return EMPTY;
406
+ }
407
+ if (!this.control.statusChanges) {
408
+ return EMPTY;
409
+ }
410
+ return this.control.statusChanges.pipe(startWith(this.control.status), delay(0));
411
+ }
412
+ }
413
+ BbFormError.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFormError, deps: [{ token: BbFormSubmit, optional: true }, { token: i5.NgControl, optional: true }, { token: ELEMENTS_ERRORS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
414
+ BbFormError.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbFormError, selector: "bb-form-error", inputs: { control: "control" }, outputs: { errorChange: "errorChange" }, host: { classAttribute: "bb-form-error" }, ngImport: i0, template: "<ng-container *ngIf=\"error$ | async as error\">\n <p *ngIf=\"error?.token | bbLocalize:{optional: true, data: error?.data} as message\"\n class=\"bb-form-error-message\">\n {{ message }}\n </p>\n</ng-container>", styles: [".bb-form-error{display:block}.bb-form-error-message{color:#c23934;display:block;font-size:13px;margin-top:4px}\n"], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i1.AsyncPipe, "bbLocalize": i4.BbLocalize }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
415
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFormError, decorators: [{
416
+ type: Component,
417
+ args: [{ selector: 'bb-form-error', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
418
+ 'class': 'bb-form-error'
419
+ }, 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"] }]
420
+ }], ctorParameters: function () { return [{ type: BbFormSubmit, decorators: [{
421
+ type: Optional
422
+ }] }, { type: i5.NgControl, decorators: [{
423
+ type: Optional
424
+ }] }, { type: undefined, decorators: [{
425
+ type: Optional
426
+ }, {
427
+ type: Inject,
428
+ args: [ELEMENTS_ERRORS]
429
+ }] }]; }, propDecorators: { control: [{
430
+ type: Input
431
+ }], errorChange: [{
432
+ type: Output
433
+ }] } });
434
+
435
+ class BbTemplate {
436
+ constructor(_templateRef, _viewContainerRef) {
437
+ this._templateRef = _templateRef;
438
+ this._viewContainerRef = _viewContainerRef;
439
+ }
440
+ set bbTemplate(content) {
441
+ // Get the template.
442
+ const template = content instanceof TemplateRef
443
+ ? content
444
+ : this._templateRef;
445
+ // Clear the view container ref and create the view.
446
+ this._viewContainerRef.clear();
447
+ this._viewContainerRef.createEmbeddedView(template);
448
+ }
449
+ }
450
+ BbTemplate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbTemplate, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
451
+ BbTemplate.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.0", type: BbTemplate, selector: "[bbTemplate]", inputs: { bbTemplate: "bbTemplate" }, ngImport: i0 });
452
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbTemplate, decorators: [{
453
+ type: Directive,
454
+ args: [{
455
+ selector: '[bbTemplate]'
456
+ }]
457
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { bbTemplate: [{
458
+ type: Input
459
+ }] } });
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: "13.1.0", ngImport: i0, type: BbFormControl, deps: null, target: i0.ɵɵFactoryTarget.Component });
481
+ BbFormControl.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbFormControl, selector: "bb-form-control", inputs: { grouped: "grouped", hideErrors: "hideErrors", label: "label", hint: "hint" }, host: { properties: { "class.readonly": "readonly", "class.required": "required", "class.disabled": "disabled", "class.focused": "focused", "class.grouped": "grouped", "class.arrow": "arrow", "class.error": "error" }, classAttribute: "bb-form-control" }, queries: [{ propertyName: "ngControl", first: true, predicate: NgControl, descendants: true }], usesInheritance: true, ngImport: i0, template: "<!-- Label of the form control. -->\n<label *ngIf=\"label as labelContent\"\n [attr.for]=\"labelId\"\n class=\"bb-form-control-label\">\n <ng-template [bbTemplate]=\"labelContent\">\n {{ labelContent }}\n </ng-template>\n</label>\n\n<!-- The input with the addons. -->\n<div class=\"bb-form-control-container\">\n <ng-content select=\"[bbPrefix]\"></ng-content>\n <ng-content select=\"[bbInput]\"></ng-content>\n <ng-content select=\"[bbSuffix]\"></ng-content>\n</div>\n\n<!-- The error component. -->\n<bb-form-error *ngIf=\"!hideErrors\"\n [control]=\"ngControl\"\n (errorChange)=\"onErrorChange($event)\">\n</bb-form-error>\n\n<!-- The form control hint. -->\n<p *ngIf=\"hint as hintContent\"\n class=\"bb-form-control-hint\">\n <ng-template [bbTemplate]=\"hintContent\">\n {{ hintContent }}\n </ng-template>\n</p>\n", styles: [".bb-form-control{color:#2d3c4d;display:block}.bb-form-control>.bb-form-control-container>*.bb-prefix,.bb-form-control>.bb-form-control-container>*.bb-suffix{margin:0 8px;color:#b4b4b4;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control.grouped{margin-bottom:20px}.bb-form-control.small{max-width:240px}.bb-form-control.medium{max-width:480px}.bb-form-control.large{max-width:720px}.bb-form-control.required>.bb-form-control-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bb-form-control.disabled>.bb-form-control-container{cursor:default;pointer-events:none;background-color:#cccccca3}.bb-form-control.disabled>.bb-form-control-container>input,.bb-form-control.disabled>.bb-form-control-container>textarea,.bb-form-control.disabled>.bb-form-control-container>select{color:#aaa}.bb-form-control.readonly>.bb-form-control-container{cursor:default;border:1px dotted #bdc4c9}.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container{background-color:#fff;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #007bff33}.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container>input::placeholder,.bb-form-control:not(.disabled):not(.readonly).focused>.bb-form-control-container>textarea::placeholder{color:#b4b4b4;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control.error>.bb-form-control-label{color:#c23934}.bb-form-control.error>.bb-form-control-hint{display:none}.bb-form-control.error>.bb-form-control-container{border:1px solid #962b26;background-color:#c2393440!important;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #c2393466!important}.bb-form-control.error>.bb-form-control-container>*.bb-prefix,.bb-form-control.error>.bb-form-control-container>.bb-suffix{color:#c23934}.bb-form-control.error>.bb-form-control-container>input::placeholder,.bb-form-control.error>.bb-form-control-container>textarea::placeholder{color:#c2393466!important}.bb-form-control.arrow>.bb-form-control-container:after{top:0;right:0;bottom:0;width:20px;content:\"\";height:36px;display:flex;min-width:20px;position:absolute;pointer-events:none;background-repeat:no-repeat;background-position:calc(100% - 8px) center;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAGCAYAAAAYLBS/AAAACXBIWXMAAAsSAAALEgHS3X78AAAAWUlEQVQYlY3QsQ2DMAAEwMMTsAkrZInvWY3WXiIjJJtkA1OBRCIRf/nSffFTrXXGE4uxbCXJBw+8R0CStcAg3JKsUI7mDzzBBd3AC4Cp9/4z21o7znl9A9gBAf4fpjLTwkUAAAAASUVORK5CYII=)}.bb-form-control-container{width:100%;display:flex;overflow:hidden;position:relative;border-radius:3px;align-items:center;border:1px solid #b6bbc1;background-color:#fff8ff;transition-duration:.25s;transition-property:background-color,box-shadow;transition-timing-function:cubic-bezier(0,0,.2,1);box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a}.bb-form-control-container>input::placeholder,.bb-form-control-container>textarea::placeholder{color:#d2d2d2;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control-container>input,.bb-form-control-container>textarea,.bb-form-control-container>select{margin:0;width:100%;border:none;color:#3d464d;font-size:16px;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:transparent}.bb-form-control-container>input,.bb-form-control-container>select{height:36px;padding:0 8px}.bb-form-control-container>select{padding-right:28px}.bb-form-control-container>select>::-ms-expand{display:none}.bb-form-control-container>input::-ms-clear,.bb-form-control-container>input::-ms-reveal{width:0;height:0;display:none}.bb-form-control-container>input::-webkit-search-decoration,.bb-form-control-container>input::-webkit-search-cancel-button,.bb-form-control-container>input::-webkit-search-results-button,.bb-form-control-container>input::-webkit-search-results-decoration{display:none}.bb-form-control-container>textarea{resize:none;padding:8px}.bb-form-control-label{color:#000;display:block;position:relative;margin-bottom:4px;transition:color 30ms cubic-bezier(0,0,.2,1)}.bb-form-control-error,.bb-form-control-hint{display:block;font-size:13px;margin-top:4px}.bb-form-control-error{color:#c23934}.bb-form-control-hint{color:#738694}\n"], components: [{ type: BbFormError, selector: "bb-form-error", inputs: ["control"], outputs: ["errorChange"] }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: BbTemplate, selector: "[bbTemplate]", inputs: ["bbTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
482
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", 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;-moz-appearance:none;appearance:none;background-color:transparent}.bb-form-control-container>input,.bb-form-control-container>select{height:36px;padding:0 8px}.bb-form-control-container>select{padding-right:28px}.bb-form-control-container>select>::-ms-expand{display:none}.bb-form-control-container>input::-ms-clear,.bb-form-control-container>input::-ms-reveal{width:0;height:0;display:none}.bb-form-control-container>input::-webkit-search-decoration,.bb-form-control-container>input::-webkit-search-cancel-button,.bb-form-control-container>input::-webkit-search-results-button,.bb-form-control-container>input::-webkit-search-results-decoration{display:none}.bb-form-control-container>textarea{resize:none;padding:8px}.bb-form-control-label{color:#000;display:block;position:relative;margin-bottom:4px;transition:color 30ms cubic-bezier(0,0,.2,1)}.bb-form-control-error,.bb-form-control-hint{display:block;font-size:13px;margin-top:4px}.bb-form-control-error{color:#c23934}.bb-form-control-hint{color:#738694}\n"] }]
494
+ }], propDecorators: { ngControl: [{
495
+ type: ContentChild,
496
+ args: [NgControl]
497
+ }], label: [{
498
+ type: Input
499
+ }], hint: [{
500
+ type: Input
501
+ }] } });
502
+
503
+ class BbFileImage {
504
+ constructor(_platform, _image, _sanitizer) {
505
+ this._platform = _platform;
506
+ this._image = _image;
507
+ this._sanitizer = _sanitizer;
508
+ }
509
+ async transform(file) {
510
+ // If the file is not a file return.
511
+ if (!this._platform.isBrowser || !(file instanceof File)) {
512
+ return null;
513
+ }
514
+ return this._image.fileToImage(file, [
515
+ 'image/png',
516
+ 'image/jpeg',
517
+ 'image/gif',
518
+ 'image/svg+xml'
519
+ ]).then(image => {
520
+ if (!image) {
521
+ return null;
522
+ }
523
+ return {
524
+ background: this._sanitizer.bypassSecurityTrustStyle(`url(${image.src})`),
525
+ aspectRatio: image.height / image.width
526
+ };
527
+ }).catch(() => {
528
+ return null;
529
+ });
530
+ }
531
+ }
532
+ BbFileImage.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFileImage, deps: [{ token: i1$1.Platform }, { token: i1$1.ImageConverter }, { token: i2.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
533
+ BbFileImage.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFileImage, name: "bbFileImage" });
534
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFileImage, decorators: [{
535
+ type: Pipe,
536
+ args: [{
537
+ name: 'bbFileImage'
538
+ }]
539
+ }], ctorParameters: function () { return [{ type: i1$1.Platform }, { type: i1$1.ImageConverter }, { type: i2.DomSanitizer }]; } });
540
+
541
+ class BbFileSize {
542
+ constructor() {
543
+ this.format = (value, decimals = 2) => {
544
+ if (value === 0) {
545
+ return '0 Bytes';
546
+ }
547
+ const k = 1024;
548
+ const dm = decimals < 0 ? 0 : decimals;
549
+ const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
550
+ const index = Math.floor(Math.log(value) / Math.log(k));
551
+ return parseFloat((value / Math.pow(k, index)).toFixed(dm)) + ' ' + sizes[index];
552
+ };
553
+ }
554
+ transform(value) {
555
+ return this.format(value);
556
+ }
557
+ }
558
+ BbFileSize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFileSize, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
559
+ BbFileSize.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFileSize, name: "bbFileSize" });
560
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFileSize, decorators: [{
561
+ type: Pipe,
562
+ args: [{
563
+ name: 'bbFileSize'
564
+ }]
565
+ }] });
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: "13.1.0", ngImport: i0, type: BbFilePicker, deps: null, target: i0.ɵɵFactoryTarget.Component });
707
+ BbFilePicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbFilePicker, selector: "bb-file-picker", inputs: { disabled: "disabled", hideErrors: "hideErrors", grouped: "grouped", required: "required", label: "label", hint: "hint", accept: "accept", showImages: "showImages", allowDragging: "allowDragging", value: "value" }, outputs: { valueChange: "valueChange" }, host: { listeners: { "dragover": "onDrag($event,true)", "dragleave": "onDrag($event,false)", "drop": "onDrop($event)" }, properties: { "class.required": "required", "class.disabled": "disabled", "class.grouped": "grouped", "class.hovered": "hovered", "class.error": "error" }, classAttribute: "bb-file-picker" }, providers: [
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;-moz-appearance:none;appearance:none;font-weight:500;align-items:center;white-space:nowrap;display:inline-flex;border-top-left-radius:3px;border-bottom-left-radius:3px;border-right:1px solid #b6bbc1;background-color:#ffffff80;transition:box-shadow .2s cubic-bezier(0,0,.2,1)}.bb-file-picker-button:focus{box-shadow:0 0 0 3px #007bff33}.bb-file-picker-button:disabled{cursor:default}.bb-file-picker-button.destructive{color:#f55656}.bb-file-picker-button.standalone{width:100%;border-right:none;border-top-right-radius:3px;border-bottom-right-radius:3px}.bb-file-picker-icon{margin-right:4px}.bb-file-picker-zone{flex:1;color:#848f99;font-size:14px;padding:8px 12px;line-height:18px;align-items:center;display:inline-flex;justify-content:center}.bb-file-picker-info{height:0;color:#848f99;padding:0 12px;overflow:hidden;line-height:36px;align-items:center;display:inline-flex;background-color:#fff8ff;border-top:0 solid #b6bbc1;transition:height .2s cubic-bezier(0,0,.2,1)}.bb-file-picker-info.visible{height:38px;border-top-width:1px}.bb-file-picker-info>span{opacity:.4;max-width:100%;font-size:14px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.bb-file-picker-info>span:first-child{flex:1}.bb-file-picker-info>span:last-child{margin-left:12px}.bb-file-picker-image-container{overflow:hidden;border-top:1px solid #b6bbc1}.bb-file-picker-image-wrapper{width:100%;max-width:40%;margin:20px auto}.bb-file-picker-image{width:100%;display:flex;overflow:hidden;position:relative;border-radius:4px;will-change:opacity;background-size:cover;background-position:center;background-repeat:no-repeat}.bb-file-picker-hint{display:block;color:#738694;font-size:13px;margin-top:4px}\n"], components: [{ type: BbFormError, selector: "bb-form-error", inputs: ["control"], outputs: ["errorChange"] }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: BbTemplate, selector: "[bbTemplate]", inputs: ["bbTemplate"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "async": i1.AsyncPipe, "bbLocalize": i4.BbLocalize, "bbFileImage": BbFileImage, "bbFileSize": BbFileSize }, animations: [
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: "13.1.0", 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;-moz-appearance:none;appearance:none;font-weight:500;align-items:center;white-space:nowrap;display:inline-flex;border-top-left-radius:3px;border-bottom-left-radius:3px;border-right:1px solid #b6bbc1;background-color:#ffffff80;transition:box-shadow .2s cubic-bezier(0,0,.2,1)}.bb-file-picker-button:focus{box-shadow:0 0 0 3px #007bff33}.bb-file-picker-button:disabled{cursor:default}.bb-file-picker-button.destructive{color:#f55656}.bb-file-picker-button.standalone{width:100%;border-right:none;border-top-right-radius:3px;border-bottom-right-radius:3px}.bb-file-picker-icon{margin-right:4px}.bb-file-picker-zone{flex:1;color:#848f99;font-size:14px;padding:8px 12px;line-height:18px;align-items:center;display:inline-flex;justify-content:center}.bb-file-picker-info{height:0;color:#848f99;padding:0 12px;overflow:hidden;line-height:36px;align-items:center;display:inline-flex;background-color:#fff8ff;border-top:0 solid #b6bbc1;transition:height .2s cubic-bezier(0,0,.2,1)}.bb-file-picker-info.visible{height:38px;border-top-width:1px}.bb-file-picker-info>span{opacity:.4;max-width:100%;font-size:14px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.bb-file-picker-info>span:first-child{flex:1}.bb-file-picker-info>span:last-child{margin-left:12px}.bb-file-picker-image-container{overflow:hidden;border-top:1px solid #b6bbc1}.bb-file-picker-image-wrapper{width:100%;max-width:40%;margin:20px auto}.bb-file-picker-image{width:100%;display:flex;overflow:hidden;position:relative;border-radius:4px;will-change:opacity;background-size:cover;background-position:center;background-repeat:no-repeat}.bb-file-picker-hint{display:block;color:#738694;font-size:13px;margin-top:4px}\n"] }]
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
+ }] } });
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: "13.1.0", ngImport: i0, type: BbSelect, deps: [{ token: i0.ElementRef }, { token: i5.NgControl, optional: true, self: true }, { token: BbFormControl, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
850
+ BbSelect.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.0", type: BbSelect, selector: "select[bbInput]", inputs: { disabled: "disabled", required: "required" }, host: { listeners: { "focus": "setFocus(true)", "blur": "setFocus(false)" }, properties: { "disabled": "disabled", "attr.id": "this.id" } }, ngImport: i0 });
851
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", 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: i5.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: "13.1.0", ngImport: i0, type: BbInput, deps: [{ token: i0.ElementRef }, { token: i5.NgControl, optional: true, self: true }, { token: BbFormControl, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
898
+ BbInput.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.0", type: BbInput, selector: "input[bbInput], textarea[bbInput]", inputs: { readonly: "readonly" }, host: { listeners: { "focus": "setFocus(true)", "blur": "setFocus(false)" }, properties: { "disabled": "disabled", "readonly": "readonly" } }, usesInheritance: true, ngImport: i0 });
899
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", 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: i5.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
+ }] } });
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: "13.1.0", ngImport: i0, type: BbDatePicker, deps: [{ token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Component });
1158
+ BbDatePicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbDatePicker, selector: "bb-date-picker", inputs: { required: "required", readonly: "readonly", disabled: "disabled", grouped: "grouped", hideErrors: "hideErrors", label: "label", hint: "hint", dayPlaceholder: "dayPlaceholder", monthPlaceholder: "monthPlaceholder", yearPlaceholder: "yearPlaceholder", years: "years", value: "value" }, outputs: { valueChange: "valueChange" }, host: { properties: { "class.required": "required", "class.readonly": "readonly", "class.disabled": "disabled", "class.grouped": "grouped", "class.error": "error" }, classAttribute: "bb-date-picker" }, providers: [
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"], components: [{ type: BbFormControl, selector: "bb-form-control", inputs: ["grouped", "hideErrors", "label", "hint"] }, { type: BbFormError, selector: "bb-form-error", inputs: ["control"], outputs: ["errorChange"] }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: BbTemplate, selector: "[bbTemplate]", inputs: ["bbTemplate"] }, { type: i5.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i5.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: BbFormSubmit, selector: "form", exportAs: ["bbForm"] }, { type: i5.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: BbSelect, selector: "select[bbInput]", inputs: ["disabled", "required"] }, { type: i5.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i5.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i5.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: BbInput, selector: "input[bbInput], textarea[bbInput]", inputs: ["readonly"] }, { type: i5.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i5.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { type: i5.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { type: i5.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }], pipes: { "async": i1.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1170
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", 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
+ }] } });
1211
+
1212
+ class BbSuffix {
1213
+ }
1214
+ BbSuffix.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbSuffix, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1215
+ BbSuffix.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.0", type: BbSuffix, selector: "[bbSuffix]", host: { classAttribute: "bb-suffix" }, ngImport: i0 });
1216
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", 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: "13.1.0", ngImport: i0, type: BbPrefix, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1228
+ BbPrefix.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.0", type: BbPrefix, selector: "[bbPrefix]", host: { classAttribute: "bb-prefix" }, ngImport: i0 });
1229
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbPrefix, decorators: [{
1230
+ type: Directive,
1231
+ args: [{
1232
+ selector: '[bbPrefix]',
1233
+ host: {
1234
+ 'class': 'bb-prefix'
1235
+ }
1236
+ }]
1237
+ }] });
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: "13.1.0", ngImport: i0, type: BbFormGroup, deps: null, target: i0.ɵɵFactoryTarget.Component });
1245
+ BbFormGroup.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbFormGroup, selector: "bb-form-group", inputs: { grouped: "grouped" }, host: { properties: { "class.grouped": "grouped" }, classAttribute: "bb-form-group" }, usesInheritance: true, ngImport: i0, template: "<ng-content></ng-content>\n", styles: [".bb-form-group{width:100%;display:flex;flex-wrap:wrap;margin-top:-10px}.bb-form-group>*{margin-top:10px}.bb-form-group>*:not(:first-child){margin-left:10px}.bb-form-group.start{justify-content:flex-start}.bb-form-group.end{justify-content:flex-end}.bb-form-group.vertical{flex-direction:column;justify-content:normal}.bb-form-group.vertical>*{margin-left:0}.bb-form-group.vertical.start{align-items:flex-start}.bb-form-group.vertical.end{align-items:flex-end}.bb-form-group.grouped{margin-bottom:20px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1246
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", 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
+ }] });
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: "13.1.0", ngImport: i0, type: BbFocusTrap, deps: [{ token: i1$1.Platform }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1317
+ BbFocusTrap.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.0", type: BbFocusTrap, selector: "[bbFocusTrap]", host: { listeners: { "keydown": "onKeydown($event)" } }, ngImport: i0 });
1318
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", 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
+ }] } });
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: "13.1.0", ngImport: i0, type: BbAutosize, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1369
+ BbAutosize.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.0", type: BbAutosize, selector: "textarea[bbAutosize]", inputs: { minHeight: "minHeight", maxHeight: "maxHeight", rows: "rows" }, host: { listeners: { "window:resize": "onWindowResize()", "input": "onInputReceived()" }, properties: { "style.min-height": "this.minHeight", "style.max-height": "this.maxHeight", "rows": "this.rows" } }, ngImport: i0 });
1370
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", 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
+ }] } });
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: "13.1.0", ngImport: i0, type: BbRelativeTime, deps: [{ token: i4.Localize, optional: true }, { token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Pipe });
1475
+ BbRelativeTime.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbRelativeTime, name: "bbRelativeTime" });
1476
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", 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
+ }] }]; } });
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: "13.1.0", ngImport: i0, type: BbCheckbox, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1539
+ BbCheckbox.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbCheckbox, selector: "bb-checkbox", inputs: { grouped: "grouped", disabled: "disabled", tabIndex: "tabIndex", checked: "checked" }, host: { properties: { "class.grouped": "grouped" }, classAttribute: "bb-checkbox" }, providers: [
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:translate(0)}.bb-checkbox-label>span:first-child{width:18px;height:18px;min-width:18px;min-height:18px;position:relative;border-radius:3px;vertical-align:middle;border:1px solid #bdc4c9;transition:all .2s ease}.bb-checkbox-label>span:last-child{padding-left:8px}.bb-checkbox-label>span:first-child>svg{top:3px;left:2px;fill:none;stroke:#fff;stroke-width:2;position:absolute;stroke-linecap:round;transition-delay:.1s;stroke-linejoin:round;stroke-dasharray:16px;stroke-dashoffset:16px;transition:all .3s ease;transform:translate(0)}.bb-checkbox-input:not(:disabled):not(:checked)+.bb-checkbox-label:focus>span:first-child{box-shadow:0 0 0 3px #decdcd80}.bb-checkbox-input:not(:disabled):checked+.bb-checkbox-label:focus>span:first-child{box-shadow:0 0 0 3px #5b53ff80}.bb-checkbox-input:checked+.bb-checkbox-label>span:first-child{border-color:#5b53ff;background-color:#5b53ff}.bb-checkbox-input:checked+.bb-checkbox-label>span:first-child>svg{stroke-dashoffset:0}.bb-checkbox-input:disabled+.bb-checkbox-label{cursor:default;pointer-events:none}.bb-checkbox-input:disabled:checked+.bb-checkbox-label>span:first-child{border-color:#cccccca3;background-color:#cccccca3}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1542
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", 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:translate(0)}.bb-checkbox-label>span:first-child{width:18px;height:18px;min-width:18px;min-height:18px;position:relative;border-radius:3px;vertical-align:middle;border:1px solid #bdc4c9;transition:all .2s ease}.bb-checkbox-label>span:last-child{padding-left:8px}.bb-checkbox-label>span:first-child>svg{top:3px;left:2px;fill:none;stroke:#fff;stroke-width:2;position:absolute;stroke-linecap:round;transition-delay:.1s;stroke-linejoin:round;stroke-dasharray:16px;stroke-dashoffset:16px;transition:all .3s ease;transform:translate(0)}.bb-checkbox-input:not(:disabled):not(:checked)+.bb-checkbox-label:focus>span:first-child{box-shadow:0 0 0 3px #decdcd80}.bb-checkbox-input:not(:disabled):checked+.bb-checkbox-label:focus>span:first-child{box-shadow:0 0 0 3px #5b53ff80}.bb-checkbox-input:checked+.bb-checkbox-label>span:first-child{border-color:#5b53ff;background-color:#5b53ff}.bb-checkbox-input:checked+.bb-checkbox-label>span:first-child>svg{stroke-dashoffset:0}.bb-checkbox-input:disabled+.bb-checkbox-label{cursor:default;pointer-events:none}.bb-checkbox-input:disabled:checked+.bb-checkbox-label>span:first-child{border-color:#cccccca3;background-color:#cccccca3}\n"] }]
1550
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { tabIndex: [{
1551
+ type: Input
1552
+ }], checked: [{
1553
+ type: Input
1554
+ }] } });
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: "13.1.0", 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: "12.0.0", version: "13.1.0", type: BbFocus, selector: "[bbFocus]", ngImport: i0 });
1585
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbFocus, decorators: [{
1586
+ type: Directive,
1587
+ args: [{
1588
+ selector: '[bbFocus]'
1589
+ }]
1590
+ }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i1$1.Platform }, { type: i0.ElementRef }]; } });
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
+ // Hex 3 values.
1634
+ let match = value.match(/^#([0-9a-f]{3})$/i);
1635
+ if (match && match[1]) {
1636
+ const r = parseInt(match[1].charAt(0), 16) * 0x11;
1637
+ const g = parseInt(match[1].charAt(1), 16) * 0x11;
1638
+ const b = parseInt(match[1].charAt(2), 16) * 0x11;
1639
+ return { r, g, b };
1640
+ }
1641
+ // Hex 6 values.
1642
+ match = value.match(/^#([0-9a-f]{6})$/i);
1643
+ if (match && match[1]) {
1644
+ const r = parseInt(match[1].substr(0, 2), 16);
1645
+ const g = parseInt(match[1].substr(2, 2), 16);
1646
+ const b = parseInt(match[1].substr(4, 2), 16);
1647
+ return { r, g, b };
1648
+ }
1649
+ // Rgb values.
1650
+ match = value.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);
1651
+ if (match) {
1652
+ const r = parseInt(match[1], 10);
1653
+ const g = parseInt(match[2], 10);
1654
+ const b = parseInt(match[3], 10);
1655
+ return { r, g, b };
1656
+ }
1657
+ // Not a supported color format.
1658
+ console?.warn?.(`BbAvatar: Unsupported tintColor "${value}" was used.`);
1659
+ return null;
1660
+ };
1661
+ }
1662
+ set src(value) {
1663
+ this._src = value;
1664
+ if (this._src) {
1665
+ this.state$.next('image');
1666
+ }
1667
+ }
1668
+ set title(value) {
1669
+ // Set the title and the initials.
1670
+ this._title = value || '!';
1671
+ this._initials = this.getInitials(this._title);
1672
+ // Generate the colors based on the name.
1673
+ const { r, g, b } = this.toRGb(this._title);
1674
+ this.setColors(r, g, b);
1675
+ }
1676
+ set tintColor(value) {
1677
+ const result = this.parseColorFormat(value);
1678
+ if (!result) {
1679
+ return;
1680
+ }
1681
+ const { r, g, b } = result;
1682
+ this.setColors(r, g, b);
1683
+ }
1684
+ get src() {
1685
+ return this._src;
1686
+ }
1687
+ get color() {
1688
+ return this._color;
1689
+ }
1690
+ get backgroundColor() {
1691
+ return this._backgroundColor;
1692
+ }
1693
+ get title() {
1694
+ return this._title;
1695
+ }
1696
+ get initials() {
1697
+ return this._initials;
1698
+ }
1699
+ setColors(red, green, blue) {
1700
+ this._color = `rgb(${red},${green},${blue})`;
1701
+ this._backgroundColor = `rgba(${red},${green},${blue}, 0.25)`;
1702
+ }
1703
+ }
1704
+ BbAvatar.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbAvatar, deps: [], target: i0.ɵɵFactoryTarget.Component });
1705
+ BbAvatar.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbAvatar, selector: "bb-avatar", inputs: { size: "size", src: "src", title: "title", tintColor: "tintColor" }, host: { attributes: { "role": "img" }, properties: { "style.width.px": "size", "style.height.px": "size", "style.font-size.px": "size / 2", "style.color": "color", "style.background-color": "backgroundColor", "attr.title": "this.title" }, classAttribute: "bb-avatar" }, ngImport: i0, template: "<ng-container [ngSwitch]=\"state$ | async\">\n <!-- Image. -->\n <ng-container *ngSwitchCase=\"'image'\">\n <img [src]=\"src\"\n [alt]=\"initials\"\n (error)=\"state$?.next('initials')\"\n class=\"bb-avatar-image\">\n </ng-container>\n\n <!-- Default initials fallback. -->\n <ng-container *ngSwitchDefault>\n {{ initials }}\n </ng-container>\n</ng-container>\n", styles: [".bb-avatar{line-height:1;font-size:18px;overflow:hidden;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;border-radius:50%;align-items:center;display:inline-flex;justify-content:center}.bb-avatar.rounded{border-radius:4px}.bb-avatar.square{border-radius:0}.bb-avatar-image{width:100%;height:100%;object-fit:cover;position:absolute}\n"], directives: [{ type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i1.NgSwitchDefault, selector: "[ngSwitchDefault]" }], pipes: { "async": i1.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1706
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbAvatar, decorators: [{
1707
+ type: Component,
1708
+ args: [{ selector: 'bb-avatar', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, host: {
1709
+ 'class': 'bb-avatar',
1710
+ 'role': 'img',
1711
+ '[style.width.px]': 'size',
1712
+ '[style.height.px]': 'size',
1713
+ '[style.font-size.px]': 'size / 2',
1714
+ '[style.color]': 'color',
1715
+ '[style.background-color]': 'backgroundColor'
1716
+ }, 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"] }]
1717
+ }], propDecorators: { size: [{
1718
+ type: Input
1719
+ }], src: [{
1720
+ type: Input
1721
+ }], title: [{
1722
+ type: Input
1723
+ }, {
1724
+ type: HostBinding,
1725
+ args: ['attr.title']
1726
+ }], tintColor: [{
1727
+ type: Input
1728
+ }] } });
1729
+
1730
+ class BbIcon {
1731
+ constructor(_registry) {
1732
+ this._registry = _registry;
1733
+ // Data.
1734
+ this._src = null;
1735
+ // State.
1736
+ this.state$ = new BehaviorSubject(null);
1737
+ this.alt = null;
1738
+ this.size = 24;
1739
+ this._ariaHidden = true;
1740
+ this.warn = (content) => {
1741
+ return console && console.warn && console.warn(content);
1742
+ };
1743
+ }
1744
+ set src(newValue) {
1745
+ this.state$.next(this.convert(newValue));
1746
+ this._src = newValue;
1747
+ }
1748
+ get src() {
1749
+ return this._src;
1750
+ }
1751
+ set ariaHidden(newValue) {
1752
+ this._ariaHidden = coerceBooleanProperty(newValue);
1753
+ }
1754
+ get ariaHidden() {
1755
+ return this._ariaHidden;
1756
+ }
1757
+ convert(src) {
1758
+ const [namespace, value] = (src || '').split(':');
1759
+ const onError = () => {
1760
+ this.warn(`ElementsModule: The icon with src "${src}" could not be rendered correctly; Did you put a correct src attribute?`);
1761
+ return { type: 'unknown' };
1762
+ };
1763
+ if (!namespace || !value || !this._registry) {
1764
+ return onError();
1765
+ }
1766
+ // Try to find a image icon.
1767
+ const imageIcon = this.findImageIcon(namespace, value);
1768
+ if (imageIcon) {
1769
+ return imageIcon;
1770
+ }
1771
+ // Try to find a font icon.
1772
+ const fontIcon = this.findFontIcon(namespace, value);
1773
+ if (fontIcon) {
1774
+ return fontIcon;
1775
+ }
1776
+ // Return the on error function.
1777
+ return onError();
1778
+ }
1779
+ findImageIcon(namespace, value) {
1780
+ const data = this._registry.find(item => item['namespace'] === namespace && item['name'] === value);
1781
+ if (!data) {
1782
+ return null;
1783
+ }
1784
+ return { type: data['type'], src: data['src'] };
1785
+ }
1786
+ findFontIcon(namespace, content) {
1787
+ const data = this._registry.find(item => item['namespace'] === namespace);
1788
+ if (!data) {
1789
+ return null;
1790
+ }
1791
+ const uses = data['uses'];
1792
+ if (uses === 'data-attribute') {
1793
+ return { type: data['type'], className: data['className'], attribute: content };
1794
+ }
1795
+ return { type: data['type'], className: data['className'], content };
1796
+ }
1797
+ }
1798
+ BbIcon.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbIcon, deps: [{ token: ELEMENTS_ICONS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1799
+ BbIcon.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbIcon, selector: "bb-icon", inputs: { alt: "alt", size: "size", src: "src", ariaHidden: "ariaHidden" }, host: { properties: { "attr.aria-hidden": "ariaHidden", "style.width.px": "size", "style.height.px": "size", "style.min-width.px": "size", "style.min-height.px": "size", "style.font-size.px": "size" }, classAttribute: "bb-icon" }, ngImport: i0, template: "<ng-container *ngIf=\"state$ | async as data\"\n [ngSwitch]=\"data?.type\">\n <i *ngSwitchCase=\"'font'\"\n [attr.data-icon]=\"data?.attribute\"\n [class]=\"data?.className\">\n {{ data?.content }}\n </i>\n <img *ngSwitchCase=\"'image'\"\n [src]=\"data?.src\"\n [alt]=\"alt\">\n <svg *ngSwitchCase=\"'unknown'\"\n viewBox=\"0 0 1 1\">\n <rect x=\"0\" y=\"0\" width=\"1\" height=\"1\" fill=\"#c5c5c5\"></rect>\n </svg>\n</ng-container>\n", styles: [".bb-icon{display:flex;-webkit-user-select:none;user-select:none;align-items:center;justify-content:center}.bb-icon>i{font-size:inherit}.bb-icon>img,.bb-icon>svg{width:100%;height:100%;display:flex}\n"], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }], pipes: { "async": i1.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1800
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbIcon, decorators: [{
1801
+ type: Component,
1802
+ args: [{ selector: 'bb-icon', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
1803
+ 'class': 'bb-icon',
1804
+ '[attr.aria-hidden]': 'ariaHidden',
1805
+ '[style.width.px]': 'size',
1806
+ '[style.height.px]': 'size',
1807
+ '[style.min-width.px]': 'size',
1808
+ '[style.min-height.px]': 'size',
1809
+ '[style.font-size.px]': 'size'
1810
+ }, 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"] }]
1811
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1812
+ type: Optional
1813
+ }, {
1814
+ type: Inject,
1815
+ args: [ELEMENTS_ICONS]
1816
+ }] }]; }, propDecorators: { alt: [{
1817
+ type: Input
1818
+ }], size: [{
1819
+ type: Input
1820
+ }], src: [{
1821
+ type: Input
1822
+ }], ariaHidden: [{
1823
+ type: Input
1824
+ }] } });
1825
+
1826
+ class BbTag {
1827
+ constructor() {
1828
+ // Outputs.
1829
+ this.onClose = new EventEmitter();
1830
+ }
1831
+ }
1832
+ BbTag.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbTag, deps: [], target: i0.ɵɵFactoryTarget.Component });
1833
+ BbTag.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbTag, selector: "bb-tag", outputs: { onClose: "onClose" }, host: { classAttribute: "bb-tag" }, ngImport: i0, template: "<ng-content></ng-content>\n\n<button *ngIf=\"onClose?.observers?.length > 0\"\n (click)=\"onClose.emit()\"\n type=\"button\">\n Close\n</button>", styles: [".bb-tag{cursor:default;padding:0 7px;font-size:12px;list-style:none;line-height:20px;border-radius:4px;white-space:nowrap;display:inline-block;color:#000000a6;border:1px solid #d9d9d9;background-color:#fafafa;font-variant:tabular-nums;font-feature-settings:\"tnum\"}.bb-tag:not(:last-child){margin-right:8px}\n"], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1834
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbTag, decorators: [{
1835
+ type: Component,
1836
+ args: [{ selector: 'bb-tag', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, host: { 'class': 'bb-tag' }, template: "<ng-content></ng-content>\n\n<button *ngIf=\"onClose?.observers?.length > 0\"\n (click)=\"onClose.emit()\"\n type=\"button\">\n Close\n</button>", styles: [".bb-tag{cursor:default;padding:0 7px;font-size:12px;list-style:none;line-height:20px;border-radius:4px;white-space:nowrap;display:inline-block;color:#000000a6;border:1px solid #d9d9d9;background-color:#fafafa;font-variant:tabular-nums;font-feature-settings:\"tnum\"}.bb-tag:not(:last-child){margin-right:8px}\n"] }]
1837
+ }], propDecorators: { onClose: [{
1838
+ type: Output
1839
+ }] } });
1840
+
1841
+ const DECLARATIONS_EXPORTS = [
1842
+ // Directives.
1843
+ BbTemplate,
1844
+ BbFormError,
1845
+ BbFormSubmit,
1846
+ BbInput,
1847
+ BbSelect,
1848
+ BbFocus,
1849
+ BbFocusTrap,
1850
+ BbAutosize,
1851
+ BbPrefix,
1852
+ BbSuffix,
1853
+ // Pipes.
1854
+ BbFileSize,
1855
+ BbFileImage,
1856
+ BbRelativeTime,
1857
+ // Components.
1858
+ BbButton,
1859
+ BbAnchor,
1860
+ BbSpinner,
1861
+ BbIcon,
1862
+ BbFormControl,
1863
+ BbFormGroup,
1864
+ BbCheckbox,
1865
+ BbDropdown,
1866
+ BbDropdownItem,
1867
+ BbTag,
1868
+ BbAvatar,
1869
+ BbFilePicker,
1870
+ BbImagePicker,
1871
+ BbDatePicker
1872
+ ];
1873
+ class ElementsModule {
1874
+ static forRoot() {
1875
+ return {
1876
+ ngModule: ElementsModule,
1877
+ providers: [
1878
+ { provide: ELEMENTS_ERRORS, useFactory: getErrors, multi: true },
1879
+ ELEMENTS_MATERIAL_ICON
1880
+ ]
1881
+ };
1882
+ }
1883
+ }
1884
+ ElementsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: ElementsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1885
+ ElementsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: ElementsModule, declarations: [
1886
+ // Directives.
1887
+ BbTemplate,
1888
+ BbFormError,
1889
+ BbFormSubmit,
1890
+ BbInput,
1891
+ BbSelect,
1892
+ BbFocus,
1893
+ BbFocusTrap,
1894
+ BbAutosize,
1895
+ BbPrefix,
1896
+ BbSuffix,
1897
+ // Pipes.
1898
+ BbFileSize,
1899
+ BbFileImage,
1900
+ BbRelativeTime,
1901
+ // Components.
1902
+ BbButton,
1903
+ BbAnchor,
1904
+ BbSpinner,
1905
+ BbIcon,
1906
+ BbFormControl,
1907
+ BbFormGroup,
1908
+ BbCheckbox,
1909
+ BbDropdown,
1910
+ BbDropdownItem,
1911
+ BbTag,
1912
+ BbAvatar,
1913
+ BbFilePicker,
1914
+ BbImagePicker,
1915
+ BbDatePicker], imports: [CommonModule, ReactiveFormsModule, LocalizeModule], exports: [
1916
+ // Directives.
1917
+ BbTemplate,
1918
+ BbFormError,
1919
+ BbFormSubmit,
1920
+ BbInput,
1921
+ BbSelect,
1922
+ BbFocus,
1923
+ BbFocusTrap,
1924
+ BbAutosize,
1925
+ BbPrefix,
1926
+ BbSuffix,
1927
+ // Pipes.
1928
+ BbFileSize,
1929
+ BbFileImage,
1930
+ BbRelativeTime,
1931
+ // Components.
1932
+ BbButton,
1933
+ BbAnchor,
1934
+ BbSpinner,
1935
+ BbIcon,
1936
+ BbFormControl,
1937
+ BbFormGroup,
1938
+ BbCheckbox,
1939
+ BbDropdown,
1940
+ BbDropdownItem,
1941
+ BbTag,
1942
+ BbAvatar,
1943
+ BbFilePicker,
1944
+ BbImagePicker,
1945
+ BbDatePicker] });
1946
+ ElementsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: ElementsModule, imports: [[CommonModule, ReactiveFormsModule, LocalizeModule]] });
1947
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: ElementsModule, decorators: [{
1948
+ type: NgModule,
1949
+ args: [{
1950
+ imports: [CommonModule, ReactiveFormsModule, LocalizeModule],
1951
+ declarations: [...DECLARATIONS_EXPORTS],
1952
+ exports: [...DECLARATIONS_EXPORTS]
1953
+ }]
1954
+ }] });
1955
+ const ELEMENTS_MATERIAL_ICON = {
1956
+ provide: ELEMENTS_ICONS,
1957
+ useValue: { namespace: 'material', className: 'material-icons', uses: 'content', type: 'font' },
1958
+ multi: true
1959
+ };
1960
+ function getErrors() {
1961
+ const data = {
1962
+ unknown: () => 'form-control-errors.unknown',
1963
+ required: () => 'form-control-errors.required',
1964
+ pattern: () => 'form-control-errors.pattern',
1965
+ email: () => 'form-control-errors.email',
1966
+ emailTaken: () => 'form-control-errors.emailTaken',
1967
+ passwordMatch: () => 'form-control-errors.passwordMatch',
1968
+ confirm: () => 'form-control-errors.confirm',
1969
+ fullNumber: () => 'form-control-errors.fullNumber',
1970
+ min: ({ min }) => ({ token: 'form-control-errors.min', data: { min } }),
1971
+ max: ({ max }) => ({ token: 'form-control-errors.max', data: { max } }),
1972
+ maxFileSize: ({ maxSize }) => ({ token: 'form-control-errors.maxFileSize', data: { maxSize } }),
1973
+ minDate: ({ date }) => ({ token: 'form-control-errors.minDate', data: { date } }),
1974
+ maxDate: ({ date }) => ({ token: 'form-control-errors.maxDate', data: { date } }),
1975
+ invalidDate: () => 'form-control-errors.invalidDate',
1976
+ invalidFileType: () => 'form-control-errors.invalidFileType',
1977
+ minlength: ({ requiredLength, actualLength }) => ({
1978
+ token: 'form-control-errors.minlength',
1979
+ data: { requiredLength, actualLength }
1980
+ }),
1981
+ maxlength: ({ requiredLength, actualLength }) => ({
1982
+ token: 'form-control-errors.maxlength',
1983
+ data: { requiredLength, actualLength }
1984
+ })
1985
+ };
1986
+ return data;
1987
+ }
1988
+
1989
+ /**
1990
+ * Generated bundle index. Do not edit.
1991
+ */
1992
+
1993
+ 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 };
1994
+ //# sourceMappingURL=bravobit-bb-foundation-elements.mjs.map