@zohodesk/components 1.2.41 → 1.2.42
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/.cli/propValidation_report.html +1 -1
- package/README.md +9 -0
- package/es/DateTime/__tests__/__snapshots__/DateTime.spec.js.snap +1 -1
- package/es/DateTime/__tests__/__snapshots__/DateTimePopupHeader.spec.js.snap +1 -1
- package/es/DateTime/__tests__/__snapshots__/YearView.spec.js.snap +1 -1
- package/es/Heading/Heading.js +5 -2
- package/es/Heading/__tests__/Heading.spec.js +9 -0
- package/es/Heading/__tests__/__snapshots__/Heading.spec.js.snap +55 -1
- package/es/Heading/props/propTypes.js +2 -1
- package/es/Tooltip/Tooltip.js +13 -3
- package/es/Tooltip/Tooltip.module.css +0 -8
- package/es/common/common.module.css +24 -0
- package/es/utils/cssUtils.js +11 -0
- package/es/v1/Heading/Heading.js +5 -2
- package/es/v1/Heading/props/propTypes.js +2 -1
- package/es/v1/Tooltip/Tooltip.js +13 -3
- package/lib/DateTime/__tests__/__snapshots__/DateTime.spec.js.snap +1 -1
- package/lib/DateTime/__tests__/__snapshots__/DateTimePopupHeader.spec.js.snap +1 -1
- package/lib/DateTime/__tests__/__snapshots__/YearView.spec.js.snap +1 -1
- package/lib/Heading/Heading.js +7 -3
- package/lib/Heading/__tests__/Heading.spec.js +9 -0
- package/lib/Heading/__tests__/__snapshots__/Heading.spec.js.snap +55 -1
- package/lib/Heading/props/propTypes.js +2 -1
- package/lib/Tooltip/Tooltip.js +15 -4
- package/lib/Tooltip/Tooltip.module.css +0 -8
- package/lib/common/common.module.css +24 -0
- package/lib/utils/cssUtils.js +22 -0
- package/lib/v1/Heading/Heading.js +7 -3
- package/lib/v1/Heading/props/propTypes.js +2 -1
- package/lib/v1/Tooltip/Tooltip.js +15 -4
- package/package.json +4 -4
- package/result.json +1 -1
package/README.md
CHANGED
|
@@ -32,6 +32,15 @@ In this Package, we Provide Some Basic Components to Build Web App
|
|
|
32
32
|
- TextBoxIcon
|
|
33
33
|
- Tooltip
|
|
34
34
|
|
|
35
|
+
# 1.2.42
|
|
36
|
+
|
|
37
|
+
- **Heading (v0&v1)** -
|
|
38
|
+
- whiteSpace prop added
|
|
39
|
+
|
|
40
|
+
- **Tooltip (v0&v1)** -
|
|
41
|
+
- whiteSpace prop added
|
|
42
|
+
- `data-title-wrap` now accepts whitespace CSS values instead of a boolean, allowing the tooltip to support all whitespace options. Default value is `normal`.
|
|
43
|
+
|
|
35
44
|
# 1.2.41
|
|
36
45
|
|
|
37
46
|
- **Tabs**
|
package/es/Heading/Heading.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { defaultProps } from './props/defaultProps';
|
|
3
3
|
import { propTypes } from './props/propTypes';
|
|
4
|
+
import { whiteSpaceClassMapping } from '../utils/cssUtils';
|
|
4
5
|
import style from './Heading.module.css';
|
|
5
6
|
export default class Heading extends React.Component {
|
|
6
7
|
render() {
|
|
@@ -12,15 +13,17 @@ export default class Heading extends React.Component {
|
|
|
12
13
|
title,
|
|
13
14
|
dataTitle,
|
|
14
15
|
dataId,
|
|
15
|
-
a11y
|
|
16
|
+
a11y,
|
|
17
|
+
whiteSpace
|
|
16
18
|
} = this.props;
|
|
17
19
|
return /*#__PURE__*/React.createElement(tagName, {
|
|
18
|
-
className: `${style.reset} ${className}`,
|
|
20
|
+
className: `${style.reset} ${whiteSpace ? whiteSpaceClassMapping[whiteSpace] : ''} ${className}`,
|
|
19
21
|
onClick,
|
|
20
22
|
onDoubleClick,
|
|
21
23
|
'data-title': dataTitle || title,
|
|
22
24
|
'data-id': dataId,
|
|
23
25
|
'data-test-id': dataId,
|
|
26
|
+
'data-title-wrap': whiteSpace,
|
|
24
27
|
...a11y
|
|
25
28
|
}, title);
|
|
26
29
|
}
|
|
@@ -8,4 +8,13 @@ describe('Heading', () => {
|
|
|
8
8
|
} = render( /*#__PURE__*/React.createElement(Heading, null));
|
|
9
9
|
expect(asFragment()).toMatchSnapshot();
|
|
10
10
|
});
|
|
11
|
+
const whiteSpace = ['normal', 'nowrap', 'pre', 'pre-line', 'pre-wrap', 'break-spaces'];
|
|
12
|
+
test.each(whiteSpace)('Should render whiteSpace of Heading - %s', whiteSpace => {
|
|
13
|
+
const {
|
|
14
|
+
asFragment
|
|
15
|
+
} = render( /*#__PURE__*/React.createElement(Heading, {
|
|
16
|
+
whiteSpace: whiteSpace
|
|
17
|
+
}));
|
|
18
|
+
expect(asFragment()).toMatchSnapshot();
|
|
19
|
+
});
|
|
11
20
|
});
|
|
@@ -1,9 +1,63 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`Heading Should render whiteSpace of Heading - break-spaces 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<h1
|
|
6
|
+
class="reset whiteSpace_breakSpaces "
|
|
7
|
+
data-title-wrap="break-spaces"
|
|
8
|
+
/>
|
|
9
|
+
</DocumentFragment>
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
exports[`Heading Should render whiteSpace of Heading - normal 1`] = `
|
|
13
|
+
<DocumentFragment>
|
|
14
|
+
<h1
|
|
15
|
+
class="reset whiteSpace_normal "
|
|
16
|
+
data-title-wrap="normal"
|
|
17
|
+
/>
|
|
18
|
+
</DocumentFragment>
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
exports[`Heading Should render whiteSpace of Heading - nowrap 1`] = `
|
|
22
|
+
<DocumentFragment>
|
|
23
|
+
<h1
|
|
24
|
+
class="reset whiteSpace_nowrap "
|
|
25
|
+
data-title-wrap="nowrap"
|
|
26
|
+
/>
|
|
27
|
+
</DocumentFragment>
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
exports[`Heading Should render whiteSpace of Heading - pre 1`] = `
|
|
31
|
+
<DocumentFragment>
|
|
32
|
+
<h1
|
|
33
|
+
class="reset whiteSpace_pre "
|
|
34
|
+
data-title-wrap="pre"
|
|
35
|
+
/>
|
|
36
|
+
</DocumentFragment>
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
exports[`Heading Should render whiteSpace of Heading - pre-line 1`] = `
|
|
40
|
+
<DocumentFragment>
|
|
41
|
+
<h1
|
|
42
|
+
class="reset whiteSpace_preLine "
|
|
43
|
+
data-title-wrap="pre-line"
|
|
44
|
+
/>
|
|
45
|
+
</DocumentFragment>
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
exports[`Heading Should render whiteSpace of Heading - pre-wrap 1`] = `
|
|
49
|
+
<DocumentFragment>
|
|
50
|
+
<h1
|
|
51
|
+
class="reset whiteSpace_preWrap "
|
|
52
|
+
data-title-wrap="pre-wrap"
|
|
53
|
+
/>
|
|
54
|
+
</DocumentFragment>
|
|
55
|
+
`;
|
|
56
|
+
|
|
3
57
|
exports[`Heading rendering the defult props 1`] = `
|
|
4
58
|
<DocumentFragment>
|
|
5
59
|
<h1
|
|
6
|
-
class="reset
|
|
60
|
+
class="reset "
|
|
7
61
|
/>
|
|
8
62
|
</DocumentFragment>
|
|
9
63
|
`;
|
|
@@ -7,5 +7,6 @@ export const propTypes = {
|
|
|
7
7
|
dataTitle: PropTypes.string,
|
|
8
8
|
onClick: PropTypes.func,
|
|
9
9
|
onDoubleClick: PropTypes.func,
|
|
10
|
-
a11y: PropTypes.object
|
|
10
|
+
a11y: PropTypes.object,
|
|
11
|
+
whiteSpace: PropTypes.oneOf(['normal', 'nowrap', 'pre', 'pre-line', 'pre-wrap', 'break-spaces'])
|
|
11
12
|
};
|
package/es/Tooltip/Tooltip.js
CHANGED
|
@@ -2,9 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import { defaultProps } from './props/defaultProps';
|
|
3
3
|
import { propTypes } from './props/propTypes';
|
|
4
4
|
import { getLibraryConfig } from '../Provider/Config';
|
|
5
|
-
import style from './Tooltip.module.css';
|
|
6
5
|
import ResizeObserver from '../Responsive/ResizeObserver';
|
|
7
6
|
import selectn from 'selectn';
|
|
7
|
+
import { whiteSpaceClassMapping } from '../utils/cssUtils';
|
|
8
|
+
import style from './Tooltip.module.css';
|
|
8
9
|
export default class Tooltip extends React.Component {
|
|
9
10
|
constructor(props) {
|
|
10
11
|
super(props);
|
|
@@ -192,7 +193,8 @@ export default class Tooltip extends React.Component {
|
|
|
192
193
|
|
|
193
194
|
let isHtml = titleDiv.getAttribute('data-ishtml');
|
|
194
195
|
let dataTooltipnoArrow = titleDiv.getAttribute('data-tooltip-noarrow') === 'true' ? true : false;
|
|
195
|
-
let dataTooltipWrap = titleDiv.getAttribute('data-title-wrap')
|
|
196
|
+
let dataTooltipWrap = titleDiv.getAttribute('data-title-wrap') || 'normal'; // values: normal, pre, pre-wrap, pre-line, nowrap, break-spaces
|
|
197
|
+
|
|
196
198
|
let clientRect = titleDiv.getBoundingClientRect();
|
|
197
199
|
let boxLayout = this.getClientRectOfContEl(containerElement);
|
|
198
200
|
this.setState({
|
|
@@ -481,7 +483,15 @@ export default class Tooltip extends React.Component {
|
|
|
481
483
|
} = this.props;
|
|
482
484
|
let arrowStyle = isArrowHorizontal ? isArrowRight ? style.arrowRight : style.arrowLeft : isArrowDown ? style.arrowDown : style.arrowUp;
|
|
483
485
|
title = title ? title.trim() : null;
|
|
484
|
-
let
|
|
486
|
+
let tooltipWhiteSpaceModification = dataTooltipWrap;
|
|
487
|
+
|
|
488
|
+
if (dataTooltipWrap == 'pre') {
|
|
489
|
+
tooltipWhiteSpaceModification = 'preWrap';
|
|
490
|
+
} else if (dataTooltipWrap == 'nowrap') {
|
|
491
|
+
tooltipWhiteSpaceModification = 'normal';
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
let tooltipCss = `${style.tooltipcont} ${whiteSpaceClassMapping[tooltipWhiteSpaceModification]}`;
|
|
485
495
|
return title ? /*#__PURE__*/React.createElement("div", {
|
|
486
496
|
className: `${customClass} ${style.tooltiptext}`,
|
|
487
497
|
style: {
|
|
@@ -522,4 +522,28 @@
|
|
|
522
522
|
.fitContHeight {
|
|
523
523
|
height: fit-content ;
|
|
524
524
|
height: -moz-fit-content ;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
.whiteSpace_normal {
|
|
528
|
+
white-space: normal;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
.whiteSpace_nowrap {
|
|
532
|
+
white-space: nowrap;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
.whiteSpace_pre {
|
|
536
|
+
white-space: pre;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
.whiteSpace_preLine {
|
|
540
|
+
white-space: pre-line;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
.whiteSpace_preWrap {
|
|
544
|
+
white-space: pre-wrap;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
.whiteSpace_breakSpaces {
|
|
548
|
+
white-space: break-spaces
|
|
525
549
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import commonStyle from '../common/common.module.css';
|
|
2
|
+
export const whiteSpaceClassMapping = {
|
|
3
|
+
// eslint-disable-next-line dot-notation
|
|
4
|
+
'normal': commonStyle.whiteSpace_normal,
|
|
5
|
+
'pre': commonStyle.whiteSpace_pre,
|
|
6
|
+
'pre-wrap': commonStyle.whiteSpace_preWrap,
|
|
7
|
+
'pre-line': commonStyle.whiteSpace_preLine,
|
|
8
|
+
// eslint-disable-next-line dot-notation
|
|
9
|
+
'nowrap': commonStyle.whiteSpace_nowrap,
|
|
10
|
+
'break-spaces': commonStyle.whiteSpace_breakSpaces
|
|
11
|
+
};
|
package/es/v1/Heading/Heading.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { defaultProps } from './props/defaultProps';
|
|
3
3
|
import { propTypes } from './props/propTypes';
|
|
4
|
+
import { whiteSpaceClassMapping } from '../../utils/cssUtils';
|
|
4
5
|
import style from '../../Heading/Heading.module.css';
|
|
5
6
|
export default function Heading(props) {
|
|
6
7
|
let {
|
|
@@ -11,15 +12,17 @@ export default function Heading(props) {
|
|
|
11
12
|
title,
|
|
12
13
|
dataTitle,
|
|
13
14
|
dataId,
|
|
14
|
-
a11y
|
|
15
|
+
a11y,
|
|
16
|
+
whiteSpace
|
|
15
17
|
} = props;
|
|
16
18
|
return /*#__PURE__*/React.createElement(tagName, {
|
|
17
|
-
className: `${style.reset} ${className}`,
|
|
19
|
+
className: `${style.reset} ${whiteSpace ? whiteSpaceClassMapping[whiteSpace] : ''} ${className}`,
|
|
18
20
|
onClick,
|
|
19
21
|
onDoubleClick,
|
|
20
22
|
'data-title': dataTitle || title,
|
|
21
23
|
'data-id': dataId,
|
|
22
24
|
'data-test-id': dataId,
|
|
25
|
+
'data-title-wrap': whiteSpace,
|
|
23
26
|
...a11y
|
|
24
27
|
}, title);
|
|
25
28
|
}
|
|
@@ -7,5 +7,6 @@ export const propTypes = {
|
|
|
7
7
|
dataTitle: PropTypes.string,
|
|
8
8
|
onClick: PropTypes.func,
|
|
9
9
|
onDoubleClick: PropTypes.func,
|
|
10
|
-
a11y: PropTypes.object
|
|
10
|
+
a11y: PropTypes.object,
|
|
11
|
+
whiteSpace: PropTypes.oneOf(['normal', 'nowrap', 'pre', 'pre-line', 'pre-wrap', 'break-spaces'])
|
|
11
12
|
};
|
package/es/v1/Tooltip/Tooltip.js
CHANGED
|
@@ -2,9 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import { defaultProps } from './props/defaultProps';
|
|
3
3
|
import { propTypes } from './props/propTypes';
|
|
4
4
|
import { getLibraryConfig } from '../../Provider/Config';
|
|
5
|
-
import style from '../../Tooltip/Tooltip.module.css';
|
|
6
5
|
import ResizeObserver from '../../Responsive/ResizeObserver';
|
|
7
6
|
import selectn from 'selectn';
|
|
7
|
+
import { whiteSpaceClassMapping } from '../../utils/cssUtils';
|
|
8
|
+
import style from '../../Tooltip/Tooltip.module.css';
|
|
8
9
|
export default class Tooltip extends React.Component {
|
|
9
10
|
constructor(props) {
|
|
10
11
|
super(props);
|
|
@@ -192,7 +193,8 @@ export default class Tooltip extends React.Component {
|
|
|
192
193
|
|
|
193
194
|
let isHtml = titleDiv.getAttribute('data-ishtml');
|
|
194
195
|
let dataTooltipnoArrow = titleDiv.getAttribute('data-tooltip-noarrow') === 'true' ? true : false;
|
|
195
|
-
let dataTooltipWrap = titleDiv.getAttribute('data-title-wrap')
|
|
196
|
+
let dataTooltipWrap = titleDiv.getAttribute('data-title-wrap') || 'normal'; // values: normal, pre, pre-wrap, pre-line, nowrap, break-spaces
|
|
197
|
+
|
|
196
198
|
let clientRect = titleDiv.getBoundingClientRect();
|
|
197
199
|
let boxLayout = this.getClientRectOfContEl(containerElement);
|
|
198
200
|
this.setState({
|
|
@@ -481,7 +483,15 @@ export default class Tooltip extends React.Component {
|
|
|
481
483
|
} = this.props;
|
|
482
484
|
let arrowStyle = isArrowHorizontal ? isArrowRight ? style.arrowRight : style.arrowLeft : isArrowDown ? style.arrowDown : style.arrowUp;
|
|
483
485
|
title = title ? title.trim() : null;
|
|
484
|
-
let
|
|
486
|
+
let tooltipWhiteSpaceModification = dataTooltipWrap;
|
|
487
|
+
|
|
488
|
+
if (dataTooltipWrap == 'pre') {
|
|
489
|
+
tooltipWhiteSpaceModification = 'preWrap';
|
|
490
|
+
} else if (dataTooltipWrap == 'nowrap') {
|
|
491
|
+
tooltipWhiteSpaceModification = 'normal';
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
let tooltipCss = `${style.tooltipcont} ${whiteSpaceClassMapping[tooltipWhiteSpaceModification]}`;
|
|
485
495
|
return title ? /*#__PURE__*/React.createElement("div", {
|
|
486
496
|
className: `${customClass} ${style.tooltiptext}`,
|
|
487
497
|
style: {
|
package/lib/Heading/Heading.js
CHANGED
|
@@ -13,6 +13,8 @@ var _defaultProps = require("./props/defaultProps");
|
|
|
13
13
|
|
|
14
14
|
var _propTypes = require("./props/propTypes");
|
|
15
15
|
|
|
16
|
+
var _cssUtils = require("../utils/cssUtils");
|
|
17
|
+
|
|
16
18
|
var _HeadingModule = _interopRequireDefault(require("./Heading.module.css"));
|
|
17
19
|
|
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -65,14 +67,16 @@ var Heading = /*#__PURE__*/function (_React$Component) {
|
|
|
65
67
|
title = _this$props.title,
|
|
66
68
|
dataTitle = _this$props.dataTitle,
|
|
67
69
|
dataId = _this$props.dataId,
|
|
68
|
-
a11y = _this$props.a11y
|
|
70
|
+
a11y = _this$props.a11y,
|
|
71
|
+
whiteSpace = _this$props.whiteSpace;
|
|
69
72
|
return /*#__PURE__*/_react["default"].createElement(tagName, _objectSpread({
|
|
70
|
-
className: "".concat(_HeadingModule["default"].reset, " ").concat(className),
|
|
73
|
+
className: "".concat(_HeadingModule["default"].reset, " ").concat(whiteSpace ? _cssUtils.whiteSpaceClassMapping[whiteSpace] : '', " ").concat(className),
|
|
71
74
|
onClick: onClick,
|
|
72
75
|
onDoubleClick: onDoubleClick,
|
|
73
76
|
'data-title': dataTitle || title,
|
|
74
77
|
'data-id': dataId,
|
|
75
|
-
'data-test-id': dataId
|
|
78
|
+
'data-test-id': dataId,
|
|
79
|
+
'data-title-wrap': whiteSpace
|
|
76
80
|
}, a11y), title);
|
|
77
81
|
}
|
|
78
82
|
}]);
|
|
@@ -15,4 +15,13 @@ describe('Heading', function () {
|
|
|
15
15
|
|
|
16
16
|
expect(asFragment()).toMatchSnapshot();
|
|
17
17
|
});
|
|
18
|
+
var whiteSpace = ['normal', 'nowrap', 'pre', 'pre-line', 'pre-wrap', 'break-spaces'];
|
|
19
|
+
test.each(whiteSpace)('Should render whiteSpace of Heading - %s', function (whiteSpace) {
|
|
20
|
+
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Heading["default"], {
|
|
21
|
+
whiteSpace: whiteSpace
|
|
22
|
+
})),
|
|
23
|
+
asFragment = _render2.asFragment;
|
|
24
|
+
|
|
25
|
+
expect(asFragment()).toMatchSnapshot();
|
|
26
|
+
});
|
|
18
27
|
});
|
|
@@ -1,9 +1,63 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`Heading Should render whiteSpace of Heading - break-spaces 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<h1
|
|
6
|
+
class="reset whiteSpace_breakSpaces "
|
|
7
|
+
data-title-wrap="break-spaces"
|
|
8
|
+
/>
|
|
9
|
+
</DocumentFragment>
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
exports[`Heading Should render whiteSpace of Heading - normal 1`] = `
|
|
13
|
+
<DocumentFragment>
|
|
14
|
+
<h1
|
|
15
|
+
class="reset whiteSpace_normal "
|
|
16
|
+
data-title-wrap="normal"
|
|
17
|
+
/>
|
|
18
|
+
</DocumentFragment>
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
exports[`Heading Should render whiteSpace of Heading - nowrap 1`] = `
|
|
22
|
+
<DocumentFragment>
|
|
23
|
+
<h1
|
|
24
|
+
class="reset whiteSpace_nowrap "
|
|
25
|
+
data-title-wrap="nowrap"
|
|
26
|
+
/>
|
|
27
|
+
</DocumentFragment>
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
exports[`Heading Should render whiteSpace of Heading - pre 1`] = `
|
|
31
|
+
<DocumentFragment>
|
|
32
|
+
<h1
|
|
33
|
+
class="reset whiteSpace_pre "
|
|
34
|
+
data-title-wrap="pre"
|
|
35
|
+
/>
|
|
36
|
+
</DocumentFragment>
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
exports[`Heading Should render whiteSpace of Heading - pre-line 1`] = `
|
|
40
|
+
<DocumentFragment>
|
|
41
|
+
<h1
|
|
42
|
+
class="reset whiteSpace_preLine "
|
|
43
|
+
data-title-wrap="pre-line"
|
|
44
|
+
/>
|
|
45
|
+
</DocumentFragment>
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
exports[`Heading Should render whiteSpace of Heading - pre-wrap 1`] = `
|
|
49
|
+
<DocumentFragment>
|
|
50
|
+
<h1
|
|
51
|
+
class="reset whiteSpace_preWrap "
|
|
52
|
+
data-title-wrap="pre-wrap"
|
|
53
|
+
/>
|
|
54
|
+
</DocumentFragment>
|
|
55
|
+
`;
|
|
56
|
+
|
|
3
57
|
exports[`Heading rendering the defult props 1`] = `
|
|
4
58
|
<DocumentFragment>
|
|
5
59
|
<h1
|
|
6
|
-
class="reset
|
|
60
|
+
class="reset "
|
|
7
61
|
/>
|
|
8
62
|
</DocumentFragment>
|
|
9
63
|
`;
|
|
@@ -17,6 +17,7 @@ var propTypes = {
|
|
|
17
17
|
dataTitle: _propTypes["default"].string,
|
|
18
18
|
onClick: _propTypes["default"].func,
|
|
19
19
|
onDoubleClick: _propTypes["default"].func,
|
|
20
|
-
a11y: _propTypes["default"].object
|
|
20
|
+
a11y: _propTypes["default"].object,
|
|
21
|
+
whiteSpace: _propTypes["default"].oneOf(['normal', 'nowrap', 'pre', 'pre-line', 'pre-wrap', 'break-spaces'])
|
|
21
22
|
};
|
|
22
23
|
exports.propTypes = propTypes;
|
package/lib/Tooltip/Tooltip.js
CHANGED
|
@@ -15,12 +15,14 @@ var _propTypes = require("./props/propTypes");
|
|
|
15
15
|
|
|
16
16
|
var _Config = require("../Provider/Config");
|
|
17
17
|
|
|
18
|
-
var _TooltipModule = _interopRequireDefault(require("./Tooltip.module.css"));
|
|
19
|
-
|
|
20
18
|
var _ResizeObserver = _interopRequireDefault(require("../Responsive/ResizeObserver"));
|
|
21
19
|
|
|
22
20
|
var _selectn = _interopRequireDefault(require("selectn"));
|
|
23
21
|
|
|
22
|
+
var _cssUtils = require("../utils/cssUtils");
|
|
23
|
+
|
|
24
|
+
var _TooltipModule = _interopRequireDefault(require("./Tooltip.module.css"));
|
|
25
|
+
|
|
24
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
27
|
|
|
26
28
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -251,7 +253,8 @@ var Tooltip = /*#__PURE__*/function (_React$Component) {
|
|
|
251
253
|
|
|
252
254
|
var isHtml = titleDiv.getAttribute('data-ishtml');
|
|
253
255
|
var dataTooltipnoArrow = titleDiv.getAttribute('data-tooltip-noarrow') === 'true' ? true : false;
|
|
254
|
-
var dataTooltipWrap = titleDiv.getAttribute('data-title-wrap')
|
|
256
|
+
var dataTooltipWrap = titleDiv.getAttribute('data-title-wrap') || 'normal'; // values: normal, pre, pre-wrap, pre-line, nowrap, break-spaces
|
|
257
|
+
|
|
255
258
|
var clientRect = titleDiv.getBoundingClientRect();
|
|
256
259
|
var boxLayout = this.getClientRectOfContEl(containerElement);
|
|
257
260
|
this.setState({
|
|
@@ -545,7 +548,15 @@ var Tooltip = /*#__PURE__*/function (_React$Component) {
|
|
|
545
548
|
customClass = _this$props.customClass;
|
|
546
549
|
var arrowStyle = isArrowHorizontal ? isArrowRight ? _TooltipModule["default"].arrowRight : _TooltipModule["default"].arrowLeft : isArrowDown ? _TooltipModule["default"].arrowDown : _TooltipModule["default"].arrowUp;
|
|
547
550
|
title = title ? title.trim() : null;
|
|
548
|
-
var
|
|
551
|
+
var tooltipWhiteSpaceModification = dataTooltipWrap;
|
|
552
|
+
|
|
553
|
+
if (dataTooltipWrap == 'pre') {
|
|
554
|
+
tooltipWhiteSpaceModification = 'preWrap';
|
|
555
|
+
} else if (dataTooltipWrap == 'nowrap') {
|
|
556
|
+
tooltipWhiteSpaceModification = 'normal';
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
var tooltipCss = "".concat(_TooltipModule["default"].tooltipcont, " ").concat(_cssUtils.whiteSpaceClassMapping[tooltipWhiteSpaceModification]);
|
|
549
560
|
return title ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
550
561
|
className: "".concat(customClass, " ").concat(_TooltipModule["default"].tooltiptext),
|
|
551
562
|
style: {
|
|
@@ -522,4 +522,28 @@
|
|
|
522
522
|
.fitContHeight {
|
|
523
523
|
height: fit-content ;
|
|
524
524
|
height: -moz-fit-content ;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
.whiteSpace_normal {
|
|
528
|
+
white-space: normal;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
.whiteSpace_nowrap {
|
|
532
|
+
white-space: nowrap;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
.whiteSpace_pre {
|
|
536
|
+
white-space: pre;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
.whiteSpace_preLine {
|
|
540
|
+
white-space: pre-line;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
.whiteSpace_preWrap {
|
|
544
|
+
white-space: pre-wrap;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
.whiteSpace_breakSpaces {
|
|
548
|
+
white-space: break-spaces
|
|
525
549
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.whiteSpaceClassMapping = void 0;
|
|
7
|
+
|
|
8
|
+
var _commonModule = _interopRequireDefault(require("../common/common.module.css"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
|
|
12
|
+
var whiteSpaceClassMapping = {
|
|
13
|
+
// eslint-disable-next-line dot-notation
|
|
14
|
+
'normal': _commonModule["default"].whiteSpace_normal,
|
|
15
|
+
'pre': _commonModule["default"].whiteSpace_pre,
|
|
16
|
+
'pre-wrap': _commonModule["default"].whiteSpace_preWrap,
|
|
17
|
+
'pre-line': _commonModule["default"].whiteSpace_preLine,
|
|
18
|
+
// eslint-disable-next-line dot-notation
|
|
19
|
+
'nowrap': _commonModule["default"].whiteSpace_nowrap,
|
|
20
|
+
'break-spaces': _commonModule["default"].whiteSpace_breakSpaces
|
|
21
|
+
};
|
|
22
|
+
exports.whiteSpaceClassMapping = whiteSpaceClassMapping;
|
|
@@ -11,6 +11,8 @@ var _defaultProps = require("./props/defaultProps");
|
|
|
11
11
|
|
|
12
12
|
var _propTypes = require("./props/propTypes");
|
|
13
13
|
|
|
14
|
+
var _cssUtils = require("../../utils/cssUtils");
|
|
15
|
+
|
|
14
16
|
var _HeadingModule = _interopRequireDefault(require("../../Heading/Heading.module.css"));
|
|
15
17
|
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -29,14 +31,16 @@ function Heading(props) {
|
|
|
29
31
|
title = props.title,
|
|
30
32
|
dataTitle = props.dataTitle,
|
|
31
33
|
dataId = props.dataId,
|
|
32
|
-
a11y = props.a11y
|
|
34
|
+
a11y = props.a11y,
|
|
35
|
+
whiteSpace = props.whiteSpace;
|
|
33
36
|
return /*#__PURE__*/_react["default"].createElement(tagName, _objectSpread({
|
|
34
|
-
className: "".concat(_HeadingModule["default"].reset, " ").concat(className),
|
|
37
|
+
className: "".concat(_HeadingModule["default"].reset, " ").concat(whiteSpace ? _cssUtils.whiteSpaceClassMapping[whiteSpace] : '', " ").concat(className),
|
|
35
38
|
onClick: onClick,
|
|
36
39
|
onDoubleClick: onDoubleClick,
|
|
37
40
|
'data-title': dataTitle || title,
|
|
38
41
|
'data-id': dataId,
|
|
39
|
-
'data-test-id': dataId
|
|
42
|
+
'data-test-id': dataId,
|
|
43
|
+
'data-title-wrap': whiteSpace
|
|
40
44
|
}, a11y), title);
|
|
41
45
|
}
|
|
42
46
|
|
|
@@ -17,6 +17,7 @@ var propTypes = {
|
|
|
17
17
|
dataTitle: _propTypes["default"].string,
|
|
18
18
|
onClick: _propTypes["default"].func,
|
|
19
19
|
onDoubleClick: _propTypes["default"].func,
|
|
20
|
-
a11y: _propTypes["default"].object
|
|
20
|
+
a11y: _propTypes["default"].object,
|
|
21
|
+
whiteSpace: _propTypes["default"].oneOf(['normal', 'nowrap', 'pre', 'pre-line', 'pre-wrap', 'break-spaces'])
|
|
21
22
|
};
|
|
22
23
|
exports.propTypes = propTypes;
|