skillgrid 0.0.25-dev-38682-image.1172030 → 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/Image/Image.type.d.ts +0 -4
- package/dist/components/Loader/Loader.type.d.ts +1 -1
- 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 +1861 -1694
- package/dist/types/common.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +3 -2
|
@@ -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 {};
|
|
@@ -20,10 +20,6 @@ export interface ImageProps extends Omit<React.ImgHTMLAttributes<HTMLImageElemen
|
|
|
20
20
|
* Дополнительный CSS класс
|
|
21
21
|
*/
|
|
22
22
|
className?: string;
|
|
23
|
-
/**
|
|
24
|
-
* Дополнительный CSS класс для контейнера
|
|
25
|
-
*/
|
|
26
|
-
containerClassName?: string;
|
|
27
23
|
/**
|
|
28
24
|
* Test ID для тестирования
|
|
29
25
|
* @default 'image'
|
|
@@ -9,7 +9,7 @@ export interface BaseLoaderProps {
|
|
|
9
9
|
* Вариант цвета лоадера
|
|
10
10
|
* @default 'accent'
|
|
11
11
|
*/
|
|
12
|
-
variant?: 'accent' | 'neutral' | 'positive' | 'negative' | 'contrast' | 'gray' | 'special'
|
|
12
|
+
variant?: 'accent' | 'neutral' | 'positive' | 'negative' | 'contrast' | 'gray' | 'special';
|
|
13
13
|
/**
|
|
14
14
|
* Дополнительный CSS класс
|
|
15
15
|
*/
|
|
@@ -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;
|