@true-engineering/true-react-common-ui-kit 3.12.0 → 3.13.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@true-engineering/true-react-common-ui-kit",
3
- "version": "3.12.0",
3
+ "version": "3.13.1",
4
4
  "description": "True Engineering React UI Kit with theming support",
5
5
  "author": "True Engineering (https://trueengineering.ru)",
6
6
  "keywords": [
@@ -47,10 +47,6 @@ export const useStyles = createThemedStyles('IconButton', {
47
47
  },
48
48
 
49
49
  loading: {
50
- '& $content': {
51
- visibility: 'hidden',
52
- },
53
-
54
50
  '& $loader': {
55
51
  display: 'block',
56
52
  },
@@ -5,6 +5,7 @@ import clsx from 'clsx';
5
5
  import {
6
6
  addDataTestId,
7
7
  getTestId,
8
+ isArrayNotEmpty,
8
9
  isReactNodeNotEmpty,
9
10
  } from '@true-engineering/true-react-platform-helpers';
10
11
  import { addDataAttributes } from '../../helpers';
@@ -20,6 +21,8 @@ export interface IModalProps extends ICommonProps<IModalStyles>, IModalTransitio
20
21
  size?: 'l' | 'm' | 's';
21
22
  /** @default false */
22
23
  isFooterSticky?: boolean;
24
+ footer?: ReactNode;
25
+ /** @deprecated use {@link footer} */
23
26
  buttons?: ReactNode[];
24
27
  /** @default 'right' */
25
28
  buttonsAlign?: 'left' | 'center' | 'right';
@@ -48,6 +51,7 @@ export const Modal: FC<IModalProps> = ({
48
51
  title,
49
52
  size = 'l',
50
53
  isFooterSticky = false,
54
+ footer,
51
55
  buttons,
52
56
  buttonsAlign = 'right',
53
57
  hasCloseButton = true,
@@ -77,7 +81,7 @@ export const Modal: FC<IModalProps> = ({
77
81
  const [isClickOnOverlay, setIsClickOnOverlay] = useState(false);
78
82
 
79
83
  const isModalOpen = restProps.in ?? isOpen;
80
- const hasFooter = buttons !== undefined && buttons.length > 0;
84
+ const hasFooter = isReactNodeNotEmpty(footer) || isArrayNotEmpty(buttons);
81
85
  const overlay = useRef<HTMLDivElement>(null);
82
86
 
83
87
  // Клик на оверлее обрабатываем через связку onMouseDown и onMouseUp, т.к. клик
@@ -185,7 +189,7 @@ export const Modal: FC<IModalProps> = ({
185
189
  [classes.stickyFooter]: isFooterSticky,
186
190
  })}
187
191
  >
188
- {buttons.map((button) => button)}
192
+ {isReactNodeNotEmpty(footer) ? footer : buttons}
189
193
  </div>
190
194
  </div>
191
195
  )}