@spartan-ng/brain 0.0.1-alpha.511 → 0.0.1-alpha.513
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/lib/brn-accordion.d.ts +8 -4
- package/checkbox/lib/brn-checkbox.d.ts +3 -1
- package/fesm2022/spartan-ng-brain-accordion.mjs +82 -30
- package/fesm2022/spartan-ng-brain-accordion.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-checkbox.mjs +5 -2
- package/fesm2022/spartan-ng-brain-checkbox.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-input-otp.mjs +11 -9
- package/fesm2022/spartan-ng-brain-input-otp.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-radio-group.mjs +4 -1
- package/fesm2022/spartan-ng-brain-radio-group.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-select.mjs +9 -3
- package/fesm2022/spartan-ng-brain-select.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-slider.mjs +8 -2
- package/fesm2022/spartan-ng-brain-slider.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-switch.mjs +5 -2
- package/fesm2022/spartan-ng-brain-switch.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-toggle-group.mjs +5 -2
- package/fesm2022/spartan-ng-brain-toggle-group.mjs.map +1 -1
- package/input-otp/lib/brn-input-otp.d.ts +4 -2
- package/package.json +1 -1
- package/radio-group/lib/brn-radio-group.d.ts +3 -1
- package/select/lib/brn-select.d.ts +2 -1
- package/slider/lib/brn-slider.d.ts +3 -1
- package/switch/lib/brn-switch.d.ts +3 -1
- package/toggle-group/lib/brn-toggle-group.d.ts +3 -1
|
@@ -1,37 +1,39 @@
|
|
|
1
|
+
import { FocusableOption } from '@angular/cdk/a11y';
|
|
1
2
|
import { BooleanInput } from '@angular/cdk/coercion';
|
|
2
3
|
import { type AfterContentInit, type OnDestroy } from '@angular/core';
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
5
|
export declare class BrnAccordionItem {
|
|
5
6
|
private static _itemIdGenerator;
|
|
7
|
+
readonly id: number;
|
|
6
8
|
private readonly _accordion;
|
|
7
9
|
/**
|
|
8
10
|
* Whether the accordion item is opened or closed.
|
|
9
11
|
* @default false
|
|
10
12
|
*/
|
|
11
13
|
readonly isOpened: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
|
|
12
|
-
readonly id: number;
|
|
13
14
|
readonly state: import("@angular/core").Signal<"open" | "closed">;
|
|
14
15
|
constructor();
|
|
15
16
|
static ɵfac: i0.ɵɵFactoryDeclaration<BrnAccordionItem, never>;
|
|
16
17
|
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnAccordionItem, "[brnAccordionItem]", ["brnAccordionItem"], { "isOpened": { "alias": "isOpened"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
17
18
|
}
|
|
18
|
-
export declare class BrnAccordionTrigger {
|
|
19
|
+
export declare class BrnAccordionTrigger implements FocusableOption {
|
|
19
20
|
private readonly _accordion;
|
|
20
21
|
private readonly _item;
|
|
21
|
-
private readonly
|
|
22
|
+
private readonly _el;
|
|
22
23
|
readonly state: import("@angular/core").Signal<"open" | "closed">;
|
|
23
24
|
readonly id: string;
|
|
24
25
|
readonly ariaControls: string;
|
|
25
26
|
constructor();
|
|
26
27
|
protected toggle(event: Event): void;
|
|
27
28
|
focus(): void;
|
|
29
|
+
private validateAriaStructure;
|
|
28
30
|
static ɵfac: i0.ɵɵFactoryDeclaration<BrnAccordionTrigger, never>;
|
|
29
31
|
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnAccordionTrigger, "[brnAccordionTrigger]", never, {}, {}, never, never, true, never>;
|
|
30
32
|
}
|
|
31
33
|
export declare class BrnAccordion implements AfterContentInit, OnDestroy {
|
|
32
34
|
private readonly _el;
|
|
33
|
-
private _keyManager?;
|
|
34
35
|
private readonly _focusMonitor;
|
|
36
|
+
private readonly _keyManager;
|
|
35
37
|
private readonly _focused;
|
|
36
38
|
private readonly _openItemIds;
|
|
37
39
|
readonly openItemIds: import("@angular/core").Signal<number[]>;
|
|
@@ -58,6 +60,8 @@ export declare class BrnAccordion implements AfterContentInit, OnDestroy {
|
|
|
58
60
|
toggleItem(id: number): void;
|
|
59
61
|
openItem(id: number): void;
|
|
60
62
|
closeItem(id: number): void;
|
|
63
|
+
private isEditableTarget;
|
|
64
|
+
private shouldIgnoreEvent;
|
|
61
65
|
private preventDefaultEvents;
|
|
62
66
|
static ɵfac: i0.ɵɵFactoryDeclaration<BrnAccordion, never>;
|
|
63
67
|
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnAccordion, "[brnAccordion]", ["brnAccordion"], { "type": { "alias": "type"; "required": false; "isSignal": true; }; "dir": { "alias": "dir"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; }, {}, ["triggers"], never, true, never>;
|
|
@@ -24,6 +24,8 @@ export declare class BrnCheckbox implements ControlValueAccessor, AfterContentIn
|
|
|
24
24
|
* Can be bound with [(checked)] for two-way binding.
|
|
25
25
|
*/
|
|
26
26
|
readonly checked: import("@angular/core").ModelSignal<BrnCheckboxValue>;
|
|
27
|
+
/** Emits when checked state changes. */
|
|
28
|
+
readonly checkedChange: import("@angular/core").OutputEmitterRef<BrnCheckboxValue>;
|
|
27
29
|
/**
|
|
28
30
|
* Read-only signal of current checkbox state.
|
|
29
31
|
* Use this when you only need to read state without changing it.
|
|
@@ -150,7 +152,7 @@ export declare class BrnCheckbox implements ControlValueAccessor, AfterContentIn
|
|
|
150
152
|
*/
|
|
151
153
|
setDisabledState(isDisabled: boolean): void;
|
|
152
154
|
static ɵfac: i0.ɵɵFactoryDeclaration<BrnCheckbox, never>;
|
|
153
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<BrnCheckbox, "brn-checkbox", never, { "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "class": { "alias": "class"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "ariaLabelledby": { "alias": "aria-labelledby"; "required": false; "isSignal": true; }; "ariaDescribedby": { "alias": "aria-describedby"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "checked": "checkedChange"; "changed": "changed"; "touched": "touched"; }, never, ["*"], true, never>;
|
|
155
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BrnCheckbox, "brn-checkbox", never, { "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "class": { "alias": "class"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "ariaLabelledby": { "alias": "aria-labelledby"; "required": false; "isSignal": true; }; "ariaDescribedby": { "alias": "aria-describedby"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "checked": "checkedChange"; "checkedChange": "checkedChange"; "changed": "changed"; "touched": "touched"; }, never, ["*"], true, never>;
|
|
154
156
|
}
|
|
155
157
|
type BrnCheckboxValue = boolean | 'indeterminate';
|
|
156
158
|
export {};
|
|
@@ -7,17 +7,17 @@ import { fromEvent } from 'rxjs';
|
|
|
7
7
|
|
|
8
8
|
class BrnAccordionItem {
|
|
9
9
|
static _itemIdGenerator = 0;
|
|
10
|
+
id = ++BrnAccordionItem._itemIdGenerator;
|
|
10
11
|
_accordion = inject(BrnAccordion);
|
|
11
12
|
/**
|
|
12
13
|
* Whether the accordion item is opened or closed.
|
|
13
14
|
* @default false
|
|
14
15
|
*/
|
|
15
16
|
isOpened = input(false, { transform: coerceBooleanProperty });
|
|
16
|
-
id = ++BrnAccordionItem._itemIdGenerator;
|
|
17
17
|
state = computed(() => (this._accordion.openItemIds().includes(this.id) ? 'open' : 'closed'));
|
|
18
18
|
constructor() {
|
|
19
19
|
if (!this._accordion) {
|
|
20
|
-
throw Error('Accordion
|
|
20
|
+
throw Error('Accordion item can only be used inside an Accordion. Add brnAccordion to ancestor.');
|
|
21
21
|
}
|
|
22
22
|
effect(() => {
|
|
23
23
|
const isOpened = this.isOpened();
|
|
@@ -47,18 +47,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
47
47
|
class BrnAccordionTrigger {
|
|
48
48
|
_accordion = inject(BrnAccordion);
|
|
49
49
|
_item = inject(BrnAccordionItem);
|
|
50
|
-
|
|
50
|
+
_el = inject((ElementRef));
|
|
51
51
|
state = this._item.state;
|
|
52
52
|
id = `brn-accordion-trigger-${this._item.id}`;
|
|
53
53
|
ariaControls = `brn-accordion-content-${this._item.id}`;
|
|
54
54
|
constructor() {
|
|
55
|
-
if (!this._accordion)
|
|
56
|
-
throw Error('Accordion trigger
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
fromEvent(this._elementRef.nativeElement, 'focus')
|
|
55
|
+
if (!this._accordion)
|
|
56
|
+
throw Error('Accordion trigger requires a parent Accordion.');
|
|
57
|
+
if (!this._item)
|
|
58
|
+
throw Error('Accordion trigger requires a parent AccordionItem.');
|
|
59
|
+
this.validateAriaStructure();
|
|
60
|
+
fromEvent(this._el.nativeElement, 'focus')
|
|
62
61
|
.pipe(takeUntilDestroyed())
|
|
63
62
|
.subscribe(() => {
|
|
64
63
|
this._accordion.setActiveItem(this);
|
|
@@ -69,10 +68,32 @@ class BrnAccordionTrigger {
|
|
|
69
68
|
this._accordion.toggleItem(this._item.id);
|
|
70
69
|
}
|
|
71
70
|
focus() {
|
|
72
|
-
this.
|
|
71
|
+
this._el.nativeElement.focus();
|
|
72
|
+
}
|
|
73
|
+
validateAriaStructure() {
|
|
74
|
+
const element = this._el.nativeElement;
|
|
75
|
+
const isButton = element.tagName === 'BUTTON';
|
|
76
|
+
const hasButtonRole = element.getAttribute('role') === 'button';
|
|
77
|
+
if (!isButton && !hasButtonRole) {
|
|
78
|
+
throw Error(`BrnAccordionTrigger: The trigger element must be a <button> or have role="button". ` +
|
|
79
|
+
`Found: <${element.tagName.toLowerCase()}>`);
|
|
80
|
+
}
|
|
81
|
+
const parent = element.parentElement;
|
|
82
|
+
if (!parent) {
|
|
83
|
+
throw Error('BrnAccordionTrigger: The trigger button must be wrapped in a heading element.');
|
|
84
|
+
}
|
|
85
|
+
const isNativeHeading = /^H[1-6]$/.test(parent.tagName);
|
|
86
|
+
const hasHeadingRole = parent.getAttribute('role') === 'heading';
|
|
87
|
+
if (!isNativeHeading && !hasHeadingRole) {
|
|
88
|
+
throw Error(`BrnAccordionTrigger: The trigger button must be wrapped in a heading element ` +
|
|
89
|
+
`(h1-h6) or an element with role="heading". Found parent: <${parent.tagName.toLowerCase()}>`);
|
|
90
|
+
}
|
|
91
|
+
if (hasHeadingRole && !parent.hasAttribute('aria-level')) {
|
|
92
|
+
throw Error('BrnAccordionTrigger: Elements with role="heading" must have an aria-level attribute.');
|
|
93
|
+
}
|
|
73
94
|
}
|
|
74
95
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAccordionTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
75
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: BrnAccordionTrigger, isStandalone: true, selector: "[brnAccordionTrigger]", host: {
|
|
96
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: BrnAccordionTrigger, isStandalone: true, selector: "[brnAccordionTrigger]", host: { listeners: { "click": "toggle($event)", "keyup.space": "toggle($event)", "keyup.enter": "toggle($event)" }, properties: { "attr.data-state": "state()", "attr.aria-expanded": "state() === \"open\"", "attr.aria-controls": "ariaControls", "id": "id", "attr.role": "\"button\"" } }, ngImport: i0 });
|
|
76
97
|
}
|
|
77
98
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAccordionTrigger, decorators: [{
|
|
78
99
|
type: Directive,
|
|
@@ -82,9 +103,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
82
103
|
'[attr.data-state]': 'state()',
|
|
83
104
|
'[attr.aria-expanded]': 'state() === "open"',
|
|
84
105
|
'[attr.aria-controls]': 'ariaControls',
|
|
85
|
-
role: 'heading',
|
|
86
|
-
'aria-level': '3',
|
|
87
106
|
'[id]': 'id',
|
|
107
|
+
'[attr.role]': '"button"',
|
|
88
108
|
},
|
|
89
109
|
}]
|
|
90
110
|
}], ctorParameters: () => [], propDecorators: { toggle: [{
|
|
@@ -107,11 +127,25 @@ const HORIZONTAL_KEYS_TO_PREVENT_DEFAULT = [
|
|
|
107
127
|
' ',
|
|
108
128
|
'Enter',
|
|
109
129
|
];
|
|
110
|
-
const VERTICAL_KEYS_TO_PREVENT_DEFAULT = [
|
|
130
|
+
const VERTICAL_KEYS_TO_PREVENT_DEFAULT = [
|
|
131
|
+
'ArrowUp',
|
|
132
|
+
'ArrowDown',
|
|
133
|
+
'PageDown',
|
|
134
|
+
'PageUp',
|
|
135
|
+
'Home',
|
|
136
|
+
'End',
|
|
137
|
+
' ',
|
|
138
|
+
'Enter',
|
|
139
|
+
];
|
|
111
140
|
class BrnAccordion {
|
|
112
|
-
_el = inject(ElementRef);
|
|
113
|
-
_keyManager;
|
|
141
|
+
_el = inject((ElementRef));
|
|
114
142
|
_focusMonitor = inject(FocusMonitor);
|
|
143
|
+
_keyManager = computed(() => new FocusKeyManager(this.triggers())
|
|
144
|
+
.withHomeAndEnd()
|
|
145
|
+
.withPageUpDown()
|
|
146
|
+
.withWrap()
|
|
147
|
+
.withHorizontalOrientation(this.orientation() === 'vertical' ? null : (this.dir() ?? 'ltr'))
|
|
148
|
+
.withVerticalOrientation(this.orientation() === 'vertical'));
|
|
115
149
|
_focused = signal(false);
|
|
116
150
|
_openItemIds = signal([]);
|
|
117
151
|
openItemIds = this._openItemIds.asReadonly();
|
|
@@ -133,18 +167,10 @@ class BrnAccordion {
|
|
|
133
167
|
*/
|
|
134
168
|
orientation = input('vertical');
|
|
135
169
|
ngAfterContentInit() {
|
|
136
|
-
this._keyManager = new FocusKeyManager(this.triggers())
|
|
137
|
-
.withHomeAndEnd()
|
|
138
|
-
.withPageUpDown()
|
|
139
|
-
.withWrap();
|
|
140
|
-
if (this.orientation() === 'horizontal') {
|
|
141
|
-
this._keyManager.withHorizontalOrientation(this.dir() ?? 'ltr').withVerticalOrientation(false);
|
|
142
|
-
}
|
|
143
170
|
this._el.nativeElement.addEventListener('keydown', (event) => {
|
|
144
|
-
|
|
145
|
-
if (target.tagName === 'INPUT')
|
|
171
|
+
if (this.shouldIgnoreEvent(event))
|
|
146
172
|
return;
|
|
147
|
-
this._keyManager?.onKeydown(event);
|
|
173
|
+
this._keyManager()?.onKeydown(event);
|
|
148
174
|
this.preventDefaultEvents(event);
|
|
149
175
|
});
|
|
150
176
|
this._focusMonitor.monitor(this._el, true).subscribe((origin) => this._focused.set(origin !== null));
|
|
@@ -153,7 +179,7 @@ class BrnAccordion {
|
|
|
153
179
|
this._focusMonitor.stopMonitoring(this._el);
|
|
154
180
|
}
|
|
155
181
|
setActiveItem(item) {
|
|
156
|
-
this._keyManager?.setActiveItem(item);
|
|
182
|
+
this._keyManager()?.setActiveItem(item);
|
|
157
183
|
}
|
|
158
184
|
toggleItem(id) {
|
|
159
185
|
if (this._openItemIds().includes(id)) {
|
|
@@ -167,12 +193,38 @@ class BrnAccordion {
|
|
|
167
193
|
this._openItemIds.set([id]);
|
|
168
194
|
return;
|
|
169
195
|
}
|
|
170
|
-
this._openItemIds.update((ids) => [...ids, id]);
|
|
196
|
+
this._openItemIds.update((ids) => (ids.includes(id) ? ids : [...ids, id]));
|
|
171
197
|
}
|
|
172
198
|
closeItem(id) {
|
|
173
|
-
this._openItemIds.update((ids) => ids.filter((openId) =>
|
|
199
|
+
this._openItemIds.update((ids) => ids.filter((openId) => openId !== id));
|
|
200
|
+
}
|
|
201
|
+
isEditableTarget(el) {
|
|
202
|
+
const node = el;
|
|
203
|
+
if (!node)
|
|
204
|
+
return false;
|
|
205
|
+
const tag = node.tagName;
|
|
206
|
+
if (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT')
|
|
207
|
+
return true;
|
|
208
|
+
if (node.isContentEditable)
|
|
209
|
+
return true;
|
|
210
|
+
const role = node.getAttribute?.('role') ?? '';
|
|
211
|
+
if (/^(textbox|searchbox|combobox|listbox|grid|tree|menu|spinbutton|slider)$/.test(role))
|
|
212
|
+
return true;
|
|
213
|
+
const editableAncestor = node.closest?.('input, textarea, select, [contenteditable=""], [contenteditable="true"], ' +
|
|
214
|
+
'[role="textbox"], [role="searchbox"], [role="combobox"], [role="listbox"], ' +
|
|
215
|
+
'[role="grid"], [role="tree"], [role="menu"], [role="spinbutton"], [role="slider"]');
|
|
216
|
+
return !!editableAncestor;
|
|
217
|
+
}
|
|
218
|
+
shouldIgnoreEvent(e) {
|
|
219
|
+
if (e.defaultPrevented)
|
|
220
|
+
return true; // another handler already acted
|
|
221
|
+
if (e.ctrlKey || e.metaKey || e.altKey)
|
|
222
|
+
return true; // let shortcuts through
|
|
223
|
+
return this.isEditableTarget(e.target); // don't steal from editable/ARIA widgets
|
|
174
224
|
}
|
|
175
225
|
preventDefaultEvents(event) {
|
|
226
|
+
if (event.defaultPrevented)
|
|
227
|
+
return;
|
|
176
228
|
if (!this._focused())
|
|
177
229
|
return;
|
|
178
230
|
if (!('key' in event))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spartan-ng-brain-accordion.mjs","sources":["../../../../libs/brain/accordion/src/lib/brn-accordion.ts","../../../../libs/brain/accordion/src/lib/brn-accordion-content.ts","../../../../libs/brain/accordion/src/index.ts","../../../../libs/brain/accordion/src/spartan-ng-brain-accordion.ts"],"sourcesContent":["import { FocusKeyManager, FocusMonitor } from '@angular/cdk/a11y';\nimport { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';\nimport {\n\ttype AfterContentInit,\n\tDirective,\n\tElementRef,\n\tHostListener,\n\ttype OnDestroy,\n\tcomputed,\n\tcontentChildren,\n\teffect,\n\tinject,\n\tinput,\n\tsignal,\n\tuntracked,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { fromEvent } from 'rxjs';\n\n@Directive({\n\tselector: '[brnAccordionItem]',\n\thost: {\n\t\t'[attr.data-state]': 'state()',\n\t},\n\texportAs: 'brnAccordionItem',\n})\nexport class BrnAccordionItem {\n\tprivate static _itemIdGenerator = 0;\n\tprivate readonly _accordion = inject(BrnAccordion);\n\t/**\n\t * Whether the accordion item is opened or closed.\n\t * @default false\n\t */\n\tpublic readonly isOpened = input<boolean, BooleanInput>(false, { transform: coerceBooleanProperty });\n\n\tpublic readonly id = ++BrnAccordionItem._itemIdGenerator;\n\tpublic readonly state = computed(() => (this._accordion.openItemIds().includes(this.id) ? 'open' : 'closed'));\n\n\tconstructor() {\n\t\tif (!this._accordion) {\n\t\t\tthrow Error('Accordion trigger can only be used inside an Accordion. Add brnAccordion to ancestor.');\n\t\t}\n\t\teffect(() => {\n\t\t\tconst isOpened = this.isOpened();\n\t\t\tuntracked(() => {\n\t\t\t\tif (isOpened) {\n\t\t\t\t\tthis._accordion.openItem(this.id);\n\t\t\t\t} else {\n\t\t\t\t\tthis._accordion.closeItem(this.id);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n}\n\n@Directive({\n\tselector: '[brnAccordionTrigger]',\n\thost: {\n\t\t'[attr.data-state]': 'state()',\n\t\t'[attr.aria-expanded]': 'state() === \"open\"',\n\t\t'[attr.aria-controls]': 'ariaControls',\n\t\trole: 'heading',\n\t\t'aria-level': '3',\n\t\t'[id]': 'id',\n\t},\n})\nexport class BrnAccordionTrigger {\n\tprivate readonly _accordion = inject(BrnAccordion);\n\tprivate readonly _item = inject(BrnAccordionItem);\n\tprivate readonly _elementRef = inject(ElementRef);\n\n\tpublic readonly state = this._item.state;\n\tpublic readonly id = `brn-accordion-trigger-${this._item.id}`;\n\tpublic readonly ariaControls = `brn-accordion-content-${this._item.id}`;\n\n\tconstructor() {\n\t\tif (!this._accordion) {\n\t\t\tthrow Error('Accordion trigger can only be used inside an Accordion. Add brnAccordion to ancestor.');\n\t\t}\n\n\t\tif (!this._item) {\n\t\t\tthrow Error('Accordion trigger can only be used inside an AccordionItem. Add brnAccordionItem to parent.');\n\t\t}\n\n\t\tfromEvent(this._elementRef.nativeElement, 'focus')\n\t\t\t.pipe(takeUntilDestroyed())\n\t\t\t.subscribe(() => {\n\t\t\t\tthis._accordion.setActiveItem(this);\n\t\t\t});\n\t}\n\n\t@HostListener('click', ['$event'])\n\t@HostListener('keyup.space', ['$event'])\n\t@HostListener('keyup.enter', ['$event'])\n\tprotected toggle(event: Event): void {\n\t\tevent.preventDefault();\n\t\tthis._accordion.toggleItem(this._item.id);\n\t}\n\n\tpublic focus() {\n\t\tthis._elementRef.nativeElement.focus();\n\t}\n}\n\nconst HORIZONTAL_KEYS_TO_PREVENT_DEFAULT = [\n\t'ArrowLeft',\n\t'ArrowRight',\n\t'PageDown',\n\t'PageUp',\n\t'Home',\n\t'End',\n\t' ',\n\t'Enter',\n];\nconst VERTICAL_KEYS_TO_PREVENT_DEFAULT = ['ArrowUp', 'ArrowDown', 'PageDown', 'PageUp', 'Home', 'End', ' ', 'Enter'];\n\n@Directive({\n\tselector: '[brnAccordion]',\n\thost: {\n\t\t'[attr.data-state]': 'state()',\n\t\t'[attr.data-orientation]': 'orientation()',\n\t},\n\texportAs: 'brnAccordion',\n})\nexport class BrnAccordion implements AfterContentInit, OnDestroy {\n\tprivate readonly _el = inject(ElementRef);\n\tprivate _keyManager?: FocusKeyManager<BrnAccordionTrigger>;\n\tprivate readonly _focusMonitor = inject(FocusMonitor);\n\n\tprivate readonly _focused = signal<boolean>(false);\n\tprivate readonly _openItemIds = signal<number[]>([]);\n\tpublic readonly openItemIds = this._openItemIds.asReadonly();\n\tpublic readonly state = computed(() => (this._openItemIds().length > 0 ? 'open' : 'closed'));\n\n\tpublic triggers = contentChildren(BrnAccordionTrigger, { descendants: true });\n\n\t/**\n\t * Whether the accordion is in single or multiple mode.\n\t * @default 'single'\n\t */\n\tpublic readonly type = input<'single' | 'multiple'>('single');\n\t/**\n\t * The direction of the accordion, either 'ltr' (left-to-right) or 'rtl' (right-to-left).\n\t * @default null\n\t */\n\tpublic readonly dir = input<'ltr' | 'rtl' | null>(null);\n\t/**\n\t * The orientation of the accordion, either 'horizontal' or 'vertical'.\n\t * @default 'vertical'\n\t */\n\tpublic readonly orientation = input<'horizontal' | 'vertical'>('vertical');\n\n\tpublic ngAfterContentInit() {\n\t\tthis._keyManager = new FocusKeyManager<BrnAccordionTrigger>(this.triggers())\n\t\t\t.withHomeAndEnd()\n\t\t\t.withPageUpDown()\n\t\t\t.withWrap();\n\n\t\tif (this.orientation() === 'horizontal') {\n\t\t\tthis._keyManager.withHorizontalOrientation(this.dir() ?? 'ltr').withVerticalOrientation(false);\n\t\t}\n\n\t\tthis._el.nativeElement.addEventListener('keydown', (event: KeyboardEvent) => {\n\t\t\tconst target = event.target as HTMLElement;\n\n\t\t\tif (target.tagName === 'INPUT') return;\n\n\t\t\tthis._keyManager?.onKeydown(event);\n\t\t\tthis.preventDefaultEvents(event);\n\t\t});\n\t\tthis._focusMonitor.monitor(this._el, true).subscribe((origin) => this._focused.set(origin !== null));\n\t}\n\n\tngOnDestroy(): void {\n\t\tthis._focusMonitor.stopMonitoring(this._el);\n\t}\n\n\tpublic setActiveItem(item: BrnAccordionTrigger) {\n\t\tthis._keyManager?.setActiveItem(item);\n\t}\n\n\tpublic toggleItem(id: number) {\n\t\tif (this._openItemIds().includes(id)) {\n\t\t\tthis.closeItem(id);\n\t\t\treturn;\n\t\t}\n\t\tthis.openItem(id);\n\t}\n\n\tpublic openItem(id: number) {\n\t\tif (this.type() === 'single') {\n\t\t\tthis._openItemIds.set([id]);\n\t\t\treturn;\n\t\t}\n\t\tthis._openItemIds.update((ids) => [...ids, id]);\n\t}\n\n\tpublic closeItem(id: number) {\n\t\tthis._openItemIds.update((ids) => ids.filter((openId) => id !== openId));\n\t}\n\n\tprivate preventDefaultEvents(event: KeyboardEvent) {\n\t\tif (!this._focused()) return;\n\t\tif (!('key' in event)) return;\n\n\t\tconst keys =\n\t\t\tthis.orientation() === 'horizontal' ? HORIZONTAL_KEYS_TO_PREVENT_DEFAULT : VERTICAL_KEYS_TO_PREVENT_DEFAULT;\n\t\tif (keys.includes(event.key) && event.code !== 'NumpadEnter') {\n\t\t\tevent.preventDefault();\n\t\t}\n\t}\n}\n","import {\n\tChangeDetectionStrategy,\n\tComponent,\n\tViewEncapsulation,\n\tcomputed,\n\tinject,\n\tinput,\n\tlinkedSignal,\n} from '@angular/core';\nimport type { CustomElementClassSettable } from '@spartan-ng/brain/core';\nimport type { ClassValue } from 'clsx';\nimport { BrnAccordionItem } from './brn-accordion';\n\n@Component({\n\tselector: 'brn-accordion-content',\n\thost: {\n\t\t'[attr.data-state]': 'state()',\n\t\t'[attr.aria-labelledby]': 'ariaLabeledBy',\n\t\trole: 'region',\n\t\t'[id]': 'id',\n\t},\n\ttemplate: `\n\t\t<div [attr.inert]=\"_addInert()\" style=\"overflow: hidden\">\n\t\t\t<p [class]=\"_contentClass()\">\n\t\t\t\t<ng-content />\n\t\t\t</p>\n\t\t</div>\n\t`,\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n\tencapsulation: ViewEncapsulation.None,\n})\nexport class BrnAccordionContent implements CustomElementClassSettable {\n\tprivate readonly _item = inject(BrnAccordionItem);\n\n\tpublic readonly state = this._item.state;\n\tpublic readonly id = `brn-accordion-content-${this._item.id}`;\n\tpublic readonly ariaLabeledBy = `brn-accordion-trigger-${this._item.id}`;\n\n\tprotected readonly _addInert = computed(() => (this.state() === 'closed' ? true : undefined));\n\t/**\n\t * The class to be applied to the content element.\n\t */\n\tpublic readonly contentClass = input<ClassValue>('');\n\n\tprotected readonly _contentClass = linkedSignal(() => this.contentClass());\n\n\tconstructor() {\n\t\tif (!this._item) {\n\t\t\tthrow Error('Accordion Content can only be used inside an AccordionItem. Add brnAccordionItem to parent.');\n\t\t}\n\t}\n\n\tpublic setClassToCustomElement(classes: ClassValue) {\n\t\tthis._contentClass.set(classes);\n\t}\n}\n","import { NgModule } from '@angular/core';\n\nimport { BrnAccordion, BrnAccordionItem, BrnAccordionTrigger } from './lib/brn-accordion';\nimport { BrnAccordionContent } from './lib/brn-accordion-content';\n\nexport * from './lib/brn-accordion';\nexport * from './lib/brn-accordion-content';\n\nexport const BrnAccordionImports = [BrnAccordion, BrnAccordionContent, BrnAccordionItem, BrnAccordionTrigger] as const;\n\n@NgModule({\n\timports: [...BrnAccordionImports],\n\texports: [...BrnAccordionImports],\n})\nexport class BrnAccordionModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MA0Ba,gBAAgB,CAAA;AACpB,IAAA,OAAO,gBAAgB,GAAG,CAAC;AAClB,IAAA,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC;AAClD;;;AAGG;IACa,QAAQ,GAAG,KAAK,CAAwB,KAAK,EAAE,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAAC;AAEpF,IAAA,EAAE,GAAG,EAAE,gBAAgB,CAAC,gBAAgB;AACxC,IAAA,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,MAAM,GAAG,QAAQ,CAAC,CAAC;AAE7G,IAAA,WAAA,GAAA;AACC,QAAA,IAAI,CAAC,IAAI,CAAC,UAAU,EA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,EAAE,QAAQ;AACd,wBAAA,MAAM,EAAE,IAAI;AACZ,qBAAA;AACD,oBAAA,QAAQ,EAAE;;;;;;AAMT,CAAA,CAAA;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,aAAa,EAAE,iBAAiB,CAAC,IAAI;AACrC,iBAAA;;;ACtBM,MAAM,mBAAmB,GAAG,CAAC,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,mBAAmB;MAM/F,kBAAkB,CAAA;0HAAlB,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;AAAlB,uBAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,EAAA,OAAA,EAAA,CANK,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,mBAAmB,CAAA,EAAA,OAAA,EAAA,CAAxE,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,mBAAmB,CAAA,EAAA,CAAA;2HAM/F,kBAAkB,EAAA,CAAA;;2FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,OAAO,EAAE,CAAC,GAAG,mBAAmB,CAAC;AACjC,oBAAA,OAAO,EAAE,CAAC,GAAG,mBAAmB,CAAC;AACjC,iBAAA;;;ACbD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"spartan-ng-brain-accordion.mjs","sources":["../../../../libs/brain/accordion/src/lib/brn-accordion.ts","../../../../libs/brain/accordion/src/lib/brn-accordion-content.ts","../../../../libs/brain/accordion/src/index.ts","../../../../libs/brain/accordion/src/spartan-ng-brain-accordion.ts"],"sourcesContent":["import { FocusableOption, FocusKeyManager, FocusMonitor } from '@angular/cdk/a11y';\nimport { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';\nimport {\n\ttype AfterContentInit,\n\tcomputed,\n\tcontentChildren,\n\tDirective,\n\teffect,\n\tElementRef,\n\tHostListener,\n\tinject,\n\tinput,\n\ttype OnDestroy,\n\tsignal,\n\tuntracked,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { fromEvent } from 'rxjs';\n\n@Directive({\n\tselector: '[brnAccordionItem]',\n\thost: {\n\t\t'[attr.data-state]': 'state()',\n\t},\n\texportAs: 'brnAccordionItem',\n})\nexport class BrnAccordionItem {\n\tprivate static _itemIdGenerator = 0;\n\tpublic readonly id = ++BrnAccordionItem._itemIdGenerator;\n\tprivate readonly _accordion = inject(BrnAccordion);\n\t/**\n\t * Whether the accordion item is opened or closed.\n\t * @default false\n\t */\n\tpublic readonly isOpened = input<boolean, BooleanInput>(false, { transform: coerceBooleanProperty });\n\tpublic readonly state = computed(() => (this._accordion.openItemIds().includes(this.id) ? 'open' : 'closed'));\n\n\tconstructor() {\n\t\tif (!this._accordion) {\n\t\t\tthrow Error('Accordion item can only be used inside an Accordion. Add brnAccordion to ancestor.');\n\t\t}\n\t\teffect(() => {\n\t\t\tconst isOpened = this.isOpened();\n\t\t\tuntracked(() => {\n\t\t\t\tif (isOpened) {\n\t\t\t\t\tthis._accordion.openItem(this.id);\n\t\t\t\t} else {\n\t\t\t\t\tthis._accordion.closeItem(this.id);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n}\n\n@Directive({\n\tselector: '[brnAccordionTrigger]',\n\thost: {\n\t\t'[attr.data-state]': 'state()',\n\t\t'[attr.aria-expanded]': 'state() === \"open\"',\n\t\t'[attr.aria-controls]': 'ariaControls',\n\t\t'[id]': 'id',\n\t\t'[attr.role]': '\"button\"',\n\t},\n})\nexport class BrnAccordionTrigger implements FocusableOption {\n\tprivate readonly _accordion = inject(BrnAccordion);\n\tprivate readonly _item = inject(BrnAccordionItem);\n\tprivate readonly _el = inject(ElementRef<HTMLElement>);\n\n\tpublic readonly state = this._item.state;\n\tpublic readonly id = `brn-accordion-trigger-${this._item.id}`;\n\tpublic readonly ariaControls = `brn-accordion-content-${this._item.id}`;\n\tconstructor() {\n\t\tif (!this._accordion) throw Error('Accordion trigger requires a parent Accordion.');\n\t\tif (!this._item) throw Error('Accordion trigger requires a parent AccordionItem.');\n\t\tthis.validateAriaStructure();\n\n\t\tfromEvent(this._el.nativeElement, 'focus')\n\t\t\t.pipe(takeUntilDestroyed())\n\t\t\t.subscribe(() => {\n\t\t\t\tthis._accordion.setActiveItem(this);\n\t\t\t});\n\t}\n\n\t@HostListener('click', ['$event'])\n\t@HostListener('keyup.space', ['$event'])\n\t@HostListener('keyup.enter', ['$event'])\n\tprotected toggle(event: Event): void {\n\t\tevent.preventDefault();\n\t\tthis._accordion.toggleItem(this._item.id);\n\t}\n\n\tpublic focus() {\n\t\tthis._el.nativeElement.focus();\n\t}\n\n\tprivate validateAriaStructure(): void {\n\t\tconst element = this._el.nativeElement;\n\n\t\tconst isButton = element.tagName === 'BUTTON';\n\t\tconst hasButtonRole = element.getAttribute('role') === 'button';\n\n\t\tif (!isButton && !hasButtonRole) {\n\t\t\tthrow Error(\n\t\t\t\t`BrnAccordionTrigger: The trigger element must be a <button> or have role=\"button\". ` +\n\t\t\t\t\t`Found: <${element.tagName.toLowerCase()}>`,\n\t\t\t);\n\t\t}\n\n\t\tconst parent = element.parentElement;\n\t\tif (!parent) {\n\t\t\tthrow Error('BrnAccordionTrigger: The trigger button must be wrapped in a heading element.');\n\t\t}\n\n\t\tconst isNativeHeading = /^H[1-6]$/.test(parent.tagName);\n\t\tconst hasHeadingRole = parent.getAttribute('role') === 'heading';\n\n\t\tif (!isNativeHeading && !hasHeadingRole) {\n\t\t\tthrow Error(\n\t\t\t\t`BrnAccordionTrigger: The trigger button must be wrapped in a heading element ` +\n\t\t\t\t\t`(h1-h6) or an element with role=\"heading\". Found parent: <${parent.tagName.toLowerCase()}>`,\n\t\t\t);\n\t\t}\n\n\t\tif (hasHeadingRole && !parent.hasAttribute('aria-level')) {\n\t\t\tthrow Error('BrnAccordionTrigger: Elements with role=\"heading\" must have an aria-level attribute.');\n\t\t}\n\t}\n}\n\nconst HORIZONTAL_KEYS_TO_PREVENT_DEFAULT = [\n\t'ArrowLeft',\n\t'ArrowRight',\n\t'PageDown',\n\t'PageUp',\n\t'Home',\n\t'End',\n\t' ',\n\t'Enter',\n] as const;\n\nconst VERTICAL_KEYS_TO_PREVENT_DEFAULT = [\n\t'ArrowUp',\n\t'ArrowDown',\n\t'PageDown',\n\t'PageUp',\n\t'Home',\n\t'End',\n\t' ',\n\t'Enter',\n] as const;\n\n@Directive({\n\tselector: '[brnAccordion]',\n\thost: {\n\t\t'[attr.data-state]': 'state()',\n\t\t'[attr.data-orientation]': 'orientation()',\n\t},\n\texportAs: 'brnAccordion',\n})\nexport class BrnAccordion implements AfterContentInit, OnDestroy {\n\tprivate readonly _el = inject(ElementRef<HTMLElement>);\n\tprivate readonly _focusMonitor = inject(FocusMonitor);\n\tprivate readonly _keyManager = computed(() =>\n\t\tnew FocusKeyManager<BrnAccordionTrigger>(this.triggers())\n\t\t\t.withHomeAndEnd()\n\t\t\t.withPageUpDown()\n\t\t\t.withWrap()\n\t\t\t.withHorizontalOrientation(this.orientation() === 'vertical' ? null : (this.dir() ?? 'ltr'))\n\t\t\t.withVerticalOrientation(this.orientation() === 'vertical'),\n\t);\n\n\tprivate readonly _focused = signal<boolean>(false);\n\tprivate readonly _openItemIds = signal<number[]>([]);\n\tpublic readonly openItemIds = this._openItemIds.asReadonly();\n\tpublic readonly state = computed(() => (this._openItemIds().length > 0 ? 'open' : 'closed'));\n\n\tpublic triggers = contentChildren(BrnAccordionTrigger, { descendants: true });\n\n\t/**\n\t * Whether the accordion is in single or multiple mode.\n\t * @default 'single'\n\t */\n\tpublic readonly type = input<'single' | 'multiple'>('single');\n\t/**\n\t * The direction of the accordion, either 'ltr' (left-to-right) or 'rtl' (right-to-left).\n\t * @default null\n\t */\n\tpublic readonly dir = input<'ltr' | 'rtl' | null>(null);\n\t/**\n\t * The orientation of the accordion, either 'horizontal' or 'vertical'.\n\t * @default 'vertical'\n\t */\n\tpublic readonly orientation = input<'horizontal' | 'vertical'>('vertical');\n\n\tpublic ngAfterContentInit() {\n\t\tthis._el.nativeElement.addEventListener('keydown', (event: KeyboardEvent) => {\n\t\t\tif (this.shouldIgnoreEvent(event)) return;\n\t\t\tthis._keyManager()?.onKeydown(event);\n\t\t\tthis.preventDefaultEvents(event);\n\t\t});\n\t\tthis._focusMonitor.monitor(this._el, true).subscribe((origin) => this._focused.set(origin !== null));\n\t}\n\n\tngOnDestroy(): void {\n\t\tthis._focusMonitor.stopMonitoring(this._el);\n\t}\n\n\tpublic setActiveItem(item: BrnAccordionTrigger) {\n\t\tthis._keyManager()?.setActiveItem(item);\n\t}\n\n\tpublic toggleItem(id: number) {\n\t\tif (this._openItemIds().includes(id)) {\n\t\t\tthis.closeItem(id);\n\t\t\treturn;\n\t\t}\n\t\tthis.openItem(id);\n\t}\n\n\tpublic openItem(id: number) {\n\t\tif (this.type() === 'single') {\n\t\t\tthis._openItemIds.set([id]);\n\t\t\treturn;\n\t\t}\n\t\tthis._openItemIds.update((ids) => (ids.includes(id) ? ids : [...ids, id]));\n\t}\n\n\tpublic closeItem(id: number) {\n\t\tthis._openItemIds.update((ids) => ids.filter((openId) => openId !== id));\n\t}\n\n\tprivate isEditableTarget(el: EventTarget | null): boolean {\n\t\tconst node = el as HTMLElement | null;\n\t\tif (!node) return false;\n\n\t\tconst tag = node.tagName;\n\t\tif (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT') return true;\n\t\tif (node.isContentEditable) return true;\n\n\t\tconst role = node.getAttribute?.('role') ?? '';\n\t\tif (/^(textbox|searchbox|combobox|listbox|grid|tree|menu|spinbutton|slider)$/.test(role)) return true;\n\n\t\tconst editableAncestor = node.closest?.(\n\t\t\t'input, textarea, select, [contenteditable=\"\"], [contenteditable=\"true\"], ' +\n\t\t\t\t'[role=\"textbox\"], [role=\"searchbox\"], [role=\"combobox\"], [role=\"listbox\"], ' +\n\t\t\t\t'[role=\"grid\"], [role=\"tree\"], [role=\"menu\"], [role=\"spinbutton\"], [role=\"slider\"]',\n\t\t);\n\t\treturn !!editableAncestor;\n\t}\n\n\tprivate shouldIgnoreEvent(e: KeyboardEvent): boolean {\n\t\tif (e.defaultPrevented) return true; // another handler already acted\n\t\tif (e.ctrlKey || e.metaKey || e.altKey) return true; // let shortcuts through\n\t\treturn this.isEditableTarget(e.target); // don't steal from editable/ARIA widgets\n\t}\n\n\tprivate preventDefaultEvents(event: KeyboardEvent) {\n\t\tif (event.defaultPrevented) return;\n\t\tif (!this._focused()) return;\n\t\tif (!('key' in event)) return;\n\n\t\tconst keys: readonly string[] =\n\t\t\tthis.orientation() === 'horizontal' ? HORIZONTAL_KEYS_TO_PREVENT_DEFAULT : VERTICAL_KEYS_TO_PREVENT_DEFAULT;\n\n\t\tif (keys.includes(event.key) && event.code !== 'NumpadEnter') {\n\t\t\tevent.preventDefault();\n\t\t}\n\t}\n}\n","import {\n\tChangeDetectionStrategy,\n\tComponent,\n\tViewEncapsulation,\n\tcomputed,\n\tinject,\n\tinput,\n\tlinkedSignal,\n} from '@angular/core';\nimport type { CustomElementClassSettable } from '@spartan-ng/brain/core';\nimport type { ClassValue } from 'clsx';\nimport { BrnAccordionItem } from './brn-accordion';\n\n@Component({\n\tselector: 'brn-accordion-content',\n\thost: {\n\t\t'[attr.data-state]': 'state()',\n\t\t'[attr.aria-labelledby]': 'ariaLabeledBy',\n\t\trole: 'region',\n\t\t'[id]': 'id',\n\t},\n\ttemplate: `\n\t\t<div [attr.inert]=\"_addInert()\" style=\"overflow: hidden\">\n\t\t\t<p [class]=\"_contentClass()\">\n\t\t\t\t<ng-content />\n\t\t\t</p>\n\t\t</div>\n\t`,\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n\tencapsulation: ViewEncapsulation.None,\n})\nexport class BrnAccordionContent implements CustomElementClassSettable {\n\tprivate readonly _item = inject(BrnAccordionItem);\n\n\tpublic readonly state = this._item.state;\n\tpublic readonly id = `brn-accordion-content-${this._item.id}`;\n\tpublic readonly ariaLabeledBy = `brn-accordion-trigger-${this._item.id}`;\n\n\tprotected readonly _addInert = computed(() => (this.state() === 'closed' ? true : undefined));\n\t/**\n\t * The class to be applied to the content element.\n\t */\n\tpublic readonly contentClass = input<ClassValue>('');\n\n\tprotected readonly _contentClass = linkedSignal(() => this.contentClass());\n\n\tconstructor() {\n\t\tif (!this._item) {\n\t\t\tthrow Error('Accordion Content can only be used inside an AccordionItem. Add brnAccordionItem to parent.');\n\t\t}\n\t}\n\n\tpublic setClassToCustomElement(classes: ClassValue) {\n\t\tthis._contentClass.set(classes);\n\t}\n}\n","import { NgModule } from '@angular/core';\n\nimport { BrnAccordion, BrnAccordionItem, BrnAccordionTrigger } from './lib/brn-accordion';\nimport { BrnAccordionContent } from './lib/brn-accordion-content';\n\nexport * from './lib/brn-accordion';\nexport * from './lib/brn-accordion-content';\n\nexport const BrnAccordionImports = [BrnAccordion, BrnAccordionContent, BrnAccordionItem, BrnAccordionTrigger] as const;\n\n@NgModule({\n\timports: [...BrnAccordionImports],\n\texports: [...BrnAccordionImports],\n})\nexport class BrnAccordionModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MA0Ba,gBAAgB,CAAA;AACpB,IAAA,OAAO,gBAAgB,GAAG,CAAC;AACnB,IAAA,EAAE,GAAG,EAAE,gBAAgB,CAAC,gBAAgB;AACvC,IAAA,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC;AAClD;;;AAGG;IACa,QAAQ,GAAG,KAAK,CAAwB,KAAK,EAAE,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAAC;AACpF,IAAA,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CA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CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,EAAA,OAAA,EAAA,CANK,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,mBAAmB,CAAA,EAAA,OAAA,EAAA,CAAxE,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,mBAAmB,CAAA,EAAA,CAAA;2HAM/F,kBAAkB,EAAA,CAAA;;2FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,OAAO,EAAE,CAAC,GAAG,mBAAmB,CAAC;AACjC,oBAAA,OAAO,EAAE,CAAC,GAAG,mBAAmB,CAAC;AACjC,iBAAA;;;ACbD;;AAEG;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { forwardRef, inject, DestroyRef, Renderer2, ElementRef, ChangeDetectorRef, PLATFORM_ID, signal, model, computed, input, linkedSignal, booleanAttribute, viewChild,
|
|
2
|
+
import { forwardRef, inject, DestroyRef, Renderer2, ElementRef, ChangeDetectorRef, PLATFORM_ID, signal, model, output, computed, input, linkedSignal, booleanAttribute, viewChild, effect, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
|
|
3
3
|
import { FocusMonitor } from '@angular/cdk/a11y';
|
|
4
4
|
import { DOCUMENT, isPlatformBrowser } from '@angular/common';
|
|
5
5
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
@@ -28,6 +28,8 @@ class BrnCheckbox {
|
|
|
28
28
|
* Can be bound with [(checked)] for two-way binding.
|
|
29
29
|
*/
|
|
30
30
|
checked = model(false);
|
|
31
|
+
/** Emits when checked state changes. */
|
|
32
|
+
checkedChange = output();
|
|
31
33
|
/**
|
|
32
34
|
* Read-only signal of current checkbox state.
|
|
33
35
|
* Use this when you only need to read state without changing it.
|
|
@@ -157,6 +159,7 @@ class BrnCheckbox {
|
|
|
157
159
|
this.checked.set(previousChecked === 'indeterminate' ? true : !previousChecked);
|
|
158
160
|
this._onChange(this.checked());
|
|
159
161
|
this.changed.emit(this.checked());
|
|
162
|
+
this.checkedChange.emit(this.checked());
|
|
160
163
|
}
|
|
161
164
|
ngAfterContentInit() {
|
|
162
165
|
this._focusMonitor
|
|
@@ -242,7 +245,7 @@ class BrnCheckbox {
|
|
|
242
245
|
this._cdr.markForCheck();
|
|
243
246
|
}
|
|
244
247
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCheckbox, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
245
|
-
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.8", type: BrnCheckbox, isStandalone: true, selector: "brn-checkbox", 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 } }, 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": "_dataState()", "attr.data-focus-visible": "_focusVisible()", "attr.data-focus": "_focused()", "attr.data-disabled": "_state().disabled()" } }, providers: [BRN_CHECKBOX_VALUE_ACCESSOR], viewQueries: [{ propertyName: "checkbox", first: true, predicate: ["checkBox"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
248
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.8", type: BrnCheckbox, isStandalone: true, selector: "brn-checkbox", 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 } }, outputs: { checked: "checkedChange", checkedChange: "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": "_dataState()", "attr.data-focus-visible": "_focusVisible()", "attr.data-focus": "_focused()", "attr.data-disabled": "_state().disabled()" } }, providers: [BRN_CHECKBOX_VALUE_ACCESSOR], viewQueries: [{ propertyName: "checkbox", first: true, predicate: ["checkBox"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
246
249
|
<button
|
|
247
250
|
#checkBox
|
|
248
251
|
role="checkbox"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spartan-ng-brain-checkbox.mjs","sources":["../../../../libs/brain/checkbox/src/lib/brn-checkbox.ts","../../../../libs/brain/checkbox/src/index.ts","../../../../libs/brain/checkbox/src/spartan-ng-brain-checkbox.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\tChangeDetectionStrategy,\n\tChangeDetectorRef,\n\tComponent,\n\tDestroyRef,\n\tElementRef,\n\ttype OnDestroy,\n\tPLATFORM_ID,\n\tRenderer2,\n\tbooleanAttribute,\n\tcomputed,\n\teffect,\n\tforwardRef,\n\tinject,\n\tinput,\n\tlinkedSignal,\n\tmodel,\n\toutput,\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_CHECKBOX_VALUE_ACCESSOR = {\n\tprovide: NG_VALUE_ACCESSOR,\n\tuseExisting: forwardRef(() => BrnCheckbox),\n\tmulti: true,\n};\n\nlet uniqueIdCounter = 0;\n\nconst CONTAINER_POST_FIX = '-checkbox';\n\n@Component({\n\tselector: 'brn-checkbox',\n\ttemplate: `\n\t\t<button\n\t\t\t#checkBox\n\t\t\trole=\"checkbox\"\n\t\t\ttype=\"button\"\n\t\t\t[id]=\"getCheckboxButtonId(_state().id) ?? ''\"\n\t\t\t[name]=\"getCheckboxButtonId(_state().name) ?? ''\"\n\t\t\t[class]=\"class()\"\n\t\t\t[attr.aria-checked]=\"_ariaChecked()\"\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]=\"_dataState()\"\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]=\"_state().disabled() ? -1 : 0\"\n\t\t\t(click)=\"$event.preventDefault(); toggle()\"\n\t\t>\n\t\t\t<ng-content />\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]': '_dataState()',\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_CHECKBOX_VALUE_ACCESSOR],\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BrnCheckbox implements ControlValueAccessor, AfterContentInit, OnDestroy {\n\tprivate readonly _destroyRef = inject(DestroyRef);\n\tprivate readonly _renderer = inject(Renderer2);\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\tprivate readonly _isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n\tprotected readonly _focusVisible = signal(false);\n\tprotected readonly _focused = signal(false);\n\n\t/**\n\t * Current checked state of checkbox.\n\t * Can be boolean (true/false) or 'indeterminate'.\n\t * Can be bound with [(checked)] for two-way binding.\n\t */\n\tpublic readonly checked = model<BrnCheckboxValue>(false);\n\n\t/**\n\t * Read-only signal of current checkbox state.\n\t * Use this when you only need to read state without changing it.\n\t */\n\tpublic readonly isChecked = this.checked.asReadonly();\n\n\t/**\n\t * Computed data-state attribute value based on checked state.\n\t * Returns 'checked', 'unchecked', or 'indeterminate'.\n\t */\n\tprotected readonly _dataState = computed(() => {\n\t\tconst checked = this.checked();\n\t\tif (checked === 'indeterminate') return 'indeterminate';\n\t\treturn checked ? 'checked' : 'unchecked';\n\t});\n\n\t/**\n\t * Computed aria-checked attribute value for accessibility.\n\t * Returns 'true', 'false', or 'mixed' (for indeterminate).\n\t */\n\tprotected readonly _ariaChecked = computed(() => {\n\t\tconst checked = this.checked();\n\t\tif (checked === 'indeterminate') return 'mixed';\n\t\treturn checked ? 'true' : 'false';\n\t});\n\n\t/**\n\t * Unique identifier for checkbox component.\n\t * When provided, inner button gets ID without '-checkbox' 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 checkbox.\n\t * When provided, inner button gets name without '-checkbox' 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 checkbox for accessibility.\n\t * Auto-set when checkbox 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 checkbox for accessibility.\n\t */\n\tpublic readonly ariaDescribedby = input<string | null>(null, { alias: 'aria-describedby' });\n\n\t/**\n\t * Whether checkbox is required in a form.\n\t */\n\tpublic readonly required = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\t/**\n\t * Whether checkbox is disabled.\n\t * Disabled checkboxes cannot be toggled and indicate disabled state through data-disabled attribute.\n\t */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\t/**\n\t * Computed state for checkbox container and accessibility.\n\t * Manages ID, name, and disabled state.\n\t */\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\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\tprotected _onChange: ChangeFn<BrnCheckboxValue> = () => {};\n\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\tprivate _onTouched: TouchFn = () => {};\n\n\t/**\n\t * Reference to the checkbox button element in the template.\n\t */\n\tpublic readonly checkbox = viewChild.required<ElementRef<HTMLButtonElement>>('checkBox');\n\n\t/**\n\t * Event emitted when checkbox value changes.\n\t * Emits new checked state (true/false/'indeterminate').\n\t */\n\tpublic readonly changed = output<BrnCheckboxValue>();\n\n\t/**\n\t * Event emitted when checkbox is blurred (loses focus).\n\t * Used for form validation.\n\t */\n\tpublic readonly touched = output<void>();\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 checkboxButtonId = this.getCheckboxButtonId(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=\"${checkboxButtonId}\"]`);\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 checkbox between checked/unchecked states.\n\t * If checkbox is indeterminate, sets to checked.\n\t * Does nothing if checkbox is disabled.\n\t */\n\ttoggle() {\n\t\tif (this._state().disabled()) return;\n\n\t\tthis._onTouched();\n\t\tthis.touched.emit();\n\n\t\tconst previousChecked = this.checked();\n\t\tthis.checked.set(previousChecked === 'indeterminate' ? true : !previousChecked);\n\t\tthis._onChange(this.checked());\n\t\tthis.changed.emit(this.checked());\n\t}\n\n\tngAfterContentInit() {\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\t}\n\n\tngOnDestroy() {\n\t\tthis._focusMonitor.stopMonitoring(this._elementRef);\n\t}\n\n\t/**\n\t * Gets proper ID for inner button element.\n\t * Removes '-checkbox' 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 getCheckboxButtonId(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 * Handles boolean and 'indeterminate' values.\n\t * Part of ControlValueAccessor interface.\n\t *\n\t * @param value - New checkbox state (true/false/'indeterminate')\n\t */\n\twriteValue(value: BrnCheckboxValue): void {\n\t\tif (value === 'indeterminate') {\n\t\t\tthis.checked.set('indeterminate');\n\t\t} else {\n\t\t\tthis.checked.set(value);\n\t\t}\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\tregisterOnChange(fn: ChangeFn<BrnCheckboxValue>): 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\tregisterOnTouched(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 checkbox should be disabled\n\t */\n\tsetDisabledState(isDisabled: boolean): void {\n\t\tthis._state().disabled.set(isDisabled);\n\t\tthis._cdr.markForCheck();\n\t}\n}\n\ntype BrnCheckboxValue = boolean | 'indeterminate';\n","import { NgModule } from '@angular/core';\n\nimport { BrnCheckbox } from './lib/brn-checkbox';\n\nexport * from './lib/brn-checkbox';\n\nexport const BrnCheckboxImports = [BrnCheckbox] as const;\n\n@NgModule({\n\timports: [...BrnCheckboxImports],\n\texports: [...BrnCheckboxImports],\n})\nexport class BrnCheckboxModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport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AAwB,EAAE,MAAM;AAChC,wBAAA,mBAAmB,EAAE,MAAM;AAC3B,wBAAA,yBAAyB,EAAE,MAAM;AACjC,wBAAA,mBAAmB,EAAE,cAAc;AACnC,wBAAA,2BAA2B,EAAE,iBAAiB;AAC9C,wBAAA,mBAAmB,EAAE,YAAY;AACjC,wBAAA,sBAAsB,EAAE,qBAAqB;AAC7C,qBAAA;oBACD,SAAS,EAAE,CAAC,2BAA2B,CAAC;oBACxC,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAC/C,iBAAA;;;ACxEM,MAAM,kBAAkB,GAAG,CAAC,WAAW;MAMjC,iBAAiB,CAAA;0HAAjB,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;2HAAjB,iBAAiB,EAAA,OAAA,EAAA,CANK,WAAW,CAAA,EAAA,OAAA,EAAA,CAAX,WAAW,CAAA,EAAA,CAAA;2HAMjC,iBAAiB,EAAA,CAAA;;2FAAjB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAJ7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,OAAO,EAAE,CAAC,GAAG,kBAAkB,CAAC;AAChC,oBAAA,OAAO,EAAE,CAAC,GAAG,kBAAkB,CAAC;AAChC,iBAAA;;;ACXD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"spartan-ng-brain-checkbox.mjs","sources":["../../../../libs/brain/checkbox/src/lib/brn-checkbox.ts","../../../../libs/brain/checkbox/src/index.ts","../../../../libs/brain/checkbox/src/spartan-ng-brain-checkbox.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\tChangeDetectionStrategy,\n\tChangeDetectorRef,\n\tComponent,\n\tDestroyRef,\n\tElementRef,\n\ttype OnDestroy,\n\tPLATFORM_ID,\n\tRenderer2,\n\tbooleanAttribute,\n\tcomputed,\n\teffect,\n\tforwardRef,\n\tinject,\n\tinput,\n\tlinkedSignal,\n\tmodel,\n\toutput,\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_CHECKBOX_VALUE_ACCESSOR = {\n\tprovide: NG_VALUE_ACCESSOR,\n\tuseExisting: forwardRef(() => BrnCheckbox),\n\tmulti: true,\n};\n\nlet uniqueIdCounter = 0;\n\nconst CONTAINER_POST_FIX = '-checkbox';\n\n@Component({\n\tselector: 'brn-checkbox',\n\ttemplate: `\n\t\t<button\n\t\t\t#checkBox\n\t\t\trole=\"checkbox\"\n\t\t\ttype=\"button\"\n\t\t\t[id]=\"getCheckboxButtonId(_state().id) ?? ''\"\n\t\t\t[name]=\"getCheckboxButtonId(_state().name) ?? ''\"\n\t\t\t[class]=\"class()\"\n\t\t\t[attr.aria-checked]=\"_ariaChecked()\"\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]=\"_dataState()\"\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]=\"_state().disabled() ? -1 : 0\"\n\t\t\t(click)=\"$event.preventDefault(); toggle()\"\n\t\t>\n\t\t\t<ng-content />\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]': '_dataState()',\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_CHECKBOX_VALUE_ACCESSOR],\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BrnCheckbox implements ControlValueAccessor, AfterContentInit, OnDestroy {\n\tprivate readonly _destroyRef = inject(DestroyRef);\n\tprivate readonly _renderer = inject(Renderer2);\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\tprivate readonly _isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n\tprotected readonly _focusVisible = signal(false);\n\tprotected readonly _focused = signal(false);\n\n\t/**\n\t * Current checked state of checkbox.\n\t * Can be boolean (true/false) or 'indeterminate'.\n\t * Can be bound with [(checked)] for two-way binding.\n\t */\n\tpublic readonly checked = model<BrnCheckboxValue>(false);\n\n\t/** Emits when checked state changes. */\n\tpublic readonly checkedChange = output<BrnCheckboxValue>();\n\n\t/**\n\t * Read-only signal of current checkbox state.\n\t * Use this when you only need to read state without changing it.\n\t */\n\tpublic readonly isChecked = this.checked.asReadonly();\n\n\t/**\n\t * Computed data-state attribute value based on checked state.\n\t * Returns 'checked', 'unchecked', or 'indeterminate'.\n\t */\n\tprotected readonly _dataState = computed(() => {\n\t\tconst checked = this.checked();\n\t\tif (checked === 'indeterminate') return 'indeterminate';\n\t\treturn checked ? 'checked' : 'unchecked';\n\t});\n\n\t/**\n\t * Computed aria-checked attribute value for accessibility.\n\t * Returns 'true', 'false', or 'mixed' (for indeterminate).\n\t */\n\tprotected readonly _ariaChecked = computed(() => {\n\t\tconst checked = this.checked();\n\t\tif (checked === 'indeterminate') return 'mixed';\n\t\treturn checked ? 'true' : 'false';\n\t});\n\n\t/**\n\t * Unique identifier for checkbox component.\n\t * When provided, inner button gets ID without '-checkbox' 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 checkbox.\n\t * When provided, inner button gets name without '-checkbox' 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 checkbox for accessibility.\n\t * Auto-set when checkbox 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 checkbox for accessibility.\n\t */\n\tpublic readonly ariaDescribedby = input<string | null>(null, { alias: 'aria-describedby' });\n\n\t/**\n\t * Whether checkbox is required in a form.\n\t */\n\tpublic readonly required = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\t/**\n\t * Whether checkbox is disabled.\n\t * Disabled checkboxes cannot be toggled and indicate disabled state through data-disabled attribute.\n\t */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\t/**\n\t * Computed state for checkbox container and accessibility.\n\t * Manages ID, name, and disabled state.\n\t */\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\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\tprotected _onChange: ChangeFn<BrnCheckboxValue> = () => {};\n\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\tprivate _onTouched: TouchFn = () => {};\n\n\t/**\n\t * Reference to the checkbox button element in the template.\n\t */\n\tpublic readonly checkbox = viewChild.required<ElementRef<HTMLButtonElement>>('checkBox');\n\n\t/**\n\t * Event emitted when checkbox value changes.\n\t * Emits new checked state (true/false/'indeterminate').\n\t */\n\tpublic readonly changed = output<BrnCheckboxValue>();\n\n\t/**\n\t * Event emitted when checkbox is blurred (loses focus).\n\t * Used for form validation.\n\t */\n\tpublic readonly touched = output<void>();\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 checkboxButtonId = this.getCheckboxButtonId(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=\"${checkboxButtonId}\"]`);\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 checkbox between checked/unchecked states.\n\t * If checkbox is indeterminate, sets to checked.\n\t * Does nothing if checkbox is disabled.\n\t */\n\ttoggle() {\n\t\tif (this._state().disabled()) return;\n\n\t\tthis._onTouched();\n\t\tthis.touched.emit();\n\n\t\tconst previousChecked = this.checked();\n\t\tthis.checked.set(previousChecked === 'indeterminate' ? true : !previousChecked);\n\t\tthis._onChange(this.checked());\n\t\tthis.changed.emit(this.checked());\n\t\tthis.checkedChange.emit(this.checked());\n\t}\n\n\tngAfterContentInit() {\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\t}\n\n\tngOnDestroy() {\n\t\tthis._focusMonitor.stopMonitoring(this._elementRef);\n\t}\n\n\t/**\n\t * Gets proper ID for inner button element.\n\t * Removes '-checkbox' 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 getCheckboxButtonId(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 * Handles boolean and 'indeterminate' values.\n\t * Part of ControlValueAccessor interface.\n\t *\n\t * @param value - New checkbox state (true/false/'indeterminate')\n\t */\n\twriteValue(value: BrnCheckboxValue): void {\n\t\tif (value === 'indeterminate') {\n\t\t\tthis.checked.set('indeterminate');\n\t\t} else {\n\t\t\tthis.checked.set(value);\n\t\t}\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\tregisterOnChange(fn: ChangeFn<BrnCheckboxValue>): 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\tregisterOnTouched(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 checkbox should be disabled\n\t */\n\tsetDisabledState(isDisabled: boolean): void {\n\t\tthis._state().disabled.set(isDisabled);\n\t\tthis._cdr.markForCheck();\n\t}\n}\n\ntype BrnCheckboxValue = boolean | 'indeterminate';\n","import { NgModule } from '@angular/core';\n\nimport { BrnCheckbox } from './lib/brn-checkbox';\n\nexport * from './lib/brn-checkbox';\n\nexport const BrnCheckboxImports = [BrnCheckbox] as const;\n\n@NgModule({\n\timports: [...BrnCheckboxImports],\n\texports: [...BrnCheckboxImports],\n})\nexport class BrnCheckboxModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AA6BO,MAAM,2BAA2B,GAAG;AAC1C,IAAA,OAAO,EAAE,iBAAiB;AAC1B,IAAA,WAAW,EAAE,UAAU,CAAC,MAAM,WAAW,CAAC;AAC1C,IAAA,KAAK,EAAE,IAAI;;AAGZ,IAAI,eAAe,GAAG,CAAC;AAEvB,MAAM,kBAAkB,GAAG,WAAW;MA0CzB,WAAW,CAAA;AACN,IAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;AAChC,IAAA,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;AAC7B,IAAA,WAAW,GAAG,M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E,CAAC,2BAA2B,CAAC;oBACxC,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAC/C,iBAAA;;;ACxEM,MAAM,kBAAkB,GAAG,CAAC,WAAW;MAMjC,iBAAiB,CAAA;0HAAjB,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;2HAAjB,iBAAiB,EAAA,OAAA,EAAA,CANK,WAAW,CAAA,EAAA,OAAA,EAAA,CAAX,WAAW,CAAA,EAAA,CAAA;2HAMjC,iBAAiB,EAAA,CAAA;;2FAAjB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAJ7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,OAAO,EAAE,CAAC,GAAG,kBAAkB,CAAC;AAChC,oBAAA,OAAO,EAAE,CAAC,GAAG,kBAAkB,CAAC;AAChC,iBAAA;;;ACXD;;AAEG;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, forwardRef, signal, input, booleanAttribute, numberAttribute, model,
|
|
2
|
+
import { InjectionToken, inject, forwardRef, signal, input, booleanAttribute, numberAttribute, model, output, computed, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/forms';
|
|
4
4
|
import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
5
5
|
|
|
@@ -43,9 +43,11 @@ class BrnInputOtp {
|
|
|
43
43
|
*/
|
|
44
44
|
transformPaste = input((text) => text);
|
|
45
45
|
/** The value controlling the input */
|
|
46
|
-
value = model(
|
|
46
|
+
value = model(null);
|
|
47
|
+
/** Emits when the value changes. */
|
|
48
|
+
valueChange = output();
|
|
47
49
|
context = computed(() => {
|
|
48
|
-
const value = this.value();
|
|
50
|
+
const value = this.value() ?? '';
|
|
49
51
|
const focused = this._focused();
|
|
50
52
|
const maxLength = this.maxLength();
|
|
51
53
|
const slots = Array.from({ length: this.maxLength() }).map((_, slotIndex) => {
|
|
@@ -85,10 +87,10 @@ class BrnInputOtp {
|
|
|
85
87
|
}
|
|
86
88
|
/** CONTROL VALUE ACCESSOR */
|
|
87
89
|
writeValue(value) {
|
|
88
|
-
|
|
89
|
-
if (value ===
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
this.value.set(value);
|
|
91
|
+
if (value?.length === this.maxLength()) {
|
|
92
|
+
this.completed.emit(value ?? '');
|
|
93
|
+
}
|
|
92
94
|
}
|
|
93
95
|
registerOnChange(fn) {
|
|
94
96
|
this._onChange = fn;
|
|
@@ -103,7 +105,7 @@ class BrnInputOtp {
|
|
|
103
105
|
return newValue !== previousValue && previousValue.length < maxLength && newValue.length === maxLength;
|
|
104
106
|
}
|
|
105
107
|
updateValue(newValue, maxLength) {
|
|
106
|
-
const previousValue = this.value();
|
|
108
|
+
const previousValue = this.value() ?? '';
|
|
107
109
|
this.value.set(newValue);
|
|
108
110
|
this._onChange?.(newValue);
|
|
109
111
|
if (this.isCompleted(newValue, previousValue, maxLength)) {
|
|
@@ -111,7 +113,7 @@ class BrnInputOtp {
|
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
115
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnInputOtp, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
114
|
-
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.8", type: BrnInputOtp, isStandalone: true, selector: "brn-input-otp", inputs: { hostStyles: { classPropertyName: "hostStyles", publicName: "hostStyles", isSignal: true, isRequired: false, transformFunction: null }, inputStyles: { classPropertyName: "inputStyles", publicName: "inputStyles", isSignal: true, isRequired: false, transformFunction: null }, containerStyles: { classPropertyName: "containerStyles", publicName: "containerStyles", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, maxLength: { classPropertyName: "maxLength", publicName: "maxLength", isSignal: true, isRequired: true, transformFunction: null }, inputMode: { classPropertyName: "inputMode", publicName: "inputMode", isSignal: true, isRequired: false, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null }, transformPaste: { classPropertyName: "transformPaste", publicName: "transformPaste", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", completed: "completed" }, host: { attributes: { "data-input-otp-container": "true" }, properties: { "style": "hostStyles()" } }, providers: [BRN_INPUT_OTP_VALUE_ACCESSOR, provideBrnInputOtp(BrnInputOtp)], ngImport: i0, template: `
|
|
116
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.8", type: BrnInputOtp, isStandalone: true, selector: "brn-input-otp", inputs: { hostStyles: { classPropertyName: "hostStyles", publicName: "hostStyles", isSignal: true, isRequired: false, transformFunction: null }, inputStyles: { classPropertyName: "inputStyles", publicName: "inputStyles", isSignal: true, isRequired: false, transformFunction: null }, containerStyles: { classPropertyName: "containerStyles", publicName: "containerStyles", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, maxLength: { classPropertyName: "maxLength", publicName: "maxLength", isSignal: true, isRequired: true, transformFunction: null }, inputMode: { classPropertyName: "inputMode", publicName: "inputMode", isSignal: true, isRequired: false, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null }, transformPaste: { classPropertyName: "transformPaste", publicName: "transformPaste", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", valueChange: "valueChange", completed: "completed" }, host: { attributes: { "data-input-otp-container": "true" }, properties: { "style": "hostStyles()" } }, providers: [BRN_INPUT_OTP_VALUE_ACCESSOR, provideBrnInputOtp(BrnInputOtp)], ngImport: i0, template: `
|
|
115
117
|
<ng-content />
|
|
116
118
|
<div [style]="containerStyles()">
|
|
117
119
|
<input
|