@skedulo/sked-ui 19.11.1 → 19.12.2

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.
@@ -1,5 +1,5 @@
1
+ import { RangeType } from './elements/RangePicker';
1
2
  export declare type DateDirection = 'forward' | 'backward';
2
- export declare type RangeType = 'day' | '3-days' | '2-weeks' | 'week' | 'month';
3
3
  export declare const moveDate: (selected: Date, days: RangeType, direction: DateDirection) => Date;
4
4
  export declare const endOfPeriod: (selected: Date, selectedRange: RangeType) => Date;
5
5
  export declare const formatLongDate: (date: Date) => string;
@@ -1,55 +1,29 @@
1
1
  import * as React from 'react';
2
- import { RangeType as Range } from './CalendarControls-utils';
3
- export declare type RangeType = Range;
4
- declare type SelectDateHandler = (date: Date) => void;
5
- interface IRangeProps {
6
- selectedRange?: RangeType;
7
- onRangeChange?: (range: RangeType) => void;
8
- rangeOptions?: RangeType[];
9
- selected?: Date;
10
- }
11
- export interface ICalendarControlProps extends React.HTMLAttributes<HTMLDivElement> {
2
+ import { IDateSelectorProps } from './elements/DateSelector';
3
+ import { INavigationButtonProps } from './elements/NavigationButtons';
4
+ import { IRangeProps, RangePicker, RangeType } from './elements/RangePicker';
5
+ export interface IBaseCalendarControlProps {
12
6
  /**
13
- * The current focus date for the Calendar. If a range is provided this is the start of the range to render
14
- */
15
- selected: Date;
16
- /**
17
- * When a new range has been provided, this callback is triggered
7
+ * The current range to display. This will update the current range dropdown and the date range displayed
18
8
  */
19
- onRangeChange?: (range: RangeType) => void;
9
+ selectedRange?: RangeType;
20
10
  /**
21
- * Whenever the date is changed, either through direct select, clicking to or navigating, the new date is provided to this function
11
+ * The current focus date for the Calendar. If a range is provided this is the start of the range to render
22
12
  */
23
- onDateSelect?: SelectDateHandler;
13
+ selected?: Date;
14
+ }
15
+ export interface ICalendarControlProps extends React.HTMLAttributes<HTMLDivElement>, IDateSelectorProps, INavigationButtonProps, IRangeProps {
24
16
  /**
25
17
  * Whenever the user clicks the `Today` button this callback is triggered
26
18
  */
27
19
  onTodayClick?: () => void;
28
- /**
29
- * The callback handler when a Day in the datepicker dropdown is hovered
30
- */
31
- onDayMouseEnter?: SelectDateHandler;
32
- /**
33
- * The callback handler for when the mouse leaves the datepicker dropdown
34
- */
35
- onMonthMouseLeave?: () => void;
36
- /**
37
- * A day of a week to highlight. It will highlight from Sunday to Saturday of the weeks selected based on rangeOptions
38
- */
39
- highlightWeek?: Date;
40
- /**
41
- * Highlight the entire week of the currently selected date, from Sunday to Saturday based on rangeOptions
42
- */
43
- selectWeek?: boolean;
44
- /**
45
- * The current range to display. This will update the current range dropdown and the date range displayed
46
- */
47
- selectedRange?: RangeType;
48
- /**
49
- * The list of options that can be chosen from. Current range options are 'day', '3-days', 'week' and 'month'
50
- */
51
- rangeOptions?: RangeType[];
52
20
  }
53
- export declare const RangePicker: React.FC<IRangeProps>;
54
- export declare const CalendarControls: ({ selected, onDateSelect, onTodayClick, onDayMouseEnter, onMonthMouseLeave, highlightWeek, selectWeek, selectedRange, onRangeChange, rangeOptions, className, ...rest }: ICalendarControlProps) => JSX.Element;
55
- export {};
21
+ export declare function useCalendarControlsContext(): ICalendarControlProps;
22
+ declare function CalendarControls(props: ICalendarControlProps): JSX.Element;
23
+ declare namespace CalendarControls {
24
+ var TodayButton: React.FC<import("./elements/TodayButton").ITodayButtonProps>;
25
+ var NavigationButtons: React.FC<INavigationButtonProps>;
26
+ var DateSelector: React.FC<IDateSelectorProps>;
27
+ var RangePicker: React.FC<IRangeProps>;
28
+ }
29
+ export { CalendarControls, RangePicker, RangeType };
@@ -0,0 +1,33 @@
1
+ import React, { HTMLAttributes } from 'react';
2
+ import { ButtonTypes } from '../../..';
3
+ import { IBaseCalendarControlProps } from '../CalendarControls';
4
+ export declare type SelectDateHandler = (date: Date) => void;
5
+ export interface IBaseDateSelectorProps extends IBaseCalendarControlProps {
6
+ /**
7
+ * Whenever the date is changed, either through direct select, clicking to or navigating, the new date is provided to this function
8
+ */
9
+ onDateSelect?: SelectDateHandler;
10
+ }
11
+ export interface IDateSelectorProps extends IBaseDateSelectorProps, HTMLAttributes<HTMLDivElement> {
12
+ /**
13
+ * The callback handler when a Day in the datepicker dropdown is hovered
14
+ */
15
+ onDayMouseEnter?: SelectDateHandler;
16
+ /**
17
+ * The callback handler for when the mouse leaves the datepicker dropdown
18
+ */
19
+ onMonthMouseLeave?: () => void;
20
+ /**
21
+ * A day of a week to highlight. It will highlight from Sunday to Saturday of the weeks selected based on rangeOptions
22
+ */
23
+ highlightWeek?: Date;
24
+ /**
25
+ * Highlight the entire week of the currently selected date, from Sunday to Saturday based on rangeOptions
26
+ */
27
+ selectWeek?: boolean;
28
+ /**
29
+ * The type of Datepicker custom input button to be displayed. Primary | Secondary | Transparent
30
+ */
31
+ buttonType?: ButtonTypes;
32
+ }
33
+ export declare const DateSelector: React.FC<IDateSelectorProps>;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { IBaseDateSelectorProps } from './DateSelector';
3
+ export interface INavigationButtonProps extends IBaseDateSelectorProps {
4
+ }
5
+ export declare const NavigationButtons: React.FC<INavigationButtonProps>;
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { IBaseCalendarControlProps } from '../CalendarControls';
3
+ export interface IRangeProps extends IBaseCalendarControlProps {
4
+ /**
5
+ * When a new range has been provided, this callback is triggered
6
+ */
7
+ onRangeChange?: (range: RangeType) => void;
8
+ /**
9
+ * The list of options that can be chosen from. Current range options are 'day', '3-days', 'week' and 'month'
10
+ */
11
+ rangeOptions?: RangeType[];
12
+ }
13
+ export declare type RangeType = 'day' | '3-days' | '2-weeks' | 'week' | 'month';
14
+ export declare const dateRangeLabel: {
15
+ day: string;
16
+ '3-days': string;
17
+ week: string;
18
+ '2-weeks': string;
19
+ month: string;
20
+ };
21
+ export declare const RangePicker: React.FC<IRangeProps>;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export interface ITodayButtonProps {
3
+ onClick?: () => void;
4
+ }
5
+ export declare const TodayButton: React.FC<ITodayButtonProps>;
@@ -1,11 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { ReactDatePickerProps } from 'react-datepicker';
3
- import { RangeType } from '../calendar-controls/CalendarControls';
3
+ import { RangeType } from '../calendar-controls/elements/RangePicker';
4
4
  export declare type LocaleType = 'AU' | 'US' | 'UK';
5
- export interface CustomInput extends React.PureComponent {
6
- value: Date;
7
- onClick: React.MouseEventHandler;
8
- }
9
5
  export interface DatepickerProps {
10
6
  /**
11
7
  * The currently selected date.
@@ -111,11 +107,13 @@ export interface DatepickerProps {
111
107
  declare type CustomInputType = React.InputHTMLAttributes<HTMLInputElement> & {
112
108
  onBlurCustom: () => void;
113
109
  openCalendar: (open: boolean) => void;
110
+ onBackspace: () => void;
114
111
  Component: (props: React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement>) => JSX.Element;
115
112
  };
116
113
  export declare const CustomInput: React.ForwardRefExoticComponent<React.InputHTMLAttributes<HTMLInputElement> & {
117
114
  onBlurCustom: () => void;
118
115
  openCalendar: (open: boolean) => void;
116
+ onBackspace: () => void;
119
117
  Component: (props: React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement>) => JSX.Element;
120
118
  } & React.RefAttributes<HTMLInputElement>>;
121
119
  export declare const Datepicker: React.FC<DatepickerProps>;