@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
60 lines (59 loc) • 2.15 kB
TypeScript
import type { ComponentType, HTMLAttributes, ReactNode } from 'react';
export type THtmlButton = HTMLAttributes<HTMLButtonElement>;
export type THtmlAnchor = HTMLAttributes<HTMLAnchorElement>;
export type TBaseLinkProps = {
to: string;
className?: string;
children?: ReactNode;
} & HTMLAttributes<HTMLAnchorElement>;
export type TChildrenElement = JSX.Element | JSX.Element[];
export type TChildren = string | TChildrenElement | null;
export type TSize = 'sm' | 'md' | 'lg';
export type TabVariant = 'default' | 'secondary' | 'switch';
export type TSuffixRecord<T extends string = string, V = string | number> = Record<T, V>;
export type TResolveToConfig = {
key: string;
defaultLink: string;
resolver?(title?: string): string;
onResolve?(searchParams?: URLSearchParams): void;
};
export type TNavigationUtils = {
searchParams: URLSearchParams;
navigate: (path: string) => void;
LinkComponent: ComponentType<TBaseLinkProps>;
};
export type TPassedProps<T extends string = string> = {
linkConfig?: TResolveToConfig;
size?: TSize;
suffixRecord?: TSuffixRecord<T>;
title?: T;
};
export type TSharedProps = TPassedProps & {
onClick?(): void;
size?: TSize;
classValue: string;
selectedClassValue: string;
textClassValue: string;
isSelected?: boolean;
selectedId?: string;
icon?: ReactNode;
};
export type TChildrenProps = Pick<TSharedProps, 'isSelected' | 'selectedClassValue' | 'textClassValue' | 'selectedId'> & {
children: TChildren;
disableAnimation?: boolean;
color?: string;
};
export declare const TYPES: readonly ["link", "button"];
export type TTypeKey = (typeof TYPES)[number];
export type TParentSharedProps = Pick<TSharedProps, 'classValue'>;
export type TLinkProps = TBaseLinkProps & TParentSharedProps;
export type TButtonProps = THtmlButton & TParentSharedProps;
export type TSwitchProps<T extends TTypeKey = 'button'> = {
link: TLinkProps & TSharedProps;
button: TButtonProps & TSharedProps;
activeTab: string;
iconsOnly: boolean;
draggingTab?: boolean;
disableAnimation?: boolean;
tabOptions?: ReactNode;
}[T];