skillgrid 0.0.25 → 0.0.26
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/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Button/Button.type.d.ts +121 -43
- package/dist/components/Button/assets/ArrowIcon.d.ts +5 -0
- package/dist/components/Button/assets/ArrowRightIcon.d.ts +5 -0
- package/dist/components/Button/assets/CrossIcon.d.ts +5 -0
- package/dist/components/Button/assets/DownloadIcon.d.ts +5 -0
- package/dist/components/Button/assets/FollowIcon.d.ts +5 -0
- package/dist/components/Button/assets/HeartIcon.d.ts +5 -0
- package/dist/components/Button/assets/LocationIcon.d.ts +5 -0
- package/dist/components/Button/assets/MapMarkerIcon.d.ts +5 -0
- package/dist/components/Button/assets/index.d.ts +9 -0
- package/dist/components/Button/assets/types.d.ts +7 -0
- package/dist/components/Button/lib/get-safe-props.d.ts +8 -0
- package/dist/components/Button/lib/get-safe-props.test.d.ts +1 -0
- package/dist/components/Button/lib/get-typography.d.ts +11 -0
- package/dist/components/Button/lib/get-typography.test.d.ts +1 -0
- package/dist/components/Button/preview/index.d.ts +8 -0
- package/dist/components/Radio/Radio.type.d.ts +14 -2
- package/dist/components/Radio/RadioGroup/RadioGroup.d.ts +2 -1
- package/dist/components/Radio/RadioGroup/RadioGroup.type.d.ts +1 -1
- package/dist/components/Radio/index.d.ts +4 -2
- package/dist/components/Tabs/ScrollWrapper.d.ts +13 -0
- package/dist/components/Tabs/Tabs.d.ts +27 -0
- package/dist/components/Tabs/Tabs.type.d.ts +199 -0
- package/dist/components/Tabs/index.d.ts +2 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useIsMobile.d.ts +1 -0
- package/dist/hooks/useViewPortSize.d.ts +4 -0
- package/dist/hooks/useWindowEvent.d.ts +1 -0
- package/dist/index.cjs.js +11 -11
- package/dist/index.css +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +1905 -1729
- package/dist/types/common.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +2 -1
|
@@ -5,7 +5,7 @@ import { ButtonProps } from './Button.type';
|
|
|
5
5
|
* @component
|
|
6
6
|
* @example
|
|
7
7
|
* ```tsx
|
|
8
|
-
* <Button mode="primary" size="
|
|
8
|
+
* <Button mode="primary" size="m" buttonStyle="accent">Click me</Button>
|
|
9
9
|
* ```
|
|
10
10
|
*/
|
|
11
11
|
export declare const Button: import('react').ForwardRefExoticComponent<(ButtonProps & {
|
|
@@ -1,95 +1,160 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type LinkSizeType = 'l' | 'm' | 's';
|
|
2
|
+
/**
|
|
3
|
+
* Link style variants - buttonStyle and mode combinations
|
|
4
|
+
*/
|
|
5
|
+
type LinkStyleProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Button style type
|
|
8
|
+
* @default 'neutral'
|
|
9
|
+
*/
|
|
10
|
+
buttonStyle?: 'neutral';
|
|
2
11
|
/**
|
|
3
12
|
* Button variant
|
|
4
13
|
* @default 'primary'
|
|
5
14
|
*/
|
|
6
15
|
mode?: 'primary' | 'secondary' | 'tertiary';
|
|
16
|
+
} | {
|
|
7
17
|
/**
|
|
8
|
-
*
|
|
9
|
-
* @default '
|
|
18
|
+
* Button style type
|
|
19
|
+
* @default 'accent'
|
|
10
20
|
*/
|
|
11
|
-
|
|
21
|
+
buttonStyle?: 'accent' | 'positive' | 'negative' | 'contrast' | 'warning';
|
|
12
22
|
/**
|
|
13
|
-
* Button
|
|
14
|
-
* @default '
|
|
23
|
+
* Button variant
|
|
24
|
+
* @default 'primary'
|
|
15
25
|
*/
|
|
16
|
-
|
|
26
|
+
mode?: 'primary' | 'secondary';
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Link icon variants
|
|
30
|
+
* - With icons: size is required
|
|
31
|
+
* - Without icons: size is optional
|
|
32
|
+
*/
|
|
33
|
+
type LinkIconVariant = {
|
|
17
34
|
/**
|
|
18
|
-
*
|
|
19
|
-
* @default
|
|
35
|
+
* Icons render only when size is provided.
|
|
36
|
+
* @default 'm'
|
|
20
37
|
*/
|
|
21
|
-
|
|
38
|
+
size: LinkSizeType;
|
|
39
|
+
iconLeft?: React.ReactNode;
|
|
40
|
+
iconRight?: React.ReactNode;
|
|
41
|
+
} | {
|
|
42
|
+
/** No icons in this variant */
|
|
43
|
+
size?: LinkSizeType;
|
|
44
|
+
iconLeft?: never;
|
|
45
|
+
iconRight?: never;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Base properties common to all link variants
|
|
49
|
+
*/
|
|
50
|
+
type LinkBaseProps = Omit<ButtonBaseProps, 'mode' | 'iconRight'> & LinkStyleProps & {
|
|
51
|
+
/**
|
|
52
|
+
* Display variant
|
|
53
|
+
*/
|
|
54
|
+
displayAs: 'link';
|
|
22
55
|
/**
|
|
23
|
-
*
|
|
56
|
+
* Underline setting (only for displayAs='link')
|
|
24
57
|
* @default false
|
|
25
58
|
*/
|
|
26
|
-
|
|
59
|
+
showUnderline?: boolean;
|
|
60
|
+
postfix?: never;
|
|
61
|
+
subcaption?: never;
|
|
62
|
+
loading?: never;
|
|
63
|
+
stretched?: never;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Base properties common to all button variants
|
|
67
|
+
*/
|
|
68
|
+
type ButtonBaseProps = {
|
|
27
69
|
/**
|
|
28
|
-
*
|
|
70
|
+
* Button variant
|
|
71
|
+
* @default 'primary'
|
|
29
72
|
*/
|
|
30
|
-
|
|
73
|
+
mode?: 'primary' | 'secondary' | 'tertiary';
|
|
31
74
|
/**
|
|
32
|
-
*
|
|
75
|
+
* Disables the button
|
|
76
|
+
* @default false
|
|
33
77
|
*/
|
|
34
|
-
|
|
78
|
+
disabled?: boolean;
|
|
35
79
|
/**
|
|
36
|
-
*
|
|
80
|
+
* Button icon (right side)
|
|
37
81
|
*/
|
|
38
|
-
|
|
82
|
+
iconRight?: React.ReactNode;
|
|
39
83
|
/**
|
|
40
|
-
*
|
|
84
|
+
* Additional CSS class
|
|
41
85
|
*/
|
|
42
|
-
|
|
86
|
+
className?: string;
|
|
43
87
|
/**
|
|
44
|
-
*
|
|
88
|
+
* Tab index
|
|
45
89
|
*/
|
|
46
|
-
|
|
90
|
+
tabIndex?: number;
|
|
47
91
|
/**
|
|
48
|
-
*
|
|
49
|
-
* @default false
|
|
92
|
+
* Children content
|
|
50
93
|
*/
|
|
51
|
-
|
|
94
|
+
children?: React.ReactNode;
|
|
52
95
|
/**
|
|
53
|
-
*
|
|
54
|
-
* @default false
|
|
96
|
+
* Test ID for testing
|
|
55
97
|
*/
|
|
56
|
-
|
|
98
|
+
'data-testid'?: string;
|
|
99
|
+
};
|
|
100
|
+
type CommonProps = (ButtonBaseProps & {
|
|
57
101
|
/**
|
|
58
|
-
* Button
|
|
102
|
+
* Button style type
|
|
103
|
+
* @default 'neutral'
|
|
59
104
|
*/
|
|
60
|
-
|
|
105
|
+
buttonStyle?: 'neutral' | 'accent' | 'positive' | 'negative' | 'contrast' | 'special';
|
|
61
106
|
/**
|
|
62
|
-
* Button
|
|
107
|
+
* Button size
|
|
108
|
+
* @default 'm'
|
|
63
109
|
*/
|
|
64
|
-
|
|
110
|
+
size?: 'l' | 'm' | 's' | 'xs';
|
|
65
111
|
/**
|
|
66
|
-
*
|
|
112
|
+
* Display variant
|
|
113
|
+
* @default 'button'
|
|
67
114
|
*/
|
|
68
|
-
|
|
115
|
+
displayAs?: 'button';
|
|
69
116
|
/**
|
|
70
|
-
*
|
|
117
|
+
* Button postfix (only for displayAs='button')
|
|
71
118
|
*/
|
|
72
|
-
|
|
119
|
+
postfix?: React.ReactNode;
|
|
73
120
|
/**
|
|
74
|
-
*
|
|
121
|
+
* Subcaption text or node (only for displayAs='button')
|
|
75
122
|
*/
|
|
76
|
-
|
|
123
|
+
subcaption?: React.ReactNode;
|
|
77
124
|
/**
|
|
78
|
-
*
|
|
125
|
+
* Shows loading state
|
|
126
|
+
* @default false
|
|
79
127
|
*/
|
|
80
|
-
|
|
81
|
-
|
|
128
|
+
loading?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Stretch button to full width, optionally with justify-content control
|
|
131
|
+
* @default false
|
|
132
|
+
* @example
|
|
133
|
+
* stretched={true} // Simple full width
|
|
134
|
+
* stretched={{ justify: 'space-between' }} // Full width with space-between
|
|
135
|
+
*/
|
|
136
|
+
stretched?: boolean | {
|
|
137
|
+
justify: React.CSSProperties['justifyContent'];
|
|
138
|
+
};
|
|
139
|
+
iconLeft?: never;
|
|
140
|
+
showUnderline?: never;
|
|
141
|
+
}) | (LinkBaseProps & LinkIconVariant);
|
|
82
142
|
/**
|
|
83
143
|
* Props when rendered as a native HTMLButtonElement (default behaviour).
|
|
84
144
|
*/
|
|
85
|
-
export type ButtonAsNativeButtonProps =
|
|
145
|
+
export type ButtonAsNativeButtonProps = CommonProps & React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
86
146
|
as?: 'button';
|
|
87
147
|
};
|
|
88
148
|
/**
|
|
89
149
|
* Props when rendered as an anchor (HTMLAnchorElement).
|
|
90
150
|
*/
|
|
91
|
-
export type ButtonAsAnchorProps =
|
|
151
|
+
export type ButtonAsAnchorProps = CommonProps & React.AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
92
152
|
as: 'a';
|
|
153
|
+
/**
|
|
154
|
+
* External link default. If target/rel are not provided, sets target="_blank"
|
|
155
|
+
* and adds rel="noopener noreferrer". Explicit target/rel take precedence.
|
|
156
|
+
*/
|
|
157
|
+
isExternal?: boolean;
|
|
93
158
|
};
|
|
94
159
|
/**
|
|
95
160
|
* Discriminated union tying `href` and `onClick` types to the `as` prop.
|
|
@@ -103,3 +168,16 @@ export declare const isAsLink: (props: ButtonProps) => props is ButtonAsAnchorPr
|
|
|
103
168
|
* Runtime type guard that checks if the provided props correspond to a native button variant.
|
|
104
169
|
*/
|
|
105
170
|
export declare const isAsButton: (props: ButtonProps) => props is ButtonAsNativeButtonProps;
|
|
171
|
+
/**
|
|
172
|
+
* Runtime type guard that checks if the component should be displayed as a button.
|
|
173
|
+
*/
|
|
174
|
+
export declare const isDisplayAsButton: (props: ButtonProps) => props is Extract<ButtonProps, {
|
|
175
|
+
displayAs?: "button";
|
|
176
|
+
}>;
|
|
177
|
+
/**
|
|
178
|
+
* Runtime type guard that checks if the component should be displayed as a link.
|
|
179
|
+
*/
|
|
180
|
+
export declare const isDisplayAsLink: (props: ButtonProps) => props is Extract<ButtonProps, {
|
|
181
|
+
displayAs: "link";
|
|
182
|
+
}>;
|
|
183
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type { IconProps } from './types';
|
|
2
|
+
export { ArrowRightIcon } from './ArrowRightIcon';
|
|
3
|
+
export { LocationIcon } from './LocationIcon';
|
|
4
|
+
export { MapMarkerIcon } from './MapMarkerIcon';
|
|
5
|
+
export { HeartIcon } from './HeartIcon';
|
|
6
|
+
export { ArrowIcon } from './ArrowIcon';
|
|
7
|
+
export { FollowIcon } from './FollowIcon';
|
|
8
|
+
export { DownloadIcon } from './DownloadIcon';
|
|
9
|
+
export { CrossIcon } from './CrossIcon';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filters out internal Button/Link component props from a props object.
|
|
3
|
+
* This ensures that only valid DOM attributes are forwarded to the underlying HTML element,
|
|
4
|
+
* preventing React warnings about unknown DOM properties.
|
|
5
|
+
* @param {T} props - The props object to filter
|
|
6
|
+
* @returns {Record<string, unknown>} A new object containing only safe props that can be forwarded to DOM elements
|
|
7
|
+
*/
|
|
8
|
+
export declare const getSafeProps: <T extends Record<string, unknown>>(props: T) => Record<string, unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as t } from '../../../styles/typography.module.css';
|
|
2
|
+
import { LinkSizeType } from '../Button.type';
|
|
3
|
+
type TypographyType = keyof typeof t;
|
|
4
|
+
/**
|
|
5
|
+
* Maps a Link size variant to its corresponding typography CSS class name.
|
|
6
|
+
* This ensures consistent typography styling across different link sizes.
|
|
7
|
+
* @param {LinkSizeType} size - The size of the link component ('l', 'm', or 's')
|
|
8
|
+
* @returns {TypographyType} The typography class name corresponding to the given size
|
|
9
|
+
*/
|
|
10
|
+
declare function getTypography(size: LinkSizeType): TypographyType;
|
|
11
|
+
export { getTypography };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
export interface Option<T extends string | number> {
|
|
3
3
|
/**
|
|
4
4
|
* Значение вариант
|
|
@@ -23,6 +23,10 @@ export interface RadioProps<T> {
|
|
|
23
23
|
* Уникальное имя для компонента
|
|
24
24
|
*/
|
|
25
25
|
name: string;
|
|
26
|
+
/**
|
|
27
|
+
* Идентификатор компонента, иначе используется name
|
|
28
|
+
*/
|
|
29
|
+
id?: string;
|
|
26
30
|
/**
|
|
27
31
|
* Выбрано ли значение
|
|
28
32
|
* - true - отмеченный
|
|
@@ -38,7 +42,7 @@ export interface RadioProps<T> {
|
|
|
38
42
|
/**
|
|
39
43
|
* Вложенный компонент справа
|
|
40
44
|
*/
|
|
41
|
-
|
|
45
|
+
children?: ReactNode;
|
|
42
46
|
/**
|
|
43
47
|
* Загрузка (компонент становится неактивным)
|
|
44
48
|
* @default false
|
|
@@ -74,6 +78,14 @@ export interface RadioProps<T> {
|
|
|
74
78
|
* Формат отображения
|
|
75
79
|
*/
|
|
76
80
|
mode?: 'card' | 'default';
|
|
81
|
+
/**
|
|
82
|
+
* Дополнительные CSS стили для контейнера
|
|
83
|
+
*/
|
|
84
|
+
containerStyle?: CSSProperties;
|
|
85
|
+
/**
|
|
86
|
+
* Дополнительные CSS стили для radio
|
|
87
|
+
*/
|
|
88
|
+
style?: CSSProperties;
|
|
77
89
|
/**
|
|
78
90
|
* Обработчик изменения состояния
|
|
79
91
|
* @param value - Выбранное значение
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactElement, RefAttributes } from 'react';
|
|
1
2
|
import { RadioGroupProps } from './RadioGroup.type';
|
|
2
3
|
/**
|
|
3
4
|
* RadioGroup компонент для группировки Radio
|
|
@@ -18,4 +19,4 @@ import { RadioGroupProps } from './RadioGroup.type';
|
|
|
18
19
|
* />
|
|
19
20
|
* ```
|
|
20
21
|
*/
|
|
21
|
-
export declare const RadioGroup:
|
|
22
|
+
export declare const RadioGroup: <T extends string | number>(props: RadioGroupProps<T> & RefAttributes<HTMLInputElement>) => ReactElement | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Option, RadioProps } from '../Radio.type';
|
|
2
|
-
export interface RadioGroupProps<T extends string | number> extends Omit<RadioProps<T>, 'value' | '
|
|
2
|
+
export interface RadioGroupProps<T extends string | number> extends Omit<RadioProps<T>, 'value' | 'children' | 'checked'> {
|
|
3
3
|
/**
|
|
4
4
|
* Список radio кнопок
|
|
5
5
|
*/
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
declare const Radio: (<T>(props: import('./Radio.type').RadioProps<T> & import('react').RefAttributes<HTMLInputElement>) => import('react').ReactElement | null) & {
|
|
2
|
+
Group: <T extends string | number>(props: import('.').RadioGroupProps<T> & import('react').RefAttributes<HTMLInputElement>) => import('react').ReactElement | null;
|
|
3
|
+
};
|
|
2
4
|
export * from './Radio.type';
|
|
3
|
-
export { RadioGroup } from './RadioGroup/RadioGroup';
|
|
4
5
|
export * from './RadioGroup/RadioGroup.type';
|
|
6
|
+
export { Radio };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
interface ScrollWrapperProps {
|
|
3
|
+
/** дочерние элементы внутри скролл-бара */
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/** size - размер компонента (элементов управления скроллом) */
|
|
6
|
+
size: 'sm' | 'md' | 'xs';
|
|
7
|
+
/** включить контролы/маски (обычно на десктопе) */
|
|
8
|
+
withControls?: boolean;
|
|
9
|
+
/** className для внешнего враппера (ячейка сетки) */
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const ScrollWrapper: FC<ScrollWrapperProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { default as React, FC } from 'react';
|
|
2
|
+
import { TabsBarProps, TabPanelProps, TabsContentProps, TabsProviderProps } from './Tabs.type';
|
|
3
|
+
/**
|
|
4
|
+
* Bar - компонент для отображения списка вкладок.
|
|
5
|
+
*
|
|
6
|
+
* Компонент связан с контекстом `TabsProvider` и обновляет
|
|
7
|
+
* активную вкладку при клике на элемент.
|
|
8
|
+
*
|
|
9
|
+
* @param mode - визуальный режим вкладки
|
|
10
|
+
* @param items - список вкладок для отображения
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <Tabs.Provider defaultActiveTab="tab1">
|
|
14
|
+
* <Tabs.Bar mode="primary" items={[
|
|
15
|
+
* { value: "tab1", label: "Tab 1" },
|
|
16
|
+
* { value: "tab2", label: "Tab 2", postfix: "🔥" }
|
|
17
|
+
* ]}/>
|
|
18
|
+
* </Tabs.Provider>
|
|
19
|
+
*/
|
|
20
|
+
declare const Bar: FC<TabsBarProps>;
|
|
21
|
+
export declare const Tabs: {
|
|
22
|
+
Provider: React.FC<TabsProviderProps>;
|
|
23
|
+
Content: React.FC<TabsContentProps>;
|
|
24
|
+
Panel: React.FC<TabPanelProps>;
|
|
25
|
+
Bar: React.FC<TabsBarProps>;
|
|
26
|
+
};
|
|
27
|
+
export default Bar;
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { ReactNode, HTMLAttributes } from 'react';
|
|
2
|
+
import { Nullable } from '../../types/index.ts';
|
|
3
|
+
import { BadgeProps } from '../Badge';
|
|
4
|
+
/**
|
|
5
|
+
* Tabs визуальный режим табов
|
|
6
|
+
* * 'primary' - навигация первого уровня (основные вкладки)
|
|
7
|
+
* * 'secondary' - навигация второго уровня (подвкладки)
|
|
8
|
+
*/
|
|
9
|
+
export type TabsVisualMode = 'primary' | 'secondary';
|
|
10
|
+
/**
|
|
11
|
+
* Размер табов
|
|
12
|
+
* * 'md' - стандартный размер
|
|
13
|
+
* * 'sm' - уменьшенный размер
|
|
14
|
+
* * 'xs' - самый маленький размер
|
|
15
|
+
*
|
|
16
|
+
* @default 'md'
|
|
17
|
+
*/
|
|
18
|
+
export type TabsSize = 'md' | 'sm' | 'xs';
|
|
19
|
+
/**
|
|
20
|
+
* TabsItem - представляет одну вкладку
|
|
21
|
+
*/
|
|
22
|
+
export interface TabsItem {
|
|
23
|
+
/**
|
|
24
|
+
* label - текстовый ярлык вкладки
|
|
25
|
+
*/
|
|
26
|
+
label: string;
|
|
27
|
+
/**
|
|
28
|
+
* value - значение вкладки (используется для сравнения с activeTab)
|
|
29
|
+
*/
|
|
30
|
+
value: string;
|
|
31
|
+
/**
|
|
32
|
+
* isDisabled - флаг, указывающий, что вкладка неактивна и не может быть выбрана
|
|
33
|
+
* если true, вкладка будет отображаться в стиле disabled и не будет реагировать на клики
|
|
34
|
+
*
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
isDisabled?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* showBadge - если true, будет отображаться badge
|
|
40
|
+
*/
|
|
41
|
+
showBadge?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* badgeProps - свойства элемента badge (см. компонент Badge для деталей)
|
|
44
|
+
*/
|
|
45
|
+
badgeProps?: BadgeProps;
|
|
46
|
+
/**
|
|
47
|
+
* prefix - дополнительный ReactNode, например иконка или текст перед label
|
|
48
|
+
*/
|
|
49
|
+
prefix?: Nullable<React.ReactNode>;
|
|
50
|
+
/**
|
|
51
|
+
* prefixWrapperProps - дополнительные пропсы для обертки prefix
|
|
52
|
+
*/
|
|
53
|
+
prefixWrapperProps?: HTMLAttributes<HTMLSpanElement>;
|
|
54
|
+
/**
|
|
55
|
+
* postfix - дополнительный ReactNode, например иконка или текст после label
|
|
56
|
+
*/
|
|
57
|
+
postfix?: Nullable<React.ReactNode>;
|
|
58
|
+
/**
|
|
59
|
+
* postfixWrapperProps - дополнительные пропсы для обертки postfix
|
|
60
|
+
*/
|
|
61
|
+
postfixWrapperProps?: HTMLAttributes<HTMLSpanElement>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* TabsContextType - тип для контекста Tabs
|
|
65
|
+
*/
|
|
66
|
+
export interface TabsContextType {
|
|
67
|
+
/**
|
|
68
|
+
* activeTab - текущее активное значение вкладки
|
|
69
|
+
*/
|
|
70
|
+
activeTab: string | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* setTab - функция для смены активной вкладки по значению
|
|
73
|
+
*/
|
|
74
|
+
setTab: (value: string) => void;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* TabsProviderProps - пропсы для TabsProvider
|
|
78
|
+
*/
|
|
79
|
+
export interface TabsProviderProps {
|
|
80
|
+
/**
|
|
81
|
+
* children - дочерние элементы, обычно Tabs.Bar и Tabs.Content
|
|
82
|
+
*/
|
|
83
|
+
children: ReactNode;
|
|
84
|
+
/**
|
|
85
|
+
* defaultActiveTab - вкладка по умолчанию (неконтролируемый режим)
|
|
86
|
+
*/
|
|
87
|
+
defaultActiveTab?: string;
|
|
88
|
+
/**
|
|
89
|
+
* activeTab - активная вкладка (контролируемый режим)
|
|
90
|
+
*/
|
|
91
|
+
activeTab?: string;
|
|
92
|
+
/**
|
|
93
|
+
* onChange - колбэк при смене активной вкладки
|
|
94
|
+
*/
|
|
95
|
+
onChange?: (value: string) => void;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* TabsBarProps - пропсы для компонента Tabs.Bar
|
|
99
|
+
*/
|
|
100
|
+
export interface TabsBarProps {
|
|
101
|
+
/**
|
|
102
|
+
* mode - визуальный режим вкладок ('primary' | 'secondary')
|
|
103
|
+
*/
|
|
104
|
+
mode: TabsVisualMode;
|
|
105
|
+
/**
|
|
106
|
+
* items - список вкладок, каждый элемент — TabsItem
|
|
107
|
+
*/
|
|
108
|
+
items: Array<TabsItem>;
|
|
109
|
+
/**
|
|
110
|
+
* size - размер вкладок ('md' | 'sm' | 'xs')
|
|
111
|
+
* * 'md' - стандартный размер
|
|
112
|
+
* * 'sm' - уменьшенный размер
|
|
113
|
+
* * 'xs' - самый маленький размер
|
|
114
|
+
*
|
|
115
|
+
* @default 'md'
|
|
116
|
+
*/
|
|
117
|
+
size?: TabsSize;
|
|
118
|
+
/**
|
|
119
|
+
* isAllItemsDisabled - флаг, указывающий, что все элементы неактивны и не могут быть выбраны
|
|
120
|
+
* если true, все элементы будут отображаться в стиле disabled и не будут реагировать на клики
|
|
121
|
+
*
|
|
122
|
+
* @default false
|
|
123
|
+
*/
|
|
124
|
+
isAllItemsDisabled?: boolean;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* TabsItemProps - пропсы для одной вкладки (TabElement)
|
|
128
|
+
*/
|
|
129
|
+
export interface TabsItemProps {
|
|
130
|
+
/**
|
|
131
|
+
* mode - режим отображения по типу навигации
|
|
132
|
+
* * 'primary' - для навигации первого уровня
|
|
133
|
+
* * 'secondary' - для навигации второго уровня
|
|
134
|
+
*/
|
|
135
|
+
mode: TabsVisualMode;
|
|
136
|
+
/**
|
|
137
|
+
* item - данные вкладки (label, value, badge, postfix)
|
|
138
|
+
*/
|
|
139
|
+
item: TabsItem;
|
|
140
|
+
/**
|
|
141
|
+
* isActive - активна ли текущая вкладка
|
|
142
|
+
*/
|
|
143
|
+
isActive: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* onSelectTab - колбэк при клике на вкладку
|
|
146
|
+
* * получает значение выбранной вкладки
|
|
147
|
+
*/
|
|
148
|
+
onSelectTab: (value: string) => void;
|
|
149
|
+
/**
|
|
150
|
+
* showBadge - если true, будет отображаться badge
|
|
151
|
+
*/
|
|
152
|
+
showBadge?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* badgeProps - свойства элемента badge (см. компонент Badge для деталей)
|
|
155
|
+
*/
|
|
156
|
+
badgeProps?: BadgeProps;
|
|
157
|
+
/**
|
|
158
|
+
* size - размер отдельного таба ('md' | 'sm' | 'xs')
|
|
159
|
+
* * 'md' - стандартный размер
|
|
160
|
+
* * 'sm' - уменьшенный размер
|
|
161
|
+
* * 'xs' - самый маленький размер
|
|
162
|
+
*
|
|
163
|
+
* @default 'md'
|
|
164
|
+
*/
|
|
165
|
+
size: TabsSize;
|
|
166
|
+
/**
|
|
167
|
+
* isDisabled - флаг, указывающий, что вкладка неактивна и не может быть выбрана
|
|
168
|
+
* если true, вкладка будет отображаться в стиле disabled и не будет реагировать на клики
|
|
169
|
+
*
|
|
170
|
+
* @default false
|
|
171
|
+
*/
|
|
172
|
+
isDisabled?: boolean;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Пропсы для компонента TabPanel
|
|
176
|
+
* * Наследует стандартные атрибуты div, поэтому можно передавать `className`, `style` и т.д.
|
|
177
|
+
*/
|
|
178
|
+
export interface TabPanelProps extends HTMLAttributes<HTMLDivElement> {
|
|
179
|
+
/**
|
|
180
|
+
* tabValue - идентификатор панели вкладки
|
|
181
|
+
* * Должен совпадать со значением соответствующей вкладки
|
|
182
|
+
*/
|
|
183
|
+
tabValue: string;
|
|
184
|
+
/**
|
|
185
|
+
* children - содержимое панели вкладки
|
|
186
|
+
*/
|
|
187
|
+
children?: ReactNode;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Пропсы для компонента TabsContent
|
|
191
|
+
* * Наследует стандартные атрибуты div, поэтому можно передавать `className`, `style` и т.д.
|
|
192
|
+
*/
|
|
193
|
+
export interface TabsContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
194
|
+
/**
|
|
195
|
+
* children - один или несколько компонентов TabPanel
|
|
196
|
+
* * Будет отображаться только панель, чей `tabValue` совпадает с активной вкладкой
|
|
197
|
+
*/
|
|
198
|
+
children: ReactNode | Array<ReactNode>;
|
|
199
|
+
}
|
package/dist/hooks/index.d.ts
CHANGED