2023-12-18 19:42:27 +03:00
|
|
|
// =========== Module contains interfaces for common UI elements. ==========
|
2023-12-25 16:53:27 +03:00
|
|
|
import { HTMLMotionProps } from 'framer-motion';
|
|
|
|
|
2023-12-18 19:42:27 +03:00
|
|
|
export namespace CProps {
|
2024-09-12 16:42:02 +03:00
|
|
|
/**
|
|
|
|
* 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 {
|
2024-09-12 16:42:02 +03:00
|
|
|
/** Tooltip: `plain text`. */
|
2023-12-28 14:04:44 +03:00
|
|
|
title?: string;
|
2024-09-12 16:42:02 +03:00
|
|
|
|
|
|
|
/** Tooltip: `HTML formatted`. */
|
2024-03-09 16:40:10 +03:00
|
|
|
titleHtml?: string;
|
2024-09-12 16:42:02 +03:00
|
|
|
|
|
|
|
/** 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
|
|
|
|
2024-09-12 16:42:02 +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 & {
|
2024-09-12 16:42:02 +03:00
|
|
|
/** Indicates whether the control is disabled. */
|
2023-12-28 14:04:44 +03:00
|
|
|
disabled?: boolean;
|
2024-09-12 16:42:02 +03:00
|
|
|
|
|
|
|
/** Indicates whether the control should render without a border. */
|
2023-12-28 14:04:44 +03:00
|
|
|
noBorder?: boolean;
|
2024-09-12 16:42:02 +03:00
|
|
|
|
|
|
|
/** Indicates whether the control should render without an outline. */
|
2023-12-28 14:04:44 +03:00
|
|
|
noOutline?: boolean;
|
|
|
|
};
|
|
|
|
|
2024-09-12 16:42:02 +03:00
|
|
|
/**
|
|
|
|
* 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 & {
|
2024-09-12 16:42:02 +03:00
|
|
|
/** Text label. */
|
2023-12-28 14:04:44 +03:00
|
|
|
label?: string;
|
|
|
|
};
|
|
|
|
|
2024-09-12 16:42:02 +03:00
|
|
|
/**
|
|
|
|
* 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>;
|
2024-09-12 16:42:02 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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'
|
|
|
|
>;
|
2024-09-12 16:42:02 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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'
|
|
|
|
>;
|
2024-09-12 16:42:02 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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>;
|
2024-09-12 16:42:02 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
2024-09-12 16:42:02 +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'>;
|
2024-09-12 16:42:02 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents `div` component with animation properties.
|
|
|
|
*/
|
2024-01-06 03:15:02 +03:00
|
|
|
export type AnimatedDiv = HTMLMotionProps<'div'>;
|
2024-04-07 19:45:07 +03:00
|
|
|
|
2024-09-12 16:42:02 +03:00
|
|
|
/**
|
|
|
|
* Represents `mouse event` in React.
|
|
|
|
*/
|
2024-04-07 19:45:07 +03:00
|
|
|
export type EventMouse = React.MouseEvent<Element, MouseEvent>;
|
2023-12-18 19:42:27 +03:00
|
|
|
}
|