{"name":"rc-collapse","version":"4.0.0","description":"rc-collapse ui component for react","keywords":["react","react-component","react-rc-collapse","rc-collapse","collapse","accordion"],"homepage":"http://github.com/react-component/collapse","bugs":{"url":"http://github.com/react-component/collapse/issues"},"repository":{"type":"git","url":"git+ssh://git@github.com/react-component/collapse.git"},"license":"MIT","main":"./lib/index","module":"./es/index","typings":"es/index.d.ts","scripts":{"compile":"father build && lessc assets/index.less assets/index.css","coverage":"rc-test --coverage","docs:build":"dumi build","docs:deploy":"npm run docs:build && gh-pages -d .doc","lint":"eslint src/ --ext .ts,.tsx,.jsx,.js,.md","prepare":"husky","now-build":"npm run docs:build","prepublishOnly":"npm run compile && np --yolo --no-publish","prettier":"prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"","postpublish":"npm run docs:deploy","start":"dumi dev","test":"rc-test"},"lint-staged":{"**/*.{ts,tsx,js,jsx,json,md}":"npm run prettier"},"dependencies":{"@babel/runtime":"^7.10.1","classnames":"2.x","rc-motion":"^2.3.4","rc-util":"^5.27.0"},"devDependencies":{"@rc-component/father-plugin":"^1.0.1","@testing-library/jest-dom":"^6.1.4","@testing-library/react":"^14.1.2","@testing-library/user-event":"^14.5.2","@types/classnames":"^2.2.9","@types/jest":"^29.4.0","@types/react":"^18.0.0","@types/react-dom":"^18.0.0","@umijs/fabric":"^4.0.0","dumi":"^2.1.1","eslint":"^8.55.0","eslint-plugin-jest":"^27.6.0","eslint-plugin-unicorn":"^49.0.0","father":"^4.1.3","gh-pages":"^6.2.0","husky":"^9.0.0","jest":"^29.1.2","less":"^4.2.0","lint-staged":"^15.0.2","np":"^9.1.0","prettier":"^3.0.3","rc-test":"^7.0.14","react":"^18.2.0","react-dom":"^18.2.0","typescript":"^5.0.0"},"peerDependencies":{"react":">=16.9.0","react-dom":">=16.9.0"},"_id":"rc-collapse@4.0.0","gitHead":"cc9da67f7432f2742d908d67f2118bbfc9537ff6","_nodeVersion":"22.5.1","_npmVersion":"10.8.2","dist":{"integrity":"sha512-SwoOByE39/3oIokDs/BnkqI+ltwirZbP8HZdq1/3SkPSBi7xDdvWHTp7cpNI9ullozkR6mwTWQi6/E/9huQVrA==","shasum":"4df23eb0b2fd4a0dd2e2e08d67d21acd548cd45f","tarball":"http://registry-npm.ywwl.com/rc-collapse/download/rc-collapse-4.0.0.tgz","fileCount":28,"unpackedSize":53441,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBJiQINPyV3pWHVa7A1aDniONjBgoFuEPQxq9N7B5mMHAiEAl3QZDTCSXrikNZ2T8eZsjceQWHZrzcuh7z5Hhw41z/Y="}],"size":9818,"noattachment":false,"key":"/rc-collapse/-/rc-collapse-4.0.0.tgz"},"_npmUser":{"name":"zombiej","email":"smith3816@gmail.com"},"directories":{},"maintainers":[{"name":"shepherdwind","email":"eward.song@gmail.com"},{"name":"afc163","email":"afc163@gmail.com"},{"name":"yiminghe","email":"yiminghe@gmail.com"},{"name":"zombiej","email":"smith3816@gmail.com"},{"name":"lixuan","email":"kermitlx@outlook.com"},{"name":"madccc","email":"1075746765@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/rc-collapse_4.0.0_1736241990770_0.42811996488126236"},"_hasShrinkwrap":false,"readme":"# rc-collapse\n\nrc-collapse ui component for react\n\n[![NPM version][npm-image]][npm-url] [![build status][github-actions-image]][github-actions-url] [![Test coverage][codecov-image]][codecov-url] [![npm download][download-image]][download-url]\n\n[npm-image]: http://img.shields.io/npm/v/rc-collapse.svg?style=flat-square\n[npm-url]: http://npmjs.org/package/rc-collapse\n[github-actions-image]: https://github.com/react-component/collapse/workflows/CI/badge.svg\n[github-actions-url]: https://github.com/react-component/collapse/actions\n[codecov-image]: https://img.shields.io/codecov/c/github/react-component/collapse/master.svg?style=flat-square\n[codecov-url]: https://app.codecov.io/gh/react-component/collapse\n[download-image]: https://img.shields.io/npm/dm/rc-collapse.svg?style=flat-square\n[download-url]: https://npmjs.org/package/rc-collapse\n\n## Live Demo\n\nhttps://collapse-react-component.vercel.app\n\n## Install\n\n[![rc-collapse](https://nodei.co/npm/rc-collapse.png)](https://npmjs.org/package/rc-collapse)\n\n## Usage\n\n```js\nvar Collapse = require('rc-collapse');\nvar Panel = Collapse.Panel;\nvar React = require('react');\nvar ReactDOM = require('react-dom');\nrequire('rc-collapse/assets/index.css');\n\nvar App = (\n  <Collapse accordion={true}>\n    <Panel header=\"hello\" headerClass=\"my-header-class\">\n      this is panel content\n    </Panel>\n    <Panel header=\"title2\">this is panel content2 or other</Panel>\n  </Collapse>\n);\nReactDOM.render(App, container);\n```\n\n## Features\n\n- support ie8,ie8+,chrome,firefox,safari\n\n## API\n\n### Collapse props\n\n<table class=\"table table-bordered table-striped\">\n    <thead>\n    <tr>\n        <th style=\"width: 100px;\">name</th>\n        <th style=\"width: 50px;\">type</th>\n        <th>default</th>\n        <th>description</th>\n    </tr>\n    </thead>\n    <tbody>\n      <tr>\n          <td>activeKey</td>\n          <td>String|Array<String></td>\n          <th>The first panel key</th>\n          <td>current active Panel key</td>\n      </tr>\n      <tr>\n        <td>className</td>\n        <td>String or object</td>\n        <th></th>\n        <td>custom className to apply</td>\n      </tr>\n      <tr>\n          <td>defaultActiveKey</td>\n          <td>String|Array<String></td>\n          <th>null</th>\n          <td>default active key</td>\n      </tr>\n      <tr>\n          <td>destroyInactivePanel</td>\n          <td>Boolean</td>\n          <th>false</th>\n          <td>If destroy the panel which not active, default false. </td>\n      </tr>\n      <tr>\n          <td>accordion</td>\n          <td>Boolean</td>\n          <th>false</th>\n          <td>accordion mode, default is null, is collapse mode</td>\n      </tr>\n      <tr>\n          <td>onChange</td>\n          <td>Function(key)</td>\n          <th>noop</th>\n          <td>called when collapse Panel is changed</td>\n      </tr>\n      <tr>\n          <td>expandIcon</td>\n          <td>(props: PanelProps) => ReactNode</td>\n          <th></th>\n          <td>specific the custom expand icon.</td>\n      </tr>\n      <tr>\n          <td>collapsible</td>\n          <td>'header' | 'icon' | 'disabled'</td>\n          <th>-</th>\n          <td>specify whether the panel of children is collapsible or the area of collapsible.</td>\n      </tr>\n      <tr>\n          <td>items</td>\n          <td>\n            <a href=\"./src/interface.ts#ItemType\">interface.ts#ItemType</a>\n          </td>\n          <th>-</th>\n          <td>collapse items content</td>\n      </tr>\n    </tbody>\n</table>\n\nIf `accordion` is null or false, every panel can open. Opening another panel will not close any of the other panels. `activeKey` should be an string, if passing an array (the first item in the array will be used).\n\nIf `accordion` is true, only one panel can be open. Opening another panel will cause the previously opened panel to close. `activeKey` should be an string, if passing an array (the first item in the array will be used).\n\n### Collapse.Panel props\n\n> **deprecated** use `items` instead, will be removed in `v4.0.0`\n\n<table class=\"table table-bordered table-striped\">\n    <thead>\n    <tr>\n        <th style=\"width: 100px;\">name</th>\n        <th style=\"width: 200px;\">type</th>\n        <th>default</th>\n        <th>description</th>\n    </tr>\n    </thead>\n    <tbody>\n      <tr>\n          <td>header</td>\n          <td>String or node</td>\n          <th></th>\n          <td>header content of Panel</td>\n      </tr>\n      <tr>\n          <td>headerClass</td>\n          <td>String</td>\n          <th>' '</th>\n          <td>custom className to apply to header</td>\n      </tr>\n      <tr>\n          <td>showArrow</td>\n          <td>boolean</td>\n          <th>true</th>\n          <td>show arrow beside header</td>\n      </tr>\n      <tr>\n        <td>className</td>\n        <td>String or object</td>\n        <th></th>\n        <td>custom className to apply</td>\n      </tr>\n      <tr>\n        <td>classNames</td>\n        <td>{ header?: string, body?: string }</td>\n        <th></th>\n        <td>Semantic structure className</td>\n      </tr>\n      <tr>\n        <td>style</td>\n        <td>object</td>\n        <th></th>\n        <td>custom style</td>\n      </tr>\n      <tr>\n        <td>styles</td>\n        <td>{ header?: React.CSSProperties, body?: React.CSSProperties }</td>\n        <th></th>\n        <td>Semantic structure styles</td>\n      </tr>\n      <tr>\n        <td>openMotion</td>\n        <td>object</td>\n        <th></th>\n        <td>set the animation of open behavior, [more](https://github.com/react-component/motion). Different with v2, closed pane use a `rc-collapse-content-hidden` class to set `display: none` for hidden.</td>\n      </tr>\n      <tr>\n        <td>forceRender</td>\n        <td>boolean</td>\n        <th>false</th>\n        <td>forced render of content in panel, not lazy render after clicking on header</td>\n      </tr>\n      <tr>\n          <td>extra</td>\n          <td>String | ReactNode</td>\n          <th></th>\n          <td>Content to render in the right of the panel header</td>\n      </tr>\n      <tr>\n          <td>collapsible</td>\n          <td>'header' | 'icon' | 'disabled'</td>\n          <th>-</th>\n          <td>specify whether the panel be collapsible or the area of collapsible.</td>\n      </tr>\n    </tbody>\n</table>\n\n> `disabled` is removed since 3.0.0, please use `collapsible=disabled` replace it.\n\n#### key\n\nIf `key` is not provided, the panel's index will be used instead.\n\n#### KeyBoard Event\n\nBy default, Collapse will listen `onKeyDown`(<3.7.0 `onKeyPress`) event with `enter` key to toggle panel's active state when `collapsible` is not `disabled`. If you want to disable this behavior, you can prevent the event from bubbling like this:\n\n```tsx | pure\nconst App = () => {\n  const items: CollapseProps['items'] = [\n    {\n      label: <input onKeyDown={(e) => e.stopPropagation()} />,\n      children: 'content',\n    },\n    {\n      label: (\n        <div onKeyDown={(e) => e.stopPropagation()}>\n          <CustomComponent />\n        </div>\n      ),\n      children: 'content',\n    },\n    {\n      label: 'title 2',\n      children: 'content 2',\n      collapsible: 'disabled',\n    },\n    {\n      label: 'title 3',\n      children: 'content 3',\n      onItemClick: console.log,\n    },\n  ];\n\n  return <Collapse items={items} />;\n};\n```\n\n## Development\n\n```bash\nnpm install\nnpm start\n```\n\n## Test Case\n\n```bash\nnpm test\n```\n\n## Coverage\n\n```bash\nnpm test -- --coverage\n```\n\n## License\n\nrc-collapse is released under the MIT license.\n","publish_time":1736241990958,"_cnpm_publish_time":1736241990958,"dist-tags":{"latest":"4.0.0"}}