@patternfly/pfe-core 3.0.0 → 4.0.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/controllers/activedescendant-controller.d.ts +99 -0
- package/controllers/activedescendant-controller.js +230 -0
- package/controllers/activedescendant-controller.js.map +1 -0
- package/controllers/at-focus-controller.d.ts +56 -0
- package/controllers/at-focus-controller.js +168 -0
- package/controllers/at-focus-controller.js.map +1 -0
- package/controllers/cascade-controller.d.ts +7 -2
- package/controllers/cascade-controller.js +6 -1
- package/controllers/cascade-controller.js.map +1 -1
- package/controllers/combobox-controller.d.ts +117 -0
- package/controllers/combobox-controller.js +611 -0
- package/controllers/combobox-controller.js.map +1 -0
- package/controllers/css-variable-controller.js +1 -1
- package/controllers/css-variable-controller.js.map +1 -1
- package/controllers/floating-dom-controller.d.ts +8 -1
- package/controllers/floating-dom-controller.js +12 -5
- package/controllers/floating-dom-controller.js.map +1 -1
- package/controllers/internals-controller.d.ts +26 -9
- package/controllers/internals-controller.js +45 -13
- package/controllers/internals-controller.js.map +1 -1
- package/controllers/light-dom-controller.js +2 -2
- package/controllers/light-dom-controller.js.map +1 -1
- package/controllers/listbox-controller.d.ts +118 -33
- package/controllers/listbox-controller.js +347 -154
- package/controllers/listbox-controller.js.map +1 -1
- package/controllers/logger.d.ts +13 -10
- package/controllers/logger.js +15 -11
- package/controllers/logger.js.map +1 -1
- package/controllers/overflow-controller.js +10 -6
- package/controllers/overflow-controller.js.map +1 -1
- package/controllers/perf-controller.js.map +1 -1
- package/controllers/property-observer-controller.d.ts +13 -16
- package/controllers/property-observer-controller.js +54 -25
- package/controllers/property-observer-controller.js.map +1 -1
- package/controllers/roving-tabindex-controller.d.ts +12 -61
- package/controllers/roving-tabindex-controller.js +57 -203
- package/controllers/roving-tabindex-controller.js.map +1 -1
- package/controllers/scroll-spy-controller.d.ts +4 -1
- package/controllers/scroll-spy-controller.js +9 -6
- package/controllers/scroll-spy-controller.js.map +1 -1
- package/controllers/slot-controller.d.ts +12 -16
- package/controllers/slot-controller.js +17 -20
- package/controllers/slot-controller.js.map +1 -1
- package/controllers/style-controller.js +3 -1
- package/controllers/style-controller.js.map +1 -1
- package/controllers/tabs-aria-controller.d.ts +2 -0
- package/controllers/tabs-aria-controller.js +2 -0
- package/controllers/tabs-aria-controller.js.map +1 -1
- package/controllers/test/combobox-controller.spec.d.ts +1 -0
- package/controllers/test/combobox-controller.spec.js +282 -0
- package/controllers/test/combobox-controller.spec.js.map +1 -0
- package/controllers/timestamp-controller.js +7 -2
- package/controllers/timestamp-controller.js.map +1 -1
- package/core.d.ts +0 -23
- package/core.js +1 -38
- package/core.js.map +1 -1
- package/custom-elements.json +3844 -1369
- package/decorators/bound.d.ts +3 -1
- package/decorators/bound.js +3 -1
- package/decorators/bound.js.map +1 -1
- package/decorators/cascades.d.ts +2 -1
- package/decorators/cascades.js +2 -1
- package/decorators/cascades.js.map +1 -1
- package/decorators/deprecation.d.ts +6 -5
- package/decorators/deprecation.js +6 -5
- package/decorators/deprecation.js.map +1 -1
- package/decorators/initializer.js.map +1 -1
- package/decorators/listen.d.ts +8 -0
- package/decorators/listen.js +22 -0
- package/decorators/listen.js.map +1 -0
- package/decorators/observed.d.ts +12 -16
- package/decorators/observed.js +39 -44
- package/decorators/observed.js.map +1 -1
- package/decorators/observes.d.ts +15 -0
- package/decorators/observes.js +30 -0
- package/decorators/observes.js.map +1 -0
- package/decorators/time.d.ts +1 -0
- package/decorators/time.js +6 -9
- package/decorators/time.js.map +1 -1
- package/decorators/trace.d.ts +4 -1
- package/decorators/trace.js +4 -1
- package/decorators/trace.js.map +1 -1
- package/decorators.d.ts +2 -0
- package/decorators.js +2 -0
- package/decorators.js.map +1 -1
- package/functions/arraysAreEquivalent.d.ts +9 -0
- package/functions/arraysAreEquivalent.js +28 -0
- package/functions/arraysAreEquivalent.js.map +1 -0
- package/functions/containsDeep.d.ts +2 -0
- package/functions/containsDeep.js +2 -0
- package/functions/containsDeep.js.map +1 -1
- package/functions/context.d.ts +3 -4
- package/functions/context.js +6 -2
- package/functions/context.js.map +1 -1
- package/functions/debounce.js.map +1 -1
- package/functions/isElementInView.d.ts +4 -6
- package/functions/isElementInView.js +9 -11
- package/functions/isElementInView.js.map +1 -1
- package/package.json +7 -4
|
@@ -1,58 +1,143 @@
|
|
|
1
1
|
import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
-
export interface ListboxAccessibilityController<Item extends HTMLElement> extends ReactiveController {
|
|
3
|
-
items: Item[];
|
|
4
|
-
activeItem?: Item;
|
|
5
|
-
nextItem?: Item;
|
|
6
|
-
prevItem?: Item;
|
|
7
|
-
firstItem?: Item;
|
|
8
|
-
lastItem?: Item;
|
|
9
|
-
updateItems(items: Item[]): void;
|
|
10
|
-
setActiveItem(item: Item): void;
|
|
11
|
-
}
|
|
12
2
|
/**
|
|
13
|
-
*
|
|
3
|
+
* Options for listbox controller
|
|
14
4
|
*/
|
|
15
|
-
export interface
|
|
5
|
+
export interface ListboxControllerOptions<Item extends HTMLElement> {
|
|
6
|
+
/**
|
|
7
|
+
* Whether the listbox supports multiple selections.
|
|
8
|
+
*/
|
|
16
9
|
multi?: boolean;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Optional callback to control the selection behavior of items. By default, ListboxController
|
|
12
|
+
* will set the `aria-selected` attribute. When overriding this option, it will call it on your
|
|
13
|
+
* element with the selected state.
|
|
14
|
+
* Callers **must** ensure that the correct ARIA state is set.
|
|
15
|
+
*/
|
|
16
|
+
setItemSelected?(item: Item, selected: boolean): void;
|
|
17
|
+
/**
|
|
18
|
+
* Optional predicate to ascertain whether a custom element item is disabled or not
|
|
19
|
+
* By default, if the item matches any of these conditions, it is considered disabled:
|
|
20
|
+
* 1. it's `disabled` DOM property is `true`
|
|
21
|
+
* 1. it has the `aria-disabled="true"` attribute
|
|
22
|
+
* 2. it has the `disabled` attribute present
|
|
23
|
+
* 3. it matches the `:disabled` pseudo selector
|
|
24
|
+
*/
|
|
25
|
+
isItemDisabled?(item: Item): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Predicate which determines if a given element is in fact an item
|
|
28
|
+
* instead of e.g a presentational divider. By default, elements must meet the following criteria
|
|
29
|
+
* 1. element a child of a listbox role,
|
|
30
|
+
* 2. element does not have role="presentation"
|
|
31
|
+
* 2. element is not an `<hr>`
|
|
32
|
+
* **NB**: When overriding, you must avoid outside references. This predicate must
|
|
33
|
+
* only consider the element itself, without reference to the host element's items array.
|
|
34
|
+
* @example ```js
|
|
35
|
+
* isItem: (item) => item instanceof MyCustomItem
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
isItem?(item: EventTarget | null): item is Item;
|
|
39
|
+
/**
|
|
40
|
+
* Function returning the item which currently has assistive technology focus.
|
|
41
|
+
* In most cases, this should be the `atFocusedItem` of an ATFocusController
|
|
42
|
+
* i.e. RovingTabindexController or ActivedescendantController.
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
45
|
+
getATFocusedItem(): Item | null;
|
|
46
|
+
/**
|
|
47
|
+
* Function returning the DOM node which is the direct parent of the item elements
|
|
48
|
+
* Defaults to the controller host.
|
|
49
|
+
* If the controller host is not an HTMLElement, this *must* be set
|
|
50
|
+
*/
|
|
51
|
+
getItemsContainer?(): HTMLElement | null;
|
|
52
|
+
/**
|
|
53
|
+
* Optional function returning an additional DOM node which controls the listbox, e.g.
|
|
54
|
+
* a combobox input.
|
|
55
|
+
*/
|
|
56
|
+
getControlsElements?(): HTMLElement[];
|
|
21
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* @param item possible disabled item
|
|
60
|
+
* @package do not import this outside of `@patternfly/pfe-core`, it is subject to change at any time
|
|
61
|
+
*/
|
|
62
|
+
export declare function isItem<Item extends HTMLElement>(item: EventTarget | null): item is Item;
|
|
63
|
+
/**
|
|
64
|
+
* This is a fib. aria-disabled might not be present on an element that uses internals,
|
|
65
|
+
* and the `disabled` attribute may not accurately represent the disabled state.
|
|
66
|
+
* short of patching the `attachInternals` constructor, it may not be possible at
|
|
67
|
+
* runtime to know with certainty that an arbitrary custom element is disabled or not.
|
|
68
|
+
* @param item possibly disabled item
|
|
69
|
+
* @package do not import this outside of `@patternfly/pfe-core`, it is subject to change at any time
|
|
70
|
+
*/
|
|
71
|
+
export declare function isItemDisabled<Item extends HTMLElement>(item: Item): boolean;
|
|
22
72
|
/**
|
|
23
73
|
* Implements listbox semantics and accesibility. As there are two recognized
|
|
24
74
|
* patterns for implementing keyboard interactions with listbox patterns,
|
|
25
75
|
* provide a secondary controller (either RovingTabindexController or
|
|
26
76
|
* ActiveDescendantController) to complete the implementation.
|
|
77
|
+
*
|
|
78
|
+
* @see https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_focus_vs_selection
|
|
79
|
+
*
|
|
80
|
+
* > Occasionally, it may appear as if two elements on the page have focus at the same time.
|
|
81
|
+
* > For example, in a multi-select list box, when an option is selected it may be greyed.
|
|
82
|
+
* > Yet, the focus indicator can still be moved to other options, which may also be selected.
|
|
83
|
+
* > Similarly, when a user activates a tab in a tablist, the selected state is set on the tab
|
|
84
|
+
* > and its visual appearance changes. However, the user can still navigate, moving the focus
|
|
85
|
+
* > indicator elsewhere on the page while the tab retains its selected appearance and state.
|
|
86
|
+
* >
|
|
87
|
+
* > Focus and selection are quite different. From the keyboard user's perspective,
|
|
88
|
+
* > focus is a pointer, like a mouse pointer; it tracks the path of navigation.
|
|
89
|
+
* > There is only one point of focus at any time and all operations take place at the
|
|
90
|
+
* > point of focus. On the other hand, selection is an operation that can be performed in
|
|
91
|
+
* > some widgets, such as list boxes, trees, and tablists. If a widget supports only single
|
|
92
|
+
* > selection, then only one item can be selected and very often the selected state will simply
|
|
93
|
+
* > follow the focus when focus is moved inside of the widget.
|
|
94
|
+
* > That is, in some widgets, moving focus may also perform the select operation.
|
|
95
|
+
* > However, if the widget supports multiple selection, then more than one item can be in a
|
|
96
|
+
* > selected state, and keys for moving focus do not perform selection. Some multi-select widgets
|
|
97
|
+
* > do support key commands that both move focus and change selection, but those keys are
|
|
98
|
+
* > different from the normal navigation keys. Finally, when focus leaves a widget that includes
|
|
99
|
+
* > a selected element, the selected state persists.
|
|
100
|
+
* >
|
|
101
|
+
* > From the developer's perspective, the difference is simple -- the focused element is the
|
|
102
|
+
* > active element (document.activeElement). Selected elements are elements that have
|
|
103
|
+
* > aria-selected="true".
|
|
104
|
+
* >
|
|
105
|
+
* > With respect to focus and the selected state, the most important considerations for designers
|
|
106
|
+
* > and developers are:
|
|
107
|
+
* >
|
|
108
|
+
* > - The visual focus indicator must always be visible.
|
|
109
|
+
* > - The selected state must be visually distinct from the focus indicator.
|
|
27
110
|
*/
|
|
28
111
|
export declare class ListboxController<Item extends HTMLElement> implements ReactiveController {
|
|
29
112
|
#private;
|
|
30
113
|
host: ReactiveControllerHost;
|
|
31
|
-
private _options;
|
|
32
114
|
private static instances;
|
|
33
|
-
static of<Item extends HTMLElement>(host: ReactiveControllerHost, options:
|
|
34
|
-
private constructor();
|
|
115
|
+
static of<Item extends HTMLElement>(host: ReactiveControllerHost, options: ListboxControllerOptions<Item>): ListboxController<Item>;
|
|
35
116
|
/** Whether listbox is disabled */
|
|
36
117
|
disabled: boolean;
|
|
37
|
-
|
|
38
|
-
get
|
|
39
|
-
|
|
40
|
-
get
|
|
118
|
+
get container(): HTMLElement;
|
|
119
|
+
get multi(): boolean;
|
|
120
|
+
set multi(v: boolean);
|
|
121
|
+
get items(): Item[];
|
|
41
122
|
/**
|
|
42
|
-
*
|
|
123
|
+
* register's the host's Item elements as listbox controller items
|
|
124
|
+
* sets aria-setsize and aria-posinset on items
|
|
125
|
+
* @param items items
|
|
43
126
|
*/
|
|
44
|
-
|
|
45
|
-
get value(): Item | Item[];
|
|
46
|
-
private get element();
|
|
47
|
-
hostConnected(): Promise<void>;
|
|
48
|
-
hostUpdated(): void;
|
|
49
|
-
hostDisconnected(): void;
|
|
127
|
+
set items(items: Item[]);
|
|
50
128
|
/**
|
|
51
129
|
* sets the listbox value based on selected options
|
|
130
|
+
* @param selected item or items
|
|
52
131
|
*/
|
|
53
|
-
|
|
132
|
+
set selected(selected: Item[]);
|
|
54
133
|
/**
|
|
55
|
-
*
|
|
134
|
+
* array of options which are selected
|
|
56
135
|
*/
|
|
57
|
-
|
|
136
|
+
get selected(): Item[];
|
|
137
|
+
private constructor();
|
|
138
|
+
hostConnected(): Promise<void>;
|
|
139
|
+
hostUpdate(): void;
|
|
140
|
+
hostUpdated(): void;
|
|
141
|
+
hostDisconnected(): void;
|
|
142
|
+
isSelected(item: Item): boolean;
|
|
58
143
|
}
|