@ozen-ui/kit 0.37.1 → 0.38.0

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 (58) hide show
  1. package/ButtonBase/package.json +5 -0
  2. package/ButtonNext/package.json +5 -0
  3. package/IconButtonNext/package.json +5 -0
  4. package/__inner__/cjs/components/Breadcrumbs/Breadcrumbs.css +1 -1
  5. package/__inner__/cjs/components/Button/Button.d.ts +3 -0
  6. package/__inner__/cjs/components/Button/Button.js +8 -3
  7. package/__inner__/cjs/components/ButtonBase/ButtonBase.css +10 -0
  8. package/__inner__/cjs/components/ButtonBase/ButtonBase.d.ts +20 -0
  9. package/__inner__/cjs/components/ButtonBase/ButtonBase.js +30 -0
  10. package/__inner__/cjs/components/ButtonBase/constants.d.ts +1 -0
  11. package/__inner__/cjs/components/ButtonBase/constants.js +4 -0
  12. package/__inner__/cjs/components/ButtonBase/index.d.ts +1 -0
  13. package/__inner__/cjs/components/ButtonBase/index.js +4 -0
  14. package/__inner__/cjs/components/ButtonNext/Button.css +333 -0
  15. package/__inner__/cjs/components/ButtonNext/Button.d.ts +51 -0
  16. package/__inner__/cjs/components/ButtonNext/Button.js +60 -0
  17. package/__inner__/cjs/components/ButtonNext/constants.d.ts +4 -0
  18. package/__inner__/cjs/components/ButtonNext/constants.js +7 -0
  19. package/__inner__/cjs/components/ButtonNext/index.d.ts +1 -0
  20. package/__inner__/cjs/components/ButtonNext/index.js +4 -0
  21. package/__inner__/cjs/components/IconButton/IconButton.d.ts +3 -0
  22. package/__inner__/cjs/components/IconButton/IconButton.js +7 -0
  23. package/__inner__/cjs/components/IconButtonNext/IconButton.css +348 -0
  24. package/__inner__/cjs/components/IconButtonNext/IconButton.d.ts +41 -0
  25. package/__inner__/cjs/components/IconButtonNext/IconButton.js +70 -0
  26. package/__inner__/cjs/components/IconButtonNext/constants.d.ts +4 -0
  27. package/__inner__/cjs/components/IconButtonNext/constants.js +7 -0
  28. package/__inner__/cjs/components/IconButtonNext/index.d.ts +1 -0
  29. package/__inner__/cjs/components/IconButtonNext/index.js +4 -0
  30. package/__inner__/cjs/components/ThemeProvider/types.d.ts +4 -0
  31. package/__inner__/esm/components/Breadcrumbs/Breadcrumbs.css +1 -1
  32. package/__inner__/esm/components/Button/Button.d.ts +3 -0
  33. package/__inner__/esm/components/Button/Button.js +8 -3
  34. package/__inner__/esm/components/ButtonBase/ButtonBase.css +10 -0
  35. package/__inner__/esm/components/ButtonBase/ButtonBase.d.ts +20 -0
  36. package/__inner__/esm/components/ButtonBase/ButtonBase.js +27 -0
  37. package/__inner__/esm/components/ButtonBase/constants.d.ts +1 -0
  38. package/__inner__/esm/components/ButtonBase/constants.js +1 -0
  39. package/__inner__/esm/components/ButtonBase/index.d.ts +1 -0
  40. package/__inner__/esm/components/ButtonBase/index.js +1 -0
  41. package/__inner__/esm/components/ButtonNext/Button.css +333 -0
  42. package/__inner__/esm/components/ButtonNext/Button.d.ts +51 -0
  43. package/__inner__/esm/components/ButtonNext/Button.js +57 -0
  44. package/__inner__/esm/components/ButtonNext/constants.d.ts +4 -0
  45. package/__inner__/esm/components/ButtonNext/constants.js +4 -0
  46. package/__inner__/esm/components/ButtonNext/index.d.ts +1 -0
  47. package/__inner__/esm/components/ButtonNext/index.js +1 -0
  48. package/__inner__/esm/components/IconButton/IconButton.d.ts +3 -0
  49. package/__inner__/esm/components/IconButton/IconButton.js +7 -0
  50. package/__inner__/esm/components/IconButtonNext/IconButton.css +348 -0
  51. package/__inner__/esm/components/IconButtonNext/IconButton.d.ts +41 -0
  52. package/__inner__/esm/components/IconButtonNext/IconButton.js +67 -0
  53. package/__inner__/esm/components/IconButtonNext/constants.d.ts +4 -0
  54. package/__inner__/esm/components/IconButtonNext/constants.js +4 -0
  55. package/__inner__/esm/components/IconButtonNext/index.d.ts +1 -0
  56. package/__inner__/esm/components/IconButtonNext/index.js +1 -0
  57. package/__inner__/esm/components/ThemeProvider/types.d.ts +4 -0
  58. package/package.json +5 -8
@@ -0,0 +1 @@
1
+ export * from './ButtonBase';
@@ -0,0 +1 @@
1
+ export * from './ButtonBase';
@@ -0,0 +1,333 @@
1
+ /* stylelint-disable */
2
+ .ButtonNext {
3
+ display: inline-flex;
4
+ flex-wrap: nowrap;
5
+ align-items: center;
6
+ justify-content: center;
7
+ box-sizing: border-box;
8
+ text-decoration: none;
9
+ border: none;
10
+ cursor: pointer;
11
+ color: var(--button-font-color);
12
+ block-size: var(--button-height);
13
+ min-inline-size: var(--button-min-width);
14
+ padding: 0 var(--button-padding-x);
15
+ background-color: var(--button-bg-color);
16
+ border-radius: var(--border-radius-xs);
17
+ transition:
18
+ background-color var(--transition-default),
19
+ border-color var(--transition-default),
20
+ box-shadow var(--transition-default),
21
+ opacity var(--transition-default);
22
+ -webkit-tap-highlight-color: unset;
23
+ position: relative;
24
+ }
25
+ .ButtonNext > svg {
26
+ flex-shrink: 0;
27
+ }
28
+ .ButtonNext_size_2xs {
29
+ --button-height: var(--control-height-2xs);
30
+ --button-padding-x: var(--control-padding-xs);
31
+ --button-min-width: 56px;
32
+
33
+ font: var(--typography-text-2xs-font);
34
+
35
+ letter-spacing: var(--typography-text-2xs-letter_spacing, 0);
36
+
37
+ text-transform: var(--typography-text-2xs-text_transform, none);
38
+ }
39
+ .ButtonNext_size_xs {
40
+ --button-height: var(--control-height-xs);
41
+ --button-padding-x: var(--control-padding-xs);
42
+ --button-min-width: 64px;
43
+
44
+ font: var(--typography-text-xs-font);
45
+
46
+ letter-spacing: var(--typography-text-xs-letter_spacing, 0);
47
+
48
+ text-transform: var(--typography-text-xs-text_transform, none);
49
+ }
50
+ .ButtonNext_size_s {
51
+ --button-height: var(--control-height-s);
52
+ --button-padding-x: var(--control-padding-s);
53
+ --button-min-width: 72px;
54
+
55
+ font: var(--typography-text-s-font);
56
+
57
+ letter-spacing: var(--typography-text-s-letter_spacing, 0);
58
+
59
+ text-transform: var(--typography-text-s-text_transform, none);
60
+ }
61
+ .ButtonNext_size_m {
62
+ --button-height: var(--control-height-m);
63
+ --button-padding-x: var(--control-padding-m);
64
+ --button-min-width: 80px;
65
+
66
+ font: var(--typography-text-m-font);
67
+
68
+ letter-spacing: var(--typography-text-m-letter_spacing, 0);
69
+
70
+ text-transform: var(--typography-text-m-text_transform, none);
71
+ }
72
+ .ButtonNext_size_l {
73
+ --button-height: var(--control-height-l);
74
+ --button-padding-x: var(--control-padding-l);
75
+ --button-min-width: 88px;
76
+
77
+ font: var(--typography-text-l-font);
78
+
79
+ letter-spacing: var(--typography-text-l-letter_spacing, 0);
80
+
81
+ text-transform: var(--typography-text-l-text_transform, none);
82
+ }
83
+ .ButtonNext_variant_contained.ButtonNext_color_primary {
84
+ --button-bg-color: var(--color-background-action);
85
+ --button-bg-color-hover: var(--color-background-action-hover);
86
+ --button-bg-color-active: var(--color-background-action-pressed);
87
+ --button-bg-color-focus: var(--color-background-action);
88
+ --button-font-color: var(--color-content-action-on);
89
+ --button-font-color-hover: var(--color-content-action-on);
90
+ --button-font-color-active: var(--color-content-action-on);
91
+ --button-font-color-focus: var(--color-content-action-on);
92
+ }
93
+ .ButtonNext_variant_contained.ButtonNext_color_secondary {
94
+ --button-bg-color: var(--color-background-action-secondary);
95
+ --button-bg-color-hover: var(--color-background-action-secondary-hover);
96
+ --button-bg-color-active: var(--color-background-action-secondary-pressed);
97
+ --button-bg-color-focus: var(--color-background-action-secondary);
98
+ --button-font-color: var(--color-content-action-on);
99
+ --button-font-color-hover: var(--color-content-action-on);
100
+ --button-font-color-active: var(--color-content-action-on);
101
+ --button-font-color-focus: var(--color-content-action-on);
102
+ }
103
+ .ButtonNext_variant_contained.ButtonNext_color_tertiary {
104
+ --button-bg-color: var(--color-background-tertiary);
105
+ --button-bg-color-hover: var(--color-background-tertiary-hover);
106
+ --button-bg-color-active: var(--color-background-tertiary-pressed);
107
+ --button-bg-color-focus: var(--color-background-tertiary);
108
+ --button-font-color: var(--color-content-primary);
109
+ --button-font-color-hover: var(--color-content-primary);
110
+ --button-font-color-active: var(--color-content-primary);
111
+ --button-font-color-focus: var(--color-content-primary);
112
+ }
113
+ .ButtonNext_variant_contained.ButtonNext_color_error {
114
+ --button-bg-color: var(--color-background-error);
115
+ --button-bg-color-hover: var(--color-background-error-hover);
116
+ --button-bg-color-active: var(--color-background-error-pressed);
117
+ --button-bg-color-focus: var(--color-background-error);
118
+ --button-font-color: var(--color-content-action-on);
119
+ --button-font-color-hover: var(--color-content-action-on);
120
+ --button-font-color-active: var(--color-content-action-on);
121
+ --button-font-color-focus: var(--color-content-action-on);
122
+ }
123
+ .ButtonNext_variant_contained-additional.ButtonNext_color_primary {
124
+ --button-bg-color: var(--color-background-action-light);
125
+ --button-bg-color-hover: var(--color-background-action-light-hover);
126
+ --button-bg-color-active: var(--color-background-action-light-pressed);
127
+ --button-bg-color-focus: unset;
128
+ --button-font-color: var(--color-content-action);
129
+ --button-font-color-hover: var(--color-content-action);
130
+ --button-font-color-active: var(--color-content-action);
131
+ --button-font-color-focus: var(--color-content-action);
132
+ }
133
+ .ButtonNext_variant_contained-additional.ButtonNext_color_secondary {
134
+ --button-bg-color: var(--color-background-secondary);
135
+ --button-bg-color-hover: var(--color-background-secondary-hover);
136
+ --button-bg-color-active: var(--color-background-secondary-pressed);
137
+ --button-bg-color-focus: unset;
138
+ --button-font-color: var(--color-content-primary);
139
+ --button-font-color-hover: var(--color-content-primary);
140
+ --button-font-color-active: var(--color-content-primary);
141
+ --button-font-color-focus: var(--color-content-primary);
142
+ }
143
+ .ButtonNext_variant_contained-additional.ButtonNext_color_tertiary {
144
+ --button-bg-color: var(--color-background-primary);
145
+ --button-bg-color-hover: var(--color-background-primary-hover);
146
+ --button-bg-color-active: var(--color-background-primary-pressed);
147
+ --button-bg-color-focus: unset;
148
+ --button-font-color: var(--color-content-secondary);
149
+ --button-font-color-hover: var(--color-content-secondary);
150
+ --button-font-color-active: var(--color-content-secondary);
151
+ --button-font-color-focus: var(--color-content-secondary);
152
+ }
153
+ .ButtonNext_variant_contained-additional.ButtonNext_color_error {
154
+ --button-bg-color: var(--color-background-error-light);
155
+ --button-bg-color-hover: var(--color-background-error-light-hover);
156
+ --button-bg-color-active: var(--color-background-error-light-pressed);
157
+ --button-bg-color-focus: unset;
158
+ --button-font-color: var(--color-content-error);
159
+ --button-font-color-hover: var(--color-content-error);
160
+ --button-font-color-active: var(--color-content-error);
161
+ --button-font-color-focus: var(--color-content-error);
162
+ }
163
+ .ButtonNext_variant_ghost.ButtonNext_color_primary {
164
+ --button-bg-color: unset;
165
+ --button-bg-color-hover: var(--color-background-success-light-hover);
166
+ --button-bg-color-active: var(--color-background-success-light-pressed);
167
+ --button-bg-color-focus: unset;
168
+ --button-font-color: var(--color-content-action);
169
+ --button-font-color-hover: var(--color-content-action);
170
+ --button-font-color-active: var(--color-content-action);
171
+ --button-font-color-focus: var(--color-content-action);
172
+ }
173
+ .ButtonNext_variant_ghost.ButtonNext_color_secondary {
174
+ --button-bg-color: unset;
175
+ --button-bg-color-hover: var(--color-background-secondary-hover);
176
+ --button-bg-color-active: var(--color-background-secondary-pressed);
177
+ --button-bg-color-focus: unset;
178
+ --button-font-color: var(--color-content-primary);
179
+ --button-font-color-hover: var(--color-content-primary);
180
+ --button-font-color-active: var(--color-content-primary);
181
+ --button-font-color-focus: var(--color-content-primary);
182
+ }
183
+ .ButtonNext_variant_ghost.ButtonNext_color_tertiary {
184
+ --button-bg-color: unset;
185
+ --button-bg-color-hover: var(--color-background-primary-hover);
186
+ --button-bg-color-active: var(--color-background-primary-pressed);
187
+ --button-bg-color-focus: unset;
188
+ --button-font-color: var(--color-content-secondary);
189
+ --button-font-color-hover: var(--color-content-secondary);
190
+ --button-font-color-active: var(--color-content-secondary);
191
+ --button-font-color-focus: var(--color-content-secondary);
192
+ }
193
+ .ButtonNext_variant_ghost.ButtonNext_color_error {
194
+ --button-bg-color: unset;
195
+ --button-bg-color-hover: var(--color-background-error-light-hover);
196
+ --button-bg-color-active: var(--color-background-error-light-pressed);
197
+ --button-bg-color-focus: unset;
198
+ --button-font-color: var(--color-content-error);
199
+ --button-font-color-hover: var(--color-content-error);
200
+ --button-font-color-active: var(--color-content-error);
201
+ --button-font-color-focus: var(--color-content-error);
202
+ }
203
+ .ButtonNext_variant_function {
204
+ --button-height: auto;
205
+ --button-min-width: auto;
206
+ --button-padding-x: 0;
207
+ }
208
+ .ButtonNext_variant_function.ButtonNext_color_primary,
209
+ .ButtonNext_variant_function.ButtonNext_color_secondary,
210
+ .ButtonNext_variant_function.ButtonNext_color_tertiary,
211
+ .ButtonNext_variant_function.ButtonNext_color_error {
212
+ --button-bg-color: unset;
213
+ --button-bg-color-hover: unset;
214
+ --button-bg-color-active: unset;
215
+ --button-bg-color-focus: unset;
216
+ }
217
+ .ButtonNext_variant_function.ButtonNext_color_primary {
218
+ --button-font-color: var(--color-content-action);
219
+ --button-font-color-hover: var(--color-background-action-hover);
220
+ --button-font-color-active: var(--color-background-action-pressed);
221
+ --button-font-color-focus: var(--color-background-action-pressed);
222
+ }
223
+ .ButtonNext_variant_function.ButtonNext_color_secondary {
224
+ --button-font-color: var(--color-content-action-secondary);
225
+ --button-font-color-hover: var(--color-content-action-secondary-hover);
226
+ --button-font-color-active: var(--color-content-action-secondary-pressed);
227
+ --button-font-color-focus: var(--color-content-action-secondary-pressed);
228
+ }
229
+ .ButtonNext_variant_function.ButtonNext_color_tertiary {
230
+ --button-font-color: var(--color-content-secondary);
231
+ --button-font-color-hover: var(--color-content-secondary);
232
+ --button-font-color-active: var(--color-content-secondary);
233
+ --button-font-color-focus: var(--color-content-secondary);
234
+ }
235
+ .ButtonNext_variant_function.ButtonNext_color_error {
236
+ --button-font-color: var(--color-content-error);
237
+ --button-font-color-hover: var(--color-content-error-hover);
238
+ --button-font-color-active: var(--color-content-error-pressed);
239
+ --button-font-color-focus: var(--color-content-error-pressed);
240
+ }
241
+ .ButtonNext_variant_contained.ButtonNext_disabled,
242
+ .ButtonNext_variant_contained.ButtonNext_loading,
243
+ .ButtonNext_variant_contained-additional.ButtonNext_disabled,
244
+ .ButtonNext_variant_contained-additional.ButtonNext_loading,
245
+ .ButtonNext_variant_ghost.ButtonNext_disabled,
246
+ .ButtonNext_variant_ghost.ButtonNext_loading,
247
+ .ButtonNext_variant_function.ButtonNext_disabled,
248
+ .ButtonNext_variant_function.ButtonNext_loading {
249
+ --button-font-color: var(--color-content-disabled);
250
+ }
251
+ .ButtonNext_variant_contained.ButtonNext_disabled,
252
+ .ButtonNext_variant_contained.ButtonNext_loading,
253
+ .ButtonNext_variant_contained-additional.ButtonNext_disabled,
254
+ .ButtonNext_variant_contained-additional.ButtonNext_loading {
255
+ --button-bg-color: var(--color-background-disabled);
256
+ --button-bg-color-hover: var(--color-background-disabled);
257
+ --button-bg-color-active: var(--color-background-disabled);
258
+ }
259
+ .ButtonNext_variant_ghost.ButtonNext_disabled,
260
+ .ButtonNext_variant_ghost.ButtonNext_loading,
261
+ .ButtonNext_variant_function.ButtonNext_disabled,
262
+ .ButtonNext_variant_function.ButtonNext_loading {
263
+ --button-bg-color: unset;
264
+ --button-bg-color-hover: unset;
265
+ --button-bg-color-active: unset;
266
+ }
267
+ .ButtonNext:focus:not(:focus-visible, :active, :hover) {
268
+ box-shadow: none;
269
+ color: var(--button-font-color);
270
+ }
271
+ .ButtonNext:focus:not(:focus-visible) {
272
+ box-shadow: none;
273
+ }
274
+ .ButtonNext:focus {
275
+ outline: 0;
276
+ box-shadow: var(--shadow-outline-focused);
277
+ background-color: var(--button-bg-color-focus);
278
+ color: var(--button-font-color-focus);
279
+ }
280
+ .ButtonNext:hover {
281
+ background-color: var(--button-bg-color-hover);
282
+ color: var(--button-font-color-hover);
283
+ }
284
+ .ButtonNext:active {
285
+ background-color: var(--button-bg-color-active);
286
+ color: var(--button-font-color-active);
287
+ }
288
+ .ButtonNext_fullWidth {
289
+ inline-size: 100%;
290
+ }
291
+ .ButtonNext_disabled,
292
+ .ButtonNext_loading {
293
+ pointer-events: none;
294
+ cursor: auto;
295
+ }
296
+ .ButtonNext_loading .ButtonNext-Content {
297
+ visibility: hidden;
298
+ }
299
+ .ButtonNext-Content {
300
+ flex-grow: 1;
301
+ flex-shrink: 1;
302
+ display: flex;
303
+ text-align: center;
304
+ place-content: center;
305
+ align-items: center;
306
+ min-inline-size: 0;
307
+ gap: var(--spacing-2xs);
308
+ }
309
+ .ButtonNext-Label {
310
+ overflow: hidden;
311
+ text-overflow: ellipsis;
312
+ white-space: nowrap;
313
+ }
314
+ .ButtonNext-Loader {
315
+ position: absolute;
316
+ }
317
+ .ButtonNext-Loader_animation-enter {
318
+ opacity: 0;
319
+ }
320
+ .ButtonNext-Loader_animation-enter-active {
321
+ opacity: 1;
322
+ transition: opacity var(--transition-default);
323
+ }
324
+ .ButtonNext-Loader_animation-exit {
325
+ opacity: 1;
326
+ }
327
+ .ButtonNext-Loader_animation-exit-active {
328
+ opacity: 0;
329
+ transition: opacity var(--transition-default);
330
+ }
331
+ .ButtonNext .Loader {
332
+ color: var(--color-content-disabled);
333
+ }
@@ -0,0 +1,51 @@
1
+ import './Button.css';
2
+ import type { ReactNode, ElementType, ComponentPropsWithRef } from 'react';
3
+ import type { IconProps, IconSize } from '@ozen-ui/icons';
4
+ import type { FormElementSizeVariant } from '../../types/FormElementSizeVariant';
5
+ import type { PolymorphicComponentPropsWithoutRef } from '../../utils/polymorphicComponentWithRef';
6
+ import type { RenderContentType } from '../../utils/renderContent';
7
+ import { BUTTON_DEFAULT_TAG } from './constants';
8
+ export declare const buttonVariant: readonly ["contained", "contained-additional", "ghost", "function"];
9
+ export declare const buttonColorVariant: readonly ["primary", "secondary", "tertiary", "error"];
10
+ export type ButtonVariant = (typeof buttonVariant)[number];
11
+ export type ButtonColorVariant = (typeof buttonColorVariant)[number];
12
+ export type ButtonIcon = RenderContentType<IconProps & {
13
+ size?: IconSize;
14
+ }>['content'];
15
+ type ButtonBaseProps = {
16
+ /**
17
+ * Вариант отображения кнопки
18
+ * @default contained
19
+ * */
20
+ variant?: ButtonVariant;
21
+ /**
22
+ * Размер
23
+ * @default m
24
+ * */
25
+ size?: FormElementSizeVariant;
26
+ /**
27
+ * Цвет
28
+ * @default primary
29
+ * */
30
+ color?: ButtonColorVariant;
31
+ /** Содержимое кнопки */
32
+ children?: ReactNode;
33
+ /** Если {true} делает кнопку заблокированной */
34
+ disabled?: boolean;
35
+ /** Если {true} переводит кнопку в состояние загрузки */
36
+ loading?: boolean;
37
+ /** Дополнительные CSS-классы */
38
+ className?: string;
39
+ /** Иконка слева */
40
+ iconLeft?: ButtonIcon;
41
+ /** Иконка справа */
42
+ iconRight?: ButtonIcon;
43
+ /** Если {true} растягивает кнопку на всю ширину родительского контейнера */
44
+ fullWidth?: boolean;
45
+ /** Свойства лейбла кнопки */
46
+ labelProps?: ComponentPropsWithRef<'span'>;
47
+ };
48
+ export type ButtonProps<As extends ElementType = typeof BUTTON_DEFAULT_TAG> = PolymorphicComponentPropsWithoutRef<ButtonBaseProps, As>;
49
+ export declare const cnButton: import("@bem-react/classname").ClassNameFormatter;
50
+ export declare const Button: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<ButtonBaseProps, "button">;
51
+ export {};
@@ -0,0 +1,57 @@
1
+ import { __assign, __rest } from "tslib";
2
+ import './Button.css';
3
+ import React from 'react';
4
+ import { CSSTransition } from 'react-transition-group';
5
+ import { useThemeProps } from '../../hooks/useThemeProps';
6
+ import { cn } from '../../utils/classname';
7
+ import { getIconSizeToFormElement } from '../../utils/getIconSizeToFormElement';
8
+ import { polymorphicComponentWithRef } from '../../utils/polymorphicComponentWithRef';
9
+ import { renderContent } from '../../utils/renderContent';
10
+ import { ButtonBase } from '../ButtonBase';
11
+ import { Loader } from '../Loader';
12
+ import { BUTTON_DEFAULT_SIZE, BUTTON_DEFAULT_VARIANT, BUTTON_DEFAULT_COLOR, BUTTON_DEFAULT_TAG, } from './constants';
13
+ export var buttonVariant = [
14
+ 'contained',
15
+ 'contained-additional',
16
+ 'ghost',
17
+ 'function',
18
+ ];
19
+ export var buttonColorVariant = [
20
+ 'primary',
21
+ 'secondary',
22
+ 'tertiary',
23
+ 'error',
24
+ ];
25
+ export var cnButton = cn('ButtonNext');
26
+ export var Button = polymorphicComponentWithRef(function (inProps, ref) {
27
+ var props = useThemeProps({
28
+ props: inProps,
29
+ name: 'ButtonNext',
30
+ });
31
+ var _a = props.as, Tag = _a === void 0 ? BUTTON_DEFAULT_TAG : _a, _b = props.variant, variant = _b === void 0 ? BUTTON_DEFAULT_VARIANT : _b, _c = props.color, color = _c === void 0 ? BUTTON_DEFAULT_COLOR : _c, _d = props.size, size = _d === void 0 ? BUTTON_DEFAULT_SIZE : _d, iconLeft = props.iconLeft, iconRight = props.iconRight, loading = props.loading, children = props.children, disabled = props.disabled, className = props.className, fullWidth = props.fullWidth, labelProps = props.labelProps, onClick = props.onClick, other = __rest(props, ["as", "variant", "color", "size", "iconLeft", "iconRight", "loading", "children", "disabled", "className", "fullWidth", "labelProps", "onClick"]);
32
+ var iconSize = getIconSizeToFormElement(size);
33
+ var renderIcon = function (content) {
34
+ return renderContent({
35
+ content: content,
36
+ props: {
37
+ size: getIconSizeToFormElement(size),
38
+ },
39
+ });
40
+ };
41
+ var childContent = (React.createElement(React.Fragment, null,
42
+ React.createElement("span", { className: cnButton('Content') },
43
+ renderIcon(iconLeft),
44
+ React.createElement("span", __assign({}, labelProps, { className: cnButton('Label', [labelProps === null || labelProps === void 0 ? void 0 : labelProps.className]), ref: labelProps === null || labelProps === void 0 ? void 0 : labelProps.ref }), children),
45
+ renderIcon(iconRight)),
46
+ React.createElement(CSSTransition, { in: loading, timeout: 120, classNames: cnButton('Loader', { animation: true }), unmountOnExit: true },
47
+ React.createElement(Loader, { size: iconSize, className: cnButton('Loader') }))));
48
+ return (React.createElement(ButtonBase, __assign({ as: Tag, disabled: disabled, loading: loading, onClick: onClick, className: cnButton({
49
+ variant: variant,
50
+ size: size,
51
+ disabled: disabled,
52
+ loading: loading,
53
+ color: color,
54
+ fullWidth: fullWidth,
55
+ }, [className]) }, other, { ref: ref }), childContent));
56
+ });
57
+ Button.displayName = 'Button';
@@ -0,0 +1,4 @@
1
+ export declare const BUTTON_DEFAULT_SIZE = "m";
2
+ export declare const BUTTON_DEFAULT_VARIANT = "contained";
3
+ export declare const BUTTON_DEFAULT_COLOR = "primary";
4
+ export declare const BUTTON_DEFAULT_TAG = "button";
@@ -0,0 +1,4 @@
1
+ export var BUTTON_DEFAULT_SIZE = 'm';
2
+ export var BUTTON_DEFAULT_VARIANT = 'contained';
3
+ export var BUTTON_DEFAULT_COLOR = 'primary';
4
+ export var BUTTON_DEFAULT_TAG = 'button';
@@ -0,0 +1 @@
1
+ export * from './Button';
@@ -0,0 +1 @@
1
+ export * from './Button';
@@ -37,5 +37,8 @@ type IconButtonBaseProps = {
37
37
  };
38
38
  export type IconButtonProps<As extends ElementType = typeof ICON_BUTTON_DEFAULT_TAG> = PolymorphicComponentPropsWithoutRef<IconButtonBaseProps, As>;
39
39
  export declare const cnIconButton: import("@bem-react/classname").ClassNameFormatter;
40
+ /**
41
+ * @deprecated Компонент устарел. Для замены используйте компонент IconButtonNext
42
+ */
40
43
  export declare const IconButton: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<IconButtonBaseProps, "button">;
41
44
  export {};
@@ -1,6 +1,7 @@
1
1
  import { __assign, __rest } from "tslib";
2
2
  import './IconButton.css';
3
3
  import React, { useMemo } from 'react';
4
+ import { deprecate } from '@ozen-ui/logger';
4
5
  import { useThemeProps } from '../../hooks/useThemeProps';
5
6
  import { cn } from '../../utils/classname';
6
7
  import { getIconSizeToFormElement } from '../../utils/getIconSizeToFormElement';
@@ -24,11 +25,17 @@ var loaderSizeMapper = {
24
25
  m: 'm',
25
26
  l: 'l',
26
27
  };
28
+ /**
29
+ * @deprecated Компонент устарел. Для замены используйте компонент IconButtonNext
30
+ */
27
31
  export var IconButton = polymorphicComponentWithRef(function (inProps, ref) {
28
32
  var props = useThemeProps({
29
33
  props: inProps,
30
34
  name: 'IconButton',
31
35
  });
36
+ if (process.env.NODE_ENV !== 'production') {
37
+ deprecate('Компонент «%s» устарел. Для замены используйте компонент «%s».', 'IconButton', 'IconButtonNext');
38
+ }
32
39
  var _a = props.size, size = _a === void 0 ? ICON_BUTTON_DEFAULT_SIZE : _a, _b = props.variant, variant = _b === void 0 ? ICON_BUTTON_DEFAULT_VARIANT : _b, _c = props.color, color = _c === void 0 ? ICON_BUTTON_DEFAULT_COLOR : _c, _d = props.as, Tag = _d === void 0 ? ICON_BUTTON_DEFAULT_TAG : _d, iconColor = props.iconColor, compressed = props.compressed, loading = props.loading, disabled = props.disabled, className = props.className, icon = props.icon, onClick = props.onClick, rounded = props.rounded, other = __rest(props, ["size", "variant", "color", "as", "iconColor", "compressed", "loading", "disabled", "className", "icon", "onClick", "rounded"]);
33
40
  var isInteractionPrevented = disabled || loading;
34
41
  var handleClick = function (event) {