diff --git a/.gitignore b/.gitignore index afe49bfb..c72619e3 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,8 @@ yarn-debug.log* yarn-error.log* hidden -.cursorrules \ No newline at end of file +.cursorrules +/examples/**/node_modules +/examples/**/.next +/examples/**/build +/examples/**/dist \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 661edcd2..a9a3c75e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,167 @@

Files ui

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. -Thils file also consider all dropzone-ui [releases](https://github.com/dropzone-ui/dropzone-ui-react/releases). +This file also consider all dropzone-ui [releases](https://github.com/dropzone-ui/dropzone-ui-react/releases). + +## [2.0.0](https://github.com/files-ui/files-ui-react/releases/tag/v2.0.0) (2026-07-28) + +## ✨ Major Release — Headless Architecture, Server Actions & RSC Boundaries + +### Summary + +v2.0.0 is a fully backward-compatible major release. All existing component APIs continue to work unchanged. The new capabilities are opt-in. + +--- + +### New Features + +#### Headless Hook — `useFilesUI` + +A framework-agnostic hook that extracts all validation, upload orchestration, and state management from `` and ``. Use it to build fully custom upload UIs without any of the library's default styling. + +```tsx +import { useFilesUI } from "@files-ui/react"; + +function MyCustomUploader() { + const { files, isUploading, uploadFiles, getDragHandlers, getInputProps } = useFilesUI({ + accept: "image/*", + maxFileSize: 5 * 1024 * 1024, + url: "/api/upload", + }); + return ( +
+ + +
+ ); +} +``` + +#### Server Actions — `action` prop + +Native Next.js 16 App Router Server Actions support. Pass a Server Action directly to `` or `` — no manual `fetch()` calls required. + +```tsx +// app/actions/upload.ts +"use server"; +export async function uploadFile(formData: FormData) { + const file = formData.get("file") as File; + return { success: true, message: `Received ${file.name}` }; +} + +// app/upload/UploadPanel.tsx +"use client"; +import { Dropzone } from "@files-ui/react/client/dropzone"; +import { uploadFile } from "../actions/upload"; +export default function UploadPanel() { + return ; +} +``` + +New core exports: + +- `uploadExtFileViaAction(extFile, action, uploadLabel?)` — uploads a single file via Server Action +- `uploadExtFilesViaAction(extFiles, action, uploadLabel?, maxConcurrency?, onFileComplete?)` — uploads multiple files + +#### RSC Client Boundaries + +Each interactive component now ships a dedicated client-only import path for safe use in Next.js 16 App Router without accidentally pulling browser code into Server Components. + +```tsx +import { Dropzone } from "@files-ui/react/client/dropzone"; +import { FileInputButton } from "@files-ui/react/client/file-input-button"; +import { FileCard } from "@files-ui/react/client/file-card"; +import { FileMosaic } from "@files-ui/react/client/file-mosaic"; +import { Avatar } from "@files-ui/react/client/avatar"; +import { FullScreen } from "@files-ui/react/client/full-screen"; +``` + +The root import `from "@files-ui/react"` continues to work for non-Next.js consumers. + +New named exports in root: `DropzoneClient`, `DropzoneContainer`, `FileInputButtonClient`, `FileInputButtonContainer`, `FileCardClient`, `FileCardContainer`, `FileMosaicClient`, `FileMosaicContainer`, `AvatarClient`, `AvatarContainer`, `FullScreenClient`, `FullScreenContainer`. + + +#### Font loading behavior (Poppins opt-in) + +- Removed automatic Google Fonts `@import` from component stylesheets (`Avatar`, `Dropzone`, `FileCard`, `FileMosaic`, `MaterialButton`) +- Updated component font declarations to use fallback stack: + - `"Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif` +- Updated tooltip styles to use the same fallback stack +- Consumers who want `Poppins` should load it explicitly in their application +- Added documentation: `docs/react/Fonts.md` + +#### Global `fontFamily` config via `FilesUiProvider` + +- Added `fontFamily` prop to `FilesUIConfig` +- When set, `FilesUiProvider` injects a single `