@angular/cdk-experimental 20.0.3 → 20.1.0-next.0

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.
Files changed (42) hide show
  1. package/accordion/index.d.ts +86 -0
  2. package/accordion.d-B3UVyhWI.d.ts +87 -0
  3. package/expansion.d-DSLPa1yp.d.ts +74 -0
  4. package/fesm2022/accordion-CyyDY39y.mjs +152 -0
  5. package/fesm2022/accordion-CyyDY39y.mjs.map +1 -0
  6. package/fesm2022/accordion.mjs +184 -0
  7. package/fesm2022/accordion.mjs.map +1 -0
  8. package/fesm2022/cdk-experimental.mjs +1 -1
  9. package/fesm2022/cdk-experimental.mjs.map +1 -1
  10. package/fesm2022/expansion-DykBzWrb.mjs +93 -0
  11. package/fesm2022/expansion-DykBzWrb.mjs.map +1 -0
  12. package/fesm2022/{list-focus-Di7m_z_6.mjs → list-focus-BXQdAA3i.mjs} +2 -126
  13. package/fesm2022/list-focus-BXQdAA3i.mjs.map +1 -0
  14. package/fesm2022/list-selection-BLV4Yy7T.mjs +130 -0
  15. package/fesm2022/list-selection-BLV4Yy7T.mjs.map +1 -0
  16. package/fesm2022/listbox.mjs +18 -14
  17. package/fesm2022/listbox.mjs.map +1 -1
  18. package/fesm2022/{option-f_gNslw8.mjs → option-r2ojgVMH.mjs} +15 -2
  19. package/fesm2022/option-r2ojgVMH.mjs.map +1 -0
  20. package/fesm2022/radio-s5uO_tmJ.mjs +203 -0
  21. package/fesm2022/radio-s5uO_tmJ.mjs.map +1 -0
  22. package/fesm2022/radio.mjs +169 -0
  23. package/fesm2022/radio.mjs.map +1 -0
  24. package/fesm2022/{tabs-DFP3Xs4J.mjs → tabs-BN3wsMdD.mjs} +46 -80
  25. package/fesm2022/tabs-BN3wsMdD.mjs.map +1 -0
  26. package/fesm2022/tabs.mjs +4 -2
  27. package/fesm2022/tabs.mjs.map +1 -1
  28. package/fesm2022/ui-patterns.mjs +7 -3
  29. package/fesm2022/ui-patterns.mjs.map +1 -1
  30. package/{list-navigation.d-DfOSxsSp.d.ts → list-navigation.d-Br99p_2O.d.ts} +2 -64
  31. package/list-selection.d-BQWRFJI-.d.ts +69 -0
  32. package/listbox/index.d.ts +5 -10
  33. package/{listbox.d-QWPLmxRe.d.ts → listbox.d-C8oz9si7.d.ts} +4 -1
  34. package/package.json +11 -3
  35. package/radio/index.d.ts +77 -0
  36. package/radio-group.d-C3xIREax.d.ts +114 -0
  37. package/tabs/index.d.ts +4 -2
  38. package/{tabs.d-DooGD7Uk.d.ts → tabs.d-D0UIRVMM.d.ts} +17 -61
  39. package/ui-patterns/index.d.ts +7 -3
  40. package/fesm2022/list-focus-Di7m_z_6.mjs.map +0 -1
  41. package/fesm2022/option-f_gNslw8.mjs.map +0 -1
  42. package/fesm2022/tabs-DFP3Xs4J.mjs.map +0 -1
@@ -0,0 +1,86 @@
1
+ import * as _angular_cdk_bidi from '@angular/cdk/bidi';
2
+ import * as i0 from '@angular/core';
3
+ import { WritableSignal } from '@angular/core';
4
+ import { c as AccordionTriggerPattern, e as AccordionPanelPattern, a as AccordionGroupPattern } from '../accordion.d-B3UVyhWI.js';
5
+ import * as i1 from '@angular/cdk-experimental/deferred-content';
6
+ import '../list-navigation.d-Br99p_2O.js';
7
+ import '../expansion.d-DSLPa1yp.js';
8
+
9
+ /**
10
+ * Represents the content panel of an accordion item. It is controlled by an
11
+ * associated `CdkAccordionTrigger`.
12
+ */
13
+ declare class CdkAccordionPanel {
14
+ /** The DeferredContentAware host directive. */
15
+ private readonly _deferredContentAware;
16
+ /** A global unique identifier for the panel. */
17
+ private readonly _id;
18
+ /** A local unique identifier for the panel, used to match with its trigger's value. */
19
+ value: i0.InputSignal<string>;
20
+ /** The parent accordion trigger pattern that controls this panel. This is set by CdkAccordionGroup. */
21
+ readonly accordionTrigger: WritableSignal<AccordionTriggerPattern | undefined>;
22
+ /** The UI pattern instance for this panel. */
23
+ readonly pattern: AccordionPanelPattern;
24
+ constructor();
25
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkAccordionPanel, never>;
26
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkAccordionPanel, "[cdkAccordionPanel]", ["cdkAccordionPanel"], { "value": { "alias": "value"; "required": true; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.DeferredContentAware; inputs: { "preserveContent": "preserveContent"; }; outputs: {}; }]>;
27
+ }
28
+ /**
29
+ * Represents the trigger button for an accordion item. It controls the expansion
30
+ * state of an associated `CdkAccordionPanel`.
31
+ */
32
+ declare class CdkAccordionTrigger {
33
+ /** A global unique identifier for the trigger. */
34
+ private readonly _id;
35
+ /** A reference to the trigger element. */
36
+ private readonly _elementRef;
37
+ /** The parent CdkAccordionGroup. */
38
+ private readonly _accordionGroup;
39
+ /** A local unique identifier for the trigger, used to match with its panel's value. */
40
+ value: i0.InputSignal<string>;
41
+ /** Whether the trigger is disabled. */
42
+ disabled: i0.InputSignalWithTransform<boolean, unknown>;
43
+ /** The accordion panel pattern controlled by this trigger. This is set by CdkAccordionGroup. */
44
+ readonly accordionPanel: WritableSignal<AccordionPanelPattern | undefined>;
45
+ /** The UI pattern instance for this trigger. */
46
+ readonly pattern: AccordionTriggerPattern;
47
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkAccordionTrigger, never>;
48
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkAccordionTrigger, "[cdkAccordionTrigger]", ["cdkAccordionTrigger"], { "value": { "alias": "value"; "required": true; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
49
+ }
50
+ /**
51
+ * Container for a group of accordion items. It manages the overall state and
52
+ * interactions of the accordion, such as keyboard navigation and expansion mode.
53
+ */
54
+ declare class CdkAccordionGroup {
55
+ /** The CdkAccordionTriggers nested inside this group. */
56
+ protected readonly _triggers: i0.Signal<readonly CdkAccordionTrigger[]>;
57
+ /** The CdkAccordionPanels nested inside this group. */
58
+ protected readonly _panels: i0.Signal<readonly CdkAccordionPanel[]>;
59
+ /** The text direction (ltr or rtl). */
60
+ readonly textDirection: WritableSignal<_angular_cdk_bidi.Direction>;
61
+ /** Whether the entire accordion group is disabled. */
62
+ disabled: i0.InputSignalWithTransform<boolean, unknown>;
63
+ /** Whether multiple accordion items can be expanded simultaneously. */
64
+ multiExpandable: i0.InputSignalWithTransform<boolean, unknown>;
65
+ /** The values of the current selected/expanded accordions. */
66
+ value: i0.ModelSignal<string[]>;
67
+ /** Whether disabled items should be skipped during keyboard navigation. */
68
+ skipDisabled: i0.InputSignalWithTransform<boolean, unknown>;
69
+ /** Whether keyboard navigation should wrap around from the last item to the first, and vice-versa. */
70
+ wrap: i0.InputSignalWithTransform<boolean, unknown>;
71
+ /** The UI pattern instance for this accordion group. */
72
+ readonly pattern: AccordionGroupPattern;
73
+ constructor();
74
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkAccordionGroup, never>;
75
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkAccordionGroup, "[cdkAccordionGroup]", ["cdkAccordionGroup"], { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "multiExpandable": { "alias": "multiExpandable"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "skipDisabled": { "alias": "skipDisabled"; "required": false; "isSignal": true; }; "wrap": { "alias": "wrap"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, ["_triggers", "_panels"], never, true, never>;
76
+ }
77
+ /**
78
+ * A structural directive that marks the `ng-template` to be used as the content
79
+ * for a `CdkAccordionPanel`. This content can be lazily loaded.
80
+ */
81
+ declare class CdkAccordionContent {
82
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkAccordionContent, never>;
83
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkAccordionContent, "ng-template[cdkAccordionContent]", never, {}, {}, never, never, true, [{ directive: typeof i1.DeferredContent; inputs: {}; outputs: {}; }]>;
84
+ }
85
+
86
+ export { CdkAccordionContent, CdkAccordionGroup, CdkAccordionPanel, CdkAccordionTrigger };
@@ -0,0 +1,87 @@
1
+ import * as i0 from '@angular/core';
2
+ import { L as ListNavigationInputs, a as ListFocusInputs, b as ListNavigation, d as ListFocus, e as ListNavigationItem, f as ListFocusItem, S as SignalLike, K as KeyboardEventManager, P as PointerEventManager } from './list-navigation.d-Br99p_2O.js';
3
+ import { L as ListExpansionInputs, a as ListExpansion, E as ExpansionItem, b as ExpansionControl } from './expansion.d-DSLPa1yp.js';
4
+
5
+ /** Inputs of the AccordionGroupPattern. */
6
+ type AccordionGroupInputs = Omit<ListNavigationInputs<AccordionTriggerPattern> & ListFocusInputs<AccordionTriggerPattern> & ListExpansionInputs<AccordionTriggerPattern>, 'focusMode'>;
7
+ interface AccordionGroupPattern extends AccordionGroupInputs {
8
+ }
9
+ /** A pattern controls the nested Accordions. */
10
+ declare class AccordionGroupPattern {
11
+ readonly inputs: AccordionGroupInputs;
12
+ /** Controls navigation for the group. */
13
+ navigation: ListNavigation<AccordionTriggerPattern>;
14
+ /** Controls focus for the group. */
15
+ focusManager: ListFocus<AccordionTriggerPattern>;
16
+ /** Controls expansion for the group. */
17
+ expansionManager: ListExpansion<AccordionTriggerPattern>;
18
+ constructor(inputs: AccordionGroupInputs);
19
+ }
20
+ /** Inputs for the AccordionTriggerPattern. */
21
+ type AccordionTriggerInputs = ListNavigationItem & ListFocusItem & Omit<ExpansionItem, 'expansionId' | 'expandable'> & {
22
+ /** A local unique identifier for the trigger. */
23
+ value: SignalLike<string>;
24
+ /** The parent accordion group that controls this trigger. */
25
+ accordionGroup: SignalLike<AccordionGroupPattern>;
26
+ /** The accordion panel controlled by this trigger. */
27
+ accordionPanel: SignalLike<AccordionPanelPattern | undefined>;
28
+ };
29
+ interface AccordionTriggerPattern extends AccordionTriggerInputs {
30
+ }
31
+ /** A pattern controls the expansion state of an accordion. */
32
+ declare class AccordionTriggerPattern {
33
+ readonly inputs: AccordionTriggerInputs;
34
+ /** Whether this tab has expandable content. */
35
+ expandable: SignalLike<boolean>;
36
+ /** The unique identifier used by the expansion behavior. */
37
+ expansionId: SignalLike<string>;
38
+ /** Whether an accordion is expanded. */
39
+ expanded: SignalLike<boolean>;
40
+ /** Controls the expansion state for the trigger. */
41
+ expansionControl: ExpansionControl;
42
+ /** Whether the trigger is active. */
43
+ active: i0.Signal<boolean>;
44
+ /** Id of the accordion panel controlled by the trigger. */
45
+ controls: i0.Signal<string | undefined>;
46
+ /** The tabindex of the trigger. */
47
+ tabindex: i0.Signal<-1 | 0>;
48
+ /** Whether the trigger is disabled. Disabling an accordion group disables all the triggers. */
49
+ disabled: i0.Signal<boolean>;
50
+ constructor(inputs: AccordionTriggerInputs);
51
+ /** The key used to navigate to the previous accordion trigger. */
52
+ prevKey: i0.Signal<"ArrowUp" | "ArrowRight" | "ArrowLeft">;
53
+ /** The key used to navigate to the next accordion trigger. */
54
+ nextKey: i0.Signal<"ArrowRight" | "ArrowLeft" | "ArrowDown">;
55
+ /** The keydown event manager for the accordion trigger. */
56
+ keydown: i0.Signal<KeyboardEventManager<KeyboardEvent>>;
57
+ /** The pointerdown event manager for the accordion trigger. */
58
+ pointerdown: i0.Signal<PointerEventManager<PointerEvent>>;
59
+ /** Handles keydown events on the trigger, delegating to the group if not disabled. */
60
+ onKeydown(event: KeyboardEvent): void;
61
+ /** Handles pointerdown events on the trigger, delegating to the group if not disabled. */
62
+ onPointerdown(event: PointerEvent): void;
63
+ /** Handles focus events on the trigger. This ensures the tabbing changes the active index. */
64
+ onFocus(event: FocusEvent): void;
65
+ private _getItem;
66
+ }
67
+ /** Represents the required inputs for the AccordionPanelPattern. */
68
+ interface AccordionPanelInputs {
69
+ /** A global unique identifier for the panel. */
70
+ id: SignalLike<string>;
71
+ /** A local unique identifier for the panel, matching its trigger's value. */
72
+ value: SignalLike<string>;
73
+ /** The parent accordion trigger that controls this panel. */
74
+ accordionTrigger: SignalLike<AccordionTriggerPattern | undefined>;
75
+ }
76
+ interface AccordionPanelPattern extends AccordionPanelInputs {
77
+ }
78
+ /** Represents an accordion panel. */
79
+ declare class AccordionPanelPattern {
80
+ readonly inputs: AccordionPanelInputs;
81
+ /** Whether the accordion panel is hidden. True if the associated trigger is not expanded. */
82
+ hidden: SignalLike<boolean>;
83
+ constructor(inputs: AccordionPanelInputs);
84
+ }
85
+
86
+ export { AccordionGroupPattern as a, AccordionTriggerPattern as c, AccordionPanelPattern as e };
87
+ export type { AccordionGroupInputs as A, AccordionTriggerInputs as b, AccordionPanelInputs as d };
@@ -0,0 +1,74 @@
1
+ import * as i0 from '@angular/core';
2
+ import { f as ListFocusItem, S as SignalLike, a as ListFocusInputs, W as WritableSignalLike, d as ListFocus } from './list-navigation.d-Br99p_2O.js';
3
+
4
+ /** Represents an item that can be expanded or collapsed. */
5
+ interface ExpansionItem extends ListFocusItem {
6
+ /** Whether the item is expandable. */
7
+ expandable: SignalLike<boolean>;
8
+ /** Used to uniquely identify an expansion item. */
9
+ expansionId: SignalLike<string>;
10
+ }
11
+ interface ExpansionControl extends ExpansionItem {
12
+ }
13
+ /**
14
+ * Controls a single item's expansion state and interactions,
15
+ * delegating actual state changes to an Expansion manager.
16
+ */
17
+ declare class ExpansionControl {
18
+ readonly inputs: ExpansionItem & {
19
+ expansionManager: ListExpansion<ExpansionItem>;
20
+ };
21
+ /** Whether this specific item is currently expanded. Derived from the Expansion manager. */
22
+ readonly isExpanded: i0.Signal<boolean>;
23
+ /** Whether this item can be expanded. */
24
+ readonly isExpandable: i0.Signal<boolean>;
25
+ constructor(inputs: ExpansionItem & {
26
+ expansionManager: ListExpansion<ExpansionItem>;
27
+ });
28
+ /** Requests the Expansopn manager to open this item. */
29
+ open(): void;
30
+ /** Requests the Expansion manager to close this item. */
31
+ close(): void;
32
+ /** Requests the Expansion manager to toggle this item. */
33
+ toggle(): void;
34
+ }
35
+ /** Represents the required inputs for an expansion behavior. */
36
+ interface ListExpansionInputs<T extends ExpansionItem> extends ListFocusInputs<T> {
37
+ /** Whether multiple items can be expanded at once. */
38
+ multiExpandable: SignalLike<boolean>;
39
+ /** An array of ids of the currently expanded items. */
40
+ expandedIds: WritableSignalLike<string[]>;
41
+ }
42
+ /** Manages the expansion state of a list of items. */
43
+ declare class ListExpansion<T extends ExpansionItem> {
44
+ readonly inputs: ListExpansionInputs<T> & {
45
+ focusManager: ListFocus<T>;
46
+ };
47
+ /** A signal holding an array of ids of the currently expanded items. */
48
+ expandedIds: WritableSignalLike<string[]>;
49
+ /** The currently active (focused) item in the list. */
50
+ activeItem: i0.Signal<T>;
51
+ constructor(inputs: ListExpansionInputs<T> & {
52
+ focusManager: ListFocus<T>;
53
+ });
54
+ /** Opens the specified item, or the currently active item if none is specified. */
55
+ open(item?: T): void;
56
+ /** Closes the specified item, or the currently active item if none is specified. */
57
+ close(item?: T): void;
58
+ /**
59
+ * Toggles the expansion state of the specified item,
60
+ * or the currently active item if none is specified.
61
+ */
62
+ toggle(item?: T): void;
63
+ /** Opens all focusable items in the list. */
64
+ openAll(): void;
65
+ /** Closes all focusable items in the list. */
66
+ closeAll(): void;
67
+ /** Checks whether the specified item is expandable / collapsible. */
68
+ isExpandable(item: T): boolean;
69
+ /** Checks whether the specified item is currently expanded. */
70
+ isExpanded(item: T): boolean;
71
+ }
72
+
73
+ export { ListExpansion as a, ExpansionControl as b };
74
+ export type { ExpansionItem as E, ListExpansionInputs as L };
@@ -0,0 +1,152 @@
1
+ import { computed } from '@angular/core';
2
+ import { L as ListFocus, a as ListNavigation, K as KeyboardEventManager, P as PointerEventManager } from './list-focus-BXQdAA3i.mjs';
3
+ import { L as ListExpansion, E as ExpansionControl } from './expansion-DykBzWrb.mjs';
4
+
5
+ const focusMode = () => 'roving';
6
+ /** A pattern controls the nested Accordions. */
7
+ class AccordionGroupPattern {
8
+ inputs;
9
+ /** Controls navigation for the group. */
10
+ navigation;
11
+ /** Controls focus for the group. */
12
+ focusManager;
13
+ /** Controls expansion for the group. */
14
+ expansionManager;
15
+ constructor(inputs) {
16
+ this.inputs = inputs;
17
+ this.wrap = inputs.wrap;
18
+ this.orientation = inputs.orientation;
19
+ this.textDirection = inputs.textDirection;
20
+ this.activeIndex = inputs.activeIndex;
21
+ this.disabled = inputs.disabled;
22
+ this.multiExpandable = inputs.multiExpandable;
23
+ this.items = inputs.items;
24
+ this.expandedIds = inputs.expandedIds;
25
+ this.skipDisabled = inputs.skipDisabled;
26
+ this.focusManager = new ListFocus({
27
+ ...inputs,
28
+ focusMode,
29
+ });
30
+ this.navigation = new ListNavigation({
31
+ ...inputs,
32
+ focusMode,
33
+ focusManager: this.focusManager,
34
+ });
35
+ this.expansionManager = new ListExpansion({
36
+ ...inputs,
37
+ focusMode,
38
+ focusManager: this.focusManager,
39
+ });
40
+ }
41
+ }
42
+ /** A pattern controls the expansion state of an accordion. */
43
+ class AccordionTriggerPattern {
44
+ inputs;
45
+ /** Whether this tab has expandable content. */
46
+ expandable;
47
+ /** The unique identifier used by the expansion behavior. */
48
+ expansionId;
49
+ /** Whether an accordion is expanded. */
50
+ expanded;
51
+ /** Controls the expansion state for the trigger. */
52
+ expansionControl;
53
+ /** Whether the trigger is active. */
54
+ active = computed(() => this.inputs.accordionGroup().focusManager.activeItem() === this);
55
+ /** Id of the accordion panel controlled by the trigger. */
56
+ controls = computed(() => this.inputs.accordionPanel()?.id());
57
+ /** The tabindex of the trigger. */
58
+ tabindex = computed(() => (this.inputs.accordionGroup().focusManager.isFocusable(this) ? 0 : -1));
59
+ /** Whether the trigger is disabled. Disabling an accordion group disables all the triggers. */
60
+ disabled = computed(() => this.inputs.disabled() || this.inputs.accordionGroup().disabled());
61
+ constructor(inputs) {
62
+ this.inputs = inputs;
63
+ this.id = inputs.id;
64
+ this.element = inputs.element;
65
+ this.value = inputs.value;
66
+ this.accordionGroup = inputs.accordionGroup;
67
+ this.accordionPanel = inputs.accordionPanel;
68
+ this.expansionControl = new ExpansionControl({
69
+ ...inputs,
70
+ expansionId: inputs.value,
71
+ expandable: () => true,
72
+ expansionManager: inputs.accordionGroup().expansionManager,
73
+ });
74
+ this.expandable = this.expansionControl.isExpandable;
75
+ this.expansionId = this.expansionControl.expansionId;
76
+ this.expanded = this.expansionControl.isExpanded;
77
+ }
78
+ /** The key used to navigate to the previous accordion trigger. */
79
+ prevKey = computed(() => {
80
+ if (this.inputs.accordionGroup().orientation() === 'vertical') {
81
+ return 'ArrowUp';
82
+ }
83
+ return this.inputs.accordionGroup().textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';
84
+ });
85
+ /** The key used to navigate to the next accordion trigger. */
86
+ nextKey = computed(() => {
87
+ if (this.inputs.accordionGroup().orientation() === 'vertical') {
88
+ return 'ArrowDown';
89
+ }
90
+ return this.inputs.accordionGroup().textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';
91
+ });
92
+ /** The keydown event manager for the accordion trigger. */
93
+ keydown = computed(() => {
94
+ return new KeyboardEventManager()
95
+ .on(this.prevKey, () => this.accordionGroup().navigation.prev())
96
+ .on(this.nextKey, () => this.accordionGroup().navigation.next())
97
+ .on('Home', () => this.accordionGroup().navigation.first())
98
+ .on('End', () => this.accordionGroup().navigation.last())
99
+ .on(' ', () => this.expansionControl.toggle())
100
+ .on('Enter', () => this.expansionControl.toggle());
101
+ });
102
+ /** The pointerdown event manager for the accordion trigger. */
103
+ pointerdown = computed(() => {
104
+ return new PointerEventManager().on(e => {
105
+ const item = this._getItem(e);
106
+ if (item) {
107
+ this.accordionGroup().navigation.goto(item);
108
+ this.expansionControl.toggle();
109
+ }
110
+ });
111
+ });
112
+ /** Handles keydown events on the trigger, delegating to the group if not disabled. */
113
+ onKeydown(event) {
114
+ this.keydown().handle(event);
115
+ }
116
+ /** Handles pointerdown events on the trigger, delegating to the group if not disabled. */
117
+ onPointerdown(event) {
118
+ this.pointerdown().handle(event);
119
+ }
120
+ /** Handles focus events on the trigger. This ensures the tabbing changes the active index. */
121
+ onFocus(event) {
122
+ const item = this._getItem(event);
123
+ if (item && this.inputs.accordionGroup().focusManager.isFocusable(item)) {
124
+ this.accordionGroup().focusManager.focus(item);
125
+ }
126
+ }
127
+ _getItem(e) {
128
+ if (!(e.target instanceof HTMLElement)) {
129
+ return;
130
+ }
131
+ const element = e.target.closest('[role="button"]');
132
+ return this.accordionGroup()
133
+ .items()
134
+ .find(i => i.element() === element);
135
+ }
136
+ }
137
+ /** Represents an accordion panel. */
138
+ class AccordionPanelPattern {
139
+ inputs;
140
+ /** Whether the accordion panel is hidden. True if the associated trigger is not expanded. */
141
+ hidden;
142
+ constructor(inputs) {
143
+ this.inputs = inputs;
144
+ this.id = inputs.id;
145
+ this.value = inputs.value;
146
+ this.accordionTrigger = inputs.accordionTrigger;
147
+ this.hidden = computed(() => inputs.accordionTrigger()?.expanded() === false);
148
+ }
149
+ }
150
+
151
+ export { AccordionPanelPattern as A, AccordionTriggerPattern as a, AccordionGroupPattern as b };
152
+ //# sourceMappingURL=accordion-CyyDY39y.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accordion-CyyDY39y.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/ui-patterns/accordion/accordion.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {computed} from '@angular/core';\nimport {KeyboardEventManager} from '../behaviors/event-manager/keyboard-event-manager';\nimport {PointerEventManager} from '../behaviors/event-manager/pointer-event-manager';\nimport {\n ExpansionItem,\n ExpansionControl,\n ListExpansion,\n ListExpansionInputs,\n} from '../behaviors/expansion/expansion';\nimport {ListFocus, ListFocusInputs, ListFocusItem} from '../behaviors/list-focus/list-focus';\nimport {\n ListNavigation,\n ListNavigationInputs,\n ListNavigationItem,\n} from '../behaviors/list-navigation/list-navigation';\nimport {SignalLike} from '../behaviors/signal-like/signal-like';\n\n/** Inputs of the AccordionGroupPattern. */\nexport type AccordionGroupInputs = Omit<\n ListNavigationInputs<AccordionTriggerPattern> &\n ListFocusInputs<AccordionTriggerPattern> &\n ListExpansionInputs<AccordionTriggerPattern>,\n 'focusMode'\n>;\n\nconst focusMode = () => 'roving' as const;\n\nexport interface AccordionGroupPattern extends AccordionGroupInputs {}\n/** A pattern controls the nested Accordions. */\nexport class AccordionGroupPattern {\n /** Controls navigation for the group. */\n navigation: ListNavigation<AccordionTriggerPattern>;\n\n /** Controls focus for the group. */\n focusManager: ListFocus<AccordionTriggerPattern>;\n\n /** Controls expansion for the group. */\n expansionManager: ListExpansion<AccordionTriggerPattern>;\n\n constructor(readonly inputs: AccordionGroupInputs) {\n this.wrap = inputs.wrap;\n this.orientation = inputs.orientation;\n this.textDirection = inputs.textDirection;\n this.activeIndex = inputs.activeIndex;\n this.disabled = inputs.disabled;\n this.multiExpandable = inputs.multiExpandable;\n this.items = inputs.items;\n this.expandedIds = inputs.expandedIds;\n this.skipDisabled = inputs.skipDisabled;\n this.focusManager = new ListFocus({\n ...inputs,\n focusMode,\n });\n this.navigation = new ListNavigation({\n ...inputs,\n focusMode,\n focusManager: this.focusManager,\n });\n this.expansionManager = new ListExpansion({\n ...inputs,\n focusMode,\n focusManager: this.focusManager,\n });\n }\n}\n\n/** Inputs for the AccordionTriggerPattern. */\nexport type AccordionTriggerInputs = ListNavigationItem &\n ListFocusItem &\n Omit<ExpansionItem, 'expansionId' | 'expandable'> & {\n /** A local unique identifier for the trigger. */\n value: SignalLike<string>;\n\n /** The parent accordion group that controls this trigger. */\n accordionGroup: SignalLike<AccordionGroupPattern>;\n\n /** The accordion panel controlled by this trigger. */\n accordionPanel: SignalLike<AccordionPanelPattern | undefined>;\n };\n\nexport interface AccordionTriggerPattern extends AccordionTriggerInputs {}\n/** A pattern controls the expansion state of an accordion. */\nexport class AccordionTriggerPattern {\n /** Whether this tab has expandable content. */\n expandable: SignalLike<boolean>;\n\n /** The unique identifier used by the expansion behavior. */\n expansionId: SignalLike<string>;\n\n /** Whether an accordion is expanded. */\n expanded: SignalLike<boolean>;\n\n /** Controls the expansion state for the trigger. */\n expansionControl: ExpansionControl;\n\n /** Whether the trigger is active. */\n active = computed(() => this.inputs.accordionGroup().focusManager.activeItem() === this);\n\n /** Id of the accordion panel controlled by the trigger. */\n controls = computed(() => this.inputs.accordionPanel()?.id());\n\n /** The tabindex of the trigger. */\n tabindex = computed(() => (this.inputs.accordionGroup().focusManager.isFocusable(this) ? 0 : -1));\n\n /** Whether the trigger is disabled. Disabling an accordion group disables all the triggers. */\n disabled = computed(() => this.inputs.disabled() || this.inputs.accordionGroup().disabled());\n\n constructor(readonly inputs: AccordionTriggerInputs) {\n this.id = inputs.id;\n this.element = inputs.element;\n this.value = inputs.value;\n this.accordionGroup = inputs.accordionGroup;\n this.accordionPanel = inputs.accordionPanel;\n this.expansionControl = new ExpansionControl({\n ...inputs,\n expansionId: inputs.value,\n expandable: () => true,\n expansionManager: inputs.accordionGroup().expansionManager,\n });\n this.expandable = this.expansionControl.isExpandable;\n this.expansionId = this.expansionControl.expansionId;\n this.expanded = this.expansionControl.isExpanded;\n }\n\n /** The key used to navigate to the previous accordion trigger. */\n prevKey = computed(() => {\n if (this.inputs.accordionGroup().orientation() === 'vertical') {\n return 'ArrowUp';\n }\n return this.inputs.accordionGroup().textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n });\n\n /** The key used to navigate to the next accordion trigger. */\n nextKey = computed(() => {\n if (this.inputs.accordionGroup().orientation() === 'vertical') {\n return 'ArrowDown';\n }\n return this.inputs.accordionGroup().textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** The keydown event manager for the accordion trigger. */\n keydown = computed(() => {\n return new KeyboardEventManager()\n .on(this.prevKey, () => this.accordionGroup().navigation.prev())\n .on(this.nextKey, () => this.accordionGroup().navigation.next())\n .on('Home', () => this.accordionGroup().navigation.first())\n .on('End', () => this.accordionGroup().navigation.last())\n .on(' ', () => this.expansionControl.toggle())\n .on('Enter', () => this.expansionControl.toggle());\n });\n\n /** The pointerdown event manager for the accordion trigger. */\n pointerdown = computed(() => {\n return new PointerEventManager().on(e => {\n const item = this._getItem(e);\n\n if (item) {\n this.accordionGroup().navigation.goto(item);\n this.expansionControl.toggle();\n }\n });\n });\n\n /** Handles keydown events on the trigger, delegating to the group if not disabled. */\n onKeydown(event: KeyboardEvent): void {\n this.keydown().handle(event);\n }\n\n /** Handles pointerdown events on the trigger, delegating to the group if not disabled. */\n onPointerdown(event: PointerEvent): void {\n this.pointerdown().handle(event);\n }\n\n /** Handles focus events on the trigger. This ensures the tabbing changes the active index. */\n onFocus(event: FocusEvent): void {\n const item = this._getItem(event);\n\n if (item && this.inputs.accordionGroup().focusManager.isFocusable(item)) {\n this.accordionGroup().focusManager.focus(item);\n }\n }\n\n private _getItem(e: Event) {\n if (!(e.target instanceof HTMLElement)) {\n return;\n }\n\n const element = e.target.closest('[role=\"button\"]');\n return this.accordionGroup()\n .items()\n .find(i => i.element() === element);\n }\n}\n\n/** Represents the required inputs for the AccordionPanelPattern. */\nexport interface AccordionPanelInputs {\n /** A global unique identifier for the panel. */\n id: SignalLike<string>;\n\n /** A local unique identifier for the panel, matching its trigger's value. */\n value: SignalLike<string>;\n\n /** The parent accordion trigger that controls this panel. */\n accordionTrigger: SignalLike<AccordionTriggerPattern | undefined>;\n}\n\nexport interface AccordionPanelPattern extends AccordionPanelInputs {}\n/** Represents an accordion panel. */\nexport class AccordionPanelPattern {\n /** Whether the accordion panel is hidden. True if the associated trigger is not expanded. */\n hidden: SignalLike<boolean>;\n\n constructor(readonly inputs: AccordionPanelInputs) {\n this.id = inputs.id;\n this.value = inputs.value;\n this.accordionTrigger = inputs.accordionTrigger;\n this.hidden = computed(() => inputs.accordionTrigger()?.expanded() === false);\n }\n}\n"],"names":[],"mappings":";;;;AAiCA,MAAM,SAAS,GAAG,MAAM,QAAiB;AAGzC;MACa,qBAAqB,CAAA;AAUX,IAAA,MAAA;;AARrB,IAAA,UAAU;;AAGV,IAAA,YAAY;;AAGZ,IAAA,gBAAgB;AAEhB,IAAA,WAAA,CAAqB,MAA4B,EAA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N,MAAM;AACzB,QAAA,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE;AACnB,QAAA,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK;AACzB,QAAA,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB;AAC/C,QAAA,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,MAAM,CAAC,gBAAgB,EAAE,EAAE,QAAQ,EAAE,KAAK,KAAK,CAAC;;AAEhF;;;;"}
@@ -0,0 +1,184 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, input, signal, afterRenderEffect, Directive, ElementRef, booleanAttribute, computed, contentChildren, model } from '@angular/core';
3
+ import { _IdGenerator } from '@angular/cdk/a11y';
4
+ import { Directionality } from '@angular/cdk/bidi';
5
+ import * as i1 from '@angular/cdk-experimental/deferred-content';
6
+ import { DeferredContentAware, DeferredContent } from '@angular/cdk-experimental/deferred-content';
7
+ import { A as AccordionPanelPattern, a as AccordionTriggerPattern, b as AccordionGroupPattern } from './accordion-CyyDY39y.mjs';
8
+ import './list-focus-BXQdAA3i.mjs';
9
+ import './expansion-DykBzWrb.mjs';
10
+
11
+ /**
12
+ * Represents the content panel of an accordion item. It is controlled by an
13
+ * associated `CdkAccordionTrigger`.
14
+ */
15
+ class CdkAccordionPanel {
16
+ /** The DeferredContentAware host directive. */
17
+ _deferredContentAware = inject(DeferredContentAware);
18
+ /** A global unique identifier for the panel. */
19
+ _id = inject(_IdGenerator).getId('cdk-accordion-trigger-');
20
+ /** A local unique identifier for the panel, used to match with its trigger's value. */
21
+ value = input.required();
22
+ /** The parent accordion trigger pattern that controls this panel. This is set by CdkAccordionGroup. */
23
+ accordionTrigger = signal(undefined);
24
+ /** The UI pattern instance for this panel. */
25
+ pattern = new AccordionPanelPattern({
26
+ id: () => this._id,
27
+ value: this.value,
28
+ accordionTrigger: () => this.accordionTrigger(),
29
+ });
30
+ constructor() {
31
+ // Connect the panel's hidden state to the DeferredContentAware's visibility.
32
+ afterRenderEffect(() => {
33
+ this._deferredContentAware.contentVisible.set(!this.pattern.hidden());
34
+ });
35
+ }
36
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: CdkAccordionPanel, deps: [], target: i0.ɵɵFactoryTarget.Directive });
37
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.0", type: CdkAccordionPanel, isStandalone: true, selector: "[cdkAccordionPanel]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "role": "region" }, properties: { "attr.id": "pattern.id()", "attr.aria-labelledby": "pattern.accordionTrigger()?.id()", "attr.inert": "pattern.hidden() ? true : null" }, classAttribute: "cdk-accordion-panel" }, exportAs: ["cdkAccordionPanel"], hostDirectives: [{ directive: i1.DeferredContentAware, inputs: ["preserveContent", "preserveContent"] }], ngImport: i0 });
38
+ }
39
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: CdkAccordionPanel, decorators: [{
40
+ type: Directive,
41
+ args: [{
42
+ selector: '[cdkAccordionPanel]',
43
+ exportAs: 'cdkAccordionPanel',
44
+ hostDirectives: [
45
+ {
46
+ directive: DeferredContentAware,
47
+ inputs: ['preserveContent'],
48
+ },
49
+ ],
50
+ host: {
51
+ 'class': 'cdk-accordion-panel',
52
+ 'role': 'region',
53
+ '[attr.id]': 'pattern.id()',
54
+ '[attr.aria-labelledby]': 'pattern.accordionTrigger()?.id()',
55
+ '[attr.inert]': 'pattern.hidden() ? true : null',
56
+ },
57
+ }]
58
+ }], ctorParameters: () => [] });
59
+ /**
60
+ * Represents the trigger button for an accordion item. It controls the expansion
61
+ * state of an associated `CdkAccordionPanel`.
62
+ */
63
+ class CdkAccordionTrigger {
64
+ /** A global unique identifier for the trigger. */
65
+ _id = inject(_IdGenerator).getId('cdk-accordion-trigger-');
66
+ /** A reference to the trigger element. */
67
+ _elementRef = inject(ElementRef);
68
+ /** The parent CdkAccordionGroup. */
69
+ _accordionGroup = inject(CdkAccordionGroup);
70
+ /** A local unique identifier for the trigger, used to match with its panel's value. */
71
+ value = input.required();
72
+ /** Whether the trigger is disabled. */
73
+ disabled = input(false, { transform: booleanAttribute });
74
+ /** The accordion panel pattern controlled by this trigger. This is set by CdkAccordionGroup. */
75
+ accordionPanel = signal(undefined);
76
+ /** The UI pattern instance for this trigger. */
77
+ pattern = new AccordionTriggerPattern({
78
+ id: () => this._id,
79
+ value: this.value,
80
+ disabled: this.disabled,
81
+ element: () => this._elementRef.nativeElement,
82
+ accordionGroup: computed(() => this._accordionGroup.pattern),
83
+ accordionPanel: this.accordionPanel,
84
+ });
85
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: CdkAccordionTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
86
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.0", type: CdkAccordionTrigger, isStandalone: true, selector: "[cdkAccordionTrigger]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "button" }, listeners: { "keydown": "pattern.onKeydown($event)", "pointerdown": "pattern.onPointerdown($event)", "focusin": "pattern.onFocus($event)" }, properties: { "class.cdk-active": "pattern.active()", "id": "pattern.id()", "attr.aria-expanded": "pattern.expanded()", "attr.aria-controls": "pattern.controls()", "attr.aria-disabled": "pattern.disabled()", "attr.tabindex": "pattern.tabindex()" }, classAttribute: "cdk-accordion-trigger" }, exportAs: ["cdkAccordionTrigger"], ngImport: i0 });
87
+ }
88
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: CdkAccordionTrigger, decorators: [{
89
+ type: Directive,
90
+ args: [{
91
+ selector: '[cdkAccordionTrigger]',
92
+ exportAs: 'cdkAccordionTrigger',
93
+ host: {
94
+ 'class': 'cdk-accordion-trigger',
95
+ '[class.cdk-active]': 'pattern.active()',
96
+ 'role': 'button',
97
+ '[id]': 'pattern.id()',
98
+ '[attr.aria-expanded]': 'pattern.expanded()',
99
+ '[attr.aria-controls]': 'pattern.controls()',
100
+ '[attr.aria-disabled]': 'pattern.disabled()',
101
+ '[attr.tabindex]': 'pattern.tabindex()',
102
+ '(keydown)': 'pattern.onKeydown($event)',
103
+ '(pointerdown)': 'pattern.onPointerdown($event)',
104
+ '(focusin)': 'pattern.onFocus($event)',
105
+ },
106
+ }]
107
+ }] });
108
+ /**
109
+ * Container for a group of accordion items. It manages the overall state and
110
+ * interactions of the accordion, such as keyboard navigation and expansion mode.
111
+ */
112
+ class CdkAccordionGroup {
113
+ /** The CdkAccordionTriggers nested inside this group. */
114
+ _triggers = contentChildren(CdkAccordionTrigger, { descendants: true });
115
+ /** The CdkAccordionPanels nested inside this group. */
116
+ _panels = contentChildren(CdkAccordionPanel, { descendants: true });
117
+ /** The text direction (ltr or rtl). */
118
+ textDirection = inject(Directionality).valueSignal;
119
+ /** Whether the entire accordion group is disabled. */
120
+ disabled = input(false, { transform: booleanAttribute });
121
+ /** Whether multiple accordion items can be expanded simultaneously. */
122
+ multiExpandable = input(true, { transform: booleanAttribute });
123
+ /** The values of the current selected/expanded accordions. */
124
+ value = model([]);
125
+ /** Whether disabled items should be skipped during keyboard navigation. */
126
+ skipDisabled = input(true, { transform: booleanAttribute });
127
+ /** Whether keyboard navigation should wrap around from the last item to the first, and vice-versa. */
128
+ wrap = input(false, { transform: booleanAttribute });
129
+ /** The UI pattern instance for this accordion group. */
130
+ pattern = new AccordionGroupPattern({
131
+ ...this,
132
+ // TODO(ok7sai): Consider making `activeIndex` an internal state in the pattern and call
133
+ // `setDefaultState` in the CDK.
134
+ activeIndex: signal(0),
135
+ items: computed(() => this._triggers().map(trigger => trigger.pattern)),
136
+ expandedIds: this.value,
137
+ // TODO(ok7sai): Investigate whether an accordion should support horizontal mode.
138
+ orientation: () => 'vertical',
139
+ });
140
+ constructor() {
141
+ // Effect to link triggers with their corresponding panels and update the group's items.
142
+ afterRenderEffect(() => {
143
+ const triggers = this._triggers();
144
+ const panels = this._panels();
145
+ for (const trigger of triggers) {
146
+ const panel = panels.find(p => p.value() === trigger.value());
147
+ trigger.accordionPanel.set(panel?.pattern);
148
+ if (panel) {
149
+ panel.accordionTrigger.set(trigger.pattern);
150
+ }
151
+ }
152
+ });
153
+ }
154
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: CdkAccordionGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive });
155
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "20.0.0", type: CdkAccordionGroup, isStandalone: true, selector: "[cdkAccordionGroup]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, multiExpandable: { classPropertyName: "multiExpandable", publicName: "multiExpandable", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, skipDisabled: { classPropertyName: "skipDisabled", publicName: "skipDisabled", isSignal: true, isRequired: false, transformFunction: null }, wrap: { classPropertyName: "wrap", publicName: "wrap", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { classAttribute: "cdk-accordion-group" }, queries: [{ propertyName: "_triggers", predicate: CdkAccordionTrigger, descendants: true, isSignal: true }, { propertyName: "_panels", predicate: CdkAccordionPanel, descendants: true, isSignal: true }], exportAs: ["cdkAccordionGroup"], ngImport: i0 });
156
+ }
157
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: CdkAccordionGroup, decorators: [{
158
+ type: Directive,
159
+ args: [{
160
+ selector: '[cdkAccordionGroup]',
161
+ exportAs: 'cdkAccordionGroup',
162
+ host: {
163
+ 'class': 'cdk-accordion-group',
164
+ },
165
+ }]
166
+ }], ctorParameters: () => [] });
167
+ /**
168
+ * A structural directive that marks the `ng-template` to be used as the content
169
+ * for a `CdkAccordionPanel`. This content can be lazily loaded.
170
+ */
171
+ class CdkAccordionContent {
172
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: CdkAccordionContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
173
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0", type: CdkAccordionContent, isStandalone: true, selector: "ng-template[cdkAccordionContent]", hostDirectives: [{ directive: i1.DeferredContent }], ngImport: i0 });
174
+ }
175
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: CdkAccordionContent, decorators: [{
176
+ type: Directive,
177
+ args: [{
178
+ selector: 'ng-template[cdkAccordionContent]',
179
+ hostDirectives: [DeferredContent],
180
+ }]
181
+ }] });
182
+
183
+ export { CdkAccordionContent, CdkAccordionGroup, CdkAccordionPanel, CdkAccordionTrigger };
184
+ //# sourceMappingURL=accordion.mjs.map