@alfalab/core-components-calendar-input 10.4.34 → 11.0.0-snapshot-6a9d3fc
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/Component.responsive.d.ts +5 -7
- package/Component.responsive.js +4 -3
- package/Component.responsive.js.map +1 -0
- package/components/calendar-input/Component.d.ts +10 -16
- package/components/calendar-input/Component.js +7 -8
- package/components/calendar-input/Component.js.map +1 -0
- package/components/calendar-input/index.css +18 -56
- package/components/calendar-input/index.d.ts +1 -1
- package/components/calendar-input/index.js +3 -2
- package/components/calendar-input/index.js.map +1 -0
- package/components/calendar-input/index.module.css.js +8 -0
- package/components/calendar-input/index.module.css.js.map +1 -0
- package/cssm/Component.responsive.d.ts +5 -7
- package/cssm/Component.responsive.js +6 -5
- package/cssm/Component.responsive.js.map +1 -0
- package/cssm/components/calendar-input/Component.d.ts +10 -16
- package/cssm/components/calendar-input/Component.js +9 -8
- package/cssm/components/calendar-input/Component.js.map +1 -0
- package/cssm/components/calendar-input/index.d.ts +1 -1
- package/cssm/components/calendar-input/index.js +3 -2
- package/cssm/components/calendar-input/index.js.map +1 -0
- package/cssm/components/calendar-input/index.module.css +8 -45
- package/cssm/desktop/Component.desktop.d.ts +3 -5
- package/cssm/desktop/Component.desktop.js +3 -2
- package/cssm/desktop/Component.desktop.js.map +1 -0
- package/cssm/desktop/index.d.ts +1 -2
- package/cssm/desktop/index.js +3 -2
- package/cssm/desktop/index.js.map +1 -0
- package/cssm/index.d.ts +2 -3
- package/cssm/index.js +1 -0
- package/cssm/index.js.map +1 -0
- package/cssm/mobile/Component.mobile.d.ts +3 -5
- package/cssm/mobile/Component.mobile.js +3 -2
- package/cssm/mobile/Component.mobile.js.map +1 -0
- package/cssm/mobile/index.d.ts +1 -2
- package/cssm/mobile/index.js +3 -2
- package/cssm/mobile/index.js.map +1 -0
- package/cssm/shared/index.d.ts +1 -1
- package/cssm/shared/index.js +1 -0
- package/cssm/shared/index.js.map +1 -0
- package/cssm/utils.d.ts +9 -10
- package/cssm/utils.js +3 -2
- package/cssm/utils.js.map +1 -0
- package/desktop/Component.desktop.d.ts +3 -5
- package/desktop/Component.desktop.js +3 -2
- package/desktop/Component.desktop.js.map +1 -0
- package/desktop/index.d.ts +1 -2
- package/desktop/index.js +3 -2
- package/desktop/index.js.map +1 -0
- package/esm/Component.responsive.d.ts +5 -7
- package/esm/Component.responsive.js +1 -0
- package/esm/Component.responsive.js.map +1 -0
- package/esm/components/calendar-input/Component.d.ts +10 -16
- package/esm/components/calendar-input/Component.js +2 -3
- package/esm/components/calendar-input/Component.js.map +1 -0
- package/esm/components/calendar-input/index.css +18 -56
- package/esm/components/calendar-input/index.d.ts +1 -1
- package/esm/components/calendar-input/index.js +1 -0
- package/esm/components/calendar-input/index.js.map +1 -0
- package/esm/components/calendar-input/index.module.css.js +6 -0
- package/esm/components/calendar-input/index.module.css.js.map +1 -0
- package/esm/desktop/Component.desktop.d.ts +3 -5
- package/esm/desktop/Component.desktop.js +1 -0
- package/esm/desktop/Component.desktop.js.map +1 -0
- package/esm/desktop/index.d.ts +1 -2
- package/esm/desktop/index.js +1 -0
- package/esm/desktop/index.js.map +1 -0
- package/esm/index.d.ts +2 -3
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -0
- package/esm/mobile/Component.mobile.d.ts +3 -5
- package/esm/mobile/Component.mobile.js +1 -0
- package/esm/mobile/Component.mobile.js.map +1 -0
- package/esm/mobile/index.d.ts +1 -2
- package/esm/mobile/index.js +1 -0
- package/esm/mobile/index.js.map +1 -0
- package/esm/shared/index.d.ts +1 -1
- package/esm/shared/index.js +1 -0
- package/esm/shared/index.js.map +1 -0
- package/esm/utils.d.ts +9 -10
- package/esm/utils.js +1 -0
- package/esm/utils.js.map +1 -0
- package/index.d.ts +2 -3
- package/index.js +1 -0
- package/index.js.map +1 -0
- package/mobile/Component.mobile.d.ts +3 -5
- package/mobile/Component.mobile.js +3 -2
- package/mobile/Component.mobile.js.map +1 -0
- package/mobile/index.d.ts +1 -2
- package/mobile/index.js +3 -2
- package/mobile/index.js.map +1 -0
- package/modern/Component.responsive.d.ts +5 -7
- package/modern/Component.responsive.js +1 -0
- package/modern/Component.responsive.js.map +1 -0
- package/modern/components/calendar-input/Component.d.ts +10 -16
- package/modern/components/calendar-input/Component.js +2 -3
- package/modern/components/calendar-input/Component.js.map +1 -0
- package/modern/components/calendar-input/index.css +18 -56
- package/modern/components/calendar-input/index.d.ts +1 -1
- package/modern/components/calendar-input/index.js +1 -0
- package/modern/components/calendar-input/index.js.map +1 -0
- package/modern/components/calendar-input/index.module.css.js +6 -0
- package/modern/components/calendar-input/index.module.css.js.map +1 -0
- package/modern/desktop/Component.desktop.d.ts +3 -5
- package/modern/desktop/Component.desktop.js +1 -0
- package/modern/desktop/Component.desktop.js.map +1 -0
- package/modern/desktop/index.d.ts +1 -2
- package/modern/desktop/index.js +1 -0
- package/modern/desktop/index.js.map +1 -0
- package/modern/index.d.ts +2 -3
- package/modern/index.js +1 -0
- package/modern/index.js.map +1 -0
- package/modern/mobile/Component.mobile.d.ts +3 -5
- package/modern/mobile/Component.mobile.js +1 -0
- package/modern/mobile/Component.mobile.js.map +1 -0
- package/modern/mobile/index.d.ts +1 -2
- package/modern/mobile/index.js +1 -0
- package/modern/mobile/index.js.map +1 -0
- package/modern/shared/index.d.ts +1 -1
- package/modern/shared/index.js +1 -0
- package/modern/shared/index.js.map +1 -0
- package/modern/utils.d.ts +9 -10
- package/modern/utils.js +1 -0
- package/modern/utils.js.map +1 -0
- package/moderncssm/Component.responsive.d.ts +5 -7
- package/moderncssm/Component.responsive.js +1 -0
- package/moderncssm/Component.responsive.js.map +1 -0
- package/moderncssm/components/calendar-input/Component.d.ts +10 -16
- package/moderncssm/components/calendar-input/Component.js +1 -0
- package/moderncssm/components/calendar-input/Component.js.map +1 -0
- package/moderncssm/components/calendar-input/index.d.ts +1 -1
- package/moderncssm/components/calendar-input/index.js +1 -0
- package/moderncssm/components/calendar-input/index.js.map +1 -0
- package/moderncssm/components/calendar-input/index.module.css +3 -22
- package/moderncssm/desktop/Component.desktop.d.ts +3 -5
- package/moderncssm/desktop/Component.desktop.js +1 -0
- package/moderncssm/desktop/Component.desktop.js.map +1 -0
- package/moderncssm/desktop/index.d.ts +1 -2
- package/moderncssm/desktop/index.js +1 -0
- package/moderncssm/desktop/index.js.map +1 -0
- package/moderncssm/index.d.ts +2 -3
- package/moderncssm/index.js +1 -0
- package/moderncssm/index.js.map +1 -0
- package/moderncssm/mobile/Component.mobile.d.ts +3 -5
- package/moderncssm/mobile/Component.mobile.js +1 -0
- package/moderncssm/mobile/Component.mobile.js.map +1 -0
- package/moderncssm/mobile/index.d.ts +1 -2
- package/moderncssm/mobile/index.js +1 -0
- package/moderncssm/mobile/index.js.map +1 -0
- package/moderncssm/shared/index.d.ts +1 -1
- package/moderncssm/shared/index.js +1 -0
- package/moderncssm/shared/index.js.map +1 -0
- package/moderncssm/utils.d.ts +9 -10
- package/moderncssm/utils.js +1 -0
- package/moderncssm/utils.js.map +1 -0
- package/package.json +8 -10
- package/shared/index.d.ts +1 -1
- package/shared/index.js +1 -0
- package/shared/index.js.map +1 -0
- package/src/components/calendar-input/index.module.css +1 -1
- package/utils.d.ts +9 -10
- package/utils.js +1 -0
- package/utils.js.map +1 -0
- package/desktop/package.json +0 -3
- package/mobile/package.json +0 -3
- package/shared/package.json +0 -3
- package/src/desktop/package.json +0 -3
- package/src/mobile/package.json +0 -3
- package/src/shared/package.json +0 -3
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import { CalendarInputProps } from
|
|
4
|
-
type CalendarInputResponsiveProps = Omit<CalendarInputProps, 'view'> & {
|
|
2
|
+
import { CalendarInputProps } from './components/calendar-input/Component';
|
|
3
|
+
export declare type CalendarInputResponsiveProps = Omit<CalendarInputProps, 'view'> & {
|
|
5
4
|
/**
|
|
6
5
|
* Контрольная точка, с нее начинается desktop версия
|
|
7
6
|
* @default 1024
|
|
@@ -12,12 +11,12 @@ type CalendarInputResponsiveProps = Omit<CalendarInputProps, 'view'> & {
|
|
|
12
11
|
*/
|
|
13
12
|
client?: 'desktop' | 'mobile';
|
|
14
13
|
};
|
|
15
|
-
type CalendarInputMedia = 'desktop' | 'mobile';
|
|
14
|
+
export declare type CalendarInputMedia = 'desktop' | 'mobile';
|
|
16
15
|
/**
|
|
17
16
|
* @deprecated
|
|
18
17
|
* use UniversalDateInput instead
|
|
19
18
|
*/
|
|
20
|
-
declare const CalendarInputResponsive: React.ForwardRefExoticComponent<Omit<CalendarInputProps, "view"> & {
|
|
19
|
+
export declare const CalendarInputResponsive: React.ForwardRefExoticComponent<Omit<CalendarInputProps, "view"> & {
|
|
21
20
|
/**
|
|
22
21
|
* Контрольная точка, с нее начинается desktop версия
|
|
23
22
|
* @default 1024
|
|
@@ -26,6 +25,5 @@ declare const CalendarInputResponsive: React.ForwardRefExoticComponent<Omit<Cale
|
|
|
26
25
|
/**
|
|
27
26
|
* Версия, которая будет использоваться при серверном рендеринге
|
|
28
27
|
*/
|
|
29
|
-
client?: "
|
|
28
|
+
client?: "mobile" | "desktop" | undefined;
|
|
30
29
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
31
|
-
export { CalendarInputResponsiveProps, CalendarInputMedia, CalendarInputResponsive };
|
package/Component.responsive.js
CHANGED
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var coreComponentsMq = require('@alfalab/core-components-mq');
|
|
8
|
-
var
|
|
9
|
-
var
|
|
8
|
+
var Component_desktop = require('./desktop/Component.desktop.js');
|
|
9
|
+
var Component_mobile = require('./mobile/Component.mobile.js');
|
|
10
10
|
|
|
11
11
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
12
12
|
|
|
@@ -19,7 +19,8 @@ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
|
19
19
|
var CalendarInputResponsive = React.forwardRef(function (_a, ref) {
|
|
20
20
|
var breakpoint = _a.breakpoint, client = _a.client, restProps = tslib.__rest(_a, ["breakpoint", "client"]);
|
|
21
21
|
var isDesktop = coreComponentsMq.useIsDesktop(breakpoint, client === 'desktop');
|
|
22
|
-
return isDesktop ? (React__default.default.createElement(
|
|
22
|
+
return isDesktop ? (React__default.default.createElement(Component_desktop.CalendarInputDesktop, tslib.__assign({}, restProps, { ref: ref }))) : (React__default.default.createElement(Component_mobile.CalendarInputMobile, tslib.__assign({}, restProps, { ref: ref })));
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
exports.CalendarInputResponsive = CalendarInputResponsive;
|
|
26
|
+
//# sourceMappingURL=Component.responsive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Component.responsive.js","sources":["src/Component.responsive.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { DateInputProps } from '@alfalab/core-components-date-input';\nimport { useIsDesktop } from '@alfalab/core-components-mq';\n\nimport { CalendarInputProps } from './components/calendar-input/Component';\nimport { CalendarInputDesktop } from './desktop';\nimport { CalendarInputMobile } from './mobile';\n\nexport type CalendarInputResponsiveProps = Omit<CalendarInputProps, 'view'> & {\n /**\n * Контрольная точка, с нее начинается desktop версия\n * @default 1024\n */\n breakpoint?: number;\n\n /**\n * Версия, которая будет использоваться при серверном рендеринге\n */\n client?: 'desktop' | 'mobile';\n};\n\nexport type CalendarInputMedia = 'desktop' | 'mobile';\n\n/**\n * @deprecated\n * use UniversalDateInput instead\n */\nexport const CalendarInputResponsive = forwardRef<HTMLInputElement, CalendarInputResponsiveProps>(\n ({ breakpoint, client, ...restProps }, ref) => {\n const isDesktop = useIsDesktop(breakpoint, client === 'desktop');\n\n return isDesktop ? (\n <CalendarInputDesktop {...restProps} ref={ref} />\n ) : (\n <CalendarInputMobile {...restProps} ref={ref} />\n );\n },\n);\n"],"names":["forwardRef","__rest","useIsDesktop","React","CalendarInputDesktop","__assign","CalendarInputMobile"],"mappings":";;;;;;;;;;;;;;AAyBA;;;AAGG;IACU,uBAAuB,GAAGA,gBAAU,CAC7C,UAAC,EAAoC,EAAE,GAAG,EAAA;IAAvC,IAAA,UAAU,gBAAA,EAAE,MAAM,YAAA,EAAK,SAAS,GAAlCC,YAAA,CAAA,EAAA,EAAA,CAAA,YAAA,EAAA,QAAA,CAAoC,CAAF;IAC/B,IAAM,SAAS,GAAGC,6BAAY,CAAC,UAAU,EAAE,MAAM,KAAK,SAAS,CAAC;AAEhE,IAAA,OAAO,SAAS,IACZC,sBAAA,CAAA,aAAA,CAACC,sCAAoB,EAAAC,cAAA,CAAA,EAAA,EAAK,SAAS,EAAA,EAAE,GAAG,EAAE,GAAG,EAAA,CAAA,CAAI,KAEjDF,sBAAA,CAAA,aAAA,CAACG,oCAAmB,EAAAD,cAAA,CAAA,EAAA,EAAK,SAAS,EAAA,EAAE,GAAG,EAAE,GAAG,EAAA,CAAA,CAAI,CACnD;AACL,CAAC;;;;"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import { PopoverProps } from "@alfalab/core-components-popover";
|
|
8
|
-
type CalendarInputProps = Omit<DateInputProps, 'onChange' | 'mobileMode'> & {
|
|
1
|
+
import React, { ChangeEvent, ElementType, MouseEvent } from 'react';
|
|
2
|
+
import type { CalendarDesktopProps } from '@alfalab/core-components-calendar/desktop';
|
|
3
|
+
import type { CalendarMobileProps } from '@alfalab/core-components-calendar/mobile';
|
|
4
|
+
import { DateInputProps } from '@alfalab/core-components-date-input';
|
|
5
|
+
import { PopoverProps } from '@alfalab/core-components-popover';
|
|
6
|
+
export declare type CalendarInputProps = Omit<DateInputProps, 'onChange' | 'mobileMode'> & {
|
|
9
7
|
/**
|
|
10
8
|
* Дополнительный класс
|
|
11
9
|
*/
|
|
@@ -118,7 +116,7 @@ type CalendarInputProps = Omit<DateInputProps, 'onChange' | 'mobileMode'> & {
|
|
|
118
116
|
*/
|
|
119
117
|
disableUserInput?: boolean;
|
|
120
118
|
};
|
|
121
|
-
declare const CalendarInput: React.ForwardRefExoticComponent<Omit<DateInputProps, "onChange" | "mobileMode"> & {
|
|
119
|
+
export declare const CalendarInput: React.ForwardRefExoticComponent<Omit<DateInputProps, "onChange" | "mobileMode"> & {
|
|
122
120
|
/**
|
|
123
121
|
* Дополнительный класс
|
|
124
122
|
*/
|
|
@@ -143,16 +141,13 @@ declare const CalendarInput: React.ForwardRefExoticComponent<Omit<DateInputProps
|
|
|
143
141
|
onApply?: (() => void) | undefined;
|
|
144
142
|
clickableMonth?: boolean | undefined;
|
|
145
143
|
cancelButtonContent?: string | undefined;
|
|
146
|
-
/**
|
|
147
|
-
* Минимальная дата, доступная для выбора (timestamp)
|
|
148
|
-
*/
|
|
149
144
|
selectButtonContent?: string | undefined;
|
|
150
145
|
resetButtonContent?: string | undefined;
|
|
151
146
|
} & {
|
|
152
147
|
onMonthTitleClick?: ((event: React.MouseEvent<HTMLSpanElement, globalThis.MouseEvent>) => void) | undefined;
|
|
153
148
|
yearsAmount?: number | undefined;
|
|
154
149
|
scrollableContainer?: HTMLElement | undefined;
|
|
155
|
-
} & Omit<CalendarDesktopProps, ("className" | "dataTestId" | "
|
|
150
|
+
} & Omit<CalendarDesktopProps, ("className" | "dataTestId" | "defaultView" | "selectorView" | "rangeComplete" | "onMonthChange" | "onYearClick" | "onPeriodClick" | "hasHeader" | "responsive" | "showCurrentYearSelector") | ("headerClassName" | "contentClassName")> & Pick<CalendarDesktopProps, "className" | "dataTestId" | "defaultView" | "selectorView" | "rangeComplete" | "onMonthChange" | "onYearClick" | "onPeriodClick" | "hasHeader" | "responsive" | "showCurrentYearSelector"> & Pick<import("../../../../modal/src/shared").ModalHeaderProps, "hasBackButton" | "onBack"> & Record<string, unknown>) | undefined;
|
|
156
151
|
/**
|
|
157
152
|
* Значение инпута (используется и для календаря)
|
|
158
153
|
*/
|
|
@@ -197,7 +192,7 @@ declare const CalendarInput: React.ForwardRefExoticComponent<Omit<DateInputProps
|
|
|
197
192
|
/**
|
|
198
193
|
* Управление нативным режимом на мобильных устройствах
|
|
199
194
|
*/
|
|
200
|
-
mobileMode?: "input" | "
|
|
195
|
+
mobileMode?: "input" | "popover" | "native" | undefined;
|
|
201
196
|
/**
|
|
202
197
|
* Компонент календаря
|
|
203
198
|
*/
|
|
@@ -243,10 +238,9 @@ declare const CalendarInput: React.ForwardRefExoticComponent<Omit<DateInputProps
|
|
|
243
238
|
/**
|
|
244
239
|
* Отображение компонента в мобильном или десктопном виде
|
|
245
240
|
*/
|
|
246
|
-
view?: "
|
|
241
|
+
view?: "mobile" | "desktop" | undefined;
|
|
247
242
|
/**
|
|
248
243
|
* Запретить ввод с клавиатуры
|
|
249
244
|
*/
|
|
250
245
|
disableUserInput?: boolean | undefined;
|
|
251
246
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
252
|
-
export { CalendarInputProps, CalendarInput };
|
|
@@ -11,6 +11,7 @@ var coreComponentsDateInput = require('@alfalab/core-components-date-input');
|
|
|
11
11
|
var coreComponentsPopover = require('@alfalab/core-components-popover');
|
|
12
12
|
var CalendarMIcon = require('@alfalab/icons-glyph/CalendarMIcon');
|
|
13
13
|
var utils = require('../../utils.js');
|
|
14
|
+
var index_module = require('./index.module.css.js');
|
|
14
15
|
|
|
15
16
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
16
17
|
|
|
@@ -18,9 +19,6 @@ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
|
18
19
|
var mergeRefs__default = /*#__PURE__*/_interopDefaultCompat(mergeRefs);
|
|
19
20
|
var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
20
21
|
|
|
21
|
-
var styles = {"component":"calendar-input__component_12f4q","block":"calendar-input__block_12f4q","calendarContainer":"calendar-input__calendarContainer_12f4q","calendarResponsive":"calendar-input__calendarResponsive_12f4q","calendarIcon":"calendar-input__calendarIcon_12f4q","nativeInput":"calendar-input__nativeInput_12f4q"};
|
|
22
|
-
require('./index.css')
|
|
23
|
-
|
|
24
22
|
var CalendarInput = React.forwardRef(function (_a, ref) {
|
|
25
23
|
var _b, _c;
|
|
26
24
|
var _d;
|
|
@@ -154,17 +152,18 @@ var CalendarInput = React.forwardRef(function (_a, ref) {
|
|
|
154
152
|
React__default.default.createElement("div", { onMouseDown: handleCalendarWrapperMouseDown }, Calendar ? (React__default.default.createElement(Calendar, tslib.__assign({}, calendarProps, { responsive: calendarResponsive, open: open, onClose: closeCalendar, ref: calendarRef, defaultMonth: defaultMonth, value: checkInputValueIsValid(inputValue) ? calendarValue : undefined, onChange: handleCalendarChange, minDate: minDate, maxDate: maxDate, offDays: offDays, events: events }))) : null)); };
|
|
155
153
|
return (
|
|
156
154
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
157
|
-
React__default.default.createElement("div", { className: cn__default.default(
|
|
158
|
-
_b[
|
|
155
|
+
React__default.default.createElement("div", { className: cn__default.default(index_module.component, className, (_b = {},
|
|
156
|
+
_b[index_module.block] = block,
|
|
159
157
|
_b)), tabIndex: -1, onKeyDown: inputDisabled ? undefined : handleKeyDown, onClick: inputDisabled ? undefined : handleClick, onFocus: inputDisabled ? undefined : handleFocus, onBlur: handleBlur, "data-test-id": dataTestId },
|
|
160
158
|
React__default.default.createElement(coreComponentsDateInput.DateInput, tslib.__assign({ autoComplete: 'off' }, restProps, { ref: mergeRefs__default.default([inputRef, ref]), wrapperRef: mergeRefs__default.default([wrapperRef, inputWrapperRef]), value: inputValue, defaultValue: defaultValue, disabled: disabled, inputClassName: inputClassName, readOnly: readOnly, mobileMode: mobileMode === 'native' ? 'native' : 'input', error: error, disableUserInput: disableUserInput, rightAddons: React__default.default.createElement(React__default.default.Fragment, null,
|
|
161
159
|
rightAddons,
|
|
162
|
-
shouldRenderPopover && (React__default.default.createElement(CalendarMIcon.CalendarMIcon, { className:
|
|
160
|
+
shouldRenderPopover && (React__default.default.createElement(CalendarMIcon.CalendarMIcon, { className: index_module.calendarIcon }))), rightAddonsProps: { onMouseDown: function (e) { return e.preventDefault(); } }, onKeyDown: handleInputKeyDown, onChange: handleInputChange, block: true })),
|
|
163
161
|
shouldRenderStatic && renderCalendar(),
|
|
164
162
|
shouldRenderPopover &&
|
|
165
|
-
(view === 'desktop' ? (React__default.default.createElement(coreComponentsPopover.Popover, { open: open, useAnchorWidth: useAnchorWidth, anchorElement: inputWrapperRef.current, popperClassName: cn__default.default(
|
|
166
|
-
_c[
|
|
163
|
+
(view === 'desktop' ? (React__default.default.createElement(coreComponentsPopover.Popover, { open: open, useAnchorWidth: useAnchorWidth, anchorElement: inputWrapperRef.current, popperClassName: cn__default.default(index_module.calendarContainer, (_c = {},
|
|
164
|
+
_c[index_module.calendarResponsive] = calendarResponsive,
|
|
167
165
|
_c)), className: popoverClassName, position: popoverPosition, offset: [0, 4], withTransition: false, preventFlip: preventFlip, zIndex: zIndexPopover }, renderCalendar())) : (renderCalendar()))));
|
|
168
166
|
});
|
|
169
167
|
|
|
170
168
|
exports.CalendarInput = CalendarInput;
|
|
169
|
+
//# sourceMappingURL=Component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["../../src/components/calendar-input/Component.tsx"],"sourcesContent":["import React, {\n ChangeEvent,\n ElementType,\n FocusEvent,\n forwardRef,\n KeyboardEvent,\n MouseEvent,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport mergeRefs from 'react-merge-refs';\nimport cn from 'classnames';\n\nimport type { CalendarDesktopProps } from '@alfalab/core-components-calendar/desktop';\nimport type { CalendarMobileProps } from '@alfalab/core-components-calendar/mobile';\nimport { dateInLimits } from '@alfalab/core-components-calendar/shared';\nimport {\n DateInput,\n DateInputProps,\n formatDate,\n isCompleteDateInput,\n parseDateString,\n} from '@alfalab/core-components-date-input';\nimport { Popover, PopoverProps } from '@alfalab/core-components-popover';\nimport { CalendarMIcon } from '@alfalab/icons-glyph/CalendarMIcon';\n\nimport { SUPPORTS_INPUT_TYPE_DATE } from '../../utils';\n\nimport styles from './index.module.css';\n\nexport type CalendarInputProps = Omit<DateInputProps, 'onChange' | 'mobileMode'> & {\n /**\n * Дополнительный класс\n */\n className?: string;\n\n /**\n * Дополнительный класс для инпута\n */\n inputClassName?: string;\n\n /**\n * Дополнительный класс для поповера\n */\n popoverClassName?: string;\n\n /**\n * Доп. пропсы для календаря\n */\n calendarProps?:\n | (CalendarDesktopProps & Record<string, unknown>)\n | (CalendarMobileProps & Record<string, unknown>);\n\n /**\n * Значение инпута (используется и для календаря)\n */\n value?: string;\n\n /**\n * Начальное значение инпута\n */\n defaultValue?: string;\n\n /**\n * Состояние открытия по умолчанию\n */\n defaultOpen?: boolean;\n\n /**\n * Месяц в календаре по умолчанию (timestamp)\n */\n defaultMonth?: number;\n\n /**\n * Минимальная дата, доступная для выбора (timestamp)\n */\n minDate?: number;\n\n /**\n * Максимальная дата, доступная для выбора (timestamp)\n */\n maxDate?: number;\n\n /**\n * Список событий\n */\n events?: Array<Date | number>;\n\n /**\n * Список выходных\n */\n offDays?: Array<Date | number>;\n\n /**\n * Определяет, как рендерить календарь — в поповере или снизу инпута\n */\n calendarPosition?: 'static' | 'popover';\n\n /**\n * Запрещает поповеру менять свою позицию.\n * Например, если места снизу недостаточно,то он все равно будет показан снизу\n */\n preventFlip?: boolean;\n\n /**\n * Управление нативным режимом на мобильных устройствах\n */\n mobileMode?: 'native' | 'popover' | 'input';\n\n /**\n * Компонент календаря\n */\n Calendar?: ElementType;\n\n /**\n * Обработчик изменения значения\n */\n onChange?: (\n event: ChangeEvent<HTMLInputElement> | MouseEvent<HTMLButtonElement> | null,\n payload: { date: Date; value: string },\n ) => void;\n\n /**\n * Обработчик ввода в инпут\n */\n onInputChange?: (\n event: ChangeEvent<HTMLInputElement>,\n payload: { value: string; date: Date },\n ) => void;\n\n /**\n * Обработчик изменения календаря\n */\n onCalendarChange?: CalendarDesktopProps['onChange'];\n\n /**\n * Обработчик открытия календаря\n */\n onCalendarOpen?: () => void;\n\n /**\n * Обработчик закрытия календаря\n */\n onCalendarClose?: () => void;\n\n /**\n * Позиционирование поповера с календарем\n */\n popoverPosition?: PopoverProps['position'];\n\n /**\n * z-index Popover\n */\n zIndexPopover?: PopoverProps['zIndex'];\n\n /**\n * Календарь будет принимать ширину инпута\n */\n useAnchorWidth?: boolean;\n\n /**\n * Отображение компонента в мобильном или десктопном виде\n */\n view?: 'desktop' | 'mobile';\n\n /**\n * Запретить ввод с клавиатуры\n */\n disableUserInput?: boolean;\n};\n\nexport const CalendarInput = forwardRef<HTMLInputElement, CalendarInputProps>(\n (\n {\n block = false,\n className,\n inputClassName,\n popoverClassName,\n defaultOpen = false,\n defaultMonth,\n defaultValue = '',\n calendarPosition = 'popover',\n value,\n dataTestId,\n calendarProps = {},\n minDate = calendarProps.minDate,\n maxDate = calendarProps.maxDate,\n offDays = calendarProps.offDays || [],\n events = calendarProps.events || [],\n preventFlip,\n mobileMode = 'popover',\n wrapperRef = null,\n disabled,\n onChange = () => null,\n onInputChange,\n onCalendarChange,\n onCalendarOpen,\n onCalendarClose,\n onKeyDown,\n readOnly,\n disableUserInput = false,\n Calendar,\n popoverPosition = 'bottom-start',\n zIndexPopover,\n useAnchorWidth,\n rightAddons,\n error,\n view = 'desktop',\n ...restProps\n },\n ref,\n ) => {\n const calendarResponsive = calendarProps?.responsive ?? true;\n const shouldRenderNative = SUPPORTS_INPUT_TYPE_DATE && mobileMode === 'native';\n const shouldRenderOnlyInput = mobileMode === 'input';\n const shouldRenderStatic = calendarPosition === 'static' && !shouldRenderOnlyInput;\n const shouldRenderPopover =\n calendarPosition === 'popover' && !shouldRenderNative && !shouldRenderOnlyInput;\n\n const [open, setOpen] = useState(false);\n\n const [inputValue, setInputValue] = useState(value || defaultValue);\n\n const calendarValue = inputValue ? parseDateString(inputValue).getTime() : undefined;\n\n const checkInputValueIsValid = (newInputValue?: string) => {\n if (!newInputValue) return false;\n\n const dateValue = parseDateString(newInputValue).getTime();\n\n return !!(\n dateValue &&\n isCompleteDateInput(newInputValue) &&\n dateInLimits(dateValue, minDate, maxDate) &&\n !offDays.includes(dateValue)\n );\n };\n\n const inputDisabled = disabled || readOnly;\n\n const inputRef = useRef<HTMLInputElement>(null);\n const inputWrapperRef = useRef<HTMLDivElement>(null);\n const calendarRef = useRef<HTMLDivElement>(null);\n\n const openCalendar = () => {\n setOpen((prev) => {\n if (!prev) onCalendarOpen?.();\n\n return true;\n });\n };\n\n const closeCalendar = () => {\n setOpen((prev) => {\n if (prev) onCalendarClose?.();\n\n return false;\n });\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if ((event.target as HTMLElement).tagName === 'INPUT' && event.key === 'Enter') {\n if (open) {\n closeCalendar();\n } else {\n openCalendar();\n }\n }\n\n if (event.key === 'Escape') {\n closeCalendar();\n }\n };\n\n const handleClick = (event: MouseEvent<HTMLDivElement>) => {\n if (!inputWrapperRef.current?.contains(event.target as HTMLElement)) return;\n\n if (!open) openCalendar();\n\n if (view === 'desktop' && inputRef.current) {\n inputRef.current.focus();\n }\n };\n\n const handleFocus = (event: FocusEvent<HTMLDivElement>) => {\n if (view === 'desktop') {\n if (!inputWrapperRef.current?.contains(event.target)) return;\n\n openCalendar();\n\n if (!open && event.target.tagName !== 'INPUT' && calendarRef.current) {\n calendarRef.current.focus();\n }\n }\n };\n\n const handleBlur = (event: FocusEvent<HTMLDivElement>) => {\n if (view === 'desktop') {\n const target = (event.relatedTarget || document.activeElement) as HTMLElement;\n\n if (\n inputRef.current !== target &&\n calendarRef.current?.contains(target) === false\n ) {\n closeCalendar();\n }\n }\n };\n\n const handleInputKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (['ArrowDown', 'ArrowUp'].includes(event.key) && calendarRef.current) {\n event.preventDefault();\n calendarRef.current.focus();\n }\n\n if (onKeyDown) onKeyDown(event);\n };\n\n const changeHandler = (\n event: ChangeEvent<HTMLInputElement> | null,\n newValue: string,\n newDate: Date,\n initiator: 'input' | 'calendar' = 'input',\n shouldChange = true,\n ) => {\n if (initiator === 'input' && event && onInputChange) {\n onInputChange(event, { value: newValue, date: newDate });\n }\n\n if (initiator === 'calendar' && onCalendarChange) {\n onCalendarChange(newDate.getTime());\n }\n\n setInputValue(newValue);\n\n if (shouldChange) {\n onChange(event, { date: newDate, value: newValue });\n }\n };\n\n const handleInputChange: DateInputProps['onChange'] = (event, payload) => {\n changeHandler(\n event,\n payload.value,\n payload.date,\n 'input',\n !payload.value || checkInputValueIsValid(payload.value),\n );\n };\n\n const handleCalendarChange: CalendarDesktopProps['onChange'] = (date?: number) => {\n if (date) {\n changeHandler(null, formatDate(date), new Date(date), 'calendar');\n }\n\n if (view === 'desktop') {\n closeCalendar();\n }\n };\n\n const handleCalendarWrapperMouseDown = (event: MouseEvent<HTMLDivElement>) => {\n // Не дает инпуту терять фокус при выборе даты\n event.preventDefault();\n };\n\n useEffect(() => {\n setOpen(defaultOpen);\n }, [defaultOpen]);\n\n useEffect(() => {\n if (typeof value !== 'undefined') {\n setInputValue(value);\n }\n }, [value]);\n\n const renderCalendar = () => (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div onMouseDown={handleCalendarWrapperMouseDown}>\n {Calendar ? (\n <Calendar\n {...calendarProps}\n responsive={calendarResponsive}\n open={open}\n onClose={closeCalendar}\n ref={calendarRef}\n defaultMonth={defaultMonth}\n value={checkInputValueIsValid(inputValue) ? calendarValue : undefined}\n onChange={handleCalendarChange}\n minDate={minDate}\n maxDate={maxDate}\n offDays={offDays}\n events={events}\n />\n ) : null}\n </div>\n );\n\n return (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div\n className={cn(styles.component, className, {\n [styles.block]: block,\n })}\n tabIndex={-1}\n onKeyDown={inputDisabled ? undefined : handleKeyDown}\n onClick={inputDisabled ? undefined : handleClick}\n onFocus={inputDisabled ? undefined : handleFocus}\n onBlur={handleBlur}\n data-test-id={dataTestId}\n >\n <DateInput\n autoComplete='off'\n {...restProps}\n ref={mergeRefs([inputRef, ref])}\n wrapperRef={mergeRefs([wrapperRef, inputWrapperRef])}\n value={inputValue}\n defaultValue={defaultValue}\n disabled={disabled}\n inputClassName={inputClassName}\n readOnly={readOnly}\n mobileMode={mobileMode === 'native' ? 'native' : 'input'}\n error={error}\n disableUserInput={disableUserInput}\n rightAddons={\n <React.Fragment>\n {rightAddons}\n {shouldRenderPopover && (\n <CalendarMIcon className={styles.calendarIcon} />\n )}\n </React.Fragment>\n }\n rightAddonsProps={{ onMouseDown: (e) => e.preventDefault() }}\n onKeyDown={handleInputKeyDown}\n onChange={handleInputChange}\n block={true}\n />\n {shouldRenderStatic && renderCalendar()}\n\n {shouldRenderPopover &&\n (view === 'desktop' ? (\n <Popover\n open={open}\n useAnchorWidth={useAnchorWidth}\n anchorElement={inputWrapperRef.current as HTMLElement}\n popperClassName={cn(styles.calendarContainer, {\n [styles.calendarResponsive]: calendarResponsive,\n })}\n className={popoverClassName}\n position={popoverPosition}\n offset={[0, 4]}\n withTransition={false}\n preventFlip={preventFlip}\n zIndex={zIndexPopover}\n >\n {renderCalendar()}\n </Popover>\n ) : (\n renderCalendar()\n ))}\n </div>\n );\n },\n);\n"],"names":["forwardRef","__rest","SUPPORTS_INPUT_TYPE_DATE","useState","parseDateString","isCompleteDateInput","dateInLimits","useRef","formatDate","useEffect","React","__assign","cn","styles","DateInput","mergeRefs","CalendarMIcon","Popover"],"mappings":";;;;;;;;;;;;;;;;;;;;;IA4Ka,aAAa,GAAGA,gBAAU,CACnC,UACI,EAoCC,EACD,GAAG,EAAA;;;AApCC,IAAA,IAAA,aAAa,EAAb,KAAK,mBAAG,KAAK,GAAA,EAAA,EACb,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,cAAc,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AE,aAAa,EAEpB,EAAA,cAAc,EAAE,CACX,KAEV,cAAc,EAAE,CACnB,CAAC,CACJ;AAEd,CAAC;;;;"}
|
|
@@ -1,93 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
:root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
3
|
-
} /* deprecated */ :root {
|
|
1
|
+
:root {
|
|
4
2
|
--color-light-neutral-300: #e7e8eb;
|
|
5
|
-
--color-light-neutral-translucent-700: rgba(4, 4, 21, 0.47);
|
|
6
|
-
} :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
7
|
-
} :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
3
|
+
--color-light-neutral-translucent-700: rgba(4, 4, 21, 0.47);
|
|
8
4
|
} :root {
|
|
9
|
-
|
|
10
|
-
/* Hard */
|
|
11
|
-
|
|
12
|
-
/* Up */
|
|
13
|
-
|
|
14
|
-
/* Hard up */
|
|
15
|
-
} :root { /* deprecated */ /* deprecated */
|
|
16
|
-
--border-radius-m: 8px; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
17
|
-
|
|
18
|
-
/* новые значения, используйте их */
|
|
5
|
+
--border-radius-m: 8px;
|
|
19
6
|
--border-radius-8: var(--border-radius-m);
|
|
20
|
-
} :root {
|
|
21
|
-
--gap-2xs: 4px;
|
|
22
|
-
|
|
23
|
-
/* новые значения, используйте их */
|
|
24
|
-
|
|
25
|
-
/* no-unit может приводить к проблемам в calc (#1559) */
|
|
26
|
-
/* stylelint-disable-next-line length-zero-no-unit */
|
|
7
|
+
} :root {
|
|
8
|
+
--gap-2xs: 4px;
|
|
27
9
|
--gap-0: 0px;
|
|
28
10
|
--gap-4: var(--gap-2xs);
|
|
29
11
|
} :root {
|
|
30
|
-
} /* @deprecated */ /* @deprecated */ /* @deprecated */ /* @deprecated */ /* @deprecated */ :root {
|
|
31
|
-
} /* сбрасывает синюю подсветку при нажатии */ :root {
|
|
32
12
|
--calendar-width: 344px;
|
|
33
|
-
|
|
34
|
-
/* Кнопки выбора месяцев и годов */
|
|
35
|
-
|
|
36
|
-
/* Шапка */
|
|
37
|
-
|
|
38
|
-
/* День */
|
|
39
|
-
|
|
40
|
-
/* today */
|
|
41
|
-
|
|
42
|
-
/* highlighted */
|
|
43
|
-
|
|
44
|
-
/* holidays */
|
|
45
|
-
|
|
46
|
-
/* range */
|
|
47
|
-
|
|
48
|
-
/* selected */
|
|
49
|
-
|
|
50
|
-
/* disabled */
|
|
51
|
-
|
|
52
|
-
/* marker */
|
|
53
13
|
} :root {
|
|
54
14
|
--calendar-input-icon-color: var(--color-light-neutral-translucent-700);
|
|
55
15
|
--calendar-input-popover-border-radius: var(--border-radius-8);
|
|
56
|
-
} .calendar-
|
|
16
|
+
} .calendar-input__component_1n9rp {
|
|
57
17
|
display: inline-block;
|
|
58
18
|
outline: none;
|
|
59
19
|
position: relative;
|
|
60
|
-
} .calendar-
|
|
20
|
+
} .calendar-input__block_1n9rp {
|
|
61
21
|
width: 100%;
|
|
62
|
-
} .calendar-
|
|
22
|
+
} .calendar-input__calendarContainer_1n9rp {
|
|
63
23
|
display: inline-block;
|
|
64
24
|
box-sizing: border-box;
|
|
65
25
|
border-radius: var(--calendar-input-popover-border-radius);
|
|
66
26
|
border: 1px solid var(--color-light-neutral-300)
|
|
67
|
-
} @media (max-width: 374px) { .calendar-
|
|
27
|
+
} @media (max-width: 374px) { .calendar-input__calendarContainer_1n9rp {
|
|
68
28
|
width: 100%;
|
|
69
29
|
min-width: 288px
|
|
70
30
|
}
|
|
71
|
-
} .calendar-
|
|
31
|
+
} .calendar-input__calendarResponsive_1n9rp {
|
|
72
32
|
width: var(--calendar-width);
|
|
73
|
-
} .calendar-
|
|
33
|
+
} .calendar-input__calendarIcon_1n9rp {
|
|
74
34
|
width: 24px;
|
|
75
35
|
height: 24px;
|
|
76
36
|
display: block;
|
|
77
37
|
color: var(--calendar-input-icon-color)
|
|
78
|
-
} .calendar-
|
|
38
|
+
} .calendar-input__calendarIcon_1n9rp:not(:only-child) {
|
|
79
39
|
margin-right: var(--gap-4);
|
|
80
|
-
} .calendar-
|
|
40
|
+
} .calendar-input__nativeInput_1n9rp {
|
|
81
41
|
opacity: 0;
|
|
82
42
|
position: absolute;
|
|
83
43
|
top: var(--gap-0);
|
|
84
44
|
left: var(--gap-0);
|
|
85
45
|
width: 100%;
|
|
86
46
|
height: 100%;
|
|
87
|
-
appearance: none;
|
|
47
|
+
-webkit-appearance: none;
|
|
48
|
+
-moz-appearance: none;
|
|
49
|
+
appearance: none;
|
|
88
50
|
z-index: 1
|
|
89
|
-
} .calendar-
|
|
51
|
+
} .calendar-input__nativeInput_1n9rp::-webkit-calendar-picker-indicator {
|
|
90
52
|
display: none;
|
|
91
|
-
} .calendar-
|
|
53
|
+
} .calendar-input__nativeInput_1n9rp::-webkit-inner-spin-button {
|
|
92
54
|
display: none;
|
|
93
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './Component';
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var Component = require('./Component.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
exports.CalendarInput =
|
|
9
|
+
exports.CalendarInput = Component.CalendarInput;
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('./index.css');
|
|
4
|
+
|
|
5
|
+
var styles = {"component":"calendar-input__component_1n9rp","block":"calendar-input__block_1n9rp","calendarContainer":"calendar-input__calendarContainer_1n9rp","calendarResponsive":"calendar-input__calendarResponsive_1n9rp","calendarIcon":"calendar-input__calendarIcon_1n9rp"};
|
|
6
|
+
|
|
7
|
+
module.exports = styles;
|
|
8
|
+
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["../../src/components/calendar-input/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n@import '../../../../calendar/src/vars.css';\n\n:root {\n --calendar-input-icon-color: var(--color-light-neutral-translucent-700);\n --calendar-input-popover-border-radius: var(--border-radius-8);\n}\n\n.component {\n display: inline-block;\n outline: none;\n position: relative;\n}\n\n.block {\n width: 100%;\n}\n\n.calendarContainer {\n display: inline-block;\n box-sizing: border-box;\n border-radius: var(--calendar-input-popover-border-radius);\n border: 1px solid var(--color-light-neutral-300);\n\n @media (max-width: 374px) {\n width: 100%;\n min-width: 288px;\n }\n}\n\n.calendarResponsive {\n width: var(--calendar-width);\n}\n\n.calendarIcon {\n width: 24px;\n height: 24px;\n display: block;\n color: var(--calendar-input-icon-color);\n\n &:not(:only-child) {\n margin-right: var(--gap-4);\n }\n}\n\n.nativeInput {\n opacity: 0;\n position: absolute;\n top: var(--gap-0);\n left: var(--gap-0);\n width: 100%;\n height: 100%;\n appearance: none;\n z-index: 1;\n\n &::-webkit-calendar-picker-indicator {\n display: none;\n }\n &::-webkit-inner-spin-button {\n display: none;\n }\n}\n"],"names":[],"mappings":";;;;AAEgB,aAAe,CAAC,WAAW,CAAC,iCAAiC,CAAC,OAAO,CAAC,6BAA6B,CAAC,mBAAmB,CAAC,yCAAyC,CAAC,oBAAoB,CAAC,0CAA0C,CAAC,cAAc,CAAC,oCAAsF,CAAC;;;;"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import { CalendarInputProps } from
|
|
4
|
-
type CalendarInputResponsiveProps = Omit<CalendarInputProps, 'view'> & {
|
|
2
|
+
import { CalendarInputProps } from './components/calendar-input/Component';
|
|
3
|
+
export declare type CalendarInputResponsiveProps = Omit<CalendarInputProps, 'view'> & {
|
|
5
4
|
/**
|
|
6
5
|
* Контрольная точка, с нее начинается desktop версия
|
|
7
6
|
* @default 1024
|
|
@@ -12,12 +11,12 @@ type CalendarInputResponsiveProps = Omit<CalendarInputProps, 'view'> & {
|
|
|
12
11
|
*/
|
|
13
12
|
client?: 'desktop' | 'mobile';
|
|
14
13
|
};
|
|
15
|
-
type CalendarInputMedia = 'desktop' | 'mobile';
|
|
14
|
+
export declare type CalendarInputMedia = 'desktop' | 'mobile';
|
|
16
15
|
/**
|
|
17
16
|
* @deprecated
|
|
18
17
|
* use UniversalDateInput instead
|
|
19
18
|
*/
|
|
20
|
-
declare const CalendarInputResponsive: React.ForwardRefExoticComponent<Omit<CalendarInputProps, "view"> & {
|
|
19
|
+
export declare const CalendarInputResponsive: React.ForwardRefExoticComponent<Omit<CalendarInputProps, "view"> & {
|
|
21
20
|
/**
|
|
22
21
|
* Контрольная точка, с нее начинается desktop версия
|
|
23
22
|
* @default 1024
|
|
@@ -26,6 +25,5 @@ declare const CalendarInputResponsive: React.ForwardRefExoticComponent<Omit<Cale
|
|
|
26
25
|
/**
|
|
27
26
|
* Версия, которая будет использоваться при серверном рендеринге
|
|
28
27
|
*/
|
|
29
|
-
client?: "
|
|
28
|
+
client?: "mobile" | "desktop" | undefined;
|
|
30
29
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
31
|
-
export { CalendarInputResponsiveProps, CalendarInputMedia, CalendarInputResponsive };
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
7
|
+
var cssm = require('@alfalab/core-components-mq/cssm');
|
|
8
|
+
var Component_desktop = require('./desktop/Component.desktop.js');
|
|
9
|
+
var Component_mobile = require('./mobile/Component.mobile.js');
|
|
10
10
|
|
|
11
11
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
12
12
|
|
|
@@ -18,8 +18,9 @@ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
|
18
18
|
*/
|
|
19
19
|
var CalendarInputResponsive = React.forwardRef(function (_a, ref) {
|
|
20
20
|
var breakpoint = _a.breakpoint, client = _a.client, restProps = tslib.__rest(_a, ["breakpoint", "client"]);
|
|
21
|
-
var isDesktop =
|
|
22
|
-
return isDesktop ? (React__default.default.createElement(
|
|
21
|
+
var isDesktop = cssm.useIsDesktop(breakpoint, client === 'desktop');
|
|
22
|
+
return isDesktop ? (React__default.default.createElement(Component_desktop.CalendarInputDesktop, tslib.__assign({}, restProps, { ref: ref }))) : (React__default.default.createElement(Component_mobile.CalendarInputMobile, tslib.__assign({}, restProps, { ref: ref })));
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
exports.CalendarInputResponsive = CalendarInputResponsive;
|
|
26
|
+
//# sourceMappingURL=Component.responsive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Component.responsive.js","sources":["../src/Component.responsive.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { DateInputProps } from '@alfalab/core-components-date-input';\nimport { useIsDesktop } from '@alfalab/core-components-mq';\n\nimport { CalendarInputProps } from './components/calendar-input/Component';\nimport { CalendarInputDesktop } from './desktop';\nimport { CalendarInputMobile } from './mobile';\n\nexport type CalendarInputResponsiveProps = Omit<CalendarInputProps, 'view'> & {\n /**\n * Контрольная точка, с нее начинается desktop версия\n * @default 1024\n */\n breakpoint?: number;\n\n /**\n * Версия, которая будет использоваться при серверном рендеринге\n */\n client?: 'desktop' | 'mobile';\n};\n\nexport type CalendarInputMedia = 'desktop' | 'mobile';\n\n/**\n * @deprecated\n * use UniversalDateInput instead\n */\nexport const CalendarInputResponsive = forwardRef<HTMLInputElement, CalendarInputResponsiveProps>(\n ({ breakpoint, client, ...restProps }, ref) => {\n const isDesktop = useIsDesktop(breakpoint, client === 'desktop');\n\n return isDesktop ? (\n <CalendarInputDesktop {...restProps} ref={ref} />\n ) : (\n <CalendarInputMobile {...restProps} ref={ref} />\n );\n },\n);\n"],"names":["forwardRef","__rest","useIsDesktop","React","CalendarInputDesktop","__assign","CalendarInputMobile"],"mappings":";;;;;;;;;;;;;;AAyBA;;;AAGG;IACU,uBAAuB,GAAGA,gBAAU,CAC7C,UAAC,EAAoC,EAAE,GAAG,EAAA;IAAvC,IAAA,UAAU,gBAAA,EAAE,MAAM,YAAA,EAAK,SAAS,GAAlCC,YAAA,CAAA,EAAA,EAAA,CAAA,YAAA,EAAA,QAAA,CAAoC,CAAF;IAC/B,IAAM,SAAS,GAAGC,iBAAY,CAAC,UAAU,EAAE,MAAM,KAAK,SAAS,CAAC;AAEhE,IAAA,OAAO,SAAS,IACZC,sBAAA,CAAA,aAAA,CAACC,sCAAoB,EAAAC,cAAA,CAAA,EAAA,EAAK,SAAS,EAAA,EAAE,GAAG,EAAE,GAAG,EAAA,CAAA,CAAI,KAEjDF,sBAAA,CAAA,aAAA,CAACG,oCAAmB,EAAAD,cAAA,CAAA,EAAA,EAAK,SAAS,EAAA,EAAE,GAAG,EAAE,GAAG,EAAA,CAAA,CAAI,CACnD;AACL,CAAC;;;;"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import { PopoverProps } from "@alfalab/core-components-popover";
|
|
8
|
-
type CalendarInputProps = Omit<DateInputProps, 'onChange' | 'mobileMode'> & {
|
|
1
|
+
import React, { ChangeEvent, ElementType, MouseEvent } from 'react';
|
|
2
|
+
import type { CalendarDesktopProps } from '@alfalab/core-components-calendar/desktop';
|
|
3
|
+
import type { CalendarMobileProps } from '@alfalab/core-components-calendar/mobile';
|
|
4
|
+
import { DateInputProps } from '@alfalab/core-components-date-input';
|
|
5
|
+
import { PopoverProps } from '@alfalab/core-components-popover';
|
|
6
|
+
export declare type CalendarInputProps = Omit<DateInputProps, 'onChange' | 'mobileMode'> & {
|
|
9
7
|
/**
|
|
10
8
|
* Дополнительный класс
|
|
11
9
|
*/
|
|
@@ -118,7 +116,7 @@ type CalendarInputProps = Omit<DateInputProps, 'onChange' | 'mobileMode'> & {
|
|
|
118
116
|
*/
|
|
119
117
|
disableUserInput?: boolean;
|
|
120
118
|
};
|
|
121
|
-
declare const CalendarInput: React.ForwardRefExoticComponent<Omit<DateInputProps, "onChange" | "mobileMode"> & {
|
|
119
|
+
export declare const CalendarInput: React.ForwardRefExoticComponent<Omit<DateInputProps, "onChange" | "mobileMode"> & {
|
|
122
120
|
/**
|
|
123
121
|
* Дополнительный класс
|
|
124
122
|
*/
|
|
@@ -143,16 +141,13 @@ declare const CalendarInput: React.ForwardRefExoticComponent<Omit<DateInputProps
|
|
|
143
141
|
onApply?: (() => void) | undefined;
|
|
144
142
|
clickableMonth?: boolean | undefined;
|
|
145
143
|
cancelButtonContent?: string | undefined;
|
|
146
|
-
/**
|
|
147
|
-
* Минимальная дата, доступная для выбора (timestamp)
|
|
148
|
-
*/
|
|
149
144
|
selectButtonContent?: string | undefined;
|
|
150
145
|
resetButtonContent?: string | undefined;
|
|
151
146
|
} & {
|
|
152
147
|
onMonthTitleClick?: ((event: React.MouseEvent<HTMLSpanElement, globalThis.MouseEvent>) => void) | undefined;
|
|
153
148
|
yearsAmount?: number | undefined;
|
|
154
149
|
scrollableContainer?: HTMLElement | undefined;
|
|
155
|
-
} & Omit<CalendarDesktopProps, ("className" | "dataTestId" | "
|
|
150
|
+
} & Omit<CalendarDesktopProps, ("className" | "dataTestId" | "defaultView" | "selectorView" | "rangeComplete" | "onMonthChange" | "onYearClick" | "onPeriodClick" | "hasHeader" | "responsive" | "showCurrentYearSelector") | ("headerClassName" | "contentClassName")> & Pick<CalendarDesktopProps, "className" | "dataTestId" | "defaultView" | "selectorView" | "rangeComplete" | "onMonthChange" | "onYearClick" | "onPeriodClick" | "hasHeader" | "responsive" | "showCurrentYearSelector"> & Pick<import("../../../../modal/src/shared").ModalHeaderProps, "hasBackButton" | "onBack"> & Record<string, unknown>) | undefined;
|
|
156
151
|
/**
|
|
157
152
|
* Значение инпута (используется и для календаря)
|
|
158
153
|
*/
|
|
@@ -197,7 +192,7 @@ declare const CalendarInput: React.ForwardRefExoticComponent<Omit<DateInputProps
|
|
|
197
192
|
/**
|
|
198
193
|
* Управление нативным режимом на мобильных устройствах
|
|
199
194
|
*/
|
|
200
|
-
mobileMode?: "input" | "
|
|
195
|
+
mobileMode?: "input" | "popover" | "native" | undefined;
|
|
201
196
|
/**
|
|
202
197
|
* Компонент календаря
|
|
203
198
|
*/
|
|
@@ -243,10 +238,9 @@ declare const CalendarInput: React.ForwardRefExoticComponent<Omit<DateInputProps
|
|
|
243
238
|
/**
|
|
244
239
|
* Отображение компонента в мобильном или десктопном виде
|
|
245
240
|
*/
|
|
246
|
-
view?: "
|
|
241
|
+
view?: "mobile" | "desktop" | undefined;
|
|
247
242
|
/**
|
|
248
243
|
* Запретить ввод с клавиатуры
|
|
249
244
|
*/
|
|
250
245
|
disableUserInput?: boolean | undefined;
|
|
251
246
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
252
|
-
export { CalendarInputProps, CalendarInput };
|