@zohodesk/dot 1.8.3 → 1.8.5

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 CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  In this Library, we Provide Some Basic Components to Build Your Application
4
4
 
5
+ # 1.8.5
6
+
7
+ - **RadioField**
8
+ - Focus using ref not working - Issue fixed
9
+
10
+ # 1.8.4
11
+
12
+ - **ValidationMessage**
13
+ - `renderLeftChildren`, `renderRightChildren`,`a11yAttributes`,`alignChildren`, `tagAttributes` & `id` prop supports added.
14
+ - Wrapper _Flex_ support ,`customProps` prop supports added.
15
+ - a11y prop removed
16
+
5
17
  # 1.8.3
6
18
 
7
19
  - **RadioField**
@@ -15,13 +15,13 @@ import style from "../Fields.module.css";
15
15
  export default class RadioField extends PureComponent {
16
16
  constructor(props) {
17
17
  super(props);
18
+ this.handleChange = this.handleChange.bind(this);
19
+ this.updateData = this.updateData.bind(this);
20
+ this.handleFocus = this.handleFocus.bind(this);
18
21
  this.data = {
19
22
  radios: {},
20
23
  focus: this.handleFocus
21
24
  };
22
- this.handleChange = this.handleChange.bind(this);
23
- this.updateData = this.updateData.bind(this);
24
- this.handleFocus = this.handleFocus.bind(this);
25
25
  }
26
26
 
27
27
  componentDidMount() {
@@ -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
  };
@@ -70,13 +70,13 @@ var RadioField = /*#__PURE__*/function (_PureComponent) {
70
70
  _classCallCheck(this, RadioField);
71
71
 
72
72
  _this = _super.call(this, props);
73
+ _this.handleChange = _this.handleChange.bind(_assertThisInitialized(_this));
74
+ _this.updateData = _this.updateData.bind(_assertThisInitialized(_this));
75
+ _this.handleFocus = _this.handleFocus.bind(_assertThisInitialized(_this));
73
76
  _this.data = {
74
77
  radios: {},
75
78
  focus: _this.handleFocus
76
79
  };
77
- _this.handleChange = _this.handleChange.bind(_assertThisInitialized(_this));
78
- _this.updateData = _this.updateData.bind(_assertThisInitialized(_this));
79
- _this.handleFocus = _this.handleFocus.bind(_assertThisInitialized(_this));
80
80
  return _this;
81
81
  }
82
82
 
@@ -13,16 +13,30 @@ var _defaultProps = require("./props/defaultProps");
13
13
 
14
14
  var _propTypes = require("./props/propTypes");
15
15
 
16
+ var _Flex = _interopRequireDefault(require("@zohodesk/layout/es/Flex/Flex"));
17
+
18
+ var _utils = require("@zohodesk/utils");
19
+
16
20
  var _Label = _interopRequireDefault(require("@zohodesk/components/es/Label/Label"));
17
21
 
18
22
  var _LabelColorsModule = _interopRequireDefault(require("@zohodesk/components/es/Label/LabelColors.module.css"));
19
23
 
20
- var _ValidationMessageModule = _interopRequireDefault(require("./ValidationMessage.module.css"));
21
-
22
24
  var _icons = require("@zohodesk/icons");
23
25
 
26
+ var _Common = require("@zohodesk/components/es/utils/Common");
27
+
28
+ var _ValidationMessageModule = _interopRequireDefault(require("./ValidationMessage.module.css"));
29
+
24
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
31
 
32
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
33
+
34
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
35
+
36
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
37
+
38
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
39
+
26
40
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
27
41
 
28
42
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@@ -48,10 +62,15 @@ var ValidationMessage = /*#__PURE__*/function (_React$Component) {
48
62
 
49
63
  var _super = _createSuper(ValidationMessage);
50
64
 
51
- function ValidationMessage() {
65
+ function ValidationMessage(props) {
66
+ var _this;
67
+
52
68
  _classCallCheck(this, ValidationMessage);
53
69
 
54
- return _super.apply(this, arguments);
70
+ _this = _super.call(this, props);
71
+ _this.a11yMerged = {};
72
+ _this.tagMerged = {};
73
+ return _this;
55
74
  }
56
75
 
57
76
  _createClass(ValidationMessage, [{
@@ -66,19 +85,54 @@ var ValidationMessage = /*#__PURE__*/function (_React$Component) {
66
85
  size = _this$props.size,
67
86
  dataId = _this$props.dataId,
68
87
  clipped = _this$props.clipped,
69
- a11y = _this$props.a11y,
88
+ alignChildren = _this$props.alignChildren,
70
89
  tooltip = _this$props.tooltip,
71
- dataSelectorId = _this$props.dataSelectorId;
72
- var _a11y$role = a11y.role,
73
- role = _a11y$role === void 0 ? 'alert' : _a11y$role;
74
- return /*#__PURE__*/_react["default"].createElement("div", {
75
- role: role,
76
- onClick: onClick,
77
- className: "".concat(type === 'primary' ? _ValidationMessageModule["default"].primary : _ValidationMessageModule["default"].secondary),
78
- "data-id": "errorMsgContainer",
79
- "data-test-id": "errorMsgContainer",
80
- "data-selector-id": dataSelectorId
81
- }, /*#__PURE__*/_react["default"].createElement(_Label["default"], {
90
+ dataSelectorId = _this$props.dataSelectorId,
91
+ renderLeftChildren = _this$props.renderLeftChildren,
92
+ renderRightChildren = _this$props.renderRightChildren,
93
+ id = _this$props.id,
94
+ customProps = _this$props.customProps,
95
+ a11yAttributes = _this$props.a11yAttributes,
96
+ tagAttributes = _this$props.tagAttributes,
97
+ customClass = _this$props.customClass;
98
+
99
+ var _ref = customProps || _Common.DUMMY_OBJECT,
100
+ wrapperProps = _ref.wrapper;
101
+
102
+ var _ref2 = customClass || _Common.DUMMY_OBJECT,
103
+ _ref2$label = _ref2.label,
104
+ customLabelClass = _ref2$label === void 0 ? '' : _ref2$label,
105
+ _ref2$wrapper = _ref2.wrapper,
106
+ customWrapperClass = _ref2$wrapper === void 0 ? '' : _ref2$wrapper;
107
+
108
+ var _ref3 = a11yAttributes || _Common.DUMMY_OBJECT,
109
+ wrapperA11y = _ref3.wrapper;
110
+
111
+ var _ref4 = tagAttributes || _Common.DUMMY_OBJECT,
112
+ wrapperTagAttr = _ref4.wrapper;
113
+
114
+ var isLeftChildrenRenderable = (0, _utils.isRenderable)(renderLeftChildren);
115
+ var isRightChildrenRenderable = (0, _utils.isRenderable)(renderRightChildren);
116
+ this.a11yMerged = {
117
+ wrapper: _objectSpread(_objectSpread({}, wrapperA11y), {}, {
118
+ role: 'alert'
119
+ })
120
+ };
121
+ this.tagMerged = {
122
+ wrapper: _objectSpread(_objectSpread({}, wrapperTagAttr), {}, {
123
+ 'data-selector-id': dataSelectorId
124
+ })
125
+ };
126
+ return /*#__PURE__*/_react["default"].createElement(_Flex["default"], _extends({}, wrapperProps, {
127
+ $ui_alignItems: alignChildren,
128
+ $ui_displayMode: isRightChildrenRenderable || isLeftChildrenRenderable ? 'flex' : null,
129
+ $event_onClick: onClick,
130
+ testId: "errorMsgContainer",
131
+ customId: "errorMsgContainer",
132
+ $ui_className: "".concat(type === 'primary' ? _ValidationMessageModule["default"].primary : _ValidationMessageModule["default"].secondary, " ").concat(customWrapperClass),
133
+ $a11yAttributes_container: this.a11yMerged.wrapper,
134
+ $tagAttributes_container: this.tagMerged.wrapper
135
+ }), (0, _utils.renderNode)(renderLeftChildren), /*#__PURE__*/_react["default"].createElement(_Label["default"], {
82
136
  text: text,
83
137
  htmlFor: htmlFor,
84
138
  palette: palette,
@@ -86,14 +140,15 @@ var ValidationMessage = /*#__PURE__*/function (_React$Component) {
86
140
  dataId: dataId,
87
141
  clipped: clipped,
88
142
  title: clipped ? text : '',
89
- customClass: _ValidationMessageModule["default"].lable
143
+ customClass: "".concat(_ValidationMessageModule["default"].lable, " ").concat(customLabelClass),
144
+ id: id
90
145
  }), tooltip ? /*#__PURE__*/_react["default"].createElement("span", {
91
146
  className: "".concat(_ValidationMessageModule["default"].icon, " ").concat(_LabelColorsModule["default"][palette]),
92
147
  "data-title": tooltip
93
148
  }, /*#__PURE__*/_react["default"].createElement(_icons.Icon, {
94
149
  name: "ZD-information57",
95
150
  size: "14"
96
- })) : null);
151
+ })) : null, (0, _utils.renderNode)(renderRightChildren));
97
152
  }
98
153
  }]);
99
154
 
@@ -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"
@@ -9,6 +9,7 @@ var defaultProps = {
9
9
  size: 'xsmall',
10
10
  type: 'primary',
11
11
  a11y: {},
12
- dataSelectorId: 'validationMessage'
12
+ dataSelectorId: 'validationMessage',
13
+ alignChildren: 'start'
13
14
  };
14
15
  exports.defaultProps = defaultProps;
@@ -16,12 +16,26 @@ var propTypes = {
16
16
  size: _propTypes["default"].oneOf(['xsmall', 'small', 'medium', 'large']),
17
17
  text: _propTypes["default"].string,
18
18
  type: _propTypes["default"].oneOf(['primary', 'secondary']),
19
- a11y: _propTypes["default"].shape({
20
- role: _propTypes["default"].string
21
- }),
22
19
  tooltip: _propTypes["default"].string,
23
20
  htmlFor: _propTypes["default"].string,
24
21
  dataId: _propTypes["default"].string,
25
- dataSelectorId: _propTypes["default"].string
22
+ dataSelectorId: _propTypes["default"].string,
23
+ renderLeftChildren: _propTypes["default"].oneOfType([_propTypes["default"].node, _propTypes["default"].func]),
24
+ renderRightChildren: _propTypes["default"].oneOfType([_propTypes["default"].node, _propTypes["default"].func]),
25
+ id: _propTypes["default"].string,
26
+ alignChildren: _propTypes["default"].oneOf(['start', 'center', 'end', 'baseline']),
27
+ customProps: _propTypes["default"].shape({
28
+ wrapper: _propTypes["default"].object
29
+ }),
30
+ tagAttributes: _propTypes["default"].shape({
31
+ wrapper: _propTypes["default"].object
32
+ }),
33
+ a11yAttributes: _propTypes["default"].shape({
34
+ wrapper: _propTypes["default"].object
35
+ }),
36
+ customClass: _propTypes["default"].shape({
37
+ label: _propTypes["default"].string,
38
+ wrapper: _propTypes["default"].string
39
+ })
26
40
  };
27
41
  exports.propTypes = propTypes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/dot",
3
- "version": "1.8.3",
3
+ "version": "1.8.5",
4
4
  "main": "lib/index",
5
5
  "module": "es/index.js",
6
6
  "private": false,
@@ -43,7 +43,7 @@
43
43
  "postpublish": "node postPublish.js",
44
44
  "test-clean": "react-cli clean ./coverage && react-cli clean ./unittest react-cli clean ./es && react-cli clean ./lib && react-cli clean ./package-lock.json && react-cli clean ./result.json",
45
45
  "download": "npm run downloadOnly && cd ../ && npm run download",
46
- "downloadOnly": "react-cli clean ./node_modules ./package-lock.json && npm install",
46
+ "downloadOnly": "react-cli clean ./node_modules ./package-lock.json && npm install --legacy-peer-deps",
47
47
  "expublish": "npm publish --tag experimental-version",
48
48
  "css:lineheight:validate": "node ./node_modules/@zohodesk-private/node-plugins/es/lineheight_automation/lineHeightErrorCheck.js ./src/",
49
49
  "cssVariableConvert": "react-cli variableConverter ./lib ./lib && react-cli variableConverter ./es ./es",
@@ -73,25 +73,25 @@
73
73
  "@zohodesk-private/node-plugins": "1.1.13",
74
74
  "@zohodesk-private/react-prop-validator": "1.2.3",
75
75
  "@zohodesk/a11y": "2.3.8",
76
- "@zohodesk/components": "1.5.3",
76
+ "@zohodesk/components": "1.5.7",
77
77
  "@zohodesk/hooks": "2.0.6",
78
- "@zohodesk/icons": "1.1.4",
78
+ "@zohodesk/icons": "1.1.6",
79
79
  "@zohodesk/layout": "^3.1.0",
80
- "@zohodesk/svg": "1.2.5",
80
+ "@zohodesk/svg": "1.2.6",
81
81
  "@zohodesk/utils": "1.3.16",
82
82
  "@zohodesk/variables": "1.2.0",
83
83
  "@zohodesk/virtualizer": "1.0.13",
84
84
  "react-sortable-hoc": "^0.8.3",
85
85
  "velocity-react": "1.4.3",
86
- "@zohodesk/dotkit": "1.0.4",
86
+ "@zohodesk/dotkit": "1.0.6",
87
87
  "@zohodesk/react-cli": "1.1.27"
88
88
  },
89
89
  "peerDependencies": {
90
90
  "velocity-react": "1.4.3",
91
91
  "@zohodesk/variables": "1.2.0",
92
- "@zohodesk/components": "1.5.3",
93
- "@zohodesk/icons": "1.1.4",
94
- "@zohodesk/svg": "1.2.5",
92
+ "@zohodesk/components": "1.5.7",
93
+ "@zohodesk/icons": "1.1.6",
94
+ "@zohodesk/svg": "1.2.6",
95
95
  "@zohodesk/virtualizer": "1.0.13",
96
96
  "react-sortable-hoc": "^0.8.3",
97
97
  "@zohodesk/hooks": "2.0.6",