@zohodesk/components 1.2.4 → 1.2.6

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 (202) hide show
  1. package/README.md +8 -0
  2. package/coverage/Button/Button.js.html +1 -1
  3. package/coverage/Button/css/Button.module.css.html +1 -1
  4. package/coverage/Button/css/cssJSLogic.js.html +1 -1
  5. package/coverage/Button/css/index.html +1 -1
  6. package/coverage/Button/index.html +1 -1
  7. package/coverage/Button/props/defaultProps.js.html +1 -1
  8. package/coverage/Button/props/index.html +1 -1
  9. package/coverage/Button/props/propTypes.js.html +1 -1
  10. package/coverage/Buttongroup/Buttongroup.js.html +1 -1
  11. package/coverage/Buttongroup/Buttongroup.module.css.html +1 -1
  12. package/coverage/Buttongroup/index.html +1 -1
  13. package/coverage/Buttongroup/props/defaultProps.js.html +1 -1
  14. package/coverage/Buttongroup/props/index.html +1 -1
  15. package/coverage/Buttongroup/props/propTypes.js.html +1 -1
  16. package/coverage/index.html +1 -1
  17. package/coverage/utils/dummyFunction.js.html +1 -1
  18. package/coverage/utils/index.html +1 -1
  19. package/es/AppContainer/AppContainer.js +3 -0
  20. package/es/v1/Accordion/Accordion.js +65 -0
  21. package/es/v1/Accordion/AccordionItem.js +57 -0
  22. package/es/v1/Accordion/index.js +2 -0
  23. package/es/v1/Animation/Animation.js +127 -0
  24. package/es/v1/AppContainer/AppContainer.js +137 -0
  25. package/es/v1/Avatar/Avatar.js +189 -0
  26. package/es/v1/AvatarTeam/AvatarTeam.js +70 -0
  27. package/es/v1/Button/Button.js +68 -0
  28. package/es/v1/Buttongroup/Buttongroup.js +31 -0
  29. package/es/v1/Card/Card.js +271 -0
  30. package/es/v1/CheckBox/CheckBox.js +155 -0
  31. package/es/v1/DateTime/CalendarView.js +218 -0
  32. package/es/v1/DateTime/DateTime.js +783 -0
  33. package/es/v1/DateTime/DateTimePopupFooter.js +47 -0
  34. package/es/v1/DateTime/DateTimePopupHeader.js +105 -0
  35. package/es/v1/DateTime/DateWidget.js +1098 -0
  36. package/es/v1/DateTime/DaysRow.js +31 -0
  37. package/es/v1/DateTime/Time.js +166 -0
  38. package/es/v1/DateTime/YearView.js +264 -0
  39. package/es/v1/DateTime/index.js +1 -0
  40. package/es/v1/DropBox/DropBox.js +91 -0
  41. package/es/v1/DropBox/DropBoxElement/DropBoxElement.js +132 -0
  42. package/es/v1/DropDown/DropDown.js +73 -0
  43. package/es/v1/DropDown/DropDownHeading.js +44 -0
  44. package/es/v1/DropDown/DropDownItem.js +76 -0
  45. package/es/v1/DropDown/DropDownSearch.js +63 -0
  46. package/es/v1/DropDown/DropDownSeparator.js +15 -0
  47. package/es/v1/Heading/Heading.js +32 -0
  48. package/es/v1/Label/Label.js +40 -0
  49. package/es/v1/Layout/Box.js +115 -0
  50. package/es/v1/Layout/Container.js +132 -0
  51. package/es/v1/Layout/index.js +2 -0
  52. package/es/v1/ListItem/ListContainer.js +102 -0
  53. package/es/v1/ListItem/ListItem.js +124 -0
  54. package/es/v1/ListItem/ListItemWithAvatar.js +145 -0
  55. package/es/v1/ListItem/ListItemWithCheckBox.js +104 -0
  56. package/es/v1/ListItem/ListItemWithIcon.js +127 -0
  57. package/es/v1/ListItem/ListItemWithRadio.js +105 -0
  58. package/es/v1/ListItem/index.js +6 -0
  59. package/es/v1/Modal/Modal.js +154 -0
  60. package/es/v1/MultiSelect/AdvancedGroupMultiSelect.js +1079 -0
  61. package/es/v1/MultiSelect/AdvancedMultiSelect.js +568 -0
  62. package/es/v1/MultiSelect/EmptyState.js +64 -0
  63. package/es/v1/MultiSelect/MobileHeader/MobileHeader.js +50 -0
  64. package/es/v1/MultiSelect/MultiSelect.js +1120 -0
  65. package/es/v1/MultiSelect/MultiSelectHeader.js +32 -0
  66. package/es/v1/MultiSelect/MultiSelectWithAvatar.js +216 -0
  67. package/es/v1/MultiSelect/SelectedOptions.js +82 -0
  68. package/es/v1/MultiSelect/Suggestions.js +142 -0
  69. package/es/v1/MultiSelect/index.js +4 -0
  70. package/es/v1/PopOver/PopOver.js +211 -0
  71. package/es/v1/Popup/Popup.js +645 -0
  72. package/es/v1/Radio/Radio.js +115 -0
  73. package/es/v1/Responsive/CustomResponsive.js +195 -0
  74. package/es/v1/Responsive/RefWrapper.js +39 -0
  75. package/es/v1/Responsive/ResizeComponent.js +197 -0
  76. package/es/v1/Responsive/ResizeObserver.js +140 -0
  77. package/es/v1/Responsive/Responsive.js +194 -0
  78. package/es/v1/Responsive/index.js +9 -0
  79. package/es/v1/ResponsiveDropBox/ResponsiveDropBox.js +58 -0
  80. package/es/v1/Ribbon/Ribbon.js +33 -0
  81. package/es/v1/RippleEffect/RippleEffect.js +24 -0
  82. package/es/v1/Select/GroupSelect.js +803 -0
  83. package/es/v1/Select/Select.js +969 -0
  84. package/es/v1/Select/SelectWithAvatar.js +344 -0
  85. package/es/v1/Select/SelectWithIcon.js +535 -0
  86. package/es/v1/Select/index.js +4 -0
  87. package/es/v1/Stencils/Stencils.js +26 -0
  88. package/es/v1/Switch/Switch.js +94 -0
  89. package/es/v1/Tab/Tab.js +108 -0
  90. package/es/v1/Tab/TabContent.js +30 -0
  91. package/es/v1/Tab/TabContentWrapper.js +29 -0
  92. package/es/v1/Tab/TabWrapper.js +57 -0
  93. package/es/v1/Tab/Tabs.js +612 -0
  94. package/es/v1/Tab/index.js +5 -0
  95. package/es/v1/Tag/Tag.js +134 -0
  96. package/es/v1/TextBox/TextBox.js +154 -0
  97. package/es/v1/TextBoxIcon/TextBoxIcon.js +158 -0
  98. package/es/v1/Textarea/Textarea.js +102 -0
  99. package/es/v1/Tooltip/Tooltip.js +518 -0
  100. package/es/v1/Typography/Typography.js +38 -0
  101. package/es/v1/Typography/css/Typography.module.css +376 -0
  102. package/es/v1/Typography/css/cssJSLogic.js +46 -0
  103. package/es/v1/Typography/css/letterSpacingMap.js +12 -0
  104. package/es/v1/Typography/props/defaultProps.js +8 -0
  105. package/es/v1/Typography/props/propTypes.js +24 -0
  106. package/es/v1/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +69 -0
  107. package/es/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +100 -0
  108. package/es/v1/semantic/Button/Button.js +53 -0
  109. package/es/v1/semantic/index.js +1 -0
  110. package/lib/AppContainer/AppContainer.js +5 -0
  111. package/lib/v1/Accordion/Accordion.js +96 -0
  112. package/lib/v1/Accordion/AccordionItem.js +68 -0
  113. package/lib/v1/Accordion/index.js +23 -0
  114. package/lib/v1/Animation/Animation.js +143 -0
  115. package/lib/v1/AppContainer/AppContainer.js +209 -0
  116. package/lib/v1/Avatar/Avatar.js +246 -0
  117. package/lib/v1/AvatarTeam/AvatarTeam.js +81 -0
  118. package/lib/v1/Button/Button.js +82 -0
  119. package/lib/v1/Buttongroup/Buttongroup.js +44 -0
  120. package/lib/v1/Card/Card.js +365 -0
  121. package/lib/v1/CheckBox/CheckBox.js +166 -0
  122. package/lib/v1/DateTime/CalendarView.js +285 -0
  123. package/lib/v1/DateTime/DateTime.js +872 -0
  124. package/lib/v1/DateTime/DateTimePopupFooter.js +96 -0
  125. package/lib/v1/DateTime/DateTimePopupHeader.js +166 -0
  126. package/lib/v1/DateTime/DateWidget.js +1125 -0
  127. package/lib/v1/DateTime/DaysRow.js +80 -0
  128. package/lib/v1/DateTime/Time.js +254 -0
  129. package/lib/v1/DateTime/YearView.js +325 -0
  130. package/lib/v1/DateTime/index.js +15 -0
  131. package/lib/v1/DropBox/DropBox.js +119 -0
  132. package/lib/v1/DropBox/DropBoxElement/DropBoxElement.js +145 -0
  133. package/lib/v1/DropDown/DropDown.js +170 -0
  134. package/lib/v1/DropDown/DropDownHeading.js +93 -0
  135. package/lib/v1/DropDown/DropDownItem.js +127 -0
  136. package/lib/v1/DropDown/DropDownSearch.js +113 -0
  137. package/lib/v1/DropDown/DropDownSeparator.js +64 -0
  138. package/lib/v1/Heading/Heading.js +49 -0
  139. package/lib/v1/Label/Label.js +51 -0
  140. package/lib/v1/Layout/Box.js +128 -0
  141. package/lib/v1/Layout/Container.js +145 -0
  142. package/lib/v1/Layout/index.js +23 -0
  143. package/lib/v1/ListItem/ListContainer.js +120 -0
  144. package/lib/v1/ListItem/ListItem.js +138 -0
  145. package/lib/v1/ListItem/ListItemWithAvatar.js +162 -0
  146. package/lib/v1/ListItem/ListItemWithCheckBox.js +125 -0
  147. package/lib/v1/ListItem/ListItemWithIcon.js +143 -0
  148. package/lib/v1/ListItem/ListItemWithRadio.js +126 -0
  149. package/lib/v1/ListItem/index.js +55 -0
  150. package/lib/v1/Modal/Modal.js +212 -0
  151. package/lib/v1/MultiSelect/AdvancedGroupMultiSelect.js +1167 -0
  152. package/lib/v1/MultiSelect/AdvancedMultiSelect.js +634 -0
  153. package/lib/v1/MultiSelect/EmptyState.js +112 -0
  154. package/lib/v1/MultiSelect/MobileHeader/MobileHeader.js +62 -0
  155. package/lib/v1/MultiSelect/MultiSelect.js +1201 -0
  156. package/lib/v1/MultiSelect/MultiSelectHeader.js +78 -0
  157. package/lib/v1/MultiSelect/MultiSelectWithAvatar.js +270 -0
  158. package/lib/v1/MultiSelect/SelectedOptions.js +126 -0
  159. package/lib/v1/MultiSelect/Suggestions.js +195 -0
  160. package/lib/v1/MultiSelect/index.js +39 -0
  161. package/lib/v1/PopOver/PopOver.js +293 -0
  162. package/lib/v1/Popup/Popup.js +715 -0
  163. package/lib/v1/Radio/Radio.js +126 -0
  164. package/lib/v1/Responsive/CustomResponsive.js +242 -0
  165. package/lib/v1/Responsive/RefWrapper.js +57 -0
  166. package/lib/v1/Responsive/ResizeComponent.js +268 -0
  167. package/lib/v1/Responsive/ResizeObserver.js +168 -0
  168. package/lib/v1/Responsive/Responsive.js +274 -0
  169. package/lib/v1/Responsive/index.js +55 -0
  170. package/lib/v1/ResponsiveDropBox/ResponsiveDropBox.js +79 -0
  171. package/lib/v1/Ribbon/Ribbon.js +44 -0
  172. package/lib/v1/RippleEffect/RippleEffect.js +39 -0
  173. package/lib/v1/Select/GroupSelect.js +877 -0
  174. package/lib/v1/Select/Select.js +1013 -0
  175. package/lib/v1/Select/SelectWithAvatar.js +394 -0
  176. package/lib/v1/Select/SelectWithIcon.js +597 -0
  177. package/lib/v1/Select/index.js +39 -0
  178. package/lib/v1/Stencils/Stencils.js +43 -0
  179. package/lib/v1/Switch/Switch.js +108 -0
  180. package/lib/v1/Tab/Tab.js +132 -0
  181. package/lib/v1/Tab/TabContent.js +42 -0
  182. package/lib/v1/Tab/TabContentWrapper.js +42 -0
  183. package/lib/v1/Tab/TabWrapper.js +89 -0
  184. package/lib/v1/Tab/Tabs.js +680 -0
  185. package/lib/v1/Tab/index.js +47 -0
  186. package/lib/v1/Tag/Tag.js +154 -0
  187. package/lib/v1/TextBox/TextBox.js +168 -0
  188. package/lib/v1/TextBoxIcon/TextBoxIcon.js +196 -0
  189. package/lib/v1/Textarea/Textarea.js +118 -0
  190. package/lib/v1/Tooltip/Tooltip.js +586 -0
  191. package/lib/v1/Typography/Typography.js +56 -0
  192. package/lib/v1/Typography/css/Typography.module.css +376 -0
  193. package/lib/v1/Typography/css/cssJSLogic.js +41 -0
  194. package/lib/v1/Typography/css/letterSpacingMap.js +20 -0
  195. package/lib/v1/Typography/props/defaultProps.js +15 -0
  196. package/lib/v1/Typography/props/propTypes.js +35 -0
  197. package/lib/v1/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +90 -0
  198. package/lib/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +126 -0
  199. package/lib/v1/semantic/Button/Button.js +63 -0
  200. package/lib/v1/semantic/index.js +15 -0
  201. package/package.json +1 -1
  202. package/result.json +1 -1
@@ -0,0 +1,1098 @@
1
+ /**** Libraries ****/
2
+ import React from 'react';
3
+ import { DateWidget_propTypes } from '../../DateTime/props/propTypes';
4
+ import { DateWidget_defaultProps } from '../../DateTime/props/defaultProps';
5
+ import datetime from '@zohodesk/datetimejs';
6
+ /**** Components ****/
7
+
8
+ import DateTime from './DateTime';
9
+ import Popup from '../Popup/Popup';
10
+ import { Icon } from '@zohodesk/icons';
11
+ import { Container } from '../Layout';
12
+ import TextBoxIcon from '../TextBoxIcon/TextBoxIcon';
13
+ /**** CSS ****/
14
+
15
+ import style from '../../DateTime/DateWidget.module.css';
16
+ /**** Methods ****/
17
+
18
+ import validator from '../../DateTime/validator';
19
+ import { formatDate } from '../../utils/datetime/common';
20
+ import { getIsSupportedKey, arrayIsNotEqual } from '../../DateTime/dateFormatUtils';
21
+ import { getDateFormatDetails, getDateFormatSelection, getDateTimeString, getDateDetails, getIsValidDate, getSelectedDate } from '../../DateTime/dateFormatUtils/dateFormat';
22
+ import { getChangedDay } from '../../DateTime/dateFormatUtils/dayChange';
23
+ import { getChangedMonth } from '../../DateTime/dateFormatUtils/monthChange';
24
+ import { getChangedYear } from '../../DateTime/dateFormatUtils/yearChange';
25
+ import { getChangedHour, getChangedMinute, getChangedNoon } from '../../DateTime/dateFormatUtils/timeChange';
26
+ import { getIsEmptyValue } from '../../utils/Common';
27
+ /** * Constants ** */
28
+
29
+ import { INVALID_DATE, i18nShortMonths, i18nMonths } from '../../DateTime/constants';
30
+ /* eslint-disable react/no-unused-prop-types */
31
+
32
+ /* eslint css-modules/no-unused-class: [0, { markAsUsed: 'inputLine'] }] */
33
+
34
+ class DateWidgetComponent extends React.Component {
35
+ constructor(props) {
36
+ super(props);
37
+ this.handleSelect = this.handleSelect.bind(this);
38
+ this.handleTogglePopup = this.handleTogglePopup.bind(this);
39
+ this.handleGetDisplayText = this.handleGetDisplayText.bind(this);
40
+ this.handleKeyDown = this.handleKeyDown.bind(this);
41
+ this.handleFocus = this.handleFocus.bind(this);
42
+ this.getValueInputRef = this.getValueInputRef.bind(this);
43
+ this.handleGetMethods = this.handleGetMethods.bind(this);
44
+ this.handleInputClick = this.handleInputClick.bind(this);
45
+ this.handleGetShowValue = this.handleGetShowValue.bind(this);
46
+ this.handleSelection = this.handleSelection.bind(this);
47
+ this.handleDateType = this.handleDateType.bind(this);
48
+ this.handleBlur = this.handleBlur.bind(this);
49
+ this.handleGetAllowedType = this.handleGetAllowedType.bind(this);
50
+ this.handleDateClear = this.handleDateClear.bind(this);
51
+ this.handleDateTimeClear = this.handleDateTimeClear.bind(this);
52
+ this.handleMouseDown = this.handleMouseDown.bind(this);
53
+ this.handleDateIconClick = this.handleDateIconClick.bind(this);
54
+ this.handleSelectionRangeDetails = this.handleSelectionRangeDetails.bind(this);
55
+ this.handleBlurSelectionRange = this.handleBlurSelectionRange.bind(this);
56
+ this.state = {
57
+ selected: '',
58
+ displayText: '',
59
+ dateFormatDetails: {},
60
+ dateFormatSelection: {},
61
+ day: '',
62
+ month: '',
63
+ year: '',
64
+ hour: '',
65
+ minute: '',
66
+ noon: '',
67
+ isDateEdited: false,
68
+ stateFocusOrder: '',
69
+ isError: false,
70
+ isFocused: false
71
+ };
72
+ this.oldFocusOrder = '';
73
+ this.focusOrder = '';
74
+ this.oldKeyDownAction = ''; //'Arrow' || 'valueTyped'
75
+
76
+ this.keyDownAction = ''; //'Arrow' || 'valueTyped'
77
+
78
+ this.isMouseDown = false;
79
+ }
80
+
81
+ componentDidMount() {
82
+ const {
83
+ validation
84
+ } = this.props;
85
+ const {
86
+ selected
87
+ } = this.state;
88
+
89
+ if (validation && validation.validate) {
90
+ this.validateOnSelect(selected, this.props);
91
+ }
92
+
93
+ const {
94
+ displayText,
95
+ selected: newSelected
96
+ } = this.handleGetDisplayText(this.props);
97
+ this.setState({
98
+ displayText,
99
+ selected: newSelected
100
+ });
101
+ this.handleSelectionRangeDetails(this.props);
102
+ }
103
+
104
+ componentDidUpdate(prevProps, prevState) {
105
+ const {
106
+ selected,
107
+ day,
108
+ month,
109
+ year,
110
+ hour,
111
+ minute,
112
+ noon,
113
+ isDateEdited,
114
+ stateFocusOrder,
115
+ isFocused
116
+ } = this.state;
117
+ const {
118
+ value,
119
+ validation,
120
+ isPopupReady,
121
+ dateFormat = '',
122
+ is24Hour,
123
+ isHideCurrentYear
124
+ } = this.props;
125
+
126
+ if (validation && validation.validate) {
127
+ this.validateOnSelect(selected, this.props);
128
+ }
129
+
130
+ if (value !== prevProps.value || dateFormat !== prevProps.dateFormat || is24Hour !== prevProps.is24Hour || isHideCurrentYear !== prevProps.isHideCurrentYear) {
131
+ const {
132
+ displayText,
133
+ selected
134
+ } = this.handleGetDisplayText(this.props);
135
+ this.setState({
136
+ selected,
137
+ displayText
138
+ });
139
+
140
+ if (value !== INVALID_DATE) {
141
+ this.setState({
142
+ day: '',
143
+ month: '',
144
+ year: '',
145
+ hour: '',
146
+ minute: '',
147
+ noon: '',
148
+ isDateEdited: false,
149
+ isError: false
150
+ });
151
+ }
152
+ }
153
+
154
+ if (prevProps.isPopupReady !== isPopupReady) {
155
+ if (isPopupReady) {
156
+ this.resetLocalDate && this.resetLocalDate();
157
+ }
158
+ }
159
+
160
+ const haveLocalValue = [day, month, year, hour, minute, noon].some(value => !getIsEmptyValue(value));
161
+
162
+ if (isDateEdited !== haveLocalValue) {
163
+ this.setState({
164
+ isDateEdited: haveLocalValue
165
+ });
166
+ }
167
+
168
+ if (value !== prevProps.value || dateFormat !== prevProps.dateFormat || is24Hour !== prevProps.is24Hour || arrayIsNotEqual([day, month, year, hour, minute, noon], [prevState.day, prevState.month, prevState.year, prevState.hour, prevState.minute, prevState.noon])) {
169
+ this.handleSelectionRangeDetails(this.props);
170
+ } // if (stateFocusOrder !== prevState.stateFocusOrder) {
171
+
172
+
173
+ isFocused && !getIsEmptyValue(stateFocusOrder) && this.handleSelection(stateFocusOrder);
174
+ this.handleBlurSelectionRange(stateFocusOrder, prevState.stateFocusOrder); // }
175
+ // if (prevProps.isPopupOpen !== isPopupOpen) {
176
+ // if (!isPopupOpen) {
177
+ // this.valueInput && this.valueInput.focus({preventScroll:true});
178
+ // }
179
+ // }
180
+ }
181
+
182
+ handleSelect(userZoneSelectedTime, fotmattedValue, e) {
183
+ const {
184
+ id,
185
+ onSelect,
186
+ closePopupOnly,
187
+ validation
188
+ } = this.props;
189
+
190
+ if (validation && validation.validateOn) {
191
+ const {
192
+ selected
193
+ } = this.state;
194
+ this.validateOnSelect(selected, this.props);
195
+ }
196
+
197
+ onSelect && onSelect(userZoneSelectedTime, id);
198
+ this.valueInput && this.valueInput.focus({
199
+ preventScroll: true
200
+ });
201
+ closePopupOnly(e);
202
+ }
203
+
204
+ validateOnSelect(value, props) {
205
+ const defaultCheckPropsRules = ['required'];
206
+ const defaultValidateRules = ['required'];
207
+ const defaultType = 'onegroup';
208
+ const {
209
+ validation,
210
+ onPassValidation,
211
+ onFailValidation
212
+ } = props;
213
+ const targetTag = this.elementRef;
214
+
215
+ if (validation) {
216
+ //validateOn won't work here ...
217
+ const newValidation = validator.combinePropsValidation(this.props, defaultType, 'onSelect', validation, defaultCheckPropsRules, defaultValidateRules);
218
+ const validationObj = {
219
+ validation: newValidation,
220
+ onPassValidation,
221
+ onFailValidation
222
+ };
223
+ validator.executeValidation(value, targetTag, validationObj, defaultType);
224
+ } else {
225
+ onPassValidation && onPassValidation(value, targetTag);
226
+ }
227
+ }
228
+
229
+ handleTogglePopup(e, isOpenOnly) {
230
+ const {
231
+ togglePopup,
232
+ defaultPosition = 'bottom',
233
+ isPopupOpen,
234
+ removeClose
235
+ } = this.props;
236
+
237
+ if (isOpenOnly) {
238
+ if (!isPopupOpen) {
239
+ togglePopup(e, `${defaultPosition}Right`);
240
+ } else {
241
+ removeClose(e);
242
+ }
243
+ }
244
+
245
+ !isOpenOnly && togglePopup(e, `${defaultPosition}Right`);
246
+ }
247
+
248
+ handleSelectionRangeDetails(props) {
249
+ const {
250
+ timeZone,
251
+ dateFormat,
252
+ isDateTime,
253
+ value,
254
+ is24Hour
255
+ } = props;
256
+ const {
257
+ day,
258
+ month,
259
+ year,
260
+ hour,
261
+ minute,
262
+ noon
263
+ } = this.state;
264
+ const selected = value === INVALID_DATE ? '' : value; //New UI Changes
265
+
266
+ const dateFormatDetails = getDateFormatDetails(dateFormat, {
267
+ isHideCurrentYear: false,
268
+ value,
269
+ timeZone,
270
+ isDateTime
271
+ });
272
+ const dateFormatSelection = getDateFormatSelection(dateFormatDetails, isDateTime, {
273
+ i18nShortMonths,
274
+ i18nMonths,
275
+ selectedValue: selected,
276
+ day,
277
+ month,
278
+ year,
279
+ hour,
280
+ minute,
281
+ noon,
282
+ timeZone,
283
+ is24Hour
284
+ });
285
+ const {
286
+ dateFormat: newDateFormat
287
+ } = dateFormatDetails;
288
+ this.setState({
289
+ dateFormatDetails,
290
+ dateFormatSelection,
291
+ newDateFormat
292
+ });
293
+ }
294
+
295
+ handleGetDisplayText(props) {
296
+ const {
297
+ timeZone,
298
+ dateFormat,
299
+ isDateTime,
300
+ value,
301
+ is24Hour,
302
+ isHideCurrentYear
303
+ } = props;
304
+ const dateFormatDetails = getDateFormatDetails(dateFormat, {
305
+ isHideCurrentYear,
306
+ value,
307
+ timeZone,
308
+ isDateTime
309
+ });
310
+ const {
311
+ dateFormat: newDateFormat
312
+ } = dateFormatDetails;
313
+ let displayText = '';
314
+ const selected = value === INVALID_DATE ? '' : value;
315
+
316
+ if (selected) {
317
+ let format = newDateFormat,
318
+ convertedValue;
319
+
320
+ if (isDateTime) {
321
+ convertedValue = datetime.toDate(datetime.tz.utcToTz(value, timeZone));
322
+ format = `${newDateFormat} ${is24Hour ? 'HH:mm' : 'hh:mm A'}`;
323
+ } else {
324
+ convertedValue = datetime.toDate(value);
325
+ }
326
+
327
+ displayText = formatDate(convertedValue, format);
328
+ }
329
+
330
+ return {
331
+ displayText,
332
+ selected
333
+ };
334
+ }
335
+
336
+ handleKeyDown(e) {
337
+ const {
338
+ keyCode
339
+ } = e;
340
+ const {
341
+ isPopupOpen,
342
+ isPopupOpenOnEnter,
343
+ onKeyDown,
344
+ closePopupOnly,
345
+ cantEditOnPopupOpen
346
+ } = this.props;
347
+ const isAllowedDateType = this.handleGetAllowedType();
348
+
349
+ if (isPopupOpen) {
350
+ if (keyCode === 9 && !isAllowedDateType) {
351
+ //on tab click popup close
352
+ closePopupOnly(e);
353
+ } // ~~~~~~~ handle date navigation in dateTime popup ~~~~~
354
+
355
+
356
+ if (isAllowedDateType) {
357
+ cantEditOnPopupOpen && this.handleDateType(e);
358
+ }
359
+ } else if (!isPopupOpen) {
360
+ if (isPopupOpenOnEnter && keyCode === 13) {
361
+ //onEnter popup open
362
+ this.handleTogglePopup(e);
363
+ } else if (keyCode === 13) {
364
+ //onEnter submit case
365
+ onKeyDown && onKeyDown(e);
366
+ } else if (isAllowedDateType) {
367
+ this.handleDateType(e);
368
+ }
369
+ }
370
+ }
371
+
372
+ getValueInputRef(el) {
373
+ const {
374
+ getRef
375
+ } = this.props;
376
+ this.valueInput = el;
377
+ getRef && getRef(el);
378
+ }
379
+
380
+ handleFocus() {
381
+ const isAllowedDateType = this.handleGetAllowedType();
382
+ const {
383
+ isMouseDown
384
+ } = this;
385
+
386
+ if (isAllowedDateType && !isMouseDown) {
387
+ const {
388
+ dateFormatSelection
389
+ } = this.state;
390
+ const {
391
+ focusedIndex
392
+ } = dateFormatSelection;
393
+ const {
394
+ selectionStart: newSelectionStart,
395
+ selectionEnd: newSelectionEnd
396
+ } = this.valueInput;
397
+ const focusedOrder = focusedIndex[`${newSelectionStart}_${newSelectionEnd}`] || 0;
398
+ isAllowedDateType && this.setState({
399
+ stateFocusOrder: focusedOrder,
400
+ isFocused: true
401
+ });
402
+ } else if (!isAllowedDateType) {
403
+ const {
404
+ valueInput
405
+ } = this;
406
+ document.getSelection().removeAllRanges();
407
+ valueInput && valueInput.setSelectionRange(0, 0);
408
+ this.setState({
409
+ isFocused: true
410
+ });
411
+ }
412
+
413
+ const {
414
+ onFocus
415
+ } = this.props;
416
+ onFocus && onFocus();
417
+ }
418
+
419
+ handleBlur() {
420
+ this.focusOrder = '';
421
+ this.oldFocusOrder = '';
422
+ this.oldKeyDownAction = '';
423
+ this.keyDownAction = '';
424
+ this.setState({
425
+ isFocused: false
426
+ }); // const { valueInput } = this;
427
+ // document.getSelection().removeAllRanges();
428
+ // valueInput && valueInput.setSelectionRange(0, 0);
429
+
430
+ const {
431
+ onBlur
432
+ } = this.props;
433
+ onBlur && onBlur();
434
+ }
435
+
436
+ handleGetMethods(methods) {
437
+ const {
438
+ getMethods
439
+ } = this.props;
440
+ const {
441
+ resetLocalDate,
442
+ getStateValues,
443
+ toggleYearView
444
+ } = methods;
445
+ this.resetLocalDate = resetLocalDate;
446
+ this.getDateTimeStateValues = getStateValues;
447
+ this.DateTimeYearViewToggle = toggleYearView;
448
+ getMethods && getMethods(methods);
449
+ }
450
+
451
+ handleDateType(e) {
452
+ const {
453
+ keyCode,
454
+ shiftKey
455
+ } = e;
456
+ const input = e.target;
457
+
458
+ if (getIsSupportedKey(e)) {
459
+ e.preventDefault();
460
+ }
461
+
462
+ const {
463
+ isDateTime,
464
+ timeZone,
465
+ value,
466
+ onSelect,
467
+ id,
468
+ min,
469
+ max,
470
+ minErrorText,
471
+ maxErrorText,
472
+ onError,
473
+ closePopupOnly,
474
+ is24Hour
475
+ } = this.props;
476
+ const {
477
+ dateFormatSelection,
478
+ day,
479
+ month,
480
+ year,
481
+ hour,
482
+ minute,
483
+ noon,
484
+ selected,
485
+ dateFormatDetails
486
+ } = this.state;
487
+ const {
488
+ focusedIndex,
489
+ order
490
+ } = dateFormatSelection;
491
+ const {
492
+ yearInfo
493
+ } = dateFormatDetails;
494
+ const {
495
+ day: selectedDay = '',
496
+ month: selectedMonth = '',
497
+ year: selectedYear = '',
498
+ hour: selectedHour = '',
499
+ minute: selectedMinute = '',
500
+ noon: selectedNoon = ''
501
+ } = getDateDetails(selected, {
502
+ day,
503
+ month,
504
+ year,
505
+ hour,
506
+ minute,
507
+ noon
508
+ }, isDateTime, timeZone, {
509
+ is24Hour
510
+ });
511
+ const {
512
+ selectionStart: newSelectionStart,
513
+ selectionEnd: newSelectionEnd
514
+ } = input;
515
+ const focusedOrder = focusedIndex[`${newSelectionStart}_${newSelectionEnd}`];
516
+ const {
517
+ type
518
+ } = order[focusedOrder] || {};
519
+ this.oldFocusOrder = this.focusOrder;
520
+ this.focusOrder = focusedOrder;
521
+
522
+ if (keyCode === 38 || keyCode === 40) {
523
+ //up arrow && down arrow
524
+ this.oldKeyDownAction = this.keyDownAction;
525
+ this.keyDownAction = 'Arrow';
526
+ } else {
527
+ this.oldKeyDownAction = this.keyDownAction;
528
+ this.keyDownAction = 'valueTyped';
529
+ }
530
+
531
+ const focusedOrders = {
532
+ focusOrder: this.focusOrder,
533
+ oldFocusOrder: this.oldFocusOrder
534
+ };
535
+ const keyActions = {
536
+ oldKeyAction: this.oldKeyDownAction,
537
+ keyAction: this.keyDownAction
538
+ };
539
+ let newDay = selectedDay,
540
+ newMonth = selectedMonth,
541
+ newYear = selectedYear,
542
+ newHour = selectedHour,
543
+ newMinute = selectedMinute,
544
+ newNoon = selectedNoon,
545
+ isValueChanged = false,
546
+ newFocusOrder = focusedOrder;
547
+
548
+ if (keyCode === 9 && shiftKey && !getIsEmptyValue(focusedOrder) && focusedOrder !== 0) {
549
+ e.preventDefault();
550
+ this.setState({
551
+ stateFocusOrder: focusedOrder - 1
552
+ });
553
+ } else if (keyCode === 9 && !shiftKey && !getIsEmptyValue(focusedOrder) && order.length - 1 !== focusedOrder) {
554
+ e.preventDefault();
555
+ this.setState({
556
+ stateFocusOrder: focusedOrder + 1
557
+ });
558
+ } else if (keyCode === 39) {
559
+ //arrow right
560
+ getIsEmptyValue(focusedOrder) ? this.setState({
561
+ stateFocusOrder: 0
562
+ }) : this.setState({
563
+ stateFocusOrder: focusedOrder + 1
564
+ });
565
+ } else if (keyCode === 37) {
566
+ //arrow left
567
+ getIsEmptyValue(focusedOrder) ? this.setState({
568
+ stateFocusOrder: order.length - 1
569
+ }) : this.setState({
570
+ stateFocusOrder: focusedOrder - 1
571
+ });
572
+ } else if (keyCode === 9) {
573
+ //on tab click popup close
574
+ closePopupOnly(e);
575
+ } else if (type === 'day') {
576
+ ({
577
+ day: newDay,
578
+ isChanged: isValueChanged,
579
+ focusOrder: newFocusOrder
580
+ } = getChangedDay({
581
+ day: selectedDay,
582
+ month: selectedMonth,
583
+ year: selectedYear
584
+ }, e, focusedOrders, keyActions));
585
+ } else if (type === 'month') {
586
+ ({
587
+ /*day: newDay,*/
588
+ month: newMonth,
589
+ isChanged: isValueChanged,
590
+ focusOrder: newFocusOrder
591
+ } = getChangedMonth({
592
+ day: selectedDay,
593
+ month: selectedMonth,
594
+ year: selectedYear
595
+ }, e, focusedOrders, keyActions));
596
+ } else if (type === 'year') {
597
+ ({
598
+ /*day: newDay,*/
599
+ year: newYear,
600
+ isChanged: isValueChanged,
601
+ focusOrder: newFocusOrder
602
+ } = getChangedYear({
603
+ day: selectedDay,
604
+ month: selectedMonth,
605
+ year: selectedYear
606
+ }, e, focusedOrders, keyActions, {
607
+ yearInfo
608
+ }));
609
+ } else if (type === 'hour') {
610
+ ({
611
+ hour: newHour,
612
+ isChanged: isValueChanged,
613
+ focusOrder: newFocusOrder
614
+ } = getChangedHour({
615
+ hour: selectedHour
616
+ }, e, focusedOrders, keyActions, {
617
+ is24Hour
618
+ }));
619
+ } else if (type === 'minute') {
620
+ ({
621
+ minute: newMinute,
622
+ isChanged: isValueChanged,
623
+ focusOrder: newFocusOrder
624
+ } = getChangedMinute({
625
+ minute: selectedMinute
626
+ }, e, focusedOrders, keyActions));
627
+ } else if (type === 'noon') {
628
+ ({
629
+ noon: newNoon,
630
+ isChanged: isValueChanged,
631
+ focusOrder: newFocusOrder
632
+ } = getChangedNoon({
633
+ noon: selectedNoon
634
+ }, e, focusedOrders, keyActions));
635
+ }
636
+
637
+ if (isValueChanged) {
638
+ const currentValue = {
639
+ day: newDay,
640
+ month: newMonth,
641
+ year: newYear,
642
+ hour: newHour,
643
+ minute: newMinute,
644
+ noon: newNoon
645
+ };
646
+
647
+ const errorCaseHandle = isEmptyValError => {
648
+ this.setState(() => ({
649
+ day: newDay,
650
+ month: newMonth,
651
+ year: newYear,
652
+ hour: newHour,
653
+ minute: newMinute,
654
+ noon: newNoon,
655
+ stateFocusOrder: newFocusOrder,
656
+ isDateEdited: true,
657
+ isError: !isEmptyValError
658
+ }));
659
+ const newSelected = isEmptyValError ? '' : INVALID_DATE;
660
+ value !== newSelected && onSelect && onSelect(newSelected, id);
661
+ };
662
+
663
+ const {
664
+ isError,
665
+ isEmptyValError
666
+ } = getIsValidDate(currentValue, isDateTime, {
667
+ is24Hour
668
+ });
669
+
670
+ if (isError) {
671
+ errorCaseHandle(isEmptyValError);
672
+ } else {
673
+ const {
674
+ selectedValue,
675
+ isError: selectedDateError,
676
+ errorType
677
+ } = getSelectedDate(currentValue, {
678
+ min,
679
+ max,
680
+ timeZone,
681
+ isDateTime,
682
+ is24Hour
683
+ });
684
+
685
+ if (selectedDateError) {
686
+ if (errorType === 'MIN') {
687
+ onError && onError(minErrorText, true);
688
+ } else if (errorType === 'MAX') {
689
+ onError && onError(maxErrorText, true);
690
+ }
691
+
692
+ errorCaseHandle();
693
+ } else {
694
+ this.setState(() => ({
695
+ day: '',
696
+ month: '',
697
+ year: '',
698
+ hour: '',
699
+ minute: '',
700
+ noon: '',
701
+ isDateEdited: false,
702
+ stateFocusOrder: newFocusOrder,
703
+ isError: false
704
+ }));
705
+ onSelect && onSelect(selectedValue, id);
706
+ }
707
+ }
708
+ }
709
+ }
710
+
711
+ handleSelection() {
712
+ let focusOrder = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
713
+ const isAllowedDateType = this.handleGetAllowedType();
714
+
715
+ if (isAllowedDateType) {
716
+ const {
717
+ dateFormatSelection
718
+ } = this.state;
719
+ const {
720
+ order = {}
721
+ } = dateFormatSelection;
722
+ let {
723
+ index
724
+ } = order[focusOrder] || {};
725
+
726
+ if (!index) {
727
+ focusOrder = 0;
728
+ ({
729
+ index
730
+ } = order[focusOrder] || {});
731
+ }
732
+
733
+ if (index && this.valueInput) {
734
+ document.getSelection().removeAllRanges();
735
+ this.valueInput.setSelectionRange(index[0], index[1]);
736
+ }
737
+ }
738
+ }
739
+
740
+ handleInputClick(e) {
741
+ this.isMouseDown = false;
742
+ const {
743
+ dateFormatSelection
744
+ } = this.state;
745
+ const input = e.target;
746
+ const {
747
+ selectionEnd
748
+ } = input;
749
+ e.preventDefault();
750
+ const {
751
+ clickIndex
752
+ } = dateFormatSelection;
753
+ const focusOrder = clickIndex[selectionEnd] || clickIndex[selectionEnd - 1] || 0;
754
+ const isAllowedDateType = this.handleGetAllowedType();
755
+
756
+ if (isAllowedDateType) {
757
+ this.setState({
758
+ stateFocusOrder: focusOrder,
759
+ isFocused: true
760
+ });
761
+ }
762
+
763
+ if (!isAllowedDateType) {
764
+ this.handleTogglePopup(e);
765
+ } else {
766
+ const {
767
+ isPopupOpenOnClick,
768
+ isReadOnly,
769
+ isDisabled
770
+ } = this.props;
771
+
772
+ if (isPopupOpenOnClick && (!isReadOnly || !isDisabled)) {
773
+ this.handleTogglePopup(e, true);
774
+ }
775
+
776
+ const {
777
+ isPopupCloseOnClick,
778
+ isPopupOpen,
779
+ closePopupOnly
780
+ } = this.props;
781
+
782
+ if (isPopupCloseOnClick && !isPopupOpen) {
783
+ closePopupOnly && closePopupOnly(e);
784
+ }
785
+ }
786
+ }
787
+
788
+ handleMouseDown() {
789
+ this.isMouseDown = true;
790
+ }
791
+
792
+ handleGetShowValue() {
793
+ const {
794
+ day,
795
+ month,
796
+ year,
797
+ hour,
798
+ minute,
799
+ noon,
800
+ dateFormatDetails,
801
+ displayText,
802
+ newDateFormat,
803
+ isDateEdited,
804
+ isFocused,
805
+ selected
806
+ } = this.state;
807
+ const {
808
+ isDateTime,
809
+ is24Hour,
810
+ isPopupReady,
811
+ timeZone,
812
+ isPopupOpen
813
+ } = this.props;
814
+
815
+ if (isDateEdited || isFocused || isPopupReady || isPopupOpen) {
816
+ const {
817
+ day: selectedDay = '',
818
+ month: selectedMonth = '',
819
+ year: selectedYear = '',
820
+ hour: selectedHour = '',
821
+ minute: selectedMinute = '',
822
+ noon: selectedNoon = ''
823
+ } = getDateDetails(selected, {
824
+ day,
825
+ month,
826
+ year,
827
+ hour,
828
+ minute,
829
+ noon
830
+ }, isDateTime, timeZone, {
831
+ is24Hour
832
+ });
833
+ const dateTimeString = getDateTimeString({
834
+ day: selectedDay,
835
+ month: selectedMonth,
836
+ year: selectedYear,
837
+ hour: selectedHour,
838
+ minute: selectedMinute,
839
+ noon: selectedNoon
840
+ }, dateFormatDetails, isDateTime, {
841
+ i18nShortMonths,
842
+ i18nMonths,
843
+ is24Hour
844
+ });
845
+ return dateTimeString;
846
+ } else if (displayText) {
847
+ return displayText;
848
+ }
849
+
850
+ const timeFormat = is24Hour ? ' HH:mm' : ' hh:mm --';
851
+ const dateTimeFormat = isDateTime ? `${newDateFormat}${timeFormat}` : newDateFormat;
852
+ return dateTimeFormat || '';
853
+ }
854
+
855
+ handleGetAllowedType() {
856
+ const {
857
+ isReadOnly,
858
+ isDisabled,
859
+ isEditable
860
+ } = this.props;
861
+
862
+ if (isEditable) {
863
+ if (isReadOnly || isDisabled) {
864
+ return false;
865
+ }
866
+
867
+ return true;
868
+ }
869
+
870
+ return false;
871
+ }
872
+
873
+ handleDateClear() {
874
+ const {
875
+ id,
876
+ onSelect,
877
+ value
878
+ } = this.props;
879
+ this.setState({
880
+ day: '',
881
+ month: '',
882
+ year: '',
883
+ hour: '',
884
+ minute: '',
885
+ noon: '',
886
+ isDateEdited: false,
887
+ stateFocusOrder: 0,
888
+ isError: false
889
+ });
890
+ value && onSelect && onSelect('', id); // this.valueInput && this.valueInput.focus({ preventScroll: true });
891
+ }
892
+
893
+ handleDateTimeClear(e) {
894
+ this.handleDateClear();
895
+ const {
896
+ closePopupOnly
897
+ } = this.props;
898
+ closePopupOnly(e);
899
+ }
900
+
901
+ handleDateIconClick(e) {
902
+ this.handleTogglePopup(e);
903
+ this.valueInput && this.valueInput.focus({
904
+ preventScroll: true
905
+ });
906
+ }
907
+
908
+ handleBlurSelectionRange() {
909
+ let focusOrder = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
910
+ let oldFocusOrder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
911
+ const isAllowedDateType = this.handleGetAllowedType();
912
+
913
+ if (isAllowedDateType) {
914
+ // if (focusOrder !== oldFocusOrder) {
915
+ const {
916
+ dateFormatSelection = {}
917
+ } = this.state;
918
+ const {
919
+ order = []
920
+ } = dateFormatSelection;
921
+ const {
922
+ isPopupOpen
923
+ } = this.props; // const { type: oldFocusedType = '' } = order[oldFocusOrder] || {};
924
+
925
+ const {
926
+ type: focusedType = ''
927
+ } = order[focusOrder] || {};
928
+ const {
929
+ /*isActive,*/
930
+ isYearView,
931
+ isMonthOpen: oldIsMonthOpen
932
+ } = this.getDateTimeStateValues();
933
+ const yearViewTypes = ['month', 'year'];
934
+ const isMonthOpen = focusedType === 'month';
935
+
936
+ if (isPopupOpen) {
937
+ if (yearViewTypes.indexOf(focusedType) >= 0 && (!isYearView || isMonthOpen !== oldIsMonthOpen)) {
938
+ this.DateTimeYearViewToggle(true, isMonthOpen);
939
+ } else if (yearViewTypes.indexOf(focusedType) === -1 && isYearView) {
940
+ this.DateTimeYearViewToggle(false, false);
941
+ }
942
+ } // }
943
+
944
+ }
945
+ }
946
+
947
+ render() {
948
+ const {
949
+ removeClose,
950
+ minErrorText,
951
+ maxErrorText,
952
+ min,
953
+ max,
954
+ placeholder,
955
+ isPopupOpen,
956
+ isPopupReady,
957
+ isDateTime,
958
+ position,
959
+ textBoxVariant,
960
+ textBoxSize,
961
+ children = null,
962
+ isDisabled,
963
+ getContainerRef,
964
+ getTargetRef,
965
+ timeZone,
966
+ isReadOnly,
967
+ dataId,
968
+ needResponsive,
969
+ className,
970
+ needBorder,
971
+ defaultTime,
972
+ needDefaultTime,
973
+ borderColor,
974
+ i18nKeys,
975
+ needErrorOnBlur,
976
+ htmlId,
977
+ iconOnHover,
978
+ is24Hour,
979
+ isAbsolutePositioningNeeded,
980
+ positionsOffset,
981
+ targetOffset,
982
+ isRestrictScroll,
983
+ dropBoxPortalId,
984
+ a11y,
985
+ boxSize,
986
+ onError
987
+ } = this.props;
988
+ const {
989
+ selected: value = '',
990
+ isError,
991
+ isDateEdited,
992
+ isFocused
993
+ } = this.state;
994
+ const showValue = this.handleGetShowValue();
995
+ const isAllowedDateType = this.handleGetAllowedType();
996
+ const showClear = !(isDisabled || isReadOnly) && (isDateEdited || value) ? true : false;
997
+ const showError = needErrorOnBlur ? isError && !isFocused && !isPopupOpen : isError;
998
+ return /*#__PURE__*/React.createElement("div", {
999
+ className: `${style.container}`
1000
+ }, children ? /*#__PURE__*/React.createElement("div", {
1001
+ "data-id": `${isDisabled ? `${dataId}_disabled` : isReadOnly ? `${dataId}_readOnly` : `${dataId}_widget`}`,
1002
+ "data-test-id": `${isDisabled ? `${dataId}_disabled` : isReadOnly ? `${dataId}_readOnly` : `${dataId}_widget`}`,
1003
+ onClick: isDisabled || isReadOnly ? null : this.handleTogglePopup,
1004
+ ref: getTargetRef,
1005
+ className: `${className ? className : ''} ${isDisabled ? style.disabled : style.enabled}`
1006
+ }, children) : /*#__PURE__*/React.createElement("div", {
1007
+ "data-id": `${isDisabled ? `${dataId}_disabled` : isReadOnly ? `${dataId}_readOnly` : `${dataId}_widget`}`,
1008
+ "data-test-id": `${isDisabled ? `${dataId}_disabled` : isReadOnly ? `${dataId}_readOnly` : `${dataId}_widget`}`,
1009
+ className: `${className ? className : ''} ${style.textBox} ${isPopupOpen && !isDisabled ? style.textBoxFocus : ''} ${isDisabled ? style.disabled : isReadOnly ? style.readOnly : style.enabled}`,
1010
+ onClick: !isAllowedDateType ? isDisabled || isReadOnly ? null : this.handleTogglePopup : null,
1011
+ ref: getTargetRef
1012
+ }, /*#__PURE__*/React.createElement(TextBoxIcon, {
1013
+ htmlId: htmlId,
1014
+ value: showValue ? showValue : placeholder,
1015
+ needBorder: needBorder,
1016
+ size: textBoxSize,
1017
+ variant: textBoxVariant,
1018
+ inputRef: this.getValueInputRef,
1019
+ isDisabled: isDisabled,
1020
+ dataId: dataId,
1021
+ needReadOnlyStyle: isReadOnly || isDisabled,
1022
+ onKeyDown: this.handleKeyDown,
1023
+ onFocus: this.handleFocus,
1024
+ borderColor: showError ? 'error' : borderColor,
1025
+ needEffect: !(isDisabled || isReadOnly || showError),
1026
+ isClickable: true,
1027
+ onClick: isDisabled || isReadOnly ? null : this.handleInputClick,
1028
+ onBlur: this.handleBlur,
1029
+ onClear: showClear ? this.handleDateClear : null,
1030
+ isReadOnly: isReadOnly,
1031
+ onMouseDown: this.handleMouseDown,
1032
+ showClearIcon: showClear,
1033
+ customClass: {
1034
+ customTBoxWrap: isDateEdited || value ? '' : style.placeHolder
1035
+ },
1036
+ iconOnHover: iconOnHover,
1037
+ isFocus: isPopupReady,
1038
+ autoComplete: false,
1039
+ a11y: a11y
1040
+ }, /*#__PURE__*/React.createElement(Container, {
1041
+ align: "both",
1042
+ onClick: isDisabled || isReadOnly ? null : this.handleDateIconClick
1043
+ }, /*#__PURE__*/React.createElement(Icon, {
1044
+ name: "ZD-datepicker",
1045
+ size: "12"
1046
+ })))), isReadOnly || isDisabled ? null : /*#__PURE__*/React.createElement(DateTime, {
1047
+ value: value,
1048
+ isDateTimeField: isDateTime,
1049
+ onSelect: this.handleSelect,
1050
+ timeZone: timeZone,
1051
+ min: min,
1052
+ max: max,
1053
+ maxErrorText: maxErrorText,
1054
+ minErrorText: minErrorText,
1055
+ position: position,
1056
+ isReady: isPopupOpen,
1057
+ isActive: isPopupReady,
1058
+ getRef: getContainerRef,
1059
+ onClick: removeClose,
1060
+ needResponsive: needResponsive,
1061
+ dataId: dataId,
1062
+ defaultTime: defaultTime,
1063
+ needDefaultTime: needDefaultTime,
1064
+ getMethods: this.handleGetMethods,
1065
+ onClear: this.handleDateTimeClear,
1066
+ needAction: isDateTime,
1067
+ onDateSelect: !isDateTime ? this.handleSelect : null,
1068
+ i18nKeys: i18nKeys,
1069
+ is24Hour: is24Hour,
1070
+ isAbsolute: isAbsolutePositioningNeeded,
1071
+ positionsOffset: positionsOffset,
1072
+ targetOffset: targetOffset,
1073
+ isRestrictScroll: isRestrictScroll,
1074
+ dropBoxPortalId: dropBoxPortalId,
1075
+ boxSize: boxSize,
1076
+ onError: onError
1077
+ }));
1078
+ }
1079
+
1080
+ }
1081
+
1082
+ DateWidgetComponent.defaultProps = DateWidget_defaultProps;
1083
+ DateWidgetComponent.propTypes = DateWidget_propTypes;
1084
+ const DateWidget = Popup(DateWidgetComponent);
1085
+ DateWidget.defaultProps = DateWidgetComponent.defaultProps;
1086
+ DateWidget.propTypes = DateWidgetComponent.propTypes; // eslint-disable-next-line no-undef
1087
+ // if (__DOCS__) {
1088
+ // DateWidgetComponent.docs = {
1089
+ // componentGroup: 'Form Elements',
1090
+ // folderName: 'Style Guide',
1091
+ // external: true,
1092
+ // description: ' '
1093
+ // };
1094
+ // // eslint-disable-next-line react/forbid-foreign-prop-types
1095
+ // DateWidget.propTypes = DateWidgetComponent.propTypes;
1096
+ // }
1097
+
1098
+ export default DateWidget;