@zohodesk/dot 1.9.15 → 1.9.16
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/README.md +16 -0
- package/es/Drawer/Drawer.js +5 -1
- package/es/Drawer/props/propTypes.js +2 -0
- package/es/FormAction/FormAction.js +18 -5
- package/es/FormAction/__tests__/FormAction.spec.js +97 -3
- package/es/FormAction/__tests__/__snapshots__/FormAction.spec.js.snap +536 -1
- package/es/FormAction/props/propTypes.js +2 -0
- package/es/lookup/Lookup/Lookup.js +47 -18
- package/es/lookup/Lookup/Lookup.module.css +19 -0
- package/es/lookup/Lookup/__tests__/Lookup.spec.js +120 -4
- package/es/lookup/Lookup/__tests__/__snapshots__/Lookup.spec.js.snap +284 -2
- package/es/lookup/Lookup/props/defaultProps.js +3 -2
- package/es/lookup/Lookup/props/propTypes.js +12 -2
- package/es/lookup/Section/Section.js +14 -5
- package/es/lookup/Section/__tests__/Section.spec.js +41 -2
- package/es/lookup/Section/__tests__/__snapshots__/Section.spec.js.snap +131 -1
- package/es/lookup/Section/props/defaultProps.js +4 -0
- package/es/lookup/Section/props/propTypes.js +5 -0
- package/es/lookup/header/ModuleHeader/ModuleHeader.js +47 -18
- package/es/lookup/header/ModuleHeader/__tests__/ModuleHeader.spec.js +172 -3
- package/es/lookup/header/ModuleHeader/__tests__/__snapshots__/ModuleHeader.spec.js.snap +779 -3
- package/es/lookup/header/ModuleHeader/props/defaultProps.js +4 -0
- package/es/lookup/header/ModuleHeader/props/propTypes.js +21 -1
- package/es/lookup/header/Title/Title.js +3 -1
- package/es/lookup/header/Title/props/propTypes.js +1 -0
- package/es/version2/lookup/AlertHeader/AlertHeader.js +16 -7
- package/es/version2/lookup/AlertHeader/__tests__/AlertHeader.spec.js +114 -3
- package/es/version2/lookup/AlertHeader/__tests__/__snapshots__/AlertHeader.spec.js.snap +1695 -8
- package/es/version2/lookup/AlertHeader/css/cssJSLogic.js +8 -3
- package/es/version2/lookup/AlertHeader/props/defaultProps.js +3 -0
- package/es/version2/lookup/AlertHeader/props/propTypes.js +9 -0
- package/lib/Drawer/Drawer.js +5 -1
- package/lib/Drawer/props/propTypes.js +2 -0
- package/lib/FormAction/FormAction.js +18 -5
- package/lib/FormAction/__tests__/FormAction.spec.js +102 -2
- package/lib/FormAction/__tests__/__snapshots__/FormAction.spec.js.snap +536 -1
- package/lib/FormAction/props/propTypes.js +2 -0
- package/lib/lookup/Lookup/Lookup.js +50 -18
- package/lib/lookup/Lookup/Lookup.module.css +19 -0
- package/lib/lookup/Lookup/__tests__/Lookup.spec.js +120 -4
- package/lib/lookup/Lookup/__tests__/__snapshots__/Lookup.spec.js.snap +284 -2
- package/lib/lookup/Lookup/props/defaultProps.js +3 -2
- package/lib/lookup/Lookup/props/propTypes.js +15 -2
- package/lib/lookup/Section/Section.js +13 -5
- package/lib/lookup/Section/__tests__/Section.spec.js +40 -1
- package/lib/lookup/Section/__tests__/__snapshots__/Section.spec.js.snap +131 -1
- package/lib/lookup/Section/props/defaultProps.js +13 -0
- package/lib/lookup/Section/props/propTypes.js +6 -0
- package/lib/lookup/header/ModuleHeader/ModuleHeader.js +46 -24
- package/lib/lookup/header/ModuleHeader/__tests__/ModuleHeader.spec.js +177 -2
- package/lib/lookup/header/ModuleHeader/__tests__/__snapshots__/ModuleHeader.spec.js.snap +779 -3
- package/lib/lookup/header/ModuleHeader/props/defaultProps.js +6 -0
- package/lib/lookup/header/ModuleHeader/props/propTypes.js +25 -1
- package/lib/lookup/header/Title/Title.js +3 -1
- package/lib/lookup/header/Title/props/propTypes.js +1 -0
- package/lib/version2/lookup/AlertHeader/AlertHeader.js +18 -8
- package/lib/version2/lookup/AlertHeader/__tests__/AlertHeader.spec.js +113 -2
- package/lib/version2/lookup/AlertHeader/__tests__/__snapshots__/AlertHeader.spec.js.snap +1695 -8
- package/lib/version2/lookup/AlertHeader/css/cssJSLogic.js +7 -3
- package/lib/version2/lookup/AlertHeader/props/defaultProps.js +5 -0
- package/lib/version2/lookup/AlertHeader/props/propTypes.js +9 -0
- package/package.json +1 -1
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
+
import { ContainerProps } from '@zohodesk/components/es/Layout/props/propTypes';
|
|
3
|
+
import { propTypes as titlePropTypes } from "../../Title/props/propTypes";
|
|
4
|
+
import { propTypes as closePropTypes } from "../../Close/props/propTypes";
|
|
5
|
+
import { Search_propTypes } from "../../Search/props/propTypes";
|
|
2
6
|
export const propTypes = {
|
|
3
7
|
getSearchBoxRef: PropTypes.func,
|
|
4
8
|
miniDescription: PropTypes.string,
|
|
5
9
|
needOnTypeSearch: PropTypes.bool,
|
|
10
|
+
renderTitleChildren: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
11
|
+
renderSecondaryContent: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
6
12
|
needSearch: PropTypes.bool,
|
|
7
13
|
onLookupClose: PropTypes.func,
|
|
8
14
|
onSearch: PropTypes.func,
|
|
@@ -10,11 +16,25 @@ export const propTypes = {
|
|
|
10
16
|
searchPlaceHolder: PropTypes.string,
|
|
11
17
|
searchStr: PropTypes.string,
|
|
12
18
|
title: PropTypes.string,
|
|
19
|
+
htmlId: PropTypes.string,
|
|
13
20
|
dataId: PropTypes.string,
|
|
14
21
|
closeTitle: PropTypes.string,
|
|
15
22
|
onSearchKeyDown: PropTypes.func,
|
|
16
23
|
palette: PropTypes.oneOf(['default', 'white']),
|
|
17
24
|
children: PropTypes.any,
|
|
18
25
|
childNearTitle: PropTypes.any,
|
|
19
|
-
|
|
26
|
+
customClass: PropTypes.shape({
|
|
27
|
+
container: PropTypes.string,
|
|
28
|
+
title: PropTypes.string,
|
|
29
|
+
close: PropTypes.string
|
|
30
|
+
}),
|
|
31
|
+
isDraggable: PropTypes.bool,
|
|
32
|
+
dragBoundaryLimit: PropTypes.object,
|
|
33
|
+
customProps: PropTypes.shape({
|
|
34
|
+
container: PropTypes.shape(ContainerProps),
|
|
35
|
+
titleWrapper: PropTypes.shape(ContainerProps),
|
|
36
|
+
title: PropTypes.shape(titlePropTypes),
|
|
37
|
+
search: PropTypes.shape(Search_propTypes),
|
|
38
|
+
close: PropTypes.shape(closePropTypes)
|
|
39
|
+
})
|
|
20
40
|
};
|
|
@@ -10,9 +10,11 @@ export default class Title extends PureComponent {
|
|
|
10
10
|
let {
|
|
11
11
|
text,
|
|
12
12
|
palette,
|
|
13
|
-
isBold
|
|
13
|
+
isBold,
|
|
14
|
+
htmlId
|
|
14
15
|
} = this.props;
|
|
15
16
|
return /*#__PURE__*/React.createElement("span", {
|
|
17
|
+
id: htmlId,
|
|
16
18
|
className: `${style.title} ${style[palette]} ${isBold ? style.bold : ''}`,
|
|
17
19
|
"data-title": text
|
|
18
20
|
}, text);
|
|
@@ -7,7 +7,7 @@ import renderNode from '@zohodesk/utils/es/renderNode'; //CSS
|
|
|
7
7
|
|
|
8
8
|
import style from "./css/AlertHeaderNew.module.css";
|
|
9
9
|
import cssJSLogic from "./css/cssJSLogic";
|
|
10
|
-
import
|
|
10
|
+
import mergeStyle from '@zohodesk/utils/es/mergeStyle'; //customHooks
|
|
11
11
|
|
|
12
12
|
import useDragger from "../../../Hooks/Dragger/useDragger"; //Props
|
|
13
13
|
|
|
@@ -26,9 +26,18 @@ export default function AlertHeader(props) {
|
|
|
26
26
|
htmlId,
|
|
27
27
|
customStyle,
|
|
28
28
|
dragBoundaryLimit,
|
|
29
|
+
isDraggable,
|
|
30
|
+
customClass,
|
|
31
|
+
renderSecondaryContent,
|
|
32
|
+
renderRightActions,
|
|
29
33
|
renderAlertIcon
|
|
30
34
|
} = props;
|
|
31
35
|
const finalStyle = mergeStyle(style, customStyle);
|
|
36
|
+
const {
|
|
37
|
+
title: titleClass = '',
|
|
38
|
+
iconContainer: iconContainerClass = '',
|
|
39
|
+
close: closeClass = ''
|
|
40
|
+
} = customClass;
|
|
32
41
|
const {
|
|
33
42
|
alertHeaderContainerClass
|
|
34
43
|
} = cssJSLogic({
|
|
@@ -38,7 +47,7 @@ export default function AlertHeader(props) {
|
|
|
38
47
|
const dragRef = useRef(null); //dragRef
|
|
39
48
|
|
|
40
49
|
useDragger({
|
|
41
|
-
isActive:
|
|
50
|
+
isActive: isDraggable,
|
|
42
51
|
ChildRef: dragRef,
|
|
43
52
|
boundaryLimit: dragBoundaryLimit
|
|
44
53
|
}); //custom Hook
|
|
@@ -49,10 +58,10 @@ export default function AlertHeader(props) {
|
|
|
49
58
|
className: `${alertHeaderContainerClass}`,
|
|
50
59
|
isCover: false,
|
|
51
60
|
wrap: "wrap",
|
|
52
|
-
"data-drag-hook":
|
|
61
|
+
"data-drag-hook": isDraggable ? 'true' : 'false',
|
|
53
62
|
eleRef: dragRef
|
|
54
63
|
}, needIcon && /*#__PURE__*/React.createElement("div", {
|
|
55
|
-
className: finalStyle.iconContainer
|
|
64
|
+
className: `${finalStyle.iconContainer} ${iconContainerClass}`
|
|
56
65
|
}, renderNode(renderAlertIcon) || /*#__PURE__*/React.createElement(AlertIcons, {
|
|
57
66
|
type: type
|
|
58
67
|
})), (title || children) && /*#__PURE__*/React.createElement(Box, {
|
|
@@ -61,14 +70,14 @@ export default function AlertHeader(props) {
|
|
|
61
70
|
alignBox: "row",
|
|
62
71
|
wrap: breakChildren ? 'wrap' : null
|
|
63
72
|
}, title && /*#__PURE__*/React.createElement(Box, {
|
|
64
|
-
className: finalStyle.title
|
|
73
|
+
className: `${finalStyle.title} ${titleClass}`,
|
|
65
74
|
shrink: true,
|
|
66
75
|
id: htmlId
|
|
67
76
|
}, title), children && /*#__PURE__*/React.createElement(Box, {
|
|
68
77
|
adjust: true,
|
|
69
78
|
flexible: true
|
|
70
|
-
}, children))), onClose && /*#__PURE__*/React.createElement(Box, {
|
|
71
|
-
className:
|
|
79
|
+
}, children)), renderNode(renderSecondaryContent)), renderNode(renderRightActions), onClose && /*#__PURE__*/React.createElement(Box, {
|
|
80
|
+
className: `${finalStyle.close} ${closeClass}`
|
|
72
81
|
}, /*#__PURE__*/React.createElement(AlertClose, {
|
|
73
82
|
onClose: onClose,
|
|
74
83
|
dataTitle: closeTitle,
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { render, cleanup } from '@testing-library/react';
|
|
3
3
|
import AlertHeader from "../AlertHeader";
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const TYPE_VALUES = ['success', 'error', 'warning', 'info', 'notification'];
|
|
5
|
+
afterEach(() => {
|
|
6
|
+
cleanup();
|
|
7
|
+
});
|
|
8
|
+
describe('AlertHeader snapshot - ', () => {
|
|
9
|
+
test('Render with default props', () => {
|
|
6
10
|
const {
|
|
7
11
|
asFragment
|
|
8
12
|
} = render( /*#__PURE__*/React.createElement(AlertHeader, null));
|
|
@@ -32,4 +36,111 @@ describe('AlertHeader', () => {
|
|
|
32
36
|
}));
|
|
33
37
|
expect(asFragment()).toMatchSnapshot();
|
|
34
38
|
});
|
|
39
|
+
test.each(TYPE_VALUES)('Render with type=%s', type => {
|
|
40
|
+
const {
|
|
41
|
+
asFragment
|
|
42
|
+
} = render( /*#__PURE__*/React.createElement(AlertHeader, {
|
|
43
|
+
title: "Alert Title",
|
|
44
|
+
type: type
|
|
45
|
+
}));
|
|
46
|
+
expect(asFragment()).toMatchSnapshot();
|
|
47
|
+
});
|
|
48
|
+
test('Render with needIcon=false', () => {
|
|
49
|
+
const {
|
|
50
|
+
asFragment
|
|
51
|
+
} = render( /*#__PURE__*/React.createElement(AlertHeader, {
|
|
52
|
+
title: "Alert Title",
|
|
53
|
+
needIcon: false
|
|
54
|
+
}));
|
|
55
|
+
expect(asFragment()).toMatchSnapshot();
|
|
56
|
+
});
|
|
57
|
+
test('Render with breakChildren=true', () => {
|
|
58
|
+
const {
|
|
59
|
+
asFragment
|
|
60
|
+
} = render( /*#__PURE__*/React.createElement(AlertHeader, {
|
|
61
|
+
title: "Alert Title",
|
|
62
|
+
breakChildren: true
|
|
63
|
+
}));
|
|
64
|
+
expect(asFragment()).toMatchSnapshot();
|
|
65
|
+
});
|
|
66
|
+
test('Render with onClose', () => {
|
|
67
|
+
const {
|
|
68
|
+
asFragment
|
|
69
|
+
} = render( /*#__PURE__*/React.createElement(AlertHeader, {
|
|
70
|
+
title: "Alert Title",
|
|
71
|
+
onClose: () => {}
|
|
72
|
+
}));
|
|
73
|
+
expect(asFragment()).toMatchSnapshot();
|
|
74
|
+
});
|
|
75
|
+
test('Render with title', () => {
|
|
76
|
+
const {
|
|
77
|
+
asFragment
|
|
78
|
+
} = render( /*#__PURE__*/React.createElement(AlertHeader, {
|
|
79
|
+
title: "Alert Title"
|
|
80
|
+
}));
|
|
81
|
+
expect(asFragment()).toMatchSnapshot();
|
|
82
|
+
});
|
|
83
|
+
test('Render with isDraggable=false', () => {
|
|
84
|
+
const {
|
|
85
|
+
asFragment
|
|
86
|
+
} = render( /*#__PURE__*/React.createElement(AlertHeader, {
|
|
87
|
+
title: "Alert Title",
|
|
88
|
+
isDraggable: false
|
|
89
|
+
}));
|
|
90
|
+
expect(asFragment()).toMatchSnapshot();
|
|
91
|
+
});
|
|
92
|
+
test('Render with children', () => {
|
|
93
|
+
const {
|
|
94
|
+
asFragment
|
|
95
|
+
} = render( /*#__PURE__*/React.createElement(AlertHeader, {
|
|
96
|
+
title: "Alert Title"
|
|
97
|
+
}, /*#__PURE__*/React.createElement("span", null, "Child content")));
|
|
98
|
+
expect(asFragment()).toMatchSnapshot();
|
|
99
|
+
});
|
|
100
|
+
test('Render with customClass', () => {
|
|
101
|
+
const {
|
|
102
|
+
asFragment
|
|
103
|
+
} = render( /*#__PURE__*/React.createElement(AlertHeader, {
|
|
104
|
+
title: "Alert Title",
|
|
105
|
+
onClose: () => {},
|
|
106
|
+
customClass: {
|
|
107
|
+
container: 'custom-container-class',
|
|
108
|
+
title: 'custom-title-class',
|
|
109
|
+
iconContainer: 'custom-icon-class',
|
|
110
|
+
close: 'custom-close-class'
|
|
111
|
+
}
|
|
112
|
+
}));
|
|
113
|
+
expect(asFragment()).toMatchSnapshot();
|
|
114
|
+
});
|
|
115
|
+
test('Render with renderSecondaryContent', () => {
|
|
116
|
+
const {
|
|
117
|
+
asFragment
|
|
118
|
+
} = render( /*#__PURE__*/React.createElement(AlertHeader, {
|
|
119
|
+
title: "Alert Title",
|
|
120
|
+
renderSecondaryContent: /*#__PURE__*/React.createElement("span", null, "Secondary")
|
|
121
|
+
}));
|
|
122
|
+
expect(asFragment()).toMatchSnapshot();
|
|
123
|
+
});
|
|
124
|
+
test('Render with renderRightActions', () => {
|
|
125
|
+
const {
|
|
126
|
+
asFragment
|
|
127
|
+
} = render( /*#__PURE__*/React.createElement(AlertHeader, {
|
|
128
|
+
title: "Alert Title",
|
|
129
|
+
renderRightActions: /*#__PURE__*/React.createElement("button", {
|
|
130
|
+
type: "button"
|
|
131
|
+
}, "Action")
|
|
132
|
+
}));
|
|
133
|
+
expect(asFragment()).toMatchSnapshot();
|
|
134
|
+
});
|
|
135
|
+
test('Render with dataId and htmlId', () => {
|
|
136
|
+
const {
|
|
137
|
+
asFragment
|
|
138
|
+
} = render( /*#__PURE__*/React.createElement(AlertHeader, {
|
|
139
|
+
title: "Alert Title",
|
|
140
|
+
htmlId: "alert-header-title",
|
|
141
|
+
dataId: "alert-header",
|
|
142
|
+
onClose: () => {}
|
|
143
|
+
}));
|
|
144
|
+
expect(asFragment()).toMatchSnapshot();
|
|
145
|
+
});
|
|
35
146
|
});
|