@true-engineering/true-react-common-ui-kit 3.9.2 → 3.10.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 (48) hide show
  1. package/README.md +12 -0
  2. package/dist/components/Button/constants.d.ts +1 -0
  3. package/dist/components/Button/types.d.ts +2 -2
  4. package/dist/components/CloseButton/CloseButton.d.ts +1 -0
  5. package/dist/components/CloseButton/CloseButton.stories.d.ts +5 -0
  6. package/dist/components/IconButton/IconButton.d.ts +19 -0
  7. package/dist/components/IconButton/IconButton.stories.d.ts +6 -0
  8. package/dist/components/IconButton/IconButton.styles.d.ts +3 -0
  9. package/dist/components/IconButton/constants.d.ts +2 -0
  10. package/dist/components/IconButton/index.d.ts +3 -0
  11. package/dist/components/IconButton/types.d.ts +5 -0
  12. package/dist/components/Modal/Modal.styles.d.ts +3 -2
  13. package/dist/components/TextButton/TextButton.d.ts +6 -5
  14. package/dist/components/TextButton/TextButton.stories.d.ts +2 -1
  15. package/dist/components/TextButton/constants.d.ts +2 -0
  16. package/dist/components/TextButton/index.d.ts +1 -1
  17. package/dist/components/TextButton/types.d.ts +5 -0
  18. package/dist/components/Toaster/Toaster.styles.d.ts +2 -2
  19. package/dist/components/index.d.ts +1 -0
  20. package/dist/theme/types.d.ts +2 -1
  21. package/dist/true-react-common-ui-kit.js +667 -459
  22. package/dist/true-react-common-ui-kit.js.map +1 -1
  23. package/dist/true-react-common-ui-kit.umd.cjs +667 -459
  24. package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
  25. package/package.json +1 -1
  26. package/src/components/Button/Button.stories.tsx +3 -5
  27. package/src/components/Button/constants.ts +2 -0
  28. package/src/components/Button/types.ts +2 -2
  29. package/src/components/CloseButton/CloseButton.stories.tsx +11 -0
  30. package/src/components/CloseButton/CloseButton.tsx +1 -0
  31. package/src/components/IconButton/IconButton.stories.tsx +32 -0
  32. package/src/components/IconButton/IconButton.styles.ts +88 -0
  33. package/src/components/IconButton/IconButton.tsx +74 -0
  34. package/src/components/IconButton/constants.ts +3 -0
  35. package/src/components/IconButton/index.ts +3 -0
  36. package/src/components/IconButton/types.ts +11 -0
  37. package/src/components/Modal/Modal.styles.ts +17 -2
  38. package/src/components/Modal/Modal.tsx +7 -4
  39. package/src/components/Select/CustomSelect.stories.tsx +1 -1
  40. package/src/components/TextButton/TextButton.stories.tsx +3 -2
  41. package/src/components/TextButton/TextButton.tsx +72 -65
  42. package/src/components/TextButton/constants.ts +3 -0
  43. package/src/components/TextButton/index.ts +1 -2
  44. package/src/components/TextButton/types.ts +11 -0
  45. package/src/components/Toaster/Toaster.styles.ts +2 -2
  46. package/src/components/Toaster/Toaster.tsx +5 -4
  47. package/src/components/index.ts +1 -0
  48. package/src/theme/types.ts +8 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@true-engineering/true-react-common-ui-kit",
3
- "version": "3.9.2",
3
+ "version": "3.10.0",
4
4
  "description": "True Engineering React UI Kit with theming support",
5
5
  "author": "True Engineering (https://trueengineering.ru)",
6
6
  "keywords": [
@@ -2,9 +2,7 @@ import { ComponentStory, ComponentMeta } from '@storybook/react';
2
2
  import { IIconType, iconsList } from '../Icon';
3
3
  import { complexIcons } from '../Icon/complexIcons';
4
4
  import { Button, IButtonProps } from './Button';
5
- import { BUTTON_VIEWS } from './constants';
6
-
7
- const sizeTypes: Array<IButtonProps['size']> = ['s', 'm', 'l', 'xl'];
5
+ import { BUTTON_SIZES, BUTTON_VIEWS } from './constants';
8
6
 
9
7
  const iconTypes = [
10
8
  undefined,
@@ -31,9 +29,9 @@ export default {
31
29
  isFullWidth: false,
32
30
  },
33
31
  argTypes: {
34
- view: { options: BUTTON_VIEWS, control: 'inline-radio' },
35
32
  icon: { options: iconTypes, control: 'select' },
36
- size: { options: sizeTypes, control: 'inline-radio' },
33
+ size: { options: BUTTON_SIZES, control: 'inline-radio' },
34
+ view: { options: BUTTON_VIEWS, control: 'inline-radio' },
37
35
  iconPosition: { options: ['left', 'right'], control: 'inline-radio' },
38
36
  preloaderType: { options: preloaderTypes, control: 'inline-radio' },
39
37
  },
@@ -1,3 +1,5 @@
1
+ export const BUTTON_SIZES = ['s', 'm', 'l', 'xl'] as const;
2
+
1
3
  export const BUTTON_VIEWS = [
2
4
  'primary',
3
5
  'secondary',
@@ -1,5 +1,5 @@
1
- import { BUTTON_VIEWS } from './constants';
1
+ import { BUTTON_SIZES, BUTTON_VIEWS } from './constants';
2
2
 
3
- export type IButtonSize = 's' | 'm' | 'l' | 'xl';
3
+ export type IButtonSize = (typeof BUTTON_SIZES)[number];
4
4
 
5
5
  export type IButtonView = (typeof BUTTON_VIEWS)[number];
@@ -0,0 +1,11 @@
1
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
2
+ import { CloseButton } from './CloseButton';
3
+
4
+ export default {
5
+ title: 'Buttons/CloseButton',
6
+ component: CloseButton,
7
+ args: {},
8
+ argTypes: {},
9
+ } as ComponentMeta<typeof CloseButton>;
10
+
11
+ export const Default: ComponentStory<typeof CloseButton> = (args) => <CloseButton {...args} />;
@@ -11,6 +11,7 @@ export interface ICloseButtonProps extends ICommonProps<ICloseButtonStyles> {
11
11
  onClose?: () => void;
12
12
  }
13
13
 
14
+ /** @deprecated */
14
15
  export const CloseButton: FC<ICloseButtonProps> = ({
15
16
  tweakStyles,
16
17
  testId,
@@ -0,0 +1,32 @@
1
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
2
+ import { IIconType, iconsList } from '../Icon';
3
+ import { complexIcons } from '../Icon/complexIcons';
4
+ import { IconButton } from './IconButton';
5
+ import { ICON_BUTTON_SIZES, ICON_BUTTON_VIEWS } from './constants';
6
+
7
+ const iconTypes = [...Object.keys(iconsList), ...Object.keys(complexIcons)] as IIconType[];
8
+
9
+ export default {
10
+ title: 'Buttons/IconButton',
11
+ component: IconButton,
12
+ args: {
13
+ icon: iconTypes[0],
14
+ view: 'main',
15
+ size: 'm',
16
+ isDisabled: false,
17
+ isLoading: false,
18
+ isActive: false,
19
+ },
20
+ argTypes: {
21
+ icon: { options: iconTypes, control: 'select' },
22
+ size: { options: ICON_BUTTON_SIZES, control: 'inline-radio' },
23
+ view: { options: ICON_BUTTON_VIEWS, control: 'inline-radio' },
24
+ },
25
+ parameters: {
26
+ controls: {
27
+ exclude: ['tweakStyles', 'testId', 'data'],
28
+ },
29
+ },
30
+ } as ComponentMeta<typeof IconButton>;
31
+
32
+ export const Default: ComponentStory<typeof IconButton> = (args) => <IconButton {...args} />;
@@ -0,0 +1,88 @@
1
+ import { ITweakStyles, createThemedStyles } from '../../theme';
2
+
3
+ const BUTTON_SIZE_S = 24;
4
+ const BUTTON_SIZE_M = 32;
5
+ const ICON_SIZE = 20;
6
+
7
+ export const useStyles = createThemedStyles('IconButton', {
8
+ root: {
9
+ display: 'flex',
10
+ justifyContent: 'center',
11
+ alignItems: 'center',
12
+ cursor: 'pointer',
13
+ outline: 'none',
14
+ boxSizing: 'border-box',
15
+ transition: '0.25s ease-in-out',
16
+ transitionProperty: 'background-color, color, border-color',
17
+ border: 'none',
18
+ position: 'relative',
19
+ boxShadow: 'none',
20
+ borderRadius: '50%',
21
+ background: 'none',
22
+ padding: 0,
23
+ flexShrink: 0,
24
+
25
+ '&:disabled': {
26
+ extend: 'disabled',
27
+ },
28
+
29
+ '&:active': {
30
+ extend: 'active',
31
+ },
32
+ },
33
+
34
+ 'cancel-light': {},
35
+
36
+ cancel: {},
37
+
38
+ main: {},
39
+
40
+ custom: {},
41
+
42
+ active: {},
43
+
44
+ disabled: {
45
+ cursor: 'not-allowed',
46
+ pointerEvents: 'none',
47
+ },
48
+
49
+ loading: {
50
+ '& $content': {
51
+ visibility: 'hidden',
52
+ },
53
+
54
+ '& $loader': {
55
+ display: 'block',
56
+ },
57
+ },
58
+
59
+ icon: {
60
+ display: 'flex',
61
+ alignItems: 'center',
62
+ width: ICON_SIZE,
63
+ height: ICON_SIZE,
64
+ },
65
+
66
+ loader: {
67
+ display: 'none',
68
+ position: 'absolute',
69
+ left: '50%',
70
+ top: '50%',
71
+ transform: 'translate(-50%, -50%)',
72
+
73
+ width: ICON_SIZE,
74
+ height: ICON_SIZE,
75
+ },
76
+
77
+ s: {
78
+ width: BUTTON_SIZE_S,
79
+ height: BUTTON_SIZE_S,
80
+ },
81
+
82
+ m: {
83
+ width: BUTTON_SIZE_M,
84
+ height: BUTTON_SIZE_M,
85
+ },
86
+ });
87
+
88
+ export type IIconButtonStyles = ITweakStyles<typeof useStyles>;
@@ -0,0 +1,74 @@
1
+ import { forwardRef } from 'react';
2
+ import clsx from 'clsx';
3
+ import { addDataTestId } from '@true-engineering/true-react-platform-helpers';
4
+ import { addDataAttributes } from '../../helpers';
5
+ import { ICommonProps } from '../../types';
6
+ import { renderIcon, IIcon } from '../Icon';
7
+ import { ThemedPreloader } from '../ThemedPreloader';
8
+ import { IIconButtonSize, IIconButtonView, IIconButtonHTMLBaseProps } from './types';
9
+ import { useStyles, IIconButtonStyles } from './IconButton.styles';
10
+
11
+ export interface IIconButtonProps
12
+ extends IIconButtonHTMLBaseProps,
13
+ ICommonProps<IIconButtonStyles> {
14
+ icon: IIcon;
15
+ /** @default 'm' */
16
+ size?: IIconButtonSize;
17
+ /** @default 'cancel-light' */
18
+ view?: IIconButtonView;
19
+ /** @default false */
20
+ isDisabled?: boolean;
21
+ /** @default false */
22
+ isActive?: boolean;
23
+ /** @default false */
24
+ isLoading?: boolean;
25
+ }
26
+
27
+ export const IconButton = forwardRef<HTMLButtonElement, IIconButtonProps>(
28
+ (
29
+ {
30
+ icon,
31
+ size = 'm',
32
+ view = 'cancel-light',
33
+ isDisabled = false,
34
+ isActive = false,
35
+ isLoading = false,
36
+ type = 'button',
37
+ testId,
38
+ tweakStyles,
39
+ data,
40
+ onClick,
41
+ ...restProps
42
+ },
43
+ ref,
44
+ ) => {
45
+ const classes = useStyles({ theme: tweakStyles });
46
+
47
+ const hasNoAction = isDisabled || isLoading;
48
+
49
+ return (
50
+ <button
51
+ ref={ref}
52
+ className={clsx(classes.root, classes[view], classes[size], {
53
+ [classes.disabled]: isDisabled,
54
+ [classes.active]: isActive,
55
+ [classes.loading]: isLoading,
56
+ })}
57
+ type={type}
58
+ disabled={isDisabled}
59
+ onClick={hasNoAction ? undefined : onClick}
60
+ {...restProps}
61
+ {...addDataTestId(testId)}
62
+ {...addDataAttributes(data)}
63
+ >
64
+ {isLoading ? (
65
+ <span className={classes.loader}>
66
+ <ThemedPreloader type="default" useCurrentColor />
67
+ </span>
68
+ ) : (
69
+ <span className={classes.icon}>{renderIcon(icon)}</span>
70
+ )}
71
+ </button>
72
+ );
73
+ },
74
+ );
@@ -0,0 +1,3 @@
1
+ export const ICON_BUTTON_SIZES = ['s', 'm'] as const;
2
+
3
+ export const ICON_BUTTON_VIEWS = ['cancel', 'cancel-light', 'main', 'custom'] as const;
@@ -0,0 +1,3 @@
1
+ export * from './IconButton';
2
+ export * from './types';
3
+ export type { IIconButtonStyles } from './IconButton.styles';
@@ -0,0 +1,11 @@
1
+ import { ButtonHTMLAttributes } from 'react';
2
+ import { ICON_BUTTON_SIZES, ICON_BUTTON_VIEWS } from './constants';
3
+
4
+ export type IIconButtonSize = (typeof ICON_BUTTON_SIZES)[number];
5
+
6
+ export type IIconButtonView = (typeof ICON_BUTTON_VIEWS)[number];
7
+
8
+ export type IIconButtonHTMLBaseProps = Omit<
9
+ ButtonHTMLAttributes<HTMLButtonElement>,
10
+ 'disabled' | 'style' | 'className'
11
+ >;
@@ -1,6 +1,6 @@
1
1
  import { rgba } from '../../helpers';
2
2
  import { colors, dimensions, ITweakStyles, createThemedStyles } from '../../theme';
3
- import { ICloseButtonStyles } from '../CloseButton';
3
+ import { IIconButtonStyles } from '../IconButton';
4
4
 
5
5
  const VERTICAL_OVERLAY_PADDING = 50;
6
6
 
@@ -8,6 +8,9 @@ const MODAL_HORIZONTAL_PADDING_L = 40;
8
8
  const MODAL_HORIZONTAL_PADDING_M = 36;
9
9
  const MODAL_HORIZONTAL_PADDING_S = 26;
10
10
 
11
+ const MODAL_CLOSE_BUTTON_SIZE = 40;
12
+ const MODAL_CLOSE_BUTTON_ICON_SIZE = 30;
13
+
11
14
  export const useStyles = createThemedStyles('Modal', {
12
15
  root: {},
13
16
 
@@ -300,4 +303,16 @@ export const useStyles = createThemedStyles('Modal', {
300
303
  'modal-exit-active': { extend: 'animationEnd' },
301
304
  });
302
305
 
303
- export type IModalStyles = ITweakStyles<typeof useStyles, { tweakCloseButton: ICloseButtonStyles }>;
306
+ export const closeButtonStyles: IIconButtonStyles = {
307
+ m: {
308
+ width: MODAL_CLOSE_BUTTON_SIZE,
309
+ height: MODAL_CLOSE_BUTTON_SIZE,
310
+ },
311
+
312
+ icon: {
313
+ width: MODAL_CLOSE_BUTTON_ICON_SIZE,
314
+ height: MODAL_CLOSE_BUTTON_ICON_SIZE,
315
+ },
316
+ };
317
+
318
+ export type IModalStyles = ITweakStyles<typeof useStyles, { tweakCloseButton: IIconButtonStyles }>;
@@ -10,9 +10,9 @@ import {
10
10
  import { addDataAttributes } from '../../helpers';
11
11
  import { useTweakStyles } from '../../hooks';
12
12
  import { ICommonProps } from '../../types';
13
- import { CloseButton } from '../CloseButton';
13
+ import { IconButton } from '../IconButton';
14
14
  import { IModalPosition, IModalTransitionProps } from './types';
15
- import { useStyles, IModalStyles } from './Modal.styles';
15
+ import { useStyles, IModalStyles, closeButtonStyles } from './Modal.styles';
16
16
 
17
17
  export interface IModalProps extends ICommonProps<IModalStyles>, IModalTransitionProps {
18
18
  title?: ReactNode;
@@ -68,6 +68,7 @@ export const Modal: FC<IModalProps> = ({
68
68
  const classes = useStyles({ theme: tweakStyles });
69
69
 
70
70
  const tweakCloseButtonStyles = useTweakStyles({
71
+ innerStyles: closeButtonStyles,
71
72
  tweakStyles,
72
73
  className: 'tweakCloseButton',
73
74
  currentComponentName: 'Modal',
@@ -154,10 +155,12 @@ export const Modal: FC<IModalProps> = ({
154
155
  >
155
156
  {hasCloseButton && (
156
157
  <div className={classes.close}>
157
- <CloseButton
158
+ <IconButton
158
159
  testId={getTestId(testId, 'close-button')}
159
160
  tweakStyles={tweakCloseButtonStyles}
160
- onClose={onClose}
161
+ view="cancel-light"
162
+ icon="close"
163
+ onClick={onClose}
161
164
  />
162
165
  </div>
163
166
  )}
@@ -180,7 +180,7 @@ function SelectWithCustomProps({
180
180
  }
181
181
 
182
182
  export default {
183
- title: 'Select',
183
+ title: 'Controls/Select',
184
184
  component: SelectWithCustomProps,
185
185
  argTypes: {
186
186
  scrollParent: {
@@ -2,6 +2,7 @@ import { ComponentStory, ComponentMeta } from '@storybook/react';
2
2
  import { IIconType, iconsList } from '../Icon';
3
3
  import { complexIcons } from '../Icon/complexIcons';
4
4
  import { TextButton } from './TextButton';
5
+ import { TEXT_BUTTON_SIZES, TEXT_BUTTON_VIEWS } from './constants';
5
6
 
6
7
  const iconTypes = [
7
8
  undefined,
@@ -28,8 +29,8 @@ export default {
28
29
 
29
30
  argTypes: {
30
31
  icon: { control: 'select', options: iconTypes },
31
- size: { control: 'inline-radio' },
32
- view: { control: 'inline-radio' },
32
+ size: { options: TEXT_BUTTON_SIZES, control: 'inline-radio' },
33
+ view: { options: TEXT_BUTTON_VIEWS, control: 'inline-radio' },
33
34
  iconPosition: { control: 'inline-radio' },
34
35
  preloaderType: { control: 'inline-radio' },
35
36
  },
@@ -1,4 +1,4 @@
1
- import { ButtonHTMLAttributes, FC, ReactNode } from 'react';
1
+ import { forwardRef, ReactNode } from 'react';
2
2
  import clsx from 'clsx';
3
3
  import { addDataTestId, isReactNodeNotEmpty } from '@true-engineering/true-react-platform-helpers';
4
4
  import { addDataAttributes } from '../../helpers';
@@ -6,17 +6,18 @@ import { useTweakStyles } from '../../hooks';
6
6
  import { ICommonProps } from '../../types';
7
7
  import { IIcon, renderIcon } from '../Icon';
8
8
  import { IThemedPreloaderProps, ThemedPreloader } from '../ThemedPreloader';
9
+ import { ITextButtonHTMLBaseProps, ITextButtonSize, ITextButtonView } from './types';
9
10
  import { useStyles, ITextButtonStyles, preloaderStyles } from './TextButton.styles';
10
11
 
11
12
  export interface ITextButtonProps
12
13
  extends ICommonProps<ITextButtonStyles>,
13
- Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'className' | 'disabled'> {
14
+ ITextButtonHTMLBaseProps {
14
15
  /** @default 'undefined' */
15
16
  children?: ReactNode;
16
17
  /** @default 'undefined' */
17
18
  icon?: IIcon;
18
19
  /** @default 'primary' */
19
- view?: 'primary' | 'secondary' | 'custom';
20
+ view?: ITextButtonView;
20
21
  /** @default false */
21
22
  isBold?: boolean;
22
23
  /** @default false */
@@ -28,76 +29,82 @@ export interface ITextButtonProps
28
29
  /** @default false */
29
30
  isActive?: boolean;
30
31
  /** @default 'l' */
31
- size?: 'l' | 'xl';
32
+ size?: ITextButtonSize;
32
33
  /** @default 'left' */
33
34
  iconPosition?: 'left' | 'right';
34
35
  /** @default 'dots' */
35
36
  preloaderType?: IThemedPreloaderProps['type'];
36
37
  }
37
38
 
38
- export const TextButton: FC<ITextButtonProps> = ({
39
- children,
40
- icon,
41
- view = 'primary',
42
- isDisabled = false,
43
- isBold = false,
44
- isLoading = false,
45
- isActive = false,
46
- hasCircleUnderIcon = false,
47
- size = 'l',
48
- iconPosition = 'left',
49
- preloaderType = 'dots',
50
- type = 'button',
51
- testId,
52
- tweakStyles,
53
- data,
54
- onClick,
55
- ...restProps
56
- }) => {
57
- const classes = useStyles({ theme: tweakStyles });
39
+ export const TextButton = forwardRef<HTMLButtonElement, ITextButtonProps>(
40
+ (
41
+ {
42
+ children,
43
+ icon,
44
+ view = 'primary',
45
+ isDisabled = false,
46
+ isBold = false,
47
+ isLoading = false,
48
+ isActive = false,
49
+ hasCircleUnderIcon = false,
50
+ size = 'l',
51
+ iconPosition = 'left',
52
+ preloaderType = 'dots',
53
+ type = 'button',
54
+ testId,
55
+ tweakStyles,
56
+ data,
57
+ onClick,
58
+ ...restProps
59
+ },
60
+ ref,
61
+ ) => {
62
+ const classes = useStyles({ theme: tweakStyles });
58
63
 
59
- const tweakPreloaderStyles = useTweakStyles({
60
- innerStyles: preloaderStyles,
61
- tweakStyles,
62
- className: 'tweakPreloader',
63
- currentComponentName: 'TextButton',
64
- });
64
+ const tweakPreloaderStyles = useTweakStyles({
65
+ innerStyles: preloaderStyles,
66
+ tweakStyles,
67
+ className: 'tweakPreloader',
68
+ currentComponentName: 'TextButton',
69
+ });
65
70
 
66
- const hasNoAction = isDisabled || isLoading;
71
+ const hasNoAction = isDisabled || isLoading;
67
72
 
68
- return (
69
- <button
70
- className={clsx(classes.root, classes[size], classes[view], {
71
- [classes.bold]: isBold,
72
- [classes.loading]: isLoading,
73
- [classes.active]: isActive,
74
- [classes.disabled]: isDisabled,
75
- })}
76
- onClick={!hasNoAction ? onClick : undefined}
77
- disabled={hasNoAction}
78
- type={type}
79
- {...restProps}
80
- {...addDataTestId(testId)}
81
- {...addDataAttributes(data)}
82
- >
83
- <span className={clsx(classes.content, iconPosition === 'right' && classes.reverseContent)}>
84
- {isReactNodeNotEmpty(icon) && (
85
- <span className={clsx(classes.iconContainer, hasCircleUnderIcon && classes.circle)}>
86
- <span className={classes.icon}>{renderIcon(icon)}</span>
73
+ return (
74
+ <button
75
+ ref={ref}
76
+ type={type}
77
+ className={clsx(classes.root, classes[size], classes[view], {
78
+ [classes.bold]: isBold,
79
+ [classes.loading]: isLoading,
80
+ [classes.active]: isActive,
81
+ [classes.disabled]: isDisabled,
82
+ })}
83
+ disabled={hasNoAction}
84
+ onClick={!hasNoAction ? onClick : undefined}
85
+ {...restProps}
86
+ {...addDataTestId(testId)}
87
+ {...addDataAttributes(data)}
88
+ >
89
+ <span className={clsx(classes.content, iconPosition === 'right' && classes.reverseContent)}>
90
+ {isReactNodeNotEmpty(icon) && (
91
+ <span className={clsx(classes.iconContainer, hasCircleUnderIcon && classes.circle)}>
92
+ <span className={classes.icon}>{renderIcon(icon)}</span>
93
+ </span>
94
+ )}
95
+ {children}
96
+ </span>
97
+
98
+ {isLoading && (
99
+ <span className={classes.loader}>
100
+ <ThemedPreloader
101
+ type={preloaderType}
102
+ useCurrentColor
103
+ tweakStyles={tweakPreloaderStyles}
104
+ />
87
105
  </span>
88
106
  )}
89
- {children}
90
- </span>
91
-
92
- {isLoading && (
93
- <span className={classes.loader}>
94
- <ThemedPreloader
95
- type={preloaderType}
96
- useCurrentColor
97
- tweakStyles={tweakPreloaderStyles}
98
- />
99
- </span>
100
- )}
101
- </button>
102
- );
103
- };
107
+ </button>
108
+ );
109
+ },
110
+ );
@@ -0,0 +1,3 @@
1
+ export const TEXT_BUTTON_SIZES = ['l', 'xl'] as const;
2
+
3
+ export const TEXT_BUTTON_VIEWS = ['primary', 'secondary', 'custom'] as const;
@@ -1,4 +1,3 @@
1
1
  export * from './TextButton';
2
- export * from './TextButton';
3
-
2
+ export * from './types';
4
3
  export type { ITextButtonStyles } from './TextButton.styles';
@@ -0,0 +1,11 @@
1
+ import { ButtonHTMLAttributes } from 'react';
2
+ import { TEXT_BUTTON_SIZES, TEXT_BUTTON_VIEWS } from './constants';
3
+
4
+ export type ITextButtonSize = (typeof TEXT_BUTTON_SIZES)[number];
5
+
6
+ export type ITextButtonView = (typeof TEXT_BUTTON_VIEWS)[number];
7
+
8
+ export type ITextButtonHTMLBaseProps = Omit<
9
+ ButtonHTMLAttributes<HTMLButtonElement>,
10
+ 'disabled' | 'style' | 'className'
11
+ >;
@@ -1,5 +1,5 @@
1
1
  import { colors, ITweakStyles, createThemedStyles } from '../../theme';
2
- import { ICloseButtonStyles } from '../CloseButton';
2
+ import { IIconButtonStyles } from '../IconButton';
3
3
 
4
4
  export const useStyles = createThemedStyles('Toaster', {
5
5
  root: {
@@ -56,5 +56,5 @@ export const useStyles = createThemedStyles('Toaster', {
56
56
 
57
57
  export type IToasterStyles = ITweakStyles<
58
58
  typeof useStyles,
59
- { tweakCloseButton: ICloseButtonStyles }
59
+ { tweakCloseButton: IIconButtonStyles }
60
60
  >;
@@ -9,8 +9,8 @@ import {
9
9
  import { addDataAttributes } from '../../helpers';
10
10
  import { useTweakStyles } from '../../hooks';
11
11
  import { ICommonProps } from '../../types';
12
- import { CloseButton } from '../CloseButton';
13
12
  import { Icon } from '../Icon';
13
+ import { IconButton } from '../IconButton';
14
14
  import { DEFAULT_TIMEOUT } from './constants';
15
15
  import { IToasterType } from './types';
16
16
  import { useStyles, IToasterStyles } from './Toaster.styles';
@@ -96,10 +96,11 @@ export const Toaster: FC<IToasterProps> = ({
96
96
  </div>
97
97
  {hasCloseButton && isNotEmpty(onClose) && (
98
98
  <div className={classes.close}>
99
- <CloseButton
100
- onClose={onClose}
101
- iconType="close-window"
99
+ <IconButton
100
+ view="cancel-light"
101
+ icon="close-window"
102
102
  tweakStyles={tweakCloseButtonStyles}
103
+ onClick={onClose}
103
104
  />
104
105
  </div>
105
106
  )}
@@ -12,6 +12,7 @@ export * from './FiltersPane';
12
12
  export * from './Flag';
13
13
  export * from './FlexibleTable';
14
14
  export * from './Icon';
15
+ export * from './IconButton';
15
16
  export * from './IncrementInput';
16
17
  export * from './Input';
17
18
  export * from './List';