@dyrected/admin 2.5.51 → 2.5.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin.css +188 -67
- package/dist/components/forms/__tests__/nested-editor-context.test.d.ts +1 -0
- package/dist/components/forms/__tests__/resolveContainerPath.test.d.ts +1 -0
- package/dist/components/forms/form-engine.d.ts +7 -1
- package/dist/components/forms/nested-editor-context.d.ts +86 -0
- package/dist/components/forms/utils.d.ts +19 -0
- package/dist/components/layout/admin-splash.d.ts +12 -0
- package/dist/components/layout/sidebar-control.d.ts +12 -0
- package/dist/hooks/use-add-media-from-url.d.ts +25 -0
- package/dist/hooks/usePreference.d.ts +13 -0
- package/dist/index.mjs +1845 -975
- package/dist/lib/external-media.d.ts +39 -0
- package/package.json +4 -4
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface SidebarControlValue {
|
|
2
|
+
/** Whether the desktop nav sidebar is currently collapsed. */
|
|
3
|
+
collapsed: boolean;
|
|
4
|
+
/** Set the collapsed state imperatively (e.g. auto-collapse for live preview). */
|
|
5
|
+
setCollapsed: (collapsed: boolean) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const SidebarControlProvider: import('react').Provider<SidebarControlValue>;
|
|
8
|
+
/**
|
|
9
|
+
* Access the admin shell's sidebar collapse control. Returns null when rendered
|
|
10
|
+
* outside the shell (e.g. embedded previews, tests), so callers should guard.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useSidebarControl(): SidebarControlValue | null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Media } from '@dyrected/sdk';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export interface UseAddMediaFromUrlOptions {
|
|
4
|
+
/** Collection slug to create the external media record in. */
|
|
5
|
+
collection: string;
|
|
6
|
+
/** Called with the created media record after a successful add. */
|
|
7
|
+
onAdded: (media: Media & {
|
|
8
|
+
id: string;
|
|
9
|
+
}) => void | Promise<void>;
|
|
10
|
+
/** Called if the create request fails. */
|
|
11
|
+
onError?: (error: Error) => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Shared behavior for the "add media from a URL" flow used by both the media page
|
|
15
|
+
* upload dialog and the media library picker dialog. Owns the URL input state and
|
|
16
|
+
* the detect → create → callback pipeline so every surface behaves identically for
|
|
17
|
+
* YouTube, Vimeo, external images, and generic files.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useAddMediaFromUrl({ collection, onAdded, onError }: UseAddMediaFromUrlOptions): {
|
|
20
|
+
url: string;
|
|
21
|
+
setUrl: React.Dispatch<React.SetStateAction<string>>;
|
|
22
|
+
submit: () => Promise<void>;
|
|
23
|
+
isSubmitting: boolean;
|
|
24
|
+
canSubmit: boolean;
|
|
25
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* usePreference — read/write a single scalar user preference.
|
|
3
|
+
*
|
|
4
|
+
* `useLayoutPreference` is hard-typed around arrays (it reconciles ordered
|
|
5
|
+
* field lists). This hook is the scalar counterpart: it calls the same
|
|
6
|
+
* `client.getPreference` / `client.setPreference` SDK methods directly and
|
|
7
|
+
* unwraps the `{ key, value }` envelope the SDK returns.
|
|
8
|
+
*/
|
|
9
|
+
export declare function usePreference<T>(key: string, defaultValue: T): {
|
|
10
|
+
value: T;
|
|
11
|
+
setValue: (next: T) => void;
|
|
12
|
+
isLoading: boolean;
|
|
13
|
+
};
|