@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,348 @@
1
+ .IconButtonNext {
2
+ --icon-button-bg-color: var(--color-background-action);
3
+ --icon-button-bg-color-hover: var(--color-background-action-hover);
4
+ --icon-button-bg-color-active: var(--color-background-action-pressed);
5
+ --icon-button-font-color: var(--color-content-action-on);
6
+ block-size: var(--icon-button-size);
7
+ inline-size: var(--icon-button-size);
8
+ padding: 0;
9
+ box-sizing: border-box;
10
+ display: inline-flex;
11
+ flex-shrink: 0;
12
+ align-items: center;
13
+ justify-content: center;
14
+ cursor: pointer;
15
+ border-radius: var(--border-radius-xs);
16
+ border: none;
17
+ color: var(--icon-button-font-color);
18
+ background-color: var(--icon-button-bg-color);
19
+ opacity: 1;
20
+ transition:
21
+ background-color var(--transition-default),
22
+ box-shadow var(--transition-default),
23
+ opacity var(--transition-default);
24
+ -webkit-tap-highlight-color: transparent;
25
+ position: relative;
26
+ }
27
+
28
+ .IconButtonNext_size_2xs {
29
+ --icon-button-size: 32px;
30
+ }
31
+
32
+ .IconButtonNext_size_2xs.IconButtonNext_compressed:not(.IconButtonNext_variant_function) {
33
+ --icon-button-size: 24px;
34
+ }
35
+
36
+ .IconButtonNext_size_xs {
37
+ --icon-button-size: 40px;
38
+ }
39
+
40
+ .IconButtonNext_size_xs.IconButtonNext_compressed:not(.IconButtonNext_variant_function) {
41
+ --icon-button-size: 28px;
42
+ }
43
+
44
+ .IconButtonNext_size_s {
45
+ --icon-button-size: 48px;
46
+ }
47
+
48
+ .IconButtonNext_size_s.IconButtonNext_compressed:not(.IconButtonNext_variant_function) {
49
+ --icon-button-size: 32px;
50
+ }
51
+
52
+ .IconButtonNext_size_m {
53
+ --icon-button-size: 56px;
54
+ }
55
+
56
+ .IconButtonNext_size_m.IconButtonNext_compressed:not(.IconButtonNext_variant_function) {
57
+ --icon-button-size: 40px;
58
+ }
59
+
60
+ .IconButtonNext_size_l {
61
+ --icon-button-size: 64px;
62
+ }
63
+
64
+ .IconButtonNext_size_l.IconButtonNext_compressed:not(.IconButtonNext_variant_function) {
65
+ --icon-button-size: 48px;
66
+ }
67
+
68
+ /** contained */
69
+
70
+ .IconButtonNext_variant_contained.IconButtonNext_color_primary {
71
+ --icon-button-bg-color: var(--color-background-action);
72
+ --icon-button-bg-color-hover: var(--color-background-action-hover);
73
+ --icon-button-bg-color-active: var(--color-background-action-pressed);
74
+ --icon-button-font-color: var(--color-content-action-on);
75
+ --icon-button-font-color-hover: var(--color-content-action-on);
76
+ --icon-button-font-color-active: var(--color-content-action-on);
77
+ --icon-button-font-color-focus: var(--color-content-action-on);
78
+ }
79
+
80
+ .IconButtonNext_variant_contained.IconButtonNext_color_secondary {
81
+ --icon-button-bg-color: var(--color-content-action-secondary);
82
+ --icon-button-bg-color-hover: var(--color-content-action-secondary-hover);
83
+ --icon-button-bg-color-active: var(
84
+ --color-content-action-secondary-pressed
85
+ );
86
+ --icon-button-font-color: var(--color-content-action-on);
87
+ --icon-button-font-color-hover: var(--color-content-action-on);
88
+ --icon-button-font-color-active: var(--color-content-action-on);
89
+ --icon-button-font-color-focus: var(--color-content-action-on);
90
+ }
91
+
92
+ .IconButtonNext_variant_contained.IconButtonNext_color_tertiary {
93
+ --icon-button-bg-color: var(--color-background-tertiary);
94
+ --icon-button-bg-color-hover: var(--color-background-tertiary-hover);
95
+ --icon-button-bg-color-active: var(--color-background-tertiary-pressed);
96
+ --icon-button-font-color: var(--color-content-primary);
97
+ --icon-button-font-color-hover: var(--color-content-primary);
98
+ --icon-button-font-color-active: var(--color-content-primary);
99
+ --icon-button-font-color-focus: var(--color-content-primary);
100
+ }
101
+
102
+ .IconButtonNext_variant_contained.IconButtonNext_color_error {
103
+ --icon-button-bg-color: var(--color-background-error);
104
+ --icon-button-bg-color-hover: var(--color-background-error-hover);
105
+ --icon-button-bg-color-active: var(--color-background-error-pressed);
106
+ --icon-button-font-color: var(--color-content-action-on);
107
+ --icon-button-font-color-hover: var(--color-content-action-on);
108
+ --icon-button-font-color-active: var(--color-content-action-on);
109
+ --icon-button-font-color-focus: var(--color-content-action-on);
110
+ }
111
+
112
+ /** contained-additional */
113
+
114
+ .IconButtonNext_variant_contained-additional.IconButtonNext_color_primary {
115
+ --icon-button-bg-color: var(--color-background-action-light);
116
+ --icon-button-bg-color-hover: var(--color-background-action-light-hover);
117
+ --icon-button-bg-color-active: var(--color-background-action-light-pressed);
118
+ --icon-button-font-color: var(--color-content-action);
119
+ --icon-button-font-color-hover: var(--color-content-action);
120
+ --icon-button-font-color-active: var(--color-content-action);
121
+ --icon-button-font-color-focus: var(--color-content-action);
122
+ }
123
+
124
+ .IconButtonNext_variant_contained-additional.IconButtonNext_color_secondary {
125
+ --icon-button-bg-color: var(--color-background-secondary);
126
+ --icon-button-bg-color-hover: var(--color-background-secondary-hover);
127
+ --icon-button-bg-color-active: var(--color-background-secondary-pressed);
128
+ --icon-button-font-color: var(--color-content-primary);
129
+ --icon-button-font-color-hover: var(--color-content-primary);
130
+ --icon-button-font-color-active: var(--color-content-primary);
131
+ --icon-button-font-color-focus: var(--color-content-primary);
132
+ }
133
+
134
+ .IconButtonNext_variant_contained-additional.IconButtonNext_color_tertiary {
135
+ --icon-button-bg-color: var(--color-background-primary);
136
+ --icon-button-bg-color-hover: var(--color-background-primary-hover);
137
+ --icon-button-bg-color-active: var(--color-background-primary-pressed);
138
+ --icon-button-font-color: var(--color-content-secondary);
139
+ --icon-button-font-color-hover: var(--color-content-secondary);
140
+ --icon-button-font-color-active: var(--color-content-secondary);
141
+ --icon-button-font-color-focus: var(--color-content-secondary);
142
+ }
143
+
144
+ .IconButtonNext_variant_contained-additional.IconButtonNext_color_error {
145
+ --icon-button-bg-color: var(--color-background-error-light);
146
+ --icon-button-bg-color-hover: var(--color-background-error-light-hover);
147
+ --icon-button-bg-color-active: var(--color-background-error-light-pressed);
148
+ --icon-button-font-color: var(--color-content-error);
149
+ --icon-button-font-color-hover: var(--color-content-error);
150
+ --icon-button-font-color-active: var(--color-content-error);
151
+ --icon-button-font-color-focus: var(--color-content-error);
152
+ }
153
+
154
+ /** ghost */
155
+
156
+ .IconButtonNext_variant_ghost.IconButtonNext_color_primary {
157
+ --icon-button-bg-color: transparent;
158
+ --icon-button-bg-color-hover: var(--color-background-action-light-hover);
159
+ --icon-button-bg-color-active: var(--color-background-action-light-pressed);
160
+ --icon-button-font-color: var(--color-content-action);
161
+ --icon-button-font-color-hover: var(--color-content-action);
162
+ --icon-button-font-color-active: var(--color-content-action);
163
+ --icon-button-font-color-focus: var(--color-content-action);
164
+ }
165
+
166
+ .IconButtonNext_variant_ghost.IconButtonNext_color_secondary {
167
+ --icon-button-bg-color: transparent;
168
+ --icon-button-bg-color-hover: var(--color-background-secondary-hover);
169
+ --icon-button-bg-color-active: var(--color-background-secondary-pressed);
170
+ --icon-button-font-color: var(--color-content-primary);
171
+ --icon-button-font-color-hover: var(--color-content-primary);
172
+ --icon-button-font-color-active: var(--color-content-primary);
173
+ --icon-button-font-color-focus: var(--color-content-primary);
174
+ }
175
+
176
+ .IconButtonNext_variant_ghost.IconButtonNext_color_tertiary {
177
+ --icon-button-bg-color: transparent;
178
+ --icon-button-bg-color-hover: var(--color-background-primary-hover);
179
+ --icon-button-bg-color-active: var(--color-background-primary-pressed);
180
+ --icon-button-font-color: var(--color-content-secondary);
181
+ --icon-button-font-color-hover: var(--color-content-secondary);
182
+ --icon-button-font-color-active: var(--color-content-secondary);
183
+ --icon-button-font-color-focus: var(--color-content-secondary);
184
+ }
185
+
186
+ .IconButtonNext_variant_ghost.IconButtonNext_color_error {
187
+ --icon-button-bg-color: transparent;
188
+ --icon-button-bg-color-hover: var(--color-background-error-light-hover);
189
+ --icon-button-bg-color-active: var(--color-background-error-light-pressed);
190
+ --icon-button-font-color: var(--color-content-error);
191
+ --icon-button-font-color-hover: var(--color-content-error);
192
+ --icon-button-font-color-active: var(--color-content-error);
193
+ --icon-button-font-color-focus: var(--color-content-error);
194
+ }
195
+
196
+ /** function */
197
+
198
+ .IconButtonNext_variant_function {
199
+ --icon-button-size: auto;
200
+ }
201
+
202
+ .IconButtonNext_variant_function.IconButtonNext_color_primary,
203
+ .IconButtonNext_variant_function.IconButtonNext_color_secondary,
204
+ .IconButtonNext_variant_function.IconButtonNext_color_tertiary,
205
+ .IconButtonNext_variant_function.IconButtonNext_color_error {
206
+ --icon-button-bg-color: transparent;
207
+ --icon-button-bg-color-hover: transparent;
208
+ --icon-button-bg-color-active: transparent;
209
+ }
210
+
211
+ .IconButtonNext_variant_function.IconButtonNext_color_primary {
212
+ --icon-button-font-color: var(--color-content-action);
213
+ --icon-button-font-color-hover: var(--color-background-action-hover);
214
+ --icon-button-font-color-active: var(--color-background-action-pressed);
215
+ --icon-button-font-color-focus: var(--color-background-action-pressed);
216
+ }
217
+
218
+ .IconButtonNext_variant_function.IconButtonNext_color_secondary {
219
+ --icon-button-font-color: var(--color-content-action-secondary);
220
+ --icon-button-font-color-hover: var(--color-content-action-secondary-hover);
221
+ --icon-button-font-color-active: var(
222
+ --color-content-action-secondary-pressed
223
+ );
224
+ --icon-button-font-color-focus: var(
225
+ --color-content-action-secondary-pressed
226
+ );
227
+ }
228
+
229
+ .IconButtonNext_variant_function.IconButtonNext_color_tertiary {
230
+ --icon-button-font-color: var(--color-content-secondary);
231
+ --icon-button-font-color-hover: var(--color-content-secondary);
232
+ --icon-button-font-color-active: var(--color-content-secondary);
233
+ --icon-button-font-color-focus: var(--color-content-secondary);
234
+ }
235
+
236
+ .IconButtonNext_variant_function.IconButtonNext_color_error {
237
+ --icon-button-font-color: var(--color-content-error);
238
+ --icon-button-font-color-hover: var(--color-content-error-hover);
239
+ --icon-button-font-color-active: var(--color-content-error-pressed);
240
+ --icon-button-font-color-focus: var(--color-content-error-pressed);
241
+ }
242
+
243
+ /** floating */
244
+
245
+ .IconButtonNext_variant_floating {
246
+ --icon-button-bg-color: var(--color-background-main);
247
+ --icon-button-bg-color-hover: var(--color-background-main-hover);
248
+ --icon-button-bg-color-active: var(--color-background-main-pressed);
249
+ --icon-button-font-color: var(--color-content-primary);
250
+ --icon-button-font-color-active: var(--color-content-primary);
251
+ --icon-button-font-color-focus: var(--color-content-primary);
252
+ }
253
+
254
+ .IconButtonNext_variant_floating::after {
255
+ content: '';
256
+ inset: 0;
257
+ position: absolute;
258
+ inline-size: 100%;
259
+ border-radius: inherit;
260
+ box-shadow: 0 8px 32px rgb(0 0 0 / 8%);
261
+ }
262
+
263
+ /** rounded */
264
+
265
+ .IconButtonNext_variant_contained.IconButtonNext_rounded,
266
+ .IconButtonNext_variant_contained-additional.IconButtonNext_rounded,
267
+ .IconButtonNext_variant_ghost.IconButtonNext_rounded,
268
+ .IconButtonNext_variant_floating.IconButtonNext_rounded {
269
+ border-radius: 50%;
270
+ }
271
+
272
+ /** disabled */
273
+
274
+ .IconButtonNext_variant_contained.IconButtonNext_disabled,
275
+ .IconButtonNext_variant_contained.IconButtonNext_loading,
276
+ .IconButtonNext_variant_contained-additional.IconButtonNext_disabled,
277
+ .IconButtonNext_variant_contained-additional.IconButtonNext_loading,
278
+ .IconButtonNext_variant_ghost.IconButtonNext_disabled,
279
+ .IconButtonNext_variant_ghost.IconButtonNext_loading,
280
+ .IconButtonNext_variant_function.IconButtonNext_disabled,
281
+ .IconButtonNext_variant_function.IconButtonNext_loading,
282
+ .IconButtonNext_variant_floating.IconButtonNext_disabled,
283
+ .IconButtonNext_variant_floating.IconButtonNext_loading {
284
+ --icon-button-font-color: var(--color-content-disabled);
285
+ }
286
+
287
+ .IconButtonNext_variant_contained.IconButtonNext_disabled svg, .IconButtonNext_variant_contained.IconButtonNext_loading svg, .IconButtonNext_variant_contained-additional.IconButtonNext_disabled svg, .IconButtonNext_variant_contained-additional.IconButtonNext_loading svg, .IconButtonNext_variant_ghost.IconButtonNext_disabled svg, .IconButtonNext_variant_ghost.IconButtonNext_loading svg, .IconButtonNext_variant_function.IconButtonNext_disabled svg, .IconButtonNext_variant_function.IconButtonNext_loading svg, .IconButtonNext_variant_floating.IconButtonNext_disabled svg, .IconButtonNext_variant_floating.IconButtonNext_loading svg {
288
+ color: currentcolor;
289
+ }
290
+
291
+ .IconButtonNext_variant_contained.IconButtonNext_disabled,
292
+ .IconButtonNext_variant_contained.IconButtonNext_loading,
293
+ .IconButtonNext_variant_contained-additional.IconButtonNext_disabled,
294
+ .IconButtonNext_variant_contained-additional.IconButtonNext_loading,
295
+ .IconButtonNext_variant_floating.IconButtonNext_disabled,
296
+ .IconButtonNext_variant_floating.IconButtonNext_loading {
297
+ --icon-button-bg-color: var(--color-background-disabled);
298
+ --icon-button-bg-color-hover: var(--color-background-disabled);
299
+ --icon-button-bg-color-active: var(--color-background-disabled);
300
+ }
301
+
302
+ .IconButtonNext_variant_ghost.IconButtonNext_disabled,
303
+ .IconButtonNext_variant_ghost.IconButtonNext_loading,
304
+ .IconButtonNext_variant_function.IconButtonNext_disabled,
305
+ .IconButtonNext_variant_function.IconButtonNext_loading {
306
+ --icon-button-bg-color: transparent;
307
+ --icon-button-bg-color-hover: transparent;
308
+ --icon-button-bg-color-active: transparent;
309
+ }
310
+
311
+ /** focus */
312
+
313
+ .IconButtonNext:focus:not(:focus-visible, :active, :hover) {
314
+ box-shadow: none;
315
+ color: var(--icon-button-font-color);
316
+ }
317
+
318
+ .IconButtonNext:focus {
319
+ outline: 0;
320
+
321
+ /* the bug in outline property before chrome version 94 – doesn't repeat radius of an element */
322
+ box-shadow: var(--shadow-outline-focused);
323
+ color: var(--icon-button-font-color-focus);
324
+ }
325
+
326
+ .IconButtonNext:focus:not(:focus-visible) {
327
+ box-shadow: none;
328
+ }
329
+
330
+ /** hover */
331
+
332
+ .IconButtonNext:hover {
333
+ background-color: var(--icon-button-bg-color-hover);
334
+ color: var(--icon-button-font-color-hover);
335
+ }
336
+
337
+ /** active */
338
+
339
+ .IconButtonNext:active {
340
+ background-color: var(--icon-button-bg-color-active);
341
+ color: var(--icon-button-font-color-active);
342
+ }
343
+
344
+ .IconButtonNext_disabled,
345
+ .IconButtonNext_loading {
346
+ pointer-events: none;
347
+ cursor: auto;
348
+ }
@@ -0,0 +1,41 @@
1
+ import './IconButton.css';
2
+ import type { ElementType } from 'react';
3
+ import type { IconSize, IconProps } 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 { ICON_BUTTON_DEFAULT_TAG } from './constants';
8
+ export declare const iconButtonColorVariant: readonly ["primary", "secondary", "tertiary", "error"];
9
+ export declare const iconButtonVariant: readonly ["contained", "contained-additional", "ghost", "function", "floating"];
10
+ export type IconButtonVariant = (typeof iconButtonVariant)[number];
11
+ export type IconButtonColorVariant = (typeof iconButtonColorVariant)[number];
12
+ export type IconButtonIcon = RenderContentType<IconProps & {
13
+ size?: IconSize;
14
+ }>['content'];
15
+ type IconButtonBaseProps = {
16
+ /** Иконка */
17
+ icon: IconButtonIcon;
18
+ /** Вариант представления компонента */
19
+ variant?: IconButtonVariant;
20
+ /** Размер */
21
+ size?: FormElementSizeVariant;
22
+ /** Основной цвет компонента */
23
+ color?: IconButtonColorVariant;
24
+ /** Цвет иконки кнопки */
25
+ iconColor?: string;
26
+ /** Если {true} уменьшает размер компонента */
27
+ compressed?: boolean;
28
+ /** Если {true} делает компонент заблокированным */
29
+ disabled?: boolean;
30
+ /** Если {true} переводит компонент в состояние загрузки */
31
+ loading?: boolean;
32
+ /** Дополнительные CSS-классы */
33
+ className?: string;
34
+ /** Если {true} делает компонент круглым */
35
+ rounded?: boolean;
36
+ children?: never;
37
+ };
38
+ export type IconButtonProps<As extends ElementType = typeof ICON_BUTTON_DEFAULT_TAG> = PolymorphicComponentPropsWithoutRef<IconButtonBaseProps, As>;
39
+ export declare const cnIconButton: import("@bem-react/classname").ClassNameFormatter;
40
+ export declare const IconButton: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<IconButtonBaseProps, "button">;
41
+ export {};
@@ -0,0 +1,67 @@
1
+ import { __assign, __rest } from "tslib";
2
+ import './IconButton.css';
3
+ import React, { useMemo } from 'react';
4
+ import { useThemeProps } from '../../hooks/useThemeProps';
5
+ import { cn } from '../../utils/classname';
6
+ import { getIconSizeToFormElement } from '../../utils/getIconSizeToFormElement';
7
+ import { polymorphicComponentWithRef } from '../../utils/polymorphicComponentWithRef';
8
+ import { renderContent } from '../../utils/renderContent';
9
+ import { ButtonBase } from '../ButtonBase';
10
+ import { Loader } from '../Loader';
11
+ import { ICON_BUTTON_DEFAULT_SIZE, ICON_BUTTON_DEFAULT_VARIANT, ICON_BUTTON_DEFAULT_COLOR, ICON_BUTTON_DEFAULT_TAG, } from './constants';
12
+ export var iconButtonColorVariant = [
13
+ 'primary',
14
+ 'secondary',
15
+ 'tertiary',
16
+ 'error',
17
+ ];
18
+ export var iconButtonVariant = [
19
+ 'contained',
20
+ 'contained-additional',
21
+ 'ghost',
22
+ 'function',
23
+ 'floating',
24
+ ];
25
+ export var cnIconButton = cn('IconButtonNext');
26
+ var loaderSizeMapper = {
27
+ '2xs': 's',
28
+ xs: 's',
29
+ s: 's',
30
+ m: 'm',
31
+ l: 'l',
32
+ };
33
+ export var IconButton = polymorphicComponentWithRef(function (inProps, ref) {
34
+ var props = useThemeProps({
35
+ props: inProps,
36
+ name: 'IconButtonNext',
37
+ });
38
+ 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"]);
39
+ var renderIcon = function (content) {
40
+ return renderContent({
41
+ content: content,
42
+ props: {
43
+ size: getIconSizeToFormElement(size),
44
+ color: iconColor,
45
+ },
46
+ });
47
+ };
48
+ var resolvedChildren = useMemo(function () {
49
+ if (loading) {
50
+ return (React.createElement(Loader, { className: cnIconButton('Loader'), color: "var(--color-content-disabled)", size: loaderSizeMapper[size] }));
51
+ }
52
+ if (icon) {
53
+ return renderIcon(icon);
54
+ }
55
+ return null;
56
+ }, [loading, size, iconColor, icon, renderIcon]);
57
+ return (React.createElement(ButtonBase, __assign({ as: Tag, disabled: disabled, loading: loading, onClick: onClick, className: cnIconButton({
58
+ variant: variant,
59
+ size: size,
60
+ color: color,
61
+ disabled: disabled,
62
+ loading: loading,
63
+ compressed: compressed,
64
+ rounded: rounded,
65
+ }, [className]) }, other, { ref: ref }), resolvedChildren));
66
+ });
67
+ IconButton.displayName = 'IconButton';
@@ -0,0 +1,4 @@
1
+ export declare const ICON_BUTTON_DEFAULT_SIZE = "m";
2
+ export declare const ICON_BUTTON_DEFAULT_VARIANT = "ghost";
3
+ export declare const ICON_BUTTON_DEFAULT_COLOR = "secondary";
4
+ export declare const ICON_BUTTON_DEFAULT_TAG = "button";
@@ -0,0 +1,4 @@
1
+ export var ICON_BUTTON_DEFAULT_SIZE = 'm';
2
+ export var ICON_BUTTON_DEFAULT_VARIANT = 'ghost';
3
+ export var ICON_BUTTON_DEFAULT_COLOR = 'secondary';
4
+ export var ICON_BUTTON_DEFAULT_TAG = 'button';
@@ -0,0 +1 @@
1
+ export * from './IconButton';
@@ -0,0 +1 @@
1
+ export * from './IconButton';
@@ -5,6 +5,7 @@ import type { AvatarProps } from '../Avatar';
5
5
  import type { BackdropProps } from '../Backdrop';
6
6
  import type { BadgeProps } from '../Badge';
7
7
  import type { ButtonProps } from '../Button';
8
+ import type { ButtonProps as ButtonPropsNext } from '../ButtonNext';
8
9
  import type { CardProps } from '../Card';
9
10
  import type { CheckboxProps } from '../Checkbox';
10
11
  import type { CheckboxGroupProps } from '../CheckboxGroup';
@@ -23,6 +24,7 @@ import type { FormGroupProps } from '../FormGroup';
23
24
  import type { FormTitleProps } from '../FormTitle';
24
25
  import type { GridProps, GridItemProps } from '../Grid';
25
26
  import type { IconButtonProps } from '../IconButton';
27
+ import type { IconButtonProps as IconButtonPropsNext } from '../IconButtonNext';
26
28
  import type { IndicatorProps } from '../Indicator';
27
29
  import type { InputProps } from '../Input';
28
30
  import type { InputNumberProps } from '../InputNumber';
@@ -72,6 +74,7 @@ export type Theme = {
72
74
  Backdrop?: Partial<BackdropProps>;
73
75
  Badge?: Partial<BadgeProps>;
74
76
  Button?: Partial<ButtonProps>;
77
+ ButtonNext?: Partial<ButtonPropsNext>;
75
78
  Card?: Partial<CardProps>;
76
79
  Checkbox?: Partial<CheckboxProps>;
77
80
  CheckboxGroup?: Partial<CheckboxGroupProps>;
@@ -91,6 +94,7 @@ export type Theme = {
91
94
  Grid?: Partial<GridProps>;
92
95
  GridItem?: Partial<GridItemProps>;
93
96
  IconButton?: Partial<IconButtonProps>;
97
+ IconButtonNext?: Partial<IconButtonPropsNext>;
94
98
  Indicator?: Partial<IndicatorProps>;
95
99
  Input?: Partial<InputProps>;
96
100
  InputNumber?: Partial<InputNumberProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ozen-ui/kit",
3
- "version": "0.37.1",
3
+ "version": "0.38.0",
4
4
  "description": "React component library",
5
5
  "files": [
6
6
  "*"
@@ -21,20 +21,17 @@
21
21
  "dependencies": {
22
22
  "@bem-react/classname": "^1.6.0",
23
23
  "@bem-react/classnames": "^1.3.10",
24
- "@ozen-ui/fonts": "latest",
25
- "@ozen-ui/icons": "latest",
26
- "@ozen-ui/logger": "latest",
27
24
  "@popperjs/core": "^2.11.8",
28
25
  "decimal.js": "^10.4.3",
29
26
  "react-is": "^18.2.0",
30
27
  "react-popper": "^2.3.0",
31
28
  "react-transition-group": "^4.4.5",
32
- "tslib": "^2.6.2"
29
+ "tslib": "^2.6.2",
30
+ "@ozen-ui/icons": "0.38.0",
31
+ "@ozen-ui/fonts": "0.38.0",
32
+ "@ozen-ui/logger": "0.38.0"
33
33
  },
34
34
  "peerDependencies": {
35
- "@ozen-ui/fonts": "latest",
36
- "@ozen-ui/icons": "latest",
37
- "@ozen-ui/logger": "latest",
38
35
  "react": ">=17.0.2 <19.0.0",
39
36
  "react-dom": ">=17.0.2 <19.0.0"
40
37
  }