@ozen-ui/kit 0.37.2 → 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 +4 -4
@@ -0,0 +1,5 @@
1
+ {
2
+ "main": "../__inner__/cjs/components/ButtonBase/index.js",
3
+ "module": "../__inner__/esm/components/ButtonBase/index.js",
4
+ "types": "../__inner__/esm/components/ButtonBase/index.d.ts"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "main": "../__inner__/cjs/components/ButtonNext/index.js",
3
+ "module": "../__inner__/esm/components/ButtonNext/index.js",
4
+ "types": "../__inner__/esm/components/ButtonNext/index.d.ts"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "main": "../__inner__/cjs/components/IconButtonNext/index.js",
3
+ "module": "../__inner__/esm/components/IconButtonNext/index.js",
4
+ "types": "../__inner__/esm/components/IconButtonNext/index.d.ts"
5
+ }
@@ -13,6 +13,6 @@
13
13
  align-items: center;
14
14
  }
15
15
 
16
- .BreadcrumbItem {
16
+ .Button.BreadcrumbItem {
17
17
  color: var(--color-content-secondary);
18
18
  }
@@ -47,5 +47,8 @@ type ButtonBaseProps = {
47
47
  };
48
48
  export type ButtonProps<As extends ElementType = typeof BUTTON_DEFAULT_TAG> = PolymorphicComponentPropsWithoutRef<ButtonBaseProps, As>;
49
49
  export declare const cnButton: import("@bem-react/classname").ClassNameFormatter;
50
+ /**
51
+ * @deprecated Компонент устарел. Для замены используйте компонент ButtonNext
52
+ */
50
53
  export declare const Button: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<ButtonBaseProps, "button">;
51
54
  export {};
@@ -4,6 +4,7 @@ exports.Button = exports.cnButton = exports.buttonColorVariant = exports.buttonV
4
4
  var tslib_1 = require("tslib");
5
5
  require("./Button.css");
6
6
  var react_1 = tslib_1.__importDefault(require("react"));
7
+ var logger_1 = require("@ozen-ui/logger");
7
8
  var react_transition_group_1 = require("react-transition-group");
8
9
  var useThemeProps_1 = require("../../hooks/useThemeProps");
9
10
  var classname_1 = require("../../utils/classname");
@@ -25,13 +26,17 @@ exports.buttonColorVariant = [
25
26
  'error',
26
27
  ];
27
28
  exports.cnButton = (0, classname_1.cn)('Button');
28
- // TODO: стандартизировать стили кнопки для состояния загрузки
29
- // TODO: реализовать базовую кнопку
29
+ /**
30
+ * @deprecated Компонент устарел. Для замены используйте компонент ButtonNext
31
+ */
30
32
  exports.Button = (0, polymorphicComponentWithRef_1.polymorphicComponentWithRef)(function (inProps, ref) {
31
33
  var props = (0, useThemeProps_1.useThemeProps)({
32
34
  props: inProps,
33
35
  name: 'Button',
34
36
  });
37
+ if (process.env.NODE_ENV !== 'production') {
38
+ (0, logger_1.deprecate)('Компонент «%s» устарел. Для замены используйте компонент «%s».', 'Button', 'ButtonNext');
39
+ }
35
40
  var _a = props.as, Tag = _a === void 0 ? constants_1.BUTTON_DEFAULT_TAG : _a, _b = props.variant, variant = _b === void 0 ? constants_1.BUTTON_DEFAULT_VARIANT : _b, _c = props.color, color = _c === void 0 ? constants_1.BUTTON_DEFAULT_COLOR : _c, _d = props.size, size = _d === void 0 ? constants_1.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 = tslib_1.__rest(props, ["as", "variant", "color", "size", "iconLeft", "iconRight", "loading", "children", "disabled", "className", "fullWidth", "labelProps", "onClick"]);
36
41
  var iconSize = (0, getIconSizeToFormElement_1.getIconSizeToFormElement)(size);
37
42
  var handleClick = function (event) {
@@ -62,6 +67,6 @@ exports.Button = (0, polymorphicComponentWithRef_1.polymorphicComponentWithRef)(
62
67
  loading: loading,
63
68
  color: color,
64
69
  fullWidth: fullWidth,
65
- }, [className]) }, other, { ref: ref }), childContent));
70
+ }, [className]) }, (isInteractionPrevented && { tabIndex: -1 }), other, { ref: ref }), childContent));
66
71
  });
67
72
  exports.Button.displayName = 'Button';
@@ -0,0 +1,10 @@
1
+ .ButtonBase_unstyled {
2
+ background-color: transparent;
3
+ text-decoration: none;
4
+ cursor: pointer;
5
+ outline: 0;
6
+ border: 0;
7
+ margin: 0;
8
+ border-radius: 0;
9
+ padding: 0;
10
+ }
@@ -0,0 +1,20 @@
1
+ import './ButtonBase.css';
2
+ import type { ReactNode, ElementType } from 'react';
3
+ import type { PolymorphicComponentPropsWithoutRef } from '../../utils/polymorphicComponentWithRef';
4
+ import { BUTTON_BASE_DEFAULT_TAG } from './constants';
5
+ type ButtonBaseBaseProps = {
6
+ /** Содержимое кнопки */
7
+ children?: ReactNode;
8
+ /** Если {true} делает кнопку заблокированной */
9
+ disabled?: boolean;
10
+ /** Если {true} переводит кнопку в состояние загрузки */
11
+ loading?: boolean;
12
+ /** Дополнительные CSS-классы */
13
+ className?: string;
14
+ /** Если {true} делает кнопку не стилизованной */
15
+ unstyled?: boolean;
16
+ };
17
+ export type ButtonBaseProps<As extends ElementType = typeof BUTTON_BASE_DEFAULT_TAG> = PolymorphicComponentPropsWithoutRef<ButtonBaseBaseProps, As>;
18
+ export declare const cnButtonBase: import("@bem-react/classname").ClassNameFormatter;
19
+ export declare const ButtonBase: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<ButtonBaseBaseProps, "button">;
20
+ export {};
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ButtonBase = exports.cnButtonBase = void 0;
4
+ var tslib_1 = require("tslib");
5
+ require("./ButtonBase.css");
6
+ var react_1 = tslib_1.__importDefault(require("react"));
7
+ var useThemeProps_1 = require("../../hooks/useThemeProps");
8
+ var classname_1 = require("../../utils/classname");
9
+ var polymorphicComponentWithRef_1 = require("../../utils/polymorphicComponentWithRef");
10
+ var constants_1 = require("./constants");
11
+ exports.cnButtonBase = (0, classname_1.cn)('ButtonBase');
12
+ exports.ButtonBase = (0, polymorphicComponentWithRef_1.polymorphicComponentWithRef)(function (inProps, ref) {
13
+ var props = (0, useThemeProps_1.useThemeProps)({
14
+ props: inProps,
15
+ name: 'Button',
16
+ });
17
+ var _a = props.as, Tag = _a === void 0 ? constants_1.BUTTON_BASE_DEFAULT_TAG : _a, loading = props.loading, children = props.children, disabled = props.disabled, className = props.className, onClick = props.onClick, unstyled = props.unstyled, other = tslib_1.__rest(props, ["as", "loading", "children", "disabled", "className", "onClick", "unstyled"]);
18
+ var handleClick = function (event) {
19
+ if (onClick && !disabled && !loading) {
20
+ onClick(event);
21
+ }
22
+ };
23
+ var isInteractionPrevented = disabled || loading;
24
+ return (react_1.default.createElement(Tag, tslib_1.__assign({ disabled: isInteractionPrevented, onClick: handleClick, type: "button", className: (0, exports.cnButtonBase)({
25
+ disabled: disabled,
26
+ loading: loading,
27
+ unstyled: unstyled,
28
+ }, [className]) }, (isInteractionPrevented && { tabIndex: -1 }), other, { ref: ref }), children));
29
+ });
30
+ exports.ButtonBase.displayName = 'ButtonBase';
@@ -0,0 +1 @@
1
+ export declare const BUTTON_BASE_DEFAULT_TAG = "button";
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BUTTON_BASE_DEFAULT_TAG = void 0;
4
+ exports.BUTTON_BASE_DEFAULT_TAG = 'button';
@@ -0,0 +1 @@
1
+ export * from './ButtonBase';
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./ButtonBase"), exports);
@@ -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,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Button = exports.cnButton = exports.buttonColorVariant = exports.buttonVariant = void 0;
4
+ var tslib_1 = require("tslib");
5
+ require("./Button.css");
6
+ var react_1 = tslib_1.__importDefault(require("react"));
7
+ var react_transition_group_1 = require("react-transition-group");
8
+ var useThemeProps_1 = require("../../hooks/useThemeProps");
9
+ var classname_1 = require("../../utils/classname");
10
+ var getIconSizeToFormElement_1 = require("../../utils/getIconSizeToFormElement");
11
+ var polymorphicComponentWithRef_1 = require("../../utils/polymorphicComponentWithRef");
12
+ var renderContent_1 = require("../../utils/renderContent");
13
+ var ButtonBase_1 = require("../ButtonBase");
14
+ var Loader_1 = require("../Loader");
15
+ var constants_1 = require("./constants");
16
+ exports.buttonVariant = [
17
+ 'contained',
18
+ 'contained-additional',
19
+ 'ghost',
20
+ 'function',
21
+ ];
22
+ exports.buttonColorVariant = [
23
+ 'primary',
24
+ 'secondary',
25
+ 'tertiary',
26
+ 'error',
27
+ ];
28
+ exports.cnButton = (0, classname_1.cn)('ButtonNext');
29
+ exports.Button = (0, polymorphicComponentWithRef_1.polymorphicComponentWithRef)(function (inProps, ref) {
30
+ var props = (0, useThemeProps_1.useThemeProps)({
31
+ props: inProps,
32
+ name: 'ButtonNext',
33
+ });
34
+ var _a = props.as, Tag = _a === void 0 ? constants_1.BUTTON_DEFAULT_TAG : _a, _b = props.variant, variant = _b === void 0 ? constants_1.BUTTON_DEFAULT_VARIANT : _b, _c = props.color, color = _c === void 0 ? constants_1.BUTTON_DEFAULT_COLOR : _c, _d = props.size, size = _d === void 0 ? constants_1.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 = tslib_1.__rest(props, ["as", "variant", "color", "size", "iconLeft", "iconRight", "loading", "children", "disabled", "className", "fullWidth", "labelProps", "onClick"]);
35
+ var iconSize = (0, getIconSizeToFormElement_1.getIconSizeToFormElement)(size);
36
+ var renderIcon = function (content) {
37
+ return (0, renderContent_1.renderContent)({
38
+ content: content,
39
+ props: {
40
+ size: (0, getIconSizeToFormElement_1.getIconSizeToFormElement)(size),
41
+ },
42
+ });
43
+ };
44
+ var childContent = (react_1.default.createElement(react_1.default.Fragment, null,
45
+ react_1.default.createElement("span", { className: (0, exports.cnButton)('Content') },
46
+ renderIcon(iconLeft),
47
+ react_1.default.createElement("span", tslib_1.__assign({}, labelProps, { className: (0, exports.cnButton)('Label', [labelProps === null || labelProps === void 0 ? void 0 : labelProps.className]), ref: labelProps === null || labelProps === void 0 ? void 0 : labelProps.ref }), children),
48
+ renderIcon(iconRight)),
49
+ react_1.default.createElement(react_transition_group_1.CSSTransition, { in: loading, timeout: 120, classNames: (0, exports.cnButton)('Loader', { animation: true }), unmountOnExit: true },
50
+ react_1.default.createElement(Loader_1.Loader, { size: iconSize, className: (0, exports.cnButton)('Loader') }))));
51
+ return (react_1.default.createElement(ButtonBase_1.ButtonBase, tslib_1.__assign({ as: Tag, disabled: disabled, loading: loading, onClick: onClick, className: (0, exports.cnButton)({
52
+ variant: variant,
53
+ size: size,
54
+ disabled: disabled,
55
+ loading: loading,
56
+ color: color,
57
+ fullWidth: fullWidth,
58
+ }, [className]) }, other, { ref: ref }), childContent));
59
+ });
60
+ exports.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,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BUTTON_DEFAULT_TAG = exports.BUTTON_DEFAULT_COLOR = exports.BUTTON_DEFAULT_VARIANT = exports.BUTTON_DEFAULT_SIZE = void 0;
4
+ exports.BUTTON_DEFAULT_SIZE = 'm';
5
+ exports.BUTTON_DEFAULT_VARIANT = 'contained';
6
+ exports.BUTTON_DEFAULT_COLOR = 'primary';
7
+ exports.BUTTON_DEFAULT_TAG = 'button';
@@ -0,0 +1 @@
1
+ export * from './Button';
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./Button"), exports);
@@ -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 {};