Repository URL to install this package:
|
Version:
0.2.0-dev.38 ▾
|
/// <reference types="react" />
import React$1, { AnchorHTMLAttributes, MouseEvent, ReactNode, Dispatch, SetStateAction } from 'react';
import { To } from 'history';
import { ButtonTypeMap, TypographyProps, AutocompleteProps, CardHeaderProps, CardActionAreaProps, Theme, MenuItemProps, ButtonProps, IconButtonProps, StackProps, TypographyTypeMap, PaperProps, AppBarProps, DrawerProps, AlertColor, AlertProps, ListItemButtonProps, SxProps as SxProps$1, ThemeOptions, PaletteMode } from '@mui/material';
import CSS, { StandardLonghandProperties } from 'csstype';
import * as react_hook_form from 'react-hook-form';
import { UseControllerProps, UseFormProps, FieldPath, RegisterOptions, FormState } from 'react-hook-form';
import { To as To$1, RouteProps } from 'react-router-dom';
import { ResponsiveStyleValue, BoxProps, ContainerProps } from '@mui/system';
import { SxProps, Theme as Theme$1 } from '@mui/material/styles';
import * as notistack from 'notistack';
import { OptionsObject, SnackbarProviderProps } from 'notistack';
import * as axios from 'axios';
import { AxiosInstance } from 'axios';
import * as swr from 'swr';
import { KeyedMutator, SWRResponse, SWRConfiguration, Fetcher } from 'swr';
import * as swr_dist_types from 'swr/dist/types';
declare type objectWithStringKeys = {
[key: string]: any;
};
declare type apiObject = objectWithStringKeys;
interface StatusChipProps {
status: number | string;
statusToPropsMap?: {
[key: number | string]: {};
} | ((arg: apiObject | undefined) => {
[key: number | string]: {};
});
label?: string;
obj?: apiObject;
}
declare const StatusChip: ({ status, statusToPropsMap, label, obj, ...rest }: StatusChipProps) => JSX.Element;
declare type tag = apiObject;
interface TagsChips$1 {
tags: tag[];
gap?: number | string;
getTagKey?: (tag: tag) => number | string;
getTagLabel?: (tag: tag) => number | string;
chipProps?: objectWithStringKeys;
}
declare const TagsChips: ({ tags, gap, getTagKey, getTagLabel, chipProps, }: TagsChips$1) => JSX.Element;
interface LoadingIndicatorProps {
shaded?: boolean;
bgcolor?: string;
sx?: objectWithStringKeys;
}
declare const LoadingIndicator: ({ shaded, bgcolor, sx, ...rest }: LoadingIndicatorProps) => JSX.Element;
interface EndButtonsProps {
children: React$1.ReactNode;
gap?: number;
}
declare const EndButtons: ({ children, gap, ...rest }: EndButtonsProps) => JSX.Element;
interface FabHolderProps {
children: React$1.ReactNode;
spacing?: number;
}
declare const FabHolder: ({ children, spacing, }: FabHolderProps) => JSX.Element;
interface BackButtonProps {
defaultTo: To;
defaultLabel: string;
to?: To;
children?: React$1.ReactNode;
}
interface IStateBack {
to: To;
label?: string;
}
declare type StateBack = To | IStateBack;
declare const BackButton: ({ defaultTo, to, defaultLabel, children, }: BackButtonProps) => JSX.Element;
declare type tabView = {
key: string | number;
label: string;
count?: number;
};
interface ViewTabsProps {
icon?: React$1.ReactNode;
title?: string;
views: tabView[];
activeView: string | number;
setActiveView: (view: string | number) => void;
}
declare const ViewTabs: ({ icon, title, views, activeView, setActiveView }: ViewTabsProps) => JSX.Element;
interface ConfirmingButtonProps {
component?: React$1.FC<any> | React$1.LazyExoticComponent<React$1.FC<any>>;
onConfirm: () => Promise<void>;
tooltip?: string;
color?: ButtonTypeMap['props']['color'];
actionTitle?: string;
children?: React$1.ReactNode;
}
declare const ConfirmingButton: ({ component: Component, onConfirm, tooltip, color, actionTitle, children, ...rest }: ConfirmingButtonProps) => JSX.Element;
interface CopyButtonProps {
contentToCopy: string;
icon?: React$1.ReactNode;
iconSuccess?: React$1.ReactNode;
text?: string;
textSuccess?: string;
tooltip?: string;
component?: React$1.FC<any> | React$1.LazyExoticComponent<React$1.FC<any>>;
color?: ButtonTypeMap['props']['color'];
}
declare const CopyButton: ({ contentToCopy, icon, iconSuccess, text, textSuccess, tooltip, component: Component, color, ...rest }: CopyButtonProps) => JSX.Element;
interface CSSGridProps {
spacing?: number;
gap?: number;
cols?: number;
children: React$1.ReactNode;
}
interface CSSGridItemProps {
span: number | {
[key: string]: number;
};
cols?: number;
children: React$1.ReactNode;
}
declare const CSSGrid: {
({ cols, spacing, gap, children, ...rest }: CSSGridProps): JSX.Element;
Item: ({ children, span, ...rest }: CSSGridItemProps) => JSX.Element;
};
interface UserAvatarProps {
user: apiObject;
getAvatarSrc?: (obj: apiObject) => string;
getLabel?: (obj: apiObject) => string;
getAltText?: (obj: apiObject) => string;
gap?: number;
avatarSize?: StandardLonghandProperties['width'];
labelProps?: TypographyProps;
children?: React$1.ReactNode;
}
declare const UserAvatar: ({ user, getAvatarSrc, getLabel, getAltText, gap, avatarSize, labelProps, children, }: UserAvatarProps) => JSX.Element;
declare type ACP = AutocompleteProps<any, any, any, any, any>;
interface FormAutoCompleteProps extends Omit<ACP, 'renderInput'> {
name: UseControllerProps['name'];
control: UseControllerProps['control'];
rules?: UseControllerProps['rules'];
label?: string;
error?: boolean;
helperText?: any;
options: ReadonlyArray<any>;
renderInput?: ACP['renderInput'];
}
declare const FormAutoComplete: ({ name, control, rules, label, error, helperText, options, renderInput, ...rest }: FormAutoCompleteProps) => JSX.Element;
interface NameSlugFormAutoCompleteProps extends FormAutoCompleteProps {
getOptionName?: (option: objectWithStringKeys) => string;
getOptionSlug?: (option: objectWithStringKeys) => string;
}
declare const NameSlugFormAutoComplete: ({ getOptionName, getOptionSlug, ...rest }: NameSlugFormAutoCompleteProps) => JSX.Element;
interface IDeskGridItem {
key?: string | number;
icon?: React$1.ReactNode;
title: CardHeaderProps['title'];
subtitle?: CardHeaderProps['subheader'];
href?: AnchorHTMLAttributes<any>['href'];
to?: To$1;
blank?: boolean;
onClick?: CardActionAreaProps['onClick'];
actionProps?: Partial<CardActionAreaProps>;
span?: CSSGridItemProps['span'];
}
interface DeskGridItemProps extends Omit<IDeskGridItem, 'key'> {
}
interface DeskGridProps extends Partial<Omit<CSSGridProps, 'children'>> {
items: (IDeskGridItem | null)[];
}
declare const DeskGrid: {
({ items, spacing, ...rest }: DeskGridProps): JSX.Element;
Item: ({ icon, title, subtitle, to, href, blank, onClick, actionProps, span, }: DeskGridItemProps) => JSX.Element;
};
interface GateProps {
loading: boolean;
user: apiObject | null;
loggedOut: boolean;
forbidden: boolean;
loginPath?: string | URL;
forbiddenRedirect?: To;
element: JSX.Element;
}
declare const Gate: ({ loading, user, loggedOut, forbidden, loginPath, forbiddenRedirect, element }: GateProps) => JSX.Element | null;
declare type responsiveStyleValue = ResponsiveStyleValue<any> | ((theme: Theme) => ResponsiveStyleValue<any>);
declare type Falsy = undefined | null | false | "" | 0;
declare function isTruthy<T>(value?: T | Falsy): value is T;
interface IMenuItem {
key?: string | number;
icon?: React$1.ReactElement;
label: string;
onClick?: (e?: MouseEvent<HTMLButtonElement>) => void;
loading?: boolean;
to?: To$1;
href?: AnchorHTMLAttributes<any>['href'];
newTab?: boolean;
closeOnClick?: boolean;
menuItemProps?: MenuItemProps;
}
interface DropdownProps {
component?: React$1.FC<any> | React$1.LazyExoticComponent<React$1.FC<any>>;
children: React$1.ReactNode;
menuItems: (IMenuItem | Falsy)[];
caret?: boolean;
triggerProps?: React$1.ComponentProps<any>;
menuProps?: React$1.ComponentProps<any>;
}
interface IActionItem extends IMenuItem {
collapsedIcon?: IMenuItem['icon'];
variant?: 'icon' | 'text' | 'outlined' | 'contained';
size?: ButtonProps['size'] | IconButtonProps['size'];
buttonProps?: Partial<ButtonProps>;
iconProps?: Partial<IconButtonProps>;
}
declare type ActionsProps = {
primary?: IActionItem | (IActionItem | Falsy)[];
secondary?: IActionItem | (IActionItem | Falsy)[];
tertiary?: IActionItem | (IActionItem | Falsy)[];
fourth?: IActionItem | (IActionItem | Falsy)[];
collapsed?: (IActionItem | Falsy)[];
nonCollapsibles?: (IActionItem | Falsy)[];
collapsibles?: (IActionItem | Falsy)[];
size?: ButtonProps['size'] | IconButtonProps['size'];
children?: React$1.ReactNode;
};
declare const Actions: {
({ primary: _primary, secondary: _secondary, tertiary: _tertiary, fourth: _fourth, collapsed: _collapsed, nonCollapsibles: _nonCollapsibles, collapsibles: _collapsibles, size, children }: ActionsProps): JSX.Element;
Item: (actionItem: IActionItem) => JSX.Element;
};
interface MetaItemsProps {
items: React$1.ReactNode[];
divider?: null | React$1.ReactNode;
spacing?: number;
flexWrap?: responsiveStyleValue;
wrapperProps?: StackProps;
}
declare type HeaderTypographyProps = {
text: React$1.ReactNode;
extra?: React$1.ReactNode;
typographyProps?: TypographyTypeMap['props'];
};
declare type HeaderProps = {
title: React$1.ReactNode;
titleExtra?: React$1.ReactNode;
titleTypographyProps?: TypographyTypeMap['props'];
subtitle?: React$1.ReactNode;
subtitleExtra?: React$1.ReactNode;
subtitleTypographyProps?: TypographyTypeMap['props'];
meta?: MetaItemsProps | React$1.ReactElement;
avatar?: React$1.ReactElement;
actions?: ActionsProps | React$1.ReactElement;
wrapperProps?: BoxProps;
innerWrapperProps?: BoxProps;
};
declare const Header: {
({ title, titleExtra, titleTypographyProps, subtitle, subtitleExtra, subtitleTypographyProps, meta, avatar, actions, wrapperProps, innerWrapperProps, }: HeaderProps): JSX.Element;
Typography: ({ text, extra, typographyProps }: HeaderTypographyProps) => JSX.Element;
};
declare type ModuleHeaderProps = {
icon?: React$1.ReactNode;
title: React$1.ReactNode;
titleTypographyProps?: TypographyTypeMap['props'];
subtitle?: React$1.ReactNode;
subtitleTypographyProps?: TypographyTypeMap['props'];
actions?: ActionsProps;
wrapperProps?: BoxProps;
};
declare type ModuleProps = {
header?: ModuleHeaderProps;
children: React$1.ReactNode;
footer?: React$1.ReactElement;
divider?: React$1.ReactElement | null;
wrapperProps?: PaperProps;
headerWrapperProps?: BoxProps;
innerWrapperProps?: BoxProps;
footerWrapperProps?: BoxProps;
};
declare const Module: {
({ header, children, footer, divider, wrapperProps, headerWrapperProps, innerWrapperProps, footerWrapperProps, }: ModuleProps): JSX.Element;
Header: ({ icon, title, titleTypographyProps, subtitle, subtitleTypographyProps, actions, wrapperProps, }: ModuleHeaderProps) => JSX.Element;
};
declare type ModuleGridItemProps = {
grow?: BoxProps['gap'];
module: ModuleProps | React$1.ReactElement;
};
declare type ModuleGridProps = {
gap?: BoxProps['gap'];
grid: (ModuleGridItemProps | React$1.ReactElement)[][];
wrapperProps?: BoxProps;
children?: React$1.ReactNode;
};
declare const ModuleGrid: ({ gap, grid, children, wrapperProps }: ModuleGridProps) => JSX.Element;
interface MoreActionsDropdownProps {
menuItems: IMenuItem[];
}
declare const MoreActionsDropdown: ({ menuItems }: MoreActionsDropdownProps) => JSX.Element;
declare const Dropdown: ({ component: Component, children, menuItems, caret, triggerProps, menuProps }: DropdownProps) => JSX.Element;
declare const MetaItems: ({ items, divider, spacing, flexWrap, wrapperProps, }: MetaItemsProps) => JSX.Element;
interface HeadProps {
title: string;
htmlTitle?: string;
setAppBarTitle: (title: string) => void;
}
declare const Head: ({ title, htmlTitle, setAppBarTitle, }: HeadProps) => JSX.Element;
interface DashboardAppBarProps extends AppBarProps {
showMenuBtn?: boolean;
onClickMenu: (e?: MouseEvent<HTMLButtonElement>) => void;
children: React$1.ReactNode;
}
declare const DashboardAppBar: ({ showMenuBtn, onClickMenu, children, ...rest }: DashboardAppBarProps) => JSX.Element;
interface SideMenuDrawerProps extends DrawerProps {
width?: CSS.PropertiesFallback<number | string>['width'];
headerText?: string;
headerTo?: To$1;
header?: ReactNode;
children: ReactNode;
}
declare const SideMenuDrawer: ({ variant, width, open, onClose, headerText, headerTo, header, children, sx, ...rest }: SideMenuDrawerProps) => JSX.Element;
interface SectionProps {
children: React$1.ReactNode;
contained?: boolean;
fluid?: boolean;
header?: boolean;
containerProps?: ContainerProps;
sx?: SxProps<Theme$1>;
}
declare const Section: ({ children, contained, fluid, containerProps, header, sx, ...rest }: SectionProps) => JSX.Element;
interface ContainerPaginationProps {
count: number | undefined;
page: number;
pageSize: number;
onPageChange: (page: number) => void;
onPageSizeChange: (pageSize: number) => void;
verboseName: string;
verboseNamePlural?: string;
wrapperProps?: BoxProps;
}
declare function getPageSizeOptions(extraPageSizes: number[], defaultPageSizes?: number[]): number[];
declare const ContainerPagination: ({ count, page, pageSize, onPageChange, onPageSizeChange, verboseName, verboseNamePlural, wrapperProps, }: ContainerPaginationProps) => JSX.Element;
declare type UsePaginatorReturnType = [
number,
number,
(newPage: number) => void,
(newPageSize: number) => void
];
declare function useSearchParamsPaginator(defaultPageSize?: number, startPage?: number): UsePaginatorReturnType;
declare function useStatePaginator(defaultPageSize?: number, startPage?: number): UsePaginatorReturnType;
interface ErrorBoxProps {
what?: string;
children?: React$1.ReactNode;
severity?: AlertColor;
wrapperProps?: AlertProps;
}
declare const ErrorBox: ({ what, children, severity, wrapperProps, }: ErrorBoxProps) => JSX.Element;
interface DrawerMenuItemProps {
icon?: ReactNode;
label: string;
to: To$1;
secondaryAction?: React.ReactNode;
subMenuItems?: DrawerMenuItemProps[];
level?: number;
wrapperProps?: ListItemButtonProps;
}
declare const DrawerMenuItem: ({ label, icon, to, secondaryAction, subMenuItems, level, wrapperProps, }: DrawerMenuItemProps) => JSX.Element;
declare type DescriptionPanelItemProps = {
key?: React$1.Key;
t: React$1.ReactNode;
d: React$1.ReactNode;
wrapTitle?: boolean;
wrapDesc?: boolean;
};
declare type DescriptionPanelProps = {
items: (DescriptionPanelItemProps | Falsy)[];
gap?: number;
horizontalGap?: number;
termsMinWidth?: responsiveStyleValue;
termsWidth?: responsiveStyleValue;
alignTerms?: 'left' | 'right';
sx?: SxProps$1;
};
declare const DescriptionPanel: ({ items, gap, horizontalGap, termsMinWidth, termsWidth, alignTerms, sx, }: DescriptionPanelProps) => JSX.Element;
interface ThemeModeSettingProps {
mode: undefined | null | string;
setMode: (value: undefined | null | string) => void;
}
declare const ThemeModeSettingDropdown: ({ mode, setMode }: ThemeModeSettingProps) => JSX.Element;
declare type voidReturnFunction = () => void;
declare type useToggleReturn = [boolean, voidReturnFunction, voidReturnFunction, voidReturnFunction, {
setIsOpen: Dispatch<SetStateAction<boolean>>;
}];
declare function useToggle(initialState?: boolean): useToggleReturn;
declare type useClipboardReturn = [string | undefined, Dispatch<SetStateAction<string | undefined>>];
declare function useClipboard(): useClipboardReturn;
declare function useIsDesktop(): boolean;
declare function usePrefersDarkMode(): boolean;
declare function useIsActivePath(to: To$1, end?: boolean, caseSensitive?: boolean): boolean;
declare function useViewSearchParams(defaultTab: string, paramName?: string): (string | ((view: string) => void))[];
declare function useKeydown(conditionFunction: (e: KeyboardEvent) => boolean, onKeydown: voidReturnFunction, startingElement?: HTMLElement): (e: Event) => void;
declare function useMetaKeydown(key: KeyboardEvent['key'], onKeydown: voidReturnFunction, startingElement?: HTMLElement): (e: Event) => void;
declare function useMetaEnter(onMetaEnter: voidReturnFunction, startingElement?: HTMLElement): (e: Event) => void;
declare function useVariantsSnackbar(): {
enqueueSnackbar: (message: notistack.SnackbarMessage, options?: OptionsObject | undefined) => notistack.SnackbarKey;
successSnackbar: (message: string, options?: OptionsObject) => notistack.SnackbarKey;
errorSnackbar: (message: string, options?: OptionsObject) => notistack.SnackbarKey;
warningSnackbar: (message: string, options?: OptionsObject) => notistack.SnackbarKey;
infoSnackbar: (message: string, options?: OptionsObject) => notistack.SnackbarKey;
closeSnackbar: (key?: notistack.SnackbarKey | undefined) => void;
};
declare function useMuiHookForm(props: UseFormProps): {
watch: react_hook_form.UseFormWatch<react_hook_form.FieldValues>;
getValues: react_hook_form.UseFormGetValues<react_hook_form.FieldValues>;
getFieldState: react_hook_form.UseFormGetFieldState<react_hook_form.FieldValues>;
setError: react_hook_form.UseFormSetError<react_hook_form.FieldValues>;
clearErrors: react_hook_form.UseFormClearErrors<react_hook_form.FieldValues>;
setValue: react_hook_form.UseFormSetValue<react_hook_form.FieldValues>;
trigger: react_hook_form.UseFormTrigger<react_hook_form.FieldValues>;
formState: react_hook_form.FormState<react_hook_form.FieldValues>;
resetField: react_hook_form.UseFormResetField<react_hook_form.FieldValues>;
reset: react_hook_form.UseFormReset<react_hook_form.FieldValues>;
handleSubmit: react_hook_form.UseFormHandleSubmit<react_hook_form.FieldValues>;
unregister: react_hook_form.UseFormUnregister<react_hook_form.FieldValues>;
control: react_hook_form.Control<react_hook_form.FieldValues, any>;
setFocus: react_hook_form.UseFormSetFocus<react_hook_form.FieldValues>;
register: (name: FieldPath<any>, options: RegisterOptions) => {
onChange: react_hook_form.ChangeHandler;
onBlur: react_hook_form.ChangeHandler;
name: string;
min?: string | number | undefined;
max?: string | number | undefined;
maxLength?: number | undefined;
minLength?: number | undefined;
pattern?: string | undefined;
required?: boolean | undefined;
disabled?: boolean | undefined;
inputRef: react_hook_form.RefCallBack;
};
};
interface ControlledFieldPropsOptions {
rules?: UseControllerProps['rules'];
required?: boolean;
}
interface ControlledFieldPropsInput {
name: UseControllerProps['name'];
control: UseControllerProps['control'];
formState: FormState<any>;
options?: ControlledFieldPropsOptions;
}
interface ControlledFieldProps extends UseControllerProps {
error?: boolean;
helperText?: any;
}
declare function useInnerForm({ defaultValues, ...rest }: UseFormProps): ({
watch: react_hook_form.UseFormWatch<react_hook_form.FieldValues>;
getValues: react_hook_form.UseFormGetValues<react_hook_form.FieldValues>;
getFieldState: react_hook_form.UseFormGetFieldState<react_hook_form.FieldValues>;
setError: react_hook_form.UseFormSetError<react_hook_form.FieldValues>;
clearErrors: react_hook_form.UseFormClearErrors<react_hook_form.FieldValues>;
setValue: react_hook_form.UseFormSetValue<react_hook_form.FieldValues>;
trigger: react_hook_form.UseFormTrigger<react_hook_form.FieldValues>;
formState: react_hook_form.FormState<react_hook_form.FieldValues>;
resetField: react_hook_form.UseFormResetField<react_hook_form.FieldValues>;
reset: react_hook_form.UseFormReset<react_hook_form.FieldValues>;
handleSubmit: react_hook_form.UseFormHandleSubmit<react_hook_form.FieldValues>;
unregister: react_hook_form.UseFormUnregister<react_hook_form.FieldValues>;
control: react_hook_form.Control<react_hook_form.FieldValues, any>;
setFocus: react_hook_form.UseFormSetFocus<react_hook_form.FieldValues>;
register: (name: string, options: Partial<{
required: string | react_hook_form.ValidationRule<boolean>;
min: react_hook_form.ValidationRule<string | number>;
max: react_hook_form.ValidationRule<string | number>;
maxLength: react_hook_form.ValidationRule<number>;
minLength: react_hook_form.ValidationRule<number>;
pattern: react_hook_form.ValidationRule<RegExp>;
validate: react_hook_form.Validate<any> | Record<string, react_hook_form.Validate<any>>;
valueAsNumber: boolean;
valueAsDate: boolean;
value: any;
setValueAs: (value: any) => any;
shouldUnregister?: boolean | undefined;
onChange?: ((event: any) => void) | undefined;
onBlur?: ((event: any) => void) | undefined;
disabled: boolean;
deps: string | string[];
}>) => {
onChange: react_hook_form.ChangeHandler;
onBlur: react_hook_form.ChangeHandler;
name: string;
min?: string | number | undefined;
max?: string | number | undefined;
maxLength?: number | undefined;
minLength?: number | undefined;
pattern?: string | undefined;
required?: boolean | undefined;
disabled?: boolean | undefined;
inputRef: react_hook_form.RefCallBack;
};
} | ((name: UseControllerProps['name'], options: ControlledFieldPropsOptions) => ControlledFieldProps))[];
declare function useRequestApi(apiCallFunction: (...args: any[]) => Promise<any>, successMessageTemplate?: string | ((res: any) => string), errorMessageTemplate?: (e: Error) => string): (boolean | ((...args: any[]) => Promise<void>))[];
declare type AppThemeProviderProps = {
children: React$1.ReactNode;
theme?: ThemeOptions;
mode?: PaletteMode | null;
enableResponsiveFontSizes?: boolean;
};
declare const AppThemeProvider: ({ children, theme, mode: manualMode, enableResponsiveFontSizes, }: AppThemeProviderProps) => JSX.Element;
interface AppSnackbarProviderProps extends SnackbarProviderProps {
}
declare const AppSnackbarProvider: ({ children, iconVariant, ...rest }: AppSnackbarProviderProps) => JSX.Element;
declare const getControlledFieldProps: ({ name, control, formState, options, }: ControlledFieldPropsInput) => ControlledFieldProps;
declare function pluralizeByCount(count: number, name: string, namePlural?: string): string;
declare function toTitleCase(str: string): string;
declare function camelCaseToKebabCase(string: string): string;
declare type ApiPath = string | null | undefined | false;
declare type UseApiResults = [
any,
boolean,
any,
KeyedMutator<any>,
boolean,
SWRResponse<any, Error>
];
declare type ModelTypeApi = {
useList?(page: number, pageSize: number, params?: Record<string, any>, options?: SWRConfiguration): UseApiResults;
useUnpaginatedList?(params: Record<string, any>, options?: SWRConfiguration): UseApiResults;
useDetail?(id: string | number, params?: Record<string, any>, options?: SWRConfiguration): UseApiResults;
};
declare type ModelApi = Omit<ModelTypeApi, 'useDetail'> & {
useDetail?(params?: Record<string, any>, options?: SWRConfiguration): UseApiResults;
};
declare type ApiOptions = {
apiBasePath?: string;
fetcher?(url: string): Promise<any>;
useApi?(path: ApiPath, params?: Record<string, any>, options?: SWRConfiguration): UseApiResults;
axiosInstance?: AxiosInstance;
};
declare type PathArgs = Record<string, any> | any[] | string | number;
declare function joinPaths(path: string, ...paths: string[]): string;
declare function renderPath(path: string, pathArgs: PathArgs): string;
declare function urlParamsToString(params: Record<string, any>): string;
declare function getPathWithParams(path: ApiPath, params?: Record<string, any>): string | false | null | undefined;
declare function renderProp(prop: any, element: React$1.ReactElement): any;
declare type UseModelRoutesProps = {
path: RouteProps['path'];
lookupField?: string;
createPage?: React$1.ReactNode;
listPage?: React$1.ReactNode;
listRoutes?: React$1.ReactNode;
detailPage?: React$1.ReactNode;
detailRoutes?: React$1.ReactNode;
editPage?: React$1.ReactNode;
};
declare const useModelRoutes: ({ path, lookupField, createPage, listPage, listRoutes, detailPage, detailRoutes, editPage, }: UseModelRoutesProps) => JSX.Element;
declare type RoutingModelOptions = {
canList?: boolean;
canDetail?: boolean;
canEdit?: boolean;
canCreate?: boolean;
};
declare type RoutingModel = {
name: string;
lookup?: string;
options?: RoutingModelOptions;
};
declare type RoutingLeafDefinition = {
path?: string;
};
interface RoutingDefinition extends RoutingLeafDefinition {
[key: string]: string | undefined | RoutingDefinition;
}
declare type RoutingLeafNode = {
rawPath: string;
rawFullPath: string;
path: string;
fullPath: string;
};
declare type RoutingNodeFunction = (pathArgs?: PathArgs, params?: Record<string, any>) => RoutingLeafNode & {
[key: string]: string | RoutingNodeFunction;
};
interface RoutingNode extends RoutingLeafNode {
[key: string]: string | RoutingNodeFunction;
}
declare function buildModelRouter(path: string, lookup?: string, options?: RoutingModelOptions, detailRoutes?: Record<string, RoutingDefinition>, listRoutes?: Record<string, RoutingDefinition>): RoutingDefinition;
declare function buildRouter(routes: RoutingDefinition, basePath?: string, fallbackPath?: string): RoutingNodeFunction;
declare const backendAxiosInstance: axios.AxiosInstance;
declare function getApiOptions(options?: ApiOptions): {
apiBasePath: string;
fetcher: (url: string) => Promise<any>;
apiFetcher: (apiPath: string) => Promise<any>;
useApi: (path: ApiPath, params?: Record<string, any> | undefined, options?: Partial<swr_dist_types.PublicConfiguration<any, any, swr.BareFetcher<any>>> | undefined) => UseApiResults;
axiosInstance: axios.AxiosInstance;
};
declare function getUseApiFunction(fetcher: Fetcher): (path: ApiPath, params?: Record<string, any>, options?: SWRConfiguration) => UseApiResults;
declare function makePaginatedApi(useListApi: (params: Record<string, any>, options?: SWRConfiguration) => UseApiResults): (page: number, pageSize: number, params: Record<string, any>, options?: SWRConfiguration) => UseApiResults;
declare function getUseInfiniteApiFunction(fetcher: Fetcher): (path: ApiPath, params?: Record<string, any>, options?: SWRConfiguration) => {
api: any[];
loadNext: () => Promise<any[] | undefined>;
};
declare function getLimitOffset(page: number, pageSize: number): [limit: number, offset: number];
declare type ModelApiOptions = ApiOptions & {
apiPath?: string;
unpaginatedApiPath?: string;
};
declare type ModelFieldDefinition = {
name: string;
verboseName: string;
};
declare type ModelTypeOptions = {
idField?: ModelFieldDefinition;
};
declare type ModelOptions = ModelTypeOptions & {
adminModuleFields?: Record<string, boolean>;
};
declare type BackendRouterOptions = {
adminListHref?: string;
adminCreateHref?: string;
getAdminChangeHref?(obj: Record<string, any>): string;
};
declare type RoutingOptions = {
routingFunction?: RoutingNodeFunction;
getDetailRouter?(routingNode?: RoutingNode): RoutingNode;
backendRouter?: BackendRouterOptions;
};
declare function useModelType(routingOptions?: RoutingOptions, apiOptions?: ModelApiOptions, typeOptions?: ModelTypeOptions): {
fields: {
[x: string]: ModelFieldDefinition;
};
metaFields: {
id: ModelFieldDefinition;
};
router: (RoutingLeafNode & {
[key: string]: string | RoutingNodeFunction;
}) | undefined;
backendRouter: {
adminListHref: string | undefined;
adminCreateHref: string | undefined;
} | undefined;
api: ModelTypeApi;
};
declare function useModel(obj: Record<string, any>, routingOptions?: RoutingOptions, apiOptions?: ModelApiOptions, modelOptions?: ModelOptions): {
api: ModelApi;
router: (RoutingLeafNode & {
[key: string]: string | RoutingNodeFunction;
}) | undefined;
backendRouter: {
adminChangeHref: string | undefined;
adminListHref?: string | undefined;
adminCreateHref?: string | undefined;
} | undefined;
adminModuleItems: (Falsy | DescriptionPanelItemProps)[];
fields: {
[x: string]: ModelFieldDefinition;
};
metaFields: {
id: ModelFieldDefinition;
};
};
declare type NamedModelTypeOptions = ModelTypeOptions & {
nameField?: ModelFieldDefinition;
};
declare type NamedModelOptions = NamedModelTypeOptions & ModelOptions;
declare function useNamedModelType(routingOptions?: RoutingOptions, apiOptions?: ModelApiOptions, typeOptions?: NamedModelTypeOptions): {
fields: {
[x: string]: ModelFieldDefinition;
};
metaFields: {
name: ModelFieldDefinition;
id: ModelFieldDefinition;
};
renderLink: (obj: Record<string, any>) => JSX.Element | undefined;
router: (RoutingLeafNode & {
[key: string]: string | RoutingNodeFunction;
}) | undefined;
backendRouter: {
adminListHref: string | undefined;
adminCreateHref: string | undefined;
} | undefined;
api: ModelTypeApi;
};
declare function useNamedModel(obj: Record<string, any>, routingOptions?: RoutingOptions, apiOptions?: ModelApiOptions, modelOptions?: NamedModelOptions): {
api: ModelApi;
router: (RoutingLeafNode & {
[key: string]: string | RoutingNodeFunction;
}) | undefined;
backendRouter: {
adminChangeHref: string | undefined;
adminListHref?: string | undefined;
adminCreateHref?: string | undefined;
} | undefined;
adminModuleItems: (Falsy | DescriptionPanelItemProps)[];
renderLink: () => JSX.Element | undefined;
fields: {
[x: string]: ModelFieldDefinition;
};
metaFields: {
name: ModelFieldDefinition;
id: ModelFieldDefinition;
};
};
declare type TimeStampedModelTypeOptions = {
createdField?: ModelFieldDefinition;
modifiedField?: ModelFieldDefinition;
parseFunc?: (str: string) => Date;
formatFunc?: (date: Date) => string;
};
declare type TimeStampedModelOptions = TimeStampedModelTypeOptions & {
adminModuleFields?: Record<string, boolean>;
};
declare function useTimeStampedModelType(typeOptions?: TimeStampedModelTypeOptions): {
fields: {
[x: string]: ModelFieldDefinition;
};
metaFields: {
created: ModelFieldDefinition;
modified: ModelFieldDefinition;
};
renderCreated: (obj: Record<string, any>) => JSX.Element;
renderModified: (obj: Record<string, any>) => JSX.Element;
};
declare function useTimeStampedModel(obj: Record<string, any>, modelOptions?: TimeStampedModelOptions): {
adminModuleItems: (Falsy | DescriptionPanelItemProps)[];
renderCreated: () => JSX.Element;
renderModified: () => JSX.Element;
fields: {
[x: string]: ModelFieldDefinition;
};
metaFields: {
created: ModelFieldDefinition;
modified: ModelFieldDefinition;
};
};
declare const RouterWrapper: ({ children }: {
children: React$1.ReactNode;
}) => JSX.Element;
export { Actions, ActionsProps, ApiOptions, ApiPath, AppSnackbarProvider, AppThemeProvider, AppThemeProviderProps, BackButton, BackButtonProps, BackendRouterOptions, CSSGrid, CSSGridItemProps, CSSGridProps, ConfirmingButton, ContainerPagination, ContainerPaginationProps, ControlledFieldProps, ControlledFieldPropsInput, ControlledFieldPropsOptions, CopyButton, DashboardAppBar, DashboardAppBarProps, DescriptionPanel, DescriptionPanelItemProps, DescriptionPanelProps, DeskGrid, DeskGridItemProps, DeskGridProps, DrawerMenuItem, DrawerMenuItemProps, Dropdown, DropdownProps, EndButtons, ErrorBox, FabHolder, Falsy, FormAutoComplete, Gate, GateProps, Head, HeadProps, Header, HeaderProps, HeaderTypographyProps, IActionItem, IDeskGridItem, IMenuItem, IStateBack, LoadingIndicator, MetaItems, MetaItemsProps, ModelApi, ModelApiOptions, ModelFieldDefinition, ModelOptions, ModelTypeApi, ModelTypeOptions, Module, ModuleGrid, ModuleGridItemProps, ModuleGridProps, ModuleHeaderProps, ModuleProps, MoreActionsDropdown, NameSlugFormAutoComplete, NamedModelOptions, NamedModelTypeOptions, PathArgs, RouterWrapper, RoutingDefinition, RoutingLeafDefinition, RoutingLeafNode, RoutingModel, RoutingModelOptions, RoutingNode, RoutingNodeFunction, RoutingOptions, Section, SectionProps, SideMenuDrawer, SideMenuDrawerProps, StateBack, StatusChip, TagsChips, ThemeModeSettingDropdown, ThemeModeSettingProps, TimeStampedModelOptions, TimeStampedModelTypeOptions, UseApiResults, UseModelRoutesProps, UsePaginatorReturnType, UserAvatar, ViewTabs, apiObject, backendAxiosInstance, buildModelRouter, buildRouter, camelCaseToKebabCase, getApiOptions, getControlledFieldProps, getLimitOffset, getPageSizeOptions, getPathWithParams, getUseApiFunction, getUseInfiniteApiFunction, isTruthy, joinPaths, makePaginatedApi, objectWithStringKeys, pluralizeByCount, renderPath, renderProp, responsiveStyleValue, tabView, toTitleCase, urlParamsToString, useClipboard, useInnerForm, useIsActivePath, useIsDesktop, useKeydown, useMetaEnter, useMetaKeydown, useModel, useModelRoutes, useModelType, useMuiHookForm, useNamedModel, useNamedModelType, usePrefersDarkMode, useRequestApi, useSearchParamsPaginator, useStatePaginator, useTimeStampedModel, useTimeStampedModelType, useToggle, useToggleReturn, useVariantsSnackbar, useViewSearchParams as useViewTabsSearchParams };