@spartan-ng/brain 0.0.1-alpha.534 → 0.0.1-alpha.535
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-content.d.ts +16 -9
- package/accordion/lib/brn-accordion.d.ts +14 -2
- package/checkbox/lib/brn-checkbox.d.ts +10 -12
- package/fesm2022/spartan-ng-brain-accordion.mjs +57 -39
- package/fesm2022/spartan-ng-brain-accordion.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-checkbox.mjs +23 -25
- package/fesm2022/spartan-ng-brain-checkbox.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-menu.mjs +27 -24
- package/fesm2022/spartan-ng-brain-menu.mjs.map +1 -1
- package/menu/lib/brn-context-menu-trigger.d.ts +3 -2
- package/menu/lib/brn-menu-align.d.ts +3 -2
- package/menu/lib/brn-menu-trigger.d.ts +3 -2
- package/package.json +5 -5
|
@@ -1,19 +1,26 @@
|
|
|
1
|
-
import type { CustomElementClassSettable } from '@spartan-ng/brain/core';
|
|
2
|
-
import type { ClassValue } from 'clsx';
|
|
3
1
|
import * as i0 from "@angular/core";
|
|
4
|
-
export declare class BrnAccordionContent
|
|
2
|
+
export declare class BrnAccordionContent {
|
|
5
3
|
private readonly _item;
|
|
4
|
+
private readonly _elementRef;
|
|
5
|
+
protected readonly _width: import("@angular/core").WritableSignal<number | null>;
|
|
6
|
+
protected readonly _height: import("@angular/core").WritableSignal<number | null>;
|
|
7
|
+
protected readonly _dimensionsInitiated: import("@angular/core").WritableSignal<boolean>;
|
|
8
|
+
protected readonly _inert: import("@angular/core").Signal<true | undefined>;
|
|
6
9
|
readonly state: import("@angular/core").Signal<"open" | "closed">;
|
|
7
10
|
readonly id: string;
|
|
8
11
|
readonly ariaLabeledBy: string;
|
|
9
|
-
protected readonly _addInert: import("@angular/core").Signal<true | undefined>;
|
|
10
12
|
/**
|
|
11
|
-
* The
|
|
13
|
+
* The style to be applied to the host element after the dimensions are calculated.
|
|
14
|
+
* @default 'overflow: hidden'
|
|
12
15
|
*/
|
|
13
|
-
readonly
|
|
14
|
-
|
|
16
|
+
readonly style: import("@angular/core").InputSignal<string>;
|
|
17
|
+
/**
|
|
18
|
+
* The style to be applied to the host element while the dimensions are being calculated.
|
|
19
|
+
* @default 'opacity: 0'
|
|
20
|
+
*/
|
|
21
|
+
readonly styleWhileDimensionsAreInitiating: import("@angular/core").InputSignal<string>;
|
|
22
|
+
protected readonly _mutableStyle: import("@angular/core").WritableSignal<string>;
|
|
15
23
|
constructor();
|
|
16
|
-
setClassToCustomElement(classes: ClassValue): void;
|
|
17
24
|
static ɵfac: i0.ɵɵFactoryDeclaration<BrnAccordionContent, never>;
|
|
18
|
-
static
|
|
25
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnAccordionContent, "brn-accordion-content,[brnAccordionContent]", never, { "style": { "alias": "style"; "required": false; "isSignal": true; }; "styleWhileDimensionsAreInitiating": { "alias": "styleWhileDimensionsAreInitiating"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
19
26
|
}
|
|
@@ -7,14 +7,26 @@ export declare class BrnAccordionItem {
|
|
|
7
7
|
readonly id: number;
|
|
8
8
|
private readonly _accordion;
|
|
9
9
|
/**
|
|
10
|
-
* Whether the
|
|
10
|
+
* Whether the item is opened or closed.
|
|
11
11
|
* @default false
|
|
12
12
|
*/
|
|
13
13
|
readonly isOpened: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
|
|
14
|
+
/**
|
|
15
|
+
* Computed state of the item, either 'open' or 'closed'
|
|
16
|
+
* @default closed
|
|
17
|
+
*/
|
|
14
18
|
readonly state: import("@angular/core").Signal<"open" | "closed">;
|
|
19
|
+
/**
|
|
20
|
+
* Emits boolean when the item is opened or closed.
|
|
21
|
+
*/
|
|
22
|
+
readonly stateChange: import("@angular/core").OutputEmitterRef<"open" | "closed">;
|
|
23
|
+
/**
|
|
24
|
+
* Emits state change when item is opened or closed
|
|
25
|
+
*/
|
|
26
|
+
readonly openedChange: import("@angular/core").OutputEmitterRef<boolean>;
|
|
15
27
|
constructor();
|
|
16
28
|
static ɵfac: i0.ɵɵFactoryDeclaration<BrnAccordionItem, never>;
|
|
17
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnAccordionItem, "[brnAccordionItem]", ["brnAccordionItem"], { "isOpened": { "alias": "isOpened"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
29
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnAccordionItem, "[brnAccordionItem]", ["brnAccordionItem"], { "isOpened": { "alias": "isOpened"; "required": false; "isSignal": true; }; }, { "stateChange": "stateChange"; "openedChange": "openedChange"; }, never, never, true, never>;
|
|
18
30
|
}
|
|
19
31
|
export declare class BrnAccordionTrigger implements FocusableOption {
|
|
20
32
|
private readonly _accordion;
|
|
@@ -19,18 +19,18 @@ export declare class BrnCheckbox implements ControlValueAccessor, AfterContentIn
|
|
|
19
19
|
protected readonly _focusVisible: import("@angular/core").WritableSignal<boolean>;
|
|
20
20
|
protected readonly _focused: import("@angular/core").WritableSignal<boolean>;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
* Can be boolean (true/false) or 'indeterminate'.
|
|
22
|
+
* The checked state of the checkbox.
|
|
24
23
|
* Can be bound with [(checked)] for two-way binding.
|
|
25
24
|
*/
|
|
26
|
-
readonly checked: import("@angular/core").ModelSignal<
|
|
25
|
+
readonly checked: import("@angular/core").ModelSignal<boolean>;
|
|
27
26
|
/** Emits when checked state changes. */
|
|
28
|
-
readonly checkedChange: import("@angular/core").OutputEmitterRef<
|
|
27
|
+
readonly checkedChange: import("@angular/core").OutputEmitterRef<boolean>;
|
|
29
28
|
/**
|
|
30
29
|
* Read-only signal of current checkbox state.
|
|
31
30
|
* Use this when you only need to read state without changing it.
|
|
32
31
|
*/
|
|
33
|
-
readonly isChecked: import("@angular/core").Signal<
|
|
32
|
+
readonly isChecked: import("@angular/core").Signal<boolean>;
|
|
33
|
+
readonly indeterminate: import("@angular/core").ModelSignal<boolean>;
|
|
34
34
|
/**
|
|
35
35
|
* Computed data-state attribute value based on checked state.
|
|
36
36
|
* Returns 'checked', 'unchecked', or 'indeterminate'.
|
|
@@ -89,7 +89,7 @@ export declare class BrnCheckbox implements ControlValueAccessor, AfterContentIn
|
|
|
89
89
|
name: string | null;
|
|
90
90
|
id: string | null;
|
|
91
91
|
}>;
|
|
92
|
-
protected _onChange: ChangeFn<
|
|
92
|
+
protected _onChange: ChangeFn<boolean>;
|
|
93
93
|
private _onTouched;
|
|
94
94
|
/**
|
|
95
95
|
* Reference to the checkbox button element in the template.
|
|
@@ -116,7 +116,7 @@ export declare class BrnCheckbox implements ControlValueAccessor, AfterContentIn
|
|
|
116
116
|
* @param idPassedToContainer - ID applied to container element
|
|
117
117
|
* @returns ID to use for inner button or null
|
|
118
118
|
*/
|
|
119
|
-
protected
|
|
119
|
+
protected _getCheckboxButtonId(idPassedToContainer: string | null | undefined): string | null;
|
|
120
120
|
/**
|
|
121
121
|
* Updates internal state when control value changes from outside.
|
|
122
122
|
* Handles boolean and 'indeterminate' values.
|
|
@@ -124,14 +124,14 @@ export declare class BrnCheckbox implements ControlValueAccessor, AfterContentIn
|
|
|
124
124
|
*
|
|
125
125
|
* @param value - New checkbox state (true/false/'indeterminate')
|
|
126
126
|
*/
|
|
127
|
-
writeValue(value:
|
|
127
|
+
writeValue(value: boolean): void;
|
|
128
128
|
/**
|
|
129
129
|
* Registers callback for value changes.
|
|
130
130
|
* Part of ControlValueAccessor interface.
|
|
131
131
|
*
|
|
132
132
|
* @param fn - Function to call when value changes
|
|
133
133
|
*/
|
|
134
|
-
registerOnChange(fn: ChangeFn<
|
|
134
|
+
registerOnChange(fn: ChangeFn<boolean>): void;
|
|
135
135
|
/**
|
|
136
136
|
* Registers callback for touched events.
|
|
137
137
|
* Part of ControlValueAccessor interface.
|
|
@@ -147,7 +147,5 @@ export declare class BrnCheckbox implements ControlValueAccessor, AfterContentIn
|
|
|
147
147
|
*/
|
|
148
148
|
setDisabledState(isDisabled: boolean): void;
|
|
149
149
|
static ɵfac: i0.ɵɵFactoryDeclaration<BrnCheckbox, never>;
|
|
150
|
-
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"; "touched": "touched"; }, never, ["*"], true, never>;
|
|
150
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BrnCheckbox, "brn-checkbox", never, { "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "indeterminate": { "alias": "indeterminate"; "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"; "indeterminate": "indeterminateChange"; "touched": "touched"; }, never, ["*"], true, never>;
|
|
151
151
|
}
|
|
152
|
-
type BrnCheckboxValue = boolean | 'indeterminate';
|
|
153
|
-
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FocusMonitor, FocusKeyManager } from '@angular/cdk/a11y';
|
|
2
2
|
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { inject, input, computed, effect, untracked, Directive, ElementRef, isDevMode,
|
|
4
|
+
import { inject, input, computed, output, effect, untracked, Directive, ElementRef, isDevMode, signal, contentChildren, linkedSignal, afterNextRender } from '@angular/core';
|
|
5
5
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
6
6
|
import { fromEvent } from 'rxjs';
|
|
7
7
|
|
|
@@ -10,15 +10,34 @@ class BrnAccordionItem {
|
|
|
10
10
|
id = ++BrnAccordionItem._itemIdGenerator;
|
|
11
11
|
_accordion = inject(BrnAccordion);
|
|
12
12
|
/**
|
|
13
|
-
* Whether the
|
|
13
|
+
* Whether the item is opened or closed.
|
|
14
14
|
* @default false
|
|
15
15
|
*/
|
|
16
16
|
isOpened = input(false, { transform: coerceBooleanProperty });
|
|
17
|
+
/**
|
|
18
|
+
* Computed state of the item, either 'open' or 'closed'
|
|
19
|
+
* @default closed
|
|
20
|
+
*/
|
|
17
21
|
state = computed(() => (this._accordion.openItemIds().includes(this.id) ? 'open' : 'closed'));
|
|
22
|
+
/**
|
|
23
|
+
* Emits boolean when the item is opened or closed.
|
|
24
|
+
*/
|
|
25
|
+
stateChange = output();
|
|
26
|
+
/**
|
|
27
|
+
* Emits state change when item is opened or closed
|
|
28
|
+
*/
|
|
29
|
+
openedChange = output();
|
|
18
30
|
constructor() {
|
|
19
31
|
if (!this._accordion) {
|
|
20
32
|
throw Error('Accordion item can only be used inside an Accordion. Add brnAccordion to ancestor.');
|
|
21
33
|
}
|
|
34
|
+
effect(() => {
|
|
35
|
+
const state = this.state();
|
|
36
|
+
untracked(() => {
|
|
37
|
+
this.stateChange.emit(state);
|
|
38
|
+
this.openedChange.emit(state === 'open');
|
|
39
|
+
});
|
|
40
|
+
});
|
|
22
41
|
effect(() => {
|
|
23
42
|
const isOpened = this.isOpened();
|
|
24
43
|
untracked(() => {
|
|
@@ -32,7 +51,7 @@ class BrnAccordionItem {
|
|
|
32
51
|
});
|
|
33
52
|
}
|
|
34
53
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAccordionItem, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
35
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnAccordionItem, isStandalone: true, selector: "[brnAccordionItem]", inputs: { isOpened: { classPropertyName: "isOpened", publicName: "isOpened", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-state": "state()" } }, exportAs: ["brnAccordionItem"], ngImport: i0 });
|
|
54
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnAccordionItem, isStandalone: true, selector: "[brnAccordionItem]", inputs: { isOpened: { classPropertyName: "isOpened", publicName: "isOpened", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { stateChange: "stateChange", openedChange: "openedChange" }, host: { properties: { "attr.data-state": "state()" } }, exportAs: ["brnAccordionItem"], ngImport: i0 });
|
|
36
55
|
}
|
|
37
56
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAccordionItem, decorators: [{
|
|
38
57
|
type: Directive,
|
|
@@ -111,18 +130,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
111
130
|
'[attr.aria-controls]': 'ariaControls',
|
|
112
131
|
'[id]': 'id',
|
|
113
132
|
'[attr.role]': '"button"',
|
|
133
|
+
'(click)': 'toggle($event)',
|
|
134
|
+
'(keyup.space)': 'toggle($event)',
|
|
135
|
+
'(keyup.enter)': 'toggle($event)',
|
|
114
136
|
},
|
|
115
137
|
}]
|
|
116
|
-
}], ctorParameters: () => []
|
|
117
|
-
type: HostListener,
|
|
118
|
-
args: ['click', ['$event']]
|
|
119
|
-
}, {
|
|
120
|
-
type: HostListener,
|
|
121
|
-
args: ['keyup.space', ['$event']]
|
|
122
|
-
}, {
|
|
123
|
-
type: HostListener,
|
|
124
|
-
args: ['keyup.enter', ['$event']]
|
|
125
|
-
}] } });
|
|
138
|
+
}], ctorParameters: () => [] });
|
|
126
139
|
const HORIZONTAL_KEYS_TO_PREVENT_DEFAULT = [
|
|
127
140
|
'ArrowLeft',
|
|
128
141
|
'ArrowRight',
|
|
@@ -257,51 +270,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
257
270
|
|
|
258
271
|
class BrnAccordionContent {
|
|
259
272
|
_item = inject(BrnAccordionItem);
|
|
273
|
+
_elementRef = inject(ElementRef);
|
|
274
|
+
_width = signal(null);
|
|
275
|
+
_height = signal(null);
|
|
276
|
+
_dimensionsInitiated = signal(false);
|
|
277
|
+
_inert = computed(() => (this.state() === 'closed' ? true : undefined));
|
|
260
278
|
state = this._item.state;
|
|
261
279
|
id = `brn-accordion-content-${this._item.id}`;
|
|
262
280
|
ariaLabeledBy = `brn-accordion-trigger-${this._item.id}`;
|
|
263
|
-
_addInert = computed(() => (this.state() === 'closed' ? true : undefined));
|
|
264
281
|
/**
|
|
265
|
-
* The
|
|
282
|
+
* The style to be applied to the host element after the dimensions are calculated.
|
|
283
|
+
* @default 'overflow: hidden'
|
|
284
|
+
*/
|
|
285
|
+
style = input('overflow: hidden');
|
|
286
|
+
/**
|
|
287
|
+
* The style to be applied to the host element while the dimensions are being calculated.
|
|
288
|
+
* @default 'opacity: 0'
|
|
266
289
|
*/
|
|
267
|
-
|
|
268
|
-
|
|
290
|
+
styleWhileDimensionsAreInitiating = input('overflow: hidden');
|
|
291
|
+
_mutableStyle = linkedSignal(() => this._dimensionsInitiated() ? this.style() : this.styleWhileDimensionsAreInitiating());
|
|
269
292
|
constructor() {
|
|
270
293
|
if (!this._item) {
|
|
271
294
|
throw Error('Accordion Content can only be used inside an AccordionItem. Add brnAccordionItem to parent.');
|
|
272
295
|
}
|
|
296
|
+
afterNextRender(() => {
|
|
297
|
+
const content = this._elementRef.nativeElement.firstChild;
|
|
298
|
+
if (!content)
|
|
299
|
+
return;
|
|
300
|
+
const { width, height } = content.getBoundingClientRect();
|
|
301
|
+
this._width.set(width);
|
|
302
|
+
this._height.set(height);
|
|
303
|
+
this._dimensionsInitiated.set(true);
|
|
304
|
+
});
|
|
273
305
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAccordionContent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
278
|
-
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.8", type: BrnAccordionContent, isStandalone: true, selector: "brn-accordion-content", inputs: { contentClass: { classPropertyName: "contentClass", publicName: "contentClass", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "region" }, properties: { "attr.data-state": "state()", "attr.aria-labelledby": "ariaLabeledBy", "id": "id" } }, ngImport: i0, template: `
|
|
279
|
-
<div [attr.inert]="_addInert()" style="overflow: hidden">
|
|
280
|
-
<p [class]="_contentClass()">
|
|
281
|
-
<ng-content />
|
|
282
|
-
</p>
|
|
283
|
-
</div>
|
|
284
|
-
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
306
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAccordionContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
307
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnAccordionContent, isStandalone: true, selector: "brn-accordion-content,[brnAccordionContent]", inputs: { style: { classPropertyName: "style", publicName: "style", isSignal: true, isRequired: false, transformFunction: null }, styleWhileDimensionsAreInitiating: { classPropertyName: "styleWhileDimensionsAreInitiating", publicName: "styleWhileDimensionsAreInitiating", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "region" }, properties: { "attr.data-state": "state()", "attr.aria-labelledby": "ariaLabeledBy", "id": "id", "style.--brn-accordion-content-width.px": "_width()", "style.--brn-accordion-content-height.px": "_height()", "attr.inert": "_inert()", "attr.style": "_mutableStyle()" } }, ngImport: i0 });
|
|
285
308
|
}
|
|
286
309
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAccordionContent, decorators: [{
|
|
287
|
-
type:
|
|
310
|
+
type: Directive,
|
|
288
311
|
args: [{
|
|
289
|
-
selector: 'brn-accordion-content',
|
|
312
|
+
selector: 'brn-accordion-content,[brnAccordionContent]',
|
|
290
313
|
host: {
|
|
291
314
|
'[attr.data-state]': 'state()',
|
|
292
315
|
'[attr.aria-labelledby]': 'ariaLabeledBy',
|
|
293
316
|
role: 'region',
|
|
294
317
|
'[id]': 'id',
|
|
318
|
+
'[style.--brn-accordion-content-width.px]': '_width()',
|
|
319
|
+
'[style.--brn-accordion-content-height.px]': '_height()',
|
|
320
|
+
'[attr.inert]': '_inert()',
|
|
321
|
+
'[attr.style]': '_mutableStyle()',
|
|
295
322
|
},
|
|
296
|
-
template: `
|
|
297
|
-
<div [attr.inert]="_addInert()" style="overflow: hidden">
|
|
298
|
-
<p [class]="_contentClass()">
|
|
299
|
-
<ng-content />
|
|
300
|
-
</p>
|
|
301
|
-
</div>
|
|
302
|
-
`,
|
|
303
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
304
|
-
encapsulation: ViewEncapsulation.None,
|
|
305
323
|
}]
|
|
306
324
|
}], ctorParameters: () => [] });
|
|
307
325
|
|
|
@@ -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 { type FocusableOption, FocusKeyManager, FocusMonitor } from '@angular/cdk/a11y';\nimport { type 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\tisDevMode,\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\tconst message = 'BrnAccordionTrigger: The trigger button must be wrapped in a heading element.';\n\t\t\tif (isDevMode()) {\n\t\t\t\tthrow Error(message);\n\t\t\t} else {\n\t\t\t\tconsole.warn(message);\n\t\t\t}\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 readonly 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 { 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 * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MA2Ba,gBAAgB,CAAA;AACpB,IAAA,OAAO,gBAAgB,GAAG,CAAC;AACnB,IAAA,EAAE,GAA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AE;;;;;;AAMT,CAAA,CAAA;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,aAAa,EAAE,iBAAiB,CAAC,IAAI;AACrC,iBAAA;;;ACxBM,MAAM,mBAAmB,GAAG,CAAC,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,mBAAmB;;ACN5G;;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 { type FocusableOption, FocusKeyManager, FocusMonitor } from '@angular/cdk/a11y';\nimport { type BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';\nimport {\n\ttype AfterContentInit,\n\tcomputed,\n\tcontentChildren,\n\tDirective,\n\teffect,\n\tElementRef,\n\tinject,\n\tinput,\n\tisDevMode,\n\ttype OnDestroy,\n\toutput,\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 item is opened or closed.\n\t * @default false\n\t */\n\tpublic readonly isOpened = input<boolean, BooleanInput>(false, { transform: coerceBooleanProperty });\n\t/**\n\t * Computed state of the item, either 'open' or 'closed'\n\t * @default closed\n\t */\n\tpublic readonly state = computed(() => (this._accordion.openItemIds().includes(this.id) ? 'open' : 'closed'));\n\t/**\n\t * Emits boolean when the item is opened or closed.\n\t */\n\tpublic readonly stateChange = output<'open' | 'closed'>();\n\t/**\n\t * Emits state change when item is opened or closed\n\t */\n\tpublic readonly openedChange = output<boolean>();\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 state = this.state();\n\t\t\tuntracked(() => {\n\t\t\t\tthis.stateChange.emit(state);\n\t\t\t\tthis.openedChange.emit(state === 'open');\n\t\t\t});\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\t'(click)': 'toggle($event)',\n\t\t'(keyup.space)': 'toggle($event)',\n\t\t'(keyup.enter)': 'toggle($event)',\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\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\tconst message = 'BrnAccordionTrigger: The trigger button must be wrapped in a heading element.';\n\t\t\tif (isDevMode()) {\n\t\t\t\tthrow Error(message);\n\t\t\t} else {\n\t\t\t\tconsole.warn(message);\n\t\t\t}\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 readonly 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 { Directive, ElementRef, afterNextRender, computed, inject, input, linkedSignal, signal } from '@angular/core';\nimport { BrnAccordionItem } from './brn-accordion';\n\n@Directive({\n\tselector: 'brn-accordion-content,[brnAccordionContent]',\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\t'[style.--brn-accordion-content-width.px]': '_width()',\n\t\t'[style.--brn-accordion-content-height.px]': '_height()',\n\t\t'[attr.inert]': '_inert()',\n\t\t'[attr.style]': '_mutableStyle()',\n\t},\n})\nexport class BrnAccordionContent {\n\tprivate readonly _item = inject(BrnAccordionItem);\n\tprivate readonly _elementRef = inject(ElementRef);\n\n\tprotected readonly _width = signal<number | null>(null);\n\tprotected readonly _height = signal<number | null>(null);\n\tprotected readonly _dimensionsInitiated = signal(false);\n\tprotected readonly _inert = computed(() => (this.state() === 'closed' ? true : undefined));\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\t/**\n\t * The style to be applied to the host element after the dimensions are calculated.\n\t * @default 'overflow: hidden'\n\t */\n\tpublic readonly style = input<string>('overflow: hidden');\n\t/**\n\t * The style to be applied to the host element while the dimensions are being calculated.\n\t * @default 'opacity: 0'\n\t */\n\tpublic readonly styleWhileDimensionsAreInitiating = input<string>('overflow: hidden');\n\tprotected readonly _mutableStyle = linkedSignal(() =>\n\t\tthis._dimensionsInitiated() ? this.style() : this.styleWhileDimensionsAreInitiating(),\n\t);\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\tafterNextRender(() => {\n\t\t\tconst content = this._elementRef.nativeElement.firstChild as HTMLElement | null;\n\t\t\tif (!content) return;\n\t\t\tconst { width, height } = content.getBoundingClientRect();\n\t\t\tthis._width.set(width);\n\t\t\tthis._height.set(height);\n\t\t\tthis._dimensionsInitiated.set(true);\n\t\t});\n\t}\n}\n","import { 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 * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MA2Ba,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;AACpG;;;AAGG;AACa,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;AAC7G;;AAEG;IACa,WAAW,GAAG,MAAM,EAAqB;AACzD;;AAEG;IACa,YAAY,GAAG,MAA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AAA,EAAA,SAAA,EAAA,sBAAA,EAAA,eAAA,EAAA,IAAA,EAAA,IAAA,EAAA,wCAAA,EAAA,UAAA,EAAA,yCAAA,EAAA,WAAA,EAAA,YAAA,EAAA,UAAA,EAAA,YAAA,EAAA,iBAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAb/B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,QAAQ,EAAE,6CAA6C;AACvD,oBAAA,IAAI,EAAE;AACL,wBAAA,mBAAmB,EAAE,SAAS;AAC9B,wBAAA,wBAAwB,EAAE,eAAe;AACzC,wBAAA,IAAI,EAAE,QAAQ;AACd,wBAAA,MAAM,EAAE,IAAI;AACZ,wBAAA,0CAA0C,EAAE,UAAU;AACtD,wBAAA,2CAA2C,EAAE,WAAW;AACxD,wBAAA,cAAc,EAAE,UAAU;AAC1B,wBAAA,cAAc,EAAE,iBAAiB;AACjC,qBAAA;AACD,iBAAA;;;ACTM,MAAM,mBAAmB,GAAG,CAAC,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,mBAAmB;;ACN5G;;AAEG;;;;"}
|
|
@@ -23,8 +23,7 @@ class BrnCheckbox {
|
|
|
23
23
|
_focusVisible = signal(false);
|
|
24
24
|
_focused = signal(false);
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
* Can be boolean (true/false) or 'indeterminate'.
|
|
26
|
+
* The checked state of the checkbox.
|
|
28
27
|
* Can be bound with [(checked)] for two-way binding.
|
|
29
28
|
*/
|
|
30
29
|
checked = model(false);
|
|
@@ -35,25 +34,28 @@ class BrnCheckbox {
|
|
|
35
34
|
* Use this when you only need to read state without changing it.
|
|
36
35
|
*/
|
|
37
36
|
isChecked = this.checked.asReadonly();
|
|
37
|
+
/*
|
|
38
|
+
* The indeterminate state of the checkbox.
|
|
39
|
+
* For example, a "select all/deselect all" checkbox may be in the indeterminate state when some but not all of its sub-controls are checked.
|
|
40
|
+
*/
|
|
41
|
+
indeterminate = model(false);
|
|
38
42
|
/**
|
|
39
43
|
* Computed data-state attribute value based on checked state.
|
|
40
44
|
* Returns 'checked', 'unchecked', or 'indeterminate'.
|
|
41
45
|
*/
|
|
42
46
|
_dataState = computed(() => {
|
|
43
|
-
|
|
44
|
-
if (checked === 'indeterminate')
|
|
47
|
+
if (this.indeterminate())
|
|
45
48
|
return 'indeterminate';
|
|
46
|
-
return checked ? 'checked' : 'unchecked';
|
|
49
|
+
return this.checked() ? 'checked' : 'unchecked';
|
|
47
50
|
});
|
|
48
51
|
/**
|
|
49
52
|
* Computed aria-checked attribute value for accessibility.
|
|
50
53
|
* Returns 'true', 'false', or 'mixed' (for indeterminate).
|
|
51
54
|
*/
|
|
52
55
|
_ariaChecked = computed(() => {
|
|
53
|
-
|
|
54
|
-
if (checked === 'indeterminate')
|
|
56
|
+
if (this.indeterminate())
|
|
55
57
|
return 'mixed';
|
|
56
|
-
return checked ? 'true' : 'false';
|
|
58
|
+
return this.checked() ? 'true' : 'false';
|
|
57
59
|
});
|
|
58
60
|
/**
|
|
59
61
|
* Unique identifier for checkbox component.
|
|
@@ -127,7 +129,7 @@ class BrnCheckbox {
|
|
|
127
129
|
if (!this._elementRef.nativeElement || !this._isBrowser)
|
|
128
130
|
return;
|
|
129
131
|
const newLabelId = state.id + '-label';
|
|
130
|
-
const checkboxButtonId = this.
|
|
132
|
+
const checkboxButtonId = this._getCheckboxButtonId(state.id);
|
|
131
133
|
const labelElement = this._elementRef.nativeElement.closest('label') ??
|
|
132
134
|
this._document.querySelector(`label[for="${checkboxButtonId}"]`);
|
|
133
135
|
if (!labelElement)
|
|
@@ -150,10 +152,11 @@ class BrnCheckbox {
|
|
|
150
152
|
return;
|
|
151
153
|
this._onTouched();
|
|
152
154
|
this.touched.emit();
|
|
153
|
-
const
|
|
154
|
-
this.
|
|
155
|
-
this.
|
|
156
|
-
this.
|
|
155
|
+
const newChecked = this.indeterminate() ? true : !this.checked();
|
|
156
|
+
this.indeterminate.set(false);
|
|
157
|
+
this.checkedChange.emit(newChecked);
|
|
158
|
+
this.checked.set(newChecked);
|
|
159
|
+
this._onChange(newChecked);
|
|
157
160
|
}
|
|
158
161
|
ngAfterContentInit() {
|
|
159
162
|
this._focusMonitor
|
|
@@ -192,7 +195,7 @@ class BrnCheckbox {
|
|
|
192
195
|
* @param idPassedToContainer - ID applied to container element
|
|
193
196
|
* @returns ID to use for inner button or null
|
|
194
197
|
*/
|
|
195
|
-
|
|
198
|
+
_getCheckboxButtonId(idPassedToContainer) {
|
|
196
199
|
return idPassedToContainer ? idPassedToContainer.replace(CONTAINER_POST_FIX, '') : null;
|
|
197
200
|
}
|
|
198
201
|
/**
|
|
@@ -203,12 +206,7 @@ class BrnCheckbox {
|
|
|
203
206
|
* @param value - New checkbox state (true/false/'indeterminate')
|
|
204
207
|
*/
|
|
205
208
|
writeValue(value) {
|
|
206
|
-
|
|
207
|
-
this.checked.set('indeterminate');
|
|
208
|
-
}
|
|
209
|
-
else {
|
|
210
|
-
this.checked.set(value);
|
|
211
|
-
}
|
|
209
|
+
this.checked.set(value);
|
|
212
210
|
}
|
|
213
211
|
/**
|
|
214
212
|
* Registers callback for value changes.
|
|
@@ -239,13 +237,13 @@ class BrnCheckbox {
|
|
|
239
237
|
this._cdr.markForCheck();
|
|
240
238
|
}
|
|
241
239
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCheckbox, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
242
|
-
/** @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", 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: `
|
|
240
|
+
/** @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 }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", 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", indeterminate: "indeterminateChange", 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: `
|
|
243
241
|
<button
|
|
244
242
|
#checkBox
|
|
245
243
|
role="checkbox"
|
|
246
244
|
type="button"
|
|
247
|
-
[id]="
|
|
248
|
-
[name]="
|
|
245
|
+
[id]="_getCheckboxButtonId(_state().id) ?? ''"
|
|
246
|
+
[name]="_getCheckboxButtonId(_state().name) ?? ''"
|
|
249
247
|
[class]="class()"
|
|
250
248
|
[attr.aria-checked]="_ariaChecked()"
|
|
251
249
|
[attr.aria-label]="ariaLabel() || null"
|
|
@@ -272,8 +270,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
272
270
|
#checkBox
|
|
273
271
|
role="checkbox"
|
|
274
272
|
type="button"
|
|
275
|
-
[id]="
|
|
276
|
-
[name]="
|
|
273
|
+
[id]="_getCheckboxButtonId(_state().id) ?? ''"
|
|
274
|
+
[name]="_getCheckboxButtonId(_state().name) ?? ''"
|
|
277
275
|
[class]="class()"
|
|
278
276
|
[attr.aria-checked]="_ariaChecked()"
|
|
279
277
|
[attr.aria-label]="ariaLabel() || null"
|
|
@@ -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 type { 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 { type ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport type { 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 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.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 { BrnCheckbox } from './lib/brn-checkbox';\n\nexport * from './lib/brn-checkbox';\n\nexport const BrnCheckboxImports = [BrnCheckbox] as const;\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;AA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C,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;;;AC1EM,MAAM,kBAAkB,GAAG,CAAC,WAAW;;ACJ9C;;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 type { 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 { type ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport type { 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 * The checked state of the checkbox.\n\t * Can be bound with [(checked)] for two-way binding.\n\t */\n\tpublic readonly checked = model<boolean>(false);\n\n\t/** Emits when checked state changes. */\n\tpublic readonly checkedChange = output<boolean>();\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 * The indeterminate state of the checkbox.\n\t * For example, a \"select all/deselect all\" checkbox may be in the indeterminate state when some but not all of its sub-controls are checked.\n\t */\n\tpublic readonly indeterminate = model<boolean>(false);\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\tif (this.indeterminate()) return 'indeterminate';\n\t\treturn this.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\tif (this.indeterminate()) return 'mixed';\n\t\treturn this.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<boolean> = () => {};\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 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 newChecked = this.indeterminate() ? true : !this.checked();\n\t\tthis.indeterminate.set(false);\n\t\tthis.checkedChange.emit(newChecked);\n\t\tthis.checked.set(newChecked);\n\t\tthis._onChange(newChecked);\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: boolean): void {\n\t\tthis.checked.set(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\tregisterOnChange(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\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","import { BrnCheckbox } from './lib/brn-checkbox';\n\nexport * from './lib/brn-checkbox';\n\nexport const BrnCheckboxImports = [BrnCheckbox] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AA6BO,MAAM,2BAA2B,GAAG;AAC1C,I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EAAE,eAAe;AAC9B,wBAAA,wBAAwB,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;;;AC1EM,MAAM,kBAAkB,GAAG,CAAC,WAAW;;ACJ9C;;AAEG;;;;"}
|
|
@@ -4,26 +4,30 @@ import * as i0 from '@angular/core';
|
|
|
4
4
|
import { inject, input, effect, Directive, signal, booleanAttribute } from '@angular/core';
|
|
5
5
|
import { takeUntilDestroyed, outputFromObservable } from '@angular/core/rxjs-interop';
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
originY
|
|
11
|
-
overlayX:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
7
|
+
const getBrnMenuPosition = (align, side) => {
|
|
8
|
+
const verticalAlign = align === 'start' ? 'top' : align === 'end' ? 'bottom' : 'center';
|
|
9
|
+
const createPositions = (originX, originY, overlayX, overlayY) => [
|
|
10
|
+
{ originX, originY, overlayX, overlayY },
|
|
11
|
+
{ originX: overlayX, originY: overlayY, overlayX: originX, overlayY: originY },
|
|
12
|
+
];
|
|
13
|
+
switch (side) {
|
|
14
|
+
case 'top':
|
|
15
|
+
return createPositions(align, 'top', align, 'bottom');
|
|
16
|
+
case 'bottom':
|
|
17
|
+
return createPositions(align, 'bottom', align, 'top');
|
|
18
|
+
case 'left':
|
|
19
|
+
return createPositions('start', verticalAlign, 'end', verticalAlign);
|
|
20
|
+
case 'right':
|
|
21
|
+
return createPositions('end', verticalAlign, 'start', verticalAlign);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
21
24
|
|
|
22
25
|
class BrnContextMenuTrigger {
|
|
23
26
|
_cdkTrigger = inject(CdkContextMenuTrigger, { host: true });
|
|
24
27
|
brnCtxMenuTriggerFor = input(null);
|
|
25
28
|
brnCtxMenuTriggerData = input(undefined);
|
|
26
|
-
align = input(
|
|
29
|
+
align = input('center');
|
|
30
|
+
side = input('bottom');
|
|
27
31
|
constructor() {
|
|
28
32
|
// once the trigger opens we wait until the next tick and then grab the last position
|
|
29
33
|
// used to position the menu. we store this in our trigger which the brnMenu directive has
|
|
@@ -36,13 +40,12 @@ class BrnContextMenuTrigger {
|
|
|
36
40
|
effect(() => (this._cdkTrigger.menuData = this.brnCtxMenuTriggerData()));
|
|
37
41
|
effect(() => {
|
|
38
42
|
const align = this.align();
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
this._cdkTrigger.menuPosition = getBrnMenuAlign(align);
|
|
43
|
+
const side = this.side();
|
|
44
|
+
this._cdkTrigger.menuPosition = getBrnMenuPosition(align, side);
|
|
42
45
|
});
|
|
43
46
|
}
|
|
44
47
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnContextMenuTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
45
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnContextMenuTrigger, isStandalone: true, selector: "[brnCtxMenuTriggerFor]", inputs: { brnCtxMenuTriggerFor: { classPropertyName: "brnCtxMenuTriggerFor", publicName: "brnCtxMenuTriggerFor", isSignal: true, isRequired: false, transformFunction: null }, brnCtxMenuTriggerData: { classPropertyName: "brnCtxMenuTriggerData", publicName: "brnCtxMenuTriggerData", isSignal: true, isRequired: false, transformFunction: null }, align: { classPropertyName: "align", publicName: "align", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: i1.CdkContextMenuTrigger }], ngImport: i0 });
|
|
48
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnContextMenuTrigger, isStandalone: true, selector: "[brnCtxMenuTriggerFor]", inputs: { brnCtxMenuTriggerFor: { classPropertyName: "brnCtxMenuTriggerFor", publicName: "brnCtxMenuTriggerFor", isSignal: true, isRequired: false, transformFunction: null }, brnCtxMenuTriggerData: { classPropertyName: "brnCtxMenuTriggerData", publicName: "brnCtxMenuTriggerData", isSignal: true, isRequired: false, transformFunction: null }, align: { classPropertyName: "align", publicName: "align", isSignal: true, isRequired: false, transformFunction: null }, side: { classPropertyName: "side", publicName: "side", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: i1.CdkContextMenuTrigger }], ngImport: i0 });
|
|
46
49
|
}
|
|
47
50
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnContextMenuTrigger, decorators: [{
|
|
48
51
|
type: Directive,
|
|
@@ -198,7 +201,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
198
201
|
|
|
199
202
|
class BrnMenuTrigger {
|
|
200
203
|
_cdkTrigger = inject(CdkMenuTrigger, { host: true });
|
|
201
|
-
align = input(
|
|
204
|
+
align = input('center');
|
|
205
|
+
side = input('bottom');
|
|
202
206
|
constructor() {
|
|
203
207
|
// once the trigger opens we wait until the next tick and then grab the last position
|
|
204
208
|
// used to position the menu. we store this in our trigger which the brnMenu directive has
|
|
@@ -209,13 +213,12 @@ class BrnMenuTrigger {
|
|
|
209
213
|
this._cdkTrigger.overlayRef._positionStrategy._lastPosition)));
|
|
210
214
|
effect(() => {
|
|
211
215
|
const align = this.align();
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
this._cdkTrigger.menuPosition = getBrnMenuAlign(align);
|
|
216
|
+
const side = this.side();
|
|
217
|
+
this._cdkTrigger.menuPosition = getBrnMenuPosition(align, side);
|
|
215
218
|
});
|
|
216
219
|
}
|
|
217
220
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnMenuTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
218
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnMenuTrigger, isStandalone: true, selector: "[brnMenuTriggerFor]", inputs: { align: { classPropertyName: "align", publicName: "align", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: i1.CdkMenuTrigger, inputs: ["cdkMenuTriggerFor", "brnMenuTriggerFor", "cdkMenuTriggerData", "brnMenuTriggerData"], outputs: ["cdkMenuOpened", "brnMenuOpened", "cdkMenuClosed", "brnMenuClosed"] }], ngImport: i0 });
|
|
221
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnMenuTrigger, isStandalone: true, selector: "[brnMenuTriggerFor]", inputs: { align: { classPropertyName: "align", publicName: "align", isSignal: true, isRequired: false, transformFunction: null }, side: { classPropertyName: "side", publicName: "side", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: i1.CdkMenuTrigger, inputs: ["cdkMenuTriggerFor", "brnMenuTriggerFor", "cdkMenuTriggerData", "brnMenuTriggerData"], outputs: ["cdkMenuOpened", "brnMenuOpened", "cdkMenuClosed", "brnMenuClosed"] }], ngImport: i0 });
|
|
219
222
|
}
|
|
220
223
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnMenuTrigger, decorators: [{
|
|
221
224
|
type: Directive,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spartan-ng-brain-menu.mjs","sources":["../../../../libs/brain/menu/src/lib/brn-menu-align.ts","../../../../libs/brain/menu/src/lib/brn-context-menu-trigger.ts","../../../../libs/brain/menu/src/lib/brn-menu.ts","../../../../libs/brain/menu/src/lib/brn-menu-bar.ts","../../../../libs/brain/menu/src/lib/brn-menu-group.ts","../../../../libs/brain/menu/src/lib/brn-menu-item.ts","../../../../libs/brain/menu/src/lib/brn-menu-item-checkbox.ts","../../../../libs/brain/menu/src/lib/brn-menu-item-radio.ts","../../../../libs/brain/menu/src/lib/brn-menu-trigger.ts","../../../../libs/brain/menu/src/index.ts","../../../../libs/brain/menu/src/spartan-ng-brain-menu.ts"],"sourcesContent":["import type { ConnectedPosition } from '@angular/cdk/overlay';\n\nexport type BrnMenuAlign = 'start' | 'center' | 'end' | undefined;\nexport const getBrnMenuAlign = (align: Exclude<BrnMenuAlign, undefined>): ConnectedPosition[] => [\n\t{\n\t\toriginX: align,\n\t\toriginY: 'bottom',\n\t\toverlayX: align,\n\t\toverlayY: 'top',\n\t},\n\t{\n\t\toriginX: align,\n\t\toriginY: 'top',\n\t\toverlayX: align,\n\t\toverlayY: 'bottom',\n\t},\n];\n","import { CdkContextMenuTrigger } from '@angular/cdk/menu';\nimport { Directive, effect, inject, input, type TemplateRef } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { type BrnMenuAlign, getBrnMenuAlign } from './brn-menu-align';\n\n@Directive({\n\tselector: '[brnCtxMenuTriggerFor]',\n\thostDirectives: [CdkContextMenuTrigger],\n})\nexport class BrnContextMenuTrigger {\n\tprivate readonly _cdkTrigger = inject(CdkContextMenuTrigger, { host: true });\n\tpublic readonly brnCtxMenuTriggerFor = input<TemplateRef<unknown> | null>(null);\n\tpublic readonly brnCtxMenuTriggerData = input<unknown>(undefined);\n\tpublic readonly align = input<BrnMenuAlign>(undefined);\n\n\tconstructor() {\n\t\t// once the trigger opens we wait until the next tick and then grab the last position\n\t\t// used to position the menu. we store this in our trigger which the brnMenu directive has\n\t\t// access to through DI\n\t\tthis._cdkTrigger.opened.pipe(takeUntilDestroyed()).subscribe(() =>\n\t\t\tsetTimeout(\n\t\t\t\t() =>\n\t\t\t\t\t// eslint-disable-next-line\n\t\t\t\t\t((this._cdkTrigger as any)._spartanLastPosition = // eslint-disable-next-line\n\t\t\t\t\t\t(this._cdkTrigger as any).overlayRef._positionStrategy._lastPosition),\n\t\t\t),\n\t\t);\n\n\t\teffect(() => (this._cdkTrigger.menuTemplateRef = this.brnCtxMenuTriggerFor()));\n\t\teffect(() => (this._cdkTrigger.menuData = this.brnCtxMenuTriggerData()));\n\t\teffect(() => {\n\t\t\tconst align = this.align();\n\t\t\tif (!align) return;\n\t\t\tthis._cdkTrigger.menuPosition = getBrnMenuAlign(align);\n\t\t});\n\t}\n}\n","import { CdkMenu } from '@angular/cdk/menu';\nimport { Directive, inject, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\n@Directive({\n\tselector: '[brnMenu],[brnSubMenu]',\n\thost: {\n\t\t'[attr.data-state]': '_state()',\n\t\t'[attr.data-side]': '_side()',\n\t},\n\thostDirectives: [CdkMenu],\n})\nexport class BrnMenu {\n\tprivate readonly _host = inject(CdkMenu);\n\n\tprotected readonly _state = signal('open');\n\tprotected readonly _side = signal('top');\n\n\tconstructor() {\n\t\tthis.setSideWithDarkMagic();\n\t\t// this is a best effort, but does not seem to work currently\n\t\t// TODO: figure out a way for us to know the host is about to be closed. might not be possible with CDK\n\t\tthis._host.closed.pipe(takeUntilDestroyed()).subscribe(() => this._state.set('closed'));\n\t}\n\n\tprivate setSideWithDarkMagic() {\n\t\t/**\n\t\t * This is an ugly workaround to at least figure out the correct side of where a submenu\n\t\t * will appear and set the attribute to the host accordingly\n\t\t *\n\t\t * First of all we take advantage of the menu stack not being aware of the root\n\t\t * object immediately after it is added. This code executes before the root element is added,\n\t\t * which means the stack is still empty and the peek method returns undefined.\n\t\t */\n\t\tconst isRoot = this._host.menuStack.peek() === undefined;\n\t\tsetTimeout(() => {\n\t\t\t// our menu trigger directive leaves the last position used for use immediately after opening\n\t\t\t// we can access it here and determine the correct side.\n\t\t\t// eslint-disable-next-line\n\t\t\tconst ps = (this._host as any)._parentTrigger._spartanLastPosition;\n\t\t\tif (!ps) {\n\t\t\t\t// if we have no last position we default to the most likely option\n\t\t\t\t// I hate that we have to do this and hope we can revisit soon and improve\n\t\t\t\tthis._side.set(isRoot ? 'top' : 'left');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst side = isRoot ? ps.originY : ps.originX === 'end' ? 'right' : 'left';\n\t\t\tthis._side.set(side);\n\t\t});\n\t}\n}\n","import { CdkMenuBar } from '@angular/cdk/menu';\nimport { Directive } from '@angular/core';\n\n@Directive({\n\tselector: '[brnMenuBar]',\n\thostDirectives: [CdkMenuBar],\n})\nexport class BrnMenuBar {}\n","import { CdkMenuGroup } from '@angular/cdk/menu';\nimport { Directive } from '@angular/core';\n\n@Directive({\n\tselector: '[brnMenuGroup]',\n\thostDirectives: [CdkMenuGroup],\n})\nexport class BrnMenuGroup {}\n","import { CdkMenuItem } from '@angular/cdk/menu';\nimport { booleanAttribute, Directive, effect, inject, input } from '@angular/core';\nimport { outputFromObservable } from '@angular/core/rxjs-interop';\n\n@Directive({\n\tselector: '[brnMenuItem]',\n\thostDirectives: [CdkMenuItem],\n\thost: {\n\t\t'[disabled]': 'disabled()',\n\t\t'[attr.data-disabled]': 'disabled() ? \"\" : null',\n\t},\n})\nexport class BrnMenuItem {\n\tprivate readonly _cdkMenuItem = inject(CdkMenuItem);\n\tpublic readonly disabled = input(this._cdkMenuItem.disabled, { transform: booleanAttribute });\n\tpublic readonly triggered = outputFromObservable(this._cdkMenuItem.triggered);\n\n\tconstructor() {\n\t\teffect(() => (this._cdkMenuItem.disabled = this.disabled()));\n\t}\n}\n","import { CdkMenuItemCheckbox } from '@angular/cdk/menu';\nimport { booleanAttribute, Directive, effect, inject, input } from '@angular/core';\nimport { outputFromObservable } from '@angular/core/rxjs-interop';\n\n@Directive({\n\tselector: '[brnMenuItemCheckbox]',\n\thostDirectives: [CdkMenuItemCheckbox],\n\thost: {\n\t\t'[class.checked]': 'checked()',\n\t\t'[disabled]': 'disabled()',\n\t},\n})\nexport class BrnMenuItemCheckbox {\n\tprivate readonly _cdkMenuItem = inject(CdkMenuItemCheckbox);\n\tpublic readonly checked = input(this._cdkMenuItem.checked, { transform: booleanAttribute });\n\tpublic readonly disabled = input(this._cdkMenuItem.disabled, { transform: booleanAttribute });\n\tpublic readonly triggered = outputFromObservable(this._cdkMenuItem.triggered);\n\n\tconstructor() {\n\t\teffect(() => (this._cdkMenuItem.disabled = this.disabled()));\n\t\teffect(() => (this._cdkMenuItem.checked = this.checked()));\n\t}\n}\n","import { CdkMenuItemRadio } from '@angular/cdk/menu';\nimport { booleanAttribute, Directive, effect, inject, input } from '@angular/core';\nimport { outputFromObservable } from '@angular/core/rxjs-interop';\n\n@Directive({\n\tselector: '[brnMenuItemRadio]',\n\thostDirectives: [CdkMenuItemRadio],\n\thost: {\n\t\t'[class.checked]': 'checked()',\n\t\t'[disabled]': 'disabled()',\n\t},\n})\nexport class BrnMenuItemRadio {\n\tprivate readonly _cdkMenuItem = inject(CdkMenuItemRadio);\n\tpublic readonly checked = input(this._cdkMenuItem.checked, { transform: booleanAttribute });\n\tpublic readonly disabled = input(this._cdkMenuItem.disabled, { transform: booleanAttribute });\n\tpublic readonly triggered = outputFromObservable(this._cdkMenuItem.triggered);\n\n\tconstructor() {\n\t\teffect(() => (this._cdkMenuItem.disabled = this.disabled()));\n\t\teffect(() => (this._cdkMenuItem.checked = this.checked()));\n\t}\n}\n","import { CdkMenuTrigger } from '@angular/cdk/menu';\nimport { Directive, effect, inject, input } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { type BrnMenuAlign, getBrnMenuAlign } from './brn-menu-align';\n\n@Directive({\n\tselector: '[brnMenuTriggerFor]',\n\thostDirectives: [\n\t\t{\n\t\t\tdirective: CdkMenuTrigger,\n\t\t\tinputs: ['cdkMenuTriggerFor: brnMenuTriggerFor', 'cdkMenuTriggerData: brnMenuTriggerData'],\n\t\t\toutputs: ['cdkMenuOpened: brnMenuOpened', 'cdkMenuClosed: brnMenuClosed'],\n\t\t},\n\t],\n})\nexport class BrnMenuTrigger {\n\tprivate readonly _cdkTrigger = inject(CdkMenuTrigger, { host: true });\n\tpublic readonly align = input<BrnMenuAlign>(undefined);\n\n\tconstructor() {\n\t\t// once the trigger opens we wait until the next tick and then grab the last position\n\t\t// used to position the menu. we store this in our trigger which the brnMenu directive has\n\t\t// access to through DI\n\t\tthis._cdkTrigger.opened.pipe(takeUntilDestroyed()).subscribe(() =>\n\t\t\tsetTimeout(\n\t\t\t\t() =>\n\t\t\t\t\t// eslint-disable-next-line\n\t\t\t\t\t((this._cdkTrigger as any)._spartanLastPosition = // eslint-disable-next-line\n\t\t\t\t\t\t(this._cdkTrigger as any).overlayRef._positionStrategy._lastPosition),\n\t\t\t),\n\t\t);\n\n\t\teffect(() => {\n\t\t\tconst align = this.align();\n\t\t\tif (!align) return;\n\t\t\tthis._cdkTrigger.menuPosition = getBrnMenuAlign(align);\n\t\t});\n\t}\n}\n","import { BrnContextMenuTrigger } from './lib/brn-context-menu-trigger';\nimport { BrnMenu } from './lib/brn-menu';\nimport { BrnMenuBar } from './lib/brn-menu-bar';\nimport { BrnMenuGroup } from './lib/brn-menu-group';\nimport { BrnMenuItem } from './lib/brn-menu-item';\nimport { BrnMenuItemCheckbox } from './lib/brn-menu-item-checkbox';\nimport { BrnMenuItemRadio } from './lib/brn-menu-item-radio';\nimport { BrnMenuTrigger } from './lib/brn-menu-trigger';\n\nexport * from './lib/brn-context-menu-trigger';\nexport * from './lib/brn-menu';\nexport * from './lib/brn-menu-bar';\nexport * from './lib/brn-menu-group';\nexport * from './lib/brn-menu-item';\nexport * from './lib/brn-menu-item-checkbox';\nexport * from './lib/brn-menu-item-radio';\nexport * from './lib/brn-menu-trigger';\n\nexport const BrnMenuImports = [\n\tBrnMenuTrigger,\n\tBrnMenu,\n\tBrnMenuBar,\n\tBrnContextMenuTrigger,\n\tBrnMenuGroup,\n\tBrnMenuItem,\n\tBrnMenuItemRadio,\n\tBrnMenuItemCheckbox,\n] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAGO,MAAM,eAAe,GAAG,CAAC,KAAuC,KAA0B;AAChG,IAAA;AACC,QAAA,OAAO,EAAE,KAAK;AACd,QAAA,OAAO,EAAE,QAAQ;AACjB,QAAA,QAAQ,EAAE,KAAK;AACf,QAAA,QAAQ,EAAE,KAAK;AACf,KAAA;AACD,IAAA;AACC,QAAA,OAAO,EAAE,KAAK;AACd,QAAA,OAAO,EAAE,KAAK;AACd,QAAA,QAAQ,EAAE,KAAK;AACf,QAAA,QAAQ,EAAE,QAAQ;AAClB,KAAA;CACD;;MCPY,qBAAqB,CAAA;IAChB,WAAW,GAAG,MAAM,CAAC,qBAAqB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAC5D,IAAA,oBAAoB,GAAG,KAAK,CAA8B,IAAI,CAAC;AAC/D,IAAA,qBAAqB,GAAG,KAAK,CAAU,SAAS,CAAC;AACjD,IAAA,KAAK,GAAG,KAAK,CAAe,SAAS,CAAC;AAEtD,IAAA,WAAA,GAAA;;;;AAIC,QAAA,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC,SAAS,CAAC,MAC5D,UAAU,CACT;;AAEC,SAAE,IAAI,CAAC,WAAmB,CAAC,oBAAoB;YAC7C,IAAI,CAAC,WAAmB,CAAC,UAAU,CAAC,iBAAiB,CAAC,aAAa,CAAC,CACvE,CACD;AAED,QAAA,MAAM,CAAC,OAAO,IAAI,CAAC,WAAW,CAAC,eAAe,GAAG,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;AAC9E,QAAA,MAAM,CAAC,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,GA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s","sources":["../../../../libs/brain/menu/src/lib/brn-menu-align.ts","../../../../libs/brain/menu/src/lib/brn-context-menu-trigger.ts","../../../../libs/brain/menu/src/lib/brn-menu.ts","../../../../libs/brain/menu/src/lib/brn-menu-bar.ts","../../../../libs/brain/menu/src/lib/brn-menu-group.ts","../../../../libs/brain/menu/src/lib/brn-menu-item.ts","../../../../libs/brain/menu/src/lib/brn-menu-item-checkbox.ts","../../../../libs/brain/menu/src/lib/brn-menu-item-radio.ts","../../../../libs/brain/menu/src/lib/brn-menu-trigger.ts","../../../../libs/brain/menu/src/index.ts","../../../../libs/brain/menu/src/spartan-ng-brain-menu.ts"],"sourcesContent":["import type { ConnectedPosition } from '@angular/cdk/overlay';\n\nexport type BrnMenuAlign = 'start' | 'center' | 'end';\nexport type BrnMenuSide = 'top' | 'bottom' | 'left' | 'right';\n\nexport const getBrnMenuPosition = (align: BrnMenuAlign, side: BrnMenuSide): ConnectedPosition[] => {\n\tconst verticalAlign = align === 'start' ? 'top' : align === 'end' ? 'bottom' : 'center';\n\n\tconst createPositions = (\n\t\toriginX: 'start' | 'center' | 'end',\n\t\toriginY: 'top' | 'center' | 'bottom',\n\t\toverlayX: 'start' | 'center' | 'end',\n\t\toverlayY: 'top' | 'center' | 'bottom',\n\t): ConnectedPosition[] => [\n\t\t{ originX, originY, overlayX, overlayY },\n\t\t{ originX: overlayX, originY: overlayY, overlayX: originX, overlayY: originY },\n\t];\n\n\tswitch (side) {\n\t\tcase 'top':\n\t\t\treturn createPositions(align, 'top', align, 'bottom');\n\t\tcase 'bottom':\n\t\t\treturn createPositions(align, 'bottom', align, 'top');\n\t\tcase 'left':\n\t\t\treturn createPositions('start', verticalAlign, 'end', verticalAlign);\n\t\tcase 'right':\n\t\t\treturn createPositions('end', verticalAlign, 'start', verticalAlign);\n\t}\n};\n","import { CdkContextMenuTrigger } from '@angular/cdk/menu';\nimport { Directive, effect, inject, input, type TemplateRef } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { type BrnMenuAlign, BrnMenuSide, getBrnMenuPosition } from './brn-menu-align';\n\n@Directive({\n\tselector: '[brnCtxMenuTriggerFor]',\n\thostDirectives: [CdkContextMenuTrigger],\n})\nexport class BrnContextMenuTrigger {\n\tprivate readonly _cdkTrigger = inject(CdkContextMenuTrigger, { host: true });\n\tpublic readonly brnCtxMenuTriggerFor = input<TemplateRef<unknown> | null>(null);\n\tpublic readonly brnCtxMenuTriggerData = input<unknown>(undefined);\n\tpublic readonly align = input<BrnMenuAlign>('center');\n\tpublic readonly side = input<BrnMenuSide>('bottom');\n\n\tconstructor() {\n\t\t// once the trigger opens we wait until the next tick and then grab the last position\n\t\t// used to position the menu. we store this in our trigger which the brnMenu directive has\n\t\t// access to through DI\n\t\tthis._cdkTrigger.opened.pipe(takeUntilDestroyed()).subscribe(() =>\n\t\t\tsetTimeout(\n\t\t\t\t() =>\n\t\t\t\t\t// eslint-disable-next-line\n\t\t\t\t\t((this._cdkTrigger as any)._spartanLastPosition = // eslint-disable-next-line\n\t\t\t\t\t\t(this._cdkTrigger as any).overlayRef._positionStrategy._lastPosition),\n\t\t\t),\n\t\t);\n\n\t\teffect(() => (this._cdkTrigger.menuTemplateRef = this.brnCtxMenuTriggerFor()));\n\t\teffect(() => (this._cdkTrigger.menuData = this.brnCtxMenuTriggerData()));\n\t\teffect(() => {\n\t\t\tconst align = this.align();\n\t\t\tconst side = this.side();\n\t\t\tthis._cdkTrigger.menuPosition = getBrnMenuPosition(align, side);\n\t\t});\n\t}\n}\n","import { CdkMenu } from '@angular/cdk/menu';\nimport { Directive, inject, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\n@Directive({\n\tselector: '[brnMenu],[brnSubMenu]',\n\thost: {\n\t\t'[attr.data-state]': '_state()',\n\t\t'[attr.data-side]': '_side()',\n\t},\n\thostDirectives: [CdkMenu],\n})\nexport class BrnMenu {\n\tprivate readonly _host = inject(CdkMenu);\n\n\tprotected readonly _state = signal('open');\n\tprotected readonly _side = signal('top');\n\n\tconstructor() {\n\t\tthis.setSideWithDarkMagic();\n\t\t// this is a best effort, but does not seem to work currently\n\t\t// TODO: figure out a way for us to know the host is about to be closed. might not be possible with CDK\n\t\tthis._host.closed.pipe(takeUntilDestroyed()).subscribe(() => this._state.set('closed'));\n\t}\n\n\tprivate setSideWithDarkMagic() {\n\t\t/**\n\t\t * This is an ugly workaround to at least figure out the correct side of where a submenu\n\t\t * will appear and set the attribute to the host accordingly\n\t\t *\n\t\t * First of all we take advantage of the menu stack not being aware of the root\n\t\t * object immediately after it is added. This code executes before the root element is added,\n\t\t * which means the stack is still empty and the peek method returns undefined.\n\t\t */\n\t\tconst isRoot = this._host.menuStack.peek() === undefined;\n\t\tsetTimeout(() => {\n\t\t\t// our menu trigger directive leaves the last position used for use immediately after opening\n\t\t\t// we can access it here and determine the correct side.\n\t\t\t// eslint-disable-next-line\n\t\t\tconst ps = (this._host as any)._parentTrigger._spartanLastPosition;\n\t\t\tif (!ps) {\n\t\t\t\t// if we have no last position we default to the most likely option\n\t\t\t\t// I hate that we have to do this and hope we can revisit soon and improve\n\t\t\t\tthis._side.set(isRoot ? 'top' : 'left');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst side = isRoot ? ps.originY : ps.originX === 'end' ? 'right' : 'left';\n\t\t\tthis._side.set(side);\n\t\t});\n\t}\n}\n","import { CdkMenuBar } from '@angular/cdk/menu';\nimport { Directive } from '@angular/core';\n\n@Directive({\n\tselector: '[brnMenuBar]',\n\thostDirectives: [CdkMenuBar],\n})\nexport class BrnMenuBar {}\n","import { CdkMenuGroup } from '@angular/cdk/menu';\nimport { Directive } from '@angular/core';\n\n@Directive({\n\tselector: '[brnMenuGroup]',\n\thostDirectives: [CdkMenuGroup],\n})\nexport class BrnMenuGroup {}\n","import { CdkMenuItem } from '@angular/cdk/menu';\nimport { booleanAttribute, Directive, effect, inject, input } from '@angular/core';\nimport { outputFromObservable } from '@angular/core/rxjs-interop';\n\n@Directive({\n\tselector: '[brnMenuItem]',\n\thostDirectives: [CdkMenuItem],\n\thost: {\n\t\t'[disabled]': 'disabled()',\n\t\t'[attr.data-disabled]': 'disabled() ? \"\" : null',\n\t},\n})\nexport class BrnMenuItem {\n\tprivate readonly _cdkMenuItem = inject(CdkMenuItem);\n\tpublic readonly disabled = input(this._cdkMenuItem.disabled, { transform: booleanAttribute });\n\tpublic readonly triggered = outputFromObservable(this._cdkMenuItem.triggered);\n\n\tconstructor() {\n\t\teffect(() => (this._cdkMenuItem.disabled = this.disabled()));\n\t}\n}\n","import { CdkMenuItemCheckbox } from '@angular/cdk/menu';\nimport { booleanAttribute, Directive, effect, inject, input } from '@angular/core';\nimport { outputFromObservable } from '@angular/core/rxjs-interop';\n\n@Directive({\n\tselector: '[brnMenuItemCheckbox]',\n\thostDirectives: [CdkMenuItemCheckbox],\n\thost: {\n\t\t'[class.checked]': 'checked()',\n\t\t'[disabled]': 'disabled()',\n\t},\n})\nexport class BrnMenuItemCheckbox {\n\tprivate readonly _cdkMenuItem = inject(CdkMenuItemCheckbox);\n\tpublic readonly checked = input(this._cdkMenuItem.checked, { transform: booleanAttribute });\n\tpublic readonly disabled = input(this._cdkMenuItem.disabled, { transform: booleanAttribute });\n\tpublic readonly triggered = outputFromObservable(this._cdkMenuItem.triggered);\n\n\tconstructor() {\n\t\teffect(() => (this._cdkMenuItem.disabled = this.disabled()));\n\t\teffect(() => (this._cdkMenuItem.checked = this.checked()));\n\t}\n}\n","import { CdkMenuItemRadio } from '@angular/cdk/menu';\nimport { booleanAttribute, Directive, effect, inject, input } from '@angular/core';\nimport { outputFromObservable } from '@angular/core/rxjs-interop';\n\n@Directive({\n\tselector: '[brnMenuItemRadio]',\n\thostDirectives: [CdkMenuItemRadio],\n\thost: {\n\t\t'[class.checked]': 'checked()',\n\t\t'[disabled]': 'disabled()',\n\t},\n})\nexport class BrnMenuItemRadio {\n\tprivate readonly _cdkMenuItem = inject(CdkMenuItemRadio);\n\tpublic readonly checked = input(this._cdkMenuItem.checked, { transform: booleanAttribute });\n\tpublic readonly disabled = input(this._cdkMenuItem.disabled, { transform: booleanAttribute });\n\tpublic readonly triggered = outputFromObservable(this._cdkMenuItem.triggered);\n\n\tconstructor() {\n\t\teffect(() => (this._cdkMenuItem.disabled = this.disabled()));\n\t\teffect(() => (this._cdkMenuItem.checked = this.checked()));\n\t}\n}\n","import { CdkMenuTrigger } from '@angular/cdk/menu';\nimport { Directive, effect, inject, input } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { type BrnMenuAlign, BrnMenuSide, getBrnMenuPosition } from './brn-menu-align';\n\n@Directive({\n\tselector: '[brnMenuTriggerFor]',\n\thostDirectives: [\n\t\t{\n\t\t\tdirective: CdkMenuTrigger,\n\t\t\tinputs: ['cdkMenuTriggerFor: brnMenuTriggerFor', 'cdkMenuTriggerData: brnMenuTriggerData'],\n\t\t\toutputs: ['cdkMenuOpened: brnMenuOpened', 'cdkMenuClosed: brnMenuClosed'],\n\t\t},\n\t],\n})\nexport class BrnMenuTrigger {\n\tprivate readonly _cdkTrigger = inject(CdkMenuTrigger, { host: true });\n\tpublic readonly align = input<BrnMenuAlign>('center');\n\tpublic readonly side = input<BrnMenuSide>('bottom');\n\n\tconstructor() {\n\t\t// once the trigger opens we wait until the next tick and then grab the last position\n\t\t// used to position the menu. we store this in our trigger which the brnMenu directive has\n\t\t// access to through DI\n\t\tthis._cdkTrigger.opened.pipe(takeUntilDestroyed()).subscribe(() =>\n\t\t\tsetTimeout(\n\t\t\t\t() =>\n\t\t\t\t\t// eslint-disable-next-line\n\t\t\t\t\t((this._cdkTrigger as any)._spartanLastPosition = // eslint-disable-next-line\n\t\t\t\t\t\t(this._cdkTrigger as any).overlayRef._positionStrategy._lastPosition),\n\t\t\t),\n\t\t);\n\n\t\teffect(() => {\n\t\t\tconst align = this.align();\n\t\t\tconst side = this.side();\n\t\t\tthis._cdkTrigger.menuPosition = getBrnMenuPosition(align, side);\n\t\t});\n\t}\n}\n","import { BrnContextMenuTrigger } from './lib/brn-context-menu-trigger';\nimport { BrnMenu } from './lib/brn-menu';\nimport { BrnMenuBar } from './lib/brn-menu-bar';\nimport { BrnMenuGroup } from './lib/brn-menu-group';\nimport { BrnMenuItem } from './lib/brn-menu-item';\nimport { BrnMenuItemCheckbox } from './lib/brn-menu-item-checkbox';\nimport { BrnMenuItemRadio } from './lib/brn-menu-item-radio';\nimport { BrnMenuTrigger } from './lib/brn-menu-trigger';\n\nexport * from './lib/brn-context-menu-trigger';\nexport * from './lib/brn-menu';\nexport * from './lib/brn-menu-bar';\nexport * from './lib/brn-menu-group';\nexport * from './lib/brn-menu-item';\nexport * from './lib/brn-menu-item-checkbox';\nexport * from './lib/brn-menu-item-radio';\nexport * from './lib/brn-menu-trigger';\n\nexport const BrnMenuImports = [\n\tBrnMenuTrigger,\n\tBrnMenu,\n\tBrnMenuBar,\n\tBrnContextMenuTrigger,\n\tBrnMenuGroup,\n\tBrnMenuItem,\n\tBrnMenuItemRadio,\n\tBrnMenuItemCheckbox,\n] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAKO,MAAM,kBAAkB,GAAG,CAAC,KAAmB,EAAE,IAAiB,KAAyB;IACjG,MAAM,aAAa,GAAG,KAAK,KAAK,OAAO,GAAG,KAAK,GAAG,KAAK,KAAK,KAAK,GAAG,QAAQ,GAAG,QAAQ;AAEvF,IAAA,MAAM,eAAe,GAAG,CACvB,OAAmC,EACnC,OAAoC,EACpC,QAAoC,EACpC,QAAqC,KACZ;AACzB,QAAA,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE;AACxC,QAAA,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE;KAC9E;IAED,QAAQ,IAAI;AACX,QAAA,KAAK,KAAK;YACT,OAAO,e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1F,4BAAA,OAAO,EAAE,CAAC,8BAA8B,EAAE,8BAA8B,CAAC;AACzE,yBAAA;AACD,qBAAA;AACD,iBAAA;;;ACIM,MAAM,cAAc,GAAG;IAC7B,cAAc;IACd,OAAO;IACP,UAAU;IACV,qBAAqB;IACrB,YAAY;IACZ,WAAW;IACX,gBAAgB;IAChB,mBAAmB;;;AC1BpB;;AAEG;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type TemplateRef } from '@angular/core';
|
|
2
|
-
import { type BrnMenuAlign } from './brn-menu-align';
|
|
2
|
+
import { type BrnMenuAlign, BrnMenuSide } from './brn-menu-align';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
import * as i1 from "@angular/cdk/menu";
|
|
5
5
|
export declare class BrnContextMenuTrigger {
|
|
@@ -7,7 +7,8 @@ export declare class BrnContextMenuTrigger {
|
|
|
7
7
|
readonly brnCtxMenuTriggerFor: import("@angular/core").InputSignal<TemplateRef<unknown> | null>;
|
|
8
8
|
readonly brnCtxMenuTriggerData: import("@angular/core").InputSignal<unknown>;
|
|
9
9
|
readonly align: import("@angular/core").InputSignal<BrnMenuAlign>;
|
|
10
|
+
readonly side: import("@angular/core").InputSignal<BrnMenuSide>;
|
|
10
11
|
constructor();
|
|
11
12
|
static ɵfac: i0.ɵɵFactoryDeclaration<BrnContextMenuTrigger, never>;
|
|
12
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnContextMenuTrigger, "[brnCtxMenuTriggerFor]", never, { "brnCtxMenuTriggerFor": { "alias": "brnCtxMenuTriggerFor"; "required": false; "isSignal": true; }; "brnCtxMenuTriggerData": { "alias": "brnCtxMenuTriggerData"; "required": false; "isSignal": true; }; "align": { "alias": "align"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.CdkContextMenuTrigger; inputs: {}; outputs: {}; }]>;
|
|
13
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnContextMenuTrigger, "[brnCtxMenuTriggerFor]", never, { "brnCtxMenuTriggerFor": { "alias": "brnCtxMenuTriggerFor"; "required": false; "isSignal": true; }; "brnCtxMenuTriggerData": { "alias": "brnCtxMenuTriggerData"; "required": false; "isSignal": true; }; "align": { "alias": "align"; "required": false; "isSignal": true; }; "side": { "alias": "side"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.CdkContextMenuTrigger; inputs: {}; outputs: {}; }]>;
|
|
13
14
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { ConnectedPosition } from '@angular/cdk/overlay';
|
|
2
|
-
export type BrnMenuAlign = 'start' | 'center' | 'end'
|
|
3
|
-
export
|
|
2
|
+
export type BrnMenuAlign = 'start' | 'center' | 'end';
|
|
3
|
+
export type BrnMenuSide = 'top' | 'bottom' | 'left' | 'right';
|
|
4
|
+
export declare const getBrnMenuPosition: (align: BrnMenuAlign, side: BrnMenuSide) => ConnectedPosition[];
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { type BrnMenuAlign } from './brn-menu-align';
|
|
1
|
+
import { type BrnMenuAlign, BrnMenuSide } from './brn-menu-align';
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
3
|
import * as i1 from "@angular/cdk/menu";
|
|
4
4
|
export declare class BrnMenuTrigger {
|
|
5
5
|
private readonly _cdkTrigger;
|
|
6
6
|
readonly align: import("@angular/core").InputSignal<BrnMenuAlign>;
|
|
7
|
+
readonly side: import("@angular/core").InputSignal<BrnMenuSide>;
|
|
7
8
|
constructor();
|
|
8
9
|
static ɵfac: i0.ɵɵFactoryDeclaration<BrnMenuTrigger, never>;
|
|
9
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnMenuTrigger, "[brnMenuTriggerFor]", never, { "align": { "alias": "align"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.CdkMenuTrigger; inputs: { "cdkMenuTriggerFor": "brnMenuTriggerFor"; "cdkMenuTriggerData": "brnMenuTriggerData"; }; outputs: { "cdkMenuOpened": "brnMenuOpened"; "cdkMenuClosed": "brnMenuClosed"; }; }]>;
|
|
10
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnMenuTrigger, "[brnMenuTriggerFor]", never, { "align": { "alias": "align"; "required": false; "isSignal": true; }; "side": { "alias": "side"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.CdkMenuTrigger; inputs: { "cdkMenuTriggerFor": "brnMenuTriggerFor"; "cdkMenuTriggerData": "brnMenuTriggerData"; }; outputs: { "cdkMenuOpened": "brnMenuOpened"; "cdkMenuClosed": "brnMenuClosed"; }; }]>;
|
|
10
11
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spartan-ng/brain",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.535",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"exports": {
|
|
6
6
|
"./hlm-tailwind-preset": {
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
"types": "./accordion/index.d.ts",
|
|
19
19
|
"default": "./fesm2022/spartan-ng-brain-accordion.mjs"
|
|
20
20
|
},
|
|
21
|
-
"./autocomplete": {
|
|
22
|
-
"types": "./autocomplete/index.d.ts",
|
|
23
|
-
"default": "./fesm2022/spartan-ng-brain-autocomplete.mjs"
|
|
24
|
-
},
|
|
25
21
|
"./alert-dialog": {
|
|
26
22
|
"types": "./alert-dialog/index.d.ts",
|
|
27
23
|
"default": "./fesm2022/spartan-ng-brain-alert-dialog.mjs"
|
|
28
24
|
},
|
|
25
|
+
"./autocomplete": {
|
|
26
|
+
"types": "./autocomplete/index.d.ts",
|
|
27
|
+
"default": "./fesm2022/spartan-ng-brain-autocomplete.mjs"
|
|
28
|
+
},
|
|
29
29
|
"./avatar": {
|
|
30
30
|
"types": "./avatar/index.d.ts",
|
|
31
31
|
"default": "./fesm2022/spartan-ng-brain-avatar.mjs"
|