@angular/cdk-experimental 20.2.0-next.2 → 20.2.0-rc.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.
- package/accordion/index.d.ts +3 -3
- package/{accordion.d-CC6dGMlv.d.ts → accordion.d.d.ts} +7 -5
- package/{expansion.d-Zkcf-XJU.d.ts → expansion.d.d.ts} +3 -3
- package/fesm2022/accordion.mjs +17 -17
- package/fesm2022/accordion.mjs.map +1 -1
- package/fesm2022/{accordion-D9JoxtzT.mjs → accordion2.mjs} +8 -6
- package/fesm2022/accordion2.mjs.map +1 -0
- package/fesm2022/cdk-experimental.mjs +1 -1
- package/fesm2022/cdk-experimental.mjs.map +1 -1
- package/fesm2022/column-resize.mjs +54 -54
- package/fesm2022/column-resize.mjs.map +1 -1
- package/fesm2022/combobox.mjs +10 -10
- package/fesm2022/combobox.mjs.map +1 -1
- package/fesm2022/deferred-content.mjs +6 -6
- package/fesm2022/deferred-content.mjs.map +1 -1
- package/fesm2022/{expansion-C9iQLHOG.mjs → expansion.mjs} +2 -2
- package/fesm2022/expansion.mjs.map +1 -0
- package/fesm2022/{list-focus-Czul8jzR.mjs → list-navigation.mjs} +67 -62
- package/fesm2022/list-navigation.mjs.map +1 -0
- package/fesm2022/list.mjs +355 -0
- package/fesm2022/list.mjs.map +1 -0
- package/fesm2022/listbox.mjs +10 -11
- package/fesm2022/listbox.mjs.map +1 -1
- package/fesm2022/option.mjs +231 -0
- package/fesm2022/option.mjs.map +1 -0
- package/fesm2022/{polyfill-CXksG4af.mjs → polyfill.mjs} +2 -2
- package/fesm2022/polyfill.mjs.map +1 -0
- package/fesm2022/popover-edit.mjs +44 -44
- package/fesm2022/popover-edit.mjs.map +1 -1
- package/fesm2022/radio-group.mjs +44 -11
- package/fesm2022/radio-group.mjs.map +1 -1
- package/fesm2022/radio-group2.mjs +143 -0
- package/fesm2022/radio-group2.mjs.map +1 -0
- package/fesm2022/scrolling.mjs +7 -7
- package/fesm2022/scrolling.mjs.map +1 -1
- package/fesm2022/selection.mjs +19 -19
- package/fesm2022/selection.mjs.map +1 -1
- package/fesm2022/table-scroll-container.mjs +7 -7
- package/fesm2022/table-scroll-container.mjs.map +1 -1
- package/fesm2022/tabs.mjs +20 -20
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/{tabs-hMdwtXv2.mjs → tabs2.mjs} +34 -70
- package/fesm2022/tabs2.mjs.map +1 -0
- package/fesm2022/toolbar.mjs +168 -0
- package/fesm2022/toolbar.mjs.map +1 -0
- package/fesm2022/toolbar2.mjs +224 -0
- package/fesm2022/toolbar2.mjs.map +1 -0
- package/fesm2022/tree.mjs +140 -219
- package/fesm2022/tree.mjs.map +1 -1
- package/fesm2022/ui-patterns.mjs +8 -8
- package/fesm2022/ui-patterns.mjs.map +1 -1
- package/list.d.d.ts +207 -0
- package/listbox/index.d.ts +3 -4
- package/{listbox.d-Ckp1is82.d.ts → listbox.d.d.ts} +9 -62
- package/package.json +6 -2
- package/{pointer-event-manager.d-BqSm9Jh5.d.ts → pointer-event-manager.d.d.ts} +12 -8
- package/radio-group/index.d.ts +15 -7
- package/radio-group.d.d.ts +80 -0
- package/tabs/index.d.ts +4 -4
- package/{tabs.d-Db8oTrMB.d.ts → tabs.d.d.ts} +15 -30
- package/toolbar/index.d.ts +89 -0
- package/toolbar.d.d.ts +136 -0
- package/tree/index.d.ts +28 -63
- package/ui-patterns/index.d.ts +8 -8
- package/fesm2022/accordion-D9JoxtzT.mjs.map +0 -1
- package/fesm2022/expansion-C9iQLHOG.mjs.map +0 -1
- package/fesm2022/list-focus-Czul8jzR.mjs.map +0 -1
- package/fesm2022/list-selection-C41ApAbt.mjs +0 -136
- package/fesm2022/list-selection-C41ApAbt.mjs.map +0 -1
- package/fesm2022/list-typeahead-DIIbNJrP.mjs +0 -64
- package/fesm2022/list-typeahead-DIIbNJrP.mjs.map +0 -1
- package/fesm2022/option-CgeKz9_Q.mjs +0 -321
- package/fesm2022/option-CgeKz9_Q.mjs.map +0 -1
- package/fesm2022/polyfill-CXksG4af.mjs.map +0 -1
- package/fesm2022/radio-button-92xc4w-A.mjs +0 -203
- package/fesm2022/radio-button-92xc4w-A.mjs.map +0 -1
- package/fesm2022/tabs-hMdwtXv2.mjs.map +0 -1
- package/list-selection.d-fbAPr_N_.d.ts +0 -69
- package/list-typeahead.d-ljh3nJ9y.d.ts +0 -48
- package/radio-group.d-CFC0aKQM.d.ts +0 -114
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import { computed } from '@angular/core';
|
|
2
|
-
import { L as ListFocus, a as ListNavigation, K as KeyboardEventManager, P as PointerEventManager } from './list-focus-Czul8jzR.mjs';
|
|
3
|
-
import { L as ListSelection } from './list-selection-C41ApAbt.mjs';
|
|
4
|
-
|
|
5
|
-
/** Controls the state of a radio group. */
|
|
6
|
-
class RadioGroupPattern {
|
|
7
|
-
inputs;
|
|
8
|
-
/** Controls navigation for the radio group. */
|
|
9
|
-
navigation;
|
|
10
|
-
/** Controls selection for the radio group. */
|
|
11
|
-
selection;
|
|
12
|
-
/** Controls focus for the radio group. */
|
|
13
|
-
focusManager;
|
|
14
|
-
/** Whether the radio group is vertically or horizontally oriented. */
|
|
15
|
-
orientation;
|
|
16
|
-
/** Whether the radio group is disabled. */
|
|
17
|
-
disabled = computed(() => this.inputs.disabled() || this.focusManager.isListDisabled());
|
|
18
|
-
/** The currently selected radio button. */
|
|
19
|
-
selectedItem = computed(() => this.selection.selectedItems()[0]);
|
|
20
|
-
/** Whether the radio group is readonly. */
|
|
21
|
-
readonly = computed(() => this.selectedItem()?.disabled() || this.inputs.readonly());
|
|
22
|
-
/** The tabindex of the radio group (if using activedescendant). */
|
|
23
|
-
tabindex = computed(() => this.focusManager.getListTabindex());
|
|
24
|
-
/** The id of the current active radio button (if using activedescendant). */
|
|
25
|
-
activedescendant = computed(() => this.focusManager.getActiveDescendant());
|
|
26
|
-
/** The key used to navigate to the previous radio button. */
|
|
27
|
-
prevKey = computed(() => {
|
|
28
|
-
if (this.inputs.orientation() === 'vertical') {
|
|
29
|
-
return 'ArrowUp';
|
|
30
|
-
}
|
|
31
|
-
return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';
|
|
32
|
-
});
|
|
33
|
-
/** The key used to navigate to the next radio button. */
|
|
34
|
-
nextKey = computed(() => {
|
|
35
|
-
if (this.inputs.orientation() === 'vertical') {
|
|
36
|
-
return 'ArrowDown';
|
|
37
|
-
}
|
|
38
|
-
return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';
|
|
39
|
-
});
|
|
40
|
-
/** The keydown event manager for the radio group. */
|
|
41
|
-
keydown = computed(() => {
|
|
42
|
-
const manager = new KeyboardEventManager();
|
|
43
|
-
// Readonly mode allows navigation but not selection changes.
|
|
44
|
-
if (this.readonly()) {
|
|
45
|
-
return manager
|
|
46
|
-
.on(this.prevKey, () => this.prev())
|
|
47
|
-
.on(this.nextKey, () => this.next())
|
|
48
|
-
.on('Home', () => this.first())
|
|
49
|
-
.on('End', () => this.last());
|
|
50
|
-
}
|
|
51
|
-
// Default behavior: navigate and select on arrow keys, home, end.
|
|
52
|
-
// Space/Enter also select the focused item.
|
|
53
|
-
return manager
|
|
54
|
-
.on(this.prevKey, () => this.prev({ selectOne: true }))
|
|
55
|
-
.on(this.nextKey, () => this.next({ selectOne: true }))
|
|
56
|
-
.on('Home', () => this.first({ selectOne: true }))
|
|
57
|
-
.on('End', () => this.last({ selectOne: true }))
|
|
58
|
-
.on(' ', () => this.selection.selectOne())
|
|
59
|
-
.on('Enter', () => this.selection.selectOne());
|
|
60
|
-
});
|
|
61
|
-
/** The pointerdown event manager for the radio group. */
|
|
62
|
-
pointerdown = computed(() => {
|
|
63
|
-
const manager = new PointerEventManager();
|
|
64
|
-
if (this.readonly()) {
|
|
65
|
-
// Navigate focus only in readonly mode.
|
|
66
|
-
return manager.on(e => this.goto(e));
|
|
67
|
-
}
|
|
68
|
-
// Default behavior: navigate and select on click.
|
|
69
|
-
return manager.on(e => this.goto(e, { selectOne: true }));
|
|
70
|
-
});
|
|
71
|
-
constructor(inputs) {
|
|
72
|
-
this.inputs = inputs;
|
|
73
|
-
this.orientation = inputs.orientation;
|
|
74
|
-
this.focusManager = new ListFocus(inputs);
|
|
75
|
-
this.navigation = new ListNavigation({
|
|
76
|
-
...inputs,
|
|
77
|
-
wrap: () => false,
|
|
78
|
-
focusManager: this.focusManager,
|
|
79
|
-
});
|
|
80
|
-
this.selection = new ListSelection({
|
|
81
|
-
...inputs,
|
|
82
|
-
multi: () => false,
|
|
83
|
-
selectionMode: () => 'follow',
|
|
84
|
-
focusManager: this.focusManager,
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
/** Handles keydown events for the radio group. */
|
|
88
|
-
onKeydown(event) {
|
|
89
|
-
if (!this.disabled()) {
|
|
90
|
-
this.keydown().handle(event);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
/** Handles pointerdown events for the radio group. */
|
|
94
|
-
onPointerdown(event) {
|
|
95
|
-
if (!this.disabled()) {
|
|
96
|
-
this.pointerdown().handle(event);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
/** Navigates to the first enabled radio button in the group. */
|
|
100
|
-
first(opts) {
|
|
101
|
-
this._navigate(opts, () => this.navigation.first());
|
|
102
|
-
}
|
|
103
|
-
/** Navigates to the last enabled radio button in the group. */
|
|
104
|
-
last(opts) {
|
|
105
|
-
this._navigate(opts, () => this.navigation.last());
|
|
106
|
-
}
|
|
107
|
-
/** Navigates to the next enabled radio button in the group. */
|
|
108
|
-
next(opts) {
|
|
109
|
-
this._navigate(opts, () => this.navigation.next());
|
|
110
|
-
}
|
|
111
|
-
/** Navigates to the previous enabled radio button in the group. */
|
|
112
|
-
prev(opts) {
|
|
113
|
-
this._navigate(opts, () => this.navigation.prev());
|
|
114
|
-
}
|
|
115
|
-
/** Navigates to the radio button associated with the given pointer event. */
|
|
116
|
-
goto(event, opts) {
|
|
117
|
-
const item = this._getItem(event);
|
|
118
|
-
this._navigate(opts, () => this.navigation.goto(item));
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Sets the radio group to its default initial state.
|
|
122
|
-
*
|
|
123
|
-
* Sets the active index to the selected radio button if one exists and is focusable.
|
|
124
|
-
* Otherwise, sets the active index to the first focusable radio button.
|
|
125
|
-
*/
|
|
126
|
-
setDefaultState() {
|
|
127
|
-
let firstItem = null;
|
|
128
|
-
for (const item of this.inputs.items()) {
|
|
129
|
-
if (this.focusManager.isFocusable(item)) {
|
|
130
|
-
if (!firstItem) {
|
|
131
|
-
firstItem = item;
|
|
132
|
-
}
|
|
133
|
-
if (item.selected()) {
|
|
134
|
-
this.inputs.activeIndex.set(item.index());
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
if (firstItem) {
|
|
140
|
-
this.inputs.activeIndex.set(firstItem.index());
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
/** Validates the state of the radio group and returns a list of accessibility violations. */
|
|
144
|
-
validate() {
|
|
145
|
-
const violations = [];
|
|
146
|
-
if (this.selectedItem()?.disabled() && this.inputs.skipDisabled()) {
|
|
147
|
-
violations.push("Accessibility Violation: The selected radio button is disabled while 'skipDisabled' is true, making the selection unreachable via keyboard.");
|
|
148
|
-
}
|
|
149
|
-
return violations;
|
|
150
|
-
}
|
|
151
|
-
/** Safely performs a navigation operation and updates selection if needed. */
|
|
152
|
-
_navigate(opts = {}, operation) {
|
|
153
|
-
const moved = operation();
|
|
154
|
-
if (moved && opts.selectOne) {
|
|
155
|
-
this.selection.selectOne();
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
/** Finds the RadioButtonPattern associated with a pointer event target. */
|
|
159
|
-
_getItem(e) {
|
|
160
|
-
if (!(e.target instanceof HTMLElement)) {
|
|
161
|
-
return undefined;
|
|
162
|
-
}
|
|
163
|
-
// Assumes the target or its ancestor has role="radio"
|
|
164
|
-
const element = e.target.closest('[role="radio"]');
|
|
165
|
-
return this.inputs.items().find(i => i.element() === element);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/** Represents a radio button within a radio group. */
|
|
170
|
-
class RadioButtonPattern {
|
|
171
|
-
inputs;
|
|
172
|
-
/** A unique identifier for the radio button. */
|
|
173
|
-
id;
|
|
174
|
-
/** The value associated with the radio button. */
|
|
175
|
-
value;
|
|
176
|
-
/** The position of the radio button within the group. */
|
|
177
|
-
index = computed(() => this.group()
|
|
178
|
-
?.navigation.inputs.items()
|
|
179
|
-
.findIndex(i => i.id() === this.id()) ?? -1);
|
|
180
|
-
/** Whether the radio button is currently the active one (focused). */
|
|
181
|
-
active = computed(() => this.group()?.focusManager.activeItem() === this);
|
|
182
|
-
/** Whether the radio button is selected. */
|
|
183
|
-
selected = computed(() => !!this.group()?.selection.inputs.value().includes(this.value()));
|
|
184
|
-
/** Whether the radio button is disabled. */
|
|
185
|
-
disabled;
|
|
186
|
-
/** A reference to the parent radio group. */
|
|
187
|
-
group;
|
|
188
|
-
/** The tabindex of the radio button. */
|
|
189
|
-
tabindex = computed(() => this.group()?.focusManager.getItemTabindex(this));
|
|
190
|
-
/** The HTML element associated with the radio button. */
|
|
191
|
-
element;
|
|
192
|
-
constructor(inputs) {
|
|
193
|
-
this.inputs = inputs;
|
|
194
|
-
this.id = inputs.id;
|
|
195
|
-
this.value = inputs.value;
|
|
196
|
-
this.group = inputs.group;
|
|
197
|
-
this.element = inputs.element;
|
|
198
|
-
this.disabled = inputs.disabled;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
export { RadioGroupPattern as R, RadioButtonPattern as a };
|
|
203
|
-
//# sourceMappingURL=radio-button-92xc4w-A.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"radio-button-92xc4w-A.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/ui-patterns/radio-group/radio-group.ts","../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/ui-patterns/radio-group/radio-button.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, PointerEventManager} from '../behaviors/event-manager';\nimport {ListFocus, ListFocusInputs} from '../behaviors/list-focus/list-focus';\nimport {ListNavigation, ListNavigationInputs} from '../behaviors/list-navigation/list-navigation';\nimport {ListSelection, ListSelectionInputs} from '../behaviors/list-selection/list-selection';\nimport {SignalLike} from '../behaviors/signal-like/signal-like';\nimport {RadioButtonPattern} from './radio-button';\n\n/** The selection operations that the radio group can perform. */\ninterface SelectOptions {\n selectOne?: boolean;\n}\n\n/** Represents the required inputs for a radio group. */\nexport type RadioGroupInputs<V> = Omit<ListNavigationInputs<RadioButtonPattern<V>>, 'wrap'> &\n // Radio groups are always single-select.\n Omit<ListSelectionInputs<RadioButtonPattern<V>, V>, 'multi' | 'selectionMode'> &\n ListFocusInputs<RadioButtonPattern<V>> & {\n /** Whether the radio group is disabled. */\n disabled: SignalLike<boolean>;\n /** Whether the radio group is readonly. */\n readonly: SignalLike<boolean>;\n };\n\n/** Controls the state of a radio group. */\nexport class RadioGroupPattern<V> {\n /** Controls navigation for the radio group. */\n navigation: ListNavigation<RadioButtonPattern<V>>;\n\n /** Controls selection for the radio group. */\n selection: ListSelection<RadioButtonPattern<V>, V>;\n\n /** Controls focus for the radio group. */\n focusManager: ListFocus<RadioButtonPattern<V>>;\n\n /** Whether the radio group is vertically or horizontally oriented. */\n orientation: SignalLike<'vertical' | 'horizontal'>;\n\n /** Whether the radio group is disabled. */\n disabled = computed(() => this.inputs.disabled() || this.focusManager.isListDisabled());\n\n /** The currently selected radio button. */\n selectedItem = computed(() => this.selection.selectedItems()[0]);\n\n /** Whether the radio group is readonly. */\n readonly = computed(() => this.selectedItem()?.disabled() || this.inputs.readonly());\n\n /** The tabindex of the radio group (if using activedescendant). */\n tabindex = computed(() => this.focusManager.getListTabindex());\n\n /** The id of the current active radio button (if using activedescendant). */\n activedescendant = computed(() => this.focusManager.getActiveDescendant());\n\n /** The key used to navigate to the previous radio button. */\n prevKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return 'ArrowUp';\n }\n return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n });\n\n /** The key used to navigate to the next radio button. */\n nextKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return 'ArrowDown';\n }\n return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** The keydown event manager for the radio group. */\n keydown = computed(() => {\n const manager = new KeyboardEventManager();\n\n // Readonly mode allows navigation but not selection changes.\n if (this.readonly()) {\n return manager\n .on(this.prevKey, () => this.prev())\n .on(this.nextKey, () => this.next())\n .on('Home', () => this.first())\n .on('End', () => this.last());\n }\n\n // Default behavior: navigate and select on arrow keys, home, end.\n // Space/Enter also select the focused item.\n return manager\n .on(this.prevKey, () => this.prev({selectOne: true}))\n .on(this.nextKey, () => this.next({selectOne: true}))\n .on('Home', () => this.first({selectOne: true}))\n .on('End', () => this.last({selectOne: true}))\n .on(' ', () => this.selection.selectOne())\n .on('Enter', () => this.selection.selectOne());\n });\n\n /** The pointerdown event manager for the radio group. */\n pointerdown = computed(() => {\n const manager = new PointerEventManager();\n\n if (this.readonly()) {\n // Navigate focus only in readonly mode.\n return manager.on(e => this.goto(e));\n }\n\n // Default behavior: navigate and select on click.\n return manager.on(e => this.goto(e, {selectOne: true}));\n });\n\n constructor(readonly inputs: RadioGroupInputs<V>) {\n this.orientation = inputs.orientation;\n\n this.focusManager = new ListFocus(inputs);\n this.navigation = new ListNavigation({\n ...inputs,\n wrap: () => false,\n focusManager: this.focusManager,\n });\n this.selection = new ListSelection({\n ...inputs,\n multi: () => false,\n selectionMode: () => 'follow',\n focusManager: this.focusManager,\n });\n }\n\n /** Handles keydown events for the radio group. */\n onKeydown(event: KeyboardEvent) {\n if (!this.disabled()) {\n this.keydown().handle(event);\n }\n }\n\n /** Handles pointerdown events for the radio group. */\n onPointerdown(event: PointerEvent) {\n if (!this.disabled()) {\n this.pointerdown().handle(event);\n }\n }\n\n /** Navigates to the first enabled radio button in the group. */\n first(opts?: SelectOptions) {\n this._navigate(opts, () => this.navigation.first());\n }\n\n /** Navigates to the last enabled radio button in the group. */\n last(opts?: SelectOptions) {\n this._navigate(opts, () => this.navigation.last());\n }\n\n /** Navigates to the next enabled radio button in the group. */\n next(opts?: SelectOptions) {\n this._navigate(opts, () => this.navigation.next());\n }\n\n /** Navigates to the previous enabled radio button in the group. */\n prev(opts?: SelectOptions) {\n this._navigate(opts, () => this.navigation.prev());\n }\n\n /** Navigates to the radio button associated with the given pointer event. */\n goto(event: PointerEvent, opts?: SelectOptions) {\n const item = this._getItem(event);\n this._navigate(opts, () => this.navigation.goto(item));\n }\n\n /**\n * Sets the radio group to its default initial state.\n *\n * Sets the active index to the selected radio button if one exists and is focusable.\n * Otherwise, sets the active index to the first focusable radio button.\n */\n setDefaultState() {\n let firstItem: RadioButtonPattern<V> | null = null;\n\n for (const item of this.inputs.items()) {\n if (this.focusManager.isFocusable(item)) {\n if (!firstItem) {\n firstItem = item;\n }\n if (item.selected()) {\n this.inputs.activeIndex.set(item.index());\n return;\n }\n }\n }\n\n if (firstItem) {\n this.inputs.activeIndex.set(firstItem.index());\n }\n }\n\n /** Validates the state of the radio group and returns a list of accessibility violations. */\n validate(): string[] {\n const violations: string[] = [];\n\n if (this.selectedItem()?.disabled() && this.inputs.skipDisabled()) {\n violations.push(\n \"Accessibility Violation: The selected radio button is disabled while 'skipDisabled' is true, making the selection unreachable via keyboard.\",\n );\n }\n\n return violations;\n }\n\n /** Safely performs a navigation operation and updates selection if needed. */\n private _navigate(opts: SelectOptions = {}, operation: () => boolean) {\n const moved = operation();\n if (moved && opts.selectOne) {\n this.selection.selectOne();\n }\n }\n\n /** Finds the RadioButtonPattern associated with a pointer event target. */\n private _getItem(e: PointerEvent): RadioButtonPattern<V> | undefined {\n if (!(e.target instanceof HTMLElement)) {\n return undefined;\n }\n\n // Assumes the target or its ancestor has role=\"radio\"\n const element = e.target.closest('[role=\"radio\"]');\n return this.inputs.items().find(i => i.element() === element);\n }\n}\n","/**\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 {ListSelection, ListSelectionItem} from '../behaviors/list-selection/list-selection';\nimport {ListNavigation, ListNavigationItem} from '../behaviors/list-navigation/list-navigation';\nimport {ListFocus, ListFocusItem} from '../behaviors/list-focus/list-focus';\nimport {SignalLike} from '../behaviors/signal-like/signal-like';\n\n/**\n * Represents the properties exposed by a radio group that need to be accessed by a radio button.\n * This exists to avoid circular dependency errors between the radio group and radio button.\n */\ninterface RadioGroupLike<V> {\n focusManager: ListFocus<RadioButtonPattern<V>>;\n selection: ListSelection<RadioButtonPattern<V>, V>;\n navigation: ListNavigation<RadioButtonPattern<V>>;\n}\n\n/** Represents the required inputs for a radio button in a radio group. */\nexport interface RadioButtonInputs<V>\n extends ListNavigationItem,\n ListSelectionItem<V>,\n ListFocusItem {\n /** A reference to the parent radio group. */\n group: SignalLike<RadioGroupLike<V> | undefined>;\n}\n\n/** Represents a radio button within a radio group. */\nexport class RadioButtonPattern<V> {\n /** A unique identifier for the radio button. */\n id: SignalLike<string>;\n\n /** The value associated with the radio button. */\n value: SignalLike<V>;\n\n /** The position of the radio button within the group. */\n index = computed(\n () =>\n this.group()\n ?.navigation.inputs.items()\n .findIndex(i => i.id() === this.id()) ?? -1,\n );\n\n /** Whether the radio button is currently the active one (focused). */\n active = computed(() => this.group()?.focusManager.activeItem() === this);\n\n /** Whether the radio button is selected. */\n selected: SignalLike<boolean> = computed(\n () => !!this.group()?.selection.inputs.value().includes(this.value()),\n );\n\n /** Whether the radio button is disabled. */\n disabled: SignalLike<boolean>;\n\n /** A reference to the parent radio group. */\n group: SignalLike<RadioGroupLike<V> | undefined>;\n\n /** The tabindex of the radio button. */\n tabindex = computed(() => this.group()?.focusManager.getItemTabindex(this));\n\n /** The HTML element associated with the radio button. */\n element: SignalLike<HTMLElement>;\n\n constructor(readonly inputs: RadioButtonInputs<V>) {\n this.id = inputs.id;\n this.value = inputs.value;\n this.group = inputs.group;\n this.element = inputs.element;\n this.disabled = inputs.disabled;\n }\n}\n"],"names":[],"mappings":";;;;AAgCA;MACa,iBAAiB,CAAA;AAiFP,IAAA,MAAA;;AA/ErB,IAAA,UAAU;;AAGV,IAAA,SAAS;;AAGT,IAAA,YAAY;;AAGZ,IAAA,WAAW;;IAGX,QAAQ,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,CAAC;;AAGvF,IAAA,YAAY,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,CAAC;;IAGhE,QAAQ,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,YAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;;AAGpF,IAAA,QAAQ,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,eAAe,EAAE,CAAC;;AAG9D,IAAA,gBAAgB,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE,CAAC;;AAG1E,IAAA,OAAO,GAAG,QAAQ,CAAC,MAAK;QACtB,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,UAAU,EAAE;AAC5C,YAAA,OAAO,SAAS;;AAElB,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,KAAK,GAA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AS,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAChD;;AAGD,IAAA,MAAM,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,EAAE,YAAY,CAAC,UAAU,EAAE,KAAK,IAAI,CAAC;;AAGzE,IAAA,QAAQ,GAAwB,QAAQ,CACtC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CACtE;;AAGD,IAAA,QAAQ;;AAGR,IAAA,KAAK;;AAGL,IAAA,QAAQ,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,EAAE,YAAY,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;;AAG3E,IAAA,OAAO;AAEP,IAAA,WAAA,CAAqB,MAA4B,EAAA;QAA5B,IAAM,CAAA,MAAA,GAAN,MAAM;AACzB,QAAA,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE;AACnB,QAAA,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK;AACzB,QAAA,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK;AACzB,QAAA,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO;AAC7B,QAAA,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ;;AAElC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tabs-hMdwtXv2.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/ui-patterns/behaviors/label/label.ts","../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/ui-patterns/tabs/tabs.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 */\nimport {computed} from '@angular/core';\nimport {SignalLike} from '../signal-like/signal-like';\n\n/** Represents the required inputs for the label control. */\nexport interface LabelControlInputs {\n /** The default `aria-labelledby` ids. */\n defaultLabelledBy: SignalLike<string[]>;\n}\n\n/** Represents the optional inputs for the label control. */\nexport interface LabelControlOptionalInputs {\n /** The `aria-label`. */\n label?: SignalLike<string | undefined>;\n\n /** The user-provided `aria-labelledby` ids. */\n labelledBy?: SignalLike<string[]>;\n}\n\n/** Controls label and description of an element. */\nexport class LabelControl {\n /** The `aria-label`. */\n readonly label = computed(() => this.inputs.label?.());\n\n /** The `aria-labelledby` ids. */\n readonly labelledBy = computed(() => {\n const label = this.label();\n const labelledBy = this.inputs.labelledBy?.();\n const defaultLabelledBy = this.inputs.defaultLabelledBy();\n\n if (labelledBy && labelledBy.length > 0) {\n return labelledBy;\n }\n\n // If an aria-label is provided by developers, do not set aria-labelledby with the\n // defaultLabelledBy value because if both attributes are set, aria-labelledby will be used.\n if (label) {\n return [];\n }\n\n return defaultLabelledBy;\n });\n\n constructor(readonly inputs: LabelControlInputs & LabelControlOptionalInputs) {}\n}\n","/**\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, PointerEventManager} from '../behaviors/event-manager';\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 {\n ListSelection,\n ListSelectionInputs,\n ListSelectionItem,\n} from '../behaviors/list-selection/list-selection';\nimport {\n ExpansionItem,\n ExpansionControl,\n ListExpansionInputs,\n ListExpansion,\n} from '../behaviors/expansion/expansion';\nimport {SignalLike} from '../behaviors/signal-like/signal-like';\nimport {LabelControl, LabelControlOptionalInputs} from '../behaviors/label/label';\n\n/** The required inputs to tabs. */\nexport interface TabInputs\n extends ListNavigationItem,\n ListSelectionItem<string>,\n ListFocusItem,\n Omit<ExpansionItem, 'expansionId' | 'expandable'> {\n /** The parent tablist that controls the tab. */\n tablist: SignalLike<TabListPattern>;\n\n /** The remote tabpanel controlled by the tab. */\n tabpanel: SignalLike<TabPanelPattern | undefined>;\n}\n\n/** A tab in a tablist. */\nexport class TabPattern {\n /** Controls expansion for this tab. */\n readonly expansion: ExpansionControl;\n\n /** A global unique identifier for the tab. */\n readonly id: SignalLike<string>;\n\n /** A local unique identifier for the tab. */\n readonly value: SignalLike<string>;\n\n /** Whether the tab is disabled. */\n readonly disabled: SignalLike<boolean>;\n\n /** The html element that should receive focus. */\n readonly element: SignalLike<HTMLElement>;\n\n /** Whether this tab has expandable content. */\n readonly expandable = computed(() => this.expansion.expandable());\n\n /** The unique identifier used by the expansion behavior. */\n readonly expansionId = computed(() => this.expansion.expansionId());\n\n /** Whether the tab is expanded. */\n readonly expanded = computed(() => this.expansion.isExpanded());\n\n /** Whether the tab is active. */\n readonly active = computed(() => this.inputs.tablist().focusManager.activeItem() === this);\n\n /** Whether the tab is selected. */\n readonly selected = computed(\n () => !!this.inputs.tablist().selection.inputs.value().includes(this.value()),\n );\n\n /** The tabindex of the tab. */\n readonly tabindex = computed(() => this.inputs.tablist().focusManager.getItemTabindex(this));\n\n /** The id of the tabpanel associated with the tab. */\n readonly controls = computed(() => this.inputs.tabpanel()?.id());\n\n constructor(readonly inputs: TabInputs) {\n this.id = inputs.id;\n this.value = inputs.value;\n this.disabled = inputs.disabled;\n this.element = inputs.element;\n this.expansion = new ExpansionControl({\n ...inputs,\n expansionId: inputs.value,\n expandable: () => true,\n expansionManager: inputs.tablist().expansionManager,\n });\n }\n}\n\n/** The required inputs for the tabpanel. */\nexport interface TabPanelInputs extends LabelControlOptionalInputs {\n id: SignalLike<string>;\n tab: SignalLike<TabPattern | undefined>;\n value: SignalLike<string>;\n}\n\n/** A tabpanel associated with a tab. */\nexport class TabPanelPattern {\n /** A global unique identifier for the tabpanel. */\n readonly id: SignalLike<string>;\n\n /** A local unique identifier for the tabpanel. */\n readonly value: SignalLike<string>;\n\n /** Controls label for this tabpanel. */\n readonly labelManager: LabelControl;\n\n /** Whether the tabpanel is hidden. */\n readonly hidden = computed(() => this.inputs.tab()?.expanded() === false);\n\n /** The tabindex of this tabpanel. */\n readonly tabindex = computed(() => (this.hidden() ? -1 : 0));\n\n /** The aria-labelledby value for this tabpanel. */\n readonly labelledBy = computed(() =>\n this.labelManager.labelledBy().length > 0\n ? this.labelManager.labelledBy().join(' ')\n : undefined,\n );\n\n constructor(readonly inputs: TabPanelInputs) {\n this.id = inputs.id;\n this.value = inputs.value;\n this.labelManager = new LabelControl({\n ...inputs,\n defaultLabelledBy: computed(() => (this.inputs.tab() ? [this.inputs.tab()!.id()] : [])),\n });\n }\n}\n\n/** The selection operations that the tablist can perform. */\ninterface SelectOptions {\n select?: boolean;\n}\n\n/** The required inputs for the tablist. */\nexport type TabListInputs = ListNavigationInputs<TabPattern> &\n Omit<ListSelectionInputs<TabPattern, string>, 'multi'> &\n ListFocusInputs<TabPattern> &\n Omit<ListExpansionInputs, 'multiExpandable' | 'expandedIds' | 'items'>;\n\n/** Controls the state of a tablist. */\nexport class TabListPattern {\n /** Controls navigation for the tablist. */\n readonly navigation: ListNavigation<TabPattern>;\n\n /** Controls selection for the tablist. */\n readonly selection: ListSelection<TabPattern, string>;\n\n /** Controls focus for the tablist. */\n readonly focusManager: ListFocus<TabPattern>;\n\n /** Controls expansion for the tablist. */\n readonly expansionManager: ListExpansion;\n\n /** Whether the tablist is vertically or horizontally oriented. */\n readonly orientation: SignalLike<'vertical' | 'horizontal'>;\n\n /** Whether the tablist is disabled. */\n readonly disabled: SignalLike<boolean>;\n\n /** The tabindex of the tablist. */\n readonly tabindex = computed(() => this.focusManager.getListTabindex());\n\n /** The id of the current active tab. */\n readonly activedescendant = computed(() => this.focusManager.getActiveDescendant());\n\n /** Whether selection should follow focus. */\n readonly followFocus = computed(() => this.inputs.selectionMode() === 'follow');\n\n /** The key used to navigate to the previous tab in the tablist. */\n readonly prevKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return 'ArrowUp';\n }\n return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n });\n\n /** The key used to navigate to the next item in the list. */\n readonly nextKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return 'ArrowDown';\n }\n return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** The keydown event manager for the tablist. */\n readonly keydown = computed(() => {\n return new KeyboardEventManager()\n .on(this.prevKey, () => this.prev({select: this.followFocus()}))\n .on(this.nextKey, () => this.next({select: this.followFocus()}))\n .on('Home', () => this.first({select: this.followFocus()}))\n .on('End', () => this.last({select: this.followFocus()}))\n .on(' ', () => this._select({select: true}))\n .on('Enter', () => this._select({select: true}));\n });\n\n /** The pointerdown event manager for the tablist. */\n readonly pointerdown = computed(() => {\n return new PointerEventManager().on(e => this.goto(e, {select: true}));\n });\n\n constructor(readonly inputs: TabListInputs) {\n this.disabled = inputs.disabled;\n this.orientation = inputs.orientation;\n\n this.focusManager = new ListFocus(inputs);\n this.navigation = new ListNavigation({...inputs, focusManager: this.focusManager});\n\n this.selection = new ListSelection({\n ...inputs,\n multi: () => false,\n focusManager: this.focusManager,\n });\n\n this.expansionManager = new ListExpansion({\n ...inputs,\n multiExpandable: () => false,\n expandedIds: this.inputs.value,\n });\n }\n\n /**\n * Sets the tablist to its default initial state.\n *\n * Sets the active index of the tablist to the first focusable selected\n * tab if one exists. Otherwise, sets focus to the first focusable tab.\n *\n * This method should be called once the tablist and its tabs are properly initialized.\n */\n setDefaultState() {\n let firstItemIndex: number | undefined;\n\n for (const [index, item] of this.inputs.items().entries()) {\n if (!this.focusManager.isFocusable(item)) continue;\n\n if (firstItemIndex === undefined) {\n firstItemIndex = index;\n }\n\n if (item.selected()) {\n this.inputs.activeIndex.set(index);\n return;\n }\n }\n if (firstItemIndex !== undefined) {\n this.inputs.activeIndex.set(firstItemIndex);\n }\n }\n\n /** Handles keydown events for the tablist. */\n onKeydown(event: KeyboardEvent) {\n if (!this.disabled()) {\n this.keydown().handle(event);\n }\n }\n\n /** The pointerdown event manager for the tablist. */\n onPointerdown(event: PointerEvent) {\n if (!this.disabled()) {\n this.pointerdown().handle(event);\n }\n }\n\n /** Navigates to the first option in the tablist. */\n first(opts?: SelectOptions) {\n this.navigation.first();\n this._select(opts);\n }\n\n /** Navigates to the last option in the tablist. */\n last(opts?: SelectOptions) {\n this.navigation.last();\n this._select(opts);\n }\n\n /** Navigates to the next option in the tablist. */\n next(opts?: SelectOptions) {\n this.navigation.next();\n this._select(opts);\n }\n\n /** Navigates to the previous option in the tablist. */\n prev(opts?: SelectOptions) {\n this.navigation.prev();\n this._select(opts);\n }\n\n /** Navigates to the given item in the tablist. */\n goto(event: PointerEvent, opts?: SelectOptions) {\n const item = this._getItem(event);\n\n if (item) {\n this.navigation.goto(item);\n this._select(opts);\n }\n }\n\n /** Handles updating selection for the tablist. */\n private _select(opts?: SelectOptions) {\n if (opts?.select) {\n this.selection.selectOne();\n this.expansionManager.open(this.focusManager.activeItem());\n }\n }\n\n private _getItem(e: PointerEvent) {\n if (!(e.target instanceof HTMLElement)) {\n return;\n }\n\n const element = e.target.closest('[role=\"tab\"]');\n return this.inputs.items().find(i => i.element() === element);\n }\n}\n"],"names":[],"mappings":";;;;;AAyBA;MACa,YAAY,CAAA;AAuBF,IAAA,MAAA;;AArBZ,IAAA,KAAK,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;;AAG7C,IAAA,UAAU,GAAG,QAAQ,CAAC,MAAK;AAClC,QAAA,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE;QAC1B,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,IAAI;QAC7C,MAAM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AC,CAAe,EAAA;QAC9B,IAAI,EAAE,CAAC,CAAC,MAAM,YAAY,WAAW,CAAC,EAAE;YACtC;;QAGF,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC;QAChD,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,KAAK,OAAO,CAAC;;AAEhE;;;;"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { f as ListFocusItem, S as SignalLike, a as ListFocusInputs, W as WritableSignalLike, d as ListFocus } from './pointer-event-manager.d-BqSm9Jh5.js';
|
|
3
|
-
|
|
4
|
-
/** Represents an item in a collection, such as a listbox option, than can be selected. */
|
|
5
|
-
interface ListSelectionItem<V> extends ListFocusItem {
|
|
6
|
-
/** The value of the item. */
|
|
7
|
-
value: SignalLike<V>;
|
|
8
|
-
}
|
|
9
|
-
/** Represents the required inputs for a collection that contains selectable items. */
|
|
10
|
-
interface ListSelectionInputs<T extends ListSelectionItem<V>, V> extends ListFocusInputs<T> {
|
|
11
|
-
/** Whether multiple items in the list can be selected at once. */
|
|
12
|
-
multi: SignalLike<boolean>;
|
|
13
|
-
/** The current value of the list selection. */
|
|
14
|
-
value: WritableSignalLike<V[]>;
|
|
15
|
-
/** The selection strategy used by the list. */
|
|
16
|
-
selectionMode: SignalLike<'follow' | 'explicit'>;
|
|
17
|
-
}
|
|
18
|
-
/** Controls selection for a list of items. */
|
|
19
|
-
declare class ListSelection<T extends ListSelectionItem<V>, V> {
|
|
20
|
-
readonly inputs: ListSelectionInputs<T, V> & {
|
|
21
|
-
focusManager: ListFocus<T>;
|
|
22
|
-
};
|
|
23
|
-
/** The start index to use for range selection. */
|
|
24
|
-
rangeStartIndex: _angular_core.WritableSignal<number>;
|
|
25
|
-
/** The end index to use for range selection. */
|
|
26
|
-
rangeEndIndex: _angular_core.WritableSignal<number>;
|
|
27
|
-
/** The currently selected items. */
|
|
28
|
-
selectedItems: _angular_core.Signal<T[]>;
|
|
29
|
-
constructor(inputs: ListSelectionInputs<T, V> & {
|
|
30
|
-
focusManager: ListFocus<T>;
|
|
31
|
-
});
|
|
32
|
-
/** Selects the item at the current active index. */
|
|
33
|
-
select(item?: ListSelectionItem<V>, opts?: {
|
|
34
|
-
anchor: boolean;
|
|
35
|
-
}): void;
|
|
36
|
-
/** Deselects the item at the current active index. */
|
|
37
|
-
deselect(item?: T): void;
|
|
38
|
-
/** Toggles the item at the current active index. */
|
|
39
|
-
toggle(): void;
|
|
40
|
-
/** Toggles only the item at the current active index. */
|
|
41
|
-
toggleOne(): void;
|
|
42
|
-
/** Selects all items in the list. */
|
|
43
|
-
selectAll(): void;
|
|
44
|
-
/** Deselects all items in the list. */
|
|
45
|
-
deselectAll(): void;
|
|
46
|
-
/**
|
|
47
|
-
* Selects all items in the list or deselects all
|
|
48
|
-
* items in the list if all items are already selected.
|
|
49
|
-
*/
|
|
50
|
-
toggleAll(): void;
|
|
51
|
-
/** Sets the selection to only the current active item. */
|
|
52
|
-
selectOne(): void;
|
|
53
|
-
/**
|
|
54
|
-
* Selects all items in the list up to the anchor item.
|
|
55
|
-
*
|
|
56
|
-
* Deselects all items that were previously within the
|
|
57
|
-
* selected range that are now outside of the selected range
|
|
58
|
-
*/
|
|
59
|
-
selectRange(opts?: {
|
|
60
|
-
anchor: boolean;
|
|
61
|
-
}): void;
|
|
62
|
-
/** Marks the given index as the start of a range selection. */
|
|
63
|
-
beginRangeSelection(index?: number): void;
|
|
64
|
-
/** Returns the items in the list starting from the given index. */
|
|
65
|
-
private _getItemsFromIndex;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export { ListSelection as L };
|
|
69
|
-
export type { ListSelectionItem as a, ListSelectionInputs as b };
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { f as ListFocusItem, S as SignalLike, a as ListFocusInputs, d as ListFocus } from './pointer-event-manager.d-BqSm9Jh5.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Represents an item in a collection, such as a listbox option, than can be navigated to by
|
|
6
|
-
* typeahead.
|
|
7
|
-
*/
|
|
8
|
-
interface ListTypeaheadItem extends ListFocusItem {
|
|
9
|
-
/** The text used by the typeahead search. */
|
|
10
|
-
searchTerm: SignalLike<string>;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Represents the required inputs for a collection that contains items that can be navigated to by
|
|
14
|
-
* typeahead.
|
|
15
|
-
*/
|
|
16
|
-
interface ListTypeaheadInputs<T extends ListTypeaheadItem> extends ListFocusInputs<T> {
|
|
17
|
-
/** The amount of time before the typeahead search is reset. */
|
|
18
|
-
typeaheadDelay: SignalLike<number>;
|
|
19
|
-
}
|
|
20
|
-
/** Controls typeahead for a list of items. */
|
|
21
|
-
declare class ListTypeahead<T extends ListTypeaheadItem> {
|
|
22
|
-
readonly inputs: ListTypeaheadInputs<T> & {
|
|
23
|
-
focusManager: ListFocus<T>;
|
|
24
|
-
};
|
|
25
|
-
/** A reference to the timeout for resetting the typeahead search. */
|
|
26
|
-
timeout?: ReturnType<typeof setTimeout> | undefined;
|
|
27
|
-
/** The focus controller of the parent list. */
|
|
28
|
-
focusManager: ListFocus<T>;
|
|
29
|
-
/** Whether the user is actively typing a typeahead search query. */
|
|
30
|
-
isTyping: _angular_core.Signal<boolean>;
|
|
31
|
-
/** Keeps track of the characters that typeahead search is being called with. */
|
|
32
|
-
private _query;
|
|
33
|
-
/** The index where that the typeahead search was initiated from. */
|
|
34
|
-
private _startIndex;
|
|
35
|
-
constructor(inputs: ListTypeaheadInputs<T> & {
|
|
36
|
-
focusManager: ListFocus<T>;
|
|
37
|
-
});
|
|
38
|
-
/** Performs a typeahead search, appending the given character to the search string. */
|
|
39
|
-
search(char: string): boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Returns the first item whose search term matches the
|
|
42
|
-
* current query starting from the the current anchor index.
|
|
43
|
-
*/
|
|
44
|
-
private _getItem;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export { ListTypeahead as L };
|
|
48
|
-
export type { ListTypeaheadItem as a, ListTypeaheadInputs as b };
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { e as ListNavigationItem, f as ListFocusItem, S as SignalLike, d as ListFocus, b as ListNavigation, L as ListNavigationInputs, a as ListFocusInputs, K as KeyboardEventManager, P as PointerEventManager } from './pointer-event-manager.d-BqSm9Jh5.js';
|
|
3
|
-
import { a as ListSelectionItem, L as ListSelection, b as ListSelectionInputs } from './list-selection.d-fbAPr_N_.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Represents the properties exposed by a radio group that need to be accessed by a radio button.
|
|
7
|
-
* This exists to avoid circular dependency errors between the radio group and radio button.
|
|
8
|
-
*/
|
|
9
|
-
interface RadioGroupLike<V> {
|
|
10
|
-
focusManager: ListFocus<RadioButtonPattern<V>>;
|
|
11
|
-
selection: ListSelection<RadioButtonPattern<V>, V>;
|
|
12
|
-
navigation: ListNavigation<RadioButtonPattern<V>>;
|
|
13
|
-
}
|
|
14
|
-
/** Represents the required inputs for a radio button in a radio group. */
|
|
15
|
-
interface RadioButtonInputs<V> extends ListNavigationItem, ListSelectionItem<V>, ListFocusItem {
|
|
16
|
-
/** A reference to the parent radio group. */
|
|
17
|
-
group: SignalLike<RadioGroupLike<V> | undefined>;
|
|
18
|
-
}
|
|
19
|
-
/** Represents a radio button within a radio group. */
|
|
20
|
-
declare class RadioButtonPattern<V> {
|
|
21
|
-
readonly inputs: RadioButtonInputs<V>;
|
|
22
|
-
/** A unique identifier for the radio button. */
|
|
23
|
-
id: SignalLike<string>;
|
|
24
|
-
/** The value associated with the radio button. */
|
|
25
|
-
value: SignalLike<V>;
|
|
26
|
-
/** The position of the radio button within the group. */
|
|
27
|
-
index: _angular_core.Signal<number>;
|
|
28
|
-
/** Whether the radio button is currently the active one (focused). */
|
|
29
|
-
active: _angular_core.Signal<boolean>;
|
|
30
|
-
/** Whether the radio button is selected. */
|
|
31
|
-
selected: SignalLike<boolean>;
|
|
32
|
-
/** Whether the radio button is disabled. */
|
|
33
|
-
disabled: SignalLike<boolean>;
|
|
34
|
-
/** A reference to the parent radio group. */
|
|
35
|
-
group: SignalLike<RadioGroupLike<V> | undefined>;
|
|
36
|
-
/** The tabindex of the radio button. */
|
|
37
|
-
tabindex: _angular_core.Signal<0 | -1 | undefined>;
|
|
38
|
-
/** The HTML element associated with the radio button. */
|
|
39
|
-
element: SignalLike<HTMLElement>;
|
|
40
|
-
constructor(inputs: RadioButtonInputs<V>);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/** The selection operations that the radio group can perform. */
|
|
44
|
-
interface SelectOptions {
|
|
45
|
-
selectOne?: boolean;
|
|
46
|
-
}
|
|
47
|
-
/** Represents the required inputs for a radio group. */
|
|
48
|
-
type RadioGroupInputs<V> = Omit<ListNavigationInputs<RadioButtonPattern<V>>, 'wrap'> & Omit<ListSelectionInputs<RadioButtonPattern<V>, V>, 'multi' | 'selectionMode'> & ListFocusInputs<RadioButtonPattern<V>> & {
|
|
49
|
-
/** Whether the radio group is disabled. */
|
|
50
|
-
disabled: SignalLike<boolean>;
|
|
51
|
-
/** Whether the radio group is readonly. */
|
|
52
|
-
readonly: SignalLike<boolean>;
|
|
53
|
-
};
|
|
54
|
-
/** Controls the state of a radio group. */
|
|
55
|
-
declare class RadioGroupPattern<V> {
|
|
56
|
-
readonly inputs: RadioGroupInputs<V>;
|
|
57
|
-
/** Controls navigation for the radio group. */
|
|
58
|
-
navigation: ListNavigation<RadioButtonPattern<V>>;
|
|
59
|
-
/** Controls selection for the radio group. */
|
|
60
|
-
selection: ListSelection<RadioButtonPattern<V>, V>;
|
|
61
|
-
/** Controls focus for the radio group. */
|
|
62
|
-
focusManager: ListFocus<RadioButtonPattern<V>>;
|
|
63
|
-
/** Whether the radio group is vertically or horizontally oriented. */
|
|
64
|
-
orientation: SignalLike<'vertical' | 'horizontal'>;
|
|
65
|
-
/** Whether the radio group is disabled. */
|
|
66
|
-
disabled: _angular_core.Signal<boolean>;
|
|
67
|
-
/** The currently selected radio button. */
|
|
68
|
-
selectedItem: _angular_core.Signal<RadioButtonPattern<V>>;
|
|
69
|
-
/** Whether the radio group is readonly. */
|
|
70
|
-
readonly: _angular_core.Signal<boolean>;
|
|
71
|
-
/** The tabindex of the radio group (if using activedescendant). */
|
|
72
|
-
tabindex: _angular_core.Signal<0 | -1>;
|
|
73
|
-
/** The id of the current active radio button (if using activedescendant). */
|
|
74
|
-
activedescendant: _angular_core.Signal<string | undefined>;
|
|
75
|
-
/** The key used to navigate to the previous radio button. */
|
|
76
|
-
prevKey: _angular_core.Signal<"ArrowUp" | "ArrowRight" | "ArrowLeft">;
|
|
77
|
-
/** The key used to navigate to the next radio button. */
|
|
78
|
-
nextKey: _angular_core.Signal<"ArrowRight" | "ArrowLeft" | "ArrowDown">;
|
|
79
|
-
/** The keydown event manager for the radio group. */
|
|
80
|
-
keydown: _angular_core.Signal<KeyboardEventManager<KeyboardEvent>>;
|
|
81
|
-
/** The pointerdown event manager for the radio group. */
|
|
82
|
-
pointerdown: _angular_core.Signal<PointerEventManager<PointerEvent>>;
|
|
83
|
-
constructor(inputs: RadioGroupInputs<V>);
|
|
84
|
-
/** Handles keydown events for the radio group. */
|
|
85
|
-
onKeydown(event: KeyboardEvent): void;
|
|
86
|
-
/** Handles pointerdown events for the radio group. */
|
|
87
|
-
onPointerdown(event: PointerEvent): void;
|
|
88
|
-
/** Navigates to the first enabled radio button in the group. */
|
|
89
|
-
first(opts?: SelectOptions): void;
|
|
90
|
-
/** Navigates to the last enabled radio button in the group. */
|
|
91
|
-
last(opts?: SelectOptions): void;
|
|
92
|
-
/** Navigates to the next enabled radio button in the group. */
|
|
93
|
-
next(opts?: SelectOptions): void;
|
|
94
|
-
/** Navigates to the previous enabled radio button in the group. */
|
|
95
|
-
prev(opts?: SelectOptions): void;
|
|
96
|
-
/** Navigates to the radio button associated with the given pointer event. */
|
|
97
|
-
goto(event: PointerEvent, opts?: SelectOptions): void;
|
|
98
|
-
/**
|
|
99
|
-
* Sets the radio group to its default initial state.
|
|
100
|
-
*
|
|
101
|
-
* Sets the active index to the selected radio button if one exists and is focusable.
|
|
102
|
-
* Otherwise, sets the active index to the first focusable radio button.
|
|
103
|
-
*/
|
|
104
|
-
setDefaultState(): void;
|
|
105
|
-
/** Validates the state of the radio group and returns a list of accessibility violations. */
|
|
106
|
-
validate(): string[];
|
|
107
|
-
/** Safely performs a navigation operation and updates selection if needed. */
|
|
108
|
-
private _navigate;
|
|
109
|
-
/** Finds the RadioButtonPattern associated with a pointer event target. */
|
|
110
|
-
private _getItem;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export { RadioGroupPattern as a, RadioButtonPattern as c };
|
|
114
|
-
export type { RadioGroupInputs as R, RadioButtonInputs as b };
|