@zohodesk/dot 1.3.0 → 1.3.2
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/PropLessFiles.html +1 -1
- package/.cli/PropValidationExcludeFilesArray.js +1 -1
- package/.cli/propValidation_report.html +1 -1
- package/README.md +21 -12
- package/assets/Appearance/dark/mode/Dot_DarkMode.module.css +163 -553
- package/assets/Appearance/dark/themes/blue/blue_DotTheme_DarkTheme.module.css +3 -12
- package/assets/Appearance/dark/themes/green/green_DotTheme_DarkTheme.module.css +3 -12
- package/assets/Appearance/dark/themes/orange/orange_DotTheme_DarkTheme.module.css +3 -12
- package/assets/Appearance/dark/themes/red/red_DotTheme_DarkTheme.module.css +3 -12
- package/assets/Appearance/dark/themes/yellow/yellow_DotTheme_DarkTheme.module.css +3 -12
- package/assets/Appearance/light/mode/Dot_LightMode.module.css +163 -553
- package/assets/Appearance/light/themes/blue/blue_DotTheme_LightTheme.module.css +3 -12
- package/assets/Appearance/light/themes/green/green_DotTheme_LightTheme.module.css +3 -12
- package/assets/Appearance/light/themes/orange/orange_DotTheme_LightTheme.module.css +3 -12
- package/assets/Appearance/light/themes/red/red_DotTheme_LightTheme.module.css +3 -12
- package/assets/Appearance/light/themes/yellow/yellow_DotTheme_LightTheme.module.css +3 -12
- package/assets/Appearance/pureDark/mode/Dot_PureDarkMode.module.css +163 -553
- package/assets/Appearance/pureDark/themes/blue/blue_DotTheme_PureDarkTheme.module.css +3 -12
- package/assets/Appearance/pureDark/themes/green/green_DotTheme_PureDarkTheme.module.css +3 -12
- package/assets/Appearance/pureDark/themes/orange/orange_DotTheme_PureDarkTheme.module.css +3 -12
- package/assets/Appearance/pureDark/themes/red/red_DotTheme_PureDarkTheme.module.css +3 -12
- package/assets/Appearance/pureDark/themes/yellow/yellow_DotTheme_PureDarkTheme.module.css +3 -12
- package/coverage/ExternalLink/ExternalLink.js.html +1 -1
- package/coverage/ExternalLink/ExternalLink.module.css.html +1 -1
- package/coverage/ExternalLink/index.html +1 -1
- package/coverage/ExternalLink/props/defaultProps.js.html +1 -1
- package/coverage/ExternalLink/props/index.html +1 -1
- package/coverage/ExternalLink/props/propTypes.js.html +1 -1
- package/coverage/IconButton/IconButton.js.html +466 -0
- package/coverage/IconButton/IconButton.module.css.html +151 -0
- package/coverage/IconButton/index.html +131 -0
- package/coverage/IconButton/props/defaultProps.js.html +136 -0
- package/coverage/IconButton/props/index.html +131 -0
- package/coverage/IconButton/props/propTypes.js.html +187 -0
- package/coverage/Image/Image.js.html +1 -1
- package/coverage/Image/Image.module.css.html +1 -1
- package/coverage/Image/index.html +1 -1
- package/coverage/Image/props/defaultProps.js.html +1 -1
- package/coverage/Image/props/index.html +1 -1
- package/coverage/Image/props/propTypes.js.html +1 -1
- package/coverage/avatar/AvatarWithTeam/AvatarWithTeam.js.html +1 -1
- package/coverage/avatar/AvatarWithTeam/AvatarWithTeam.module.css.html +1 -1
- package/coverage/avatar/AvatarWithTeam/index.html +1 -1
- package/coverage/avatar/AvatarWithTeam/props/defaultProps.js.html +1 -1
- package/coverage/avatar/AvatarWithTeam/props/index.html +1 -1
- package/coverage/avatar/AvatarWithTeam/props/propTypes.js.html +1 -1
- package/coverage/coverage-final.json +4 -0
- package/coverage/coverage-summary.json +5 -1
- package/coverage/index.html +40 -10
- package/es/IconButton/__tests__/IconButton.spec.js +148 -0
- package/es/IconButton/__tests__/__snapshots__/IconButton.spec.js.snap +316 -0
- package/es/form/fields/FieldContainer/props/propTypes.js +1 -1
- package/es/v1/ActionButton/ActionButton.js +2 -2
- package/es/v1/AlphabeticList/AlphabeticList.js +6 -2
- package/es/v1/Attachment/Attachment.js +78 -75
- package/es/v1/AttachmentViewer/AttachmentImage.js +44 -63
- package/es/v1/Image/Image.js +26 -33
- package/es/v1/Loader/Loader.js +12 -18
- package/es/v1/Message/Message.js +16 -42
- package/es/v1/PlusIcon/PlusIcon.js +25 -37
- package/es/v1/Separator/Separator.js +40 -47
- package/es/v1/Upload/Upload.js +59 -66
- package/es/v1/alert/AlertHeader/AlertHeader.js +5 -4
- package/es/v1/alert/AlertHeader/props/defaultProps.js +12 -0
- package/es/v1/alert/AlertHeader/props/propTypes.js +20 -0
- package/es/v1/alert/AlertLookup/AlertLookup.js +6 -4
- package/es/v1/alert/AlertLookup/props/defaultProps.js +13 -0
- package/es/v1/alert/AlertLookup/props/propTypes.js +36 -0
- package/es/v1/avatar/AvatarClose/AvatarClose.js +32 -43
- package/es/v1/avatar/AvatarCollision/AvatarCollision.js +41 -52
- package/es/v1/avatar/AvatarIcon/AvatarIcon.js +38 -43
- package/es/v1/avatar/AvatarStatus/AvatarStatus.js +52 -63
- package/es/v1/avatar/AvatarThread/AvatarThread.js +62 -69
- package/es/v1/avatar/AvatarUser/AvatarUser.js +93 -100
- package/es/v1/avatar/AvatarWithTeam/AvatarWithTeam.js +81 -88
- package/es/v1/form/fields/CheckBoxField/CheckBoxField.js +6 -6
- package/es/v1/form/fields/CurrencyField/CurrencyField.js +6 -6
- package/es/v1/form/fields/DateField/DateField.js +6 -6
- package/es/v1/form/fields/FieldContainer/FieldContainer.js +6 -6
- package/es/v1/form/fields/MultiSelectField/MultiSelectField.js +6 -6
- package/es/v1/form/fields/PhoneField/PhoneField.js +6 -6
- package/es/v1/form/fields/RadioField/RadioField.js +89 -97
- package/es/v1/form/fields/SelectField/SelectField.js +139 -154
- package/es/v1/layout/SetupDetailLayout/SetupDetailLayout.js +154 -197
- package/es/v1/layout/SubtabLayout/SubtabLayout.js +108 -124
- package/es/v1/list/SecondaryText/AccountName.js +61 -69
- package/es/v1/list/SecondaryText/ContactName.js +66 -74
- package/es/v1/list/SecondaryText/DepartmentText.js +15 -27
- package/es/v1/list/SecondaryText/Email.js +32 -40
- package/es/v1/list/SecondaryText/HappinessRating.js +17 -25
- package/es/v1/list/SecondaryText/PhoneNumber.js +36 -44
- package/es/v1/list/SecondaryText/PriorityText.js +16 -28
- package/es/v1/list/SecondaryText/SecondaryText.js +21 -33
- package/es/v1/list/SecondaryText/StatusText.js +17 -29
- package/es/v1/list/SecondaryText/TicketId.js +33 -45
- package/es/v1/list/SecondaryText/Website.js +22 -30
- package/es/v1/list/SecondryPanel/SecondryPanel.js +66 -83
- package/es/v1/list/SentimentStatus/SentimentStatus.js +18 -29
- package/es/v1/list/status/StatusDropdown/StatusDropdown.js +2 -2
- package/es/v1/list/status/StatusListItem/StatusListItem.js +75 -100
- package/es/v1/lookup/EmptyPage/EmptyPage.js +15 -26
- package/es/v1/lookup/Section/Section.js +14 -20
- package/es/v1/svg/PlusIcon.js +20 -27
- package/es/v1/svg/SnippetIcon.js +22 -29
- package/es/v1/svg/TemplateIcon.js +23 -30
- package/lib/IconButton/__tests__/IconButton.spec.js +156 -0
- package/lib/IconButton/__tests__/__snapshots__/IconButton.spec.js.snap +316 -0
- package/lib/form/fields/FieldContainer/props/propTypes.js +1 -1
- package/lib/v1/ActionButton/ActionButton.js +2 -2
- package/lib/v1/AlphabeticList/AlphabeticList.js +7 -3
- package/lib/v1/Attachment/Attachment.js +77 -112
- package/lib/v1/AttachmentViewer/AttachmentImage.js +61 -96
- package/lib/v1/Image/Image.js +26 -71
- package/lib/v1/Loader/Loader.js +12 -55
- package/lib/v1/Message/Message.js +23 -80
- package/lib/v1/PlusIcon/PlusIcon.js +25 -71
- package/lib/v1/Separator/Separator.js +44 -85
- package/lib/v1/Upload/Upload.js +58 -103
- package/lib/v1/alert/AlertHeader/AlertHeader.js +5 -4
- package/lib/v1/alert/AlertHeader/props/defaultProps.js +19 -0
- package/lib/v1/alert/AlertHeader/props/propTypes.js +31 -0
- package/lib/v1/alert/AlertLookup/AlertLookup.js +6 -4
- package/lib/v1/alert/AlertLookup/props/defaultProps.js +20 -0
- package/lib/v1/alert/AlertLookup/props/propTypes.js +47 -0
- package/lib/v1/avatar/AvatarClose/AvatarClose.js +32 -77
- package/lib/v1/avatar/AvatarCollision/AvatarCollision.js +41 -86
- package/lib/v1/avatar/AvatarIcon/AvatarIcon.js +37 -80
- package/lib/v1/avatar/AvatarStatus/AvatarStatus.js +52 -97
- package/lib/v1/avatar/AvatarThread/AvatarThread.js +61 -106
- package/lib/v1/avatar/AvatarUser/AvatarUser.js +95 -140
- package/lib/v1/avatar/AvatarWithTeam/AvatarWithTeam.js +85 -130
- package/lib/v1/form/fields/CheckBoxField/CheckBoxField.js +6 -6
- package/lib/v1/form/fields/CurrencyField/CurrencyField.js +6 -6
- package/lib/v1/form/fields/DateField/DateField.js +6 -6
- package/lib/v1/form/fields/FieldContainer/FieldContainer.js +6 -6
- package/lib/v1/form/fields/MultiSelectField/MultiSelectField.js +6 -6
- package/lib/v1/form/fields/PhoneField/PhoneField.js +6 -6
- package/lib/v1/form/fields/RadioField/RadioField.js +91 -137
- package/lib/v1/form/fields/SelectField/SelectField.js +149 -200
- package/lib/v1/layout/SetupDetailLayout/SetupDetailLayout.js +160 -253
- package/lib/v1/layout/SubtabLayout/SubtabLayout.js +107 -206
- package/lib/v1/list/SecondaryText/AccountName.js +63 -113
- package/lib/v1/list/SecondaryText/ContactName.js +67 -117
- package/lib/v1/list/SecondaryText/DepartmentText.js +16 -66
- package/lib/v1/list/SecondaryText/Email.js +32 -82
- package/lib/v1/list/SecondaryText/HappinessRating.js +21 -68
- package/lib/v1/list/SecondaryText/PhoneNumber.js +36 -86
- package/lib/v1/list/SecondaryText/PriorityText.js +16 -66
- package/lib/v1/list/SecondaryText/SecondaryText.js +19 -69
- package/lib/v1/list/SecondaryText/StatusText.js +17 -67
- package/lib/v1/list/SecondaryText/TicketId.js +33 -83
- package/lib/v1/list/SecondaryText/Website.js +29 -72
- package/lib/v1/list/SecondryPanel/SecondryPanel.js +69 -168
- package/lib/v1/list/SentimentStatus/SentimentStatus.js +19 -64
- package/lib/v1/list/status/StatusDropdown/StatusDropdown.js +2 -2
- package/lib/v1/list/status/StatusListItem/StatusListItem.js +81 -137
- package/lib/v1/lookup/EmptyPage/EmptyPage.js +43 -93
- package/lib/v1/lookup/Section/Section.js +14 -58
- package/lib/v1/svg/PlusIcon.js +20 -65
- package/lib/v1/svg/SnippetIcon.js +22 -67
- package/lib/v1/svg/TemplateIcon.js +23 -68
- package/package.json +12 -12
- package/result.json +1 -1
- package/unittest/index.html +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
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
2
|
|
|
3
3
|
/**** Libraries ****/
|
|
4
|
-
import React, {
|
|
4
|
+
import React, { memo } from 'react';
|
|
5
5
|
import { defaultProps } from '../../../../form/fields/RadioField/props/defaultProps';
|
|
6
6
|
import { propTypes } from '../../../../form/fields/RadioField/props/propTypes';
|
|
7
7
|
/**** Components ****/
|
|
@@ -12,105 +12,97 @@ import ValidationMessage from '../ValidationMessage/ValidationMessage';
|
|
|
12
12
|
/** Css */
|
|
13
13
|
|
|
14
14
|
import style from '../../../../form/fields/Fields.module.css';
|
|
15
|
-
export default class RadioField extends PureComponent {
|
|
16
|
-
constructor(props) {
|
|
17
|
-
super(props);
|
|
18
|
-
this.handleChange = this.handleChange.bind(this);
|
|
19
|
-
}
|
|
20
15
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
const RadioField = props => {
|
|
17
|
+
const {
|
|
18
|
+
labelName,
|
|
19
|
+
id,
|
|
20
|
+
isMandatory,
|
|
21
|
+
options,
|
|
22
|
+
validationMessage,
|
|
23
|
+
validationPalette,
|
|
24
|
+
errorType,
|
|
25
|
+
isDisabled,
|
|
26
|
+
title,
|
|
27
|
+
labelPalette,
|
|
28
|
+
labelSize,
|
|
29
|
+
size,
|
|
30
|
+
selectedValue,
|
|
31
|
+
isActive,
|
|
32
|
+
dataId,
|
|
33
|
+
dataSelectorId,
|
|
34
|
+
validationRuleMessage,
|
|
35
|
+
validationRulePalette,
|
|
36
|
+
isReadOnly,
|
|
37
|
+
variant,
|
|
38
|
+
customProps,
|
|
39
|
+
onChange
|
|
40
|
+
} = props;
|
|
41
|
+
const {
|
|
42
|
+
LabelProps = {},
|
|
43
|
+
RadioProps = {},
|
|
44
|
+
ValidationMessageProps1 = {},
|
|
45
|
+
ValidationMessageProps2 = {}
|
|
46
|
+
} = customProps;
|
|
47
|
+
|
|
48
|
+
const handleChange = value => {
|
|
26
49
|
onChange && onChange(id, value);
|
|
27
|
-
}
|
|
50
|
+
};
|
|
28
51
|
|
|
29
|
-
|
|
52
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
className: `${style.container} ${isDisabled ? style.disabled : isReadOnly ? style.readonly : ''}`,
|
|
54
|
+
"data-title": isDisabled ? title : null,
|
|
55
|
+
"data-selector-id": dataSelectorId
|
|
56
|
+
}, labelName && /*#__PURE__*/React.createElement(Label, _extends({
|
|
57
|
+
text: labelName,
|
|
58
|
+
size: "medium",
|
|
59
|
+
id: id,
|
|
60
|
+
palette: isMandatory ? 'mandatory' : isDisabled ? 'primary' : 'default',
|
|
61
|
+
customClass: `${style.fieldLabel} ${isMandatory ? style.labelMandatory : ''}`,
|
|
62
|
+
dataId: isDisabled ? `${dataId}_label_disabled` : isMandatory ? `${dataId}_label_mandatory` : `${dataId}_label`
|
|
63
|
+
}, LabelProps)), /*#__PURE__*/React.createElement("div", {
|
|
64
|
+
className: `${style.fieldContainer} ${labelName ? style.fieldMargin_medium : ''} ${style.radioContainer}`
|
|
65
|
+
}, options.map((option, index) => {
|
|
30
66
|
let {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
isActive,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
size: "medium",
|
|
66
|
-
id: id,
|
|
67
|
-
palette: isMandatory ? 'mandatory' : isDisabled ? 'primary' : 'default',
|
|
68
|
-
customClass: `${style.fieldLabel} ${isMandatory ? style.labelMandatory : ''}`,
|
|
69
|
-
dataId: isDisabled ? `${dataId}_label_disabled` : isMandatory ? `${dataId}_label_mandatory` : `${dataId}_label`
|
|
70
|
-
}, LabelProps)), /*#__PURE__*/React.createElement("div", {
|
|
71
|
-
className: `${style.fieldContainer} ${labelName ? style.fieldMargin_medium : ''} ${style.radioContainer}`
|
|
72
|
-
}, options.map((option, index) => {
|
|
73
|
-
let {
|
|
74
|
-
text,
|
|
75
|
-
value
|
|
76
|
-
} = option;
|
|
77
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
78
|
-
key: index,
|
|
79
|
-
className: `${style.radio}`
|
|
80
|
-
}, /*#__PURE__*/React.createElement(Radio, _extends({
|
|
81
|
-
id: index,
|
|
82
|
-
value: value,
|
|
83
|
-
name: id,
|
|
84
|
-
text: text,
|
|
85
|
-
labelPalette: labelPalette,
|
|
86
|
-
labelSize: labelSize,
|
|
87
|
-
active: isActive,
|
|
88
|
-
disabled: isDisabled,
|
|
89
|
-
onChange: this.handleChange,
|
|
90
|
-
size: size,
|
|
91
|
-
checked: selectedValue == value,
|
|
92
|
-
dataId: dataId,
|
|
93
|
-
isReadOnly: isReadOnly,
|
|
94
|
-
variant: variant
|
|
95
|
-
}, RadioProps)));
|
|
96
|
-
})), validationMessage && /*#__PURE__*/React.createElement(ValidationMessage, _extends({
|
|
97
|
-
text: validationMessage,
|
|
98
|
-
palette: validationPalette,
|
|
99
|
-
type: errorType,
|
|
100
|
-
dataId: `${dataId}_ValidationMessage`
|
|
101
|
-
}, ValidationMessageProps1)), validationRuleMessage && /*#__PURE__*/React.createElement(ValidationMessage, _extends({
|
|
102
|
-
text: validationRuleMessage,
|
|
103
|
-
palette: validationRulePalette,
|
|
104
|
-
type: errorType,
|
|
105
|
-
dataId: `${dataId}_ValidationRuleMessage`
|
|
106
|
-
}, ValidationMessageProps2)));
|
|
107
|
-
}
|
|
67
|
+
text,
|
|
68
|
+
value
|
|
69
|
+
} = option;
|
|
70
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
71
|
+
key: index,
|
|
72
|
+
className: `${style.radio}`
|
|
73
|
+
}, /*#__PURE__*/React.createElement(Radio, _extends({
|
|
74
|
+
id: index,
|
|
75
|
+
value: value,
|
|
76
|
+
name: id,
|
|
77
|
+
text: text,
|
|
78
|
+
labelPalette: labelPalette,
|
|
79
|
+
labelSize: labelSize,
|
|
80
|
+
active: isActive,
|
|
81
|
+
disabled: isDisabled,
|
|
82
|
+
onChange: handleChange,
|
|
83
|
+
size: size,
|
|
84
|
+
checked: selectedValue == value,
|
|
85
|
+
dataId: dataId,
|
|
86
|
+
isReadOnly: isReadOnly,
|
|
87
|
+
variant: variant
|
|
88
|
+
}, RadioProps)));
|
|
89
|
+
})), validationMessage && /*#__PURE__*/React.createElement(ValidationMessage, _extends({
|
|
90
|
+
text: validationMessage,
|
|
91
|
+
palette: validationPalette,
|
|
92
|
+
type: errorType,
|
|
93
|
+
dataId: `${dataId}_ValidationMessage`
|
|
94
|
+
}, ValidationMessageProps1)), validationRuleMessage && /*#__PURE__*/React.createElement(ValidationMessage, _extends({
|
|
95
|
+
text: validationRuleMessage,
|
|
96
|
+
palette: validationRulePalette,
|
|
97
|
+
type: errorType,
|
|
98
|
+
dataId: `${dataId}_ValidationRuleMessage`
|
|
99
|
+
}, ValidationMessageProps2)));
|
|
100
|
+
};
|
|
108
101
|
|
|
109
|
-
}
|
|
110
102
|
RadioField.propTypes = propTypes;
|
|
111
|
-
RadioField.defaultProps = defaultProps;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
103
|
+
RadioField.defaultProps = defaultProps;
|
|
104
|
+
const MemoizedRadioField = /*#__PURE__*/memo(RadioField);
|
|
105
|
+
MemoizedRadioField.propTypes = propTypes;
|
|
106
|
+
MemoizedRadioField.defaultProps = defaultProps;
|
|
107
|
+
MemoizedRadioField.displayName = 'RadioField';
|
|
108
|
+
export default MemoizedRadioField;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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
2
|
|
|
3
3
|
/**** Libraries ****/
|
|
4
|
-
import React, {
|
|
4
|
+
import React, { memo } from 'react';
|
|
5
5
|
import { defaultProps } from '../../../../form/fields/SelectField/props/defaultProps';
|
|
6
6
|
import { propTypes } from '../../../../form/fields/SelectField/props/propTypes';
|
|
7
7
|
/**** Components ****/
|
|
@@ -9,39 +9,82 @@ import { propTypes } from '../../../../form/fields/SelectField/props/propTypes';
|
|
|
9
9
|
import Label from '@zohodesk/components/es/v1/Label/Label';
|
|
10
10
|
import Select from '@zohodesk/components/es/v1/Select/Select';
|
|
11
11
|
import ValidationMessage from '../ValidationMessage/ValidationMessage';
|
|
12
|
-
import {
|
|
12
|
+
import { useUniqueId } from '@zohodesk/components/es/v1/Provider/IdProvider';
|
|
13
13
|
import FieldContainer from '../FieldContainer/FieldContainer';
|
|
14
14
|
/**** props ****/
|
|
15
15
|
|
|
16
16
|
/** CSS */
|
|
17
17
|
|
|
18
18
|
import style from '../../../../form/fields/Fields.module.css';
|
|
19
|
-
export default class SelectField extends PureComponent {
|
|
20
|
-
constructor(props) {
|
|
21
|
-
super(props);
|
|
22
|
-
this.handleChange = this.handleChange.bind(this);
|
|
23
|
-
this.handleGetRef = this.handleGetRef.bind(this); // this.handleLabelClick = this.handleLabelClick.bind(this);
|
|
24
19
|
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
const SelectField = props => {
|
|
21
|
+
const {
|
|
22
|
+
labelName,
|
|
23
|
+
isMandatory,
|
|
24
|
+
options,
|
|
25
|
+
selectedValue,
|
|
26
|
+
needSearch,
|
|
27
|
+
emptyMessage,
|
|
28
|
+
animationStyle,
|
|
29
|
+
textBoxSize,
|
|
30
|
+
textBoxVariant,
|
|
31
|
+
searchBoxSize,
|
|
32
|
+
searchBoxPlaceHolder,
|
|
33
|
+
validationMessage,
|
|
34
|
+
validationPalette,
|
|
35
|
+
isReadOnly,
|
|
36
|
+
valueField,
|
|
37
|
+
textField,
|
|
38
|
+
excludeOptions,
|
|
39
|
+
errorType,
|
|
40
|
+
isDisabled,
|
|
41
|
+
title,
|
|
42
|
+
dataId,
|
|
43
|
+
dataSelectorId,
|
|
44
|
+
fieldClass,
|
|
45
|
+
validationRuleMessage,
|
|
46
|
+
validationRulePalette,
|
|
47
|
+
onKeyDown,
|
|
48
|
+
infoText,
|
|
49
|
+
isLocked,
|
|
50
|
+
lockedInfoText,
|
|
51
|
+
borderColor,
|
|
52
|
+
fieldSize,
|
|
53
|
+
isNextOptions,
|
|
54
|
+
getNextOptions,
|
|
55
|
+
popupGroup,
|
|
56
|
+
onSearch,
|
|
57
|
+
labelPalette,
|
|
58
|
+
labelCustomClass,
|
|
59
|
+
htmlId,
|
|
60
|
+
needLocalSearch,
|
|
61
|
+
isDefaultSelectValue,
|
|
62
|
+
placeHolder,
|
|
63
|
+
children,
|
|
64
|
+
onFocus,
|
|
65
|
+
iconOnHover,
|
|
66
|
+
customProps,
|
|
67
|
+
renderLabelProps,
|
|
68
|
+
id,
|
|
69
|
+
onChange,
|
|
70
|
+
getRef
|
|
71
|
+
} = props;
|
|
72
|
+
const {
|
|
73
|
+
LabelProps = {},
|
|
74
|
+
SelectProps = {},
|
|
75
|
+
ValidationMessageProps1 = {},
|
|
76
|
+
ValidationMessageProps2 = {}
|
|
77
|
+
} = customProps;
|
|
78
|
+
const getNextId = useUniqueId();
|
|
79
|
+
let uniqueId = htmlId ? htmlId : getNextId();
|
|
27
80
|
|
|
28
|
-
handleChange(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
onChange,
|
|
32
|
-
selectedValue: propValue
|
|
33
|
-
} = this.props;
|
|
34
|
-
onChange && propValue !== selctedId && onChange(fieldId, selctedId, selectedValue);
|
|
35
|
-
}
|
|
81
|
+
const handleChange = (selectedId, selectedVal) => {
|
|
82
|
+
onChange && selectedValue !== selectedId && onChange(id, selectedId, selectedVal);
|
|
83
|
+
};
|
|
36
84
|
|
|
37
|
-
handleGetRef
|
|
38
|
-
let {
|
|
39
|
-
getRef,
|
|
40
|
-
id
|
|
41
|
-
} = this.props;
|
|
42
|
-
this.selectBox = el;
|
|
85
|
+
const handleGetRef = el => {
|
|
43
86
|
getRef && getRef(el, id);
|
|
44
|
-
} // handleLabelClick() {
|
|
87
|
+
}; // handleLabelClick() {
|
|
45
88
|
// let { isFocusOnLabelClick } = this.props;
|
|
46
89
|
// if (isFocusOnLabelClick && this.selectBox && this.selectBox.focus) {
|
|
47
90
|
// this.selectBox.focus();
|
|
@@ -49,135 +92,77 @@ export default class SelectField extends PureComponent {
|
|
|
49
92
|
// }
|
|
50
93
|
|
|
51
94
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}, /*#__PURE__*/React.createElement(Label, _extends({
|
|
119
|
-
text: labelName,
|
|
120
|
-
size: fieldSize === 'small' ? 'small' : 'medium',
|
|
121
|
-
palette: isMandatory ? 'mandatory' : isDisabled ? 'primary' : labelPalette,
|
|
122
|
-
customClass: `${style.fieldLabel} ${labelCustomClass} ${isMandatory ? style.labelMandatory : ''}`,
|
|
123
|
-
htmlFor: uniqueId,
|
|
124
|
-
dataId: isDisabled ? `${dataId}_label_disabled` : isMandatory ? `${dataId}_label_mandatory` : `${dataId}_label`
|
|
125
|
-
}, LabelProps, {
|
|
126
|
-
id: uniqueId
|
|
127
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
|
128
|
-
className: `${style.fieldContainer} ${labelName ? style[`fieldMargin_${fieldSize}`] : ''} ${fieldClass ? fieldClass : ''}`
|
|
129
|
-
}, /*#__PURE__*/React.createElement(Select, _extends({
|
|
130
|
-
options: options,
|
|
131
|
-
selectedValue: selectedValue,
|
|
132
|
-
onChange: this.handleChange,
|
|
133
|
-
onFocus: onFocus,
|
|
134
|
-
getRef: this.handleGetRef,
|
|
135
|
-
needSearch: needSearch,
|
|
136
|
-
emptyMessage: emptyMessage,
|
|
137
|
-
animationStyle: animationStyle,
|
|
138
|
-
textBoxSize: fieldSize === 'medium' ? textBoxSize : 'xsmall',
|
|
139
|
-
textBoxVariant: textBoxVariant,
|
|
140
|
-
searchBoxSize: searchBoxSize,
|
|
141
|
-
searchBoxPlaceHolder: searchBoxPlaceHolder,
|
|
142
|
-
valueField: valueField,
|
|
143
|
-
textField: textField,
|
|
144
|
-
excludeOptions: excludeOptions,
|
|
145
|
-
dataId: dataId,
|
|
146
|
-
onKeyDown: onKeyDown,
|
|
147
|
-
borderColor: borderColor,
|
|
148
|
-
isDisabled: isDisabled,
|
|
149
|
-
isReadOnly: isReadOnly,
|
|
150
|
-
isNextOptions: isNextOptions,
|
|
151
|
-
getNextOptions: getNextOptions,
|
|
152
|
-
popupGroup: popupGroup,
|
|
153
|
-
onSearch: onSearch,
|
|
154
|
-
htmlId: uniqueId,
|
|
155
|
-
needLocalSearch: needLocalSearch,
|
|
156
|
-
isDefaultSelectValue: isDefaultSelectValue,
|
|
157
|
-
placeHolder: placeHolder,
|
|
158
|
-
iconOnHover: iconOnHover
|
|
159
|
-
}, SelectProps, {
|
|
160
|
-
ariaLabelledby: uniqueId
|
|
161
|
-
}), children ? children : null)), validationMessage && /*#__PURE__*/React.createElement(ValidationMessage, _extends({
|
|
162
|
-
text: validationMessage,
|
|
163
|
-
palette: validationPalette,
|
|
164
|
-
type: errorType,
|
|
165
|
-
htmlFor: uniqueId,
|
|
166
|
-
dataId: `${dataId}_ValidationMessage`
|
|
167
|
-
}, ValidationMessageProps1)), validationRuleMessage && /*#__PURE__*/React.createElement(ValidationMessage, _extends({
|
|
168
|
-
text: validationRuleMessage,
|
|
169
|
-
palette: validationRulePalette,
|
|
170
|
-
type: errorType,
|
|
171
|
-
htmlFor: uniqueId,
|
|
172
|
-
dataId: `${dataId}_ValidationRuleMessage`
|
|
173
|
-
}, ValidationMessageProps2)));
|
|
174
|
-
}
|
|
95
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
96
|
+
className: `${style.container} ${isDisabled ? style.disabled : isReadOnly ? style.readonly : ''}`,
|
|
97
|
+
"data-title": isDisabled ? title : null,
|
|
98
|
+
"data-selector-id": dataSelectorId
|
|
99
|
+
}, labelName && /*#__PURE__*/React.createElement(FieldContainer, {
|
|
100
|
+
infoText: infoText,
|
|
101
|
+
isLocked: isLocked,
|
|
102
|
+
lockedInfoText: lockedInfoText,
|
|
103
|
+
renderProps: renderLabelProps
|
|
104
|
+
}, /*#__PURE__*/React.createElement(Label, _extends({
|
|
105
|
+
text: labelName,
|
|
106
|
+
size: fieldSize === 'small' ? 'small' : 'medium',
|
|
107
|
+
palette: isMandatory ? 'mandatory' : isDisabled ? 'primary' : labelPalette,
|
|
108
|
+
customClass: `${style.fieldLabel} ${labelCustomClass} ${isMandatory ? style.labelMandatory : ''}`,
|
|
109
|
+
htmlFor: uniqueId,
|
|
110
|
+
dataId: isDisabled ? `${dataId}_label_disabled` : isMandatory ? `${dataId}_label_mandatory` : `${dataId}_label`
|
|
111
|
+
}, LabelProps, {
|
|
112
|
+
id: uniqueId
|
|
113
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
114
|
+
className: `${style.fieldContainer} ${labelName ? style[`fieldMargin_${fieldSize}`] : ''} ${fieldClass ? fieldClass : ''}`
|
|
115
|
+
}, /*#__PURE__*/React.createElement(Select, _extends({
|
|
116
|
+
options: options,
|
|
117
|
+
selectedValue: selectedValue,
|
|
118
|
+
onChange: handleChange,
|
|
119
|
+
onFocus: onFocus,
|
|
120
|
+
getRef: handleGetRef,
|
|
121
|
+
needSearch: needSearch,
|
|
122
|
+
emptyMessage: emptyMessage,
|
|
123
|
+
animationStyle: animationStyle,
|
|
124
|
+
textBoxSize: fieldSize === 'medium' ? textBoxSize : 'xsmall',
|
|
125
|
+
textBoxVariant: textBoxVariant,
|
|
126
|
+
searchBoxSize: searchBoxSize,
|
|
127
|
+
searchBoxPlaceHolder: searchBoxPlaceHolder,
|
|
128
|
+
valueField: valueField,
|
|
129
|
+
textField: textField,
|
|
130
|
+
excludeOptions: excludeOptions,
|
|
131
|
+
dataId: dataId,
|
|
132
|
+
onKeyDown: onKeyDown,
|
|
133
|
+
borderColor: borderColor,
|
|
134
|
+
isDisabled: isDisabled,
|
|
135
|
+
isReadOnly: isReadOnly,
|
|
136
|
+
isNextOptions: isNextOptions,
|
|
137
|
+
getNextOptions: getNextOptions,
|
|
138
|
+
popupGroup: popupGroup,
|
|
139
|
+
onSearch: onSearch,
|
|
140
|
+
htmlId: uniqueId,
|
|
141
|
+
needLocalSearch: needLocalSearch,
|
|
142
|
+
isDefaultSelectValue: isDefaultSelectValue,
|
|
143
|
+
placeHolder: placeHolder,
|
|
144
|
+
iconOnHover: iconOnHover
|
|
145
|
+
}, SelectProps, {
|
|
146
|
+
ariaLabelledby: uniqueId
|
|
147
|
+
}), children ? children : null)), validationMessage && /*#__PURE__*/React.createElement(ValidationMessage, _extends({
|
|
148
|
+
text: validationMessage,
|
|
149
|
+
palette: validationPalette,
|
|
150
|
+
type: errorType,
|
|
151
|
+
htmlFor: uniqueId,
|
|
152
|
+
dataId: `${dataId}_ValidationMessage`
|
|
153
|
+
}, ValidationMessageProps1)), validationRuleMessage && /*#__PURE__*/React.createElement(ValidationMessage, _extends({
|
|
154
|
+
text: validationRuleMessage,
|
|
155
|
+
palette: validationRulePalette,
|
|
156
|
+
type: errorType,
|
|
157
|
+
htmlFor: uniqueId,
|
|
158
|
+
dataId: `${dataId}_ValidationRuleMessage`
|
|
159
|
+
}, ValidationMessageProps2)));
|
|
160
|
+
};
|
|
175
161
|
|
|
176
|
-
}
|
|
177
162
|
SelectField.propTypes = propTypes;
|
|
178
|
-
SelectField.defaultProps = defaultProps;
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
163
|
+
SelectField.defaultProps = defaultProps;
|
|
164
|
+
const MemoizedSelectField = /*#__PURE__*/memo(SelectField);
|
|
165
|
+
MemoizedSelectField.propTypes = propTypes;
|
|
166
|
+
MemoizedSelectField.defaultProps = defaultProps;
|
|
167
|
+
MemoizedSelectField.displayName = 'SelectField';
|
|
168
|
+
export default MemoizedSelectField;
|