{"name":"react-content-loader","version":"6.0.0-beta.2","keywords":["react","react-native","skeleton","placeholder","loader","loading","content","svg"],"author":{"name":"Danilo Woznica","email":"danilowoz@gmail.com"},"license":"MIT","_id":"react-content-loader@6.0.0-beta.2","maintainers":[{"name":"danilowoz","email":"danilowoz@gmail.com"}],"homepage":"https://github.com/danilowoz/react-content-loader","bugs":{"url":"https://github.com/danilowoz/react-content-loader/issues"},"dist":{"shasum":"fbd89f05b32751e46a77c3bb28a83210483b8901","tarball":"http://registry-npm.ywwl.com/react-content-loader/download/react-content-loader-6.0.0-beta.2.tgz","fileCount":114,"integrity":"sha512-rGL5Qxk9zSCpa0dmk9Fpaq5AOBypW3swd27/n5sF8nRShILbf0okf8zgq1YAcKaXkUXMOGRzWubl2b80S+HXOA==","signatures":[{"sig":"MEUCIDEDsgbXtFrKlzb3d/hlPvc1QAbsBrR7Es5VTlFtUpTjAiEAweKpwoqSEgd3RfdqQGrgxtGnNeCaVbB/azT2JeEOONs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":156946,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfeizOCRA9TVsSAnZWagAAnFMP/2sHDwNHy8gTSFTnSY9g\nuRn130vytGEYOveYFAdzI6c0AJn9EmJepWFevjgoxBlC9lp9OSZzbsCMZPB8\nrDGbixMMptxiCoWas/eZ/obEag1CR3JQ1TPh0UEfH4aZuIlxllK68dPEXqx9\nWyDHSqqC3z/fnI5rCSqAW4bghSs2oQJ2hgHbZmN+yEVFZBVyBnTiG5V9TXLd\nQXw9g1pvm4J9YsOoh1qeyWCTUdLIrcyj9OkuSd9jq3RTN1RjUhVoM4ZyIkpB\nMxV4ittNfZKePtxh9pco1pOGcS95GUUlMWBEZk6tAiXrf0Xqb0Hr+g1JFORy\nz63eMu08eWotXjJ725IVv1rMLsTp8s3dl1oO+eoKO2xPJ/m5Mk0/KhkYDRMk\nYuSRb0fbRTyStGZz2NFaxK1XMwVCfhUAv1INNqSbqnJsBxHx5tzE1v3BihvO\nLP33HzAw7U1ONTM73TVaEzE0glfvOKwfOVTRmdwWYy/vQtBqv1/a3FqdbAz1\nxnV3L6qKP8V4ntgW+oRZCVASUc3ZLoy4TMdAbD9fdGSGNVjwn7vjvRG3TQxH\n7eSYttkQGFCxLfu7VjAvecPvYYPLbou0tz7b0glnstQrrc+sRNeHtp5f1JcI\naBFuLHJroZn4HZowIANf7PNrqRVR8n0pjYH7IIf3uZN9G+76/0mqTsg/RFJ+\ntnKs\r\n=bd0w\r\n-----END PGP SIGNATURE-----\r\n","size":22767,"noattachment":false,"key":"/react-content-loader/-/react-content-loader-6.0.0-beta.2.tgz"},"main":"dist/react-content-loader.cjs.js","husky":{"hooks":{"pre-push":"npm run test","commit-msg":"commitlint -E HUSKY_GIT_PARAMS","pre-commit":"npm run lint && npm run format"}},"types":"dist/web/index.d.ts","config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"module":"dist/react-content-loader.es.js","readme":"<p align=\"center\">\n  <img width=\"350\" alt=\"react-content-loader\" src=\"https://user-images.githubusercontent.com/4838076/34419335-5669c3f8-ebea-11e7-9668-c47b7846970b.png\"/>\n</p>\n<p align=\"center\">\n  <img width=\"400\" alt=\"Example's react-content-loader\" src=\"https://user-images.githubusercontent.com/4838076/34308760-ec55df82-e735-11e7-843b-2e311fa7b7d0.gif\" />\n</p>\n\nSVG-Powered component to easily create placeholder loadings (like Facebook's cards loading).\n\n## Features\n\n- :gear: **Customizable:** Feel free to change the colors, speed, sizes and even **RTL**;\n- :ok_hand: **Plug and play:** with many presets to use, see the [examples](http://danilowoz.com/create-content-loader/#gallery);\n- :pencil2: **DIY:** use the [create-content-loader](https://danilowoz.com/create-content-loader) to create your own custom loaders easily;\n- 📱 **React Native support**: same API, as same powerful features;\n- ⚛️ **Really lightweight:** less than **2kB** and **0 dependencies** for web version;\n\n## Index\n\n- [Getting Started](#gettingstarted)\n- [Usage](#usage)\n  - [Native](#native)\n- [Options](#options)\n- [Examples](#examples)\n- [Troubleshooting](#troubleshooting)\n- [Similar packages](#similarpackages)\n- [Development](#development)\n\n## Getting Started\n\n```sh\nnpm i react-content-loader --save\n```\n\n```sh\nyarn add react-content-loader\n```\n\n### For React Native\n\n```sh\nnpm i react-content-loader react-native-svg --save\n```\n\n```sh\nyarn add react-content-loader react-native-svg\n```\n\nCDN from [JSDELIVR](https://www.jsdelivr.com/package/npm/react-content-loader)\n\n## Usage\n\nThere are two ways to use it:\n\n**1. Presets, see the [examples](https://danilowoz.com/react-content-loader/):**\n\n```jsx\nimport ContentLoader, { Facebook } from 'react-content-loader'\n\nconst MyLoader = () => <ContentLoader />\nconst MyFacebookLoader = () => <Facebook />\n```\n\n**2. Custom mode, see the [online tool](https://danilowoz.com/create-content-loader)**\n\n```jsx\nconst MyLoader = () => (\n  <ContentLoader viewBox=\"0 0 380 70\">\n    {/* Only SVG shapes */}    \n    <rect x=\"0\" y=\"0\" rx=\"5\" ry=\"5\" width=\"70\" height=\"70\" />\n    <rect x=\"80\" y=\"17\" rx=\"4\" ry=\"4\" width=\"300\" height=\"13\" />\n    <rect x=\"80\" y=\"40\" rx=\"3\" ry=\"3\" width=\"250\" height=\"10\" />\n  </ContentLoader>\n)\n```\n\n**Still not clear?** Take a look at this working example at [codesandbox.io](https://codesandbox.io/s/moojk887z9)  \nOr try the components editable demo hands-on and install it from [bit.dev](https://bit.dev/danilowoz/react-content-loader)\n\n## Native\n\n`react-content-loader` can be used with React Native in the same way as web version with the same import:\n\n**1. Presets, see the [examples](#examples):**\n\n```jsx\nimport ContentLoader, { Facebook } from 'react-content-loader/native'\n\nconst MyLoader = () => <ContentLoader />\nconst MyFacebookLoader = () => <Facebook />\n```\n\n**2. Custom mode**\n\n**To create custom loaders there is an important difference:** as React Native doesn't have any native module for SVG components, it's necessary to import the shapes from [react-native-svg](https://github.com/react-native-community/react-native-svg) or use the named export Rect and Circle from `react-content-loader` import:\n\n```jsx\nimport ContentLoader, { Rect, Circle } from 'react-content-loader/native'\n\nconst MyLoader = () => (\n  <ContentLoader viewBox=\"0 0 380 70\">\n    <Circle cx=\"30\" cy=\"30\" r=\"30\" />\n    <Rect x=\"80\" y=\"17\" rx=\"4\" ry=\"4\" width=\"300\" height=\"13\" />\n    <Rect x=\"80\" y=\"40\" rx=\"3\" ry=\"3\" width=\"250\" height=\"10\" />\n  </ContentLoader>\n)\n```\n\n## Options\n\n| <div style=\"width:250px\">Prop name and type</div>             | Environment                | Description                                                                                                                                                                                                                                                                                         |\n| ------------------------------------------------------------- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **`animate?: boolean`** <br/> Defaults to `true`              | React DOM<br/>React Native | Opt-out of animations with `false`                                                                                                                                                                                                                                                                  |\n| **`title?: string`** <br/> Defaults to `Loading interface...` | React DOM only             | It's used to describe what element it is. <br />Use `''` (empty string) to remove.                                                                                                                                                                                                                  |\n| **`speed?: number`** <br /> Defaults to `1.2`                 | React DOM<br/>React Native | Animation speed in seconds.                                                                                                                                                                                                                                                                         |\n| **`interval?: number`** <br /> Defaults to `0.25`             | React DOM only             | Interval of time between runs of the animation, <br/>as a fraction of the animation speed.                                                                                                                                                                                                          |\n| **`viewBox?: string`** <br /> Defaults to `undefined`         | React DOM<br/>React Native | Use viewBox props to set a custom viewBox value, <br/>for more information about how to use it, <br/>read the article [How to Scale SVG](https://css-tricks.com/scale-svg/).                                                                                                                        |\n| **`gradientRatio?: number`** <br /> Defaults to `1.2`         | React DOM only             | Width of the animated gradient as a fraction of the view box width.                                                                                                                                                                                                                                 |\n| **`rtl?: boolean`** <br /> Defaults to `false`                | React DOM<br/>React Native | Content right-to-left.                                                                                                                                                                                                                                                                              |\n| **`backgroundColor?: string`** <br /> Defaults to `#f5f6f7`   | React DOM<br/>React Native | Used as background of animation.                                                                                                                                                                                                                                                                    |\n| **`foregroundColor?: string`** <br /> Defaults to `#eee`      | React DOM<br/>React Native | Used as the foreground of animation.                                                                                                                                                                                                                                                                |                                                                                                                                                                                             |\n| **`style?: React.CSSProperties`** <br /> Defaults to `{}`     | React DOM only             |                                                                                                                                                                                                                                                                                                     |\n| **`uniqueKey?: string`** <br /> Defaults to random unique id  | React DOM only             | Use the same value of prop key, <br/>that will solve inconsistency on the SSR, see more [here](https://github.com/danilowoz/react-content-loader/issues/78).                                                                                                                                        |\n\nSee all options [live](https://danilowoz.com/react-content-loader/)\n\n## Examples\n\n##### Facebook Style\n\n```jsx\nimport { Facebook } from 'react-content-loader'\n\nconst MyFacebookLoader = () => <Facebook />\n```\n\n<img alt=\"Facebook Style\" src=\"https://user-images.githubusercontent.com/4838076/73212460-328f7500-4146-11ea-99e7-e19cd4e07a51.png\" width=\"500px\" />\n\n##### Instagram Style\n\n```jsx\nimport { Instagram } from 'react-content-loader'\n\nconst MyInstagramLoader = () => <Instagram />\n```\n\n<img alt=\"Instagram Style\" src=\"https://user-images.githubusercontent.com/4838076/73212462-328f7500-4146-11ea-98dc-3a6aeafd4a26.png\" width=\"500px\" />\n\n##### Code Style\n\n```jsx\nimport { Code } from 'react-content-loader'\n\nconst MyCodeLoader = () => <Code />\n```\n\n<img alt=\"Code Style\" src=\"https://user-images.githubusercontent.com/4838076/73212459-328f7500-4146-11ea-89b0-1b7bbae8047b.png\" width=\"500px\" />\n\n##### List Style\n\n```jsx\nimport { List } from 'react-content-loader'\n\nconst MyListLoader = () => <List />\n```\n\n<img alt=\"List Style\" src=\"https://user-images.githubusercontent.com/4838076/73212463-33280b80-4146-11ea-9f93-95c2cbdef17b.png\" width=\"500px\" />\n\n##### Bullet list Style\n\n```jsx\nimport { BulletList } from 'react-content-loader'\n\nconst MyBulletListLoader = () => <BulletList />\n```\n\n<img alt=\"Bullet list Style\" src=\"https://user-images.githubusercontent.com/4838076/73212458-328f7500-4146-11ea-826f-576059c4644e.png\" width=\"500px\" />\n\n### Custom Style\n\nFor the custom mode, use the\n[online tool](https://danilowoz.com/create-content-loader).\n\n```jsx\nconst MyLoader = () => (\n  <ContentLoader\n    height={140}\n    speed={1}\n    backgroundColor={'#333'}\n    foregroundColor={'#999'}\n    viewBox=\"0 0 380 70\"\n  >\n    {/* Only SVG shapes */}\n    <rect x=\"0\" y=\"0\" rx=\"5\" ry=\"5\" width=\"70\" height=\"70\" />\n    <rect x=\"80\" y=\"17\" rx=\"4\" ry=\"4\" width=\"300\" height=\"13\" />\n    <rect x=\"80\" y=\"40\" rx=\"3\" ry=\"3\" width=\"250\" height=\"10\" />\n  </ContentLoader>\n)\n```\n\n![Custom](https://user-images.githubusercontent.com/4838076/36352947-b87019a8-149e-11e8-99ba-c71c2bcf8733.gif)\n\n## Troubleshooting\n\n#### Responsive - Mobile version\n\nIn order to avoid unexpected behavior, the package doesn't have opinioned settings. So if it needs to be responsive, have in mind that the output of package is a regular SVG, so it just needs the same attributes to become a regular SVG responsive, which means:\n\n```jsx\nimport { Code } from 'react-content-loader'\n\nconst MyCodeLoader = () => (\n  <Code\n    width={100}\n    height={100}\n    viewBox=\"0 0 100 100\"\n    style={{ width: '100%' }}\n  />\n)\n```\n\n#### Server-side rendering (SSR) - Match snapshot\n\nAs the main component generates random values to match the id of the SVG element with background style, it can encounter unexpected errors and unmatching warning on render, once the random value of id will be generated twice, in case of SSR: server and client; or in case of snapshot test: on the first match and re-running the test.\n\nTo fix it, set the prop [`uniqueKey`](https://github.com/danilowoz/react-content-loader#uniquekey-string---web-only), then the id will not be random anymore:\n\n```jsx\nimport { Facebook } from 'react-content-loader'\n\nconst MyFacebookLoader = () => <Facebook uniqueKey=\"my-random-valye\" />\n```\n\n#### **Black box in Safari / iOS (again)**\n\nUsing the base tag on a page that contains SVG elements fails to render and it looks like a black box. Just remove the **base-href** tag from the `<head />` and issue solved.\n\n<img width=\"350\" src=\"https://user-images.githubusercontent.com/11562881/39406054-2f308de6-4bce-11e8-91fb-bbb35e29fc10.png\" alt=\"black box\" />\n\nSee: [#93](https://github.com/danilowoz/react-content-loader/issues/93) / [109](https://github.com/danilowoz/react-content-loader/issues/109)\n\n#### Browser supports SVG-Animate\n\nOld browser doesn't support animation in SVG ([compatibility list](https://caniuse.com/#search=SVGAnimateElement)), and if your project must support IE for examples, here's a couple of ways to make sure that browser supports SVG Animate:\n\n- `window.SVGAnimateElement`\n- `document.implementation.hasFeature(\"http://www.w3.org/TR/SVG11/feature#SVG-Animation\", \"1.1\")`\n- Or even use https://modernizr.com/\n\n## Similar packages\n\n- React Native: [rn-placeholder](https://github.com/mfrachet/rn-placeholder), [react-native-svg-animated-linear-gradient](https://github.com/virusvn/react-native-svg-animated-linear-gradient);\n- [Preact](https://github.com/bonitasoft/preact-content-loader);\n- Vue.js: [vue-content-loading](https://github.com/LucasLeandro1204/vue-content-loading), [vue-content-loader](https://github.com/egoist/vue-content-loader);\n- Angular: [ngx-content-loading](https://github.com/Gbuomprisco/ngx-content-loading), [ngx-content-loader](https://github.com/NetanelBasal/ngx-content-loader).\n\n---\n\n## Development\n\nFork the repo then clone it\n\n```\n$ git clone git@github.com:YourUsername/react-content-loader.git && cd react-content-loader\n```\n\n`$ npm i`: Install the dependencies;\n\n`$ npm run build`: Build to production;\n\n`$ npm run dev`: Run the docz to see your changes;\n\n`$ npm run test`: Run all tests: type checking, unit tests on web and native;\n\n`$ yarn test:watch`: Watch unit tests;\n\n`$ yarn tsc`: Typescript checking;\n\n`$ yarn tsc:watch`: Typescript checking with watching;\n\n### Commit messages\n\nCommit messages should follow the [commit message convention](https://conventionalcommits.org/) so, changelogs could be generated automatically by that. Commit messages are validated automatically upon commit. If you aren't familiar with the commit message convention, you can use yarn commit (or `npm run commit`) instead of git commit, which provides an interactive CLI for generating proper commit messages.\n\n## License\n\n[MIT](https://github.com/danilowoz/react-content-loader/blob/master/LICENSE)\n","engines":{"node":">=10"},"gitHead":"6290823f2d9d34067bc569da55c3f2bb27c2656e","scripts":{"dev":"start-storybook -p 6006","lint":"eslint --ext .jsx --ext .ts,.tsx src/","test":"npm run test:tsc && npm run test:unit","build":"rm -fr ./dist ./native && rollup -c && npm run test:size","commit":"git-cz","format":"prettier --write \"src/**/*.{ts,tsx}\"","release":"semantic-release","test:tsc":"tsc","test:size":"bundlesize","test:unit":"npm run test:unit:web && npm run test:unit:native","test:watch":"npm run test:unit -- --watch","deploy:docs":"storybook-to-ghpages","test:unit:web":"jest -c jest.web.config.js","test:tsc:watch":"npm run tsc -- --watch","test:unit:native":"jest -c jest.native.config.js"},"_npmUser":{"name":"danilowoz","email":"danilowoz@gmail.com"},"bundlesize":[{"path":"./dist/react-content-loader.min.js","maxSize":"2 kB"},{"path":"./native/react-content-loader.native.es.js","maxSize":"3 kB"}],"commitlint":{"extends":["@commitlint/config-conventional"]},"repository":{"url":"git+https://github.com/danilowoz/react-content-loader.git","type":"git"},"_npmVersion":"6.14.5","description":"SVG-Powered component to easily create placeholder loadings (like Facebook cards loading)","directories":{},"jsnext:main":"dist/react-content-loader.es.js","sideEffects":false,"_nodeVersion":"14.5.0","dependencies":{},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"24.9.0","husky":"3.1.0","react":"16.9.0","eslint":"6.8.0","rollup":"1.27.14","ts-jest":"^26.4.0","prettier":"1.19.1","react-dom":"16.12.0","babel-core":"7.0.0-bridge.0","babel-jest":"24.9.0","bundlesize":"0.18.0","commitizen":"^4.2.1","typescript":"3.7.4","@babel/core":"7.7.7","@types/jest":"24.0.24","@types/react":"16.9.17","babel-eslint":"10.0.3","babel-loader":"8.0.6","react-native":"^0.63.2","@babel/runtime":"7.7.7","@babel/polyfill":"7.7.0","@babel/register":"7.7.7","@commitlint/cli":"^11.0.0","@storybook/react":"5.2.8","@types/react-dom":"16.9.4","react-native-svg":"9.13.6","semantic-release":"15.14.0","@babel/preset-env":"7.7.7","@storybook/addons":"5.2.8","eslint-plugin-jest":"23.1.1","rollup-plugin-copy":"3.1.0","@babel/preset-react":"7.7.4","@types/react-native":"0.60.26","eslint-plugin-react":"7.17.0","react-test-renderer":"16.12.0","rollup-plugin-uglify":"6.0.4","rollup-plugin-replace":"2.2.0","@storybook/addon-notes":"5.2.8","@significa/eslint-config":"0.0.9","react-syntax-highlighter":"^12.2.1","awesome-typescript-loader":"5.2.1","cz-conventional-changelog":"3.0.2","eslint-plugin-react-hooks":"2.3.0","rollup-plugin-typescript2":"0.25.3","@significa/prettier-config":"0.0.9","@types/react-test-renderer":"16.9.1","@storybook/storybook-deployer":"^2.8.6","@commitlint/config-conventional":"8.2.0","metro-react-native-babel-preset":"0.57.0","@typescript-eslint/eslint-plugin":"2.13.0"},"peerDependencies":{"react":"^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/react-content-loader_6.0.0-beta.2_1601842381672_0.4657619334350249","host":"s3://npm-registry-packages"},"publish_time":1601842381770,"_cnpm_publish_time":1601842381770,"dist-tags":{"beta":"6.0.0-beta.2","latest":"7.1.2","next":"5.0.4-rc1"}}