@oliasoft-open-source/react-ui-library 2.4.5 → 2.4.7

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": "@oliasoft-open-source/react-ui-library",
3
- "version": "2.4.5",
3
+ "version": "2.4.7",
4
4
  "description": "Reusable UI components for React projects",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -2,9 +2,21 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { FaTimes } from 'react-icons/fa';
4
4
  import cx from 'classnames';
5
+ import { isArray } from 'lodash';
5
6
  import { Heading } from '../heading/heading';
6
7
  import styles from './dialog.module.less';
7
8
 
9
+ const convertStringToJsx = (children) => {
10
+ if (isArray(children)) {
11
+ return children.map((text) => (
12
+ <>
13
+ {text} <br />
14
+ </>
15
+ ));
16
+ }
17
+ return children;
18
+ };
19
+
8
20
  export const Dialog = ({ dialog }) => {
9
21
  const {
10
22
  heading,
@@ -36,7 +48,7 @@ export const Dialog = ({ dialog }) => {
36
48
  ) : null}
37
49
  </div>
38
50
  <div className={styles.content} style={{ padding: contentPadding }}>
39
- {content}
51
+ {convertStringToJsx(content)}
40
52
  </div>
41
53
  {footer && <div className={styles.footer}>{footer}</div>}
42
54
  </div>
@@ -49,6 +61,7 @@ const dialogShape = PropTypes.shape({
49
61
  PropTypes.string,
50
62
  PropTypes.number,
51
63
  PropTypes.node,
64
+ PropTypes.arrayOf(PropTypes.string),
52
65
  ]).isRequired,
53
66
  contentPadding: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
54
67
  footer: PropTypes.node,
@@ -33,3 +33,7 @@
33
33
  margin-top: auto;
34
34
  margin-bottom: auto;
35
35
  }
36
+
37
+ .newLine {
38
+ white-space: 'pre-wrap';
39
+ }
@@ -64,6 +64,9 @@ export const Default = Template.bind({});
64
64
  export const Centered = Template.bind({});
65
65
  Centered.args = { centered: true };
66
66
 
67
+ export const LineBreak = Template.bind({});
68
+ LineBreak.args = { content: ['This is a', 'new line!'] };
69
+
67
70
  export const Scroll = Template.bind({});
68
71
  Scroll.args = {
69
72
  scroll: true,
@@ -63,8 +63,6 @@
63
63
  .cellWrapperPadding();
64
64
  line-height: 17px;
65
65
  position: relative;
66
- display: flex;
67
- align-items: center;
68
66
  border-radius: inherit;
69
67
 
70
68
  &.error,