{"_id":"@a11ytools/aria-roles","_rev":"6-72c0840b77c80c4d4b3d8840a5acd481","name":"@a11ytools/aria-roles","dist-tags":{"latest":"1.0.6"},"versions":{"1.0.0":{"name":"@a11ytools/aria-roles","version":"1.0.0","keywords":["aria","aria roles","aria utilities","accessibility","a11y","web accessibility","aria attributes","assistive technology"],"author":{"url":"https://github.com/zenluv","name":"zenluv"},"license":"MIT","_id":"@a11ytools/aria-roles@1.0.0","maintainers":[{"name":"zenluv","email":"venkatajanapareddy9@gmail.com"}],"homepage":"https://github.com/zenluv/aria-roles#readme","bugs":{"url":"https://github.com/zenluv/aria-roles/issues"},"dist":{"shasum":"a3c34200f6527bca3463fde25caecdc3886f267f","tarball":"https://registry.npmjs.org/@a11ytools/aria-roles/-/aria-roles-1.0.0.tgz","fileCount":4,"integrity":"sha512-1NJlGWYP4zRwxtgM2j6FEKtMC+D4GkzivrhCBFDy50Sl6lbP1EEaKBXpkEKaHTGckOssmje8Wo6vB7ApoU3eqw==","signatures":[{"sig":"MEQCIF+8b5v1UC55oo2KQnZZV2WqVABZVApD9uQ6VsL3GOEcAiAs+dMiTgJ4pPzNtKPJdVV+aThI+C5e8Ur4K29m/9HEWg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":3591},"main":"index.js","type":"module","gitHead":"bdac418470b6bdfe569546f33d3f646b59386ec8","scripts":{"test":"vitest"},"_npmUser":{"name":"zenluv","email":"venkatajanapareddy9@gmail.com"},"deprecated":"This package has moved to @a11y-tools/aria-roles. Please upgrade.","repository":{"url":"git+https://github.com/zenluv/aria-roles.git","type":"git"},"_npmVersion":"8.12.1","description":"A utility for fetching valid ARIA roles dynamically, validating roles, and providing additional accessibility-related functions.","directories":{"test":"test"},"_nodeVersion":"18.4.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.0.7"},"_npmOperationalInternal":{"tmp":"tmp/aria-roles_1.0.0_1741054690100_0.028512534814328694","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@a11ytools/aria-roles","version":"1.0.1","keywords":["aria","aria roles","aria utilities","accessibility","a11y","web accessibility","aria attributes","assistive technology"],"author":{"url":"https://github.com/zenluv","name":"zenluv"},"license":"MIT","_id":"@a11ytools/aria-roles@1.0.1","maintainers":[{"name":"zenluv","email":"venkatajanapareddy9@gmail.com"}],"homepage":"https://github.com/zenluv/aria-roles#readme","bugs":{"url":"https://github.com/zenluv/aria-roles/issues"},"dist":{"shasum":"d1861cdf6ec8e64ed193f312a22bcb27e19318b7","tarball":"https://registry.npmjs.org/@a11ytools/aria-roles/-/aria-roles-1.0.1.tgz","fileCount":5,"integrity":"sha512-uI7NKi1MYGPBqd+OhNaYWU0Zf+2QloCgcCx6nCekUQulofLxGwXtUOWZTLLW+tYBROrajvfx6Q4ZzpfWmNUOxw==","signatures":[{"sig":"MEQCIFUE56COCuhkTOghVPtvOpRvwazvkiA06w1Gq/I1yuUeAiBbA3gMLbONeHs22pE5ull/MgFiNowK8SvOkWIF3Fs5eA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":3761},"main":"index.js","type":"module","types":"index.d.ts","gitHead":"9ebe3ec6ab2449cac60fe96be67e1c8983591be8","scripts":{"test":"vitest"},"_npmUser":{"name":"zenluv","email":"venkatajanapareddy9@gmail.com"},"deprecated":"This package has moved to @a11y-tools/aria-roles. Please upgrade.","repository":{"url":"git+https://github.com/zenluv/aria-roles.git","type":"git"},"_npmVersion":"8.12.1","description":"A utility for fetching valid ARIA roles dynamically, validating roles, and providing additional accessibility-related functions.","directories":{"test":"test"},"_nodeVersion":"18.4.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.0.7"},"_npmOperationalInternal":{"tmp":"tmp/aria-roles_1.0.1_1741055304438_0.5913750293517903","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@a11ytools/aria-roles","version":"1.0.2","keywords":["aria","aria roles","aria utilities","accessibility","a11y","web accessibility","aria attributes","assistive technology","typescript","type-safe"],"author":{"url":"https://github.com/zenluv","name":"zenluv"},"license":"MIT","_id":"@a11ytools/aria-roles@1.0.2","maintainers":[{"name":"zenluv","email":"venkatajanapareddy9@gmail.com"}],"homepage":"https://github.com/zenluv/aria-roles#readme","bugs":{"url":"https://github.com/zenluv/aria-roles/issues"},"dist":{"shasum":"f905a1d63d988babe0e04a38e8cff2e3feb19e81","tarball":"https://registry.npmjs.org/@a11ytools/aria-roles/-/aria-roles-1.0.2.tgz","fileCount":6,"integrity":"sha512-XYQ9NXxEt8OKz/jYTjBuuOCikqCOOUKSRlPtx4FsbeKEKD0p26bKSO7jbSHi1+1GH5bOWm02YzTYcYwu9bFbVw==","signatures":[{"sig":"MEQCH29espUo2jIUvTiBxpwB715+6E5UZ1gFHKL70/TjoXICIQCSzySstYJt7k/Anq7e05zXkxB0/bE+S57NeHjaUeEaYg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10285},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.js","gitHead":"218c6d18e53bc587517fbe36b3ea93c05be95980","scripts":{"lint":"tsc --noEmit","test":"vitest","build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"zenluv","email":"venkatajanapareddy9@gmail.com"},"deprecated":"This package has moved to @a11y-tools/aria-roles. Please upgrade.","repository":{"url":"git+https://github.com/zenluv/aria-roles.git","type":"git"},"_npmVersion":"10.1.0","description":"A utility for fetching valid ARIA roles dynamically, validating roles, and providing type-safe access to ARIA role names.","directories":{"test":"test"},"_nodeVersion":"20.9.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.0.8","typescript":"^5.8.2","@types/node":"^22.13.9"},"_npmOperationalInternal":{"tmp":"tmp/aria-roles_1.0.2_1741321928152_0.7223598047754471","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@a11ytools/aria-roles","version":"1.0.3","keywords":["aria","aria roles","aria utilities","accessibility","a11y","web accessibility","aria attributes","assistive technology","typescript","type-safe"],"author":{"url":"https://github.com/venkata-janapareddy","name":"Venkata Janapareddy"},"license":"MIT","_id":"@a11ytools/aria-roles@1.0.3","maintainers":[{"name":"zenluv","email":"venkatajanapareddy9@gmail.com"}],"homepage":"https://github.com/a11ytools/aria-roles#readme","bugs":{"url":"https://github.com/a11ytools/aria-roles/issues"},"dist":{"shasum":"45662be80e7deb8dce05e1a7090ca884ef0e53ec","tarball":"https://registry.npmjs.org/@a11ytools/aria-roles/-/aria-roles-1.0.3.tgz","fileCount":6,"integrity":"sha512-hb3Gv7OljPTlrjpE6Vzn7f4vspn76ZWakbSUOPUAtDRik+c/IDUBygjoCozgsqldG06ceokJko08Wo90EbM7IA==","signatures":[{"sig":"MEUCIHwwChWf7SsVSqLcdh+tBocwXdQ9i8DZSkr0VpmrFcKjAiEAxF91Q0U01iREkjYVv/Z4P4gAJVAvJXQRghr3DbW46p0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":11323},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.js","engines":{"node":">=18.0.0"},"gitHead":"9e952396aafcf6c7b3c5080cc87252fa79ff96a5","scripts":{"lint":"tsc --noEmit","test":"vitest","build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"zenluv","email":"venkatajanapareddy9@gmail.com"},"deprecated":"This package has moved to @a11y-tools/aria-roles. Please upgrade.","repository":{"url":"git+https://github.com/a11ytools/aria-roles.git","type":"git"},"_npmVersion":"10.1.0","description":"A utility for fetching valid ARIA roles dynamically, validating roles, and providing type-safe access to ARIA role names.","directories":{"test":"test"},"_nodeVersion":"20.9.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.0.8","typescript":"^5.8.2","@types/node":"^22.13.9"},"_npmOperationalInternal":{"tmp":"tmp/aria-roles_1.0.3_1741393620634_0.4534794397739861","host":"s3://npm-registry-packages-npm-production"}},"1.0.6":{"name":"@a11ytools/aria-roles","version":"1.0.6","description":"A utility for fetching valid ARIA roles dynamically, validating roles, and providing type-safe access to ARIA role names.","type":"module","main":"dist/index.js","module":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"directories":{"test":"test"},"scripts":{"build":"tsc","test":"vitest","lint":"tsc --noEmit"},"keywords":["aria","aria roles","aria utilities","accessibility","a11y","web accessibility","aria attributes","assistive technology","typescript","type-safe"],"author":{"name":"Venkata Janapareddy","url":"https://github.com/venkata-janapareddy"},"license":"MIT","devDependencies":{"@types/node":"^22.13.9","typescript":"^5.8.2","vitest":"^3.0.8"},"publishConfig":{"access":"public"},"_id":"@a11ytools/aria-roles@1.0.6","_nodeVersion":"23.9.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-e0vYk2llwrdjJvx9kjGnzufn0IRrLI5tBUOm1CKGwb3C1F+DX2Rgrz3QORWWLj/dS7qaZ96QyqxlvZ+cO2Fe1A==","shasum":"1aae8285000e332e0e2c6c3444e15ec3570c77c0","tarball":"https://registry.npmjs.org/@a11ytools/aria-roles/-/aria-roles-1.0.6.tgz","fileCount":6,"unpackedSize":11040,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC1DIpmUcHWFGU4lbDjkJNRMC+IY3aMfq0ABwrnvLFFSwIhALCMFReQcaLPbYWEodjZiZI36mTuhN1aXyUTbiauZ8BV"}]},"_npmUser":{"name":"zenluv","email":"venkatajanapareddy9@gmail.com"},"maintainers":[{"name":"zenluv","email":"venkatajanapareddy9@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/aria-roles_1.0.6_1749919451666_0.6517469873500934"},"_hasShrinkwrap":false}},"time":{"created":"2025-03-04T02:18:10.002Z","modified":"2025-06-14T16:44:12.108Z","1.0.0":"2025-03-04T02:18:10.259Z","1.0.1":"2025-03-04T02:28:24.607Z","1.0.2":"2025-03-07T04:32:08.350Z","1.0.3":"2025-03-08T00:27:00.801Z","1.0.6":"2025-06-14T16:44:11.862Z"},"author":{"name":"Venkata Janapareddy","url":"https://github.com/venkata-janapareddy"},"license":"MIT","keywords":["aria","aria roles","aria utilities","accessibility","a11y","web accessibility","aria attributes","assistive technology","typescript","type-safe"],"description":"A utility for fetching valid ARIA roles dynamically, validating roles, and providing type-safe access to ARIA role names.","maintainers":[{"name":"zenluv","email":"venkatajanapareddy9@gmail.com"}],"readme":"# aria-roles\n\n**aria-roles** is a lightweight utility library that provides a reliable way to fetch valid ARIA roles dynamically. It simplifies accessibility development by preventing hardcoded role values and enabling validation for better UI accessibility compliance.\n\n## 🚀 Features\n- 📜 Retrieve a complete, up-to-date list of all valid ARIA roles\n- ✅ Validate whether a given role is a recognized ARIA role\n- 🔒 Type-safe access to ARIA role names\n- ⚡ Lightweight, fast, and dependency-free\n- 🔍 Designed for use in accessibility tooling, testing, and frontend frameworks\n\n## 📦 Installation\n```sh\nnpm install @a11ytools/aria-roles\n```\n\n## 🔧 Usage\n\n### Basic Usage\n```js\nimport { getAllAriaRoles, isValidAriaRole, ariaRoles } from \"@a11ytools/aria-roles\";\n\n// Get all valid ARIA roles\nconsole.log(getAllAriaRoles()); // Returns an array of valid ARIA roles\n\n// Validate a role\nconsole.log(isValidAriaRole(\"button\")); // true\nconsole.log(isValidAriaRole(\"fake-role\")); // false\n\n// Type-safe access to role names\nelement.setAttribute('role', ariaRoles.button);\nelement.setAttribute('role', ariaRoles.tabpanel);\n```\n\n### TypeScript Usage\n```ts\nimport { AriaRole, ariaRoles, isValidAriaRole } from \"@a11ytools/aria-roles\";\n\n// Type-safe role definition\nconst myRole: AriaRole = ariaRoles.button;\n\n// Type narrowing with isValidAriaRole\nfunction setRole(element: HTMLElement, role: string) {\n  if (isValidAriaRole(role)) {\n    // TypeScript knows 'role' is of type AriaRole here\n    element.setAttribute('role', role);\n  } else {\n    console.warn(`Invalid ARIA role: ${role}`);\n  }\n}\n```\n\n### React Example\n```tsx\nimport React from 'react';\nimport { ariaRoles } from '@a11ytools/aria-roles';\n\nfunction AccessibleButton({ children, onClick }) {\n  return (\n    <div \n      role={ariaRoles.button} \n      onClick={onClick}\n      tabIndex={0}\n      onKeyDown={(e) => {\n        if (e.key === 'Enter' || e.key === ' ') {\n          onClick();\n        }\n      }}\n    >\n      {children}\n    </div>\n  );\n}\n```\n\n### Vue Example\n```vue\n<template>\n  <div \n    :role=\"ariaRoles.button\"\n    @click=\"onClick\"\n    tabindex=\"0\"\n    @keydown=\"handleKeyDown\"\n  >\n    <slot></slot>\n  </div>\n</template>\n\n<script>\nimport { ariaRoles } from '@a11ytools/aria-roles';\n\nexport default {\n  setup() {\n    const handleKeyDown = (e) => {\n      if (e.key === 'Enter' || e.key === ' ') {\n        onClick();\n      }\n    };\n    \n    return {\n      ariaRoles,\n      handleKeyDown\n    };\n  },\n  methods: {\n    onClick() {\n      // Handle click\n    }\n  }\n}\n</script>\n```\n\n### 🧪 Testing Example\n\n```tsx\nimport { render, screen } from '@testing-library/react';\nimport { ariaRoles, isValidAriaRole } from '@a11ytools/aria-roles';\n\n// React Testing Library - use ariaRoles for type-safe queries\ntest('Component uses correct ARIA roles', () => {\n  render(<MyComponent />);\n  \n  // Query elements by their roles using ariaRoles\n  const button = screen.getByRole(ariaRoles.button);\n  const navigation = screen.getByRole(ariaRoles.navigation);\n  \n  // Verify elements have proper attributes\n  expect(button).toHaveAttribute('aria-pressed', 'false');\n  expect(navigation).toBeInTheDocument();\n});\n\n// Validate all roles in a component\ntest('All roles are valid', () => {\n  const { container } = render(<MyComponent />);\n  \n  // Check that all role attributes are valid\n  container.querySelectorAll('[role]').forEach(element => {\n    const role = element.getAttribute('role');\n    expect(isValidAriaRole(role)).toBe(true);\n  });\n});\n```\n\n## 🔄 API Reference\n\n### `getAllAriaRoles()`\nReturns an array of all valid ARIA roles as strings.\n\n```ts\nfunction getAllAriaRoles(): AriaRole[]\n```\n\n### `isValidAriaRole(role)`\nValidates if a string is a valid ARIA role. In TypeScript, this function acts as a type guard.\n\n```ts\nfunction isValidAriaRole(role: string): role is AriaRole\n```\n\n### `ariaRoles`\nAn object that provides type-safe access to all ARIA role names. Each property is named after an ARIA role and returns the role name as a string.\n\n```ts\nconst ariaRoles: Record<AriaRole, AriaRole>\n```\n\n### `AriaRole` (TypeScript only)\nA TypeScript type that represents all valid ARIA roles.\n\n```ts\ntype AriaRole = 'alert' | 'alertdialog' | 'application' | /* ... */;\n```\n\n## 🤝 Contributing\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## 📜 License\nThis project is licensed under the MIT License.\n","readmeFilename":"README.md"}