@alfalab/core-components-calendar-input 8.2.8 → 8.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/Component.desktop.d.ts +4 -3
  2. package/Component.desktop.js +3 -2
  3. package/Component.mobile.d.ts +4 -3
  4. package/Component.mobile.js +3 -2
  5. package/Component.responsive.d.ts +10 -3
  6. package/Component.responsive.js +6 -5
  7. package/components/calendar-input/Component.d.ts +216 -0
  8. package/components/calendar-input/Component.js +135 -10
  9. package/components/calendar-input/index.css +11 -11
  10. package/components/calendar-input/index.d.ts +1 -1
  11. package/components/calendar-input/index.js +2 -1
  12. package/cssm/Component.desktop.d.ts +4 -3
  13. package/cssm/Component.desktop.js +3 -2
  14. package/cssm/Component.mobile.d.ts +4 -3
  15. package/cssm/Component.mobile.js +3 -2
  16. package/cssm/Component.responsive.d.ts +10 -3
  17. package/cssm/Component.responsive.js +6 -5
  18. package/cssm/components/calendar-input/Component.d.ts +216 -0
  19. package/cssm/components/calendar-input/Component.js +134 -11
  20. package/cssm/components/calendar-input/index.d.ts +1 -1
  21. package/cssm/components/calendar-input/index.js +2 -1
  22. package/cssm/desktop.js +2 -1
  23. package/cssm/index.js +4 -3
  24. package/cssm/mobile.js +3 -2
  25. package/cssm/responsive.js +4 -3
  26. package/desktop.js +2 -1
  27. package/esm/Component.desktop.d.ts +4 -3
  28. package/esm/Component.desktop.js +4 -3
  29. package/esm/Component.mobile.d.ts +4 -3
  30. package/esm/Component.mobile.js +4 -3
  31. package/esm/Component.responsive.d.ts +10 -3
  32. package/esm/Component.responsive.js +6 -5
  33. package/esm/components/calendar-input/Component.d.ts +216 -0
  34. package/esm/components/calendar-input/Component.js +132 -9
  35. package/esm/components/calendar-input/index.css +11 -11
  36. package/esm/components/calendar-input/index.d.ts +1 -1
  37. package/esm/components/calendar-input/index.js +2 -1
  38. package/esm/desktop.js +2 -1
  39. package/esm/index.js +4 -3
  40. package/esm/mobile.js +3 -2
  41. package/esm/responsive.js +4 -3
  42. package/index.js +4 -3
  43. package/mobile.js +3 -2
  44. package/modern/Component.desktop.d.ts +3 -2
  45. package/modern/Component.desktop.js +2 -2
  46. package/modern/Component.mobile.d.ts +3 -2
  47. package/modern/Component.mobile.js +2 -2
  48. package/modern/Component.responsive.d.ts +9 -2
  49. package/modern/Component.responsive.js +4 -4
  50. package/modern/components/calendar-input/Component.d.ts +1 -1
  51. package/modern/components/calendar-input/Component.js +1 -1
  52. package/modern/components/calendar-input/index.css +11 -11
  53. package/package.json +6 -5
  54. package/responsive.js +4 -3
  55. package/Component-60ae032f.d.ts +0 -249
  56. package/Component-60ae032f.js +0 -179
  57. package/cssm/Component-fde0c12c.d.ts +0 -249
  58. package/cssm/Component-fde0c12c.js +0 -178
  59. package/esm/Component-6e641637.d.ts +0 -249
  60. package/esm/Component-6e641637.js +0 -170
@@ -1,10 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var components_calendarInput_Component = require('./Component-fde0c12c.js');
3
+ var tslib = require('tslib');
4
4
  var React = require('react');
5
5
  var hooks = require('@alfalab/hooks');
6
6
  var Component_desktop = require('./Component.desktop.js');
7
7
  var Component_mobile = require('./Component.mobile.js');
8
+ require('./components/calendar-input/Component.js');
8
9
  require('react-merge-refs');
9
10
  require('classnames');
10
11
  require('@alfalab/core-components-calendar/cssm');
@@ -21,13 +22,13 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
21
22
 
22
23
  var React__default = /*#__PURE__*/_interopDefaultCompat(React);
23
24
 
24
- var CalendarInputResponsive = function (_a) {
25
- var _b = _a.breakpoint, breakpoint = _b === void 0 ? 1024 : _b, restProps = components_calendarInput_Component.__rest(_a, ["breakpoint"]);
25
+ var CalendarInputResponsive = React.forwardRef(function (_a, ref) {
26
+ var _b = _a.breakpoint, breakpoint = _b === void 0 ? 1024 : _b, restProps = tslib.__rest(_a, ["breakpoint"]);
26
27
  var view = hooks.useMedia([
27
28
  ['mobile', "(max-width: ".concat(breakpoint - 1, "px)")],
28
29
  ['desktop', "(min-width: ".concat(breakpoint, "px)")],
29
30
  ], 'desktop')[0];
30
- return view === 'desktop' ? (React__default.default.createElement(Component_desktop.CalendarInputDesktop, components_calendarInput_Component.__assign({}, restProps))) : (React__default.default.createElement(Component_mobile.CalendarInputMobile, components_calendarInput_Component.__assign({}, restProps)));
31
- };
31
+ return view === 'desktop' ? (React__default.default.createElement(Component_desktop.CalendarInputDesktop, tslib.__assign({}, restProps, { ref: ref }))) : (React__default.default.createElement(Component_mobile.CalendarInputMobile, tslib.__assign({}, restProps, { ref: ref })));
32
+ });
32
33
 
33
34
  exports.CalendarInputResponsive = CalendarInputResponsive;
@@ -0,0 +1,216 @@
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ import { ChangeEvent, ElementType, MouseEvent } from "react";
4
+ import { CalendarMobileProps, CalendarProps } from "@alfalab/core-components-calendar";
5
+ import { DateInputProps } from "@alfalab/core-components-date-input";
6
+ import { PopoverProps } from "@alfalab/core-components-popover";
7
+ type CalendarInputProps = Omit<DateInputProps, 'onChange' | 'mobileMode'> & {
8
+ /**
9
+ * Дополнительный класс
10
+ */
11
+ className?: string;
12
+ /**
13
+ * Дополнительный класс для инпута
14
+ */
15
+ inputClassName?: string;
16
+ /**
17
+ * Дополнительный класс для поповера
18
+ */
19
+ popoverClassName?: string;
20
+ /**
21
+ * Доп. пропсы для календаря
22
+ */
23
+ calendarProps?: (CalendarProps & Record<string, unknown>) | (CalendarMobileProps & Record<string, unknown>);
24
+ /**
25
+ * Значение инпута (используется и для календаря)
26
+ */
27
+ value?: string;
28
+ /**
29
+ * Начальное значение инпута
30
+ */
31
+ defaultValue?: string;
32
+ /**
33
+ * Состояние открытия по умолчанию
34
+ */
35
+ defaultOpen?: boolean;
36
+ /**
37
+ * Месяц в календаре по умолчанию (timestamp)
38
+ */
39
+ defaultMonth?: number;
40
+ /**
41
+ * Минимальная дата, доступная для выбора (timestamp)
42
+ */
43
+ minDate?: number;
44
+ /**
45
+ * Максимальная дата, доступная для выбора (timestamp)
46
+ */
47
+ maxDate?: number;
48
+ /**
49
+ * Список событий
50
+ */
51
+ events?: Array<Date | number>;
52
+ /**
53
+ * Список выходных
54
+ */
55
+ offDays?: Array<Date | number>;
56
+ /**
57
+ * Определяет, как рендерить календарь — в поповере или снизу инпута
58
+ */
59
+ calendarPosition?: 'static' | 'popover';
60
+ /**
61
+ * Запрещает поповеру менять свою позицию.
62
+ * Например, если места снизу недостаточно,то он все равно будет показан снизу
63
+ */
64
+ preventFlip?: boolean;
65
+ /**
66
+ * Управление нативным режимом на мобильных устройствах
67
+ */
68
+ mobileMode?: 'native' | 'popover' | 'input';
69
+ /**
70
+ * Компонент календаря
71
+ */
72
+ Calendar?: ElementType;
73
+ /**
74
+ * Обработчик изменения значения
75
+ */
76
+ onChange?: (event: ChangeEvent<HTMLInputElement> | MouseEvent<HTMLButtonElement> | null, payload: {
77
+ date: Date;
78
+ value: string;
79
+ }) => void;
80
+ /**
81
+ * Обработчик ввода в инпут
82
+ */
83
+ onInputChange?: (event: ChangeEvent<HTMLInputElement>, payload: {
84
+ value: string;
85
+ date: Date;
86
+ }) => void;
87
+ /**
88
+ * Обработчик изменения календаря
89
+ */
90
+ onCalendarChange?: CalendarProps['onChange'];
91
+ /**
92
+ * Позиционирование поповера с календарем
93
+ */
94
+ popoverPosition?: PopoverProps['position'];
95
+ /**
96
+ * z-index Popover
97
+ */
98
+ zIndexPopover?: PopoverProps['zIndex'];
99
+ /**
100
+ * Календарь будет принимать ширину инпута
101
+ */
102
+ useAnchorWidth?: boolean;
103
+ /**
104
+ * Отображение компонента в мобильном или десктопном виде
105
+ */
106
+ view?: 'desktop' | 'mobile';
107
+ };
108
+ declare const CalendarInput: React.ForwardRefExoticComponent<Omit<DateInputProps, "onChange" | "mobileMode"> & {
109
+ /**
110
+ * Дополнительный класс
111
+ */
112
+ className?: string | undefined;
113
+ /**
114
+ * Дополнительный класс для инпута
115
+ */
116
+ inputClassName?: string | undefined;
117
+ /**
118
+ * Дополнительный класс для поповера
119
+ */
120
+ popoverClassName?: string | undefined;
121
+ /**
122
+ * Доп. пропсы для календаря
123
+ */
124
+ calendarProps?: (CalendarProps & Record<string, unknown>) | (CalendarProps & {
125
+ open: boolean;
126
+ title?: string | undefined;
127
+ onClose?: (() => void) | undefined;
128
+ yearsAmount?: number | undefined;
129
+ hasHeader?: boolean | undefined;
130
+ allowSelectionFromEmptyRange?: boolean | undefined;
131
+ } & Record<string, unknown>) | undefined;
132
+ /**
133
+ * Значение инпута (используется и для календаря)
134
+ */
135
+ value?: string | undefined;
136
+ /**
137
+ * Начальное значение инпута
138
+ */
139
+ defaultValue?: string | undefined;
140
+ /**
141
+ * Состояние открытия по умолчанию
142
+ */
143
+ defaultOpen?: boolean | undefined;
144
+ /**
145
+ * Месяц в календаре по умолчанию (timestamp)
146
+ */
147
+ defaultMonth?: number | undefined;
148
+ /**
149
+ * Минимальная дата, доступная для выбора (timestamp)
150
+ */
151
+ minDate?: number | undefined;
152
+ /**
153
+ * Максимальная дата, доступная для выбора (timestamp)
154
+ */
155
+ maxDate?: number | undefined;
156
+ /**
157
+ * Список событий
158
+ */
159
+ events?: (number | Date)[] | undefined;
160
+ /**
161
+ * Список выходных
162
+ */
163
+ offDays?: (number | Date)[] | undefined;
164
+ /**
165
+ * Определяет, как рендерить календарь — в поповере или снизу инпута
166
+ */
167
+ calendarPosition?: "static" | "popover" | undefined;
168
+ /**
169
+ * Запрещает поповеру менять свою позицию.
170
+ * Например, если места снизу недостаточно,то он все равно будет показан снизу
171
+ */
172
+ preventFlip?: boolean | undefined;
173
+ /**
174
+ * Управление нативным режимом на мобильных устройствах
175
+ */
176
+ mobileMode?: "input" | "native" | "popover" | undefined;
177
+ /**
178
+ * Компонент календаря
179
+ */
180
+ Calendar?: React.ElementType<any> | undefined;
181
+ /**
182
+ * Обработчик изменения значения
183
+ */
184
+ onChange?: ((event: ChangeEvent<HTMLInputElement> | MouseEvent<HTMLButtonElement> | null, payload: {
185
+ date: Date;
186
+ value: string;
187
+ }) => void) | undefined;
188
+ /**
189
+ * Обработчик ввода в инпут
190
+ */
191
+ onInputChange?: ((event: ChangeEvent<HTMLInputElement>, payload: {
192
+ value: string;
193
+ date: Date;
194
+ }) => void) | undefined;
195
+ /**
196
+ * Обработчик изменения календаря
197
+ */
198
+ onCalendarChange?: CalendarProps['onChange'];
199
+ /**
200
+ * Позиционирование поповера с календарем
201
+ */
202
+ popoverPosition?: PopoverProps['position'];
203
+ /**
204
+ * z-index Popover
205
+ */
206
+ zIndexPopover?: PopoverProps['zIndex'];
207
+ /**
208
+ * Календарь будет принимать ширину инпута
209
+ */
210
+ useAnchorWidth?: boolean | undefined;
211
+ /**
212
+ * Отображение компонента в мобильном или десктопном виде
213
+ */
214
+ view?: "mobile" | "desktop" | undefined;
215
+ } & React.RefAttributes<HTMLInputElement>>;
216
+ export { CalendarInputProps, CalendarInput };
@@ -1,19 +1,142 @@
1
1
  'use strict';
2
2
 
3
- var components_calendarInput_Component = require('../../Component-fde0c12c.js');
4
- require('react');
5
- require('react-merge-refs');
6
- require('classnames');
7
- require('@alfalab/core-components-calendar/cssm');
8
- require('@alfalab/core-components-date-input/cssm');
9
- require('@alfalab/core-components-popover/cssm');
10
- require('@alfalab/icons-glyph/CalendarMIcon');
11
- require('../../utils.js');
12
- require('./index.module.css');
3
+ var tslib = require('tslib');
4
+ var React = require('react');
5
+ var mergeRefs = require('react-merge-refs');
6
+ var cn = require('classnames');
7
+ var coreComponentsCalendar = require('@alfalab/core-components-calendar/cssm');
8
+ var coreComponentsDateInput = require('@alfalab/core-components-date-input/cssm');
9
+ var coreComponentsPopover = require('@alfalab/core-components-popover/cssm');
10
+ var CalendarMIcon = require('@alfalab/icons-glyph/CalendarMIcon');
11
+ var utils = require('../../utils.js');
12
+ var styles = require('./index.module.css');
13
13
  require('date-fns/format');
14
14
  require('date-fns/isSameDay');
15
15
  require('date-fns/parse');
16
16
 
17
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
17
18
 
19
+ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
20
+ var mergeRefs__default = /*#__PURE__*/_interopDefaultCompat(mergeRefs);
21
+ var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
22
+ var styles__default = /*#__PURE__*/_interopDefaultCompat(styles);
18
23
 
19
- exports.CalendarInput = components_calendarInput_Component.CalendarInput;
24
+ var CalendarInput = React.forwardRef(function (_a, ref) {
25
+ var _b, _c;
26
+ var _d;
27
+ var _e = _a.block, block = _e === void 0 ? false : _e, className = _a.className; _a.inputClassName; var popoverClassName = _a.popoverClassName, _f = _a.defaultOpen, defaultOpen = _f === void 0 ? false : _f, defaultMonth = _a.defaultMonth, _g = _a.defaultValue, defaultValue = _g === void 0 ? '' : _g, _h = _a.calendarPosition, calendarPosition = _h === void 0 ? 'popover' : _h, value = _a.value, dataTestId = _a.dataTestId, _j = _a.calendarProps, calendarProps = _j === void 0 ? {} : _j, _k = _a.minDate, minDate = _k === void 0 ? calendarProps.minDate : _k, _l = _a.maxDate, maxDate = _l === void 0 ? calendarProps.maxDate : _l, _m = _a.offDays, offDays = _m === void 0 ? calendarProps.offDays || [] : _m, _o = _a.events, events = _o === void 0 ? calendarProps.events || [] : _o, preventFlip = _a.preventFlip, _p = _a.mobileMode, mobileMode = _p === void 0 ? 'popover' : _p, _q = _a.wrapperRef, wrapperRef = _q === void 0 ? null : _q, disabled = _a.disabled, _r = _a.onChange, onChange = _r === void 0 ? function () { return null; } : _r, onInputChange = _a.onInputChange, onCalendarChange = _a.onCalendarChange, onKeyDown = _a.onKeyDown, readOnly = _a.readOnly, _s = _a.Calendar, Calendar = _s === void 0 ? coreComponentsCalendar.Calendar : _s, _t = _a.popoverPosition, popoverPosition = _t === void 0 ? 'bottom-start' : _t, zIndexPopover = _a.zIndexPopover, useAnchorWidth = _a.useAnchorWidth, rightAddons = _a.rightAddons, error = _a.error, _u = _a.view, view = _u === void 0 ? 'desktop' : _u, restProps = tslib.__rest(_a, ["block", "className", "inputClassName", "popoverClassName", "defaultOpen", "defaultMonth", "defaultValue", "calendarPosition", "value", "dataTestId", "calendarProps", "minDate", "maxDate", "offDays", "events", "preventFlip", "mobileMode", "wrapperRef", "disabled", "onChange", "onInputChange", "onCalendarChange", "onKeyDown", "readOnly", "Calendar", "popoverPosition", "zIndexPopover", "useAnchorWidth", "rightAddons", "error", "view"]);
28
+ var calendarResponsive = (_d = calendarProps === null || calendarProps === void 0 ? void 0 : calendarProps.responsive) !== null && _d !== void 0 ? _d : true;
29
+ var shouldRenderNative = utils.SUPPORTS_INPUT_TYPE_DATE && mobileMode === 'native';
30
+ var shouldRenderOnlyInput = mobileMode === 'input';
31
+ var shouldRenderStatic = calendarPosition === 'static' && !shouldRenderOnlyInput;
32
+ var shouldRenderPopover = calendarPosition === 'popover' && !shouldRenderNative && !shouldRenderOnlyInput;
33
+ var _v = React.useState(false), open = _v[0], setOpen = _v[1];
34
+ var _w = React.useState(value || defaultValue), inputValue = _w[0], setInputValue = _w[1];
35
+ var calendarValue = inputValue ? coreComponentsDateInput.parseDateString(inputValue).getTime() : undefined;
36
+ var checkInputValueIsValid = React.useCallback(function (newInputValue) {
37
+ if (!newInputValue)
38
+ return false;
39
+ var dateValue = coreComponentsDateInput.parseDateString(newInputValue).getTime();
40
+ return !!(dateValue &&
41
+ coreComponentsDateInput.isCompleteDateInput(newInputValue) &&
42
+ coreComponentsCalendar.dateInLimits(dateValue, minDate, maxDate) &&
43
+ !offDays.includes(dateValue));
44
+ }, [maxDate, minDate, offDays]);
45
+ var inputDisabled = disabled || readOnly;
46
+ var inputWrapperRef = React.useRef(null);
47
+ var calendarRef = React.useRef(null);
48
+ var handleKeyDown = React.useCallback(function (event) {
49
+ if (event.target.tagName === 'INPUT' && event.key === 'Enter') {
50
+ setOpen(!open);
51
+ }
52
+ if (event.key === 'Escape') {
53
+ setOpen(false);
54
+ }
55
+ }, [open]);
56
+ var handleClick = React.useCallback(function () {
57
+ if (!open)
58
+ setOpen(true);
59
+ }, [open]);
60
+ var handleFocus = React.useCallback(function (event) {
61
+ if (view === 'desktop') {
62
+ setOpen(true);
63
+ if (!open && event.target.tagName !== 'INPUT' && calendarRef.current) {
64
+ calendarRef.current.focus();
65
+ }
66
+ }
67
+ }, [open, view]);
68
+ var handleBlur = React.useCallback(function (event) {
69
+ if (view === 'desktop') {
70
+ var target = (event.relatedTarget || document.activeElement);
71
+ if (calendarRef.current && calendarRef.current.contains(target) === false) {
72
+ setOpen(false);
73
+ }
74
+ }
75
+ }, [view]);
76
+ var handleInputKeyDown = React.useCallback(function (event) {
77
+ if (['ArrowDown', 'ArrowUp'].includes(event.key) && calendarRef.current) {
78
+ event.preventDefault();
79
+ calendarRef.current.focus();
80
+ }
81
+ if (onKeyDown)
82
+ onKeyDown(event);
83
+ }, [onKeyDown]);
84
+ var changeHandler = React.useCallback(function (event, newValue, newDate, initiator, shouldChange) {
85
+ if (initiator === void 0) { initiator = 'input'; }
86
+ if (shouldChange === void 0) { shouldChange = true; }
87
+ if (initiator === 'input' && event && onInputChange) {
88
+ onInputChange(event, { value: newValue, date: newDate });
89
+ }
90
+ if (initiator === 'calendar' && onCalendarChange) {
91
+ onCalendarChange(newDate.getTime());
92
+ }
93
+ setInputValue(newValue);
94
+ if (shouldChange) {
95
+ onChange(event, { date: newDate, value: newValue });
96
+ }
97
+ }, [onCalendarChange, onChange, onInputChange]);
98
+ var handleInputChange = React.useCallback(function (event, payload) {
99
+ changeHandler(event, payload.value, payload.date, 'input', !payload.value || checkInputValueIsValid(payload.value));
100
+ }, [changeHandler, checkInputValueIsValid]);
101
+ var handleCalendarChange = React.useCallback(function (date) {
102
+ if (date) {
103
+ changeHandler(null, coreComponentsDateInput.formatDate(date), new Date(date), 'calendar');
104
+ }
105
+ if (view === 'desktop') {
106
+ setOpen(false);
107
+ }
108
+ }, [changeHandler, view]);
109
+ var handleCalendarWrapperMouseDown = React.useCallback(function (event) {
110
+ // Не дает инпуту терять фокус при выборе даты
111
+ event.preventDefault();
112
+ }, []);
113
+ var handleCalendarClose = React.useCallback(function () {
114
+ setOpen(false);
115
+ }, []);
116
+ React.useEffect(function () {
117
+ setOpen(defaultOpen);
118
+ }, [defaultOpen]);
119
+ React.useEffect(function () {
120
+ if (typeof value !== 'undefined') {
121
+ setInputValue(value);
122
+ }
123
+ }, [value]);
124
+ var renderCalendar = function () { return (
125
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
126
+ React__default.default.createElement("div", { onMouseDown: handleCalendarWrapperMouseDown },
127
+ React__default.default.createElement(Calendar, tslib.__assign({}, calendarProps, { responsive: calendarResponsive, open: open, onClose: handleCalendarClose, ref: calendarRef, defaultMonth: defaultMonth, value: checkInputValueIsValid(inputValue) ? calendarValue : undefined, onChange: handleCalendarChange, minDate: minDate, maxDate: maxDate, offDays: offDays, events: events })))); };
128
+ return (
129
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
130
+ React__default.default.createElement("div", { className: cn__default.default(styles__default.default.component, className, (_b = {},
131
+ _b[styles__default.default.block] = block,
132
+ _b)), tabIndex: -1, onKeyDown: inputDisabled ? undefined : handleKeyDown, onClick: inputDisabled ? undefined : handleClick, onFocus: inputDisabled ? undefined : handleFocus, onBlur: handleBlur, "data-test-id": dataTestId },
133
+ React__default.default.createElement(coreComponentsDateInput.DateInput, tslib.__assign({}, restProps, { ref: ref, wrapperRef: mergeRefs__default.default([wrapperRef, inputWrapperRef]), value: inputValue, defaultValue: defaultValue, disabled: disabled, readOnly: readOnly, mobileMode: mobileMode === 'native' ? 'native' : 'input', error: error, rightAddons: React__default.default.createElement(React__default.default.Fragment, null,
134
+ rightAddons,
135
+ shouldRenderPopover && (React__default.default.createElement(CalendarMIcon.CalendarMIcon, { className: styles__default.default.calendarIcon }))), onKeyDown: handleInputKeyDown, onChange: handleInputChange, block: true })),
136
+ shouldRenderStatic && renderCalendar(),
137
+ shouldRenderPopover && (React__default.default.createElement(coreComponentsPopover.Popover, { open: open, useAnchorWidth: useAnchorWidth, anchorElement: inputWrapperRef.current, popperClassName: cn__default.default(styles__default.default.calendarContainer, (_c = {},
138
+ _c[styles__default.default.calendarResponsive] = calendarResponsive,
139
+ _c)), className: popoverClassName, position: popoverPosition, offset: [0, 4], withTransition: false, preventFlip: preventFlip, zIndex: zIndexPopover }, renderCalendar()))));
140
+ });
141
+
142
+ exports.CalendarInput = CalendarInput;
@@ -1 +1 @@
1
- export * from "../../Component-fde0c12c";
1
+ export * from "./Component";
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var components_calendarInput_Component = require('../../Component-fde0c12c.js');
3
+ var components_calendarInput_Component = require('./Component.js');
4
+ require('tslib');
4
5
  require('react');
5
6
  require('react-merge-refs');
6
7
  require('classnames');
package/cssm/desktop.js CHANGED
@@ -1,8 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  var Component_desktop = require('./Component.desktop.js');
4
- require('./Component-fde0c12c.js');
4
+ require('tslib');
5
5
  require('react');
6
+ require('./components/calendar-input/Component.js');
6
7
  require('react-merge-refs');
7
8
  require('classnames');
8
9
  require('@alfalab/core-components-calendar/cssm');
package/cssm/index.js CHANGED
@@ -2,8 +2,11 @@
2
2
 
3
3
  var Component_responsive = require('./Component.responsive.js');
4
4
  var utils = require('./utils.js');
5
- require('./Component-fde0c12c.js');
5
+ require('tslib');
6
6
  require('react');
7
+ require('@alfalab/hooks');
8
+ require('./Component.desktop.js');
9
+ require('./components/calendar-input/Component.js');
7
10
  require('react-merge-refs');
8
11
  require('classnames');
9
12
  require('@alfalab/core-components-calendar/cssm');
@@ -11,8 +14,6 @@ require('@alfalab/core-components-date-input/cssm');
11
14
  require('@alfalab/core-components-popover/cssm');
12
15
  require('@alfalab/icons-glyph/CalendarMIcon');
13
16
  require('./components/calendar-input/index.module.css');
14
- require('@alfalab/hooks');
15
- require('./Component.desktop.js');
16
17
  require('date-fns/format');
17
18
  require('date-fns/isSameDay');
18
19
  require('date-fns/parse');
package/cssm/mobile.js CHANGED
@@ -1,11 +1,12 @@
1
1
  'use strict';
2
2
 
3
3
  var Component_mobile = require('./Component.mobile.js');
4
- require('./Component-fde0c12c.js');
4
+ require('tslib');
5
5
  require('react');
6
+ require('@alfalab/core-components-calendar/cssm');
7
+ require('./components/calendar-input/Component.js');
6
8
  require('react-merge-refs');
7
9
  require('classnames');
8
- require('@alfalab/core-components-calendar/cssm');
9
10
  require('@alfalab/core-components-date-input/cssm');
10
11
  require('@alfalab/core-components-popover/cssm');
11
12
  require('@alfalab/icons-glyph/CalendarMIcon');
@@ -1,8 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  var Component_responsive = require('./Component.responsive.js');
4
- require('./Component-fde0c12c.js');
4
+ require('tslib');
5
5
  require('react');
6
+ require('@alfalab/hooks');
7
+ require('./Component.desktop.js');
8
+ require('./components/calendar-input/Component.js');
6
9
  require('react-merge-refs');
7
10
  require('classnames');
8
11
  require('@alfalab/core-components-calendar/cssm');
@@ -14,8 +17,6 @@ require('date-fns/format');
14
17
  require('date-fns/isSameDay');
15
18
  require('date-fns/parse');
16
19
  require('./components/calendar-input/index.module.css');
17
- require('@alfalab/hooks');
18
- require('./Component.desktop.js');
19
20
  require('./Component.mobile.js');
20
21
 
21
22
 
package/desktop.js CHANGED
@@ -1,8 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  var Component_desktop = require('./Component.desktop.js');
4
- require('./Component-60ae032f.js');
4
+ require('tslib');
5
5
  require('react');
6
+ require('./components/calendar-input/Component.js');
6
7
  require('react-merge-refs');
7
8
  require('classnames');
8
9
  require('@alfalab/core-components-calendar');
@@ -1,5 +1,6 @@
1
- import { FC } from 'react';
2
- import { CalendarInputProps } from "./Component-6e641637";
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ import { CalendarInputProps } from "./components/calendar-input/Component";
3
4
  type CalendarInputDesktopProps = Omit<CalendarInputProps, 'view'>;
4
- declare const CalendarInputDesktop: FC<CalendarInputDesktopProps>;
5
+ declare const CalendarInputDesktop: React.ForwardRefExoticComponent<CalendarInputDesktopProps & React.RefAttributes<HTMLInputElement>>;
5
6
  export { CalendarInputDesktopProps, CalendarInputDesktop };
@@ -1,5 +1,6 @@
1
- import { C as CalendarInput, _ as __assign } from './Component-6e641637.js';
2
- import React from 'react';
1
+ import { __assign } from 'tslib';
2
+ import React, { forwardRef } from 'react';
3
+ import { CalendarInput } from './components/calendar-input/Component.js';
3
4
  import 'react-merge-refs';
4
5
  import 'classnames';
5
6
  import '@alfalab/core-components-calendar/esm';
@@ -11,6 +12,6 @@ import 'date-fns/format';
11
12
  import 'date-fns/isSameDay';
12
13
  import 'date-fns/parse';
13
14
 
14
- var CalendarInputDesktop = function (props) { return (React.createElement(CalendarInput, __assign({}, props))); };
15
+ var CalendarInputDesktop = forwardRef(function (props, ref) { return React.createElement(CalendarInput, __assign({}, props, { ref: ref })); });
15
16
 
16
17
  export { CalendarInputDesktop };
@@ -1,5 +1,6 @@
1
- import { FC } from 'react';
2
- import { CalendarInputProps } from "./Component-6e641637";
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ import { CalendarInputProps } from "./components/calendar-input/Component";
3
4
  type CalendarInputMobileProps = Omit<CalendarInputProps, 'view'>;
4
- declare const CalendarInputMobile: FC<CalendarInputMobileProps>;
5
+ declare const CalendarInputMobile: React.ForwardRefExoticComponent<CalendarInputMobileProps & React.RefAttributes<HTMLInputElement>>;
5
6
  export { CalendarInputMobileProps, CalendarInputMobile };
@@ -1,6 +1,7 @@
1
- import { C as CalendarInput, _ as __assign } from './Component-6e641637.js';
2
- import React from 'react';
1
+ import { __assign } from 'tslib';
2
+ import React, { forwardRef } from 'react';
3
3
  import { CalendarMobile } from '@alfalab/core-components-calendar/esm';
4
+ import { CalendarInput } from './components/calendar-input/Component.js';
4
5
  import 'react-merge-refs';
5
6
  import 'classnames';
6
7
  import '@alfalab/core-components-date-input/esm';
@@ -11,6 +12,6 @@ import 'date-fns/format';
11
12
  import 'date-fns/isSameDay';
12
13
  import 'date-fns/parse';
13
14
 
14
- var CalendarInputMobile = function (props) { return (React.createElement(CalendarInput, __assign({ Calendar: CalendarMobile, view: 'mobile' }, props))); };
15
+ var CalendarInputMobile = forwardRef(function (props, ref) { return React.createElement(CalendarInput, __assign({ Calendar: CalendarMobile, view: 'mobile' }, props, { ref: ref })); });
15
16
 
16
17
  export { CalendarInputMobile };
@@ -1,5 +1,6 @@
1
- import { FC } from 'react';
2
- import { CalendarInputProps } from "./Component-6e641637";
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ import { CalendarInputProps } from "./components/calendar-input/Component";
3
4
  type CalendarInputResponsiveProps = Omit<CalendarInputProps, 'view'> & {
4
5
  /**
5
6
  * Контрольная точка, с нее начинается desktop версия
@@ -8,5 +9,11 @@ type CalendarInputResponsiveProps = Omit<CalendarInputProps, 'view'> & {
8
9
  breakpoint?: number;
9
10
  };
10
11
  type CalendarInputMedia = 'desktop' | 'mobile';
11
- declare const CalendarInputResponsive: FC<CalendarInputResponsiveProps>;
12
+ declare const CalendarInputResponsive: React.ForwardRefExoticComponent<Omit<CalendarInputProps, "view"> & {
13
+ /**
14
+ * Контрольная точка, с нее начинается desktop версия
15
+ * @default 1024
16
+ */
17
+ breakpoint?: number | undefined;
18
+ } & React.RefAttributes<HTMLInputElement>>;
12
19
  export { CalendarInputResponsiveProps, CalendarInputMedia, CalendarInputResponsive };
@@ -1,8 +1,9 @@
1
- import { a as __rest, _ as __assign } from './Component-6e641637.js';
2
- import React from 'react';
1
+ import { __rest, __assign } from 'tslib';
2
+ import React, { forwardRef } from 'react';
3
3
  import { useMedia } from '@alfalab/hooks';
4
4
  import { CalendarInputDesktop } from './Component.desktop.js';
5
5
  import { CalendarInputMobile } from './Component.mobile.js';
6
+ import './components/calendar-input/Component.js';
6
7
  import 'react-merge-refs';
7
8
  import 'classnames';
8
9
  import '@alfalab/core-components-calendar/esm';
@@ -14,13 +15,13 @@ import 'date-fns/format';
14
15
  import 'date-fns/isSameDay';
15
16
  import 'date-fns/parse';
16
17
 
17
- var CalendarInputResponsive = function (_a) {
18
+ var CalendarInputResponsive = forwardRef(function (_a, ref) {
18
19
  var _b = _a.breakpoint, breakpoint = _b === void 0 ? 1024 : _b, restProps = __rest(_a, ["breakpoint"]);
19
20
  var view = useMedia([
20
21
  ['mobile', "(max-width: ".concat(breakpoint - 1, "px)")],
21
22
  ['desktop', "(min-width: ".concat(breakpoint, "px)")],
22
23
  ], 'desktop')[0];
23
- return view === 'desktop' ? (React.createElement(CalendarInputDesktop, __assign({}, restProps))) : (React.createElement(CalendarInputMobile, __assign({}, restProps)));
24
- };
24
+ return view === 'desktop' ? (React.createElement(CalendarInputDesktop, __assign({}, restProps, { ref: ref }))) : (React.createElement(CalendarInputMobile, __assign({}, restProps, { ref: ref })));
25
+ });
25
26
 
26
27
  export { CalendarInputResponsive };