{"name":"react-accessible-accordion","version":"5.0.1","keywords":["react","component","accordion","collapse","accessible","accessibility","wai-aria","aria","a11y"],"license":"MIT","_id":"react-accessible-accordion@5.0.1","maintainers":[{"name":"springloaders","email":"hello@springload.co.nz"},{"name":"thibaudcolas","email":"thibaudcolas@gmail.com"},{"name":"holloway","email":"matthew@holloway.co.nz"},{"name":"synecdokey","email":"emilia@springload.co.nz"},{"name":"yuzima","email":"yuzi.ma1990@gmail.com"},{"name":"ryami333","email":"mitch@mitch-ryan.com"},{"name":"vincentaudebert","email":"vincent.audebert@yahoo.fr"},{"name":"samanthaksanders","email":"samantha.k.sanders@gmail.com"}],"contributors":[{"url":"https://github.com/vincentaudebert","name":"Vincent Audebert"},{"url":"https://github.com/ryami333","name":"Mitch Ryan"},{"url":"https://github.com/samanthaksanders","name":"Samantha Sanders"},{"url":"https://github.com/thibaudcolas","name":"Thibaud Colas"},{"url":"https://github.com/catepalmer","name":"Cate Palmer"},{"url":"https://github.com/janzenz","name":"Janzen Zarzoso"},{"url":"https://github.com/synecdokey","name":"Emilia Zapata"}],"homepage":"https://github.com/springload/react-accessible-accordion#readme","bugs":{"url":"https://github.com/springload/react-accessible-accordion/issues"},"dist":{"shasum":"b406822d28e945bf7c2ffefbcd484bd6a8e679f5","tarball":"http://registry-npm.ywwl.com/react-accessible-accordion/download/react-accessible-accordion-5.0.1.tgz","fileCount":23,"integrity":"sha512-EIXkdQs4BObemHtRizVIq4wnbS3z0TPLAmiR2nZSG0Z3Mpm7pr8cwBddK5OcuWniRJ8OpJBqtlpUz0XnQCV06w==","signatures":[{"sig":"MEUCIExyvoS34ttfjdNvzSemO4xyXMIQhoaQxEcVZgjECaK7AiEA8fI7KNMmpn4b1QtJBan0Ci3cL/e9Ae8tTJc5KBy4ktA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":108274,"size":22904,"noattachment":false,"key":"/react-accessible-accordion/-/react-accessible-accordion-5.0.1.tgz"},"main":"dist/umd/index.js","husky":{"hooks":{"pre-commit":"lint-staged && yarn typecheck"}},"types":"dist/types/index.d.ts","module":"dist/es/index.js","gitHead":"80897350890ac0d1a855c5d6ef87ef31f3e44092","scripts":{"lint":"eslint src","test":"jest","build":"rimraf \"dist/**/*\" && yarn build:rollup && yarn build:types && yarn build:css","pages":"yarn build:demo && yarn gh-pages -d demo/dist","deploy":"yarn pages && ./bin/deploy.sh","format":"prettier \"**/*\" --write","build:css":"cp src/css/*.css dist","coveralls":"cat ./coverage/lcov.info | coveralls","typecheck":"tsc --project .","build:demo":"rimraf \"demo/dist/**/*\" && yarn webpack --context=demo --mode=production --progress --output-path=demo/dist && cp demo/src/CNAME demo/dist/CNAME","start-demo":"webpack-dev-server --context=demo --mode=development --hot","test:watch":"jest --watch","build:types":"yarn tsc --project tsconfig.declaration.json","build:rollup":"rollup -c","test:coverage":"jest --coverage","prepublishOnly":"yarn typecheck && yarn lint && yarn test && yarn build","test:integration":"yarn build:integration && yarn jest --config=integration/jest.config.js integration","build:integration":"rimraf \"integration/dist/**/*\" && yarn webpack --context=integration --mode=production --progress --output-path=integration/dist","test:coverage:watch":"jest --coverage --watch"},"_npmUser":{"name":"springloaders","email":"hello@springload.co.nz"},"repository":{"url":"git+https://github.com/springload/react-accessible-accordion.git","type":"git"},"_npmVersion":"6.14.16","description":"Accessible Accordion component for React","directories":{},"jsnext:main":"dist/es/index.js","lint-staged":{"linters":{"*.{ts,tsx}":["yarn lint"]}},"_nodeVersion":"12.22.12","_hasShrinkwrap":false,"devDependencies":{"jest":"^24.5.0","uuid":"^3.3.2","husky":"^2.4.1","react":"17","eslint":"^7.4.0","rimraf":"^2.6.3","rollup":"^1.7.4","webpack":"^4.29.6","gh-pages":"^2.0.1","prettier":"^2.0.5","coveralls":"^3.0.3","puppeteer":"2.0.0","react-dom":"17","@babel/cli":"^7.4.4","babel-core":"^7.0.0-bridge.0","babel-jest":"^24.8.0","css-loader":"^3.0.0","typescript":"^3.9.5","@babel/core":"^7.4.5","@types/jest":"^24.0.15","@types/uuid":"^3.4.4","file-loader":"^4.0.0","lint-staged":"^8.1.5","webpack-cli":"^3.3.0","@types/react":"^18.0.5","babel-loader":"^8.0.6","style-loader":"^0.23.1","@babel/polyfill":"^7.4.4","@types/react-dom":"^18.0.1","@babel/preset-env":"^7.4.5","webpack-dev-server":"^3.2.1","@babel/preset-react":"^7.0.0","eslint-plugin-react":"^7.20.3","html-webpack-plugin":"^3.2.0","react-test-renderer":"^16.8.6","rollup-plugin-babel":"^4.2.0","rollup-plugin-replace":"^2.1.1","@testing-library/react":"12","eslint-plugin-jsx-a11y":"^6.3.1","rollup-plugin-commonjs":"^10.0.0","mini-css-extract-plugin":"^0.7.0","@babel/preset-typescript":"^7.1.0","react-syntax-highlighter":"^12.2.1","@typescript-eslint/parser":"^3.6.0","@types/react-test-renderer":"^18.0.0","rollup-plugin-node-resolve":"^5.1.0","@types/react-syntax-highlighter":"^11.0.4","@typescript-eslint/eslint-plugin":"^3.6.0","@babel/plugin-proposal-class-properties":"^7.4.4","@babel/plugin-proposal-nullish-coalescing-operator":"^7.10.1"},"peerDependencies":{"react":"^16.3.2 || ^17.0.0 || ^18.0.0","react-dom":"^16.3.3 || ^17.0.0 || ^18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/react-accessible-accordion_5.0.1_1744864933792_0.07261053774530768","host":"s3://npm-registry-packages-npm-production"},"readme":"[react-accessible-accordion](https://springload.github.io/react-accessible-accordion/)\n[![npm](https://img.shields.io/npm/v/react-accessible-accordion.svg?style=flat-square)](https://www.npmjs.com/package/react-accessible-accordion)\n[![Accessibility status](https://img.shields.io/badge/a11y-tested-brightgreen.svg)](http://wave.webaim.org/report#/https://springload.github.io/react-accessible-accordion/)\n=========\n\n## ⚠️ Project status\n\nIn most cases, you no longer need a JS library like this to render fully functional, accessible accordions. For that reason, **this project is no longer maintained**. \n\nThis is because native [HTML Disclosure](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/summary) (aka `<details>`/`<summary`>) elements are now [widely supported](https://caniuse.com/details). \n\nNative disclosures offer several advantages over any JS-based solutions. For instance: \n- Because there is no JS to download/parse, they are far more performant.\n- They are framework-agnostic, and will work the same way whether you're using React, [other framework], or plain old HTML.\n- Collapsed content can still be found via find-on-page (<key>ctrl</key>/<key>command</key>+<key>f</key>) in supporting browsers, including Chrome.\n\n## Demo\n\n[Try a demo now](https://springload.github.io/react-accessible-accordion/).\n\n## Usage\n\nFirst, grab the package from npm:\n\n```sh\nnpm install --save react-accessible-accordion\n```\n\nThen, import the editor and use it in your code. Here is a\n[basic example](https://springload.github.io/react-accessible-accordion/):\n\n```jsx\nimport React from 'react';\n\nimport {\n    Accordion,\n    AccordionItem,\n    AccordionItemHeading,\n    AccordionItemButton,\n    AccordionItemPanel,\n} from 'react-accessible-accordion';\n\n// Demo styles, see 'Styles' section below for some notes on use.\nimport 'react-accessible-accordion/dist/fancy-example.css';\n\nexport default function Example() {\n    return (\n        <Accordion>\n            <AccordionItem>\n                <AccordionItemHeading>\n                    <AccordionItemButton>\n                        What harsh truths do you prefer to ignore?\n                    </AccordionItemButton>\n                </AccordionItemHeading>\n                <AccordionItemPanel>\n                    <p>\n                        Exercitation in fugiat est ut ad ea cupidatat ut in\n                        cupidatat occaecat ut occaecat consequat est minim minim\n                        esse tempor laborum consequat esse adipisicing eu\n                        reprehenderit enim.\n                    </p>\n                </AccordionItemPanel>\n            </AccordionItem>\n            <AccordionItem>\n                <AccordionItemHeading>\n                    <AccordionItemButton>\n                        Is free will real or just an illusion?\n                    </AccordionItemButton>\n                </AccordionItemHeading>\n                <AccordionItemPanel>\n                    <p>\n                        In ad velit in ex nostrud dolore cupidatat consectetur\n                        ea in ut nostrud velit in irure cillum tempor laboris\n                        sed adipisicing eu esse duis nulla non.\n                    </p>\n                </AccordionItemPanel>\n            </AccordionItem>\n        </Accordion>\n    );\n}\n```\n\n### Styles\n\nWe strongly encourage you to write your own styles for your accordions, but\nwe've published the styles used on our demo page to help you get up and running:\n\n```js\nimport 'react-accessible-accordion/dist/fancy-example.css';\n```\n\nWe recommend that you copy them into your own app and modify them to suit your\nneeds, particularly if you're using your own `className`s.\n\n## Component API\n\n### Accordion\n\n#### allowMultipleExpanded : `boolean` [*optional*, default: `false`]\n\nDon't autocollapse items when expanding other items.\n\n#### allowZeroExpanded : `boolean` [*optional*, default: `false`]\n\nAllow the only remaining expanded item to be collapsed.\n\n#### preExpanded: `string[]` [_optional_, default: `[]`]\n\nAccepts an array of strings and any `AccordionItem` whose `uuid` prop matches\nany one of these strings will be expanded on mount.\n\n#### className : `string` [*optional*, default: `'accordion'`]\n\nClass(es) to apply to element.\n\n#### onChange : `(string[]) => void` [*optional*]\n\nCallback which is invoked when items are expanded or collapsed. Gets passed\n`uuid`s of the currently expanded `AccordionItem`s.\n\n---\n\n### AccordionItem\n\n#### className : `string` [*optional*, default: `accordion__item`]\n\nClass(es) to apply to element.\n\n#### uuid : `string|number` [*optional*]\n\nRecommended for use with `onChange`. Will be auto-generated if not provided.\n\n#### dangerouslySetExpanded: `boolean` [*optional*]\n\nEnables external control of the expansion.\n\n> Warning: This may impact accessibility negatively, use at your own risk\n\n---\n\n### AccordionItemHeading\n\n#### className : `string` [*optional*, default: `'accordion__heading'`]\n\nClass(es) to apply to the 'heading' element.\n\n#### aria-level : `number` [*optional*, default: `3`]\n\nSemantics to apply to the 'heading' element. A value of `1` would make your\nheading element hierarchically equivalent to an `<h1>` tag, and likewise a value\nof `6` would make it equivalent to an `<h6>` tag.\n\n### AccordionItemButton\n\n#### className : `string` [*optional*, default: `'accordion__button'`]\n\nClass(es) to apply to the 'button' element.\n\n---\n\n### AccordionItemPanel\n\n#### className : `string` [*optional*, default: `'accordion__panel'`]\n\nClass(es) to apply to element.\n\n#### region: `boolean`\n\nMake the element have a region role.\n\n---\n\n### AccordionItemState\n\n#### children : `({ expanded: boolean, disabled: boolean }): JSX.Element` [**required**]\n\n---\n\n## Helpers\n\n### resetNextUuid : `(): void`\n\nResets the internal counter for Accordion items' identifiers (including `id`\nattributes). For use in test suites and isomorphic frameworks.\n\n---\n\n## Accessibility Best-Practice\n\nAuthoring an 'accordion' component to the\n[WAI ARIA spec](https://www.w3.org/TR/wai-aria-practices-1.1/#accordion) can be\ncomplex, but `React Accessible Accordion` does most of the heavy lifting for\nyou, including:\n\n-   Applying appropriate aria attributes (`aria-expanded`, `aria-controls`,\n    `aria-disabled`, `aria-hidden` and `aria-labelledby`).\n-   Applying appropriate `role` attributes (`button`, `heading`, `region`).\n-   Applying appropriate `tabindex` attributes.\n-   Applying keyboard interactivity ('space', 'end', 'tab', 'up', 'down', 'home'\n    and 'end' keys).\n\nHowever, there's still a couple of things you need to keep in mind to remain\nspec-compliant:\n\n-   Only ever use\n    [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content)\n    inside of your `AccordionItemHeading` component. If in doubt, use text only.\n-   Always provide an `aria-level` prop to your `AccordionItemHeading`\n    component, _especially_ if you are nesting accordions. This attribute is a\n    signal used by assistive technologies (eg. screenreaders) to determine which\n    heading level (ie. `h1`-`h6`) to treat your heading as.\n\nIf you have any questions about your implementation, then please don't be afraid\nto get in touch via our\n[issues](https://github.com/springload/react-accessible-accordion/issues).\n\n## FAQs\n\n### React 18?\n\nRAA supports React 18, and the new out-of-order streaming feature. See the\nCHANGELOG for details.\n\n### Which design patterns does this component aim to solve?\n\nThose described by the WAI ARIA spec's description of an 'accordion':\n\n> An accordion is a vertically stacked set of interactive headings that each\n> contain a title, content snippet, or thumbnail representing a section of\n> content. The headings function as controls that enable users to reveal or hide\n> their associated sections of content. Accordions are commonly used to reduce\n> the need to scroll when presenting multiple sections of content on a single\n> page.\n\n### Which design patterns does this component NOT aim to solve?\n\nComponents which are \"accordion-like\" but do not match the WAI ARIA spec's\ndescription, as written above. By \"accordion-like\", we mean components which\nhave collapsible items but require bespoke interactive mechanisms in order to\nexpand, collapse and 'disable' them. This includes (but is not limited to)\nmulti-step forms, like those seen in many cart/checkout flows, which we believe\nrequire (other) complex markup in order to be considered 'accessible'. This also\nincludes disclosure widgets.\n\n### How do I disable an item?\n\nSee \"Which design patterns does this component NOT aim to solve?\".\n\n## Browser Support\n\n**Supported browser / device versions:**\n\n| Browser       | Device/OS | Version |\n| ------------- | --------- | ------- |\n| Mobile Safari | iOS       | latest  |\n| Chrome        | Android   | latest  |\n| IE            | Windows   | 11      |\n| MS Edge       | Windows   | latest  |\n| Chrome        | Desktop   | latest  |\n| Firefox       | Desktop   | latest  |\n| Safari        | OSX       | latest  |\n","publish_time":1744864933992,"_cnpm_publish_time":1744864933992,"dist-tags":{"latest":"5.0.1","next":"2.4.4-beta.1"}}