@gravity-ui/date-components 2.4.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/Calendar/Calendar.js +1 -0
- package/dist/cjs/components/CalendarView/CalendarView.js +1 -0
- package/dist/cjs/components/DateField/DateField.js +5 -3
- package/dist/cjs/components/DateField/hooks/useBaseDateFieldState.d.ts +2 -0
- package/dist/cjs/components/DateField/hooks/useBaseDateFieldState.js +1 -0
- package/dist/cjs/components/DateField/hooks/useDateFieldState.js +1 -1
- package/dist/cjs/components/DateField/utils.d.ts +1 -2
- package/dist/cjs/components/DateField/utils.js +6 -17
- package/dist/cjs/components/DatePicker/DatePicker.d.ts +5 -2
- package/dist/cjs/components/DatePicker/DatePicker.js +5 -3
- package/dist/cjs/components/DatePicker/MobileCalendar.js +1 -0
- package/dist/cjs/components/DatePicker/hooks/datePickerStateFactory.d.ts +7 -3
- package/dist/cjs/components/DatePicker/hooks/datePickerStateFactory.js +7 -6
- package/dist/cjs/components/DatePicker/hooks/useDatePickerProps.js +33 -6
- package/dist/cjs/components/HiddenInput/HiddenInput.d.ts +14 -0
- package/dist/cjs/components/HiddenInput/HiddenInput.js +37 -0
- package/dist/cjs/components/RangeCalendar/RangeCalendar.js +1 -0
- package/dist/cjs/components/RangeDateField/RangeDateField.js +6 -1
- package/dist/cjs/components/RangeDatePicker/RangeDatePicker.js +5 -1
- package/dist/cjs/components/RelativeDateField/RelativeDateField.js +5 -4
- package/dist/cjs/components/RelativeDateField/hooks/useRelativeDateFieldState.js +2 -8
- package/dist/cjs/components/RelativeDatePicker/RelativeDatePicker.js +6 -3
- package/dist/cjs/components/RelativeRangeDatePicker/RelativeRangeDatePicker.d.ts +2 -2
- package/dist/cjs/components/RelativeRangeDatePicker/RelativeRangeDatePicker.js +15 -2
- package/dist/cjs/components/RelativeRangeDatePicker/components/PickerDialog/PickerDialog.js +1 -0
- package/dist/cjs/components/RelativeRangeDatePicker/components/Presets/Presets.js +1 -0
- package/dist/cjs/components/RelativeRangeDatePicker/components/Presets/PresetsDoc.js +1 -0
- package/dist/cjs/components/RelativeRangeDatePicker/components/Zones/Zones.js +1 -0
- package/dist/cjs/components/types/datePicker.d.ts +8 -0
- package/dist/cjs/components/types/inputs.d.ts +5 -0
- package/dist/cjs/components/utils/mergeProps.js +3 -3
- package/dist/cjs/components/utils/validation/datePicker.js +2 -2
- package/dist/esm/components/Calendar/Calendar.js +1 -0
- package/dist/esm/components/CalendarView/CalendarView.js +1 -0
- package/dist/esm/components/DateField/DateField.js +5 -3
- package/dist/esm/components/DateField/hooks/useBaseDateFieldState.d.ts +2 -0
- package/dist/esm/components/DateField/hooks/useBaseDateFieldState.js +1 -0
- package/dist/esm/components/DateField/hooks/useDateFieldState.js +1 -1
- package/dist/esm/components/DateField/utils.d.ts +1 -2
- package/dist/esm/components/DateField/utils.js +5 -15
- package/dist/esm/components/DatePicker/DatePicker.d.ts +5 -2
- package/dist/esm/components/DatePicker/DatePicker.js +5 -3
- package/dist/esm/components/DatePicker/MobileCalendar.js +1 -0
- package/dist/esm/components/DatePicker/hooks/datePickerStateFactory.d.ts +7 -3
- package/dist/esm/components/DatePicker/hooks/datePickerStateFactory.js +7 -6
- package/dist/esm/components/DatePicker/hooks/useDatePickerProps.js +33 -6
- package/dist/esm/components/HiddenInput/HiddenInput.d.ts +14 -0
- package/dist/esm/components/HiddenInput/HiddenInput.js +31 -0
- package/dist/esm/components/RangeCalendar/RangeCalendar.js +1 -0
- package/dist/esm/components/RangeDateField/RangeDateField.js +7 -2
- package/dist/esm/components/RangeDatePicker/RangeDatePicker.js +5 -1
- package/dist/esm/components/RelativeDateField/RelativeDateField.js +5 -4
- package/dist/esm/components/RelativeDateField/hooks/useRelativeDateFieldState.js +3 -11
- package/dist/esm/components/RelativeDatePicker/RelativeDatePicker.js +6 -3
- package/dist/esm/components/RelativeRangeDatePicker/RelativeRangeDatePicker.d.ts +2 -2
- package/dist/esm/components/RelativeRangeDatePicker/RelativeRangeDatePicker.js +15 -2
- package/dist/esm/components/RelativeRangeDatePicker/components/PickerDialog/PickerDialog.js +1 -0
- package/dist/esm/components/RelativeRangeDatePicker/components/Presets/Presets.js +1 -0
- package/dist/esm/components/RelativeRangeDatePicker/components/Presets/PresetsDoc.js +1 -0
- package/dist/esm/components/RelativeRangeDatePicker/components/Zones/Zones.js +1 -0
- package/dist/esm/components/types/datePicker.d.ts +8 -0
- package/dist/esm/components/types/inputs.d.ts +5 -0
- package/dist/esm/components/utils/mergeProps.js +3 -3
- package/dist/esm/components/utils/validation/datePicker.js +2 -2
- package/package.json +26 -19
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
'use client';
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.RelativeRangeDatePicker = void 0;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
@@ -7,6 +8,7 @@ const react_1 = tslib_1.__importDefault(require("react"));
|
|
|
7
8
|
const icons_1 = require("@gravity-ui/icons");
|
|
8
9
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
9
10
|
const cn_1 = require("../../utils/cn");
|
|
11
|
+
const HiddenInput_1 = require("../HiddenInput/HiddenInput");
|
|
10
12
|
const getButtonSizeForInput_1 = require("../utils/getButtonSizeForInput");
|
|
11
13
|
const PickerDialog_1 = require("./components/PickerDialog/PickerDialog");
|
|
12
14
|
const useRelativeRangeDatePickerState_1 = require("./hooks/useRelativeRangeDatePickerState");
|
|
@@ -53,7 +55,7 @@ function RelativeRangeDatePicker(props) {
|
|
|
53
55
|
}), [alwaysShowAsAbsolute, format, getRangeTitle, presetTabs, state.timeZone, state.value]);
|
|
54
56
|
const validationState = props.validationState || (state.isInvalid ? 'invalid' : undefined);
|
|
55
57
|
const errorMessage = (_a = props.errorMessage) !== null && _a !== void 0 ? _a : state.errors.join('\n');
|
|
56
|
-
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ ref: anchorRef }, focusWithinProps, { className: b(null, props.className), style: props.style, children: [(0, jsx_runtime_1.jsx)(uikit_1.TextInput, { autoFocus: props.autoFocus, controlRef: inputRef, value: text, placeholder: props.placeholder, onUpdate: (v) => {
|
|
58
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ ref: anchorRef }, focusWithinProps, { className: b(null, props.className), style: props.style, children: [(0, jsx_runtime_1.jsx)(uikit_1.TextInput, { id: props.id, autoFocus: props.autoFocus, controlRef: inputRef, value: text, placeholder: props.placeholder, onUpdate: (v) => {
|
|
57
59
|
if (!props.readOnly && !v) {
|
|
58
60
|
state.setValue(null, 'default');
|
|
59
61
|
}
|
|
@@ -88,8 +90,19 @@ function RelativeRangeDatePicker(props) {
|
|
|
88
90
|
}), onClick: () => {
|
|
89
91
|
setIsActive(true);
|
|
90
92
|
setOpen(true);
|
|
91
|
-
} })) : null, (0, jsx_runtime_1.jsx)(
|
|
93
|
+
} })) : null, (0, jsx_runtime_1.jsx)(HiddenInput_1.HiddenInput, { name: props.name, form: props.form, value: state.value, toStringValue: (v) => { var _a, _b; return (_b = (_a = v === null || v === void 0 ? void 0 : v.start) === null || _a === void 0 ? void 0 : _a.type) !== null && _b !== void 0 ? _b : ''; }, disabled: props.disabled }), (0, jsx_runtime_1.jsx)(HiddenInput_1.HiddenInput, { name: props.name, form: props.form, value: state.value, toStringValue: (v) => { var _a; return getNativeValue((_a = v === null || v === void 0 ? void 0 : v.start) !== null && _a !== void 0 ? _a : null); }, disabled: props.disabled }), (0, jsx_runtime_1.jsx)(HiddenInput_1.HiddenInput, { name: props.name, form: props.form, value: state.value, toStringValue: (v) => { var _a, _b; return (_b = (_a = v === null || v === void 0 ? void 0 : v.end) === null || _a === void 0 ? void 0 : _a.type) !== null && _b !== void 0 ? _b : ''; }, disabled: props.disabled }), (0, jsx_runtime_1.jsx)(HiddenInput_1.HiddenInput, { name: props.name, form: props.form, value: state.value, toStringValue: (v) => { var _a; return getNativeValue((_a = v === null || v === void 0 ? void 0 : v.end) !== null && _a !== void 0 ? _a : null); }, disabled: props.disabled }), (0, jsx_runtime_1.jsx)(HiddenInput_1.HiddenInput, { name: props.name, form: props.form, onReset: (v) => {
|
|
94
|
+
state.setValue(v.value, v.timeZone);
|
|
95
|
+
}, value: { value: state.value, timeZone: state.timeZone }, toStringValue: (v) => v.timeZone, disabled: props.disabled }), (0, jsx_runtime_1.jsx)(PickerDialog_1.PickerDialog, { state: state, props: props, open: open, onClose: () => {
|
|
92
96
|
setOpen(false);
|
|
93
97
|
}, anchorRef: anchorRef, isMobile: isMobile, className: props.className })] })));
|
|
94
98
|
}
|
|
95
99
|
exports.RelativeRangeDatePicker = RelativeRangeDatePicker;
|
|
100
|
+
function getNativeValue(value) {
|
|
101
|
+
if (!value) {
|
|
102
|
+
return '';
|
|
103
|
+
}
|
|
104
|
+
if (value.type === 'relative') {
|
|
105
|
+
return value.value;
|
|
106
|
+
}
|
|
107
|
+
return value.value.toISOString();
|
|
108
|
+
}
|
|
@@ -17,3 +17,11 @@ export interface DateFieldBase<T = DateTime> extends ValueBase<T | null>, InputB
|
|
|
17
17
|
*/
|
|
18
18
|
timeZone?: string;
|
|
19
19
|
}
|
|
20
|
+
export interface PopupTriggerProps<Args extends unknown[] = []> {
|
|
21
|
+
/** Whether the popup is open (controlled). */
|
|
22
|
+
open?: boolean;
|
|
23
|
+
/** Whether the popup is open by default (uncontrolled). */
|
|
24
|
+
defaultOpen?: boolean;
|
|
25
|
+
/** Handler that is called when the popup's open state changes. */
|
|
26
|
+
onOpenChange?: (open: boolean, ...args: Args) => void;
|
|
27
|
+
}
|
|
@@ -29,6 +29,11 @@ export interface InputDOMProps {
|
|
|
29
29
|
* The name of the input element, used when submitting an HTML form.
|
|
30
30
|
*/
|
|
31
31
|
name?: string;
|
|
32
|
+
/**
|
|
33
|
+
* The id of a <form> in the same document. If this attribute is not set,
|
|
34
|
+
* the <input> is associated with its ancestor <form> element, if any.
|
|
35
|
+
*/
|
|
36
|
+
form?: string;
|
|
32
37
|
}
|
|
33
38
|
export interface InputBase {
|
|
34
39
|
/**
|
|
@@ -38,9 +38,9 @@ function mergeProps(...args) {
|
|
|
38
38
|
exports.mergeProps = mergeProps;
|
|
39
39
|
function chain(...fns) {
|
|
40
40
|
return (...args) => {
|
|
41
|
-
for (const
|
|
42
|
-
if (typeof
|
|
43
|
-
|
|
41
|
+
for (const fn of fns) {
|
|
42
|
+
if (typeof fn === 'function') {
|
|
43
|
+
fn(...args);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
};
|
|
@@ -9,13 +9,13 @@ function getValidationResult(value, minValue, maxValue, isDateUnavailable, timeZ
|
|
|
9
9
|
const isInvalid = rangeOverflow || rangeUnderflow || isUnavailable;
|
|
10
10
|
const errors = [];
|
|
11
11
|
if (isInvalid) {
|
|
12
|
-
if (rangeUnderflow) {
|
|
12
|
+
if (rangeUnderflow && minValue) {
|
|
13
13
|
errors.push((0, i18n_1.i18n)('Value must be {minValue} or later.', {
|
|
14
14
|
minValue: minValue.timeZone(timeZone).format(),
|
|
15
15
|
value: valueTitle,
|
|
16
16
|
}));
|
|
17
17
|
}
|
|
18
|
-
if (rangeOverflow) {
|
|
18
|
+
if (rangeOverflow && maxValue) {
|
|
19
19
|
errors.push((0, i18n_1.i18n)('Value must be {maxValue} or earlier.', {
|
|
20
20
|
maxValue: maxValue.timeZone(timeZone).format(),
|
|
21
21
|
value: valueTitle,
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { __rest } from "tslib";
|
|
2
3
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
4
|
import React from 'react';
|
|
4
5
|
import { TextInput, useFocusWithin } from '@gravity-ui/uikit';
|
|
5
6
|
import { block } from '../../utils/cn';
|
|
7
|
+
import { HiddenInput } from '../HiddenInput/HiddenInput';
|
|
6
8
|
import { useDateFieldProps } from './hooks/useDateFieldProps';
|
|
7
9
|
import { useDateFieldState } from './hooks/useDateFieldState';
|
|
8
10
|
import './DateField.css';
|
|
@@ -17,7 +19,7 @@ export function DateField(_a) {
|
|
|
17
19
|
setActive(isFocusWithin);
|
|
18
20
|
},
|
|
19
21
|
});
|
|
20
|
-
return (_jsxs("div", Object.assign({ className: b(null, className), style: props.style }, focusWithinProps, { children: [_jsx(TextInput, Object.assign({}, inputProps, { value: state.isEmpty && !isActive && props.placeholder ? '' : inputProps.value })), _jsx(
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
return (_jsxs("div", Object.assign({ className: b(null, className), style: props.style }, focusWithinProps, { children: [_jsx(TextInput, Object.assign({}, inputProps, { value: state.isEmpty && !isActive && props.placeholder ? '' : inputProps.value })), _jsx(HiddenInput, { name: props.name, value: state.value, toStringValue: (value) => { var _a; return (_a = value === null || value === void 0 ? void 0 : value.toISOString()) !== null && _a !== void 0 ? _a : ''; }, onReset: (value) => {
|
|
23
|
+
state.setDate(value);
|
|
24
|
+
}, disabled: state.disabled, form: props.form })] })));
|
|
23
25
|
}
|
|
@@ -37,6 +37,8 @@ export type DateFieldState<T = DateTime> = {
|
|
|
37
37
|
displayValue: T;
|
|
38
38
|
/** Sets the field's value. */
|
|
39
39
|
setValue: (value: T) => void;
|
|
40
|
+
/** Sets the date value. */
|
|
41
|
+
setDate: (value: T | null) => void;
|
|
40
42
|
/** Formatted value */
|
|
41
43
|
text: string;
|
|
42
44
|
/** Whether the field is read only. */
|
|
@@ -135,7 +135,7 @@ export function useDateFieldState(props) {
|
|
|
135
135
|
}).timeZone(timeZone);
|
|
136
136
|
}
|
|
137
137
|
function setValueFromString(str) {
|
|
138
|
-
const date = parseDateFromString(str,
|
|
138
|
+
const date = parseDateFromString(str, format, timeZone);
|
|
139
139
|
if (isValid(date)) {
|
|
140
140
|
handleUpdateDate(date);
|
|
141
141
|
return true;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { DateTime } from '@gravity-ui/date-utils';
|
|
2
2
|
import type { DateFieldSection, DateFieldSectionType, DateFieldSectionWithoutPosition } from './types';
|
|
3
3
|
export declare const EDITABLE_SEGMENTS: Partial<Record<DateFieldSectionType, boolean>>;
|
|
4
|
-
export declare function expandFormat(format: string): string;
|
|
5
4
|
export declare function getSectionLimits(section: DateFieldSectionWithoutPosition, date: DateTime): {
|
|
6
5
|
minValue: number;
|
|
7
6
|
maxValue: number;
|
|
@@ -9,7 +8,7 @@ export declare function getSectionLimits(section: DateFieldSectionWithoutPositio
|
|
|
9
8
|
minValue?: undefined;
|
|
10
9
|
maxValue?: undefined;
|
|
11
10
|
};
|
|
12
|
-
export declare function getSectionValue(
|
|
11
|
+
export declare function getSectionValue(section: DateFieldSectionWithoutPosition, date: DateTime): number | undefined;
|
|
13
12
|
export declare function getDurationUnitFromSectionType(type: DateFieldSectionType): "year" | "month" | "day" | "hour" | "minute" | "second" | "date";
|
|
14
13
|
export declare function addSegment(section: DateFieldSection, date: DateTime, amount: number): DateTime;
|
|
15
14
|
export declare function setSegment(section: DateFieldSection, date: DateTime, amount: number): DateTime;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { dateTime,
|
|
2
|
+
import { dateTime, expandFormat, isValid } from '@gravity-ui/date-utils';
|
|
3
3
|
import { mergeDateTime } from '../utils/dates';
|
|
4
4
|
import { i18n } from './i18n';
|
|
5
5
|
export const EDITABLE_SEGMENTS = {
|
|
@@ -12,16 +12,6 @@ export const EDITABLE_SEGMENTS = {
|
|
|
12
12
|
dayPeriod: true,
|
|
13
13
|
weekday: true,
|
|
14
14
|
};
|
|
15
|
-
export function expandFormat(format) {
|
|
16
|
-
const localeFormats = settings.getLocaleData().formats;
|
|
17
|
-
const getShortLocalizedFormatFromLongLocalizedFormat = (formatBis) => formatBis.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (_, escapeSequence, localizedFormat) => escapeSequence || localizedFormat.slice(1));
|
|
18
|
-
return format.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (_, escapeSequence, localizedFormat) => {
|
|
19
|
-
const LongLocalizedFormat = localizedFormat && localizedFormat.toUpperCase();
|
|
20
|
-
return (escapeSequence ||
|
|
21
|
-
localeFormats[localizedFormat] ||
|
|
22
|
-
getShortLocalizedFormatFromLongLocalizedFormat(localeFormats[LongLocalizedFormat]));
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
15
|
const escapedCharacters = { start: '[', end: ']' };
|
|
26
16
|
const formatTokenMap = {
|
|
27
17
|
// Year
|
|
@@ -142,13 +132,13 @@ export function getSectionLimits(section, date) {
|
|
|
142
132
|
}
|
|
143
133
|
return {};
|
|
144
134
|
}
|
|
145
|
-
export function getSectionValue(
|
|
146
|
-
const type =
|
|
135
|
+
export function getSectionValue(section, date) {
|
|
136
|
+
const type = section.type;
|
|
147
137
|
switch (type) {
|
|
148
138
|
case 'year': {
|
|
149
|
-
return isFourDigitYearFormat(
|
|
139
|
+
return isFourDigitYearFormat(section.format)
|
|
150
140
|
? date.year()
|
|
151
|
-
: Number(date.format(
|
|
141
|
+
: Number(date.format(section.format));
|
|
152
142
|
}
|
|
153
143
|
case 'month':
|
|
154
144
|
case 'hour':
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { DateTime } from '@gravity-ui/date-utils';
|
|
3
3
|
import type { CalendarProps } from '../Calendar';
|
|
4
|
-
import type { AccessibilityProps,
|
|
4
|
+
import type { AccessibilityProps, DomProps, FocusableProps, InputDOMProps, KeyboardEvents, StyleProps, TextInputProps } from '../types';
|
|
5
|
+
import type { DatePickerStateOptions } from './hooks/datePickerStateFactory';
|
|
5
6
|
import './DatePicker.css';
|
|
6
|
-
export interface DatePickerProps<T = DateTime> extends
|
|
7
|
+
export interface DatePickerProps<T = DateTime> extends DatePickerStateOptions<T>, TextInputProps, FocusableProps, KeyboardEvents, DomProps, InputDOMProps, StyleProps, AccessibilityProps {
|
|
7
8
|
children?: (props: CalendarProps<T>) => React.ReactNode;
|
|
9
|
+
disablePortal?: boolean;
|
|
10
|
+
disableFocusTrap?: boolean;
|
|
8
11
|
}
|
|
9
12
|
export declare function DatePicker({ className, ...props }: DatePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { __rest } from "tslib";
|
|
2
3
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
4
|
import React from 'react';
|
|
@@ -5,6 +6,7 @@ import { Calendar as CalendarIcon, Clock as ClockIcon } from '@gravity-ui/icons'
|
|
|
5
6
|
import { Button, Icon, Popup, TextInput, useMobile } from '@gravity-ui/uikit';
|
|
6
7
|
import { Calendar } from '../Calendar';
|
|
7
8
|
import { DateField } from '../DateField';
|
|
9
|
+
import { HiddenInput } from '../HiddenInput/HiddenInput';
|
|
8
10
|
import { MobileCalendar } from './MobileCalendar';
|
|
9
11
|
import { StubButton } from './StubButton';
|
|
10
12
|
import { useDatePickerProps } from './hooks/useDatePickerProps';
|
|
@@ -18,7 +20,7 @@ export function DatePicker(_a) {
|
|
|
18
20
|
const { groupProps, fieldProps, calendarButtonProps, popupProps, calendarProps, timeInputProps } = useDatePickerProps(state, props);
|
|
19
21
|
const isMobile = useMobile();
|
|
20
22
|
const isOnlyTime = state.hasTime && !state.hasDate;
|
|
21
|
-
return (_jsxs("div", Object.assign({ className: b(null, className) }, groupProps, { children: [isMobile ? (_jsx(MobileCalendar, { props: props, state: state })) : (!isOnlyTime && (_jsx("div", { ref: anchorRef, className: b('popup-anchor'), children: _jsx(Popup, Object.assign({ anchorRef: anchorRef }, popupProps, { children: _jsxs("div", { className: b('popup-content'), children: [typeof props.children === 'function' ? (props.children(calendarProps)) : (_jsx(Calendar, Object.assign({}, calendarProps))), state.hasTime && (_jsx("div", { className: b('time-field-wrapper'), children: _jsx(DateField, Object.assign({}, timeInputProps)) }))] }) })) }))), _jsx(TextInput, Object.assign({}, fieldProps, { className: b('field', { mobile: isMobile }), hasClear: !isMobile && fieldProps.hasClear, endContent: _jsxs(React.Fragment, { children: [!isMobile && !isOnlyTime && (_jsx(Button, Object.assign({}, calendarButtonProps, { children: _jsx(Icon, { data: CalendarIcon }) }))), !isMobile && isOnlyTime && (_jsx(StubButton, { size: calendarButtonProps.size, icon: ClockIcon })), isMobile && (_jsx(StubButton, { size: calendarButtonProps.size, icon: isOnlyTime ? ClockIcon : CalendarIcon }))] }) })), _jsx(
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
return (_jsxs("div", Object.assign({ className: b(null, className) }, groupProps, { children: [isMobile ? (_jsx(MobileCalendar, { props: props, state: state })) : (!isOnlyTime && (_jsx("div", { ref: anchorRef, className: b('popup-anchor'), children: _jsx(Popup, Object.assign({ anchorRef: anchorRef }, popupProps, { children: _jsxs("div", { className: b('popup-content'), children: [typeof props.children === 'function' ? (props.children(calendarProps)) : (_jsx(Calendar, Object.assign({}, calendarProps))), state.hasTime && (_jsx("div", { className: b('time-field-wrapper'), children: _jsx(DateField, Object.assign({}, timeInputProps)) }))] }) })) }))), _jsx(TextInput, Object.assign({}, fieldProps, { className: b('field', { mobile: isMobile }), hasClear: !isMobile && fieldProps.hasClear, endContent: _jsxs(React.Fragment, { children: [!isMobile && !isOnlyTime && (_jsx(Button, Object.assign({}, calendarButtonProps, { children: _jsx(Icon, { data: CalendarIcon }) }))), !isMobile && isOnlyTime && (_jsx(StubButton, { size: calendarButtonProps.size, icon: ClockIcon })), isMobile && (_jsx(StubButton, { size: calendarButtonProps.size, icon: isOnlyTime ? ClockIcon : CalendarIcon }))] }) })), _jsx(HiddenInput, { name: props.name, value: state.value, toStringValue: (value) => { var _a; return (_a = value === null || value === void 0 ? void 0 : value.toISOString()) !== null && _a !== void 0 ? _a : ''; }, onReset: (value) => {
|
|
24
|
+
state.setValue(value);
|
|
25
|
+
}, disabled: state.disabled, form: props.form })] })));
|
|
24
26
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DateTime } from '@gravity-ui/date-utils';
|
|
2
2
|
import type { DateFieldState } from '../../DateField';
|
|
3
|
-
import type { DateFieldBase } from '../../types';
|
|
3
|
+
import type { DateFieldBase, PopupTriggerProps } from '../../types';
|
|
4
|
+
type OpenChangeReason = 'EscapeKeyDown' | 'FocusOut' | 'ClickOutside' | 'ValueSelected' | 'TriggerButtonClick' | 'ShortcutKeyDown';
|
|
4
5
|
export interface DatePickerState<T = DateTime> {
|
|
5
6
|
/** The currently selected date. */
|
|
6
7
|
value: T | null;
|
|
@@ -36,7 +37,7 @@ export interface DatePickerState<T = DateTime> {
|
|
|
36
37
|
/** Whether the calendar popover is currently open. */
|
|
37
38
|
isOpen: boolean;
|
|
38
39
|
/** Sets whether the calendar popover is open. */
|
|
39
|
-
setOpen: (isOpen: boolean) => void;
|
|
40
|
+
setOpen: (isOpen: boolean, reason: OpenChangeReason) => void;
|
|
40
41
|
dateFieldState: DateFieldState<T>;
|
|
41
42
|
}
|
|
42
43
|
export interface DatePickerStateFactoryOptions<T, O extends DateFieldBase<T>> {
|
|
@@ -46,4 +47,7 @@ export interface DatePickerStateFactoryOptions<T, O extends DateFieldBase<T>> {
|
|
|
46
47
|
getDateTime: (date: T | null | undefined) => DateTime | undefined;
|
|
47
48
|
useDateFieldState: (props: O) => DateFieldState<T>;
|
|
48
49
|
}
|
|
49
|
-
export
|
|
50
|
+
export interface DatePickerStateOptions<T> extends DateFieldBase<T>, PopupTriggerProps<[OpenChangeReason]> {
|
|
51
|
+
}
|
|
52
|
+
export declare function datePickerStateFactory<T, O extends DatePickerStateOptions<T>>({ getPlaceholderTime, mergeDateTime, setTimezone, getDateTime, useDateFieldState, }: DatePickerStateFactoryOptions<T, O>): (props: O) => DatePickerState<T>;
|
|
53
|
+
export {};
|
|
@@ -3,10 +3,11 @@ import { useControlledState } from '@gravity-ui/uikit';
|
|
|
3
3
|
import { useDefaultTimeZone } from '../../utils/useDefaultTimeZone';
|
|
4
4
|
export function datePickerStateFactory({ getPlaceholderTime, mergeDateTime, setTimezone, getDateTime, useDateFieldState, }) {
|
|
5
5
|
return function useDatePickerState(props) {
|
|
6
|
-
var _a;
|
|
6
|
+
var _a, _b;
|
|
7
7
|
const { disabled, readOnly } = props;
|
|
8
|
-
const [isOpen,
|
|
9
|
-
const
|
|
8
|
+
const [isOpen, _setOpen] = useControlledState(props.open, (_a = props.defaultOpen) !== null && _a !== void 0 ? _a : false, props.onOpenChange);
|
|
9
|
+
const setOpen = _setOpen;
|
|
10
|
+
const [value, setValue] = useControlledState(props.value, (_b = props.defaultValue) !== null && _b !== void 0 ? _b : null, props.onUpdate);
|
|
10
11
|
const [selectedDateInner, setSelectedDate] = React.useState(null);
|
|
11
12
|
const [selectedTimeInner, setSelectedTime] = React.useState(null);
|
|
12
13
|
const inputTimeZone = useDefaultTimeZone(getDateTime(props.value) || getDateTime(props.defaultValue) || props.placeholderValue);
|
|
@@ -61,7 +62,7 @@ export function datePickerStateFactory({ getPlaceholderTime, mergeDateTime, setT
|
|
|
61
62
|
commitValue(newValue, newValue);
|
|
62
63
|
}
|
|
63
64
|
if (shouldClose) {
|
|
64
|
-
setOpen(false);
|
|
65
|
+
setOpen(false, 'ValueSelected');
|
|
65
66
|
}
|
|
66
67
|
};
|
|
67
68
|
const selectTime = (newValue) => {
|
|
@@ -104,11 +105,11 @@ export function datePickerStateFactory({ getPlaceholderTime, mergeDateTime, setT
|
|
|
104
105
|
timeFormat,
|
|
105
106
|
timeZone,
|
|
106
107
|
isOpen,
|
|
107
|
-
setOpen(newIsOpen) {
|
|
108
|
+
setOpen(newIsOpen, reason) {
|
|
108
109
|
if (!newIsOpen && !value && selectedDate && dateFieldState.hasTime) {
|
|
109
110
|
commitValue(selectedDate, selectedTime || getPlaceholderTime(props.placeholderValue, props.timeZone));
|
|
110
111
|
}
|
|
111
|
-
setOpen(newIsOpen);
|
|
112
|
+
setOpen(newIsOpen, reason);
|
|
112
113
|
},
|
|
113
114
|
dateFieldState,
|
|
114
115
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { isDateTime } from '@gravity-ui/date-utils';
|
|
3
4
|
import { useFocusWithin, useForkRef } from '@gravity-ui/uikit';
|
|
4
5
|
import { useDateFieldProps } from '../../DateField';
|
|
5
6
|
import { getButtonSizeForInput } from '../../utils/getButtonSizeForInput';
|
|
@@ -9,13 +10,31 @@ import { getDateTimeValue } from '../utils';
|
|
|
9
10
|
export function useDatePickerProps(state, _a) {
|
|
10
11
|
var { onFocus, onBlur } = _a, props = __rest(_a, ["onFocus", "onBlur"]);
|
|
11
12
|
const [isActive, setActive] = React.useState(false);
|
|
13
|
+
const [focusedDate, setFocusedDate] = React.useState(isDateTime(state.dateFieldState.displayValue)
|
|
14
|
+
? state.dateFieldState.displayValue
|
|
15
|
+
: state.dateFieldState.displayValue.start);
|
|
16
|
+
const [prevDateValue, setPrevDateValue] = React.useState(state.dateFieldState.displayValue);
|
|
17
|
+
if (isDateTime(state.dateFieldState.displayValue)) {
|
|
18
|
+
if (!state.dateFieldState.displayValue.isSame(prevDateValue, 'day')) {
|
|
19
|
+
setPrevDateValue(state.dateFieldState.displayValue);
|
|
20
|
+
setFocusedDate(state.dateFieldState.displayValue);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else if (!state.dateFieldState.displayValue.start.isSame(prevDateValue.start, 'day')) {
|
|
24
|
+
setPrevDateValue(state.dateFieldState.displayValue);
|
|
25
|
+
setFocusedDate(state.dateFieldState.displayValue.start);
|
|
26
|
+
}
|
|
27
|
+
else if (!state.dateFieldState.displayValue.end.isSame(prevDateValue.end, 'day')) {
|
|
28
|
+
setPrevDateValue(state.dateFieldState.displayValue);
|
|
29
|
+
setFocusedDate(state.dateFieldState.displayValue.end);
|
|
30
|
+
}
|
|
12
31
|
const { focusWithinProps } = useFocusWithin({
|
|
13
32
|
onFocusWithin: onFocus,
|
|
14
33
|
onBlurWithin: onBlur,
|
|
15
34
|
onFocusWithinChange(isFocusWithin) {
|
|
16
35
|
setActive(isFocusWithin);
|
|
17
36
|
if (!isFocusWithin) {
|
|
18
|
-
state.setOpen(false);
|
|
37
|
+
state.setOpen(false, 'FocusOut');
|
|
19
38
|
}
|
|
20
39
|
},
|
|
21
40
|
});
|
|
@@ -37,7 +56,7 @@ export function useDatePickerProps(state, _a) {
|
|
|
37
56
|
if (!onlyTime && e.altKey && (e.key === 'ArrowDown' || e.key === 'ArrowUp')) {
|
|
38
57
|
e.preventDefault();
|
|
39
58
|
e.stopPropagation();
|
|
40
|
-
state.setOpen(true);
|
|
59
|
+
state.setOpen(true, 'ShortcutKeyDown');
|
|
41
60
|
}
|
|
42
61
|
} }),
|
|
43
62
|
fieldProps: mergeProps(inputProps, state.dateFieldState.isEmpty && !isActive && props.placeholder
|
|
@@ -55,25 +74,31 @@ export function useDatePickerProps(state, _a) {
|
|
|
55
74
|
view: 'flat-secondary',
|
|
56
75
|
onClick: () => {
|
|
57
76
|
setActive(true);
|
|
58
|
-
state.setOpen(!state.isOpen);
|
|
77
|
+
state.setOpen(!state.isOpen, 'TriggerButtonClick');
|
|
59
78
|
},
|
|
60
79
|
},
|
|
61
80
|
popupProps: {
|
|
62
81
|
open: state.isOpen,
|
|
63
82
|
onEscapeKeyDown: () => {
|
|
64
|
-
state.setOpen(false);
|
|
83
|
+
state.setOpen(false, 'EscapeKeyDown');
|
|
65
84
|
focusInput();
|
|
66
85
|
},
|
|
67
86
|
onOutsideClick: (e) => {
|
|
68
87
|
var _a;
|
|
69
88
|
if (e.target !== calendarButtonRef.current) {
|
|
70
|
-
state.setOpen(false);
|
|
89
|
+
state.setOpen(false, 'ClickOutside');
|
|
71
90
|
}
|
|
72
91
|
if (e.target && ((_a = groupRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
|
|
73
92
|
focusInput();
|
|
74
93
|
}
|
|
75
94
|
},
|
|
76
|
-
|
|
95
|
+
onTransitionExited: () => {
|
|
96
|
+
setFocusedDate(isDateTime(state.dateFieldState.displayValue)
|
|
97
|
+
? state.dateFieldState.displayValue
|
|
98
|
+
: state.dateFieldState.displayValue.start);
|
|
99
|
+
},
|
|
100
|
+
focusTrap: !props.disableFocusTrap,
|
|
101
|
+
disablePortal: props.disablePortal,
|
|
77
102
|
},
|
|
78
103
|
calendarProps: {
|
|
79
104
|
ref: calendarRef,
|
|
@@ -92,6 +117,8 @@ export function useDatePickerProps(state, _a) {
|
|
|
92
117
|
maxValue: props.maxValue,
|
|
93
118
|
isDateUnavailable: props.isDateUnavailable,
|
|
94
119
|
timeZone: state.timeZone,
|
|
120
|
+
focusedValue: focusedDate,
|
|
121
|
+
onFocusUpdate: setFocusedDate,
|
|
95
122
|
},
|
|
96
123
|
timeInputProps: {
|
|
97
124
|
value: state.timeValue,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface HiddenInputProps<T> {
|
|
2
|
+
value: T;
|
|
3
|
+
onReset?: (value: T) => void;
|
|
4
|
+
toStringValue?: (value: T) => string;
|
|
5
|
+
name?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
form?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function HiddenInput<T>({ name, value, onReset, form, disabled, toStringValue, }: HiddenInputProps<T>): import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
+
export declare function useFormResetHandler<T>({ initialValue, onReset, }: {
|
|
11
|
+
initialValue: T;
|
|
12
|
+
onReset?: (value: T) => void;
|
|
13
|
+
}): (node: HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | null) => void;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export function HiddenInput({ name, value, onReset, form, disabled, toStringValue, }) {
|
|
4
|
+
const ref = useFormResetHandler({ initialValue: value, onReset });
|
|
5
|
+
if (!name) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
const v = toStringValue ? toStringValue(value) : `${value !== null && value !== void 0 ? value : ''}`;
|
|
9
|
+
return _jsx("input", { ref: ref, type: "hidden", name: name, value: v, disabled: disabled, form: form });
|
|
10
|
+
}
|
|
11
|
+
export function useFormResetHandler({ initialValue, onReset, }) {
|
|
12
|
+
const [formElement, setFormElement] = React.useState(null);
|
|
13
|
+
const resetValue = React.useRef(initialValue);
|
|
14
|
+
React.useEffect(() => {
|
|
15
|
+
if (!formElement || !onReset) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
const handleReset = () => {
|
|
19
|
+
onReset(resetValue.current);
|
|
20
|
+
};
|
|
21
|
+
formElement.addEventListener('reset', handleReset);
|
|
22
|
+
return () => {
|
|
23
|
+
formElement.removeEventListener('reset', handleReset);
|
|
24
|
+
};
|
|
25
|
+
}, [formElement, onReset]);
|
|
26
|
+
const ref = React.useCallback((node) => {
|
|
27
|
+
var _a;
|
|
28
|
+
setFormElement((_a = node === null || node === void 0 ? void 0 : node.form) !== null && _a !== void 0 ? _a : null);
|
|
29
|
+
}, []);
|
|
30
|
+
return ref;
|
|
31
|
+
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { __rest } from "tslib";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
4
|
import React from 'react';
|
|
4
5
|
import { TextInput, useFocusWithin } from '@gravity-ui/uikit';
|
|
5
6
|
import { block } from '../../utils/cn';
|
|
6
7
|
import { useDateFieldProps } from '../DateField/hooks/useDateFieldProps';
|
|
8
|
+
import { HiddenInput } from '../HiddenInput/HiddenInput';
|
|
7
9
|
import { useRangeDateFieldState } from './hooks/useRangeDateFieldState';
|
|
8
10
|
import './RangeDateField.css';
|
|
9
11
|
const b = block('range-date-field');
|
|
10
12
|
export function RangeDateField(_a) {
|
|
13
|
+
var _b, _c;
|
|
11
14
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
12
15
|
const state = useRangeDateFieldState(props);
|
|
13
16
|
const { inputProps } = useDateFieldProps(state, props);
|
|
@@ -17,5 +20,7 @@ export function RangeDateField(_a) {
|
|
|
17
20
|
setActive(isFocusWithin);
|
|
18
21
|
},
|
|
19
22
|
});
|
|
20
|
-
return (
|
|
23
|
+
return (_jsxs("div", Object.assign({ className: b(null, className), style: props.style }, focusWithinProps, { children: [_jsx(TextInput, Object.assign({}, inputProps, { value: state.isEmpty && !isActive && props.placeholder ? '' : inputProps.value })), _jsx(HiddenInput, { name: props.name, form: props.form, onReset: (v) => {
|
|
24
|
+
state.setDate(v);
|
|
25
|
+
}, value: (_b = state.value) !== null && _b !== void 0 ? _b : null, toStringValue: (v) => (v ? v.start.toISOString() : ''), disabled: state.disabled }), _jsx(HiddenInput, { name: props.name, form: props.form, value: (_c = state.value) !== null && _c !== void 0 ? _c : null, toStringValue: (v) => (v ? v.end.toISOString() : ''), disabled: state.disabled })] })));
|
|
21
26
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { __rest } from "tslib";
|
|
2
3
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
4
|
import React from 'react';
|
|
@@ -7,6 +8,7 @@ import { block } from '../../utils/cn';
|
|
|
7
8
|
import { RangeCalendar } from '../Calendar';
|
|
8
9
|
import { useDatePickerProps } from '../DatePicker';
|
|
9
10
|
import { StubButton } from '../DatePicker/StubButton';
|
|
11
|
+
import { HiddenInput } from '../HiddenInput/HiddenInput';
|
|
10
12
|
import { RangeDateField } from '../RangeDateField';
|
|
11
13
|
import { useRangeDatePickerState } from './hooks/useRangeDatePickerState';
|
|
12
14
|
import './RangeDatePicker.css';
|
|
@@ -17,5 +19,7 @@ export function RangeDatePicker(_a) {
|
|
|
17
19
|
const state = useRangeDatePickerState(props);
|
|
18
20
|
const { groupProps, fieldProps, calendarButtonProps, popupProps, calendarProps, timeInputProps } = useDatePickerProps(state, props);
|
|
19
21
|
const isOnlyTime = state.hasTime && !state.hasDate;
|
|
20
|
-
return (_jsxs("div", Object.assign({ className: b(null, className) }, groupProps, { children: [!isOnlyTime && (_jsx("div", { ref: anchorRef, className: b('popup-anchor'), children: _jsx(Popup, Object.assign({ anchorRef: anchorRef }, popupProps, { children: _jsxs("div", { className: b('popup-content'), children: [typeof props.children === 'function' ? (props.children(Object.assign(Object.assign({}, calendarProps), { value: state.value }))) : (_jsx(RangeCalendar, Object.assign({}, calendarProps, { value: state.value }))), state.hasTime && (_jsx("div", { className: b('time-field-wrapper'), children: _jsx(RangeDateField, Object.assign({}, timeInputProps)) }))] }) })) })), _jsx(TextInput, Object.assign({}, fieldProps, { className: b('field'), hasClear: fieldProps.hasClear, endContent: _jsxs(React.Fragment, { children: [!isOnlyTime && (_jsx(Button, Object.assign({}, calendarButtonProps, { children: _jsx(Icon, { data: CalendarIcon }) }))), isOnlyTime && (_jsx(StubButton, { size: calendarButtonProps.size, icon: ClockIcon }))] }) }))
|
|
22
|
+
return (_jsxs("div", Object.assign({ className: b(null, className) }, groupProps, { children: [!isOnlyTime && (_jsx("div", { ref: anchorRef, className: b('popup-anchor'), children: _jsx(Popup, Object.assign({ anchorRef: anchorRef }, popupProps, { children: _jsxs("div", { className: b('popup-content'), children: [typeof props.children === 'function' ? (props.children(Object.assign(Object.assign({}, calendarProps), { value: state.value }))) : (_jsx(RangeCalendar, Object.assign({}, calendarProps, { value: state.value }))), state.hasTime && (_jsx("div", { className: b('time-field-wrapper'), children: _jsx(RangeDateField, Object.assign({}, timeInputProps)) }))] }) })) })), _jsx(TextInput, Object.assign({}, fieldProps, { className: b('field'), hasClear: fieldProps.hasClear, endContent: _jsxs(React.Fragment, { children: [!isOnlyTime && (_jsx(Button, Object.assign({}, calendarButtonProps, { children: _jsx(Icon, { data: CalendarIcon }) }))), isOnlyTime && (_jsx(StubButton, { size: calendarButtonProps.size, icon: ClockIcon }))] }) })), _jsx(HiddenInput, { name: props.name, form: props.form, onReset: (v) => {
|
|
23
|
+
state.dateFieldState.setDate(v);
|
|
24
|
+
}, value: state.value, toStringValue: (v) => (v ? v.start.toISOString() : ''), disabled: state.disabled }), _jsx(HiddenInput, { name: props.name, form: props.form, value: state.value, toStringValue: (v) => (v ? v.end.toISOString() : ''), disabled: state.disabled })] })));
|
|
21
25
|
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { Popup, TextInput, useFocusWithin, useMobile } from '@gravity-ui/uikit';
|
|
4
5
|
import { block } from '../../utils/cn';
|
|
5
6
|
import { Calendar } from '../Calendar';
|
|
6
7
|
import { DateField } from '../DateField';
|
|
8
|
+
import { HiddenInput } from '../HiddenInput/HiddenInput';
|
|
7
9
|
import { useRelativeDateFieldProps } from './hooks/useRelativeDateFieldProps';
|
|
8
10
|
import { useRelativeDateFieldState } from './hooks/useRelativeDateFieldState';
|
|
9
11
|
import './RelativeDateField.css';
|
|
10
12
|
const b = block('relative-date-field');
|
|
11
13
|
export function RelativeDateField(props) {
|
|
12
|
-
var _a;
|
|
13
14
|
const state = useRelativeDateFieldState(props);
|
|
14
15
|
const { inputProps, calendarProps, timeInputProps } = useRelativeDateFieldProps(state, props);
|
|
15
16
|
const isMobile = useMobile();
|
|
@@ -27,7 +28,7 @@ export function RelativeDateField(props) {
|
|
|
27
28
|
setOpen(true);
|
|
28
29
|
}
|
|
29
30
|
(_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
30
|
-
}, onBlur: props.onBlur })), _jsx(
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
}, onBlur: props.onBlur })), _jsx(HiddenInput, { name: props.name, value: state.value, onReset: (value) => {
|
|
32
|
+
state.setValue(value);
|
|
33
|
+
}, disabled: state.disabled, form: props.form }), !isMobile && (_jsx(Popup, { anchorRef: anchorRef, open: isOpen, children: _jsxs("div", { className: b('popup-content'), children: [_jsx(Calendar, Object.assign({}, calendarProps)), props.hasTime ? (_jsx("div", { className: b('time-field-wrapper'), children: _jsx(DateField, Object.assign({ className: b('time-field') }, timeInputProps)) })) : null] }) }))] })));
|
|
33
34
|
}
|