ConceptPortal-public/rsconcept/frontend/src/components/props.d.ts

114 lines
3.4 KiB
TypeScript
Raw Normal View History

// =========== Module contains interfaces for common UI elements. ==========
import { HTMLMotionProps } from 'framer-motion';
export namespace CProps {
/**
* Represents an object that can have inline styles and CSS class names for styling.
*/
export interface Styling {
/** Optional inline styles for the component. */
style?: React.CSSProperties;
/** Optional CSS class name(s) for the component. */
className?: string;
}
/**
* Represents an object that can have a color or set of colors.
*/
export interface Colors {
/** Optional color or set of colors applied via classNames. */
colors?: string;
}
/**
* Represents an object that can have a title with optional HTML rendering and a flag to hide the title.
*/
2024-08-06 14:39:00 +03:00
export interface Titled {
/** Tooltip: `plain text`. */
2023-12-28 14:04:44 +03:00
title?: string;
/** Tooltip: `HTML formatted`. */
2024-03-09 16:40:10 +03:00
titleHtml?: string;
/** Indicates whether the `title` should be hidden. */
2024-03-09 16:40:10 +03:00
hideTitle?: boolean;
2024-08-06 14:39:00 +03:00
}
2024-03-09 16:40:10 +03:00
/**
* Represents `control` component with optional title and configuration options.
*
* @remarks
* This type extends the {@link Titled} interface, adding properties to control the visual and interactive behavior of a component.
*/
2024-03-09 16:40:10 +03:00
export type Control = Titled & {
/** Indicates whether the control is disabled. */
2023-12-28 14:04:44 +03:00
disabled?: boolean;
/** Indicates whether the control should render without a border. */
2023-12-28 14:04:44 +03:00
noBorder?: boolean;
/** Indicates whether the control should render without an outline. */
2023-12-28 14:04:44 +03:00
noOutline?: boolean;
};
/**
* Represents `editor` component that includes a label, control features, and optional title properties.
*
* @remarks
* This type extends the {@link Control} type, inheriting title-related properties and additional configuration options, while also adding an optional label.
*/
2023-12-28 14:04:44 +03:00
export type Editor = Control & {
/** Text label. */
2023-12-28 14:04:44 +03:00
label?: string;
};
/**
* Represents `div` component with all standard HTML attributes and React-specific properties.
*/
2023-12-28 14:04:44 +03:00
export type Div = React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
/**
* Represents `button` component with optional title and HTML attributes.
*/
2024-03-09 16:40:10 +03:00
export type Button = Titled &
Omit<
React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>,
'children' | 'type'
>;
/**
* Represents `label` component with HTML attributes.
*/
2023-12-28 14:04:44 +03:00
export type Label = Omit<
React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>,
'children'
>;
/**
* Represents `textarea` component with optional title and HTML attributes.
*/
2024-03-09 16:40:10 +03:00
export type TextArea = Titled &
React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>;
/**
* Represents `input` component with optional title and HTML attributes.
*/
2024-03-09 16:40:10 +03:00
export type Input = Titled & React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
2023-12-28 14:04:44 +03:00
/**
* Represents `button` component with optional title and animation properties.
*/
2024-03-09 16:40:10 +03:00
export type AnimatedButton = Titled & Omit<HTMLMotionProps<'button'>, 'type'>;
/**
* Represents `div` component with animation properties.
*/
export type AnimatedDiv = HTMLMotionProps<'div'>;
/**
* Represents `mouse event` in React.
*/
export type EventMouse = React.MouseEvent<Element, MouseEvent>;
}