/* * Vencord, a modification for Discord's desktop app * Copyright (c) 2023 Vendicated and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ import type { Moment } from "moment"; import type { ComponentType, CSSProperties, FunctionComponent, HtmlHTMLAttributes, HTMLProps, PropsWithChildren, PropsWithRef, ReactNode, Ref } from "react"; export type TextVariant = "heading-sm/normal" | "heading-sm/medium" | "heading-sm/semibold" | "heading-sm/bold" | "heading-md/normal" | "heading-md/medium" | "heading-md/semibold" | "heading-md/bold" | "heading-lg/normal" | "heading-lg/medium" | "heading-lg/semibold" | "heading-lg/bold" | "heading-xl/normal" | "heading-xl/medium" | "heading-xl/bold" | "heading-xxl/normal" | "heading-xxl/medium" | "heading-xxl/bold" | "eyebrow" | "heading-deprecated-14/normal" | "heading-deprecated-14/medium" | "heading-deprecated-14/bold" | "text-xxs/normal" | "text-xxs/medium" | "text-xxs/semibold" | "text-xxs/bold" | "text-xs/normal" | "text-xs/medium" | "text-xs/semibold" | "text-xs/bold" | "text-sm/normal" | "text-sm/medium" | "text-sm/semibold" | "text-sm/bold" | "text-md/normal" | "text-md/medium" | "text-md/semibold" | "text-md/bold" | "text-lg/normal" | "text-lg/medium" | "text-lg/semibold" | "text-lg/bold" | "display-sm" | "display-md" | "display-lg" | "code"; export type FormTextTypes = Record<"DEFAULT" | "INPUT_PLACEHOLDER" | "DESCRIPTION" | "LABEL_BOLD" | "LABEL_SELECTED" | "LABEL_DESCRIPTOR" | "ERROR" | "SUCCESS", string>; export type Heading = `h${1 | 2 | 3 | 4 | 5 | 6}`; export type Margins = Record<"marginTop16" | "marginTop8" | "marginBottom8" | "marginTop20" | "marginBottom20", string>; export type ButtonLooks = Record<"FILLED" | "INVERTED" | "OUTLINED" | "LINK" | "BLANK", string>; export type TextProps = PropsWithChildren & { variant?: TextVariant; tag?: "div" | "span" | "p" | "strong" | Heading; selectable?: boolean; lineClamp?: number; }>; export type Text = ComponentType; export type FormTitle = ComponentType & PropsWithChildren<{ /** default is h5 */ tag?: Heading; faded?: boolean; disabled?: boolean; required?: boolean; error?: ReactNode; }>>; export type FormSection = ComponentType>; export type FormDivider = ComponentType<{ className?: string; style?: CSSProperties; }>; export type FormText = ComponentType & TextProps> & { Types: FormTextTypes; }; export type Tooltip = ComponentType<{ text: ReactNode; children: FunctionComponent<{ onClick(): void; onMouseEnter(): void; onMouseLeave(): void; onContextMenu(): void; onFocus(): void; onBlur(): void; "aria-label"?: string; }>; "aria-label"?: string; allowOverflow?: boolean; forceOpen?: boolean; hide?: boolean; hideOnClick?: boolean; shouldShow?: boolean; spacing?: number; /** Tooltip.Colors.BLACK */ color?: string; /** Tooltip.Positions.TOP */ position?: string; tooltipClassName?: string; tooltipContentClassName?: string; }> & { Positions: Record<"BOTTOM" | "CENTER" | "LEFT" | "RIGHT" | "TOP" | "WINDOW_CENTER", string>; Colors: Record<"BLACK" | "BRAND" | "CUSTOM" | "GREEN" | "GREY" | "PRIMARY" | "RED" | "YELLOW", string>; }; export type Card = ComponentType & { editable?: boolean; outline?: boolean; /** Card.Types.PRIMARY */ type?: string; }>> & { Types: Record<"BRAND" | "CUSTOM" | "DANGER" | "PRIMARY" | "SUCCESS" | "WARNING", string>; }; export type Button = ComponentType, "size"> & { /** Button.Looks.FILLED */ look?: string; /** Button.Colors.BRAND */ color?: string; /** Button.Sizes.MEDIUM */ size?: string; /** Button.BorderColors.BLACK */ borderColor?: string; wrapperClassName?: string; className?: string; innerClassName?: string; buttonRef?: Ref; focusProps?: any; submittingStartedLabel?: string; submittingFinishedLabel?: string; }>> & { BorderColors: Record<"BLACK" | "BRAND" | "BRAND_NEW" | "GREEN" | "LINK" | "PRIMARY" | "RED" | "TRANSPARENT" | "WHITE" | "YELLOW", string>; Colors: Record<"BRAND" | "RED" | "GREEN" | "YELLOW" | "PRIMARY" | "LINK" | "WHITE" | "BLACK" | "TRANSPARENT" | "BRAND_NEW" | "CUSTOM", string>; Hovers: Record<"DEFAULT" | "BRAND" | "RED" | "GREEN" | "YELLOW" | "PRIMARY" | "LINK" | "WHITE" | "BLACK" | "TRANSPARENT", string>; Looks: Record<"FILLED" | "INVERTED" | "OUTLINED" | "LINK" | "BLANK", string>; Sizes: Record<"NONE" | "TINY" | "SMALL" | "MEDIUM" | "LARGE" | "XLARGE" | "MIN" | "MAX" | "ICON", string>; Link: any; }; export type Switch = ComponentType>; export type Timestamp = ComponentType>; export type TextInput = ComponentType; prefixElement?: ReactNode; focusProps?: any; /** TextInput.Sizes.DEFAULT */ size?: string; } & Omit, "onChange">>> & { Sizes: Record<"DEFAULT" | "MINI", string>; }; export type TextArea = ComponentType>>; interface SelectOption { disabled?: boolean; value: any; label: string; key?: React.Key; default?: boolean; } export type Select = ComponentType; // TODO /** * - 0 ~ Filled * - 1 ~ Custom */ look?: 0 | 1; className?: string; popoutClassName?: string; popoutPosition?: "top" | "left" | "right" | "bottom" | "center" | "window_center"; optionClassName?: string; autoFocus?: boolean; isDisabled?: boolean; clearable?: boolean; closeOnSelect?: boolean; hideIcon?: boolean; select(value: any): void; isSelected(value: any): boolean; serialize(value: any): string; clear?(): void; maxVisibleItems?: number; popoutWidth?: number; onClose?(): void; onOpen?(): void; renderOptionLabel?(option: SelectOption): ReactNode; /** discord stupid this gets all options instead of one yeah */ renderOptionValue?(option: SelectOption[]): ReactNode; "aria-label"?: boolean; "aria-labelledby"?: boolean; }>>; export type Slider = ComponentType>; // TODO - type maybe idk probably not that useful other than the constants export type Flex = ComponentType> & { Align: Record<"START" | "END" | "CENTER" | "STRETCH" | "BASELINE", string>; Direction: Record<"VERTICAL" | "HORIZONTAL" | "HORIZONTAL_REVERSE", string>; Justify: Record<"START" | "END" | "CENTER" | "BETWEEN" | "AROUND", string>; Wrap: Record<"NO_WRAP" | "WRAP" | "WRAP_REVERSE", string>; Content: ComponentType>; Sidebar: ComponentType>; };