@zohodesk/components 1.2.27 → 1.2.28

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.
@@ -16,6 +16,7 @@ var defaultProps = {
16
16
  variant: 'default',
17
17
  isFilled: true,
18
18
  customClass: {},
19
+ customProps: {},
19
20
  a11y: {}
20
21
  };
21
22
  exports.defaultProps = defaultProps;
@@ -14,6 +14,7 @@ var propTypes = {
14
14
  checked: _propTypes["default"].bool,
15
15
  disabled: _propTypes["default"].bool,
16
16
  disabledTitle: _propTypes["default"].string,
17
+ getRef: _propTypes["default"].func,
17
18
  id: _propTypes["default"].string,
18
19
  isFilled: _propTypes["default"].bool,
19
20
  isReadOnly: _propTypes["default"].bool,
@@ -30,14 +31,20 @@ var propTypes = {
30
31
  customRadio: _propTypes["default"].string,
31
32
  customLabel: _propTypes["default"].string
32
33
  }),
34
+ customProps: _propTypes["default"].exact({
35
+ ContainerProps: _propTypes["default"].object,
36
+ LabelProps: _propTypes["default"].object
37
+ }),
33
38
  a11y: _propTypes["default"].shape({
34
39
  ariaChecked: _propTypes["default"].bool,
35
40
  ariaHidden: _propTypes["default"].bool,
36
41
  role: _propTypes["default"].string,
42
+ tabIndex: _propTypes["default"].oneOfType(_propTypes["default"].string, _propTypes["default"].number),
37
43
  ariaLabelledby: _propTypes["default"].string,
38
44
  ariaLabel: _propTypes["default"].string,
39
45
  ariaReadonly: _propTypes["default"].bool
40
46
  }),
47
+ children: _propTypes["default"].node,
41
48
  onChange: _propTypes["default"].func,
42
49
  text: _propTypes["default"].string
43
50
  };
@@ -38,6 +38,7 @@ var CheckBox = function CheckBox(props) {
38
38
  isFilled = props.isFilled,
39
39
  isClipped = props.isClipped,
40
40
  getRef = props.getRef,
41
+ getContainerRef = props.getContainerRef,
41
42
  variant = props.variant,
42
43
  active = props.active,
43
44
  dataId = props.dataId,
@@ -53,6 +54,10 @@ var CheckBox = function CheckBox(props) {
53
54
  onChange && onChange(!checked, e);
54
55
  }
55
56
 
57
+ function handleGetContainerRef(ele) {
58
+ getContainerRef && getContainerRef(ele, id);
59
+ }
60
+
56
61
  var _customProps$CheckBox = customProps.CheckBoxProps,
57
62
  CheckBoxProps = _customProps$CheckBox === void 0 ? {} : _customProps$CheckBox,
58
63
  _customProps$LabelPro = customProps.LabelProps,
@@ -85,6 +90,7 @@ var CheckBox = function CheckBox(props) {
85
90
  onClick: isReadOnly || disabled ? null : onChange,
86
91
  tabIndex: isReadOnly || disabled || ariaHidden ? '-1' : '0',
87
92
  "aria-checked": ariaChecked,
93
+ eleRef: handleGetContainerRef,
88
94
  role: role,
89
95
  "aria-label": ariaLabel,
90
96
  "aria-labelledby": ariaLabelledby,
@@ -18,6 +18,7 @@ var propTypes = {
18
18
  disabled: _propTypes["default"].bool,
19
19
  disabledTitle: _propTypes["default"].string,
20
20
  getRef: _propTypes["default"].func,
21
+ getContainerRef: _propTypes["default"].func,
21
22
  id: _propTypes["default"].string,
22
23
  isFilled: _propTypes["default"].bool,
23
24
  isClipped: _propTypes["default"].bool,
@@ -19,6 +19,8 @@ var _RadioModule = _interopRequireDefault(require("../../Radio/Radio.module.css"
19
19
 
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
21
 
22
+ 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); }
23
+
22
24
  var Radio = function Radio(props) {
23
25
  var id = props.id,
24
26
  name = props.name,
@@ -37,6 +39,9 @@ var Radio = function Radio(props) {
37
39
  active = props.active,
38
40
  isFilled = props.isFilled,
39
41
  customClass = props.customClass,
42
+ customProps = props.customProps,
43
+ getRef = props.getRef,
44
+ children = props.children,
40
45
  a11y = props.a11y;
41
46
  var _customClass$customRa = customClass.customRadioWrap,
42
47
  customRadioWrap = _customClass$customRa === void 0 ? '' : _customClass$customRa,
@@ -49,19 +54,28 @@ var Radio = function Radio(props) {
49
54
  var ariaHidden = a11y.ariaHidden,
50
55
  _a11y$role = a11y.role,
51
56
  role = _a11y$role === void 0 ? 'radio' : _a11y$role,
57
+ tabIndex = a11y.tabIndex,
52
58
  _a11y$ariaChecked = a11y.ariaChecked,
53
59
  ariaChecked = _a11y$ariaChecked === void 0 ? checked : _a11y$ariaChecked,
54
60
  ariaLabel = a11y.ariaLabel,
55
61
  ariaLabelledby = a11y.ariaLabelledby,
56
62
  _a11y$ariaReadonly = a11y.ariaReadonly,
57
63
  ariaReadonly = _a11y$ariaReadonly === void 0 ? isReadOnly || disabled ? true : false : _a11y$ariaReadonly;
64
+ var _customProps$Containe = customProps.ContainerProps,
65
+ ContainerProps = _customProps$Containe === void 0 ? {} : _customProps$Containe,
66
+ _customProps$LabelPro = customProps.LabelProps,
67
+ LabelProps = _customProps$LabelPro === void 0 ? {} : _customProps$LabelPro;
58
68
 
59
69
  function onChange(e) {
60
70
  var onChange = props.onChange;
61
71
  onChange && onChange(value, e);
62
72
  }
63
73
 
64
- return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
74
+ function handleGetRef(ele) {
75
+ getRef && getRef(ele, value);
76
+ }
77
+
78
+ return /*#__PURE__*/_react["default"].createElement(_Layout.Container, _extends({
65
79
  dataId: value ? value.toLowerCase() : 'RadioComp',
66
80
  isCover: false,
67
81
  isInline: text ? false : true,
@@ -71,13 +85,14 @@ var Radio = function Radio(props) {
71
85
  "data-title": toolTip,
72
86
  onClick: !isReadOnly && !disabled ? onChange : '',
73
87
  "aria-checked": ariaChecked,
74
- tabindex: isReadOnly || disabled || ariaHidden ? '-1' : '0',
88
+ tabindex: isReadOnly || disabled || ariaHidden ? '-1' : tabIndex || '0',
89
+ eleRef: handleGetRef,
75
90
  role: role,
76
91
  "aria-Hidden": ariaHidden,
77
92
  "aria-label": ariaLabel,
78
93
  "aria-labelledby": ariaLabelledby,
79
94
  "aria-readonly": ariaReadonly
80
- }, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
95
+ }, ContainerProps), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
81
96
  className: "".concat(_RadioModule["default"].radio, " ").concat(checked ? "".concat(_RadioModule["default"]["rdBox".concat(palette)]) : '', "\n ").concat(isReadOnly || disabled ? '' : "".concat(_RadioModule["default"]["hover".concat(palette)]), " ").concat(_RadioModule["default"][size], " ").concat(isFilled ? _RadioModule["default"].filled : '', " ").concat(_RadioModule["default"]["centerPath".concat(palette)], " ").concat(customRadio)
82
97
  }, /*#__PURE__*/_react["default"].createElement("input", {
83
98
  type: "hidden",
@@ -102,17 +117,17 @@ var Radio = function Radio(props) {
102
117
  }) : null))), text && /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
103
118
  flexible: true,
104
119
  className: _RadioModule["default"].text
105
- }, /*#__PURE__*/_react["default"].createElement(_Label["default"], {
120
+ }, /*#__PURE__*/_react["default"].createElement(_Label["default"], _extends({
106
121
  text: text,
107
- palette: disabled ? 'disable' : labelPalette,
122
+ palette: labelPalette,
108
123
  size: labelSize,
109
124
  type: "title",
110
125
  clipped: true,
111
126
  dataId: "".concat(text, "_label"),
112
127
  variant: variant,
113
128
  title: toolTip ? toolTip : text,
114
- customClass: "".concat(checked && active && !disabled ? "".concat(_RadioModule["default"]["".concat(palette, "checkedActive")]) : '', "\n ").concat(_RadioModule["default"]["".concat(palette, "Label")], " ").concat(accessMode, " ").concat(customLabel)
115
- })));
129
+ customClass: "".concat(checked && active ? "".concat(_RadioModule["default"]["".concat(palette, "checkedActive")]) : '', "\n ").concat(_RadioModule["default"]["".concat(palette, "Label")], " ").concat(accessMode, " ").concat(customLabel)
130
+ }, LabelProps))), children);
116
131
  };
117
132
 
118
133
  var _default = Radio;
@@ -16,6 +16,7 @@ var defaultProps = {
16
16
  variant: 'default',
17
17
  isFilled: true,
18
18
  customClass: {},
19
+ customProps: {},
19
20
  a11y: {}
20
21
  };
21
22
  exports.defaultProps = defaultProps;
@@ -14,6 +14,7 @@ var propTypes = {
14
14
  checked: _propTypes["default"].bool,
15
15
  disabled: _propTypes["default"].bool,
16
16
  disabledTitle: _propTypes["default"].string,
17
+ getRef: _propTypes["default"].func,
17
18
  id: _propTypes["default"].string,
18
19
  isFilled: _propTypes["default"].bool,
19
20
  isReadOnly: _propTypes["default"].bool,
@@ -30,14 +31,20 @@ var propTypes = {
30
31
  customRadio: _propTypes["default"].string,
31
32
  customLabel: _propTypes["default"].string
32
33
  }),
34
+ customProps: _propTypes["default"].exact({
35
+ ContainerProps: _propTypes["default"].object,
36
+ LabelProps: _propTypes["default"].object
37
+ }),
33
38
  a11y: _propTypes["default"].shape({
34
39
  ariaChecked: _propTypes["default"].bool,
35
40
  ariaHidden: _propTypes["default"].bool,
36
41
  role: _propTypes["default"].string,
42
+ tabIndex: _propTypes["default"].oneOfType(_propTypes["default"].string, _propTypes["default"].number),
37
43
  ariaLabelledby: _propTypes["default"].string,
38
44
  ariaLabel: _propTypes["default"].string,
39
45
  ariaReadonly: _propTypes["default"].bool
40
46
  }),
47
+ children: _propTypes["default"].node,
41
48
  onChange: _propTypes["default"].func,
42
49
  text: _propTypes["default"].string
43
50
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/components",
3
- "version": "1.2.27",
3
+ "version": "1.2.28",
4
4
  "main": "es/index.js",
5
5
  "module": "es/index.js",
6
6
  "private": false,
@@ -70,7 +70,7 @@
70
70
  "@zohodesk/a11y": "2.2.0",
71
71
  "@zohodesk/docstool": "1.0.0-alpha-2",
72
72
  "@zohodesk/hooks": "2.0.3",
73
- "@zohodesk/icons": "1.0.33",
73
+ "@zohodesk/icons": "1.0.35",
74
74
  "@zohodesk/svg": "1.1.11",
75
75
  "@zohodesk/utils": "1.3.13",
76
76
  "@zohodesk/variables": "1.0.0",
@@ -85,7 +85,7 @@
85
85
  "selectn": "1.1.2"
86
86
  },
87
87
  "peerDependencies": {
88
- "@zohodesk/icons": "1.0.33",
88
+ "@zohodesk/icons": "1.0.35",
89
89
  "@zohodesk/variables": "1.0.0",
90
90
  "@zohodesk/svg": "1.1.11",
91
91
  "@zohodesk/virtualizer": "1.0.3",