@zohodesk/dot 1.8.2 → 1.8.4

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 (28) hide show
  1. package/README.md +13 -0
  2. package/es/FlipCard/__tests__/__snapshots__/FlipCard.spec.js.snap +74 -74
  3. package/es/form/fields/CheckBoxField/__tests__/__snapshots__/CheckBoxField.spec.js.snap +3 -3
  4. package/es/form/fields/Fields.module.css +8 -3
  5. package/es/form/fields/RadioField/RadioField.js +40 -14
  6. package/es/form/fields/RadioField/__tests__/RadioField.spec.js +33 -0
  7. package/es/form/fields/RadioField/__tests__/__snapshots__/RadioField.spec.js.snap +573 -77
  8. package/es/form/fields/RadioField/props/defaultProps.js +1 -0
  9. package/es/form/fields/RadioField/props/propTypes.js +6 -0
  10. package/es/form/fields/ValidationMessage/ValidationMessage.js +57 -16
  11. package/es/form/fields/ValidationMessage/__tests__/__snapshots__/ValidationMessage.spec.js.snap +2 -2
  12. package/es/form/fields/ValidationMessage/props/defaultProps.js +2 -1
  13. package/es/form/fields/ValidationMessage/props/propTypes.js +18 -4
  14. package/es/list/AvatarFlip/__tests__/__snapshots__/AvatarFlip.spec.js.snap +1 -1
  15. package/lib/FlipCard/__tests__/__snapshots__/FlipCard.spec.js.snap +74 -74
  16. package/lib/form/fields/CheckBoxField/__tests__/__snapshots__/CheckBoxField.spec.js.snap +3 -3
  17. package/lib/form/fields/Fields.module.css +8 -3
  18. package/lib/form/fields/RadioField/RadioField.js +39 -15
  19. package/lib/form/fields/RadioField/__tests__/RadioField.spec.js +33 -0
  20. package/lib/form/fields/RadioField/__tests__/__snapshots__/RadioField.spec.js.snap +573 -77
  21. package/lib/form/fields/RadioField/props/defaultProps.js +1 -0
  22. package/lib/form/fields/RadioField/props/propTypes.js +6 -0
  23. package/lib/form/fields/ValidationMessage/ValidationMessage.js +73 -18
  24. package/lib/form/fields/ValidationMessage/__tests__/__snapshots__/ValidationMessage.spec.js.snap +2 -2
  25. package/lib/form/fields/ValidationMessage/props/defaultProps.js +2 -1
  26. package/lib/form/fields/ValidationMessage/props/propTypes.js +18 -4
  27. package/lib/list/AvatarFlip/__tests__/__snapshots__/AvatarFlip.spec.js.snap +1 -1
  28. package/package.json +9 -9
@@ -8,6 +8,7 @@ export const defaultProps = {
8
8
  labelSize: 'medium',
9
9
  labelPalette: 'default',
10
10
  isActive: false,
11
+ customClass: {},
11
12
  customProps: {},
12
13
  dataSelectorId: 'radioField'
13
14
  };
@@ -22,6 +22,12 @@ export const propTypes = {
22
22
  validationRuleMessage: PropTypes.string,
23
23
  validationRulePalette: PropTypes.string,
24
24
  variant: PropTypes.oneOf(['primary', 'default', 'secondary']),
25
+ customClass: {
26
+ customWrapperClass: PropTypes.string,
27
+ customLabelClass: PropTypes.string,
28
+ customRadioWrapperClass: PropTypes.string,
29
+ customRadioClass: PropTypes.string
30
+ },
25
31
  customProps: PropTypes.shape({
26
32
  LabelProps: PropTypes.object,
27
33
  RadioProps: PropTypes.object,
@@ -1,11 +1,20 @@
1
1
  import React from 'react';
2
2
  import { defaultProps } from "./props/defaultProps";
3
3
  import { propTypes } from "./props/propTypes";
4
+ import Flex from '@zohodesk/layout/es/Flex/Flex';
5
+ import { renderNode, isRenderable } from '@zohodesk/utils';
4
6
  import Label from '@zohodesk/components/es/Label/Label';
5
7
  import colors from '@zohodesk/components/es/Label/LabelColors.module.css';
6
- import style from "./ValidationMessage.module.css";
7
8
  import { Icon } from '@zohodesk/icons';
9
+ import { DUMMY_OBJECT } from '@zohodesk/components/es/utils/Common';
10
+ import style from "./ValidationMessage.module.css";
8
11
  export default class ValidationMessage extends React.Component {
12
+ constructor(props) {
13
+ super(props);
14
+ this.a11yMerged = {};
15
+ this.tagMerged = {};
16
+ }
17
+
9
18
  render() {
10
19
  let {
11
20
  palette,
@@ -16,21 +25,52 @@ export default class ValidationMessage extends React.Component {
16
25
  size,
17
26
  dataId,
18
27
  clipped,
19
- a11y,
28
+ alignChildren,
20
29
  tooltip,
21
- dataSelectorId
30
+ dataSelectorId,
31
+ renderLeftChildren,
32
+ renderRightChildren,
33
+ id,
34
+ customProps,
35
+ a11yAttributes,
36
+ tagAttributes,
37
+ customClass
22
38
  } = this.props;
23
- let {
24
- role = 'alert'
25
- } = a11y;
26
- return /*#__PURE__*/React.createElement("div", {
27
- role: role,
28
- onClick: onClick,
29
- className: `${type === 'primary' ? style.primary : style.secondary}`,
30
- "data-id": "errorMsgContainer",
31
- "data-test-id": "errorMsgContainer",
32
- "data-selector-id": dataSelectorId
33
- }, /*#__PURE__*/React.createElement(Label, {
39
+ const {
40
+ wrapper: wrapperProps
41
+ } = customProps || DUMMY_OBJECT;
42
+ const {
43
+ label: customLabelClass = '',
44
+ wrapper: customWrapperClass = ''
45
+ } = customClass || DUMMY_OBJECT;
46
+ const {
47
+ wrapper: wrapperA11y
48
+ } = a11yAttributes || DUMMY_OBJECT;
49
+ const {
50
+ wrapper: wrapperTagAttr
51
+ } = tagAttributes || DUMMY_OBJECT;
52
+ const isLeftChildrenRenderable = isRenderable(renderLeftChildren);
53
+ const isRightChildrenRenderable = isRenderable(renderRightChildren);
54
+ this.a11yMerged = {
55
+ wrapper: { ...wrapperA11y,
56
+ role: 'alert'
57
+ }
58
+ };
59
+ this.tagMerged = {
60
+ wrapper: { ...wrapperTagAttr,
61
+ 'data-selector-id': dataSelectorId
62
+ }
63
+ };
64
+ return /*#__PURE__*/React.createElement(Flex, { ...wrapperProps,
65
+ $ui_alignItems: alignChildren,
66
+ $ui_displayMode: isRightChildrenRenderable || isLeftChildrenRenderable ? 'flex' : null,
67
+ $event_onClick: onClick,
68
+ testId: "errorMsgContainer",
69
+ customId: "errorMsgContainer",
70
+ $ui_className: `${type === 'primary' ? style.primary : style.secondary} ${customWrapperClass}`,
71
+ $a11yAttributes_container: this.a11yMerged.wrapper,
72
+ $tagAttributes_container: this.tagMerged.wrapper
73
+ }, renderNode(renderLeftChildren), /*#__PURE__*/React.createElement(Label, {
34
74
  text: text,
35
75
  htmlFor: htmlFor,
36
76
  palette: palette,
@@ -38,14 +78,15 @@ export default class ValidationMessage extends React.Component {
38
78
  dataId: dataId,
39
79
  clipped: clipped,
40
80
  title: clipped ? text : '',
41
- customClass: style.lable
81
+ customClass: `${style.lable} ${customLabelClass}`,
82
+ id: id
42
83
  }), tooltip ? /*#__PURE__*/React.createElement("span", {
43
84
  className: `${style.icon} ${colors[palette]}`,
44
85
  "data-title": tooltip
45
86
  }, /*#__PURE__*/React.createElement(Icon, {
46
87
  name: "ZD-information57",
47
88
  size: "14"
48
- })) : null);
89
+ })) : null, renderNode(renderRightChildren));
49
90
  }
50
91
 
51
92
  }
@@ -3,7 +3,7 @@
3
3
  exports[`ValidationMessage rendering the defult props 1`] = `
4
4
  <DocumentFragment>
5
5
  <div
6
- class="primary"
6
+ class="primary "
7
7
  data-id="errorMsgContainer"
8
8
  data-selector-id="validationMessage"
9
9
  data-test-id="errorMsgContainer"
@@ -11,7 +11,7 @@ exports[`ValidationMessage rendering the defult props 1`] = `
11
11
  >
12
12
  <label
13
13
  class="label title xsmall mandatory font_default
14
- cursor lable "
14
+ cursor lable "
15
15
  data-id="label"
16
16
  data-selector-id="label"
17
17
  data-test-id="label"
@@ -3,5 +3,6 @@ export const defaultProps = {
3
3
  size: 'xsmall',
4
4
  type: 'primary',
5
5
  a11y: {},
6
- dataSelectorId: 'validationMessage'
6
+ dataSelectorId: 'validationMessage',
7
+ alignChildren: 'start'
7
8
  };
@@ -6,11 +6,25 @@ export const propTypes = {
6
6
  size: PropTypes.oneOf(['xsmall', 'small', 'medium', 'large']),
7
7
  text: PropTypes.string,
8
8
  type: PropTypes.oneOf(['primary', 'secondary']),
9
- a11y: PropTypes.shape({
10
- role: PropTypes.string
11
- }),
12
9
  tooltip: PropTypes.string,
13
10
  htmlFor: PropTypes.string,
14
11
  dataId: PropTypes.string,
15
- dataSelectorId: PropTypes.string
12
+ dataSelectorId: PropTypes.string,
13
+ renderLeftChildren: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
14
+ renderRightChildren: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
15
+ id: PropTypes.string,
16
+ alignChildren: PropTypes.oneOf(['start', 'center', 'end', 'baseline']),
17
+ customProps: PropTypes.shape({
18
+ wrapper: PropTypes.object
19
+ }),
20
+ tagAttributes: PropTypes.shape({
21
+ wrapper: PropTypes.object
22
+ }),
23
+ a11yAttributes: PropTypes.shape({
24
+ wrapper: PropTypes.object
25
+ }),
26
+ customClass: PropTypes.shape({
27
+ label: PropTypes.string,
28
+ wrapper: PropTypes.string
29
+ })
16
30
  };
@@ -29,7 +29,7 @@ exports[`AvatarFlip rendering the defult props 1`] = `
29
29
  tabindex="0"
30
30
  >
31
31
  <div
32
- class="boxContainer medium filled shrinkOff"
32
+ class="boxContainer medium filled shrinkOff"
33
33
  data-id="boxComponent"
34
34
  data-selector-id="box"
35
35
  data-test-id="boxComponent"