import { FloatingMessageBlock, MessageTypes } from '@c-fo/vibes'; import { ComponentProps } from 'react'; import { ApiPayloadOptions } from './pages/fetcher'; import { RequestMethodType } from './types'; export type NotificationType = { message: string; type: 'success' | 'error'; }; export type SetNotificationType = (notification: NotificationType | undefined) => void; type ScreenMessage = { body: string; type: keyof MessageTypes; } & Omit, 'message' | keyof MessageTypes>; export type UrlOptionOrder = 'search-hash' | 'hash-search'; export declare const useStandardUIContext: () => { historyPushState: (path: string) => void; historyReplaceState: (path: string) => void; setNotification: SetNotificationType; apiPayloadOptions?: ApiPayloadOptions | undefined; requestHeaders: Partial>>; providerMounted: boolean; urlOptionOrder: UrlOptionOrder; }; /** * StandardUI間で共通のコンテキストを扱うためのProviderです * 標準UIを使用しているApplication全体をラップすると、 * 標準UIのコンポーネントはここに渡したPropsを参照するようになります * * WARN: このコンポーネントに渡すオブジェクトや関数はメモ化してください(再描画抑制のため) */ export declare const StandardUIProvider: ({ children, historyPushState, historyReplaceState, apiPayloadOptions, requestHeaders, ...props }: { children: React.ReactNode; /** * history.pushStateに該当する処理 * 標準UI内部での遷移に使用される * * ex: react-router の場合は useNavigate の返り値を渡してください * https://reactrouter.com/en/main/hooks/use-navigate#usenavigate * * must be memoize * * @default (url) => history.pushState({}, '', location.pathname); */ historyPushState?: ((path: string) => void) | undefined; /** * history.replaceStateに該当する処理 * 標準UI内部での遷移に使用される * ex: react-router の場合は useNavigate の返り値に * { replace: true } を渡すようにラップした関数を渡してください * https://reactrouter.com/en/main/hooks/use-navigate#optionsreplace * * must be memoize * * @default (url) => history.replaceState({}, '', location.pathname); */ historyReplaceState?: ((path: string) => void) | undefined; /** * 操作に対するフィードバックとしてMessageBlockを表示するための関数 * global-navigationを使用している場合はuseGlobalNavigationContextから取得したshowScreenMessageを渡してください * const { showScreenMessage } = useGlobalNavigationContext(); * * must be memoize * * @default 標準UI内部のFloatingMessageBlockを使用します */ showScreenMessage?: ((message: ScreenMessage) => unknown) | undefined; /** * リクエストパラメータ、レスポンスのフォーマット設定 * 基本的にはResourceContainerで使用されるオプションですが、 * parametersのみListControlAreaに影響します * * must be memoize */ apiPayloadOptions?: ApiPayloadOptions | undefined; /** * ResourceContainerでAPIリクエスト時に付与する共通のヘッダーをカスタムしたい場合は設定してください * * must be memoize */ requestHeaders?: Partial>> | undefined; /** * URLのクエリパラメーターとハッシュの順番を指定します * react-router v3 + hashRouterの場合はhash-searchを推奨します * (他のバージョンについては未確認) * * @default 'search-hash' */ urlOptionOrder?: UrlOptionOrder | undefined; }) => JSX.Element; export {};