@alfalab/core-components-date-range-input 2.1.3 → 2.2.1
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-070df1af.d.ts} +44 -3
- package/{Component.js → Component-070df1af.js} +26 -25
- 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-range-input/Component.d.ts +0 -0
- package/components/date-range-input/Component.js +18 -0
- package/{esm → components/date-range-input}/index.css +6 -6
- package/components/date-range-input/index.d.ts +1 -0
- package/components/date-range-input/index.js +18 -0
- package/cssm/{Component.d.ts → Component-a4cfbf46.d.ts} +44 -3
- package/cssm/{Component.js → Component-a4cfbf46.js} +28 -26
- 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-range-input/Component.d.ts +0 -0
- package/cssm/components/date-range-input/Component.js +19 -0
- package/cssm/components/date-range-input/index.d.ts +1 -0
- package/cssm/components/date-range-input/index.js +19 -0
- package/cssm/{index.module.css → components/date-range-input/index.module.css} +0 -0
- package/cssm/desktop.d.ts +2 -0
- package/cssm/desktop.js +20 -0
- package/cssm/index.d.ts +2 -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/format.js +8 -3
- package/desktop.d.ts +2 -0
- package/desktop.js +19 -0
- package/{modern/Component.d.ts → esm/Component-3d173527.d.ts} +44 -3
- package/esm/{Component.js → Component-3d173527.js} +9 -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-range-input/Component.d.ts +0 -0
- package/esm/components/date-range-input/Component.js +12 -0
- package/{index.css → esm/components/date-range-input/index.css} +6 -6
- package/esm/components/date-range-input/index.d.ts +1 -0
- package/esm/components/date-range-input/index.js +12 -0
- package/esm/desktop.d.ts +2 -0
- package/esm/desktop.js +13 -0
- package/esm/index.d.ts +2 -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 +2 -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/date-range-input/Component.d.ts} +10 -2
- package/modern/{Component.js → components/date-range-input/Component.js} +5 -11
- package/modern/{index.css → components/date-range-input/index.css} +6 -6
- package/modern/components/date-range-input/index.d.ts +1 -0
- package/modern/components/date-range-input/index.js +12 -0
- package/modern/desktop.d.ts +2 -0
- package/modern/desktop.js +13 -0
- package/modern/index.d.ts +2 -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 +5 -5
- package/responsive.d.ts +2 -0
- package/responsive.js +22 -0
- package/utils/format.js +8 -3
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var components_dateRangeInput_Component = require('./Component-a4cfbf46.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('date-fns/isValid');
|
|
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/parse');
|
|
15
|
+
require('./components/date-range-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 DateRangeInputMobile = function (props) { return (React__default.default.createElement(components_dateRangeInput_Component.DateRangeInput, components_dateRangeInput_Component.__assign({ Calendar: coreComponentsCalendar.CalendarMobile, view: 'mobile' }, props))); };
|
|
22
|
+
|
|
23
|
+
exports.DateRangeInputMobile = DateRangeInputMobile;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { DateRangeInputProps } from "./Component-a4cfbf46";
|
|
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,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var components_dateRangeInput_Component = require('./Component-a4cfbf46.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('date-fns/isValid');
|
|
11
|
+
require('@alfalab/core-components-calendar/cssm');
|
|
12
|
+
require('@alfalab/core-components-icon-button/cssm');
|
|
13
|
+
require('@alfalab/core-components-input/cssm');
|
|
14
|
+
require('@alfalab/core-components-popover/cssm');
|
|
15
|
+
require('@alfalab/icons-glyph/CalendarMIcon');
|
|
16
|
+
require('./utils/format.js');
|
|
17
|
+
require('date-fns/parse');
|
|
18
|
+
require('./components/date-range-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 DateRangeInputResponsive = function (_a) {
|
|
25
|
+
var _b = _a.breakpoint, breakpoint = _b === void 0 ? 1024 : _b, restProps = components_dateRangeInput_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.DateRangeInputDesktop, components_dateRangeInput_Component.__assign({}, restProps))) : (React__default.default.createElement(Component_mobile.DateRangeInputMobile, components_dateRangeInput_Component.__assign({}, restProps)));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.DateRangeInputResponsive = DateRangeInputResponsive;
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var components_dateRangeInput_Component = require('../../Component-a4cfbf46.js');
|
|
4
|
+
require('react');
|
|
5
|
+
require('react-merge-refs');
|
|
6
|
+
require('classnames');
|
|
7
|
+
require('date-fns/isValid');
|
|
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('./index.module.css');
|
|
15
|
+
require('date-fns/parse');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
exports.DateRangeInput = components_dateRangeInput_Component.DateRangeInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../Component-a4cfbf46";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var components_dateRangeInput_Component = require('../../Component-a4cfbf46.js');
|
|
4
|
+
require('react');
|
|
5
|
+
require('react-merge-refs');
|
|
6
|
+
require('classnames');
|
|
7
|
+
require('date-fns/isValid');
|
|
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/parse');
|
|
15
|
+
require('./index.module.css');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
exports.DateRangeInput = components_dateRangeInput_Component.DateRangeInput;
|
|
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-a4cfbf46.js');
|
|
5
|
+
require('react');
|
|
6
|
+
require('react-merge-refs');
|
|
7
|
+
require('classnames');
|
|
8
|
+
require('date-fns/isValid');
|
|
9
|
+
require('@alfalab/core-components-calendar/cssm');
|
|
10
|
+
require('@alfalab/core-components-icon-button/cssm');
|
|
11
|
+
require('@alfalab/core-components-input/cssm');
|
|
12
|
+
require('@alfalab/core-components-popover/cssm');
|
|
13
|
+
require('@alfalab/icons-glyph/CalendarMIcon');
|
|
14
|
+
require('./utils/format.js');
|
|
15
|
+
require('date-fns/parse');
|
|
16
|
+
require('./components/date-range-input/index.module.css');
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
exports.DateRangeInputDesktop = Component_desktop.DateRangeInputDesktop;
|
package/cssm/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { DateRangeInputResponsive as DateRangeInput } from "./responsive";
|
|
2
|
+
export type { DateRangeInputResponsiveProps as DateRangeInputProps } from "./responsive";
|
package/cssm/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var Component_responsive = require('./Component.responsive.js');
|
|
4
|
+
require('./Component-a4cfbf46.js');
|
|
4
5
|
require('react');
|
|
5
6
|
require('react-merge-refs');
|
|
6
7
|
require('classnames');
|
|
@@ -9,12 +10,14 @@ require('@alfalab/core-components-calendar/cssm');
|
|
|
9
10
|
require('@alfalab/core-components-icon-button/cssm');
|
|
10
11
|
require('@alfalab/core-components-input/cssm');
|
|
11
12
|
require('@alfalab/core-components-popover/cssm');
|
|
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('./index.module.css');
|
|
16
|
+
require('./components/date-range-input/index.module.css');
|
|
17
|
+
require('@alfalab/hooks');
|
|
18
|
+
require('./Component.desktop.js');
|
|
19
|
+
require('./Component.mobile.js');
|
|
17
20
|
|
|
18
21
|
|
|
19
22
|
|
|
20
|
-
exports.DateRangeInput =
|
|
23
|
+
exports.DateRangeInput = Component_responsive.DateRangeInputResponsive;
|
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-a4cfbf46.js');
|
|
5
|
+
require('react');
|
|
6
|
+
require('react-merge-refs');
|
|
7
|
+
require('classnames');
|
|
8
|
+
require('date-fns/isValid');
|
|
9
|
+
require('@alfalab/core-components-calendar/cssm');
|
|
10
|
+
require('@alfalab/core-components-icon-button/cssm');
|
|
11
|
+
require('@alfalab/core-components-input/cssm');
|
|
12
|
+
require('@alfalab/core-components-popover/cssm');
|
|
13
|
+
require('@alfalab/icons-glyph/CalendarMIcon');
|
|
14
|
+
require('./utils/format.js');
|
|
15
|
+
require('date-fns/parse');
|
|
16
|
+
require('./components/date-range-input/index.module.css');
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
exports.DateRangeInputMobile = Component_mobile.DateRangeInputMobile;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Component_responsive = require('./Component.responsive.js');
|
|
4
|
+
require('./Component-a4cfbf46.js');
|
|
5
|
+
require('react');
|
|
6
|
+
require('react-merge-refs');
|
|
7
|
+
require('classnames');
|
|
8
|
+
require('date-fns/isValid');
|
|
9
|
+
require('@alfalab/core-components-calendar/cssm');
|
|
10
|
+
require('@alfalab/core-components-icon-button/cssm');
|
|
11
|
+
require('@alfalab/core-components-input/cssm');
|
|
12
|
+
require('@alfalab/core-components-popover/cssm');
|
|
13
|
+
require('@alfalab/icons-glyph/CalendarMIcon');
|
|
14
|
+
require('./utils/format.js');
|
|
15
|
+
require('date-fns/parse');
|
|
16
|
+
require('./components/date-range-input/index.module.css');
|
|
17
|
+
require('@alfalab/hooks');
|
|
18
|
+
require('./Component.desktop.js');
|
|
19
|
+
require('./Component.mobile.js');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
exports.DateRangeInputResponsive = Component_responsive.DateRangeInputResponsive;
|
package/cssm/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
|
|
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
|
-
|
|
42
|
-
|
|
46
|
+
dateFnsIsValid__default.default(parseDateString(dateFrom)) &&
|
|
47
|
+
dateFnsIsValid__default.default(parseDateString(dateTo)));
|
|
43
48
|
};
|
|
44
49
|
var format = function (value) {
|
|
45
50
|
return value
|
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-070df1af.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.DateRangeInputDesktop = Component_desktop.DateRangeInputDesktop;
|
|
@@ -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 DateRangeInputProps = Omit<InputProps, 'onChange'> & {
|
|
8
41
|
/**
|
|
9
42
|
* Дополнительный класс
|
|
@@ -40,7 +73,7 @@ type DateRangeInputProps = Omit<InputProps, 'onChange'> & {
|
|
|
40
73
|
/**
|
|
41
74
|
* Компонент календаря
|
|
42
75
|
*/
|
|
43
|
-
Calendar?: ElementType
|
|
76
|
+
Calendar?: ElementType;
|
|
44
77
|
/**
|
|
45
78
|
* Доп. пропсы для календаря
|
|
46
79
|
*/
|
|
@@ -90,6 +123,10 @@ type DateRangeInputProps = Omit<InputProps, 'onChange'> & {
|
|
|
90
123
|
* Растягивает компонент на ширину контейнера
|
|
91
124
|
*/
|
|
92
125
|
block?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Отображение компонента в мобильном или десктопном виде
|
|
128
|
+
*/
|
|
129
|
+
view?: 'desktop' | 'mobile';
|
|
93
130
|
};
|
|
94
131
|
declare const DateRangeInput: React.ForwardRefExoticComponent<Omit<InputProps, "onChange"> & {
|
|
95
132
|
/**
|
|
@@ -127,7 +164,7 @@ declare const DateRangeInput: React.ForwardRefExoticComponent<Omit<InputProps, "
|
|
|
127
164
|
/**
|
|
128
165
|
* Компонент календаря
|
|
129
166
|
*/
|
|
130
|
-
Calendar?: React.ElementType<
|
|
167
|
+
Calendar?: React.ElementType<any> | undefined;
|
|
131
168
|
/**
|
|
132
169
|
* Доп. пропсы для календаря
|
|
133
170
|
*/
|
|
@@ -184,5 +221,9 @@ declare const DateRangeInput: React.ForwardRefExoticComponent<Omit<InputProps, "
|
|
|
184
221
|
* Растягивает компонент на ширину контейнера
|
|
185
222
|
*/
|
|
186
223
|
block?: boolean | undefined;
|
|
224
|
+
/**
|
|
225
|
+
* Отображение компонента в мобильном или десктопном виде
|
|
226
|
+
*/
|
|
227
|
+
view?: "desktop" | "mobile" | undefined;
|
|
187
228
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
188
|
-
export { DateRangeInputProps, DateRangeInput };
|
|
229
|
+
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, DateRangeInputProps, DateRangeInput };
|
|
@@ -2,14 +2,12 @@ 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,
|
|
5
|
+
import { usePeriod, Calendar } from '@alfalab/core-components-calendar/esm';
|
|
6
6
|
import { IconButton } from '@alfalab/core-components-icon-button/esm';
|
|
7
7
|
import { Input } from '@alfalab/core-components-input/esm';
|
|
8
8
|
import { Popover } from '@alfalab/core-components-popover/esm';
|
|
9
|
-
import { useMedia } from '@alfalab/hooks';
|
|
10
9
|
import { CalendarMIcon } from '@alfalab/icons-glyph/CalendarMIcon';
|
|
11
10
|
import { parseTimestampToDate, DATE_FORMAT, DATE_MASK, format, parseDateString, isCompleteDateInput, isValid } from './utils/format.js';
|
|
12
|
-
import 'date-fns/parse';
|
|
13
11
|
|
|
14
12
|
/******************************************************************************
|
|
15
13
|
Copyright (c) Microsoft Corporation.
|
|
@@ -50,24 +48,19 @@ function __rest(s, e) {
|
|
|
50
48
|
return t;
|
|
51
49
|
}
|
|
52
50
|
|
|
53
|
-
var styles = {"component":"date-range-
|
|
54
|
-
require('./index.css')
|
|
51
|
+
var styles = {"component":"date-range-input__component_xgs6o","calendarContainer":"date-range-input__calendarContainer_xgs6o","calendarResponsive":"date-range-input__calendarResponsive_xgs6o","block":"date-range-input__block_xgs6o"};
|
|
52
|
+
require('./components/date-range-input/index.css')
|
|
55
53
|
|
|
56
54
|
/* eslint-disable no-useless-escape, jsx-a11y/click-events-have-key-events */
|
|
57
55
|
var DateRangeInput = React.forwardRef(function (_a, ref) {
|
|
58
56
|
var _b, _c;
|
|
59
57
|
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, 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"]);
|
|
61
|
-
var view = useMedia([
|
|
62
|
-
['mobile', '(max-width: 1023px)'],
|
|
63
|
-
['desktop', '(min-width: 1024px)'],
|
|
64
|
-
], 'desktop')[0];
|
|
58
|
+
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, _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", "view"]);
|
|
65
59
|
var inputRef = useRef(null);
|
|
66
60
|
var calendarRef = useRef(null);
|
|
67
|
-
var
|
|
68
|
-
var
|
|
61
|
+
var _q = useState(propValue || defaultValue), value = _q[0], setValue = _q[1];
|
|
62
|
+
var _r = useState(false), open = _r[0], setOpen = _r[1];
|
|
69
63
|
var inputDisabled = disabled || readOnly;
|
|
70
|
-
var CalendarComponent = view === 'desktop' ? Calendar$1 : CalendarMobile;
|
|
71
64
|
var calendarResponsive = (_d = calendarProps === null || calendarProps === void 0 ? void 0 : calendarProps.responsive) !== null && _d !== void 0 ? _d : true;
|
|
72
65
|
useEffect(function () {
|
|
73
66
|
setOpen(defaultOpen);
|
|
@@ -95,7 +88,7 @@ var DateRangeInput = React.forwardRef(function (_a, ref) {
|
|
|
95
88
|
});
|
|
96
89
|
}
|
|
97
90
|
};
|
|
98
|
-
var
|
|
91
|
+
var _s = usePeriod({ onPeriodChange: handlePeriodChange }), selectedFrom = _s.selectedFrom, selectedTo = _s.selectedTo, updatePeriod = _s.updatePeriod, resetPeriod = _s.resetPeriod, setStart = _s.setStart, setEnd = _s.setEnd;
|
|
99
92
|
var handleInputWrapperFocus = function (event) {
|
|
100
93
|
if (view === 'desktop') {
|
|
101
94
|
if (!open && event.target.tagName !== 'INPUT' && calendarRef.current) {
|
|
@@ -194,7 +187,7 @@ var DateRangeInput = React.forwardRef(function (_a, ref) {
|
|
|
194
187
|
var renderCalendar = function () { return (
|
|
195
188
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
196
189
|
React.createElement("div", { onMouseDown: handleCalendarWrapperMouseDown },
|
|
197
|
-
React.createElement(
|
|
190
|
+
React.createElement(Calendar$1, __assign({}, 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 })))); };
|
|
198
191
|
return (React.createElement("div", { className: cn(styles.component, className, (_b = {},
|
|
199
192
|
_b[styles.block] = block,
|
|
200
193
|
_b)), onClick: inputDisabled ? undefined : handleInputWrapperClick, onFocus: inputDisabled ? undefined : handleInputWrapperFocus, onBlur: handleBlur },
|
|
@@ -206,4 +199,4 @@ var DateRangeInput = React.forwardRef(function (_a, ref) {
|
|
|
206
199
|
_c)), className: popoverClassName, position: popoverPosition, offset: [0, 8], withTransition: false, preventFlip: preventFlip, zIndex: zIndexPopover }, renderCalendar()))));
|
|
207
200
|
});
|
|
208
201
|
|
|
209
|
-
export { DateRangeInput };
|
|
202
|
+
export { DateRangeInput as D, __assign as _, __rest as a };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { DateRangeInputProps } from "./Component-3d173527";
|
|
3
|
+
type DateRangeInputDesktopProps = Omit<DateRangeInputProps, 'view'>;
|
|
4
|
+
declare const DateRangeInputDesktop: FC<DateRangeInputDesktopProps>;
|
|
5
|
+
export { DateRangeInputDesktopProps, DateRangeInputDesktop };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { D as DateRangeInput, _ as __assign } from './Component-3d173527.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import 'react-merge-refs';
|
|
4
|
+
import 'classnames';
|
|
5
|
+
import 'date-fns/isValid';
|
|
6
|
+
import '@alfalab/core-components-calendar/esm';
|
|
7
|
+
import '@alfalab/core-components-icon-button/esm';
|
|
8
|
+
import '@alfalab/core-components-input/esm';
|
|
9
|
+
import '@alfalab/core-components-popover/esm';
|
|
10
|
+
import '@alfalab/icons-glyph/CalendarMIcon';
|
|
11
|
+
import './utils/format.js';
|
|
12
|
+
import 'date-fns/parse';
|
|
13
|
+
|
|
14
|
+
var DateRangeInputDesktop = function (props) { return (React.createElement(DateRangeInput, __assign({}, props))); };
|
|
15
|
+
|
|
16
|
+
export { DateRangeInputDesktop };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { DateRangeInputProps } from "./Component-3d173527";
|
|
3
|
+
type DateRangeInputMobileProps = Omit<DateRangeInputProps, 'view'>;
|
|
4
|
+
declare const DateRangeInputMobile: FC<DateRangeInputMobileProps>;
|
|
5
|
+
export { DateRangeInputMobileProps, DateRangeInputMobile };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { D as DateRangeInput, _ as __assign } from './Component-3d173527.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 'date-fns/isValid';
|
|
7
|
+
import '@alfalab/core-components-icon-button/esm';
|
|
8
|
+
import '@alfalab/core-components-input/esm';
|
|
9
|
+
import '@alfalab/core-components-popover/esm';
|
|
10
|
+
import '@alfalab/icons-glyph/CalendarMIcon';
|
|
11
|
+
import './utils/format.js';
|
|
12
|
+
import 'date-fns/parse';
|
|
13
|
+
|
|
14
|
+
var DateRangeInputMobile = function (props) { return (React.createElement(DateRangeInput, __assign({ Calendar: CalendarMobile, view: 'mobile' }, props))); };
|
|
15
|
+
|
|
16
|
+
export { DateRangeInputMobile };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { DateRangeInputProps } from "./Component-3d173527";
|
|
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,26 @@
|
|
|
1
|
+
import { a as __rest, _ as __assign } from './Component-3d173527.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useMedia } from '@alfalab/hooks';
|
|
4
|
+
import { DateRangeInputDesktop } from './Component.desktop.js';
|
|
5
|
+
import { DateRangeInputMobile } from './Component.mobile.js';
|
|
6
|
+
import 'react-merge-refs';
|
|
7
|
+
import 'classnames';
|
|
8
|
+
import 'date-fns/isValid';
|
|
9
|
+
import '@alfalab/core-components-calendar/esm';
|
|
10
|
+
import '@alfalab/core-components-icon-button/esm';
|
|
11
|
+
import '@alfalab/core-components-input/esm';
|
|
12
|
+
import '@alfalab/core-components-popover/esm';
|
|
13
|
+
import '@alfalab/icons-glyph/CalendarMIcon';
|
|
14
|
+
import './utils/format.js';
|
|
15
|
+
import 'date-fns/parse';
|
|
16
|
+
|
|
17
|
+
var DateRangeInputResponsive = 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(DateRangeInputDesktop, __assign({}, restProps))) : (React.createElement(DateRangeInputMobile, __assign({}, restProps)));
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { DateRangeInputResponsive };
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { D as DateRangeInput } from '../../Component-3d173527.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'react-merge-refs';
|
|
4
|
+
import 'classnames';
|
|
5
|
+
import 'date-fns/isValid';
|
|
6
|
+
import '@alfalab/core-components-calendar/esm';
|
|
7
|
+
import '@alfalab/core-components-icon-button/esm';
|
|
8
|
+
import '@alfalab/core-components-input/esm';
|
|
9
|
+
import '@alfalab/core-components-popover/esm';
|
|
10
|
+
import '@alfalab/icons-glyph/CalendarMIcon';
|
|
11
|
+
import '../../utils/format.js';
|
|
12
|
+
import 'date-fns/parse';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: rqkkz */
|
|
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-
|
|
42
|
+
.date-range-input__component_xgs6o {
|
|
43
43
|
display: inline-block;
|
|
44
44
|
outline: none;
|
|
45
45
|
position: relative;
|
|
46
46
|
}
|
|
47
|
-
.date-range-
|
|
47
|
+
.date-range-input__calendarContainer_xgs6o {
|
|
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-
|
|
53
|
+
.date-range-input__calendarContainer_xgs6o {
|
|
54
54
|
width: 100%;
|
|
55
55
|
min-width: 288px
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
.date-range-
|
|
58
|
+
.date-range-input__calendarResponsive_xgs6o {
|
|
59
59
|
width: var(--calendar-width);
|
|
60
60
|
padding: 0 var(--gap-m);
|
|
61
61
|
}
|
|
62
|
-
.date-range-
|
|
62
|
+
.date-range-input__block_xgs6o {
|
|
63
63
|
width: 100%;
|
|
64
64
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../Component-3d173527";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { D as DateRangeInput } from '../../Component-3d173527.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'react-merge-refs';
|
|
4
|
+
import 'classnames';
|
|
5
|
+
import 'date-fns/isValid';
|
|
6
|
+
import '@alfalab/core-components-calendar/esm';
|
|
7
|
+
import '@alfalab/core-components-icon-button/esm';
|
|
8
|
+
import '@alfalab/core-components-input/esm';
|
|
9
|
+
import '@alfalab/core-components-popover/esm';
|
|
10
|
+
import '@alfalab/icons-glyph/CalendarMIcon';
|
|
11
|
+
import '../../utils/format.js';
|
|
12
|
+
import 'date-fns/parse';
|
package/esm/desktop.d.ts
ADDED
package/esm/desktop.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { DateRangeInputDesktop } from './Component.desktop.js';
|
|
2
|
+
import './Component-3d173527.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';
|
package/esm/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { DateRangeInputResponsive as DateRangeInput } from "./responsive";
|
|
2
|
+
export type { DateRangeInputResponsiveProps as DateRangeInputProps } from "./responsive";
|