aria-ease 7.3.0 → 7.4.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/dist/index.cjs +25 -25
- package/dist/index.d.cts +24 -11
- package/dist/index.d.ts +24 -11
- package/dist/index.js +8 -8
- package/dist/src/{Types.d-DYfYR3Vc.d.cts → Types.d-D96FYkCN.d.cts} +22 -1
- package/dist/src/{Types.d-DYfYR3Vc.d.ts → Types.d-D96FYkCN.d.ts} +22 -1
- package/dist/src/accordion/index.d.cts +1 -1
- package/dist/src/accordion/index.d.ts +1 -1
- package/dist/src/block/index.d.cts +1 -1
- package/dist/src/block/index.d.ts +1 -1
- package/dist/src/checkbox/index.cjs +1 -1
- package/dist/src/checkbox/index.d.cts +2 -6
- package/dist/src/checkbox/index.d.ts +2 -6
- package/dist/src/checkbox/index.js +1 -1
- package/dist/src/combobox/index.d.cts +1 -1
- package/dist/src/combobox/index.d.ts +1 -1
- package/dist/src/menu/index.d.cts +1 -1
- package/dist/src/menu/index.d.ts +1 -1
- package/dist/src/radio/index.cjs +1 -1
- package/dist/src/radio/index.d.cts +3 -7
- package/dist/src/radio/index.d.ts +3 -7
- package/dist/src/radio/index.js +1 -1
- package/dist/src/tabs/index.d.cts +1 -1
- package/dist/src/tabs/index.d.ts +1 -1
- package/dist/src/toggle/index.d.cts +1 -1
- package/dist/src/toggle/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/src/radio/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function
|
|
1
|
+
'use strict';function y({radioGroupId:s,radiosClass:l,defaultSelectedIndex:d,callback:b}){if(s==="")return console.error("[aria-ease] 'radioGroupId' should not be an empty string. Provide an id to the radio group container element that exists before calling makeRadioAccessible."),{cleanup:()=>{}};let i=document.querySelector(`#${s}`);if(!i)return console.error(`[aria-ease] Element with id="${s}" not found. Make sure the radio group container exists before calling makeRadioAccessible.`),{cleanup:()=>{}};if(l==="")return console.error("[aria-ease] 'radiosClass' should not be an empty string. Provide a class name that exists on the radio button elements before calling makeRadioAccessible."),{cleanup:()=>{}};let r=Array.from(i.querySelectorAll(`.${l}`));if(r.length===0)return console.error(`[aria-ease] No elements with class="${l}" found. Make sure radio buttons exist before calling makeRadioAccessible.`),{cleanup:()=>{}};let u=new WeakMap,f=new WeakMap,n;d&&(n=d);function m(){i.getAttribute("role")||i.setAttribute("role","radiogroup"),r.forEach((e,t)=>{e.setAttribute("role","radio"),e.setAttribute("tabindex","0"),t===n?e.setAttribute("aria-checked","true"):e.setAttribute("aria-checked","false");});}function c(e){if(e<0||e>=r.length){console.error(`[aria-ease] Invalid radio index: ${e}`);return}if(n>=0&&n<r.length&&r[n].setAttribute("aria-checked","false"),r[e].setAttribute("aria-checked","true"),r[e].focus(),b?.onCheck)try{b.onCheck(e);}catch(t){console.error("[aria-ease] Error in radio onCheck callback:",t);}n=e;}function h(e){return ()=>{c(e);}}function k(e){return t=>{let{key:o}=t,a=e;switch(o){case "ArrowDown":case "ArrowRight":t.preventDefault(),a=(e+1)%r.length,c(a);break;case "ArrowUp":case "ArrowLeft":t.preventDefault(),a=(e-1+r.length)%r.length,c(a);break;case " ":case "Enter":t.preventDefault(),c(e);break}}}function g(){r.forEach((e,t)=>{let o=h(t),a=k(t);e.addEventListener("click",o),e.addEventListener("keydown",a),u.set(e,a),f.set(e,o);});}function p(){r.forEach(e=>{let t=u.get(e),o=f.get(e);t&&(e.removeEventListener("keydown",t),u.delete(e)),o&&(e.removeEventListener("click",o),f.delete(e));});}function A(){p();}function E(){return n}return m(),g(),{selectRadio:c,getSelectedIndex:E,cleanup:A}}exports.makeRadioAccessible=y;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as AccessibilityInstance } from '../Types.d-
|
|
1
|
+
import { R as RadioConfig, a as AccessibilityInstance } from '../Types.d-D96FYkCN.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Makes a radio group accessible by managing ARIA attributes, keyboard interaction, and state.
|
|
@@ -6,13 +6,9 @@ import { a as AccessibilityInstance } from '../Types.d-DYfYR3Vc.cjs';
|
|
|
6
6
|
* @param {string} radioGroupId - The id of the radio group container.
|
|
7
7
|
* @param {string} radiosClass - The shared class of all radio buttons.
|
|
8
8
|
* @param {number} defaultSelectedIndex - The index of the initially selected radio (default: 0).
|
|
9
|
+
* @param {RadioCallback} callback - Configuration options for callbacks.
|
|
9
10
|
*/
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
radioGroupId: string;
|
|
13
|
-
radiosClass: string;
|
|
14
|
-
defaultSelectedIndex?: number;
|
|
15
|
-
}
|
|
16
|
-
declare function makeRadioAccessible({ radioGroupId, radiosClass, defaultSelectedIndex }: RadioConfig): AccessibilityInstance;
|
|
12
|
+
declare function makeRadioAccessible({ radioGroupId, radiosClass, defaultSelectedIndex, callback }: RadioConfig): AccessibilityInstance;
|
|
17
13
|
|
|
18
14
|
export { makeRadioAccessible };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as AccessibilityInstance } from '../Types.d-
|
|
1
|
+
import { R as RadioConfig, a as AccessibilityInstance } from '../Types.d-D96FYkCN.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Makes a radio group accessible by managing ARIA attributes, keyboard interaction, and state.
|
|
@@ -6,13 +6,9 @@ import { a as AccessibilityInstance } from '../Types.d-DYfYR3Vc.js';
|
|
|
6
6
|
* @param {string} radioGroupId - The id of the radio group container.
|
|
7
7
|
* @param {string} radiosClass - The shared class of all radio buttons.
|
|
8
8
|
* @param {number} defaultSelectedIndex - The index of the initially selected radio (default: 0).
|
|
9
|
+
* @param {RadioCallback} callback - Configuration options for callbacks.
|
|
9
10
|
*/
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
radioGroupId: string;
|
|
13
|
-
radiosClass: string;
|
|
14
|
-
defaultSelectedIndex?: number;
|
|
15
|
-
}
|
|
16
|
-
declare function makeRadioAccessible({ radioGroupId, radiosClass, defaultSelectedIndex }: RadioConfig): AccessibilityInstance;
|
|
12
|
+
declare function makeRadioAccessible({ radioGroupId, radiosClass, defaultSelectedIndex, callback }: RadioConfig): AccessibilityInstance;
|
|
17
13
|
|
|
18
14
|
export { makeRadioAccessible };
|
package/dist/src/radio/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function y({radioGroupId:s,radiosClass:l,defaultSelectedIndex:d,callback:b}){if(s==="")return console.error("[aria-ease] 'radioGroupId' should not be an empty string. Provide an id to the radio group container element that exists before calling makeRadioAccessible."),{cleanup:()=>{}};let i=document.querySelector(`#${s}`);if(!i)return console.error(`[aria-ease] Element with id="${s}" not found. Make sure the radio group container exists before calling makeRadioAccessible.`),{cleanup:()=>{}};if(l==="")return console.error("[aria-ease] 'radiosClass' should not be an empty string. Provide a class name that exists on the radio button elements before calling makeRadioAccessible."),{cleanup:()=>{}};let r=Array.from(i.querySelectorAll(`.${l}`));if(r.length===0)return console.error(`[aria-ease] No elements with class="${l}" found. Make sure radio buttons exist before calling makeRadioAccessible.`),{cleanup:()=>{}};let u=new WeakMap,f=new WeakMap,n;d&&(n=d);function m(){i.getAttribute("role")||i.setAttribute("role","radiogroup"),r.forEach((e,t)=>{e.setAttribute("role","radio"),e.setAttribute("tabindex","0"),t===n?e.setAttribute("aria-checked","true"):e.setAttribute("aria-checked","false");});}function c(e){if(e<0||e>=r.length){console.error(`[aria-ease] Invalid radio index: ${e}`);return}if(n>=0&&n<r.length&&r[n].setAttribute("aria-checked","false"),r[e].setAttribute("aria-checked","true"),r[e].focus(),b?.onCheck)try{b.onCheck(e);}catch(t){console.error("[aria-ease] Error in radio onCheck callback:",t);}n=e;}function h(e){return ()=>{c(e);}}function k(e){return t=>{let{key:o}=t,a=e;switch(o){case "ArrowDown":case "ArrowRight":t.preventDefault(),a=(e+1)%r.length,c(a);break;case "ArrowUp":case "ArrowLeft":t.preventDefault(),a=(e-1+r.length)%r.length,c(a);break;case " ":case "Enter":t.preventDefault(),c(e);break}}}function g(){r.forEach((e,t)=>{let o=h(t),a=k(t);e.addEventListener("click",o),e.addEventListener("keydown",a),u.set(e,a),f.set(e,o);});}function p(){r.forEach(e=>{let t=u.get(e),o=f.get(e);t&&(e.removeEventListener("keydown",t),u.delete(e)),o&&(e.removeEventListener("click",o),f.delete(e));});}function A(){p();}function E(){return n}return m(),g(),{selectRadio:c,getSelectedIndex:E,cleanup:A}}export{y as makeRadioAccessible};
|
package/dist/src/tabs/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aria-ease",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.4.0",
|
|
4
4
|
"description": "Accessibility infrastructure for the entire frontend engineering lifecycle. Build accessible patterns, run automated audits, verify component interactions, and gate deployments — all in one system.",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"type": "module",
|