{"_id":"@atoir/react-breadcrumbs-dynamic","_rev":"2-8ce8b4e764c0a76503083bb56eaa2ae6","name":"@atoir/react-breadcrumbs-dynamic","dist-tags":{"latest":"1.2.2"},"versions":{"1.2.1":{"name":"@atoir/react-breadcrumbs-dynamic","version":"1.2.1","description":"fork React dynamic breadcrumbs extremely flexible and easy to use","main":"dist/src/index.js","repository":{"type":"git","url":"git+https://github.com/atoir/react-breadcrumbs-dynamic.git"},"keywords":["breadcrumbs","theme","react","router","react-router","through","react-through"],"author":{"name":"Serguei Okladnikov","email":"oklaspec@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/oklas/react-breadcrumbs-dynamic/issues"},"homepage":"https://github.com/oklas/react-breadcrumbs-dynamic#readme","peerDependencies":{"react":">=16.3.0 || ^16.3.0"},"devDependencies":{"@babel/polyfill":"^7.0.0","babel-cli":"^6.26.0","babel-core":"^6.26.3","babel-jest":"^22.4.3","babel-loader":"^7.1.1","babel-plugin-transform-decorators-legacy":"^1.3.4","babel-plugin-transform-react-jsx":"^6.24.1","babel-preset-env":"^1.7.0","babel-preset-es2015":"^6.24.1","babel-preset-stage-0":"^6.24.1","chai":"^4.1.2","codecov":"^3.0.1","enzyme":"^3.2.0","enzyme-adapter-react-16":"^1.1.1","gh-pages":"^2.0.1","jest":"^22.4.3","react":"^16.3.2","react-bootstrap":"^0.32.1","react-dom":"^16.3.2","react-router-bootstrap":"^0.24.4","react-router-dom":"^4.2.2","webpack":"^3.10.0","webpack-dev-server":"^2.9.7"},"dependencies":{"babel":"^6.23.0","react-through":"^1.1.4"},"jest":{"moduleDirectories":["node_modules","src"],"testRegex":"(/__tests__/.*|\\.(test|spec))\\.(js|jsx)$","coverageDirectory":"coverage","coverageReporters":["text-summary","lcov","html"],"collectCoverageFrom":["src/**/*.js","!src/**/*.spec.js","!src/**/*.index.js"],"moduleFileExtensions":["js","jsx"],"transform":{"^.+\\.js$":"babel-jest","^.+\\.jsx$":"babel-jest"},"testURL":"http://localhost"},"scripts":{"build":"babel -d dist/ src/index.js","build:example":"cd example && webpack","start:example":"cd example && webpack-dev-server --config webpack.config.js","build:version":"node -p -e \"require('./package.json').version\"","gh-pages":"sh -c \"gh-pages -d example -m $(yarn -s build:version)\"","deploy":"yarn build && yarn build:example && yarn gh-pages","prepublish":"npm run build","test":"jest --coverage","test-debug":"jest --bail --verbose"},"gitHead":"3d0478056ac6b5e2b57f4b826655885c6f06c898","_id":"@atoir/react-breadcrumbs-dynamic@1.2.1","_nodeVersion":"10.16.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-CYDVnbvw3CXfXH9JR+k87rEl8vyIcjs8FFxPDFqYH0g18naUwGf0Jdwt6SnapqCGAZIrXAaKQ36nDNUyAwmlow==","shasum":"3df83a89ba23a250f343af3c1a61f7c4037b9765","tarball":"https://registry.npmjs.org/@atoir/react-breadcrumbs-dynamic/-/react-breadcrumbs-dynamic-1.2.1.tgz","fileCount":25,"unpackedSize":27784,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJduoTYCRA9TVsSAnZWagAAbOAP/RPFqYI50TOY2L2z46Rf\nqDVfhn4F8gZx0Uh8ysVlbiUDKTCchj8tJEySw0fQ9CgOsV2706ma/H2Co8VY\nmvK7sT5u1Ff3sr05v30rHwVR+fUibcwGOy+U04Ao+r7nUPHdVNrQsuwkBbkP\nx9TuHZkbNMVq66koIU/Hb/ZGyQ1Mi/DhkhYB8616h2FYO4vf9HKGPhjxi0dA\nweR1ZsuSUGhbk7iDLcsWHEPYd20OEOnOQyip5nU7stGCC6u+lCs8wGaoAx7H\nNjpGtDemJzxfv0QZ0uQLqtLY7rpOCn+5nKU8KT/eK4+j7xXzwJD3Cer4FQw7\nb3mxmDtfriUYU2/eUJpLVnLuppgink4dZzTERrj+fxaysbUZ32IxmfqawEUs\nxG/e3WdWix5RY33fHa7C9c+VIFEpOM3oeKPf2epscJuZAOWWkP9vA2IeKsh7\nmCd7DWSO2p3O08UCUw5NJw0KFa/nVxZfXSPUdiz8seK4Tnxp+ZKJK0O7LGOV\nAEiklnadiplBxxVFx109tVcZfm7A9NZF30se0IW7BTkvtf+YdowtxLcotJfx\nPR6hTKDx9ultLSG3f0yKKcM8rKuhJBG6eGv3Sz7bp56WsHaCP/gwmSWbaTQm\ni8ajcZo1wxc6JcR0XEOeCATN9LdSV8GBsEY/8zkWv3X01FyIm6xowywMUfht\nIstG\r\n=xy86\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDWtOh6mP7h2vrw1fyNT5lg00bSyhnyXY3mi65jTYTfSAIgAwQdDQUkdRKN//sAkL6bnQDocqs1MpDKwYdNyW1hp0c="}]},"maintainers":[{"name":"atoir","email":"kolbin.egor@atoir.ru"}],"_npmUser":{"name":"atoir","email":"kolbin.egor@atoir.ru"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-breadcrumbs-dynamic_1.2.1_1572504791721_0.18954335791320864"},"_hasShrinkwrap":false},"1.2.2":{"name":"@atoir/react-breadcrumbs-dynamic","version":"1.2.2","description":"fork React dynamic breadcrumbs extremely flexible and easy to use","main":"dist/src/index.js","repository":{"type":"git","url":"git+https://github.com/atoir/react-breadcrumbs-dynamic.git"},"keywords":["breadcrumbs","theme","react","router","react-router","through","react-through"],"author":{"name":"Serguei Okladnikov","email":"oklaspec@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/oklas/react-breadcrumbs-dynamic/issues"},"homepage":"https://github.com/oklas/react-breadcrumbs-dynamic#readme","peerDependencies":{"react":">=16.3.0 || ^16.3.0"},"devDependencies":{"@babel/polyfill":"^7.0.0","babel-cli":"^6.26.0","babel-core":"^6.26.3","babel-jest":"^22.4.3","babel-loader":"^7.1.1","babel-plugin-transform-decorators-legacy":"^1.3.4","babel-plugin-transform-react-jsx":"^6.24.1","babel-preset-env":"^1.7.0","babel-preset-es2015":"^6.24.1","babel-preset-stage-0":"^6.24.1","chai":"^4.1.2","codecov":"^3.0.1","enzyme":"^3.2.0","enzyme-adapter-react-16":"^1.1.1","gh-pages":"^2.0.1","jest":"^22.4.3","react":"^16.3.2","react-bootstrap":"^0.32.1","react-dom":"^16.3.2","react-router-bootstrap":"^0.24.4","react-router-dom":"^4.2.2","webpack":"^3.10.0","webpack-dev-server":"^2.9.7"},"dependencies":{"babel":"^6.23.0","react-through":"^1.1.4"},"jest":{"moduleDirectories":["node_modules","src"],"testRegex":"(/__tests__/.*|\\.(test|spec))\\.(js|jsx)$","coverageDirectory":"coverage","coverageReporters":["text-summary","lcov","html"],"collectCoverageFrom":["src/**/*.js","!src/**/*.spec.js","!src/**/*.index.js"],"moduleFileExtensions":["js","jsx"],"transform":{"^.+\\.js$":"babel-jest","^.+\\.jsx$":"babel-jest"},"testURL":"http://localhost"},"scripts":{"build":"babel -d dist/ src/index.js","build:example":"cd example && webpack","start:example":"cd example && webpack-dev-server --config webpack.config.js","build:version":"node -p -e \"require('./package.json').version\"","gh-pages":"sh -c \"gh-pages -d example -m $(yarn -s build:version)\"","deploy":"yarn build && yarn build:example && yarn gh-pages","prepublish":"npm run build","test":"jest --coverage","test-debug":"jest --bail --verbose"},"gitHead":"ed348a784ea6630fe589814c66e1dcd77aaf2c80","_id":"@atoir/react-breadcrumbs-dynamic@1.2.2","_nodeVersion":"10.16.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-M9NLHVktGB3KWPsdYuTzfnhmVv14iM6Q6eBT/c+63LPH/W4/x6tBT/ngpFYqydk5u3P9uGLdoAMPdCQSBwZ/GQ==","shasum":"b8f8f5df35f32af7893f3fe2ec2fcc4f7ffe183b","tarball":"https://registry.npmjs.org/@atoir/react-breadcrumbs-dynamic/-/react-breadcrumbs-dynamic-1.2.2.tgz","fileCount":33,"unpackedSize":61673,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdupUFCRA9TVsSAnZWagAA/LEP/3W8S/r/U8v8pERyJRSC\n3EVG2lfPOr2gJm8U9Qih1M0Qqgnr2zQK+sldmzU688Lh5E33g0Olhxohv/oV\n8yRs8rfyI0Ih7qLCnAzvC4u93FABwaRYNcIeKlNndmCA8/FNv6Bt3erZxvDq\nJiaf2kBmHa7l6+EmEZ9OouZn9GDld4nQX5txAxih3y+GjkKfoZDIB4RkGcLb\nhDbfN+ZulOA494tWWzidbGBO1IflJJEE/DdcazXQrJShpbN/RQWT1JD2XKil\nh/rZoZu2p5oHBK6hFjS7l6sGVj05+tT5YWZ4qf0layEBTrKu/7MoB7OOo0VX\nmm10ADMsXSBTsefDCDOBsLJFyODOdTIgcj0YGxBRxFNFqGiCNqR8jsUMOHYU\nB+DKXUjPAA7OJTRF+r37qdSRw0I9ebeNpea6pKAHTIOJtKXUAkJFg+qk3jyR\nvsWmz2CtrmH/+KRvDg1DmwZVh+SxVFKkK25sg1v/YK8VuFeCdWBF7HC7OlhE\nV0FlkmXdEWBQK5+A4mXG5fYdmfPXhzqcY0HLgNl4egLbyAm31sTZnNBOP0OG\nNLvVf/cz23XeXS0m3G1VKfm6DelyxkJAP5NDQFsaD3dJmLzfAUJQ7KipzAan\nV8aHTMP6ledIzvO5GXtFNs4XQ6/kcNjOtdXJG6F2QjFDC/3dBJ6TgABEQ2Oz\nR5ZA\r\n=D9p4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDjbrXjvhtrcyWUVcXcZAb9YjcgGZEdI2s8G/F3KIan8gIgIg3vEVQNdZ3NqmELVBKH/GDWf3XGDXd994iReg2O/IE="}]},"maintainers":[{"name":"atoir","email":"kolbin.egor@atoir.ru"}],"_npmUser":{"name":"atoir","email":"kolbin.egor@atoir.ru"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-breadcrumbs-dynamic_1.2.2_1572508932965_0.38748284832692925"},"_hasShrinkwrap":false}},"time":{"created":"2019-10-31T06:53:11.502Z","1.2.1":"2019-10-31T06:53:11.832Z","modified":"2022-04-04T16:14:04.642Z","1.2.2":"2019-10-31T08:02:13.093Z"},"maintainers":[{"name":"atoir","email":"kolbin.egor@atoir.ru"}],"description":"fork React dynamic breadcrumbs extremely flexible and easy to use","homepage":"https://github.com/oklas/react-breadcrumbs-dynamic#readme","keywords":["breadcrumbs","theme","react","router","react-router","through","react-through"],"repository":{"type":"git","url":"git+https://github.com/atoir/react-breadcrumbs-dynamic.git"},"author":{"name":"Serguei Okladnikov","email":"oklaspec@gmail.com"},"bugs":{"url":"https://github.com/oklas/react-breadcrumbs-dynamic/issues"},"license":"MIT","readme":"# react-breadcrumbs-dynamic\n\n[![Npm package](https://img.shields.io/npm/v/react-breadcrumbs-dynamic.svg?style=flat)](https://npmjs.com/package/react-breadcrumbs-dynamic)\n[![Npm downloads](https://img.shields.io/npm/dm/react-breadcrumbs-dynamic.svg?style=flat)](https://npmjs.com/package/react-breadcrumbs-dynamic)\n[![Travis build status](http://img.shields.io/travis/oklas/react-breadcrumbs-dynamic.svg?style=flat)](https://travis-ci.org/oklas/react-breadcrumbs-dynamic)\n[![Test Coverage](https://img.shields.io/codecov/c/github/oklas/react-breadcrumbs-dynamic.svg)](https://codecov.io/gh/oklas/react-breadcrumbs-dynamic)\n[![Dependency Status](https://david-dm.org/oklas/react-breadcrumbs-dynamic.svg)](https://david-dm.org/oklas/react-breadcrumbs-dynamic)\n\n***\n\n[`🏠`](https://oklas.github.io/react-breadcrumbs-dynamic) > [`React dynamic breadcrumbs`](https://oklas.github.io/react-breadcrumbs-dynamic) > [`extremely flexible`](https://oklas.github.io/react-breadcrumbs-dynamic) > [`and`](https://oklas.github.io/react-breadcrumbs-dynamic) > [`easy to use`](https://oklas.github.io/react-breadcrumbs-dynamic)\n\n\nThis is completely router-independent solution. You can use it with any version\nof React Router (2 or 3 or 4) or any other routing library for React or without\nrouting at all. All what you need is just to specify components for breadcrumbs\nitems and its props. However props and components should be specified\n[separately](https://github.com/oklas/react-through#readme). Props should be specified\nin intermediator component `BreadcrumbsItem` anywhere in your hierarchy of\ncomponents and routes.\n\nVisit live **[DEMO](//oklas.github.io/react-breadcrumbs-dynamic)** (source code\nof demo in [example](example/src) folder)\n\n# Synopsis\n\n```js\nconst Profile = ({user}) => (\n  <div>\n\n    <BreadcrumbsItem\n      to=`/user/${user.login}`\n      icon='account-box'\n    >\n      {user.firstName} {user.lastName}\n    </BreadcrumbsItem>\n\n    <h1>\n      {user.firstName} {user.lastName}\n    </h1>\n  </div>\n)\n```\n\n# Installation\n\n``` sh\nnpm install --save react-through react-breadcrumbs-dynamic\n\n# definitions may be installed if typescript is used\n# ( worked for 1.0.10, leave feedback if any )\nnpm install --save @types/react-breadcrumbs-dynamic\n```\n\n# Base configuration\n\nDo you already use declarative communications through react tree with\n[react-through](https://github.com/oklas/react-through#readme)?\nJust add `<ThroughProvider/>` to the root of your React component tree:\n\n``` javascript\nimport {ThroughProvider} from 'react-through'\n\nconst theApp = (\n  <ThroughProvider>\n    <App />\n  </ThroughProvider>\n)\n\nReactDOM.render(theApp, document.getElementById('root'))\n```\n\n\n# Instance configuration\n\nIn this example the `react-router` v4 `<NavLink>` is used as breadcrumbs item:\n\n``` javascript\nimport {Breadcrumbs} from 'react-breadcrumbs-dynamic'\n\nconst Page = (props) => (\n  return (\n    <div className=\"App\">\n      <Header>\n\n        <Breadcrumbs\n          separator={<b> / </b>}\n          item={NavLink}\n          finalItem={'b'}\n          finalProps={{\n            style: {color: 'red'}\n          }}\n        />\n\n      </Header>\n\n      {props.children}\n\n      <Footer>\n        <Breadcrumbs/>\n      </Footer>\n    </div>\n  )\n}\n```\n\nPlease note that `item` and `finalItem` require react component (class) instead\nof react element. However `separator` requires react element.\n\nBy default order of items is based on URL length. You can override the sort order\nas you like just specify comparision function in `compare` prop which receive\npair of objects containing props of breadcrumbs item. For example:\n`<Breadcrumbs compare={(a,b)=>a.weight-b.weight} removeProps={{weight: true}} />`.\n\nIf you use `<a>` tag based items then you will find `renameProps` or\n`duplicateProps` useful to map prop `to` on prop `href` like this:\n`<Breadcrumbs renameProps={{to:\"href\"}} />`.\n\n\n# Adding items to breadcrumbs\n\nEach routed component in your react tree is generally associated with route\nand with correspondent breadcrumbs. Each component may add its breadcrumbs\nitem by rendering `<BreadcrumbsItem>` with any props and children.\n\nExample tree of routed components with breadcrumbs items:\n\n``` javascript\nimport {BreadcrumbsItem} from 'react-breadcrumbs-dynamic'\n\nconst App = (props) => (\n  <div>\n    <BreadcrumbsItem to='/'>Main Page</BreadcrumbsItem>\n    {props.children}\n    <Route exact path=\"/user\" component={User} />\n  </div>\n)\n\nconst User = (props) => (\n  <div>\n    <BreadcrumbsItem to='/user'>Home</BreadcrumbsItem>\n    <h2>Home</h2>\n    {props.children}\n    <Route exact path=\"/user/contacts\" component={Contacts} />\n  </div>\n)\n\nconst Contacts = (props) => (\n  <div>\n    <BreadcrumbsItem to='/user/contacts'>Contacts</BreadcrumbsItem>\n    <h2>Contacts</h2>\n    ...\n  </div>\n)\n```\n\nYou can declaratively pass props with any data, functions, components and so on\nthrough react tree in any direction because\n[react-through](https://github.com/oklas/react-through#readme) allows to do that.\n\n\n# Result\n\nThe result of above code will represent breadcrumbs like this:\n\n``` javascript\n  <NavLink to='/'>Main Page</NavLink>\n  <b> / </b>\n  <NavLink to='/user'>Home</NavLink>\n  <b> / </b>\n  <b to='/user/contacts'>Contacts</b>\n```\n\nIf you use library or if you think that it is good for use -\nlet people know about that - click the star.\n\n___\n\n\n# The components and functions\n\n## `Breadcrumbs` component props\n\nThe breadcrumbs instance is implemented in the `Breadcrumbs` component, which\nis the `through container` in terms of\n[react-through](https://github.com/oklas/react-through#readme).\n\n| property | type | default | description |\n| -------- | ---- | ------- | ------- |\n| `separator` | *element* | `undefined` | separator between breadcrumbs items |\n| `item` | *component* | `a` | component of breadcrumbs items |\n| `finalItem` | *component* | value of `item` prop | component of final breadcrumbs item |\n| `finalProps` | *object* | `{}` | final item props - will override specified in `BreadcrumbsItem` |\n| `container` | *component* | `span` | wrapper component |\n| `containerProps` | *object* | `{}` | props for `container` component |\n| `compare` | *function* | (a,b)=>a.to.length-b.to.length | comparision function for sorting items |\n| `hideIfEmpty` | *boolean* | `false` | show or hide breadcrumbs container if items exist or not |\n| `renameProps` | *object* | `{}` | rename props passed from item `BreadcrumbsItem` to `item` |\n| `duplicateProps` | *object* | `{}` | duplicate props passed from item `BreadcrumbsItem` to `item` |\n| `removeProps` | *object* | `{}` | props aren't passed from item `BreadcrumbsItem` to `item` |\n\n\n## `BreadcrumbsItem` component props\n\nThe `BreadcrumbsItem` component is the `through agent` with bearing key in\nprop `to` in terms of [react-through](https://github.com/oklas/react-through#readme).\n\nThe `BreadcrumbsItem` component may have any prop and may have children. Each prop\nfor `BreadcrumbsItem` will be passed to correspondent breadcrumb component specified\nin `item` or `finalItem` prop of `Breadcrumbs`. Only one prop is mandatory.\n\n| property | type | default | description |\n| -------- | ---- | ------- | ------- |\n| `to` | *string* | required | mandatory required bearing key with URL |\n| `...` | *any* | | any properties - will be mapped to correspondent breadcrumb item |\n\n___\n\n\n### `withBreadcrumbsItem()` function\n\nAdvanced usage higher order component function. It acquire one argument with\nyour custom react component and return appropriate component which will have\n`breadcrumbs` in its props with methods `item()` and `items()` like\n`throughAgent` from [react-through](https://github.com/oklas/react-through#readme).\n\n\n### `this.props.breadcrumbs.item()` and `this.props.breadcrumbs.items()`\n\nAdvanced usage methods to configure breadcrumbs item of your react component.\nThese methods will be added to props by HOC of `withBreadcrumbsItem` function.\nThe function `item()` accepts one react component with props and the functions\n`items()` accepts react component with children which may contain any number of\ncomponents to create correspondent number of breadcrumbs item. The breadcrumbs\nitem for these functions may be any react component and only props is\nsignificant. The `Dummy` and the `Item` components is exported by library\nfor this case. Each function accepts null to reset breadcrumbs items to none if\ncurrent component is no more needed to represent any breadcrumbs items.\n\n\n### constants\n\nThe `through area` name  used by this library is defined in\n`breadcrumbsThroughArea` variable.\n\nThe prop name which contain bearing key is defined in\n`breadcrumbsBearingKey`.\n\n\n``` javascript\nimport { breadcrumbsThroughArea } from 'react-breadcrumbs-dynamic'\nimport { breadcrumbsBearingKey } from 'react-breadcrumbs-dynamic'\n```\n\n\n## LICENSE\n\n#### [MIT](./LICENSE.md)\n","readmeFilename":"README.md"}