This commit is contained in:
2025-08-31 23:39:44 -04:00
parent 40f8780dec
commit d4f4747fde
20 changed files with 1919 additions and 13 deletions

View File

@ -0,0 +1,43 @@
import React from 'react';
import { TablerIconsProps } from '@tabler/icons-react';
export interface ActionMenuItem {
key: string;
label: string;
icon?: React.ComponentType<TablerIconsProps>;
color?: string;
disabled?: boolean;
hidden?: boolean;
onClick: (item?: any) => void | Promise<void>;
confirm?: {
title: string;
message: string;
confirmLabel?: string;
cancelLabel?: string;
};
show?: (item: any) => boolean;
}
export interface ActionMenuProps {
item?: any;
actions: ActionMenuItem[];
trigger?: 'dots' | 'button' | 'custom';
triggerLabel?: string;
triggerIcon?: React.ComponentType<TablerIconsProps>;
triggerProps?: any;
customTrigger?: React.ReactNode;
position?: 'bottom-end' | 'bottom-start' | 'top-end' | 'top-start';
withArrow?: boolean;
withinPortal?: boolean;
'aria-label'?: string;
}
declare const ActionMenu: React.FC<ActionMenuProps>;
export default ActionMenu;
export declare const createViewAction: (onView: (item: any) => void) => ActionMenuItem;
export declare const createEditAction: (onEdit: (item: any) => void) => ActionMenuItem;
export declare const createCopyAction: (onCopy: (item: any) => void) => ActionMenuItem;
export declare const createDeleteAction: (onDelete: (item: any) => void | Promise<void>, itemName?: string) => ActionMenuItem;
export declare const createArchiveAction: (onArchive: (item: any) => void) => ActionMenuItem;
export declare const createRestoreAction: (onRestore: (item: any) => void) => ActionMenuItem;
export declare const getUserActions: (onEdit: (item: any) => void, onDelete: (item: any) => void, onViewDetails?: (item: any) => void) => ActionMenuItem[];
export declare const getApplicationActions: (onEdit: (item: any) => void, onDelete: (item: any) => void, onConfigure?: (item: any) => void) => ActionMenuItem[];
export declare const getFunctionActions: (onEdit: (item: any) => void, onDelete: (item: any) => void, onExecute?: (item: any) => void, onViewLogs?: (item: any) => void) => ActionMenuItem[];
export declare const getTokenActions: (onRevoke: (item: any) => void, onCopy?: (item: any) => void, onRefresh?: (item: any) => void) => ActionMenuItem[];

View File

@ -0,0 +1,47 @@
import React from 'react';
import { TablerIconsProps } from '@tabler/icons-react';
export type EmptyStateVariant = 'no-data' | 'no-results' | 'error' | 'loading-failed' | 'access-denied' | 'coming-soon';
export type EmptyStateContext = 'users' | 'applications' | 'functions' | 'tokens' | 'executions' | 'permissions' | 'audit' | 'generic';
export interface EmptyStateAction {
label: string;
onClick: () => void;
variant?: 'filled' | 'light' | 'outline';
color?: string;
leftSection?: React.ReactNode;
}
export interface EmptyStateProps {
variant?: EmptyStateVariant;
context?: EmptyStateContext;
title?: string;
message?: string;
icon?: React.ComponentType<TablerIconsProps>;
iconSize?: number;
iconColor?: string;
actions?: EmptyStateAction[];
height?: number | string;
}
declare const EmptyState: React.FC<EmptyStateProps & {
onAdd?: () => void;
onRefresh?: () => void;
onClearFilters?: () => void;
}>;
export default EmptyState;
export declare const NoUsersState: React.FC<Omit<EmptyStateProps, 'context' | 'variant'> & {
onAddUser?: () => void;
}>;
export declare const NoApplicationsState: React.FC<Omit<EmptyStateProps, 'context' | 'variant'> & {
onCreateApp?: () => void;
}>;
export declare const NoFunctionsState: React.FC<Omit<EmptyStateProps, 'context' | 'variant'> & {
onCreateFunction?: () => void;
}>;
export declare const NoTokensState: React.FC<Omit<EmptyStateProps, 'context' | 'variant'> & {
onGenerateToken?: () => void;
}>;
export declare const NoSearchResults: React.FC<Omit<EmptyStateProps, 'variant'> & {
onClearFilters?: () => void;
onRefresh?: () => void;
}>;
export declare const ErrorState: React.FC<Omit<EmptyStateProps, 'variant'> & {
onRetry?: () => void;
}>;

View File

@ -0,0 +1,46 @@
import React from 'react';
export type LoadingVariant = 'spinner' | 'progress' | 'skeleton-table' | 'skeleton-cards' | 'skeleton-form' | 'skeleton-text' | 'dots' | 'overlay';
export type LoadingSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
export interface LoadingStateProps {
variant?: LoadingVariant;
size?: LoadingSize;
height?: number | string;
message?: string;
submessage?: string;
progress?: number;
progressLabel?: string;
rows?: number;
columns?: number;
color?: string;
withContainer?: boolean;
animate?: boolean;
}
declare const LoadingState: React.FC<LoadingStateProps>;
export default LoadingState;
export declare const TableLoadingState: React.FC<{
rows?: number;
columns?: number;
}>;
export declare const CardsLoadingState: React.FC<{
count?: number;
columns?: number;
}>;
export declare const FormLoadingState: React.FC<{
fields?: number;
}>;
export declare const PageLoadingState: React.FC<{
message?: string;
}>;
export declare const InlineLoadingState: React.FC<{
message?: string;
size?: LoadingSize;
}>;
export declare const useLoadingState: (initialLoading?: boolean) => {
loading: boolean;
progress: number;
startLoading: () => void;
stopLoading: () => void;
updateProgress: (value: number) => void;
setLoading: React.Dispatch<React.SetStateAction<boolean>>;
setProgress: React.Dispatch<React.SetStateAction<number>>;
};

View File

@ -0,0 +1,49 @@
import React from 'react';
export interface SidebarProps {
opened: boolean;
onClose: () => void;
title: string;
width?: number;
position?: 'left' | 'right';
headerActions?: React.ReactNode;
footer?: React.ReactNode;
children: React.ReactNode;
zIndex?: number;
offsetTop?: number;
backgroundColor?: string;
borderColor?: string;
animationDuration?: string;
'aria-label'?: string;
}
declare const Sidebar: React.FC<SidebarProps>;
export default Sidebar;
export interface FormSidebarWrapperProps extends Omit<SidebarProps, 'children'> {
children: React.ReactNode;
cancelLabel?: string;
submitLabel?: string;
onCancel?: () => void;
onSubmit?: () => void;
submitDisabled?: boolean;
showFooterActions?: boolean;
}
export declare const FormSidebarWrapper: React.FC<FormSidebarWrapperProps>;
export interface DetailsSidebarProps extends Omit<SidebarProps, 'title'> {
itemName: string;
itemType?: string;
editButton?: React.ReactNode;
deleteButton?: React.ReactNode;
status?: React.ReactNode;
}
export declare const DetailsSidebar: React.FC<DetailsSidebarProps>;
export interface QuickSidebarProps extends Omit<SidebarProps, 'children'> {
content: React.ReactNode;
actions?: React.ReactNode;
}
export declare const QuickSidebar: React.FC<QuickSidebarProps>;
export declare const useSidebar: (initialOpened?: boolean) => {
opened: boolean;
open: () => void;
close: () => void;
toggle: () => void;
setOpened: React.Dispatch<React.SetStateAction<boolean>>;
};

View File

@ -0,0 +1,18 @@
import React from 'react';
import { BadgeProps } from '@mantine/core';
export type StatusVariant = 'status' | 'role' | 'runtime' | 'type' | 'severity' | 'execution';
export interface StatusBadgeProps extends Omit<BadgeProps, 'color' | 'children'> {
value: string;
variant?: StatusVariant;
customColorMap?: Record<string, string>;
}
declare const COLOR_MAPS: Record<StatusVariant, Record<string, string>>;
declare const DEFAULT_COLORS: Record<StatusVariant, string>;
declare const StatusBadge: React.FC<StatusBadgeProps>;
export default StatusBadge;
export { COLOR_MAPS, DEFAULT_COLORS };
export declare const UserRoleBadge: React.FC<Omit<StatusBadgeProps, 'variant'>>;
export declare const ApplicationTypeBadge: React.FC<Omit<StatusBadgeProps, 'variant'>>;
export declare const RuntimeBadge: React.FC<Omit<StatusBadgeProps, 'variant'>>;
export declare const ExecutionStatusBadge: React.FC<Omit<StatusBadgeProps, 'variant'>>;
export declare const SeverityBadge: React.FC<Omit<StatusBadgeProps, 'variant'>>;

View File

@ -1,5 +1,10 @@
export { default as FormSidebar } from './components/FormSidebar/FormSidebar';
export { default as DataTable } from './components/DataTable/DataTable';
export { default as StatusBadge, UserRoleBadge, ApplicationTypeBadge, RuntimeBadge, ExecutionStatusBadge, SeverityBadge } from './components/StatusBadge/StatusBadge';
export { default as EmptyState, NoUsersState, NoApplicationsState, NoFunctionsState, NoTokensState, NoSearchResults, ErrorState } from './components/EmptyState/EmptyState';
export { default as Sidebar, FormSidebarWrapper, DetailsSidebar, QuickSidebar, useSidebar } from './components/Sidebar/Sidebar';
export { default as ActionMenu, createViewAction, createEditAction, createCopyAction, createDeleteAction, createArchiveAction, createRestoreAction, getUserActions, getApplicationActions, getFunctionActions, getTokenActions } from './components/ActionMenu/ActionMenu';
export { default as LoadingState, TableLoadingState, CardsLoadingState, FormLoadingState, PageLoadingState, InlineLoadingState, useLoadingState } from './components/LoadingState/LoadingState';
export * from './types';
export { useApiService } from './hooks/useApiService';
export { useDataFilter } from './hooks/useDataFilter';

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -77,3 +77,8 @@ export interface FormField {
validation?: ValidationRule;
defaultValue?: any;
}
export type { StatusVariant, StatusBadgeProps } from '../components/StatusBadge/StatusBadge';
export type { EmptyStateVariant, EmptyStateContext, EmptyStateProps, EmptyStateAction } from '../components/EmptyState/EmptyState';
export type { SidebarProps, FormSidebarWrapperProps, DetailsSidebarProps, QuickSidebarProps } from '../components/Sidebar/Sidebar';
export type { ActionMenuItem, ActionMenuProps } from '../components/ActionMenu/ActionMenu';
export type { LoadingVariant, LoadingSize, LoadingStateProps } from '../components/LoadingState/LoadingState';