@zohodesk/dot 1.9.14 → 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.
Files changed (68) hide show
  1. package/README.md +22 -0
  2. package/es/Drawer/Drawer.js +5 -1
  3. package/es/Drawer/props/propTypes.js +2 -0
  4. package/es/FormAction/FormAction.js +18 -5
  5. package/es/FormAction/__tests__/FormAction.spec.js +97 -3
  6. package/es/FormAction/__tests__/__snapshots__/FormAction.spec.js.snap +536 -1
  7. package/es/FormAction/props/propTypes.js +2 -0
  8. package/es/lookup/Lookup/Lookup.js +47 -18
  9. package/es/lookup/Lookup/Lookup.module.css +19 -0
  10. package/es/lookup/Lookup/__tests__/Lookup.spec.js +120 -4
  11. package/es/lookup/Lookup/__tests__/__snapshots__/Lookup.spec.js.snap +284 -2
  12. package/es/lookup/Lookup/props/defaultProps.js +3 -2
  13. package/es/lookup/Lookup/props/propTypes.js +12 -2
  14. package/es/lookup/Section/Section.js +14 -5
  15. package/es/lookup/Section/__tests__/Section.spec.js +41 -2
  16. package/es/lookup/Section/__tests__/__snapshots__/Section.spec.js.snap +131 -1
  17. package/es/lookup/Section/props/defaultProps.js +4 -0
  18. package/es/lookup/Section/props/propTypes.js +5 -0
  19. package/es/lookup/header/ModuleHeader/ModuleHeader.js +47 -18
  20. package/es/lookup/header/ModuleHeader/__tests__/ModuleHeader.spec.js +172 -3
  21. package/es/lookup/header/ModuleHeader/__tests__/__snapshots__/ModuleHeader.spec.js.snap +779 -3
  22. package/es/lookup/header/ModuleHeader/props/defaultProps.js +4 -0
  23. package/es/lookup/header/ModuleHeader/props/propTypes.js +21 -1
  24. package/es/lookup/header/Title/Title.js +3 -1
  25. package/es/lookup/header/Title/props/propTypes.js +1 -0
  26. package/es/version2/lookup/AlertHeader/AlertHeader.js +16 -7
  27. package/es/version2/lookup/AlertHeader/__tests__/AlertHeader.spec.js +114 -3
  28. package/es/version2/lookup/AlertHeader/__tests__/__snapshots__/AlertHeader.spec.js.snap +1695 -8
  29. package/es/version2/lookup/AlertHeader/css/cssJSLogic.js +8 -3
  30. package/es/version2/lookup/AlertHeader/props/defaultProps.js +3 -0
  31. package/es/version2/lookup/AlertHeader/props/propTypes.js +9 -0
  32. package/es/version2/lookup/AlertLookup/AlertLookup.js +11 -5
  33. package/es/version2/lookup/AlertLookup/props/defaultProps.js +1 -0
  34. package/es/version2/lookup/AlertLookup/props/propTypes.js +1 -0
  35. package/lib/Drawer/Drawer.js +5 -1
  36. package/lib/Drawer/props/propTypes.js +2 -0
  37. package/lib/FormAction/FormAction.js +18 -5
  38. package/lib/FormAction/__tests__/FormAction.spec.js +102 -2
  39. package/lib/FormAction/__tests__/__snapshots__/FormAction.spec.js.snap +536 -1
  40. package/lib/FormAction/props/propTypes.js +2 -0
  41. package/lib/lookup/Lookup/Lookup.js +50 -18
  42. package/lib/lookup/Lookup/Lookup.module.css +19 -0
  43. package/lib/lookup/Lookup/__tests__/Lookup.spec.js +120 -4
  44. package/lib/lookup/Lookup/__tests__/__snapshots__/Lookup.spec.js.snap +284 -2
  45. package/lib/lookup/Lookup/props/defaultProps.js +3 -2
  46. package/lib/lookup/Lookup/props/propTypes.js +15 -2
  47. package/lib/lookup/Section/Section.js +13 -5
  48. package/lib/lookup/Section/__tests__/Section.spec.js +40 -1
  49. package/lib/lookup/Section/__tests__/__snapshots__/Section.spec.js.snap +131 -1
  50. package/lib/lookup/Section/props/defaultProps.js +13 -0
  51. package/lib/lookup/Section/props/propTypes.js +6 -0
  52. package/lib/lookup/header/ModuleHeader/ModuleHeader.js +46 -24
  53. package/lib/lookup/header/ModuleHeader/__tests__/ModuleHeader.spec.js +177 -2
  54. package/lib/lookup/header/ModuleHeader/__tests__/__snapshots__/ModuleHeader.spec.js.snap +779 -3
  55. package/lib/lookup/header/ModuleHeader/props/defaultProps.js +6 -0
  56. package/lib/lookup/header/ModuleHeader/props/propTypes.js +25 -1
  57. package/lib/lookup/header/Title/Title.js +3 -1
  58. package/lib/lookup/header/Title/props/propTypes.js +1 -0
  59. package/lib/version2/lookup/AlertHeader/AlertHeader.js +18 -8
  60. package/lib/version2/lookup/AlertHeader/__tests__/AlertHeader.spec.js +113 -2
  61. package/lib/version2/lookup/AlertHeader/__tests__/__snapshots__/AlertHeader.spec.js.snap +1695 -8
  62. package/lib/version2/lookup/AlertHeader/css/cssJSLogic.js +7 -3
  63. package/lib/version2/lookup/AlertHeader/props/defaultProps.js +5 -0
  64. package/lib/version2/lookup/AlertHeader/props/propTypes.js +9 -0
  65. package/lib/version2/lookup/AlertLookup/AlertLookup.js +11 -8
  66. package/lib/version2/lookup/AlertLookup/props/defaultProps.js +1 -0
  67. package/lib/version2/lookup/AlertLookup/props/propTypes.js +1 -0
  68. package/package.json +8 -8
package/README.md CHANGED
@@ -2,6 +2,28 @@
2
2
 
3
3
  In this Library, we Provide Some Basic Components to Build Your Application
4
4
 
5
+
6
+ # 1.9.16
7
+
8
+ - **FormAction, Drawer.Footer**
9
+ - `testId`, `customId` - Props supported
10
+ - **Lookup**
11
+ - `placement` property support. **center** placement introduced. Default is *topCenter*.
12
+ - `hasFreezeLayer` property supported for configurable freeze layer.
13
+ - `freezeLayerProps` and `velocityAnimationProps` are supported under `customProps` prop
14
+ - **Section**
15
+ - `customProps` prop supported
16
+ - **ModuleHeader**
17
+ - `renderTitleChildren`, `renderSecondaryContent`, `isDraggable`, `htmlId`, `customClass`, `customProps` - Props supported
18
+ - **version2/AlertHeader**
19
+ - `isDraggable`, `customClass`, `renderSecondaryContent`, `renderRightActions` - Props supported
20
+
21
+ # 1.9.15
22
+
23
+ - **version2/lookup/AlertLookup/AlertLookup**
24
+ - Added `renderFooterNode` prop support using `renderNode`.
25
+ - Footer now renders custom content when `renderFooterNode` is provided; otherwise, existing submit/cancel footer behavior is preserved.
26
+
5
27
  # 1.9.14
6
28
 
7
29
  - Updated `@zohodesk-private/color-variable-preprocessor@1.3.3` package version - CTA category overridden variables are now generated only for the necessary CTA variables using the `buildOverriddenCTACategories` function.
@@ -119,12 +119,16 @@ export class Footer extends React.Component {
119
119
  paddingLeftSize,
120
120
  paddingRightClass,
121
121
  children,
122
+ testId,
123
+ customId,
122
124
  size
123
125
  } = this.props;
124
126
  return /*#__PURE__*/React.createElement(FormAction, {
125
127
  size: size,
126
128
  paddingLeftSize: paddingLeftSize,
127
- paddingRightClass: paddingRightClass
129
+ paddingRightClass: paddingRightClass,
130
+ customId: customId,
131
+ testId: testId
128
132
  }, children);
129
133
  }
130
134
 
@@ -27,6 +27,8 @@ export const Footer_propTypes = {
27
27
  children: PropTypes.node,
28
28
  paddingLeftSize: PropTypes.string,
29
29
  paddingRightClass: PropTypes.string,
30
+ testId: PropTypes.string,
31
+ customId: PropTypes.string,
30
32
  size: PropTypes.string
31
33
  };
32
34
  export const Drawer_propTypes = {
@@ -19,7 +19,9 @@ export default class FormAction extends React.Component {
19
19
  children,
20
20
  paddingLeftSize,
21
21
  paddingRightClass,
22
- dataSelectorId
22
+ dataSelectorId,
23
+ testId,
24
+ customId
23
25
  } = this.props;
24
26
  let leftbuttonGroup = [],
25
27
  rightbuttonGroup = [],
@@ -42,11 +44,15 @@ export default class FormAction extends React.Component {
42
44
  let hasCenterChild = centerbuttonGroup.length > 0;
43
45
  return /*#__PURE__*/React.createElement("div", {
44
46
  className: style.wrapperDiv,
45
- "data-selector-id": dataSelectorId
47
+ "data-selector-id": dataSelectorId,
48
+ "data-test-id": testId,
49
+ "data-id": customId
46
50
  }, /*#__PURE__*/React.createElement(Container, {
47
51
  alignBox: "row",
48
52
  isCover: false,
49
53
  align: hasCenterChild ? 'around' : hasRightChild && !hasLeftChild ? 'right' : null,
54
+ dataId: customId ? `${customId}_container` : undefined,
55
+ testId: testId ? `${testId}_container` : undefined,
50
56
  className: `
51
57
  ${`${style.footerParent} ${hasCenterChild ? '' : style[`${paddingLeftSize ? paddingLeftSize : size}Padding`]} ${paddingRightClass}`}
52
58
 
@@ -54,16 +60,23 @@ export default class FormAction extends React.Component {
54
60
  `
55
61
  }, hasLeftChild ? /*#__PURE__*/React.createElement(Box, {
56
62
  flexible: hasRightChild ? true : false,
57
- shrink: !hasRightChild && hasLeftChild ? true : false
63
+ shrink: !hasRightChild && hasLeftChild ? true : false,
64
+ dataId: customId ? `${customId}_leftElement` : undefined,
65
+ testId: testId ? `${testId}_leftElement` : undefined
58
66
  }, leftbuttonGroup.length > 1 ? leftbuttonGroup.map((item, index) => /*#__PURE__*/React.createElement("div", {
59
67
  className: style.marginRight,
60
68
  key: index
61
69
  }, item)) : leftbuttonGroup[0]) : null, hasRightChild ? /*#__PURE__*/React.createElement(Box, {
62
- shrink: hasRightChild && !hasLeftChild ? true : false
70
+ shrink: hasRightChild && !hasLeftChild ? true : false,
71
+ dataId: customId ? `${customId}_rightElement` : undefined,
72
+ testId: testId ? `${testId}_rightElement` : undefined
63
73
  }, rightbuttonGroup.length > 1 ? rightbuttonGroup.map((item, index) => /*#__PURE__*/React.createElement("div", {
64
74
  className: style.marginRight,
65
75
  key: index
66
- }, item)) : rightbuttonGroup[0]) : null, hasCenterChild ? /*#__PURE__*/React.createElement(Box, null, centerbuttonGroup.length > 1 ? centerbuttonGroup.map((item, index) => /*#__PURE__*/React.createElement("div", {
76
+ }, item)) : rightbuttonGroup[0]) : null, hasCenterChild ? /*#__PURE__*/React.createElement(Box, {
77
+ dataId: customId ? `${customId}_centerElement` : undefined,
78
+ testId: testId ? `${testId}_centerElement` : undefined
79
+ }, centerbuttonGroup.length > 1 ? centerbuttonGroup.map((item, index) => /*#__PURE__*/React.createElement("div", {
67
80
  className: style.marginRight,
68
81
  key: index
69
82
  }, item)) : centerbuttonGroup[0]) : null));
@@ -1,11 +1,105 @@
1
1
  import React from 'react';
2
- import { render } from '@testing-library/react';
3
- import FormAction from "../FormAction";
2
+ import { render, cleanup } from '@testing-library/react';
3
+ import FormAction, { LeftSide, RightSide, Center } from "../FormAction";
4
4
  describe('FormAction', () => {
5
- test('rendering the defult props', () => {
5
+ afterEach(() => {
6
+ cleanup();
7
+ });
8
+ const sizes = ['large', 'medium', 'small'];
9
+ const paddingLeftSizes = ['large', 'medium', 'xmedium', 'small', 'xsmall'];
10
+ test('Render with default props', () => {
6
11
  const {
7
12
  asFragment
8
13
  } = render( /*#__PURE__*/React.createElement(FormAction, null));
9
14
  expect(asFragment()).toMatchSnapshot();
10
15
  });
16
+ test.each(sizes)('Render with size as %s', size => {
17
+ const {
18
+ asFragment
19
+ } = render( /*#__PURE__*/React.createElement(FormAction, {
20
+ size: size
21
+ }));
22
+ expect(asFragment()).toMatchSnapshot();
23
+ });
24
+ test.each(paddingLeftSizes)('Render with paddingLeftSize as %s', paddingLeftSize => {
25
+ const {
26
+ asFragment
27
+ } = render( /*#__PURE__*/React.createElement(FormAction, {
28
+ paddingLeftSize: paddingLeftSize
29
+ }));
30
+ expect(asFragment()).toMatchSnapshot();
31
+ });
32
+ test('Render with paddingRightClass', () => {
33
+ const {
34
+ asFragment
35
+ } = render( /*#__PURE__*/React.createElement(FormAction, {
36
+ paddingRightClass: "customPaddingRight"
37
+ }));
38
+ expect(asFragment()).toMatchSnapshot();
39
+ });
40
+ test('Render with LeftSide children', () => {
41
+ const {
42
+ asFragment
43
+ } = render( /*#__PURE__*/React.createElement(FormAction, null, /*#__PURE__*/React.createElement(LeftSide, null, /*#__PURE__*/React.createElement("button", null, "Save"))));
44
+ expect(asFragment()).toMatchSnapshot();
45
+ });
46
+ test('Render with RightSide children', () => {
47
+ const {
48
+ asFragment
49
+ } = render( /*#__PURE__*/React.createElement(FormAction, null, /*#__PURE__*/React.createElement(RightSide, null, /*#__PURE__*/React.createElement("button", null, "Cancel"))));
50
+ expect(asFragment()).toMatchSnapshot();
51
+ });
52
+ test('Render with Center children', () => {
53
+ const {
54
+ asFragment
55
+ } = render( /*#__PURE__*/React.createElement(FormAction, null, /*#__PURE__*/React.createElement(Center, null, /*#__PURE__*/React.createElement("button", null, "Submit"))));
56
+ expect(asFragment()).toMatchSnapshot();
57
+ });
58
+ test('Render with LeftSide, Center and RightSide children', () => {
59
+ const {
60
+ asFragment
61
+ } = render( /*#__PURE__*/React.createElement(FormAction, null, /*#__PURE__*/React.createElement(LeftSide, null, /*#__PURE__*/React.createElement("button", null, "Save")), /*#__PURE__*/React.createElement(Center, null, /*#__PURE__*/React.createElement("button", null, "Preview")), /*#__PURE__*/React.createElement(RightSide, null, /*#__PURE__*/React.createElement("button", null, "Cancel"))));
62
+ expect(asFragment()).toMatchSnapshot();
63
+ });
64
+ test('Render with multiple children in LeftSide', () => {
65
+ const {
66
+ asFragment
67
+ } = render( /*#__PURE__*/React.createElement(FormAction, null, /*#__PURE__*/React.createElement(LeftSide, null, /*#__PURE__*/React.createElement("button", null, "Save"), /*#__PURE__*/React.createElement("button", null, "Draft"))));
68
+ expect(asFragment()).toMatchSnapshot();
69
+ });
70
+ test('Render with multiple children in RightSide', () => {
71
+ const {
72
+ asFragment
73
+ } = render( /*#__PURE__*/React.createElement(FormAction, null, /*#__PURE__*/React.createElement(RightSide, null, /*#__PURE__*/React.createElement("button", null, "Cancel"), /*#__PURE__*/React.createElement("button", null, "Reset"))));
74
+ expect(asFragment()).toMatchSnapshot();
75
+ });
76
+ test('Render with multiple children in Center', () => {
77
+ const {
78
+ asFragment
79
+ } = render( /*#__PURE__*/React.createElement(FormAction, null, /*#__PURE__*/React.createElement(Center, null, /*#__PURE__*/React.createElement("button", null, "Submit"), /*#__PURE__*/React.createElement("button", null, "Preview"))));
80
+ expect(asFragment()).toMatchSnapshot();
81
+ });
82
+ test('Render with direct child (defaults to left group)', () => {
83
+ const {
84
+ asFragment
85
+ } = render( /*#__PURE__*/React.createElement(FormAction, null, /*#__PURE__*/React.createElement("button", null, "Standalone")));
86
+ expect(asFragment()).toMatchSnapshot();
87
+ });
88
+ test('Render with customId and testId', () => {
89
+ const {
90
+ asFragment
91
+ } = render( /*#__PURE__*/React.createElement(FormAction, {
92
+ customId: "form-action-customId",
93
+ testId: "form-action-testId"
94
+ }, /*#__PURE__*/React.createElement(LeftSide, null, /*#__PURE__*/React.createElement("button", null, "Save")), /*#__PURE__*/React.createElement(Center, null, /*#__PURE__*/React.createElement("button", null, "Preview")), /*#__PURE__*/React.createElement(RightSide, null, /*#__PURE__*/React.createElement("button", null, "Cancel"))));
95
+ expect(asFragment()).toMatchSnapshot();
96
+ });
97
+ test('Render with dataSelectorId', () => {
98
+ const {
99
+ asFragment
100
+ } = render( /*#__PURE__*/React.createElement(FormAction, {
101
+ dataSelectorId: "form-action-dataSelectorId"
102
+ }));
103
+ expect(asFragment()).toMatchSnapshot();
104
+ });
11
105
  });