Skip to content

feat(media): MediaLibrary and MediaPicker on a storage adapter - #625

Merged
lorant-one merged 3 commits into
previewfrom
feat/media-library-adapter
Nov 28, 2026
Merged

lorant-one merged 3 commits into
previewfrom
feat/media-library-adapter

Conversation

@lorant-one

Copy link
Copy Markdown
Member

Requested by Lorant · project thread

A media library that works on any storage, ported from Aveiro's src/components/media-library/ onto core's FileTree, Media and MediaUpload. 3.1.x candidate; additive only, nothing existing changes.

What's in it

On @once-ui-system/core/media:

  • MediaLibrary has a folder tree, a searchable tile grid with paging (InfiniteScroll) and drop-to-upload with a progress tile. You can select one or several files, rename them, move them (from a menu or by dragging onto a folder; a selected tile drags the whole selection) and delete them. It covers loading, empty, no-results and error-with-Retry states. When the library is empty and only takes images, the empty state is a MediaUpload drop zone.
  • MediaPicker is the "choose an image" dialog. It wraps MediaLibrary in a Dialog and gives back the picked assets. A double click chooses a file straight away. accept limits it by kind and multiple lets you pick several.
  • The adapter contract (mediaAdapter.ts):
    • list is the only required method.
    • Optional methods: upload, remove, move, rename, listFolders, createFolder, renameFolder, removeFolder.
    • Each control shows only when the adapter has the method behind it, so { list } alone gives a read-only grid.
    • The component never fetches anything itself.
  • createMemoryMediaAdapter() is an in-memory adapter for prototypes, docs and tests. There are also mediaKindOfFile and formatMediaSize helpers.

Writes are optimistic and roll back on failure. If a ToastProvider is mounted, the failure shows as a danger toast; without one, it shows as an inline Feedback. Every string can be translated through labels.

Drag and drop uses native HTML5 drag events, so core gains no dnd dependency.

Checks

  • tsc clean.
  • Full core suite: 353 files, 4948 tests passing. That includes the new media-library.interaction.test.tsx (11 tests, axe included) and the guard tests updated for the new exports.
  • validate-ai-code clean on both components.
  • Biome clean on the new files.
  • AI spec, catalog and the two component slices are regenerated, with new catalog seed entries.
  • CHANGELOG entry under Unreleased.
  • Proof page at apps/dev → /media-library-proof. Screenshots (dark, light, menu, picker, phone) are in the project files under core/media-library/.

Next

  • A Chirio /api/v1/assets adapter on Bunny storage.
  • A Studio Film Assets panel built on this component.
  • Aveiro moves onto it later with its own adapter.

Generated by Claude Code

A media library for any storage, ported from Aveiro's onto core's FileTree,
Media and MediaUpload: folder tree, searchable tile grid with paging, drop to
upload with progress, select, rename, move (menu or drag onto a folder) and
delete. Every read and write goes through an adapter prop, and each control
shows only when the adapter has the method behind it. MediaPicker wraps it in
a Dialog for "choose an image". createMemoryMediaAdapter() backs prototypes
and tests; apps/dev has a proof page at /media-library-proof.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016gNJu1G51Lw3fmNHE7VvzH
The entry now carries Dialog, Dropdown, FileTree and InfiniteScroll for the
library (48.8 KB -> 82.4 KB gzipped for the whole entry; bundlers still drop
what an app does not import).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016gNJu1G51Lw3fmNHE7VvzH
@lorant-one
lorant-one merged commit f186797 into preview Nov 28, 2026
9 checks passed
@lorant-one
lorant-one deleted the feat/media-library-adapter branch November 29, 2026 13:44
@lorant-one lorant-one added the approved label Nov 29, 2026 — with Claude
@lorant-one lorant-one mentioned this pull request Nov 29, 2026
12 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants