@object-ui/providers
v18.3.0
Published
Reusable context providers for ObjectUI applications
Maintainers
Readme
@object-ui/providers
Reusable Context Providers for ObjectUI
React context providers for ObjectUI applications that third-party systems can use without console dependencies — today, the upload adapter context.
Installation
pnpm add @object-ui/providersProviders
Every example below compiles against this package's built types. The values your
own app supplies are written as declare const stand-ins so each block stands
alone.
UploadProvider
The ambient upload adapter the @object-ui/fields file, image and avatar widgets
upload through (useUpload() reads it). Without a provider they fall back to
createObjectUrlAdapter(), which persists nothing and is a no-crash default, not
an upload destination.
import type { ReactNode } from 'react';
import { UploadProvider, createObjectStackUploadAdapter } from '@object-ui/providers';
declare const App: () => ReactNode;
const adapter = createObjectStackUploadAdapter({ baseUrl: 'https://api.example.com' });
<UploadProvider adapter={adapter}>
<App />
</UploadProvider>createS3Adapter and createAzureBlobAdapter build adapters for presigned
S3 and Azure Blob uploads; any object with a name and an upload(file, opts)
method is an UploadAdapter.
Retired providers
DataSourceProvider / useDataSource, MetadataProvider / useMetadata and
ThemeProvider / useTheme are no longer exported from this package. Use the
ones the rest of ObjectUI reads instead:
- the data source:
SchemaRendererProvider(itsdataSourceprop) from@object-ui/react; - metadata:
MetadataProvider/useMetadatafrom@object-ui/app-shell; - theme:
ThemeProvider/useThemefrom@object-ui/react(defaultModetakesauto | light | dark; the oldsystemspelling isauto).
Links
License
MIT — see LICENSE.
