@alfalab/core-components-calendar-input 8.1.3 → 8.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.
- package/{esm/Component.d.ts → Component-98dcf994.d.ts} +45 -6
- package/{Component.js → Component-98dcf994.js} +21 -23
- package/Component.desktop.d.ts +5 -0
- package/Component.desktop.js +22 -0
- package/Component.mobile.d.ts +5 -0
- package/Component.mobile.js +22 -0
- package/Component.responsive.d.ts +12 -0
- package/Component.responsive.js +32 -0
- package/components/calendar-input/Component.d.ts +0 -0
- package/components/calendar-input/Component.js +18 -0
- package/{esm → components/calendar-input}/index.css +11 -11
- package/components/calendar-input/index.d.ts +1 -0
- package/components/calendar-input/index.js +18 -0
- package/cssm/{Component.d.ts → Component-fde0c12c.d.ts} +45 -6
- package/cssm/{Component.js → Component-fde0c12c.js} +23 -24
- package/cssm/Component.desktop.d.ts +5 -0
- package/cssm/Component.desktop.js +23 -0
- package/cssm/Component.mobile.d.ts +5 -0
- package/cssm/Component.mobile.js +23 -0
- package/cssm/Component.responsive.d.ts +12 -0
- package/cssm/Component.responsive.js +33 -0
- package/cssm/components/calendar-input/Component.d.ts +0 -0
- package/cssm/components/calendar-input/Component.js +19 -0
- package/cssm/components/calendar-input/index.d.ts +1 -0
- package/cssm/components/calendar-input/index.js +19 -0
- package/cssm/{index.module.css → components/calendar-input/index.module.css} +0 -0
- package/cssm/desktop.d.ts +2 -0
- package/cssm/desktop.js +20 -0
- package/cssm/index.d.ts +1 -1
- package/cssm/index.js +7 -4
- package/cssm/mobile.d.ts +2 -0
- package/cssm/mobile.js +20 -0
- package/cssm/responsive.d.ts +2 -0
- package/cssm/responsive.js +23 -0
- package/cssm/utils.js +9 -3
- package/desktop.d.ts +2 -0
- package/desktop.js +19 -0
- package/{modern/Component.d.ts → esm/Component-8d1a1461.d.ts} +45 -6
- package/esm/{Component.js → Component-8d1a1461.js} +8 -17
- package/esm/Component.desktop.d.ts +5 -0
- package/esm/Component.desktop.js +16 -0
- package/esm/Component.mobile.d.ts +5 -0
- package/esm/Component.mobile.js +16 -0
- package/esm/Component.responsive.d.ts +12 -0
- package/esm/Component.responsive.js +26 -0
- package/esm/components/calendar-input/Component.d.ts +0 -0
- package/esm/components/calendar-input/Component.js +12 -0
- package/{index.css → esm/components/calendar-input/index.css} +11 -11
- package/esm/components/calendar-input/index.d.ts +1 -0
- package/esm/components/calendar-input/index.js +12 -0
- package/esm/desktop.d.ts +2 -0
- package/esm/desktop.js +13 -0
- package/esm/index.d.ts +1 -1
- package/esm/index.js +5 -2
- package/esm/mobile.d.ts +2 -0
- package/esm/mobile.js +13 -0
- package/esm/responsive.d.ts +2 -0
- package/esm/responsive.js +16 -0
- package/index.d.ts +1 -1
- package/index.js +6 -3
- package/mobile.d.ts +2 -0
- package/mobile.js +19 -0
- package/modern/Component.desktop.d.ts +5 -0
- package/modern/Component.desktop.js +16 -0
- package/modern/Component.mobile.d.ts +5 -0
- package/modern/Component.mobile.js +16 -0
- package/modern/Component.responsive.d.ts +12 -0
- package/modern/Component.responsive.js +25 -0
- package/{Component.d.ts → modern/components/calendar-input/Component.d.ts} +11 -5
- package/modern/{Component.js → components/calendar-input/Component.js} +5 -11
- package/modern/{index.css → components/calendar-input/index.css} +11 -11
- package/modern/components/calendar-input/index.d.ts +1 -0
- package/modern/components/calendar-input/index.js +12 -0
- package/modern/desktop.d.ts +2 -0
- package/modern/desktop.js +13 -0
- package/modern/index.d.ts +1 -1
- package/modern/index.js +5 -2
- package/modern/mobile.d.ts +2 -0
- package/modern/mobile.js +13 -0
- package/modern/responsive.d.ts +2 -0
- package/modern/responsive.js +16 -0
- package/package.json +4 -4
- package/responsive.d.ts +2 -0
- package/responsive.js +22 -0
- package/utils.js +9 -3
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var components_calendarInput_Component = require('./Component-fde0c12c.js');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
require('react-merge-refs');
|
|
6
|
+
require('classnames');
|
|
7
|
+
require('@alfalab/core-components-calendar/cssm');
|
|
8
|
+
require('@alfalab/core-components-date-input/cssm');
|
|
9
|
+
require('@alfalab/core-components-popover/cssm');
|
|
10
|
+
require('@alfalab/icons-glyph/CalendarMIcon');
|
|
11
|
+
require('./utils.js');
|
|
12
|
+
require('date-fns/format');
|
|
13
|
+
require('date-fns/isSameDay');
|
|
14
|
+
require('date-fns/parse');
|
|
15
|
+
require('./components/calendar-input/index.module.css');
|
|
16
|
+
|
|
17
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
18
|
+
|
|
19
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
20
|
+
|
|
21
|
+
var CalendarInputDesktop = function (props) { return (React__default.default.createElement(components_calendarInput_Component.CalendarInput, components_calendarInput_Component.__assign({}, props))); };
|
|
22
|
+
|
|
23
|
+
exports.CalendarInputDesktop = CalendarInputDesktop;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { CalendarInputProps } from "./Component-fde0c12c";
|
|
3
|
+
type CalendarInputMobileProps = Omit<CalendarInputProps, 'view'>;
|
|
4
|
+
declare const CalendarInputMobile: FC<CalendarInputMobileProps>;
|
|
5
|
+
export { CalendarInputMobileProps, CalendarInputMobile };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var components_calendarInput_Component = require('./Component-fde0c12c.js');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var coreComponentsCalendar = require('@alfalab/core-components-calendar/cssm');
|
|
6
|
+
require('react-merge-refs');
|
|
7
|
+
require('classnames');
|
|
8
|
+
require('@alfalab/core-components-date-input/cssm');
|
|
9
|
+
require('@alfalab/core-components-popover/cssm');
|
|
10
|
+
require('@alfalab/icons-glyph/CalendarMIcon');
|
|
11
|
+
require('./utils.js');
|
|
12
|
+
require('date-fns/format');
|
|
13
|
+
require('date-fns/isSameDay');
|
|
14
|
+
require('date-fns/parse');
|
|
15
|
+
require('./components/calendar-input/index.module.css');
|
|
16
|
+
|
|
17
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
18
|
+
|
|
19
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
20
|
+
|
|
21
|
+
var CalendarInputMobile = function (props) { return (React__default.default.createElement(components_calendarInput_Component.CalendarInput, components_calendarInput_Component.__assign({ Calendar: coreComponentsCalendar.CalendarMobile, view: 'mobile' }, props))); };
|
|
22
|
+
|
|
23
|
+
exports.CalendarInputMobile = CalendarInputMobile;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { CalendarInputProps } from "./Component-fde0c12c";
|
|
3
|
+
type CalendarInputResponsiveProps = Omit<CalendarInputProps, 'view'> & {
|
|
4
|
+
/**
|
|
5
|
+
* Контрольная точка, с нее начинается desktop версия
|
|
6
|
+
* @default 1024
|
|
7
|
+
*/
|
|
8
|
+
breakpoint?: number;
|
|
9
|
+
};
|
|
10
|
+
type CalendarInputMedia = 'desktop' | 'mobile';
|
|
11
|
+
declare const CalendarInputResponsive: FC<CalendarInputResponsiveProps>;
|
|
12
|
+
export { CalendarInputResponsiveProps, CalendarInputMedia, CalendarInputResponsive };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var components_calendarInput_Component = require('./Component-fde0c12c.js');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var hooks = require('@alfalab/hooks');
|
|
6
|
+
var Component_desktop = require('./Component.desktop.js');
|
|
7
|
+
var Component_mobile = require('./Component.mobile.js');
|
|
8
|
+
require('react-merge-refs');
|
|
9
|
+
require('classnames');
|
|
10
|
+
require('@alfalab/core-components-calendar/cssm');
|
|
11
|
+
require('@alfalab/core-components-date-input/cssm');
|
|
12
|
+
require('@alfalab/core-components-popover/cssm');
|
|
13
|
+
require('@alfalab/icons-glyph/CalendarMIcon');
|
|
14
|
+
require('./utils.js');
|
|
15
|
+
require('date-fns/format');
|
|
16
|
+
require('date-fns/isSameDay');
|
|
17
|
+
require('date-fns/parse');
|
|
18
|
+
require('./components/calendar-input/index.module.css');
|
|
19
|
+
|
|
20
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
21
|
+
|
|
22
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
23
|
+
|
|
24
|
+
var CalendarInputResponsive = function (_a) {
|
|
25
|
+
var _b = _a.breakpoint, breakpoint = _b === void 0 ? 1024 : _b, restProps = components_calendarInput_Component.__rest(_a, ["breakpoint"]);
|
|
26
|
+
var view = hooks.useMedia([
|
|
27
|
+
['mobile', "(max-width: ".concat(breakpoint - 1, "px)")],
|
|
28
|
+
['desktop', "(min-width: ".concat(breakpoint, "px)")],
|
|
29
|
+
], 'desktop')[0];
|
|
30
|
+
return view === 'desktop' ? (React__default.default.createElement(Component_desktop.CalendarInputDesktop, components_calendarInput_Component.__assign({}, restProps))) : (React__default.default.createElement(Component_mobile.CalendarInputMobile, components_calendarInput_Component.__assign({}, restProps)));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.CalendarInputResponsive = CalendarInputResponsive;
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var components_calendarInput_Component = require('../../Component-fde0c12c.js');
|
|
4
|
+
require('react');
|
|
5
|
+
require('react-merge-refs');
|
|
6
|
+
require('classnames');
|
|
7
|
+
require('@alfalab/core-components-calendar/cssm');
|
|
8
|
+
require('@alfalab/core-components-date-input/cssm');
|
|
9
|
+
require('@alfalab/core-components-popover/cssm');
|
|
10
|
+
require('@alfalab/icons-glyph/CalendarMIcon');
|
|
11
|
+
require('../../utils.js');
|
|
12
|
+
require('./index.module.css');
|
|
13
|
+
require('date-fns/format');
|
|
14
|
+
require('date-fns/isSameDay');
|
|
15
|
+
require('date-fns/parse');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
exports.CalendarInput = components_calendarInput_Component.CalendarInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../Component-fde0c12c";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var components_calendarInput_Component = require('../../Component-fde0c12c.js');
|
|
4
|
+
require('react');
|
|
5
|
+
require('react-merge-refs');
|
|
6
|
+
require('classnames');
|
|
7
|
+
require('@alfalab/core-components-calendar/cssm');
|
|
8
|
+
require('@alfalab/core-components-date-input/cssm');
|
|
9
|
+
require('@alfalab/core-components-popover/cssm');
|
|
10
|
+
require('@alfalab/icons-glyph/CalendarMIcon');
|
|
11
|
+
require('../../utils.js');
|
|
12
|
+
require('date-fns/format');
|
|
13
|
+
require('date-fns/isSameDay');
|
|
14
|
+
require('date-fns/parse');
|
|
15
|
+
require('./index.module.css');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
exports.CalendarInput = components_calendarInput_Component.CalendarInput;
|
|
File without changes
|
package/cssm/desktop.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Component_desktop = require('./Component.desktop.js');
|
|
4
|
+
require('./Component-fde0c12c.js');
|
|
5
|
+
require('react');
|
|
6
|
+
require('react-merge-refs');
|
|
7
|
+
require('classnames');
|
|
8
|
+
require('@alfalab/core-components-calendar/cssm');
|
|
9
|
+
require('@alfalab/core-components-date-input/cssm');
|
|
10
|
+
require('@alfalab/core-components-popover/cssm');
|
|
11
|
+
require('@alfalab/icons-glyph/CalendarMIcon');
|
|
12
|
+
require('./utils.js');
|
|
13
|
+
require('date-fns/format');
|
|
14
|
+
require('date-fns/isSameDay');
|
|
15
|
+
require('date-fns/parse');
|
|
16
|
+
require('./components/calendar-input/index.module.css');
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
exports.CalendarInputDesktop = Component_desktop.CalendarInputDesktop;
|
package/cssm/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { CalendarInputResponsive as CalendarInput, CalendarInputResponsiveProps as CalendarInputProps } from "./responsive";
|
|
2
2
|
export * from "./utils";
|
package/cssm/index.js
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var Component_responsive = require('./Component.responsive.js');
|
|
4
4
|
var utils = require('./utils.js');
|
|
5
|
+
require('./Component-fde0c12c.js');
|
|
5
6
|
require('react');
|
|
6
7
|
require('react-merge-refs');
|
|
7
8
|
require('classnames');
|
|
8
9
|
require('@alfalab/core-components-calendar/cssm');
|
|
9
10
|
require('@alfalab/core-components-date-input/cssm');
|
|
10
11
|
require('@alfalab/core-components-popover/cssm');
|
|
11
|
-
require('@alfalab/hooks');
|
|
12
12
|
require('@alfalab/icons-glyph/CalendarMIcon');
|
|
13
|
-
require('./index.module.css');
|
|
13
|
+
require('./components/calendar-input/index.module.css');
|
|
14
|
+
require('@alfalab/hooks');
|
|
15
|
+
require('./Component.desktop.js');
|
|
14
16
|
require('date-fns/format');
|
|
15
17
|
require('date-fns/isSameDay');
|
|
16
18
|
require('date-fns/parse');
|
|
19
|
+
require('./Component.mobile.js');
|
|
17
20
|
|
|
18
21
|
|
|
19
22
|
|
|
20
|
-
exports.CalendarInput =
|
|
23
|
+
exports.CalendarInput = Component_responsive.CalendarInputResponsive;
|
|
21
24
|
exports.DATE_FORMAT = utils.DATE_FORMAT;
|
|
22
25
|
exports.DATE_MASK = utils.DATE_MASK;
|
|
23
26
|
exports.IS_BROWSER = utils.IS_BROWSER;
|
package/cssm/mobile.d.ts
ADDED
package/cssm/mobile.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Component_mobile = require('./Component.mobile.js');
|
|
4
|
+
require('./Component-fde0c12c.js');
|
|
5
|
+
require('react');
|
|
6
|
+
require('react-merge-refs');
|
|
7
|
+
require('classnames');
|
|
8
|
+
require('@alfalab/core-components-calendar/cssm');
|
|
9
|
+
require('@alfalab/core-components-date-input/cssm');
|
|
10
|
+
require('@alfalab/core-components-popover/cssm');
|
|
11
|
+
require('@alfalab/icons-glyph/CalendarMIcon');
|
|
12
|
+
require('./utils.js');
|
|
13
|
+
require('date-fns/format');
|
|
14
|
+
require('date-fns/isSameDay');
|
|
15
|
+
require('date-fns/parse');
|
|
16
|
+
require('./components/calendar-input/index.module.css');
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
exports.CalendarInputMobile = Component_mobile.CalendarInputMobile;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Component_responsive = require('./Component.responsive.js');
|
|
4
|
+
require('./Component-fde0c12c.js');
|
|
5
|
+
require('react');
|
|
6
|
+
require('react-merge-refs');
|
|
7
|
+
require('classnames');
|
|
8
|
+
require('@alfalab/core-components-calendar/cssm');
|
|
9
|
+
require('@alfalab/core-components-date-input/cssm');
|
|
10
|
+
require('@alfalab/core-components-popover/cssm');
|
|
11
|
+
require('@alfalab/icons-glyph/CalendarMIcon');
|
|
12
|
+
require('./utils.js');
|
|
13
|
+
require('date-fns/format');
|
|
14
|
+
require('date-fns/isSameDay');
|
|
15
|
+
require('date-fns/parse');
|
|
16
|
+
require('./components/calendar-input/index.module.css');
|
|
17
|
+
require('@alfalab/hooks');
|
|
18
|
+
require('./Component.desktop.js');
|
|
19
|
+
require('./Component.mobile.js');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
exports.CalendarInputResponsive = Component_responsive.CalendarInputResponsive;
|
package/cssm/utils.js
CHANGED
|
@@ -6,6 +6,12 @@ var parse = require('date-fns/parse');
|
|
|
6
6
|
var coreComponentsCalendar = require('@alfalab/core-components-calendar/cssm');
|
|
7
7
|
var coreComponentsDateInput = require('@alfalab/core-components-date-input/cssm');
|
|
8
8
|
|
|
9
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
10
|
+
|
|
11
|
+
var format__default = /*#__PURE__*/_interopDefaultCompat(format);
|
|
12
|
+
var isSameDay__default = /*#__PURE__*/_interopDefaultCompat(isSameDay);
|
|
13
|
+
var parse__default = /*#__PURE__*/_interopDefaultCompat(parse);
|
|
14
|
+
|
|
9
15
|
var DATE_FORMAT = 'dd.MM.yyyy';
|
|
10
16
|
var NATIVE_DATE_FORMAT = 'yyyy-MM-dd';
|
|
11
17
|
var DATE_MASK = [/\d/, /\d/, '.', /\d/, /\d/, '.', /\d/, /\d/, /\d/, /\d/];
|
|
@@ -13,11 +19,11 @@ var IS_BROWSER = typeof window !== 'undefined';
|
|
|
13
19
|
var SUPPORTS_INPUT_TYPE_DATE = IS_BROWSER && isInputDateSupported();
|
|
14
20
|
var formatDate = function (date, dateFormat) {
|
|
15
21
|
if (dateFormat === void 0) { dateFormat = DATE_FORMAT; }
|
|
16
|
-
return
|
|
22
|
+
return format__default.default(date, dateFormat);
|
|
17
23
|
};
|
|
18
24
|
var parseDateString = function (value, dateFormat) {
|
|
19
25
|
if (dateFormat === void 0) { dateFormat = DATE_FORMAT; }
|
|
20
|
-
return
|
|
26
|
+
return parse__default.default(value, dateFormat, new Date());
|
|
21
27
|
};
|
|
22
28
|
/**
|
|
23
29
|
* Возвращает `true`, если поддерживается `input[type="date"]`
|
|
@@ -37,7 +43,7 @@ var isValidInputValue = function (newInputValue, minDate, maxDate, offDays) {
|
|
|
37
43
|
return Boolean(dateValue &&
|
|
38
44
|
coreComponentsDateInput.isCompleteDateInput(newInputValue) &&
|
|
39
45
|
coreComponentsCalendar.dateInLimits(dateValue, minDate, maxDate) &&
|
|
40
|
-
!offDays.some(function (offDay) { return
|
|
46
|
+
!offDays.some(function (offDay) { return isSameDay__default.default(offDay, dateValue); }));
|
|
41
47
|
};
|
|
42
48
|
|
|
43
49
|
exports.DATE_FORMAT = DATE_FORMAT;
|
package/desktop.d.ts
ADDED
package/desktop.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Component_desktop = require('./Component.desktop.js');
|
|
4
|
+
require('./Component-98dcf994.js');
|
|
5
|
+
require('react');
|
|
6
|
+
require('react-merge-refs');
|
|
7
|
+
require('classnames');
|
|
8
|
+
require('@alfalab/core-components-calendar');
|
|
9
|
+
require('@alfalab/core-components-date-input');
|
|
10
|
+
require('@alfalab/core-components-popover');
|
|
11
|
+
require('@alfalab/icons-glyph/CalendarMIcon');
|
|
12
|
+
require('./utils.js');
|
|
13
|
+
require('date-fns/format');
|
|
14
|
+
require('date-fns/isSameDay');
|
|
15
|
+
require('date-fns/parse');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
exports.CalendarInputDesktop = Component_desktop.CalendarInputDesktop;
|
|
@@ -4,6 +4,39 @@ import { ChangeEvent, ElementType, MouseEvent } from "react";
|
|
|
4
4
|
import { CalendarMobileProps, CalendarProps } from "@alfalab/core-components-calendar";
|
|
5
5
|
import { DateInputProps } from "@alfalab/core-components-date-input";
|
|
6
6
|
import { PopoverProps } from "@alfalab/core-components-popover";
|
|
7
|
+
declare function __extends(d: any, b: any): void;
|
|
8
|
+
declare function __rest(s: any, e: any): {};
|
|
9
|
+
declare function __decorate(decorators: any, target: any, key: any, desc: any, ...args: any[]): any;
|
|
10
|
+
declare function __param(paramIndex: any, decorator: any): (target: any, key: any) => void;
|
|
11
|
+
declare function __metadata(metadataKey: any, metadataValue: any): any;
|
|
12
|
+
declare function __awaiter(thisArg: any, _arguments: any, P: any, generator: any): any;
|
|
13
|
+
declare function __generator(thisArg: any, body: any): {
|
|
14
|
+
next: (v: any) => any;
|
|
15
|
+
throw: (v: any) => any;
|
|
16
|
+
return: (v: any) => any;
|
|
17
|
+
};
|
|
18
|
+
declare function __exportStar(m: any, o: any): void;
|
|
19
|
+
declare function __values(o: any): any;
|
|
20
|
+
declare function __read(o: any, n: any): any;
|
|
21
|
+
declare function __spread(...args: any[]): any[];
|
|
22
|
+
declare function __spreadArrays(...args: any[]): any[];
|
|
23
|
+
declare function __spreadArray(to: any, from: any, pack: any, ...args: any[]): any;
|
|
24
|
+
declare function __await(v: any): __await;
|
|
25
|
+
declare class __await {
|
|
26
|
+
constructor(v: any);
|
|
27
|
+
v: any;
|
|
28
|
+
}
|
|
29
|
+
declare function __asyncGenerator(thisArg: any, _arguments: any, generator: any): {};
|
|
30
|
+
declare function __asyncDelegator(o: any): {};
|
|
31
|
+
declare function __asyncValues(o: any): any;
|
|
32
|
+
declare function __makeTemplateObject(cooked: any, raw: any): any;
|
|
33
|
+
declare function __importStar(mod: any): any;
|
|
34
|
+
declare function __importDefault(mod: any): any;
|
|
35
|
+
declare function __classPrivateFieldGet(receiver: any, state: any, kind: any, f: any): any;
|
|
36
|
+
declare function __classPrivateFieldSet(receiver: any, state: any, value: any, kind: any, f: any): any;
|
|
37
|
+
declare function __classPrivateFieldIn(state: any, receiver: any): any;
|
|
38
|
+
declare function __assign(...args: any[]): any;
|
|
39
|
+
declare function __createBinding(o: any, m: any, k: any, k2: any): void;
|
|
7
40
|
type CalendarInputProps = Omit<DateInputProps, 'onChange' | 'mobileMode'> & {
|
|
8
41
|
/**
|
|
9
42
|
* Дополнительный класс
|
|
@@ -69,7 +102,7 @@ type CalendarInputProps = Omit<DateInputProps, 'onChange' | 'mobileMode'> & {
|
|
|
69
102
|
/**
|
|
70
103
|
* Компонент календаря
|
|
71
104
|
*/
|
|
72
|
-
Calendar?: ElementType
|
|
105
|
+
Calendar?: ElementType;
|
|
73
106
|
/**
|
|
74
107
|
* Обработчик изменения значения
|
|
75
108
|
*/
|
|
@@ -100,6 +133,10 @@ type CalendarInputProps = Omit<DateInputProps, 'onChange' | 'mobileMode'> & {
|
|
|
100
133
|
* Календарь будет принимать ширину инпута
|
|
101
134
|
*/
|
|
102
135
|
useAnchorWidth?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Отображение компонента в мобильном или десктопном виде
|
|
138
|
+
*/
|
|
139
|
+
view?: 'desktop' | 'mobile';
|
|
103
140
|
};
|
|
104
141
|
declare const CalendarInput: React.ForwardRefExoticComponent<Omit<DateInputProps, "onChange" | "mobileMode"> & {
|
|
105
142
|
/**
|
|
@@ -119,9 +156,7 @@ declare const CalendarInput: React.ForwardRefExoticComponent<Omit<DateInputProps
|
|
|
119
156
|
*/
|
|
120
157
|
calendarProps?: (CalendarProps & Record<string, unknown>) | (CalendarProps & {
|
|
121
158
|
open: boolean;
|
|
122
|
-
title?: string | undefined;
|
|
123
|
-
* Дополнительный класс для поповера
|
|
124
|
-
*/
|
|
159
|
+
title?: string | undefined;
|
|
125
160
|
onClose?: (() => void) | undefined;
|
|
126
161
|
yearsAmount?: number | undefined;
|
|
127
162
|
hasHeader?: boolean | undefined;
|
|
@@ -175,7 +210,7 @@ declare const CalendarInput: React.ForwardRefExoticComponent<Omit<DateInputProps
|
|
|
175
210
|
/**
|
|
176
211
|
* Компонент календаря
|
|
177
212
|
*/
|
|
178
|
-
Calendar?: React.ElementType<
|
|
213
|
+
Calendar?: React.ElementType<any> | undefined;
|
|
179
214
|
/**
|
|
180
215
|
* Обработчик изменения значения
|
|
181
216
|
*/
|
|
@@ -206,5 +241,9 @@ declare const CalendarInput: React.ForwardRefExoticComponent<Omit<DateInputProps
|
|
|
206
241
|
* Календарь будет принимать ширину инпута
|
|
207
242
|
*/
|
|
208
243
|
useAnchorWidth?: boolean | undefined;
|
|
244
|
+
/**
|
|
245
|
+
* Отображение компонента в мобильном или десктопном виде
|
|
246
|
+
*/
|
|
247
|
+
view?: "desktop" | "mobile" | undefined;
|
|
209
248
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
210
|
-
export { CalendarInputProps, CalendarInput };
|
|
249
|
+
export { __extends, __rest, __decorate, __param, __metadata, __awaiter, __generator, __exportStar, __values, __read, __spread, __spreadArrays, __spreadArray, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet, __classPrivateFieldIn, __assign, __createBinding, CalendarInputProps, CalendarInput };
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import React, { forwardRef, useState, useCallback, useRef, useEffect } from 'react';
|
|
2
2
|
import mergeRefs from 'react-merge-refs';
|
|
3
3
|
import cn from 'classnames';
|
|
4
|
-
import { dateInLimits,
|
|
4
|
+
import { dateInLimits, Calendar } from '@alfalab/core-components-calendar/esm';
|
|
5
5
|
import { parseDateString, isCompleteDateInput, formatDate, DateInput } from '@alfalab/core-components-date-input/esm';
|
|
6
6
|
import { Popover } from '@alfalab/core-components-popover/esm';
|
|
7
|
-
import { useMedia } from '@alfalab/hooks';
|
|
8
7
|
import { CalendarMIcon } from '@alfalab/icons-glyph/CalendarMIcon';
|
|
9
8
|
import { SUPPORTS_INPUT_TYPE_DATE } from './utils.js';
|
|
10
|
-
import 'date-fns/format';
|
|
11
|
-
import 'date-fns/isSameDay';
|
|
12
|
-
import 'date-fns/parse';
|
|
13
9
|
|
|
14
10
|
/******************************************************************************
|
|
15
11
|
Copyright (c) Microsoft Corporation.
|
|
@@ -50,25 +46,20 @@ function __rest(s, e) {
|
|
|
50
46
|
return t;
|
|
51
47
|
}
|
|
52
48
|
|
|
53
|
-
var styles = {"component":"calendar-
|
|
54
|
-
require('./index.css')
|
|
49
|
+
var styles = {"component":"calendar-input__component_wpjcj","block":"calendar-input__block_wpjcj","calendarContainer":"calendar-input__calendarContainer_wpjcj","calendarResponsive":"calendar-input__calendarResponsive_wpjcj","calendarIcon":"calendar-input__calendarIcon_wpjcj","nativeInput":"calendar-input__nativeInput_wpjcj"};
|
|
50
|
+
require('./components/calendar-input/index.css')
|
|
55
51
|
|
|
56
52
|
var CalendarInput = forwardRef(function (_a, ref) {
|
|
57
53
|
var _b, _c;
|
|
58
54
|
var _d;
|
|
59
|
-
var _e = _a.block, block = _e === void 0 ? false : _e, className = _a.className; _a.inputClassName; var popoverClassName = _a.popoverClassName, _f = _a.defaultOpen, defaultOpen = _f === void 0 ? false : _f, defaultMonth = _a.defaultMonth, _g = _a.defaultValue, defaultValue = _g === void 0 ? '' : _g, _h = _a.calendarPosition, calendarPosition = _h === void 0 ? 'popover' : _h, value = _a.value, dataTestId = _a.dataTestId, _j = _a.calendarProps, calendarProps = _j === void 0 ? {} : _j, _k = _a.minDate, minDate = _k === void 0 ? calendarProps.minDate : _k, _l = _a.maxDate, maxDate = _l === void 0 ? calendarProps.maxDate : _l, _m = _a.offDays, offDays = _m === void 0 ? calendarProps.offDays || [] : _m, _o = _a.events, events = _o === void 0 ? calendarProps.events || [] : _o, preventFlip = _a.preventFlip, _p = _a.mobileMode, mobileMode = _p === void 0 ? 'popover' : _p, _q = _a.wrapperRef, wrapperRef = _q === void 0 ? null : _q, disabled = _a.disabled, _r = _a.onChange, onChange = _r === void 0 ? function () { return null; } : _r, onInputChange = _a.onInputChange, onCalendarChange = _a.onCalendarChange, onKeyDown = _a.onKeyDown, readOnly = _a.readOnly, _s = _a.Calendar, Calendar$1 = _s === void 0 ? Calendar : _s, _t = _a.popoverPosition, popoverPosition = _t === void 0 ? 'bottom-start' : _t, zIndexPopover = _a.zIndexPopover, useAnchorWidth = _a.useAnchorWidth, rightAddons = _a.rightAddons, error = _a.error, restProps = __rest(_a, ["block", "className", "inputClassName", "popoverClassName", "defaultOpen", "defaultMonth", "defaultValue", "calendarPosition", "value", "dataTestId", "calendarProps", "minDate", "maxDate", "offDays", "events", "preventFlip", "mobileMode", "wrapperRef", "disabled", "onChange", "onInputChange", "onCalendarChange", "onKeyDown", "readOnly", "Calendar", "popoverPosition", "zIndexPopover", "useAnchorWidth", "rightAddons", "error"]);
|
|
60
|
-
var view = useMedia([
|
|
61
|
-
['mobile', '(max-width: 1023px)'],
|
|
62
|
-
['desktop', '(min-width: 1024px)'],
|
|
63
|
-
], 'desktop')[0];
|
|
64
|
-
var CalendarComponent = view === 'desktop' ? Calendar$1 : CalendarMobile;
|
|
55
|
+
var _e = _a.block, block = _e === void 0 ? false : _e, className = _a.className; _a.inputClassName; var popoverClassName = _a.popoverClassName, _f = _a.defaultOpen, defaultOpen = _f === void 0 ? false : _f, defaultMonth = _a.defaultMonth, _g = _a.defaultValue, defaultValue = _g === void 0 ? '' : _g, _h = _a.calendarPosition, calendarPosition = _h === void 0 ? 'popover' : _h, value = _a.value, dataTestId = _a.dataTestId, _j = _a.calendarProps, calendarProps = _j === void 0 ? {} : _j, _k = _a.minDate, minDate = _k === void 0 ? calendarProps.minDate : _k, _l = _a.maxDate, maxDate = _l === void 0 ? calendarProps.maxDate : _l, _m = _a.offDays, offDays = _m === void 0 ? calendarProps.offDays || [] : _m, _o = _a.events, events = _o === void 0 ? calendarProps.events || [] : _o, preventFlip = _a.preventFlip, _p = _a.mobileMode, mobileMode = _p === void 0 ? 'popover' : _p, _q = _a.wrapperRef, wrapperRef = _q === void 0 ? null : _q, disabled = _a.disabled, _r = _a.onChange, onChange = _r === void 0 ? function () { return null; } : _r, onInputChange = _a.onInputChange, onCalendarChange = _a.onCalendarChange, onKeyDown = _a.onKeyDown, readOnly = _a.readOnly, _s = _a.Calendar, Calendar$1 = _s === void 0 ? Calendar : _s, _t = _a.popoverPosition, popoverPosition = _t === void 0 ? 'bottom-start' : _t, zIndexPopover = _a.zIndexPopover, useAnchorWidth = _a.useAnchorWidth, rightAddons = _a.rightAddons, error = _a.error, _u = _a.view, view = _u === void 0 ? 'desktop' : _u, restProps = __rest(_a, ["block", "className", "inputClassName", "popoverClassName", "defaultOpen", "defaultMonth", "defaultValue", "calendarPosition", "value", "dataTestId", "calendarProps", "minDate", "maxDate", "offDays", "events", "preventFlip", "mobileMode", "wrapperRef", "disabled", "onChange", "onInputChange", "onCalendarChange", "onKeyDown", "readOnly", "Calendar", "popoverPosition", "zIndexPopover", "useAnchorWidth", "rightAddons", "error", "view"]);
|
|
65
56
|
var calendarResponsive = (_d = calendarProps === null || calendarProps === void 0 ? void 0 : calendarProps.responsive) !== null && _d !== void 0 ? _d : true;
|
|
66
57
|
var shouldRenderNative = SUPPORTS_INPUT_TYPE_DATE && mobileMode === 'native';
|
|
67
58
|
var shouldRenderOnlyInput = mobileMode === 'input';
|
|
68
59
|
var shouldRenderStatic = calendarPosition === 'static' && !shouldRenderOnlyInput;
|
|
69
60
|
var shouldRenderPopover = calendarPosition === 'popover' && !shouldRenderNative && !shouldRenderOnlyInput;
|
|
70
|
-
var
|
|
71
|
-
var
|
|
61
|
+
var _v = useState(false), open = _v[0], setOpen = _v[1];
|
|
62
|
+
var _w = useState(value || defaultValue), inputValue = _w[0], setInputValue = _w[1];
|
|
72
63
|
var calendarValue = inputValue ? parseDateString(inputValue).getTime() : undefined;
|
|
73
64
|
var checkInputValueIsValid = useCallback(function (newInputValue) {
|
|
74
65
|
if (!newInputValue)
|
|
@@ -161,7 +152,7 @@ var CalendarInput = forwardRef(function (_a, ref) {
|
|
|
161
152
|
var renderCalendar = function () { return (
|
|
162
153
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
163
154
|
React.createElement("div", { onMouseDown: handleCalendarWrapperMouseDown },
|
|
164
|
-
React.createElement(
|
|
155
|
+
React.createElement(Calendar$1, __assign({}, calendarProps, { responsive: calendarResponsive, open: open, onClose: handleCalendarClose, ref: calendarRef, defaultMonth: defaultMonth, value: checkInputValueIsValid(inputValue) ? calendarValue : undefined, onChange: handleCalendarChange, minDate: minDate, maxDate: maxDate, offDays: offDays, events: events })))); };
|
|
165
156
|
return (
|
|
166
157
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
167
158
|
React.createElement("div", { className: cn(styles.component, className, (_b = {},
|
|
@@ -176,4 +167,4 @@ var CalendarInput = forwardRef(function (_a, ref) {
|
|
|
176
167
|
_c)), className: popoverClassName, position: popoverPosition, offset: [0, 4], withTransition: false, preventFlip: preventFlip, zIndex: zIndexPopover }, renderCalendar()))));
|
|
177
168
|
});
|
|
178
169
|
|
|
179
|
-
export { CalendarInput };
|
|
170
|
+
export { CalendarInput as C, __assign as _, __rest as a };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { CalendarInputProps } from "./Component-8d1a1461";
|
|
3
|
+
type CalendarInputDesktopProps = Omit<CalendarInputProps, 'view'>;
|
|
4
|
+
declare const CalendarInputDesktop: FC<CalendarInputDesktopProps>;
|
|
5
|
+
export { CalendarInputDesktopProps, CalendarInputDesktop };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { C as CalendarInput, _ as __assign } from './Component-8d1a1461.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import 'react-merge-refs';
|
|
4
|
+
import 'classnames';
|
|
5
|
+
import '@alfalab/core-components-calendar/esm';
|
|
6
|
+
import '@alfalab/core-components-date-input/esm';
|
|
7
|
+
import '@alfalab/core-components-popover/esm';
|
|
8
|
+
import '@alfalab/icons-glyph/CalendarMIcon';
|
|
9
|
+
import './utils.js';
|
|
10
|
+
import 'date-fns/format';
|
|
11
|
+
import 'date-fns/isSameDay';
|
|
12
|
+
import 'date-fns/parse';
|
|
13
|
+
|
|
14
|
+
var CalendarInputDesktop = function (props) { return (React.createElement(CalendarInput, __assign({}, props))); };
|
|
15
|
+
|
|
16
|
+
export { CalendarInputDesktop };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { CalendarInputProps } from "./Component-8d1a1461";
|
|
3
|
+
type CalendarInputMobileProps = Omit<CalendarInputProps, 'view'>;
|
|
4
|
+
declare const CalendarInputMobile: FC<CalendarInputMobileProps>;
|
|
5
|
+
export { CalendarInputMobileProps, CalendarInputMobile };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { C as CalendarInput, _ as __assign } from './Component-8d1a1461.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { CalendarMobile } from '@alfalab/core-components-calendar/esm';
|
|
4
|
+
import 'react-merge-refs';
|
|
5
|
+
import 'classnames';
|
|
6
|
+
import '@alfalab/core-components-date-input/esm';
|
|
7
|
+
import '@alfalab/core-components-popover/esm';
|
|
8
|
+
import '@alfalab/icons-glyph/CalendarMIcon';
|
|
9
|
+
import './utils.js';
|
|
10
|
+
import 'date-fns/format';
|
|
11
|
+
import 'date-fns/isSameDay';
|
|
12
|
+
import 'date-fns/parse';
|
|
13
|
+
|
|
14
|
+
var CalendarInputMobile = function (props) { return (React.createElement(CalendarInput, __assign({ Calendar: CalendarMobile, view: 'mobile' }, props))); };
|
|
15
|
+
|
|
16
|
+
export { CalendarInputMobile };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { CalendarInputProps } from "./Component-8d1a1461";
|
|
3
|
+
type CalendarInputResponsiveProps = Omit<CalendarInputProps, 'view'> & {
|
|
4
|
+
/**
|
|
5
|
+
* Контрольная точка, с нее начинается desktop версия
|
|
6
|
+
* @default 1024
|
|
7
|
+
*/
|
|
8
|
+
breakpoint?: number;
|
|
9
|
+
};
|
|
10
|
+
type CalendarInputMedia = 'desktop' | 'mobile';
|
|
11
|
+
declare const CalendarInputResponsive: FC<CalendarInputResponsiveProps>;
|
|
12
|
+
export { CalendarInputResponsiveProps, CalendarInputMedia, CalendarInputResponsive };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { a as __rest, _ as __assign } from './Component-8d1a1461.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useMedia } from '@alfalab/hooks';
|
|
4
|
+
import { CalendarInputDesktop } from './Component.desktop.js';
|
|
5
|
+
import { CalendarInputMobile } from './Component.mobile.js';
|
|
6
|
+
import 'react-merge-refs';
|
|
7
|
+
import 'classnames';
|
|
8
|
+
import '@alfalab/core-components-calendar/esm';
|
|
9
|
+
import '@alfalab/core-components-date-input/esm';
|
|
10
|
+
import '@alfalab/core-components-popover/esm';
|
|
11
|
+
import '@alfalab/icons-glyph/CalendarMIcon';
|
|
12
|
+
import './utils.js';
|
|
13
|
+
import 'date-fns/format';
|
|
14
|
+
import 'date-fns/isSameDay';
|
|
15
|
+
import 'date-fns/parse';
|
|
16
|
+
|
|
17
|
+
var CalendarInputResponsive = function (_a) {
|
|
18
|
+
var _b = _a.breakpoint, breakpoint = _b === void 0 ? 1024 : _b, restProps = __rest(_a, ["breakpoint"]);
|
|
19
|
+
var view = useMedia([
|
|
20
|
+
['mobile', "(max-width: ".concat(breakpoint - 1, "px)")],
|
|
21
|
+
['desktop', "(min-width: ".concat(breakpoint, "px)")],
|
|
22
|
+
], 'desktop')[0];
|
|
23
|
+
return view === 'desktop' ? (React.createElement(CalendarInputDesktop, __assign({}, restProps))) : (React.createElement(CalendarInputMobile, __assign({}, restProps)));
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { CalendarInputResponsive };
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { C as CalendarInput } from '../../Component-8d1a1461.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'react-merge-refs';
|
|
4
|
+
import 'classnames';
|
|
5
|
+
import '@alfalab/core-components-calendar/esm';
|
|
6
|
+
import '@alfalab/core-components-date-input/esm';
|
|
7
|
+
import '@alfalab/core-components-popover/esm';
|
|
8
|
+
import '@alfalab/icons-glyph/CalendarMIcon';
|
|
9
|
+
import '../../utils.js';
|
|
10
|
+
import 'date-fns/format';
|
|
11
|
+
import 'date-fns/isSameDay';
|
|
12
|
+
import 'date-fns/parse';
|