@alfalab/core-components-date-range-input 2.1.3 → 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 (85) hide show
  1. package/{esm/Component.d.ts → Component-105ad648.d.ts} +44 -3
  2. package/{Component.js → Component-105ad648.js} +26 -25
  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-range-input/Component.d.ts +0 -0
  10. package/components/date-range-input/Component.js +18 -0
  11. package/{esm → components/date-range-input}/index.css +6 -6
  12. package/components/date-range-input/index.d.ts +1 -0
  13. package/components/date-range-input/index.js +18 -0
  14. package/cssm/{Component.d.ts → Component-a4cfbf46.d.ts} +44 -3
  15. package/cssm/{Component.js → Component-a4cfbf46.js} +28 -26
  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-range-input/Component.d.ts +0 -0
  23. package/cssm/components/date-range-input/Component.js +19 -0
  24. package/cssm/components/date-range-input/index.d.ts +1 -0
  25. package/cssm/components/date-range-input/index.js +19 -0
  26. package/cssm/{index.module.css → components/date-range-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 +7 -4
  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 +8 -3
  36. package/desktop.d.ts +2 -0
  37. package/desktop.js +19 -0
  38. package/{modern/Component.d.ts → esm/Component-e59830f5.d.ts} +44 -3
  39. package/esm/{Component.js → Component-e59830f5.js} +9 -16
  40. package/esm/Component.desktop.d.ts +5 -0
  41. package/esm/Component.desktop.js +16 -0
  42. package/esm/Component.mobile.d.ts +5 -0
  43. package/esm/Component.mobile.js +16 -0
  44. package/esm/Component.responsive.d.ts +12 -0
  45. package/esm/Component.responsive.js +26 -0
  46. package/esm/components/date-range-input/Component.d.ts +0 -0
  47. package/esm/components/date-range-input/Component.js +12 -0
  48. package/{index.css → esm/components/date-range-input/index.css} +6 -6
  49. package/esm/components/date-range-input/index.d.ts +1 -0
  50. package/esm/components/date-range-input/index.js +12 -0
  51. package/esm/desktop.d.ts +2 -0
  52. package/esm/desktop.js +13 -0
  53. package/esm/index.d.ts +1 -1
  54. package/esm/index.js +5 -2
  55. package/esm/mobile.d.ts +2 -0
  56. package/esm/mobile.js +13 -0
  57. package/esm/responsive.d.ts +2 -0
  58. package/esm/responsive.js +16 -0
  59. package/index.d.ts +1 -1
  60. package/index.js +6 -3
  61. package/mobile.d.ts +2 -0
  62. package/mobile.js +19 -0
  63. package/modern/Component.desktop.d.ts +5 -0
  64. package/modern/Component.desktop.js +16 -0
  65. package/modern/Component.mobile.d.ts +5 -0
  66. package/modern/Component.mobile.js +16 -0
  67. package/modern/Component.responsive.d.ts +12 -0
  68. package/modern/Component.responsive.js +25 -0
  69. package/{Component.d.ts → modern/components/date-range-input/Component.d.ts} +10 -2
  70. package/modern/{Component.js → components/date-range-input/Component.js} +5 -11
  71. package/modern/{index.css → components/date-range-input/index.css} +6 -6
  72. package/modern/components/date-range-input/index.d.ts +1 -0
  73. package/modern/components/date-range-input/index.js +12 -0
  74. package/modern/desktop.d.ts +2 -0
  75. package/modern/desktop.js +13 -0
  76. package/modern/index.d.ts +1 -1
  77. package/modern/index.js +5 -2
  78. package/modern/mobile.d.ts +2 -0
  79. package/modern/mobile.js +13 -0
  80. package/modern/responsive.d.ts +2 -0
  81. package/modern/responsive.js +16 -0
  82. package/package.json +5 -5
  83. package/responsive.d.ts +2 -0
  84. package/responsive.js +22 -0
  85. package/utils/format.js +8 -3
package/esm/index.js CHANGED
@@ -1,4 +1,5 @@
1
- export { DateRangeInput } from './Component.js';
1
+ export { DateRangeInputResponsive as DateRangeInput } from './Component.responsive.js';
2
+ import './Component-e59830f5.js';
2
3
  import 'react';
3
4
  import 'react-merge-refs';
4
5
  import 'classnames';
@@ -7,7 +8,9 @@ import '@alfalab/core-components-calendar/esm';
7
8
  import '@alfalab/core-components-icon-button/esm';
8
9
  import '@alfalab/core-components-input/esm';
9
10
  import '@alfalab/core-components-popover/esm';
10
- import '@alfalab/hooks';
11
11
  import '@alfalab/icons-glyph/CalendarMIcon';
12
12
  import './utils/format.js';
13
13
  import 'date-fns/parse';
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 { DateRangeInputMobile } from './Component.mobile.js';
2
+ import './Component-e59830f5.js';
3
+ import 'react';
4
+ import 'react-merge-refs';
5
+ import 'classnames';
6
+ import 'date-fns/isValid';
7
+ import '@alfalab/core-components-calendar/esm';
8
+ import '@alfalab/core-components-icon-button/esm';
9
+ import '@alfalab/core-components-input/esm';
10
+ import '@alfalab/core-components-popover/esm';
11
+ import '@alfalab/icons-glyph/CalendarMIcon';
12
+ import './utils/format.js';
13
+ import 'date-fns/parse';
@@ -0,0 +1,2 @@
1
+ export * from "./Component.responsive";
2
+ export {};
@@ -0,0 +1,16 @@
1
+ export { DateRangeInputResponsive } from './Component.responsive.js';
2
+ import './Component-e59830f5.js';
3
+ import 'react';
4
+ import 'react-merge-refs';
5
+ import 'classnames';
6
+ import 'date-fns/isValid';
7
+ import '@alfalab/core-components-calendar/esm';
8
+ import '@alfalab/core-components-icon-button/esm';
9
+ import '@alfalab/core-components-input/esm';
10
+ import '@alfalab/core-components-popover/esm';
11
+ import '@alfalab/icons-glyph/CalendarMIcon';
12
+ import './utils/format.js';
13
+ import 'date-fns/parse';
14
+ import '@alfalab/hooks';
15
+ import './Component.desktop.js';
16
+ import './Component.mobile.js';
package/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from "./Component";
1
+ export { DateRangeInputResponsive as DateRangeInput, DateRangeInputResponsiveProps as DateRangeInputProps } from "./responsive";
package/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var Component = require('./Component.js');
3
+ var Component_responsive = require('./Component.responsive.js');
4
+ require('./Component-105ad648.js');
4
5
  require('react');
5
6
  require('react-merge-refs');
6
7
  require('classnames');
@@ -9,11 +10,13 @@ require('@alfalab/core-components-calendar');
9
10
  require('@alfalab/core-components-icon-button');
10
11
  require('@alfalab/core-components-input');
11
12
  require('@alfalab/core-components-popover');
12
- require('@alfalab/hooks');
13
13
  require('@alfalab/icons-glyph/CalendarMIcon');
14
14
  require('./utils/format.js');
15
15
  require('date-fns/parse');
16
+ require('@alfalab/hooks');
17
+ require('./Component.desktop.js');
18
+ require('./Component.mobile.js');
16
19
 
17
20
 
18
21
 
19
- exports.DateRangeInput = Component.DateRangeInput;
22
+ exports.DateRangeInput = Component_responsive.DateRangeInputResponsive;
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-105ad648.js');
5
+ require('react');
6
+ require('react-merge-refs');
7
+ require('classnames');
8
+ require('date-fns/isValid');
9
+ require('@alfalab/core-components-calendar');
10
+ require('@alfalab/core-components-icon-button');
11
+ require('@alfalab/core-components-input');
12
+ require('@alfalab/core-components-popover');
13
+ require('@alfalab/icons-glyph/CalendarMIcon');
14
+ require('./utils/format.js');
15
+ require('date-fns/parse');
16
+
17
+
18
+
19
+ exports.DateRangeInputMobile = Component_mobile.DateRangeInputMobile;
@@ -0,0 +1,5 @@
1
+ import { FC } from 'react';
2
+ import { DateRangeInputProps } from "./components/date-range-input/Component";
3
+ type DateRangeInputDesktopProps = Omit<DateRangeInputProps, 'view'>;
4
+ declare const DateRangeInputDesktop: FC<DateRangeInputDesktopProps>;
5
+ export { DateRangeInputDesktopProps, DateRangeInputDesktop };
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { DateRangeInput } from './components/date-range-input/Component.js';
3
+ import 'react-merge-refs';
4
+ import 'classnames';
5
+ import 'date-fns/isValid';
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/parse';
13
+
14
+ const DateRangeInputDesktop = (props) => (React.createElement(DateRangeInput, { ...props }));
15
+
16
+ export { DateRangeInputDesktop };
@@ -0,0 +1,5 @@
1
+ import { FC } from 'react';
2
+ import { DateRangeInputProps } from "./components/date-range-input/Component";
3
+ type DateRangeInputMobileProps = Omit<DateRangeInputProps, 'view'>;
4
+ declare const DateRangeInputMobile: FC<DateRangeInputMobileProps>;
5
+ export { DateRangeInputMobileProps, DateRangeInputMobile };
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { CalendarMobile } from '@alfalab/core-components-calendar/modern';
3
+ import { DateRangeInput } from './components/date-range-input/Component.js';
4
+ import 'react-merge-refs';
5
+ import 'classnames';
6
+ import 'date-fns/isValid';
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/parse';
13
+
14
+ const DateRangeInputMobile = (props) => (React.createElement(DateRangeInput, { Calendar: CalendarMobile, view: 'mobile', ...props }));
15
+
16
+ export { DateRangeInputMobile };
@@ -0,0 +1,12 @@
1
+ import { FC } from 'react';
2
+ import { DateRangeInputProps } from "./components/date-range-input/Component";
3
+ type DateRangeInputResponsiveProps = Omit<DateRangeInputProps, 'view'> & {
4
+ /**
5
+ * Контрольная точка, с нее начинается desktop версия
6
+ * @default 1024
7
+ */
8
+ breakpoint?: number;
9
+ };
10
+ type DateRangeInputMedia = 'desktop' | 'mobile';
11
+ declare const DateRangeInputResponsive: FC<DateRangeInputResponsiveProps>;
12
+ export { DateRangeInputResponsiveProps, DateRangeInputMedia, DateRangeInputResponsive };
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { useMedia } from '@alfalab/hooks';
3
+ import { DateRangeInputDesktop } from './Component.desktop.js';
4
+ import { DateRangeInputMobile } from './Component.mobile.js';
5
+ import './components/date-range-input/Component.js';
6
+ import 'react-merge-refs';
7
+ import 'classnames';
8
+ import 'date-fns/isValid';
9
+ import '@alfalab/core-components-calendar/modern';
10
+ import '@alfalab/core-components-icon-button/modern';
11
+ import '@alfalab/core-components-input/modern';
12
+ import '@alfalab/core-components-popover/modern';
13
+ import '@alfalab/icons-glyph/CalendarMIcon';
14
+ import './utils/format.js';
15
+ import 'date-fns/parse';
16
+
17
+ const DateRangeInputResponsive = ({ 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(DateRangeInputDesktop, { ...restProps })) : (React.createElement(DateRangeInputMobile, { ...restProps }));
23
+ };
24
+
25
+ export { DateRangeInputResponsive };
@@ -40,7 +40,7 @@ type DateRangeInputProps = Omit<InputProps, 'onChange'> & {
40
40
  /**
41
41
  * Компонент календаря
42
42
  */
43
- Calendar?: ElementType<CalendarProps>;
43
+ Calendar?: ElementType;
44
44
  /**
45
45
  * Доп. пропсы для календаря
46
46
  */
@@ -90,6 +90,10 @@ type DateRangeInputProps = Omit<InputProps, 'onChange'> & {
90
90
  * Растягивает компонент на ширину контейнера
91
91
  */
92
92
  block?: boolean;
93
+ /**
94
+ * Отображение компонента в мобильном или десктопном виде
95
+ */
96
+ view?: 'desktop' | 'mobile';
93
97
  };
94
98
  declare const DateRangeInput: React.ForwardRefExoticComponent<Omit<InputProps, "onChange"> & {
95
99
  /**
@@ -127,7 +131,7 @@ declare const DateRangeInput: React.ForwardRefExoticComponent<Omit<InputProps, "
127
131
  /**
128
132
  * Компонент календаря
129
133
  */
130
- Calendar?: React.ElementType<CalendarProps> | undefined;
134
+ Calendar?: React.ElementType<any> | undefined;
131
135
  /**
132
136
  * Доп. пропсы для календаря
133
137
  */
@@ -184,5 +188,9 @@ declare const DateRangeInput: React.ForwardRefExoticComponent<Omit<InputProps, "
184
188
  * Растягивает компонент на ширину контейнера
185
189
  */
186
190
  block?: boolean | undefined;
191
+ /**
192
+ * Отображение компонента в мобильном или десктопном виде
193
+ */
194
+ view?: "desktop" | "mobile" | undefined;
187
195
  } & React.RefAttributes<HTMLInputElement>>;
188
196
  export { DateRangeInputProps, DateRangeInput };
@@ -2,30 +2,24 @@ import React, { useRef, useState, useEffect } from 'react';
2
2
  import mergeRefs from 'react-merge-refs';
3
3
  import cn from 'classnames';
4
4
  import dateFnsIsValid from 'date-fns/isValid';
5
- import { usePeriod, Calendar, CalendarMobile } from '@alfalab/core-components-calendar/modern';
5
+ import { usePeriod, Calendar } from '@alfalab/core-components-calendar/modern';
6
6
  import { IconButton } from '@alfalab/core-components-icon-button/modern';
7
7
  import { Input } from '@alfalab/core-components-input/modern';
8
8
  import { Popover } from '@alfalab/core-components-popover/modern';
9
- import { useMedia } from '@alfalab/hooks';
10
9
  import { CalendarMIcon } from '@alfalab/icons-glyph/CalendarMIcon';
11
- import { parseTimestampToDate, DATE_FORMAT, DATE_MASK, format, parseDateString, isCompleteDateInput, isValid } from './utils/format.js';
10
+ import { parseTimestampToDate, DATE_FORMAT, DATE_MASK, format, parseDateString, isCompleteDateInput, isValid } from '../../utils/format.js';
12
11
  import 'date-fns/parse';
13
12
 
14
- const styles = {"component":"date-range-input__component_1akod","calendarContainer":"date-range-input__calendarContainer_1akod","calendarResponsive":"date-range-input__calendarResponsive_1akod","block":"date-range-input__block_1akod"};
13
+ const styles = {"component":"date-range-input__component_1yhrr","calendarContainer":"date-range-input__calendarContainer_1yhrr","calendarResponsive":"date-range-input__calendarResponsive_1yhrr","block":"date-range-input__block_1yhrr"};
15
14
  require('./index.css')
16
15
 
17
16
  /* eslint-disable no-useless-escape, jsx-a11y/click-events-have-key-events */
18
- const DateRangeInput = 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, ...restProps }, ref) => {
19
- const [view] = useMedia([
20
- ['mobile', '(max-width: 1023px)'],
21
- ['desktop', '(min-width: 1024px)'],
22
- ], 'desktop');
17
+ const DateRangeInput = 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, 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 inputDisabled = disabled || readOnly;
28
- const CalendarComponent = view === 'desktop' ? Calendar$1 : CalendarMobile;
29
23
  const calendarResponsive = calendarProps?.responsive ?? true;
30
24
  useEffect(() => {
31
25
  setOpen(defaultOpen);
@@ -151,7 +145,7 @@ const DateRangeInput = React.forwardRef(({ className, inputClassName, popoverCla
151
145
  const renderCalendar = () => (
152
146
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
153
147
  React.createElement("div", { onMouseDown: handleCalendarWrapperMouseDown },
154
- React.createElement(CalendarComponent, { ...calendarProps, responsive: calendarResponsive, open: open, onClose: handleCalendarClose, ref: calendarRef, defaultMonth: defaultMonth, selectedFrom: selectedFrom, selectedTo: selectedTo, onChange: handleCalendarChange, minDate: minDate, maxDate: maxDate, offDays: offDays, events: events })));
148
+ React.createElement(Calendar$1, { ...calendarProps, responsive: calendarResponsive, open: open, onClose: handleCalendarClose, ref: calendarRef, defaultMonth: defaultMonth, selectedFrom: selectedFrom, selectedTo: selectedTo, onChange: handleCalendarChange, minDate: minDate, maxDate: maxDate, offDays: offDays, events: events })));
155
149
  return (React.createElement("div", { className: cn(styles.component, className, {
156
150
  [styles.block]: block,
157
151
  }), onClick: inputDisabled ? undefined : handleInputWrapperClick, onFocus: inputDisabled ? undefined : handleInputWrapperFocus, onBlur: handleBlur },
@@ -1,4 +1,4 @@
1
- /* hash: 13ivl */
1
+ /* hash: 2v93k */
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-range-input__component_1akod {
42
+ .date-range-input__component_1yhrr {
43
43
  display: inline-block;
44
44
  outline: none;
45
45
  position: relative;
46
46
  }
47
- .date-range-input__calendarContainer_1akod {
47
+ .date-range-input__calendarContainer_1yhrr {
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-range-input__calendarContainer_1akod {
53
+ .date-range-input__calendarContainer_1yhrr {
54
54
  width: 100%;
55
55
  min-width: 288px
56
56
  }
57
57
  }
58
- .date-range-input__calendarResponsive_1akod {
58
+ .date-range-input__calendarResponsive_1yhrr {
59
59
  width: var(--calendar-width);
60
60
  padding: 0 var(--gap-m);
61
61
  }
62
- .date-range-input__block_1akod {
62
+ .date-range-input__block_1yhrr {
63
63
  width: 100%;
64
64
  }
@@ -0,0 +1 @@
1
+ export * from "./Component";
@@ -0,0 +1,12 @@
1
+ export { DateRangeInput } from './Component.js';
2
+ import 'react';
3
+ import 'react-merge-refs';
4
+ import 'classnames';
5
+ import 'date-fns/isValid';
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/parse';
@@ -0,0 +1,2 @@
1
+ export * from "./Component.desktop";
2
+ export {};
@@ -0,0 +1,13 @@
1
+ export { DateRangeInputDesktop } from './Component.desktop.js';
2
+ import 'react';
3
+ import './components/date-range-input/Component.js';
4
+ import 'react-merge-refs';
5
+ import 'classnames';
6
+ import 'date-fns/isValid';
7
+ import '@alfalab/core-components-calendar/modern';
8
+ import '@alfalab/core-components-icon-button/modern';
9
+ import '@alfalab/core-components-input/modern';
10
+ import '@alfalab/core-components-popover/modern';
11
+ import '@alfalab/icons-glyph/CalendarMIcon';
12
+ import './utils/format.js';
13
+ import 'date-fns/parse';
package/modern/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from "./Component";
1
+ export { DateRangeInputResponsive as DateRangeInput, DateRangeInputResponsiveProps as DateRangeInputProps } from "./responsive";
package/modern/index.js CHANGED
@@ -1,5 +1,8 @@
1
- export { DateRangeInput } from './Component.js';
1
+ export { DateRangeInputResponsive as DateRangeInput } from './Component.responsive.js';
2
2
  import 'react';
3
+ import '@alfalab/hooks';
4
+ import './Component.desktop.js';
5
+ import './components/date-range-input/Component.js';
3
6
  import 'react-merge-refs';
4
7
  import 'classnames';
5
8
  import 'date-fns/isValid';
@@ -7,7 +10,7 @@ import '@alfalab/core-components-calendar/modern';
7
10
  import '@alfalab/core-components-icon-button/modern';
8
11
  import '@alfalab/core-components-input/modern';
9
12
  import '@alfalab/core-components-popover/modern';
10
- import '@alfalab/hooks';
11
13
  import '@alfalab/icons-glyph/CalendarMIcon';
12
14
  import './utils/format.js';
13
15
  import 'date-fns/parse';
16
+ import './Component.mobile.js';
@@ -0,0 +1,2 @@
1
+ export * from "./Component.mobile";
2
+ export {};
@@ -0,0 +1,13 @@
1
+ export { DateRangeInputMobile } from './Component.mobile.js';
2
+ import 'react';
3
+ import '@alfalab/core-components-calendar/modern';
4
+ import './components/date-range-input/Component.js';
5
+ import 'react-merge-refs';
6
+ import 'classnames';
7
+ import 'date-fns/isValid';
8
+ import '@alfalab/core-components-icon-button/modern';
9
+ import '@alfalab/core-components-input/modern';
10
+ import '@alfalab/core-components-popover/modern';
11
+ import '@alfalab/icons-glyph/CalendarMIcon';
12
+ import './utils/format.js';
13
+ import 'date-fns/parse';
@@ -0,0 +1,2 @@
1
+ export * from "./Component.responsive";
2
+ export {};
@@ -0,0 +1,16 @@
1
+ export { DateRangeInputResponsive } from './Component.responsive.js';
2
+ import 'react';
3
+ import '@alfalab/hooks';
4
+ import './Component.desktop.js';
5
+ import './components/date-range-input/Component.js';
6
+ import 'react-merge-refs';
7
+ import 'classnames';
8
+ import 'date-fns/isValid';
9
+ import '@alfalab/core-components-calendar/modern';
10
+ import '@alfalab/core-components-icon-button/modern';
11
+ import '@alfalab/core-components-input/modern';
12
+ import '@alfalab/core-components-popover/modern';
13
+ import '@alfalab/icons-glyph/CalendarMIcon';
14
+ import './utils/format.js';
15
+ import 'date-fns/parse';
16
+ import './Component.mobile.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfalab/core-components-date-range-input",
3
- "version": "2.1.3",
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-input": "^11.1.0",
19
- "@alfalab/core-components-icon-button": "^6.0.1",
20
- "@alfalab/core-components-calendar": "^6.1.15",
21
- "@alfalab/core-components-popover": "^6.0.4",
18
+ "@alfalab/core-components-input": "^11.1.1",
19
+ "@alfalab/core-components-icon-button": "^6.0.2",
20
+ "@alfalab/core-components-calendar": "^6.2.0",
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-105ad648.js');
5
+ require('react');
6
+ require('react-merge-refs');
7
+ require('classnames');
8
+ require('date-fns/isValid');
9
+ require('@alfalab/core-components-calendar');
10
+ require('@alfalab/core-components-icon-button');
11
+ require('@alfalab/core-components-input');
12
+ require('@alfalab/core-components-popover');
13
+ require('@alfalab/icons-glyph/CalendarMIcon');
14
+ require('./utils/format.js');
15
+ require('date-fns/parse');
16
+ require('@alfalab/hooks');
17
+ require('./Component.desktop.js');
18
+ require('./Component.mobile.js');
19
+
20
+
21
+
22
+ exports.DateRangeInputResponsive = Component_responsive.DateRangeInputResponsive;
package/utils/format.js CHANGED
@@ -3,6 +3,11 @@
3
3
  var dateFnsIsValid = require('date-fns/isValid');
4
4
  var parse = require('date-fns/parse');
5
5
 
6
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
7
+
8
+ var dateFnsIsValid__default = /*#__PURE__*/_interopDefaultCompat(dateFnsIsValid);
9
+ var parse__default = /*#__PURE__*/_interopDefaultCompat(parse);
10
+
6
11
  /* eslint-disable no-useless-escape */
7
12
  var DATE_FORMAT = 'dd.MM.yyyy';
8
13
  var DATE_MASK = [
@@ -33,13 +38,13 @@ var DATE_MASK = [
33
38
  var isCompleteDateInput = function (input) { return input.length === DATE_MASK.length; };
34
39
  var parseDateString = function (value, dateFormat) {
35
40
  if (dateFormat === void 0) { dateFormat = DATE_FORMAT; }
36
- return parse(value, dateFormat, new Date());
41
+ return parse__default.default(value, dateFormat, new Date());
37
42
  };
38
43
  var isValid = function (inputValue, dateFrom, dateTo) {
39
44
  return !inputValue ||
40
45
  (isCompleteDateInput(inputValue) &&
41
- dateFnsIsValid(parseDateString(dateFrom)) &&
42
- dateFnsIsValid(parseDateString(dateTo)));
46
+ dateFnsIsValid__default.default(parseDateString(dateFrom)) &&
47
+ dateFnsIsValid__default.default(parseDateString(dateTo)));
43
48
  };
44
49
  var format = function (value) {
45
50
  return value