@alfalab/core-components-date-time-input 2.2.0 → 3.0.0

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 (73) hide show
  1. package/{Component-27749cf7.d.ts → Component-1ff76732.d.ts} +4 -7
  2. package/{Component-27749cf7.js → Component-1ff76732.js} +36 -15
  3. package/Component.desktop.d.ts +1 -1
  4. package/Component.desktop.js +2 -1
  5. package/Component.mobile.d.ts +1 -1
  6. package/Component.mobile.js +2 -1
  7. package/Component.responsive.d.ts +1 -1
  8. package/Component.responsive.js +1 -1
  9. package/components/date-time-input/Component.js +2 -1
  10. package/components/date-time-input/index.css +8 -8
  11. package/components/date-time-input/index.d.ts +1 -1
  12. package/components/date-time-input/index.js +2 -1
  13. package/{esm/Component-e82a534f.d.ts → cssm/Component-b91f18e8.d.ts} +4 -7
  14. package/cssm/{Component-d6110aa7.js → Component-b91f18e8.js} +35 -14
  15. package/cssm/Component.desktop.d.ts +1 -1
  16. package/cssm/Component.desktop.js +2 -1
  17. package/cssm/Component.mobile.d.ts +1 -1
  18. package/cssm/Component.mobile.js +2 -1
  19. package/cssm/Component.responsive.d.ts +1 -1
  20. package/cssm/Component.responsive.js +1 -1
  21. package/cssm/components/date-time-input/Component.js +2 -1
  22. package/cssm/components/date-time-input/index.d.ts +1 -1
  23. package/cssm/components/date-time-input/index.js +2 -1
  24. package/cssm/components/date-time-input/index.module.css +2 -2
  25. package/cssm/desktop.js +2 -1
  26. package/cssm/index.d.ts +2 -1
  27. package/cssm/index.js +2 -2
  28. package/cssm/mobile.js +2 -1
  29. package/cssm/responsive.js +2 -2
  30. package/cssm/utils/format.d.ts +3 -2
  31. package/cssm/utils/format.js +7 -3
  32. package/cssm/utils/index.js +2 -1
  33. package/desktop.js +2 -1
  34. package/{cssm/Component-d6110aa7.d.ts → esm/Component-074b6874.d.ts} +4 -7
  35. package/esm/{Component-e82a534f.js → Component-074b6874.js} +37 -16
  36. package/esm/Component.desktop.d.ts +1 -1
  37. package/esm/Component.desktop.js +2 -1
  38. package/esm/Component.mobile.d.ts +1 -1
  39. package/esm/Component.mobile.js +2 -1
  40. package/esm/Component.responsive.d.ts +1 -1
  41. package/esm/Component.responsive.js +1 -1
  42. package/esm/components/date-time-input/Component.js +2 -1
  43. package/esm/components/date-time-input/index.css +8 -8
  44. package/esm/components/date-time-input/index.d.ts +1 -1
  45. package/esm/components/date-time-input/index.js +2 -1
  46. package/esm/desktop.js +2 -1
  47. package/esm/index.d.ts +2 -1
  48. package/esm/index.js +2 -2
  49. package/esm/mobile.js +2 -1
  50. package/esm/responsive.js +2 -2
  51. package/esm/utils/format.d.ts +3 -2
  52. package/esm/utils/format.js +6 -3
  53. package/esm/utils/index.js +1 -1
  54. package/index.d.ts +2 -1
  55. package/index.js +2 -2
  56. package/mobile.js +2 -1
  57. package/modern/Component.desktop.js +1 -0
  58. package/modern/Component.mobile.js +1 -0
  59. package/modern/components/date-time-input/Component.d.ts +4 -7
  60. package/modern/components/date-time-input/Component.js +37 -16
  61. package/modern/components/date-time-input/index.css +8 -8
  62. package/modern/components/date-time-input/index.js +1 -0
  63. package/modern/desktop.js +1 -0
  64. package/modern/index.d.ts +2 -1
  65. package/modern/mobile.js +1 -0
  66. package/modern/utils/format.d.ts +3 -2
  67. package/modern/utils/format.js +6 -3
  68. package/modern/utils/index.js +1 -1
  69. package/package.json +4 -3
  70. package/responsive.js +2 -2
  71. package/utils/format.d.ts +3 -2
  72. package/utils/format.js +7 -3
  73. package/utils/index.js +2 -1
package/cssm/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var Component_responsive = require('./Component.responsive.js');
4
- require('./Component-d6110aa7.js');
4
+ require('./Component-b91f18e8.js');
5
5
  require('react');
6
6
  require('react-merge-refs');
7
7
  require('classnames');
@@ -9,12 +9,12 @@ require('@alfalab/core-components-calendar/cssm');
9
9
  require('@alfalab/core-components-icon-button/cssm');
10
10
  require('@alfalab/core-components-input/cssm');
11
11
  require('@alfalab/core-components-popover/cssm');
12
+ require('@alfalab/hooks');
12
13
  require('@alfalab/icons-glyph/CalendarMIcon');
13
14
  require('./utils/format.js');
14
15
  require('date-fns/isValid');
15
16
  require('date-fns/parse');
16
17
  require('./components/date-time-input/index.module.css');
17
- require('@alfalab/hooks');
18
18
  require('./Component.desktop.js');
19
19
  require('./Component.mobile.js');
20
20
 
package/cssm/mobile.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var Component_mobile = require('./Component.mobile.js');
4
- require('./Component-d6110aa7.js');
4
+ require('./Component-b91f18e8.js');
5
5
  require('react');
6
6
  require('react-merge-refs');
7
7
  require('classnames');
@@ -9,6 +9,7 @@ require('@alfalab/core-components-calendar/cssm');
9
9
  require('@alfalab/core-components-icon-button/cssm');
10
10
  require('@alfalab/core-components-input/cssm');
11
11
  require('@alfalab/core-components-popover/cssm');
12
+ require('@alfalab/hooks');
12
13
  require('@alfalab/icons-glyph/CalendarMIcon');
13
14
  require('./utils/format.js');
14
15
  require('date-fns/isValid');
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var Component_responsive = require('./Component.responsive.js');
4
- require('./Component-d6110aa7.js');
4
+ require('./Component-b91f18e8.js');
5
5
  require('react');
6
6
  require('react-merge-refs');
7
7
  require('classnames');
@@ -9,12 +9,12 @@ require('@alfalab/core-components-calendar/cssm');
9
9
  require('@alfalab/core-components-icon-button/cssm');
10
10
  require('@alfalab/core-components-input/cssm');
11
11
  require('@alfalab/core-components-popover/cssm');
12
+ require('@alfalab/hooks');
12
13
  require('@alfalab/icons-glyph/CalendarMIcon');
13
14
  require('./utils/format.js');
14
15
  require('date-fns/isValid');
15
16
  require('date-fns/parse');
16
17
  require('./components/date-time-input/index.module.css');
17
- require('@alfalab/hooks');
18
18
  require('./Component.desktop.js');
19
19
  require('./Component.mobile.js');
20
20
 
@@ -1,5 +1,6 @@
1
1
  declare const DATE_FORMAT = "dd.MM.yyyy";
2
2
  declare const DATE_MASK: (string | RegExp)[];
3
+ declare const DATE_WITH_TIME_LENGTH: number;
3
4
  declare const isCompleteDateInput: (input: string) => boolean;
4
5
  declare const parseDateString: (value: string, dateFormat?: string) => Date;
5
6
  declare const isValidTimeFormat: (value: string) => boolean;
@@ -8,5 +9,5 @@ declare const format: (value: string) => string;
8
9
  declare const parseTimestampToDate: (timestamp: number) => string;
9
10
  declare const getDateWithoutTime: (value: string) => Date;
10
11
  declare const getFullDateTime: (value: string) => Date;
11
- declare const setTimeToDate: (value: string) => string;
12
- export { DATE_FORMAT, DATE_MASK, isCompleteDateInput, parseDateString, isValidTimeFormat, isValid, format, parseTimestampToDate, getDateWithoutTime, getFullDateTime, setTimeToDate };
12
+ declare const addTimeToDate: (value: string) => string;
13
+ export { DATE_FORMAT, DATE_MASK, DATE_WITH_TIME_LENGTH, isCompleteDateInput, parseDateString, isValidTimeFormat, isValid, format, parseTimestampToDate, getDateWithoutTime, getFullDateTime, addTimeToDate };
@@ -29,7 +29,8 @@ var DATE_MASK = [
29
29
  /\d/,
30
30
  /\d/,
31
31
  ];
32
- var isCompleteDateInput = function (input) { return input.length === DATE_MASK.length; };
32
+ var DATE_WITH_TIME_LENGTH = DATE_MASK.length;
33
+ var isCompleteDateInput = function (input) { return input.length === DATE_WITH_TIME_LENGTH; };
33
34
  var parseDateString = function (value, dateFormat) {
34
35
  if (dateFormat === void 0) { dateFormat = DATE_FORMAT; }
35
36
  return parse__default.default(value, dateFormat, new Date());
@@ -123,9 +124,11 @@ var getFullDateTime = function (value) {
123
124
  fullDate.setFullYear(Number(year), Number(month) - 1, Number(day));
124
125
  fullDate.setHours(Number(hours) || 0);
125
126
  fullDate.setMinutes(Number(mins) || 0);
127
+ fullDate.setSeconds(0);
128
+ fullDate.setMilliseconds(0);
126
129
  return fullDate;
127
130
  };
128
- var setTimeToDate = function (value) {
131
+ var addTimeToDate = function (value) {
129
132
  if (value.length === 10 && dateFnsIsValid__default.default(parseDateString(value))) {
130
133
  return "".concat(value, ", 00:00");
131
134
  }
@@ -134,6 +137,8 @@ var setTimeToDate = function (value) {
134
137
 
135
138
  exports.DATE_FORMAT = DATE_FORMAT;
136
139
  exports.DATE_MASK = DATE_MASK;
140
+ exports.DATE_WITH_TIME_LENGTH = DATE_WITH_TIME_LENGTH;
141
+ exports.addTimeToDate = addTimeToDate;
137
142
  exports.format = format;
138
143
  exports.getDateWithoutTime = getDateWithoutTime;
139
144
  exports.getFullDateTime = getFullDateTime;
@@ -142,4 +147,3 @@ exports.isValid = isValid;
142
147
  exports.isValidTimeFormat = isValidTimeFormat;
143
148
  exports.parseDateString = parseDateString;
144
149
  exports.parseTimestampToDate = parseTimestampToDate;
145
- exports.setTimeToDate = setTimeToDate;
@@ -8,6 +8,8 @@ require('date-fns/parse');
8
8
 
9
9
  exports.DATE_FORMAT = utils_format.DATE_FORMAT;
10
10
  exports.DATE_MASK = utils_format.DATE_MASK;
11
+ exports.DATE_WITH_TIME_LENGTH = utils_format.DATE_WITH_TIME_LENGTH;
12
+ exports.addTimeToDate = utils_format.addTimeToDate;
11
13
  exports.format = utils_format.format;
12
14
  exports.getDateWithoutTime = utils_format.getDateWithoutTime;
13
15
  exports.getFullDateTime = utils_format.getFullDateTime;
@@ -16,4 +18,3 @@ exports.isValid = utils_format.isValid;
16
18
  exports.isValidTimeFormat = utils_format.isValidTimeFormat;
17
19
  exports.parseDateString = utils_format.parseDateString;
18
20
  exports.parseTimestampToDate = utils_format.parseTimestampToDate;
19
- exports.setTimeToDate = utils_format.setTimeToDate;
package/desktop.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var Component_desktop = require('./Component.desktop.js');
4
- require('./Component-27749cf7.js');
4
+ require('./Component-1ff76732.js');
5
5
  require('react');
6
6
  require('react-merge-refs');
7
7
  require('classnames');
@@ -9,6 +9,7 @@ require('@alfalab/core-components-calendar');
9
9
  require('@alfalab/core-components-icon-button');
10
10
  require('@alfalab/core-components-input');
11
11
  require('@alfalab/core-components-popover');
12
+ require('@alfalab/hooks');
12
13
  require('@alfalab/icons-glyph/CalendarMIcon');
13
14
  require('./utils/format.js');
14
15
  require('date-fns/isValid');
@@ -57,14 +57,14 @@ type DateTimeInputProps = Omit<InputProps, 'onChange'> & {
57
57
  /**
58
58
  * Обработчик изменения значения
59
59
  */
60
- onChange?: (event: ChangeEvent<HTMLInputElement>, payload: {
60
+ onChange?: (event: ChangeEvent<HTMLInputElement> | null, payload: {
61
61
  date: Date;
62
62
  value: string;
63
63
  }) => void;
64
64
  /**
65
65
  * Обработчик окончания ввода
66
66
  */
67
- onComplete?: (event: ChangeEvent<HTMLInputElement>, payload: {
67
+ onComplete?: (event: ChangeEvent<HTMLInputElement> | null, payload: {
68
68
  date: Date;
69
69
  value: string;
70
70
  }) => void;
@@ -146,14 +146,14 @@ declare const DateTimeInput: React.ForwardRefExoticComponent<Omit<InputProps, "o
146
146
  /**
147
147
  * Обработчик изменения значения
148
148
  */
149
- onChange?: ((event: ChangeEvent<HTMLInputElement>, payload: {
149
+ onChange?: ((event: ChangeEvent<HTMLInputElement> | null, payload: {
150
150
  date: Date;
151
151
  value: string;
152
152
  }) => void) | undefined;
153
153
  /**
154
154
  * Обработчик окончания ввода
155
155
  */
156
- onComplete?: ((event: ChangeEvent<HTMLInputElement>, payload: {
156
+ onComplete?: ((event: ChangeEvent<HTMLInputElement> | null, payload: {
157
157
  date: Date;
158
158
  value: string;
159
159
  }) => void) | undefined;
@@ -166,9 +166,6 @@ declare const DateTimeInput: React.ForwardRefExoticComponent<Omit<InputProps, "o
166
166
  */
167
167
  calendarProps?: (CalendarProps & Record<string, unknown>) | (CalendarProps & {
168
168
  open: boolean;
169
- /**
170
- * Дополнительный класс для поповера
171
- */
172
169
  title?: string | undefined;
173
170
  onClose?: (() => void) | undefined;
174
171
  yearsAmount?: number | undefined;
@@ -5,8 +5,9 @@ import { Calendar, dateInLimits } from '@alfalab/core-components-calendar/esm';
5
5
  import { IconButton } from '@alfalab/core-components-icon-button/esm';
6
6
  import { Input } from '@alfalab/core-components-input/esm';
7
7
  import { Popover } from '@alfalab/core-components-popover/esm';
8
+ import { useDidUpdateEffect } from '@alfalab/hooks';
8
9
  import { CalendarMIcon } from '@alfalab/icons-glyph/CalendarMIcon';
9
- import { getDateWithoutTime, setTimeToDate, DATE_MASK, format, getFullDateTime, isCompleteDateInput, isValid, parseTimestampToDate } from './utils/format.js';
10
+ import { getDateWithoutTime, DATE_WITH_TIME_LENGTH, format, getFullDateTime, isCompleteDateInput, isValid, addTimeToDate, parseTimestampToDate } from './utils/format.js';
10
11
 
11
12
  /******************************************************************************
12
13
  Copyright (c) Microsoft Corporation.
@@ -47,7 +48,7 @@ function __rest(s, e) {
47
48
  return t;
48
49
  }
49
50
 
50
- var styles = {"component":"date-time-input__component_1u4x2","calendarContainer":"date-time-input__calendarContainer_1u4x2","calendarResponsive":"date-time-input__calendarResponsive_1u4x2","block":"date-time-input__block_1u4x2"};
51
+ var styles = {"component":"date-time-input__component_wum5f","calendarContainer":"date-time-input__calendarContainer_wum5f","calendarResponsive":"date-time-input__calendarResponsive_wum5f","block":"date-time-input__block_wum5f"};
51
52
  require('./components/date-time-input/index.css')
52
53
 
53
54
  /* eslint-disable no-useless-escape, jsx-a11y/click-events-have-key-events */
@@ -65,6 +66,10 @@ var DateTimeInput = React.forwardRef(function (_a, ref) {
65
66
  useEffect(function () {
66
67
  setOpen(defaultOpen);
67
68
  }, [defaultOpen]);
69
+ useDidUpdateEffect(function () {
70
+ var newPropValue = propValue || '';
71
+ setValue(function (prevValue) { return (prevValue === propValue ? prevValue : newPropValue); });
72
+ }, [propValue]);
68
73
  var checkInputValueIsValid = function (newInputValue) {
69
74
  if (!newInputValue || error)
70
75
  return false;
@@ -73,8 +78,23 @@ var DateTimeInput = React.forwardRef(function (_a, ref) {
73
78
  dateInLimits(dateValue, minDate, maxDate) &&
74
79
  !offDays.includes(dateValue));
75
80
  };
81
+ var setTimeToDate = function () {
82
+ setValue(function (prevValue) {
83
+ var dateWithTime = addTimeToDate(prevValue);
84
+ if (dateWithTime !== prevValue && dateWithTime.length === DATE_WITH_TIME_LENGTH) {
85
+ onComplete === null || onComplete === void 0 ? void 0 : onComplete(null, {
86
+ date: getFullDateTime(dateWithTime),
87
+ value: dateWithTime,
88
+ });
89
+ }
90
+ return dateWithTime;
91
+ });
92
+ };
76
93
  var handleInputWrapperFocus = function (event) {
77
94
  if (view === 'desktop') {
95
+ if (picker) {
96
+ setOpen(true);
97
+ }
78
98
  if (!open && event.target.tagName !== 'INPUT' && calendarRef.current) {
79
99
  calendarRef.current.focus();
80
100
  }
@@ -85,21 +105,21 @@ var DateTimeInput = React.forwardRef(function (_a, ref) {
85
105
  var target = (event.relatedTarget || document.activeElement);
86
106
  if (calendarRef.current && calendarRef.current.contains(target) === false) {
87
107
  setOpen(false);
88
- setValue(function (prevValue) { return setTimeToDate(prevValue); });
108
+ setTimeToDate();
89
109
  }
90
110
  }
91
111
  };
92
112
  var handleChange = function (event) {
93
113
  var newValue = event.target.value;
94
- if (newValue.length > DATE_MASK.length)
114
+ if (newValue.length > DATE_WITH_TIME_LENGTH)
95
115
  return;
96
116
  // Позволяем вводить только цифры, точки, запятую, двоеточие и пробел
97
- if (/[^\d., :\d.]/.test(newValue)) {
117
+ if (/[^\d., :]/.test(newValue)) {
98
118
  return;
99
119
  }
100
120
  var dots = newValue.match(/\./g);
101
- var colon = newValue.match(/\:/g);
102
- var comma = newValue.match(/\,/g);
121
+ var colon = newValue.match(/:/g);
122
+ var comma = newValue.match(/,/g);
103
123
  // Не даем вводить больше, чем 2 точки, 1 двоеточие и 1 запятую
104
124
  if ((dots && dots.length > 2) ||
105
125
  (colon && colon.length > 1) ||
@@ -120,37 +140,38 @@ var DateTimeInput = React.forwardRef(function (_a, ref) {
120
140
  }
121
141
  }
122
142
  };
123
- var handleCalendarClose = function () {
143
+ var handleMobileCalendarClose = function () {
124
144
  setOpen(false);
145
+ setTimeToDate();
125
146
  };
126
147
  var handleClear = function () {
127
148
  setValue('');
128
149
  };
129
150
  var handleCalendarChange = function (date) {
130
151
  if (date) {
131
- setValue(parseTimestampToDate(date));
152
+ var newValue = parseTimestampToDate(date);
153
+ setValue(newValue);
154
+ onChange === null || onChange === void 0 ? void 0 : onChange(null, { date: getFullDateTime(newValue), value: newValue });
132
155
  }
133
156
  };
134
157
  var handleCalendarWrapperMouseDown = function (event) {
135
158
  // Не дает инпуту терять фокус при выборе даты
136
159
  event.preventDefault();
137
160
  };
138
- var handleInputWrapperClick = function () {
139
- if (view === 'desktop' && !open) {
140
- setOpen(true);
141
- }
142
- };
143
161
  var handleIconButtonClick = function () {
144
162
  if (!open)
145
163
  setOpen(true);
164
+ if (view === 'desktop' && inputRef.current) {
165
+ inputRef.current.focus();
166
+ }
146
167
  };
147
168
  var renderCalendar = function () { return (
148
169
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
149
170
  React.createElement("div", { onMouseDown: handleCalendarWrapperMouseDown },
150
- React.createElement(Calendar$1, __assign({}, calendarProps, { responsive: calendarResponsive, open: open, onClose: handleCalendarClose, ref: calendarRef, defaultMonth: defaultMonth, value: checkInputValueIsValid(value) ? calendarValue : undefined, onChange: handleCalendarChange, minDate: minDate, maxDate: maxDate, offDays: offDays, events: events })))); };
171
+ React.createElement(Calendar$1, __assign({}, calendarProps, { responsive: calendarResponsive, open: open, onClose: handleMobileCalendarClose, ref: calendarRef, defaultMonth: defaultMonth, value: checkInputValueIsValid(value) ? calendarValue : undefined, onChange: handleCalendarChange, minDate: minDate, maxDate: maxDate, offDays: offDays, events: events })))); };
151
172
  return (React.createElement("div", { className: cn(styles.component, className, (_b = {},
152
173
  _b[styles.block] = block,
153
- _b)), onClick: inputDisabled ? undefined : handleInputWrapperClick, onFocus: inputDisabled ? undefined : handleInputWrapperFocus, onBlur: handleBlur },
174
+ _b)), onFocus: inputDisabled ? undefined : handleInputWrapperFocus, onBlur: handleBlur },
154
175
  React.createElement(Input, __assign({}, restProps, { block: block, ref: mergeRefs([ref, inputRef]), value: value, onChange: handleChange, disabled: disabled, readOnly: readOnly, className: inputClassName, onClear: handleClear, error: error, rightAddons: React.createElement(React.Fragment, null,
155
176
  rightAddons,
156
177
  picker && (React.createElement(IconButton, { onClick: inputDisabled ? undefined : handleIconButtonClick, icon: CalendarMIcon, size: 'xxs' }))) })),
@@ -1,5 +1,5 @@
1
1
  import { FC } from 'react';
2
- import { DateTimeInputProps } from "./Component-e82a534f";
2
+ import { DateTimeInputProps } from "./Component-074b6874";
3
3
  type DateTimeInputDesktopProps = Omit<DateTimeInputProps, 'view'>;
4
4
  declare const DateTimeInputDesktop: FC<DateTimeInputDesktopProps>;
5
5
  export { DateTimeInputDesktopProps, DateTimeInputDesktop };
@@ -1,4 +1,4 @@
1
- import { D as DateTimeInput, _ as __assign } from './Component-e82a534f.js';
1
+ import { D as DateTimeInput, _ as __assign } from './Component-074b6874.js';
2
2
  import React from 'react';
3
3
  import 'react-merge-refs';
4
4
  import 'classnames';
@@ -6,6 +6,7 @@ import '@alfalab/core-components-calendar/esm';
6
6
  import '@alfalab/core-components-icon-button/esm';
7
7
  import '@alfalab/core-components-input/esm';
8
8
  import '@alfalab/core-components-popover/esm';
9
+ import '@alfalab/hooks';
9
10
  import '@alfalab/icons-glyph/CalendarMIcon';
10
11
  import './utils/format.js';
11
12
  import 'date-fns/isValid';
@@ -1,5 +1,5 @@
1
1
  import { FC } from 'react';
2
- import { DateTimeInputProps } from "./Component-e82a534f";
2
+ import { DateTimeInputProps } from "./Component-074b6874";
3
3
  type DateTimeInputMobileProps = Omit<DateTimeInputProps, 'view'>;
4
4
  declare const DateTimeInputMobile: FC<DateTimeInputMobileProps>;
5
5
  export { DateTimeInputMobileProps, DateTimeInputMobile };
@@ -1,4 +1,4 @@
1
- import { D as DateTimeInput, _ as __assign } from './Component-e82a534f.js';
1
+ import { D as DateTimeInput, _ as __assign } from './Component-074b6874.js';
2
2
  import React from 'react';
3
3
  import { CalendarMobile } from '@alfalab/core-components-calendar/esm';
4
4
  import 'react-merge-refs';
@@ -6,6 +6,7 @@ import 'classnames';
6
6
  import '@alfalab/core-components-icon-button/esm';
7
7
  import '@alfalab/core-components-input/esm';
8
8
  import '@alfalab/core-components-popover/esm';
9
+ import '@alfalab/hooks';
9
10
  import '@alfalab/icons-glyph/CalendarMIcon';
10
11
  import './utils/format.js';
11
12
  import 'date-fns/isValid';
@@ -1,5 +1,5 @@
1
1
  import { FC } from 'react';
2
- import { DateTimeInputProps } from "./Component-e82a534f";
2
+ import { DateTimeInputProps } from "./Component-074b6874";
3
3
  type DateTimeInputResponsiveProps = Omit<DateTimeInputProps, 'view'> & {
4
4
  /**
5
5
  * Контрольная точка, с нее начинается desktop версия
@@ -1,4 +1,4 @@
1
- import { a as __rest, _ as __assign } from './Component-e82a534f.js';
1
+ import { a as __rest, _ as __assign } from './Component-074b6874.js';
2
2
  import React from 'react';
3
3
  import { useMedia } from '@alfalab/hooks';
4
4
  import { DateTimeInputDesktop } from './Component.desktop.js';
@@ -1,4 +1,4 @@
1
- export { D as DateTimeInput } from '../../Component-e82a534f.js';
1
+ export { D as DateTimeInput } from '../../Component-074b6874.js';
2
2
  import 'react';
3
3
  import 'react-merge-refs';
4
4
  import 'classnames';
@@ -6,6 +6,7 @@ import '@alfalab/core-components-calendar/esm';
6
6
  import '@alfalab/core-components-icon-button/esm';
7
7
  import '@alfalab/core-components-input/esm';
8
8
  import '@alfalab/core-components-popover/esm';
9
+ import '@alfalab/hooks';
9
10
  import '@alfalab/icons-glyph/CalendarMIcon';
10
11
  import '../../utils/format.js';
11
12
  import 'date-fns/isValid';
@@ -1,4 +1,4 @@
1
- /* hash: 1e3mm */
1
+ /* hash: 9vegz */
2
2
  :root {
3
3
 
4
4
  /* Hard */
@@ -11,7 +11,7 @@
11
11
  --gap-m: 16px;
12
12
  }
13
13
  :root {
14
- --border-radius-s: 4px;
14
+ --border-radius-m: 8px;
15
15
  }
16
16
  :root {
17
17
  --calendar-width: 344px;
@@ -37,28 +37,28 @@
37
37
  /* marker */
38
38
  }
39
39
  :root {
40
- --calendar-popover-border-radius: 0 0 var(--border-radius-s) var(--border-radius-s);
40
+ --calendar-popover-border-radius: var(--border-radius-m);
41
41
  }
42
- .date-time-input__component_1u4x2 {
42
+ .date-time-input__component_wum5f {
43
43
  display: inline-block;
44
44
  outline: none;
45
45
  position: relative;
46
46
  }
47
- .date-time-input__calendarContainer_1u4x2 {
47
+ .date-time-input__calendarContainer_wum5f {
48
48
  display: inline-block;
49
49
  box-sizing: border-box;
50
50
  border-radius: var(--calendar-popover-border-radius)
51
51
  }
52
52
  @media (max-width: 374px) {
53
- .date-time-input__calendarContainer_1u4x2 {
53
+ .date-time-input__calendarContainer_wum5f {
54
54
  width: 100%;
55
55
  min-width: 288px
56
56
  }
57
57
  }
58
- .date-time-input__calendarResponsive_1u4x2 {
58
+ .date-time-input__calendarResponsive_wum5f {
59
59
  width: var(--calendar-width);
60
60
  padding: 0 var(--gap-m);
61
61
  }
62
- .date-time-input__block_1u4x2 {
62
+ .date-time-input__block_wum5f {
63
63
  width: 100%;
64
64
  }
@@ -1 +1 @@
1
- export * from "../../Component-e82a534f";
1
+ export * from "../../Component-074b6874";
@@ -1,4 +1,4 @@
1
- export { D as DateTimeInput } from '../../Component-e82a534f.js';
1
+ export { D as DateTimeInput } from '../../Component-074b6874.js';
2
2
  import 'react';
3
3
  import 'react-merge-refs';
4
4
  import 'classnames';
@@ -6,6 +6,7 @@ import '@alfalab/core-components-calendar/esm';
6
6
  import '@alfalab/core-components-icon-button/esm';
7
7
  import '@alfalab/core-components-input/esm';
8
8
  import '@alfalab/core-components-popover/esm';
9
+ import '@alfalab/hooks';
9
10
  import '@alfalab/icons-glyph/CalendarMIcon';
10
11
  import '../../utils/format.js';
11
12
  import 'date-fns/isValid';
package/esm/desktop.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { DateTimeInputDesktop } from './Component.desktop.js';
2
- import './Component-e82a534f.js';
2
+ import './Component-074b6874.js';
3
3
  import 'react';
4
4
  import 'react-merge-refs';
5
5
  import 'classnames';
@@ -7,6 +7,7 @@ import '@alfalab/core-components-calendar/esm';
7
7
  import '@alfalab/core-components-icon-button/esm';
8
8
  import '@alfalab/core-components-input/esm';
9
9
  import '@alfalab/core-components-popover/esm';
10
+ import '@alfalab/hooks';
10
11
  import '@alfalab/icons-glyph/CalendarMIcon';
11
12
  import './utils/format.js';
12
13
  import 'date-fns/isValid';
package/esm/index.d.ts CHANGED
@@ -1 +1,2 @@
1
- export { DateTimeInputResponsive as DateTimeInput, DateTimeInputResponsiveProps as DateTimeInputProps } from "./responsive";
1
+ export { DateTimeInputResponsive as DateTimeInput } from "./responsive";
2
+ export type { DateTimeInputResponsiveProps as DateTimeInputProps } from "./responsive";
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { DateTimeInputResponsive as DateTimeInput } from './Component.responsive.js';
2
- import './Component-e82a534f.js';
2
+ import './Component-074b6874.js';
3
3
  import 'react';
4
4
  import 'react-merge-refs';
5
5
  import 'classnames';
@@ -7,10 +7,10 @@ import '@alfalab/core-components-calendar/esm';
7
7
  import '@alfalab/core-components-icon-button/esm';
8
8
  import '@alfalab/core-components-input/esm';
9
9
  import '@alfalab/core-components-popover/esm';
10
+ import '@alfalab/hooks';
10
11
  import '@alfalab/icons-glyph/CalendarMIcon';
11
12
  import './utils/format.js';
12
13
  import 'date-fns/isValid';
13
14
  import 'date-fns/parse';
14
- import '@alfalab/hooks';
15
15
  import './Component.desktop.js';
16
16
  import './Component.mobile.js';
package/esm/mobile.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { DateTimeInputMobile } from './Component.mobile.js';
2
- import './Component-e82a534f.js';
2
+ import './Component-074b6874.js';
3
3
  import 'react';
4
4
  import 'react-merge-refs';
5
5
  import 'classnames';
@@ -7,6 +7,7 @@ import '@alfalab/core-components-calendar/esm';
7
7
  import '@alfalab/core-components-icon-button/esm';
8
8
  import '@alfalab/core-components-input/esm';
9
9
  import '@alfalab/core-components-popover/esm';
10
+ import '@alfalab/hooks';
10
11
  import '@alfalab/icons-glyph/CalendarMIcon';
11
12
  import './utils/format.js';
12
13
  import 'date-fns/isValid';
package/esm/responsive.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { DateTimeInputResponsive } from './Component.responsive.js';
2
- import './Component-e82a534f.js';
2
+ import './Component-074b6874.js';
3
3
  import 'react';
4
4
  import 'react-merge-refs';
5
5
  import 'classnames';
@@ -7,10 +7,10 @@ import '@alfalab/core-components-calendar/esm';
7
7
  import '@alfalab/core-components-icon-button/esm';
8
8
  import '@alfalab/core-components-input/esm';
9
9
  import '@alfalab/core-components-popover/esm';
10
+ import '@alfalab/hooks';
10
11
  import '@alfalab/icons-glyph/CalendarMIcon';
11
12
  import './utils/format.js';
12
13
  import 'date-fns/isValid';
13
14
  import 'date-fns/parse';
14
- import '@alfalab/hooks';
15
15
  import './Component.desktop.js';
16
16
  import './Component.mobile.js';
@@ -1,5 +1,6 @@
1
1
  declare const DATE_FORMAT = "dd.MM.yyyy";
2
2
  declare const DATE_MASK: (string | RegExp)[];
3
+ declare const DATE_WITH_TIME_LENGTH: number;
3
4
  declare const isCompleteDateInput: (input: string) => boolean;
4
5
  declare const parseDateString: (value: string, dateFormat?: string) => Date;
5
6
  declare const isValidTimeFormat: (value: string) => boolean;
@@ -8,5 +9,5 @@ declare const format: (value: string) => string;
8
9
  declare const parseTimestampToDate: (timestamp: number) => string;
9
10
  declare const getDateWithoutTime: (value: string) => Date;
10
11
  declare const getFullDateTime: (value: string) => Date;
11
- declare const setTimeToDate: (value: string) => string;
12
- export { DATE_FORMAT, DATE_MASK, isCompleteDateInput, parseDateString, isValidTimeFormat, isValid, format, parseTimestampToDate, getDateWithoutTime, getFullDateTime, setTimeToDate };
12
+ declare const addTimeToDate: (value: string) => string;
13
+ export { DATE_FORMAT, DATE_MASK, DATE_WITH_TIME_LENGTH, isCompleteDateInput, parseDateString, isValidTimeFormat, isValid, format, parseTimestampToDate, getDateWithoutTime, getFullDateTime, addTimeToDate };
@@ -22,7 +22,8 @@ var DATE_MASK = [
22
22
  /\d/,
23
23
  /\d/,
24
24
  ];
25
- var isCompleteDateInput = function (input) { return input.length === DATE_MASK.length; };
25
+ var DATE_WITH_TIME_LENGTH = DATE_MASK.length;
26
+ var isCompleteDateInput = function (input) { return input.length === DATE_WITH_TIME_LENGTH; };
26
27
  var parseDateString = function (value, dateFormat) {
27
28
  if (dateFormat === void 0) { dateFormat = DATE_FORMAT; }
28
29
  return parse(value, dateFormat, new Date());
@@ -116,13 +117,15 @@ var getFullDateTime = function (value) {
116
117
  fullDate.setFullYear(Number(year), Number(month) - 1, Number(day));
117
118
  fullDate.setHours(Number(hours) || 0);
118
119
  fullDate.setMinutes(Number(mins) || 0);
120
+ fullDate.setSeconds(0);
121
+ fullDate.setMilliseconds(0);
119
122
  return fullDate;
120
123
  };
121
- var setTimeToDate = function (value) {
124
+ var addTimeToDate = function (value) {
122
125
  if (value.length === 10 && dateFnsIsValid(parseDateString(value))) {
123
126
  return "".concat(value, ", 00:00");
124
127
  }
125
128
  return value;
126
129
  };
127
130
 
128
- export { DATE_FORMAT, DATE_MASK, format, getDateWithoutTime, getFullDateTime, isCompleteDateInput, isValid, isValidTimeFormat, parseDateString, parseTimestampToDate, setTimeToDate };
131
+ export { DATE_FORMAT, DATE_MASK, DATE_WITH_TIME_LENGTH, addTimeToDate, format, getDateWithoutTime, getFullDateTime, isCompleteDateInput, isValid, isValidTimeFormat, parseDateString, parseTimestampToDate };
@@ -1,3 +1,3 @@
1
- export { DATE_FORMAT, DATE_MASK, format, getDateWithoutTime, getFullDateTime, isCompleteDateInput, isValid, isValidTimeFormat, parseDateString, parseTimestampToDate, setTimeToDate } from './format.js';
1
+ export { DATE_FORMAT, DATE_MASK, DATE_WITH_TIME_LENGTH, addTimeToDate, format, getDateWithoutTime, getFullDateTime, isCompleteDateInput, isValid, isValidTimeFormat, parseDateString, parseTimestampToDate } from './format.js';
2
2
  import 'date-fns/isValid';
3
3
  import 'date-fns/parse';
package/index.d.ts CHANGED
@@ -1 +1,2 @@
1
- export { DateTimeInputResponsive as DateTimeInput, DateTimeInputResponsiveProps as DateTimeInputProps } from "./responsive";
1
+ export { DateTimeInputResponsive as DateTimeInput } from "./responsive";
2
+ export type { DateTimeInputResponsiveProps as DateTimeInputProps } from "./responsive";
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var Component_responsive = require('./Component.responsive.js');
4
- require('./Component-27749cf7.js');
4
+ require('./Component-1ff76732.js');
5
5
  require('react');
6
6
  require('react-merge-refs');
7
7
  require('classnames');
@@ -9,11 +9,11 @@ require('@alfalab/core-components-calendar');
9
9
  require('@alfalab/core-components-icon-button');
10
10
  require('@alfalab/core-components-input');
11
11
  require('@alfalab/core-components-popover');
12
+ require('@alfalab/hooks');
12
13
  require('@alfalab/icons-glyph/CalendarMIcon');
13
14
  require('./utils/format.js');
14
15
  require('date-fns/isValid');
15
16
  require('date-fns/parse');
16
- require('@alfalab/hooks');
17
17
  require('./Component.desktop.js');
18
18
  require('./Component.mobile.js');
19
19
 
package/mobile.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var Component_mobile = require('./Component.mobile.js');
4
- require('./Component-27749cf7.js');
4
+ require('./Component-1ff76732.js');
5
5
  require('react');
6
6
  require('react-merge-refs');
7
7
  require('classnames');
@@ -9,6 +9,7 @@ require('@alfalab/core-components-calendar');
9
9
  require('@alfalab/core-components-icon-button');
10
10
  require('@alfalab/core-components-input');
11
11
  require('@alfalab/core-components-popover');
12
+ require('@alfalab/hooks');
12
13
  require('@alfalab/icons-glyph/CalendarMIcon');
13
14
  require('./utils/format.js');
14
15
  require('date-fns/isValid');