@alfalab/core-components-date-range-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-105ad648.d.ts} +46 -5
- package/{Component.js → Component-105ad648.js} +25 -33
- 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} +46 -5
- package/cssm/{Component.js → Component-a4cfbf46.js} +27 -35
- 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 +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 +9 -11
- 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-e59830f5.d.ts} +46 -5
- package/esm/{Component.js → Component-e59830f5.js} +10 -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/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 +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 +3 -3
- 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-range-input/Component.d.ts} +12 -4
- 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 +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 +9 -11
- package/utils/index.js +1 -3
|
@@ -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
|
/**
|
|
@@ -115,7 +152,7 @@ declare const DateRangeInput: React.ForwardRefExoticComponent<Omit<InputProps, "
|
|
|
115
152
|
dateFrom?: Date;
|
|
116
153
|
dateTo?: Date;
|
|
117
154
|
value: string;
|
|
118
|
-
}, event?:
|
|
155
|
+
}, event?: ChangeEvent<HTMLInputElement>) => void) | undefined;
|
|
119
156
|
/**
|
|
120
157
|
* Обработчик окончания ввода
|
|
121
158
|
*/
|
|
@@ -123,11 +160,11 @@ declare const DateRangeInput: React.ForwardRefExoticComponent<Omit<InputProps, "
|
|
|
123
160
|
dateFrom: Date;
|
|
124
161
|
dateTo: Date;
|
|
125
162
|
value: string;
|
|
126
|
-
}, event?:
|
|
163
|
+
}, event?: ChangeEvent<HTMLInputElement>) => void) | undefined;
|
|
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 };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var React = require('react');
|
|
6
4
|
var mergeRefs = require('react-merge-refs');
|
|
7
5
|
var cn = require('classnames');
|
|
@@ -10,17 +8,15 @@ var coreComponentsCalendar = require('@alfalab/core-components-calendar');
|
|
|
10
8
|
var coreComponentsIconButton = require('@alfalab/core-components-icon-button');
|
|
11
9
|
var coreComponentsInput = require('@alfalab/core-components-input');
|
|
12
10
|
var coreComponentsPopover = require('@alfalab/core-components-popover');
|
|
13
|
-
var hooks = require('@alfalab/hooks');
|
|
14
11
|
var CalendarMIcon = require('@alfalab/icons-glyph/CalendarMIcon');
|
|
15
|
-
require('date-fns/parse');
|
|
16
12
|
var utils_format = require('./utils/format.js');
|
|
17
13
|
|
|
18
|
-
function
|
|
14
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
19
15
|
|
|
20
|
-
var React__default = /*#__PURE__*/
|
|
21
|
-
var mergeRefs__default = /*#__PURE__*/
|
|
22
|
-
var cn__default = /*#__PURE__*/
|
|
23
|
-
var dateFnsIsValid__default = /*#__PURE__*/
|
|
16
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
17
|
+
var mergeRefs__default = /*#__PURE__*/_interopDefaultCompat(mergeRefs);
|
|
18
|
+
var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
19
|
+
var dateFnsIsValid__default = /*#__PURE__*/_interopDefaultCompat(dateFnsIsValid);
|
|
24
20
|
|
|
25
21
|
/******************************************************************************
|
|
26
22
|
Copyright (c) Microsoft Corporation.
|
|
@@ -36,8 +32,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
36
32
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
37
33
|
PERFORMANCE OF THIS SOFTWARE.
|
|
38
34
|
***************************************************************************** */
|
|
39
|
-
|
|
40
|
-
__assign = Object.assign || function __assign(t) {
|
|
35
|
+
exports.__assign = function () {
|
|
36
|
+
exports.__assign = Object.assign || function __assign(t) {
|
|
41
37
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
42
38
|
s = arguments[i];
|
|
43
39
|
for (var p in s)
|
|
@@ -46,7 +42,7 @@ var __assign = function () {
|
|
|
46
42
|
}
|
|
47
43
|
return t;
|
|
48
44
|
};
|
|
49
|
-
return __assign.apply(this, arguments);
|
|
45
|
+
return exports.__assign.apply(this, arguments);
|
|
50
46
|
};
|
|
51
47
|
function __rest(s, e) {
|
|
52
48
|
var t = {};
|
|
@@ -61,24 +57,19 @@ function __rest(s, e) {
|
|
|
61
57
|
return t;
|
|
62
58
|
}
|
|
63
59
|
|
|
64
|
-
var styles = {"component":"date-range-
|
|
65
|
-
require('./index.css')
|
|
60
|
+
var styles = {"component":"date-range-input__component_1yhrr","calendarContainer":"date-range-input__calendarContainer_1yhrr","calendarResponsive":"date-range-input__calendarResponsive_1yhrr","block":"date-range-input__block_1yhrr"};
|
|
61
|
+
require('./components/date-range-input/index.css')
|
|
66
62
|
|
|
67
63
|
/* eslint-disable no-useless-escape, jsx-a11y/click-events-have-key-events */
|
|
68
|
-
var DateRangeInput = React__default
|
|
64
|
+
var DateRangeInput = React__default.default.forwardRef(function (_a, ref) {
|
|
69
65
|
var _b, _c;
|
|
70
66
|
var _d;
|
|
71
|
-
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 = _g === void 0 ? coreComponentsCalendar.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"]);
|
|
72
|
-
var view = hooks.useMedia([
|
|
73
|
-
['mobile', '(max-width: 1023px)'],
|
|
74
|
-
['desktop', '(min-width: 1024px)'],
|
|
75
|
-
], 'desktop')[0];
|
|
67
|
+
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 = _g === void 0 ? coreComponentsCalendar.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"]);
|
|
76
68
|
var inputRef = React.useRef(null);
|
|
77
69
|
var calendarRef = React.useRef(null);
|
|
78
|
-
var
|
|
79
|
-
var
|
|
70
|
+
var _q = React.useState(propValue || defaultValue), value = _q[0], setValue = _q[1];
|
|
71
|
+
var _r = React.useState(false), open = _r[0], setOpen = _r[1];
|
|
80
72
|
var inputDisabled = disabled || readOnly;
|
|
81
|
-
var CalendarComponent = view === 'desktop' ? Calendar : coreComponentsCalendar.CalendarMobile;
|
|
82
73
|
var calendarResponsive = (_d = calendarProps === null || calendarProps === void 0 ? void 0 : calendarProps.responsive) !== null && _d !== void 0 ? _d : true;
|
|
83
74
|
React.useEffect(function () {
|
|
84
75
|
setOpen(defaultOpen);
|
|
@@ -106,7 +97,7 @@ var DateRangeInput = React__default['default'].forwardRef(function (_a, ref) {
|
|
|
106
97
|
});
|
|
107
98
|
}
|
|
108
99
|
};
|
|
109
|
-
var
|
|
100
|
+
var _s = coreComponentsCalendar.usePeriod({ onPeriodChange: handlePeriodChange }), selectedFrom = _s.selectedFrom, selectedTo = _s.selectedTo, updatePeriod = _s.updatePeriod, resetPeriod = _s.resetPeriod, setStart = _s.setStart, setEnd = _s.setEnd;
|
|
110
101
|
var handleInputWrapperFocus = function (event) {
|
|
111
102
|
if (view === 'desktop') {
|
|
112
103
|
if (!open && event.target.tagName !== 'INPUT' && calendarRef.current) {
|
|
@@ -147,12 +138,12 @@ var DateRangeInput = React__default['default'].forwardRef(function (_a, ref) {
|
|
|
147
138
|
else if (selectedFrom && selectedTo) {
|
|
148
139
|
setEnd();
|
|
149
140
|
}
|
|
150
|
-
else if (dateFnsIsValid__default
|
|
141
|
+
else if (dateFnsIsValid__default.default(dateFrom) &&
|
|
151
142
|
((_a = dateArr[0]) === null || _a === void 0 ? void 0 : _a.length) === utils_format.DATE_FORMAT.length &&
|
|
152
143
|
dateFrom.getTime() !== selectedFrom) {
|
|
153
144
|
setStart(dateFrom.getTime());
|
|
154
145
|
}
|
|
155
|
-
else if (dateFnsIsValid__default
|
|
146
|
+
else if (dateFnsIsValid__default.default(dateTo) &&
|
|
156
147
|
((_b = dateArr[1]) === null || _b === void 0 ? void 0 : _b.length) === utils_format.DATE_FORMAT.length &&
|
|
157
148
|
dateTo.getTime() !== selectedTo) {
|
|
158
149
|
setEnd(dateTo.getTime());
|
|
@@ -183,7 +174,7 @@ var DateRangeInput = React__default['default'].forwardRef(function (_a, ref) {
|
|
|
183
174
|
};
|
|
184
175
|
React.useEffect(function () {
|
|
185
176
|
if (selectedFrom && selectedTo) {
|
|
186
|
-
setValue(utils_format.parseTimestampToDate(selectedFrom)
|
|
177
|
+
setValue("".concat(utils_format.parseTimestampToDate(selectedFrom), " - ").concat(utils_format.parseTimestampToDate(selectedTo)));
|
|
187
178
|
}
|
|
188
179
|
else if (selectedFrom && value.length < utils_format.DATE_FORMAT.length) {
|
|
189
180
|
setValue(utils_format.parseTimestampToDate(selectedFrom));
|
|
@@ -204,17 +195,18 @@ var DateRangeInput = React__default['default'].forwardRef(function (_a, ref) {
|
|
|
204
195
|
};
|
|
205
196
|
var renderCalendar = function () { return (
|
|
206
197
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
207
|
-
React__default
|
|
208
|
-
React__default
|
|
209
|
-
return (React__default
|
|
198
|
+
React__default.default.createElement("div", { onMouseDown: handleCalendarWrapperMouseDown },
|
|
199
|
+
React__default.default.createElement(Calendar, exports.__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 })))); };
|
|
200
|
+
return (React__default.default.createElement("div", { className: cn__default.default(styles.component, className, (_b = {},
|
|
210
201
|
_b[styles.block] = block,
|
|
211
202
|
_b)), onClick: inputDisabled ? undefined : handleInputWrapperClick, onFocus: inputDisabled ? undefined : handleInputWrapperFocus, onBlur: handleBlur },
|
|
212
|
-
React__default
|
|
203
|
+
React__default.default.createElement(coreComponentsInput.Input, exports.__assign({}, restProps, { block: block, ref: mergeRefs__default.default([ref, inputRef]), value: value, onChange: handleChange, disabled: disabled, readOnly: readOnly, className: inputClassName, onClear: handleClear, rightAddons: React__default.default.createElement(React__default.default.Fragment, null,
|
|
213
204
|
rightAddons,
|
|
214
|
-
picker && (React__default
|
|
215
|
-
picker && (React__default
|
|
205
|
+
picker && (React__default.default.createElement(coreComponentsIconButton.IconButton, { onClick: inputDisabled ? undefined : handleIconButtonClick, icon: CalendarMIcon.CalendarMIcon, size: 'xxs' }))) })),
|
|
206
|
+
picker && (React__default.default.createElement(coreComponentsPopover.Popover, { open: open, useAnchorWidth: useAnchorWidth, anchorElement: inputRef.current, popperClassName: cn__default.default(styles.calendarContainer, (_c = {},
|
|
216
207
|
_c[styles.calendarResponsive] = calendarResponsive,
|
|
217
208
|
_c)), className: popoverClassName, position: popoverPosition, offset: [0, 8], withTransition: false, preventFlip: preventFlip, zIndex: zIndexPopover }, renderCalendar()))));
|
|
218
209
|
});
|
|
219
210
|
|
|
220
211
|
exports.DateRangeInput = DateRangeInput;
|
|
212
|
+
exports.__rest = __rest;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { DateRangeInputProps } from "./Component-105ad648";
|
|
3
|
+
type DateRangeInputDesktopProps = Omit<DateRangeInputProps, 'view'>;
|
|
4
|
+
declare const DateRangeInputDesktop: FC<DateRangeInputDesktopProps>;
|
|
5
|
+
export { DateRangeInputDesktopProps, DateRangeInputDesktop };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var components_dateRangeInput_Component = require('./Component-105ad648.js');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
require('react-merge-refs');
|
|
6
|
+
require('classnames');
|
|
7
|
+
require('date-fns/isValid');
|
|
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/parse');
|
|
15
|
+
|
|
16
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
17
|
+
|
|
18
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
19
|
+
|
|
20
|
+
var DateRangeInputDesktop = function (props) { return (React__default.default.createElement(components_dateRangeInput_Component.DateRangeInput, components_dateRangeInput_Component.__assign({}, props))); };
|
|
21
|
+
|
|
22
|
+
exports.DateRangeInputDesktop = DateRangeInputDesktop;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { DateRangeInputProps } from "./Component-105ad648";
|
|
3
|
+
type DateRangeInputMobileProps = Omit<DateRangeInputProps, 'view'>;
|
|
4
|
+
declare const DateRangeInputMobile: FC<DateRangeInputMobileProps>;
|
|
5
|
+
export { DateRangeInputMobileProps, DateRangeInputMobile };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var components_dateRangeInput_Component = require('./Component-105ad648.js');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var coreComponentsCalendar = require('@alfalab/core-components-calendar');
|
|
6
|
+
require('react-merge-refs');
|
|
7
|
+
require('classnames');
|
|
8
|
+
require('date-fns/isValid');
|
|
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/parse');
|
|
15
|
+
|
|
16
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
17
|
+
|
|
18
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
19
|
+
|
|
20
|
+
var DateRangeInputMobile = function (props) { return (React__default.default.createElement(components_dateRangeInput_Component.DateRangeInput, components_dateRangeInput_Component.__assign({ Calendar: coreComponentsCalendar.CalendarMobile, view: 'mobile' }, props))); };
|
|
21
|
+
|
|
22
|
+
exports.DateRangeInputMobile = DateRangeInputMobile;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { DateRangeInputProps } from "./Component-105ad648";
|
|
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,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var components_dateRangeInput_Component = require('./Component-105ad648.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');
|
|
12
|
+
require('@alfalab/core-components-icon-button');
|
|
13
|
+
require('@alfalab/core-components-input');
|
|
14
|
+
require('@alfalab/core-components-popover');
|
|
15
|
+
require('@alfalab/icons-glyph/CalendarMIcon');
|
|
16
|
+
require('./utils/format.js');
|
|
17
|
+
require('date-fns/parse');
|
|
18
|
+
|
|
19
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
20
|
+
|
|
21
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
22
|
+
|
|
23
|
+
var DateRangeInputResponsive = function (_a) {
|
|
24
|
+
var _b = _a.breakpoint, breakpoint = _b === void 0 ? 1024 : _b, restProps = components_dateRangeInput_Component.__rest(_a, ["breakpoint"]);
|
|
25
|
+
var view = hooks.useMedia([
|
|
26
|
+
['mobile', "(max-width: ".concat(breakpoint - 1, "px)")],
|
|
27
|
+
['desktop', "(min-width: ".concat(breakpoint, "px)")],
|
|
28
|
+
], 'desktop')[0];
|
|
29
|
+
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)));
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
exports.DateRangeInputResponsive = DateRangeInputResponsive;
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var components_dateRangeInput_Component = require('../../Component-105ad648.js');
|
|
4
|
+
require('react');
|
|
5
|
+
require('react-merge-refs');
|
|
6
|
+
require('classnames');
|
|
7
|
+
require('date-fns/isValid');
|
|
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/parse');
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
exports.DateRangeInput = components_dateRangeInput_Component.DateRangeInput;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 2v93k */
|
|
2
2
|
:root {
|
|
3
3
|
|
|
4
4
|
/* Hard */
|
|
@@ -39,26 +39,26 @@
|
|
|
39
39
|
:root {
|
|
40
40
|
--calendar-popover-border-radius: 0 0 var(--border-radius-s) var(--border-radius-s);
|
|
41
41
|
}
|
|
42
|
-
.date-range-
|
|
42
|
+
.date-range-input__component_1yhrr {
|
|
43
43
|
display: inline-block;
|
|
44
44
|
outline: none;
|
|
45
45
|
position: relative;
|
|
46
46
|
}
|
|
47
|
-
.date-range-
|
|
47
|
+
.date-range-input__calendarContainer_1yhrr {
|
|
48
48
|
display: inline-block;
|
|
49
49
|
box-sizing: border-box;
|
|
50
50
|
border-radius: var(--calendar-popover-border-radius)
|
|
51
51
|
}
|
|
52
52
|
@media (max-width: 374px) {
|
|
53
|
-
.date-range-
|
|
53
|
+
.date-range-input__calendarContainer_1yhrr {
|
|
54
54
|
width: 100%;
|
|
55
55
|
min-width: 288px
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
.date-range-
|
|
58
|
+
.date-range-input__calendarResponsive_1yhrr {
|
|
59
59
|
width: var(--calendar-width);
|
|
60
60
|
padding: 0 var(--gap-m);
|
|
61
61
|
}
|
|
62
|
-
.date-range-
|
|
62
|
+
.date-range-input__block_1yhrr {
|
|
63
63
|
width: 100%;
|
|
64
64
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../Component-105ad648";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var components_dateRangeInput_Component = require('../../Component-105ad648.js');
|
|
4
|
+
require('react');
|
|
5
|
+
require('react-merge-refs');
|
|
6
|
+
require('classnames');
|
|
7
|
+
require('date-fns/isValid');
|
|
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/parse');
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
exports.DateRangeInput = components_dateRangeInput_Component.DateRangeInput;
|
|
@@ -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
|
/**
|
|
@@ -115,7 +152,7 @@ declare const DateRangeInput: React.ForwardRefExoticComponent<Omit<InputProps, "
|
|
|
115
152
|
dateFrom?: Date;
|
|
116
153
|
dateTo?: Date;
|
|
117
154
|
value: string;
|
|
118
|
-
}, event?:
|
|
155
|
+
}, event?: ChangeEvent<HTMLInputElement>) => void) | undefined;
|
|
119
156
|
/**
|
|
120
157
|
* Обработчик окончания ввода
|
|
121
158
|
*/
|
|
@@ -123,11 +160,11 @@ declare const DateRangeInput: React.ForwardRefExoticComponent<Omit<InputProps, "
|
|
|
123
160
|
dateFrom: Date;
|
|
124
161
|
dateTo: Date;
|
|
125
162
|
value: string;
|
|
126
|
-
}, event?:
|
|
163
|
+
}, event?: ChangeEvent<HTMLInputElement>) => void) | undefined;
|
|
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 };
|