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