aria-ease 3.0.3 → 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/bin/cli.cjs +32 -0
- package/bin/cli.js +1 -1
- package/bin/{contractTestRunnerPlaywright-3VJUZSYK.js → contractTestRunnerPlaywright-EZLNNJV5.js} +32 -0
- package/bin/{test-D374H2ZS.js → test-45KMD4F4.js} +1 -1
- package/dist/{contractTestRunnerPlaywright-4UOHWGWD.js → contractTestRunnerPlaywright-UQQI5MYS.js} +32 -0
- package/dist/index.cjs +624 -1
- package/dist/index.d.cts +83 -2
- package/dist/index.d.ts +83 -2
- package/dist/index.js +589 -2
- package/dist/src/{Types.d-uG0Hm1yK.d.ts → Types.d-BrHSyS03.d.cts} +17 -0
- package/dist/src/{Types.d-uG0Hm1yK.d.cts → Types.d-BrHSyS03.d.ts} +17 -0
- package/dist/src/accordion/index.cjs +159 -0
- package/dist/src/accordion/index.d.cts +19 -2
- package/dist/src/accordion/index.d.ts +19 -2
- package/dist/src/accordion/index.js +159 -1
- package/dist/src/block/index.cjs +1 -1
- package/dist/src/block/index.d.cts +6 -2
- package/dist/src/block/index.d.ts +6 -2
- package/dist/src/block/index.js +1 -1
- package/dist/src/checkbox/index.cjs +129 -0
- package/dist/src/checkbox/index.d.cts +15 -2
- package/dist/src/checkbox/index.d.ts +15 -2
- package/dist/src/checkbox/index.js +129 -1
- package/dist/src/combobox/index.d.cts +1 -1
- package/dist/src/combobox/index.d.ts +1 -1
- package/dist/src/menu/index.cjs +32 -0
- package/dist/src/menu/index.d.cts +1 -1
- package/dist/src/menu/index.d.ts +1 -1
- package/dist/src/menu/index.js +32 -0
- package/dist/src/radio/index.cjs +122 -0
- package/dist/src/radio/index.d.cts +17 -2
- package/dist/src/radio/index.d.ts +17 -2
- package/dist/src/radio/index.js +122 -1
- package/dist/src/toggle/index.cjs +145 -0
- package/dist/src/toggle/index.d.cts +17 -2
- package/dist/src/toggle/index.d.ts +17 -2
- package/dist/src/toggle/index.js +145 -1
- package/dist/src/utils/test/{contractTestRunnerPlaywright-4UOHWGWD.js → contractTestRunnerPlaywright-UQQI5MYS.js} +32 -0
- package/dist/src/utils/test/contracts/MenuContract.json +0 -1
- package/dist/src/utils/test/index.cjs +32 -0
- package/dist/src/utils/test/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -25,6 +25,23 @@ interface AccessibilityInstance {
|
|
|
25
25
|
refresh?: () => void;
|
|
26
26
|
openMenu?: () => void;
|
|
27
27
|
closeMenu?: () => void;
|
|
28
|
+
// Accordion methods
|
|
29
|
+
expandItem?: (index: number) => void;
|
|
30
|
+
collapseItem?: (index: number) => void;
|
|
31
|
+
toggleItem?: (index: number) => void;
|
|
32
|
+
// Radio methods
|
|
33
|
+
selectRadio?: (index: number) => void;
|
|
34
|
+
getSelectedIndex?: () => number;
|
|
35
|
+
// Checkbox methods
|
|
36
|
+
toggleCheckbox?: (index: number) => void;
|
|
37
|
+
setCheckboxState?: (index: number, checked: boolean) => void;
|
|
38
|
+
getCheckedStates?: () => boolean[];
|
|
39
|
+
getCheckedIndices?: () => number[];
|
|
40
|
+
// Toggle methods
|
|
41
|
+
toggleButton?: (index: number) => void;
|
|
42
|
+
setPressed?: (index: number, pressed: boolean) => void;
|
|
43
|
+
getPressedStates?: () => boolean[];
|
|
44
|
+
getPressedIndices?: () => number[];
|
|
28
45
|
}
|
|
29
46
|
|
|
30
47
|
interface ComboboxConfig {
|
|
@@ -52,13 +69,34 @@ interface config {
|
|
|
52
69
|
|
|
53
70
|
declare function updateAccordionTriggerAriaAttributes(accordionId: string, accordionTriggersClass: string, accordionStates: AccordionStates[], clickedTriggerIndex: number): void;
|
|
54
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Makes an accordion accessible by managing ARIA attributes, keyboard navigation, and state.
|
|
74
|
+
* Handles multiple accordion items with proper focus management and keyboard interactions.
|
|
75
|
+
* @param {string} accordionId - The id of the accordion container.
|
|
76
|
+
* @param {string} triggersClass - The shared class of all accordion trigger buttons.
|
|
77
|
+
* @param {string} panelsClass - The shared class of all accordion panels.
|
|
78
|
+
* @param {boolean} allowMultiple - Whether multiple panels can be open simultaneously (default: false).
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
interface AccordionConfig {
|
|
82
|
+
accordionId: string;
|
|
83
|
+
triggersClass: string;
|
|
84
|
+
panelsClass: string;
|
|
85
|
+
allowMultiple?: boolean;
|
|
86
|
+
}
|
|
87
|
+
declare function makeAccordionAccessible({ accordionId, triggersClass, panelsClass, allowMultiple }: AccordionConfig): AccessibilityInstance;
|
|
88
|
+
|
|
55
89
|
/**
|
|
56
90
|
* Adds keyboard interaction to block. The block traps focus and can be interacted with using the keyboard.
|
|
57
91
|
* @param {string} blockId The id of the block container.
|
|
58
92
|
* @param {string} blockItemsClass The shared class of the elements that are children of the block.
|
|
59
93
|
*/
|
|
60
94
|
|
|
61
|
-
|
|
95
|
+
interface BlockConfig {
|
|
96
|
+
blockId: string;
|
|
97
|
+
blockItemsClass: string;
|
|
98
|
+
}
|
|
99
|
+
declare function makeBlockAccessible({ blockId, blockItemsClass }: BlockConfig): AccessibilityInstance;
|
|
62
100
|
|
|
63
101
|
/**
|
|
64
102
|
* Adds screen reader accessibility to multiple checkboxes. Updates the aria attributes of the checkboxes. Checkbox elements must possess the following aria attributes; aria-checked and aria-label.
|
|
@@ -70,6 +108,19 @@ declare function makeBlockAccessible(blockId: string, blockItemsClass: string):
|
|
|
70
108
|
|
|
71
109
|
declare function updateCheckboxAriaAttributes(checkboxId: string, checkboxesClass: string, checkboxStates: CheckboxStates[], currentPressedCheckboxIndex: number): void;
|
|
72
110
|
|
|
111
|
+
/**
|
|
112
|
+
* Makes a checkbox group accessible by managing ARIA attributes and keyboard navigation.
|
|
113
|
+
* Handles multiple independent checkboxes with proper focus management and keyboard interactions.
|
|
114
|
+
* @param {string} checkboxGroupId - The id of the checkbox group container.
|
|
115
|
+
* @param {string} checkboxesClass - The shared class of all checkboxes.
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
interface CheckboxConfig {
|
|
119
|
+
checkboxGroupId: string;
|
|
120
|
+
checkboxesClass: string;
|
|
121
|
+
}
|
|
122
|
+
declare function makeCheckboxAccessible({ checkboxGroupId, checkboxesClass }: CheckboxConfig): AccessibilityInstance;
|
|
123
|
+
|
|
73
124
|
/**
|
|
74
125
|
* Adds keyboard interaction to toggle menu. The menu traps focus and can be interacted with using the keyboard. The first interactive item of the menu has focus when menu open.
|
|
75
126
|
* @param {string} menuId - The id of the menu.
|
|
@@ -93,6 +144,21 @@ declare function makeMenuAccessible({ menuId, menuItemsClass, triggerId }: {
|
|
|
93
144
|
|
|
94
145
|
declare function updateRadioAriaAttributes(radioId: string, radiosClass: string, radioStates: RadioStates[], currentPressedRadioIndex: number): void;
|
|
95
146
|
|
|
147
|
+
/**
|
|
148
|
+
* Makes a radio group accessible by managing ARIA attributes, keyboard navigation, and state.
|
|
149
|
+
* Handles radio button selection with proper focus management and keyboard interactions.
|
|
150
|
+
* @param {string} radioGroupId - The id of the radio group container.
|
|
151
|
+
* @param {string} radiosClass - The shared class of all radio buttons.
|
|
152
|
+
* @param {number} defaultSelectedIndex - The index of the initially selected radio (default: 0).
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
interface RadioConfig {
|
|
156
|
+
radioGroupId: string;
|
|
157
|
+
radiosClass: string;
|
|
158
|
+
defaultSelectedIndex?: number;
|
|
159
|
+
}
|
|
160
|
+
declare function makeRadioAccessible({ radioGroupId, radiosClass, defaultSelectedIndex }: RadioConfig): AccessibilityInstance;
|
|
161
|
+
|
|
96
162
|
/**
|
|
97
163
|
* Adds screen reader accessibility to toggle buttons. Updates the aria attributes of the toggle buttons. Button must be a semantic button element or a non-semantic element with a role of button, and possess the aria-pressed attribute.
|
|
98
164
|
* @param {string} toggleId The id of the toggle buttons parent container.
|
|
@@ -103,6 +169,21 @@ declare function updateRadioAriaAttributes(radioId: string, radiosClass: string,
|
|
|
103
169
|
|
|
104
170
|
declare function updateToggleAriaAttribute(toggleId: string, togglesClass: string, toggleStates: ToggleStates[], currentPressedToggleIndex: number): void;
|
|
105
171
|
|
|
172
|
+
/**
|
|
173
|
+
* Makes a toggle button accessible by managing ARIA attributes and keyboard interactions.
|
|
174
|
+
* Handles toggle button state with proper focus management.
|
|
175
|
+
* @param {string} toggleId - The id of the toggle button or toggle button container.
|
|
176
|
+
* @param {string} togglesClass - The shared class of toggle buttons (for groups).
|
|
177
|
+
* @param {boolean} isSingleToggle - Whether this is a single toggle button (default: true).
|
|
178
|
+
*/
|
|
179
|
+
|
|
180
|
+
interface ToggleConfig {
|
|
181
|
+
toggleId: string;
|
|
182
|
+
togglesClass?: string;
|
|
183
|
+
isSingleToggle?: boolean;
|
|
184
|
+
}
|
|
185
|
+
declare function makeToggleAccessible({ toggleId, togglesClass, isSingleToggle }: ToggleConfig): AccessibilityInstance;
|
|
186
|
+
|
|
106
187
|
/**
|
|
107
188
|
* Makes a Combobox accessible by adding appropriate ARIA attributes, keyboard interactions and focus management.
|
|
108
189
|
* @param {string} comboboxInputId - The id of the combobox input element.
|
|
@@ -123,4 +204,4 @@ declare function makeComboboxAccessible({ comboboxInputId, comboboxButtonId, lis
|
|
|
123
204
|
|
|
124
205
|
declare function testUiComponent(componentName: string, component: HTMLElement, url?: string): Promise<JestAxeResult>;
|
|
125
206
|
|
|
126
|
-
export { makeBlockAccessible, makeComboboxAccessible, makeMenuAccessible, testUiComponent, updateAccordionTriggerAriaAttributes, updateCheckboxAriaAttributes, updateRadioAriaAttributes, updateToggleAriaAttribute };
|
|
207
|
+
export { makeAccordionAccessible, makeBlockAccessible, makeCheckboxAccessible, makeComboboxAccessible, makeMenuAccessible, makeRadioAccessible, makeToggleAccessible, testUiComponent, updateAccordionTriggerAriaAttributes, updateCheckboxAriaAttributes, updateRadioAriaAttributes, updateToggleAriaAttribute };
|
package/dist/index.d.ts
CHANGED
|
@@ -25,6 +25,23 @@ interface AccessibilityInstance {
|
|
|
25
25
|
refresh?: () => void;
|
|
26
26
|
openMenu?: () => void;
|
|
27
27
|
closeMenu?: () => void;
|
|
28
|
+
// Accordion methods
|
|
29
|
+
expandItem?: (index: number) => void;
|
|
30
|
+
collapseItem?: (index: number) => void;
|
|
31
|
+
toggleItem?: (index: number) => void;
|
|
32
|
+
// Radio methods
|
|
33
|
+
selectRadio?: (index: number) => void;
|
|
34
|
+
getSelectedIndex?: () => number;
|
|
35
|
+
// Checkbox methods
|
|
36
|
+
toggleCheckbox?: (index: number) => void;
|
|
37
|
+
setCheckboxState?: (index: number, checked: boolean) => void;
|
|
38
|
+
getCheckedStates?: () => boolean[];
|
|
39
|
+
getCheckedIndices?: () => number[];
|
|
40
|
+
// Toggle methods
|
|
41
|
+
toggleButton?: (index: number) => void;
|
|
42
|
+
setPressed?: (index: number, pressed: boolean) => void;
|
|
43
|
+
getPressedStates?: () => boolean[];
|
|
44
|
+
getPressedIndices?: () => number[];
|
|
28
45
|
}
|
|
29
46
|
|
|
30
47
|
interface ComboboxConfig {
|
|
@@ -52,13 +69,34 @@ interface config {
|
|
|
52
69
|
|
|
53
70
|
declare function updateAccordionTriggerAriaAttributes(accordionId: string, accordionTriggersClass: string, accordionStates: AccordionStates[], clickedTriggerIndex: number): void;
|
|
54
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Makes an accordion accessible by managing ARIA attributes, keyboard navigation, and state.
|
|
74
|
+
* Handles multiple accordion items with proper focus management and keyboard interactions.
|
|
75
|
+
* @param {string} accordionId - The id of the accordion container.
|
|
76
|
+
* @param {string} triggersClass - The shared class of all accordion trigger buttons.
|
|
77
|
+
* @param {string} panelsClass - The shared class of all accordion panels.
|
|
78
|
+
* @param {boolean} allowMultiple - Whether multiple panels can be open simultaneously (default: false).
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
interface AccordionConfig {
|
|
82
|
+
accordionId: string;
|
|
83
|
+
triggersClass: string;
|
|
84
|
+
panelsClass: string;
|
|
85
|
+
allowMultiple?: boolean;
|
|
86
|
+
}
|
|
87
|
+
declare function makeAccordionAccessible({ accordionId, triggersClass, panelsClass, allowMultiple }: AccordionConfig): AccessibilityInstance;
|
|
88
|
+
|
|
55
89
|
/**
|
|
56
90
|
* Adds keyboard interaction to block. The block traps focus and can be interacted with using the keyboard.
|
|
57
91
|
* @param {string} blockId The id of the block container.
|
|
58
92
|
* @param {string} blockItemsClass The shared class of the elements that are children of the block.
|
|
59
93
|
*/
|
|
60
94
|
|
|
61
|
-
|
|
95
|
+
interface BlockConfig {
|
|
96
|
+
blockId: string;
|
|
97
|
+
blockItemsClass: string;
|
|
98
|
+
}
|
|
99
|
+
declare function makeBlockAccessible({ blockId, blockItemsClass }: BlockConfig): AccessibilityInstance;
|
|
62
100
|
|
|
63
101
|
/**
|
|
64
102
|
* Adds screen reader accessibility to multiple checkboxes. Updates the aria attributes of the checkboxes. Checkbox elements must possess the following aria attributes; aria-checked and aria-label.
|
|
@@ -70,6 +108,19 @@ declare function makeBlockAccessible(blockId: string, blockItemsClass: string):
|
|
|
70
108
|
|
|
71
109
|
declare function updateCheckboxAriaAttributes(checkboxId: string, checkboxesClass: string, checkboxStates: CheckboxStates[], currentPressedCheckboxIndex: number): void;
|
|
72
110
|
|
|
111
|
+
/**
|
|
112
|
+
* Makes a checkbox group accessible by managing ARIA attributes and keyboard navigation.
|
|
113
|
+
* Handles multiple independent checkboxes with proper focus management and keyboard interactions.
|
|
114
|
+
* @param {string} checkboxGroupId - The id of the checkbox group container.
|
|
115
|
+
* @param {string} checkboxesClass - The shared class of all checkboxes.
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
interface CheckboxConfig {
|
|
119
|
+
checkboxGroupId: string;
|
|
120
|
+
checkboxesClass: string;
|
|
121
|
+
}
|
|
122
|
+
declare function makeCheckboxAccessible({ checkboxGroupId, checkboxesClass }: CheckboxConfig): AccessibilityInstance;
|
|
123
|
+
|
|
73
124
|
/**
|
|
74
125
|
* Adds keyboard interaction to toggle menu. The menu traps focus and can be interacted with using the keyboard. The first interactive item of the menu has focus when menu open.
|
|
75
126
|
* @param {string} menuId - The id of the menu.
|
|
@@ -93,6 +144,21 @@ declare function makeMenuAccessible({ menuId, menuItemsClass, triggerId }: {
|
|
|
93
144
|
|
|
94
145
|
declare function updateRadioAriaAttributes(radioId: string, radiosClass: string, radioStates: RadioStates[], currentPressedRadioIndex: number): void;
|
|
95
146
|
|
|
147
|
+
/**
|
|
148
|
+
* Makes a radio group accessible by managing ARIA attributes, keyboard navigation, and state.
|
|
149
|
+
* Handles radio button selection with proper focus management and keyboard interactions.
|
|
150
|
+
* @param {string} radioGroupId - The id of the radio group container.
|
|
151
|
+
* @param {string} radiosClass - The shared class of all radio buttons.
|
|
152
|
+
* @param {number} defaultSelectedIndex - The index of the initially selected radio (default: 0).
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
interface RadioConfig {
|
|
156
|
+
radioGroupId: string;
|
|
157
|
+
radiosClass: string;
|
|
158
|
+
defaultSelectedIndex?: number;
|
|
159
|
+
}
|
|
160
|
+
declare function makeRadioAccessible({ radioGroupId, radiosClass, defaultSelectedIndex }: RadioConfig): AccessibilityInstance;
|
|
161
|
+
|
|
96
162
|
/**
|
|
97
163
|
* Adds screen reader accessibility to toggle buttons. Updates the aria attributes of the toggle buttons. Button must be a semantic button element or a non-semantic element with a role of button, and possess the aria-pressed attribute.
|
|
98
164
|
* @param {string} toggleId The id of the toggle buttons parent container.
|
|
@@ -103,6 +169,21 @@ declare function updateRadioAriaAttributes(radioId: string, radiosClass: string,
|
|
|
103
169
|
|
|
104
170
|
declare function updateToggleAriaAttribute(toggleId: string, togglesClass: string, toggleStates: ToggleStates[], currentPressedToggleIndex: number): void;
|
|
105
171
|
|
|
172
|
+
/**
|
|
173
|
+
* Makes a toggle button accessible by managing ARIA attributes and keyboard interactions.
|
|
174
|
+
* Handles toggle button state with proper focus management.
|
|
175
|
+
* @param {string} toggleId - The id of the toggle button or toggle button container.
|
|
176
|
+
* @param {string} togglesClass - The shared class of toggle buttons (for groups).
|
|
177
|
+
* @param {boolean} isSingleToggle - Whether this is a single toggle button (default: true).
|
|
178
|
+
*/
|
|
179
|
+
|
|
180
|
+
interface ToggleConfig {
|
|
181
|
+
toggleId: string;
|
|
182
|
+
togglesClass?: string;
|
|
183
|
+
isSingleToggle?: boolean;
|
|
184
|
+
}
|
|
185
|
+
declare function makeToggleAccessible({ toggleId, togglesClass, isSingleToggle }: ToggleConfig): AccessibilityInstance;
|
|
186
|
+
|
|
106
187
|
/**
|
|
107
188
|
* Makes a Combobox accessible by adding appropriate ARIA attributes, keyboard interactions and focus management.
|
|
108
189
|
* @param {string} comboboxInputId - The id of the combobox input element.
|
|
@@ -123,4 +204,4 @@ declare function makeComboboxAccessible({ comboboxInputId, comboboxButtonId, lis
|
|
|
123
204
|
|
|
124
205
|
declare function testUiComponent(componentName: string, component: HTMLElement, url?: string): Promise<JestAxeResult>;
|
|
125
206
|
|
|
126
|
-
export { makeBlockAccessible, makeComboboxAccessible, makeMenuAccessible, testUiComponent, updateAccordionTriggerAriaAttributes, updateCheckboxAriaAttributes, updateRadioAriaAttributes, updateToggleAriaAttribute };
|
|
207
|
+
export { makeAccordionAccessible, makeBlockAccessible, makeCheckboxAccessible, makeComboboxAccessible, makeMenuAccessible, makeRadioAccessible, makeToggleAccessible, testUiComponent, updateAccordionTriggerAriaAttributes, updateCheckboxAriaAttributes, updateRadioAriaAttributes, updateToggleAriaAttribute };
|