diginet-core-ui 1.3.78 → 1.3.79

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 (209) hide show
  1. package/components/accordion/details.js +2 -6
  2. package/components/accordion/group.js +2 -9
  3. package/components/accordion/index.js +2 -15
  4. package/components/accordion/summary.js +4 -27
  5. package/components/alert/index.js +98 -137
  6. package/components/alert/notify.js +97 -166
  7. package/components/avatar/index.js +4 -63
  8. package/components/badge/index.js +7 -34
  9. package/components/button/icon.js +120 -186
  10. package/components/button/index.js +136 -205
  11. package/components/button/more.js +0 -12
  12. package/components/button/ripple-effect.js +46 -44
  13. package/components/card/body.js +2 -7
  14. package/components/card/extra.js +2 -7
  15. package/components/card/footer.js +2 -7
  16. package/components/card/header.js +2 -7
  17. package/components/card/index.js +2 -22
  18. package/components/chart/Pie/Circle.js +0 -1
  19. package/components/chart/Pie/Sector.js +0 -17
  20. package/components/chart/Pie/Sectors.js +0 -10
  21. package/components/chart/Pie/index.js +4 -36
  22. package/components/chart/Pie-v2/Circle.js +0 -1
  23. package/components/chart/Pie-v2/Sector.js +0 -13
  24. package/components/chart/Pie-v2/Sectors.js +0 -20
  25. package/components/chart/Pie-v2/index.js +11 -38
  26. package/components/chart/bar/Axis.js +0 -12
  27. package/components/chart/bar/Bar.js +13 -35
  28. package/components/chart/bar/Grid.js +0 -18
  29. package/components/chart/bar/Labels.js +0 -18
  30. package/components/chart/bar/Points.js +0 -17
  31. package/components/chart/bar/index.js +6 -26
  32. package/components/chart/bar-v2/Axis.js +0 -12
  33. package/components/chart/bar-v2/Bar.js +15 -36
  34. package/components/chart/bar-v2/Grid.js +0 -18
  35. package/components/chart/bar-v2/Labels.js +0 -18
  36. package/components/chart/bar-v2/Points.js +0 -17
  37. package/components/chart/bar-v2/index.js +6 -26
  38. package/components/chart/line/Axis.js +4 -16
  39. package/components/chart/line/Grid.js +2 -19
  40. package/components/chart/line/Labels.js +0 -18
  41. package/components/chart/line/Path.js +23 -33
  42. package/components/chart/line/Point.js +6 -40
  43. package/components/chart/line/Title.js +0 -3
  44. package/components/chart/line/index.js +12 -35
  45. package/components/chart/line-v2/Axis.js +0 -13
  46. package/components/chart/line-v2/Grid.js +0 -18
  47. package/components/chart/line-v2/Labels.js +0 -18
  48. package/components/chart/line-v2/Path.js +23 -33
  49. package/components/chart/line-v2/Point.js +6 -35
  50. package/components/chart/line-v2/Title.js +0 -3
  51. package/components/chart/line-v2/index.js +12 -30
  52. package/components/check-text/index.js +0 -8
  53. package/components/check-text/interview-confirmation.js +0 -7
  54. package/components/check-text/interview-status.js +0 -7
  55. package/components/chip/attach.js +4 -17
  56. package/components/chip/index.js +6 -33
  57. package/components/collapse/index.js +0 -13
  58. package/components/divider/index.js +0 -8
  59. package/components/form-control/attachment/index.js +24 -202
  60. package/components/form-control/calendar/function.js +40 -94
  61. package/components/form-control/calendar/index.js +5 -30
  62. package/components/form-control/calendar/range.js +11 -28
  63. package/components/form-control/checkbox/index.js +4 -37
  64. package/components/form-control/control/index.js +3 -13
  65. package/components/form-control/date-picker/index-old.js +18 -0
  66. package/components/form-control/date-picker/index.js +23 -99
  67. package/components/form-control/date-range-picker/index.js +86 -221
  68. package/components/form-control/dropdown/index.js +72 -289
  69. package/components/form-control/dropdown-box/index.js +6 -35
  70. package/components/form-control/form/index.js +0 -2
  71. package/components/form-control/form-group/index.js +1 -6
  72. package/components/form-control/helper-text/index.js +2 -9
  73. package/components/form-control/input-base/index.js +218 -399
  74. package/components/form-control/label/index.js +2 -12
  75. package/components/form-control/money-input/index.js +43 -132
  76. package/components/form-control/number-input/index.js +15 -113
  77. package/components/form-control/number-input/index2.js +78 -119
  78. package/components/form-control/phone-input/index.js +16 -78
  79. package/components/form-control/radio/index.js +4 -23
  80. package/components/form-control/text-input/index.js +33 -256
  81. package/components/form-control/time-picker/index.js +14 -71
  82. package/components/form-control/time-picker/swiper.js +21 -73
  83. package/components/form-control/toggle/index.js +4 -19
  84. package/components/form-view/helper-text.js +2 -2
  85. package/components/form-view/index.js +0 -14
  86. package/components/form-view/input.js +2 -13
  87. package/components/form-view/label.js +0 -2
  88. package/components/grid/Col.js +2 -15
  89. package/components/grid/Container.js +2 -21
  90. package/components/grid/Row.js +2 -21
  91. package/components/grid/index.js +2 -43
  92. package/components/image/index.js +2 -22
  93. package/components/index.js +62 -31
  94. package/components/list/list-item-action.js +0 -9
  95. package/components/list/list-item-icon.js +0 -9
  96. package/components/list/list-item-text.js +0 -5
  97. package/components/list/list-item.js +0 -11
  98. package/components/list/list.js +0 -13
  99. package/components/list/sub-header.js +0 -4
  100. package/components/modal/body.js +2 -6
  101. package/components/modal/footer.js +2 -11
  102. package/components/modal/header.js +2 -12
  103. package/components/modal/index.js +2 -10
  104. package/components/modal/modal.js +11 -52
  105. package/components/others/extra/index.js +3 -10
  106. package/components/others/import/index.js +0 -7
  107. package/components/others/option-wrapper/index.js +4 -7
  108. package/components/others/scrollbar/index.js +0 -3
  109. package/components/paging/page-info.js +39 -101
  110. package/components/paging/page-selector.js +7 -35
  111. package/components/paging/page-selector2.js +35 -74
  112. package/components/paper/index.js +0 -11
  113. package/components/popover/body.js +2 -6
  114. package/components/popover/footer.js +2 -11
  115. package/components/popover/header.js +2 -7
  116. package/components/popover/index.js +39 -123
  117. package/components/popup/danger_popup.js +0 -19
  118. package/components/popup/index.js +2 -48
  119. package/components/popup/proposals_popup.js +10 -49
  120. package/components/popup/v2/index.js +0 -31
  121. package/components/progress/circular.js +19 -81
  122. package/components/progress/linear.js +4 -20
  123. package/components/rating/index.js +0 -24
  124. package/components/slider/slider-container.js +3 -40
  125. package/components/slider/slider-item.js +10 -25
  126. package/components/status/index.js +2 -16
  127. package/components/tab/tab-container.js +2 -16
  128. package/components/tab/tab-header.js +4 -24
  129. package/components/tab/tab-panel.js +4 -16
  130. package/components/tab/tab.js +4 -28
  131. package/components/tooltip/index.js +12 -97
  132. package/components/tooltip/portal.js +0 -2
  133. package/components/transfer/index.js +22 -67
  134. package/components/tree-view/index.js +62 -202
  135. package/components/typography/index.js +3 -31
  136. package/global/index.js +0 -8
  137. package/icons/basic.js +0 -48
  138. package/icons/effect.js +17 -29
  139. package/icons/general/clock/clock.js +0 -2
  140. package/icons/general/color-handler/background.js +0 -2
  141. package/icons/general/color-handler/text.js +0 -2
  142. package/icons/general/emoji/emoji.js +0 -2
  143. package/icons/general/font-properties/bold.js +0 -2
  144. package/icons/general/font-properties/font-family.js +0 -2
  145. package/icons/general/font-properties/font-size.js +0 -2
  146. package/icons/general/font-properties/italic.js +0 -2
  147. package/icons/general/font-properties/underline.js +0 -2
  148. package/icons/general/hyperlink/hyperlink.js +0 -2
  149. package/icons/general/indent/decrease.js +0 -2
  150. package/icons/general/indent/increase.js +0 -2
  151. package/icons/general/list/bullets.js +0 -2
  152. package/icons/general/list/numbering.js +0 -2
  153. package/icons/general/picture/picture.js +0 -2
  154. package/icons/general/steps/redo.js +0 -2
  155. package/icons/general/steps/undo.js +0 -2
  156. package/icons/general/text-align/center.js +0 -2
  157. package/icons/general/text-align/justify.js +0 -2
  158. package/icons/general/text-align/left.js +0 -2
  159. package/icons/general/text-align/right.js +0 -2
  160. package/icons/menu/dhr.js +2 -1
  161. package/icons/menu/index.js +2 -2
  162. package/icons/menu/v2/index.js +0 -10
  163. package/package.json +1 -1
  164. package/readme.md +11 -1
  165. package/styles/animation.js +15 -58
  166. package/styles/color-helper.js +24 -54
  167. package/styles/colors.js +17 -9
  168. package/styles/general.js +6 -2
  169. package/styles/typography.js +4 -4
  170. package/styles/utils.js +2 -2
  171. package/theme/createBreakpoints.js +7 -18
  172. package/theme/make-styles.js +2 -5
  173. package/theme/set-theme.js +3 -6
  174. package/theme/settings.js +3 -2
  175. package/theme/theme-provider.js +0 -1
  176. package/utils/array/array.js +14 -23
  177. package/utils/classNames.js +0 -5
  178. package/utils/console.js +0 -6
  179. package/utils/date.js +13 -82
  180. package/utils/error/error.js +1 -9
  181. package/utils/error/errors.js +1 -48
  182. package/utils/getFileType.js +0 -9
  183. package/utils/handleBreakpoints.js +0 -5
  184. package/utils/intersectionObserver.js +0 -5
  185. package/utils/iterator.js +0 -9
  186. package/utils/map-parent.js +3 -10
  187. package/utils/object/extend.js +0 -10
  188. package/utils/object/object.js +12 -11
  189. package/utils/parseHTML.js +0 -1
  190. package/utils/promisify.js +0 -5
  191. package/utils/randomString.js +0 -7
  192. package/utils/remove-unicode.js +0 -1
  193. package/utils/render-portal.js +1 -9
  194. package/utils/renderHTML.js +4 -6
  195. package/utils/renderIcon.js +4 -14
  196. package/utils/sb-template.js +6 -5
  197. package/utils/string/capitalize.js +0 -1
  198. package/utils/string/capitalizeSentenceCase.js +0 -2
  199. package/utils/string/string.js +0 -13
  200. package/utils/type.js +0 -21
  201. package/utils/updatePosition.js +4 -5
  202. package/utils/useDelayUnmount.js +0 -4
  203. package/utils/useElementSize.js +9 -3
  204. package/utils/useEventListener.js +12 -6
  205. package/utils/useInput.js +0 -6
  206. package/utils/useMediaQuery.js +8 -10
  207. package/utils/useOnClickOutside.js +0 -2
  208. package/utils/usePortal.js +3 -10
  209. package/utils/validate.js +6 -20
@@ -1,110 +1,86 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import { css, jsx } from '@emotion/core';
5
- import { useImperativeHandle, useRef, memo, forwardRef, useEffect, useState, useCallback } from 'react';
6
- import { Button, ButtonIcon, Divider, HelperText, InputBase, Label, Typography } from '../..';
7
- import ControlComp from '../control';
8
4
  import PropTypes from 'prop-types';
9
- import theme from '../../../theme/settings';
5
+ import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
10
6
  import { render } from 'react-dom';
11
- import { randomString, updatePosition, date as moment, capitalizeSentenceCase, isEqual, classNames } from '../../../utils';
7
+ import { Button, ButtonIcon, Divider, HelperText, InputBase, Label, Typography } from '../..';
12
8
  import { getGlobal } from '../../../global';
13
- import { generateCalendarCSS, onUpdateNavigator, renderHeader, renderNavigator } from '../calendar/function';
14
9
  import locale from '../../../locale';
15
- import { alignCenter, borderRadius4px, cursorPointer, displayBlock, displayNone, flexCol, flexRow, justifyEnd, parseWidth, pointerEventsNone, positionFixed, textCenter, userSelectNone, whiteSpaceNoWrap } from '../../../styles/general';
10
+ import { alignCenter, borderRadius4px, cursorPointer, displayBlock, displayNone, flexCol, flexRow, justifyEnd, parseHeight, parseMaxWidth, parseMinWidth, parseWidth, parseWidthHeight, pointerEventsNone, positionFixed, textCenter, userSelectNone, whiteSpaceNoWrap } from '../../../styles/general';
11
+ import { useTheme } from '../../../theme';
12
+ import { capitalizeSentenceCase, classNames, date as moment, isEqual, randomString, updatePosition } from '../../../utils';
13
+ import { generateCalendarCSS, onUpdateNavigator, renderHeader, renderNavigator } from '../calendar/function';
14
+ import ControlComp from '../control';
16
15
  const {
17
16
  colors: {
18
17
  system: {
19
- white
18
+ white: systemWhite
20
19
  }
21
20
  },
21
+ boxShadows: {
22
+ large: boxShadowsLarge
23
+ },
22
24
  spacing,
23
25
  zIndex: zIndexCORE
24
- } = theme;
25
-
26
+ } = useTheme();
26
27
  const toLocalTimestamp = t => {
27
28
  if (typeof t === 'object' && t.getTime) {
28
29
  t = t.getTime();
29
30
  }
30
-
31
31
  if (typeof t === 'string' && !t.match(/\d{13}/)) {
32
32
  t = Date.parse(t).getTime();
33
33
  }
34
-
35
34
  t = parseInt(t, 10) - new Date().getTimezoneOffset() * 60 * 1000;
36
35
  return t;
37
36
  };
38
-
39
37
  const getDaysFrom1970 = t => {
40
38
  return Math.floor(toLocalTimestamp(t) / 86400000);
41
39
  };
42
-
43
40
  const countDays = (start, end, startFromZero) => {
44
41
  return Math.abs(getDaysFrom1970(start) - getDaysFrom1970(end)) + (startFromZero ? 0 : 1);
45
42
  };
46
-
47
43
  const formatValue = (value, format, utc = false) => {
48
44
  return moment(value).format(format, utc);
49
45
  };
50
-
51
46
  const getDateOfWeek = date => {
52
47
  let day = date.getDay();
53
48
  if (day === 0) day = 7;
54
49
  return day - 1;
55
50
  };
56
-
57
51
  const isValidDate = v => {
58
- if (!v || v === null) return false;
59
-
52
+ if (!v) return false;
60
53
  if (Object.prototype.toString.call(v) === '[object Date]') {
61
54
  return true;
62
55
  }
63
-
64
- if (!isNaN(Date.parse(new Date(v)))) {
65
- return true;
66
- }
67
-
68
- return false;
56
+ return !isNaN(Date.parse(new Date(v)));
69
57
  };
70
-
71
58
  const isValidValues = v => {
72
59
  if (!v || !Array.isArray(v) || v.length !== 2) {
73
60
  return false;
74
61
  }
75
-
76
- if (isValidDate(v[0]) && isValidDate(v[1]) && +moment(v[0]).diff(v[1]) <= 0) {
77
- return true;
78
- }
79
-
80
- return false;
62
+ return !!(isValidDate(v[0]) && isValidDate(v[1]) && +moment(v[0]).diff(v[1]) <= 0);
81
63
  };
82
-
83
64
  const isToday = day => {
84
65
  return +moment(day).diff(new Date().setHours(0, 0, 0, 0)) === 0 ? unique.day.today : '';
85
66
  };
86
-
87
67
  const isLimit = (day, max, min) => {
88
68
  return isBefore(min, day) || isAfter(max, day) ? unique.day.limit : '';
89
69
  };
90
-
91
70
  const isBefore = (min, time) => {
92
71
  return min && isValidDate(min) && moment(time).diff(min) < 0;
93
72
  };
94
-
95
73
  const isAfter = (max, time) => {
96
74
  return max && isValidDate(max) && moment(time).diff(max) > 0;
97
75
  };
98
-
99
76
  const parseDate = day => {
100
77
  return Date.parse(new Date(day));
101
78
  };
102
-
103
79
  const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
104
80
  action = {},
105
81
  actionIconAt,
106
- controls,
107
82
  clearAble,
83
+ controls,
108
84
  defaultValue,
109
85
  disabled,
110
86
  displayFormat,
@@ -165,6 +141,7 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
165
141
  right: useRef(null),
166
142
  content: useRef(null)
167
143
  };
144
+ const isEnable = !readOnly && !disabled;
168
145
  const closeText = getGlobal(['close']);
169
146
  const cancelText = getGlobal(['cancel']);
170
147
  const confirmText = getGlobal(['confirm']);
@@ -189,7 +166,6 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
189
166
  valueTo.current = v;
190
167
  setValueTo();
191
168
  }, [valueTo]);
192
-
193
169
  const isActive = day => {
194
170
  if (values.current[0] && +moment(values.current[0]).diff(day) === 0) {
195
171
  if (values.current[1] && +moment(values.current[0]).diff(values.current[1]) < 0) {
@@ -200,26 +176,20 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
200
176
  } else if (values.current[1] && parseDate(values.current[1]) === parseDate(day)) {
201
177
  return `${unique.day.to + ' ' + unique.day.active}`;
202
178
  }
203
-
204
179
  return '';
205
180
  };
206
-
207
181
  const isBetween = dayParsed => {
208
182
  if (values.current[0] && values.current[1] && parseDate(values.current[0]) < dayParsed && dayParsed < parseDate(values.current[1])) {
209
183
  return unique.day.between;
210
184
  }
211
-
212
185
  return '';
213
186
  };
214
-
215
187
  const countDay = v => {
216
188
  if (v && Array.isArray(v) && v.length === 2) {
217
189
  return Number(+moment(v[1]).diff(v[0]) + (startFromZero ? 0 : 1));
218
190
  }
219
-
220
191
  return Number(startFromZero ? 0 : 1);
221
192
  };
222
-
223
193
  const onChangeValue = v => {
224
194
  setInputValue(v[0], true);
225
195
  setInputValue(v[1], false);
@@ -227,11 +197,9 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
227
197
  value: [formatValue(v[0], returnFormat), formatValue(v[1], returnFormat), selected.current]
228
198
  });
229
199
  };
230
-
231
200
  const onDayClick = e => {
232
201
  const el = e.currentTarget;
233
202
  const v = parseInt(el.dataset.time, 10);
234
-
235
203
  if (values.current.length === 0) {
236
204
  //push
237
205
  el.classList.add(unique.day.active);
@@ -272,23 +240,21 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
272
240
  }
273
241
  }
274
242
  };
275
-
276
243
  const renderCalendar = (time, type) => {
277
244
  time = new Date(time);
278
245
  const firstDay = new Date(new Date(time).setDate(1)),
279
- lastDay = new Date(firstDay.getFullYear(), firstDay.getMonth() + 1, 0),
280
- prevDay = new Date(firstDay.getFullYear(), firstDay.getMonth(), 0),
281
- lastDate = lastDay.getDate(),
282
- prevDate = prevDay.getDate();
246
+ lastDay = new Date(firstDay.getFullYear(), firstDay.getMonth() + 1, 0),
247
+ prevDay = new Date(firstDay.getFullYear(), firstDay.getMonth(), 0),
248
+ lastDate = lastDay.getDate(),
249
+ prevDate = prevDay.getDate();
283
250
  let tableBody = [],
284
- tableRaw = [],
285
- tableData = [],
286
- weekDateFirst = getDateOfWeek(firstDay),
287
- weekDateLast = getDateOfWeek(lastDay);
251
+ tableRaw = [],
252
+ tableData = [],
253
+ weekDateFirst = getDateOfWeek(firstDay),
254
+ weekDateLast = getDateOfWeek(lastDay);
288
255
  /**
289
256
  * days of previous month
290
257
  */
291
-
292
258
  for (let i = weekDateFirst; i > 0; i--) {
293
259
  const day = Date.parse(new Date(time.getFullYear(), time.getMonth(), 1));
294
260
  tableData.push(jsx("td", {
@@ -302,8 +268,6 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
302
268
  /**
303
269
  * days of current month
304
270
  */
305
-
306
-
307
271
  for (let i = 0; i < lastDate; i++) {
308
272
  const day = new Date(time.getFullYear(), time.getMonth(), i + 1);
309
273
  tableData.push(jsx("td", {
@@ -331,8 +295,6 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
331
295
  /**
332
296
  * days of next month
333
297
  */
334
-
335
-
336
298
  for (let i = 0; i < 13 - weekDateLast; i++) {
337
299
  const day = Date.parse(new Date(time.getFullYear(), time.getMonth() + 1, 0));
338
300
  tableData.push(jsx("td", {
@@ -343,7 +305,6 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
343
305
  className: unique.day.day
344
306
  })));
345
307
  }
346
-
347
308
  for (let i = 0; i < 6; i++) {
348
309
  for (let j = 0; j < 7; j++) {
349
310
  tableRaw.push(tableData[7 * i + j] || jsx("td", {
@@ -351,31 +312,26 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
351
312
  className: classNames(unique.table.data, 'next_month')
352
313
  }));
353
314
  }
354
-
355
315
  tableBody.push(jsx("tr", {
356
316
  key: i,
357
317
  className: unique.day.week
358
318
  }, tableRaw));
359
319
  tableRaw = [];
360
320
  }
361
-
362
321
  if (type === 'from') {
363
322
  onUpdateNavigator(time, navigatorFromRefs);
364
-
365
323
  if (tableFrRef.current) {
366
324
  tableFrRef.current.querySelector('tbody').remove();
367
325
  render(tableBody, tableFrRef.current.appendChild(document.createElement('tbody')));
368
326
  }
369
327
  } else if (type === 'to') {
370
328
  onUpdateNavigator(time, navigatorToRefs);
371
-
372
329
  if (tableToRef.current) {
373
330
  tableToRef.current.querySelector('tbody').remove();
374
331
  render(tableBody, tableToRef.current.appendChild(document.createElement('tbody')));
375
332
  }
376
333
  }
377
334
  };
378
-
379
335
  const updateFromTo = (times = [new Date(), new Date()]) => {
380
336
  const timeFr = new Date(times[0]);
381
337
  const timeTo = new Date(times[1]);
@@ -384,7 +340,6 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
384
340
  updateValueFr(from);
385
341
  updateValueTo(to);
386
342
  };
387
-
388
343
  const update = v => {
389
344
  if (v) {
390
345
  if (isValidValues(v)) {
@@ -400,7 +355,8 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
400
355
  } else {
401
356
  updateValues([new Date().setHours(0, 0, 0, 0), new Date().setHours(0, 0, 0, 0)]);
402
357
  updateSelected(0);
403
- updateFromTo(values.current); // setInputValue(values.current[0], true);
358
+ updateFromTo(values.current);
359
+ // setInputValue(values.current[0], true);
404
360
  // setInputValue(values.current[1], false);
405
361
  }
406
362
  };
@@ -421,7 +377,6 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
421
377
  style.left = left;
422
378
  style.top = top + height + 4;
423
379
  style.transformOrigin = '50% 20%';
424
-
425
380
  if (style.top + pickerHeight > innerHeight) {
426
381
  if (top > pickerHeight) {
427
382
  style.top = innerHeight - pickerHeight - 4;
@@ -431,88 +386,71 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
431
386
  style.transformOrigin = 'center';
432
387
  }
433
388
  }
434
-
435
389
  const pickerWidth = window.innerWidth <= 633 ? 300 : 633;
436
-
437
390
  if (left + pickerWidth > innerWidth) {
438
391
  if (innerWidth > pickerWidth) {
439
392
  style.left = (innerWidth - pickerWidth) / 2;
440
393
  }
441
394
  }
442
-
443
395
  return pickerCSS.picker(style, width).styles;
444
396
  };
445
-
446
397
  const clearDayHovering = arr => {
447
398
  if (values.current.length !== 2) {
448
399
  for (let i in arr) {
449
400
  arr[i].classList.remove(unique.day.from, unique.day.to, unique.day.between);
450
401
  }
451
-
452
402
  tooltipRef.current.style.visibility = 'hidden';
453
403
  }
454
404
  };
455
-
456
405
  const createBackground = () => {
457
406
  let background = document.getElementById(unique.backGr);
458
-
459
407
  if (!background) {
460
408
  background = document.createElement('div');
461
409
  background.id = unique.backGr;
462
410
  background.classList.add(unique.portal, unique.backGr);
463
411
  document.body.appendChild(background);
464
412
  }
465
-
466
413
  background.style.cssText = pickerCSS.backGr;
467
414
  return background;
468
415
  };
469
-
470
416
  const createPicker = anchor => {
471
417
  const picker = document.createElement('div');
472
418
  picker.id = unique.picker;
473
419
  picker.style.cssText = getPickerStyle(anchor);
474
420
  return picker;
475
421
  };
476
-
477
422
  const setPrevTime = (e, level, time, type) => {
478
423
  if (!valueFr.current || !time) return;
479
424
  const firstDayOfMin = min && min !== null && new Date(new Date(min).setDate(1)).setHours(0, 0, 0, 0);
480
425
  const firstDayOfTime = new Date(new Date(time).setDate(1)).setHours(0, 0, 0, 0);
481
-
482
426
  if (level === 'month') {
483
427
  if (firstDayOfMin) {
484
428
  if (type === 'to' && getDaysFrom1970(firstDayOfTime) - getDaysFrom1970(firstDayOfMin) < 59) {
485
429
  e.currentTarget.disabled = true;
486
430
  return;
487
431
  }
488
-
489
432
  if (getDaysFrom1970(firstDayOfTime) - getDaysFrom1970(firstDayOfMin) < 28) {
490
433
  e.currentTarget.disabled = true;
491
434
  return;
492
435
  }
493
436
  }
494
-
495
437
  time.setMonth(time.getMonth() - 1);
496
438
  renderCalendar(time, type);
497
439
  }
498
-
499
440
  if (level === 'year') {
500
441
  if (firstDayOfMin) {
501
442
  if (type === 'to' && getDaysFrom1970(firstDayOfTime) - getDaysFrom1970(firstDayOfMin) < 396) {
502
443
  e.currentTarget.disabled = true;
503
444
  return;
504
445
  }
505
-
506
446
  if (getDaysFrom1970(firstDayOfTime) - getDaysFrom1970(firstDayOfMin) < 365) {
507
447
  e.currentTarget.disabled = true;
508
448
  return;
509
449
  }
510
450
  }
511
-
512
451
  time.setFullYear(time.getFullYear() - 1);
513
452
  renderCalendar(time, type);
514
453
  }
515
-
516
454
  if (type === 'to') {
517
455
  if (+moment(time).diff(valueFr.current, 'months') < 1) {
518
456
  valueFr.current.setFullYear(time.getFullYear());
@@ -521,46 +459,38 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
521
459
  }
522
460
  }
523
461
  };
524
-
525
462
  const setNextTime = (e, level, time, type) => {
526
463
  if (!valueTo.current || !time) return;
527
464
  const firstDayOfMax = max && max !== null && new Date(new Date(max).setDate(1)).setHours(0, 0, 0, 0);
528
465
  const firstDayOfTime = new Date(new Date(time).setDate(1)).setHours(0, 0, 0, 0);
529
-
530
466
  if (level === 'month') {
531
467
  if (firstDayOfMax) {
532
468
  if (type === 'from' && getDaysFrom1970(firstDayOfTime) - getDaysFrom1970(firstDayOfMax) > -59) {
533
469
  e.currentTarget.disabled = true;
534
470
  return;
535
471
  }
536
-
537
472
  if (getDaysFrom1970(firstDayOfTime) - getDaysFrom1970(firstDayOfMax) > -28) {
538
473
  e.currentTarget.disabled = true;
539
474
  return;
540
475
  }
541
476
  }
542
-
543
477
  time.setMonth(time.getMonth() + 1);
544
478
  renderCalendar(time, type);
545
479
  }
546
-
547
480
  if (level === 'year') {
548
481
  if (firstDayOfMax) {
549
482
  if (type === 'from' && getDaysFrom1970(firstDayOfTime) - getDaysFrom1970(firstDayOfMax) > -396) {
550
483
  e.currentTarget.disabled = true;
551
484
  return;
552
485
  }
553
-
554
486
  if (getDaysFrom1970(firstDayOfTime) - getDaysFrom1970(firstDayOfMax) > -365) {
555
487
  e.currentTarget.disabled = true;
556
488
  return;
557
489
  }
558
490
  }
559
-
560
491
  time.setFullYear(time.getFullYear() + 1);
561
492
  renderCalendar(time, type);
562
493
  }
563
-
564
494
  if (type === 'from') {
565
495
  if (+moment(time).diff(valueTo.current, 'months') >= 0) {
566
496
  valueTo.current.setFullYear(time.getFullYear());
@@ -569,14 +499,11 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
569
499
  }
570
500
  }
571
501
  };
572
-
573
502
  const setButtonState = () => {
574
503
  const isVisible = isEqual(values.current, tempValues.current);
575
-
576
504
  const query = function (selector) {
577
505
  return footerRef.current.querySelector(selector);
578
506
  };
579
-
580
507
  const close = query(`.${unique.close}`);
581
508
  const cancel = query(`.${unique.cancel}`);
582
509
  const confirm = query(`.${unique.confirm}`);
@@ -588,7 +515,6 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
588
515
  display: 'inline-flex',
589
516
  visibility: 'visible'
590
517
  };
591
-
592
518
  if (isVisible) {
593
519
  Object.assign(close.style, visible);
594
520
  Object.assign(cancel.style, hidden);
@@ -599,83 +525,72 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
599
525
  Object.assign(close.style, hidden);
600
526
  }
601
527
  };
602
-
603
528
  const onCancel = () => {
604
529
  updateValues(tempValues.current);
605
530
  setButtonState();
606
531
  closePicker();
607
532
  };
608
-
609
533
  const onConfirm = () => {
610
534
  setButtonState();
611
-
612
535
  if (values.current.length === 1) {
613
536
  onChangeValue([values.current[0], values.current[0]]);
614
537
  } else {
615
538
  onChangeValue(values.current);
616
539
  }
617
-
618
540
  closePicker();
619
541
  };
620
-
621
542
  const onSwap = open => {
543
+ if (!isEnable) return;
622
544
  const t = iconRef.current.childNodes[+open];
623
-
624
545
  if (open) {
625
- Object.assign(t.style, { ...hiddenStyle
546
+ Object.assign(t.style, {
547
+ ...hiddenStyle
626
548
  });
627
- Object.assign(t.previousSibling.style, { ...activeStyle
549
+ Object.assign(t.previousSibling.style, {
550
+ ...activeStyle
628
551
  });
629
552
  setTimeout(() => {
630
553
  t.previousSibling.style.pointerEvents = null;
631
554
  }, 200);
632
555
  } else {
633
- Object.assign(t.style, { ...hiddenStyle
556
+ Object.assign(t.style, {
557
+ ...hiddenStyle
634
558
  });
635
- Object.assign(t.nextSibling.style, { ...activeStyle
559
+ Object.assign(t.nextSibling.style, {
560
+ ...activeStyle
636
561
  });
637
562
  setTimeout(() => {
638
563
  t.nextSibling.style.pointerEvents = null;
639
564
  }, 200);
640
565
  }
641
566
  };
642
-
643
567
  const onScroll = () => {
644
568
  const node = document.getElementById(unique.picker);
645
-
646
569
  if (!ipConRef.current || !node) {
647
570
  window.removeEventListener('scroll', onScroll);
648
571
  return;
649
572
  }
650
-
651
573
  updatePosition(ipConRef.current, node, closePicker);
652
574
  };
653
-
654
575
  const onResize = () => {
655
576
  if (!ref.current) return;
656
577
  const {
657
578
  width
658
579
  } = ref.current.getBoundingClientRect();
659
580
  const node = document.getElementById(unique.picker);
660
-
661
581
  if (node) {
662
582
  node.style.width = width + 'px';
663
583
  }
664
-
665
584
  onScroll();
666
585
  };
667
-
668
586
  const onDayHover = (e, arr) => {
669
587
  const currentTime = parseInt(e.target.dataset.time, 10);
670
588
  let tooltipContent = '';
671
589
  if (e.target.classList.contains(unique.day.limit)) return;
672
-
673
590
  for (let i in arr) {
674
591
  const time = parseInt(arr[i].dataset.time, 10);
675
-
676
592
  if (values.current[0] && !values.current[1]) {
677
593
  const firstValue = Number(values.current[0]);
678
-
679
594
  if (firstValue <= time && currentTime >= time && currentTime !== firstValue) {
680
595
  if (time === firstValue) {
681
596
  arr[i].classList.remove(unique.day.between, unique.day.to);
@@ -703,15 +618,12 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
703
618
  }
704
619
  }
705
620
  }
706
-
707
621
  if (values.current[0] && !values.current[1]) {
708
622
  const dates = Math.abs(countDays(new Date(values.current), new Date(currentTime), startFromZero));
709
623
  const tooltip = tooltipRef.current;
710
-
711
624
  if (onShowTooltip && dates > 0) {
712
625
  tooltipContent = dates + ' ' + unitText;
713
626
  }
714
-
715
627
  if (tooltipContent) {
716
628
  const tooltipBounding = tooltip.getBoundingClientRect();
717
629
  const dayBounding = e.target.getBoundingClientRect();
@@ -731,17 +643,14 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
731
643
  tooltipRef.current.style.visibility = 'hidden';
732
644
  }
733
645
  };
734
-
735
646
  const onPickerHover = (e, arr) => {
736
647
  arr = Array.from(arr);
737
-
738
648
  if (e.target.tagName && e.target.tagName.toLowerCase() === 'td') {
739
649
  onDayHover(e, arr);
740
650
  } else {
741
651
  clearDayHovering(arr);
742
652
  }
743
653
  };
744
-
745
654
  const pressESCHandler = event => {
746
655
  if (event.key === 'Escape') {
747
656
  onClickOutside({
@@ -749,12 +658,10 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
749
658
  });
750
659
  }
751
660
  };
752
-
753
661
  const renderPicker = () => {
754
662
  renderCalendar(valueFr.current, 'from');
755
663
  renderCalendar(valueTo.current, 'to');
756
664
  };
757
-
758
665
  const openPicker = anchor => {
759
666
  const backGr = createBackground();
760
667
  const picker = createPicker(anchor);
@@ -762,34 +669,31 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
762
669
  const arr = pickerRef.current.getElementsByTagName('td');
763
670
  updateTempValues(values.current.length === 1 ? [values.current[0], values.current[0]] : values.current);
764
671
  setTimeout(() => {
765
- Object.assign(picker.style, { ...pickerCSS.active
672
+ Object.assign(picker.style, {
673
+ ...pickerCSS.active
766
674
  });
767
675
  renderPicker();
768
676
  pickerRef.current.addEventListener('mouseover', e => onPickerHover(e, arr));
769
677
  window.addEventListener('resize', onResize);
770
678
  window.addEventListener('scroll', onScroll);
771
679
  document.addEventListener('mousedown', onClickOutside);
772
-
773
680
  if (pressESCToClose) {
774
681
  document.addEventListener('keydown', pressESCHandler);
775
682
  }
776
-
777
683
  controls && setButtonState();
778
684
  });
779
685
  };
780
-
781
686
  const closePicker = () => {
782
687
  const backGr = document.getElementById(unique.backGr);
783
688
  if (!backGr) return;
784
689
  const picker = backGr.querySelector(`#${unique.picker}`);
785
690
  if (!picker) return;
786
- Object.assign(picker.style, { ...pickerCSS.remove
691
+ Object.assign(picker.style, {
692
+ ...pickerCSS.remove
787
693
  });
788
-
789
694
  if (pressESCToClose) {
790
695
  document.removeEventListener('keydown', pressESCHandler);
791
696
  }
792
-
793
697
  document.removeEventListener('mousedown', onClickOutside);
794
698
  window.removeEventListener('scroll', onScroll);
795
699
  window.removeEventListener('resize', onResize);
@@ -797,22 +701,18 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
797
701
  backGr.remove();
798
702
  }, 200);
799
703
  pickerRef.current && pickerRef.current.removeEventListener('mouseover', onPickerHover);
800
-
801
704
  if (ipConRef.current) {
802
705
  ipConRef.current.classList.remove(unique.focus);
803
706
  ipConRef.current.style.zIndex = null;
804
707
  }
805
-
806
708
  ipRef.current && ipRef.current.blur();
807
709
  updateTempValues([]);
808
710
  };
809
-
810
711
  const onClickOutside = e => {
811
712
  if (ipConRef.current && !ipConRef.current.contains(e.target) && ipRef.current && !ipRef.current.contains(e.target) && pickerRef.current && !pickerRef.current.contains(e.target)) {
812
713
  controls ? onCancel() : closePicker();
813
714
  }
814
715
  };
815
-
816
716
  const triggerFocus = () => {
817
717
  if (!ipConRef.current.classList.contains(unique.focus)) {
818
718
  ipRef.current.focus();
@@ -822,22 +722,18 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
822
722
  });
823
723
  }
824
724
  };
825
-
826
725
  const onInputFocus = () => {
827
726
  const el = ipConRef.current;
828
-
829
727
  if (!el.classList.contains(unique.focus)) {
830
728
  el.classList.add(unique.focus);
831
729
  openPicker();
832
730
  }
833
731
  };
834
-
835
732
  const setInputValue = (time, reset, unshift = false) => {
836
733
  if (!ipRef.current) return;
837
734
  const el = ipRef.current;
838
735
  let enUnitText = locale.get() === 'en' && selected.current > 1 ? unitText + 's' : unitText;
839
- let tempValue = '';
840
-
736
+ let tempValue;
841
737
  if (!reset) {
842
738
  if (unshift) {
843
739
  tempValue = formatValue(time, displayFormat) + ' - ' + el.value + (showUnitCount ? ` (${selected.current} ${enUnitText})` : '');
@@ -847,11 +743,9 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
847
743
  } else {
848
744
  tempValue = formatValue(time, displayFormat);
849
745
  }
850
-
851
746
  el.value = capitalizeSentenceCase(tempValue);
852
747
  clearAble && onSwap(false);
853
748
  };
854
-
855
749
  const onClear = () => {
856
750
  if (!clearAble || !ipRef.current) return;
857
751
  ipRef.current.value = '';
@@ -862,7 +756,6 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
862
756
  !!onChange && onChange(e);
863
757
  onSwap(true);
864
758
  };
865
-
866
759
  useEffect(() => {
867
760
  update(defaultValue);
868
761
  return () => {
@@ -879,10 +772,8 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
879
772
  if (!readOnly) {
880
773
  ipRef.current.addEventListener('focus', onInputFocus);
881
774
  }
882
-
883
775
  return () => {
884
776
  if (!ipRef.current) return;
885
-
886
777
  if (!readOnly) {
887
778
  ipRef.current.removeEventListener('focus', onInputFocus);
888
779
  }
@@ -892,33 +783,26 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
892
783
  if (min && min !== null) {
893
784
  let arr = new Array();
894
785
  const newMin = new Date(min).setHours(0, 0, 0, 0);
895
-
896
786
  if (isBefore(newMin, values.current[0])) {
897
787
  arr.push(newMin);
898
-
899
788
  if (isBefore(newMin, values.current[1])) {
900
789
  arr.push(newMin);
901
790
  } else {
902
791
  arr.push(values.current[1]);
903
792
  }
904
-
905
793
  update(arr);
906
794
  }
907
795
  }
908
-
909
796
  if (max && max !== null) {
910
- let arr = new Array();
797
+ let arr = [];
911
798
  const newMax = max && new Date(max).setHours(0, 0, 0, 0);
912
-
913
799
  if (isAfter(newMax, values.current[1])) {
914
800
  arr.push(newMax);
915
-
916
801
  if (isAfter(newMax, values.current[0])) {
917
802
  arr.push(newMax);
918
803
  } else {
919
804
  arr.unshift(values.current[0]);
920
805
  }
921
-
922
806
  update(arr);
923
807
  }
924
808
  }
@@ -927,28 +811,32 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
927
811
  if (ipRef.current.value !== '') {
928
812
  update(values.current);
929
813
  }
930
-
931
- if (disabled) {
932
- iconRef.current.childNodes[0].style.pointerEvents = 'none';
933
- closePicker();
934
- } else if (!readOnly) {
935
- ipRef.current.addEventListener('focus', onInputFocus);
936
- } else {
814
+ // if (disabled) {
815
+ // iconRef.current.childNodes[0].style.pointerEvents = 'none';
816
+ // closePicker();
817
+ // } else if (!readOnly) {
818
+ // ipRef.current.addEventListener('focus', onInputFocus);
819
+ // } else {
820
+ // iconRef.current.childNodes[0].style.pointerEvents = 'none';
821
+ // closePicker();
822
+ // }
823
+
824
+ if (isEnable) {
937
825
  iconRef.current.childNodes[0].style.pointerEvents = 'none';
938
826
  closePicker();
939
827
  }
940
-
941
828
  return () => {
942
829
  if (!iconRef.current || !ipRef.current) return;
943
-
944
- if (disabled) {
945
- iconRef.current.childNodes[0].style.pointerEvents = null;
946
- } else if (!readOnly) {
947
- ipRef.current.removeEventListener('focus', onInputFocus);
948
- } else {
830
+ // if (disabled) {
831
+ // iconRef.current.childNodes[0].style.pointerEvents = null;
832
+ // } else if (!readOnly) {
833
+ // ipRef.current.removeEventListener('focus', onInputFocus);
834
+ // } else {
835
+ // iconRef.current.childNodes[0].style.pointerEvents = null;
836
+ // }
837
+ if (isEnable) {
949
838
  iconRef.current.childNodes[0].style.pointerEvents = null;
950
839
  }
951
-
952
840
  closePicker();
953
841
  };
954
842
  }, [actionIconAt, clearAble, controls, disabled, displayFormat, max, min, pressESCToClose, readOnly, startFromZero, unitCount, viewType]);
@@ -961,13 +849,11 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
961
849
  close: closePicker,
962
850
  ...action
963
851
  }; // methods
964
-
965
852
  _instance.__proto__ = {}; // hidden methods
966
-
967
853
  currentRef.instance = _instance;
968
854
  return currentRef;
969
855
  });
970
- const iconComp = jsx("div", {
856
+ const iconComp = isEnable && jsx("div", {
971
857
  css: IconAreaCSS,
972
858
  ref: iconRef
973
859
  }, jsx(ButtonIcon, {
@@ -989,15 +875,18 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
989
875
  css: ControlContainerCSS,
990
876
  className: unique.footer,
991
877
  ref: footerRef
992
- }, jsx(Button, { ...buttonProps,
878
+ }, jsx(Button, {
879
+ ...buttonProps,
993
880
  className: unique.close,
994
881
  onClick: () => onClickOutside({
995
882
  target: null
996
883
  })
997
- }, closeText), jsx(Button, { ...buttonProps,
884
+ }, closeText), jsx(Button, {
885
+ ...buttonProps,
998
886
  className: unique.cancel,
999
887
  onClick: onCancel
1000
- }, cancelText), jsx(Button, { ...buttonProps,
888
+ }, cancelText), jsx(Button, {
889
+ ...buttonProps,
1001
890
  color: 'info',
1002
891
  className: unique.confirm,
1003
892
  onClick: onConfirm
@@ -1022,7 +911,7 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1022
911
  className: unique.tooltip,
1023
912
  ref: tooltipRef
1024
913
  }, jsx(Typography, {
1025
- color: white,
914
+ color: systemWhite,
1026
915
  type: 'p2'
1027
916
  }));
1028
917
  const pickerComp = jsx("div", {
@@ -1039,12 +928,14 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1039
928
  margin: spacing([4.5, 0.5, 0])
1040
929
  }
1041
930
  }), rightCalendarComp), tooltipComp, !!controls && footerMemo);
1042
- return jsx(ControlComp, { ...props,
931
+ return jsx(ControlComp, {
932
+ ...props,
1043
933
  disabled: disabled,
1044
934
  error: error,
1045
935
  ref: ref,
1046
936
  style: style
1047
- }, !!label && jsx(Label, { ...labelProps,
937
+ }, !!label && jsx(Label, {
938
+ ...labelProps,
1048
939
  disabled: disabled,
1049
940
  required: required
1050
941
  }, label), jsx(InputBase, {
@@ -1067,7 +958,8 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1067
958
  className: 'non-effect allow-disabled'
1068
959
  },
1069
960
  endIcon: endIcon
1070
- }), !!error && jsx(HelperText, { ...helperTextProps,
961
+ }), !!error && jsx(HelperText, {
962
+ ...helperTextProps,
1071
963
  disabled: disabled
1072
964
  }, error));
1073
965
  }));
@@ -1162,11 +1054,11 @@ const pickerCSS = {
1162
1054
  container: css`
1163
1055
  ${flexCol};
1164
1056
  ${borderRadius4px};
1165
- background-color: ${white};
1166
- box-shadow: ${theme.boxShadows.large};
1057
+ background-color: ${systemWhite};
1058
+ box-shadow: ${boxShadowsLarge};
1167
1059
  .${unique.wrapper} {
1168
1060
  ${flexRow};
1169
- min-width: 633px;
1061
+ ${parseMinWidth(633)};
1170
1062
  }
1171
1063
  .${unique.tooltip} {
1172
1064
  ${borderRadius4px};
@@ -1175,9 +1067,9 @@ const pickerCSS = {
1175
1067
  ${textCenter};
1176
1068
  ${userSelectNone};
1177
1069
  ${whiteSpaceNoWrap};
1070
+ ${parseHeight(18)};
1071
+ ${parseMinWidth(65)};
1178
1072
  background-color: rgba(21, 26, 48, 0.9);
1179
- height: 18px;
1180
- min-width: 65px;
1181
1073
  padding: ${spacing([0.75, 1.5])};
1182
1074
  transition: left 0.05s ease-in, top 0.05s ease-in;
1183
1075
  vertical-align: middle;
@@ -1201,11 +1093,10 @@ const pickerCSS = {
1201
1093
  picker: (position, width) => css`
1202
1094
  ${borderRadius4px};
1203
1095
  ${positionFixed};
1204
- ${parseWidth(width)};
1205
- height: max-content;
1096
+ ${parseWidthHeight(width, 'max-content')};
1097
+ ${parseMinWidth(window.innerWidth <= 633 ? 300 : 633)};
1098
+ ${parseMaxWidth(805)};
1206
1099
  left: ${position.left}px;
1207
- max-width: 805px;
1208
- min-width: ${window.innerWidth <= 633 ? 300 : 633}px;
1209
1100
  opacity: 0;
1210
1101
  top: ${position.top}px;
1211
1102
  transform: scale(0);
@@ -1227,98 +1118,72 @@ DateRangePickerV2.defaultProps = {
1227
1118
  actionIconAt: 'end',
1228
1119
  clearAble: false,
1229
1120
  controls: false,
1230
- unitCount: 'day',
1231
1121
  disabled: false,
1232
1122
  displayFormat: 'DD/MM/YY',
1233
1123
  onShowTooltip: true,
1234
1124
  pressESCToClose: true,
1235
1125
  readOnly: false,
1236
1126
  required: false,
1237
- startFromZero: false,
1238
- textAlign: 'start',
1239
1127
  returnFormat: 'YYYY-MM-DD',
1240
1128
  showUnitCount: true,
1129
+ startFromZero: false,
1130
+ textAlign: 'start',
1131
+ unitCount: 'day',
1241
1132
  viewType: 'underlined'
1242
1133
  };
1243
1134
  DateRangePickerV2.propTypes = {
1244
1135
  /** Position of action icons. */
1245
1136
  actionIconAt: PropTypes.oneOf(['end', 'start']),
1246
-
1247
1137
  /** If `true`, display the clear icon. */
1248
1138
  clearAble: PropTypes.bool,
1249
-
1250
1139
  /** If `true`, the calendar will have a footer controls. */
1251
1140
  controls: PropTypes.bool,
1252
-
1253
1141
  /** The count unit when select. */
1254
1142
  unitCount: PropTypes.oneOf(['day', 'night']),
1255
-
1256
1143
  /** Default value of the component. */
1257
1144
  defaultValue: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.instanceOf(Date)), PropTypes.arrayOf(PropTypes.string)]),
1258
-
1259
1145
  /** If `true`, the component is disabled. */
1260
1146
  disabled: PropTypes.bool,
1261
-
1262
1147
  /** Format to display value. */
1263
1148
  displayFormat: PropTypes.oneOfType([PropTypes.oneOf(['DD/MM/YYYY', 'MM/DD/YYYY', 'YYYY/MM/DD', 'DD-MM-YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD']), PropTypes.string]),
1264
-
1265
1149
  /** Error displayed below input. */
1266
1150
  error: PropTypes.string,
1267
-
1268
1151
  /** [Props](https://core.diginet.com.vn/ui/?path=/story/form-control-text-helpertext) of helper text. */
1269
1152
  helperTextProps: PropTypes.object,
1270
-
1271
1153
  /** [Props](https://core.diginet.com.vn/ui/?path=/story/form-control-input-inputbase) of input base */
1272
1154
  inputProps: PropTypes.object,
1273
-
1274
1155
  /** Consult [InputBase's](https://core.diginet.com.vn/ui/?path=/story/form-control-input-inputbase) documents. */
1275
1156
  inputStyle: PropTypes.object,
1276
-
1277
1157
  /** The label of the component. */
1278
1158
  label: PropTypes.string,
1279
-
1280
1159
  /** [Props](https://core.diginet.com.vn/ui/?path=/docs/form-control-text-label--simple) of label. */
1281
1160
  labelProps: PropTypes.object,
1282
-
1283
1161
  /** Min value of date picker. */
1284
1162
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),
1285
-
1286
1163
  /** Max value of date picker. */
1287
1164
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),
1288
-
1289
1165
  /** Callback fired when the value is changed. */
1290
1166
  onChange: PropTypes.func,
1291
-
1292
1167
  /** The short hint displayed in the input before the user enters a value. */
1293
1168
  placeholder: PropTypes.string,
1294
-
1295
1169
  /** If `true`, hitting escape will close component. */
1296
1170
  pressESCToClose: PropTypes.bool,
1297
-
1298
1171
  /** If `true`, the component is readOnly. */
1299
1172
  readOnly: PropTypes.bool,
1300
-
1301
1173
  /** If `true`, the input element is required. */
1302
1174
  required: PropTypes.bool,
1303
-
1304
1175
  /** Format of the returned value. */
1305
1176
  returnFormat: PropTypes.oneOfType([PropTypes.oneOf(['DD/MM/YYYY', 'MM/DD/YYYY', 'YYYY/MM/DD', 'DD-MM-YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD']), PropTypes.string]),
1306
-
1307
1177
  /** If `true`, show unit count. */
1308
1178
  showUnitCount: PropTypes.bool,
1309
-
1310
1179
  /** Counter with start with 0 or 1. */
1311
1180
  startFromZero: PropTypes.bool,
1312
-
1313
1181
  /** Style inline of component. */
1314
1182
  style: PropTypes.object,
1315
-
1316
1183
  /** Text align of the input. */
1317
1184
  textAlign: PropTypes.oneOf(['center', 'end', 'start']),
1318
-
1319
1185
  /** The value of the input element, required for a controlled component. */
1320
1186
  value: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string])),
1321
-
1322
1187
  /** The variant to use. */
1323
1188
  viewType: PropTypes.oneOf(['outlined', 'underlined'])
1324
1189
  };