Files
sigpro-ui/index.d.ts
natxocc 7d2ad67513
All checks were successful
Deploy Docs to Synology / deploy (push) Successful in 3s
Update TS
2026-04-29 23:23:08 +02:00

553 lines
18 KiB
TypeScript

type Signal<T> = {
(): T;
(value: T | ((prev: T) => T)): void;
};
type ComponentChild = Node | string | number | boolean | null | undefined;
type ComponentChildren = ComponentChild | ComponentChild[] | (() => ComponentChild | ComponentChildren);
interface BaseProps {
class?: string | (() => string);
style?: string | (() => string);
id?: string | (() => string);
[key: string]: any;
}
// ---------- helpers ----------
const hide: () => void;
const i18n: {
es: Record<string, string>;
en: Record<string, string>;
};
const currentLocale: Signal<string>;
const Locale: (locale: string) => void;
const tt: (key: string) => () => string;
// ---------- components ----------
interface AccordionItem {
title?: string | (() => string);
content?: string | (() => string);
open?: boolean;
classTitle?: string;
classContent?: string;
}
interface AccordionProps extends BaseProps {
items: AccordionItem[] | (() => AccordionItem[]);
name?: string;
}
function Accordion(props: AccordionProps): Node;
interface AlertProps extends BaseProps { }
function Alert(props: AlertProps, children?: ComponentChildren): Node;
interface AutocompleteProps extends BaseProps {
items: (string | { label: string; value?: string })[] | (() => (string | { label: string; value?: string })[]);
value?: Signal<string> | string;
onselect?: (item: string | { label: string; value?: string }) => void;
placeholder?: string;
}
function Autocomplete(props: AutocompleteProps): Node;
interface BadgeProps extends BaseProps { }
function Badge(props: BadgeProps, children?: ComponentChildren): Node;
interface ButtonProps extends BaseProps { }
function Button(props: ButtonProps, children?: ComponentChildren): Node;
interface DateRange {
start: string;
end: string | null;
startHour?: number;
endHour?: number;
}
interface CalendarProps extends BaseProps {
value?: Signal<string | DateRange> | string | DateRange;
range?: boolean | (() => boolean);
hour?: boolean;
onChange?: (value: string | DateRange | null) => void;
onAccept?: () => void;
onCancel?: () => void;
}
function Calendar(props: CalendarProps): Node;
interface CardProps extends BaseProps { }
function Card(props: CardProps, children?: ComponentChildren): Node;
interface CardTitleProps extends BaseProps { }
function CardTitle(props: CardTitleProps, children?: ComponentChildren): Node;
interface CardBodyProps extends BaseProps { }
function CardBody(props: CardBodyProps, children?: ComponentChildren): Node;
interface CardActionsProps extends BaseProps { }
function CardActions(props: CardActionsProps, children?: ComponentChildren): Node;
interface CarouselProps extends BaseProps { }
function Carousel(props: CarouselProps, children?: ComponentChildren): Node;
interface CarouselItemProps extends BaseProps { }
function CarouselItem(props: CarouselItemProps, children?: ComponentChildren): Node;
interface ChatProps extends BaseProps { }
function Chat(props: ChatProps, children?: ComponentChildren): Node;
interface ChatBubbleProps extends BaseProps { }
function ChatBubble(props: ChatBubbleProps, children?: ComponentChildren): Node;
interface ChatFooterProps extends BaseProps { }
function ChatFooter(props: ChatFooterProps, children?: ComponentChildren): Node;
interface ChatHeaderProps extends BaseProps { }
function ChatHeader(props: ChatHeaderProps, children?: ComponentChildren): Node;
interface ChatImageProps extends BaseProps { }
function ChatImage(props: ChatImageProps, children?: ComponentChildren): Node;
interface CheckboxProps extends BaseProps { }
function Checkbox(props: CheckboxProps): Node;
interface ColorpickerProps extends BaseProps {
value?: Signal<string> | string;
label?: string | (() => string);
onchange?: (color: string) => void;
}
function Colorpicker(props: ColorpickerProps): Node;
interface ColorPaletteProps extends BaseProps {
value?: Signal<string> | string;
onchange?: (color: string) => void;
}
function ColorPalette(props: ColorPaletteProps): Node;
interface DatepickerProps extends BaseProps {
value?: Signal<string | DateRange> | string | DateRange;
range?: boolean | (() => boolean);
hour?: boolean;
placeholder?: string;
onChange?: (value: string | DateRange | null) => void;
onAccept?: () => void;
onCancel?: () => void;
}
function Datepicker(props: DatepickerProps): Node;
interface DividerProps extends BaseProps { }
function Divider(props: DividerProps): Node;
interface DrawerProps extends BaseProps { }
function Drawer(props: DrawerProps, children?: ComponentChildren): Node;
interface DrawerToggleProps extends BaseProps {
checked?: Signal<boolean> | boolean;
}
function DrawerToggle(props: DrawerToggleProps): Node;
interface DrawerContentProps extends BaseProps { }
function DrawerContent(props: DrawerContentProps, children?: ComponentChildren): Node;
interface DrawerSideProps extends BaseProps { }
function DrawerSide(props: DrawerSideProps, children?: ComponentChildren): Node;
interface DrawerOverlayProps extends BaseProps {
for?: string;
}
function DrawerOverlay(props: DrawerOverlayProps): Node;
interface DropdownProps extends BaseProps {
open?: Signal<boolean>;
}
function Dropdown(props: DropdownProps, children?: ComponentChildren): Node;
interface DropdownButtonProps extends BaseProps { }
function DropdownButton(props: DropdownButtonProps, children?: ComponentChildren): Node;
interface DropdownContentProps extends BaseProps { }
function DropdownContent(props: DropdownContentProps, children?: ComponentChildren): Node;
interface EditorProps extends BaseProps {
value?: Signal<string> | string;
onchange?: (value: string) => void;
}
function Editor(props: EditorProps): Node;
interface FabProps extends BaseProps {
icon?: string;
}
function Fab(props: FabProps, children?: ComponentChildren): Node;
interface FieldsetProps extends BaseProps {
label?: string | (() => string);
}
function Fieldset(props: FieldsetProps, children?: ComponentChildren): Node;
interface FileinputProps extends BaseProps {
max?: number;
accept?: string;
onselect?: (files: File[]) => void;
value?: Signal<File[]>;
}
function Fileinput(props: FileinputProps): Node;
interface IconProps {
class?: string;
}
function Icon(props: string | IconProps): Node;
interface IndicatorProps extends BaseProps {
value?: string | number | (() => string | number);
}
function Indicator(props: IndicatorProps, children?: ComponentChildren): Node;
interface InputProps extends BaseProps {
value?: Signal<string> | string;
type?: string;
placeholder?: string;
label?: string | (() => string);
float?: boolean;
left?: ComponentChild;
right?: ComponentChild;
rule?: string;
hint?: string | (() => string);
}
function Input(props: InputProps): Node;
interface KbdProps extends BaseProps { }
function Kbd(props: KbdProps, children?: ComponentChildren): Node;
interface ListProps extends BaseProps { }
function List(props: ListProps, children?: ComponentChildren): Node;
interface ListRowsProps extends BaseProps {
items?: any[] | (() => any[]);
render?: (item: any, index: number) => ComponentChild;
}
function ListRows(props: ListRowsProps): Node;
interface LoadingProps extends BaseProps { }
function Loading(props: LoadingProps, children?: ComponentChildren): Node;
interface MenuItem {
label?: string | (() => string);
href?: string;
onclick?: (e: MouseEvent) => void;
children?: MenuItem[] | (() => MenuItem[]);
open?: boolean;
}
interface MenuProps extends BaseProps {
items?: MenuItem[] | (() => MenuItem[]);
children?: ComponentChildren;
}
function Menu(props: MenuProps): Node;
interface ModalProps extends BaseProps {
open?: Signal<boolean> | boolean;
title?: string | (() => string);
actions?: ComponentChild;
}
function Modal(props: ModalProps, children?: ComponentChildren): Node;
interface NavbarProps extends BaseProps { }
function Navbar(props: NavbarProps, children?: ComponentChildren): Node;
interface ProgressProps extends BaseProps {
value?: number | (() => number);
max?: number;
}
function Progress(props: ProgressProps): Node;
interface RadialProps extends BaseProps {
value?: Signal<number> | number;
}
function Radial(props: RadialProps, children?: ComponentChildren): Node;
interface RadioProps extends BaseProps {
name?: string;
checked?: boolean | (() => boolean);
}
function Radio(props: RadioProps): Node;
interface RangeProps extends BaseProps {
value?: Signal<number> | number;
min?: number;
max?: number;
}
function Range(props: RangeProps): Node;
interface RatingProps extends BaseProps { }
function Rating(props: RatingProps, children?: ComponentChildren): Node;
interface RatingItemsProps extends BaseProps {
count: number;
name?: string;
value?: Signal<number> | number;
onchange?: (value: number) => void;
}
function RatingItems(props: RatingItemsProps): Node;
interface SelectOption {
label?: string;
value?: string;
disabled?: boolean;
}
interface SelectProps extends BaseProps {
items?: SelectOption[] | (() => SelectOption[]);
value?: Signal<string> | string;
placeholder?: string;
placeholderDisabled?: boolean;
label?: string | (() => string);
float?: boolean;
left?: ComponentChild;
right?: ComponentChild;
hint?: string | (() => string);
onchange?: (e: Event) => void;
}
function Select(props: SelectProps, children?: ComponentChildren): Node;
interface SkeletonProps extends BaseProps { }
function Skeleton(props: SkeletonProps): Node;
interface SkeletonTextProps extends BaseProps { }
function SkeletonText(props: SkeletonTextProps): Node;
interface StackProps extends BaseProps { }
function Stack(props: StackProps, children?: ComponentChildren): Node;
interface StatProps extends BaseProps {
title?: string | (() => string);
value?: string | number | (() => string | number);
desc?: string | (() => string);
}
function Stat(props: StatProps): Node;
interface StatsProps extends BaseProps { }
function Stats(props: StatsProps, children?: ComponentChildren): Node;
interface StepsProps extends BaseProps { }
function Steps(props: StepsProps, children?: ComponentChildren): Node;
interface StepProps extends BaseProps {
dataContent?: string;
}
function Step(props: StepProps, children?: ComponentChildren): Node;
interface SwapProps extends BaseProps { }
function Swap(props: SwapProps, children?: ComponentChildren): Node;
interface SwapToggleProps extends BaseProps {
value?: Signal<boolean> | boolean;
}
function SwapToggle(props: SwapToggleProps): Node;
interface SwapOnProps extends BaseProps { }
function SwapOn(props: SwapOnProps, children?: ComponentChildren): Node;
interface SwapOffProps extends BaseProps { }
function SwapOff(props: SwapOffProps, children?: ComponentChildren): Node;
interface TableProps extends BaseProps { }
function Table(props: TableProps, children?: ComponentChildren): Node;
interface TableColumn {
label?: string;
key?: string;
render?: (item: any, index: number) => ComponentChild;
class?: string;
}
interface TableItemsProps extends BaseProps {
items?: any[] | (() => any[]);
columns?: TableColumn[];
header?: boolean;
}
function TableItems(props: TableItemsProps): Node;
interface TabItem {
label?: string | (() => string);
content?: ComponentChild | (() => ComponentChild);
class?: string;
closable?: boolean;
onclick?: (e: MouseEvent) => void;
}
interface TabsProps extends BaseProps {
items?: TabItem[] | (() => TabItem[]);
activeIndex?: Signal<number>;
onClose?: (index: number, item: TabItem) => void;
children?: ComponentChildren;
}
function Tabs(props: TabsProps): Node;
interface TextareaProps extends BaseProps {
value?: Signal<string> | string;
placeholder?: string;
}
function Textarea(props: TextareaProps): Node;
interface TextrotateProps extends BaseProps { }
function Textrotate(props: TextrotateProps, children?: ComponentChildren): Node;
interface TimelineProps extends BaseProps { }
function Timeline(props: TimelineProps, children?: ComponentChildren): Node;
type ToastType = 'alert-info' | 'alert-success' | 'alert-warning' | 'alert-error';
function Toast(message: string | (() => string), type?: ToastType, duration?: number): () => void;
interface ToggleProps extends BaseProps {
checked?: Signal<boolean> | boolean;
}
function Toggle(props: ToggleProps): Node;
interface TooltipProps extends BaseProps {
tip: string | (() => string);
}
function Tooltip(props: TooltipProps, children?: ComponentChildren): Node;
const Components: {
Accordion: typeof Accordion;
Alert: typeof Alert;
Autocomplete: typeof Autocomplete;
Badge: typeof Badge;
Button: typeof Button;
Calendar: typeof Calendar;
Card: typeof Card;
CardTitle: typeof CardTitle;
CardBody: typeof CardBody;
CardActions: typeof CardActions;
Carousel: typeof Carousel;
CarouselItem: typeof CarouselItem;
Chat: typeof Chat;
ChatBubble: typeof ChatBubble;
ChatFooter: typeof ChatFooter;
ChatHeader: typeof ChatHeader;
ChatImage: typeof ChatImage;
Checkbox: typeof Checkbox;
Colorpicker: typeof Colorpicker;
ColorPalette: typeof ColorPalette;
Datepicker: typeof Datepicker;
Divider: typeof Divider;
Drawer: typeof Drawer;
DrawerToggle: typeof DrawerToggle;
DrawerContent: typeof DrawerContent;
DrawerSide: typeof DrawerSide;
DrawerOverlay: typeof DrawerOverlay;
Dropdown: typeof Dropdown;
DropdownButton: typeof DropdownButton;
DropdownContent: typeof DropdownContent;
Editor: typeof Editor;
Fab: typeof Fab;
Fieldset: typeof Fieldset;
Fileinput: typeof Fileinput;
Icon: typeof Icon;
Indicator: typeof Indicator;
Input: typeof Input;
Kbd: typeof Kbd;
List: typeof List;
ListRows: typeof ListRows;
Loading: typeof Loading;
Menu: typeof Menu;
Modal: typeof Modal;
Navbar: typeof Navbar;
Progress: typeof Progress;
Radial: typeof Radial;
Radio: typeof Radio;
Range: typeof Range;
Rating: typeof Rating;
RatingItems: typeof RatingItems;
Select: typeof Select;
Skeleton: typeof Skeleton;
SkeletonText: typeof SkeletonText;
Stack: typeof Stack;
Stat: typeof Stat;
Stats: typeof Stats;
Steps: typeof Steps;
Step: typeof Step;
Swap: typeof Swap;
SwapToggle: typeof SwapToggle;
SwapOn: typeof SwapOn;
SwapOff: typeof SwapOff;
Table: typeof Table;
TableItems: typeof TableItems;
Tabs: typeof Tabs;
Textarea: typeof Textarea;
Textrotate: typeof Textrotate;
Timeline: typeof Timeline;
Toast: typeof Toast;
Toggle: typeof Toggle;
Tooltip: typeof Tooltip;
};
export { Components };
export default Components;
declare global {
const Accordion: typeof import('sigpro-ui').Accordion;
const Alert: typeof import('sigpro-ui').Alert;
const Autocomplete: typeof import('sigpro-ui').Autocomplete;
const Badge: typeof import('sigpro-ui').Badge;
const Button: typeof import('sigpro-ui').Button;
const Calendar: typeof import('sigpro-ui').Calendar;
const Card: typeof import('sigpro-ui').Card;
const CardTitle: typeof import('sigpro-ui').CardTitle;
const CardBody: typeof import('sigpro-ui').CardBody;
const CardActions: typeof import('sigpro-ui').CardActions;
const Carousel: typeof import('sigpro-ui').Carousel;
const CarouselItem: typeof import('sigpro-ui').CarouselItem;
const Chat: typeof import('sigpro-ui').Chat;
const ChatBubble: typeof import('sigpro-ui').ChatBubble;
const ChatFooter: typeof import('sigpro-ui').ChatFooter;
const ChatHeader: typeof import('sigpro-ui').ChatHeader;
const ChatImage: typeof import('sigpro-ui').ChatImage;
const Checkbox: typeof import('sigpro-ui').Checkbox;
const Colorpicker: typeof import('sigpro-ui').Colorpicker;
const ColorPalette: typeof import('sigpro-ui').ColorPalette;
const Datepicker: typeof import('sigpro-ui').Datepicker;
const Divider: typeof import('sigpro-ui').Divider;
const Drawer: typeof import('sigpro-ui').Drawer;
const DrawerToggle: typeof import('sigpro-ui').DrawerToggle;
const DrawerContent: typeof import('sigpro-ui').DrawerContent;
const DrawerSide: typeof import('sigpro-ui').DrawerSide;
const DrawerOverlay: typeof import('sigpro-ui').DrawerOverlay;
const Dropdown: typeof import('sigpro-ui').Dropdown;
const DropdownButton: typeof import('sigpro-ui').DropdownButton;
const DropdownContent: typeof import('sigpro-ui').DropdownContent;
const Editor: typeof import('sigpro-ui').Editor;
const Fab: typeof import('sigpro-ui').Fab;
const Fieldset: typeof import('sigpro-ui').Fieldset;
const Fileinput: typeof import('sigpro-ui').Fileinput;
const Icon: typeof import('sigpro-ui').Icon;
const Indicator: typeof import('sigpro-ui').Indicator;
const Input: typeof import('sigpro-ui').Input;
const Kbd: typeof import('sigpro-ui').Kbd;
const List: typeof import('sigpro-ui').List;
const ListRows: typeof import('sigpro-ui').ListRows;
const Loading: typeof import('sigpro-ui').Loading;
const Menu: typeof import('sigpro-ui').Menu;
const Modal: typeof import('sigpro-ui').Modal;
const Navbar: typeof import('sigpro-ui').Navbar;
const Progress: typeof import('sigpro-ui').Progress;
const Radial: typeof import('sigpro-ui').Radial;
const Radio: typeof import('sigpro-ui').Radio;
const Range: typeof import('sigpro-ui').Range;
const Rating: typeof import('sigpro-ui').Rating;
const RatingItems: typeof import('sigpro-ui').RatingItems;
const Select: typeof import('sigpro-ui').Select;
const Skeleton: typeof import('sigpro-ui').Skeleton;
const SkeletonText: typeof import('sigpro-ui').SkeletonText;
const Stack: typeof import('sigpro-ui').Stack;
const Stat: typeof import('sigpro-ui').Stat;
const Stats: typeof import('sigpro-ui').Stats;
const Steps: typeof import('sigpro-ui').Steps;
const Step: typeof import('sigpro-ui').Step;
const Swap: typeof import('sigpro-ui').Swap;
const SwapToggle: typeof import('sigpro-ui').SwapToggle;
const SwapOn: typeof import('sigpro-ui').SwapOn;
const SwapOff: typeof import('sigpro-ui').SwapOff;
const Table: typeof import('sigpro-ui').Table;
const TableItems: typeof import('sigpro-ui').TableItems;
const Tabs: typeof import('sigpro-ui').Tabs;
const Textarea: typeof import('sigpro-ui').Textarea;
const Textrotate: typeof import('sigpro-ui').Textrotate;
const Timeline: typeof import('sigpro-ui').Timeline;
const Toast: typeof import('sigpro-ui').Toast;
const Toggle: typeof import('sigpro-ui').Toggle;
const Tooltip: typeof import('sigpro-ui').Tooltip;
const Components: typeof import('sigpro-ui').Components;
}