skillgrid 0.0.42-dev-43812.1262429 → 0.0.42

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.
@@ -1,7 +1,6 @@
1
- import { ButtonProps, BackButtonProps, LinkButtonProps } from './Button.type';
1
+ import { ButtonProps, BackButtonProps } from './Button.type';
2
2
  export declare const Button: import('react').ForwardRefExoticComponent<(ButtonProps & {
3
3
  style?: React.CSSProperties;
4
4
  }) & import('react').RefAttributes<HTMLButtonElement | HTMLAnchorElement>> & {
5
5
  Back: import('react').ForwardRefExoticComponent<BackButtonProps & import('react').RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
6
- Link: import('react').ForwardRefExoticComponent<LinkButtonProps & import('react').RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
7
6
  };
@@ -85,24 +85,51 @@ type ButtonBaseProps = BaseProps & {
85
85
  */
86
86
  iconLeft?: React.ReactNode;
87
87
  };
88
+ /**
89
+ * Base properties common to all link variants
90
+ */
91
+ type LinkBaseProps = BaseProps & LinkStyleProps & {
92
+ /**
93
+ * Display variant
94
+ */
95
+ displayAs: 'link';
96
+ /**
97
+ * Underline setting (only for displayAs='link')
98
+ * @default false
99
+ */
100
+ showUnderline?: boolean;
101
+ /**
102
+ * Button icon (right side, only for links)
103
+ */
104
+ iconRight?: React.ReactNode;
105
+ postfix?: never;
106
+ subcaption?: never;
107
+ loading?: never;
108
+ stretched?: never;
109
+ };
88
110
  type CommonProps = (Omit<ButtonBaseProps, 'mode'> & {
89
111
  /**
90
- * Button style type (gray is not available for this variant)
112
+ * Button style type
91
113
  * @default 'neutral'
92
114
  */
93
- buttonStyle?: 'neutral' | 'accent' | 'positive' | 'negative' | 'contrast';
115
+ buttonStyle?: 'neutral' | 'accent' | 'positive' | 'negative' | 'contrast' | 'gray';
94
116
  /**
95
- * Button variant - supports both primary and secondary modes
117
+ * Button variant - primary mode supports all buttonStyle options including gray
96
118
  * @default 'primary'
97
119
  */
98
- mode?: 'primary' | 'secondary';
120
+ mode?: 'primary';
99
121
  /**
100
122
  * Button size
101
123
  * @default 'm'
102
124
  */
103
125
  size?: ButtonSize;
104
126
  /**
105
- * Button postfix
127
+ * Display variant
128
+ * @default 'button'
129
+ */
130
+ displayAs?: 'button';
131
+ /**
132
+ * Button postfix (only for displayAs='button')
106
133
  */
107
134
  postfix?: React.ReactNode;
108
135
  /**
@@ -129,24 +156,27 @@ type CommonProps = (Omit<ButtonBaseProps, 'mode'> & {
129
156
  paddings?: never;
130
157
  } & ButtonSizeAndSubcaption) | (Omit<ButtonBaseProps, 'mode'> & {
131
158
  /**
132
- * Button style type - supports union types including 'gray'
133
- * When 'gray' is used, mode must be 'primary' only
159
+ * Button style type (gray is not available for secondary/tertiary)
134
160
  * @default 'neutral'
135
161
  */
136
- buttonStyle?: 'neutral' | 'accent' | 'positive' | 'negative' | 'contrast' | 'gray';
162
+ buttonStyle?: 'neutral' | 'accent' | 'positive' | 'negative' | 'contrast';
137
163
  /**
138
- * Button variant - when buttonStyle includes 'gray', only 'primary' is allowed
139
- * For other buttonStyle values, both 'primary' and 'secondary' are allowed
164
+ * Button variant
140
165
  * @default 'primary'
141
166
  */
142
- mode?: 'primary' | 'secondary';
167
+ mode?: 'secondary';
143
168
  /**
144
169
  * Button size
145
170
  * @default 'm'
146
171
  */
147
172
  size?: ButtonSize;
148
173
  /**
149
- * Button postfix
174
+ * Display variant
175
+ * @default 'button'
176
+ */
177
+ displayAs?: 'button';
178
+ /**
179
+ * Button postfix (only for displayAs='button')
150
180
  */
151
181
  postfix?: React.ReactNode;
152
182
  /**
@@ -188,7 +218,12 @@ type CommonProps = (Omit<ButtonBaseProps, 'mode'> & {
188
218
  */
189
219
  size?: ButtonSize;
190
220
  /**
191
- * Button postfix
221
+ * Display variant
222
+ * @default 'button'
223
+ */
224
+ displayAs?: 'button';
225
+ /**
226
+ * Button postfix (only for displayAs='button')
192
227
  */
193
228
  postfix?: React.ReactNode;
194
229
  /**
@@ -217,7 +252,7 @@ type CommonProps = (Omit<ButtonBaseProps, 'mode'> & {
217
252
  paddings?: boolean;
218
253
  iconRight?: never;
219
254
  showUnderline?: never;
220
- } & ButtonSizeAndSubcaption);
255
+ } & ButtonSizeAndSubcaption) | (LinkBaseProps & LinkIconVariant);
221
256
  /**
222
257
  * Props when rendered as a native HTMLButtonElement (default behaviour).
223
258
  */
@@ -237,17 +272,28 @@ export type ButtonAsAnchorProps = CommonProps & React.AnchorHTMLAttributes<HTMLA
237
272
  };
238
273
  /**
239
274
  * Discriminated union tying `href` and `onClick` types to the `as` prop.
240
- * Properties unavailable for regular Button (iconRight, showUnderline) are excluded from autocomplete.
241
275
  */
242
- export type ButtonProps = Omit<ButtonAsNativeButtonProps, 'iconRight' | 'showUnderline'> | Omit<ButtonAsAnchorProps, 'iconRight' | 'showUnderline'>;
276
+ export type ButtonProps = ButtonAsNativeButtonProps | ButtonAsAnchorProps;
243
277
  /**
244
278
  * Runtime type guard that checks if the provided props correspond to an anchor variant of the Button.
245
279
  */
246
- export declare const isAsLink: (props: ButtonProps) => props is Omit<ButtonAsAnchorProps, "iconRight" | "showUnderline">;
280
+ export declare const isAsLink: (props: ButtonProps) => props is ButtonAsAnchorProps;
247
281
  /**
248
282
  * Runtime type guard that checks if the provided props correspond to a native button variant.
249
283
  */
250
- export declare const isAsButton: (props: ButtonProps) => props is Omit<ButtonAsNativeButtonProps, "iconRight" | "showUnderline">;
284
+ export declare const isAsButton: (props: ButtonProps) => props is ButtonAsNativeButtonProps;
285
+ /**
286
+ * Runtime type guard that checks if the component should be displayed as a button.
287
+ */
288
+ export declare const isDisplayAsButton: (props: ButtonProps) => props is Extract<ButtonProps, {
289
+ displayAs?: "button";
290
+ }>;
291
+ /**
292
+ * Runtime type guard that checks if the component should be displayed as a link.
293
+ */
294
+ export declare const isDisplayAsLink: (props: ButtonProps) => props is Extract<ButtonProps, {
295
+ displayAs: "link";
296
+ }>;
251
297
  /**
252
298
  * Enforces that subcaption can be provided only when size is 'l'.
253
299
  * - If subcaption is present → size must be 'l'
@@ -260,38 +306,8 @@ type ButtonSizeAndSubcaption = {
260
306
  subcaption: React.ReactNode;
261
307
  size: 'l';
262
308
  };
263
- /**
264
- * Props for Button.Link component - specialized variant for link display.
265
- * Properties unavailable for Button.Link (loading, stretched, postfix, subcaption, paddings) are excluded from autocomplete.
266
- */
267
- export type LinkButtonProps = Omit<BaseProps & LinkStyleProps & LinkIconVariant & {
268
- /**
269
- * Underline setting
270
- * @default false
271
- */
272
- showUnderline?: boolean;
273
- /**
274
- * Render as native button element
275
- */
276
- as?: 'button';
277
- } & React.ButtonHTMLAttributes<HTMLButtonElement>, 'loading' | 'stretched' | 'postfix' | 'subcaption' | 'paddings'> | Omit<BaseProps & LinkStyleProps & LinkIconVariant & {
278
- /**
279
- * Underline setting
280
- * @default false
281
- */
282
- showUnderline?: boolean;
283
- /**
284
- * Render as anchor element
285
- */
286
- as: 'a';
287
- /**
288
- * External link default. If target/rel are not provided, sets target="_blank"
289
- * and adds rel="noopener noreferrer". Explicit target/rel take precedence.
290
- */
291
- isExternal?: boolean;
292
- } & React.AnchorHTMLAttributes<HTMLAnchorElement>, 'loading' | 'stretched' | 'postfix' | 'subcaption' | 'paddings'>;
293
309
  /**
294
310
  * Props for Button.Back component - based on ButtonProps with restricted design props
295
311
  */
296
- export type BackButtonProps = Omit<ButtonAsNativeButtonProps, 'mode' | 'buttonStyle' | 'size' | 'loading' | 'stretched' | 'postfix' | 'subcaption' | 'iconRight' | 'showUnderline'> | Omit<ButtonAsAnchorProps, 'mode' | 'buttonStyle' | 'size' | 'loading' | 'stretched' | 'postfix' | 'subcaption' | 'iconRight' | 'showUnderline'>;
312
+ export type BackButtonProps = Omit<ButtonAsNativeButtonProps, 'mode' | 'buttonStyle' | 'size' | 'displayAs' | 'loading' | 'stretched' | 'postfix' | 'subcaption' | 'iconRight' | 'showUnderline'> | Omit<ButtonAsAnchorProps, 'mode' | 'buttonStyle' | 'size' | 'displayAs' | 'loading' | 'stretched' | 'postfix' | 'subcaption' | 'iconRight' | 'showUnderline'>;
297
313
  export {};
@@ -0,0 +1,6 @@
1
+ import { FC } from 'react';
2
+ import { DropCommonProps } from './Drop.type';
3
+ /**
4
+ * Дроп компонент
5
+ */
6
+ export declare const Drop: FC<DropCommonProps>;
@@ -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';
@@ -12,7 +12,10 @@ export type TooltipContentClassNames = {
12
12
  text?: string;
13
13
  closeButton?: string;
14
14
  };
15
- export type TooltipButtonConfig = ButtonAsNativeButtonProps & {
15
+ type TooltipNativeButton = Extract<ButtonAsNativeButtonProps, {
16
+ displayAs?: 'button';
17
+ }>;
18
+ export type TooltipButtonConfig = TooltipNativeButton & {
16
19
  closeOnClick?: boolean;
17
20
  };
18
21
  export interface TooltipCommonProps {