@alfalab/core-components-date-time-input 1.1.4 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Component.d.ts +7 -7
- package/Component.js +8 -8
- package/cssm/Component.d.ts +7 -7
- package/cssm/Component.js +7 -7
- package/cssm/index.js +5 -5
- package/cssm/utils/format.js +2 -2
- package/cssm/utils/index.js +1 -1
- package/esm/Component.d.ts +7 -7
- package/esm/Component.js +7 -7
- package/esm/index.css +6 -6
- package/esm/index.js +5 -5
- package/esm/utils/format.js +1 -1
- package/esm/utils/index.js +1 -1
- package/index.css +6 -6
- package/index.js +5 -5
- package/modern/Component.d.ts +7 -7
- package/modern/Component.js +9 -9
- package/modern/index.css +6 -6
- package/modern/index.js +5 -5
- package/modern/utils/format.js +1 -1
- package/modern/utils/index.js +1 -1
- package/package.json +4 -4
- package/utils/format.js +2 -2
- package/utils/index.js +1 -1
package/Component.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ChangeEvent, ElementType } from "react";
|
|
4
|
+
import { CalendarMobileProps, CalendarProps } from "@alfalab/core-components-calendar";
|
|
4
5
|
import { InputProps } from "@alfalab/core-components-input";
|
|
5
|
-
import { CalendarProps, CalendarMobileProps } from "@alfalab/core-components-calendar";
|
|
6
6
|
import { PopoverProps } from "@alfalab/core-components-popover";
|
|
7
7
|
type DateTimeInputProps = Omit<InputProps, 'onChange'> & {
|
|
8
8
|
/**
|
|
@@ -89,7 +89,7 @@ type DateTimeInputProps = Omit<InputProps, 'onChange'> & {
|
|
|
89
89
|
*/
|
|
90
90
|
block?: boolean;
|
|
91
91
|
};
|
|
92
|
-
declare const DateTimeInput: React.ForwardRefExoticComponent<
|
|
92
|
+
declare const DateTimeInput: React.ForwardRefExoticComponent<Omit<InputProps, "onChange"> & {
|
|
93
93
|
/**
|
|
94
94
|
* Дополнительный класс
|
|
95
95
|
*/
|
|
@@ -109,21 +109,21 @@ declare const DateTimeInput: React.ForwardRefExoticComponent<Pick<InputProps, "c
|
|
|
109
109
|
/**
|
|
110
110
|
* Обработчик изменения значения
|
|
111
111
|
*/
|
|
112
|
-
onChange?: ((event:
|
|
112
|
+
onChange?: ((event: ChangeEvent<HTMLInputElement>, payload: {
|
|
113
113
|
date: Date;
|
|
114
114
|
value: string;
|
|
115
115
|
}) => void) | undefined;
|
|
116
116
|
/**
|
|
117
117
|
* Обработчик окончания ввода
|
|
118
118
|
*/
|
|
119
|
-
onComplete?: ((event:
|
|
119
|
+
onComplete?: ((event: ChangeEvent<HTMLInputElement>, payload: {
|
|
120
120
|
date: Date;
|
|
121
121
|
value: string;
|
|
122
122
|
}) => void) | undefined;
|
|
123
123
|
/**
|
|
124
124
|
* Компонент календаря
|
|
125
125
|
*/
|
|
126
|
-
Calendar?: React.
|
|
126
|
+
Calendar?: React.ElementType<CalendarProps> | undefined;
|
|
127
127
|
/**
|
|
128
128
|
* Доп. пропсы для календаря
|
|
129
129
|
*/
|
|
@@ -162,11 +162,11 @@ declare const DateTimeInput: React.ForwardRefExoticComponent<Pick<InputProps, "c
|
|
|
162
162
|
/**
|
|
163
163
|
* Позиционирование поповера с календарем
|
|
164
164
|
*/
|
|
165
|
-
popoverPosition?:
|
|
165
|
+
popoverPosition?: PopoverProps['position'];
|
|
166
166
|
/**
|
|
167
167
|
* z-index Popover
|
|
168
168
|
*/
|
|
169
|
-
zIndexPopover?:
|
|
169
|
+
zIndexPopover?: PopoverProps['zIndex'];
|
|
170
170
|
/**
|
|
171
171
|
* Запрещает поповеру менять свою позицию.
|
|
172
172
|
* Например, если места снизу недостаточно,то он все равно будет показан снизу
|
package/Component.js
CHANGED
|
@@ -3,25 +3,25 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var cn = require('classnames');
|
|
7
6
|
var mergeRefs = require('react-merge-refs');
|
|
8
|
-
var
|
|
9
|
-
var coreComponentsInput = require('@alfalab/core-components-input');
|
|
7
|
+
var cn = require('classnames');
|
|
10
8
|
var coreComponentsCalendar = require('@alfalab/core-components-calendar');
|
|
11
|
-
var coreComponentsPopover = require('@alfalab/core-components-popover');
|
|
12
9
|
var coreComponentsIconButton = require('@alfalab/core-components-icon-button');
|
|
10
|
+
var coreComponentsInput = require('@alfalab/core-components-input');
|
|
11
|
+
var coreComponentsPopover = require('@alfalab/core-components-popover');
|
|
12
|
+
var hooks = require('@alfalab/hooks');
|
|
13
13
|
var CalendarMIcon = require('@alfalab/icons-glyph/CalendarMIcon');
|
|
14
|
-
require('date-fns/parse');
|
|
15
14
|
require('date-fns/isValid');
|
|
15
|
+
require('date-fns/parse');
|
|
16
16
|
var utils_format = require('./utils/format.js');
|
|
17
17
|
|
|
18
18
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
19
19
|
|
|
20
20
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
21
|
-
var cn__default = /*#__PURE__*/_interopDefaultLegacy(cn);
|
|
22
21
|
var mergeRefs__default = /*#__PURE__*/_interopDefaultLegacy(mergeRefs);
|
|
22
|
+
var cn__default = /*#__PURE__*/_interopDefaultLegacy(cn);
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
/******************************************************************************
|
|
25
25
|
Copyright (c) Microsoft Corporation.
|
|
26
26
|
|
|
27
27
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -60,7 +60,7 @@ function __rest(s, e) {
|
|
|
60
60
|
return t;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
var styles = {"component":"date-time-
|
|
63
|
+
var styles = {"component":"date-time-input__component_7fekn","calendarContainer":"date-time-input__calendarContainer_7fekn","calendarResponsive":"date-time-input__calendarResponsive_7fekn","block":"date-time-input__block_7fekn"};
|
|
64
64
|
require('./index.css')
|
|
65
65
|
|
|
66
66
|
/* eslint-disable no-useless-escape, jsx-a11y/click-events-have-key-events */
|
package/cssm/Component.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ChangeEvent, ElementType } from "react";
|
|
4
|
+
import { CalendarMobileProps, CalendarProps } from "@alfalab/core-components-calendar";
|
|
4
5
|
import { InputProps } from "@alfalab/core-components-input";
|
|
5
|
-
import { CalendarProps, CalendarMobileProps } from "@alfalab/core-components-calendar";
|
|
6
6
|
import { PopoverProps } from "@alfalab/core-components-popover";
|
|
7
7
|
type DateTimeInputProps = Omit<InputProps, 'onChange'> & {
|
|
8
8
|
/**
|
|
@@ -89,7 +89,7 @@ type DateTimeInputProps = Omit<InputProps, 'onChange'> & {
|
|
|
89
89
|
*/
|
|
90
90
|
block?: boolean;
|
|
91
91
|
};
|
|
92
|
-
declare const DateTimeInput: React.ForwardRefExoticComponent<
|
|
92
|
+
declare const DateTimeInput: React.ForwardRefExoticComponent<Omit<InputProps, "onChange"> & {
|
|
93
93
|
/**
|
|
94
94
|
* Дополнительный класс
|
|
95
95
|
*/
|
|
@@ -109,21 +109,21 @@ declare const DateTimeInput: React.ForwardRefExoticComponent<Pick<InputProps, "c
|
|
|
109
109
|
/**
|
|
110
110
|
* Обработчик изменения значения
|
|
111
111
|
*/
|
|
112
|
-
onChange?: ((event:
|
|
112
|
+
onChange?: ((event: ChangeEvent<HTMLInputElement>, payload: {
|
|
113
113
|
date: Date;
|
|
114
114
|
value: string;
|
|
115
115
|
}) => void) | undefined;
|
|
116
116
|
/**
|
|
117
117
|
* Обработчик окончания ввода
|
|
118
118
|
*/
|
|
119
|
-
onComplete?: ((event:
|
|
119
|
+
onComplete?: ((event: ChangeEvent<HTMLInputElement>, payload: {
|
|
120
120
|
date: Date;
|
|
121
121
|
value: string;
|
|
122
122
|
}) => void) | undefined;
|
|
123
123
|
/**
|
|
124
124
|
* Компонент календаря
|
|
125
125
|
*/
|
|
126
|
-
Calendar?: React.
|
|
126
|
+
Calendar?: React.ElementType<CalendarProps> | undefined;
|
|
127
127
|
/**
|
|
128
128
|
* Доп. пропсы для календаря
|
|
129
129
|
*/
|
|
@@ -162,11 +162,11 @@ declare const DateTimeInput: React.ForwardRefExoticComponent<Pick<InputProps, "c
|
|
|
162
162
|
/**
|
|
163
163
|
* Позиционирование поповера с календарем
|
|
164
164
|
*/
|
|
165
|
-
popoverPosition?:
|
|
165
|
+
popoverPosition?: PopoverProps['position'];
|
|
166
166
|
/**
|
|
167
167
|
* z-index Popover
|
|
168
168
|
*/
|
|
169
|
-
zIndexPopover?:
|
|
169
|
+
zIndexPopover?: PopoverProps['zIndex'];
|
|
170
170
|
/**
|
|
171
171
|
* Запрещает поповеру менять свою позицию.
|
|
172
172
|
* Например, если места снизу недостаточно,то он все равно будет показан снизу
|
package/cssm/Component.js
CHANGED
|
@@ -3,27 +3,27 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var cn = require('classnames');
|
|
7
6
|
var mergeRefs = require('react-merge-refs');
|
|
8
|
-
var
|
|
9
|
-
var coreComponentsInput = require('@alfalab/core-components-input/cssm');
|
|
7
|
+
var cn = require('classnames');
|
|
10
8
|
var coreComponentsCalendar = require('@alfalab/core-components-calendar/cssm');
|
|
11
|
-
var coreComponentsPopover = require('@alfalab/core-components-popover/cssm');
|
|
12
9
|
var coreComponentsIconButton = require('@alfalab/core-components-icon-button/cssm');
|
|
10
|
+
var coreComponentsInput = require('@alfalab/core-components-input/cssm');
|
|
11
|
+
var coreComponentsPopover = require('@alfalab/core-components-popover/cssm');
|
|
12
|
+
var hooks = require('@alfalab/hooks');
|
|
13
13
|
var CalendarMIcon = require('@alfalab/icons-glyph/CalendarMIcon');
|
|
14
|
-
require('date-fns/parse');
|
|
15
14
|
require('date-fns/isValid');
|
|
15
|
+
require('date-fns/parse');
|
|
16
16
|
var utils_format = require('./utils/format.js');
|
|
17
17
|
var styles = require('./index.module.css');
|
|
18
18
|
|
|
19
19
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
20
|
|
|
21
21
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
22
|
-
var cn__default = /*#__PURE__*/_interopDefaultLegacy(cn);
|
|
23
22
|
var mergeRefs__default = /*#__PURE__*/_interopDefaultLegacy(mergeRefs);
|
|
23
|
+
var cn__default = /*#__PURE__*/_interopDefaultLegacy(cn);
|
|
24
24
|
var styles__default = /*#__PURE__*/_interopDefaultLegacy(styles);
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
/******************************************************************************
|
|
27
27
|
Copyright (c) Microsoft Corporation.
|
|
28
28
|
|
|
29
29
|
Permission to use, copy, modify, and/or distribute this software for any
|
package/cssm/index.js
CHANGED
|
@@ -4,16 +4,16 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var Component = require('./Component.js');
|
|
6
6
|
require('react');
|
|
7
|
-
require('classnames');
|
|
8
7
|
require('react-merge-refs');
|
|
9
|
-
require('
|
|
10
|
-
require('@alfalab/core-components-input/cssm');
|
|
8
|
+
require('classnames');
|
|
11
9
|
require('@alfalab/core-components-calendar/cssm');
|
|
12
|
-
require('@alfalab/core-components-popover/cssm');
|
|
13
10
|
require('@alfalab/core-components-icon-button/cssm');
|
|
11
|
+
require('@alfalab/core-components-input/cssm');
|
|
12
|
+
require('@alfalab/core-components-popover/cssm');
|
|
13
|
+
require('@alfalab/hooks');
|
|
14
14
|
require('@alfalab/icons-glyph/CalendarMIcon');
|
|
15
|
-
require('date-fns/parse');
|
|
16
15
|
require('date-fns/isValid');
|
|
16
|
+
require('date-fns/parse');
|
|
17
17
|
require('./utils/format.js');
|
|
18
18
|
require('./index.module.css');
|
|
19
19
|
|
package/cssm/utils/format.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var parse = require('date-fns/parse');
|
|
6
5
|
var dateFnsIsValid = require('date-fns/isValid');
|
|
6
|
+
var parse = require('date-fns/parse');
|
|
7
7
|
|
|
8
8
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
9
|
|
|
10
|
-
var parse__default = /*#__PURE__*/_interopDefaultLegacy(parse);
|
|
11
10
|
var dateFnsIsValid__default = /*#__PURE__*/_interopDefaultLegacy(dateFnsIsValid);
|
|
11
|
+
var parse__default = /*#__PURE__*/_interopDefaultLegacy(parse);
|
|
12
12
|
|
|
13
13
|
/* eslint-disable no-useless-escape */
|
|
14
14
|
var DATE_FORMAT = 'dd.MM.yyyy';
|
package/cssm/utils/index.js
CHANGED
package/esm/Component.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ChangeEvent, ElementType } from "react";
|
|
4
|
+
import { CalendarMobileProps, CalendarProps } from "@alfalab/core-components-calendar";
|
|
4
5
|
import { InputProps } from "@alfalab/core-components-input";
|
|
5
|
-
import { CalendarProps, CalendarMobileProps } from "@alfalab/core-components-calendar";
|
|
6
6
|
import { PopoverProps } from "@alfalab/core-components-popover";
|
|
7
7
|
type DateTimeInputProps = Omit<InputProps, 'onChange'> & {
|
|
8
8
|
/**
|
|
@@ -89,7 +89,7 @@ type DateTimeInputProps = Omit<InputProps, 'onChange'> & {
|
|
|
89
89
|
*/
|
|
90
90
|
block?: boolean;
|
|
91
91
|
};
|
|
92
|
-
declare const DateTimeInput: React.ForwardRefExoticComponent<
|
|
92
|
+
declare const DateTimeInput: React.ForwardRefExoticComponent<Omit<InputProps, "onChange"> & {
|
|
93
93
|
/**
|
|
94
94
|
* Дополнительный класс
|
|
95
95
|
*/
|
|
@@ -109,21 +109,21 @@ declare const DateTimeInput: React.ForwardRefExoticComponent<Pick<InputProps, "c
|
|
|
109
109
|
/**
|
|
110
110
|
* Обработчик изменения значения
|
|
111
111
|
*/
|
|
112
|
-
onChange?: ((event:
|
|
112
|
+
onChange?: ((event: ChangeEvent<HTMLInputElement>, payload: {
|
|
113
113
|
date: Date;
|
|
114
114
|
value: string;
|
|
115
115
|
}) => void) | undefined;
|
|
116
116
|
/**
|
|
117
117
|
* Обработчик окончания ввода
|
|
118
118
|
*/
|
|
119
|
-
onComplete?: ((event:
|
|
119
|
+
onComplete?: ((event: ChangeEvent<HTMLInputElement>, payload: {
|
|
120
120
|
date: Date;
|
|
121
121
|
value: string;
|
|
122
122
|
}) => void) | undefined;
|
|
123
123
|
/**
|
|
124
124
|
* Компонент календаря
|
|
125
125
|
*/
|
|
126
|
-
Calendar?: React.
|
|
126
|
+
Calendar?: React.ElementType<CalendarProps> | undefined;
|
|
127
127
|
/**
|
|
128
128
|
* Доп. пропсы для календаря
|
|
129
129
|
*/
|
|
@@ -162,11 +162,11 @@ declare const DateTimeInput: React.ForwardRefExoticComponent<Pick<InputProps, "c
|
|
|
162
162
|
/**
|
|
163
163
|
* Позиционирование поповера с календарем
|
|
164
164
|
*/
|
|
165
|
-
popoverPosition?:
|
|
165
|
+
popoverPosition?: PopoverProps['position'];
|
|
166
166
|
/**
|
|
167
167
|
* z-index Popover
|
|
168
168
|
*/
|
|
169
|
-
zIndexPopover?:
|
|
169
|
+
zIndexPopover?: PopoverProps['zIndex'];
|
|
170
170
|
/**
|
|
171
171
|
* Запрещает поповеру менять свою позицию.
|
|
172
172
|
* Например, если места снизу недостаточно,то он все равно будет показан снизу
|
package/esm/Component.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import React, { useRef, useState, useEffect } from 'react';
|
|
2
|
-
import cn from 'classnames';
|
|
3
2
|
import mergeRefs from 'react-merge-refs';
|
|
4
|
-
import
|
|
5
|
-
import { Input } from '@alfalab/core-components-input/esm';
|
|
3
|
+
import cn from 'classnames';
|
|
6
4
|
import { CalendarMobile, dateInLimits, Calendar } from '@alfalab/core-components-calendar/esm';
|
|
7
|
-
import { Popover } from '@alfalab/core-components-popover/esm';
|
|
8
5
|
import { IconButton } from '@alfalab/core-components-icon-button/esm';
|
|
6
|
+
import { Input } from '@alfalab/core-components-input/esm';
|
|
7
|
+
import { Popover } from '@alfalab/core-components-popover/esm';
|
|
8
|
+
import { useMedia } from '@alfalab/hooks';
|
|
9
9
|
import { CalendarMIcon } from '@alfalab/icons-glyph/CalendarMIcon';
|
|
10
|
-
import 'date-fns/parse';
|
|
11
10
|
import 'date-fns/isValid';
|
|
11
|
+
import 'date-fns/parse';
|
|
12
12
|
import { getDateWithoutTime, setTimeToDate, DATE_MASK, format, getFullDateTime, isCompleteDateInput, isValid, parseTimestampToDate } from './utils/format.js';
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
/******************************************************************************
|
|
15
15
|
Copyright (c) Microsoft Corporation.
|
|
16
16
|
|
|
17
17
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -50,7 +50,7 @@ function __rest(s, e) {
|
|
|
50
50
|
return t;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
var styles = {"component":"date-time-
|
|
53
|
+
var styles = {"component":"date-time-input__component_7fekn","calendarContainer":"date-time-input__calendarContainer_7fekn","calendarResponsive":"date-time-input__calendarResponsive_7fekn","block":"date-time-input__block_7fekn"};
|
|
54
54
|
require('./index.css')
|
|
55
55
|
|
|
56
56
|
/* eslint-disable no-useless-escape, jsx-a11y/click-events-have-key-events */
|
package/esm/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 13ecj */
|
|
2
2
|
:root {
|
|
3
3
|
|
|
4
4
|
/* Hard */
|
|
@@ -39,26 +39,26 @@
|
|
|
39
39
|
:root {
|
|
40
40
|
--calendar-popover-border-radius: 0 0 var(--border-radius-s) var(--border-radius-s);
|
|
41
41
|
}
|
|
42
|
-
.date-time-
|
|
42
|
+
.date-time-input__component_7fekn {
|
|
43
43
|
display: inline-block;
|
|
44
44
|
outline: none;
|
|
45
45
|
position: relative;
|
|
46
46
|
}
|
|
47
|
-
.date-time-
|
|
47
|
+
.date-time-input__calendarContainer_7fekn {
|
|
48
48
|
display: inline-block;
|
|
49
49
|
box-sizing: border-box;
|
|
50
50
|
border-radius: var(--calendar-popover-border-radius)
|
|
51
51
|
}
|
|
52
52
|
@media (max-width: 374px) {
|
|
53
|
-
.date-time-
|
|
53
|
+
.date-time-input__calendarContainer_7fekn {
|
|
54
54
|
width: 100%;
|
|
55
55
|
min-width: 288px
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
.date-time-
|
|
58
|
+
.date-time-input__calendarResponsive_7fekn {
|
|
59
59
|
width: var(--calendar-width);
|
|
60
60
|
padding: 0 var(--gap-m);
|
|
61
61
|
}
|
|
62
|
-
.date-time-
|
|
62
|
+
.date-time-input__block_7fekn {
|
|
63
63
|
width: 100%;
|
|
64
64
|
}
|
package/esm/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export { DateTimeInput } from './Component.js';
|
|
2
2
|
import 'react';
|
|
3
|
-
import 'classnames';
|
|
4
3
|
import 'react-merge-refs';
|
|
5
|
-
import '
|
|
6
|
-
import '@alfalab/core-components-input/esm';
|
|
4
|
+
import 'classnames';
|
|
7
5
|
import '@alfalab/core-components-calendar/esm';
|
|
8
|
-
import '@alfalab/core-components-popover/esm';
|
|
9
6
|
import '@alfalab/core-components-icon-button/esm';
|
|
7
|
+
import '@alfalab/core-components-input/esm';
|
|
8
|
+
import '@alfalab/core-components-popover/esm';
|
|
9
|
+
import '@alfalab/hooks';
|
|
10
10
|
import '@alfalab/icons-glyph/CalendarMIcon';
|
|
11
|
-
import 'date-fns/parse';
|
|
12
11
|
import 'date-fns/isValid';
|
|
12
|
+
import 'date-fns/parse';
|
|
13
13
|
import './utils/format.js';
|
package/esm/utils/format.js
CHANGED
package/esm/utils/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import 'date-fns/parse';
|
|
2
1
|
import 'date-fns/isValid';
|
|
2
|
+
import 'date-fns/parse';
|
|
3
3
|
export { DATE_FORMAT, DATE_MASK, format, getDateWithoutTime, getFullDateTime, isCompleteDateInput, isValid, isValidTimeFormat, parseDateString, parseTimestampToDate, setTimeToDate } from './format.js';
|
package/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 13ecj */
|
|
2
2
|
:root {
|
|
3
3
|
|
|
4
4
|
/* Hard */
|
|
@@ -39,26 +39,26 @@
|
|
|
39
39
|
:root {
|
|
40
40
|
--calendar-popover-border-radius: 0 0 var(--border-radius-s) var(--border-radius-s);
|
|
41
41
|
}
|
|
42
|
-
.date-time-
|
|
42
|
+
.date-time-input__component_7fekn {
|
|
43
43
|
display: inline-block;
|
|
44
44
|
outline: none;
|
|
45
45
|
position: relative;
|
|
46
46
|
}
|
|
47
|
-
.date-time-
|
|
47
|
+
.date-time-input__calendarContainer_7fekn {
|
|
48
48
|
display: inline-block;
|
|
49
49
|
box-sizing: border-box;
|
|
50
50
|
border-radius: var(--calendar-popover-border-radius)
|
|
51
51
|
}
|
|
52
52
|
@media (max-width: 374px) {
|
|
53
|
-
.date-time-
|
|
53
|
+
.date-time-input__calendarContainer_7fekn {
|
|
54
54
|
width: 100%;
|
|
55
55
|
min-width: 288px
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
.date-time-
|
|
58
|
+
.date-time-input__calendarResponsive_7fekn {
|
|
59
59
|
width: var(--calendar-width);
|
|
60
60
|
padding: 0 var(--gap-m);
|
|
61
61
|
}
|
|
62
|
-
.date-time-
|
|
62
|
+
.date-time-input__block_7fekn {
|
|
63
63
|
width: 100%;
|
|
64
64
|
}
|
package/index.js
CHANGED
|
@@ -4,16 +4,16 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var Component = require('./Component.js');
|
|
6
6
|
require('react');
|
|
7
|
-
require('classnames');
|
|
8
7
|
require('react-merge-refs');
|
|
9
|
-
require('
|
|
10
|
-
require('@alfalab/core-components-input');
|
|
8
|
+
require('classnames');
|
|
11
9
|
require('@alfalab/core-components-calendar');
|
|
12
|
-
require('@alfalab/core-components-popover');
|
|
13
10
|
require('@alfalab/core-components-icon-button');
|
|
11
|
+
require('@alfalab/core-components-input');
|
|
12
|
+
require('@alfalab/core-components-popover');
|
|
13
|
+
require('@alfalab/hooks');
|
|
14
14
|
require('@alfalab/icons-glyph/CalendarMIcon');
|
|
15
|
-
require('date-fns/parse');
|
|
16
15
|
require('date-fns/isValid');
|
|
16
|
+
require('date-fns/parse');
|
|
17
17
|
require('./utils/format.js');
|
|
18
18
|
|
|
19
19
|
|
package/modern/Component.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ChangeEvent, ElementType } from "react";
|
|
4
|
+
import { CalendarMobileProps, CalendarProps } from "@alfalab/core-components-calendar";
|
|
4
5
|
import { InputProps } from "@alfalab/core-components-input";
|
|
5
|
-
import { CalendarProps, CalendarMobileProps } from "@alfalab/core-components-calendar";
|
|
6
6
|
import { PopoverProps } from "@alfalab/core-components-popover";
|
|
7
7
|
type DateTimeInputProps = Omit<InputProps, 'onChange'> & {
|
|
8
8
|
/**
|
|
@@ -89,7 +89,7 @@ type DateTimeInputProps = Omit<InputProps, 'onChange'> & {
|
|
|
89
89
|
*/
|
|
90
90
|
block?: boolean;
|
|
91
91
|
};
|
|
92
|
-
declare const DateTimeInput: React.ForwardRefExoticComponent<
|
|
92
|
+
declare const DateTimeInput: React.ForwardRefExoticComponent<Omit<InputProps, "onChange"> & {
|
|
93
93
|
/**
|
|
94
94
|
* Дополнительный класс
|
|
95
95
|
*/
|
|
@@ -109,21 +109,21 @@ declare const DateTimeInput: React.ForwardRefExoticComponent<Pick<InputProps, "c
|
|
|
109
109
|
/**
|
|
110
110
|
* Обработчик изменения значения
|
|
111
111
|
*/
|
|
112
|
-
onChange?: ((event:
|
|
112
|
+
onChange?: ((event: ChangeEvent<HTMLInputElement>, payload: {
|
|
113
113
|
date: Date;
|
|
114
114
|
value: string;
|
|
115
115
|
}) => void) | undefined;
|
|
116
116
|
/**
|
|
117
117
|
* Обработчик окончания ввода
|
|
118
118
|
*/
|
|
119
|
-
onComplete?: ((event:
|
|
119
|
+
onComplete?: ((event: ChangeEvent<HTMLInputElement>, payload: {
|
|
120
120
|
date: Date;
|
|
121
121
|
value: string;
|
|
122
122
|
}) => void) | undefined;
|
|
123
123
|
/**
|
|
124
124
|
* Компонент календаря
|
|
125
125
|
*/
|
|
126
|
-
Calendar?: React.
|
|
126
|
+
Calendar?: React.ElementType<CalendarProps> | undefined;
|
|
127
127
|
/**
|
|
128
128
|
* Доп. пропсы для календаря
|
|
129
129
|
*/
|
|
@@ -162,11 +162,11 @@ declare const DateTimeInput: React.ForwardRefExoticComponent<Pick<InputProps, "c
|
|
|
162
162
|
/**
|
|
163
163
|
* Позиционирование поповера с календарем
|
|
164
164
|
*/
|
|
165
|
-
popoverPosition?:
|
|
165
|
+
popoverPosition?: PopoverProps['position'];
|
|
166
166
|
/**
|
|
167
167
|
* z-index Popover
|
|
168
168
|
*/
|
|
169
|
-
zIndexPopover?:
|
|
169
|
+
zIndexPopover?: PopoverProps['zIndex'];
|
|
170
170
|
/**
|
|
171
171
|
* Запрещает поповеру менять свою позицию.
|
|
172
172
|
* Например, если места снизу недостаточно,то он все равно будет показан снизу
|
package/modern/Component.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import React, { useRef, useState, useEffect } from 'react';
|
|
2
|
-
import cn from 'classnames';
|
|
3
2
|
import mergeRefs from 'react-merge-refs';
|
|
4
|
-
import
|
|
5
|
-
import { Input } from '@alfalab/core-components-input/modern';
|
|
3
|
+
import cn from 'classnames';
|
|
6
4
|
import { Calendar, CalendarMobile, dateInLimits } from '@alfalab/core-components-calendar/modern';
|
|
7
|
-
import { Popover } from '@alfalab/core-components-popover/modern';
|
|
8
5
|
import { IconButton } from '@alfalab/core-components-icon-button/modern';
|
|
6
|
+
import { Input } from '@alfalab/core-components-input/modern';
|
|
7
|
+
import { Popover } from '@alfalab/core-components-popover/modern';
|
|
8
|
+
import { useMedia } from '@alfalab/hooks';
|
|
9
9
|
import { CalendarMIcon } from '@alfalab/icons-glyph/CalendarMIcon';
|
|
10
|
-
import 'date-fns/parse';
|
|
11
10
|
import 'date-fns/isValid';
|
|
11
|
+
import 'date-fns/parse';
|
|
12
12
|
import { getDateWithoutTime, setTimeToDate, DATE_MASK, format, getFullDateTime, isCompleteDateInput, isValid, parseTimestampToDate } from './utils/format.js';
|
|
13
13
|
|
|
14
|
-
var styles = {"component":"date-time-
|
|
14
|
+
var styles = {"component":"date-time-input__component_7fekn","calendarContainer":"date-time-input__calendarContainer_7fekn","calendarResponsive":"date-time-input__calendarResponsive_7fekn","block":"date-time-input__block_7fekn"};
|
|
15
15
|
require('./index.css')
|
|
16
16
|
|
|
17
17
|
/* eslint-disable no-useless-escape, jsx-a11y/click-events-have-key-events */
|
|
@@ -113,13 +113,13 @@ const DateTimeInput = React.forwardRef(({ className, inputClassName, popoverClas
|
|
|
113
113
|
const renderCalendar = () => (
|
|
114
114
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
115
115
|
React.createElement("div", { onMouseDown: handleCalendarWrapperMouseDown },
|
|
116
|
-
React.createElement(CalendarComponent,
|
|
116
|
+
React.createElement(CalendarComponent, { ...calendarProps, responsive: calendarResponsive, open: open, onClose: handleCalendarClose, ref: calendarRef, defaultMonth: defaultMonth, value: checkInputValueIsValid(value) ? calendarValue : undefined, onChange: handleCalendarChange, minDate: minDate, maxDate: maxDate, offDays: offDays, events: events })));
|
|
117
117
|
return (React.createElement("div", { className: cn(styles.component, className, {
|
|
118
118
|
[styles.block]: block,
|
|
119
119
|
}), onClick: inputDisabled ? undefined : handleInputWrapperClick, onFocus: inputDisabled ? undefined : handleInputWrapperFocus, onBlur: handleBlur },
|
|
120
|
-
React.createElement(Input,
|
|
120
|
+
React.createElement(Input, { ...restProps, block: block, ref: mergeRefs([ref, inputRef]), value: value, onChange: handleChange, disabled: disabled, readOnly: readOnly, className: inputClassName, onClear: handleClear, error: error, rightAddons: React.createElement(React.Fragment, null,
|
|
121
121
|
rightAddons,
|
|
122
|
-
picker && (React.createElement(IconButton, { onClick: inputDisabled ? undefined : handleIconButtonClick, icon: CalendarMIcon, size: 'xxs' }))) })
|
|
122
|
+
picker && (React.createElement(IconButton, { onClick: inputDisabled ? undefined : handleIconButtonClick, icon: CalendarMIcon, size: 'xxs' }))) }),
|
|
123
123
|
picker && (React.createElement(Popover, { open: open, useAnchorWidth: useAnchorWidth, anchorElement: inputRef.current, popperClassName: cn(styles.calendarContainer, {
|
|
124
124
|
[styles.calendarResponsive]: calendarResponsive,
|
|
125
125
|
}), className: popoverClassName, position: popoverPosition, offset: [0, 8], withTransition: false, preventFlip: preventFlip, zIndex: zIndexPopover }, renderCalendar()))));
|
package/modern/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 13ecj */
|
|
2
2
|
:root {
|
|
3
3
|
|
|
4
4
|
/* Hard */
|
|
@@ -39,26 +39,26 @@
|
|
|
39
39
|
:root {
|
|
40
40
|
--calendar-popover-border-radius: 0 0 var(--border-radius-s) var(--border-radius-s);
|
|
41
41
|
}
|
|
42
|
-
.date-time-
|
|
42
|
+
.date-time-input__component_7fekn {
|
|
43
43
|
display: inline-block;
|
|
44
44
|
outline: none;
|
|
45
45
|
position: relative;
|
|
46
46
|
}
|
|
47
|
-
.date-time-
|
|
47
|
+
.date-time-input__calendarContainer_7fekn {
|
|
48
48
|
display: inline-block;
|
|
49
49
|
box-sizing: border-box;
|
|
50
50
|
border-radius: var(--calendar-popover-border-radius)
|
|
51
51
|
}
|
|
52
52
|
@media (max-width: 374px) {
|
|
53
|
-
.date-time-
|
|
53
|
+
.date-time-input__calendarContainer_7fekn {
|
|
54
54
|
width: 100%;
|
|
55
55
|
min-width: 288px
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
.date-time-
|
|
58
|
+
.date-time-input__calendarResponsive_7fekn {
|
|
59
59
|
width: var(--calendar-width);
|
|
60
60
|
padding: 0 var(--gap-m);
|
|
61
61
|
}
|
|
62
|
-
.date-time-
|
|
62
|
+
.date-time-input__block_7fekn {
|
|
63
63
|
width: 100%;
|
|
64
64
|
}
|
package/modern/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import 'react';
|
|
2
|
-
import 'classnames';
|
|
3
2
|
import 'react-merge-refs';
|
|
4
|
-
import '
|
|
5
|
-
import '@alfalab/core-components-input/modern';
|
|
3
|
+
import 'classnames';
|
|
6
4
|
import '@alfalab/core-components-calendar/modern';
|
|
7
|
-
import '@alfalab/core-components-popover/modern';
|
|
8
5
|
import '@alfalab/core-components-icon-button/modern';
|
|
6
|
+
import '@alfalab/core-components-input/modern';
|
|
7
|
+
import '@alfalab/core-components-popover/modern';
|
|
8
|
+
import '@alfalab/hooks';
|
|
9
9
|
import '@alfalab/icons-glyph/CalendarMIcon';
|
|
10
|
-
import 'date-fns/parse';
|
|
11
10
|
import 'date-fns/isValid';
|
|
11
|
+
import 'date-fns/parse';
|
|
12
12
|
import './utils/format.js';
|
|
13
13
|
export { DateTimeInput } from './Component.js';
|
package/modern/utils/format.js
CHANGED
package/modern/utils/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import 'date-fns/parse';
|
|
2
1
|
import 'date-fns/isValid';
|
|
2
|
+
import 'date-fns/parse';
|
|
3
3
|
export { DATE_FORMAT, DATE_MASK, format, getDateWithoutTime, getFullDateTime, isCompleteDateInput, isValid, isValidTimeFormat, parseDateString, parseTimestampToDate, setTimeToDate } from './format.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-date-time-input",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"react-dom": "^16.9.0 || ^17.0.1 || ^18.0.0"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@alfalab/core-components-calendar": "^6.1.
|
|
19
|
-
"@alfalab/core-components-input": "^
|
|
20
|
-
"@alfalab/core-components-icon-button": "^
|
|
18
|
+
"@alfalab/core-components-calendar": "^6.1.10",
|
|
19
|
+
"@alfalab/core-components-input": "^11.0.1",
|
|
20
|
+
"@alfalab/core-components-icon-button": "^6.0.0",
|
|
21
21
|
"@alfalab/core-components-popover": "^6.0.2",
|
|
22
22
|
"classnames": "^2.3.1"
|
|
23
23
|
}
|
package/utils/format.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var parse = require('date-fns/parse');
|
|
6
5
|
var dateFnsIsValid = require('date-fns/isValid');
|
|
6
|
+
var parse = require('date-fns/parse');
|
|
7
7
|
|
|
8
8
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
9
|
|
|
10
|
-
var parse__default = /*#__PURE__*/_interopDefaultLegacy(parse);
|
|
11
10
|
var dateFnsIsValid__default = /*#__PURE__*/_interopDefaultLegacy(dateFnsIsValid);
|
|
11
|
+
var parse__default = /*#__PURE__*/_interopDefaultLegacy(parse);
|
|
12
12
|
|
|
13
13
|
/* eslint-disable no-useless-escape */
|
|
14
14
|
var DATE_FORMAT = 'dd.MM.yyyy';
|