skillgrid 0.0.31 → 0.0.35

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.
Files changed (47) hide show
  1. package/dist/components/Alert/Alert.d.ts +9 -0
  2. package/dist/components/Alert/Alert.type.d.ts +25 -0
  3. package/dist/components/Alert/assets/index.d.ts +1 -0
  4. package/dist/components/Alert/assets/react-svg-icons.d.ts +6 -0
  5. package/dist/components/Alert/index.d.ts +2 -0
  6. package/dist/components/Alert/lib/constants.d.ts +7 -0
  7. package/dist/components/Alert/lib/index.d.ts +1 -0
  8. package/dist/components/Button/Button.d.ts +4 -11
  9. package/dist/components/Button/Button.type.d.ts +184 -54
  10. package/dist/components/Button/assets/ArrowLeftIcon.d.ts +6 -0
  11. package/dist/components/Button/assets/CrossIcon.d.ts +2 -2
  12. package/dist/components/Button/assets/index.d.ts +1 -0
  13. package/dist/components/Button/assets/types.d.ts +2 -5
  14. package/dist/components/Button/lib/get-button-typography.d.ts +5 -0
  15. package/dist/components/Button/lib/get-button-typography.test.d.ts +1 -0
  16. package/dist/components/Button/lib/get-loader-variant.d.ts +7 -0
  17. package/dist/components/Button/lib/get-loader-variant.test.d.ts +1 -0
  18. package/dist/components/Button/lib/get-typography.d.ts +3 -3
  19. package/dist/components/Button/preview/index.d.ts +1 -0
  20. package/dist/components/Dialog/Dialog.d.ts +8 -0
  21. package/dist/components/Dialog/Dialog.type.d.ts +29 -0
  22. package/dist/components/Dialog/index.d.ts +2 -0
  23. package/dist/components/Dialog/lib/index.d.ts +1 -0
  24. package/dist/components/Dialog/lib/use-dialog.d.ts +43 -0
  25. package/dist/components/Dialog/lib/use-dialog.test.d.ts +1 -0
  26. package/dist/components/Loader/Loader.d.ts +1 -1
  27. package/dist/components/Modal/Modal.d.ts +7 -0
  28. package/dist/components/Modal/Modal.type.d.ts +34 -0
  29. package/dist/components/Modal/index.d.ts +2 -0
  30. package/dist/components/Placeholder/Placeholder.d.ts +14 -0
  31. package/dist/components/Placeholder/Placeholder.type.d.ts +20 -0
  32. package/dist/components/Placeholder/index.d.ts +2 -0
  33. package/dist/components/Placeholder/lib/get-typography-classes-from-placeholder-size.d.ts +13 -0
  34. package/dist/components/Placeholder/lib/get-typography-classes-from-placeholder-size.test.d.ts +1 -0
  35. package/dist/components/Placeholder/lib/index.d.ts +1 -0
  36. package/dist/components/SegmentedControl/SegmentedControl.type.d.ts +8 -4
  37. package/dist/components/SegmentedControl/index.d.ts +1 -1
  38. package/dist/components/Tooltip/Tooltip.type.d.ts +4 -1
  39. package/dist/components/Tooltip/utils/index.d.ts +1 -0
  40. package/dist/components/Tooltip/utils/merge-tooltip-button-props.d.ts +2 -0
  41. package/dist/components/Tooltip/utils/merge-tooltip-button-props.test.d.ts +1 -0
  42. package/dist/components/Typography/Typography.d.ts +2 -2
  43. package/dist/index.cjs.js +11 -11
  44. package/dist/index.css +1 -1
  45. package/dist/index.d.ts +3 -0
  46. package/dist/index.es.js +2591 -2025
  47. package/package.json +2 -1
@@ -0,0 +1,9 @@
1
+ import { FC } from 'react';
2
+ import { AlertProps } from './Alert.type';
3
+ /**
4
+ * Alert - это модальный диалог, предназначенный для отображения важной информации, предупреждений или запроса действий от пользователя.
5
+ * Он построен на основе компонентов `Dialog` и `Placeholder` и предоставляет несколько вариантов для разных сценариев,
6
+ * включая настраиваемый вариант с аватаром.
7
+ * @returns {JSX.Element} Отрендеренный компонент Alert.
8
+ */
9
+ export declare const Alert: FC<AlertProps>;
@@ -0,0 +1,25 @@
1
+ import { DialogProps } from '../Dialog';
2
+ import { ReactNode } from 'react';
3
+ import { AvatarProps } from '../Avatar';
4
+ export type AlertVariant = 'info' | 'success' | 'warning' | 'error' | 'dialog' | 'avatar';
5
+ export interface AlertProps extends Pick<DialogProps, 'placement' | 'open' | 'onOpenChange' | 'children'> {
6
+ /**
7
+ * Вариант отображения Alert. Определяет иконку и цветовую схему.
8
+ * Вариант `avatar` позволяет отобразить кастомный аватар.
9
+ * @default 'info'
10
+ */
11
+ variant?: AlertVariant;
12
+ /**
13
+ * Свойства для компонента Avatar, когда `variant` равен 'avatar'.
14
+ * Позволяет настраивать аватар, например, устанавливать `src` для изображения или `text`.
15
+ * Эти свойства переопределят настройки аватара по умолчанию.
16
+ * @see AvatarProps
17
+ */
18
+ variantAvatarProps?: Partial<AvatarProps>;
19
+ /** Заголовок Alert. */
20
+ title: ReactNode;
21
+ /** Основной контент/описание Alert. */
22
+ description: ReactNode;
23
+ /** ID для тестирования. */
24
+ 'data-testid'?: string;
25
+ }
@@ -0,0 +1 @@
1
+ export { CheckIcon, AlertIcon, AttentionIcon, InfoIcon, DialogIcon } from './react-svg-icons';
@@ -0,0 +1,6 @@
1
+ declare const InfoIcon: () => import("react/jsx-runtime").JSX.Element;
2
+ declare const DialogIcon: () => import("react/jsx-runtime").JSX.Element;
3
+ declare const CheckIcon: () => import("react/jsx-runtime").JSX.Element;
4
+ declare const AttentionIcon: () => import("react/jsx-runtime").JSX.Element;
5
+ declare const AlertIcon: () => import("react/jsx-runtime").JSX.Element;
6
+ export { AttentionIcon, DialogIcon, CheckIcon, AlertIcon, InfoIcon };
@@ -0,0 +1,2 @@
1
+ export { Alert } from './Alert';
2
+ export type { AlertProps, AlertVariant } from './Alert.type';
@@ -0,0 +1,7 @@
1
+ import { AlertVariant } from '../Alert.type';
2
+ import { AvatarProps } from '../../Avatar';
3
+ import { FC } from 'react';
4
+ export declare const ALERT_ICON_MAP: Record<AlertVariant, {
5
+ icon: FC | null;
6
+ colorScheme: AvatarProps['colorScheme'];
7
+ }>;
@@ -0,0 +1 @@
1
+ export * from './constants';
@@ -1,13 +1,6 @@
1
- import { ButtonProps } from './Button.type';
2
- /**
3
- * Button component for user interactions
4
- *
5
- * @component
6
- * @example
7
- * ```tsx
8
- * <Button mode="primary" size="m" buttonStyle="accent">Click me</Button>
9
- * ```
10
- */
1
+ import { ButtonProps, BackButtonProps } from './Button.type';
11
2
  export declare const Button: import('react').ForwardRefExoticComponent<(ButtonProps & {
12
3
  style?: React.CSSProperties;
13
- }) & import('react').RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
4
+ }) & import('react').RefAttributes<HTMLButtonElement | HTMLAnchorElement>> & {
5
+ Back: import('react').ForwardRefExoticComponent<BackButtonProps & import('react').RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
6
+ };
@@ -1,5 +1,7 @@
1
+ export type LinkSize = 'l' | 'm' | 's';
2
+ export type ButtonSize = 'l' | 'm' | 's' | 'xs';
1
3
  /**
2
- * Base properties common to all button variants
4
+ * Base properties common to all button and link variants
3
5
  */
4
6
  type BaseProps = {
5
7
  /**
@@ -24,6 +26,54 @@ type BaseProps = {
24
26
  */
25
27
  'data-testid'?: string;
26
28
  };
29
+ /**
30
+ * Link style variants - buttonStyle and mode combinations
31
+ */
32
+ type LinkStyleProps = {
33
+ /**
34
+ * Button style type
35
+ * @default 'neutral'
36
+ */
37
+ buttonStyle?: 'neutral';
38
+ /**
39
+ * Button variant
40
+ * @default 'primary'
41
+ */
42
+ mode?: 'primary' | 'secondary' | 'tertiary';
43
+ } | {
44
+ /**
45
+ * Button style type
46
+ * @default 'accent'
47
+ */
48
+ buttonStyle?: 'accent' | 'positive' | 'negative' | 'contrast' | 'warning';
49
+ /**
50
+ * Button variant
51
+ * @default 'primary'
52
+ */
53
+ mode?: 'primary' | 'secondary';
54
+ };
55
+ /**
56
+ * Link icon variants
57
+ * - With icons: size is required
58
+ * - Without icons: size is optional
59
+ */
60
+ type LinkIconVariant = {
61
+ /**
62
+ * Icons render only when size is provided.
63
+ * @default 'm'
64
+ */
65
+ size: LinkSize;
66
+ iconLeft?: React.ReactNode;
67
+ iconRight?: React.ReactNode;
68
+ } | {
69
+ /** No icons in this variant */
70
+ size?: LinkSize;
71
+ iconLeft?: never;
72
+ iconRight?: never;
73
+ };
74
+ /**
75
+ * Base properties common to all button variants
76
+ */
27
77
  type ButtonBaseProps = BaseProps & {
28
78
  /**
29
79
  * Button variant
@@ -31,19 +81,48 @@ type ButtonBaseProps = BaseProps & {
31
81
  */
32
82
  mode?: 'primary' | 'secondary' | 'tertiary';
33
83
  /**
34
- * Button icon (right side)
84
+ * Button icon (left side)
85
+ */
86
+ iconLeft?: React.ReactNode;
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)
35
103
  */
36
104
  iconRight?: React.ReactNode;
105
+ postfix?: never;
106
+ subcaption?: never;
107
+ loading?: never;
108
+ stretched?: never;
109
+ };
110
+ type CommonProps = (Omit<ButtonBaseProps, 'mode'> & {
37
111
  /**
38
112
  * Button style type
39
113
  * @default 'neutral'
40
114
  */
41
- buttonStyle?: 'neutral' | 'accent' | 'positive' | 'negative' | 'contrast' | 'special';
115
+ buttonStyle?: 'neutral' | 'accent' | 'positive' | 'negative' | 'contrast' | 'gray';
116
+ /**
117
+ * Button variant - primary mode supports all buttonStyle options including gray
118
+ * @default 'primary'
119
+ */
120
+ mode?: 'primary';
42
121
  /**
43
122
  * Button size
44
123
  * @default 'm'
45
124
  */
46
- size?: 'l' | 'm' | 's' | 'xs';
125
+ size?: ButtonSize;
47
126
  /**
48
127
  * Display variant
49
128
  * @default 'button'
@@ -53,10 +132,6 @@ type ButtonBaseProps = BaseProps & {
53
132
  * Button postfix (only for displayAs='button')
54
133
  */
55
134
  postfix?: React.ReactNode;
56
- /**
57
- * Subcaption text or node (only for displayAs='button')
58
- */
59
- subcaption?: React.ReactNode;
60
135
  /**
61
136
  * Shows loading state
62
137
  * @default false
@@ -72,83 +147,122 @@ type ButtonBaseProps = BaseProps & {
72
147
  stretched?: boolean | {
73
148
  justify: React.CSSProperties['justifyContent'];
74
149
  };
75
- iconLeft?: never;
150
+ /**
151
+ * Button icon (left side)
152
+ */
153
+ iconLeft?: React.ReactNode;
154
+ iconRight?: never;
76
155
  showUnderline?: never;
77
- };
78
- export type LinkSizeType = 'l' | 'm' | 's';
79
- /**
80
- * Link style variants - buttonStyle and mode combinations
81
- */
82
- type LinkStyleProps = {
156
+ paddings?: never;
157
+ } & ButtonSizeAndSubcaption) | (Omit<ButtonBaseProps, 'mode'> & {
83
158
  /**
84
- * Button style type
159
+ * Button style type (gray is not available for secondary/tertiary)
85
160
  * @default 'neutral'
86
161
  */
87
- buttonStyle?: 'neutral';
162
+ buttonStyle?: 'neutral' | 'accent' | 'positive' | 'negative' | 'contrast';
88
163
  /**
89
164
  * Button variant
90
165
  * @default 'primary'
91
166
  */
92
- mode?: 'primary' | 'secondary' | 'tertiary';
93
- } | {
167
+ mode?: 'secondary';
94
168
  /**
95
- * Button style type
96
- * @default 'accent'
169
+ * Button size
170
+ * @default 'm'
97
171
  */
98
- buttonStyle?: 'accent' | 'positive' | 'negative' | 'contrast' | 'warning';
172
+ size?: ButtonSize;
173
+ /**
174
+ * Display variant
175
+ * @default 'button'
176
+ */
177
+ displayAs?: 'button';
178
+ /**
179
+ * Button postfix (only for displayAs='button')
180
+ */
181
+ postfix?: React.ReactNode;
182
+ /**
183
+ * Shows loading state
184
+ * @default false
185
+ */
186
+ loading?: boolean;
187
+ /**
188
+ * Stretch button to full width, optionally with justify-content control
189
+ * @default false
190
+ * @example
191
+ * stretched={true} // Simple full width
192
+ * stretched={{ justify: 'space-between' }} // Full width with space-between
193
+ */
194
+ stretched?: boolean | {
195
+ justify: React.CSSProperties['justifyContent'];
196
+ };
197
+ /**
198
+ * Button icon (left side)
199
+ */
200
+ iconLeft?: React.ReactNode;
201
+ iconRight?: never;
202
+ showUnderline?: never;
203
+ paddings?: never;
204
+ } & ButtonSizeAndSubcaption) | (Omit<ButtonBaseProps, 'mode'> & {
205
+ /**
206
+ * Button style type (gray is not available for secondary/tertiary)
207
+ * @default 'neutral'
208
+ */
209
+ buttonStyle?: 'neutral' | 'accent' | 'positive' | 'negative' | 'contrast';
99
210
  /**
100
211
  * Button variant
101
212
  * @default 'primary'
102
213
  */
103
- mode?: 'primary' | 'secondary';
104
- };
105
- /**
106
- * Link icon variants
107
- * - With icons: size is required
108
- * - Without icons: size is optional
109
- */
110
- type LinkIconVariant = {
214
+ mode: 'tertiary';
111
215
  /**
112
- * Icons render only when size is provided.
216
+ * Button size
113
217
  * @default 'm'
114
218
  */
115
- size: LinkSizeType;
116
- iconLeft?: React.ReactNode;
117
- iconRight?: React.ReactNode;
118
- } | {
119
- /** No icons in this variant */
120
- size?: LinkSizeType;
121
- iconLeft?: never;
122
- iconRight?: never;
123
- };
124
- /**
125
- * Base properties common to all link variants
126
- */
127
- type LinkBaseProps = BaseProps & LinkStyleProps & {
219
+ size?: ButtonSize;
128
220
  /**
129
221
  * Display variant
222
+ * @default 'button'
130
223
  */
131
- displayAs: 'link';
224
+ displayAs?: 'button';
132
225
  /**
133
- * Underline setting (only for displayAs='link')
226
+ * Button postfix (only for displayAs='button')
227
+ */
228
+ postfix?: React.ReactNode;
229
+ /**
230
+ * Shows loading state
134
231
  * @default false
135
232
  */
136
- showUnderline?: boolean;
137
- postfix?: never;
138
- subcaption?: never;
139
- loading?: never;
140
- stretched?: never;
141
- };
233
+ loading?: boolean;
234
+ /**
235
+ * Stretch button to full width, optionally with justify-content control
236
+ * @default false
237
+ * @example
238
+ * stretched={true} // Simple full width
239
+ * stretched={{ justify: 'space-between' }} // Full width with space-between
240
+ */
241
+ stretched?: boolean | {
242
+ justify: React.CSSProperties['justifyContent'];
243
+ };
244
+ /**
245
+ * Button icon (left side)
246
+ */
247
+ iconLeft?: React.ReactNode;
248
+ /**
249
+ * Enable or disable horizontal paddings (only for tertiary mode)
250
+ * @default true
251
+ */
252
+ paddings?: boolean;
253
+ iconRight?: never;
254
+ showUnderline?: never;
255
+ } & ButtonSizeAndSubcaption) | (LinkBaseProps & LinkIconVariant);
142
256
  /**
143
257
  * Props when rendered as a native HTMLButtonElement (default behaviour).
144
258
  */
145
- export type ButtonAsNativeButtonProps = ButtonBaseProps & React.ButtonHTMLAttributes<HTMLButtonElement> & {
259
+ export type ButtonAsNativeButtonProps = CommonProps & React.ButtonHTMLAttributes<HTMLButtonElement> & {
146
260
  as?: 'button';
147
261
  };
148
262
  /**
149
263
  * Props when rendered as an anchor (HTMLAnchorElement).
150
264
  */
151
- export type ButtonAsAnchorProps = LinkBaseProps & LinkIconVariant & React.AnchorHTMLAttributes<HTMLAnchorElement> & {
265
+ export type ButtonAsAnchorProps = CommonProps & React.AnchorHTMLAttributes<HTMLAnchorElement> & {
152
266
  as: 'a';
153
267
  /**
154
268
  * External link default. If target/rel are not provided, sets target="_blank"
@@ -180,4 +294,20 @@ export declare const isDisplayAsButton: (props: ButtonProps) => props is Extract
180
294
  export declare const isDisplayAsLink: (props: ButtonProps) => props is Extract<ButtonProps, {
181
295
  displayAs: "link";
182
296
  }>;
297
+ /**
298
+ * Enforces that subcaption can be provided only when size is 'l'.
299
+ * - If subcaption is present → size must be 'l'
300
+ * - If subcaption is absent → size can be any or undefined (defaults to 'm')
301
+ */
302
+ type ButtonSizeAndSubcaption = {
303
+ subcaption?: never;
304
+ size?: ButtonSize;
305
+ } | {
306
+ subcaption: React.ReactNode;
307
+ size: 'l';
308
+ };
309
+ /**
310
+ * Props for Button.Back component - based on ButtonProps with restricted design props
311
+ */
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'>;
183
313
  export {};
@@ -0,0 +1,6 @@
1
+ import { IconProps } from './types';
2
+ import { FC } from 'react';
3
+ /**
4
+ * Simple arrow left icon used in Button (asBackButton)
5
+ */
6
+ export declare const ArrowLeftIcon: FC<IconProps>;
@@ -1,5 +1,5 @@
1
- import { IconProps } from './types';
1
+ import { FC, SVGProps } from 'react';
2
2
  /**
3
3
  * Cross/close icon used in Button examples
4
4
  */
5
- export declare const CrossIcon: React.FC<IconProps>;
5
+ export declare const CrossIcon: FC<SVGProps<SVGSVGElement>>;
@@ -7,3 +7,4 @@ export { ArrowIcon } from './ArrowIcon';
7
7
  export { FollowIcon } from './FollowIcon';
8
8
  export { DownloadIcon } from './DownloadIcon';
9
9
  export { CrossIcon } from './CrossIcon';
10
+ export { ArrowLeftIcon } from './ArrowLeftIcon';
@@ -1,7 +1,4 @@
1
- export interface IconProps {
2
- width?: number;
3
- height?: number;
4
- className?: string;
5
- color?: string;
1
+ import { SVGProps } from 'react';
2
+ export interface IconProps extends Pick<SVGProps<SVGElement>, 'height' | 'width' | 'className' | 'color'> {
6
3
  [key: string]: unknown;
7
4
  }
@@ -0,0 +1,5 @@
1
+ import { default as t } from '../../../styles/typography.module.css';
2
+ import { ButtonSize } from '../Button.type';
3
+ type TypographyType = keyof typeof t;
4
+ export declare const getButtonTypography: (size: ButtonSize) => TypographyType;
5
+ export {};
@@ -0,0 +1,7 @@
1
+ import { ButtonProps } from '../Button.type';
2
+ import { LoaderProps } from '../../Loader';
3
+ type LoaderVariant = NonNullable<LoaderProps['variant']>;
4
+ export declare const getLoaderVariant: (isDisabled: boolean, mode: NonNullable<ButtonProps["mode"]>, buttonStyle: NonNullable<Extract<ButtonProps, {
5
+ buttonStyle?: unknown;
6
+ }>["buttonStyle"]>) => LoaderVariant;
7
+ export {};
@@ -1,11 +1,11 @@
1
1
  import { default as t } from '../../../styles/typography.module.css';
2
- import { LinkSizeType } from '../Button.type';
2
+ import { LinkSize } from '../Button.type';
3
3
  type TypographyType = keyof typeof t;
4
4
  /**
5
5
  * Maps a Link size variant to its corresponding typography CSS class name.
6
6
  * This ensures consistent typography styling across different link sizes.
7
- * @param {LinkSizeType} size - The size of the link component ('l', 'm', or 's')
7
+ * @param {LinkSize} size - The size of the link component ('l', 'm', or 's')
8
8
  * @returns {TypographyType} The typography class name corresponding to the given size
9
9
  */
10
- declare function getTypography(size: LinkSizeType): TypographyType;
10
+ declare function getTypography(size: LinkSize): TypographyType;
11
11
  export { getTypography };
@@ -6,3 +6,4 @@ export declare const Tile: FC<{
6
6
  title: ReactNode;
7
7
  children: ReactNode;
8
8
  }>;
9
+ export declare const ButtonPreview: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { DialogProps } from './Dialog.type';
2
+ /**
3
+ * Базовый компонент диалогового окна.
4
+ * Обеспечивает управление состоянием, фокусом и позиционированием.
5
+ * Является основой для более сложных компонентов, таких как Modal.
6
+ */
7
+ declare const Dialog: import('react').ForwardRefExoticComponent<DialogProps & import('react').RefAttributes<HTMLDivElement>>;
8
+ export { Dialog };
@@ -0,0 +1,29 @@
1
+ import { HTMLProps } from 'react';
2
+ /** Тип позиционирования диалогового окна. */
3
+ export type DialogPlacement = 'default' | 'default-stretched' | 'center' | 'center-stretched' | 'mobile' | 'right-drawer' | 'left-drawer';
4
+ /** Пропсы для компонента Dialog. */
5
+ export interface DialogProps extends Pick<HTMLProps<HTMLDivElement>, 'className' | 'style' | 'children'> {
6
+ /** Контролируемое состояние открытия. */
7
+ open: boolean;
8
+ /** Callback при изменении состояния. */
9
+ onOpenChange: (open: boolean) => void;
10
+ /**
11
+ * Позиционирование диалога.
12
+ * @default 'top'
13
+ */
14
+ placement?: DialogPlacement;
15
+ /**
16
+ * Отключить закрытие по клику вне диалога.
17
+ * @default false
18
+ */
19
+ disableOutsideClick?: boolean;
20
+ /**
21
+ * Отключить закрытие по Escape.
22
+ * @default false
23
+ */
24
+ disableEscapeKey?: boolean;
25
+ /** testId для тестирования. */
26
+ 'data-testid'?: string;
27
+ /** Класс для оверлея. */
28
+ overlayClassName?: HTMLProps<HTMLDivElement>['className'];
29
+ }
@@ -0,0 +1,2 @@
1
+ export { Dialog } from './Dialog';
2
+ export type { DialogProps, DialogPlacement } from './Dialog.type';
@@ -0,0 +1 @@
1
+ export { useDialog } from './use-dialog';
@@ -0,0 +1,43 @@
1
+ import { Placement } from '@floating-ui/react';
2
+ import { DialogProps } from '../Dialog.type';
3
+ type UseDialogOptions = Pick<DialogProps, 'placement' | 'open' | 'disableOutsideClick' | 'disableEscapeKey' | 'onOpenChange'>;
4
+ /**
5
+ * Хук для управления состоянием и взаимодействиями диалогового окна.
6
+ * Инкапсулирует логику Floating UI для позиционирования, анимаций и закрытия.
7
+ * @returns {object} Объект со свойствами и хендлерами для управления диалогом.
8
+ */
9
+ export declare function useDialog({ open, onOpenChange, placement, disableOutsideClick, disableEscapeKey, }: UseDialogOptions): {
10
+ /** Состояние для условного рендеринга с поддержкой анимации закрытия. */
11
+ isMounted: boolean;
12
+ /** Стили для CSS-переходов (анимации). */
13
+ transitionStyles: import('react').CSSProperties;
14
+ /** Контекст Floating UI. */
15
+ context: {
16
+ x: number;
17
+ y: number;
18
+ placement: Placement;
19
+ strategy: import('@floating-ui/utils').Strategy;
20
+ middlewareData: import('@floating-ui/core').MiddlewareData;
21
+ isPositioned: boolean;
22
+ update: () => void;
23
+ floatingStyles: React.CSSProperties;
24
+ open: boolean;
25
+ onOpenChange: (open: boolean, event?: Event, reason?: import('@floating-ui/react').OpenChangeReason) => void;
26
+ events: import('@floating-ui/react').FloatingEvents;
27
+ dataRef: React.MutableRefObject<import('@floating-ui/react').ContextData>;
28
+ nodeId: string | undefined;
29
+ floatingId: string | undefined;
30
+ refs: import('@floating-ui/react').ExtendedRefs<import('@floating-ui/react').ReferenceType>;
31
+ elements: import('@floating-ui/react').ExtendedElements<import('@floating-ui/react').ReferenceType>;
32
+ };
33
+ /** Ссылки на элементы для Floating UI. */
34
+ refs: {
35
+ reference: import('react').MutableRefObject<import('@floating-ui/react-dom').ReferenceType | null>;
36
+ floating: React.MutableRefObject<HTMLElement | null>;
37
+ setReference: (node: import('@floating-ui/react-dom').ReferenceType | null) => void;
38
+ setFloating: (node: HTMLElement | null) => void;
39
+ } & import('@floating-ui/react').ExtendedRefs<import('@floating-ui/react').ReferenceType>;
40
+ /** Пропсы для плавающего элемента. */
41
+ getFloatingProps: (userProps?: React.HTMLProps<HTMLElement>) => Record<string, unknown>;
42
+ };
43
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -15,5 +15,5 @@ import { LoaderProps } from './Loader.type';
15
15
  * </Loader>
16
16
  * ```
17
17
  */
18
- declare const Loader: import('react').ForwardRefExoticComponent<LoaderProps & import('react').RefAttributes<HTMLDivElement | SVGSVGElement>>;
18
+ declare const Loader: import('react').ForwardRefExoticComponent<LoaderProps & import('react').RefAttributes<SVGSVGElement | HTMLDivElement>>;
19
19
  export { Loader };
@@ -0,0 +1,7 @@
1
+ import { ModalProps } from './Modal.type';
2
+ /**
3
+ * Компонент модального окна.
4
+ * Построен на основе Dialog и добавляет с��андартную разметку (шапка, контент, футер).
5
+ */
6
+ declare const Modal: import('react').ForwardRefExoticComponent<ModalProps & import('react').RefAttributes<HTMLDivElement>>;
7
+ export { Modal };
@@ -0,0 +1,34 @@
1
+ import { DialogProps } from '../Dialog';
2
+ import { FC, HTMLProps, PropsWithChildren, ReactNode } from 'react';
3
+ import { ButtonProps } from '../Button';
4
+ /** Поля модального окна для стилизации. */
5
+ type ModalFields = 'container' | 'title' | 'subTitle' | 'content' | 'footer';
6
+ /** Пропсы компонента Modal. @extends DialogProps */
7
+ export interface ModalProps extends DialogProps {
8
+ /** Заголовок модального окна. */
9
+ title?: ReactNode;
10
+ /** Слот для элементов в правом верхнем углу (рядом с кнопкой закрытия). */
11
+ actions?: ReactNode;
12
+ /** Подзаголовок под основным заголовком. */
13
+ subTitle?: ReactNode;
14
+ /** Содержимое футера (например, кнопки). */
15
+ footer?: ReactNode;
16
+ /** Ширина модального окна в px (допустимо: 480, 620, 800). */
17
+ size?: 480 | 620 | 800;
18
+ /** Inline-стили для отдельных частей модального окна. */
19
+ styles?: Partial<Record<ModalFields, HTMLProps<HTMLDivElement>['style']>>;
20
+ /** CSS-классы для отдельных частей модального окна. */
21
+ classNames?: Partial<Record<ModalFields, HTMLProps<HTMLDivElement>['className']>>;
22
+ /** Показывать кнопку закрытия в шапке. @default true */
23
+ showCloseButton?: boolean;
24
+ /** Пропсы кнопки закрытия; можно обернуть кнопку через wrapper. */
25
+ closeButtonProps?: ButtonProps & {
26
+ /** Обёрточный компонент для кнопки закрытия. */
27
+ wrapper?: FC<PropsWithChildren>;
28
+ };
29
+ /** Скрыть разделитель в шапке. */
30
+ hideHeaderDivider?: boolean;
31
+ /** Скрыть разделитель в футере. */
32
+ hideFooterDivider?: boolean;
33
+ }
34
+ export {};
@@ -0,0 +1,2 @@
1
+ export { Modal } from './Modal';
2
+ export type { ModalProps } from './Modal.type';
@@ -0,0 +1,14 @@
1
+ import { FC } from 'react';
2
+ import { PlaceholderProps } from './Placeholder.type';
3
+ /**
4
+ * Компонент плейсхолдера для отображения состояний (пустое состояние, загрузка, ошибка)
5
+ *
6
+ * @example
7
+ * <Placeholder
8
+ * iconSlot={<Icon />}
9
+ * title="Заголовок"
10
+ * subTitle="Описание"
11
+ * size="l"
12
+ * />
13
+ */
14
+ export declare const Placeholder: FC<PlaceholderProps>;