UNPKG

@bernierllc/generic-workflow-ui

Version:

Generic, reusable workflow UI components with linear and graph visualization

202 lines 5.14 kB
import React from 'react'; /** * Generic workflow definition - domain-agnostic */ export interface GenericWorkflow<TStageMetadata = any, TTransitionMetadata = any> { id: string; name: string; description?: string; stages: GenericStage<TStageMetadata>[]; transitions: GenericTransition<TTransitionMetadata>[]; metadata?: Record<string, any>; } /** * Generic workflow stage */ export interface GenericStage<TMetadata = any> { id: string; name: string; description?: string; order: number; metadata?: TMetadata; } /** * Generic workflow transition */ export interface GenericTransition<TMetadata = any> { id: string; from: string; to: string; name?: string; description?: string; metadata?: TMetadata; } /** * Generic workflow status */ export interface GenericWorkflowStatus<TStageMetadata = any> { workflowId: string; currentStageId: string; stageMetadata?: TStageMetadata; availableTransitions: string[]; metadata?: Record<string, any>; } /** * Generic workflow timeline item */ export interface GenericWorkflowTimelineItem<TMetadata = any> { id: string; timestamp: Date; userId: string; userName?: string; userAvatar?: string; stageId: string; stageName: string; description?: string; icon?: React.ReactNode; color?: string; metadata?: TMetadata; } /** * Generic action button */ export interface GenericActionButton { id: string; label: string; icon?: React.ReactNode; tooltip?: string; visible: boolean; disabled?: boolean; variant?: 'primary' | 'secondary' | 'outline' | 'ghost'; color?: string; onClick: () => void; } /** * Workflow stepper configuration */ export interface GenericWorkflowStepperConfig { enabled: boolean; orientation: 'horizontal' | 'vertical'; showDescriptions: boolean; showIcons: boolean; showTimestamps: boolean; showUsers: boolean; clickableStages: boolean; stageColors?: Record<string, string>; stageIcons?: Record<string, string>; } /** * Action buttons configuration */ export interface GenericActionButtonsConfig { enabled: boolean; size: 'small' | 'medium' | 'large'; variant: 'primary' | 'secondary' | 'outline' | 'ghost'; showIcons: boolean; showLabels: boolean; showTooltips: boolean; buttonColors?: Record<string, string>; } /** * Workflow timeline configuration */ export interface GenericWorkflowTimelineConfig { enabled: boolean; orientation: 'horizontal' | 'vertical'; showTimestamps: boolean; showUsers: boolean; showDescriptions: boolean; showIcons: boolean; maxItems?: number; showToggle: boolean; } /** * Workflow progress bar configuration */ export interface GenericWorkflowProgressBarConfig { enabled: boolean; height: string | number; color?: string; backgroundColor?: string; showStageLabels: boolean; showPercentage: boolean; showStageIcons: boolean; stageColors?: Record<string, string>; } /** * Workflow status indicator configuration */ export interface GenericWorkflowStatusIndicatorConfig { enabled: boolean; size: 'small' | 'medium' | 'large'; showText: boolean; showIcon: boolean; showTransitions: boolean; statusColors?: Record<string, string>; statusIcons?: Record<string, string>; getStatusInfo?: (status: GenericWorkflowStatus) => { status: string; label: string; color: string; icon: string; }; } /** * Workflow builder configuration */ export interface GenericWorkflowBuilderConfig { enabled: boolean; allowJSONImport: boolean; allowJSONExport: boolean; allowUIEditing: boolean; showJSONView: boolean; validateOnChange: boolean; autoSave: boolean; } /** * Workflow admin configuration */ export interface GenericWorkflowAdminConfigConfig { enabled: boolean; showWorkflowList: boolean; showStageEditor: boolean; showTransitionEditor: boolean; showPreview: boolean; allowCreation: boolean; allowDeletion: boolean; allowStageReordering: boolean; } /** * Workflow stage editor configuration */ export interface GenericWorkflowStageEditorConfig { enabled: boolean; showStageId: boolean; showStageName: boolean; showStageOrder: boolean; showDescription: boolean; showNextStage: boolean; customFields?: Array<{ key: string; label: string; render: (stage: GenericStage, onChange: (stage: GenericStage) => void) => React.ReactNode; }>; } /** * Workflow transition editor configuration */ export interface GenericWorkflowTransitionEditorConfig { enabled: boolean; showPermissions: boolean; showDescription: boolean; showColorPicker: boolean; showIconPicker: boolean; allowCreation: boolean; allowDeletion: boolean; customFields?: Array<{ key: string; label: string; render: (transition: GenericTransition, onChange: (transition: GenericTransition) => void) => React.ReactNode; }>; } //# sourceMappingURL=types.d.ts.map