@a11y-core/core 0.1.0-alpha.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/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-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-NPIQ53MH.js +147 -0
- package/dist/chunk-NPIQ53MH.js.map +1 -0
- package/dist/chunk-UFCK24OY.cjs +158 -0
- package/dist/chunk-UFCK24OY.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-B_JDMBSp.d.cts +52 -0
- package/dist/types-B_JDMBSp.d.ts +52 -0
- package/package.json +68 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { c as AriaRole } from '../types-B_JDMBSp.js';
|
|
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 };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
// src/aria/aria-utils.ts
|
|
2
|
+
var aria = {
|
|
3
|
+
/**
|
|
4
|
+
* Set aria-hidden on an element
|
|
5
|
+
*/
|
|
6
|
+
hide(element) {
|
|
7
|
+
element.setAttribute("aria-hidden", "true");
|
|
8
|
+
},
|
|
9
|
+
/**
|
|
10
|
+
* Remove aria-hidden from an element
|
|
11
|
+
*/
|
|
12
|
+
show(element) {
|
|
13
|
+
element.removeAttribute("aria-hidden");
|
|
14
|
+
},
|
|
15
|
+
/**
|
|
16
|
+
* Set aria-expanded state
|
|
17
|
+
*/
|
|
18
|
+
setExpanded(element, expanded) {
|
|
19
|
+
element.setAttribute("aria-expanded", String(expanded));
|
|
20
|
+
},
|
|
21
|
+
/**
|
|
22
|
+
* Set aria-selected state
|
|
23
|
+
*/
|
|
24
|
+
setSelected(element, selected) {
|
|
25
|
+
element.setAttribute("aria-selected", String(selected));
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* Set aria-checked state
|
|
29
|
+
*/
|
|
30
|
+
setChecked(element, checked) {
|
|
31
|
+
element.setAttribute("aria-checked", String(checked));
|
|
32
|
+
},
|
|
33
|
+
/**
|
|
34
|
+
* Set aria-pressed state
|
|
35
|
+
*/
|
|
36
|
+
setPressed(element, pressed) {
|
|
37
|
+
element.setAttribute("aria-pressed", String(pressed));
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* Set aria-disabled state
|
|
41
|
+
*/
|
|
42
|
+
setDisabled(element, disabled) {
|
|
43
|
+
element.setAttribute("aria-disabled", String(disabled));
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* Set aria-busy state
|
|
47
|
+
*/
|
|
48
|
+
setBusy(element, busy) {
|
|
49
|
+
element.setAttribute("aria-busy", String(busy));
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* Set aria-current
|
|
53
|
+
*/
|
|
54
|
+
setCurrent(element, value) {
|
|
55
|
+
if (value === "false") {
|
|
56
|
+
element.removeAttribute("aria-current");
|
|
57
|
+
} else {
|
|
58
|
+
element.setAttribute("aria-current", value);
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
/**
|
|
62
|
+
* Set aria-invalid state
|
|
63
|
+
*/
|
|
64
|
+
setInvalid(element, invalid) {
|
|
65
|
+
if (invalid === false) {
|
|
66
|
+
element.removeAttribute("aria-invalid");
|
|
67
|
+
} else {
|
|
68
|
+
element.setAttribute("aria-invalid", String(invalid));
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
/**
|
|
72
|
+
* Set aria-label
|
|
73
|
+
*/
|
|
74
|
+
setLabel(element, label) {
|
|
75
|
+
if (label) {
|
|
76
|
+
element.setAttribute("aria-label", label);
|
|
77
|
+
} else {
|
|
78
|
+
element.removeAttribute("aria-label");
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
/**
|
|
82
|
+
* Set aria-labelledby
|
|
83
|
+
*/
|
|
84
|
+
setLabelledBy(element, ...ids) {
|
|
85
|
+
const value = ids.filter(Boolean).join(" ");
|
|
86
|
+
if (value) {
|
|
87
|
+
element.setAttribute("aria-labelledby", value);
|
|
88
|
+
} else {
|
|
89
|
+
element.removeAttribute("aria-labelledby");
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
/**
|
|
93
|
+
* Set aria-describedby
|
|
94
|
+
*/
|
|
95
|
+
setDescribedBy(element, ...ids) {
|
|
96
|
+
const value = ids.filter(Boolean).join(" ");
|
|
97
|
+
if (value) {
|
|
98
|
+
element.setAttribute("aria-describedby", value);
|
|
99
|
+
} else {
|
|
100
|
+
element.removeAttribute("aria-describedby");
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
/**
|
|
104
|
+
* Set aria-controls
|
|
105
|
+
*/
|
|
106
|
+
setControls(element, ...ids) {
|
|
107
|
+
const value = ids.filter(Boolean).join(" ");
|
|
108
|
+
if (value) {
|
|
109
|
+
element.setAttribute("aria-controls", value);
|
|
110
|
+
} else {
|
|
111
|
+
element.removeAttribute("aria-controls");
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
/**
|
|
115
|
+
* Set aria-owns
|
|
116
|
+
*/
|
|
117
|
+
setOwns(element, ...ids) {
|
|
118
|
+
const value = ids.filter(Boolean).join(" ");
|
|
119
|
+
if (value) {
|
|
120
|
+
element.setAttribute("aria-owns", value);
|
|
121
|
+
} else {
|
|
122
|
+
element.removeAttribute("aria-owns");
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
/**
|
|
126
|
+
* Set aria-activedescendant
|
|
127
|
+
*/
|
|
128
|
+
setActiveDescendant(element, id) {
|
|
129
|
+
if (id) {
|
|
130
|
+
element.setAttribute("aria-activedescendant", id);
|
|
131
|
+
} else {
|
|
132
|
+
element.removeAttribute("aria-activedescendant");
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
/**
|
|
136
|
+
* Set aria-haspopup
|
|
137
|
+
*/
|
|
138
|
+
setHasPopup(element, popup) {
|
|
139
|
+
if (popup === false) {
|
|
140
|
+
element.removeAttribute("aria-haspopup");
|
|
141
|
+
} else {
|
|
142
|
+
element.setAttribute("aria-haspopup", String(popup));
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
/**
|
|
146
|
+
* Set aria-level
|
|
147
|
+
*/
|
|
148
|
+
setLevel(element, level) {
|
|
149
|
+
element.setAttribute("aria-level", String(level));
|
|
150
|
+
},
|
|
151
|
+
/**
|
|
152
|
+
* Set aria-posinset and aria-setsize
|
|
153
|
+
*/
|
|
154
|
+
setPosition(element, position, setSize) {
|
|
155
|
+
element.setAttribute("aria-posinset", String(position));
|
|
156
|
+
element.setAttribute("aria-setsize", String(setSize));
|
|
157
|
+
},
|
|
158
|
+
/**
|
|
159
|
+
* Set aria-valuemin, aria-valuemax, aria-valuenow
|
|
160
|
+
*/
|
|
161
|
+
setValue(element, options) {
|
|
162
|
+
if (options.min !== void 0) {
|
|
163
|
+
element.setAttribute("aria-valuemin", String(options.min));
|
|
164
|
+
}
|
|
165
|
+
if (options.max !== void 0) {
|
|
166
|
+
element.setAttribute("aria-valuemax", String(options.max));
|
|
167
|
+
}
|
|
168
|
+
if (options.now !== void 0) {
|
|
169
|
+
element.setAttribute("aria-valuenow", String(options.now));
|
|
170
|
+
}
|
|
171
|
+
if (options.text !== void 0) {
|
|
172
|
+
element.setAttribute("aria-valuetext", options.text);
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
/**
|
|
176
|
+
* Set role attribute
|
|
177
|
+
*/
|
|
178
|
+
setRole(element, role) {
|
|
179
|
+
if (role) {
|
|
180
|
+
element.setAttribute("role", role);
|
|
181
|
+
} else {
|
|
182
|
+
element.removeAttribute("role");
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
/**
|
|
186
|
+
* Set aria-modal
|
|
187
|
+
*/
|
|
188
|
+
setModal(element, modal) {
|
|
189
|
+
if (modal) {
|
|
190
|
+
element.setAttribute("aria-modal", "true");
|
|
191
|
+
} else {
|
|
192
|
+
element.removeAttribute("aria-modal");
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
/**
|
|
196
|
+
* Set aria-orientation
|
|
197
|
+
*/
|
|
198
|
+
setOrientation(element, orientation) {
|
|
199
|
+
element.setAttribute("aria-orientation", orientation);
|
|
200
|
+
},
|
|
201
|
+
/**
|
|
202
|
+
* Set aria-required
|
|
203
|
+
*/
|
|
204
|
+
setRequired(element, required) {
|
|
205
|
+
element.setAttribute("aria-required", String(required));
|
|
206
|
+
},
|
|
207
|
+
/**
|
|
208
|
+
* Set aria-readonly
|
|
209
|
+
*/
|
|
210
|
+
setReadOnly(element, readOnly) {
|
|
211
|
+
element.setAttribute("aria-readonly", String(readOnly));
|
|
212
|
+
},
|
|
213
|
+
/**
|
|
214
|
+
* Set aria-autocomplete
|
|
215
|
+
*/
|
|
216
|
+
setAutocomplete(element, value) {
|
|
217
|
+
element.setAttribute("aria-autocomplete", value);
|
|
218
|
+
},
|
|
219
|
+
/**
|
|
220
|
+
* Set aria-multiselectable
|
|
221
|
+
*/
|
|
222
|
+
setMultiSelectable(element, multiselectable) {
|
|
223
|
+
element.setAttribute("aria-multiselectable", String(multiselectable));
|
|
224
|
+
},
|
|
225
|
+
/**
|
|
226
|
+
* Set aria-sort
|
|
227
|
+
*/
|
|
228
|
+
setSort(element, sort) {
|
|
229
|
+
element.setAttribute("aria-sort", sort);
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
function buildAriaProps(props) {
|
|
233
|
+
const result = {};
|
|
234
|
+
if (props.label) result["aria-label"] = props.label;
|
|
235
|
+
if (props.labelledBy) {
|
|
236
|
+
result["aria-labelledby"] = Array.isArray(props.labelledBy) ? props.labelledBy.join(" ") : props.labelledBy;
|
|
237
|
+
}
|
|
238
|
+
if (props.describedBy) {
|
|
239
|
+
result["aria-describedby"] = Array.isArray(props.describedBy) ? props.describedBy.join(" ") : props.describedBy;
|
|
240
|
+
}
|
|
241
|
+
if (props.controls) {
|
|
242
|
+
result["aria-controls"] = Array.isArray(props.controls) ? props.controls.join(" ") : props.controls;
|
|
243
|
+
}
|
|
244
|
+
if (props.owns) {
|
|
245
|
+
result["aria-owns"] = Array.isArray(props.owns) ? props.owns.join(" ") : props.owns;
|
|
246
|
+
}
|
|
247
|
+
if (props.expanded !== void 0) result["aria-expanded"] = String(props.expanded);
|
|
248
|
+
if (props.selected !== void 0) result["aria-selected"] = String(props.selected);
|
|
249
|
+
if (props.checked !== void 0) result["aria-checked"] = String(props.checked);
|
|
250
|
+
if (props.pressed !== void 0) result["aria-pressed"] = String(props.pressed);
|
|
251
|
+
if (props.disabled !== void 0) result["aria-disabled"] = String(props.disabled);
|
|
252
|
+
if (props.hidden !== void 0) result["aria-hidden"] = String(props.hidden);
|
|
253
|
+
if (props.modal !== void 0) result["aria-modal"] = String(props.modal);
|
|
254
|
+
if (props.busy !== void 0) result["aria-busy"] = String(props.busy);
|
|
255
|
+
if (props.current) result["aria-current"] = props.current;
|
|
256
|
+
if (props.invalid !== void 0) result["aria-invalid"] = String(props.invalid);
|
|
257
|
+
if (props.hasPopup !== void 0) result["aria-haspopup"] = String(props.hasPopup);
|
|
258
|
+
if (props.activeDescendant) result["aria-activedescendant"] = props.activeDescendant;
|
|
259
|
+
if (props.level !== void 0) result["aria-level"] = String(props.level);
|
|
260
|
+
if (props.posInSet !== void 0) result["aria-posinset"] = String(props.posInSet);
|
|
261
|
+
if (props.setSize !== void 0) result["aria-setsize"] = String(props.setSize);
|
|
262
|
+
if (props.valueMin !== void 0) result["aria-valuemin"] = String(props.valueMin);
|
|
263
|
+
if (props.valueMax !== void 0) result["aria-valuemax"] = String(props.valueMax);
|
|
264
|
+
if (props.valueNow !== void 0) result["aria-valuenow"] = String(props.valueNow);
|
|
265
|
+
if (props.valueText) result["aria-valuetext"] = props.valueText;
|
|
266
|
+
if (props.orientation) result["aria-orientation"] = props.orientation;
|
|
267
|
+
if (props.required !== void 0) result["aria-required"] = String(props.required);
|
|
268
|
+
if (props.readOnly !== void 0) result["aria-readonly"] = String(props.readOnly);
|
|
269
|
+
if (props.autocomplete) result["aria-autocomplete"] = props.autocomplete;
|
|
270
|
+
if (props.multiSelectable !== void 0) result["aria-multiselectable"] = String(props.multiSelectable);
|
|
271
|
+
if (props.sort) result["aria-sort"] = props.sort;
|
|
272
|
+
if (props.role) result.role = props.role;
|
|
273
|
+
return result;
|
|
274
|
+
}
|
|
275
|
+
function mergeAriaIds(...ids) {
|
|
276
|
+
const filtered = ids.filter(Boolean);
|
|
277
|
+
return filtered.length > 0 ? filtered.join(" ") : void 0;
|
|
278
|
+
}
|
|
279
|
+
function hasAccessibleName(element) {
|
|
280
|
+
if (element.getAttribute("aria-label")) {
|
|
281
|
+
return true;
|
|
282
|
+
}
|
|
283
|
+
const labelledBy = element.getAttribute("aria-labelledby");
|
|
284
|
+
if (labelledBy) {
|
|
285
|
+
const ids = labelledBy.split(" ");
|
|
286
|
+
const hasLabelContent = ids.some((id) => {
|
|
287
|
+
const labelElement = document.getElementById(id);
|
|
288
|
+
return labelElement && labelElement.textContent?.trim();
|
|
289
|
+
});
|
|
290
|
+
if (hasLabelContent) return true;
|
|
291
|
+
}
|
|
292
|
+
if (element.textContent?.trim()) {
|
|
293
|
+
return true;
|
|
294
|
+
}
|
|
295
|
+
if (element.getAttribute("title")) {
|
|
296
|
+
return true;
|
|
297
|
+
}
|
|
298
|
+
if ("labels" in element && element.labels?.length) {
|
|
299
|
+
return true;
|
|
300
|
+
}
|
|
301
|
+
if (element.tagName === "IMG" && element.getAttribute("alt")) {
|
|
302
|
+
return true;
|
|
303
|
+
}
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export { aria, buildAriaProps, hasAccessibleName, mergeAriaIds };
|
|
308
|
+
//# sourceMappingURL=chunk-24U5HHMC.js.map
|
|
309
|
+
//# sourceMappingURL=chunk-24U5HHMC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/aria/aria-utils.ts"],"names":[],"mappings":";AAWO,IAAM,IAAA,GAAO;AAAA;AAAA;AAAA;AAAA,EAIlB,KAAK,OAAA,EAA4B;AAC/B,IAAA,OAAA,CAAQ,YAAA,CAAa,eAAe,MAAM,CAAA;AAAA,EAC5C,CAAA;AAAA;AAAA;AAAA;AAAA,EAKA,KAAK,OAAA,EAA4B;AAC/B,IAAA,OAAA,CAAQ,gBAAgB,aAAa,CAAA;AAAA,EACvC,CAAA;AAAA;AAAA;AAAA;AAAA,EAKA,WAAA,CAAY,SAAsB,QAAA,EAAyB;AACzD,IAAA,OAAA,CAAQ,YAAA,CAAa,eAAA,EAAiB,MAAA,CAAO,QAAQ,CAAC,CAAA;AAAA,EACxD,CAAA;AAAA;AAAA;AAAA;AAAA,EAKA,WAAA,CAAY,SAAsB,QAAA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OAAA,EAA+B;AAE/D,EAAA,IAAI,OAAA,CAAQ,YAAA,CAAa,YAAY,CAAA,EAAG;AACtC,IAAA,OAAO,IAAA;AAAA,EACT;AAGA,EAAA,MAAM,UAAA,GAAa,OAAA,CAAQ,YAAA,CAAa,iBAAiB,CAAA;AACzD,EAAA,IAAI,UAAA,EAAY;AACd,IAAA,MAAM,GAAA,GAAM,UAAA,CAAW,KAAA,CAAM,GAAG,CAAA;AAChC,IAAA,MAAM,eAAA,GAAkB,GAAA,CAAI,IAAA,CAAK,CAAC,EAAA,KAAO;AACvC,MAAA,MAAM,YAAA,GAAe,QAAA,CAAS,cAAA,CAAe,EAAE,CAAA;AAC/C,MAAA,OAAO,YAAA,IAAgB,YAAA,CAAa,WAAA,EAAa,IAAA,EAAK;AAAA,IACxD,CAAC,CAAA;AACD,IAAA,IAAI,iBAAiB,OAAO,IAAA;AAAA,EAC9B;AAGA,EAAA,IAAI,OAAA,CAAQ,WAAA,EAAa,IAAA,EAAK,EAAG;AAC/B,IAAA,OAAO,IAAA;AAAA,EACT;AAGA,EAAA,IAAI,OAAA,CAAQ,YAAA,CAAa,OAAO,CAAA,EAAG;AACjC,IAAA,OAAO,IAAA;AAAA,EACT;AAGA,EAAA,IAAI,QAAA,IAAY,OAAA,IAAY,OAAA,CAA6B,MAAA,EAAQ,MAAA,EAAQ;AACvE,IAAA,OAAO,IAAA;AAAA,EACT;AAGA,EAAA,IAAI,QAAQ,OAAA,KAAY,KAAA,IAAS,OAAA,CAAQ,YAAA,CAAa,KAAK,CAAA,EAAG;AAC5D,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,KAAA;AACT","file":"chunk-24U5HHMC.js","sourcesContent":["/**\n * ARIA Utilities\n *\n * Helpers for managing ARIA attributes and relationships\n */\n\nimport type { AriaRole } from '../types';\n\n/**\n * ARIA attribute helpers\n */\nexport const aria = {\n /**\n * Set aria-hidden on an element\n */\n hide(element: HTMLElement): void {\n element.setAttribute('aria-hidden', 'true');\n },\n\n /**\n * Remove aria-hidden from an element\n */\n show(element: HTMLElement): void {\n element.removeAttribute('aria-hidden');\n },\n\n /**\n * Set aria-expanded state\n */\n setExpanded(element: HTMLElement, expanded: boolean): void {\n element.setAttribute('aria-expanded', String(expanded));\n },\n\n /**\n * Set aria-selected state\n */\n setSelected(element: HTMLElement, selected: boolean): void {\n element.setAttribute('aria-selected', String(selected));\n },\n\n /**\n * Set aria-checked state\n */\n setChecked(element: HTMLElement, checked: boolean | 'mixed'): void {\n element.setAttribute('aria-checked', String(checked));\n },\n\n /**\n * Set aria-pressed state\n */\n setPressed(element: HTMLElement, pressed: boolean | 'mixed'): void {\n element.setAttribute('aria-pressed', String(pressed));\n },\n\n /**\n * Set aria-disabled state\n */\n setDisabled(element: HTMLElement, disabled: boolean): void {\n element.setAttribute('aria-disabled', String(disabled));\n },\n\n /**\n * Set aria-busy state\n */\n setBusy(element: HTMLElement, busy: boolean): void {\n element.setAttribute('aria-busy', String(busy));\n },\n\n /**\n * Set aria-current\n */\n setCurrent(\n element: HTMLElement,\n value: 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false'\n ): void {\n if (value === 'false') {\n element.removeAttribute('aria-current');\n } else {\n element.setAttribute('aria-current', value);\n }\n },\n\n /**\n * Set aria-invalid state\n */\n setInvalid(element: HTMLElement, invalid: boolean | 'grammar' | 'spelling'): void {\n if (invalid === false) {\n element.removeAttribute('aria-invalid');\n } else {\n element.setAttribute('aria-invalid', String(invalid));\n }\n },\n\n /**\n * Set aria-label\n */\n setLabel(element: HTMLElement, label: string): void {\n if (label) {\n element.setAttribute('aria-label', label);\n } else {\n element.removeAttribute('aria-label');\n }\n },\n\n /**\n * Set aria-labelledby\n */\n setLabelledBy(element: HTMLElement, ...ids: string[]): void {\n const value = ids.filter(Boolean).join(' ');\n if (value) {\n element.setAttribute('aria-labelledby', value);\n } else {\n element.removeAttribute('aria-labelledby');\n }\n },\n\n /**\n * Set aria-describedby\n */\n setDescribedBy(element: HTMLElement, ...ids: string[]): void {\n const value = ids.filter(Boolean).join(' ');\n if (value) {\n element.setAttribute('aria-describedby', value);\n } else {\n element.removeAttribute('aria-describedby');\n }\n },\n\n /**\n * Set aria-controls\n */\n setControls(element: HTMLElement, ...ids: string[]): void {\n const value = ids.filter(Boolean).join(' ');\n if (value) {\n element.setAttribute('aria-controls', value);\n } else {\n element.removeAttribute('aria-controls');\n }\n },\n\n /**\n * Set aria-owns\n */\n setOwns(element: HTMLElement, ...ids: string[]): void {\n const value = ids.filter(Boolean).join(' ');\n if (value) {\n element.setAttribute('aria-owns', value);\n } else {\n element.removeAttribute('aria-owns');\n }\n },\n\n /**\n * Set aria-activedescendant\n */\n setActiveDescendant(element: HTMLElement, id: string | null): void {\n if (id) {\n element.setAttribute('aria-activedescendant', id);\n } else {\n element.removeAttribute('aria-activedescendant');\n }\n },\n\n /**\n * Set aria-haspopup\n */\n setHasPopup(\n element: HTMLElement,\n popup: 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog' | boolean\n ): void {\n if (popup === false) {\n element.removeAttribute('aria-haspopup');\n } else {\n element.setAttribute('aria-haspopup', String(popup));\n }\n },\n\n /**\n * Set aria-level\n */\n setLevel(element: HTMLElement, level: number): void {\n element.setAttribute('aria-level', String(level));\n },\n\n /**\n * Set aria-posinset and aria-setsize\n */\n setPosition(element: HTMLElement, position: number, setSize: number): void {\n element.setAttribute('aria-posinset', String(position));\n element.setAttribute('aria-setsize', String(setSize));\n },\n\n /**\n * Set aria-valuemin, aria-valuemax, aria-valuenow\n */\n setValue(\n element: HTMLElement,\n options: {\n min?: number;\n max?: number;\n now?: number;\n text?: string;\n }\n ): void {\n if (options.min !== undefined) {\n element.setAttribute('aria-valuemin', String(options.min));\n }\n if (options.max !== undefined) {\n element.setAttribute('aria-valuemax', String(options.max));\n }\n if (options.now !== undefined) {\n element.setAttribute('aria-valuenow', String(options.now));\n }\n if (options.text !== undefined) {\n element.setAttribute('aria-valuetext', options.text);\n }\n },\n\n /**\n * Set role attribute\n */\n setRole(element: HTMLElement, role: AriaRole | null): void {\n if (role) {\n element.setAttribute('role', role);\n } else {\n element.removeAttribute('role');\n }\n },\n\n /**\n * Set aria-modal\n */\n setModal(element: HTMLElement, modal: boolean): void {\n if (modal) {\n element.setAttribute('aria-modal', 'true');\n } else {\n element.removeAttribute('aria-modal');\n }\n },\n\n /**\n * Set aria-orientation\n */\n setOrientation(element: HTMLElement, orientation: 'horizontal' | 'vertical'): void {\n element.setAttribute('aria-orientation', orientation);\n },\n\n /**\n * Set aria-required\n */\n setRequired(element: HTMLElement, required: boolean): void {\n element.setAttribute('aria-required', String(required));\n },\n\n /**\n * Set aria-readonly\n */\n setReadOnly(element: HTMLElement, readOnly: boolean): void {\n element.setAttribute('aria-readonly', String(readOnly));\n },\n\n /**\n * Set aria-autocomplete\n */\n setAutocomplete(element: HTMLElement, value: 'none' | 'inline' | 'list' | 'both'): void {\n element.setAttribute('aria-autocomplete', value);\n },\n\n /**\n * Set aria-multiselectable\n */\n setMultiSelectable(element: HTMLElement, multiselectable: boolean): void {\n element.setAttribute('aria-multiselectable', String(multiselectable));\n },\n\n /**\n * Set aria-sort\n */\n setSort(element: HTMLElement, sort: 'none' | 'ascending' | 'descending' | 'other'): void {\n element.setAttribute('aria-sort', sort);\n },\n};\n\n/**\n * Build ARIA props object for React/JS usage\n */\nexport function buildAriaProps(props: {\n label?: string;\n labelledBy?: string | string[];\n describedBy?: string | string[];\n controls?: string | string[];\n owns?: string | string[];\n expanded?: boolean;\n selected?: boolean;\n checked?: boolean | 'mixed';\n pressed?: boolean | 'mixed';\n disabled?: boolean;\n hidden?: boolean;\n modal?: boolean;\n busy?: boolean;\n current?: 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false';\n invalid?: boolean | 'grammar' | 'spelling';\n hasPopup?: 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog' | boolean;\n activeDescendant?: string;\n level?: number;\n posInSet?: number;\n setSize?: number;\n valueMin?: number;\n valueMax?: number;\n valueNow?: number;\n valueText?: string;\n orientation?: 'horizontal' | 'vertical';\n required?: boolean;\n readOnly?: boolean;\n autocomplete?: 'none' | 'inline' | 'list' | 'both';\n multiSelectable?: boolean;\n sort?: 'none' | 'ascending' | 'descending' | 'other';\n role?: AriaRole;\n}): Record<string, string | undefined> {\n const result: Record<string, string | undefined> = {};\n\n if (props.label) result['aria-label'] = props.label;\n if (props.labelledBy) {\n result['aria-labelledby'] = Array.isArray(props.labelledBy)\n ? props.labelledBy.join(' ')\n : props.labelledBy;\n }\n if (props.describedBy) {\n result['aria-describedby'] = Array.isArray(props.describedBy)\n ? props.describedBy.join(' ')\n : props.describedBy;\n }\n if (props.controls) {\n result['aria-controls'] = Array.isArray(props.controls)\n ? props.controls.join(' ')\n : props.controls;\n }\n if (props.owns) {\n result['aria-owns'] = Array.isArray(props.owns)\n ? props.owns.join(' ')\n : props.owns;\n }\n if (props.expanded !== undefined) result['aria-expanded'] = String(props.expanded);\n if (props.selected !== undefined) result['aria-selected'] = String(props.selected);\n if (props.checked !== undefined) result['aria-checked'] = String(props.checked);\n if (props.pressed !== undefined) result['aria-pressed'] = String(props.pressed);\n if (props.disabled !== undefined) result['aria-disabled'] = String(props.disabled);\n if (props.hidden !== undefined) result['aria-hidden'] = String(props.hidden);\n if (props.modal !== undefined) result['aria-modal'] = String(props.modal);\n if (props.busy !== undefined) result['aria-busy'] = String(props.busy);\n if (props.current) result['aria-current'] = props.current;\n if (props.invalid !== undefined) result['aria-invalid'] = String(props.invalid);\n if (props.hasPopup !== undefined) result['aria-haspopup'] = String(props.hasPopup);\n if (props.activeDescendant) result['aria-activedescendant'] = props.activeDescendant;\n if (props.level !== undefined) result['aria-level'] = String(props.level);\n if (props.posInSet !== undefined) result['aria-posinset'] = String(props.posInSet);\n if (props.setSize !== undefined) result['aria-setsize'] = String(props.setSize);\n if (props.valueMin !== undefined) result['aria-valuemin'] = String(props.valueMin);\n if (props.valueMax !== undefined) result['aria-valuemax'] = String(props.valueMax);\n if (props.valueNow !== undefined) result['aria-valuenow'] = String(props.valueNow);\n if (props.valueText) result['aria-valuetext'] = props.valueText;\n if (props.orientation) result['aria-orientation'] = props.orientation;\n if (props.required !== undefined) result['aria-required'] = String(props.required);\n if (props.readOnly !== undefined) result['aria-readonly'] = String(props.readOnly);\n if (props.autocomplete) result['aria-autocomplete'] = props.autocomplete;\n if (props.multiSelectable !== undefined) result['aria-multiselectable'] = String(props.multiSelectable);\n if (props.sort) result['aria-sort'] = props.sort;\n if (props.role) result.role = props.role;\n\n return result;\n}\n\n/**\n * Merge multiple aria-labelledby or aria-describedby values\n */\nexport function mergeAriaIds(...ids: (string | undefined | null)[]): string | undefined {\n const filtered = ids.filter(Boolean) as string[];\n return filtered.length > 0 ? filtered.join(' ') : undefined;\n}\n\n/**\n * Check if an element has an accessible name\n */\nexport function hasAccessibleName(element: HTMLElement): boolean {\n // Check aria-label\n if (element.getAttribute('aria-label')) {\n return true;\n }\n\n // Check aria-labelledby\n const labelledBy = element.getAttribute('aria-labelledby');\n if (labelledBy) {\n const ids = labelledBy.split(' ');\n const hasLabelContent = ids.some((id) => {\n const labelElement = document.getElementById(id);\n return labelElement && labelElement.textContent?.trim();\n });\n if (hasLabelContent) return true;\n }\n\n // Check text content (for buttons, links, etc.)\n if (element.textContent?.trim()) {\n return true;\n }\n\n // Check title attribute (fallback)\n if (element.getAttribute('title')) {\n return true;\n }\n\n // Check associated label (for form elements)\n if ('labels' in element && (element as HTMLInputElement).labels?.length) {\n return true;\n }\n\n // Check alt attribute (for images)\n if (element.tagName === 'IMG' && element.getAttribute('alt')) {\n return true;\n }\n\n return false;\n}\n"]}
|