{"name":"filestack-react","version":"4.1.1","keywords":["filestack-react","filestack","filepicker","react","uploader","upload","file","image","ssr","server"],"author":{"name":"filestack"},"license":"MIT","_id":"filestack-react@4.1.1","maintainers":[{"name":"zerocho","email":"zerohch0@gmail.com"},{"name":"filestack-dev","email":"dev@filestack.com"},{"name":"samuxyz","email":"zaza.samuele@gmail.com"},{"name":"mariahtree","email":"mariah@filestack.com"}],"homepage":"https://github.com/filestack/filestack-react#readme","bugs":{"url":"https://github.com/filestack/filestack-react/issues"},"dist":{"shasum":"e6add2c401f82843212a49eadf60d0648891c4f0","tarball":"http://registry-npm.ywwl.com/filestack-react/download/filestack-react-4.1.1.tgz","fileCount":9,"integrity":"sha512-AYT6J6u/AHtCyXT5V5qVrICpe/ym+9MBDi8Pg6hw9gZ4pjARQcbtIH2vMfW8G/DGn5GPvKNxYtE0ET2rxHX9Bw==","signatures":[{"sig":"MEUCIQCSz7xvi6GNqKNRFJVok2agQLq6oG0n9hXGZaRzvsJYQwIgFoqKFU3fDouAwgxaaJTLczE/F6WEOOiZNF/sUIoBZkk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":275541,"size":58661,"noattachment":false,"key":"/filestack-react/-/filestack-react-4.1.1.tgz"},"main":"dist/filestack-react.js","module":"dist/filestack-react.modern.js","source":"src/index.js","engines":{"node":">=10"},"gitHead":"4e8e65efd301a18e2af6d1c674381275af3b0093","scripts":{"test":"run-s test:unit test:lint test:build","build":"microbundle-crl --no-compress --format modern,cjs","start":"microbundle-crl watch --no-compress --format modern,cjs","prepare":"run-s build","release":"standard-version","test:lint":"eslint .","test:unit":"cross-env CI=1 react-scripts test --env=jsdom","build:prod":"microbundle-crl --compress --format modern,cjs","docs:build":"cd example && npm install && npm run build","test:build":"run-s build","test:watch":"react-scripts test --env=jsdom"},"_npmUser":{"name":"filestack-dev","email":"dev@filestack.com"},"repository":{"url":"git+https://github.com/filestack/filestack-react.git","type":"git"},"_npmVersion":"6.14.18","description":"Official React component for Filestack - API and content management system that makes it easy to add powerful file uploading and transformation capabilities to any web or mobile application.","directories":{},"_nodeVersion":"14.21.3","dependencies":{"filestack-js":"^3.44.2"},"_hasShrinkwrap":false,"devDependencies":{"gulp":"^4.0.2","react":"^16.13.1","eslint":"^6.8.0","aws-sdk":"^2.808.0","gh-pages":"^2.2.0","gulp-sri":"^0.3.1","prettier":"^2.0.4","cross-env":"^7.0.2","react-dom":"^16.13.1","npm-run-all":"^4.1.5","babel-eslint":"^10.0.3","git-rev-sync":"^3.0.1","react-scripts":"^3.4.1","gulp-s3-publish":"^3.0.0","microbundle-crl":"^0.13.10","standard-version":"^9.0.0","eslint-plugin-node":"^11.0.0","eslint-plugin-react":"^7.17.0","react-test-renderer":"^16.14.0","eslint-plugin-import":"^2.18.2","eslint-plugin-promise":"^4.2.1","@testing-library/react":"^11.2.2","eslint-config-prettier":"^6.7.0","eslint-config-standard":"^14.1.0","eslint-plugin-prettier":"^3.1.1","eslint-plugin-standard":"^4.0.1","@testing-library/react-hooks":"^3.4.2","eslint-config-standard-react":"^9.2.0"},"peerDependencies":{"react":"^16.13.1","react-dom":"^16.13.1"},"_npmOperationalInternal":{"tmp":"tmp/filestack-react_4.1.1_1762345907848_0.3210508270136625","host":"s3://npm-registry-packages-npm-production"},"readme":"<p align=\"center\"><img src=\"logo.svg\" align=\"center\" width=\"80\"/></p>\n<h1 align=\"center\">filestack-react</h1>\n<p align=\"center\">\n  Official React components for <a href=\"https://www.filestack.com\">Filestack</a> — upload, transform, and deliver files with a few lines of JSX.\n</p>\n<p align=\"center\">\n  <a href=\"https://github.com/filestack/filestack-react/actions/workflows/test.yml\">\n    <img src=\"https://github.com/filestack/filestack-react/actions/workflows/test.yml/badge.svg\" alt=\"Tests\" />\n  </a>\n  <a href=\"https://npmjs.com/package/filestack-react\">\n    <img src=\"https://img.shields.io/npm/v/filestack-react.svg\" alt=\"npm version\" />\n  </a>\n  <img src=\"https://img.shields.io/badge/types-included-blue.svg\" alt=\"TypeScript types included\" />\n  <img src=\"https://img.shields.io/bundlephobia/min/filestack-react.svg\" alt=\"bundle size\" />\n</p>\n<hr>\n\n**Contents**\n- [Overview](#overview)\n- [Requirements](#requirements)\n- [Install](#install)\n- [Quick start](#quick-start)\n- [Components](#components)\n- [Props](#props)\n- [FilestackProvider](#filestackprovider)\n- [TypeScript](#typescript)\n- [The filestack-js client](#the-filestack-js-client)\n- [Server-side rendering & frameworks](#server-side-rendering--frameworks)\n- [Migrating from v6](#migrating-from-v6)\n- [Older migrations](#older-migrations)\n- [Development](#development)\n- [Documentation](#documentation)\n- [Contributing](#contributing)\n\n## Overview\n\n`filestack-react` is a thin wrapper around [filestack-js](https://github.com/filestack/filestack-js). It gives you three picker components — overlay, inline, and drop pane — plus an optional context provider, and re-exports the full filestack-js client if you need the lower-level API. Anything you can do with filestack-js, you can do here.\n\nThe library is written in TypeScript and ships its own `.d.ts` files, so there's no `@types/filestack-react` to install.\n\n## Requirements\n\n| | Version |\n|---|---|\n| React / React DOM | `18.3+` or `19` |\n| filestack-js | `4.x` — installed by you as a peer dependency (see below) |\n| Node (to build/develop) | `18+` |\n\n## Install\n\nfilestack-js is a **peer dependency** as of v7, so install both packages:\n\n```bash\nnpm install filestack-react filestack-js\n```\n\nIf you skip `filestack-js`, npm will warn about an unmet peer dependency and the picker won't initialize.\n\n## Quick start\n\n```jsx\nimport { PickerOverlay } from 'filestack-react';\n\n<PickerOverlay\n  apikey={YOUR_API_KEY}\n  onUploadDone={(res) => console.log(res.filesUploaded)}\n/>\n```\n\nThat's a working uploader. `apikey` is the only thing you have to pass (or set it once on a [`FilestackProvider`](#filestackprovider)).\n\n## Components\n\nAll three components take the same props. The only difference is how the picker is presented.\n\n**Overlay** — opens the picker in a modal over your page:\n\n```jsx\n<PickerOverlay apikey=\"YOUR_APIKEY\" onUploadDone={handleUploadDone} />\n```\n\n**Inline** — renders the picker inside the page. Without a child container it draws a 500px-tall `<div>`:\n\n```jsx\n<PickerInline apikey=\"YOUR_APIKEY\" onUploadDone={handleUploadDone} />\n```\n\n**Drop pane** — a drag-and-drop target:\n\n```jsx\n<PickerDropPane apikey=\"YOUR_APIKEY\" onUploadDone={handleUploadDone} />\n```\n\n**Bring your own container.** Pass a single child element and the picker mounts into it (the component clones your element and gives it the id it needs):\n\n```jsx\n<PickerInline apikey=\"YOUR_APIKEY\">\n  <div className=\"my-container\" style={{ height: 400 }} />\n</PickerInline>\n```\n\n## Props\n\n| Prop | Type | Required | Default | Description |\n|---|---|---|---|---|\n| `apikey` | `string` | Yes\\* | — | Your Filestack API key. \\*Optional on the component if a [`FilestackProvider`](#filestackprovider) supplies it. |\n| `pickerOptions` | `object` | No | `{}` | Passed to `client.picker(...)`. See [PickerOptions](https://filestack.github.io/filestack-js/interfaces/pickeroptions.html). `displayMode` is set for you per component. |\n| `clientOptions` | `object` | No | `{}` | Passed to `Filestack(apikey, ...)`. See [ClientOptions](https://filestack.github.io/filestack-js/interfaces/clientoptions.html). |\n| `onUploadDone` | `(res: PickerResponse) => void` | No | no-op | Called when all files finish uploading. |\n| `onError` | `(err) => void` | No | no-op | Called if `picker.open()` rejects. |\n| `onSuccess` | `(res: PickerResponse) => void` | No | no-op | **Deprecated** — use `onUploadDone`. Still works; if both are set, `onUploadDone` is the one that fires. |\n| `children` | `ReactElement` | No | — | Optional custom container. Cloned with the generated id so the picker mounts inside it. |\n\nCallbacks are silent by default in v7 — nothing is logged unless you pass a handler.\n\n## FilestackProvider\n\nNew in v7. If you use pickers in more than one place, set the shared values once instead of repeating them:\n\n```tsx\nimport { FilestackProvider, PickerOverlay, PickerInline } from 'filestack-react';\n\n<FilestackProvider apikey={process.env.REACT_APP_FILESTACK_KEY}>\n  <PickerOverlay onUploadDone={handleUploadDone} />\n  <PickerInline pickerOptions={{ maxFiles: 3 }} />\n</FilestackProvider>\n```\n\nHow values resolve:\n\n- **Scalars** (`apikey`, `onUploadDone`, `onError`, `onSuccess`) — a prop set directly on a picker wins; otherwise the provider's value is used.\n- **`pickerOptions` / `clientOptions`** — shallow-merged, with the provider as the base and the component's options on top.\n\nIt's entirely opt-in. If you'd rather pass `apikey` to each picker, keep doing that — you don't need the provider.\n\n## TypeScript\n\nThe package bundles its own declarations — install it and import, no `@types/*` needed.\n\n```tsx\nimport {\n  PickerOverlay,\n  FilestackProvider,\n  type PickerOverlayProps,\n  type PickerResponse,\n  type PickerOptions,\n  type ClientOptions\n} from 'filestack-react';\n\nconst pickerOptions: PickerOptions = { maxFiles: 5, accept: ['image/*'] };\nconst clientOptions: ClientOptions = { cname: 'cdn.example.com' };\n\nconst handleUploadDone = (res: PickerResponse) => {\n  res.filesUploaded.forEach((file) => console.log(file.url));\n};\n\nconst App = () => (\n  <FilestackProvider apikey={process.env.REACT_APP_FILESTACK_KEY!}>\n    <PickerOverlay\n      pickerOptions={pickerOptions}\n      clientOptions={clientOptions}\n      onUploadDone={handleUploadDone}\n      onError={(err) => console.error(err)}\n    />\n  </FilestackProvider>\n);\n```\n\nBecause `PickerOptions`, `ClientOptions`, and `PickerResponse` come from filestack-js, you get autocomplete on every nested option (`maxFiles`, `accept`, `fromSources`, `transformations`, and the rest).\n\nEvery public type is exported from the package root: `PickerBaseProps`, `PickerOverlayProps`, `PickerInlineProps`, `PickerDropPaneProps`, `FilestackProviderProps`, `FilestackContextValue`, and `UsePickerResult`, alongside the upstream filestack-js types.\n\n## The filestack-js client\n\nNeed the lower-level SDK? It's re-exported:\n\n```jsx\nimport { client } from 'filestack-react';\n\nconst fsClient = client.init('YOUR_APIKEY');\nfsClient.upload(file);\n```\n\n## Server-side rendering & frameworks\n\nThe picker runs in the browser — it initializes inside `useEffect`, so it never executes during a server render.\n\n**Next.js App Router.** Every component ships with a `'use client'` directive, so you can import them straight into your App Router files without wrapping them yourself:\n\n```tsx\n// app/upload/page.tsx\nimport { PickerOverlay } from 'filestack-react';\n\nexport default function UploadPage() {\n  return <PickerOverlay apikey={process.env.NEXT_PUBLIC_FILESTACK_KEY!} />;\n}\n```\n\n**Next.js Pages Router, Gatsby, and other SSG setups.** These generally work as-is. If a build step tries to evaluate the picker on the server, load it client-side only:\n\n```tsx\nimport dynamic from 'next/dynamic';\n\nconst PickerOverlay = dynamic(\n  () => import('filestack-react').then((m) => m.PickerOverlay),\n  { ssr: false }\n);\n```\n\n## Migrating from v6\n\nMost v6 apps need two changes: install filestack-js, and (eventually) rename one callback.\n\n1. **Install filestack-js yourself.** It's a peer dependency now:\n   ```bash\n   npm install filestack-react@7 filestack-js@^4\n   ```\n2. **Check your React and Node versions** — React 18.3+ or 19, Node 18+. React 16/17 are no longer supported.\n3. **Remove `@types/filestack-react`** if you had it — types ship in the package now.\n4. **Move off `onSuccess`** when convenient. It still works but is deprecated; `onUploadDone` is the replacement.\n\n| v6 | v7 | Notes |\n|---|---|---|\n| `apikey`, `pickerOptions`, `clientOptions` | same | Unchanged |\n| `onUploadDone`, `onError` | same | Unchanged |\n| `onSuccess` | `onUploadDone` | `onSuccess` still works but is deprecated |\n| filestack-js bundled as a dependency | filestack-js `^4` peer dependency | Install it in your app |\n| React 16/17/18 | React 18.3+ / 19 | |\n| plain JavaScript | TypeScript types included | Drop `@types/filestack-react` |\n\nThe picker UI itself now comes from filestack-js 4. If you relied on specific 3.x picker behavior, skim the [filestack-js changelog](https://github.com/filestack/filestack-js/blob/master/CHANGELOG.md).\n\n## Older migrations\n\n<details>\n<summary>Migrating from 3.x / 4.x</summary>\n\n| 3.x | 4.0.0 | Comment |\n|---|---|---|\n| apikey | apikey | |\n| actionOptions | pickerOptions | Consistent with other Filestack libs |\n| clientOptions | clientOptions | |\n| onSuccess | onSuccess | |\n| onError | onError | |\n| N/A | children | Used for a custom container |\n| action | N/A | Picker action is always `pick` |\n| file | N/A | Removed |\n| source | N/A | Removed |\n| customRender | N/A | Removed — you render the container |\n| componentDisplayMode | N/A | Removed — you render the container |\n\n</details>\n\n<details>\n<summary>Migrating from 1.x / 2.x</summary>\n\n| 2.x | 3.0.0 | Comment |\n|---|---|---|\n| apikey | apikey | |\n| mode | action | |\n| options | actionOptions | |\n| preload | N/A | Assets are preloaded by default |\n| onSuccess | onSuccess | |\n| onError | onError | |\n| security | clientOptions.security | Grouped under `clientOptions` |\n| cname | clientOptions.cname | Grouped under `clientOptions` |\n| sessionCache | clientOptions.sessionCache | Grouped under `clientOptions` |\n\n</details>\n\n## Development\n\nComponents live in `src/picker/`. After making a change:\n\n```bash\nnpm run build   # bundle\nnpm run test    # unit tests, lint, and a build check\nnpm run test:types   # tsc --noEmit\n```\n\n## Documentation\n\nFull option reference (client methods, picker options) lives in the filestack-js docs:\n[https://filestack.github.io/filestack-js/](https://filestack.github.io/filestack-js/)\n\n## Contributing\n\nContributions and ideas are welcome. We follow the [Conventional Commits](https://www.conventionalcommits.org/) spec so the changelog stays consistent — please match it in your commit messages.\n","publish_time":1762345908024,"_cnpm_publish_time":1762345908024,"dist-tags":{"beta":"7.0.0-beta.1","latest":"7.0.1"}}