{"name":"react-highlight-words","version":"0.6.0","description":"React component to highlight words within a larger body of text","main":"dist/main.js","scripts":{"build":"npm run build:website && npm run build:dist","build:website":"npm run clean:website && NODE_ENV=production webpack --config webpack.config.website.js -p --bail","build:dist":"npm run clean:dist && NODE_ENV=production webpack --config webpack.config.dist.js --bail","clean":"npm run clean:website && npm run clean:dist","clean:website":"rimraf build","clean:dist":"rimraf dist","deploy":"gh-pages -d build","lint":"standard","prebuild":"npm run lint","postpublish":"npm run deploy","prepublish":"npm run build","start":"webpack-dev-server --hot --inline --config webpack.config.dev.js","test":"NODE_ENV=test karma start","watch":"watch 'clear && npm run lint -s && npm run test -s' src"},"repository":{"type":"git","url":"git+https://github.com/bvaughn/react-highlight-words.git"},"author":{"name":"Brian Vaughn"},"license":"MIT","bugs":{"url":"https://github.com/bvaughn/react-highlight-words/issues"},"homepage":"https://github.com/bvaughn/react-highlight-words#readme","keywords":["react","reactjs","react-component","highlighter","highlight","text","words","matches","substring","occurrences","search"],"standard":{"parser":"babel-eslint","ignore":["build","dist","node_modules"],"global":["afterAll","afterEach","beforeAll","beforeEach","describe","it","jasmine"]},"devDependencies":{"babel":"^5.8.34","babel-core":"^5.8.34","babel-eslint":"^4.1.6","babel-loader":"^5.4.0","babel-plugin-react-transform":"^1.1.1","css-loader":"^0.23.0","cssnext":"^1.8.4","cssnext-loader":"^1.0.1","expect.js":"^0.3.1","gh-pages":"^0.8.0","html-webpack-plugin":"^1.7.0","karma":"^0.13.15","karma-junit-reporter":"^0.3.8","karma-mocha":"^0.2.1","karma-phantomjs2-launcher":"^0.3.2","karma-sourcemap-loader":"^0.3.6","karma-spec-reporter":"0.0.23","karma-webpack":"^1.7.0","latinize":"^0.2.0","mocha":"^2.3.4","phantomjs2":"^2.0.2","react":"^15.1.0","react-dom":"^15.1.0","react-transform-catch-errors":"^1.0.0","react-transform-hmr":"^1.0.1","redbox-react":"1.2.6","rimraf":"^2.4.4","standard":"^5.4.1","style-loader":"^0.13.0","watch":"^0.16.0","webpack":"^1.12.9","webpack-dev-server":"^1.14.0","worker-loader":"^0.7.0"},"dependencies":{"highlight-words-core":"^1.0.2"},"peerDependencies":{"react":"^0.14.0 || ^15.0.0"},"gitHead":"f77a7827b90b3297d70197e6935ecbbd18cf5cda","_id":"react-highlight-words@0.6.0","_shasum":"e12e9fedda4333e410ea408cdedffc77122020aa","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.6.0","_npmUser":{"name":"brianvaughn","email":"briandavidvaughn@gmail.com"},"dist":{"shasum":"e12e9fedda4333e410ea408cdedffc77122020aa","tarball":"http://registry-npm.ywwl.com/react-highlight-words/download/react-highlight-words-0.6.0.tgz","integrity":"sha512-5h1j+YJ4SRbWoh5/eO2oVd3fLPs7GFJ+/Vmgi7hRcJCnvq+iaBODWub5VPeFyaiXjC8E0BXYxTrCJyhcHmrwbg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCW2GuUxExIR0STaGBHlUOuLn44W1cBUuxh1I+vOIG1ywIgOz7PgtblyoQCXhFqBpapNzd7X3xhUth11a2fL3s6qx4="}],"size":610295,"noattachment":false,"key":"/react-highlight-words/-/react-highlight-words-0.6.0.tgz"},"maintainers":[{"name":"brianvaughn","email":"briandavidvaughn@gmail.com"},{"name":"clauderic","email":"clauderic.d@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/react-highlight-words-0.6.0.tgz_1478718495046_0.3425877885892987"},"directories":{},"readme":"<img src=\"https://cloud.githubusercontent.com/assets/29597/11913937/0d2dcd78-a629-11e5-83e7-6a17b6d765a5.png\" width=\"260\" height=\"260\">\r\n\r\nReact component to highlight words within a larger body of text.\r\n\r\nCheck out a demo [here](https://bvaughn.github.io/react-highlight-words).\r\n\r\n## Usage\r\n\r\nTo use it, just provide it with an array of search terms and a body of text to highlight.\r\n\r\n[Try this example in Code Sandbox.](https://codesandbox.io/s/5v8yqoxv7k)\r\n\r\n```jsx\r\nimport React from \"react\";\r\nimport { createRoot } from \"react-dom/client\";\r\nimport Highlighter from \"react-highlight-words\";\r\n\r\nconst root = createRoot(document.getElementById(\"root\"));\r\nroot.render(\r\n  <Highlighter\r\n    highlightClassName=\"YourHighlightClass\"\r\n    searchWords={[\"and\", \"or\", \"the\"]}\r\n    autoEscape={true}\r\n    textToHighlight=\"The dog is chasing the cat. Or perhaps they're just playing?\"\r\n  />\r\n);\r\n```\r\n\r\nAnd the `Highlighter` will mark all occurrences of search terms within the text:\r\n\r\n<img width=\"368\" alt=\"screen shot 2015-12-19 at 8 23 43 am\" src=\"https://cloud.githubusercontent.com/assets/29597/11914033/e3c319f6-a629-11e5-896d-1a5ce22c9ea2.png\">\r\n\r\n## Props\r\n\r\n| Property | Type | Required? | Description |\r\n|:---|:---|:---:|:---|\r\n| activeClassName | String |  | The class name to be applied to an active match. Use along with `activeIndex` |\r\n| activeIndex | Number |  | Specify the match index that should be actively highlighted. Use along with `activeClassName` |\r\n| activeStyle | Object |  | The inline style to be applied to an active match. Use along with `activeIndex` |\r\n| autoEscape | Boolean |  | Escape characters in `searchWords` which are meaningful in regular expressions |\r\n| className | String |  | CSS class name applied to the outer/wrapper `<span>` |\r\n| caseSensitive | Boolean |  | Search should be case sensitive; defaults to `false` |\r\n| findChunks | Function |  | Use a custom function to search for matching chunks. This makes it possible to use arbitrary logic when looking for matches. See the default `findChunks` function in [highlight-words-core](https://github.com/bvaughn/highlight-words-core) for signature. Have a look at the [custom findChunks example](https://codesandbox.io/s/k20x3ox31o) on how to use it. |\r\n| highlightClassName | String or Object |  | CSS class name applied to highlighted text or object mapping search term matches to class names. |\r\n| highlightStyle | Object |  | Inline styles applied to highlighted text |\r\n| highlightTag | Node or String |  | Type of tag to wrap around highlighted matches. Defaults to `mark` but can also be a React element (class or functional) |\r\n| sanitize | Function |  | Process each search word and text to highlight before comparing (eg remove accents); signature `(text: string): string` |\r\n| searchWords | Array<String &#124; RegExp> | ✓ | Array of search words. String search terms are automatically cast to RegExps unless `autoEscape` is true. |\r\n| textToHighlight | String | ✓ | Text to highlight matches in |\r\n| unhighlightClassName | String |  | CSS class name applied to unhighlighted text |\r\n| unhighlightStyle | Object |  | Inline styles applied to unhighlighted text |\r\n| unhighlightTag | Node or String |  | Type of tag applied to unhighlighted parts. Defaults to `span` but can also be a React element (class or functional) |\r\n| * | any | | Any other props (such as `title` or `data-*`) are applied to the outer/wrapper `<span>` |\r\n\r\n## Custom highlight tag\r\n\r\nBy default this component uses an HTML Mark Text element (`<mark>`) to wrap matched text, but you can inject a custom\r\ntag using the `highlightTag` property. This tag should be a React component that accepts the following properties:\r\n\r\n| Property | Type | Description |\r\n|:---|:---|:---|\r\n| children | String | Text to be highlighted |\r\n| highlightIndex | Number | Index of matched text |\r\n\r\nFor example:\r\n\r\n```js\r\nconst Highlight = ({ children, highlightIndex }) => (\r\n  <strong className=\"highlighted-text\">{children}</strong>\r\n);\r\n```\r\n\r\n## Installation\r\n\r\n```\r\nyarn add react-highlight-words\r\n```\r\n\r\n```\r\nnpm i --save react-highlight-words\r\n```\r\n\r\n## License\r\n\r\nMIT License - fork, modify and use however you want.\r\n","publish_time":1478718495278,"_cnpm_publish_time":1478718495278,"dist-tags":{"latest":"1.0.0"}}