skillgrid 0.0.42-dev-43812.1262745 → 0.0.43
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.type.d.ts +11 -3
- package/dist/components/Button/lib/get-safe-rel.d.ts +11 -0
- package/dist/components/Button/lib/get-safe-rel.test.d.ts +1 -0
- package/dist/components/Drop/Drop.d.ts +6 -0
- package/dist/components/Drop/Drop.type.d.ts +151 -0
- package/dist/components/Drop/constants.d.ts +12 -0
- package/dist/components/Drop/index.d.ts +1 -0
- package/dist/components/Icon/Icon.d.ts +12 -0
- package/dist/components/Icon/Icon.type.d.ts +156 -0
- package/dist/components/Icon/IconCategories.d.ts +429 -0
- package/dist/components/Icon/IconWithCategories.d.ts +42 -0
- package/dist/components/Icon/index.d.ts +3 -0
- package/dist/components/Icon/useIcon.d.ts +61 -0
- package/dist/components/Loader/Loader.type.d.ts +1 -1
- package/dist/components/StoryStyles.d.ts +255 -0
- package/dist/index.cjs.js +11 -11
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +4010 -3156
- package/package.json +6 -2
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
export type LinkSize = 'l' | 'm' | 's';
|
|
2
2
|
export type ButtonSize = 'l' | 'm' | 's' | 'xs';
|
|
3
|
+
/**
|
|
4
|
+
* Button style types - all available styles including gray
|
|
5
|
+
*/
|
|
6
|
+
export type ButtonStyle = 'neutral' | 'accent' | 'positive' | 'negative' | 'contrast' | 'gray' | 'warning' | 'dreamy' | 'special' | 'lovely' | 'vivid' | 'blue';
|
|
7
|
+
/**
|
|
8
|
+
* Button style types without gray variant
|
|
9
|
+
*/
|
|
10
|
+
export type ButtonStyleWithoutGray = Exclude<ButtonStyle, 'gray'>;
|
|
3
11
|
/**
|
|
4
12
|
* Base properties common to all button and link variants
|
|
5
13
|
*/
|
|
@@ -90,7 +98,7 @@ type CommonProps = (Omit<ButtonBaseProps, 'mode'> & {
|
|
|
90
98
|
* Button style type (gray is not available for this variant)
|
|
91
99
|
* @default 'neutral'
|
|
92
100
|
*/
|
|
93
|
-
buttonStyle?:
|
|
101
|
+
buttonStyle?: ButtonStyleWithoutGray;
|
|
94
102
|
/**
|
|
95
103
|
* Button variant - supports both primary and secondary modes
|
|
96
104
|
* @default 'primary'
|
|
@@ -133,7 +141,7 @@ type CommonProps = (Omit<ButtonBaseProps, 'mode'> & {
|
|
|
133
141
|
* When 'gray' is used, mode must be 'primary' only
|
|
134
142
|
* @default 'neutral'
|
|
135
143
|
*/
|
|
136
|
-
buttonStyle?:
|
|
144
|
+
buttonStyle?: ButtonStyle;
|
|
137
145
|
/**
|
|
138
146
|
* Button variant - when buttonStyle includes 'gray', only 'primary' is allowed
|
|
139
147
|
* For other buttonStyle values, both 'primary' and 'secondary' are allowed
|
|
@@ -176,7 +184,7 @@ type CommonProps = (Omit<ButtonBaseProps, 'mode'> & {
|
|
|
176
184
|
* Button style type (gray is not available for secondary/tertiary)
|
|
177
185
|
* @default 'neutral'
|
|
178
186
|
*/
|
|
179
|
-
buttonStyle?:
|
|
187
|
+
buttonStyle?: ButtonStyleWithoutGray;
|
|
180
188
|
/**
|
|
181
189
|
* Button variant
|
|
182
190
|
* @default 'primary'
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HTMLAttributeAnchorTarget } from 'react';
|
|
2
|
+
type GetSafeRelParams = {
|
|
3
|
+
rel?: string;
|
|
4
|
+
target?: HTMLAttributeAnchorTarget;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Гарантирует, что ссылки, открывающиеся в новой вкладке, содержат rel-атрибуты,
|
|
8
|
+
* блокирующие доступ к объекту `window.opener`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const getSafeRel: ({ rel, target }: GetSafeRelParams) => string | undefined;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { Placement } from '@floating-ui/react';
|
|
2
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
3
|
+
export type PositionDrop = Exclude<Placement, 'top' | 'bottom' | 'left' | 'right'>;
|
|
4
|
+
export type DividerBehavior = 'auto' | 'always' | 'never';
|
|
5
|
+
export type PaddingToken = 'none' | 'sm' | 'md' | 'lg' | 'xl';
|
|
6
|
+
export type ButtonsContainerPadding = {
|
|
7
|
+
padding: PaddingToken;
|
|
8
|
+
paddingType: 'all' | 'block' | 'inline';
|
|
9
|
+
};
|
|
10
|
+
export interface DropCommonProps {
|
|
11
|
+
/**
|
|
12
|
+
* Элемент, по клику на который открывается дроп
|
|
13
|
+
*/
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Флаг, указывающий, открыт ли дроп
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
open?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Функция для управления состоянием видимости дропа
|
|
22
|
+
*/
|
|
23
|
+
onOpenChange: (open: boolean) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Контент дропа
|
|
26
|
+
*/
|
|
27
|
+
content: ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* Позиция открытия дропа относительно toggleа
|
|
30
|
+
* @default 'left-start'
|
|
31
|
+
*/
|
|
32
|
+
position?: PositionDrop;
|
|
33
|
+
/**
|
|
34
|
+
* Контент футера
|
|
35
|
+
*/
|
|
36
|
+
footerContent?: ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* Поведение разделителя
|
|
39
|
+
* * auto - автоматическое поведение (скрывается при прокрутке контента до конца)
|
|
40
|
+
* * always - всегда показывать разделитель
|
|
41
|
+
* * never - никогда не показывать разделитель
|
|
42
|
+
* @default 'auto'
|
|
43
|
+
*/
|
|
44
|
+
dividerBehavior?: DividerBehavior;
|
|
45
|
+
/**
|
|
46
|
+
* Закрывать дроп при клике вне его области
|
|
47
|
+
* @default true
|
|
48
|
+
*/
|
|
49
|
+
closeOnOutsideClick?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Закрывать дроп при нажатии клавиши ESC
|
|
52
|
+
* @default true
|
|
53
|
+
*/
|
|
54
|
+
closeOnEscape?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Режим открытия дропа
|
|
57
|
+
* @default 'click'
|
|
58
|
+
*/
|
|
59
|
+
toggleMode?: 'click' | 'hover';
|
|
60
|
+
/**
|
|
61
|
+
* Отступы контента дропа
|
|
62
|
+
* * xl - 24px
|
|
63
|
+
* * lg - 16px
|
|
64
|
+
* * md - 12px
|
|
65
|
+
* * sm - 8px
|
|
66
|
+
* @default xl
|
|
67
|
+
*/
|
|
68
|
+
padding?: PaddingToken;
|
|
69
|
+
/**
|
|
70
|
+
* Отступы футера с кнопками
|
|
71
|
+
* @default: { padding: 24, paddingType: 'all' }
|
|
72
|
+
*/
|
|
73
|
+
footerPadding?: ButtonsContainerPadding;
|
|
74
|
+
/**
|
|
75
|
+
* Дополнительные классы для:
|
|
76
|
+
* @wrapper для обертки
|
|
77
|
+
* @toggle для контейнера тоггла
|
|
78
|
+
* @drop для контейнера контента
|
|
79
|
+
* @content для контейнера контента
|
|
80
|
+
* @footer для контейнера футера
|
|
81
|
+
*/
|
|
82
|
+
classNames?: {
|
|
83
|
+
wrapper?: string;
|
|
84
|
+
toggle?: string;
|
|
85
|
+
drop?: string;
|
|
86
|
+
content?: string;
|
|
87
|
+
footer?: string;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Дополнительные стили для:
|
|
91
|
+
* @wrapper для обертки
|
|
92
|
+
* @toggle для контейнера тоггла
|
|
93
|
+
* @drop для контейнера контента
|
|
94
|
+
* @content для контейнера контента
|
|
95
|
+
* @footer для контейнера футера
|
|
96
|
+
*/
|
|
97
|
+
styles?: {
|
|
98
|
+
wrapper?: CSSProperties;
|
|
99
|
+
toggle?: CSSProperties;
|
|
100
|
+
drop?: CSSProperties;
|
|
101
|
+
content?: CSSProperties;
|
|
102
|
+
footer?: CSSProperties;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
export interface ContentCommonProps {
|
|
106
|
+
/**
|
|
107
|
+
* Дочерние элементы контента дропа
|
|
108
|
+
*/
|
|
109
|
+
children: ReactNode;
|
|
110
|
+
/**
|
|
111
|
+
* Размер внутренних отступов контента (в пикселях)
|
|
112
|
+
*/
|
|
113
|
+
padding: PaddingToken;
|
|
114
|
+
/**
|
|
115
|
+
* Флаг, указывающий наличие футера с кнопками
|
|
116
|
+
* Влияет на применяемые стили отступов
|
|
117
|
+
*/
|
|
118
|
+
hasFooter: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Дополнительный CSS-класс для контейнера контента
|
|
121
|
+
*/
|
|
122
|
+
className?: string;
|
|
123
|
+
/**
|
|
124
|
+
* Дополнительные inline-стили для контейнера контента
|
|
125
|
+
*/
|
|
126
|
+
style?: CSSProperties;
|
|
127
|
+
/**
|
|
128
|
+
* Поведение разделителя
|
|
129
|
+
* @default 'auto'
|
|
130
|
+
*/
|
|
131
|
+
dividerBehavior: DividerBehavior;
|
|
132
|
+
}
|
|
133
|
+
export interface FooterCommonProps {
|
|
134
|
+
/**
|
|
135
|
+
* Контент футера
|
|
136
|
+
*/
|
|
137
|
+
children?: ReactNode;
|
|
138
|
+
/**
|
|
139
|
+
* Настройки отступов футера
|
|
140
|
+
* @default: { padding: 'xl', paddingType: 'all' }
|
|
141
|
+
*/
|
|
142
|
+
footerPadding: ButtonsContainerPadding;
|
|
143
|
+
/**
|
|
144
|
+
* Дополнительный CSS-класс для контейнера футера
|
|
145
|
+
*/
|
|
146
|
+
className?: string;
|
|
147
|
+
/**
|
|
148
|
+
* Дополнительные inline-стили для контейнера футера
|
|
149
|
+
*/
|
|
150
|
+
style?: CSSProperties;
|
|
151
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Дефолтная высота дропа в пикселях */
|
|
2
|
+
export declare const DROP_HEIGHT_DEFAULT = 460;
|
|
3
|
+
/** Отступ между toggle-ом и выпадающим меню (drop) в пикселях */
|
|
4
|
+
export declare const DROP_TOGGLE_MARGIN = 8;
|
|
5
|
+
/** Минимальный отступ между drop и границами viewport (окна браузера) в пикселях. */
|
|
6
|
+
export declare const MIN_DROP_VIEWPORT_GAP = 24;
|
|
7
|
+
/** Допустимая погрешность в пикселях при определении достижения конца скролла
|
|
8
|
+
* Необходима из-за особенностей рендеринга браузеров и дробных значений
|
|
9
|
+
*/
|
|
10
|
+
export declare const SCROLL_BOTTOM_TOLERANCE_PX = 1;
|
|
11
|
+
export declare const SEMANTIC_ANIMATION_EASE_IN_OUT_200 = "200ms ease-in-out";
|
|
12
|
+
export declare const SEMANTIC_ANIMATION_EASE_IN_OUT_100 = "100ms ease-in-out";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Drop } from './Drop';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { IconProps } from './Icon.type';
|
|
3
|
+
/**
|
|
4
|
+
* Компонент Icon для отображения SVG иконок из assets
|
|
5
|
+
* Поддерживает только React элементы (SVG), не поддерживает emoji и строки
|
|
6
|
+
*/
|
|
7
|
+
type IconComponent = {
|
|
8
|
+
<E extends React.ElementType = 'button'>(props: IconProps<E>): React.ReactElement | null;
|
|
9
|
+
displayName?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const Icon: IconComponent;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
export type IconModeBase = 'primary' | 'secondary';
|
|
2
|
+
export type IconMode = IconModeBase | 'tertiary';
|
|
3
|
+
export type IconStyleNonNeutral = 'accent' | 'positive' | 'negative' | 'warning' | 'special' | 'dreamy' | 'lovely' | 'vivid' | 'constant' | 'inverse' | 'custom' | 'none';
|
|
4
|
+
export type IconStyle = 'neutral' | IconStyleNonNeutral;
|
|
5
|
+
export type BorderStyle = 'neutral' | 'phantom' | 'overlay' | 'accent' | 'positive' | 'negative' | 'warning' | 'special' | 'dreamy' | 'lovely' | 'vivid';
|
|
6
|
+
export type BackgroundStyle = 'primary' | 'secondary' | 'tertiary' | 'transparent' | 'overlay' | 'constant' | 'inverse' | 'constant-secondary' | 'inverse-secondary' | 'positive' | 'warning' | 'negative' | 'accent' | 'positive-secondary' | 'warning-secondary' | 'negative-secondary' | 'accent-secondary' | 'special' | 'dreamy' | 'lovely' | 'vivid' | 'special-secondary' | 'dreamy-secondary' | 'lovely-secondary' | 'vivid-secondary';
|
|
7
|
+
export type IconSize = number;
|
|
8
|
+
export type ShadowMode = false | 'permanent' | 'increases-when-pressed';
|
|
9
|
+
export type BadgeSize = 'extra-small' | 'small';
|
|
10
|
+
export type BadgeSizeNumeric = 8 | 16 | 20;
|
|
11
|
+
export interface BadgeConfig {
|
|
12
|
+
show: boolean;
|
|
13
|
+
size?: BadgeSize;
|
|
14
|
+
value?: number | string;
|
|
15
|
+
}
|
|
16
|
+
type AsProp<E extends React.ElementType> = {
|
|
17
|
+
/**
|
|
18
|
+
* Элемент для рендера
|
|
19
|
+
* @default 'button'
|
|
20
|
+
*/
|
|
21
|
+
as?: E;
|
|
22
|
+
};
|
|
23
|
+
type PropsToOmit<E extends React.ElementType, P> = keyof (AsProp<E> & P);
|
|
24
|
+
type PolymorphicComponentProps<E extends React.ElementType, Props = object> = Props & AsProp<E> & Omit<React.ComponentPropsWithoutRef<E>, PropsToOmit<E, Props>>;
|
|
25
|
+
type PolymorphicRef<E extends React.ElementType> = React.ComponentPropsWithRef<E>['ref'];
|
|
26
|
+
export type PolymorphicComponentPropsWithRef<E extends React.ElementType, Props = object> = PolymorphicComponentProps<E, Props> & {
|
|
27
|
+
ref?: PolymorphicRef<E>;
|
|
28
|
+
};
|
|
29
|
+
interface BaseIconProps {
|
|
30
|
+
/**
|
|
31
|
+
* Иконка (только React элементы - SVG)
|
|
32
|
+
* Используйте Icon.Category.Name компоненты для доступа к иконкам из assets
|
|
33
|
+
*/
|
|
34
|
+
icon?: React.ReactElement;
|
|
35
|
+
/**
|
|
36
|
+
* Размер иконки в пикселях
|
|
37
|
+
* @default 24
|
|
38
|
+
*/
|
|
39
|
+
iconSize?: IconSize;
|
|
40
|
+
/**
|
|
41
|
+
* Кастомный цвет для режима 'custom'
|
|
42
|
+
*/
|
|
43
|
+
customColor?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Стиль иконки при hover
|
|
46
|
+
* Позволяет задать любой цвет из набора для состояния hover
|
|
47
|
+
*/
|
|
48
|
+
hoverStyle?: IconStyle;
|
|
49
|
+
/**
|
|
50
|
+
* Кастомный цвет для hover при hoverStyle='custom'
|
|
51
|
+
*/
|
|
52
|
+
hoverCustomColor?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Стиль иконки при pressed
|
|
55
|
+
* Позволяет задать любой цвет из набора для состояния pressed
|
|
56
|
+
*/
|
|
57
|
+
pressedStyle?: IconStyle;
|
|
58
|
+
/**
|
|
59
|
+
* Кастомный цвет для pressed при pressedStyle='custom'
|
|
60
|
+
*/
|
|
61
|
+
pressedCustomColor?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Внутренние отступы
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
padding?: false | number;
|
|
67
|
+
/**
|
|
68
|
+
* Фон иконки
|
|
69
|
+
* @default false
|
|
70
|
+
*/
|
|
71
|
+
background?: false | BackgroundStyle;
|
|
72
|
+
/**
|
|
73
|
+
* Тень
|
|
74
|
+
* @default false
|
|
75
|
+
*/
|
|
76
|
+
shadow?: ShadowMode;
|
|
77
|
+
/**
|
|
78
|
+
* Показывать рамку
|
|
79
|
+
* @default false
|
|
80
|
+
*/
|
|
81
|
+
showBorder?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Стиль рамки
|
|
84
|
+
* @default 'neutral'
|
|
85
|
+
*/
|
|
86
|
+
borderStyle?: BorderStyle;
|
|
87
|
+
/**
|
|
88
|
+
* Радиус скругления углов
|
|
89
|
+
*/
|
|
90
|
+
borderRadius?: number | '50%';
|
|
91
|
+
/**
|
|
92
|
+
* Конфигурация бейджа
|
|
93
|
+
*/
|
|
94
|
+
badge?: BadgeConfig;
|
|
95
|
+
/**
|
|
96
|
+
* Состояние checked (для переключаемых иконок)
|
|
97
|
+
* @default false
|
|
98
|
+
*/
|
|
99
|
+
checked?: false | React.ReactNode;
|
|
100
|
+
/**
|
|
101
|
+
* Состояние disabled
|
|
102
|
+
* @default false
|
|
103
|
+
*/
|
|
104
|
+
disabled?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Состояние loading
|
|
107
|
+
* @default false
|
|
108
|
+
*/
|
|
109
|
+
loading?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Дополнительный CSS класс
|
|
112
|
+
*/
|
|
113
|
+
className?: string;
|
|
114
|
+
/**
|
|
115
|
+
* Inline стили
|
|
116
|
+
*/
|
|
117
|
+
styles?: React.CSSProperties;
|
|
118
|
+
/**
|
|
119
|
+
* Test ID для тестирования
|
|
120
|
+
*/
|
|
121
|
+
'data-testid'?: string;
|
|
122
|
+
/**
|
|
123
|
+
* ARIA label для доступности
|
|
124
|
+
*/
|
|
125
|
+
'aria-label'?: string;
|
|
126
|
+
/**
|
|
127
|
+
* ARIA описание
|
|
128
|
+
*/
|
|
129
|
+
'aria-describedby'?: string;
|
|
130
|
+
}
|
|
131
|
+
interface NeutralIconProps extends BaseIconProps {
|
|
132
|
+
/**
|
|
133
|
+
* Стиль иконки
|
|
134
|
+
* @default 'neutral'
|
|
135
|
+
*/
|
|
136
|
+
style?: 'neutral';
|
|
137
|
+
/**
|
|
138
|
+
* Режим отображения иконки (для neutral доступны primary, secondary и tertiary)
|
|
139
|
+
* @default 'primary'
|
|
140
|
+
*/
|
|
141
|
+
mode?: IconMode;
|
|
142
|
+
}
|
|
143
|
+
interface NonNeutralIconProps extends BaseIconProps {
|
|
144
|
+
/**
|
|
145
|
+
* Стиль иконки
|
|
146
|
+
*/
|
|
147
|
+
style?: IconStyleNonNeutral;
|
|
148
|
+
/**
|
|
149
|
+
* Режим отображения иконки (только primary и secondary)
|
|
150
|
+
* @default 'primary'
|
|
151
|
+
*/
|
|
152
|
+
mode?: IconModeBase;
|
|
153
|
+
}
|
|
154
|
+
type BaseIconPropsUnion = NeutralIconProps | NonNeutralIconProps;
|
|
155
|
+
export type IconProps<E extends React.ElementType = 'div'> = PolymorphicComponentPropsWithRef<E, BaseIconPropsUnion>;
|
|
156
|
+
export {};
|