@compa11y/core 0.1.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/LICENSE +21 -0
- package/README.md +160 -0
- package/dist/announcer/index.cjs +49 -0
- package/dist/announcer/index.cjs.map +1 -0
- package/dist/announcer/index.d.cts +61 -0
- package/dist/announcer/index.d.ts +61 -0
- package/dist/announcer/index.js +4 -0
- package/dist/announcer/index.js.map +1 -0
- package/dist/aria/index.cjs +24 -0
- package/dist/aria/index.cjs.map +1 -0
- package/dist/aria/index.d.cts +176 -0
- package/dist/aria/index.d.ts +176 -0
- package/dist/aria/index.js +3 -0
- package/dist/aria/index.js.map +1 -0
- package/dist/chunk-24U5HHMC.js +309 -0
- package/dist/chunk-24U5HHMC.js.map +1 -0
- package/dist/chunk-2CQOLVQH.js +147 -0
- package/dist/chunk-2CQOLVQH.js.map +1 -0
- package/dist/chunk-2PUYKF2E.js +631 -0
- package/dist/chunk-2PUYKF2E.js.map +1 -0
- package/dist/chunk-2WF5Y6D7.js +175 -0
- package/dist/chunk-2WF5Y6D7.js.map +1 -0
- package/dist/chunk-CQXMBRLD.cjs +657 -0
- package/dist/chunk-CQXMBRLD.cjs.map +1 -0
- package/dist/chunk-HQOFVJFO.cjs +181 -0
- package/dist/chunk-HQOFVJFO.cjs.map +1 -0
- package/dist/chunk-NBGFFCIJ.cjs +314 -0
- package/dist/chunk-NBGFFCIJ.cjs.map +1 -0
- package/dist/chunk-V6TZIZZ4.cjs +158 -0
- package/dist/chunk-V6TZIZZ4.cjs.map +1 -0
- package/dist/chunk-XEGB27QF.cjs +78 -0
- package/dist/chunk-XEGB27QF.cjs.map +1 -0
- package/dist/chunk-Z7K2G6FX.js +66 -0
- package/dist/chunk-Z7K2G6FX.js.map +1 -0
- package/dist/focus/index.cjs +53 -0
- package/dist/focus/index.cjs.map +1 -0
- package/dist/focus/index.d.cts +139 -0
- package/dist/focus/index.d.ts +139 -0
- package/dist/focus/index.js +4 -0
- package/dist/focus/index.js.map +1 -0
- package/dist/index.cjs +573 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +241 -0
- package/dist/index.d.ts +241 -0
- package/dist/index.js +343 -0
- package/dist/index.js.map +1 -0
- package/dist/keyboard/index.cjs +28 -0
- package/dist/keyboard/index.cjs.map +1 -0
- package/dist/keyboard/index.d.cts +102 -0
- package/dist/keyboard/index.d.ts +102 -0
- package/dist/keyboard/index.js +3 -0
- package/dist/keyboard/index.js.map +1 -0
- package/dist/types-DDSPmE8m.d.cts +52 -0
- package/dist/types-DDSPmE8m.d.ts +52 -0
- package/package.json +78 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ivan Trajkovski
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# @compa11y/core
|
|
2
|
+
|
|
3
|
+
Framework-agnostic accessibility primitives for building accessible UI components.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @compa11y/core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- **Focus Management** — Focus traps, focus scope, roving tabindex
|
|
14
|
+
- **Keyboard Navigation** — Pre-built patterns for menus, tabs, grids
|
|
15
|
+
- **Screen Reader Support** — Live region announcements
|
|
16
|
+
- **ARIA Utilities** — Helpers for managing ARIA attributes
|
|
17
|
+
- **Dev Warnings** — Catch accessibility issues during development
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
### Focus Trap
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { createFocusTrap } from '@compa11y/core';
|
|
25
|
+
|
|
26
|
+
const dialog = document.getElementById('dialog');
|
|
27
|
+
const trap = createFocusTrap(dialog, {
|
|
28
|
+
escapeDeactivates: true,
|
|
29
|
+
returnFocus: true,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Activate when dialog opens
|
|
33
|
+
trap.activate();
|
|
34
|
+
|
|
35
|
+
// Deactivate when dialog closes
|
|
36
|
+
trap.deactivate();
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Announcements
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { announce, announcePolite, announceAssertive } from '@compa11y/core';
|
|
43
|
+
|
|
44
|
+
// Polite announcement (doesn't interrupt)
|
|
45
|
+
announcePolite('Item added to cart');
|
|
46
|
+
|
|
47
|
+
// Assertive announcement (interrupts current speech)
|
|
48
|
+
announceAssertive('Error: Form submission failed');
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Keyboard Navigation
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { createKeyboardManager, KeyboardPatterns } from '@compa11y/core';
|
|
55
|
+
|
|
56
|
+
const manager = createKeyboardManager(
|
|
57
|
+
KeyboardPatterns.menu({
|
|
58
|
+
onUp: () => focusPreviousItem(),
|
|
59
|
+
onDown: () => focusNextItem(),
|
|
60
|
+
onEnter: () => selectItem(),
|
|
61
|
+
onEscape: () => closeMenu(),
|
|
62
|
+
})
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
manager.attach(menuElement);
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### ARIA Utilities
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
import { aria, buildAriaProps, hasAccessibleName } from '@compa11y/core';
|
|
72
|
+
|
|
73
|
+
// Set individual ARIA attributes
|
|
74
|
+
aria.setExpanded(button, true);
|
|
75
|
+
aria.setControls(button, 'menu-id');
|
|
76
|
+
|
|
77
|
+
// Build props object for React/frameworks
|
|
78
|
+
const props = buildAriaProps({
|
|
79
|
+
expanded: true,
|
|
80
|
+
controls: 'menu-id',
|
|
81
|
+
hasPopup: 'menu',
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// Check accessibility
|
|
85
|
+
if (!hasAccessibleName(element)) {
|
|
86
|
+
console.warn('Element needs an accessible name');
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Dev Warnings
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
import { checks, createComponentWarnings } from '@compa11y/core';
|
|
94
|
+
|
|
95
|
+
// Use pre-built checks
|
|
96
|
+
checks.accessibleLabel(element, 'MyComponent');
|
|
97
|
+
|
|
98
|
+
// Create component-scoped warnings
|
|
99
|
+
const warnings = createComponentWarnings('MyComponent');
|
|
100
|
+
warnings.error('Missing required prop', 'Add the "label" prop');
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## API Reference
|
|
104
|
+
|
|
105
|
+
### Focus
|
|
106
|
+
|
|
107
|
+
- `createFocusTrap(container, options)` — Create a focus trap
|
|
108
|
+
- `createFocusScope(container, options)` — Manage focus within a scope
|
|
109
|
+
- `createRovingTabindex(container, selector, options)` — Roving tabindex pattern
|
|
110
|
+
- `initFocusVisible()` — Initialize focus-visible detection
|
|
111
|
+
|
|
112
|
+
### Announcer
|
|
113
|
+
|
|
114
|
+
- `initAnnouncer()` — Initialize live regions
|
|
115
|
+
- `announce(message, options)` — General announcement
|
|
116
|
+
- `announcePolite(message)` — Non-interrupting announcement
|
|
117
|
+
- `announceAssertive(message)` — Interrupting announcement
|
|
118
|
+
- `createAnnouncer(defaults)` — Create scoped announcer
|
|
119
|
+
|
|
120
|
+
### Keyboard
|
|
121
|
+
|
|
122
|
+
- `createKeyboardManager(handlers, options)` — Keyboard event handling
|
|
123
|
+
- `KeyboardPatterns.menu(handlers)` — Menu navigation pattern
|
|
124
|
+
- `KeyboardPatterns.tabs(handlers)` — Tabs navigation pattern
|
|
125
|
+
- `KeyboardPatterns.grid(handlers)` — Grid navigation pattern
|
|
126
|
+
- `createTypeAhead(items, options)` — Type-ahead search
|
|
127
|
+
|
|
128
|
+
### ARIA
|
|
129
|
+
|
|
130
|
+
- `aria.*` — ARIA attribute setters
|
|
131
|
+
- `buildAriaProps(props)` — Build props object
|
|
132
|
+
- `hasAccessibleName(element)` — Check for accessible name
|
|
133
|
+
- `mergeAriaIds(...ids)` — Merge ARIA ID lists
|
|
134
|
+
|
|
135
|
+
### Dev
|
|
136
|
+
|
|
137
|
+
- `warn(warning)` — Issue a warning
|
|
138
|
+
- `checks.*` — Pre-built accessibility checks
|
|
139
|
+
- `createComponentWarnings(name)` — Create scoped warnings
|
|
140
|
+
|
|
141
|
+
### DOM Utilities
|
|
142
|
+
|
|
143
|
+
- `isFocusable(element)` — Check if focusable
|
|
144
|
+
- `isTabbable(element)` — Check if tabbable
|
|
145
|
+
- `getFocusableElements(container)` — Get all focusable elements
|
|
146
|
+
- `getTabbableElements(container)` — Get all tabbable elements
|
|
147
|
+
- `getFirstFocusable(container)` — Get first focusable
|
|
148
|
+
- `getLastFocusable(container)` — Get last focusable
|
|
149
|
+
|
|
150
|
+
### Platform
|
|
151
|
+
|
|
152
|
+
- `isBrowser()` — Check if in browser
|
|
153
|
+
- `isMac()` — Check if macOS
|
|
154
|
+
- `prefersReducedMotion()` — Check motion preference
|
|
155
|
+
- `prefersHighContrast()` — Check contrast preference
|
|
156
|
+
- `prefersDarkMode()` — Check color scheme preference
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
MIT
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkV6TZIZZ4_cjs = require('../chunk-V6TZIZZ4.cjs');
|
|
4
|
+
require('../chunk-XEGB27QF.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, "announce", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return chunkV6TZIZZ4_cjs.announce; }
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "announceAssertive", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return chunkV6TZIZZ4_cjs.announceAssertive; }
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "announceError", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return chunkV6TZIZZ4_cjs.announceError; }
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "announcePolite", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return chunkV6TZIZZ4_cjs.announcePolite; }
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "announceProgress", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () { return chunkV6TZIZZ4_cjs.announceProgress; }
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports, "announceStatus", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () { return chunkV6TZIZZ4_cjs.announceStatus; }
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports, "clearAnnouncements", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () { return chunkV6TZIZZ4_cjs.clearAnnouncements; }
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "createAnnouncer", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () { return chunkV6TZIZZ4_cjs.createAnnouncer; }
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(exports, "initAnnouncer", {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function () { return chunkV6TZIZZ4_cjs.initAnnouncer; }
|
|
43
|
+
});
|
|
44
|
+
Object.defineProperty(exports, "queueAnnouncement", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () { return chunkV6TZIZZ4_cjs.queueAnnouncement; }
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=index.cjs.map
|
|
49
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { A as AnnouncerOptions } from '../types-DDSPmE8m.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Live Announcer
|
|
5
|
+
*
|
|
6
|
+
* Provides screen reader announcements via ARIA live regions
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Initialize the live announcer
|
|
11
|
+
* Call this once at app startup
|
|
12
|
+
*/
|
|
13
|
+
declare function initAnnouncer(): () => void;
|
|
14
|
+
/**
|
|
15
|
+
* Announce a message to screen readers
|
|
16
|
+
*/
|
|
17
|
+
declare function announce(message: string, options?: AnnouncerOptions): void;
|
|
18
|
+
/**
|
|
19
|
+
* Announce a polite message (non-interruptive)
|
|
20
|
+
*/
|
|
21
|
+
declare function announcePolite(message: string, options?: Omit<AnnouncerOptions, 'politeness'>): void;
|
|
22
|
+
/**
|
|
23
|
+
* Announce an assertive message (interruptive)
|
|
24
|
+
*/
|
|
25
|
+
declare function announceAssertive(message: string, options?: Omit<AnnouncerOptions, 'politeness'>): void;
|
|
26
|
+
/**
|
|
27
|
+
* Clear all announcements
|
|
28
|
+
*/
|
|
29
|
+
declare function clearAnnouncements(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Queue multiple announcements (debounced)
|
|
32
|
+
*/
|
|
33
|
+
declare function queueAnnouncement(message: string, options?: AnnouncerOptions & {
|
|
34
|
+
debounce?: number;
|
|
35
|
+
}): void;
|
|
36
|
+
/**
|
|
37
|
+
* Create an announcer instance for a specific context
|
|
38
|
+
*/
|
|
39
|
+
declare function createAnnouncer(defaultOptions?: AnnouncerOptions): {
|
|
40
|
+
announce: (message: string, options?: AnnouncerOptions) => void;
|
|
41
|
+
polite: (message: string, options?: Omit<AnnouncerOptions, "politeness">) => void;
|
|
42
|
+
assertive: (message: string, options?: Omit<AnnouncerOptions, "politeness">) => void;
|
|
43
|
+
queue: (message: string, options?: AnnouncerOptions & {
|
|
44
|
+
debounce?: number;
|
|
45
|
+
}) => void;
|
|
46
|
+
clear: typeof clearAnnouncements;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Status announcer - for status updates like "Saved", "Loading complete"
|
|
50
|
+
*/
|
|
51
|
+
declare function announceStatus(message: string): void;
|
|
52
|
+
/**
|
|
53
|
+
* Error announcer - for error messages
|
|
54
|
+
*/
|
|
55
|
+
declare function announceError(message: string): void;
|
|
56
|
+
/**
|
|
57
|
+
* Progress announcer - for progress updates
|
|
58
|
+
*/
|
|
59
|
+
declare function announceProgress(current: number, total: number, template?: string): void;
|
|
60
|
+
|
|
61
|
+
export { announce, announceAssertive, announceError, announcePolite, announceProgress, announceStatus, clearAnnouncements, createAnnouncer, initAnnouncer, queueAnnouncement };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { A as AnnouncerOptions } from '../types-DDSPmE8m.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Live Announcer
|
|
5
|
+
*
|
|
6
|
+
* Provides screen reader announcements via ARIA live regions
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Initialize the live announcer
|
|
11
|
+
* Call this once at app startup
|
|
12
|
+
*/
|
|
13
|
+
declare function initAnnouncer(): () => void;
|
|
14
|
+
/**
|
|
15
|
+
* Announce a message to screen readers
|
|
16
|
+
*/
|
|
17
|
+
declare function announce(message: string, options?: AnnouncerOptions): void;
|
|
18
|
+
/**
|
|
19
|
+
* Announce a polite message (non-interruptive)
|
|
20
|
+
*/
|
|
21
|
+
declare function announcePolite(message: string, options?: Omit<AnnouncerOptions, 'politeness'>): void;
|
|
22
|
+
/**
|
|
23
|
+
* Announce an assertive message (interruptive)
|
|
24
|
+
*/
|
|
25
|
+
declare function announceAssertive(message: string, options?: Omit<AnnouncerOptions, 'politeness'>): void;
|
|
26
|
+
/**
|
|
27
|
+
* Clear all announcements
|
|
28
|
+
*/
|
|
29
|
+
declare function clearAnnouncements(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Queue multiple announcements (debounced)
|
|
32
|
+
*/
|
|
33
|
+
declare function queueAnnouncement(message: string, options?: AnnouncerOptions & {
|
|
34
|
+
debounce?: number;
|
|
35
|
+
}): void;
|
|
36
|
+
/**
|
|
37
|
+
* Create an announcer instance for a specific context
|
|
38
|
+
*/
|
|
39
|
+
declare function createAnnouncer(defaultOptions?: AnnouncerOptions): {
|
|
40
|
+
announce: (message: string, options?: AnnouncerOptions) => void;
|
|
41
|
+
polite: (message: string, options?: Omit<AnnouncerOptions, "politeness">) => void;
|
|
42
|
+
assertive: (message: string, options?: Omit<AnnouncerOptions, "politeness">) => void;
|
|
43
|
+
queue: (message: string, options?: AnnouncerOptions & {
|
|
44
|
+
debounce?: number;
|
|
45
|
+
}) => void;
|
|
46
|
+
clear: typeof clearAnnouncements;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Status announcer - for status updates like "Saved", "Loading complete"
|
|
50
|
+
*/
|
|
51
|
+
declare function announceStatus(message: string): void;
|
|
52
|
+
/**
|
|
53
|
+
* Error announcer - for error messages
|
|
54
|
+
*/
|
|
55
|
+
declare function announceError(message: string): void;
|
|
56
|
+
/**
|
|
57
|
+
* Progress announcer - for progress updates
|
|
58
|
+
*/
|
|
59
|
+
declare function announceProgress(current: number, total: number, template?: string): void;
|
|
60
|
+
|
|
61
|
+
export { announce, announceAssertive, announceError, announcePolite, announceProgress, announceStatus, clearAnnouncements, createAnnouncer, initAnnouncer, queueAnnouncement };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { announce, announceAssertive, announceError, announcePolite, announceProgress, announceStatus, clearAnnouncements, createAnnouncer, initAnnouncer, queueAnnouncement } from '../chunk-2CQOLVQH.js';
|
|
2
|
+
import '../chunk-Z7K2G6FX.js';
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkNBGFFCIJ_cjs = require('../chunk-NBGFFCIJ.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "aria", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkNBGFFCIJ_cjs.aria; }
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(exports, "buildAriaProps", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunkNBGFFCIJ_cjs.buildAriaProps; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "hasAccessibleName", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunkNBGFFCIJ_cjs.hasAccessibleName; }
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "mergeAriaIds", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return chunkNBGFFCIJ_cjs.mergeAriaIds; }
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=index.cjs.map
|
|
24
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { c as AriaRole } from '../types-DDSPmE8m.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ARIA Utilities
|
|
5
|
+
*
|
|
6
|
+
* Helpers for managing ARIA attributes and relationships
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* ARIA attribute helpers
|
|
11
|
+
*/
|
|
12
|
+
declare const aria: {
|
|
13
|
+
/**
|
|
14
|
+
* Set aria-hidden on an element
|
|
15
|
+
*/
|
|
16
|
+
hide(element: HTMLElement): void;
|
|
17
|
+
/**
|
|
18
|
+
* Remove aria-hidden from an element
|
|
19
|
+
*/
|
|
20
|
+
show(element: HTMLElement): void;
|
|
21
|
+
/**
|
|
22
|
+
* Set aria-expanded state
|
|
23
|
+
*/
|
|
24
|
+
setExpanded(element: HTMLElement, expanded: boolean): void;
|
|
25
|
+
/**
|
|
26
|
+
* Set aria-selected state
|
|
27
|
+
*/
|
|
28
|
+
setSelected(element: HTMLElement, selected: boolean): void;
|
|
29
|
+
/**
|
|
30
|
+
* Set aria-checked state
|
|
31
|
+
*/
|
|
32
|
+
setChecked(element: HTMLElement, checked: boolean | "mixed"): void;
|
|
33
|
+
/**
|
|
34
|
+
* Set aria-pressed state
|
|
35
|
+
*/
|
|
36
|
+
setPressed(element: HTMLElement, pressed: boolean | "mixed"): void;
|
|
37
|
+
/**
|
|
38
|
+
* Set aria-disabled state
|
|
39
|
+
*/
|
|
40
|
+
setDisabled(element: HTMLElement, disabled: boolean): void;
|
|
41
|
+
/**
|
|
42
|
+
* Set aria-busy state
|
|
43
|
+
*/
|
|
44
|
+
setBusy(element: HTMLElement, busy: boolean): void;
|
|
45
|
+
/**
|
|
46
|
+
* Set aria-current
|
|
47
|
+
*/
|
|
48
|
+
setCurrent(element: HTMLElement, value: "page" | "step" | "location" | "date" | "time" | "true" | "false"): void;
|
|
49
|
+
/**
|
|
50
|
+
* Set aria-invalid state
|
|
51
|
+
*/
|
|
52
|
+
setInvalid(element: HTMLElement, invalid: boolean | "grammar" | "spelling"): void;
|
|
53
|
+
/**
|
|
54
|
+
* Set aria-label
|
|
55
|
+
*/
|
|
56
|
+
setLabel(element: HTMLElement, label: string): void;
|
|
57
|
+
/**
|
|
58
|
+
* Set aria-labelledby
|
|
59
|
+
*/
|
|
60
|
+
setLabelledBy(element: HTMLElement, ...ids: string[]): void;
|
|
61
|
+
/**
|
|
62
|
+
* Set aria-describedby
|
|
63
|
+
*/
|
|
64
|
+
setDescribedBy(element: HTMLElement, ...ids: string[]): void;
|
|
65
|
+
/**
|
|
66
|
+
* Set aria-controls
|
|
67
|
+
*/
|
|
68
|
+
setControls(element: HTMLElement, ...ids: string[]): void;
|
|
69
|
+
/**
|
|
70
|
+
* Set aria-owns
|
|
71
|
+
*/
|
|
72
|
+
setOwns(element: HTMLElement, ...ids: string[]): void;
|
|
73
|
+
/**
|
|
74
|
+
* Set aria-activedescendant
|
|
75
|
+
*/
|
|
76
|
+
setActiveDescendant(element: HTMLElement, id: string | null): void;
|
|
77
|
+
/**
|
|
78
|
+
* Set aria-haspopup
|
|
79
|
+
*/
|
|
80
|
+
setHasPopup(element: HTMLElement, popup: "menu" | "listbox" | "tree" | "grid" | "dialog" | boolean): void;
|
|
81
|
+
/**
|
|
82
|
+
* Set aria-level
|
|
83
|
+
*/
|
|
84
|
+
setLevel(element: HTMLElement, level: number): void;
|
|
85
|
+
/**
|
|
86
|
+
* Set aria-posinset and aria-setsize
|
|
87
|
+
*/
|
|
88
|
+
setPosition(element: HTMLElement, position: number, setSize: number): void;
|
|
89
|
+
/**
|
|
90
|
+
* Set aria-valuemin, aria-valuemax, aria-valuenow
|
|
91
|
+
*/
|
|
92
|
+
setValue(element: HTMLElement, options: {
|
|
93
|
+
min?: number;
|
|
94
|
+
max?: number;
|
|
95
|
+
now?: number;
|
|
96
|
+
text?: string;
|
|
97
|
+
}): void;
|
|
98
|
+
/**
|
|
99
|
+
* Set role attribute
|
|
100
|
+
*/
|
|
101
|
+
setRole(element: HTMLElement, role: AriaRole | null): void;
|
|
102
|
+
/**
|
|
103
|
+
* Set aria-modal
|
|
104
|
+
*/
|
|
105
|
+
setModal(element: HTMLElement, modal: boolean): void;
|
|
106
|
+
/**
|
|
107
|
+
* Set aria-orientation
|
|
108
|
+
*/
|
|
109
|
+
setOrientation(element: HTMLElement, orientation: "horizontal" | "vertical"): void;
|
|
110
|
+
/**
|
|
111
|
+
* Set aria-required
|
|
112
|
+
*/
|
|
113
|
+
setRequired(element: HTMLElement, required: boolean): void;
|
|
114
|
+
/**
|
|
115
|
+
* Set aria-readonly
|
|
116
|
+
*/
|
|
117
|
+
setReadOnly(element: HTMLElement, readOnly: boolean): void;
|
|
118
|
+
/**
|
|
119
|
+
* Set aria-autocomplete
|
|
120
|
+
*/
|
|
121
|
+
setAutocomplete(element: HTMLElement, value: "none" | "inline" | "list" | "both"): void;
|
|
122
|
+
/**
|
|
123
|
+
* Set aria-multiselectable
|
|
124
|
+
*/
|
|
125
|
+
setMultiSelectable(element: HTMLElement, multiselectable: boolean): void;
|
|
126
|
+
/**
|
|
127
|
+
* Set aria-sort
|
|
128
|
+
*/
|
|
129
|
+
setSort(element: HTMLElement, sort: "none" | "ascending" | "descending" | "other"): void;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Build ARIA props object for React/JS usage
|
|
133
|
+
*/
|
|
134
|
+
declare function buildAriaProps(props: {
|
|
135
|
+
label?: string;
|
|
136
|
+
labelledBy?: string | string[];
|
|
137
|
+
describedBy?: string | string[];
|
|
138
|
+
controls?: string | string[];
|
|
139
|
+
owns?: string | string[];
|
|
140
|
+
expanded?: boolean;
|
|
141
|
+
selected?: boolean;
|
|
142
|
+
checked?: boolean | 'mixed';
|
|
143
|
+
pressed?: boolean | 'mixed';
|
|
144
|
+
disabled?: boolean;
|
|
145
|
+
hidden?: boolean;
|
|
146
|
+
modal?: boolean;
|
|
147
|
+
busy?: boolean;
|
|
148
|
+
current?: 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false';
|
|
149
|
+
invalid?: boolean | 'grammar' | 'spelling';
|
|
150
|
+
hasPopup?: 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog' | boolean;
|
|
151
|
+
activeDescendant?: string;
|
|
152
|
+
level?: number;
|
|
153
|
+
posInSet?: number;
|
|
154
|
+
setSize?: number;
|
|
155
|
+
valueMin?: number;
|
|
156
|
+
valueMax?: number;
|
|
157
|
+
valueNow?: number;
|
|
158
|
+
valueText?: string;
|
|
159
|
+
orientation?: 'horizontal' | 'vertical';
|
|
160
|
+
required?: boolean;
|
|
161
|
+
readOnly?: boolean;
|
|
162
|
+
autocomplete?: 'none' | 'inline' | 'list' | 'both';
|
|
163
|
+
multiSelectable?: boolean;
|
|
164
|
+
sort?: 'none' | 'ascending' | 'descending' | 'other';
|
|
165
|
+
role?: AriaRole;
|
|
166
|
+
}): Record<string, string | undefined>;
|
|
167
|
+
/**
|
|
168
|
+
* Merge multiple aria-labelledby or aria-describedby values
|
|
169
|
+
*/
|
|
170
|
+
declare function mergeAriaIds(...ids: (string | undefined | null)[]): string | undefined;
|
|
171
|
+
/**
|
|
172
|
+
* Check if an element has an accessible name
|
|
173
|
+
*/
|
|
174
|
+
declare function hasAccessibleName(element: HTMLElement): boolean;
|
|
175
|
+
|
|
176
|
+
export { aria, buildAriaProps, hasAccessibleName, mergeAriaIds };
|