@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.
- package/.cli/propValidation_report.html +1 -1
- package/README.md +8 -5
- package/es/CheckBox/CheckBox.js +10 -0
- package/es/CheckBox/props/propTypes.js +1 -0
- package/es/Radio/Radio.js +26 -7
- package/es/Radio/Radio.module.css +3 -0
- package/es/Radio/__tests__/__snapshots__/Radio.spec.js.snap +3 -3
- package/es/Radio/props/defaultProps.js +1 -0
- package/es/Radio/props/propTypes.js +7 -0
- package/es/v1/CheckBox/CheckBox.js +6 -0
- package/es/v1/CheckBox/props/propTypes.js +1 -0
- package/es/v1/Radio/Radio.js +22 -7
- package/es/v1/Radio/props/defaultProps.js +1 -0
- package/es/v1/Radio/props/propTypes.js +7 -0
- package/lib/CheckBox/CheckBox.js +34 -24
- package/lib/CheckBox/props/propTypes.js +1 -0
- package/lib/Radio/Radio.js +45 -26
- package/lib/Radio/Radio.module.css +3 -0
- package/lib/Radio/__tests__/__snapshots__/Radio.spec.js.snap +3 -3
- package/lib/Radio/props/defaultProps.js +1 -0
- package/lib/Radio/props/propTypes.js +7 -0
- package/lib/v1/CheckBox/CheckBox.js +6 -0
- package/lib/v1/CheckBox/props/propTypes.js +1 -0
- package/lib/v1/Radio/Radio.js +22 -7
- package/lib/v1/Radio/props/defaultProps.js +1 -0
- package/lib/v1/Radio/props/propTypes.js +7 -0
- package/package.json +3 -3
- package/result.json +1 -1
package/README.md
CHANGED
|
@@ -32,17 +32,20 @@ In this Package, we Provide Some Basic Components to Build Web App
|
|
|
32
32
|
- TextBoxIcon
|
|
33
33
|
- Tooltip
|
|
34
34
|
|
|
35
|
+
# 1.2.28
|
|
36
|
+
|
|
37
|
+
- **CheckBox** - getContainerRef prop supported
|
|
38
|
+
- **Radio** - children, customProps, getRef props supported. tabIndex option supported inside a11y prop
|
|
39
|
+
|
|
35
40
|
# 1.2.27
|
|
36
41
|
|
|
37
42
|
- **DateWidget** - The issue with the YearView Open State Reset on Blur Event in DidMount has been resolved
|
|
38
43
|
|
|
39
|
-
|
|
40
44
|
# 1.2.26
|
|
41
45
|
|
|
42
|
-
- **
|
|
43
|
-
- **
|
|
44
|
-
- **
|
|
45
|
-
|
|
46
|
+
- **MultiSelect, MultiSelectWithAvatar** - Mobile Header Render Issue in Mobile Responsive Fixed.
|
|
47
|
+
- **isMobilePopover** - Function added in Dropbox.
|
|
48
|
+
- **Tag** - closeTitle not working issue fixed ( because value sends in wrong prop key data-title)
|
|
46
49
|
|
|
47
50
|
# 1.2.25
|
|
48
51
|
|
package/es/CheckBox/CheckBox.js
CHANGED
|
@@ -11,6 +11,7 @@ export default class CheckBox extends React.Component {
|
|
|
11
11
|
constructor(props) {
|
|
12
12
|
super(props);
|
|
13
13
|
this.onChange = this.onChange.bind(this);
|
|
14
|
+
this.handleGetContainerRef = this.handleGetContainerRef.bind(this);
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
onChange(e) {
|
|
@@ -21,6 +22,14 @@ export default class CheckBox extends React.Component {
|
|
|
21
22
|
onChange && onChange(!checked, e);
|
|
22
23
|
}
|
|
23
24
|
|
|
25
|
+
handleGetContainerRef(ele) {
|
|
26
|
+
let {
|
|
27
|
+
getContainerRef,
|
|
28
|
+
id
|
|
29
|
+
} = this.props;
|
|
30
|
+
getContainerRef && getContainerRef(ele, id);
|
|
31
|
+
}
|
|
32
|
+
|
|
24
33
|
render() {
|
|
25
34
|
let {
|
|
26
35
|
id,
|
|
@@ -78,6 +87,7 @@ export default class CheckBox extends React.Component {
|
|
|
78
87
|
onClick: isReadOnly || disabled ? null : this.onChange,
|
|
79
88
|
tabIndex: isReadOnly || disabled || ariaHidden ? '-1' : '0',
|
|
80
89
|
"aria-checked": ariaChecked,
|
|
90
|
+
eleRef: this.handleGetContainerRef,
|
|
81
91
|
role: role,
|
|
82
92
|
"aria-label": ariaLabel,
|
|
83
93
|
"aria-labelledby": ariaLabelledby,
|
package/es/Radio/Radio.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
|
|
1
3
|
/* eslint css-modules/no-unused-class: [2, { markAsUsed: ['small', 'medium'] }] */
|
|
2
4
|
import React from 'react';
|
|
3
5
|
import { defaultProps } from './props/defaultProps';
|
|
@@ -9,6 +11,7 @@ export default class Radio extends React.Component {
|
|
|
9
11
|
constructor(props) {
|
|
10
12
|
super(props);
|
|
11
13
|
this.onChange = this.onChange.bind(this);
|
|
14
|
+
this.handleGetRef = this.handleGetRef.bind(this);
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
onChange(e) {
|
|
@@ -19,6 +22,14 @@ export default class Radio extends React.Component {
|
|
|
19
22
|
onChange && onChange(value, e);
|
|
20
23
|
}
|
|
21
24
|
|
|
25
|
+
handleGetRef(ele) {
|
|
26
|
+
let {
|
|
27
|
+
getRef,
|
|
28
|
+
value
|
|
29
|
+
} = this.props;
|
|
30
|
+
getRef && getRef(ele, value);
|
|
31
|
+
}
|
|
32
|
+
|
|
22
33
|
render() {
|
|
23
34
|
let {
|
|
24
35
|
id,
|
|
@@ -38,6 +49,8 @@ export default class Radio extends React.Component {
|
|
|
38
49
|
active,
|
|
39
50
|
isFilled,
|
|
40
51
|
customClass,
|
|
52
|
+
customProps,
|
|
53
|
+
children,
|
|
41
54
|
a11y
|
|
42
55
|
} = this.props;
|
|
43
56
|
let {
|
|
@@ -50,12 +63,17 @@ export default class Radio extends React.Component {
|
|
|
50
63
|
let {
|
|
51
64
|
ariaHidden,
|
|
52
65
|
role = 'radio',
|
|
66
|
+
tabIndex,
|
|
53
67
|
ariaChecked = checked,
|
|
54
68
|
ariaLabel,
|
|
55
69
|
ariaLabelledby,
|
|
56
70
|
ariaReadonly = isReadOnly || disabled ? true : false
|
|
57
71
|
} = a11y;
|
|
58
|
-
|
|
72
|
+
let {
|
|
73
|
+
ContainerProps = {},
|
|
74
|
+
LabelProps = {}
|
|
75
|
+
} = customProps;
|
|
76
|
+
return /*#__PURE__*/React.createElement(Container, _extends({
|
|
59
77
|
dataId: value ? value.toLowerCase() : 'RadioComp',
|
|
60
78
|
isCover: false,
|
|
61
79
|
isInline: text ? false : true,
|
|
@@ -65,13 +83,14 @@ export default class Radio extends React.Component {
|
|
|
65
83
|
"data-title": toolTip,
|
|
66
84
|
onClick: !isReadOnly && !disabled ? this.onChange : '',
|
|
67
85
|
"aria-checked": ariaChecked,
|
|
68
|
-
tabindex: isReadOnly || disabled || ariaHidden ? '-1' : '0',
|
|
86
|
+
tabindex: isReadOnly || disabled || ariaHidden ? '-1' : tabIndex || '0',
|
|
87
|
+
eleRef: this.handleGetRef,
|
|
69
88
|
role: role,
|
|
70
89
|
"aria-Hidden": ariaHidden,
|
|
71
90
|
"aria-label": ariaLabel,
|
|
72
91
|
"aria-labelledby": ariaLabelledby,
|
|
73
92
|
"aria-readonly": ariaReadonly
|
|
74
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
93
|
+
}, ContainerProps), /*#__PURE__*/React.createElement(Box, {
|
|
75
94
|
className: `${style.radio} ${checked ? `${style[`rdBox${palette}`]}` : ''}
|
|
76
95
|
${isReadOnly || disabled ? '' : `${style[`hover${palette}`]}`} ${style[size]} ${isFilled ? style.filled : ''} ${style[`centerPath${palette}`]} ${customRadio}`
|
|
77
96
|
}, /*#__PURE__*/React.createElement("input", {
|
|
@@ -97,18 +116,18 @@ export default class Radio extends React.Component {
|
|
|
97
116
|
}) : null))), text && /*#__PURE__*/React.createElement(Box, {
|
|
98
117
|
flexible: true,
|
|
99
118
|
className: style.text
|
|
100
|
-
}, /*#__PURE__*/React.createElement(Label, {
|
|
119
|
+
}, /*#__PURE__*/React.createElement(Label, _extends({
|
|
101
120
|
text: text,
|
|
102
|
-
palette:
|
|
121
|
+
palette: labelPalette,
|
|
103
122
|
size: labelSize,
|
|
104
123
|
type: "title",
|
|
105
124
|
clipped: true,
|
|
106
125
|
dataId: `${text}_label`,
|
|
107
126
|
variant: variant,
|
|
108
127
|
title: toolTip ? toolTip : text,
|
|
109
|
-
customClass: `${checked && active
|
|
128
|
+
customClass: `${checked && active ? `${style[`${palette}checkedActive`]}` : ''}
|
|
110
129
|
${style[`${palette}Label`]} ${accessMode} ${customLabel}`
|
|
111
|
-
})));
|
|
130
|
+
}, LabelProps))), children);
|
|
112
131
|
}
|
|
113
132
|
|
|
114
133
|
}
|
|
@@ -1145,7 +1145,7 @@ exports[`Radio rendering the accessMode when disabled 1`] = `
|
|
|
1145
1145
|
data-test-id="boxComponent"
|
|
1146
1146
|
>
|
|
1147
1147
|
<label
|
|
1148
|
-
class="label title medium
|
|
1148
|
+
class="label title medium default font_default
|
|
1149
1149
|
dotted cursor
|
|
1150
1150
|
primaryLabel disabled "
|
|
1151
1151
|
data-id="RadioText_label"
|
|
@@ -1505,7 +1505,7 @@ exports[`Radio rendering the disabled is true 1`] = `
|
|
|
1505
1505
|
data-test-id="boxComponent"
|
|
1506
1506
|
>
|
|
1507
1507
|
<label
|
|
1508
|
-
class="label title medium
|
|
1508
|
+
class="label title medium default font_default
|
|
1509
1509
|
dotted cursor
|
|
1510
1510
|
undefined disabled "
|
|
1511
1511
|
data-id="RadioText_label"
|
|
@@ -1567,7 +1567,7 @@ exports[`Radio rendering the disabledTitle 1`] = `
|
|
|
1567
1567
|
data-test-id="boxComponent"
|
|
1568
1568
|
>
|
|
1569
1569
|
<label
|
|
1570
|
-
class="label title medium
|
|
1570
|
+
class="label title medium default font_default
|
|
1571
1571
|
dotted cursor
|
|
1572
1572
|
primaryLabel disabled "
|
|
1573
1573
|
data-id="RadioText_label"
|
|
@@ -4,6 +4,7 @@ export const propTypes = {
|
|
|
4
4
|
checked: PropTypes.bool,
|
|
5
5
|
disabled: PropTypes.bool,
|
|
6
6
|
disabledTitle: PropTypes.string,
|
|
7
|
+
getRef: PropTypes.func,
|
|
7
8
|
id: PropTypes.string,
|
|
8
9
|
isFilled: PropTypes.bool,
|
|
9
10
|
isReadOnly: PropTypes.bool,
|
|
@@ -20,14 +21,20 @@ export const propTypes = {
|
|
|
20
21
|
customRadio: PropTypes.string,
|
|
21
22
|
customLabel: PropTypes.string
|
|
22
23
|
}),
|
|
24
|
+
customProps: PropTypes.exact({
|
|
25
|
+
ContainerProps: PropTypes.object,
|
|
26
|
+
LabelProps: PropTypes.object
|
|
27
|
+
}),
|
|
23
28
|
a11y: PropTypes.shape({
|
|
24
29
|
ariaChecked: PropTypes.bool,
|
|
25
30
|
ariaHidden: PropTypes.bool,
|
|
26
31
|
role: PropTypes.string,
|
|
32
|
+
tabIndex: PropTypes.oneOfType(PropTypes.string, PropTypes.number),
|
|
27
33
|
ariaLabelledby: PropTypes.string,
|
|
28
34
|
ariaLabel: PropTypes.string,
|
|
29
35
|
ariaReadonly: PropTypes.bool
|
|
30
36
|
}),
|
|
37
|
+
children: PropTypes.node,
|
|
31
38
|
onChange: PropTypes.func,
|
|
32
39
|
text: PropTypes.string
|
|
33
40
|
};
|
|
@@ -24,6 +24,7 @@ const CheckBox = props => {
|
|
|
24
24
|
isFilled,
|
|
25
25
|
isClipped,
|
|
26
26
|
getRef,
|
|
27
|
+
getContainerRef,
|
|
27
28
|
variant,
|
|
28
29
|
active,
|
|
29
30
|
dataId,
|
|
@@ -42,6 +43,10 @@ const CheckBox = props => {
|
|
|
42
43
|
onChange && onChange(!checked, e);
|
|
43
44
|
}
|
|
44
45
|
|
|
46
|
+
function handleGetContainerRef(ele) {
|
|
47
|
+
getContainerRef && getContainerRef(ele, id);
|
|
48
|
+
}
|
|
49
|
+
|
|
45
50
|
let {
|
|
46
51
|
CheckBoxProps = {},
|
|
47
52
|
LabelProps = {}
|
|
@@ -73,6 +78,7 @@ const CheckBox = props => {
|
|
|
73
78
|
onClick: isReadOnly || disabled ? null : onChange,
|
|
74
79
|
tabIndex: isReadOnly || disabled || ariaHidden ? '-1' : '0',
|
|
75
80
|
"aria-checked": ariaChecked,
|
|
81
|
+
eleRef: handleGetContainerRef,
|
|
76
82
|
role: role,
|
|
77
83
|
"aria-label": ariaLabel,
|
|
78
84
|
"aria-labelledby": ariaLabelledby,
|
package/es/v1/Radio/Radio.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
|
|
1
3
|
import React from 'react';
|
|
2
4
|
import { defaultProps } from './props/defaultProps';
|
|
3
5
|
import { propTypes } from './props/propTypes';
|
|
@@ -24,6 +26,9 @@ const Radio = props => {
|
|
|
24
26
|
active,
|
|
25
27
|
isFilled,
|
|
26
28
|
customClass,
|
|
29
|
+
customProps,
|
|
30
|
+
getRef,
|
|
31
|
+
children,
|
|
27
32
|
a11y
|
|
28
33
|
} = props;
|
|
29
34
|
let {
|
|
@@ -36,11 +41,16 @@ const Radio = props => {
|
|
|
36
41
|
let {
|
|
37
42
|
ariaHidden,
|
|
38
43
|
role = 'radio',
|
|
44
|
+
tabIndex,
|
|
39
45
|
ariaChecked = checked,
|
|
40
46
|
ariaLabel,
|
|
41
47
|
ariaLabelledby,
|
|
42
48
|
ariaReadonly = isReadOnly || disabled ? true : false
|
|
43
49
|
} = a11y;
|
|
50
|
+
let {
|
|
51
|
+
ContainerProps = {},
|
|
52
|
+
LabelProps = {}
|
|
53
|
+
} = customProps;
|
|
44
54
|
|
|
45
55
|
function onChange(e) {
|
|
46
56
|
const {
|
|
@@ -49,7 +59,11 @@ const Radio = props => {
|
|
|
49
59
|
onChange && onChange(value, e);
|
|
50
60
|
}
|
|
51
61
|
|
|
52
|
-
|
|
62
|
+
function handleGetRef(ele) {
|
|
63
|
+
getRef && getRef(ele, value);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return /*#__PURE__*/React.createElement(Container, _extends({
|
|
53
67
|
dataId: value ? value.toLowerCase() : 'RadioComp',
|
|
54
68
|
isCover: false,
|
|
55
69
|
isInline: text ? false : true,
|
|
@@ -59,13 +73,14 @@ const Radio = props => {
|
|
|
59
73
|
"data-title": toolTip,
|
|
60
74
|
onClick: !isReadOnly && !disabled ? onChange : '',
|
|
61
75
|
"aria-checked": ariaChecked,
|
|
62
|
-
tabindex: isReadOnly || disabled || ariaHidden ? '-1' : '0',
|
|
76
|
+
tabindex: isReadOnly || disabled || ariaHidden ? '-1' : tabIndex || '0',
|
|
77
|
+
eleRef: handleGetRef,
|
|
63
78
|
role: role,
|
|
64
79
|
"aria-Hidden": ariaHidden,
|
|
65
80
|
"aria-label": ariaLabel,
|
|
66
81
|
"aria-labelledby": ariaLabelledby,
|
|
67
82
|
"aria-readonly": ariaReadonly
|
|
68
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
83
|
+
}, ContainerProps), /*#__PURE__*/React.createElement(Box, {
|
|
69
84
|
className: `${style.radio} ${checked ? `${style[`rdBox${palette}`]}` : ''}
|
|
70
85
|
${isReadOnly || disabled ? '' : `${style[`hover${palette}`]}`} ${style[size]} ${isFilled ? style.filled : ''} ${style[`centerPath${palette}`]} ${customRadio}`
|
|
71
86
|
}, /*#__PURE__*/React.createElement("input", {
|
|
@@ -91,18 +106,18 @@ const Radio = props => {
|
|
|
91
106
|
}) : null))), text && /*#__PURE__*/React.createElement(Box, {
|
|
92
107
|
flexible: true,
|
|
93
108
|
className: style.text
|
|
94
|
-
}, /*#__PURE__*/React.createElement(Label, {
|
|
109
|
+
}, /*#__PURE__*/React.createElement(Label, _extends({
|
|
95
110
|
text: text,
|
|
96
|
-
palette:
|
|
111
|
+
palette: labelPalette,
|
|
97
112
|
size: labelSize,
|
|
98
113
|
type: "title",
|
|
99
114
|
clipped: true,
|
|
100
115
|
dataId: `${text}_label`,
|
|
101
116
|
variant: variant,
|
|
102
117
|
title: toolTip ? toolTip : text,
|
|
103
|
-
customClass: `${checked && active
|
|
118
|
+
customClass: `${checked && active ? `${style[`${palette}checkedActive`]}` : ''}
|
|
104
119
|
${style[`${palette}Label`]} ${accessMode} ${customLabel}`
|
|
105
|
-
})));
|
|
120
|
+
}, LabelProps))), children);
|
|
106
121
|
};
|
|
107
122
|
|
|
108
123
|
export default Radio;
|
|
@@ -4,6 +4,7 @@ export const propTypes = {
|
|
|
4
4
|
checked: PropTypes.bool,
|
|
5
5
|
disabled: PropTypes.bool,
|
|
6
6
|
disabledTitle: PropTypes.string,
|
|
7
|
+
getRef: PropTypes.func,
|
|
7
8
|
id: PropTypes.string,
|
|
8
9
|
isFilled: PropTypes.bool,
|
|
9
10
|
isReadOnly: PropTypes.bool,
|
|
@@ -20,14 +21,20 @@ export const propTypes = {
|
|
|
20
21
|
customRadio: PropTypes.string,
|
|
21
22
|
customLabel: PropTypes.string
|
|
22
23
|
}),
|
|
24
|
+
customProps: PropTypes.exact({
|
|
25
|
+
ContainerProps: PropTypes.object,
|
|
26
|
+
LabelProps: PropTypes.object
|
|
27
|
+
}),
|
|
23
28
|
a11y: PropTypes.shape({
|
|
24
29
|
ariaChecked: PropTypes.bool,
|
|
25
30
|
ariaHidden: PropTypes.bool,
|
|
26
31
|
role: PropTypes.string,
|
|
32
|
+
tabIndex: PropTypes.oneOfType(PropTypes.string, PropTypes.number),
|
|
27
33
|
ariaLabelledby: PropTypes.string,
|
|
28
34
|
ariaLabel: PropTypes.string,
|
|
29
35
|
ariaReadonly: PropTypes.bool
|
|
30
36
|
}),
|
|
37
|
+
children: PropTypes.node,
|
|
31
38
|
onChange: PropTypes.func,
|
|
32
39
|
text: PropTypes.string
|
|
33
40
|
};
|
package/lib/CheckBox/CheckBox.js
CHANGED
|
@@ -57,6 +57,7 @@ var CheckBox = /*#__PURE__*/function (_React$Component) {
|
|
|
57
57
|
|
|
58
58
|
_this = _super.call(this, props);
|
|
59
59
|
_this.onChange = _this.onChange.bind(_assertThisInitialized(_this));
|
|
60
|
+
_this.handleGetContainerRef = _this.handleGetContainerRef.bind(_assertThisInitialized(_this));
|
|
60
61
|
return _this;
|
|
61
62
|
}
|
|
62
63
|
|
|
@@ -68,33 +69,41 @@ var CheckBox = /*#__PURE__*/function (_React$Component) {
|
|
|
68
69
|
checked = _this$props.checked;
|
|
69
70
|
onChange && onChange(!checked, e);
|
|
70
71
|
}
|
|
72
|
+
}, {
|
|
73
|
+
key: "handleGetContainerRef",
|
|
74
|
+
value: function handleGetContainerRef(ele) {
|
|
75
|
+
var _this$props2 = this.props,
|
|
76
|
+
getContainerRef = _this$props2.getContainerRef,
|
|
77
|
+
id = _this$props2.id;
|
|
78
|
+
getContainerRef && getContainerRef(ele, id);
|
|
79
|
+
}
|
|
71
80
|
}, {
|
|
72
81
|
key: "render",
|
|
73
82
|
value: function render() {
|
|
74
|
-
var _this$
|
|
75
|
-
id = _this$
|
|
76
|
-
checked = _this$
|
|
77
|
-
disabled = _this$
|
|
78
|
-
isReadOnly = _this$
|
|
79
|
-
disabledTitle = _this$
|
|
80
|
-
title = _this$
|
|
81
|
-
palette = _this$
|
|
82
|
-
text = _this$
|
|
83
|
-
size = _this$
|
|
84
|
-
labelPalette = _this$
|
|
85
|
-
labelSize = _this$
|
|
86
|
-
isFilled = _this$
|
|
87
|
-
isClipped = _this$
|
|
88
|
-
getRef = _this$
|
|
89
|
-
variant = _this$
|
|
90
|
-
active = _this$
|
|
91
|
-
dataId = _this$
|
|
92
|
-
name = _this$
|
|
93
|
-
activeStyle = _this$
|
|
94
|
-
a11y = _this$
|
|
95
|
-
customClass = _this$
|
|
96
|
-
customProps = _this$
|
|
97
|
-
dataSelectorId = _this$
|
|
83
|
+
var _this$props3 = this.props,
|
|
84
|
+
id = _this$props3.id,
|
|
85
|
+
checked = _this$props3.checked,
|
|
86
|
+
disabled = _this$props3.disabled,
|
|
87
|
+
isReadOnly = _this$props3.isReadOnly,
|
|
88
|
+
disabledTitle = _this$props3.disabledTitle,
|
|
89
|
+
title = _this$props3.title,
|
|
90
|
+
palette = _this$props3.palette,
|
|
91
|
+
text = _this$props3.text,
|
|
92
|
+
size = _this$props3.size,
|
|
93
|
+
labelPalette = _this$props3.labelPalette,
|
|
94
|
+
labelSize = _this$props3.labelSize,
|
|
95
|
+
isFilled = _this$props3.isFilled,
|
|
96
|
+
isClipped = _this$props3.isClipped,
|
|
97
|
+
getRef = _this$props3.getRef,
|
|
98
|
+
variant = _this$props3.variant,
|
|
99
|
+
active = _this$props3.active,
|
|
100
|
+
dataId = _this$props3.dataId,
|
|
101
|
+
name = _this$props3.name,
|
|
102
|
+
activeStyle = _this$props3.activeStyle,
|
|
103
|
+
a11y = _this$props3.a11y,
|
|
104
|
+
customClass = _this$props3.customClass,
|
|
105
|
+
customProps = _this$props3.customProps,
|
|
106
|
+
dataSelectorId = _this$props3.dataSelectorId;
|
|
98
107
|
var _customProps$CheckBox = customProps.CheckBoxProps,
|
|
99
108
|
CheckBoxProps = _customProps$CheckBox === void 0 ? {} : _customProps$CheckBox,
|
|
100
109
|
_customProps$LabelPro = customProps.LabelProps,
|
|
@@ -127,6 +136,7 @@ var CheckBox = /*#__PURE__*/function (_React$Component) {
|
|
|
127
136
|
onClick: isReadOnly || disabled ? null : this.onChange,
|
|
128
137
|
tabIndex: isReadOnly || disabled || ariaHidden ? '-1' : '0',
|
|
129
138
|
"aria-checked": ariaChecked,
|
|
139
|
+
eleRef: this.handleGetContainerRef,
|
|
130
140
|
role: role,
|
|
131
141
|
"aria-label": ariaLabel,
|
|
132
142
|
"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,
|
package/lib/Radio/Radio.js
CHANGED
|
@@ -21,6 +21,8 @@ var _RadioModule = _interopRequireDefault(require("./Radio.module.css"));
|
|
|
21
21
|
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
23
|
|
|
24
|
+
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); }
|
|
25
|
+
|
|
24
26
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
25
27
|
|
|
26
28
|
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); } }
|
|
@@ -53,6 +55,7 @@ var Radio = /*#__PURE__*/function (_React$Component) {
|
|
|
53
55
|
|
|
54
56
|
_this = _super.call(this, props);
|
|
55
57
|
_this.onChange = _this.onChange.bind(_assertThisInitialized(_this));
|
|
58
|
+
_this.handleGetRef = _this.handleGetRef.bind(_assertThisInitialized(_this));
|
|
56
59
|
return _this;
|
|
57
60
|
}
|
|
58
61
|
|
|
@@ -64,28 +67,38 @@ var Radio = /*#__PURE__*/function (_React$Component) {
|
|
|
64
67
|
value = _this$props.value;
|
|
65
68
|
onChange && onChange(value, e);
|
|
66
69
|
}
|
|
70
|
+
}, {
|
|
71
|
+
key: "handleGetRef",
|
|
72
|
+
value: function handleGetRef(ele) {
|
|
73
|
+
var _this$props2 = this.props,
|
|
74
|
+
getRef = _this$props2.getRef,
|
|
75
|
+
value = _this$props2.value;
|
|
76
|
+
getRef && getRef(ele, value);
|
|
77
|
+
}
|
|
67
78
|
}, {
|
|
68
79
|
key: "render",
|
|
69
80
|
value: function render() {
|
|
70
|
-
var _this$
|
|
71
|
-
id = _this$
|
|
72
|
-
name = _this$
|
|
73
|
-
value = _this$
|
|
74
|
-
checked = _this$
|
|
75
|
-
disabled = _this$
|
|
76
|
-
isReadOnly = _this$
|
|
77
|
-
palette = _this$
|
|
78
|
-
disabledTitle = _this$
|
|
79
|
-
title = _this$
|
|
80
|
-
text = _this$
|
|
81
|
-
labelPalette = _this$
|
|
82
|
-
size = _this$
|
|
83
|
-
labelSize = _this$
|
|
84
|
-
variant = _this$
|
|
85
|
-
active = _this$
|
|
86
|
-
isFilled = _this$
|
|
87
|
-
customClass = _this$
|
|
88
|
-
|
|
81
|
+
var _this$props3 = this.props,
|
|
82
|
+
id = _this$props3.id,
|
|
83
|
+
name = _this$props3.name,
|
|
84
|
+
value = _this$props3.value,
|
|
85
|
+
checked = _this$props3.checked,
|
|
86
|
+
disabled = _this$props3.disabled,
|
|
87
|
+
isReadOnly = _this$props3.isReadOnly,
|
|
88
|
+
palette = _this$props3.palette,
|
|
89
|
+
disabledTitle = _this$props3.disabledTitle,
|
|
90
|
+
title = _this$props3.title,
|
|
91
|
+
text = _this$props3.text,
|
|
92
|
+
labelPalette = _this$props3.labelPalette,
|
|
93
|
+
size = _this$props3.size,
|
|
94
|
+
labelSize = _this$props3.labelSize,
|
|
95
|
+
variant = _this$props3.variant,
|
|
96
|
+
active = _this$props3.active,
|
|
97
|
+
isFilled = _this$props3.isFilled,
|
|
98
|
+
customClass = _this$props3.customClass,
|
|
99
|
+
customProps = _this$props3.customProps,
|
|
100
|
+
children = _this$props3.children,
|
|
101
|
+
a11y = _this$props3.a11y;
|
|
89
102
|
var _customClass$customRa = customClass.customRadioWrap,
|
|
90
103
|
customRadioWrap = _customClass$customRa === void 0 ? '' : _customClass$customRa,
|
|
91
104
|
_customClass$customRa2 = customClass.customRadio,
|
|
@@ -97,13 +110,18 @@ var Radio = /*#__PURE__*/function (_React$Component) {
|
|
|
97
110
|
var ariaHidden = a11y.ariaHidden,
|
|
98
111
|
_a11y$role = a11y.role,
|
|
99
112
|
role = _a11y$role === void 0 ? 'radio' : _a11y$role,
|
|
113
|
+
tabIndex = a11y.tabIndex,
|
|
100
114
|
_a11y$ariaChecked = a11y.ariaChecked,
|
|
101
115
|
ariaChecked = _a11y$ariaChecked === void 0 ? checked : _a11y$ariaChecked,
|
|
102
116
|
ariaLabel = a11y.ariaLabel,
|
|
103
117
|
ariaLabelledby = a11y.ariaLabelledby,
|
|
104
118
|
_a11y$ariaReadonly = a11y.ariaReadonly,
|
|
105
119
|
ariaReadonly = _a11y$ariaReadonly === void 0 ? isReadOnly || disabled ? true : false : _a11y$ariaReadonly;
|
|
106
|
-
|
|
120
|
+
var _customProps$Containe = customProps.ContainerProps,
|
|
121
|
+
ContainerProps = _customProps$Containe === void 0 ? {} : _customProps$Containe,
|
|
122
|
+
_customProps$LabelPro = customProps.LabelProps,
|
|
123
|
+
LabelProps = _customProps$LabelPro === void 0 ? {} : _customProps$LabelPro;
|
|
124
|
+
return /*#__PURE__*/_react["default"].createElement(_Layout.Container, _extends({
|
|
107
125
|
dataId: value ? value.toLowerCase() : 'RadioComp',
|
|
108
126
|
isCover: false,
|
|
109
127
|
isInline: text ? false : true,
|
|
@@ -113,13 +131,14 @@ var Radio = /*#__PURE__*/function (_React$Component) {
|
|
|
113
131
|
"data-title": toolTip,
|
|
114
132
|
onClick: !isReadOnly && !disabled ? this.onChange : '',
|
|
115
133
|
"aria-checked": ariaChecked,
|
|
116
|
-
tabindex: isReadOnly || disabled || ariaHidden ? '-1' : '0',
|
|
134
|
+
tabindex: isReadOnly || disabled || ariaHidden ? '-1' : tabIndex || '0',
|
|
135
|
+
eleRef: this.handleGetRef,
|
|
117
136
|
role: role,
|
|
118
137
|
"aria-Hidden": ariaHidden,
|
|
119
138
|
"aria-label": ariaLabel,
|
|
120
139
|
"aria-labelledby": ariaLabelledby,
|
|
121
140
|
"aria-readonly": ariaReadonly
|
|
122
|
-
}, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
141
|
+
}, ContainerProps), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
123
142
|
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)
|
|
124
143
|
}, /*#__PURE__*/_react["default"].createElement("input", {
|
|
125
144
|
type: "hidden",
|
|
@@ -144,17 +163,17 @@ var Radio = /*#__PURE__*/function (_React$Component) {
|
|
|
144
163
|
}) : null))), text && /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
145
164
|
flexible: true,
|
|
146
165
|
className: _RadioModule["default"].text
|
|
147
|
-
}, /*#__PURE__*/_react["default"].createElement(_Label["default"], {
|
|
166
|
+
}, /*#__PURE__*/_react["default"].createElement(_Label["default"], _extends({
|
|
148
167
|
text: text,
|
|
149
|
-
palette:
|
|
168
|
+
palette: labelPalette,
|
|
150
169
|
size: labelSize,
|
|
151
170
|
type: "title",
|
|
152
171
|
clipped: true,
|
|
153
172
|
dataId: "".concat(text, "_label"),
|
|
154
173
|
variant: variant,
|
|
155
174
|
title: toolTip ? toolTip : text,
|
|
156
|
-
customClass: "".concat(checked && active
|
|
157
|
-
})));
|
|
175
|
+
customClass: "".concat(checked && active ? "".concat(_RadioModule["default"]["".concat(palette, "checkedActive")]) : '', " \n ").concat(_RadioModule["default"]["".concat(palette, "Label")], " ").concat(accessMode, " ").concat(customLabel)
|
|
176
|
+
}, LabelProps))), children);
|
|
158
177
|
}
|
|
159
178
|
}]);
|
|
160
179
|
|
|
@@ -1145,7 +1145,7 @@ exports[`Radio rendering the accessMode when disabled 1`] = `
|
|
|
1145
1145
|
data-test-id="boxComponent"
|
|
1146
1146
|
>
|
|
1147
1147
|
<label
|
|
1148
|
-
class="label title medium
|
|
1148
|
+
class="label title medium default font_default
|
|
1149
1149
|
dotted cursor
|
|
1150
1150
|
primaryLabel disabled "
|
|
1151
1151
|
data-id="RadioText_label"
|
|
@@ -1505,7 +1505,7 @@ exports[`Radio rendering the disabled is true 1`] = `
|
|
|
1505
1505
|
data-test-id="boxComponent"
|
|
1506
1506
|
>
|
|
1507
1507
|
<label
|
|
1508
|
-
class="label title medium
|
|
1508
|
+
class="label title medium default font_default
|
|
1509
1509
|
dotted cursor
|
|
1510
1510
|
undefined disabled "
|
|
1511
1511
|
data-id="RadioText_label"
|
|
@@ -1567,7 +1567,7 @@ exports[`Radio rendering the disabledTitle 1`] = `
|
|
|
1567
1567
|
data-test-id="boxComponent"
|
|
1568
1568
|
>
|
|
1569
1569
|
<label
|
|
1570
|
-
class="label title medium
|
|
1570
|
+
class="label title medium default font_default
|
|
1571
1571
|
dotted cursor
|
|
1572
1572
|
primaryLabel disabled "
|
|
1573
1573
|
data-id="RadioText_label"
|