{"name":"react-content-loader","version":"5.0.4-rc1","keywords":["react","react-native","skeleton","placeholder","loader","loading","content","svg"],"author":{"name":"Danilo Woznica","email":"danilowoz@gmail.com"},"license":"MIT","_id":"react-content-loader@5.0.4-rc1","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":"619ad835548baf04a9d7af492446e4d783b33f22","tarball":"http://registry-npm.ywwl.com/react-content-loader/download/react-content-loader-5.0.4-rc1.tgz","fileCount":114,"integrity":"sha512-8Kh8Pf/nw7BSAZ1InR0J/1JiUZokM3gRsmRQmWi3kmLVDIBAQ8t4bl5Morbk0np50b1jgD+F0g1dIAKzuxCMdg==","signatures":[{"sig":"MEUCIFOIbIlSMmdWOIQHBtfTS3Glzbra+ROPs3v3Dm7pWza/AiEA/rTkNJ331GAeRUADJ86LMIhQuiLWBhkgxOToOBP+YuM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":156097,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJejDx6CRA9TVsSAnZWagAA6tEP/17vEmGYIeyb8ghqlO3K\nxB1DBqZNYRoHHPQYS6HMkWolh3zi9I84bjaKijkb/M8cL5AOC7uxfoUnfP5O\nNHIcN1J1G4o+LSnqb/q0GuFiy1psub7T37tOD4dPWHNc5Rub1GAhZV9I31Kc\namKuAhi5l+bB1qwtXj4j6HCL4zzrpeX4b7A4yUDRnhvdoDmh5+XLVJ2mrQYH\naUiQCILElIUs0PKkMVoWlZ66wDlLk47i4kqiW7EaUaMAsObaQ6epAEU4oPR0\nVt4uYJYEoXfHwoIStHyQQbdadVXI9Jdm5MnAsK069MfLcEXVXboWH+HImu0x\nPSaarDpXXLYR02M9cONi6sLsCqopkgoXDsfQc1otAqZVvovBsW8BtC251vO6\nm3vXmfO8u2DxdnZLnQKuQHBXl6FKZP46wvRR7+EO99lg+/YgPLa6RVfLB+Vz\nMJz1o0c0hM6dn2plDpmCWctaLJNr0fXdyFTmN+r8IfncPTcUqaeBAt2xwiLC\n4nBn5QdSj553ZSkbUy3i12WmhXojXf+QobVA+s7JbGORcli+pAnMbaKn/LXK\npmGVgNJ4BinQX0QKEmWlXtKy/XZ4uoWUNMSOnFEmiODyBgUKI41tVKecbxlE\nG8KGYYTS20aC5etaCybUdYGQ3bXfQqClSZpkBK+LrRH5Dm8lpuQJfO1qv6Wz\nBjkH\r\n=Kj36\r\n-----END PGP SIGNATURE-----\r\n","size":22269,"noattachment":false,"key":"/react-content-loader/-/react-content-loader-5.0.4-rc1.tgz"},"main":"dist/react-content-loader.cjs.js","_from":"file:react-content-loader-5.0.4-rc1.tgz","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.github.io/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.github.io/create-react-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#### **`animate?: boolean`**\n\nDefaults to `true`. Opt-out of animations with `false`\n\n#### **`title?: string`** - _Web only_\n\nDefaults to `Loading interface...`. It's used to describe what element it is. Use ''(empty string) to remove.\n\n#### **`baseUrl?: string`** - _Web only_\n\nRequired if you're using `<base url=\"/\" />` document `<head/>`. \nDefaults to an empty string. This prop is common used as: `<ContentLoader baseUrl={window.location.pathname} />` which will fill the SVG attribute with the relative path. Related [#93](https://github.com/danilowoz/react-content-loader/issues/93).\n\n#### **`speed?: number`**\n\nDefaults to `1.2`. Animation speed in seconds.\n\n#### **`interval?: number`** - _Web only_\n\nDefaults to `0.25`. Interval of time between runs of the animation, as a fraction of the animation speed.\n\n#### **`viewBox?: string`**\n\nUse viewBox props to set a custom viewBox value, for more information about how to use it, read the article [How to Scale SVG](https://css-tricks.com/scale-svg/).\n\n#### **`gradientRatio?: number`** - _Web only_\n\nDefaults to `1.2`. Width of the animated gradient as a fraction of the view box width.\n\n#### **`rtl?: boolean`**\n\nDefaults to `false`. Content right-to-left.\n\n#### **`backgroundColor?: string`**\n\nDefaults to `#f5f6f7` which is used as background of animation.\n\n#### **`foregroundColor?: string`**\n\nDefaults to `#eee` which is used as the foreground of animation.\n\n#### **`backgroundOpacity?: number`** - _Web only_\n\nDefaults to `1`. Background opacity (0 = transparent, 1 = opaque) used to solve an issue in [Safari](#safari--ios)\n\n#### **`foregroundOpacity?: number`** - _Web only_\n\nDefaults to `1`. Animation opacity (0 = transparent, 1 = opaque) used to solve an issue in [Safari](#safari--ios)\n\n#### **`style?: React.CSSProperties`**\n\nDefaults to an empty object.\n\n#### **`uniqueKey?: string`** - _Web only_\n\nDefaults to random unique id. Use the same value of prop key, 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.github.io/create-react-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#### 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\n#### **Alpha is not working: Safari / iOS**\n\nWhen using `rgba` as a `backgroundColor` or `foregroundColor` value, [Safari does not respect the alpha channel](https://github.com/w3c/svgwg/issues/180), meaning that the color will be opaque. To prevent this, instead of using a `rgba` value for `backgroundColor`/`foregroundColor`, use the `rgb` equivalent and move the alpha channel value to the `backgroundOpacity`/`foregroundOpacity` props.\n\n```jsx\n{/* Opaque color in Safari and iOS */}\n<ContentLoader\n  backgroundColor=\"rgba(0,0,0,0.06)\"\n  foregroundColor=\"rgba(0,0,0,0.12)\">\n\n\n{/_ Semi-transparent color in Safari and iOS _/}\n<ContentLoader\n    backgroundColor=\"rgb(0,0,0)\"\n    foregroundColor=\"rgb(0,0,0)\"\n    backgroundOpacity={0.06}\n    foregroundOpacity={0.12}>\n\n\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## 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","scripts":{"dev":"start-storybook -p 6006","lint":"eslint --ext .jsx --ext .ts,.tsx src/","test":"npm run test:tsc && npm run test:unit && npm run build","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"},"_resolved":"","_integrity":"","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.13.4","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":"10.19.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":"24.2.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.0.3","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.62.1","@babel/runtime":"7.7.7","@babel/polyfill":"7.7.0","@babel/register":"7.7.7","@commitlint/cli":"8.2.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.1","@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_5.0.4-rc1_1586248826446_0.8491832144365294","host":"s3://npm-registry-packages"},"publish_time":1586248826604,"_cnpm_publish_time":1586248826604,"dist-tags":{"beta":"6.0.0-beta.2","latest":"7.1.2","next":"5.0.4-rc1"}}