{"_id":"aria-attribute-types","_rev":"7-1954cb81b22aadccceb3b1900b0c3992","name":"aria-attribute-types","dist-tags":{"latest":"1.0.0"},"versions":{"0.0.0":{"name":"aria-attribute-types","version":"0.0.0","keywords":[],"author":"","license":"ISC","_id":"aria-attribute-types@0.0.0","maintainers":[{"name":"ymrl","email":"ymrl@ymrl.net"}],"dist":{"shasum":"be883f1494a93cad79d39ef02e5e38bfb4600f7a","tarball":"https://registry.npmjs.org/aria-attribute-types/-/aria-attribute-types-0.0.0.tgz","fileCount":66,"integrity":"sha512-Eq2kKTvt5UUTCHRtxdEq/ya4Xo+Q1XxRGj0huwzPvcoBr82HwDO+F1lTXj5PRCeZdF9UBRZPxUw3b3ANYV7mAA==","signatures":[{"sig":"MEYCIQCY7m3J7hXcE1SbYvht7Iiob9n1dXnlwJnVc5LPMG31WwIhALJfym+fYQ/pdPHFLp1U3FpWnVrowVme9uhU681J8C0x","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":409229},"_from":"file:aria-attribute-types-0.0.0.tgz","exports":{".":{"types":"./dist/lib/index.d.ts","import":"./dist/lib/index.js"}},"scripts":{"dev":"tsc --watch","lint":"prettier . --check && eslint .","test":"vitest --run","build":"tsc","clean":"rm -rf dist","lint:fix":"prettier . --write && eslint . --fix","typecheck":"vitest --typecheck --run","test:watch":"vitest","typecheck:watch":"vitest --typecheck"},"_npmUser":{"name":"ymrl","email":"ymrl@ymrl.net"},"_resolved":"/private/var/folders/9k/wmkbz4tj1t9741ly5899qwv00000gn/T/be8b8840c9219da89e0a0bc61041bdc4/aria-attribute-types-0.0.0.tgz","_integrity":"sha512-Eq2kKTvt5UUTCHRtxdEq/ya4Xo+Q1XxRGj0huwzPvcoBr82HwDO+F1lTXj5PRCeZdF9UBRZPxUw3b3ANYV7mAA==","_npmVersion":"11.1.0","description":"Type-safe [WAI-ARIA](https://www.w3.org/TR/wai-aria-1.2/) attributes for TypeScript.","directories":{},"_nodeVersion":"23.8.0","_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.25.0","vitest":"^3.1.3","globals":"^16.0.0","prettier":"3.5.2","@eslint/js":"^9.25.0","typescript":"~5.8.3","typescript-eslint":"^8.30.1","eslint-config-prettier":"^10.1.5"},"_npmOperationalInternal":{"tmp":"tmp/aria-attribute-types_0.0.0_1747495109708_0.3561925030909163","host":"s3://npm-registry-packages-npm-production"}},"0.0.1":{"name":"aria-attribute-types","version":"0.0.1","keywords":[],"author":"","license":"ISC","_id":"aria-attribute-types@0.0.1","maintainers":[{"name":"ymrl","email":"ymrl@ymrl.net"}],"dist":{"shasum":"505397cfd0d0ae36bb9db96f5b85985bf1dec9fe","tarball":"https://registry.npmjs.org/aria-attribute-types/-/aria-attribute-types-0.0.1.tgz","fileCount":93,"integrity":"sha512-CKQbeFUTTAFTh4+O/RhUMHxBS1yLROwW0x72OzcyzX8iKCs5/2aPDdIR9+PYabYVriUSBbHi0XqlVm9FfvOj8Q==","signatures":[{"sig":"MEYCIQDBKWJlvwWjsqmgDLhoX/ijV6cGUSpKkJ7t0TqD69PrewIhANvWmtMU+XS8NHXR+cogZdIn9PFqgdeE52ICRus4b2R/","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":551382},"main":"dist/lib/index.js","_from":"file:aria-attribute-types-0.0.1.tgz","types":"dist/lib/index.d.ts","exports":{".":{"types":"./dist/lib/index.d.ts","import":"./dist/lib/index.js"}},"scripts":{"dev":"tsc --watch","lint":"prettier . --check && eslint .","test":"vitest --run","build":"tsc","clean":"rm -rf dist","lint:fix":"prettier . --write && eslint . --fix","typecheck":"vitest --typecheck --run","test:watch":"vitest","typecheck:watch":"vitest --typecheck"},"_npmUser":{"name":"ymrl","email":"ymrl@ymrl.net"},"_resolved":"/private/var/folders/9k/wmkbz4tj1t9741ly5899qwv00000gn/T/f720ad720161f29bd263b4bfbb15895b/aria-attribute-types-0.0.1.tgz","_integrity":"sha512-CKQbeFUTTAFTh4+O/RhUMHxBS1yLROwW0x72OzcyzX8iKCs5/2aPDdIR9+PYabYVriUSBbHi0XqlVm9FfvOj8Q==","_npmVersion":"11.3.0","description":"Type-safe [WAI-ARIA](https://www.w3.org/TR/wai-aria-1.2/) attributes for TypeScript.","directories":{},"_nodeVersion":"24.0.2","_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.25.0","vitest":"^3.1.3","globals":"^16.0.0","prettier":"3.5.2","@eslint/js":"^9.25.0","typescript":"~5.8.3","typescript-eslint":"^8.30.1","eslint-config-prettier":"^10.1.5"},"_npmOperationalInternal":{"tmp":"tmp/aria-attribute-types_0.0.1_1747926118211_0.9018133556978274","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"aria-attribute-types","version":"0.0.3","keywords":["aria","wai-aria","typescript","accessibility"],"author":{"name":"ymrl"},"license":"ISC","_id":"aria-attribute-types@0.0.3","maintainers":[{"name":"ymrl","email":"ymrl@ymrl.net"}],"homepage":"https://github.com/ymrl/aria-attribute-types","bugs":{"url":"https://github.com/ymrl/aria-attribute-types/issues"},"dist":{"shasum":"2f8cce117ea4f171c865f557ed1129541b72faa5","tarball":"https://registry.npmjs.org/aria-attribute-types/-/aria-attribute-types-0.0.3.tgz","fileCount":87,"integrity":"sha512-6fldL7adgb2cnhqIy8+wVf+u/SADxU9C5kwqFKm7PxgffeckRtP2qfTQMlIN0rIKfLbiBauB3gVt+I+iaaGR1A==","signatures":[{"sig":"MEUCIQCzgFKdjHuu9VSOSPIQLIAj9ZjOxjXDJX7Fbwj3Tks7ZAIgSN3DrlMBSRgeq+dpCg5yjlXRSKsJcsCCFmHFZj9QEyc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":551600},"main":"dist/lib/index.js","_from":"file:aria-attribute-types-0.0.3.tgz","types":"dist/lib/index.d.ts","exports":{".":{"types":"./dist/lib/index.d.ts","import":"./dist/lib/index.js"}},"scripts":{"dev":"tsc --watch","lint":"prettier . --check && eslint .","test":"vitest --run","build":"tsc","clean":"rm -rf dist","lint:fix":"prettier . --write && eslint . --fix","typecheck":"vitest --typecheck --run","test:watch":"vitest","typecheck:watch":"vitest --typecheck"},"_npmUser":{"name":"ymrl","email":"ymrl@ymrl.net"},"_resolved":"/private/var/folders/9k/wmkbz4tj1t9741ly5899qwv00000gn/T/0d0a69377de1f36f415c73c07bc3737d/aria-attribute-types-0.0.3.tgz","_integrity":"sha512-6fldL7adgb2cnhqIy8+wVf+u/SADxU9C5kwqFKm7PxgffeckRtP2qfTQMlIN0rIKfLbiBauB3gVt+I+iaaGR1A==","repository":{"url":"git+https://github.com/ymrl/aria-attribute-types.git","type":"git"},"_npmVersion":"11.3.0","description":"Type-safe WAI-ARIA attributes for TypeScript.","directories":{},"_nodeVersion":"24.0.2","_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.25.0","vitest":"^3.1.3","globals":"^16.0.0","prettier":"3.5.2","@eslint/js":"^9.25.0","typescript":"~5.8.3","typescript-eslint":"^8.30.1","eslint-config-prettier":"^10.1.5"},"_npmOperationalInternal":{"tmp":"tmp/aria-attribute-types_0.0.3_1747989203132_0.4473639540972425","host":"s3://npm-registry-packages-npm-production"}},"0.0.4":{"name":"aria-attribute-types","version":"0.0.4","keywords":["aria","wai-aria","typescript","accessibility"],"author":{"name":"ymrl"},"license":"ISC","_id":"aria-attribute-types@0.0.4","maintainers":[{"name":"ymrl","email":"ymrl@ymrl.net"}],"homepage":"https://github.com/ymrl/aria-attribute-types","bugs":{"url":"https://github.com/ymrl/aria-attribute-types/issues"},"dist":{"shasum":"ac13e11390427b8c70d6039a6fa46404d6197a46","tarball":"https://registry.npmjs.org/aria-attribute-types/-/aria-attribute-types-0.0.4.tgz","fileCount":87,"integrity":"sha512-CuWdYE21PnU0QZWlSTyha6bpwPqcilhQttSn2/iHsdE4TNqspkFwkOezk7AEFWbhaV3bXYDu3wRsCJ/5coKDhQ==","signatures":[{"sig":"MEUCIQCmsqhVQiGERfcbQ/tXggHAvmMr4A5/FSawnHSwiTeOSQIgXuMQoyBKd4UqY/v6ML2imqDeY088tsV0n4yQuHsAOek=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":554270},"main":"dist/lib/index.js","_from":"file:aria-attribute-types-0.0.4.tgz","types":"dist/lib/index.d.ts","exports":{".":{"types":"./dist/lib/index.d.ts","import":"./dist/lib/index.js"}},"scripts":{"dev":"tsc --watch","lint":"prettier . --check && eslint .","test":"vitest --run","build":"tsc","clean":"rm -rf dist","lint:fix":"prettier . --write && eslint . --fix","typecheck":"vitest --typecheck --run","test:watch":"vitest","typecheck:watch":"vitest --typecheck"},"_npmUser":{"name":"ymrl","email":"ymrl@ymrl.net"},"_resolved":"/tmp/6d95b4f3856ece050dab9b94f903602f/aria-attribute-types-0.0.4.tgz","_integrity":"sha512-CuWdYE21PnU0QZWlSTyha6bpwPqcilhQttSn2/iHsdE4TNqspkFwkOezk7AEFWbhaV3bXYDu3wRsCJ/5coKDhQ==","repository":{"url":"git+https://github.com/ymrl/aria-attribute-types.git","type":"git"},"_npmVersion":"11.3.0","description":"Type-safe WAI-ARIA attributes for TypeScript.","directories":{},"_nodeVersion":"24.1.0","_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.25.0","vitest":"^3.1.3","globals":"^16.0.0","prettier":"3.5.2","@eslint/js":"^9.25.0","typescript":"~5.8.3","typescript-eslint":"^8.30.1","eslint-config-prettier":"^10.1.5"},"_npmOperationalInternal":{"tmp":"tmp/aria-attribute-types_0.0.4_1748673361329_0.8445383479348558","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"aria-attribute-types","version":"1.0.0","description":"Type-safe WAI-ARIA attributes for TypeScript.","homepage":"https://github.com/ymrl/aria-attribute-types","repository":{"type":"git","url":"git+https://github.com/ymrl/aria-attribute-types.git"},"main":"dist/lib/index.js","types":"dist/lib/index.d.ts","exports":{".":{"import":"./dist/lib/index.js","types":"./dist/lib/index.d.ts"}},"keywords":["aria","wai-aria","typescript","accessibility"],"author":{"name":"ymrl"},"license":"ISC","devDependencies":{"@eslint/js":"^9.25.0","eslint":"^9.25.0","eslint-config-prettier":"^10.1.5","globals":"^16.0.0","prettier":"3.5.2","typescript":"~5.8.3","typescript-eslint":"^8.30.1","vitest":"^3.1.3"},"scripts":{"test:watch":"vitest","test":"vitest --run","typecheck":"vitest --typecheck --run","typecheck:watch":"vitest --typecheck","lint":"prettier src --check && eslint src","lint:fix":"prettier src --write && eslint src --fix","build":"tsc","dev":"tsc --watch","clean":"rm -rf dist"},"_id":"aria-attribute-types@1.0.0","bugs":{"url":"https://github.com/ymrl/aria-attribute-types/issues"},"_integrity":"sha512-Y9LGoxcZYT7eeFdTS3ZSpTXdMJlUDzPNQPy6820G6c3htZK6/uquePCeViEofEe3AD6Np+mt+kRmgcXK4XTaiw==","_resolved":"/tmp/ddbf39526ada9a3334680019922eb367/aria-attribute-types-1.0.0.tgz","_from":"file:aria-attribute-types-1.0.0.tgz","_nodeVersion":"24.1.0","_npmVersion":"11.3.0","dist":{"integrity":"sha512-Y9LGoxcZYT7eeFdTS3ZSpTXdMJlUDzPNQPy6820G6c3htZK6/uquePCeViEofEe3AD6Np+mt+kRmgcXK4XTaiw==","shasum":"eb760944e2da8f8508ae806a01b4cc8e407dbcc2","tarball":"https://registry.npmjs.org/aria-attribute-types/-/aria-attribute-types-1.0.0.tgz","fileCount":95,"unpackedSize":1471095,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIBAqlVj2kyD8WGiBPfdR8bd+A6H3HZhGfzcNh3MZ6s5+AiA/fkTM5KSfq3riHlUf7Pj75itbWo+zvl4B5cWtRfPZJA=="}]},"_npmUser":{"name":"ymrl","email":"ymrl@ymrl.net"},"directories":{},"maintainers":[{"name":"ymrl","email":"ymrl@ymrl.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/aria-attribute-types_1.0.0_1748701973223_0.46035913822675045"},"_hasShrinkwrap":false}},"time":{"created":"2025-05-17T15:18:29.610Z","modified":"2025-05-31T14:32:53.577Z","0.0.0":"2025-05-17T15:18:29.926Z","0.0.1":"2025-05-22T15:01:58.415Z","0.0.2":"2025-05-23T08:26:45.780Z","0.0.3":"2025-05-23T08:33:23.331Z","0.0.4":"2025-05-31T06:36:01.532Z","1.0.0":"2025-05-31T14:32:53.390Z"},"bugs":{"url":"https://github.com/ymrl/aria-attribute-types/issues"},"author":{"name":"ymrl"},"license":"ISC","homepage":"https://github.com/ymrl/aria-attribute-types","keywords":["aria","wai-aria","typescript","accessibility"],"repository":{"type":"git","url":"git+https://github.com/ymrl/aria-attribute-types.git"},"description":"Type-safe WAI-ARIA attributes for TypeScript.","maintainers":[{"name":"ymrl","email":"ymrl@ymrl.net"}],"readme":"# aria-attribute-types\n\nType-safe [WAI-ARIA](https://www.w3.org/TR/wai-aria-1.2/) attributes for TypeScript.\n\n## Overview\n\nThis package provides type definitions for WAI-ARIA attributes in both camelCase and kebab-case, designed for use in TypeScript environments such as React or other JSX-based frameworks.\n\nIn JSX, TypeScript does not perform type checking on unknown kebab-case attributes. As a result, typos in ARIA attributes can go unnoticed. To address this, aria-attribute-types offers:\n\n- CamelCase ARIA props, such as `ariaLabel`, `ariaHidden`, etc., to enable full type checking in JSX.\n- A conversion utility to transform camelCase ARIA props into kebab-case (ariaLabel → aria-label) for rendering to HTML.\n- Role-based ARIA type definitions, ensuring only valid ARIA attributes are used for a given WAI-ARIA role.\n\nThis helps developers write more accessible, robust code with confidence and better editor support.\n\n## Installation\n\n```bash\n# Using npm\nnpm install -D aria-attribute-types\n\n# Using yarn\nyarn add -D aria-attribute-types\n\n# Using pnpm\npnpm add -D aria-attribute-types\n```\n\n## Usage\n\n```tsx\nimport { convertCamelizedAttributes } from \"aria-attribute-types\";\nimport type {\n  // Types for `aria-*` attributes in camelCase\n  CamelCaseAria,\n  // Types for `role` attributes\n  Role\n} from \"aria-attribute-types\";\n\nexport const Link = ({\n  children,\n  ...props\n}: {\n  children?: React.ReactNode;\n  href: string;\n  target?: string;\n  className?: string;\n} & CamelCaseAria<R extends undefined ? \"link\" : R>) => {\n  return (\n    <a\n      // Convert camelCase attributes to kebab-case for HTML rendering.\n      // It will affect only `^aria` attributes.\n      {...convertCamelizedAttributes(props)}\n    >\n      {children}\n    </a>\n  );\n};\n```\n\n## Included Types\n\nThere are three formats of types included in this package:\n\n- **kebab-case**: ARIA attributes in kebab-case format, such as `aria-label`, `aria-describedby`, etc.\n- **camelCase**: ARIA attributes in camelCase format, such as `ariaLabel`, `ariaDescribedBy`, etc.\n- **Bodies**: camelCase ARIA attribute format excluding `aria-` prefix, such as `label`, `describedBy`, etc.\n\n\n### Roles\n\nUnion types for WAI-ARIA roles:\n\n- `DefinedRole`: Valid WAI-ARIA 1.2 roles excluding abstract roles.\n- `Role`: Union type of `DefinedRole` and `\\`${string} ${DefinedRole}\\``.\n\n```ts\nimport type { DefinedRole, Role } from \"aria-attribute-types\";\n\nconst role: DefinedRole = \"button\"; // Valid\nconst roleWithNamespace: Role = \"newbutton button\"; // Valid\nconst invalidRole: ROle = \"newbutton\"; // Invalid, not a defined role\n```\n\n### Attributes by Role\n\n\n- `CamelCaseAria<R extends Role>`: camelCase ARIA attributes for a given role `R`.\n- `KebabCaseAria<R extends Role>`: kebab-case ARIA attributes for a given role `R`.\n- `AriaBodies<R extends Role>`: camelCase ARIA attribute bodies (without `aria-` prefix) for a given role `R`.\n\n```ts\nimport type { CamelCaseAria, KebabCaseAria, AriaBodies, Role } from \"aria-attribute-types\";\n\nconst camelCaseAttributes: CamelCaseAria<\"button\"> = {\n  ariaLabel: \"Submit\",\n  ariaDisabled: false,\n  ariaDescribedBy: \"description-id\",\n  ariaPressed: true,\n};\nconst kebabCaseAttributes: KebabCaseAria<\"button\"> = {\n  \"aria-label\": \"Submit\",\n  \"aria-disabled\": false,\n  \"aria-describedby\": \"description-id\",\n  \"aria-pressed\": true,\n};\nconst ariaBodies: AriaBodies<\"button\"> = {\n  label: \"Submit\",\n  disabled: false,\n  describedBy: \"description-id\",\n  pressed: true,\n};\n```\n\n### All Attributes\n\n- `AllKebabCaseAriaAttributes`: All ARIA attributes in kebab-case format.\n- `AllCamelCaseAriaAttributes`: All ARIA attributes in camelCase format.\n- `AllAriaAttributeBodies`: All ARIA attribute bodies in camelCase format (without `aria-` prefix).\n\n\n## Utility Functions\n\n- `convertCamelizedAttributes(props: {[key: string]: unknown} ): Record<string, unknown>`: Converts camelCase ARIA attributes to kebab-case for HTML rendering.\n\n```ts\nimport { convertCamelizedAttributes } from \"aria-attribute-types\";\n\n\nconst props = {\n  ariaActiveDescendant: \"foo\",\n  ariaAtomic: true,\n  ariaAutoComplete: \"none\",\n  ariaColIndex: 1,\n  \"data-foo\": \"bar\",\n  tabIndex: 0,\n  href: \"https://example.com\",\n};\n\nconst result = convertCamelizedAttributes(props);\n// result will be:\n{\n  \"aria-activedescendant\": \"foo\",\n  \"aria-atomic\": true,\n  \"aria-autocomplete\": \"none\",\n  \"aria-colindex\": 1,\n  \"data-foo\": \"bar\",\n  tabIndex: 0,\n  href: \"https://example.com\",\n}\n```\n","readmeFilename":"README.md"}