@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.
- package/{esm/Component.d.ts → Component-27749cf7.d.ts} +47 -3
- package/{Component.js → Component-27749cf7.js} +20 -29
- 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/date-time-input/Component.d.ts +0 -0
- package/components/date-time-input/Component.js +18 -0
- package/{esm → components/date-time-input}/index.css +6 -6
- package/components/date-time-input/index.d.ts +1 -0
- package/components/date-time-input/index.js +18 -0
- package/cssm/{Component.d.ts → Component-d6110aa7.d.ts} +47 -3
- package/cssm/{Component.js → Component-d6110aa7.js} +22 -31
- 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/date-time-input/Component.d.ts +0 -0
- package/cssm/components/date-time-input/Component.js +19 -0
- package/cssm/components/date-time-input/index.d.ts +1 -0
- package/cssm/components/date-time-input/index.js +19 -0
- package/cssm/{index.module.css → components/date-time-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 +8 -7
- 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/format.js +10 -12
- package/cssm/utils/index.js +1 -3
- package/desktop.d.ts +2 -0
- package/desktop.js +19 -0
- package/{modern/Component.d.ts → esm/Component-e82a534f.d.ts} +47 -3
- package/esm/{Component.js → Component-e82a534f.js} +8 -16
- 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/date-time-input/Component.d.ts +0 -0
- package/esm/components/date-time-input/Component.js +12 -0
- package/{index.css → esm/components/date-time-input/index.css} +6 -6
- package/esm/components/date-time-input/index.d.ts +1 -0
- package/esm/components/date-time-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 +6 -3
- 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/esm/utils/format.js +4 -4
- package/esm/utils/index.js +1 -1
- package/index.d.ts +1 -1
- package/index.js +7 -6
- 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/date-time-input/Component.d.ts} +13 -2
- package/modern/{Component.js → components/date-time-input/Component.js} +5 -11
- package/modern/{index.css → components/date-time-input/index.css} +6 -6
- package/modern/components/date-time-input/index.d.ts +1 -0
- package/modern/components/date-time-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 +6 -3
- 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/modern/utils/index.js +1 -1
- package/package.json +5 -5
- package/responsive.d.ts +2 -0
- package/responsive.js +22 -0
- package/utils/format.js +10 -12
- package/utils/index.js +1 -3
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var components_dateTimeInput_Component = require('./Component-d6110aa7.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-icon-button/cssm');
|
|
9
|
+
require('@alfalab/core-components-input/cssm');
|
|
10
|
+
require('@alfalab/core-components-popover/cssm');
|
|
11
|
+
require('@alfalab/icons-glyph/CalendarMIcon');
|
|
12
|
+
require('./utils/format.js');
|
|
13
|
+
require('date-fns/isValid');
|
|
14
|
+
require('date-fns/parse');
|
|
15
|
+
require('./components/date-time-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 DateTimeInputMobile = function (props) { return (React__default.default.createElement(components_dateTimeInput_Component.DateTimeInput, components_dateTimeInput_Component.__assign({ Calendar: coreComponentsCalendar.CalendarMobile, view: 'mobile' }, props))); };
|
|
22
|
+
|
|
23
|
+
exports.DateTimeInputMobile = DateTimeInputMobile;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { DateTimeInputProps } from "./Component-d6110aa7";
|
|
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,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var components_dateTimeInput_Component = require('./Component-d6110aa7.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-icon-button/cssm');
|
|
12
|
+
require('@alfalab/core-components-input/cssm');
|
|
13
|
+
require('@alfalab/core-components-popover/cssm');
|
|
14
|
+
require('@alfalab/icons-glyph/CalendarMIcon');
|
|
15
|
+
require('./utils/format.js');
|
|
16
|
+
require('date-fns/isValid');
|
|
17
|
+
require('date-fns/parse');
|
|
18
|
+
require('./components/date-time-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 DateTimeInputResponsive = function (_a) {
|
|
25
|
+
var _b = _a.breakpoint, breakpoint = _b === void 0 ? 1024 : _b, restProps = components_dateTimeInput_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.DateTimeInputDesktop, components_dateTimeInput_Component.__assign({}, restProps))) : (React__default.default.createElement(Component_mobile.DateTimeInputMobile, components_dateTimeInput_Component.__assign({}, restProps)));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.DateTimeInputResponsive = DateTimeInputResponsive;
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var components_dateTimeInput_Component = require('../../Component-d6110aa7.js');
|
|
4
|
+
require('react');
|
|
5
|
+
require('react-merge-refs');
|
|
6
|
+
require('classnames');
|
|
7
|
+
require('@alfalab/core-components-calendar/cssm');
|
|
8
|
+
require('@alfalab/core-components-icon-button/cssm');
|
|
9
|
+
require('@alfalab/core-components-input/cssm');
|
|
10
|
+
require('@alfalab/core-components-popover/cssm');
|
|
11
|
+
require('@alfalab/icons-glyph/CalendarMIcon');
|
|
12
|
+
require('../../utils/format.js');
|
|
13
|
+
require('./index.module.css');
|
|
14
|
+
require('date-fns/isValid');
|
|
15
|
+
require('date-fns/parse');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
exports.DateTimeInput = components_dateTimeInput_Component.DateTimeInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../Component-d6110aa7";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var components_dateTimeInput_Component = require('../../Component-d6110aa7.js');
|
|
4
|
+
require('react');
|
|
5
|
+
require('react-merge-refs');
|
|
6
|
+
require('classnames');
|
|
7
|
+
require('@alfalab/core-components-calendar/cssm');
|
|
8
|
+
require('@alfalab/core-components-icon-button/cssm');
|
|
9
|
+
require('@alfalab/core-components-input/cssm');
|
|
10
|
+
require('@alfalab/core-components-popover/cssm');
|
|
11
|
+
require('@alfalab/icons-glyph/CalendarMIcon');
|
|
12
|
+
require('../../utils/format.js');
|
|
13
|
+
require('date-fns/isValid');
|
|
14
|
+
require('date-fns/parse');
|
|
15
|
+
require('./index.module.css');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
exports.DateTimeInput = components_dateTimeInput_Component.DateTimeInput;
|
|
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-d6110aa7.js');
|
|
5
|
+
require('react');
|
|
6
|
+
require('react-merge-refs');
|
|
7
|
+
require('classnames');
|
|
8
|
+
require('@alfalab/core-components-calendar/cssm');
|
|
9
|
+
require('@alfalab/core-components-icon-button/cssm');
|
|
10
|
+
require('@alfalab/core-components-input/cssm');
|
|
11
|
+
require('@alfalab/core-components-popover/cssm');
|
|
12
|
+
require('@alfalab/icons-glyph/CalendarMIcon');
|
|
13
|
+
require('./utils/format.js');
|
|
14
|
+
require('date-fns/isValid');
|
|
15
|
+
require('date-fns/parse');
|
|
16
|
+
require('./components/date-time-input/index.module.css');
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
exports.DateTimeInputDesktop = Component_desktop.DateTimeInputDesktop;
|
package/cssm/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { DateTimeInputResponsive as DateTimeInput, DateTimeInputResponsiveProps as DateTimeInputProps } from "./responsive";
|
package/cssm/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var Component = require('./Component.js');
|
|
3
|
+
var Component_responsive = require('./Component.responsive.js');
|
|
4
|
+
require('./Component-d6110aa7.js');
|
|
6
5
|
require('react');
|
|
7
6
|
require('react-merge-refs');
|
|
8
7
|
require('classnames');
|
|
@@ -10,13 +9,15 @@ require('@alfalab/core-components-calendar/cssm');
|
|
|
10
9
|
require('@alfalab/core-components-icon-button/cssm');
|
|
11
10
|
require('@alfalab/core-components-input/cssm');
|
|
12
11
|
require('@alfalab/core-components-popover/cssm');
|
|
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('./
|
|
18
|
-
require('
|
|
16
|
+
require('./components/date-time-input/index.module.css');
|
|
17
|
+
require('@alfalab/hooks');
|
|
18
|
+
require('./Component.desktop.js');
|
|
19
|
+
require('./Component.mobile.js');
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
|
|
22
|
-
exports.DateTimeInput =
|
|
23
|
+
exports.DateTimeInput = Component_responsive.DateTimeInputResponsive;
|
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-d6110aa7.js');
|
|
5
|
+
require('react');
|
|
6
|
+
require('react-merge-refs');
|
|
7
|
+
require('classnames');
|
|
8
|
+
require('@alfalab/core-components-calendar/cssm');
|
|
9
|
+
require('@alfalab/core-components-icon-button/cssm');
|
|
10
|
+
require('@alfalab/core-components-input/cssm');
|
|
11
|
+
require('@alfalab/core-components-popover/cssm');
|
|
12
|
+
require('@alfalab/icons-glyph/CalendarMIcon');
|
|
13
|
+
require('./utils/format.js');
|
|
14
|
+
require('date-fns/isValid');
|
|
15
|
+
require('date-fns/parse');
|
|
16
|
+
require('./components/date-time-input/index.module.css');
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
exports.DateTimeInputMobile = Component_mobile.DateTimeInputMobile;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Component_responsive = require('./Component.responsive.js');
|
|
4
|
+
require('./Component-d6110aa7.js');
|
|
5
|
+
require('react');
|
|
6
|
+
require('react-merge-refs');
|
|
7
|
+
require('classnames');
|
|
8
|
+
require('@alfalab/core-components-calendar/cssm');
|
|
9
|
+
require('@alfalab/core-components-icon-button/cssm');
|
|
10
|
+
require('@alfalab/core-components-input/cssm');
|
|
11
|
+
require('@alfalab/core-components-popover/cssm');
|
|
12
|
+
require('@alfalab/icons-glyph/CalendarMIcon');
|
|
13
|
+
require('./utils/format.js');
|
|
14
|
+
require('date-fns/isValid');
|
|
15
|
+
require('date-fns/parse');
|
|
16
|
+
require('./components/date-time-input/index.module.css');
|
|
17
|
+
require('@alfalab/hooks');
|
|
18
|
+
require('./Component.desktop.js');
|
|
19
|
+
require('./Component.mobile.js');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
exports.DateTimeInputResponsive = Component_responsive.DateTimeInputResponsive;
|
package/cssm/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
|
|
6
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
9
7
|
|
|
10
|
-
var dateFnsIsValid__default = /*#__PURE__*/
|
|
11
|
-
var parse__default = /*#__PURE__*/
|
|
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
|
|
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
|
|
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"
|
|
85
|
+
month = "0".concat(month);
|
|
88
86
|
}
|
|
89
87
|
if (day < 10) {
|
|
90
|
-
day = "0"
|
|
88
|
+
day = "0".concat(day);
|
|
91
89
|
}
|
|
92
|
-
return day
|
|
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
|
|
132
|
-
return value
|
|
129
|
+
if (value.length === 10 && dateFnsIsValid__default.default(parseDateString(value))) {
|
|
130
|
+
return "".concat(value, ", 00:00");
|
|
133
131
|
}
|
|
134
132
|
return value;
|
|
135
133
|
};
|
package/cssm/utils/index.js
CHANGED
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-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.DateTimeInputDesktop = Component_desktop.DateTimeInputDesktop;
|
|
@@ -4,6 +4,39 @@ import { ChangeEvent, ElementType } from "react";
|
|
|
4
4
|
import { CalendarMobileProps, CalendarProps } from "@alfalab/core-components-calendar";
|
|
5
5
|
import { InputProps } from "@alfalab/core-components-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 DateTimeInputProps = Omit<InputProps, 'onChange'> & {
|
|
8
41
|
/**
|
|
9
42
|
* Дополнительный класс
|
|
@@ -38,7 +71,7 @@ type DateTimeInputProps = Omit<InputProps, 'onChange'> & {
|
|
|
38
71
|
/**
|
|
39
72
|
* Компонент календаря
|
|
40
73
|
*/
|
|
41
|
-
Calendar?: ElementType
|
|
74
|
+
Calendar?: ElementType;
|
|
42
75
|
/**
|
|
43
76
|
* Доп. пропсы для календаря
|
|
44
77
|
*/
|
|
@@ -88,6 +121,10 @@ type DateTimeInputProps = Omit<InputProps, 'onChange'> & {
|
|
|
88
121
|
* Растягивает компонент на ширину контейнера
|
|
89
122
|
*/
|
|
90
123
|
block?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Отображение компонента в мобильном или десктопном виде
|
|
126
|
+
*/
|
|
127
|
+
view?: 'desktop' | 'mobile';
|
|
91
128
|
};
|
|
92
129
|
declare const DateTimeInput: React.ForwardRefExoticComponent<Omit<InputProps, "onChange"> & {
|
|
93
130
|
/**
|
|
@@ -123,12 +160,15 @@ declare const DateTimeInput: React.ForwardRefExoticComponent<Omit<InputProps, "o
|
|
|
123
160
|
/**
|
|
124
161
|
* Компонент календаря
|
|
125
162
|
*/
|
|
126
|
-
Calendar?: React.ElementType<
|
|
163
|
+
Calendar?: React.ElementType<any> | undefined;
|
|
127
164
|
/**
|
|
128
165
|
* Доп. пропсы для календаря
|
|
129
166
|
*/
|
|
130
167
|
calendarProps?: (CalendarProps & Record<string, unknown>) | (CalendarProps & {
|
|
131
168
|
open: boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Дополнительный класс для поповера
|
|
171
|
+
*/
|
|
132
172
|
title?: string | undefined;
|
|
133
173
|
onClose?: (() => void) | undefined;
|
|
134
174
|
yearsAmount?: number | undefined;
|
|
@@ -180,5 +220,9 @@ declare const DateTimeInput: React.ForwardRefExoticComponent<Omit<InputProps, "o
|
|
|
180
220
|
* Растягивает компонент на ширину контейнера
|
|
181
221
|
*/
|
|
182
222
|
block?: boolean | undefined;
|
|
223
|
+
/**
|
|
224
|
+
* Отображение компонента в мобильном или десктопном виде
|
|
225
|
+
*/
|
|
226
|
+
view?: "desktop" | "mobile" | undefined;
|
|
183
227
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
184
|
-
export { DateTimeInputProps, DateTimeInput };
|
|
228
|
+
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, DateTimeInputProps, DateTimeInput };
|
|
@@ -1,14 +1,11 @@
|
|
|
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 {
|
|
4
|
+
import { Calendar, dateInLimits } from '@alfalab/core-components-calendar/esm';
|
|
5
5
|
import { IconButton } from '@alfalab/core-components-icon-button/esm';
|
|
6
6
|
import { Input } from '@alfalab/core-components-input/esm';
|
|
7
7
|
import { Popover } from '@alfalab/core-components-popover/esm';
|
|
8
|
-
import { useMedia } from '@alfalab/hooks';
|
|
9
8
|
import { CalendarMIcon } from '@alfalab/icons-glyph/CalendarMIcon';
|
|
10
|
-
import 'date-fns/isValid';
|
|
11
|
-
import 'date-fns/parse';
|
|
12
9
|
import { getDateWithoutTime, setTimeToDate, DATE_MASK, format, getFullDateTime, isCompleteDateInput, isValid, parseTimestampToDate } from './utils/format.js';
|
|
13
10
|
|
|
14
11
|
/******************************************************************************
|
|
@@ -50,25 +47,20 @@ function __rest(s, e) {
|
|
|
50
47
|
return t;
|
|
51
48
|
}
|
|
52
49
|
|
|
53
|
-
var styles = {"component":"date-time-
|
|
54
|
-
require('./index.css')
|
|
50
|
+
var styles = {"component":"date-time-input__component_1u4x2","calendarContainer":"date-time-input__calendarContainer_1u4x2","calendarResponsive":"date-time-input__calendarResponsive_1u4x2","block":"date-time-input__block_1u4x2"};
|
|
51
|
+
require('./components/date-time-input/index.css')
|
|
55
52
|
|
|
56
53
|
/* eslint-disable no-useless-escape, jsx-a11y/click-events-have-key-events */
|
|
57
54
|
var DateTimeInput = React.forwardRef(function (_a, ref) {
|
|
58
55
|
var _b, _c;
|
|
59
56
|
var _d;
|
|
60
|
-
var className = _a.className, inputClassName = _a.inputClassName, popoverClassName = _a.popoverClassName, disabled = _a.disabled, readOnly = _a.readOnly, picker = _a.picker, _e = _a.defaultValue, defaultValue = _e === void 0 ? '' : _e, propValue = _a.value, onChange = _a.onChange, onComplete = _a.onComplete, rightAddons = _a.rightAddons, useAnchorWidth = _a.useAnchorWidth, block = _a.block, _f = _a.popoverPosition, popoverPosition = _f === void 0 ? 'bottom-start' : _f, zIndexPopover = _a.zIndexPopover, preventFlip = _a.preventFlip, _g = _a.Calendar, Calendar$1 = _g === void 0 ? Calendar : _g, _h = _a.calendarProps, calendarProps = _h === void 0 ? {} : _h, defaultMonth = _a.defaultMonth, _j = _a.minDate, minDate = _j === void 0 ? calendarProps.minDate : _j, _k = _a.maxDate, maxDate = _k === void 0 ? calendarProps.maxDate : _k, _l = _a.offDays, offDays = _l === void 0 ? calendarProps.offDays || [] : _l, _m = _a.events, events = _m === void 0 ? calendarProps.events || [] : _m, _o = _a.defaultOpen, defaultOpen = _o === void 0 ? false : _o, error = _a.error, restProps = __rest(_a, ["className", "inputClassName", "popoverClassName", "disabled", "readOnly", "picker", "defaultValue", "value", "onChange", "onComplete", "rightAddons", "useAnchorWidth", "block", "popoverPosition", "zIndexPopover", "preventFlip", "Calendar", "calendarProps", "defaultMonth", "minDate", "maxDate", "offDays", "events", "defaultOpen", "error"]);
|
|
61
|
-
var view = useMedia([
|
|
62
|
-
['mobile', '(max-width: 1023px)'],
|
|
63
|
-
['desktop', '(min-width: 1024px)'],
|
|
64
|
-
], 'desktop')[0];
|
|
57
|
+
var className = _a.className, inputClassName = _a.inputClassName, popoverClassName = _a.popoverClassName, disabled = _a.disabled, readOnly = _a.readOnly, picker = _a.picker, _e = _a.defaultValue, defaultValue = _e === void 0 ? '' : _e, propValue = _a.value, onChange = _a.onChange, onComplete = _a.onComplete, rightAddons = _a.rightAddons, useAnchorWidth = _a.useAnchorWidth, block = _a.block, _f = _a.popoverPosition, popoverPosition = _f === void 0 ? 'bottom-start' : _f, zIndexPopover = _a.zIndexPopover, preventFlip = _a.preventFlip, _g = _a.Calendar, Calendar$1 = _g === void 0 ? Calendar : _g, _h = _a.calendarProps, calendarProps = _h === void 0 ? {} : _h, defaultMonth = _a.defaultMonth, _j = _a.minDate, minDate = _j === void 0 ? calendarProps.minDate : _j, _k = _a.maxDate, maxDate = _k === void 0 ? calendarProps.maxDate : _k, _l = _a.offDays, offDays = _l === void 0 ? calendarProps.offDays || [] : _l, _m = _a.events, events = _m === void 0 ? calendarProps.events || [] : _m, _o = _a.defaultOpen, defaultOpen = _o === void 0 ? false : _o, error = _a.error, _p = _a.view, view = _p === void 0 ? 'desktop' : _p, restProps = __rest(_a, ["className", "inputClassName", "popoverClassName", "disabled", "readOnly", "picker", "defaultValue", "value", "onChange", "onComplete", "rightAddons", "useAnchorWidth", "block", "popoverPosition", "zIndexPopover", "preventFlip", "Calendar", "calendarProps", "defaultMonth", "minDate", "maxDate", "offDays", "events", "defaultOpen", "error", "view"]);
|
|
65
58
|
var inputRef = useRef(null);
|
|
66
59
|
var calendarRef = useRef(null);
|
|
67
|
-
var
|
|
68
|
-
var
|
|
60
|
+
var _q = useState(propValue || defaultValue), value = _q[0], setValue = _q[1];
|
|
61
|
+
var _r = useState(false), open = _r[0], setOpen = _r[1];
|
|
69
62
|
var calendarValue = value ? getDateWithoutTime(value).getTime() : undefined;
|
|
70
63
|
var inputDisabled = disabled || readOnly;
|
|
71
|
-
var CalendarComponent = view === 'desktop' ? Calendar$1 : CalendarMobile;
|
|
72
64
|
var calendarResponsive = (_d = calendarProps === null || calendarProps === void 0 ? void 0 : calendarProps.responsive) !== null && _d !== void 0 ? _d : true;
|
|
73
65
|
useEffect(function () {
|
|
74
66
|
setOpen(defaultOpen);
|
|
@@ -155,7 +147,7 @@ var DateTimeInput = React.forwardRef(function (_a, ref) {
|
|
|
155
147
|
var renderCalendar = function () { return (
|
|
156
148
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
157
149
|
React.createElement("div", { onMouseDown: handleCalendarWrapperMouseDown },
|
|
158
|
-
React.createElement(
|
|
150
|
+
React.createElement(Calendar$1, __assign({}, calendarProps, { responsive: calendarResponsive, open: open, onClose: handleCalendarClose, ref: calendarRef, defaultMonth: defaultMonth, value: checkInputValueIsValid(value) ? calendarValue : undefined, onChange: handleCalendarChange, minDate: minDate, maxDate: maxDate, offDays: offDays, events: events })))); };
|
|
159
151
|
return (React.createElement("div", { className: cn(styles.component, className, (_b = {},
|
|
160
152
|
_b[styles.block] = block,
|
|
161
153
|
_b)), onClick: inputDisabled ? undefined : handleInputWrapperClick, onFocus: inputDisabled ? undefined : handleInputWrapperFocus, onBlur: handleBlur },
|
|
@@ -167,4 +159,4 @@ var DateTimeInput = React.forwardRef(function (_a, ref) {
|
|
|
167
159
|
_c)), className: popoverClassName, position: popoverPosition, offset: [0, 8], withTransition: false, preventFlip: preventFlip, zIndex: zIndexPopover }, renderCalendar()))));
|
|
168
160
|
});
|
|
169
161
|
|
|
170
|
-
export { DateTimeInput };
|
|
162
|
+
export { DateTimeInput as D, __assign as _, __rest as a };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { DateTimeInputProps } from "./Component-e82a534f";
|
|
3
|
+
type DateTimeInputDesktopProps = Omit<DateTimeInputProps, 'view'>;
|
|
4
|
+
declare const DateTimeInputDesktop: FC<DateTimeInputDesktopProps>;
|
|
5
|
+
export { DateTimeInputDesktopProps, DateTimeInputDesktop };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { D as DateTimeInput, _ as __assign } from './Component-e82a534f.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-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';
|
|
13
|
+
|
|
14
|
+
var DateTimeInputDesktop = function (props) { return (React.createElement(DateTimeInput, __assign({}, props))); };
|
|
15
|
+
|
|
16
|
+
export { DateTimeInputDesktop };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { DateTimeInputProps } from "./Component-e82a534f";
|
|
3
|
+
type DateTimeInputMobileProps = Omit<DateTimeInputProps, 'view'>;
|
|
4
|
+
declare const DateTimeInputMobile: FC<DateTimeInputMobileProps>;
|
|
5
|
+
export { DateTimeInputMobileProps, DateTimeInputMobile };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { D as DateTimeInput, _ as __assign } from './Component-e82a534f.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-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';
|
|
13
|
+
|
|
14
|
+
var DateTimeInputMobile = function (props) { return (React.createElement(DateTimeInput, __assign({ Calendar: CalendarMobile, view: 'mobile' }, props))); };
|
|
15
|
+
|
|
16
|
+
export { DateTimeInputMobile };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { DateTimeInputProps } from "./Component-e82a534f";
|
|
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,26 @@
|
|
|
1
|
+
import { a as __rest, _ as __assign } from './Component-e82a534f.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useMedia } from '@alfalab/hooks';
|
|
4
|
+
import { DateTimeInputDesktop } from './Component.desktop.js';
|
|
5
|
+
import { DateTimeInputMobile } from './Component.mobile.js';
|
|
6
|
+
import 'react-merge-refs';
|
|
7
|
+
import 'classnames';
|
|
8
|
+
import '@alfalab/core-components-calendar/esm';
|
|
9
|
+
import '@alfalab/core-components-icon-button/esm';
|
|
10
|
+
import '@alfalab/core-components-input/esm';
|
|
11
|
+
import '@alfalab/core-components-popover/esm';
|
|
12
|
+
import '@alfalab/icons-glyph/CalendarMIcon';
|
|
13
|
+
import './utils/format.js';
|
|
14
|
+
import 'date-fns/isValid';
|
|
15
|
+
import 'date-fns/parse';
|
|
16
|
+
|
|
17
|
+
var DateTimeInputResponsive = 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(DateTimeInputDesktop, __assign({}, restProps))) : (React.createElement(DateTimeInputMobile, __assign({}, restProps)));
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { DateTimeInputResponsive };
|
|
File without changes
|
|
@@ -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';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
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-
|
|
42
|
+
.date-time-input__component_1u4x2 {
|
|
43
43
|
display: inline-block;
|
|
44
44
|
outline: none;
|
|
45
45
|
position: relative;
|
|
46
46
|
}
|
|
47
|
-
.date-time-
|
|
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-
|
|
53
|
+
.date-time-input__calendarContainer_1u4x2 {
|
|
54
54
|
width: 100%;
|
|
55
55
|
min-width: 288px
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
.date-time-
|
|
58
|
+
.date-time-input__calendarResponsive_1u4x2 {
|
|
59
59
|
width: var(--calendar-width);
|
|
60
60
|
padding: 0 var(--gap-m);
|
|
61
61
|
}
|
|
62
|
-
.date-time-
|
|
62
|
+
.date-time-input__block_1u4x2 {
|
|
63
63
|
width: 100%;
|
|
64
64
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../Component-e82a534f";
|