@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.
- 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,35 +1,18 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { forwardRef, inject, DestroyRef, Renderer2, PLATFORM_ID, ElementRef, ChangeDetectorRef, signal, model, input, linkedSignal, booleanAttribute, output, viewChild, computed, effect, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
|
|
3
3
|
import { FocusMonitor } from '@angular/cdk/a11y';
|
|
4
4
|
import { isPlatformBrowser, DOCUMENT } from '@angular/common';
|
|
5
5
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
6
6
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
7
7
|
|
|
8
|
-
class BrnSwitchThumbComponent {
|
|
9
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnSwitchThumbComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
10
|
-
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.8", type: BrnSwitchThumbComponent, isStandalone: true, selector: "brn-switch-thumb", host: { attributes: { "role": "presentation" }, listeners: { "click": "$event.preventDefault()" } }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
11
|
-
}
|
|
12
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnSwitchThumbComponent, decorators: [{
|
|
13
|
-
type: Component,
|
|
14
|
-
args: [{
|
|
15
|
-
selector: 'brn-switch-thumb',
|
|
16
|
-
template: '',
|
|
17
|
-
host: {
|
|
18
|
-
role: 'presentation',
|
|
19
|
-
'(click)': '$event.preventDefault()',
|
|
20
|
-
},
|
|
21
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
22
|
-
}]
|
|
23
|
-
}] });
|
|
24
|
-
|
|
25
8
|
const BRN_SWITCH_VALUE_ACCESSOR = {
|
|
26
9
|
provide: NG_VALUE_ACCESSOR,
|
|
27
|
-
useExisting: forwardRef(() =>
|
|
10
|
+
useExisting: forwardRef(() => BrnSwitch),
|
|
28
11
|
multi: true,
|
|
29
12
|
};
|
|
30
13
|
const CONTAINER_POST_FIX = '-switch';
|
|
31
14
|
let uniqueIdCounter = 0;
|
|
32
|
-
class
|
|
15
|
+
class BrnSwitch {
|
|
33
16
|
_destroyRef = inject(DestroyRef);
|
|
34
17
|
_renderer = inject(Renderer2);
|
|
35
18
|
_isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
@@ -228,8 +211,8 @@ class BrnSwitchComponent {
|
|
|
228
211
|
this._state().disabled.set(isDisabled);
|
|
229
212
|
this._cdr.markForCheck();
|
|
230
213
|
};
|
|
231
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
232
|
-
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.8", type:
|
|
214
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnSwitch, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
215
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.8", type: BrnSwitch, isStandalone: true, selector: "brn-switch", inputs: { checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange", changed: "changed", touched: "touched" }, host: { properties: { "style": "{display: \"contents\"}", "attr.id": "_state().id", "attr.name": "_state().name", "attr.aria-labelledby": "null", "attr.aria-label": "null", "attr.aria-describedby": "null", "attr.data-state": "checked() ? \"checked\" : \"unchecked\"", "attr.data-focus-visible": "_focusVisible()", "attr.data-focus": "_focused()", "attr.data-disabled": "_state().disabled()" } }, providers: [BRN_SWITCH_VALUE_ACCESSOR], viewQueries: [{ propertyName: "switch", first: true, predicate: ["switch"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
233
216
|
<button
|
|
234
217
|
#switch
|
|
235
218
|
role="switch"
|
|
@@ -254,7 +237,7 @@ class BrnSwitchComponent {
|
|
|
254
237
|
</button>
|
|
255
238
|
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
256
239
|
}
|
|
257
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
240
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnSwitch, decorators: [{
|
|
258
241
|
type: Component,
|
|
259
242
|
args: [{
|
|
260
243
|
selector: 'brn-switch',
|
|
@@ -299,10 +282,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
299
282
|
}]
|
|
300
283
|
}], ctorParameters: () => [] });
|
|
301
284
|
|
|
302
|
-
|
|
285
|
+
class BrnSwitchThumb {
|
|
286
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnSwitchThumb, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
287
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.8", type: BrnSwitchThumb, isStandalone: true, selector: "brn-switch-thumb", host: { attributes: { "role": "presentation" }, listeners: { "click": "$event.preventDefault()" } }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
288
|
+
}
|
|
289
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnSwitchThumb, decorators: [{
|
|
290
|
+
type: Component,
|
|
291
|
+
args: [{
|
|
292
|
+
selector: 'brn-switch-thumb',
|
|
293
|
+
template: '',
|
|
294
|
+
host: {
|
|
295
|
+
role: 'presentation',
|
|
296
|
+
'(click)': '$event.preventDefault()',
|
|
297
|
+
},
|
|
298
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
299
|
+
}]
|
|
300
|
+
}] });
|
|
301
|
+
|
|
302
|
+
const BrnSwitchImports = [BrnSwitch, BrnSwitchThumb];
|
|
303
303
|
class BrnSwitchModule {
|
|
304
304
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnSwitchModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
305
|
-
/** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.8", ngImport: i0, type: BrnSwitchModule, imports: [
|
|
305
|
+
/** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.8", ngImport: i0, type: BrnSwitchModule, imports: [BrnSwitch, BrnSwitchThumb], exports: [BrnSwitch, BrnSwitchThumb] });
|
|
306
306
|
/** @nocollapse */ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnSwitchModule });
|
|
307
307
|
}
|
|
308
308
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnSwitchModule, decorators: [{
|
|
@@ -317,5 +317,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
317
317
|
* Generated bundle index. Do not edit.
|
|
318
318
|
*/
|
|
319
319
|
|
|
320
|
-
export { BRN_SWITCH_VALUE_ACCESSOR,
|
|
320
|
+
export { BRN_SWITCH_VALUE_ACCESSOR, BrnSwitch, BrnSwitchImports, BrnSwitchModule, BrnSwitchThumb };
|
|
321
321
|
//# sourceMappingURL=spartan-ng-brain-switch.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spartan-ng-brain-switch.mjs","sources":["../../../../libs/brain/switch/src/lib/brn-switch-thumb.component.ts","../../../../libs/brain/switch/src/lib/brn-switch.component.ts","../../../../libs/brain/switch/src/index.ts","../../../../libs/brain/switch/src/spartan-ng-brain-switch.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component } from '@angular/core';\n\n@Component({\n\tselector: 'brn-switch-thumb',\n\ttemplate: '',\n\thost: {\n\t\trole: 'presentation',\n\t\t'(click)': '$event.preventDefault()',\n\t},\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BrnSwitchThumbComponent {}\n","import { FocusMonitor } from '@angular/cdk/a11y';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport {\n\ttype AfterContentInit,\n\tbooleanAttribute,\n\tChangeDetectionStrategy,\n\tChangeDetectorRef,\n\tComponent,\n\tcomputed,\n\tDestroyRef,\n\teffect,\n\tElementRef,\n\tforwardRef,\n\tinject,\n\tinput,\n\tlinkedSignal,\n\tmodel,\n\ttype OnDestroy,\n\toutput,\n\tPLATFORM_ID,\n\tRenderer2,\n\tsignal,\n\tviewChild,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { ChangeFn, TouchFn } from '@spartan-ng/brain/forms';\n\nexport const BRN_SWITCH_VALUE_ACCESSOR = {\n\tprovide: NG_VALUE_ACCESSOR,\n\tuseExisting: forwardRef(() => BrnSwitchComponent),\n\tmulti: true,\n};\n\nconst CONTAINER_POST_FIX = '-switch';\n\nlet uniqueIdCounter = 0;\n\n@Component({\n\tselector: 'brn-switch',\n\ttemplate: `\n\t\t<button\n\t\t\t#switch\n\t\t\trole=\"switch\"\n\t\t\ttype=\"button\"\n\t\t\t[class]=\"class()\"\n\t\t\t[id]=\"getSwitchButtonId(_state().id) ?? ''\"\n\t\t\t[name]=\"getSwitchButtonId(_state().name) ?? ''\"\n\t\t\t[value]=\"checked() ? 'on' : 'off'\"\n\t\t\t[attr.aria-checked]=\"checked()\"\n\t\t\t[attr.aria-label]=\"ariaLabel() || null\"\n\t\t\t[attr.aria-labelledby]=\"mutableAriaLabelledby() || null\"\n\t\t\t[attr.aria-describedby]=\"ariaDescribedby() || null\"\n\t\t\t[attr.data-state]=\"checked() ? 'checked' : 'unchecked'\"\n\t\t\t[attr.data-focus-visible]=\"_focusVisible()\"\n\t\t\t[attr.data-focus]=\"_focused()\"\n\t\t\t[attr.data-disabled]=\"_state().disabled()\"\n\t\t\t[disabled]=\"_state().disabled()\"\n\t\t\t[tabIndex]=\"tabIndex()\"\n\t\t\t(click)=\"$event.preventDefault(); toggle()\"\n\t\t>\n\t\t\t<ng-content select=\"brn-switch-thumb\" />\n\t\t</button>\n\t`,\n\thost: {\n\t\t'[style]': '{display: \"contents\"}',\n\t\t'[attr.id]': '_state().id',\n\t\t'[attr.name]': '_state().name',\n\t\t'[attr.aria-labelledby]': 'null',\n\t\t'[attr.aria-label]': 'null',\n\t\t'[attr.aria-describedby]': 'null',\n\t\t'[attr.data-state]': 'checked() ? \"checked\" : \"unchecked\"',\n\t\t'[attr.data-focus-visible]': '_focusVisible()',\n\t\t'[attr.data-focus]': '_focused()',\n\t\t'[attr.data-disabled]': '_state().disabled()',\n\t},\n\tproviders: [BRN_SWITCH_VALUE_ACCESSOR],\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BrnSwitchComponent implements AfterContentInit, OnDestroy, ControlValueAccessor {\n\tprivate readonly _destroyRef = inject(DestroyRef);\n\tprivate readonly _renderer = inject(Renderer2);\n\tprivate readonly _isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\tprivate readonly _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\tprivate readonly _focusMonitor = inject(FocusMonitor);\n\tprivate readonly _cdr = inject(ChangeDetectorRef);\n\tprivate readonly _document = inject(DOCUMENT);\n\n\tprotected readonly _focusVisible = signal(false);\n\tprotected readonly _focused = signal(false);\n\n\t/**\n\t * Whether switch is checked/toggled on.\n\t * Can be bound with [(checked)] for two-way binding.\n\t */\n\tpublic readonly checked = model<boolean>(false);\n\n\t/**\n\t * Unique identifier for switch component.\n\t * When provided, inner button gets ID without '-switch' suffix.\n\t * Auto-generates ID if not provided.\n\t */\n\tpublic readonly id = input<string | null>(uniqueIdCounter++ + '');\n\n\t/**\n\t * Form control name for switch.\n\t * When provided, inner button gets name without '-switch' suffix.\n\t */\n\tpublic readonly name = input<string | null>(null);\n\n\t/**\n\t * CSS classes applied to inner button element.\n\t */\n\tpublic readonly class = input<string | null>(null);\n\n\t/**\n\t * Accessibility label for screen readers.\n\t * Use when no visible label exists.\n\t */\n\tpublic readonly ariaLabel = input<string | null>(null, { alias: 'aria-label' });\n\n\t/**\n\t * ID of element that labels this switch for accessibility.\n\t * Auto-set when switch is inside label element.\n\t */\n\tpublic readonly ariaLabelledby = input<string | null>(null, { alias: 'aria-labelledby' });\n\tpublic readonly mutableAriaLabelledby = linkedSignal(() => this.ariaLabelledby());\n\n\t/**\n\t * ID of element that describes this switch for accessibility.\n\t */\n\tpublic readonly ariaDescribedby = input<string | null>(null, { alias: 'aria-describedby' });\n\n\t/**\n\t * Whether switch is required in a form.\n\t */\n\tpublic readonly required = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\t/**\n\t * Whether switch is disabled.\n\t * Disabled switches cannot be toggled and indicate disabled state with data attribute.\n\t */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, {\n\t\ttransform: booleanAttribute,\n\t});\n\n\t/**\n\t * Keyboard tab order for switch.\n\t * @default 0\n\t */\n\tpublic readonly tabIndex = input(0);\n\n\t/**\n\t * Event emitted when switch value changes.\n\t * Emits new checked state (true/false).\n\t */\n\tpublic readonly changed = output<boolean>();\n\n\t/**\n\t * Event emitted when switch is blurred (loses focus).\n\t * Used for form validation.\n\t */\n\tpublic readonly touched = output<void>();\n\n\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\tprotected _onChange: ChangeFn<boolean> = () => {};\n\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\tprivate _onTouched: TouchFn = () => {};\n\n\tpublic readonly switch = viewChild.required<ElementRef<HTMLInputElement>>('switch');\n\n\tprotected readonly _state = computed(() => {\n\t\tconst name = this.name();\n\t\tconst id = this.id();\n\t\treturn {\n\t\t\tdisabled: signal(this.disabled()),\n\t\t\tname: name ? name + CONTAINER_POST_FIX : null,\n\t\t\tid: id ? id + CONTAINER_POST_FIX : null,\n\t\t};\n\t});\n\n\tconstructor() {\n\t\teffect(() => {\n\t\t\tconst state = this._state();\n\t\t\tconst isDisabled = state.disabled();\n\n\t\t\tif (!this._elementRef.nativeElement || !this._isBrowser) return;\n\n\t\t\tconst newLabelId = state.id + '-label';\n\t\t\tconst switchButtonId = this.getSwitchButtonId(state.id);\n\t\t\tconst labelElement =\n\t\t\t\tthis._elementRef.nativeElement.closest('label') ??\n\t\t\t\tthis._document.querySelector(`label[for=\"${switchButtonId}\"]`);\n\n\t\t\tif (!labelElement) return;\n\t\t\tconst existingLabelId = labelElement.id;\n\n\t\t\tthis._renderer.setAttribute(labelElement, 'data-disabled', isDisabled ? 'true' : 'false');\n\t\t\tthis.mutableAriaLabelledby.set(existingLabelId || newLabelId);\n\n\t\t\tif (!existingLabelId || existingLabelId.length === 0) {\n\t\t\t\tthis._renderer.setAttribute(labelElement, 'id', newLabelId);\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Toggles switch between checked/unchecked states.\n\t * Does nothing if switch is disabled.\n\t */\n\tprotected toggle(): void {\n\t\tif (this._state().disabled()) return;\n\n\t\tthis._onTouched();\n\t\tthis.touched.emit();\n\n\t\tthis.checked.update((checked) => !checked);\n\t\tthis._onChange(this.checked());\n\t\tthis.changed.emit(this.checked());\n\t}\n\n\tpublic ngAfterContentInit() {\n\t\tthis._focusMonitor\n\t\t\t.monitor(this._elementRef, true)\n\t\t\t.pipe(takeUntilDestroyed(this._destroyRef))\n\t\t\t.subscribe((focusOrigin) => {\n\t\t\t\tif (focusOrigin) this._focused.set(true);\n\t\t\t\tif (focusOrigin === 'keyboard' || focusOrigin === 'program') {\n\t\t\t\t\tthis._focusVisible.set(true);\n\t\t\t\t\tthis._cdr.markForCheck();\n\t\t\t\t}\n\t\t\t\tif (!focusOrigin) {\n\t\t\t\t\t// When a focused element becomes disabled, the browser *immediately* fires a blur event.\n\t\t\t\t\t// Angular does not expect events to be raised during change detection, so any state\n\t\t\t\t\t// change (such as a form control's ng-touched) will cause a changed-after-checked error.\n\t\t\t\t\t// See https://github.com/angular/angular/issues/17793. To work around this, we defer\n\t\t\t\t\t// telling the form control it has been touched until the next tick.\n\t\t\t\t\tPromise.resolve().then(() => {\n\t\t\t\t\t\tthis._focusVisible.set(false);\n\t\t\t\t\t\tthis._focused.set(false);\n\t\t\t\t\t\tthis._onTouched();\n\t\t\t\t\t\tthis.touched.emit();\n\t\t\t\t\t\tthis._cdr.markForCheck();\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\n\t\tif (!this.switch()) return;\n\t\tthis.switch().nativeElement.value = this.checked() ? 'on' : 'off';\n\t\tthis.switch().nativeElement.dispatchEvent(new Event('change'));\n\t}\n\n\tpublic ngOnDestroy() {\n\t\tthis._focusMonitor.stopMonitoring(this._elementRef);\n\t}\n\n\t/**\n\t * Gets proper ID for inner button element.\n\t * Removes '-switch' suffix if present in container ID.\n\t *\n\t * @param idPassedToContainer - ID applied to container element\n\t * @returns ID to use for inner button or null\n\t */\n\tprotected getSwitchButtonId(idPassedToContainer: string | null | undefined): string | null {\n\t\treturn idPassedToContainer ? idPassedToContainer.replace(CONTAINER_POST_FIX, '') : null;\n\t}\n\n\t/**\n\t * Updates internal state when control value changes from outside.\n\t * Part of ControlValueAccessor interface.\n\t *\n\t * @param value - New checked state\n\t */\n\tpublic writeValue(value: boolean): void {\n\t\tthis.checked.set(Boolean(value));\n\t}\n\n\t/**\n\t * Registers callback for value changes.\n\t * Part of ControlValueAccessor interface.\n\t *\n\t * @param fn - Function to call when value changes\n\t */\n\tpublic registerOnChange(fn: ChangeFn<boolean>): void {\n\t\tthis._onChange = fn;\n\t}\n\n\t/**\n\t * Registers callback for touched events.\n\t * Part of ControlValueAccessor interface.\n\t *\n\t * @param fn - Function to call when control is touched\n\t */\n\tpublic registerOnTouched(fn: TouchFn): void {\n\t\tthis._onTouched = fn;\n\t}\n\n\t/**\n\t * Updates disabled state from form control.\n\t * Part of ControlValueAccessor interface.\n\t *\n\t * @param isDisabled - Whether switch should be disabled\n\t */\n\tpublic setDisabledState = (isDisabled: boolean): void => {\n\t\tthis._state().disabled.set(isDisabled);\n\t\tthis._cdr.markForCheck();\n\t};\n}\n","import { NgModule } from '@angular/core';\n\nimport { BrnSwitchThumbComponent } from './lib/brn-switch-thumb.component';\nimport { BrnSwitchComponent } from './lib/brn-switch.component';\n\nexport * from './lib/brn-switch-thumb.component';\nexport * from './lib/brn-switch.component';\n\nexport const BrnSwitchImports = [BrnSwitchComponent, BrnSwitchThumbComponent] as const;\n\n@NgModule({\n\timports: [...BrnSwitchImports],\n\texports: [...BrnSwitchImports],\n})\nexport class BrnSwitchModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAWa,uBAAuB,CAAA;0HAAvB,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,iLAPzB,EAAE,EAAA,Q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","../../../../libs/brain/switch/src/lib/brn-switch-thumb.ts","../../../../libs/brain/switch/src/index.ts","../../../../libs/brain/switch/src/spartan-ng-brain-switch.ts"],"sourcesContent":["import { FocusMonitor } from '@angular/cdk/a11y';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport {\n\ttype AfterContentInit,\n\tbooleanAttribute,\n\tChangeDetectionStrategy,\n\tChangeDetectorRef,\n\tComponent,\n\tcomputed,\n\tDestroyRef,\n\teffect,\n\tElementRef,\n\tforwardRef,\n\tinject,\n\tinput,\n\tlinkedSignal,\n\tmodel,\n\ttype OnDestroy,\n\toutput,\n\tPLATFORM_ID,\n\tRenderer2,\n\tsignal,\n\tviewChild,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { ChangeFn, TouchFn } from '@spartan-ng/brain/forms';\n\nexport const BRN_SWITCH_VALUE_ACCESSOR = {\n\tprovide: NG_VALUE_ACCESSOR,\n\tuseExisting: forwardRef(() => BrnSwitch),\n\tmulti: true,\n};\n\nconst CONTAINER_POST_FIX = '-switch';\n\nlet uniqueIdCounter = 0;\n\n@Component({\n\tselector: 'brn-switch',\n\ttemplate: `\n\t\t<button\n\t\t\t#switch\n\t\t\trole=\"switch\"\n\t\t\ttype=\"button\"\n\t\t\t[class]=\"class()\"\n\t\t\t[id]=\"getSwitchButtonId(_state().id) ?? ''\"\n\t\t\t[name]=\"getSwitchButtonId(_state().name) ?? ''\"\n\t\t\t[value]=\"checked() ? 'on' : 'off'\"\n\t\t\t[attr.aria-checked]=\"checked()\"\n\t\t\t[attr.aria-label]=\"ariaLabel() || null\"\n\t\t\t[attr.aria-labelledby]=\"mutableAriaLabelledby() || null\"\n\t\t\t[attr.aria-describedby]=\"ariaDescribedby() || null\"\n\t\t\t[attr.data-state]=\"checked() ? 'checked' : 'unchecked'\"\n\t\t\t[attr.data-focus-visible]=\"_focusVisible()\"\n\t\t\t[attr.data-focus]=\"_focused()\"\n\t\t\t[attr.data-disabled]=\"_state().disabled()\"\n\t\t\t[disabled]=\"_state().disabled()\"\n\t\t\t[tabIndex]=\"tabIndex()\"\n\t\t\t(click)=\"$event.preventDefault(); toggle()\"\n\t\t>\n\t\t\t<ng-content select=\"brn-switch-thumb\" />\n\t\t</button>\n\t`,\n\thost: {\n\t\t'[style]': '{display: \"contents\"}',\n\t\t'[attr.id]': '_state().id',\n\t\t'[attr.name]': '_state().name',\n\t\t'[attr.aria-labelledby]': 'null',\n\t\t'[attr.aria-label]': 'null',\n\t\t'[attr.aria-describedby]': 'null',\n\t\t'[attr.data-state]': 'checked() ? \"checked\" : \"unchecked\"',\n\t\t'[attr.data-focus-visible]': '_focusVisible()',\n\t\t'[attr.data-focus]': '_focused()',\n\t\t'[attr.data-disabled]': '_state().disabled()',\n\t},\n\tproviders: [BRN_SWITCH_VALUE_ACCESSOR],\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BrnSwitch implements AfterContentInit, OnDestroy, ControlValueAccessor {\n\tprivate readonly _destroyRef = inject(DestroyRef);\n\tprivate readonly _renderer = inject(Renderer2);\n\tprivate readonly _isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\tprivate readonly _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\tprivate readonly _focusMonitor = inject(FocusMonitor);\n\tprivate readonly _cdr = inject(ChangeDetectorRef);\n\tprivate readonly _document = inject(DOCUMENT);\n\n\tprotected readonly _focusVisible = signal(false);\n\tprotected readonly _focused = signal(false);\n\n\t/**\n\t * Whether switch is checked/toggled on.\n\t * Can be bound with [(checked)] for two-way binding.\n\t */\n\tpublic readonly checked = model<boolean>(false);\n\n\t/**\n\t * Unique identifier for switch component.\n\t * When provided, inner button gets ID without '-switch' suffix.\n\t * Auto-generates ID if not provided.\n\t */\n\tpublic readonly id = input<string | null>(uniqueIdCounter++ + '');\n\n\t/**\n\t * Form control name for switch.\n\t * When provided, inner button gets name without '-switch' suffix.\n\t */\n\tpublic readonly name = input<string | null>(null);\n\n\t/**\n\t * CSS classes applied to inner button element.\n\t */\n\tpublic readonly class = input<string | null>(null);\n\n\t/**\n\t * Accessibility label for screen readers.\n\t * Use when no visible label exists.\n\t */\n\tpublic readonly ariaLabel = input<string | null>(null, { alias: 'aria-label' });\n\n\t/**\n\t * ID of element that labels this switch for accessibility.\n\t * Auto-set when switch is inside label element.\n\t */\n\tpublic readonly ariaLabelledby = input<string | null>(null, { alias: 'aria-labelledby' });\n\tpublic readonly mutableAriaLabelledby = linkedSignal(() => this.ariaLabelledby());\n\n\t/**\n\t * ID of element that describes this switch for accessibility.\n\t */\n\tpublic readonly ariaDescribedby = input<string | null>(null, { alias: 'aria-describedby' });\n\n\t/**\n\t * Whether switch is required in a form.\n\t */\n\tpublic readonly required = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\t/**\n\t * Whether switch is disabled.\n\t * Disabled switches cannot be toggled and indicate disabled state with data attribute.\n\t */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, {\n\t\ttransform: booleanAttribute,\n\t});\n\n\t/**\n\t * Keyboard tab order for switch.\n\t * @default 0\n\t */\n\tpublic readonly tabIndex = input(0);\n\n\t/**\n\t * Event emitted when switch value changes.\n\t * Emits new checked state (true/false).\n\t */\n\tpublic readonly changed = output<boolean>();\n\n\t/**\n\t * Event emitted when switch is blurred (loses focus).\n\t * Used for form validation.\n\t */\n\tpublic readonly touched = output<void>();\n\n\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\tprotected _onChange: ChangeFn<boolean> = () => {};\n\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\tprivate _onTouched: TouchFn = () => {};\n\n\tpublic readonly switch = viewChild.required<ElementRef<HTMLInputElement>>('switch');\n\n\tprotected readonly _state = computed(() => {\n\t\tconst name = this.name();\n\t\tconst id = this.id();\n\t\treturn {\n\t\t\tdisabled: signal(this.disabled()),\n\t\t\tname: name ? name + CONTAINER_POST_FIX : null,\n\t\t\tid: id ? id + CONTAINER_POST_FIX : null,\n\t\t};\n\t});\n\n\tconstructor() {\n\t\teffect(() => {\n\t\t\tconst state = this._state();\n\t\t\tconst isDisabled = state.disabled();\n\n\t\t\tif (!this._elementRef.nativeElement || !this._isBrowser) return;\n\n\t\t\tconst newLabelId = state.id + '-label';\n\t\t\tconst switchButtonId = this.getSwitchButtonId(state.id);\n\t\t\tconst labelElement =\n\t\t\t\tthis._elementRef.nativeElement.closest('label') ??\n\t\t\t\tthis._document.querySelector(`label[for=\"${switchButtonId}\"]`);\n\n\t\t\tif (!labelElement) return;\n\t\t\tconst existingLabelId = labelElement.id;\n\n\t\t\tthis._renderer.setAttribute(labelElement, 'data-disabled', isDisabled ? 'true' : 'false');\n\t\t\tthis.mutableAriaLabelledby.set(existingLabelId || newLabelId);\n\n\t\t\tif (!existingLabelId || existingLabelId.length === 0) {\n\t\t\t\tthis._renderer.setAttribute(labelElement, 'id', newLabelId);\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Toggles switch between checked/unchecked states.\n\t * Does nothing if switch is disabled.\n\t */\n\tprotected toggle(): void {\n\t\tif (this._state().disabled()) return;\n\n\t\tthis._onTouched();\n\t\tthis.touched.emit();\n\n\t\tthis.checked.update((checked) => !checked);\n\t\tthis._onChange(this.checked());\n\t\tthis.changed.emit(this.checked());\n\t}\n\n\tpublic ngAfterContentInit() {\n\t\tthis._focusMonitor\n\t\t\t.monitor(this._elementRef, true)\n\t\t\t.pipe(takeUntilDestroyed(this._destroyRef))\n\t\t\t.subscribe((focusOrigin) => {\n\t\t\t\tif (focusOrigin) this._focused.set(true);\n\t\t\t\tif (focusOrigin === 'keyboard' || focusOrigin === 'program') {\n\t\t\t\t\tthis._focusVisible.set(true);\n\t\t\t\t\tthis._cdr.markForCheck();\n\t\t\t\t}\n\t\t\t\tif (!focusOrigin) {\n\t\t\t\t\t// When a focused element becomes disabled, the browser *immediately* fires a blur event.\n\t\t\t\t\t// Angular does not expect events to be raised during change detection, so any state\n\t\t\t\t\t// change (such as a form control's ng-touched) will cause a changed-after-checked error.\n\t\t\t\t\t// See https://github.com/angular/angular/issues/17793. To work around this, we defer\n\t\t\t\t\t// telling the form control it has been touched until the next tick.\n\t\t\t\t\tPromise.resolve().then(() => {\n\t\t\t\t\t\tthis._focusVisible.set(false);\n\t\t\t\t\t\tthis._focused.set(false);\n\t\t\t\t\t\tthis._onTouched();\n\t\t\t\t\t\tthis.touched.emit();\n\t\t\t\t\t\tthis._cdr.markForCheck();\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\n\t\tif (!this.switch()) return;\n\t\tthis.switch().nativeElement.value = this.checked() ? 'on' : 'off';\n\t\tthis.switch().nativeElement.dispatchEvent(new Event('change'));\n\t}\n\n\tpublic ngOnDestroy() {\n\t\tthis._focusMonitor.stopMonitoring(this._elementRef);\n\t}\n\n\t/**\n\t * Gets proper ID for inner button element.\n\t * Removes '-switch' suffix if present in container ID.\n\t *\n\t * @param idPassedToContainer - ID applied to container element\n\t * @returns ID to use for inner button or null\n\t */\n\tprotected getSwitchButtonId(idPassedToContainer: string | null | undefined): string | null {\n\t\treturn idPassedToContainer ? idPassedToContainer.replace(CONTAINER_POST_FIX, '') : null;\n\t}\n\n\t/**\n\t * Updates internal state when control value changes from outside.\n\t * Part of ControlValueAccessor interface.\n\t *\n\t * @param value - New checked state\n\t */\n\tpublic writeValue(value: boolean): void {\n\t\tthis.checked.set(Boolean(value));\n\t}\n\n\t/**\n\t * Registers callback for value changes.\n\t * Part of ControlValueAccessor interface.\n\t *\n\t * @param fn - Function to call when value changes\n\t */\n\tpublic registerOnChange(fn: ChangeFn<boolean>): void {\n\t\tthis._onChange = fn;\n\t}\n\n\t/**\n\t * Registers callback for touched events.\n\t * Part of ControlValueAccessor interface.\n\t *\n\t * @param fn - Function to call when control is touched\n\t */\n\tpublic registerOnTouched(fn: TouchFn): void {\n\t\tthis._onTouched = fn;\n\t}\n\n\t/**\n\t * Updates disabled state from form control.\n\t * Part of ControlValueAccessor interface.\n\t *\n\t * @param isDisabled - Whether switch should be disabled\n\t */\n\tpublic setDisabledState = (isDisabled: boolean): void => {\n\t\tthis._state().disabled.set(isDisabled);\n\t\tthis._cdr.markForCheck();\n\t};\n}\n","import { ChangeDetectionStrategy, Component } from '@angular/core';\n\n@Component({\n\tselector: 'brn-switch-thumb',\n\ttemplate: '',\n\thost: {\n\t\trole: 'presentation',\n\t\t'(click)': '$event.preventDefault()',\n\t},\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BrnSwitchThumb {}\n","import { NgModule } from '@angular/core';\n\nimport { BrnSwitch } from './lib/brn-switch';\nimport { BrnSwitchThumb } from './lib/brn-switch-thumb';\n\nexport * from './lib/brn-switch';\nexport * from './lib/brn-switch-thumb';\n\nexport const BrnSwitchImports = [BrnSwitch, BrnSwitchThumb] as const;\n\n@NgModule({\n\timports: [...BrnSwitchImports],\n\texports: [...BrnSwitchImports],\n})\nexport class BrnSwitchModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AA6BO,MAAM,yBAAyB,GAAG;AACxC,IAAA,OAAO,EAAE,iBAAiB;AAC1B,IAAA,WAAW,EAAE,UAAU,CAAC,MAAM,SAAS,CAAC;AACxC,IAAA,KAAK,EAAE,IAAI;;AAGZ,MAAM,kBAAkB,GAAG,SAAS;AAEpC,IAAI,eAAe,GAAG,CAAC;MA2CV,SAAS,CAAA;AACJ,IAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;AAChC,IAAA,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;IAC7B,UAAU,GAAG,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AACnD,IAAA,WAAW,GAAG,MAAM,CAA0B,UAAU,CAAC;AACzD,IAAA,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC;AACpC,IAAA,IAAI,GAAG,MAA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A,QAAQ,EAAE,kBAAkB;AAC5B,oBAAA,QAAQ,EAAE,EAAE;AACZ,oBAAA,IAAI,EAAE;AACL,wBAAA,IAAI,EAAE,cAAc;AACpB,wBAAA,SAAS,EAAE,yBAAyB;AACpC,qBAAA;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAC/C,iBAAA;;;MCFY,gBAAgB,GAAG,CAAC,SAAS,EAAE,cAAc;MAM7C,eAAe,CAAA;0HAAf,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;AAAf,uBAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,YANK,SAAS,EAAE,cAAc,CAAA,EAAA,OAAA,EAAA,CAAzB,SAAS,EAAE,cAAc,CAAA,EAAA,CAAA;2HAM7C,eAAe,EAAA,CAAA;;2FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAJ3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,OAAO,EAAE,CAAC,GAAG,gBAAgB,CAAC;AAC9B,oBAAA,OAAO,EAAE,CAAC,GAAG,gBAAgB,CAAC;AAC9B,iBAAA;;;ACbD;;AAEG;;;;"}
|
|
@@ -9,7 +9,7 @@ import { SharedResizeObserver } from '@angular/cdk/observers/private';
|
|
|
9
9
|
import { normalizePassiveListenerOptions, Platform } from '@angular/cdk/platform';
|
|
10
10
|
import { ViewportRuler } from '@angular/cdk/scrolling';
|
|
11
11
|
|
|
12
|
-
class
|
|
12
|
+
class BrnTabs {
|
|
13
13
|
orientation = input('horizontal');
|
|
14
14
|
/** internal **/
|
|
15
15
|
$orientation = this.orientation;
|
|
@@ -58,10 +58,10 @@ class BrnTabsDirective {
|
|
|
58
58
|
setActiveTab(key) {
|
|
59
59
|
this.activeTab.set(key);
|
|
60
60
|
}
|
|
61
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
62
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type:
|
|
61
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnTabs, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
62
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnTabs, isStandalone: true, selector: "[brnTabs]", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, activeTab: { classPropertyName: "activeTab", publicName: "brnTabs", isSignal: true, isRequired: false, transformFunction: null }, activationMode: { classPropertyName: "activationMode", publicName: "activationMode", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activeTab: "brnTabsChange", tabActivated: "tabActivated" }, host: { properties: { "attr.data-orientation": "orientation()", "attr.dir": "direction()" } }, exportAs: ["brnTabs"], ngImport: i0 });
|
|
63
63
|
}
|
|
64
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
64
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnTabs, decorators: [{
|
|
65
65
|
type: Directive,
|
|
66
66
|
args: [{
|
|
67
67
|
selector: '[brnTabs]',
|
|
@@ -73,8 +73,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
73
73
|
}]
|
|
74
74
|
}] });
|
|
75
75
|
|
|
76
|
-
class
|
|
77
|
-
_root = inject(
|
|
76
|
+
class BrnTabsContent {
|
|
77
|
+
_root = inject(BrnTabs);
|
|
78
78
|
_elementRef = inject(ElementRef);
|
|
79
79
|
contentFor = input.required({ alias: 'brnTabsContent' });
|
|
80
80
|
_isSelected = computed(() => this._root.$activeTab() === this.contentFor());
|
|
@@ -92,10 +92,10 @@ class BrnTabsContentDirective {
|
|
|
92
92
|
ngOnDestroy() {
|
|
93
93
|
this._root.unregisterContent(this.contentFor());
|
|
94
94
|
}
|
|
95
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
96
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type:
|
|
95
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnTabsContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
96
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnTabsContent, isStandalone: true, selector: "[brnTabsContent]", inputs: { contentFor: { classPropertyName: "contentFor", publicName: "brnTabsContent", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "role": "tabpanel", "tabindex": "0" }, properties: { "id": "_contentId()", "attr.aria-labelledby": "_labelId()", "hidden": "_isSelected() === false" } }, exportAs: ["brnTabsContent"], ngImport: i0 });
|
|
97
97
|
}
|
|
98
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
98
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnTabsContent, decorators: [{
|
|
99
99
|
type: Directive,
|
|
100
100
|
args: [{
|
|
101
101
|
selector: '[brnTabsContent]',
|
|
@@ -110,9 +110,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
110
110
|
}]
|
|
111
111
|
}], ctorParameters: () => [] });
|
|
112
112
|
|
|
113
|
-
class
|
|
113
|
+
class BrnTabsTrigger {
|
|
114
114
|
elementRef = inject(ElementRef);
|
|
115
|
-
_root = inject(
|
|
115
|
+
_root = inject(BrnTabs);
|
|
116
116
|
_orientation = this._root.$orientation;
|
|
117
117
|
triggerFor = input.required({ alias: 'brnTabsTrigger' });
|
|
118
118
|
selected = computed(() => this._root.$activeTab() === this.triggerFor());
|
|
@@ -150,10 +150,10 @@ class BrnTabsTriggerDirective {
|
|
|
150
150
|
ngOnDestroy() {
|
|
151
151
|
this._root.unregisterTrigger(this.triggerFor());
|
|
152
152
|
}
|
|
153
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
154
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type:
|
|
153
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnTabsTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
154
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnTabsTrigger, isStandalone: true, selector: "button[brnTabsTrigger]", inputs: { triggerFor: { classPropertyName: "triggerFor", publicName: "brnTabsTrigger", isSignal: true, isRequired: true, transformFunction: null }, _disabled: { classPropertyName: "_disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "type": "button", "role": "tab" }, listeners: { "click": "activate()" }, properties: { "id": "_labelId()", "tabindex": "selected() ? \"0\": \"-1\"", "attr.aria-selected": "selected()", "attr.aria-controls": "_contentId()", "attr.aria-disabled": "_disabled()", "attr.data-state": "selected() ? 'active' : 'inactive'", "attr.data-orientation": "_orientation()", "attr.data-disabled": "_disabled() ? '' : undefined", "attr.disabled": "_disabled() ? '' : undefined" } }, exportAs: ["brnTabsTrigger"], ngImport: i0 });
|
|
155
155
|
}
|
|
156
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
156
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnTabsTrigger, decorators: [{
|
|
157
157
|
type: Directive,
|
|
158
158
|
args: [{
|
|
159
159
|
selector: 'button[brnTabsTrigger]',
|
|
@@ -175,8 +175,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
175
175
|
}]
|
|
176
176
|
}], ctorParameters: () => [] });
|
|
177
177
|
|
|
178
|
-
class
|
|
179
|
-
_root = inject(
|
|
178
|
+
class BrnTabsList {
|
|
179
|
+
_root = inject(BrnTabs);
|
|
180
180
|
_orientation = this._root.$orientation;
|
|
181
181
|
_direction = this._root.$direction;
|
|
182
182
|
_activeTab = this._root.$activeTab;
|
|
@@ -184,7 +184,7 @@ class BrnTabsListDirective {
|
|
|
184
184
|
_elementRef = inject(ElementRef);
|
|
185
185
|
_keyDownListener = fromEvent(this._elementRef.nativeElement, 'keydown');
|
|
186
186
|
_keyManager;
|
|
187
|
-
triggers = contentChildren(
|
|
187
|
+
triggers = contentChildren(BrnTabsTrigger, { descendants: true });
|
|
188
188
|
ngAfterContentInit() {
|
|
189
189
|
this._keyManager = new FocusKeyManager(this.triggers())
|
|
190
190
|
.withHorizontalOrientation(this._direction())
|
|
@@ -218,10 +218,10 @@ class BrnTabsListDirective {
|
|
|
218
218
|
this._keyManager?.onKeydown(event);
|
|
219
219
|
});
|
|
220
220
|
}
|
|
221
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
222
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.8", type:
|
|
221
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnTabsList, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
222
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.8", type: BrnTabsList, isStandalone: true, selector: "[brnTabsList]", host: { attributes: { "role": "tablist" }, properties: { "attr.aria-orientation": "_orientation()", "attr.data-orientation": "_orientation()" } }, queries: [{ propertyName: "triggers", predicate: BrnTabsTrigger, descendants: true, isSignal: true }], exportAs: ["brnTabsList"], ngImport: i0 });
|
|
223
223
|
}
|
|
224
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
224
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnTabsList, decorators: [{
|
|
225
225
|
type: Directive,
|
|
226
226
|
args: [{
|
|
227
227
|
selector: '[brnTabsList]',
|
|
@@ -264,12 +264,12 @@ const HEADER_SCROLL_INTERVAL = 100;
|
|
|
264
264
|
* Base class for a tab header that supported pagination.
|
|
265
265
|
* @docs-private
|
|
266
266
|
*/
|
|
267
|
-
class
|
|
267
|
+
class BrnTabsPaginatedList {
|
|
268
268
|
/** The distance in pixels that the tab labels should be translated to the left. */
|
|
269
269
|
_scrollDistance = 0;
|
|
270
270
|
/** Whether the header should scroll to the selected index after the view has been checked. */
|
|
271
271
|
_selectedIndexChanged = false;
|
|
272
|
-
_root = inject(
|
|
272
|
+
_root = inject(BrnTabs);
|
|
273
273
|
_activeTab = this._root.$activeTab;
|
|
274
274
|
_tabs = this._root.$tabs;
|
|
275
275
|
/** Emits when the component is destroyed. */
|
|
@@ -741,28 +741,17 @@ class BrnTabsPaginatedListDirective {
|
|
|
741
741
|
this._checkScrollingControls();
|
|
742
742
|
return { maxScrollDistance, distance: this._scrollDistance };
|
|
743
743
|
}
|
|
744
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
745
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type:
|
|
744
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnTabsPaginatedList, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
745
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnTabsPaginatedList, isStandalone: true, inputs: { disablePagination: { classPropertyName: "disablePagination", publicName: "disablePagination", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectFocusedIndex: "selectFocusedIndex", indexFocused: "indexFocused" }, ngImport: i0 });
|
|
746
746
|
}
|
|
747
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
747
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnTabsPaginatedList, decorators: [{
|
|
748
748
|
type: Directive
|
|
749
749
|
}], ctorParameters: () => [] });
|
|
750
750
|
|
|
751
|
-
const BrnTabsImports = [
|
|
752
|
-
BrnTabsDirective,
|
|
753
|
-
BrnTabsListDirective,
|
|
754
|
-
BrnTabsTriggerDirective,
|
|
755
|
-
BrnTabsContentDirective,
|
|
756
|
-
];
|
|
751
|
+
const BrnTabsImports = [BrnTabs, BrnTabsList, BrnTabsTrigger, BrnTabsContent];
|
|
757
752
|
class BrnTabsModule {
|
|
758
753
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnTabsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
759
|
-
/** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.8", ngImport: i0, type: BrnTabsModule, imports: [
|
|
760
|
-
BrnTabsListDirective,
|
|
761
|
-
BrnTabsTriggerDirective,
|
|
762
|
-
BrnTabsContentDirective], exports: [BrnTabsDirective,
|
|
763
|
-
BrnTabsListDirective,
|
|
764
|
-
BrnTabsTriggerDirective,
|
|
765
|
-
BrnTabsContentDirective] });
|
|
754
|
+
/** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.8", ngImport: i0, type: BrnTabsModule, imports: [BrnTabs, BrnTabsList, BrnTabsTrigger, BrnTabsContent], exports: [BrnTabs, BrnTabsList, BrnTabsTrigger, BrnTabsContent] });
|
|
766
755
|
/** @nocollapse */ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnTabsModule });
|
|
767
756
|
}
|
|
768
757
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnTabsModule, decorators: [{
|
|
@@ -777,5 +766,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
777
766
|
* Generated bundle index. Do not edit.
|
|
778
767
|
*/
|
|
779
768
|
|
|
780
|
-
export {
|
|
769
|
+
export { BrnTabs, BrnTabsContent, BrnTabsImports, BrnTabsList, BrnTabsModule, BrnTabsPaginatedList, BrnTabsTrigger };
|
|
781
770
|
//# sourceMappingURL=spartan-ng-brain-tabs.mjs.map
|