@lax-wp/design-system
Version:
A comprehensive React + TypeScript design system built with Vite, providing reusable UI components for the LAX web portal applications. Features a complete set of form components, data display elements, and interactive controls with full TypeScript suppor
66 lines (65 loc) • 1.94 kB
TypeScript
import { ReactNode } from 'react';
export type TabVariant = 'default' | 'secondary' | 'switch';
export type TBaseTabProps<T extends string> = {
tabs: readonly T[];
initialHiddenTabs?: readonly T[];
activeTab: T;
onTabClick?(id: T): void;
counts?: Record<T, number>;
isDisabled?: boolean;
tabIcons?: Record<string, ReactNode>;
isLoading?: boolean;
className?: string;
title?: string;
iconsOnly?: boolean;
draggable?: boolean;
variant?: TabVariant;
fullWidth?: boolean;
color?: 'light' | 'dark';
};
export type Tab<T extends string> = {
name: T;
is_default: boolean;
is_hidden: boolean;
is_pinned?: boolean;
};
export type TSize = 'sm' | 'md' | '';
export type TSuffixRecord<T extends string = string, V = string> = Record<T, V>;
export type TResolveToConfig = {
key: string;
defaultLink: string;
resolver?(title?: string): string;
onResolve?(searchParams?: URLSearchParams): void;
};
export type TPassedProps<T extends string = string> = {
linkConfig?: TResolveToConfig;
size?: TSize;
suffixRecord?: TSuffixRecord<T>;
};
export type TSharedProps = TPassedProps & {
onClick?(): void;
size?: TSize;
classValue: string;
selectedClassValue: string;
textClassValue: string;
isSelected?: boolean;
selectedId?: string;
icon?: ReactNode;
title?: string;
};
export type TChildrenProps = Pick<TSharedProps, 'isSelected' | 'selectedClassValue' | 'textClassValue' | 'selectedId'> & {
children: ReactNode;
disableAnimation?: boolean;
color?: string;
};
export declare const TYPES: readonly ["link", "button"];
export type TTypeKey = (typeof TYPES)[number];
export type TSwitchProps<T extends TTypeKey = 'button'> = TSharedProps & {
link?: any;
button?: any;
activeTab?: string;
iconsOnly?: boolean;
draggingTab?: boolean;
disableAnimation?: boolean;
tabOptions?: ReactNode;
};