@spartan-ng/brain 0.0.1-alpha.492 → 0.0.1-alpha.494
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.
- package/accordion/index.d.ts +8 -8
- package/accordion/lib/{brn-accordion-content.component.d.ts → brn-accordion-content.d.ts} +3 -3
- package/accordion/lib/{brn-accordion.directive.d.ts → brn-accordion.d.ts} +11 -11
- package/alert-dialog/index.d.ts +20 -20
- package/alert-dialog/lib/brn-alert-dialog-content.d.ts +6 -0
- package/alert-dialog/lib/brn-alert-dialog-description.d.ts +6 -0
- package/alert-dialog/lib/brn-alert-dialog-overlay.d.ts +6 -0
- package/alert-dialog/lib/brn-alert-dialog-title.d.ts +6 -0
- package/alert-dialog/lib/brn-alert-dialog-trigger.d.ts +9 -0
- package/alert-dialog/lib/brn-alert-dialog.d.ts +7 -0
- package/avatar/index.d.ts +9 -9
- package/avatar/lib/brn-avatar.d.ts +7 -0
- package/avatar/lib/fallback/brn-avatar-fallback.d.ts +9 -0
- package/avatar/lib/fallback/index.d.ts +1 -1
- package/avatar/lib/image/brn-avatar-image.d.ts +9 -0
- package/avatar/lib/image/index.d.ts +1 -1
- package/calendar/index.d.ts +32 -32
- package/calendar/lib/{brn-calendar-cell-button.directive.d.ts → brn-calendar-cell-button.d.ts} +4 -4
- package/calendar/lib/brn-calendar-cell.d.ts +5 -0
- package/calendar/lib/brn-calendar-grid.d.ts +7 -0
- package/calendar/lib/brn-calendar-header.d.ts +7 -0
- package/calendar/lib/{brn-calendar-next-button.directive.d.ts → brn-calendar-next-button.d.ts} +3 -3
- package/calendar/lib/{brn-calendar-previous-button.directive.d.ts → brn-calendar-previous-button.d.ts} +3 -3
- package/calendar/lib/{brn-calendar-week.directive.d.ts → brn-calendar-week.d.ts} +4 -4
- package/calendar/lib/{brn-calendar-weekday.directive.d.ts → brn-calendar-weekday.d.ts} +4 -4
- package/calendar/lib/{brn-calendar.directive.d.ts → brn-calendar.d.ts} +8 -8
- package/calendar/lib/brn-calendar.token.d.ts +6 -6
- package/calendar/lib/mode/{brn-calendar-multiple.directive.d.ts → brn-calendar-multiple.d.ts} +9 -9
- package/checkbox/index.d.ts +5 -5
- package/checkbox/lib/{brn-checkbox.component.d.ts → brn-checkbox.d.ts} +3 -3
- package/collapsible/index.d.ts +11 -11
- package/collapsible/lib/{brn-collapsible-content.component.d.ts → brn-collapsible-content.d.ts} +5 -5
- package/collapsible/lib/brn-collapsible-trigger.d.ts +9 -0
- package/collapsible/lib/{brn-collapsible.component.d.ts → brn-collapsible.d.ts} +3 -3
- package/command/index.d.ts +20 -20
- package/command/lib/brn-command-empty.d.ts +11 -0
- package/command/lib/{brn-command-group.directive.d.ts → brn-command-group.d.ts} +3 -3
- package/command/lib/{brn-command-item.directive.d.ts → brn-command-item.d.ts} +3 -3
- package/command/lib/brn-command-item.token.d.ts +3 -3
- package/command/lib/brn-command-list.d.ts +8 -0
- package/command/lib/{brn-command-search-input.directive.d.ts → brn-command-search-input.d.ts} +3 -3
- package/command/lib/brn-command-search-input.token.d.ts +3 -3
- package/command/lib/{brn-command.directive.d.ts → brn-command.d.ts} +5 -5
- package/command/lib/brn-command.token.d.ts +4 -4
- package/dialog/index.d.ts +23 -23
- package/dialog/lib/brn-dialog-close.d.ts +8 -0
- package/dialog/lib/brn-dialog-content.d.ts +12 -0
- package/dialog/lib/{brn-dialog-description.directive.d.ts → brn-dialog-description.d.ts} +3 -3
- package/dialog/lib/brn-dialog-overlay.d.ts +9 -0
- package/dialog/lib/brn-dialog-title.d.ts +8 -0
- package/dialog/lib/brn-dialog-trigger.d.ts +18 -0
- package/dialog/lib/{brn-dialog.component.d.ts → brn-dialog.d.ts} +3 -3
- package/fesm2022/spartan-ng-brain-accordion.mjs +25 -36
- package/fesm2022/spartan-ng-brain-accordion.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-alert-dialog.mjs +79 -79
- package/fesm2022/spartan-ng-brain-alert-dialog.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-avatar.mjs +16 -16
- package/fesm2022/spartan-ng-brain-avatar.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-calendar.mjs +239 -239
- package/fesm2022/spartan-ng-brain-calendar.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-checkbox.mjs +8 -8
- package/fesm2022/spartan-ng-brain-checkbox.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-collapsible.mjs +17 -25
- package/fesm2022/spartan-ng-brain-collapsible.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-command.mjs +195 -195
- package/fesm2022/spartan-ng-brain-command.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-dialog.mjs +98 -98
- package/fesm2022/spartan-ng-brain-dialog.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-form-field.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-forms.mjs +3 -2
- package/fesm2022/spartan-ng-brain-forms.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-hover-card.mjs +21 -29
- package/fesm2022/spartan-ng-brain-hover-card.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-input-otp.mjs +44 -44
- package/fesm2022/spartan-ng-brain-input-otp.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-label.mjs +8 -8
- package/fesm2022/spartan-ng-brain-label.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-menu.mjs +102 -131
- package/fesm2022/spartan-ng-brain-menu.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-popover.mjs +75 -86
- package/fesm2022/spartan-ng-brain-popover.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-progress.mjs +28 -28
- package/fesm2022/spartan-ng-brain-progress.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-radio-group.mjs +17 -17
- package/fesm2022/spartan-ng-brain-radio-group.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-select.mjs +277 -277
- package/fesm2022/spartan-ng-brain-select.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-separator.mjs +8 -8
- package/fesm2022/spartan-ng-brain-separator.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-sheet.mjs +69 -69
- package/fesm2022/spartan-ng-brain-sheet.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-slider.mjs +136 -142
- package/fesm2022/spartan-ng-brain-slider.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-switch.mjs +26 -26
- package/fesm2022/spartan-ng-brain-switch.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-tabs.mjs +28 -39
- package/fesm2022/spartan-ng-brain-tabs.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-toggle-group.mjs +18 -18
- package/fesm2022/spartan-ng-brain-toggle-group.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-toggle.mjs +9 -9
- package/fesm2022/spartan-ng-brain-toggle.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-tooltip.mjs +31 -42
- package/fesm2022/spartan-ng-brain-tooltip.mjs.map +1 -1
- package/form-field/lib/brn-form-field-control.d.ts +2 -2
- package/forms/lib/error-options.d.ts +1 -1
- package/hover-card/index.d.ts +6 -6
- package/hover-card/lib/brn-hover-card-content.service.d.ts +9 -9
- package/hover-card/lib/brn-hover-card.d.ts +9 -0
- package/input-otp/index.d.ts +8 -8
- package/input-otp/lib/{brn-input-otp-slot.component.d.ts → brn-input-otp-slot.d.ts} +4 -4
- package/input-otp/lib/{brn-input-otp.component.d.ts → brn-input-otp.d.ts} +3 -3
- package/input-otp/lib/brn-input-otp.token.d.ts +4 -4
- package/label/index.d.ts +3 -3
- package/label/lib/{brn-label.directive.d.ts → brn-label.d.ts} +3 -3
- package/menu/index.d.ts +32 -32
- package/menu/lib/{brn-context-menu-trigger.directive.d.ts → brn-context-menu-trigger.d.ts} +3 -3
- package/menu/lib/brn-menu-bar.d.ts +6 -0
- package/menu/lib/brn-menu-group.d.ts +6 -0
- package/menu/lib/brn-menu-item-checkbox.d.ts +11 -0
- package/menu/lib/brn-menu-item-radio.d.ts +11 -0
- package/menu/lib/brn-menu-item.d.ts +10 -0
- package/menu/lib/brn-menu-trigger.d.ts +10 -0
- package/menu/lib/{brn-menu.directive.d.ts → brn-menu.d.ts} +3 -3
- package/package.json +1 -1
- package/popover/index.d.ts +14 -14
- package/popover/lib/brn-popover-close.d.ts +6 -0
- package/popover/lib/brn-popover-content.d.ts +6 -0
- package/popover/lib/brn-popover-trigger.d.ts +10 -0
- package/popover/lib/brn-popover.d.ts +12 -0
- package/progress/index.d.ts +8 -8
- package/progress/lib/{brn-progress-indicator.component.d.ts → brn-progress-indicator.d.ts} +4 -4
- package/progress/lib/{brn-progress.component.d.ts → brn-progress.d.ts} +3 -3
- package/progress/lib/brn-progress.token.d.ts +3 -3
- package/radio-group/index.d.ts +8 -8
- package/radio-group/lib/{brn-radio-group.directive.d.ts → brn-radio-group.d.ts} +6 -6
- package/radio-group/lib/brn-radio-group.token.d.ts +3 -3
- package/radio-group/lib/{brn-radio.component.d.ts → brn-radio.d.ts} +6 -6
- package/select/index.d.ts +29 -29
- package/select/lib/{brn-select-content.component.d.ts → brn-select-content.d.ts} +15 -15
- package/select/lib/brn-select-content.token.d.ts +3 -3
- package/select/lib/brn-select-group.d.ts +6 -0
- package/select/lib/brn-select-label.d.ts +9 -0
- package/select/lib/{brn-select-option.directive.d.ts → brn-select-option.d.ts} +5 -5
- package/select/lib/{brn-select-placeholder.directive.d.ts → brn-select-placeholder.d.ts} +3 -3
- package/select/lib/{brn-select-trigger.directive.d.ts → brn-select-trigger.d.ts} +4 -4
- package/select/lib/brn-select-value-template.d.ts +11 -0
- package/select/lib/{brn-select-value.component.d.ts → brn-select-value.d.ts} +8 -8
- package/select/lib/{brn-select.component.d.ts → brn-select.d.ts} +12 -12
- package/select/lib/brn-select.token.d.ts +3 -3
- package/separator/index.d.ts +3 -3
- package/separator/lib/{brn-separator.component.d.ts → brn-separator.d.ts} +3 -3
- package/sheet/index.d.ts +23 -23
- package/sheet/lib/brn-sheet-close.d.ts +6 -0
- package/sheet/lib/brn-sheet-content.d.ts +8 -0
- package/sheet/lib/brn-sheet-description.d.ts +6 -0
- package/sheet/lib/brn-sheet-overlay.d.ts +6 -0
- package/sheet/lib/brn-sheet-title.d.ts +6 -0
- package/sheet/lib/brn-sheet-trigger.d.ts +9 -0
- package/sheet/lib/brn-sheet.d.ts +10 -0
- package/slider/index.d.ts +11 -11
- package/slider/lib/brn-slider-range.d.ts +7 -0
- package/slider/lib/{brn-slider-thumb.directive.d.ts → brn-slider-thumb.d.ts} +4 -4
- package/slider/lib/brn-slider-tick.d.ts +12 -0
- package/slider/lib/{brn-slider-track.directive.d.ts → brn-slider-track.d.ts} +4 -4
- package/slider/lib/brn-slider-track.token.d.ts +4 -4
- package/slider/lib/{brn-slider.directive.d.ts → brn-slider.d.ts} +5 -5
- package/slider/lib/brn-slider.token.d.ts +3 -3
- package/switch/index.d.ts +8 -8
- package/switch/lib/brn-switch-thumb.d.ts +5 -0
- package/switch/lib/{brn-switch.component.d.ts → brn-switch.d.ts} +3 -3
- package/tabs/index.d.ts +15 -15
- package/tabs/lib/{brn-tabs-content.directive.d.ts → brn-tabs-content.d.ts} +3 -3
- package/tabs/lib/{brn-tabs-list.directive.d.ts → brn-tabs-list.d.ts} +6 -6
- package/tabs/lib/{brn-tabs-paginated-list.directive.d.ts → brn-tabs-paginated-list.d.ts} +3 -3
- package/tabs/lib/{brn-tabs-trigger.directive.d.ts → brn-tabs-trigger.d.ts} +4 -4
- package/tabs/lib/{brn-tabs.directive.d.ts → brn-tabs.d.ts} +9 -9
- package/toggle/index.d.ts +3 -3
- package/toggle/lib/{brn-toggle.directive.d.ts → brn-toggle.d.ts} +3 -3
- package/toggle-group/index.d.ts +6 -6
- package/toggle-group/lib/{brn-toggle-group.component.d.ts → brn-toggle-group.d.ts} +8 -8
- package/toggle-group/lib/brn-toggle-group.token.d.ts +3 -3
- package/toggle-group/lib/{brn-toggle-item.directive.d.ts → brn-toggle-item.d.ts} +4 -4
- package/tooltip/index.d.ts +14 -14
- package/tooltip/lib/brn-tooltip-content-template.d.ts +8 -0
- package/tooltip/lib/{brn-tooltip-content.component.d.ts → brn-tooltip-content.d.ts} +3 -3
- package/tooltip/lib/{brn-tooltip-trigger.directive.d.ts → brn-tooltip-trigger.d.ts} +3 -3
- package/tooltip/lib/brn-tooltip.d.ts +7 -0
- package/tooltip/lib/brn-tooltip.token.d.ts +1 -1
- package/alert-dialog/lib/brn-alert-dialog-content.directive.d.ts +0 -6
- package/alert-dialog/lib/brn-alert-dialog-description.directive.d.ts +0 -6
- package/alert-dialog/lib/brn-alert-dialog-overlay.component.d.ts +0 -6
- package/alert-dialog/lib/brn-alert-dialog-title.directive.d.ts +0 -6
- package/alert-dialog/lib/brn-alert-dialog-trigger.directive.d.ts +0 -9
- package/alert-dialog/lib/brn-alert-dialog.component.d.ts +0 -7
- package/avatar/lib/brn-avatar.component.d.ts +0 -7
- package/avatar/lib/fallback/brn-avatar-fallback.directive.d.ts +0 -9
- package/avatar/lib/image/brn-avatar-image.directive.d.ts +0 -9
- package/calendar/lib/brn-calendar-cell.directive.d.ts +0 -5
- package/calendar/lib/brn-calendar-grid.directive.d.ts +0 -7
- package/calendar/lib/brn-calendar-header.directive.d.ts +0 -7
- package/collapsible/lib/brn-collapsible-trigger.directive.d.ts +0 -9
- package/command/lib/brn-command-empty.directive.d.ts +0 -11
- package/command/lib/brn-command-list.directive.d.ts +0 -8
- package/dialog/lib/brn-dialog-close.directive.d.ts +0 -8
- package/dialog/lib/brn-dialog-content.directive.d.ts +0 -12
- package/dialog/lib/brn-dialog-overlay.component.d.ts +0 -9
- package/dialog/lib/brn-dialog-title.directive.d.ts +0 -8
- package/dialog/lib/brn-dialog-trigger.directive.d.ts +0 -18
- package/hover-card/lib/brn-hover-card.component.d.ts +0 -9
- package/menu/lib/brn-menu-bar.directive.d.ts +0 -6
- package/menu/lib/brn-menu-group.directive.d.ts +0 -6
- package/menu/lib/brn-menu-item-checkbox.directive.d.ts +0 -11
- package/menu/lib/brn-menu-item-radio.directive.d.ts +0 -11
- package/menu/lib/brn-menu-item.directive.d.ts +0 -10
- package/menu/lib/brn-menu-trigger.directive.d.ts +0 -10
- package/popover/lib/brn-popover-close.directive.d.ts +0 -6
- package/popover/lib/brn-popover-content.directive.d.ts +0 -6
- package/popover/lib/brn-popover-trigger.directive.d.ts +0 -10
- package/popover/lib/brn-popover.component.d.ts +0 -12
- package/select/lib/brn-select-group.directive.d.ts +0 -6
- package/select/lib/brn-select-label.directive.d.ts +0 -9
- package/select/lib/brn-select-value.directive.d.ts +0 -11
- package/sheet/lib/brn-sheet-close.directive.d.ts +0 -6
- package/sheet/lib/brn-sheet-content.directive.d.ts +0 -8
- package/sheet/lib/brn-sheet-description.directive.d.ts +0 -6
- package/sheet/lib/brn-sheet-overlay.component.d.ts +0 -6
- package/sheet/lib/brn-sheet-title.directive.d.ts +0 -6
- package/sheet/lib/brn-sheet-trigger.directive.d.ts +0 -9
- package/sheet/lib/brn-sheet.component.d.ts +0 -10
- package/slider/lib/brn-slider-range.directive.d.ts +0 -7
- package/slider/lib/brn-slider-tick.directive.d.ts +0 -12
- package/switch/lib/brn-switch-thumb.component.d.ts +0 -5
- package/tooltip/lib/brn-tooltip-content.directive.d.ts +0 -8
- 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,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,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAvB,uBAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,uBAAuB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,UAAA,EAAA,QAA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C,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,Q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AAA,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,
|
|
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
|
-
|
|
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
|
|
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:
|
|
34
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type:
|
|
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:
|
|
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
|
-
|
|
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-${
|
|
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:
|
|
59
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.8", type:
|
|
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:
|
|
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
|
|
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-${
|
|
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:
|
|
136
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type:
|
|
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:
|
|
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(
|
|
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
|
|
311
|
+
class BrnCommandList {
|
|
162
312
|
static _id = 0;
|
|
163
313
|
/** The id of the command list */
|
|
164
|
-
id = input(`brn-command-list-${
|
|
165
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
166
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type:
|
|
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:
|
|
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
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
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: [
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
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 {
|
|
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
|