UNPKG

@knapsack/app

Version:

Build Design Systems on top of knapsack, by Basalt

81 lines 2.96 kB
import { Action } from './types'; declare type StatusTypes = 'success' | 'info' | 'warning' | 'error'; declare const SET_STATUS = "knapsack/ui/SET_STATUS"; declare const SET_TEMPLATE_RENDERER = "knapsack/ui/SET_TEMPLATE_RENDERER"; declare const REMOVE_STATUS = "knapsack/ui/REMOVE_STATUS"; declare type Status = { type: StatusTypes; /** * Can contain markdown */ message: string; /** * After x seconds, remove */ dismissAfter?: number; }; declare enum PatternViewPreferences { 'grid' = "grid", 'table' = "table" } export interface UiState { status?: { type: StatusTypes; message: string; dismissAfter?: number; }; currentTemplateRenderer?: string; sidebarOpen?: boolean; /** * Is right sidebar open? */ pageDetailsOpen?: boolean; /** On a Pattern page, does the user prefer grid view or table view. */ patternViewPreference: keyof typeof PatternViewPreferences; } declare const SET_PAGE_DETAILS_VISIBILITY = "knapsack/ui/SET_PAGE_DETAILS_VISIBILITY"; interface SetPageDetailsVisibilityAction extends Action { type: typeof SET_PAGE_DETAILS_VISIBILITY; payload: { isOpen: boolean; }; } export declare function setPageDetailsVisibility(payload: SetPageDetailsVisibilityAction['payload']): SetPageDetailsVisibilityAction; declare const SET_SIDEBAR_VISIBILITY = "knapsack/ui/Set sidebar visibility"; interface SetSidebarVisibilityAction extends Action { type: typeof SET_SIDEBAR_VISIBILITY; payload: { isOpen: boolean; }; } export declare function setSidebarVisibility(payload: SetSidebarVisibilityAction['payload']): SetSidebarVisibilityAction; declare const SET_PATTERN_PAGE_VIEW_PREFERENCE = "knapsack/ui/SET_PATTERN_PAGE_VIEW_PREFERENCE"; interface SetPatternPageViewPreference extends Action { type: typeof SET_PATTERN_PAGE_VIEW_PREFERENCE; payload: { preference: keyof typeof PatternViewPreferences; }; } export declare function setPatternPageViewPreference(payload: SetPatternPageViewPreference['payload']): SetPatternPageViewPreference; interface SetTemplateRenderer extends Action { type: typeof SET_TEMPLATE_RENDERER; payload: { id: string; }; } export declare function setCurrentTemplateRenderer({ id, }: { id: string; }): SetTemplateRenderer; interface SetStatusAction extends Action { type: typeof SET_STATUS; payload: Status; } interface RemoveStatusAction extends Action { type: typeof REMOVE_STATUS; } export declare function removeStatus(): RemoveStatusAction; export declare function setStatus(status: Status): (dispatch: any) => void; declare type UiActionTypes = SetStatusAction | RemoveStatusAction | SetTemplateRenderer | SetPageDetailsVisibilityAction | SetSidebarVisibilityAction | SetPatternPageViewPreference; export default function reducer(state: UiState, action: UiActionTypes): UiState; export {}; //# sourceMappingURL=ui.d.ts.map