@zendeskgarden/react-datepickers 8.69.2 → 8.69.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/index.cjs.js +111 -2445
  2. package/dist/index.esm.js +20 -2372
  3. package/dist/typings/elements/Datepicker/Datepicker.d.ts +12 -12
  4. package/dist/typings/elements/Datepicker/components/Calendar.d.ts +18 -18
  5. package/dist/typings/elements/Datepicker/components/MonthSelector.d.ts +13 -13
  6. package/dist/typings/elements/Datepicker/utils/datepicker-reducer.d.ts +43 -43
  7. package/dist/typings/elements/Datepicker/utils/garden-placements.d.ts +21 -21
  8. package/dist/typings/elements/Datepicker/utils/useDatepickerContext.d.ts +18 -18
  9. package/dist/typings/elements/DatepickerRange/DatepickerRange.d.ts +35 -35
  10. package/dist/typings/elements/DatepickerRange/components/Calendar.d.ts +11 -11
  11. package/dist/typings/elements/DatepickerRange/components/End.d.ts +11 -11
  12. package/dist/typings/elements/DatepickerRange/components/Month.d.ts +14 -14
  13. package/dist/typings/elements/DatepickerRange/components/Start.d.ts +11 -11
  14. package/dist/typings/elements/DatepickerRange/utils/datepicker-range-reducer.d.ts +71 -71
  15. package/dist/typings/elements/DatepickerRange/utils/useDatepickerRangeContext.d.ts +33 -33
  16. package/dist/typings/index.d.ts +11 -11
  17. package/dist/typings/styled/StyledCalendar.d.ts +13 -13
  18. package/dist/typings/styled/StyledCalendarItem.d.ts +15 -15
  19. package/dist/typings/styled/StyledDatepicker.d.ts +14 -14
  20. package/dist/typings/styled/StyledDay.d.ts +16 -16
  21. package/dist/typings/styled/StyledDayLabel.d.ts +11 -11
  22. package/dist/typings/styled/StyledHeader.d.ts +11 -11
  23. package/dist/typings/styled/StyledHeaderLabel.d.ts +11 -11
  24. package/dist/typings/styled/StyledHeaderPaddle.d.ts +13 -13
  25. package/dist/typings/styled/StyledHighlight.d.ts +16 -16
  26. package/dist/typings/styled/StyledMenu.d.ts +10 -10
  27. package/dist/typings/styled/StyledMenuWrapper.d.ts +15 -15
  28. package/dist/typings/styled/StyledRangeCalendar.d.ts +9 -9
  29. package/dist/typings/styled/index.d.ts +18 -18
  30. package/dist/typings/types/index.d.ts +112 -112
  31. package/dist/typings/utils/calendar-utils.d.ts +19 -19
  32. package/package.json +3 -3
@@ -1,12 +1,12 @@
1
- /**
2
- * Copyright Zendesk, Inc.
3
- *
4
- * Use of this source code is governed under the Apache License, Version 2.0
5
- * found at http://www.apache.org/licenses/LICENSE-2.0.
6
- */
7
- import React from 'react';
8
- import { IDatepickerProps } from '../../types';
9
- /**
10
- * @extends HTMLAttributes<HTMLDivElement>
11
- */
12
- export declare const Datepicker: React.ForwardRefExoticComponent<IDatepickerProps & React.RefAttributes<HTMLDivElement>>;
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import React from 'react';
8
+ import { IDatepickerProps } from '../../types';
9
+ /**
10
+ * @extends HTMLAttributes<HTMLDivElement>
11
+ */
12
+ export declare const Datepicker: React.ForwardRefExoticComponent<IDatepickerProps & React.RefAttributes<HTMLDivElement>>;
@@ -1,18 +1,18 @@
1
- /**
2
- * Copyright Zendesk, Inc.
3
- *
4
- * Use of this source code is governed under the Apache License, Version 2.0
5
- * found at http://www.apache.org/licenses/LICENSE-2.0.
6
- */
7
- import React, { HTMLAttributes } from 'react';
8
- import { DateFnsIndex } from '../../../utils/calendar-utils';
9
- interface ICalendarProps extends HTMLAttributes<HTMLDivElement> {
10
- value?: Date;
11
- minValue?: Date;
12
- maxValue?: Date;
13
- isCompact?: boolean;
14
- locale?: string;
15
- weekStartsOn?: DateFnsIndex;
16
- }
17
- export declare const Calendar: React.ForwardRefExoticComponent<ICalendarProps & React.RefAttributes<HTMLDivElement>>;
18
- export {};
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import React, { HTMLAttributes } from 'react';
8
+ import { DateFnsIndex } from '../../../utils/calendar-utils';
9
+ interface ICalendarProps extends HTMLAttributes<HTMLDivElement> {
10
+ value?: Date;
11
+ minValue?: Date;
12
+ maxValue?: Date;
13
+ isCompact?: boolean;
14
+ locale?: string;
15
+ weekStartsOn?: DateFnsIndex;
16
+ }
17
+ export declare const Calendar: React.ForwardRefExoticComponent<ICalendarProps & React.RefAttributes<HTMLDivElement>>;
18
+ export {};
@@ -1,13 +1,13 @@
1
- /**
2
- * Copyright Zendesk, Inc.
3
- *
4
- * Use of this source code is governed under the Apache License, Version 2.0
5
- * found at http://www.apache.org/licenses/LICENSE-2.0.
6
- */
7
- import React from 'react';
8
- interface IMonthSelectorProps {
9
- locale?: string;
10
- isCompact: boolean;
11
- }
12
- export declare const MonthSelector: React.FunctionComponent<IMonthSelectorProps>;
13
- export {};
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import React from 'react';
8
+ interface IMonthSelectorProps {
9
+ locale?: string;
10
+ isCompact: boolean;
11
+ }
12
+ export declare const MonthSelector: React.FunctionComponent<IMonthSelectorProps>;
13
+ export {};
@@ -1,43 +1,43 @@
1
- /**
2
- * Copyright Zendesk, Inc.
3
- *
4
- * Use of this source code is governed under the Apache License, Version 2.0
5
- * found at http://www.apache.org/licenses/LICENSE-2.0.
6
- */
7
- import { IDatepickerProps } from '../../../types';
8
- export interface IDatepickerState {
9
- isOpen: boolean;
10
- previewDate: Date;
11
- inputValue: string;
12
- }
13
- export type DatepickerAction = {
14
- type: 'OPEN';
15
- } | {
16
- type: 'CLOSE';
17
- } | {
18
- type: 'PREVIEW_NEXT_MONTH';
19
- } | {
20
- type: 'PREVIEW_PREVIOUS_MONTH';
21
- } | {
22
- type: 'MANUALLY_UPDATE_INPUT';
23
- value: string;
24
- } | {
25
- type: 'CONTROLLED_VALUE_CHANGE';
26
- value?: Date;
27
- } | {
28
- type: 'CONTROLLED_LOCALE_CHANGE';
29
- } | {
30
- type: 'SELECT_DATE';
31
- value: Date;
32
- };
33
- export declare const datepickerReducer: ({ value, formatDate, locale, customParseDate, onChange }: {
34
- value?: Date | undefined;
35
- formatDate?: ((date: Date) => string) | undefined;
36
- locale: any;
37
- customParseDate?: ((inputValue: string) => Date) | undefined;
38
- onChange?: ((date: Date) => void) | undefined;
39
- }) => (state: IDatepickerState, action: DatepickerAction) => IDatepickerState;
40
- /**
41
- * Retrieve initial state for the Datepicker reducer
42
- */
43
- export declare function retrieveInitialState(initialProps: IDatepickerProps): IDatepickerState;
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import { IDatepickerProps } from '../../../types';
8
+ export interface IDatepickerState {
9
+ isOpen: boolean;
10
+ previewDate: Date;
11
+ inputValue: string;
12
+ }
13
+ export type DatepickerAction = {
14
+ type: 'OPEN';
15
+ } | {
16
+ type: 'CLOSE';
17
+ } | {
18
+ type: 'PREVIEW_NEXT_MONTH';
19
+ } | {
20
+ type: 'PREVIEW_PREVIOUS_MONTH';
21
+ } | {
22
+ type: 'MANUALLY_UPDATE_INPUT';
23
+ value: string;
24
+ } | {
25
+ type: 'CONTROLLED_VALUE_CHANGE';
26
+ value?: Date;
27
+ } | {
28
+ type: 'CONTROLLED_LOCALE_CHANGE';
29
+ } | {
30
+ type: 'SELECT_DATE';
31
+ value: Date;
32
+ };
33
+ export declare const datepickerReducer: ({ value, formatDate, locale, customParseDate, onChange }: {
34
+ value?: Date | undefined;
35
+ formatDate?: ((date: Date) => string) | undefined;
36
+ locale: any;
37
+ customParseDate?: ((inputValue: string) => Date) | undefined;
38
+ onChange?: ((date: Date) => void) | undefined;
39
+ }) => (state: IDatepickerState, action: DatepickerAction) => IDatepickerState;
40
+ /**
41
+ * Retrieve initial state for the Datepicker reducer
42
+ */
43
+ export declare function retrieveInitialState(initialProps: IDatepickerProps): IDatepickerState;
@@ -1,21 +1,21 @@
1
- /**
2
- * Copyright Zendesk, Inc.
3
- *
4
- * Use of this source code is governed under the Apache License, Version 2.0
5
- * found at http://www.apache.org/licenses/LICENSE-2.0.
6
- */
7
- import { GardenPlacement, PopperPlacement } from '../../../types';
8
- /**
9
- * Convert Garden RTL aware placement to Popper.JS valid placement
10
- */
11
- export declare function getPopperPlacement(gardenPlacement: GardenPlacement): PopperPlacement;
12
- /**
13
- * Convert Garden RTL aware placement to RTL equivalent Popper.JS placement
14
- * @param {String} gardenPlacement
15
- */
16
- export declare function getRtlPopperPlacement(gardenPlacement: GardenPlacement): PopperPlacement;
17
- /**
18
- * Convert Popper.JS placement to corresponding menu position
19
- * @param {String} popperPlacement
20
- */
21
- export declare function getMenuPosition(popperPlacement?: PopperPlacement): "top" | "bottom" | "right" | "left";
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import { GardenPlacement, PopperPlacement } from '../../../types';
8
+ /**
9
+ * Convert Garden RTL aware placement to Popper.JS valid placement
10
+ */
11
+ export declare function getPopperPlacement(gardenPlacement: GardenPlacement): PopperPlacement;
12
+ /**
13
+ * Convert Garden RTL aware placement to RTL equivalent Popper.JS placement
14
+ * @param {String} gardenPlacement
15
+ */
16
+ export declare function getRtlPopperPlacement(gardenPlacement: GardenPlacement): PopperPlacement;
17
+ /**
18
+ * Convert Popper.JS placement to corresponding menu position
19
+ * @param {String} popperPlacement
20
+ */
21
+ export declare function getMenuPosition(popperPlacement?: PopperPlacement): "top" | "bottom" | "right" | "left";
@@ -1,18 +1,18 @@
1
- /**
2
- * Copyright Zendesk, Inc.
3
- *
4
- * Use of this source code is governed under the Apache License, Version 2.0
5
- * found at http://www.apache.org/licenses/LICENSE-2.0.
6
- */
7
- /// <reference types="react" />
8
- import { IDatepickerState, DatepickerAction } from './datepicker-reducer';
9
- export interface IDatepickerContext {
10
- state: IDatepickerState;
11
- dispatch: React.Dispatch<DatepickerAction>;
12
- }
13
- export declare const DatepickerContext: import("react").Context<IDatepickerContext | undefined>;
14
- /**
15
- * Retrieve Dropdown component context
16
- */
17
- declare const useDatepickerContext: () => IDatepickerContext;
18
- export default useDatepickerContext;
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ /// <reference types="react" />
8
+ import { IDatepickerState, DatepickerAction } from './datepicker-reducer';
9
+ export interface IDatepickerContext {
10
+ state: IDatepickerState;
11
+ dispatch: React.Dispatch<DatepickerAction>;
12
+ }
13
+ export declare const DatepickerContext: import("react").Context<IDatepickerContext | undefined>;
14
+ /**
15
+ * Retrieve Dropdown component context
16
+ */
17
+ declare const useDatepickerContext: () => IDatepickerContext;
18
+ export default useDatepickerContext;
@@ -1,35 +1,35 @@
1
- /**
2
- * Copyright Zendesk, Inc.
3
- *
4
- * Use of this source code is governed under the Apache License, Version 2.0
5
- * found at http://www.apache.org/licenses/LICENSE-2.0.
6
- */
7
- import React, { PropsWithChildren } from 'react';
8
- import PropTypes from 'prop-types';
9
- import { IDatepickerRangeProps } from '../../types';
10
- import { Start } from './components/Start';
11
- import { End } from './components/End';
12
- import { Calendar } from './components/Calendar';
13
- export declare const DatepickerRange: {
14
- (props: PropsWithChildren<IDatepickerRangeProps>): React.JSX.Element;
15
- propTypes: {
16
- locale: PropTypes.Requireable<string>;
17
- weekStartsOn: PropTypes.Requireable<number>;
18
- startValue: PropTypes.Requireable<Date>;
19
- endValue: PropTypes.Requireable<Date>;
20
- minValue: PropTypes.Requireable<Date>;
21
- maxValue: PropTypes.Requireable<Date>;
22
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
23
- formatDate: PropTypes.Requireable<(...args: any[]) => any>;
24
- customParseDate: PropTypes.Requireable<(...args: any[]) => any>;
25
- isCompact: PropTypes.Requireable<boolean>;
26
- };
27
- defaultProps: {
28
- locale: string;
29
- isCompact: boolean;
30
- };
31
- } & {
32
- Calendar: typeof Calendar;
33
- End: typeof End;
34
- Start: typeof Start;
35
- };
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import React, { PropsWithChildren } from 'react';
8
+ import PropTypes from 'prop-types';
9
+ import { IDatepickerRangeProps } from '../../types';
10
+ import { Start } from './components/Start';
11
+ import { End } from './components/End';
12
+ import { Calendar } from './components/Calendar';
13
+ export declare const DatepickerRange: {
14
+ (props: PropsWithChildren<IDatepickerRangeProps>): React.JSX.Element;
15
+ propTypes: {
16
+ locale: PropTypes.Requireable<string>;
17
+ weekStartsOn: PropTypes.Requireable<number>;
18
+ startValue: PropTypes.Requireable<Date>;
19
+ endValue: PropTypes.Requireable<Date>;
20
+ minValue: PropTypes.Requireable<Date>;
21
+ maxValue: PropTypes.Requireable<Date>;
22
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
23
+ formatDate: PropTypes.Requireable<(...args: any[]) => any>;
24
+ customParseDate: PropTypes.Requireable<(...args: any[]) => any>;
25
+ isCompact: PropTypes.Requireable<boolean>;
26
+ };
27
+ defaultProps: {
28
+ locale: string;
29
+ isCompact: boolean;
30
+ };
31
+ } & {
32
+ Calendar: typeof Calendar;
33
+ End: typeof End;
34
+ Start: typeof Start;
35
+ };
@@ -1,11 +1,11 @@
1
- /**
2
- * Copyright Zendesk, Inc.
3
- *
4
- * Use of this source code is governed under the Apache License, Version 2.0
5
- * found at http://www.apache.org/licenses/LICENSE-2.0.
6
- */
7
- import React from 'react';
8
- /**
9
- * @extends HTMLAttributes<HTMLDivElement>
10
- */
11
- export declare const Calendar: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import React from 'react';
8
+ /**
9
+ * @extends HTMLAttributes<HTMLDivElement>
10
+ */
11
+ export declare const Calendar: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
@@ -1,11 +1,11 @@
1
- /**
2
- * Copyright Zendesk, Inc.
3
- *
4
- * Use of this source code is governed under the Apache License, Version 2.0
5
- * found at http://www.apache.org/licenses/LICENSE-2.0.
6
- */
7
- import React, { PropsWithChildren, HTMLAttributes } from 'react';
8
- export declare const End: {
9
- (props: PropsWithChildren<HTMLAttributes<HTMLInputElement>>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
10
- displayName: string;
11
- };
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import React, { PropsWithChildren, HTMLAttributes } from 'react';
8
+ export declare const End: {
9
+ (props: PropsWithChildren<HTMLAttributes<HTMLInputElement>>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
10
+ displayName: string;
11
+ };
@@ -1,14 +1,14 @@
1
- /**
2
- * Copyright Zendesk, Inc.
3
- *
4
- * Use of this source code is governed under the Apache License, Version 2.0
5
- * found at http://www.apache.org/licenses/LICENSE-2.0.
6
- */
7
- import React, { HTMLAttributes } from 'react';
8
- interface IMonthProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
9
- displayDate: Date;
10
- isPreviousHidden?: boolean;
11
- isNextHidden?: boolean;
12
- }
13
- export declare const Month: React.ForwardRefExoticComponent<IMonthProps & React.RefAttributes<HTMLDivElement>>;
14
- export {};
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import React, { HTMLAttributes } from 'react';
8
+ interface IMonthProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
9
+ displayDate: Date;
10
+ isPreviousHidden?: boolean;
11
+ isNextHidden?: boolean;
12
+ }
13
+ export declare const Month: React.ForwardRefExoticComponent<IMonthProps & React.RefAttributes<HTMLDivElement>>;
14
+ export {};
@@ -1,11 +1,11 @@
1
- /**
2
- * Copyright Zendesk, Inc.
3
- *
4
- * Use of this source code is governed under the Apache License, Version 2.0
5
- * found at http://www.apache.org/licenses/LICENSE-2.0.
6
- */
7
- import React, { PropsWithChildren, HTMLAttributes } from 'react';
8
- export declare const Start: {
9
- (props: PropsWithChildren<HTMLAttributes<HTMLInputElement>>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
10
- displayName: string;
11
- };
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import React, { PropsWithChildren, HTMLAttributes } from 'react';
8
+ export declare const Start: {
9
+ (props: PropsWithChildren<HTMLAttributes<HTMLInputElement>>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
10
+ displayName: string;
11
+ };
@@ -1,71 +1,71 @@
1
- /**
2
- * Copyright Zendesk, Inc.
3
- *
4
- * Use of this source code is governed under the Apache License, Version 2.0
5
- * found at http://www.apache.org/licenses/LICENSE-2.0.
6
- */
7
- import { IDatepickerRangeProps } from '../../../types';
8
- export interface IDatepickerRangeState {
9
- previewDate: Date;
10
- hoverDate?: Date;
11
- isStartFocused: boolean;
12
- isEndFocused: boolean;
13
- startInputValue?: string;
14
- endInputValue?: string;
15
- }
16
- /**
17
- * Format date value to a localized string
18
- */
19
- export declare function formatValue({ value, locale, formatDate }: {
20
- value?: Date;
21
- formatDate?: any;
22
- locale?: string;
23
- }): string;
24
- /**
25
- * Parse string input value using current locale and date formats
26
- */
27
- export declare function parseInputValue({ inputValue }: {
28
- inputValue?: string;
29
- }): Date;
30
- export type DatepickerRangeAction = {
31
- type: 'HOVER_DATE';
32
- value?: Date;
33
- } | {
34
- type: 'CLICK_DATE';
35
- value: Date;
36
- } | {
37
- type: 'PREVIEW_NEXT_MONTH';
38
- } | {
39
- type: 'PREVIEW_PREVIOUS_MONTH';
40
- } | {
41
- type: 'START_INPUT_ONCHANGE';
42
- value: string;
43
- } | {
44
- type: 'END_INPUT_ONCHANGE';
45
- value: string;
46
- } | {
47
- type: 'START_BLUR';
48
- } | {
49
- type: 'END_BLUR';
50
- } | {
51
- type: 'START_FOCUS';
52
- } | {
53
- type: 'END_FOCUS';
54
- } | {
55
- type: 'CONTROLLED_START_VALUE_CHANGE';
56
- value?: Date;
57
- } | {
58
- type: 'CONTROLLED_END_VALUE_CHANGE';
59
- value?: Date;
60
- };
61
- export declare const datepickerRangeReducer: ({ startValue, endValue, locale, formatDate, customParseDate }: {
62
- startValue?: Date | undefined;
63
- endValue?: Date | undefined;
64
- locale?: string | undefined;
65
- formatDate?: any;
66
- customParseDate?: ((inputValue?: string) => Date) | undefined;
67
- }) => (state: IDatepickerRangeState, action: DatepickerRangeAction) => IDatepickerRangeState;
68
- /**
69
- * Retrieve initial state for the Datepicker reducer
70
- */
71
- export declare function retrieveInitialState(initialProps: IDatepickerRangeProps): IDatepickerRangeState;
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import { IDatepickerRangeProps } from '../../../types';
8
+ export interface IDatepickerRangeState {
9
+ previewDate: Date;
10
+ hoverDate?: Date;
11
+ isStartFocused: boolean;
12
+ isEndFocused: boolean;
13
+ startInputValue?: string;
14
+ endInputValue?: string;
15
+ }
16
+ /**
17
+ * Format date value to a localized string
18
+ */
19
+ export declare function formatValue({ value, locale, formatDate }: {
20
+ value?: Date;
21
+ formatDate?: any;
22
+ locale?: string;
23
+ }): string;
24
+ /**
25
+ * Parse string input value using current locale and date formats
26
+ */
27
+ export declare function parseInputValue({ inputValue }: {
28
+ inputValue?: string;
29
+ }): Date;
30
+ export type DatepickerRangeAction = {
31
+ type: 'HOVER_DATE';
32
+ value?: Date;
33
+ } | {
34
+ type: 'CLICK_DATE';
35
+ value: Date;
36
+ } | {
37
+ type: 'PREVIEW_NEXT_MONTH';
38
+ } | {
39
+ type: 'PREVIEW_PREVIOUS_MONTH';
40
+ } | {
41
+ type: 'START_INPUT_ONCHANGE';
42
+ value: string;
43
+ } | {
44
+ type: 'END_INPUT_ONCHANGE';
45
+ value: string;
46
+ } | {
47
+ type: 'START_BLUR';
48
+ } | {
49
+ type: 'END_BLUR';
50
+ } | {
51
+ type: 'START_FOCUS';
52
+ } | {
53
+ type: 'END_FOCUS';
54
+ } | {
55
+ type: 'CONTROLLED_START_VALUE_CHANGE';
56
+ value?: Date;
57
+ } | {
58
+ type: 'CONTROLLED_END_VALUE_CHANGE';
59
+ value?: Date;
60
+ };
61
+ export declare const datepickerRangeReducer: ({ startValue, endValue, locale, formatDate, customParseDate }: {
62
+ startValue?: Date | undefined;
63
+ endValue?: Date | undefined;
64
+ locale?: string | undefined;
65
+ formatDate?: any;
66
+ customParseDate?: ((inputValue?: string) => Date) | undefined;
67
+ }) => (state: IDatepickerRangeState, action: DatepickerRangeAction) => IDatepickerRangeState;
68
+ /**
69
+ * Retrieve initial state for the Datepicker reducer
70
+ */
71
+ export declare function retrieveInitialState(initialProps: IDatepickerRangeProps): IDatepickerRangeState;
@@ -1,33 +1,33 @@
1
- /**
2
- * Copyright Zendesk, Inc.
3
- *
4
- * Use of this source code is governed under the Apache License, Version 2.0
5
- * found at http://www.apache.org/licenses/LICENSE-2.0.
6
- */
7
- import { DateFnsIndex } from 'packages/datepickers/src/utils/calendar-utils';
8
- import { MutableRefObject } from 'react';
9
- import { IDatepickerRangeState, DatepickerRangeAction } from './datepicker-range-reducer';
10
- export interface IDatepickerRangeContext {
11
- state: IDatepickerRangeState;
12
- dispatch: React.Dispatch<DatepickerRangeAction>;
13
- locale?: string;
14
- weekStartsOn?: DateFnsIndex;
15
- isCompact?: boolean;
16
- minValue?: Date;
17
- maxValue?: Date;
18
- startValue?: Date;
19
- endValue?: Date;
20
- onChange?: (values: {
21
- startValue?: Date;
22
- endValue?: Date;
23
- }) => void;
24
- startInputRef: MutableRefObject<HTMLInputElement | undefined>;
25
- endInputRef: MutableRefObject<HTMLInputElement | undefined>;
26
- customParseDate?: (inputValue?: string) => Date;
27
- }
28
- export declare const DatepickerRangeContext: import("react").Context<IDatepickerRangeContext | undefined>;
29
- /**
30
- * Retrieve Dropdown component context
31
- */
32
- declare const useDatepickerContext: () => IDatepickerRangeContext;
33
- export default useDatepickerContext;
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import { MutableRefObject } from 'react';
8
+ import { DateFnsIndex } from '../../../utils/calendar-utils';
9
+ import { IDatepickerRangeState, DatepickerRangeAction } from './datepicker-range-reducer';
10
+ export interface IDatepickerRangeContext {
11
+ state: IDatepickerRangeState;
12
+ dispatch: React.Dispatch<DatepickerRangeAction>;
13
+ locale?: string;
14
+ weekStartsOn?: DateFnsIndex;
15
+ isCompact?: boolean;
16
+ minValue?: Date;
17
+ maxValue?: Date;
18
+ startValue?: Date;
19
+ endValue?: Date;
20
+ onChange?: (values: {
21
+ startValue?: Date;
22
+ endValue?: Date;
23
+ }) => void;
24
+ startInputRef: MutableRefObject<HTMLInputElement | undefined>;
25
+ endInputRef: MutableRefObject<HTMLInputElement | undefined>;
26
+ customParseDate?: (inputValue?: string) => Date;
27
+ }
28
+ export declare const DatepickerRangeContext: import("react").Context<IDatepickerRangeContext | undefined>;
29
+ /**
30
+ * Retrieve Dropdown component context
31
+ */
32
+ declare const useDatepickerContext: () => IDatepickerRangeContext;
33
+ export default useDatepickerContext;