@superdispatch/dates 0.21.5-alpha.2 → 0.21.6
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-node/index.js +34 -33
- package/dist-node/index.js.map +1 -1
- package/dist-src/base-date-picker/BaseDatePicker.js +2 -2
- package/dist-src/calendar/Calendar.js +4 -4
- package/dist-src/calendar/CalendarQuickSelection.js +1 -1
- package/dist-src/calendar/InternalCalendarComponents.js +2 -2
- package/dist-src/date-range-field/DateRangeField.js +1 -1
- package/dist-src/time-field/TimeField.js +2 -1
- package/dist-types/index.d.ts +239 -239
- package/dist-web/index.js +6 -5
- package/dist-web/index.js.map +1 -1
- package/package.json +32 -32
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["footer", "classes", "direction", "quickSelection", "selectedDays", "disabledDays", "onDayClick", "onDayKeyDown", "onDayMouseEnter", "onDayMouseLeave", "onDayMouseDown", "onDayMouseUp", "onDayTouchEnd", "onDayTouchStart", "modifiers", "highlightedDays", "format", "initialTime", "initialMonth"];
|
|
4
|
-
import { Divider, Grid, Hidden } from '@
|
|
5
|
-
import { makeStyles } from '@
|
|
4
|
+
import { Divider, Grid, Hidden } from '@material-ui/core';
|
|
5
|
+
import { makeStyles } from '@material-ui/styles';
|
|
6
6
|
import { Color } from '@superdispatch/ui';
|
|
7
7
|
import { DateTime } from 'luxon';
|
|
8
8
|
import { forwardRef, useMemo } from 'react';
|
|
@@ -33,12 +33,12 @@ var useStyles = /*#__PURE__*/makeStyles(theme => ({
|
|
|
33
33
|
interactionDisabled: {},
|
|
34
34
|
navBar: {},
|
|
35
35
|
navButtonPrev: {
|
|
36
|
-
position: 'absolute
|
|
36
|
+
position: 'absolute',
|
|
37
37
|
top: theme.spacing(1.5),
|
|
38
38
|
left: theme.spacing(1.5)
|
|
39
39
|
},
|
|
40
40
|
navButtonNext: {
|
|
41
|
-
position: 'absolute
|
|
41
|
+
position: 'absolute',
|
|
42
42
|
top: theme.spacing(1.5),
|
|
43
43
|
right: theme.spacing(1.5)
|
|
44
44
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { IconButton, Typography } from '@material-ui/core';
|
|
2
|
+
import { ChevronLeft, ChevronRight } from '@material-ui/icons';
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
4
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
5
5
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -3,7 +3,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
3
3
|
var _excluded = ["modifiers", "onDayClick", "onDayMouseEnter"],
|
|
4
4
|
_excluded2 = ["onBlur", "onFocus", "onChange", "renderFooter", "renderQuickSelection", "value", "format", "fallback", "enableClearable", "disableCloseOnSelect", "CalendarProps"],
|
|
5
5
|
_excluded3 = ["rangeStart", "rangeFinish"];
|
|
6
|
-
import { makeStyles } from '@
|
|
6
|
+
import { makeStyles } from '@material-ui/styles';
|
|
7
7
|
import { Color } from '@superdispatch/ui';
|
|
8
8
|
import { forwardRef, useMemo, useRef, useState } from 'react';
|
|
9
9
|
import { BaseDatePicker } from "../base-date-picker/BaseDatePicker.js";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["disabled", "onChange", "value", "format"];
|
|
4
|
-
import {
|
|
4
|
+
import { TextField } from '@material-ui/core';
|
|
5
|
+
import { Autocomplete } from '@material-ui/lab';
|
|
5
6
|
import { DateTime } from 'luxon';
|
|
6
7
|
import { forwardRef, useEffect, useMemo, useState } from 'react';
|
|
7
8
|
import { useDateConfig } from "../date-config/DateConfig.js";
|
package/dist-types/index.d.ts
CHANGED
|
@@ -1,266 +1,266 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ReactNode, ReactElement, ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
3
|
-
import { GridDirection, BaseTextFieldProps, InputBaseProps } from '@
|
|
4
|
-
import { ClassNameMap } from '@
|
|
3
|
+
import { GridDirection, BaseTextFieldProps, InputBaseProps } from '@material-ui/core';
|
|
4
|
+
import { ClassNameMap } from '@material-ui/styles';
|
|
5
5
|
import { ColorVariant } from '@superdispatch/ui';
|
|
6
6
|
import { DayPickerProps } from 'react-day-picker';
|
|
7
7
|
import { DateTime, ToRelativeOptions, ToRelativeUnit } from 'luxon';
|
|
8
8
|
|
|
9
|
-
declare function setDefaultTimeZone(offset: number | 'local'): string;
|
|
10
|
-
declare function useDefaultTimeZone(offset: number | 'local'): string;
|
|
11
|
-
declare type DateFormat = 'DateISO' | 'DateTimeISO' | 'JodaISO';
|
|
12
|
-
interface DateConfig {
|
|
13
|
-
readonly format: DateFormat;
|
|
14
|
-
}
|
|
15
|
-
declare const defaultDateConfig: DateConfig;
|
|
16
|
-
declare function useDateConfig(options?: Partial<DateConfig>): DateConfig;
|
|
17
|
-
interface DateConfigProviderProps extends Partial<DateConfig> {
|
|
18
|
-
children?: ReactNode;
|
|
19
|
-
}
|
|
9
|
+
declare function setDefaultTimeZone(offset: number | 'local'): string;
|
|
10
|
+
declare function useDefaultTimeZone(offset: number | 'local'): string;
|
|
11
|
+
declare type DateFormat = 'DateISO' | 'DateTimeISO' | 'JodaISO';
|
|
12
|
+
interface DateConfig {
|
|
13
|
+
readonly format: DateFormat;
|
|
14
|
+
}
|
|
15
|
+
declare const defaultDateConfig: DateConfig;
|
|
16
|
+
declare function useDateConfig(options?: Partial<DateConfig>): DateConfig;
|
|
17
|
+
interface DateConfigProviderProps extends Partial<DateConfig> {
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
}
|
|
20
20
|
declare function DateConfigProvider({ format, children, }: DateConfigProviderProps): ReactElement;
|
|
21
21
|
|
|
22
|
-
declare type DateDisplayVariant = 'Date' | 'ShortDate' | 'Time' | 'DateTime';
|
|
23
|
-
declare type DateString = string;
|
|
24
|
-
declare type NullableDateString = null | undefined | DateString;
|
|
25
|
-
declare type PrimitiveDateInput = number | DateString;
|
|
26
|
-
declare type NullableDateInput = null | undefined | Date | DateTime | PrimitiveDateInput;
|
|
27
|
-
declare function toPrimitiveDateInput(input: NullableDateInput): PrimitiveDateInput;
|
|
28
|
-
declare function parseDate(input: NullableDateInput, { format }?: DateConfig): DateTime;
|
|
29
|
-
declare function stringifyDate(input: NullableDateInput, config?: DateConfig): string | null;
|
|
30
|
-
interface FormatDateConfig {
|
|
31
|
-
fallback?: string;
|
|
32
|
-
variant: DateDisplayVariant;
|
|
33
|
-
}
|
|
34
|
-
declare function formatDate(input: NullableDateInput, { variant, fallback }: FormatDateConfig, config?: DateConfig): string;
|
|
35
|
-
interface FormatRelativeTimeOptions extends Pick<ToRelativeOptions, 'round' | 'padding'> {
|
|
36
|
-
fallback?: string;
|
|
37
|
-
unit?: ToRelativeUnit;
|
|
38
|
-
base?: NullableDateInput;
|
|
39
|
-
}
|
|
40
|
-
declare function formatRelativeTime(input: NullableDateInput, { round, unit: unitOption, base: baseOption, padding: paddingOption, fallback, }?: FormatRelativeTimeOptions, config?: DateConfig): string;
|
|
41
|
-
interface DatePayload {
|
|
42
|
-
readonly config: DateConfig;
|
|
43
|
-
readonly dateValue: DateTime;
|
|
44
|
-
readonly stringValue: null | DateString;
|
|
45
|
-
}
|
|
46
|
-
declare function toDatePayload(input: NullableDateInput, config?: DateConfig): DatePayload;
|
|
47
|
-
declare type DateTimeRange = [null | DateTime, null | DateTime];
|
|
48
|
-
declare type DateStringRange = [null | DateString, null | DateString];
|
|
49
|
-
declare type NullableDateRangeInput = null | undefined | [NullableDateInput?, NullableDateInput?];
|
|
50
|
-
declare type PrimitiveDateRangeInput = [
|
|
51
|
-
undefined | PrimitiveDateInput,
|
|
52
|
-
undefined | PrimitiveDateInput
|
|
53
|
-
];
|
|
54
|
-
declare function toPrimitiveDateRangeInput(input: NullableDateRangeInput): PrimitiveDateRangeInput;
|
|
55
|
-
declare function parseDateRange(input: NullableDateRangeInput, config?: DateConfig): DateTimeRange;
|
|
56
|
-
declare function stringifyDateRange(input: NullableDateRangeInput, config?: DateConfig): DateStringRange;
|
|
57
|
-
interface FormatDateRangeOptions {
|
|
58
|
-
fallback?: string;
|
|
59
|
-
}
|
|
60
|
-
declare function formatDateRange(input: NullableDateRangeInput, { fallback }: FormatDateRangeOptions, config?: DateConfig): string;
|
|
61
|
-
interface DateRangePayload {
|
|
62
|
-
config: DateConfig;
|
|
63
|
-
dateValue: DateTimeRange;
|
|
64
|
-
stringValue: DateStringRange;
|
|
65
|
-
}
|
|
22
|
+
declare type DateDisplayVariant = 'Date' | 'ShortDate' | 'Time' | 'DateTime';
|
|
23
|
+
declare type DateString = string;
|
|
24
|
+
declare type NullableDateString = null | undefined | DateString;
|
|
25
|
+
declare type PrimitiveDateInput = number | DateString;
|
|
26
|
+
declare type NullableDateInput = null | undefined | Date | DateTime | PrimitiveDateInput;
|
|
27
|
+
declare function toPrimitiveDateInput(input: NullableDateInput): PrimitiveDateInput;
|
|
28
|
+
declare function parseDate(input: NullableDateInput, { format }?: DateConfig): DateTime;
|
|
29
|
+
declare function stringifyDate(input: NullableDateInput, config?: DateConfig): string | null;
|
|
30
|
+
interface FormatDateConfig {
|
|
31
|
+
fallback?: string;
|
|
32
|
+
variant: DateDisplayVariant;
|
|
33
|
+
}
|
|
34
|
+
declare function formatDate(input: NullableDateInput, { variant, fallback }: FormatDateConfig, config?: DateConfig): string;
|
|
35
|
+
interface FormatRelativeTimeOptions extends Pick<ToRelativeOptions, 'round' | 'padding'> {
|
|
36
|
+
fallback?: string;
|
|
37
|
+
unit?: ToRelativeUnit;
|
|
38
|
+
base?: NullableDateInput;
|
|
39
|
+
}
|
|
40
|
+
declare function formatRelativeTime(input: NullableDateInput, { round, unit: unitOption, base: baseOption, padding: paddingOption, fallback, }?: FormatRelativeTimeOptions, config?: DateConfig): string;
|
|
41
|
+
interface DatePayload {
|
|
42
|
+
readonly config: DateConfig;
|
|
43
|
+
readonly dateValue: DateTime;
|
|
44
|
+
readonly stringValue: null | DateString;
|
|
45
|
+
}
|
|
46
|
+
declare function toDatePayload(input: NullableDateInput, config?: DateConfig): DatePayload;
|
|
47
|
+
declare type DateTimeRange = [null | DateTime, null | DateTime];
|
|
48
|
+
declare type DateStringRange = [null | DateString, null | DateString];
|
|
49
|
+
declare type NullableDateRangeInput = null | undefined | [NullableDateInput?, NullableDateInput?];
|
|
50
|
+
declare type PrimitiveDateRangeInput = [
|
|
51
|
+
undefined | PrimitiveDateInput,
|
|
52
|
+
undefined | PrimitiveDateInput
|
|
53
|
+
];
|
|
54
|
+
declare function toPrimitiveDateRangeInput(input: NullableDateRangeInput): PrimitiveDateRangeInput;
|
|
55
|
+
declare function parseDateRange(input: NullableDateRangeInput, config?: DateConfig): DateTimeRange;
|
|
56
|
+
declare function stringifyDateRange(input: NullableDateRangeInput, config?: DateConfig): DateStringRange;
|
|
57
|
+
interface FormatDateRangeOptions {
|
|
58
|
+
fallback?: string;
|
|
59
|
+
}
|
|
60
|
+
declare function formatDateRange(input: NullableDateRangeInput, { fallback }: FormatDateRangeOptions, config?: DateConfig): string;
|
|
61
|
+
interface DateRangePayload {
|
|
62
|
+
config: DateConfig;
|
|
63
|
+
dateValue: DateTimeRange;
|
|
64
|
+
stringValue: DateStringRange;
|
|
65
|
+
}
|
|
66
66
|
declare function toDateRangePayload(input: NullableDateRangeInput, config?: DateConfig): DateRangePayload;
|
|
67
67
|
|
|
68
|
-
declare type CalendarDayHighlightColor = Exclude<ColorVariant, 'grey' | 'silver'>;
|
|
69
|
-
declare type CalendarClassNames = keyof NonNullable<DayPickerProps['classNames']> | CalendarDayHighlightColor | 'firstDayOfMonth' | 'lastDayOfMonth';
|
|
70
|
-
declare type CalendarClassNameMap = ClassNameMap<CalendarClassNames>;
|
|
71
|
-
declare type CalendarModifier = (info: DatePayload) => boolean;
|
|
72
|
-
interface CalendarDateEvent extends DatePayload {
|
|
73
|
-
disabled: boolean;
|
|
74
|
-
selected: boolean;
|
|
75
|
-
}
|
|
76
|
-
declare type CalendarDayEventHandler = (event: CalendarDateEvent) => void;
|
|
77
|
-
interface CalendarModifiers {
|
|
78
|
-
today?: CalendarModifier;
|
|
79
|
-
outside?: CalendarModifier;
|
|
80
|
-
[other: string]: undefined | CalendarModifier;
|
|
81
|
-
}
|
|
82
|
-
declare type CalendarHighlightedDays = Partial<Record<CalendarDayHighlightColor, CalendarModifier>>;
|
|
83
|
-
interface CalendarProps extends Pick<DayPickerProps, 'numberOfMonths'> {
|
|
84
|
-
direction?: GridDirection;
|
|
85
|
-
classes?: Partial<CalendarClassNameMap>;
|
|
86
|
-
footer?: ReactNode;
|
|
87
|
-
quickSelection?: ReactNode;
|
|
88
|
-
format?: DateFormat;
|
|
89
|
-
initialTime?: NullableDateInput;
|
|
90
|
-
initialMonth?: NullableDateInput;
|
|
91
|
-
modifiers?: CalendarModifiers;
|
|
92
|
-
selectedDays?: CalendarModifier;
|
|
93
|
-
disabledDays?: CalendarModifier;
|
|
94
|
-
highlightedDays?: CalendarHighlightedDays;
|
|
95
|
-
onDayClick?: CalendarDayEventHandler;
|
|
96
|
-
onDayKeyDown?: CalendarDayEventHandler;
|
|
97
|
-
onDayMouseEnter?: CalendarDayEventHandler;
|
|
98
|
-
onDayMouseLeave?: CalendarDayEventHandler;
|
|
99
|
-
onDayMouseDown?: CalendarDayEventHandler;
|
|
100
|
-
onDayMouseUp?: CalendarDayEventHandler;
|
|
101
|
-
onDayTouchEnd?: CalendarDayEventHandler;
|
|
102
|
-
onDayTouchStart?: CalendarDayEventHandler;
|
|
103
|
-
}
|
|
68
|
+
declare type CalendarDayHighlightColor = Exclude<ColorVariant, 'grey' | 'silver'>;
|
|
69
|
+
declare type CalendarClassNames = keyof NonNullable<DayPickerProps['classNames']> | CalendarDayHighlightColor | 'firstDayOfMonth' | 'lastDayOfMonth';
|
|
70
|
+
declare type CalendarClassNameMap = ClassNameMap<CalendarClassNames>;
|
|
71
|
+
declare type CalendarModifier = (info: DatePayload) => boolean;
|
|
72
|
+
interface CalendarDateEvent extends DatePayload {
|
|
73
|
+
disabled: boolean;
|
|
74
|
+
selected: boolean;
|
|
75
|
+
}
|
|
76
|
+
declare type CalendarDayEventHandler = (event: CalendarDateEvent) => void;
|
|
77
|
+
interface CalendarModifiers {
|
|
78
|
+
today?: CalendarModifier;
|
|
79
|
+
outside?: CalendarModifier;
|
|
80
|
+
[other: string]: undefined | CalendarModifier;
|
|
81
|
+
}
|
|
82
|
+
declare type CalendarHighlightedDays = Partial<Record<CalendarDayHighlightColor, CalendarModifier>>;
|
|
83
|
+
interface CalendarProps extends Pick<DayPickerProps, 'numberOfMonths'> {
|
|
84
|
+
direction?: GridDirection;
|
|
85
|
+
classes?: Partial<CalendarClassNameMap>;
|
|
86
|
+
footer?: ReactNode;
|
|
87
|
+
quickSelection?: ReactNode;
|
|
88
|
+
format?: DateFormat;
|
|
89
|
+
initialTime?: NullableDateInput;
|
|
90
|
+
initialMonth?: NullableDateInput;
|
|
91
|
+
modifiers?: CalendarModifiers;
|
|
92
|
+
selectedDays?: CalendarModifier;
|
|
93
|
+
disabledDays?: CalendarModifier;
|
|
94
|
+
highlightedDays?: CalendarHighlightedDays;
|
|
95
|
+
onDayClick?: CalendarDayEventHandler;
|
|
96
|
+
onDayKeyDown?: CalendarDayEventHandler;
|
|
97
|
+
onDayMouseEnter?: CalendarDayEventHandler;
|
|
98
|
+
onDayMouseLeave?: CalendarDayEventHandler;
|
|
99
|
+
onDayMouseDown?: CalendarDayEventHandler;
|
|
100
|
+
onDayMouseUp?: CalendarDayEventHandler;
|
|
101
|
+
onDayTouchEnd?: CalendarDayEventHandler;
|
|
102
|
+
onDayTouchStart?: CalendarDayEventHandler;
|
|
103
|
+
}
|
|
104
104
|
declare const Calendar: ForwardRefExoticComponent<CalendarProps & RefAttributes<HTMLDivElement>>;
|
|
105
105
|
|
|
106
|
-
interface CalendarQuickSelectionItemProps {
|
|
107
|
-
children?: ReactNode;
|
|
108
|
-
selected?: boolean;
|
|
109
|
-
onClick?: () => void;
|
|
110
|
-
}
|
|
111
|
-
declare const CalendarQuickSelectionItem: ForwardRefExoticComponent<CalendarQuickSelectionItemProps & RefAttributes<HTMLDivElement>>;
|
|
112
|
-
interface CalendarQuickSelectionProps {
|
|
113
|
-
children?: ReactNode;
|
|
114
|
-
}
|
|
106
|
+
interface CalendarQuickSelectionItemProps {
|
|
107
|
+
children?: ReactNode;
|
|
108
|
+
selected?: boolean;
|
|
109
|
+
onClick?: () => void;
|
|
110
|
+
}
|
|
111
|
+
declare const CalendarQuickSelectionItem: ForwardRefExoticComponent<CalendarQuickSelectionItemProps & RefAttributes<HTMLDivElement>>;
|
|
112
|
+
interface CalendarQuickSelectionProps {
|
|
113
|
+
children?: ReactNode;
|
|
114
|
+
}
|
|
115
115
|
declare const CalendarQuickSelection: ForwardRefExoticComponent<CalendarQuickSelectionProps & RefAttributes<HTMLUListElement>>;
|
|
116
116
|
|
|
117
|
-
interface DateFieldAPI extends DatePayload {
|
|
118
|
-
close: () => void;
|
|
119
|
-
change: (value: NullableDateInput) => void;
|
|
120
|
-
}
|
|
121
|
-
interface DateFieldProps extends Pick<BaseTextFieldProps, 'disabled' | 'error' | 'fullWidth' | 'helperText' | 'id' | 'label' | 'name' | 'onClick' | 'onKeyDown' | 'placeholder' | 'required'> {
|
|
122
|
-
format?: DateFormat;
|
|
123
|
-
value?: NullableDateInput;
|
|
124
|
-
onBlur?: () => void;
|
|
125
|
-
onFocus?: () => void;
|
|
126
|
-
onChange?: (event: DatePayload) => void;
|
|
127
|
-
fallback?: string;
|
|
128
|
-
variant?: DateDisplayVariant;
|
|
129
|
-
enableClearable?: boolean;
|
|
130
|
-
disableCloseOnSelect?: boolean;
|
|
131
|
-
renderFooter?: (api: DateFieldAPI) => ReactNode;
|
|
132
|
-
renderQuickSelection?: (api: DateFieldAPI) => ReactNode;
|
|
133
|
-
InputProps?: Pick<InputBaseProps, 'aria-label' | 'aria-labelledby' | 'startAdornment'>;
|
|
134
|
-
CalendarProps?: Omit<CalendarProps, 'classes' | 'footer' | 'initialMonth' | 'numberOfMonths' | 'quickSelection' | 'selectedDays'>;
|
|
135
|
-
}
|
|
117
|
+
interface DateFieldAPI extends DatePayload {
|
|
118
|
+
close: () => void;
|
|
119
|
+
change: (value: NullableDateInput) => void;
|
|
120
|
+
}
|
|
121
|
+
interface DateFieldProps extends Pick<BaseTextFieldProps, 'disabled' | 'error' | 'fullWidth' | 'helperText' | 'id' | 'label' | 'name' | 'onClick' | 'onKeyDown' | 'placeholder' | 'required'> {
|
|
122
|
+
format?: DateFormat;
|
|
123
|
+
value?: NullableDateInput;
|
|
124
|
+
onBlur?: () => void;
|
|
125
|
+
onFocus?: () => void;
|
|
126
|
+
onChange?: (event: DatePayload) => void;
|
|
127
|
+
fallback?: string;
|
|
128
|
+
variant?: DateDisplayVariant;
|
|
129
|
+
enableClearable?: boolean;
|
|
130
|
+
disableCloseOnSelect?: boolean;
|
|
131
|
+
renderFooter?: (api: DateFieldAPI) => ReactNode;
|
|
132
|
+
renderQuickSelection?: (api: DateFieldAPI) => ReactNode;
|
|
133
|
+
InputProps?: Pick<InputBaseProps, 'aria-label' | 'aria-labelledby' | 'startAdornment'>;
|
|
134
|
+
CalendarProps?: Omit<CalendarProps, 'classes' | 'footer' | 'initialMonth' | 'numberOfMonths' | 'quickSelection' | 'selectedDays'>;
|
|
135
|
+
}
|
|
136
136
|
declare const DateField: ForwardRefExoticComponent<DateFieldProps & RefAttributes<HTMLDivElement>>;
|
|
137
137
|
|
|
138
|
-
interface DateRangeFieldAPI extends DateRangePayload {
|
|
139
|
-
close: () => void;
|
|
140
|
-
change: (value: NullableDateRangeInput) => void;
|
|
141
|
-
}
|
|
142
|
-
interface DateRangeFieldProps extends Pick<BaseTextFieldProps, 'disabled' | 'error' | 'fullWidth' | 'helperText' | 'id' | 'label' | 'name' | 'required' | 'placeholder'> {
|
|
143
|
-
fallback?: string;
|
|
144
|
-
enableClearable?: boolean;
|
|
145
|
-
disableCloseOnSelect?: boolean;
|
|
146
|
-
format?: DateFormat;
|
|
147
|
-
value?: NullableDateRangeInput;
|
|
148
|
-
onBlur?: () => void;
|
|
149
|
-
onFocus?: () => void;
|
|
150
|
-
onChange?: (value: DateRangePayload) => void;
|
|
151
|
-
renderFooter?: (api: DateRangeFieldAPI) => ReactNode;
|
|
152
|
-
renderQuickSelection?: (api: DateRangeFieldAPI) => ReactNode;
|
|
153
|
-
InputProps?: Pick<InputBaseProps, 'aria-label' | 'aria-labelledby' | 'startAdornment'>;
|
|
154
|
-
CalendarProps?: Omit<CalendarProps, 'footer' | 'classes' | 'selectedDays' | 'quickSelection' | 'numberOfMonths'>;
|
|
155
|
-
}
|
|
138
|
+
interface DateRangeFieldAPI extends DateRangePayload {
|
|
139
|
+
close: () => void;
|
|
140
|
+
change: (value: NullableDateRangeInput) => void;
|
|
141
|
+
}
|
|
142
|
+
interface DateRangeFieldProps extends Pick<BaseTextFieldProps, 'disabled' | 'error' | 'fullWidth' | 'helperText' | 'id' | 'label' | 'name' | 'required' | 'placeholder'> {
|
|
143
|
+
fallback?: string;
|
|
144
|
+
enableClearable?: boolean;
|
|
145
|
+
disableCloseOnSelect?: boolean;
|
|
146
|
+
format?: DateFormat;
|
|
147
|
+
value?: NullableDateRangeInput;
|
|
148
|
+
onBlur?: () => void;
|
|
149
|
+
onFocus?: () => void;
|
|
150
|
+
onChange?: (value: DateRangePayload) => void;
|
|
151
|
+
renderFooter?: (api: DateRangeFieldAPI) => ReactNode;
|
|
152
|
+
renderQuickSelection?: (api: DateRangeFieldAPI) => ReactNode;
|
|
153
|
+
InputProps?: Pick<InputBaseProps, 'aria-label' | 'aria-labelledby' | 'startAdornment'>;
|
|
154
|
+
CalendarProps?: Omit<CalendarProps, 'footer' | 'classes' | 'selectedDays' | 'quickSelection' | 'numberOfMonths'>;
|
|
155
|
+
}
|
|
156
156
|
declare const DateRangeField: ForwardRefExoticComponent<DateRangeFieldProps & RefAttributes<HTMLDivElement>>;
|
|
157
157
|
|
|
158
|
-
/** @deprecated */
|
|
159
|
-
declare type DateUnit = 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond';
|
|
160
|
-
/** @deprecated */
|
|
161
|
-
declare type DateDurationUnit = DateUnit | 'quarter' | 'week';
|
|
162
|
-
/** @deprecated */
|
|
163
|
-
declare type DateObject = Record<DateUnit, number>;
|
|
164
|
-
/** @deprecated */
|
|
165
|
-
declare type NullableDate = null | undefined | Date;
|
|
166
|
-
/** @deprecated */
|
|
167
|
-
declare type DateLike = number | Date;
|
|
168
|
-
/** @deprecated */
|
|
169
|
-
declare type NullableDateLike = null | undefined | DateLike;
|
|
170
|
-
/** @deprecated */
|
|
171
|
-
declare type DateRange = [Date?, Date?];
|
|
172
|
-
/** @deprecated */
|
|
173
|
-
declare type DateRangeLike = [DateLike?, DateLike?];
|
|
174
|
-
/** @deprecated */
|
|
175
|
-
declare type NullableDateRange = null | undefined | [NullableDate?, NullableDate?];
|
|
176
|
-
/** @deprecated */
|
|
177
|
-
declare type NullableDateRangeLike = null | undefined | [NullableDateLike?, NullableDateLike?];
|
|
178
|
-
/** @deprecated */
|
|
179
|
-
declare function isDate(value: unknown): value is Date;
|
|
180
|
-
/** @deprecated */
|
|
181
|
-
declare function isDateLike(value: unknown): value is DateLike;
|
|
182
|
-
/** @deprecated */
|
|
183
|
-
declare function isValidDate(value: unknown): value is Date;
|
|
184
|
-
/** @deprecated */
|
|
185
|
-
declare function isDateRange(range: unknown): range is DateRange;
|
|
186
|
-
/** @deprecated */
|
|
187
|
-
declare function isDateRangeLike(range: unknown): range is DateRangeLike;
|
|
188
|
-
/** @deprecated */
|
|
189
|
-
declare function isValidDateRange(range: unknown): range is DateRange;
|
|
190
|
-
/** @deprecated */
|
|
191
|
-
declare function toDate(value: NullableDateLike): Date;
|
|
192
|
-
/** @deprecated */
|
|
193
|
-
declare function toDateRange(range: NullableDateRangeLike): DateRange;
|
|
194
|
-
/** @deprecated */
|
|
195
|
-
declare type DateFormatVariant = 'date' | 'shortDate' | 'time' | 'dateTime';
|
|
196
|
-
/** @deprecated */
|
|
197
|
-
declare type DateFormatOptions = Omit<Intl.DateTimeFormatOptions, 'timeZone' | 'timeZoneName'>;
|
|
198
|
-
/** @deprecated */
|
|
199
|
-
declare type RelativeTimeFormatStyle = 'narrow' | 'short' | 'long';
|
|
200
|
-
/** @deprecated */
|
|
201
|
-
interface RelativeTimeFormatOptions {
|
|
202
|
-
style?: RelativeTimeFormatStyle;
|
|
203
|
-
compare?: DateLike;
|
|
204
|
-
}
|
|
205
|
-
/** @deprecated */
|
|
206
|
-
declare class DateUtils {
|
|
207
|
-
/** @deprecated */
|
|
208
|
-
toObject(value: DateLike): DateObject;
|
|
209
|
-
/** @deprecated */
|
|
210
|
-
fromObject({ year, month, day, hour, minute, second, millisecond, }: Partial<DateObject>): Date;
|
|
211
|
-
/** @deprecated */
|
|
212
|
-
update(value: DateLike, values: Partial<DateObject>): Date;
|
|
213
|
-
/** @deprecated */
|
|
214
|
-
mergeDateAndTime(date: DateLike, time: DateLike): Date;
|
|
215
|
-
/** @deprecated */
|
|
216
|
-
startOf(value: DateLike, unit: DateDurationUnit): Date;
|
|
217
|
-
/** @deprecated */
|
|
218
|
-
endOf(value: DateLike, unit: DateDurationUnit): Date;
|
|
219
|
-
/** @deprecated */
|
|
220
|
-
plus(value: DateLike, values: Partial<DateObject>): Date;
|
|
221
|
-
/** @deprecated */
|
|
222
|
-
minus(value: DateLike, values: Partial<DateObject>): Date;
|
|
223
|
-
/** @deprecated */
|
|
224
|
-
isSameDate(value: NullableDateLike, compare: NullableDateLike, unit?: DateUnit): boolean;
|
|
225
|
-
/** @deprecated */
|
|
226
|
-
isSameDateRange(value: NullableDateRangeLike, compare: NullableDateRangeLike, unit?: DateUnit): boolean;
|
|
227
|
-
/** @deprecated */
|
|
228
|
-
diff(value: DateLike, compare: DateLike, unit: DateUnit): number;
|
|
229
|
-
/** @deprecated */
|
|
230
|
-
toLocaleString(value: DateLike, options?: DateFormatOptions): string;
|
|
231
|
-
/** @deprecated */
|
|
232
|
-
format(value: DateLike, variant: DateFormatVariant): string;
|
|
233
|
-
/** @deprecated */
|
|
234
|
-
formatRange(value: NullableDateRangeLike, emptyText?: string): string;
|
|
235
|
-
/** @deprecated */
|
|
236
|
-
formatRelativeTime(value: DateLike, { style, compare }?: RelativeTimeFormatOptions): string;
|
|
237
|
-
}
|
|
158
|
+
/** @deprecated */
|
|
159
|
+
declare type DateUnit = 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond';
|
|
160
|
+
/** @deprecated */
|
|
161
|
+
declare type DateDurationUnit = DateUnit | 'quarter' | 'week';
|
|
162
|
+
/** @deprecated */
|
|
163
|
+
declare type DateObject = Record<DateUnit, number>;
|
|
164
|
+
/** @deprecated */
|
|
165
|
+
declare type NullableDate = null | undefined | Date;
|
|
166
|
+
/** @deprecated */
|
|
167
|
+
declare type DateLike = number | Date;
|
|
168
|
+
/** @deprecated */
|
|
169
|
+
declare type NullableDateLike = null | undefined | DateLike;
|
|
170
|
+
/** @deprecated */
|
|
171
|
+
declare type DateRange = [Date?, Date?];
|
|
172
|
+
/** @deprecated */
|
|
173
|
+
declare type DateRangeLike = [DateLike?, DateLike?];
|
|
174
|
+
/** @deprecated */
|
|
175
|
+
declare type NullableDateRange = null | undefined | [NullableDate?, NullableDate?];
|
|
176
|
+
/** @deprecated */
|
|
177
|
+
declare type NullableDateRangeLike = null | undefined | [NullableDateLike?, NullableDateLike?];
|
|
178
|
+
/** @deprecated */
|
|
179
|
+
declare function isDate(value: unknown): value is Date;
|
|
180
|
+
/** @deprecated */
|
|
181
|
+
declare function isDateLike(value: unknown): value is DateLike;
|
|
182
|
+
/** @deprecated */
|
|
183
|
+
declare function isValidDate(value: unknown): value is Date;
|
|
184
|
+
/** @deprecated */
|
|
185
|
+
declare function isDateRange(range: unknown): range is DateRange;
|
|
186
|
+
/** @deprecated */
|
|
187
|
+
declare function isDateRangeLike(range: unknown): range is DateRangeLike;
|
|
188
|
+
/** @deprecated */
|
|
189
|
+
declare function isValidDateRange(range: unknown): range is DateRange;
|
|
190
|
+
/** @deprecated */
|
|
191
|
+
declare function toDate(value: NullableDateLike): Date;
|
|
192
|
+
/** @deprecated */
|
|
193
|
+
declare function toDateRange(range: NullableDateRangeLike): DateRange;
|
|
194
|
+
/** @deprecated */
|
|
195
|
+
declare type DateFormatVariant = 'date' | 'shortDate' | 'time' | 'dateTime';
|
|
196
|
+
/** @deprecated */
|
|
197
|
+
declare type DateFormatOptions = Omit<Intl.DateTimeFormatOptions, 'timeZone' | 'timeZoneName'>;
|
|
198
|
+
/** @deprecated */
|
|
199
|
+
declare type RelativeTimeFormatStyle = 'narrow' | 'short' | 'long';
|
|
200
|
+
/** @deprecated */
|
|
201
|
+
interface RelativeTimeFormatOptions {
|
|
202
|
+
style?: RelativeTimeFormatStyle;
|
|
203
|
+
compare?: DateLike;
|
|
204
|
+
}
|
|
205
|
+
/** @deprecated */
|
|
206
|
+
declare class DateUtils {
|
|
207
|
+
/** @deprecated */
|
|
208
|
+
toObject(value: DateLike): DateObject;
|
|
209
|
+
/** @deprecated */
|
|
210
|
+
fromObject({ year, month, day, hour, minute, second, millisecond, }: Partial<DateObject>): Date;
|
|
211
|
+
/** @deprecated */
|
|
212
|
+
update(value: DateLike, values: Partial<DateObject>): Date;
|
|
213
|
+
/** @deprecated */
|
|
214
|
+
mergeDateAndTime(date: DateLike, time: DateLike): Date;
|
|
215
|
+
/** @deprecated */
|
|
216
|
+
startOf(value: DateLike, unit: DateDurationUnit): Date;
|
|
217
|
+
/** @deprecated */
|
|
218
|
+
endOf(value: DateLike, unit: DateDurationUnit): Date;
|
|
219
|
+
/** @deprecated */
|
|
220
|
+
plus(value: DateLike, values: Partial<DateObject>): Date;
|
|
221
|
+
/** @deprecated */
|
|
222
|
+
minus(value: DateLike, values: Partial<DateObject>): Date;
|
|
223
|
+
/** @deprecated */
|
|
224
|
+
isSameDate(value: NullableDateLike, compare: NullableDateLike, unit?: DateUnit): boolean;
|
|
225
|
+
/** @deprecated */
|
|
226
|
+
isSameDateRange(value: NullableDateRangeLike, compare: NullableDateRangeLike, unit?: DateUnit): boolean;
|
|
227
|
+
/** @deprecated */
|
|
228
|
+
diff(value: DateLike, compare: DateLike, unit: DateUnit): number;
|
|
229
|
+
/** @deprecated */
|
|
230
|
+
toLocaleString(value: DateLike, options?: DateFormatOptions): string;
|
|
231
|
+
/** @deprecated */
|
|
232
|
+
format(value: DateLike, variant: DateFormatVariant): string;
|
|
233
|
+
/** @deprecated */
|
|
234
|
+
formatRange(value: NullableDateRangeLike, emptyText?: string): string;
|
|
235
|
+
/** @deprecated */
|
|
236
|
+
formatRelativeTime(value: DateLike, { style, compare }?: RelativeTimeFormatOptions): string;
|
|
237
|
+
}
|
|
238
238
|
declare function useDateUtils(): DateUtils;
|
|
239
239
|
|
|
240
|
-
interface FormattedDateConfig extends Partial<DateConfig>, FormatDateConfig {
|
|
241
|
-
}
|
|
242
|
-
declare function useFormattedDate(input: NullableDateInput, { variant, fallback, ...dateConfig }: FormattedDateConfig): string;
|
|
243
|
-
interface FormattedDateProps extends Omit<FormattedDateConfig, 'fallback'> {
|
|
244
|
-
fallback?: ReactNode;
|
|
245
|
-
date: NullableDateInput;
|
|
246
|
-
}
|
|
240
|
+
interface FormattedDateConfig extends Partial<DateConfig>, FormatDateConfig {
|
|
241
|
+
}
|
|
242
|
+
declare function useFormattedDate(input: NullableDateInput, { variant, fallback, ...dateConfig }: FormattedDateConfig): string;
|
|
243
|
+
interface FormattedDateProps extends Omit<FormattedDateConfig, 'fallback'> {
|
|
244
|
+
fallback?: ReactNode;
|
|
245
|
+
date: NullableDateInput;
|
|
246
|
+
}
|
|
247
247
|
declare function FormattedDate({ date, fallback, ...options }: FormattedDateProps): null | ReactElement;
|
|
248
248
|
|
|
249
|
-
interface FormattedRelativeTimeOptions extends Partial<DateConfig>, FormatRelativeTimeOptions {
|
|
250
|
-
}
|
|
251
|
-
declare function useFormattedRelativeTime(input: NullableDateInput, { unit, round, padding, fallback, base: baseOption, ...dateConfig }?: FormattedRelativeTimeOptions): string;
|
|
252
|
-
interface FormattedRelativeTimeProps extends Omit<FormattedRelativeTimeOptions, 'fallback'> {
|
|
253
|
-
date: NullableDateInput;
|
|
254
|
-
fallback?: ReactNode;
|
|
255
|
-
}
|
|
249
|
+
interface FormattedRelativeTimeOptions extends Partial<DateConfig>, FormatRelativeTimeOptions {
|
|
250
|
+
}
|
|
251
|
+
declare function useFormattedRelativeTime(input: NullableDateInput, { unit, round, padding, fallback, base: baseOption, ...dateConfig }?: FormattedRelativeTimeOptions): string;
|
|
252
|
+
interface FormattedRelativeTimeProps extends Omit<FormattedRelativeTimeOptions, 'fallback'> {
|
|
253
|
+
date: NullableDateInput;
|
|
254
|
+
fallback?: ReactNode;
|
|
255
|
+
}
|
|
256
256
|
declare function FormattedRelativeTime({ date, fallback, ...options }: FormattedRelativeTimeProps): null | ReactElement;
|
|
257
257
|
|
|
258
|
-
interface TimeFieldProps extends Pick<BaseTextFieldProps, 'disabled' | 'error' | 'fullWidth' | 'helperText' | 'id' | 'label' | 'name' | 'placeholder' | 'required'> {
|
|
259
|
-
format?: DateFormat;
|
|
260
|
-
value?: NullableDateInput;
|
|
261
|
-
onChange?: (value: DatePayload) => void;
|
|
262
|
-
InputProps?: Pick<InputBaseProps, 'startAdornment'>;
|
|
263
|
-
}
|
|
258
|
+
interface TimeFieldProps extends Pick<BaseTextFieldProps, 'disabled' | 'error' | 'fullWidth' | 'helperText' | 'id' | 'label' | 'name' | 'placeholder' | 'required'> {
|
|
259
|
+
format?: DateFormat;
|
|
260
|
+
value?: NullableDateInput;
|
|
261
|
+
onChange?: (value: DatePayload) => void;
|
|
262
|
+
InputProps?: Pick<InputBaseProps, 'startAdornment'>;
|
|
263
|
+
}
|
|
264
264
|
declare const TimeField: ForwardRefExoticComponent<TimeFieldProps & RefAttributes<HTMLDivElement>>;
|
|
265
265
|
|
|
266
266
|
declare function useDateTimeRange(input: NullableDateRangeInput, options?: Partial<DateConfig>): DateTimeRange;
|
package/dist-web/index.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
2
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
|
-
import { Typography, IconButton, Grid, Hidden, Divider, ListItem, List, Popover, TextField, InputAdornment, SvgIcon
|
|
4
|
-
import { makeStyles } from '@
|
|
3
|
+
import { Typography, IconButton, Grid, Hidden, Divider, ListItem, List, Popover, TextField, InputAdornment, SvgIcon } from '@material-ui/core';
|
|
4
|
+
import { makeStyles } from '@material-ui/styles';
|
|
5
5
|
import { Color, useUID, mergeRefs, renderChildren } from '@superdispatch/ui';
|
|
6
6
|
import { Settings, FixedOffsetZone, DateTime } from 'luxon';
|
|
7
7
|
import { useMemo, useContext, createContext, forwardRef, useRef, useState, useImperativeHandle, useEffect } from 'react';
|
|
8
8
|
import DayPicker from 'react-day-picker';
|
|
9
9
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
|
-
import { ChevronLeft, ChevronRight, Clear } from '@
|
|
10
|
+
import { ChevronLeft, ChevronRight, Clear } from '@material-ui/icons';
|
|
11
11
|
import { mdiCalendarMonth } from '@mdi/js';
|
|
12
12
|
import { useValueObserver } from '@superdispatch/hooks';
|
|
13
|
+
import { Autocomplete } from '@material-ui/lab';
|
|
13
14
|
|
|
14
15
|
function setDefaultTimeZone(offset) {
|
|
15
16
|
if (offset === 'local') {
|
|
@@ -394,12 +395,12 @@ var useStyles = /*#__PURE__*/makeStyles(theme => ({
|
|
|
394
395
|
interactionDisabled: {},
|
|
395
396
|
navBar: {},
|
|
396
397
|
navButtonPrev: {
|
|
397
|
-
position: 'absolute
|
|
398
|
+
position: 'absolute',
|
|
398
399
|
top: theme.spacing(1.5),
|
|
399
400
|
left: theme.spacing(1.5)
|
|
400
401
|
},
|
|
401
402
|
navButtonNext: {
|
|
402
|
-
position: 'absolute
|
|
403
|
+
position: 'absolute',
|
|
403
404
|
top: theme.spacing(1.5),
|
|
404
405
|
right: theme.spacing(1.5)
|
|
405
406
|
},
|