skillgrid 0.0.21-dev-36347-gornyi.1125678 → 0.0.21-imports.1141086
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +151 -1
- package/dist/components/Button/Button.d.ts +2 -3
- package/dist/components/Checkbox/Checkbox.d.ts +18 -0
- package/dist/components/Checkbox/Checkbox.type.d.ts +90 -0
- package/dist/components/Checkbox/assets/CheckIcon.d.ts +16 -0
- package/dist/components/Checkbox/assets/LineIcon.d.ts +16 -0
- package/dist/components/Checkbox/index.d.ts +2 -0
- package/dist/components/Helper/Helper.d.ts +7 -0
- package/dist/components/Helper/Helper.type.d.ts +17 -0
- package/dist/components/Helper/index.d.ts +2 -0
- package/dist/components/InputBase/Input.d.ts +9 -0
- package/dist/components/InputBase/Input.type.d.ts +138 -0
- package/dist/components/InputBase/InputBase.d.ts +6 -0
- package/dist/components/InputBase/InputBase.type.d.ts +110 -0
- package/dist/components/InputBase/assets/GripIcon.d.ts +8 -0
- package/dist/components/InputBase/assets/SearchIcon.d.ts +17 -0
- package/dist/components/InputBase/assets/XIcon.d.ts +18 -0
- package/dist/components/InputBase/assets/index.d.ts +3 -0
- package/dist/components/InputBase/index.d.ts +3 -0
- package/dist/components/InputBase/lib/constants.d.ts +4 -0
- package/dist/components/InputBase/lib/index.d.ts +4 -0
- package/dist/components/InputBase/lib/useGripResize.d.ts +11 -0
- package/dist/components/InputBase/lib/useInputSync.d.ts +11 -0
- package/dist/components/InputBase/lib/useTextareaResize.d.ts +9 -0
- package/dist/components/List/List.d.ts +5 -0
- package/dist/components/List/List.type.d.ts +34 -0
- package/dist/components/List/ListItem/ListItem.d.ts +9 -0
- package/dist/components/List/index.d.ts +2 -0
- package/dist/components/TextArea/TextArea.d.ts +6 -0
- package/dist/components/TextArea/TextArea.type.d.ts +66 -0
- package/dist/components/TextArea/index.d.ts +2 -0
- package/dist/components/TextArea/lib/constants.d.ts +65 -0
- package/dist/components/TextArea/lib/getters.d.ts +38 -0
- package/dist/components/TextArea/lib/index.d.ts +2 -0
- package/dist/components/TextInput/TextInput.d.ts +6 -0
- package/dist/components/TextInput/TextInput.type.d.ts +72 -0
- package/dist/components/TextInput/index.d.ts +2 -0
- package/dist/components/TextInput/lib/constants.d.ts +9 -0
- package/dist/components/TextInput/lib/getters.d.ts +38 -0
- package/dist/components/TextInput/lib/index.d.ts +2 -0
- package/dist/components/Typography/Typography.constants.d.ts +2 -0
- package/dist/components/Typography/Typography.d.ts +21 -0
- package/dist/components/Typography/Typography.type.d.ts +68 -0
- package/dist/components/Typography/index.d.ts +1 -0
- package/dist/index.cjs.js +11 -11
- package/dist/index.css +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.es.js +2084 -871
- package/dist/utils/other.d.ts +8 -0
- package/package.json +4 -2
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, HTMLAttributes } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Размеры для компонента InputBase
|
|
4
|
+
*/
|
|
5
|
+
export type InputBaseSize = 'small' | 'medium' | 'large';
|
|
6
|
+
/**
|
|
7
|
+
* Типы компонентов для InputBase
|
|
8
|
+
*/
|
|
9
|
+
export type InputBaseComponent = 'input' | 'textarea';
|
|
10
|
+
/**
|
|
11
|
+
* Базовые пропсы для компонента InputBase
|
|
12
|
+
*/
|
|
13
|
+
export interface InputBaseProps {
|
|
14
|
+
/** Тип компонента (input или textarea) */
|
|
15
|
+
component?: InputBaseComponent;
|
|
16
|
+
/** Размер компонента */
|
|
17
|
+
size?: InputBaseSize;
|
|
18
|
+
/** Содержимое компонента (устаревший способ) */
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
/** Дополнительные CSS классы */
|
|
21
|
+
className?: string;
|
|
22
|
+
/** Состояние ошибки */
|
|
23
|
+
error?: boolean;
|
|
24
|
+
/** Плейсхолдер для поля */
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
/** Отключенное состояние */
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
/** Состояние загрузки */
|
|
29
|
+
loading?: boolean;
|
|
30
|
+
/** Показывать ли метку (по умолчанию: true) */
|
|
31
|
+
showLabel?: boolean;
|
|
32
|
+
/** CSS классы для плавающей метки */
|
|
33
|
+
labelClassName?: string;
|
|
34
|
+
/** Вспомогательный текст под полем */
|
|
35
|
+
helper?: string;
|
|
36
|
+
/** Префикс (иконка слева) */
|
|
37
|
+
prefix?: ReactNode;
|
|
38
|
+
/** Суффикс (иконка справа) */
|
|
39
|
+
suffix?: ReactNode;
|
|
40
|
+
/** ID компонента */
|
|
41
|
+
id?: string;
|
|
42
|
+
/** Обработчик фокуса */
|
|
43
|
+
onFocus?: () => void;
|
|
44
|
+
/** Обработчик потери фокуса */
|
|
45
|
+
onBlur?: () => void;
|
|
46
|
+
/** Обработчик изменения значения */
|
|
47
|
+
onChange?: (value: string) => void;
|
|
48
|
+
/** Текущее значение */
|
|
49
|
+
value?: string;
|
|
50
|
+
/** Стили для обертки */
|
|
51
|
+
wrapperProps?: HTMLAttributes<HTMLDivElement>;
|
|
52
|
+
/** Стили для метки */
|
|
53
|
+
labelProps?: HTMLAttributes<HTMLLabelElement>;
|
|
54
|
+
/** Стили для вспомогательного текста */
|
|
55
|
+
helperProps?: HTMLAttributes<HTMLDivElement>;
|
|
56
|
+
/** Дополнительные стили для обертки (высота, отступы) */
|
|
57
|
+
wrapperStyles?: React.CSSProperties;
|
|
58
|
+
/** Дополнительные стили для плавающей метки */
|
|
59
|
+
floatingLabelStyles?: React.CSSProperties;
|
|
60
|
+
/** Дополнительные стили для префикса */
|
|
61
|
+
prefixStyles?: React.CSSProperties;
|
|
62
|
+
/** Дополнительные стили для суффикса */
|
|
63
|
+
suffixStyles?: React.CSSProperties;
|
|
64
|
+
/** Стили для textarea элемента */
|
|
65
|
+
textareaStyles?: React.CSSProperties;
|
|
66
|
+
/** Показывать ли счетчик символов */
|
|
67
|
+
showLimit?: boolean;
|
|
68
|
+
/** Максимальная длина */
|
|
69
|
+
maxLength?: number;
|
|
70
|
+
/** Пропсы для встроенного input/textarea */
|
|
71
|
+
inputProps?: InputHTMLAttributes<HTMLInputElement> | TextareaHTMLAttributes<HTMLTextAreaElement>;
|
|
72
|
+
/** Подсказка внутри поля ввода */
|
|
73
|
+
hint?: string;
|
|
74
|
+
/** Показывать ли подсказку */
|
|
75
|
+
showHint?: boolean;
|
|
76
|
+
/** Показывать подсказку когда значение пустое */
|
|
77
|
+
showHintOnEmpty?: boolean;
|
|
78
|
+
/** Включить обрезку текста с многоточием */
|
|
79
|
+
truncate?: boolean;
|
|
80
|
+
/** Состояние ошибки для accessibility */
|
|
81
|
+
'aria-invalid'?: boolean;
|
|
82
|
+
/** ID элемента с сообщением об ошибке для accessibility */
|
|
83
|
+
'aria-errormessage'?: string;
|
|
84
|
+
/** Тип изменения размера для textarea */
|
|
85
|
+
resize?: 'fill' | 'hug' | 'fixed';
|
|
86
|
+
/** Показывать ли grip для изменения размера */
|
|
87
|
+
showGrip?: boolean;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Пропсы для встроенного input элемента
|
|
91
|
+
*/
|
|
92
|
+
export interface InputBaseInputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
93
|
+
/** Состояние ошибки */
|
|
94
|
+
error?: boolean;
|
|
95
|
+
/** Отключенное состояние */
|
|
96
|
+
disabled?: boolean;
|
|
97
|
+
/** Состояние загрузки */
|
|
98
|
+
loading?: boolean;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Пропсы для встроенного textarea элемента
|
|
102
|
+
*/
|
|
103
|
+
export interface InputBaseTextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
104
|
+
/** Состояние ошибки */
|
|
105
|
+
error?: boolean;
|
|
106
|
+
/** Отключенное состояние */
|
|
107
|
+
disabled?: boolean;
|
|
108
|
+
/** Состояние загрузки */
|
|
109
|
+
loading?: boolean;
|
|
110
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface SearchIconProps {
|
|
2
|
+
/** Дополнительные CSS классы */
|
|
3
|
+
className?: string;
|
|
4
|
+
/** Инлайн стили */
|
|
5
|
+
style?: React.CSSProperties;
|
|
6
|
+
/** Размер иконки */
|
|
7
|
+
size?: 'xxxs' | 'xxs' | 'xs' | 'sm' | 'md' | 'lg';
|
|
8
|
+
/** Цвет иконки */
|
|
9
|
+
color?: string;
|
|
10
|
+
/** Дополнительные пропсы */
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Компонент иконки поиска
|
|
15
|
+
* Принимает className и style для кастомизации
|
|
16
|
+
*/
|
|
17
|
+
export declare const SearchIcon: React.FC<SearchIconProps>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface XIconProps {
|
|
2
|
+
/** Дополнительные CSS классы */
|
|
3
|
+
className?: string;
|
|
4
|
+
/** Инлайн стили */
|
|
5
|
+
style?: React.CSSProperties;
|
|
6
|
+
/** Размер иконки */
|
|
7
|
+
size?: 'xxxs' | 'xxs' | 'xs' | 'sm' | 'md' | 'lg';
|
|
8
|
+
/** Цвет иконки */
|
|
9
|
+
color?: string;
|
|
10
|
+
/** Обработчик клика */
|
|
11
|
+
onClick?: () => void;
|
|
12
|
+
/** Дополнительные пропсы */
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Компонент иконки X
|
|
17
|
+
*/
|
|
18
|
+
export declare const XIcon: React.FC<XIconProps>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Хук для обработки resize через grip
|
|
3
|
+
* @param showGrip - показывать ли grip
|
|
4
|
+
* @param disabled - отключен ли компонент
|
|
5
|
+
* @param loading - состояние загрузки
|
|
6
|
+
* @param resize - режим изменения размера
|
|
7
|
+
* @returns обработчик mousedown для grip
|
|
8
|
+
*/
|
|
9
|
+
export declare const useGripResize: (showGrip: boolean | undefined, disabled: boolean | undefined, loading: boolean | undefined, resize: string | undefined) => {
|
|
10
|
+
handleGripMouseDown: (e: React.MouseEvent) => void;
|
|
11
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Хук для синхронизации состояния HTML элемента с внешним состоянием
|
|
3
|
+
* @param value - внешнее значение
|
|
4
|
+
* @param component - тип компонента ('input' | 'textarea')
|
|
5
|
+
* @returns refs для input и textarea элементов
|
|
6
|
+
*/
|
|
7
|
+
export declare const useInputSync: (value: string, component: "input" | "textarea") => {
|
|
8
|
+
textareaRef: import('react').RefObject<HTMLTextAreaElement>;
|
|
9
|
+
inputRef: import('react').RefObject<HTMLInputElement>;
|
|
10
|
+
currentRef: import('react').RefObject<HTMLInputElement> | import('react').RefObject<HTMLTextAreaElement>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Хук для автоматического изменения размера textarea
|
|
3
|
+
* @param value - значение textarea
|
|
4
|
+
* @param resize - режим изменения размера
|
|
5
|
+
* @param textareaRef - ref для textarea элемента
|
|
6
|
+
*/
|
|
7
|
+
export declare const useTextareaResize: (value: string, resize: string | undefined, textareaRef: React.RefObject<HTMLTextAreaElement>) => {
|
|
8
|
+
resizeTextArea: () => void;
|
|
9
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ListProps } from './List.type';
|
|
3
|
+
export declare const List: React.ForwardRefExoticComponent<ListProps & React.RefAttributes<HTMLOListElement | HTMLUListElement>> & {
|
|
4
|
+
Item: React.FC<import('./ListItem/ListItem').ListItemProps>;
|
|
5
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Базовые пропсы для списка (используются и для `<ul>`, и для `<ol>`).
|
|
3
|
+
*/
|
|
4
|
+
interface BaseListProps {
|
|
5
|
+
/** Дополнительный CSS-класс для списка */
|
|
6
|
+
className?: string;
|
|
7
|
+
/** Дочерние элементы списка (`<List.Item>` или `<li>`) */
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
/** Размер списка, влияет на отступы и размер шрифта */
|
|
10
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
11
|
+
/** Атрибут для тестирования */
|
|
12
|
+
'data-testid'?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Пропсы для маркированного списка (`<ul>`).
|
|
16
|
+
* Атрибут `start` запрещён.
|
|
17
|
+
*/
|
|
18
|
+
interface UnorderedListProps extends BaseListProps {
|
|
19
|
+
/** Тип списка — маркированный (по умолчанию) */
|
|
20
|
+
variant?: 'unordered';
|
|
21
|
+
/** Невозможен для `<ul>` */
|
|
22
|
+
start?: never;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Пропсы для нумерованного списка (`<ol>`).
|
|
26
|
+
*/
|
|
27
|
+
interface OrderedListProps extends BaseListProps {
|
|
28
|
+
/** Тип списка — нумерованный */
|
|
29
|
+
variant: 'ordered';
|
|
30
|
+
/** Начальный номер для `<ol>` */
|
|
31
|
+
start?: number;
|
|
32
|
+
}
|
|
33
|
+
export type ListProps = UnorderedListProps | OrderedListProps;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface ListItemProps {
|
|
2
|
+
/** Дополнительный CSS-класс для списка */
|
|
3
|
+
className?: string;
|
|
4
|
+
/** Дочерние элементы */
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
/** Атрибут для тестирования */
|
|
7
|
+
'data-testid'?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const ListItem: React.FC<ListItemProps>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TextAreaProps } from './TextArea.type';
|
|
2
|
+
/**
|
|
3
|
+
* Компонент многострочного текстового поля
|
|
4
|
+
* Восстановленная версия с полной логикой стилей
|
|
5
|
+
*/
|
|
6
|
+
export declare const TextArea: import('react').ForwardRefExoticComponent<TextAreaProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { TextareaHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Размеры для компонента TextArea
|
|
4
|
+
*/
|
|
5
|
+
export type TextAreaSize = 'small' | 'medium';
|
|
6
|
+
/**
|
|
7
|
+
* Пропсы для компонента TextArea
|
|
8
|
+
*/
|
|
9
|
+
export interface TextAreaProps {
|
|
10
|
+
/** Значение поля */
|
|
11
|
+
value?: string | null;
|
|
12
|
+
/** Обработчик изменения значения */
|
|
13
|
+
onChange?: (value: string | null) => void;
|
|
14
|
+
/** Плейсхолдер для поля */
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
/** Максимальная длина */
|
|
17
|
+
maxLength?: number;
|
|
18
|
+
/** Минимальная длина */
|
|
19
|
+
minLength?: number;
|
|
20
|
+
/** Показывать ли лейбл (по умолчанию true) */
|
|
21
|
+
showLabel?: boolean;
|
|
22
|
+
/** Автофокус */
|
|
23
|
+
autoFocus?: boolean;
|
|
24
|
+
/** Размер компонента */
|
|
25
|
+
size?: TextAreaSize;
|
|
26
|
+
/** Состояние ошибки */
|
|
27
|
+
error?: boolean;
|
|
28
|
+
/** Отключенное состояние */
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
/** Состояние загрузки */
|
|
31
|
+
loading?: boolean;
|
|
32
|
+
/** Вспомогательный текст под полем */
|
|
33
|
+
helper?: string;
|
|
34
|
+
/** Суффикс (правая иконка) */
|
|
35
|
+
suffix?: ReactNode;
|
|
36
|
+
/** Показывать ли кнопку очистки */
|
|
37
|
+
clearable?: boolean;
|
|
38
|
+
/** ID компонента */
|
|
39
|
+
id?: string;
|
|
40
|
+
/** Обработчик фокуса */
|
|
41
|
+
onFocus?: () => void;
|
|
42
|
+
/** Обработчик потери фокуса */
|
|
43
|
+
onBlur?: () => void;
|
|
44
|
+
/** Дополнительные CSS классы */
|
|
45
|
+
className?: string;
|
|
46
|
+
/** Количество строк для textarea */
|
|
47
|
+
rows?: number;
|
|
48
|
+
/** Максимальное количество строк */
|
|
49
|
+
maxRows?: number;
|
|
50
|
+
/** Показывать ли индикатор изменения размера */
|
|
51
|
+
showGrip?: boolean;
|
|
52
|
+
/** Показывать ли счетчик символов */
|
|
53
|
+
showLimit?: boolean;
|
|
54
|
+
/** Минимальная высота компонента */
|
|
55
|
+
minHeight?: number;
|
|
56
|
+
/** Тип изменения размера */
|
|
57
|
+
resize?: 'fill' | 'hug' | 'fixed';
|
|
58
|
+
/** Стили для обертки */
|
|
59
|
+
wrapperProps?: React.HTMLAttributes<HTMLDivElement>;
|
|
60
|
+
/** Стили для лейбла */
|
|
61
|
+
labelProps?: React.HTMLAttributes<HTMLLabelElement>;
|
|
62
|
+
/** Стили для вспомогательного текста */
|
|
63
|
+
helperProps?: React.HTMLAttributes<HTMLDivElement>;
|
|
64
|
+
/** Дополнительные пропсы для элемента textarea */
|
|
65
|
+
textareaProps?: Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'value' | 'onChange' | 'placeholder' | 'maxLength' | 'minLength' | 'autoFocus' | 'rows' | 'disabled'>;
|
|
66
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Константы для размеров TextArea
|
|
3
|
+
*/
|
|
4
|
+
export declare const SIZES: {
|
|
5
|
+
readonly SMALL: "small";
|
|
6
|
+
readonly MEDIUM: "medium";
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Константы для позиций
|
|
10
|
+
*/
|
|
11
|
+
export declare const POSITIONS: {
|
|
12
|
+
readonly SMALL: "12px";
|
|
13
|
+
readonly MEDIUM: "16px";
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Константы для размеров иконок
|
|
17
|
+
*/
|
|
18
|
+
export declare const ICON_SIZES: {
|
|
19
|
+
readonly SMALL: "xs";
|
|
20
|
+
readonly MEDIUM: "sm";
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Константы для resize режимов
|
|
24
|
+
*/
|
|
25
|
+
export declare const RESIZE_MODES: {
|
|
26
|
+
readonly NONE: "none";
|
|
27
|
+
readonly HUG: "hug";
|
|
28
|
+
readonly FILL: "fill";
|
|
29
|
+
readonly FIXED: "fixed";
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Константы для высот wrapper
|
|
33
|
+
*/
|
|
34
|
+
export declare const WRAPPER_HEIGHTS: {
|
|
35
|
+
readonly SMALL: "112px";
|
|
36
|
+
readonly MEDIUM: "56px";
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Константы для высот textarea
|
|
40
|
+
*/
|
|
41
|
+
export declare const TEXTAREA_HEIGHTS: {
|
|
42
|
+
readonly SMALL: "48px";
|
|
43
|
+
readonly MEDIUM: "22px";
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Константы для padding
|
|
47
|
+
*/
|
|
48
|
+
export declare const PADDING: {
|
|
49
|
+
readonly SMALL: "12px 12px 12px 12px";
|
|
50
|
+
readonly MEDIUM: "16px 16px 16px 16px";
|
|
51
|
+
readonly MEDIUM_WITH_PREFIX: "12px 16px 12px 16px";
|
|
52
|
+
readonly MEDIUM_FLOATING_LABEL: "8px 16px 8px 16px";
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Константы для minHeight значений
|
|
56
|
+
*/
|
|
57
|
+
export declare const MIN_HEIGHTS: {
|
|
58
|
+
readonly SMALL: 48;
|
|
59
|
+
readonly MEDIUM: 56;
|
|
60
|
+
readonly LARGE: 112;
|
|
61
|
+
};
|
|
62
|
+
export type TextAreaSize = (typeof SIZES)[keyof typeof SIZES];
|
|
63
|
+
export type TextAreaPosition = (typeof POSITIONS)[keyof typeof POSITIONS];
|
|
64
|
+
export type TextAreaIconSize = (typeof ICON_SIZES)[keyof typeof ICON_SIZES];
|
|
65
|
+
export type TextAreaResizeMode = (typeof RESIZE_MODES)[keyof typeof RESIZE_MODES];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { TextAreaSize, TextAreaResizeMode } from './constants';
|
|
2
|
+
/**
|
|
3
|
+
* Интерфейс для стилей размеров TextArea
|
|
4
|
+
*/
|
|
5
|
+
export interface TextAreaSizeStyles {
|
|
6
|
+
wrapperStyles: React.CSSProperties;
|
|
7
|
+
floatingLabelStyles: React.CSSProperties;
|
|
8
|
+
suffixStyles: React.CSSProperties;
|
|
9
|
+
textareaStyles: React.CSSProperties;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Получает высоту wrapper в зависимости от размера и minHeight
|
|
13
|
+
*/
|
|
14
|
+
export declare const getWrapperHeight: (size: TextAreaSize, minHeight?: number) => string;
|
|
15
|
+
/**
|
|
16
|
+
* Получает высоту textarea в зависимости от размера и minHeight
|
|
17
|
+
*/
|
|
18
|
+
export declare const getTextareaHeight: (size: TextAreaSize, minHeight?: number) => string;
|
|
19
|
+
/**
|
|
20
|
+
* Получает padding в зависимости от размера, minHeight и состояния плавающего лейбла
|
|
21
|
+
*/
|
|
22
|
+
export declare const getPadding: (size: TextAreaSize, minHeight?: number, shouldShowFloatingLabel?: boolean) => string;
|
|
23
|
+
/**
|
|
24
|
+
* Получает размер для InputBase в зависимости от размера TextArea и minHeight
|
|
25
|
+
*/
|
|
26
|
+
export declare const getInputBaseSize: (size: TextAreaSize, minHeight?: number) => "small" | "medium";
|
|
27
|
+
/**
|
|
28
|
+
* Получает размер иконки в зависимости от размера TextArea
|
|
29
|
+
*/
|
|
30
|
+
export declare const getIconSize: (size: TextAreaSize) => "xs" | "sm";
|
|
31
|
+
/**
|
|
32
|
+
* Получает позицию суффикса в зависимости от размера
|
|
33
|
+
*/
|
|
34
|
+
export declare const getSuffixPosition: (size: TextAreaSize) => string;
|
|
35
|
+
/**
|
|
36
|
+
* Основная функция для получения стилей размеров TextArea
|
|
37
|
+
*/
|
|
38
|
+
export declare const getSizeStyles: (size: TextAreaSize, minHeight?: number, shouldShowFloatingLabel?: boolean, resize?: TextAreaResizeMode) => TextAreaSizeStyles;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TextInputProps } from './TextInput.type';
|
|
2
|
+
/**
|
|
3
|
+
* Компонент текстового поля ввода
|
|
4
|
+
* Построен на основе InputBase с дополнительной логикой для текстового ввода
|
|
5
|
+
*/
|
|
6
|
+
export declare const TextInput: import('react').ForwardRefExoticComponent<TextInputProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Размеры для компонента TextInput
|
|
4
|
+
*/
|
|
5
|
+
export type TextInputSize = 'small' | 'medium' | 'large';
|
|
6
|
+
/**
|
|
7
|
+
* Пропсы для компонента TextInput
|
|
8
|
+
*/
|
|
9
|
+
export interface TextInputProps {
|
|
10
|
+
/** Значение поля */
|
|
11
|
+
value?: string | null;
|
|
12
|
+
/** Обработчик изменения значения */
|
|
13
|
+
onChange?: (value: string | null) => void;
|
|
14
|
+
/** Плейсхолдер для поля */
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
/** Тип элемента input */
|
|
17
|
+
type?: InputHTMLAttributes<HTMLInputElement>['type'];
|
|
18
|
+
/** Максимальная длина */
|
|
19
|
+
maxLength?: number;
|
|
20
|
+
/** Минимальная длина */
|
|
21
|
+
minLength?: number;
|
|
22
|
+
/** Показывать ли метку (по умолчанию: true) */
|
|
23
|
+
showLabel?: boolean;
|
|
24
|
+
/** Автозаполнение */
|
|
25
|
+
autoComplete?: string;
|
|
26
|
+
/** Автофокус */
|
|
27
|
+
autoFocus?: boolean;
|
|
28
|
+
/** Размер компонента */
|
|
29
|
+
size?: TextInputSize;
|
|
30
|
+
/** Состояние ошибки */
|
|
31
|
+
error?: boolean;
|
|
32
|
+
/** Отключенное состояние */
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
/** Состояние загрузки */
|
|
35
|
+
loading?: boolean;
|
|
36
|
+
/** Вспомогательный текст под полем */
|
|
37
|
+
helper?: string;
|
|
38
|
+
/** Префикс (иконка слева) */
|
|
39
|
+
prefix?: ReactNode;
|
|
40
|
+
/** Суффикс (иконка справа) */
|
|
41
|
+
suffix?: ReactNode;
|
|
42
|
+
/** Показывать ли кнопку очистки */
|
|
43
|
+
clearable?: boolean;
|
|
44
|
+
/** ID компонента */
|
|
45
|
+
id?: string;
|
|
46
|
+
/** Обработчик фокуса */
|
|
47
|
+
onFocus?: () => void;
|
|
48
|
+
/** Обработчик потери фокуса */
|
|
49
|
+
onBlur?: () => void;
|
|
50
|
+
/** Дополнительные CSS классы */
|
|
51
|
+
className?: string;
|
|
52
|
+
/** Включить обрезку текста с многоточием */
|
|
53
|
+
truncate?: boolean;
|
|
54
|
+
/** Подсказка внутри поля ввода (максимум 30 символов) */
|
|
55
|
+
hint?: string;
|
|
56
|
+
/** Показывать ли подсказку (по умолчанию: false) */
|
|
57
|
+
showHint?: boolean;
|
|
58
|
+
/** Показывать подсказку когда значение пустое (по умолчанию: false) */
|
|
59
|
+
showHintOnEmpty?: boolean;
|
|
60
|
+
/** Стили для обертки */
|
|
61
|
+
wrapperProps?: React.HTMLAttributes<HTMLDivElement>;
|
|
62
|
+
/** Стили для метки */
|
|
63
|
+
labelProps?: React.HTMLAttributes<HTMLLabelElement>;
|
|
64
|
+
/** Стили для вспомогательного текста */
|
|
65
|
+
helperProps?: React.HTMLAttributes<HTMLDivElement>;
|
|
66
|
+
/** Стили для префикса */
|
|
67
|
+
prefixStyles?: React.CSSProperties;
|
|
68
|
+
/** Стили для суффикса */
|
|
69
|
+
suffixStyles?: React.CSSProperties;
|
|
70
|
+
/** Дополнительные пропсы для элемента input */
|
|
71
|
+
inputProps?: Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'placeholder' | 'type' | 'maxLength' | 'minLength' | 'autoComplete' | 'autoFocus' | 'size'>;
|
|
72
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { TextInputSize } from './constants';
|
|
2
|
+
/**
|
|
3
|
+
* Интерфейс для стилей размеров
|
|
4
|
+
*/
|
|
5
|
+
export interface SizeStyles {
|
|
6
|
+
wrapperStyles: React.CSSProperties;
|
|
7
|
+
floatingLabelStyles: React.CSSProperties;
|
|
8
|
+
prefixStyles: React.CSSProperties;
|
|
9
|
+
suffixStyles: React.CSSProperties;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Получает отступы в зависимости от размера и состояния
|
|
13
|
+
*/
|
|
14
|
+
export declare const getPadding: (size: TextInputSize, showFloatingLabel: boolean, hasValue: boolean, hasPrefix: boolean) => string;
|
|
15
|
+
/**
|
|
16
|
+
* Получает высоту в зависимости от размера
|
|
17
|
+
*/
|
|
18
|
+
export declare const getHeight: (size: TextInputSize) => string;
|
|
19
|
+
/**
|
|
20
|
+
* Получает отступы префикса и суффикса
|
|
21
|
+
*/
|
|
22
|
+
export declare const getPrefixSuffixSpacing: (size: TextInputSize) => number;
|
|
23
|
+
/**
|
|
24
|
+
* Получает стили для большого размера
|
|
25
|
+
*/
|
|
26
|
+
export declare const getLargeSizeStyles: (height: string, padding: string, spacing: number) => SizeStyles;
|
|
27
|
+
/**
|
|
28
|
+
* Получает стили для среднего размера
|
|
29
|
+
*/
|
|
30
|
+
export declare const getMediumSizeStyles: (height: string, padding: string, spacing: number) => SizeStyles;
|
|
31
|
+
/**
|
|
32
|
+
* Получает стили для малого размера
|
|
33
|
+
*/
|
|
34
|
+
export declare const getSmallSizeStyles: (height: string, padding: string, spacing: number) => SizeStyles;
|
|
35
|
+
/**
|
|
36
|
+
* Основная функция для получения стилей размеров
|
|
37
|
+
*/
|
|
38
|
+
export declare const getSizeStyles: (size: TextInputSize, showFloatingLabel: boolean, hasValue: boolean, hasPrefix: boolean) => SizeStyles;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TypographyTitleProps, TypographyTextProps } from './Typography.type';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Object containing typography components.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* import { Typography } from './Typography';
|
|
9
|
+
*
|
|
10
|
+
* <Typography.Title size={1}>Heading</Typography.Title>
|
|
11
|
+
* <Typography.Subtitle size={2}>Subheading</Typography.Subtitle>
|
|
12
|
+
* <Typography.Label size={3}>Label</Typography.Label>
|
|
13
|
+
* <Typography.Paragraph size={4}>Paragraph</Typography.Paragraph>
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare const Typography: {
|
|
17
|
+
Title: React.ForwardRefExoticComponent<TypographyTitleProps & React.RefAttributes<HTMLHeadingElement | null>>;
|
|
18
|
+
Subtitle: React.ForwardRefExoticComponent<TypographyTitleProps & React.RefAttributes<HTMLHeadingElement | null>>;
|
|
19
|
+
Label: React.ForwardRefExoticComponent<TypographyTextProps & React.RefAttributes<HTMLSpanElement | HTMLDivElement | HTMLLabelElement | HTMLParagraphElement | null>>;
|
|
20
|
+
Paragraph: React.ForwardRefExoticComponent<TypographyTextProps & React.RefAttributes<HTMLSpanElement | HTMLDivElement | HTMLLabelElement | HTMLParagraphElement | null>>;
|
|
21
|
+
};
|