aria-ease 4.0.0 → 5.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.
Files changed (36) hide show
  1. package/README.md +208 -90
  2. package/dist/index.cjs +12 -144
  3. package/dist/index.d.cts +1 -57
  4. package/dist/index.d.ts +1 -57
  5. package/dist/index.js +11 -139
  6. package/dist/src/{Types.d-BrHSyS03.d.cts → Types.d-COr5IFp5.d.cts} +1 -17
  7. package/dist/src/{Types.d-BrHSyS03.d.ts → Types.d-COr5IFp5.d.ts} +1 -17
  8. package/dist/src/accordion/index.cjs +0 -27
  9. package/dist/src/accordion/index.d.cts +2 -12
  10. package/dist/src/accordion/index.d.ts +2 -12
  11. package/dist/src/accordion/index.js +1 -27
  12. package/dist/src/block/index.d.cts +1 -1
  13. package/dist/src/block/index.d.ts +1 -1
  14. package/dist/src/checkbox/index.cjs +0 -32
  15. package/dist/src/checkbox/index.d.cts +2 -12
  16. package/dist/src/checkbox/index.d.ts +2 -12
  17. package/dist/src/checkbox/index.js +1 -32
  18. package/dist/src/combobox/index.cjs +1 -1
  19. package/dist/src/combobox/index.d.cts +1 -1
  20. package/dist/src/combobox/index.d.ts +1 -1
  21. package/dist/src/combobox/index.js +1 -1
  22. package/dist/src/menu/index.cjs +9 -18
  23. package/dist/src/menu/index.d.cts +1 -1
  24. package/dist/src/menu/index.d.ts +1 -1
  25. package/dist/src/menu/index.js +9 -18
  26. package/dist/src/radio/index.cjs +0 -31
  27. package/dist/src/radio/index.d.cts +2 -12
  28. package/dist/src/radio/index.d.ts +2 -12
  29. package/dist/src/radio/index.js +1 -31
  30. package/dist/src/toggle/index.cjs +0 -28
  31. package/dist/src/toggle/index.d.cts +2 -12
  32. package/dist/src/toggle/index.d.ts +2 -12
  33. package/dist/src/toggle/index.js +1 -28
  34. package/dist/src/utils/test/contracts/AccordionContract.json +55 -0
  35. package/dist/src/utils/test/contracts/MenuContract.json +1 -1
  36. package/package.json +1 -1
package/README.md CHANGED
@@ -156,136 +156,253 @@ menu.refresh();
156
156
 
157
157
  ### 🪗 Accordion
158
158
 
159
- Updates `aria-expanded` attributes for accordion panels.
159
+ Creates accessible accordions with keyboard navigation and automatic state management.
160
+
161
+ **Features:**
162
+
163
+ - Arrow key navigation between triggers
164
+ - Automatic ARIA attribute management
165
+ - Single or multiple panel expansion
166
+ - Enter/Space to toggle panels
167
+ - Home/End key support
160
168
 
161
169
  ```javascript
162
- import { updateAccordionTriggerAriaAttributes } from "aria-ease/accordion";
163
-
164
- const accordionStates = [
165
- { expanded: true },
166
- { expanded: false },
167
- { expanded: false },
168
- ];
169
-
170
- // Call when accordion state changes
171
- updateAccordionTriggerAriaAttributes(
172
- "accordion-container", // Container ID
173
- "accordion-trigger", // Shared class for triggers
174
- accordionStates, // State array
175
- 0, // Index of trigger that changed
176
- );
170
+ import { makeAccordionAccessible } from "aria-ease/accordion";
171
+
172
+ // React Example
173
+ useEffect(() => {
174
+ const accordion = makeAccordionAccessible({
175
+ accordionId: "accordion-container",
176
+ triggersClass: "accordion-trigger",
177
+ panelsClass: "accordion-panel",
178
+ allowMultiple: false, // Only one panel open at a time (default)
179
+ });
180
+
181
+ return () => accordion.cleanup();
182
+ }, []);
183
+
184
+ // Programmatic control
185
+ accordion.expandItem(0); // Expand first panel
186
+ accordion.collapseItem(1); // Collapse second panel
187
+ accordion.toggleItem(2); // Toggle third panel
177
188
  ```
178
189
 
179
190
  **HTML structure:**
180
191
 
181
192
  ```html
182
193
  <div id="accordion-container">
183
- <button
184
- class="accordion-trigger"
185
- aria-expanded="false"
186
- aria-controls="panel-1"
187
- >
188
- Section 1
189
- </button>
190
- <div id="panel-1">Content 1</div>
191
-
192
- <button
193
- class="accordion-trigger"
194
- aria-expanded="false"
195
- aria-controls="panel-2"
196
- >
197
- Section 2
198
- </button>
199
- <div id="panel-2">Content 2</div>
194
+ <button class="accordion-trigger">Section 1</button>
195
+ <div class="accordion-panel">Content 1</div>
196
+
197
+ <button class="accordion-trigger">Section 2</button>
198
+ <div class="accordion-panel">Content 2</div>
199
+
200
+ <button class="accordion-trigger">Section 3</button>
201
+ <div class="accordion-panel">Content 3</div>
200
202
  </div>
201
203
  ```
202
204
 
205
+ <details>
206
+ <summary>📌 Legacy API deprecated</summary>
207
+
208
+ ```javascript
209
+ import { makeAccordionAccessible } from "aria-ease/accordion";
210
+
211
+ const accordionStates = [{ display: true }, { display: false }];
212
+
213
+ makeAccordionAccessible({
214
+ accordionId: "faq-div",
215
+ triggersClass: "dropdown-button",
216
+ panelsClass: "accordion-panel",
217
+ allowMultiple: false, // Only one panel open at a time
218
+ });
219
+ ```
220
+
221
+ </details>
222
+
203
223
  ---
204
224
 
205
225
  ### ✅ Checkbox
206
226
 
207
- Updates `aria-checked` attributes for custom checkboxes.
227
+ Creates accessible checkbox groups with keyboard navigation and state management.
228
+
229
+ **Features:**
230
+
231
+ - Arrow key navigation
232
+ - Space to toggle
233
+ - Independent state tracking
234
+ - Home/End key support
235
+ - Query checked states
208
236
 
209
237
  ```javascript
210
- import { updateCheckboxAriaAttributes } from "aria-ease/checkbox";
211
-
212
- const checkboxStates = [
213
- { checked: true },
214
- { checked: false },
215
- { checked: true },
216
- ];
217
-
218
- // Call when checkbox is toggled
219
- function handleCheckboxClick(index) {
220
- checkboxStates[index].checked = !checkboxStates[index].checked;
221
-
222
- updateCheckboxAriaAttributes(
223
- "checkbox-group",
224
- "custom-checkbox",
225
- checkboxStates,
226
- index,
227
- );
228
- }
238
+ import { makeCheckboxAccessible } from "aria-ease/checkbox";
239
+
240
+ // React Example
241
+ useEffect(() => {
242
+ const checkboxGroup = makeCheckboxAccessible({
243
+ checkboxGroupId: "checkbox-group",
244
+ checkboxesClass: "custom-checkbox",
245
+ });
246
+
247
+ return () => checkboxGroup.cleanup();
248
+ }, []);
249
+
250
+ // Programmatic control
251
+ checkboxGroup.toggleCheckbox(0); // Toggle first checkbox
252
+ checkboxGroup.setCheckboxState(1, true); // Check second checkbox
253
+ const states = checkboxGroup.getCheckedStates(); // [true, false, true]
254
+ const indices = checkboxGroup.getCheckedIndices(); // [0, 2]
229
255
  ```
230
256
 
231
257
  **HTML structure:**
232
258
 
233
259
  ```html
234
260
  <div id="checkbox-group">
235
- <div
236
- class="custom-checkbox"
237
- role="checkbox"
238
- aria-checked="false"
239
- aria-label="Option 1"
240
- ></div>
241
- <div
242
- class="custom-checkbox"
243
- role="checkbox"
244
- aria-checked="false"
245
- aria-label="Option 2"
246
- ></div>
261
+ <div class="custom-checkbox" aria-label="Option 1"></div>
262
+ <div class="custom-checkbox" aria-label="Option 2"></div>
263
+ <div class="custom-checkbox" aria-label="Option 3"></div>
247
264
  </div>
248
265
  ```
249
266
 
267
+ <details>
268
+ <summary>📌 Legacy API deprecated</summary>
269
+
270
+ ```javascript
271
+ import { makeCheckboxAccessible } from "aria-ease/checkbox";
272
+
273
+ makeCheckboxAccessible({
274
+ checkboxGroupId: "checkbox-div",
275
+ checkboxesClass: "course-checkbox",
276
+ });
277
+ ```
278
+
279
+ </details>
280
+
250
281
  ---
251
282
 
252
283
  ### 🔘 Radio Button
253
284
 
254
- Updates `aria-checked` attributes for custom radio buttons.
285
+ Creates accessible radio groups with keyboard navigation and automatic selection management.
255
286
 
256
- ```javascript
257
- import { updateRadioAriaAttributes } from "aria-ease/radio";
287
+ **Features:**
258
288
 
259
- const radioStates = [{ checked: true }, { checked: false }, { checked: false }];
289
+ - Arrow key navigation (all directions)
290
+ - Automatic unchecking of other radios
291
+ - Space to select
292
+ - Home/End key support
293
+ - Single selection enforcement
260
294
 
261
- function handleRadioSelect(index) {
262
- // Uncheck all, check selected
263
- radioStates.forEach((state, i) => {
264
- state.checked = i === index;
295
+ ```javascript
296
+ import { makeRadioAccessible } from "aria-ease/radio";
297
+
298
+ // React Example
299
+ useEffect(() => {
300
+ const radioGroup = makeRadioAccessible({
301
+ radioGroupId: "radio-group",
302
+ radiosClass: "custom-radio",
303
+ defaultSelectedIndex: 0, // Initially selected (optional)
265
304
  });
266
305
 
267
- updateRadioAriaAttributes("radio-group", "custom-radio", radioStates);
268
- }
306
+ return () => radioGroup.cleanup();
307
+ }, []);
308
+
309
+ // Programmatic control
310
+ radioGroup.selectRadio(2); // Select third radio
311
+ const selected = radioGroup.getSelectedIndex(); // Get current selection
269
312
  ```
270
313
 
314
+ **HTML structure:**
315
+
316
+ ```html
317
+ <div id="radio-group">
318
+ <div class="custom-radio" aria-label="Option 1"></div>
319
+ <div class="custom-radio" aria-label="Option 2"></div>
320
+ <div class="custom-radio" aria-label="Option 3"></div>
321
+ </div>
322
+ ```
323
+
324
+ <details>
325
+ <summary>📌 Legacy API deprecated</summary>
326
+
327
+ ```javascript
328
+ import { makeRadioAccessible } from "aria-ease/radio";
329
+
330
+ makeRadioAccessible({
331
+ radioGroupId: "radio-div",
332
+ radiosClass: "radio",
333
+ defaultSelectedIndex: 0, // Optional: which radio is selected initially
334
+ });
335
+ ```
336
+
337
+ </details>
338
+
271
339
  ---
272
340
 
273
341
  ### 🔀 Toggle Button
274
342
 
275
- Updates `aria-pressed` attributes for toggle buttons.
343
+ Creates accessible toggle buttons with keyboard interactions and state management.
344
+
345
+ **Features:**
346
+
347
+ - Enter/Space to toggle
348
+ - Single toggle or toggle groups
349
+ - Arrow key navigation (groups)
350
+ - Home/End support (groups)
351
+ - Query pressed states
276
352
 
277
353
  ```javascript
278
- import { updateToggleAriaAttribute } from "aria-ease/toggle";
354
+ import { makeToggleAccessible } from "aria-ease/toggle";
279
355
 
280
- const toggleStates = [{ pressed: false }, { pressed: true }];
356
+ // Single toggle button
357
+ const toggle = makeToggleAccessible({
358
+ toggleId: "mute-button",
359
+ isSingleToggle: true,
360
+ });
281
361
 
282
- function handleToggle(index) {
283
- toggleStates[index].pressed = !toggleStates[index].pressed;
362
+ // Toggle button group
363
+ const toggleGroup = makeToggleAccessible({
364
+ toggleId: "toolbar",
365
+ togglesClass: "toggle-btn",
366
+ isSingleToggle: false,
367
+ });
284
368
 
285
- updateToggleAriaAttribute("toggle-container", "toggle-btn", toggleStates);
286
- }
369
+ // Programmatic control
370
+ toggle.toggleButton(0); // Toggle the button
371
+ toggle.setPressed(0, true); // Set pressed state
372
+ const states = toggleGroup.getPressedStates(); // [false, true, false]
373
+ const indices = toggleGroup.getPressedIndices(); // [1]
374
+
375
+ // Cleanup
376
+ toggle.cleanup();
287
377
  ```
288
378
 
379
+ **HTML structure:**
380
+
381
+ ```html
382
+ <!-- Single toggle -->
383
+ <button id="mute-button">Mute</button>
384
+
385
+ <!-- Toggle group -->
386
+ <div id="toolbar">
387
+ <button class="toggle-btn">Bold</button>
388
+ <button class="toggle-btn">Italic</button>
389
+ <button class="toggle-btn">Underline</button>
390
+ </div>
391
+ ```
392
+
393
+ <details>
394
+ <summary>📌 Legacy API deprecated</summary>
395
+
396
+ ```javascript
397
+ import { updateToggleAriaAttribute } from "aria-ease/toggle";
398
+
399
+ const toggleStates = [{ pressed: false }];
400
+
401
+ updateToggleAriaAttribute("toggle-container", "toggle-btn", toggleStates, 0);
402
+ ```
403
+
404
+ </details>
405
+
289
406
  ---
290
407
 
291
408
  ### 🧱 Block (Generic Focusable Groups)
@@ -336,23 +453,24 @@ Aria-Ease is designed to be lightweight and tree-shakable:
336
453
 
337
454
  | Import | Size (ESM) |
338
455
  | ---------------------------- | --------------------- |
339
- | `aria-ease/accordion` | ~1.5KB |
340
- | `aria-ease/checkbox` | ~1.6KB |
341
- | `aria-ease/radio` | ~1.6KB |
342
- | `aria-ease/toggle` | ~1.4KB |
343
- | `aria-ease/menu` | ~3.7KB |
456
+ | `aria-ease/accordion` | ~6.5KB |
457
+ | `aria-ease/checkbox` | ~6.0KB |
458
+ | `aria-ease/radio` | ~5.5KB |
459
+ | `aria-ease/toggle` | ~6.0KB |
460
+ | `aria-ease/menu` | ~6.7KB |
344
461
  | `aria-ease/block` | ~1.7KB |
345
- | Full bundle (all components) | ~416KB (uncompressed) |
462
+ | `aria-ease/combobox` | ~8.1KB |
463
+ | Full bundle (all components) | ~459KB (uncompressed) |
346
464
 
347
465
  **💡 Tip:** Always import individual components for optimal bundle size:
348
466
 
349
467
  ```javascript
350
- // ✅ Good - only imports menu code (~3.7KB)
468
+ // ✅ Good - only imports menu code (~6.7KB)
351
469
  import { makeMenuAccessible } from "aria-ease/menu";
352
470
  //or
353
471
  import * as Block from "aria-ease/block";
354
472
 
355
- // ❌ Avoid - imports everything (~416KB)
473
+ // ❌ Avoid - imports everything (~459KB)
356
474
  import { makeMenuAccessible } from "aria-ease";
357
475
  ```
358
476
 
package/dist/index.cjs CHANGED
@@ -9853,40 +9853,10 @@ __export(index_exports, {
9853
9853
  makeMenuAccessible: () => makeMenuAccessible,
9854
9854
  makeRadioAccessible: () => makeRadioAccessible,
9855
9855
  makeToggleAccessible: () => makeToggleAccessible,
9856
- testUiComponent: () => testUiComponent,
9857
- updateAccordionTriggerAriaAttributes: () => updateAccordionTriggerAriaAttributes,
9858
- updateCheckboxAriaAttributes: () => updateCheckboxAriaAttributes,
9859
- updateRadioAriaAttributes: () => updateRadioAriaAttributes,
9860
- updateToggleAriaAttribute: () => updateToggleAriaAttribute
9856
+ testUiComponent: () => testUiComponent
9861
9857
  });
9862
9858
  module.exports = __toCommonJS(index_exports);
9863
9859
 
9864
- // src/accordion/src/updateAccordionTriggerAriaAttributes/updateAccordionTriggerAriaAttributes.ts
9865
- function updateAccordionTriggerAriaAttributes(accordionId, accordionTriggersClass, accordionStates, clickedTriggerIndex) {
9866
- const accordionDiv = document.querySelector(`#${accordionId}`);
9867
- if (!accordionDiv) {
9868
- console.error(`[aria-ease] Element with id="${accordionId}" not found. Make sure the accordion element exists before calling updateAccordionTriggerAriaAttributes.`);
9869
- return;
9870
- }
9871
- const accordionItems = Array.from(accordionDiv.querySelectorAll(`.${accordionTriggersClass}`));
9872
- if (accordionItems.length === 0) {
9873
- console.error(`[aria-ease] Element with class="${accordionTriggersClass}" not found. Make sure the accordion items exist before calling updateAccordionTriggerAriaAttributes.`);
9874
- return;
9875
- }
9876
- if (accordionItems.length !== accordionStates.length) {
9877
- console.error(`[aria-ease] Accordion state/DOM length mismatch: found ${accordionItems.length} triggers, but got ${accordionStates.length} state objects.'`);
9878
- return;
9879
- }
9880
- accordionItems.forEach((accordionItem, index) => {
9881
- const state = accordionStates[index];
9882
- const expanded = accordionItem.getAttribute("aria-expanded");
9883
- const shouldBeExpanded = index === clickedTriggerIndex ? state.display ? "true" : "false" : "false";
9884
- if (expanded && expanded !== shouldBeExpanded) {
9885
- accordionItem.setAttribute("aria-expanded", shouldBeExpanded);
9886
- }
9887
- });
9888
- }
9889
-
9890
9860
  // src/accordion/src/makeAccordionAccessible/makeAccordionAccessible.ts
9891
9861
  function makeAccordionAccessible({ accordionId, triggersClass, panelsClass, allowMultiple = false }) {
9892
9862
  const accordionContainer = document.querySelector(`#${accordionId}`);
@@ -10215,38 +10185,6 @@ function makeBlockAccessible({ blockId, blockItemsClass }) {
10215
10185
  return { cleanup, refresh };
10216
10186
  }
10217
10187
 
10218
- // src/checkbox/src/updateCheckboxAriaAttributes/updateCheckboxAriaAttributes.ts
10219
- function updateCheckboxAriaAttributes(checkboxId, checkboxesClass, checkboxStates, currentPressedCheckboxIndex) {
10220
- const checkboxDiv = document.querySelector(`#${checkboxId}`);
10221
- if (!checkboxDiv) {
10222
- console.error(`[aria-ease] Invalid checkbox main div id provided. No checkbox div with id '${checkboxDiv} found.'`);
10223
- return;
10224
- }
10225
- const checkboxItems = Array.from(document.querySelectorAll(`.${checkboxesClass}`));
10226
- if (checkboxItems.length === 0) {
10227
- console.error(`[aria-ease] Element with class="${checkboxesClass}" not found. Make sure the checkbox items exist before calling updateCheckboxAriaAttributes.`);
10228
- return;
10229
- }
10230
- ;
10231
- if (checkboxStates.length === 0) {
10232
- console.error(`[aria-ease] Checkbox states array is empty. Make sure the checkboxStates array is populated before calling updateCheckboxAriaAttributes.`);
10233
- return;
10234
- }
10235
- if (currentPressedCheckboxIndex < 0 || currentPressedCheckboxIndex >= checkboxStates.length) {
10236
- console.error(`[aria-ease] Checkbox index ${currentPressedCheckboxIndex} is out of bounds for states array of length ${checkboxStates.length}.`);
10237
- return;
10238
- }
10239
- checkboxItems.forEach((checkbox, index) => {
10240
- if (index === currentPressedCheckboxIndex) {
10241
- const checked = checkbox.getAttribute("aria-checked");
10242
- const shouldBeChecked = checkboxStates[index].checked ? "true" : "false";
10243
- if (checked && checked !== shouldBeChecked) {
10244
- checkbox.setAttribute("aria-checked", shouldBeChecked);
10245
- }
10246
- }
10247
- });
10248
- }
10249
-
10250
10188
  // src/checkbox/src/makeCheckboxAccessible/makeCheckboxAccessible.ts
10251
10189
  function makeCheckboxAccessible({ checkboxGroupId, checkboxesClass }) {
10252
10190
  const checkboxGroup = document.querySelector(`#${checkboxGroupId}`);
@@ -10520,8 +10458,8 @@ function makeMenuAccessible({ menuId, menuItemsClass, triggerId }) {
10520
10458
  });
10521
10459
  }
10522
10460
  function openMenu() {
10523
- menuDiv.style.display = "block";
10524
10461
  setAria(true);
10462
+ menuDiv.style.display = "block";
10525
10463
  const items = getFilteredItems();
10526
10464
  addListeners();
10527
10465
  if (items && items.length > 0) {
@@ -10529,9 +10467,9 @@ function makeMenuAccessible({ menuId, menuItemsClass, triggerId }) {
10529
10467
  }
10530
10468
  }
10531
10469
  function closeMenu() {
10532
- removeListeners();
10533
- menuDiv.style.display = "none";
10534
10470
  setAria(false);
10471
+ menuDiv.style.display = "none";
10472
+ removeListeners();
10535
10473
  triggerButton.focus();
10536
10474
  }
10537
10475
  function intializeMenuItems() {
@@ -10541,19 +10479,8 @@ function makeMenuAccessible({ menuId, menuItemsClass, triggerId }) {
10541
10479
  });
10542
10480
  }
10543
10481
  intializeMenuItems();
10544
- function handleTriggerKeydown(event) {
10545
- if (event.key === "Enter" || event.key === " ") {
10546
- event.preventDefault();
10547
- const isOpen = menuDiv.style.display !== "none";
10548
- if (isOpen) {
10549
- closeMenu();
10550
- } else {
10551
- openMenu();
10552
- }
10553
- }
10554
- }
10555
10482
  function handleTriggerClick() {
10556
- const isOpen = menuDiv.style.display !== "none";
10483
+ const isOpen = triggerButton.getAttribute("aria-expanded") === "true";
10557
10484
  if (isOpen) {
10558
10485
  closeMenu();
10559
10486
  } else {
@@ -10561,17 +10488,19 @@ function makeMenuAccessible({ menuId, menuItemsClass, triggerId }) {
10561
10488
  }
10562
10489
  }
10563
10490
  function handleClickOutside(event) {
10564
- if (menuDiv && triggerButton && !menuDiv.contains(event.target) && !triggerButton.contains(event.target) && getComputedStyle(menuDiv).display !== "none" && triggerButton.getAttribute("aria-expanded") === "true") {
10491
+ const isMenuOpen = triggerButton.getAttribute("aria-expanded") === "true";
10492
+ if (!isMenuOpen) return;
10493
+ const clickedTrigger = triggerButton.contains(event.target);
10494
+ const clickedMenu = menuDiv.contains(event.target);
10495
+ if (!clickedTrigger && !clickedMenu) {
10565
10496
  closeMenu();
10566
10497
  }
10567
10498
  }
10568
- triggerButton.addEventListener("keydown", handleTriggerKeydown);
10569
10499
  triggerButton.addEventListener("click", handleTriggerClick);
10570
10500
  document.addEventListener("click", handleClickOutside);
10571
10501
  triggerButton.setAttribute("data-menu-initialized", "true");
10572
10502
  function cleanup() {
10573
10503
  removeListeners();
10574
- triggerButton.removeEventListener("keydown", handleTriggerKeydown);
10575
10504
  triggerButton.removeEventListener("click", handleTriggerClick);
10576
10505
  document.removeEventListener("click", handleClickOutside);
10577
10506
  menuDiv.style.display = "none";
@@ -10586,36 +10515,6 @@ function makeMenuAccessible({ menuId, menuItemsClass, triggerId }) {
10586
10515
  return { openMenu, closeMenu, cleanup, refresh };
10587
10516
  }
10588
10517
 
10589
- // src/radio/src/updateRadioAriaAttributes/updateRadioAriaAttributes.ts
10590
- function updateRadioAriaAttributes(radioId, radiosClass, radioStates, currentPressedRadioIndex) {
10591
- const radioDiv = document.querySelector(`#${radioId}`);
10592
- if (!radioDiv) {
10593
- console.error(`[aria-ease] Element with id="${radioId}" not found. Make sure the radio element exists before calling updateRadioAriaAttributes.`);
10594
- return;
10595
- }
10596
- const radioItems = Array.from(radioDiv.querySelectorAll(`.${radiosClass}`));
10597
- if (radioItems.length === 0) {
10598
- console.error(`[aria-ease] Element with class="${radiosClass}" not found. Make sure the radio items exist before calling updateRadioAriaAttributes.`);
10599
- return;
10600
- }
10601
- if (radioStates.length === 0) {
10602
- console.error(`[aria-ease] Radio states array is empty. Make sure the radioStates array is populated before calling updateRadioAriaAttributes.`);
10603
- return;
10604
- }
10605
- if (currentPressedRadioIndex < 0 || currentPressedRadioIndex >= radioStates.length) {
10606
- console.error(`[aria-ease] Radio index ${currentPressedRadioIndex} is out of bounds for states array of length ${radioStates.length}.`);
10607
- return;
10608
- }
10609
- radioItems.forEach((radioItem, index) => {
10610
- const state = radioStates[index];
10611
- const checked = radioItem.getAttribute("aria-checked");
10612
- const shouldBeChecked = index === currentPressedRadioIndex ? state.checked ? "true" : "false" : "false";
10613
- if (checked && checked !== shouldBeChecked) {
10614
- radioItem.setAttribute("aria-checked", shouldBeChecked);
10615
- }
10616
- });
10617
- }
10618
-
10619
10518
  // src/radio/src/makeRadioAccessible/makeRadioAccessible.ts
10620
10519
  function makeRadioAccessible({ radioGroupId, radiosClass, defaultSelectedIndex = 0 }) {
10621
10520
  const radioGroup = document.querySelector(`#${radioGroupId}`);
@@ -10737,33 +10636,6 @@ function makeRadioAccessible({ radioGroupId, radiosClass, defaultSelectedIndex =
10737
10636
  };
10738
10637
  }
10739
10638
 
10740
- // src/toggle/src/updateToggleAriaAttribute/updateToggleAriaAttribute.ts
10741
- function updateToggleAriaAttribute(toggleId, togglesClass, toggleStates, currentPressedToggleIndex) {
10742
- const toggleDiv = document.querySelector(`#${toggleId}`);
10743
- if (!toggleDiv) {
10744
- console.error(`[aria-ease] Element with id="${toggleId}" not found. Make sure the toggle element exists before calling updateToggleAriaAttribute.`);
10745
- return;
10746
- }
10747
- const toggleItems = Array.from(toggleDiv.querySelectorAll(`.${togglesClass}`));
10748
- if (toggleItems.length === 0) {
10749
- console.error(`[aria-ease] Element with class="${togglesClass}" not found. Make sure the toggle items exist before calling updateToggleAriaAttribute.`);
10750
- return;
10751
- }
10752
- if (toggleItems.length !== toggleStates.length) {
10753
- console.error(`[aria-ease] Toggle state/DOM length mismatch: found ${toggleItems.length} triggers, but got ${toggleStates.length} state objects.'`);
10754
- return;
10755
- }
10756
- toggleItems.forEach((toggle, index) => {
10757
- if (index === currentPressedToggleIndex) {
10758
- const pressed = toggle.getAttribute("aria-pressed");
10759
- const shouldBePressed = toggleStates[index].pressed ? "true" : "false";
10760
- if (pressed && pressed !== shouldBePressed) {
10761
- toggle.setAttribute("aria-pressed", shouldBePressed);
10762
- }
10763
- }
10764
- });
10765
- }
10766
-
10767
10639
  // src/toggle/src/makeTogggleAccessible/makeToggleAccessible.ts
10768
10640
  function makeToggleAccessible({ toggleId, togglesClass, isSingleToggle = true }) {
10769
10641
  const toggleContainer = document.querySelector(`#${toggleId}`);
@@ -10908,7 +10780,7 @@ function makeToggleAccessible({ toggleId, togglesClass, isSingleToggle = true })
10908
10780
  };
10909
10781
  }
10910
10782
 
10911
- // src/combobox/src/makeComboBoxAccessible.ts
10783
+ // src/combobox/src/makeComboBoxAccessible/makeComboBoxAccessible.ts
10912
10784
  function makeComboboxAccessible({ comboboxInputId, comboboxButtonId, listBoxId, listBoxItemsClass, config: config2 }) {
10913
10785
  const comboboxInput = document.getElementById(`${comboboxInputId}`);
10914
10786
  if (!comboboxInput) {
@@ -14827,11 +14699,7 @@ if (typeof window === "undefined") {
14827
14699
  makeMenuAccessible,
14828
14700
  makeRadioAccessible,
14829
14701
  makeToggleAccessible,
14830
- testUiComponent,
14831
- updateAccordionTriggerAriaAttributes,
14832
- updateCheckboxAriaAttributes,
14833
- updateRadioAriaAttributes,
14834
- updateToggleAriaAttribute
14702
+ testUiComponent
14835
14703
  });
14836
14704
  /*! Bundled license information:
14837
14705