@spartan-ng/brain 0.0.1-alpha.493 → 0.0.1-alpha.495

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 (234) hide show
  1. package/accordion/index.d.ts +8 -8
  2. package/accordion/lib/{brn-accordion-content.component.d.ts → brn-accordion-content.d.ts} +3 -3
  3. package/accordion/lib/{brn-accordion.directive.d.ts → brn-accordion.d.ts} +11 -11
  4. package/alert-dialog/index.d.ts +20 -20
  5. package/alert-dialog/lib/brn-alert-dialog-content.d.ts +6 -0
  6. package/alert-dialog/lib/brn-alert-dialog-description.d.ts +6 -0
  7. package/alert-dialog/lib/brn-alert-dialog-overlay.d.ts +6 -0
  8. package/alert-dialog/lib/brn-alert-dialog-title.d.ts +6 -0
  9. package/alert-dialog/lib/brn-alert-dialog-trigger.d.ts +9 -0
  10. package/alert-dialog/lib/brn-alert-dialog.d.ts +7 -0
  11. package/avatar/index.d.ts +9 -9
  12. package/avatar/lib/brn-avatar.d.ts +7 -0
  13. package/avatar/lib/fallback/brn-avatar-fallback.d.ts +9 -0
  14. package/avatar/lib/fallback/index.d.ts +1 -1
  15. package/avatar/lib/image/brn-avatar-image.d.ts +9 -0
  16. package/avatar/lib/image/index.d.ts +1 -1
  17. package/calendar/index.d.ts +32 -32
  18. package/calendar/lib/{brn-calendar-cell-button.directive.d.ts → brn-calendar-cell-button.d.ts} +4 -4
  19. package/calendar/lib/brn-calendar-cell.d.ts +5 -0
  20. package/calendar/lib/brn-calendar-grid.d.ts +7 -0
  21. package/calendar/lib/brn-calendar-header.d.ts +7 -0
  22. package/calendar/lib/{brn-calendar-next-button.directive.d.ts → brn-calendar-next-button.d.ts} +3 -3
  23. package/calendar/lib/{brn-calendar-previous-button.directive.d.ts → brn-calendar-previous-button.d.ts} +3 -3
  24. package/calendar/lib/{brn-calendar-week.directive.d.ts → brn-calendar-week.d.ts} +4 -4
  25. package/calendar/lib/{brn-calendar-weekday.directive.d.ts → brn-calendar-weekday.d.ts} +4 -4
  26. package/calendar/lib/{brn-calendar.directive.d.ts → brn-calendar.d.ts} +8 -8
  27. package/calendar/lib/brn-calendar.token.d.ts +6 -6
  28. package/calendar/lib/mode/{brn-calendar-multiple.directive.d.ts → brn-calendar-multiple.d.ts} +9 -9
  29. package/checkbox/index.d.ts +5 -5
  30. package/checkbox/lib/{brn-checkbox.component.d.ts → brn-checkbox.d.ts} +3 -3
  31. package/collapsible/index.d.ts +11 -11
  32. package/collapsible/lib/{brn-collapsible-content.component.d.ts → brn-collapsible-content.d.ts} +5 -5
  33. package/collapsible/lib/brn-collapsible-trigger.d.ts +9 -0
  34. package/collapsible/lib/{brn-collapsible.component.d.ts → brn-collapsible.d.ts} +3 -3
  35. package/command/index.d.ts +20 -20
  36. package/command/lib/brn-command-empty.d.ts +11 -0
  37. package/command/lib/{brn-command-group.directive.d.ts → brn-command-group.d.ts} +3 -3
  38. package/command/lib/{brn-command-item.directive.d.ts → brn-command-item.d.ts} +3 -3
  39. package/command/lib/brn-command-item.token.d.ts +3 -3
  40. package/command/lib/brn-command-list.d.ts +8 -0
  41. package/command/lib/{brn-command-search-input.directive.d.ts → brn-command-search-input.d.ts} +3 -3
  42. package/command/lib/brn-command-search-input.token.d.ts +3 -3
  43. package/command/lib/{brn-command.directive.d.ts → brn-command.d.ts} +5 -5
  44. package/command/lib/brn-command.token.d.ts +4 -4
  45. package/dialog/index.d.ts +23 -23
  46. package/dialog/lib/brn-dialog-close.d.ts +8 -0
  47. package/dialog/lib/brn-dialog-content.d.ts +12 -0
  48. package/dialog/lib/{brn-dialog-description.directive.d.ts → brn-dialog-description.d.ts} +3 -3
  49. package/dialog/lib/brn-dialog-overlay.d.ts +9 -0
  50. package/dialog/lib/brn-dialog-title.d.ts +8 -0
  51. package/dialog/lib/brn-dialog-trigger.d.ts +18 -0
  52. package/dialog/lib/{brn-dialog.component.d.ts → brn-dialog.d.ts} +3 -3
  53. package/fesm2022/spartan-ng-brain-accordion.mjs +25 -36
  54. package/fesm2022/spartan-ng-brain-accordion.mjs.map +1 -1
  55. package/fesm2022/spartan-ng-brain-alert-dialog.mjs +79 -79
  56. package/fesm2022/spartan-ng-brain-alert-dialog.mjs.map +1 -1
  57. package/fesm2022/spartan-ng-brain-avatar.mjs +16 -16
  58. package/fesm2022/spartan-ng-brain-avatar.mjs.map +1 -1
  59. package/fesm2022/spartan-ng-brain-calendar.mjs +239 -239
  60. package/fesm2022/spartan-ng-brain-calendar.mjs.map +1 -1
  61. package/fesm2022/spartan-ng-brain-checkbox.mjs +8 -8
  62. package/fesm2022/spartan-ng-brain-checkbox.mjs.map +1 -1
  63. package/fesm2022/spartan-ng-brain-collapsible.mjs +17 -25
  64. package/fesm2022/spartan-ng-brain-collapsible.mjs.map +1 -1
  65. package/fesm2022/spartan-ng-brain-command.mjs +195 -195
  66. package/fesm2022/spartan-ng-brain-command.mjs.map +1 -1
  67. package/fesm2022/spartan-ng-brain-dialog.mjs +98 -98
  68. package/fesm2022/spartan-ng-brain-dialog.mjs.map +1 -1
  69. package/fesm2022/spartan-ng-brain-form-field.mjs.map +1 -1
  70. package/fesm2022/spartan-ng-brain-forms.mjs +3 -2
  71. package/fesm2022/spartan-ng-brain-forms.mjs.map +1 -1
  72. package/fesm2022/spartan-ng-brain-hover-card.mjs +21 -29
  73. package/fesm2022/spartan-ng-brain-hover-card.mjs.map +1 -1
  74. package/fesm2022/spartan-ng-brain-input-otp.mjs +44 -44
  75. package/fesm2022/spartan-ng-brain-input-otp.mjs.map +1 -1
  76. package/fesm2022/spartan-ng-brain-label.mjs +8 -8
  77. package/fesm2022/spartan-ng-brain-label.mjs.map +1 -1
  78. package/fesm2022/spartan-ng-brain-menu.mjs +102 -131
  79. package/fesm2022/spartan-ng-brain-menu.mjs.map +1 -1
  80. package/fesm2022/spartan-ng-brain-popover.mjs +75 -86
  81. package/fesm2022/spartan-ng-brain-popover.mjs.map +1 -1
  82. package/fesm2022/spartan-ng-brain-progress.mjs +28 -28
  83. package/fesm2022/spartan-ng-brain-progress.mjs.map +1 -1
  84. package/fesm2022/spartan-ng-brain-radio-group.mjs +17 -17
  85. package/fesm2022/spartan-ng-brain-radio-group.mjs.map +1 -1
  86. package/fesm2022/spartan-ng-brain-select.mjs +277 -277
  87. package/fesm2022/spartan-ng-brain-select.mjs.map +1 -1
  88. package/fesm2022/spartan-ng-brain-separator.mjs +8 -8
  89. package/fesm2022/spartan-ng-brain-separator.mjs.map +1 -1
  90. package/fesm2022/spartan-ng-brain-sheet.mjs +69 -69
  91. package/fesm2022/spartan-ng-brain-sheet.mjs.map +1 -1
  92. package/fesm2022/spartan-ng-brain-slider.mjs +136 -142
  93. package/fesm2022/spartan-ng-brain-slider.mjs.map +1 -1
  94. package/fesm2022/spartan-ng-brain-switch.mjs +26 -26
  95. package/fesm2022/spartan-ng-brain-switch.mjs.map +1 -1
  96. package/fesm2022/spartan-ng-brain-tabs.mjs +28 -39
  97. package/fesm2022/spartan-ng-brain-tabs.mjs.map +1 -1
  98. package/fesm2022/spartan-ng-brain-toggle-group.mjs +18 -18
  99. package/fesm2022/spartan-ng-brain-toggle-group.mjs.map +1 -1
  100. package/fesm2022/spartan-ng-brain-toggle.mjs +9 -9
  101. package/fesm2022/spartan-ng-brain-toggle.mjs.map +1 -1
  102. package/fesm2022/spartan-ng-brain-tooltip.mjs +31 -42
  103. package/fesm2022/spartan-ng-brain-tooltip.mjs.map +1 -1
  104. package/form-field/lib/brn-form-field-control.d.ts +2 -2
  105. package/forms/lib/error-options.d.ts +1 -1
  106. package/hover-card/index.d.ts +6 -6
  107. package/hover-card/lib/brn-hover-card-content.service.d.ts +9 -9
  108. package/hover-card/lib/brn-hover-card.d.ts +9 -0
  109. package/input-otp/index.d.ts +8 -8
  110. package/input-otp/lib/{brn-input-otp-slot.component.d.ts → brn-input-otp-slot.d.ts} +4 -4
  111. package/input-otp/lib/{brn-input-otp.component.d.ts → brn-input-otp.d.ts} +3 -3
  112. package/input-otp/lib/brn-input-otp.token.d.ts +4 -4
  113. package/label/index.d.ts +3 -3
  114. package/label/lib/{brn-label.directive.d.ts → brn-label.d.ts} +3 -3
  115. package/menu/index.d.ts +32 -32
  116. package/menu/lib/{brn-context-menu-trigger.directive.d.ts → brn-context-menu-trigger.d.ts} +3 -3
  117. package/menu/lib/brn-menu-bar.d.ts +6 -0
  118. package/menu/lib/brn-menu-group.d.ts +6 -0
  119. package/menu/lib/brn-menu-item-checkbox.d.ts +11 -0
  120. package/menu/lib/brn-menu-item-radio.d.ts +11 -0
  121. package/menu/lib/brn-menu-item.d.ts +10 -0
  122. package/menu/lib/brn-menu-trigger.d.ts +10 -0
  123. package/menu/lib/{brn-menu.directive.d.ts → brn-menu.d.ts} +3 -3
  124. package/package.json +1 -1
  125. package/popover/index.d.ts +14 -14
  126. package/popover/lib/brn-popover-close.d.ts +6 -0
  127. package/popover/lib/brn-popover-content.d.ts +6 -0
  128. package/popover/lib/brn-popover-trigger.d.ts +10 -0
  129. package/popover/lib/brn-popover.d.ts +12 -0
  130. package/progress/index.d.ts +8 -8
  131. package/progress/lib/{brn-progress-indicator.component.d.ts → brn-progress-indicator.d.ts} +4 -4
  132. package/progress/lib/{brn-progress.component.d.ts → brn-progress.d.ts} +3 -3
  133. package/progress/lib/brn-progress.token.d.ts +3 -3
  134. package/radio-group/index.d.ts +8 -8
  135. package/radio-group/lib/{brn-radio-group.directive.d.ts → brn-radio-group.d.ts} +6 -6
  136. package/radio-group/lib/brn-radio-group.token.d.ts +3 -3
  137. package/radio-group/lib/{brn-radio.component.d.ts → brn-radio.d.ts} +6 -6
  138. package/select/index.d.ts +29 -29
  139. package/select/lib/{brn-select-content.component.d.ts → brn-select-content.d.ts} +15 -15
  140. package/select/lib/brn-select-content.token.d.ts +3 -3
  141. package/select/lib/brn-select-group.d.ts +6 -0
  142. package/select/lib/brn-select-label.d.ts +9 -0
  143. package/select/lib/{brn-select-option.directive.d.ts → brn-select-option.d.ts} +5 -5
  144. package/select/lib/{brn-select-placeholder.directive.d.ts → brn-select-placeholder.d.ts} +3 -3
  145. package/select/lib/{brn-select-trigger.directive.d.ts → brn-select-trigger.d.ts} +4 -4
  146. package/select/lib/brn-select-value-template.d.ts +11 -0
  147. package/select/lib/{brn-select-value.component.d.ts → brn-select-value.d.ts} +8 -8
  148. package/select/lib/{brn-select.component.d.ts → brn-select.d.ts} +12 -12
  149. package/select/lib/brn-select.token.d.ts +3 -3
  150. package/separator/index.d.ts +3 -3
  151. package/separator/lib/{brn-separator.component.d.ts → brn-separator.d.ts} +3 -3
  152. package/sheet/index.d.ts +23 -23
  153. package/sheet/lib/brn-sheet-close.d.ts +6 -0
  154. package/sheet/lib/brn-sheet-content.d.ts +8 -0
  155. package/sheet/lib/brn-sheet-description.d.ts +6 -0
  156. package/sheet/lib/brn-sheet-overlay.d.ts +6 -0
  157. package/sheet/lib/brn-sheet-title.d.ts +6 -0
  158. package/sheet/lib/brn-sheet-trigger.d.ts +9 -0
  159. package/sheet/lib/brn-sheet.d.ts +10 -0
  160. package/slider/index.d.ts +11 -11
  161. package/slider/lib/brn-slider-range.d.ts +7 -0
  162. package/slider/lib/{brn-slider-thumb.directive.d.ts → brn-slider-thumb.d.ts} +4 -4
  163. package/slider/lib/brn-slider-tick.d.ts +12 -0
  164. package/slider/lib/{brn-slider-track.directive.d.ts → brn-slider-track.d.ts} +4 -4
  165. package/slider/lib/brn-slider-track.token.d.ts +4 -4
  166. package/slider/lib/{brn-slider.directive.d.ts → brn-slider.d.ts} +5 -5
  167. package/slider/lib/brn-slider.token.d.ts +3 -3
  168. package/switch/index.d.ts +8 -8
  169. package/switch/lib/brn-switch-thumb.d.ts +5 -0
  170. package/switch/lib/{brn-switch.component.d.ts → brn-switch.d.ts} +3 -3
  171. package/tabs/index.d.ts +15 -15
  172. package/tabs/lib/{brn-tabs-content.directive.d.ts → brn-tabs-content.d.ts} +3 -3
  173. package/tabs/lib/{brn-tabs-list.directive.d.ts → brn-tabs-list.d.ts} +6 -6
  174. package/tabs/lib/{brn-tabs-paginated-list.directive.d.ts → brn-tabs-paginated-list.d.ts} +3 -3
  175. package/tabs/lib/{brn-tabs-trigger.directive.d.ts → brn-tabs-trigger.d.ts} +4 -4
  176. package/tabs/lib/{brn-tabs.directive.d.ts → brn-tabs.d.ts} +9 -9
  177. package/toggle/index.d.ts +3 -3
  178. package/toggle/lib/{brn-toggle.directive.d.ts → brn-toggle.d.ts} +3 -3
  179. package/toggle-group/index.d.ts +6 -6
  180. package/toggle-group/lib/{brn-toggle-group.component.d.ts → brn-toggle-group.d.ts} +8 -8
  181. package/toggle-group/lib/brn-toggle-group.token.d.ts +3 -3
  182. package/toggle-group/lib/{brn-toggle-item.directive.d.ts → brn-toggle-item.d.ts} +4 -4
  183. package/tooltip/index.d.ts +14 -14
  184. package/tooltip/lib/brn-tooltip-content-template.d.ts +8 -0
  185. package/tooltip/lib/{brn-tooltip-content.component.d.ts → brn-tooltip-content.d.ts} +3 -3
  186. package/tooltip/lib/{brn-tooltip-trigger.directive.d.ts → brn-tooltip-trigger.d.ts} +3 -3
  187. package/tooltip/lib/brn-tooltip.d.ts +7 -0
  188. package/tooltip/lib/brn-tooltip.token.d.ts +1 -1
  189. package/alert-dialog/lib/brn-alert-dialog-content.directive.d.ts +0 -6
  190. package/alert-dialog/lib/brn-alert-dialog-description.directive.d.ts +0 -6
  191. package/alert-dialog/lib/brn-alert-dialog-overlay.component.d.ts +0 -6
  192. package/alert-dialog/lib/brn-alert-dialog-title.directive.d.ts +0 -6
  193. package/alert-dialog/lib/brn-alert-dialog-trigger.directive.d.ts +0 -9
  194. package/alert-dialog/lib/brn-alert-dialog.component.d.ts +0 -7
  195. package/avatar/lib/brn-avatar.component.d.ts +0 -7
  196. package/avatar/lib/fallback/brn-avatar-fallback.directive.d.ts +0 -9
  197. package/avatar/lib/image/brn-avatar-image.directive.d.ts +0 -9
  198. package/calendar/lib/brn-calendar-cell.directive.d.ts +0 -5
  199. package/calendar/lib/brn-calendar-grid.directive.d.ts +0 -7
  200. package/calendar/lib/brn-calendar-header.directive.d.ts +0 -7
  201. package/collapsible/lib/brn-collapsible-trigger.directive.d.ts +0 -9
  202. package/command/lib/brn-command-empty.directive.d.ts +0 -11
  203. package/command/lib/brn-command-list.directive.d.ts +0 -8
  204. package/dialog/lib/brn-dialog-close.directive.d.ts +0 -8
  205. package/dialog/lib/brn-dialog-content.directive.d.ts +0 -12
  206. package/dialog/lib/brn-dialog-overlay.component.d.ts +0 -9
  207. package/dialog/lib/brn-dialog-title.directive.d.ts +0 -8
  208. package/dialog/lib/brn-dialog-trigger.directive.d.ts +0 -18
  209. package/hover-card/lib/brn-hover-card.component.d.ts +0 -9
  210. package/menu/lib/brn-menu-bar.directive.d.ts +0 -6
  211. package/menu/lib/brn-menu-group.directive.d.ts +0 -6
  212. package/menu/lib/brn-menu-item-checkbox.directive.d.ts +0 -11
  213. package/menu/lib/brn-menu-item-radio.directive.d.ts +0 -11
  214. package/menu/lib/brn-menu-item.directive.d.ts +0 -10
  215. package/menu/lib/brn-menu-trigger.directive.d.ts +0 -10
  216. package/popover/lib/brn-popover-close.directive.d.ts +0 -6
  217. package/popover/lib/brn-popover-content.directive.d.ts +0 -6
  218. package/popover/lib/brn-popover-trigger.directive.d.ts +0 -10
  219. package/popover/lib/brn-popover.component.d.ts +0 -12
  220. package/select/lib/brn-select-group.directive.d.ts +0 -6
  221. package/select/lib/brn-select-label.directive.d.ts +0 -9
  222. package/select/lib/brn-select-value.directive.d.ts +0 -11
  223. package/sheet/lib/brn-sheet-close.directive.d.ts +0 -6
  224. package/sheet/lib/brn-sheet-content.directive.d.ts +0 -8
  225. package/sheet/lib/brn-sheet-description.directive.d.ts +0 -6
  226. package/sheet/lib/brn-sheet-overlay.component.d.ts +0 -6
  227. package/sheet/lib/brn-sheet-title.directive.d.ts +0 -6
  228. package/sheet/lib/brn-sheet-trigger.directive.d.ts +0 -9
  229. package/sheet/lib/brn-sheet.component.d.ts +0 -10
  230. package/slider/lib/brn-slider-range.directive.d.ts +0 -7
  231. package/slider/lib/brn-slider-tick.directive.d.ts +0 -12
  232. package/switch/lib/brn-switch-thumb.component.d.ts +0 -5
  233. package/tooltip/lib/brn-tooltip-content.directive.d.ts +0 -8
  234. package/tooltip/lib/brn-tooltip.directive.d.ts +0 -7
@@ -1 +1 @@
1
- {"version":3,"file":"spartan-ng-brain-collapsible.mjs","sources":["../../../../libs/brain/collapsible/src/lib/brn-collapsible.component.ts","../../../../libs/brain/collapsible/src/lib/brn-collapsible-content.component.ts","../../../../libs/brain/collapsible/src/lib/brn-collapsible-trigger.directive.ts","../../../../libs/brain/collapsible/src/index.ts","../../../../libs/brain/collapsible/src/spartan-ng-brain-collapsible.ts"],"sourcesContent":["import { BooleanInput } from '@angular/cdk/coercion';\nimport { ChangeDetectionStrategy, Component, booleanAttribute, input, model, signal } from '@angular/core';\n\nlet collapsibleContentIdSequence = 0;\n\nexport type BrnCollapsibleState = 'open' | 'closed';\n\n@Component({\n\tselector: 'brn-collapsible',\n\thost: {\n\t\t'[attr.data-state]': 'expanded() ? \"open\" : \"closed\"',\n\t\t'[attr.disabled]': 'disabled() ? true : undefined',\n\t},\n\ttemplate: `\n\t\t<ng-content />\n\t`,\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BrnCollapsibleComponent {\n\tpublic readonly contentId = signal(`brn-collapsible-content-${collapsibleContentIdSequence++}`);\n\n\t/**\n\t * The expanded or collapsed state of the collapsible component.\n\t */\n\tpublic readonly expanded = model<boolean>(false);\n\n\t/**\n\t * The disabled state of the collapsible component.\n\t */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\t/**\n\t * Toggles the expanded state of the collapsible component.\n\t */\n\tpublic toggle(): void {\n\t\tthis.expanded.update((expanded) => !expanded);\n\t}\n}\n","import { isPlatformServer } from '@angular/common';\nimport {\n\tChangeDetectionStrategy,\n\tComponent,\n\tElementRef,\n\tOnInit,\n\tPLATFORM_ID,\n\teffect,\n\tinject,\n\tinput,\n\tsignal,\n\tuntracked,\n} from '@angular/core';\nimport { BrnCollapsibleComponent } from './brn-collapsible.component';\n\n@Component({\n\tselector: 'brn-collapsible-content',\n\thost: {\n\t\t'[hidden]': '!_collapsible?.expanded()',\n\t\t'[attr.data-state]': '_collapsible?.expanded() ? \"open\" : \"closed\"',\n\t\t'[id]': '_collapsible?.contentId()',\n\t\t'[style.--brn-collapsible-content-width.px]': '_width()',\n\t\t'[style.--brn-collapsible-content-height.px]': '_height()',\n\t},\n\ttemplate: `\n\t\t<ng-content />\n\t`,\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BrnCollapsibleContentComponent implements OnInit {\n\tprotected readonly _collapsible = inject(BrnCollapsibleComponent, { optional: true });\n\tprivate readonly _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\tprivate readonly _platformId = inject(PLATFORM_ID);\n\t/**\n\t * The id of the collapsible content element.\n\t */\n\tpublic readonly id = input<string | null | undefined>();\n\tprotected readonly _width = signal<number | null>(null);\n\tprotected readonly _height = signal<number | null>(null);\n\n\tconstructor() {\n\t\tif (!this._collapsible) {\n\t\t\tthrow Error('Collapsible trigger directive can only be used inside a brn-collapsible element.');\n\t\t}\n\n\t\teffect(() => {\n\t\t\tconst id = this.id();\n\t\t\tconst collapsible = this._collapsible;\n\t\t\tif (!id || !collapsible) return;\n\t\t\tuntracked(() => collapsible.contentId.set(id));\n\t\t});\n\t}\n\n\tngOnInit(): void {\n\t\tif (isPlatformServer(this._platformId)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// ensure the element is not hidden when measuring its size\n\t\tthis._elementRef.nativeElement.hidden = false;\n\n\t\tconst { width, height } = this._elementRef.nativeElement.getBoundingClientRect();\n\t\tthis._width.set(width);\n\t\tthis._height.set(height);\n\n\t\t// we force the element to be hidden again if collapsed after measuring its size\n\t\t// this is handled by the host binding, but it can cause a flicker if we don't do this here manually\n\t\tthis._elementRef.nativeElement.hidden = this._collapsible?.expanded() ?? false;\n\t}\n}\n","import { Directive, inject } from '@angular/core';\nimport { BrnCollapsibleComponent } from './brn-collapsible.component';\n\n@Directive({\n\tselector: 'button[brnCollapsibleTrigger]',\n\thost: {\n\t\t'[attr.data-state]': '_collapsible?.expanded() ? \"open\" : \"closed\"',\n\t\t'[attr.disabled]': '_collapsible?.disabled() ? true : undefined',\n\t\t'[attr.aria-expanded]': '_collapsible?.expanded()',\n\t\t'[attr.aria-controls]': '_collapsible?.contentId()',\n\t\t'(click)': 'toggle()',\n\t},\n})\nexport class BrnCollapsibleTriggerDirective {\n\tprotected readonly _collapsible = inject(BrnCollapsibleComponent, { optional: true });\n\n\tconstructor() {\n\t\tif (!this._collapsible) {\n\t\t\tthrow Error('Collapsible trigger directive can only be used inside a brn-collapsible element.');\n\t\t}\n\t}\n\n\ttoggle(): void {\n\t\tthis._collapsible?.toggle();\n\t}\n}\n","import { NgModule } from '@angular/core';\n\nimport { BrnCollapsibleContentComponent } from './lib/brn-collapsible-content.component';\nimport { BrnCollapsibleTriggerDirective } from './lib/brn-collapsible-trigger.directive';\nimport { BrnCollapsibleComponent } from './lib/brn-collapsible.component';\n\nexport * from './lib/brn-collapsible-content.component';\nexport * from './lib/brn-collapsible-trigger.directive';\nexport * from './lib/brn-collapsible.component';\n\nexport const BrnCollapsibleImports = [\n\tBrnCollapsibleComponent,\n\tBrnCollapsibleTriggerDirective,\n\tBrnCollapsibleContentComponent,\n] as const;\n\n@NgModule({\n\timports: [...BrnCollapsibleImports],\n\texports: [...BrnCollapsibleImports],\n})\nexport class BrnCollapsibleModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAGA,IAAI,4BAA4B,GAAG,CAAC;MAevB,uBAAuB,CAAA;IACnB,SAAS,GAAG,MAAM,CAAC,CAAA,wBAAA,EAA2B,4BAA4B,EAAE,CAAA,CAAE,CAAC;AAE/F;;AAEG;AACa,IAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,CAAC;AAEhD;;AAEG;IACa,QAAQ,GAAG,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vB,8BAA8B;IAC9B,8BAA8B;;MAOlB,oBAAoB,CAAA;0HAApB,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;AAApB,uBAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,YAThC,uBAAuB;YACvB,8BAA8B;AAC9B,YAAA,8BAA8B,aAF9B,uBAAuB;YACvB,8BAA8B;YAC9B,8BAA8B,CAAA,EAAA,CAAA;2HAOlB,oBAAoB,EAAA,CAAA;;2FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAJhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,OAAO,EAAE,CAAC,GAAG,qBAAqB,CAAC;AACnC,oBAAA,OAAO,EAAE,CAAC,GAAG,qBAAqB,CAAC;AACnC,iBAAA;;;ACnBD;;AAEG;;;;"}
1
+ {"version":3,"file":"spartan-ng-brain-collapsible.mjs","sources":["../../../../libs/brain/collapsible/src/lib/brn-collapsible.ts","../../../../libs/brain/collapsible/src/lib/brn-collapsible-content.ts","../../../../libs/brain/collapsible/src/lib/brn-collapsible-trigger.ts","../../../../libs/brain/collapsible/src/index.ts","../../../../libs/brain/collapsible/src/spartan-ng-brain-collapsible.ts"],"sourcesContent":["import { BooleanInput } from '@angular/cdk/coercion';\nimport { ChangeDetectionStrategy, Component, booleanAttribute, input, model, signal } from '@angular/core';\n\nlet collapsibleContentIdSequence = 0;\n\nexport type BrnCollapsibleState = 'open' | 'closed';\n\n@Component({\n\tselector: 'brn-collapsible',\n\thost: {\n\t\t'[attr.data-state]': 'expanded() ? \"open\" : \"closed\"',\n\t\t'[attr.disabled]': 'disabled() ? true : undefined',\n\t},\n\ttemplate: `\n\t\t<ng-content />\n\t`,\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BrnCollapsible {\n\tpublic readonly contentId = signal(`brn-collapsible-content-${collapsibleContentIdSequence++}`);\n\n\t/**\n\t * The expanded or collapsed state of the collapsible component.\n\t */\n\tpublic readonly expanded = model<boolean>(false);\n\n\t/**\n\t * The disabled state of the collapsible component.\n\t */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\t/**\n\t * Toggles the expanded state of the collapsible component.\n\t */\n\tpublic toggle(): void {\n\t\tthis.expanded.update((expanded) => !expanded);\n\t}\n}\n","import { isPlatformServer } from '@angular/common';\nimport {\n\tChangeDetectionStrategy,\n\tComponent,\n\tElementRef,\n\tOnInit,\n\tPLATFORM_ID,\n\teffect,\n\tinject,\n\tinput,\n\tsignal,\n\tuntracked,\n} from '@angular/core';\nimport { BrnCollapsible } from './brn-collapsible';\n\n@Component({\n\tselector: 'brn-collapsible-content',\n\thost: {\n\t\t'[hidden]': '!_collapsible?.expanded()',\n\t\t'[attr.data-state]': '_collapsible?.expanded() ? \"open\" : \"closed\"',\n\t\t'[id]': '_collapsible?.contentId()',\n\t\t'[style.--brn-collapsible-content-width.px]': '_width()',\n\t\t'[style.--brn-collapsible-content-height.px]': '_height()',\n\t},\n\ttemplate: `\n\t\t<ng-content />\n\t`,\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BrnCollapsibleContent implements OnInit {\n\tprotected readonly _collapsible = inject(BrnCollapsible, { optional: true });\n\tprivate readonly _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\tprivate readonly _platformId = inject(PLATFORM_ID);\n\t/**\n\t * The id of the collapsible content element.\n\t */\n\tpublic readonly id = input<string | null | undefined>();\n\tprotected readonly _width = signal<number | null>(null);\n\tprotected readonly _height = signal<number | null>(null);\n\n\tconstructor() {\n\t\tif (!this._collapsible) {\n\t\t\tthrow Error('Collapsible trigger directive can only be used inside a brn-collapsible element.');\n\t\t}\n\n\t\teffect(() => {\n\t\t\tconst id = this.id();\n\t\t\tconst collapsible = this._collapsible;\n\t\t\tif (!id || !collapsible) return;\n\t\t\tuntracked(() => collapsible.contentId.set(id));\n\t\t});\n\t}\n\n\tngOnInit(): void {\n\t\tif (isPlatformServer(this._platformId)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// ensure the element is not hidden when measuring its size\n\t\tthis._elementRef.nativeElement.hidden = false;\n\n\t\tconst { width, height } = this._elementRef.nativeElement.getBoundingClientRect();\n\t\tthis._width.set(width);\n\t\tthis._height.set(height);\n\n\t\t// we force the element to be hidden again if collapsed after measuring its size\n\t\t// this is handled by the host binding, but it can cause a flicker if we don't do this here manually\n\t\tthis._elementRef.nativeElement.hidden = this._collapsible?.expanded() ?? false;\n\t}\n}\n","import { Directive, inject } from '@angular/core';\nimport { BrnCollapsible } from './brn-collapsible';\n\n@Directive({\n\tselector: 'button[brnCollapsibleTrigger]',\n\thost: {\n\t\t'[attr.data-state]': '_collapsible?.expanded() ? \"open\" : \"closed\"',\n\t\t'[attr.disabled]': '_collapsible?.disabled() ? true : undefined',\n\t\t'[attr.aria-expanded]': '_collapsible?.expanded()',\n\t\t'[attr.aria-controls]': '_collapsible?.contentId()',\n\t\t'(click)': 'toggle()',\n\t},\n})\nexport class BrnCollapsibleTrigger {\n\tprotected readonly _collapsible = inject(BrnCollapsible, { optional: true });\n\n\tconstructor() {\n\t\tif (!this._collapsible) {\n\t\t\tthrow Error('Collapsible trigger directive can only be used inside a brn-collapsible element.');\n\t\t}\n\t}\n\n\ttoggle(): void {\n\t\tthis._collapsible?.toggle();\n\t}\n}\n","import { NgModule } from '@angular/core';\n\nimport { BrnCollapsible } from './lib/brn-collapsible';\nimport { BrnCollapsibleContent } from './lib/brn-collapsible-content';\nimport { BrnCollapsibleTrigger } from './lib/brn-collapsible-trigger';\n\nexport * from './lib/brn-collapsible';\nexport * from './lib/brn-collapsible-content';\nexport * from './lib/brn-collapsible-trigger';\n\nexport const BrnCollapsibleImports = [BrnCollapsible, BrnCollapsibleTrigger, BrnCollapsibleContent] as const;\n\n@NgModule({\n\timports: [...BrnCollapsibleImports],\n\texports: [...BrnCollapsibleImports],\n})\nexport class BrnCollapsibleModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAGA,IAAI,4BAA4B,GAAG,CAAC;MAevB,cAAc,CAAA;IACV,SAAS,GAAG,MAAM,CAAC,CAAA,wBAAA,EAA2B,4BAA4B,EAAE,CAAA,CAAE,CAAC;AAE/F;;AAEG;AACa,IAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,CAAC;AAEhD;;AAEG;IACa,QAAQ,GAAG,KAAK,CAAwB,KAAK,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;AAE/F;;AAEG;IACI,MAAM,GAAA;AACZ,QAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,QAAQ,KAAK,CAAC,QAAQ,CAAC;;0HAjBlC,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAd,uBAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,cAAc,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,UAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,UAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,QAAA,EAAA,gBAAA,EAAA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FAArB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAVjC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,QAAQ,EAAE,+BAA+B;AACzC,oBAAA,IAAI,EAAE;AACL,wBAAA,mBAAmB,EAAE,8CAA8C;AACnE,wBAAA,iBAAiB,EAAE,6CAA6C;AAChE,wBAAA,sBAAsB,EAAE,0BAA0B;AAClD,wBAAA,sBAAsB,EAAE,2BAA2B;AACnD,wBAAA,SAAS,EAAE,UAAU;AACrB,qBAAA;AACD,iBAAA;;;ACFM,MAAM,qBAAqB,GAAG,CAAC,cAAc,EAAE,qBAAqB,EAAE,qBAAqB;MAMrF,oBAAoB,CAAA;0HAApB,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;2HAApB,oBAAoB,EAAA,OAAA,EAAA,CANK,cAAc,EAAE,qBAAqB,EAAE,qBAAqB,CAAA,EAAA,OAAA,EAAA,CAA5D,cAAc,EAAE,qBAAqB,EAAE,qBAAqB,CAAA,EAAA,CAAA;2HAMrF,oBAAoB,EAAA,CAAA;;2FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAJhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,OAAO,EAAE,CAAC,GAAG,qBAAqB,CAAC;AACnC,oBAAA,OAAO,EAAE,CAAC,GAAG,qBAAqB,CAAC;AACnC,iBAAA;;;ACfD;;AAEG;;;;"}
@@ -1,10 +1,20 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, TemplateRef, ViewContainerRef, computed, effect, Directive, input, contentChildren, PLATFORM_ID, ElementRef, booleanAttribute, signal, output, HostListener, forwardRef, Optional, Inject, Injector, contentChild, untracked, NgModule } from '@angular/core';
2
+ import { InjectionToken, inject, input, computed, signal, effect, forwardRef, Optional, Inject, Directive, PLATFORM_ID, Injector, output, contentChild, contentChildren, untracked, HostListener, TemplateRef, ViewContainerRef, ElementRef, booleanAttribute, NgModule } from '@angular/core';
3
+ import { ActiveDescendantKeyManager } from '@angular/cdk/a11y';
3
4
  import { isPlatformBrowser } from '@angular/common';
4
5
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
6
  import { DefaultValueAccessor, COMPOSITION_BUFFER_MODE, NG_VALUE_ACCESSOR } from '@angular/forms';
6
7
  import { startWith } from 'rxjs/operators';
7
- import { ActiveDescendantKeyManager } from '@angular/cdk/a11y';
8
+
9
+ const BrnCommandItemToken = new InjectionToken('BrnCommandItemToken');
10
+ function provideBrnCommandItem(command) {
11
+ return { provide: BrnCommandItemToken, useExisting: command };
12
+ }
13
+
14
+ const BrnCommandSearchInputToken = new InjectionToken('BrnCommandSearchInputToken');
15
+ function provideBrnCommandSearchInput(command) {
16
+ return { provide: BrnCommandSearchInputToken, useExisting: command };
17
+ }
8
18
 
9
19
  const BrnCommandToken = new InjectionToken('BrnCommandToken');
10
20
  function provideBrnCommand(command) {
@@ -14,7 +24,152 @@ function injectBrnCommand() {
14
24
  return inject(BrnCommandToken);
15
25
  }
16
26
 
17
- class BrnCommandEmptyDirective {
27
+ class BrnCommandSearchInput extends DefaultValueAccessor {
28
+ elementRef;
29
+ _command = injectBrnCommand();
30
+ /** The initial value of the search input */
31
+ value = input('');
32
+ /** @internal The mutable value of the search input */
33
+ mutableValue = computed(() => signal(this.value()));
34
+ /** @internal The "real" value of the search input */
35
+ valueState = computed(() => this.mutableValue()());
36
+ /** The id of the active option */
37
+ _activeDescendant = signal(undefined);
38
+ constructor(renderer, elementRef, compositionMode) {
39
+ super(renderer, elementRef, compositionMode);
40
+ this.elementRef = elementRef;
41
+ this._command.keyManager.change
42
+ .pipe(startWith(this._command.keyManager.activeItemIndex), takeUntilDestroyed())
43
+ .subscribe(() => this._activeDescendant.set(this._command.keyManager.activeItem?.id()));
44
+ effect(() => {
45
+ this.elementRef.nativeElement.value = this.valueState();
46
+ });
47
+ }
48
+ /** Listen for changes to the input value */
49
+ onInput() {
50
+ this.mutableValue().set(this.elementRef.nativeElement.value);
51
+ }
52
+ /** Listen for keydown events */
53
+ onKeyDown(event) {
54
+ this._command.keyManager.onKeydown(event);
55
+ }
56
+ /** CONROL VALUE ACCESSOR */
57
+ writeValue(value) {
58
+ super.writeValue(value);
59
+ if (value) {
60
+ this.mutableValue().set(value);
61
+ }
62
+ }
63
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandSearchInput, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: COMPOSITION_BUFFER_MODE, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
64
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnCommandSearchInput, isStandalone: true, selector: "input[brnCommandSearchInput]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "combobox", "aria-autocomplete": "list" }, listeners: { "keydown": "onKeyDown($event)", "input": "onInput()" }, properties: { "attr.aria-activedescendant": "_activeDescendant()" } }, providers: [
65
+ provideBrnCommandSearchInput(BrnCommandSearchInput),
66
+ {
67
+ provide: NG_VALUE_ACCESSOR,
68
+ useExisting: forwardRef((() => BrnCommandSearchInput)),
69
+ multi: true,
70
+ },
71
+ ], usesInheritance: true, ngImport: i0 });
72
+ }
73
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandSearchInput, decorators: [{
74
+ type: Directive,
75
+ args: [{
76
+ selector: 'input[brnCommandSearchInput]',
77
+ providers: [
78
+ provideBrnCommandSearchInput(BrnCommandSearchInput),
79
+ {
80
+ provide: NG_VALUE_ACCESSOR,
81
+ useExisting: forwardRef((() => BrnCommandSearchInput)),
82
+ multi: true,
83
+ },
84
+ ],
85
+ host: {
86
+ role: 'combobox',
87
+ 'aria-autocomplete': 'list',
88
+ '[attr.aria-activedescendant]': '_activeDescendant()',
89
+ '(keydown)': 'onKeyDown($event)',
90
+ '(input)': 'onInput()',
91
+ },
92
+ }]
93
+ }], ctorParameters: () => [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: undefined, decorators: [{
94
+ type: Optional
95
+ }, {
96
+ type: Inject,
97
+ args: [COMPOSITION_BUFFER_MODE]
98
+ }] }] });
99
+
100
+ class BrnCommand {
101
+ static _id = 0;
102
+ _platform = inject(PLATFORM_ID);
103
+ _injector = inject(Injector);
104
+ /** The id of the command */
105
+ id = input(`brn-command-${BrnCommand._id++}`);
106
+ /** The default filter function */
107
+ _defaultFilter = (value, search) => value.toLowerCase().includes(search.toLowerCase());
108
+ /** A custom filter function to use when searching. */
109
+ filter = input(this._defaultFilter);
110
+ /** when the selection has changed */
111
+ valueChange = output();
112
+ /** @internal The search query */
113
+ search = computed(() => this._searchInput()?.valueState() ?? '');
114
+ /** Access the search input if present */
115
+ _searchInput = contentChild(BrnCommandSearchInput, {
116
+ descendants: true,
117
+ });
118
+ /** @internal Access all the items within the commmand */
119
+ items = contentChildren(BrnCommandItemToken, {
120
+ descendants: true,
121
+ });
122
+ /** @internal The key manager for managing active descendant */
123
+ keyManager = new ActiveDescendantKeyManager(this.items, this._injector);
124
+ constructor() {
125
+ this.keyManager
126
+ .withVerticalOrientation()
127
+ .withHomeAndEnd()
128
+ .withWrap()
129
+ .skipPredicate((item) => item.disabled || !item.visible());
130
+ // When clearing the search input we also want to reset the active item to the first one
131
+ effect(() => {
132
+ const searchInput = this.search();
133
+ untracked(() => {
134
+ const activeItemIsVisible = this.keyManager.activeItem?.visible();
135
+ if ((searchInput !== undefined && searchInput.length === 0) || !activeItemIsVisible) {
136
+ this.keyManager.setFirstItemActive();
137
+ }
138
+ });
139
+ });
140
+ this.keyManager.change.pipe(takeUntilDestroyed()).subscribe(() => {
141
+ const value = this.keyManager.activeItem?.safeValue();
142
+ if (value) {
143
+ this.valueChange.emit(value);
144
+ }
145
+ });
146
+ }
147
+ ngAfterViewInit() {
148
+ if (isPlatformBrowser(this._platform) && this.items().length) {
149
+ this.keyManager.setActiveItem(0);
150
+ }
151
+ }
152
+ selectActiveItem() {
153
+ this.keyManager.activeItem?.selected.emit();
154
+ }
155
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommand, deps: [], target: i0.ɵɵFactoryTarget.Directive });
156
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.8", type: BrnCommand, isStandalone: true, selector: "[brnCommand]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, host: { listeners: { "keydown.enter": "selectActiveItem()" }, properties: { "id": "id()" } }, providers: [provideBrnCommand(BrnCommand)], queries: [{ propertyName: "_searchInput", first: true, predicate: BrnCommandSearchInput, descendants: true, isSignal: true }, { propertyName: "items", predicate: BrnCommandItemToken, descendants: true, isSignal: true }], ngImport: i0 });
157
+ }
158
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommand, decorators: [{
159
+ type: Directive,
160
+ args: [{
161
+ selector: '[brnCommand]',
162
+ providers: [provideBrnCommand(BrnCommand)],
163
+ host: {
164
+ '[id]': 'id()',
165
+ },
166
+ }]
167
+ }], ctorParameters: () => [], propDecorators: { selectActiveItem: [{
168
+ type: HostListener,
169
+ args: ['keydown.enter']
170
+ }] } });
171
+
172
+ class BrnCommandEmpty {
18
173
  _templateRef = inject(TemplateRef);
19
174
  _viewContainerRef = inject(ViewContainerRef);
20
175
  _command = injectBrnCommand();
@@ -30,35 +185,30 @@ class BrnCommandEmptyDirective {
30
185
  }
31
186
  });
32
187
  }
33
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandEmptyDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
34
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: BrnCommandEmptyDirective, isStandalone: true, selector: "[brnCommandEmpty]", ngImport: i0 });
188
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandEmpty, deps: [], target: i0.ɵɵFactoryTarget.Directive });
189
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: BrnCommandEmpty, isStandalone: true, selector: "[brnCommandEmpty]", ngImport: i0 });
35
190
  }
36
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandEmptyDirective, decorators: [{
191
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandEmpty, decorators: [{
37
192
  type: Directive,
38
193
  args: [{
39
194
  selector: '[brnCommandEmpty]',
40
195
  }]
41
196
  }], ctorParameters: () => [] });
42
197
 
43
- const BrnCommandItemToken = new InjectionToken('BrnCommandItemToken');
44
- function provideBrnCommandItem(command) {
45
- return { provide: BrnCommandItemToken, useExisting: command };
46
- }
47
-
48
- class BrnCommandGroupDirective {
198
+ class BrnCommandGroup {
49
199
  static _id = 0;
50
200
  /** The id of the command list */
51
- id = input(`brn-command-group-${BrnCommandGroupDirective._id++}`);
201
+ id = input(`brn-command-group-${BrnCommandGroup._id++}`);
52
202
  /** Get the items in the group */
53
203
  _items = contentChildren(BrnCommandItemToken, {
54
204
  descendants: true,
55
205
  });
56
206
  /** Determine if there are any visible items in the group */
57
207
  _visible = computed(() => this._items().some((item) => item.visible()));
58
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandGroupDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
59
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.8", type: BrnCommandGroupDirective, isStandalone: true, selector: "[brnCommandGroup]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "group" }, properties: { "attr.data-hidden": "!_visible() ? \"\" : null", "id": "id()" } }, queries: [{ propertyName: "_items", predicate: BrnCommandItemToken, descendants: true, isSignal: true }], ngImport: i0 });
208
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive });
209
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.8", type: BrnCommandGroup, isStandalone: true, selector: "[brnCommandGroup]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "group" }, properties: { "attr.data-hidden": "!_visible() ? \"\" : null", "id": "id()" } }, queries: [{ propertyName: "_items", predicate: BrnCommandItemToken, descendants: true, isSignal: true }], ngImport: i0 });
60
210
  }
61
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandGroupDirective, decorators: [{
211
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandGroup, decorators: [{
62
212
  type: Directive,
63
213
  args: [{
64
214
  selector: '[brnCommandGroup]',
@@ -70,14 +220,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
70
220
  }]
71
221
  }] });
72
222
 
73
- class BrnCommandItemDirective {
223
+ class BrnCommandItem {
74
224
  static _id = 0;
75
225
  _platform = inject(PLATFORM_ID);
76
226
  _elementRef = inject(ElementRef);
77
227
  /** Access the command component */
78
228
  _command = injectBrnCommand();
79
229
  /** A unique id for the item */
80
- id = input(`brn-command-item-${BrnCommandItemDirective._id++}`);
230
+ id = input(`brn-command-item-${BrnCommandItem._id++}`);
81
231
  /** The value this item represents. */
82
232
  value = input.required();
83
233
  /** Whether the item is disabled. */
@@ -132,14 +282,14 @@ class BrnCommandItemDirective {
132
282
  ngOnInit() {
133
283
  this._initialized.set(true);
134
284
  }
135
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
136
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnCommandItemDirective, isStandalone: true, selector: "button[brnCommandItem]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, _disabled: { classPropertyName: "_disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selected" }, host: { attributes: { "type": "button", "role": "option", "tabIndex": "-1" }, listeners: { "click": "onClick()" }, properties: { "id": "id()", "attr.disabled": "_disabled() ? true : null", "attr.data-disabled": "_disabled() ? \"\" : null", "attr.data-value": "value()", "attr.data-hidden": "!visible() ? '' : null", "attr.aria-selected": "_active()", "attr.data-selected": "_active() ? '' : null" } }, providers: [provideBrnCommandItem(BrnCommandItemDirective)], ngImport: i0 });
285
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandItem, deps: [], target: i0.ɵɵFactoryTarget.Directive });
286
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnCommandItem, isStandalone: true, selector: "button[brnCommandItem]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, _disabled: { classPropertyName: "_disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selected" }, host: { attributes: { "type": "button", "role": "option", "tabIndex": "-1" }, listeners: { "click": "onClick()" }, properties: { "id": "id()", "attr.disabled": "_disabled() ? true : null", "attr.data-disabled": "_disabled() ? \"\" : null", "attr.data-value": "value()", "attr.data-hidden": "!visible() ? '' : null", "attr.aria-selected": "_active()", "attr.data-selected": "_active() ? '' : null" } }, providers: [provideBrnCommandItem(BrnCommandItem)], ngImport: i0 });
137
287
  }
138
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandItemDirective, decorators: [{
288
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandItem, decorators: [{
139
289
  type: Directive,
140
290
  args: [{
141
291
  selector: 'button[brnCommandItem]',
142
- providers: [provideBrnCommandItem(BrnCommandItemDirective)],
292
+ providers: [provideBrnCommandItem(BrnCommandItem)],
143
293
  host: {
144
294
  type: 'button',
145
295
  role: 'option',
@@ -158,14 +308,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
158
308
  args: ['click']
159
309
  }] } });
160
310
 
161
- class BrnCommandListDirective {
311
+ class BrnCommandList {
162
312
  static _id = 0;
163
313
  /** The id of the command list */
164
- id = input(`brn-command-list-${BrnCommandListDirective._id++}`);
165
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandListDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
166
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnCommandListDirective, isStandalone: true, selector: "[brnCommandList]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "listbox" }, properties: { "id": "id()" } }, ngImport: i0 });
314
+ id = input(`brn-command-list-${BrnCommandList._id++}`);
315
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandList, deps: [], target: i0.ɵɵFactoryTarget.Directive });
316
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnCommandList, isStandalone: true, selector: "[brnCommandList]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "listbox" }, properties: { "id": "id()" } }, ngImport: i0 });
167
317
  }
168
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandListDirective, decorators: [{
318
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandList, decorators: [{
169
319
  type: Directive,
170
320
  args: [{
171
321
  selector: '[brnCommandList]',
@@ -176,177 +326,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
176
326
  }]
177
327
  }] });
178
328
 
179
- const BrnCommandSearchInputToken = new InjectionToken('BrnCommandSearchInputToken');
180
- function provideBrnCommandSearchInput(command) {
181
- return { provide: BrnCommandSearchInputToken, useExisting: command };
182
- }
183
-
184
- class BrnCommandSearchInputDirective extends DefaultValueAccessor {
185
- elementRef;
186
- _command = injectBrnCommand();
187
- /** The initial value of the search input */
188
- value = input('');
189
- /** @internal The mutable value of the search input */
190
- mutableValue = computed(() => signal(this.value()));
191
- /** @internal The "real" value of the search input */
192
- valueState = computed(() => this.mutableValue()());
193
- /** The id of the active option */
194
- _activeDescendant = signal(undefined);
195
- constructor(renderer, elementRef, compositionMode) {
196
- super(renderer, elementRef, compositionMode);
197
- this.elementRef = elementRef;
198
- this._command.keyManager.change
199
- .pipe(startWith(this._command.keyManager.activeItemIndex), takeUntilDestroyed())
200
- .subscribe(() => this._activeDescendant.set(this._command.keyManager.activeItem?.id()));
201
- effect(() => {
202
- this.elementRef.nativeElement.value = this.valueState();
203
- });
204
- }
205
- /** Listen for changes to the input value */
206
- onInput() {
207
- this.mutableValue().set(this.elementRef.nativeElement.value);
208
- }
209
- /** Listen for keydown events */
210
- onKeyDown(event) {
211
- this._command.keyManager.onKeydown(event);
212
- }
213
- /** CONROL VALUE ACCESSOR */
214
- writeValue(value) {
215
- super.writeValue(value);
216
- if (value) {
217
- this.mutableValue().set(value);
218
- }
219
- }
220
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandSearchInputDirective, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: COMPOSITION_BUFFER_MODE, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
221
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnCommandSearchInputDirective, isStandalone: true, selector: "input[brnCommandSearchInput]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "combobox", "aria-autocomplete": "list" }, listeners: { "keydown": "onKeyDown($event)", "input": "onInput()" }, properties: { "attr.aria-activedescendant": "_activeDescendant()" } }, providers: [
222
- provideBrnCommandSearchInput(BrnCommandSearchInputDirective),
223
- {
224
- provide: NG_VALUE_ACCESSOR,
225
- useExisting: forwardRef((() => BrnCommandSearchInputDirective)),
226
- multi: true,
227
- },
228
- ], usesInheritance: true, ngImport: i0 });
229
- }
230
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandSearchInputDirective, decorators: [{
231
- type: Directive,
232
- args: [{
233
- selector: 'input[brnCommandSearchInput]',
234
- providers: [
235
- provideBrnCommandSearchInput(BrnCommandSearchInputDirective),
236
- {
237
- provide: NG_VALUE_ACCESSOR,
238
- useExisting: forwardRef((() => BrnCommandSearchInputDirective)),
239
- multi: true,
240
- },
241
- ],
242
- host: {
243
- role: 'combobox',
244
- 'aria-autocomplete': 'list',
245
- '[attr.aria-activedescendant]': '_activeDescendant()',
246
- '(keydown)': 'onKeyDown($event)',
247
- '(input)': 'onInput()',
248
- },
249
- }]
250
- }], ctorParameters: () => [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: undefined, decorators: [{
251
- type: Optional
252
- }, {
253
- type: Inject,
254
- args: [COMPOSITION_BUFFER_MODE]
255
- }] }] });
256
-
257
- class BrnCommandDirective {
258
- static _id = 0;
259
- _platform = inject(PLATFORM_ID);
260
- _injector = inject(Injector);
261
- /** The id of the command */
262
- id = input(`brn-command-${BrnCommandDirective._id++}`);
263
- /** The default filter function */
264
- _defaultFilter = (value, search) => value.toLowerCase().includes(search.toLowerCase());
265
- /** A custom filter function to use when searching. */
266
- filter = input(this._defaultFilter);
267
- /** when the selection has changed */
268
- valueChange = output();
269
- /** @internal The search query */
270
- search = computed(() => this._searchInput()?.valueState() ?? '');
271
- /** Access the search input if present */
272
- _searchInput = contentChild(BrnCommandSearchInputDirective, {
273
- descendants: true,
274
- });
275
- /** @internal Access all the items within the commmand */
276
- items = contentChildren(BrnCommandItemToken, {
277
- descendants: true,
278
- });
279
- /** @internal The key manager for managing active descendant */
280
- keyManager = new ActiveDescendantKeyManager(this.items, this._injector);
281
- constructor() {
282
- this.keyManager
283
- .withVerticalOrientation()
284
- .withHomeAndEnd()
285
- .withWrap()
286
- .skipPredicate((item) => item.disabled || !item.visible());
287
- // When clearing the search input we also want to reset the active item to the first one
288
- effect(() => {
289
- const searchInput = this.search();
290
- untracked(() => {
291
- const activeItemIsVisible = this.keyManager.activeItem?.visible();
292
- if ((searchInput !== undefined && searchInput.length === 0) || !activeItemIsVisible) {
293
- this.keyManager.setFirstItemActive();
294
- }
295
- });
296
- });
297
- this.keyManager.change.pipe(takeUntilDestroyed()).subscribe(() => {
298
- const value = this.keyManager.activeItem?.safeValue();
299
- if (value) {
300
- this.valueChange.emit(value);
301
- }
302
- });
303
- }
304
- ngAfterViewInit() {
305
- if (isPlatformBrowser(this._platform) && this.items().length) {
306
- this.keyManager.setActiveItem(0);
307
- }
308
- }
309
- selectActiveItem() {
310
- this.keyManager.activeItem?.selected.emit();
311
- }
312
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
313
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.8", type: BrnCommandDirective, isStandalone: true, selector: "[brnCommand]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, host: { listeners: { "keydown.enter": "selectActiveItem()" }, properties: { "id": "id()" } }, providers: [provideBrnCommand(BrnCommandDirective)], queries: [{ propertyName: "_searchInput", first: true, predicate: BrnCommandSearchInputDirective, descendants: true, isSignal: true }, { propertyName: "items", predicate: BrnCommandItemToken, descendants: true, isSignal: true }], ngImport: i0 });
314
- }
315
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandDirective, decorators: [{
316
- type: Directive,
317
- args: [{
318
- selector: '[brnCommand]',
319
- providers: [provideBrnCommand(BrnCommandDirective)],
320
- host: {
321
- '[id]': 'id()',
322
- },
323
- }]
324
- }], ctorParameters: () => [], propDecorators: { selectActiveItem: [{
325
- type: HostListener,
326
- args: ['keydown.enter']
327
- }] } });
328
-
329
329
  const BrnCommandImports = [
330
- BrnCommandEmptyDirective,
331
- BrnCommandGroupDirective,
332
- BrnCommandItemDirective,
333
- BrnCommandListDirective,
334
- BrnCommandSearchInputDirective,
335
- BrnCommandDirective,
330
+ BrnCommandEmpty,
331
+ BrnCommandGroup,
332
+ BrnCommandItem,
333
+ BrnCommandList,
334
+ BrnCommandSearchInput,
335
+ BrnCommand,
336
336
  ];
337
337
  class BrnCommandModule {
338
338
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
339
- /** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandModule, imports: [BrnCommandEmptyDirective,
340
- BrnCommandGroupDirective,
341
- BrnCommandItemDirective,
342
- BrnCommandListDirective,
343
- BrnCommandSearchInputDirective,
344
- BrnCommandDirective], exports: [BrnCommandEmptyDirective,
345
- BrnCommandGroupDirective,
346
- BrnCommandItemDirective,
347
- BrnCommandListDirective,
348
- BrnCommandSearchInputDirective,
349
- BrnCommandDirective] });
339
+ /** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandModule, imports: [BrnCommandEmpty,
340
+ BrnCommandGroup,
341
+ BrnCommandItem,
342
+ BrnCommandList,
343
+ BrnCommandSearchInput,
344
+ BrnCommand], exports: [BrnCommandEmpty,
345
+ BrnCommandGroup,
346
+ BrnCommandItem,
347
+ BrnCommandList,
348
+ BrnCommandSearchInput,
349
+ BrnCommand] });
350
350
  /** @nocollapse */ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandModule });
351
351
  }
352
352
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCommandModule, decorators: [{
@@ -361,5 +361,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
361
361
  * Generated bundle index. Do not edit.
362
362
  */
363
363
 
364
- export { BrnCommandDirective, BrnCommandEmptyDirective, BrnCommandGroupDirective, BrnCommandImports, BrnCommandItemDirective, BrnCommandItemToken, BrnCommandListDirective, BrnCommandModule, BrnCommandSearchInputDirective, BrnCommandSearchInputToken, BrnCommandToken, injectBrnCommand, provideBrnCommand, provideBrnCommandItem, provideBrnCommandSearchInput };
364
+ export { BrnCommand, BrnCommandEmpty, BrnCommandGroup, BrnCommandImports, BrnCommandItem, BrnCommandItemToken, BrnCommandList, BrnCommandModule, BrnCommandSearchInput, BrnCommandSearchInputToken, BrnCommandToken, injectBrnCommand, provideBrnCommand, provideBrnCommandItem, provideBrnCommandSearchInput };
365
365
  //# sourceMappingURL=spartan-ng-brain-command.mjs.map