@spartan-ng/brain 0.0.1-alpha.555 → 0.0.1-alpha.557
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion/index.d.ts +6 -1
- package/accordion/lib/brn-accordion-content.d.ts +2 -8
- package/accordion/lib/brn-accordion-item.d.ts +28 -0
- package/accordion/lib/brn-accordion-token.d.ts +19 -0
- package/accordion/lib/brn-accordion-trigger.d.ts +16 -0
- package/accordion/lib/brn-accordion.d.ts +1 -42
- package/collapsible/index.d.ts +1 -0
- package/collapsible/lib/brn-collapsible-content.d.ts +6 -9
- package/collapsible/lib/brn-collapsible-token.d.ts +16 -0
- package/collapsible/lib/brn-collapsible-trigger.d.ts +3 -3
- package/collapsible/lib/brn-collapsible.d.ts +5 -1
- package/core/helpers/measure-dimensions.d.ts +5 -0
- package/core/index.d.ts +1 -0
- package/fesm2022/spartan-ng-brain-accordion.mjs +103 -80
- package/fesm2022/spartan-ng-brain-accordion.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-alert-dialog.mjs +3 -5
- package/fesm2022/spartan-ng-brain-alert-dialog.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-avatar.mjs +2 -3
- package/fesm2022/spartan-ng-brain-avatar.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-collapsible.mjs +54 -46
- package/fesm2022/spartan-ng-brain-collapsible.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-core.mjs +15 -1
- package/fesm2022/spartan-ng-brain-core.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-dialog.mjs +3 -5
- package/fesm2022/spartan-ng-brain-dialog.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-popover.mjs +2 -3
- package/fesm2022/spartan-ng-brain-popover.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-radio-group.mjs +13 -7
- package/fesm2022/spartan-ng-brain-radio-group.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-select.mjs +27 -24
- package/fesm2022/spartan-ng-brain-select.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-sheet.mjs +3 -5
- package/fesm2022/spartan-ng-brain-sheet.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-tooltip.mjs +2 -3
- package/fesm2022/spartan-ng-brain-tooltip.mjs.map +1 -1
- package/package.json +1 -1
package/accordion/index.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { BrnAccordion
|
|
1
|
+
import { BrnAccordion } from './lib/brn-accordion';
|
|
2
2
|
import { BrnAccordionContent } from './lib/brn-accordion-content';
|
|
3
|
+
import { BrnAccordionItem } from './lib/brn-accordion-item';
|
|
4
|
+
import { BrnAccordionTrigger } from './lib/brn-accordion-trigger';
|
|
3
5
|
export * from './lib/brn-accordion';
|
|
4
6
|
export * from './lib/brn-accordion-content';
|
|
7
|
+
export * from './lib/brn-accordion-item';
|
|
8
|
+
export * from './lib/brn-accordion-token';
|
|
9
|
+
export * from './lib/brn-accordion-trigger';
|
|
5
10
|
export declare const BrnAccordionImports: readonly [typeof BrnAccordion, typeof BrnAccordionContent, typeof BrnAccordionItem, typeof BrnAccordionTrigger];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
export declare class BrnAccordionContent {
|
|
3
|
+
private readonly _config;
|
|
3
4
|
private readonly _item;
|
|
4
5
|
private readonly _elementRef;
|
|
5
6
|
protected readonly _width: import("@angular/core").WritableSignal<number | null>;
|
|
6
7
|
protected readonly _height: import("@angular/core").WritableSignal<number | null>;
|
|
7
|
-
protected readonly _dimensionsInitiated: import("@angular/core").WritableSignal<boolean>;
|
|
8
8
|
protected readonly _inert: import("@angular/core").Signal<true | undefined>;
|
|
9
9
|
readonly state: import("@angular/core").Signal<"open" | "closed">;
|
|
10
10
|
readonly id: string;
|
|
@@ -14,13 +14,7 @@ export declare class BrnAccordionContent {
|
|
|
14
14
|
* @default 'overflow: hidden'
|
|
15
15
|
*/
|
|
16
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>;
|
|
23
17
|
constructor();
|
|
24
18
|
static ɵfac: i0.ɵɵFactoryDeclaration<BrnAccordionContent, never>;
|
|
25
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnAccordionContent, "brn-accordion-content,[brnAccordionContent]", never, { "style": { "alias": "style"; "required": false; "isSignal": true; };
|
|
19
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnAccordionContent, "brn-accordion-content,[brnAccordionContent]", never, { "style": { "alias": "style"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
26
20
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BooleanInput } from '@angular/cdk/coercion';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class BrnAccordionItem {
|
|
4
|
+
private static _itemIdGenerator;
|
|
5
|
+
readonly id: number;
|
|
6
|
+
private readonly _accordion;
|
|
7
|
+
/**
|
|
8
|
+
* Whether the item is opened or closed.
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
11
|
+
readonly isOpened: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
|
|
12
|
+
/**
|
|
13
|
+
* Computed state of the item, either 'open' or 'closed'
|
|
14
|
+
* @default closed
|
|
15
|
+
*/
|
|
16
|
+
readonly state: import("@angular/core").Signal<"open" | "closed">;
|
|
17
|
+
/**
|
|
18
|
+
* Emits boolean when the item is opened or closed.
|
|
19
|
+
*/
|
|
20
|
+
readonly stateChange: import("@angular/core").OutputEmitterRef<"open" | "closed">;
|
|
21
|
+
/**
|
|
22
|
+
* Emits state change when item is opened or closed
|
|
23
|
+
*/
|
|
24
|
+
readonly openedChange: import("@angular/core").OutputEmitterRef<boolean>;
|
|
25
|
+
constructor();
|
|
26
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BrnAccordionItem, never>;
|
|
27
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnAccordionItem, "[brnAccordionItem]", ["brnAccordionItem"], { "isOpened": { "alias": "isOpened"; "required": false; "isSignal": true; }; }, { "stateChange": "stateChange"; "openedChange": "openedChange"; }, never, never, true, never>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ExistingProvider, InjectionToken, type Type, type ValueProvider } from '@angular/core';
|
|
2
|
+
import type { MeasurementDisplay } from '@spartan-ng/brain/core';
|
|
3
|
+
import type { BrnAccordion } from './brn-accordion';
|
|
4
|
+
import type { BrnAccordionItem } from './brn-accordion-item';
|
|
5
|
+
export declare const BrnAccordionToken: InjectionToken<BrnAccordion>;
|
|
6
|
+
export declare function injectBrnAccordion(): BrnAccordion;
|
|
7
|
+
export declare function provideBrnAccordion(accordion: Type<BrnAccordion>): ExistingProvider;
|
|
8
|
+
export declare const BrnAccordionItemToken: InjectionToken<BrnAccordionItem>;
|
|
9
|
+
export declare function injectBrnAccordionItem(): BrnAccordionItem;
|
|
10
|
+
export declare function provideBrnAccordionItem(item: Type<BrnAccordionItem>): ExistingProvider;
|
|
11
|
+
export interface BrBrnAccordionConfig {
|
|
12
|
+
/**
|
|
13
|
+
* The display style to use when measuring element dimensions.
|
|
14
|
+
* @default 'block'
|
|
15
|
+
*/
|
|
16
|
+
measurementDisplay: MeasurementDisplay;
|
|
17
|
+
}
|
|
18
|
+
export declare function provideBrnAccordionConfig(config: Partial<BrBrnAccordionConfig>): ValueProvider;
|
|
19
|
+
export declare function injectBrnAccordionConfig(): BrBrnAccordionConfig;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FocusableOption } from '@angular/cdk/a11y';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class BrnAccordionTrigger implements FocusableOption {
|
|
4
|
+
private readonly _accordion;
|
|
5
|
+
private readonly _item;
|
|
6
|
+
private readonly _el;
|
|
7
|
+
readonly state: import("@angular/core").Signal<"open" | "closed">;
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly ariaControls: string;
|
|
10
|
+
constructor();
|
|
11
|
+
protected toggle(event: Event): void;
|
|
12
|
+
focus(): void;
|
|
13
|
+
private validateAriaStructure;
|
|
14
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BrnAccordionTrigger, never>;
|
|
15
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnAccordionTrigger, "[brnAccordionTrigger]", never, {}, {}, never, never, true, never>;
|
|
16
|
+
}
|
|
@@ -1,47 +1,6 @@
|
|
|
1
|
-
import { type FocusableOption } from '@angular/cdk/a11y';
|
|
2
|
-
import { type BooleanInput } from '@angular/cdk/coercion';
|
|
3
1
|
import { type AfterContentInit, type OnDestroy } from '@angular/core';
|
|
2
|
+
import { BrnAccordionTrigger } from './brn-accordion-trigger';
|
|
4
3
|
import * as i0 from "@angular/core";
|
|
5
|
-
export declare class BrnAccordionItem {
|
|
6
|
-
private static _itemIdGenerator;
|
|
7
|
-
readonly id: number;
|
|
8
|
-
private readonly _accordion;
|
|
9
|
-
/**
|
|
10
|
-
* Whether the item is opened or closed.
|
|
11
|
-
* @default false
|
|
12
|
-
*/
|
|
13
|
-
readonly isOpened: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
|
|
14
|
-
/**
|
|
15
|
-
* Computed state of the item, either 'open' or 'closed'
|
|
16
|
-
* @default closed
|
|
17
|
-
*/
|
|
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>;
|
|
27
|
-
constructor();
|
|
28
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<BrnAccordionItem, never>;
|
|
29
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnAccordionItem, "[brnAccordionItem]", ["brnAccordionItem"], { "isOpened": { "alias": "isOpened"; "required": false; "isSignal": true; }; }, { "stateChange": "stateChange"; "openedChange": "openedChange"; }, never, never, true, never>;
|
|
30
|
-
}
|
|
31
|
-
export declare class BrnAccordionTrigger implements FocusableOption {
|
|
32
|
-
private readonly _accordion;
|
|
33
|
-
private readonly _item;
|
|
34
|
-
private readonly _el;
|
|
35
|
-
readonly state: import("@angular/core").Signal<"open" | "closed">;
|
|
36
|
-
readonly id: string;
|
|
37
|
-
readonly ariaControls: string;
|
|
38
|
-
constructor();
|
|
39
|
-
protected toggle(event: Event): void;
|
|
40
|
-
focus(): void;
|
|
41
|
-
private validateAriaStructure;
|
|
42
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<BrnAccordionTrigger, never>;
|
|
43
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnAccordionTrigger, "[brnAccordionTrigger]", never, {}, {}, never, never, true, never>;
|
|
44
|
-
}
|
|
45
4
|
export declare class BrnAccordion implements AfterContentInit, OnDestroy {
|
|
46
5
|
private readonly _el;
|
|
47
6
|
private readonly _focusMonitor;
|
package/collapsible/index.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ import { BrnCollapsibleContent } from './lib/brn-collapsible-content';
|
|
|
3
3
|
import { BrnCollapsibleTrigger } from './lib/brn-collapsible-trigger';
|
|
4
4
|
export * from './lib/brn-collapsible';
|
|
5
5
|
export * from './lib/brn-collapsible-content';
|
|
6
|
+
export * from './lib/brn-collapsible-token';
|
|
6
7
|
export * from './lib/brn-collapsible-trigger';
|
|
7
8
|
export declare const BrnCollapsibleImports: readonly [typeof BrnCollapsible, typeof BrnCollapsibleTrigger, typeof BrnCollapsibleContent];
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import { type OnInit } from '@angular/core';
|
|
2
|
-
import { BrnCollapsible } from './brn-collapsible';
|
|
3
1
|
import * as i0 from "@angular/core";
|
|
4
|
-
export declare class BrnCollapsibleContent
|
|
5
|
-
|
|
2
|
+
export declare class BrnCollapsibleContent {
|
|
3
|
+
private readonly _config;
|
|
6
4
|
private readonly _elementRef;
|
|
7
|
-
|
|
5
|
+
protected readonly _collapsible: import("@spartan-ng/brain/collapsible").BrnCollapsible | null;
|
|
6
|
+
protected readonly _width: import("@angular/core").WritableSignal<number | null>;
|
|
7
|
+
protected readonly _height: import("@angular/core").WritableSignal<number | null>;
|
|
8
8
|
/**
|
|
9
9
|
* The id of the collapsible content element.
|
|
10
10
|
*/
|
|
11
11
|
readonly id: import("@angular/core").InputSignal<string | null | undefined>;
|
|
12
|
-
protected readonly _width: import("@angular/core").WritableSignal<number | null>;
|
|
13
|
-
protected readonly _height: import("@angular/core").WritableSignal<number | null>;
|
|
14
12
|
constructor();
|
|
15
|
-
ngOnInit(): void;
|
|
16
13
|
static ɵfac: i0.ɵɵFactoryDeclaration<BrnCollapsibleContent, never>;
|
|
17
|
-
static
|
|
14
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnCollapsibleContent, "[brnCollapsibleContent],brn-collapsible-content", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
18
15
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ValueProvider } from '@angular/core';
|
|
2
|
+
import { type ExistingProvider, InjectionToken, type Type } from '@angular/core';
|
|
3
|
+
import type { MeasurementDisplay } from '@spartan-ng/brain/core';
|
|
4
|
+
import type { BrnCollapsible } from './brn-collapsible';
|
|
5
|
+
export declare const BrnCollapsibleToken: InjectionToken<BrnCollapsible>;
|
|
6
|
+
export declare function injectBrnCollapsible(): BrnCollapsible | null;
|
|
7
|
+
export declare function provideBrnCollapsible(collapsible: Type<BrnCollapsible>): ExistingProvider;
|
|
8
|
+
export interface BrCollapsibleConfig {
|
|
9
|
+
/**
|
|
10
|
+
* The display style to use when measuring element dimensions.
|
|
11
|
+
* @default 'block'
|
|
12
|
+
*/
|
|
13
|
+
measurementDisplay: MeasurementDisplay;
|
|
14
|
+
}
|
|
15
|
+
export declare function provideBrnCollapsibleConfig(config: Partial<BrCollapsibleConfig>): ValueProvider;
|
|
16
|
+
export declare function injectBrnCollapsibleConfig(): BrCollapsibleConfig;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { BrnCollapsible } from './brn-collapsible';
|
|
2
1
|
import * as i0 from "@angular/core";
|
|
3
2
|
export declare class BrnCollapsibleTrigger {
|
|
4
|
-
protected readonly _collapsible: BrnCollapsible | null;
|
|
3
|
+
protected readonly _collapsible: import("@spartan-ng/brain/collapsible").BrnCollapsible | null;
|
|
4
|
+
readonly type: import("@angular/core").InputSignal<"button" | "submit" | "reset">;
|
|
5
5
|
constructor();
|
|
6
6
|
toggle(): void;
|
|
7
7
|
static ɵfac: i0.ɵɵFactoryDeclaration<BrnCollapsibleTrigger, never>;
|
|
8
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnCollapsibleTrigger, "button[brnCollapsibleTrigger]", never, {}, {}, never, never, true, never>;
|
|
8
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnCollapsibleTrigger, "button[brnCollapsibleTrigger]", never, { "type": { "alias": "type"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
9
9
|
}
|
|
@@ -7,6 +7,10 @@ export declare class BrnCollapsible {
|
|
|
7
7
|
* The expanded or collapsed state of the collapsible component.
|
|
8
8
|
*/
|
|
9
9
|
readonly expanded: import("@angular/core").ModelSignal<boolean>;
|
|
10
|
+
/**
|
|
11
|
+
* The current state of the collapsible component as 'open' or 'closed'.
|
|
12
|
+
*/
|
|
13
|
+
readonly state: import("@angular/core").Signal<BrnCollapsibleState>;
|
|
10
14
|
/**
|
|
11
15
|
* The disabled state of the collapsible component.
|
|
12
16
|
*/
|
|
@@ -16,5 +20,5 @@ export declare class BrnCollapsible {
|
|
|
16
20
|
*/
|
|
17
21
|
toggle(): void;
|
|
18
22
|
static ɵfac: i0.ɵɵFactoryDeclaration<BrnCollapsible, never>;
|
|
19
|
-
static
|
|
23
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnCollapsible, "[brnCollapsible],brn-collapsible", never, { "expanded": { "alias": "expanded"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "expanded": "expandedChange"; }, never, never, true, never>;
|
|
20
24
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type MeasurementDisplay = 'block' | 'inline-block' | 'flex' | 'grid' | 'table' | 'contents' | (string & {});
|
|
2
|
+
export declare const measureDimensions: (elementToMeasure: HTMLElement, measurementDisplay: MeasurementDisplay) => {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
};
|
package/core/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './helpers/debounced-signal';
|
|
|
5
5
|
export * from './helpers/dev-mode';
|
|
6
6
|
export * from './helpers/exposes-side';
|
|
7
7
|
export * from './helpers/exposes-state';
|
|
8
|
+
export * from './helpers/measure-dimensions';
|
|
8
9
|
export * from './helpers/table-classes-settable';
|
|
9
10
|
export * from './helpers/wait-for-element-animations';
|
|
10
11
|
export * from './helpers/zone-free';
|
|
@@ -1,71 +1,39 @@
|
|
|
1
1
|
import { FocusMonitor, FocusKeyManager } from '@angular/cdk/a11y';
|
|
2
|
-
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
3
2
|
import * as i0 from '@angular/core';
|
|
4
|
-
import {
|
|
3
|
+
import { InjectionToken, inject, ElementRef, isDevMode, Directive, computed, signal, contentChildren, input, afterNextRender, output, effect, untracked } from '@angular/core';
|
|
5
4
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
6
5
|
import { fromEvent } from 'rxjs';
|
|
6
|
+
import { measureDimensions } from '@spartan-ng/brain/core';
|
|
7
|
+
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
_accordion = inject(BrnAccordion);
|
|
12
|
-
/**
|
|
13
|
-
* Whether the item is opened or closed.
|
|
14
|
-
* @default false
|
|
15
|
-
*/
|
|
16
|
-
isOpened = input(false, { transform: coerceBooleanProperty });
|
|
17
|
-
/**
|
|
18
|
-
* Computed state of the item, either 'open' or 'closed'
|
|
19
|
-
* @default closed
|
|
20
|
-
*/
|
|
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();
|
|
30
|
-
constructor() {
|
|
31
|
-
if (!this._accordion) {
|
|
32
|
-
throw Error('Accordion item can only be used inside an Accordion. Add brnAccordion to ancestor.');
|
|
33
|
-
}
|
|
34
|
-
effect(() => {
|
|
35
|
-
const state = this.state();
|
|
36
|
-
untracked(() => {
|
|
37
|
-
this.stateChange.emit(state);
|
|
38
|
-
this.openedChange.emit(state === 'open');
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
effect(() => {
|
|
42
|
-
const isOpened = this.isOpened();
|
|
43
|
-
untracked(() => {
|
|
44
|
-
if (isOpened) {
|
|
45
|
-
this._accordion.openItem(this.id);
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
this._accordion.closeItem(this.id);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAccordionItem, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
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 });
|
|
9
|
+
const BrnAccordionToken = new InjectionToken('BrnAccordionToken');
|
|
10
|
+
function injectBrnAccordion() {
|
|
11
|
+
return inject(BrnAccordionToken);
|
|
55
12
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
13
|
+
function provideBrnAccordion(accordion) {
|
|
14
|
+
return { provide: BrnAccordionToken, useExisting: accordion };
|
|
15
|
+
}
|
|
16
|
+
const BrnAccordionItemToken = new InjectionToken('BrnAccordionItemToken');
|
|
17
|
+
function injectBrnAccordionItem() {
|
|
18
|
+
return inject(BrnAccordionItemToken);
|
|
19
|
+
}
|
|
20
|
+
function provideBrnAccordionItem(item) {
|
|
21
|
+
return { provide: BrnAccordionItemToken, useExisting: item };
|
|
22
|
+
}
|
|
23
|
+
const defaultConfig = {
|
|
24
|
+
measurementDisplay: 'block',
|
|
25
|
+
};
|
|
26
|
+
const BrnAccordionConfigToken = new InjectionToken('BrnBrnAccordionConfig');
|
|
27
|
+
function provideBrnAccordionConfig(config) {
|
|
28
|
+
return { provide: BrnAccordionConfigToken, useValue: { ...defaultConfig, ...config } };
|
|
29
|
+
}
|
|
30
|
+
function injectBrnAccordionConfig() {
|
|
31
|
+
return inject(BrnAccordionConfigToken, { optional: true }) ?? defaultConfig;
|
|
32
|
+
}
|
|
33
|
+
|
|
66
34
|
class BrnAccordionTrigger {
|
|
67
|
-
_accordion =
|
|
68
|
-
_item =
|
|
35
|
+
_accordion = injectBrnAccordion();
|
|
36
|
+
_item = injectBrnAccordionItem();
|
|
69
37
|
_el = inject((ElementRef));
|
|
70
38
|
state = this._item.state;
|
|
71
39
|
id = `brn-accordion-trigger-${this._item.id}`;
|
|
@@ -136,6 +104,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
136
104
|
},
|
|
137
105
|
}]
|
|
138
106
|
}], ctorParameters: () => [] });
|
|
107
|
+
|
|
139
108
|
const HORIZONTAL_KEYS_TO_PREVENT_DEFAULT = [
|
|
140
109
|
'ArrowLeft',
|
|
141
110
|
'ArrowRight',
|
|
@@ -254,7 +223,7 @@ class BrnAccordion {
|
|
|
254
223
|
}
|
|
255
224
|
}
|
|
256
225
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAccordion, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
257
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.8", type: BrnAccordion, isStandalone: true, selector: "[brnAccordion]", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, dir: { classPropertyName: "dir", publicName: "dir", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-state": "state()", "attr.data-orientation": "orientation()" } }, queries: [{ propertyName: "triggers", predicate: BrnAccordionTrigger, descendants: true, isSignal: true }], exportAs: ["brnAccordion"], ngImport: i0 });
|
|
226
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.8", type: BrnAccordion, isStandalone: true, selector: "[brnAccordion]", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, dir: { classPropertyName: "dir", publicName: "dir", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-state": "state()", "attr.data-orientation": "orientation()" } }, providers: [provideBrnAccordion(BrnAccordion)], queries: [{ propertyName: "triggers", predicate: BrnAccordionTrigger, descendants: true, isSignal: true }], exportAs: ["brnAccordion"], ngImport: i0 });
|
|
258
227
|
}
|
|
259
228
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAccordion, decorators: [{
|
|
260
229
|
type: Directive,
|
|
@@ -264,31 +233,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
264
233
|
'[attr.data-state]': 'state()',
|
|
265
234
|
'[attr.data-orientation]': 'orientation()',
|
|
266
235
|
},
|
|
236
|
+
providers: [provideBrnAccordion(BrnAccordion)],
|
|
267
237
|
exportAs: 'brnAccordion',
|
|
268
238
|
}]
|
|
269
239
|
}] });
|
|
270
240
|
|
|
271
241
|
class BrnAccordionContent {
|
|
272
|
-
|
|
242
|
+
_config = injectBrnAccordionConfig();
|
|
243
|
+
_item = injectBrnAccordionItem();
|
|
273
244
|
_elementRef = inject(ElementRef);
|
|
274
245
|
_width = signal(null);
|
|
275
246
|
_height = signal(null);
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
ariaLabeledBy = `brn-accordion-trigger-${this._item.id}`;
|
|
247
|
+
_inert = computed(() => (this.state?.() === 'closed' ? true : undefined));
|
|
248
|
+
state = this._item?.state;
|
|
249
|
+
id = `brn-accordion-content-${this._item?.id}`;
|
|
250
|
+
ariaLabeledBy = `brn-accordion-trigger-${this._item?.id}`;
|
|
281
251
|
/**
|
|
282
252
|
* The style to be applied to the host element after the dimensions are calculated.
|
|
283
253
|
* @default 'overflow: hidden'
|
|
284
254
|
*/
|
|
285
255
|
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'
|
|
289
|
-
*/
|
|
290
|
-
styleWhileDimensionsAreInitiating = input('overflow: hidden');
|
|
291
|
-
_mutableStyle = linkedSignal(() => this._dimensionsInitiated() ? this.style() : this.styleWhileDimensionsAreInitiating());
|
|
292
256
|
constructor() {
|
|
293
257
|
if (!this._item) {
|
|
294
258
|
throw Error('Accordion Content can only be used inside an AccordionItem. Add brnAccordionItem to parent.');
|
|
@@ -297,37 +261,96 @@ class BrnAccordionContent {
|
|
|
297
261
|
const content = this._elementRef.nativeElement.firstChild;
|
|
298
262
|
if (!content)
|
|
299
263
|
return;
|
|
300
|
-
const { width, height } = content.
|
|
264
|
+
const { width, height } = measureDimensions(content, this._config.measurementDisplay);
|
|
301
265
|
this._width.set(width);
|
|
302
266
|
this._height.set(height);
|
|
303
|
-
this._dimensionsInitiated.set(true);
|
|
304
267
|
});
|
|
305
268
|
}
|
|
306
269
|
/** @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 }
|
|
270
|
+
/** @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 } }, 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": "style()" } }, ngImport: i0 });
|
|
308
271
|
}
|
|
309
272
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAccordionContent, decorators: [{
|
|
310
273
|
type: Directive,
|
|
311
274
|
args: [{
|
|
312
275
|
selector: 'brn-accordion-content,[brnAccordionContent]',
|
|
313
276
|
host: {
|
|
314
|
-
'[attr.data-state]': 'state()',
|
|
277
|
+
'[attr.data-state]': 'state?.()',
|
|
315
278
|
'[attr.aria-labelledby]': 'ariaLabeledBy',
|
|
316
279
|
role: 'region',
|
|
317
280
|
'[id]': 'id',
|
|
318
281
|
'[style.--brn-accordion-content-width.px]': '_width()',
|
|
319
282
|
'[style.--brn-accordion-content-height.px]': '_height()',
|
|
320
283
|
'[attr.inert]': '_inert()',
|
|
321
|
-
'[attr.style]': '
|
|
284
|
+
'[attr.style]': 'style()',
|
|
322
285
|
},
|
|
323
286
|
}]
|
|
324
287
|
}], ctorParameters: () => [] });
|
|
325
288
|
|
|
289
|
+
class BrnAccordionItem {
|
|
290
|
+
static _itemIdGenerator = 0;
|
|
291
|
+
id = ++BrnAccordionItem._itemIdGenerator;
|
|
292
|
+
_accordion = injectBrnAccordion();
|
|
293
|
+
/**
|
|
294
|
+
* Whether the item is opened or closed.
|
|
295
|
+
* @default false
|
|
296
|
+
*/
|
|
297
|
+
isOpened = input(false, { transform: coerceBooleanProperty });
|
|
298
|
+
/**
|
|
299
|
+
* Computed state of the item, either 'open' or 'closed'
|
|
300
|
+
* @default closed
|
|
301
|
+
*/
|
|
302
|
+
state = computed(() => (this._accordion.openItemIds()?.includes(this.id) ? 'open' : 'closed'));
|
|
303
|
+
/**
|
|
304
|
+
* Emits boolean when the item is opened or closed.
|
|
305
|
+
*/
|
|
306
|
+
stateChange = output();
|
|
307
|
+
/**
|
|
308
|
+
* Emits state change when item is opened or closed
|
|
309
|
+
*/
|
|
310
|
+
openedChange = output();
|
|
311
|
+
constructor() {
|
|
312
|
+
if (!this._accordion) {
|
|
313
|
+
throw Error('Accordion item can only be used inside an Accordion. Add brnAccordion to ancestor.');
|
|
314
|
+
}
|
|
315
|
+
effect(() => {
|
|
316
|
+
const state = this.state();
|
|
317
|
+
untracked(() => {
|
|
318
|
+
this.stateChange.emit(state);
|
|
319
|
+
this.openedChange.emit(state === 'open');
|
|
320
|
+
});
|
|
321
|
+
});
|
|
322
|
+
effect(() => {
|
|
323
|
+
const isOpened = this.isOpened();
|
|
324
|
+
untracked(() => {
|
|
325
|
+
if (isOpened) {
|
|
326
|
+
this._accordion.openItem(this.id);
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
|
+
this._accordion.closeItem(this.id);
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAccordionItem, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
335
|
+
/** @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()" } }, providers: [provideBrnAccordionItem(BrnAccordionItem)], exportAs: ["brnAccordionItem"], ngImport: i0 });
|
|
336
|
+
}
|
|
337
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAccordionItem, decorators: [{
|
|
338
|
+
type: Directive,
|
|
339
|
+
args: [{
|
|
340
|
+
selector: '[brnAccordionItem]',
|
|
341
|
+
host: {
|
|
342
|
+
'[attr.data-state]': 'state()',
|
|
343
|
+
},
|
|
344
|
+
providers: [provideBrnAccordionItem(BrnAccordionItem)],
|
|
345
|
+
exportAs: 'brnAccordionItem',
|
|
346
|
+
}]
|
|
347
|
+
}], ctorParameters: () => [] });
|
|
348
|
+
|
|
326
349
|
const BrnAccordionImports = [BrnAccordion, BrnAccordionContent, BrnAccordionItem, BrnAccordionTrigger];
|
|
327
350
|
|
|
328
351
|
/**
|
|
329
352
|
* Generated bundle index. Do not edit.
|
|
330
353
|
*/
|
|
331
354
|
|
|
332
|
-
export { BrnAccordion, BrnAccordionContent, BrnAccordionImports, BrnAccordionItem, BrnAccordionTrigger };
|
|
355
|
+
export { BrnAccordion, BrnAccordionContent, BrnAccordionImports, BrnAccordionItem, BrnAccordionItemToken, BrnAccordionToken, BrnAccordionTrigger, injectBrnAccordion, injectBrnAccordionConfig, injectBrnAccordionItem, provideBrnAccordion, provideBrnAccordionConfig, provideBrnAccordionItem };
|
|
333
356
|
//# sourceMappingURL=spartan-ng-brain-accordion.mjs.map
|