@alfalab/core-components-date-time-input 2.1.2 → 2.2.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 (90) hide show
  1. package/{esm/Component.d.ts → Component-27749cf7.d.ts} +47 -3
  2. package/{Component.js → Component-27749cf7.js} +20 -29
  3. package/Component.desktop.d.ts +5 -0
  4. package/Component.desktop.js +22 -0
  5. package/Component.mobile.d.ts +5 -0
  6. package/Component.mobile.js +22 -0
  7. package/Component.responsive.d.ts +12 -0
  8. package/Component.responsive.js +32 -0
  9. package/components/date-time-input/Component.d.ts +0 -0
  10. package/components/date-time-input/Component.js +18 -0
  11. package/{esm → components/date-time-input}/index.css +6 -6
  12. package/components/date-time-input/index.d.ts +1 -0
  13. package/components/date-time-input/index.js +18 -0
  14. package/cssm/{Component.d.ts → Component-d6110aa7.d.ts} +47 -3
  15. package/cssm/{Component.js → Component-d6110aa7.js} +22 -31
  16. package/cssm/Component.desktop.d.ts +5 -0
  17. package/cssm/Component.desktop.js +23 -0
  18. package/cssm/Component.mobile.d.ts +5 -0
  19. package/cssm/Component.mobile.js +23 -0
  20. package/cssm/Component.responsive.d.ts +12 -0
  21. package/cssm/Component.responsive.js +33 -0
  22. package/cssm/components/date-time-input/Component.d.ts +0 -0
  23. package/cssm/components/date-time-input/Component.js +19 -0
  24. package/cssm/components/date-time-input/index.d.ts +1 -0
  25. package/cssm/components/date-time-input/index.js +19 -0
  26. package/cssm/{index.module.css → components/date-time-input/index.module.css} +0 -0
  27. package/cssm/desktop.d.ts +2 -0
  28. package/cssm/desktop.js +20 -0
  29. package/cssm/index.d.ts +1 -1
  30. package/cssm/index.js +8 -7
  31. package/cssm/mobile.d.ts +2 -0
  32. package/cssm/mobile.js +20 -0
  33. package/cssm/responsive.d.ts +2 -0
  34. package/cssm/responsive.js +23 -0
  35. package/cssm/utils/format.js +10 -12
  36. package/cssm/utils/index.js +1 -3
  37. package/desktop.d.ts +2 -0
  38. package/desktop.js +19 -0
  39. package/{modern/Component.d.ts → esm/Component-e82a534f.d.ts} +47 -3
  40. package/esm/{Component.js → Component-e82a534f.js} +8 -16
  41. package/esm/Component.desktop.d.ts +5 -0
  42. package/esm/Component.desktop.js +16 -0
  43. package/esm/Component.mobile.d.ts +5 -0
  44. package/esm/Component.mobile.js +16 -0
  45. package/esm/Component.responsive.d.ts +12 -0
  46. package/esm/Component.responsive.js +26 -0
  47. package/esm/components/date-time-input/Component.d.ts +0 -0
  48. package/esm/components/date-time-input/Component.js +12 -0
  49. package/{index.css → esm/components/date-time-input/index.css} +6 -6
  50. package/esm/components/date-time-input/index.d.ts +1 -0
  51. package/esm/components/date-time-input/index.js +12 -0
  52. package/esm/desktop.d.ts +2 -0
  53. package/esm/desktop.js +13 -0
  54. package/esm/index.d.ts +1 -1
  55. package/esm/index.js +6 -3
  56. package/esm/mobile.d.ts +2 -0
  57. package/esm/mobile.js +13 -0
  58. package/esm/responsive.d.ts +2 -0
  59. package/esm/responsive.js +16 -0
  60. package/esm/utils/format.js +4 -4
  61. package/esm/utils/index.js +1 -1
  62. package/index.d.ts +1 -1
  63. package/index.js +7 -6
  64. package/mobile.d.ts +2 -0
  65. package/mobile.js +19 -0
  66. package/modern/Component.desktop.d.ts +5 -0
  67. package/modern/Component.desktop.js +16 -0
  68. package/modern/Component.mobile.d.ts +5 -0
  69. package/modern/Component.mobile.js +16 -0
  70. package/modern/Component.responsive.d.ts +12 -0
  71. package/modern/Component.responsive.js +25 -0
  72. package/{Component.d.ts → modern/components/date-time-input/Component.d.ts} +13 -2
  73. package/modern/{Component.js → components/date-time-input/Component.js} +5 -11
  74. package/modern/{index.css → components/date-time-input/index.css} +6 -6
  75. package/modern/components/date-time-input/index.d.ts +1 -0
  76. package/modern/components/date-time-input/index.js +12 -0
  77. package/modern/desktop.d.ts +2 -0
  78. package/modern/desktop.js +13 -0
  79. package/modern/index.d.ts +1 -1
  80. package/modern/index.js +6 -3
  81. package/modern/mobile.d.ts +2 -0
  82. package/modern/mobile.js +13 -0
  83. package/modern/responsive.d.ts +2 -0
  84. package/modern/responsive.js +16 -0
  85. package/modern/utils/index.js +1 -1
  86. package/package.json +5 -5
  87. package/responsive.d.ts +2 -0
  88. package/responsive.js +22 -0
  89. package/utils/format.js +10 -12
  90. package/utils/index.js +1 -3
@@ -0,0 +1,12 @@
1
+ export { D as DateTimeInput } from '../../Component-e82a534f.js';
2
+ import 'react';
3
+ import 'react-merge-refs';
4
+ import 'classnames';
5
+ import '@alfalab/core-components-calendar/esm';
6
+ import '@alfalab/core-components-icon-button/esm';
7
+ import '@alfalab/core-components-input/esm';
8
+ import '@alfalab/core-components-popover/esm';
9
+ import '@alfalab/icons-glyph/CalendarMIcon';
10
+ import '../../utils/format.js';
11
+ import 'date-fns/isValid';
12
+ import 'date-fns/parse';
@@ -0,0 +1,2 @@
1
+ export * from "./Component.desktop";
2
+ export {};
package/esm/desktop.js ADDED
@@ -0,0 +1,13 @@
1
+ export { DateTimeInputDesktop } from './Component.desktop.js';
2
+ import './Component-e82a534f.js';
3
+ import 'react';
4
+ import 'react-merge-refs';
5
+ import 'classnames';
6
+ import '@alfalab/core-components-calendar/esm';
7
+ import '@alfalab/core-components-icon-button/esm';
8
+ import '@alfalab/core-components-input/esm';
9
+ import '@alfalab/core-components-popover/esm';
10
+ import '@alfalab/icons-glyph/CalendarMIcon';
11
+ import './utils/format.js';
12
+ import 'date-fns/isValid';
13
+ import 'date-fns/parse';
package/esm/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from "./Component";
1
+ export { DateTimeInputResponsive as DateTimeInput, DateTimeInputResponsiveProps as DateTimeInputProps } from "./responsive";
package/esm/index.js CHANGED
@@ -1,4 +1,5 @@
1
- export { DateTimeInput } from './Component.js';
1
+ export { DateTimeInputResponsive as DateTimeInput } from './Component.responsive.js';
2
+ import './Component-e82a534f.js';
2
3
  import 'react';
3
4
  import 'react-merge-refs';
4
5
  import 'classnames';
@@ -6,8 +7,10 @@ import '@alfalab/core-components-calendar/esm';
6
7
  import '@alfalab/core-components-icon-button/esm';
7
8
  import '@alfalab/core-components-input/esm';
8
9
  import '@alfalab/core-components-popover/esm';
9
- import '@alfalab/hooks';
10
10
  import '@alfalab/icons-glyph/CalendarMIcon';
11
+ import './utils/format.js';
11
12
  import 'date-fns/isValid';
12
13
  import 'date-fns/parse';
13
- import './utils/format.js';
14
+ import '@alfalab/hooks';
15
+ import './Component.desktop.js';
16
+ import './Component.mobile.js';
@@ -0,0 +1,2 @@
1
+ export * from "./Component.mobile";
2
+ export {};
package/esm/mobile.js ADDED
@@ -0,0 +1,13 @@
1
+ export { DateTimeInputMobile } from './Component.mobile.js';
2
+ import './Component-e82a534f.js';
3
+ import 'react';
4
+ import 'react-merge-refs';
5
+ import 'classnames';
6
+ import '@alfalab/core-components-calendar/esm';
7
+ import '@alfalab/core-components-icon-button/esm';
8
+ import '@alfalab/core-components-input/esm';
9
+ import '@alfalab/core-components-popover/esm';
10
+ import '@alfalab/icons-glyph/CalendarMIcon';
11
+ import './utils/format.js';
12
+ import 'date-fns/isValid';
13
+ import 'date-fns/parse';
@@ -0,0 +1,2 @@
1
+ export * from "./Component.responsive";
2
+ export {};
@@ -0,0 +1,16 @@
1
+ export { DateTimeInputResponsive } from './Component.responsive.js';
2
+ import './Component-e82a534f.js';
3
+ import 'react';
4
+ import 'react-merge-refs';
5
+ import 'classnames';
6
+ import '@alfalab/core-components-calendar/esm';
7
+ import '@alfalab/core-components-icon-button/esm';
8
+ import '@alfalab/core-components-input/esm';
9
+ import '@alfalab/core-components-popover/esm';
10
+ import '@alfalab/icons-glyph/CalendarMIcon';
11
+ import './utils/format.js';
12
+ import 'date-fns/isValid';
13
+ import 'date-fns/parse';
14
+ import '@alfalab/hooks';
15
+ import './Component.desktop.js';
16
+ import './Component.mobile.js';
@@ -75,12 +75,12 @@ var parseTimestampToDate = function (timestamp) {
75
75
  var month = date.getMonth() + 1;
76
76
  var day = date.getDate();
77
77
  if (month < 10) {
78
- month = "0" + month;
78
+ month = "0".concat(month);
79
79
  }
80
80
  if (day < 10) {
81
- day = "0" + day;
81
+ day = "0".concat(day);
82
82
  }
83
- return day + "." + month + "." + year;
83
+ return "".concat(day, ".").concat(month, ".").concat(year);
84
84
  };
85
85
  var getDateWithoutTime = function (value) {
86
86
  var valueArr = value.split(', ');
@@ -120,7 +120,7 @@ var getFullDateTime = function (value) {
120
120
  };
121
121
  var setTimeToDate = function (value) {
122
122
  if (value.length === 10 && dateFnsIsValid(parseDateString(value))) {
123
- return value + ", 00:00";
123
+ return "".concat(value, ", 00:00");
124
124
  }
125
125
  return value;
126
126
  };
@@ -1,3 +1,3 @@
1
+ export { DATE_FORMAT, DATE_MASK, format, getDateWithoutTime, getFullDateTime, isCompleteDateInput, isValid, isValidTimeFormat, parseDateString, parseTimestampToDate, setTimeToDate } from './format.js';
1
2
  import 'date-fns/isValid';
2
3
  import 'date-fns/parse';
3
- export { DATE_FORMAT, DATE_MASK, format, getDateWithoutTime, getFullDateTime, isCompleteDateInput, isValid, isValidTimeFormat, parseDateString, parseTimestampToDate, setTimeToDate } from './format.js';
package/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from "./Component";
1
+ export { DateTimeInputResponsive as DateTimeInput, DateTimeInputResponsiveProps as DateTimeInputProps } from "./responsive";
package/index.js CHANGED
@@ -1,8 +1,7 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var Component = require('./Component.js');
3
+ var Component_responsive = require('./Component.responsive.js');
4
+ require('./Component-27749cf7.js');
6
5
  require('react');
7
6
  require('react-merge-refs');
8
7
  require('classnames');
@@ -10,12 +9,14 @@ require('@alfalab/core-components-calendar');
10
9
  require('@alfalab/core-components-icon-button');
11
10
  require('@alfalab/core-components-input');
12
11
  require('@alfalab/core-components-popover');
13
- require('@alfalab/hooks');
14
12
  require('@alfalab/icons-glyph/CalendarMIcon');
13
+ require('./utils/format.js');
15
14
  require('date-fns/isValid');
16
15
  require('date-fns/parse');
17
- require('./utils/format.js');
16
+ require('@alfalab/hooks');
17
+ require('./Component.desktop.js');
18
+ require('./Component.mobile.js');
18
19
 
19
20
 
20
21
 
21
- exports.DateTimeInput = Component.DateTimeInput;
22
+ exports.DateTimeInput = Component_responsive.DateTimeInputResponsive;
package/mobile.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./Component.mobile";
2
+ export {};
package/mobile.js ADDED
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ var Component_mobile = require('./Component.mobile.js');
4
+ require('./Component-27749cf7.js');
5
+ require('react');
6
+ require('react-merge-refs');
7
+ require('classnames');
8
+ require('@alfalab/core-components-calendar');
9
+ require('@alfalab/core-components-icon-button');
10
+ require('@alfalab/core-components-input');
11
+ require('@alfalab/core-components-popover');
12
+ require('@alfalab/icons-glyph/CalendarMIcon');
13
+ require('./utils/format.js');
14
+ require('date-fns/isValid');
15
+ require('date-fns/parse');
16
+
17
+
18
+
19
+ exports.DateTimeInputMobile = Component_mobile.DateTimeInputMobile;
@@ -0,0 +1,5 @@
1
+ import { FC } from 'react';
2
+ import { DateTimeInputProps } from "./components/date-time-input/Component";
3
+ type DateTimeInputDesktopProps = Omit<DateTimeInputProps, 'view'>;
4
+ declare const DateTimeInputDesktop: FC<DateTimeInputDesktopProps>;
5
+ export { DateTimeInputDesktopProps, DateTimeInputDesktop };
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { DateTimeInput } from './components/date-time-input/Component.js';
3
+ import 'react-merge-refs';
4
+ import 'classnames';
5
+ import '@alfalab/core-components-calendar/modern';
6
+ import '@alfalab/core-components-icon-button/modern';
7
+ import '@alfalab/core-components-input/modern';
8
+ import '@alfalab/core-components-popover/modern';
9
+ import '@alfalab/icons-glyph/CalendarMIcon';
10
+ import './utils/format.js';
11
+ import 'date-fns/isValid';
12
+ import 'date-fns/parse';
13
+
14
+ const DateTimeInputDesktop = (props) => (React.createElement(DateTimeInput, { ...props }));
15
+
16
+ export { DateTimeInputDesktop };
@@ -0,0 +1,5 @@
1
+ import { FC } from 'react';
2
+ import { DateTimeInputProps } from "./components/date-time-input/Component";
3
+ type DateTimeInputMobileProps = Omit<DateTimeInputProps, 'view'>;
4
+ declare const DateTimeInputMobile: FC<DateTimeInputMobileProps>;
5
+ export { DateTimeInputMobileProps, DateTimeInputMobile };
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { CalendarMobile } from '@alfalab/core-components-calendar/modern';
3
+ import { DateTimeInput } from './components/date-time-input/Component.js';
4
+ import 'react-merge-refs';
5
+ import 'classnames';
6
+ import '@alfalab/core-components-icon-button/modern';
7
+ import '@alfalab/core-components-input/modern';
8
+ import '@alfalab/core-components-popover/modern';
9
+ import '@alfalab/icons-glyph/CalendarMIcon';
10
+ import './utils/format.js';
11
+ import 'date-fns/isValid';
12
+ import 'date-fns/parse';
13
+
14
+ const DateTimeInputMobile = (props) => (React.createElement(DateTimeInput, { Calendar: CalendarMobile, view: 'mobile', ...props }));
15
+
16
+ export { DateTimeInputMobile };
@@ -0,0 +1,12 @@
1
+ import { FC } from 'react';
2
+ import { DateTimeInputProps } from "./components/date-time-input/Component";
3
+ type DateTimeInputResponsiveProps = Omit<DateTimeInputProps, 'view'> & {
4
+ /**
5
+ * Контрольная точка, с нее начинается desktop версия
6
+ * @default 1024
7
+ */
8
+ breakpoint?: number;
9
+ };
10
+ type DateTimeInputMedia = 'desktop' | 'mobile';
11
+ declare const DateTimeInputResponsive: FC<DateTimeInputResponsiveProps>;
12
+ export { DateTimeInputResponsiveProps, DateTimeInputMedia, DateTimeInputResponsive };
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { useMedia } from '@alfalab/hooks';
3
+ import { DateTimeInputDesktop } from './Component.desktop.js';
4
+ import { DateTimeInputMobile } from './Component.mobile.js';
5
+ import './components/date-time-input/Component.js';
6
+ import 'react-merge-refs';
7
+ import 'classnames';
8
+ import '@alfalab/core-components-calendar/modern';
9
+ import '@alfalab/core-components-icon-button/modern';
10
+ import '@alfalab/core-components-input/modern';
11
+ import '@alfalab/core-components-popover/modern';
12
+ import '@alfalab/icons-glyph/CalendarMIcon';
13
+ import './utils/format.js';
14
+ import 'date-fns/isValid';
15
+ import 'date-fns/parse';
16
+
17
+ const DateTimeInputResponsive = ({ breakpoint = 1024, ...restProps }) => {
18
+ const [view] = useMedia([
19
+ ['mobile', `(max-width: ${breakpoint - 1}px)`],
20
+ ['desktop', `(min-width: ${breakpoint}px)`],
21
+ ], 'desktop');
22
+ return view === 'desktop' ? (React.createElement(DateTimeInputDesktop, { ...restProps })) : (React.createElement(DateTimeInputMobile, { ...restProps }));
23
+ };
24
+
25
+ export { DateTimeInputResponsive };
@@ -38,7 +38,7 @@ type DateTimeInputProps = Omit<InputProps, 'onChange'> & {
38
38
  /**
39
39
  * Компонент календаря
40
40
  */
41
- Calendar?: ElementType<CalendarProps>;
41
+ Calendar?: ElementType;
42
42
  /**
43
43
  * Доп. пропсы для календаря
44
44
  */
@@ -88,6 +88,10 @@ type DateTimeInputProps = Omit<InputProps, 'onChange'> & {
88
88
  * Растягивает компонент на ширину контейнера
89
89
  */
90
90
  block?: boolean;
91
+ /**
92
+ * Отображение компонента в мобильном или десктопном виде
93
+ */
94
+ view?: 'desktop' | 'mobile';
91
95
  };
92
96
  declare const DateTimeInput: React.ForwardRefExoticComponent<Omit<InputProps, "onChange"> & {
93
97
  /**
@@ -123,12 +127,15 @@ declare const DateTimeInput: React.ForwardRefExoticComponent<Omit<InputProps, "o
123
127
  /**
124
128
  * Компонент календаря
125
129
  */
126
- Calendar?: React.ElementType<CalendarProps> | undefined;
130
+ Calendar?: React.ElementType<any> | undefined;
127
131
  /**
128
132
  * Доп. пропсы для календаря
129
133
  */
130
134
  calendarProps?: (CalendarProps & Record<string, unknown>) | (CalendarProps & {
131
135
  open: boolean;
136
+ /**
137
+ * Дополнительный класс для поповера
138
+ */
132
139
  title?: string | undefined;
133
140
  onClose?: (() => void) | undefined;
134
141
  yearsAmount?: number | undefined;
@@ -180,5 +187,9 @@ declare const DateTimeInput: React.ForwardRefExoticComponent<Omit<InputProps, "o
180
187
  * Растягивает компонент на ширину контейнера
181
188
  */
182
189
  block?: boolean | undefined;
190
+ /**
191
+ * Отображение компонента в мобильном или десктопном виде
192
+ */
193
+ view?: "desktop" | "mobile" | undefined;
183
194
  } & React.RefAttributes<HTMLInputElement>>;
184
195
  export { DateTimeInputProps, DateTimeInput };
@@ -1,32 +1,26 @@
1
1
  import React, { useRef, useState, useEffect } from 'react';
2
2
  import mergeRefs from 'react-merge-refs';
3
3
  import cn from 'classnames';
4
- import { Calendar, CalendarMobile, dateInLimits } from '@alfalab/core-components-calendar/modern';
4
+ import { Calendar, dateInLimits } from '@alfalab/core-components-calendar/modern';
5
5
  import { IconButton } from '@alfalab/core-components-icon-button/modern';
6
6
  import { Input } from '@alfalab/core-components-input/modern';
7
7
  import { Popover } from '@alfalab/core-components-popover/modern';
8
- import { useMedia } from '@alfalab/hooks';
9
8
  import { CalendarMIcon } from '@alfalab/icons-glyph/CalendarMIcon';
9
+ import { getDateWithoutTime, setTimeToDate, DATE_MASK, format, getFullDateTime, isCompleteDateInput, isValid, parseTimestampToDate } from '../../utils/format.js';
10
10
  import 'date-fns/isValid';
11
11
  import 'date-fns/parse';
12
- import { getDateWithoutTime, setTimeToDate, DATE_MASK, format, getFullDateTime, isCompleteDateInput, isValid, parseTimestampToDate } from './utils/format.js';
13
12
 
14
- var styles = {"component":"date-time-input__component_xq07m","calendarContainer":"date-time-input__calendarContainer_xq07m","calendarResponsive":"date-time-input__calendarResponsive_xq07m","block":"date-time-input__block_xq07m"};
13
+ const 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"};
15
14
  require('./index.css')
16
15
 
17
16
  /* eslint-disable no-useless-escape, jsx-a11y/click-events-have-key-events */
18
- const DateTimeInput = React.forwardRef(({ className, inputClassName, popoverClassName, disabled, readOnly, picker, defaultValue = '', value: propValue, onChange, onComplete, rightAddons, useAnchorWidth, block, popoverPosition = 'bottom-start', zIndexPopover, preventFlip, Calendar: Calendar$1 = Calendar, calendarProps = {}, defaultMonth, minDate = calendarProps.minDate, maxDate = calendarProps.maxDate, offDays = calendarProps.offDays || [], events = calendarProps.events || [], defaultOpen = false, error, ...restProps }, ref) => {
19
- const [view] = useMedia([
20
- ['mobile', '(max-width: 1023px)'],
21
- ['desktop', '(min-width: 1024px)'],
22
- ], 'desktop');
17
+ const DateTimeInput = React.forwardRef(({ className, inputClassName, popoverClassName, disabled, readOnly, picker, defaultValue = '', value: propValue, onChange, onComplete, rightAddons, useAnchorWidth, block, popoverPosition = 'bottom-start', zIndexPopover, preventFlip, Calendar: Calendar$1 = Calendar, calendarProps = {}, defaultMonth, minDate = calendarProps.minDate, maxDate = calendarProps.maxDate, offDays = calendarProps.offDays || [], events = calendarProps.events || [], defaultOpen = false, error, view = 'desktop', ...restProps }, ref) => {
23
18
  const inputRef = useRef(null);
24
19
  const calendarRef = useRef(null);
25
20
  const [value, setValue] = useState(propValue || defaultValue);
26
21
  const [open, setOpen] = useState(false);
27
22
  const calendarValue = value ? getDateWithoutTime(value).getTime() : undefined;
28
23
  const inputDisabled = disabled || readOnly;
29
- const CalendarComponent = view === 'desktop' ? Calendar$1 : CalendarMobile;
30
24
  const calendarResponsive = calendarProps?.responsive ?? true;
31
25
  useEffect(() => {
32
26
  setOpen(defaultOpen);
@@ -113,7 +107,7 @@ const DateTimeInput = React.forwardRef(({ className, inputClassName, popoverClas
113
107
  const renderCalendar = () => (
114
108
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
115
109
  React.createElement("div", { onMouseDown: handleCalendarWrapperMouseDown },
116
- React.createElement(CalendarComponent, { ...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 })));
110
+ React.createElement(Calendar$1, { ...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 })));
117
111
  return (React.createElement("div", { className: cn(styles.component, className, {
118
112
  [styles.block]: block,
119
113
  }), onClick: inputDisabled ? undefined : handleInputWrapperClick, onFocus: inputDisabled ? undefined : handleInputWrapperFocus, onBlur: handleBlur },
@@ -1,4 +1,4 @@
1
- /* hash: 1cz69 */
1
+ /* hash: 1e3mm */
2
2
  :root {
3
3
 
4
4
  /* Hard */
@@ -39,26 +39,26 @@
39
39
  :root {
40
40
  --calendar-popover-border-radius: 0 0 var(--border-radius-s) var(--border-radius-s);
41
41
  }
42
- .date-time-input__component_xq07m {
42
+ .date-time-input__component_1u4x2 {
43
43
  display: inline-block;
44
44
  outline: none;
45
45
  position: relative;
46
46
  }
47
- .date-time-input__calendarContainer_xq07m {
47
+ .date-time-input__calendarContainer_1u4x2 {
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_xq07m {
53
+ .date-time-input__calendarContainer_1u4x2 {
54
54
  width: 100%;
55
55
  min-width: 288px
56
56
  }
57
57
  }
58
- .date-time-input__calendarResponsive_xq07m {
58
+ .date-time-input__calendarResponsive_1u4x2 {
59
59
  width: var(--calendar-width);
60
60
  padding: 0 var(--gap-m);
61
61
  }
62
- .date-time-input__block_xq07m {
62
+ .date-time-input__block_1u4x2 {
63
63
  width: 100%;
64
64
  }
@@ -0,0 +1 @@
1
+ export * from "./Component";
@@ -0,0 +1,12 @@
1
+ export { DateTimeInput } from './Component.js';
2
+ import 'react';
3
+ import 'react-merge-refs';
4
+ import 'classnames';
5
+ import '@alfalab/core-components-calendar/modern';
6
+ import '@alfalab/core-components-icon-button/modern';
7
+ import '@alfalab/core-components-input/modern';
8
+ import '@alfalab/core-components-popover/modern';
9
+ import '@alfalab/icons-glyph/CalendarMIcon';
10
+ import '../../utils/format.js';
11
+ import 'date-fns/isValid';
12
+ import 'date-fns/parse';
@@ -0,0 +1,2 @@
1
+ export * from "./Component.desktop";
2
+ export {};
@@ -0,0 +1,13 @@
1
+ export { DateTimeInputDesktop } from './Component.desktop.js';
2
+ import 'react';
3
+ import './components/date-time-input/Component.js';
4
+ import 'react-merge-refs';
5
+ import 'classnames';
6
+ import '@alfalab/core-components-calendar/modern';
7
+ import '@alfalab/core-components-icon-button/modern';
8
+ import '@alfalab/core-components-input/modern';
9
+ import '@alfalab/core-components-popover/modern';
10
+ import '@alfalab/icons-glyph/CalendarMIcon';
11
+ import './utils/format.js';
12
+ import 'date-fns/isValid';
13
+ import 'date-fns/parse';
package/modern/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from "./Component";
1
+ export { DateTimeInputResponsive as DateTimeInput, DateTimeInputResponsiveProps as DateTimeInputProps } from "./responsive";
package/modern/index.js CHANGED
@@ -1,13 +1,16 @@
1
+ export { DateTimeInputResponsive as DateTimeInput } from './Component.responsive.js';
1
2
  import 'react';
3
+ import '@alfalab/hooks';
4
+ import './Component.desktop.js';
5
+ import './components/date-time-input/Component.js';
2
6
  import 'react-merge-refs';
3
7
  import 'classnames';
4
8
  import '@alfalab/core-components-calendar/modern';
5
9
  import '@alfalab/core-components-icon-button/modern';
6
10
  import '@alfalab/core-components-input/modern';
7
11
  import '@alfalab/core-components-popover/modern';
8
- import '@alfalab/hooks';
9
12
  import '@alfalab/icons-glyph/CalendarMIcon';
13
+ import './utils/format.js';
10
14
  import 'date-fns/isValid';
11
15
  import 'date-fns/parse';
12
- import './utils/format.js';
13
- export { DateTimeInput } from './Component.js';
16
+ import './Component.mobile.js';
@@ -0,0 +1,2 @@
1
+ export * from "./Component.mobile";
2
+ export {};
@@ -0,0 +1,13 @@
1
+ export { DateTimeInputMobile } from './Component.mobile.js';
2
+ import 'react';
3
+ import '@alfalab/core-components-calendar/modern';
4
+ import './components/date-time-input/Component.js';
5
+ import 'react-merge-refs';
6
+ import 'classnames';
7
+ import '@alfalab/core-components-icon-button/modern';
8
+ import '@alfalab/core-components-input/modern';
9
+ import '@alfalab/core-components-popover/modern';
10
+ import '@alfalab/icons-glyph/CalendarMIcon';
11
+ import './utils/format.js';
12
+ import 'date-fns/isValid';
13
+ import 'date-fns/parse';
@@ -0,0 +1,2 @@
1
+ export * from "./Component.responsive";
2
+ export {};
@@ -0,0 +1,16 @@
1
+ export { DateTimeInputResponsive } from './Component.responsive.js';
2
+ import 'react';
3
+ import '@alfalab/hooks';
4
+ import './Component.desktop.js';
5
+ import './components/date-time-input/Component.js';
6
+ import 'react-merge-refs';
7
+ import 'classnames';
8
+ import '@alfalab/core-components-calendar/modern';
9
+ import '@alfalab/core-components-icon-button/modern';
10
+ import '@alfalab/core-components-input/modern';
11
+ import '@alfalab/core-components-popover/modern';
12
+ import '@alfalab/icons-glyph/CalendarMIcon';
13
+ import './utils/format.js';
14
+ import 'date-fns/isValid';
15
+ import 'date-fns/parse';
16
+ import './Component.mobile.js';
@@ -1,3 +1,3 @@
1
+ export { DATE_FORMAT, DATE_MASK, format, getDateWithoutTime, getFullDateTime, isCompleteDateInput, isValid, isValidTimeFormat, parseDateString, parseTimestampToDate, setTimeToDate } from './format.js';
1
2
  import 'date-fns/isValid';
2
3
  import 'date-fns/parse';
3
- export { DATE_FORMAT, DATE_MASK, format, getDateWithoutTime, getFullDateTime, isCompleteDateInput, isValid, isValidTimeFormat, parseDateString, parseTimestampToDate, setTimeToDate } from './format.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfalab/core-components-date-time-input",
3
- "version": "2.1.2",
3
+ "version": "2.2.0",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -15,10 +15,10 @@
15
15
  "react-dom": "^16.9.0 || ^17.0.1 || ^18.0.0"
16
16
  },
17
17
  "dependencies": {
18
- "@alfalab/core-components-calendar": "^6.1.14",
19
- "@alfalab/core-components-input": "^11.1.0",
20
- "@alfalab/core-components-icon-button": "^6.0.1",
21
- "@alfalab/core-components-popover": "^6.0.4",
18
+ "@alfalab/core-components-calendar": "^6.2.0",
19
+ "@alfalab/core-components-input": "^11.1.1",
20
+ "@alfalab/core-components-icon-button": "^6.0.2",
21
+ "@alfalab/core-components-popover": "^6.0.5",
22
22
  "classnames": "^2.3.1"
23
23
  }
24
24
  }
@@ -0,0 +1,2 @@
1
+ export * from "./Component.responsive";
2
+ export {};
package/responsive.js ADDED
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ var Component_responsive = require('./Component.responsive.js');
4
+ require('./Component-27749cf7.js');
5
+ require('react');
6
+ require('react-merge-refs');
7
+ require('classnames');
8
+ require('@alfalab/core-components-calendar');
9
+ require('@alfalab/core-components-icon-button');
10
+ require('@alfalab/core-components-input');
11
+ require('@alfalab/core-components-popover');
12
+ require('@alfalab/icons-glyph/CalendarMIcon');
13
+ require('./utils/format.js');
14
+ require('date-fns/isValid');
15
+ require('date-fns/parse');
16
+ require('@alfalab/hooks');
17
+ require('./Component.desktop.js');
18
+ require('./Component.mobile.js');
19
+
20
+
21
+
22
+ exports.DateTimeInputResponsive = Component_responsive.DateTimeInputResponsive;
package/utils/format.js CHANGED
@@ -1,14 +1,12 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var dateFnsIsValid = require('date-fns/isValid');
6
4
  var parse = require('date-fns/parse');
7
5
 
8
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
6
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
9
7
 
10
- var dateFnsIsValid__default = /*#__PURE__*/_interopDefaultLegacy(dateFnsIsValid);
11
- var parse__default = /*#__PURE__*/_interopDefaultLegacy(parse);
8
+ var dateFnsIsValid__default = /*#__PURE__*/_interopDefaultCompat(dateFnsIsValid);
9
+ var parse__default = /*#__PURE__*/_interopDefaultCompat(parse);
12
10
 
13
11
  /* eslint-disable no-useless-escape */
14
12
  var DATE_FORMAT = 'dd.MM.yyyy';
@@ -34,7 +32,7 @@ var DATE_MASK = [
34
32
  var isCompleteDateInput = function (input) { return input.length === DATE_MASK.length; };
35
33
  var parseDateString = function (value, dateFormat) {
36
34
  if (dateFormat === void 0) { dateFormat = DATE_FORMAT; }
37
- return parse__default['default'](value, dateFormat, new Date());
35
+ return parse__default.default(value, dateFormat, new Date());
38
36
  };
39
37
  var isValidTimeFormat = function (value) {
40
38
  var timeArr = value.split(':');
@@ -54,7 +52,7 @@ var isValid = function (inputValue) {
54
52
  var time = inputValueArr[1];
55
53
  return (!inputValue ||
56
54
  (isCompleteDateInput(inputValue) &&
57
- dateFnsIsValid__default['default'](parseDateString(date)) &&
55
+ dateFnsIsValid__default.default(parseDateString(date)) &&
58
56
  isValidTimeFormat(time)));
59
57
  };
60
58
  var format = function (value) {
@@ -84,12 +82,12 @@ var parseTimestampToDate = function (timestamp) {
84
82
  var month = date.getMonth() + 1;
85
83
  var day = date.getDate();
86
84
  if (month < 10) {
87
- month = "0" + month;
85
+ month = "0".concat(month);
88
86
  }
89
87
  if (day < 10) {
90
- day = "0" + day;
88
+ day = "0".concat(day);
91
89
  }
92
- return day + "." + month + "." + year;
90
+ return "".concat(day, ".").concat(month, ".").concat(year);
93
91
  };
94
92
  var getDateWithoutTime = function (value) {
95
93
  var valueArr = value.split(', ');
@@ -128,8 +126,8 @@ var getFullDateTime = function (value) {
128
126
  return fullDate;
129
127
  };
130
128
  var setTimeToDate = function (value) {
131
- if (value.length === 10 && dateFnsIsValid__default['default'](parseDateString(value))) {
132
- return value + ", 00:00";
129
+ if (value.length === 10 && dateFnsIsValid__default.default(parseDateString(value))) {
130
+ return "".concat(value, ", 00:00");
133
131
  }
134
132
  return value;
135
133
  };