@ssa-ui-kit/core 2.32.0 → 2.33.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.
@@ -1,2 +1,2 @@
1
1
  import { DateRangePickerProps } from './types';
2
- export declare const DateRangePicker: ({ format, openCalendarMode, showCalendarIcon, showStatusArea, rangePickerType, ...rest }: DateRangePickerProps) => import("@emotion/react/jsx-runtime").JSX.Element;
2
+ export declare const DateRangePicker: ({ format, showCalendarIcon, showStatusArea, rangePickerType, ...rest }: DateRangePickerProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,7 +1,4 @@
1
- import { MouseEventHandler } from 'react';
2
- export declare const TriggerInput: ({ datepickerType, withPopover, className, onClick, }: {
1
+ export declare const TriggerInput: ({ datepickerType, className, }: {
3
2
  datepickerType: "from" | "to";
4
- withPopover?: boolean;
5
3
  className?: string;
6
- onClick: MouseEventHandler<HTMLInputElement>;
7
4
  }) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,3 +1,4 @@
1
1
  export * from './useDateRangePicker';
2
2
  export * from './useDatePickerMask';
3
3
  export * from './useRangeHighlighting';
4
+ export * from './useRangeSelection';
@@ -1,10 +1,4 @@
1
- import { DateRangePickerProps } from '../types';
2
- export declare const useDatePickerMask: ({ maskOptions, formatIndexes, dateMinParts, dateMaxParts, }: Pick<DateRangePickerProps, "maskOptions"> & {
3
- formatIndexes: {
4
- day: number;
5
- month: number;
6
- year: number;
7
- };
8
- dateMinParts: number[];
9
- dateMaxParts: number[];
1
+ import { type MaskOptions } from '@react-input/mask';
2
+ export declare const useDatePickerMask: ({ maskOptions, }: {
3
+ maskOptions?: MaskOptions;
10
4
  }) => import("react").MutableRefObject<HTMLInputElement>;
@@ -16,7 +16,6 @@ export declare const useDateRangePicker: ({ dateMin, dateMax, name: _name, forma
16
16
  inputValueFrom: any;
17
17
  inputValueTo: any;
18
18
  calendarViewDateTime: [DateTime<boolean> | undefined, DateTime<boolean> | undefined];
19
- maskInputRef: import("react").MutableRefObject<HTMLInputElement>;
20
19
  calendarType: CalendarType;
21
20
  lastChangedDate: [Date | undefined, Date | undefined];
22
21
  luxonFormat: string;
@@ -30,11 +29,13 @@ export declare const useDateRangePicker: ({ dateMin, dateMax, name: _name, forma
30
29
  inputFromRef: ((instance: HTMLInputElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | null;
31
30
  inputToRef: ((instance: HTMLInputElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | null;
32
31
  setIsOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
33
- handleSetIsOpen: (open: boolean) => void;
34
32
  setLastFocusedElement: import("react").Dispatch<import("react").SetStateAction<"from" | "to">>;
35
33
  safeOnChange: (newDateTime?: DateTime) => void;
36
34
  setCalendarType: import("react").Dispatch<import("react").SetStateAction<CalendarType>>;
37
35
  setCalendarViewDateTime: import("react").Dispatch<import("react").SetStateAction<[DateTime<boolean> | undefined, DateTime<boolean> | undefined]>>;
38
36
  setDateTime: import("react").Dispatch<import("react").SetStateAction<DateTimeTuple>>;
39
37
  handleBlur: import("react").FocusEventHandler<HTMLInputElement>;
38
+ rangeSelectionStep: "start" | "end" | null;
39
+ setRangeSelectionStep: import("react").Dispatch<import("react").SetStateAction<"start" | "end" | null>>;
40
+ clearInputValue: (field: "from" | "to") => void;
40
41
  };
@@ -0,0 +1,20 @@
1
+ import { DateTime } from 'luxon';
2
+ type UseRangeSelectionOptions = {
3
+ /**
4
+ * Function to create the new DateTime from the selected value
5
+ */
6
+ createNewDate: (selectedValue: number | string) => DateTime | undefined;
7
+ /**
8
+ * Function to format the date for comparison (e.g., 'D' for days, 'yyyy-MM' for months, 'yyyy' for years)
9
+ */
10
+ getComparisonFormat: () => string;
11
+ };
12
+ export declare const useRangeSelection: ({ createNewDate, getComparisonFormat, }: UseRangeSelectionOptions) => {
13
+ handleRangeSelect: (selectedValue: number | string) => void;
14
+ getDateSelectionState: (currentDT: DateTime) => {
15
+ isCalendarFirstDateSelected: boolean;
16
+ isCalendarSecondDateSelected: boolean;
17
+ isCalendarDateSelected: boolean;
18
+ };
19
+ };
20
+ export {};
@@ -1,4 +1,4 @@
1
- import { Dispatch, MouseEventHandler, SetStateAction } from 'react';
1
+ import { Dispatch, MouseEventHandler, SetStateAction, FocusEventHandler } from 'react';
2
2
  import { DateTime } from 'luxon';
3
3
  import { useMask } from '@react-input/mask';
4
4
  import { FieldContextValue } from '../Field/FieldProvider';
@@ -14,7 +14,6 @@ export type DateRangePickerProps = {
14
14
  value?: [string | undefined, string | undefined];
15
15
  defaultValue?: [string, string];
16
16
  maskOptions?: Parameters<typeof useMask>[0];
17
- openCalendarMode?: 'icon' | 'input' | 'both';
18
17
  inputProps?: Partial<InputProps>;
19
18
  status?: FieldContextValue['status'];
20
19
  showStatusArea?: boolean;
@@ -46,7 +45,8 @@ export type DateRangePickerProps = {
46
45
  onError?: (date: unknown, error?: string | null) => void;
47
46
  onMonthChange?: (date: Date) => void;
48
47
  onYearChange?: (date: Date) => void;
49
- onBlur?: React.FocusEventHandler<HTMLInputElement>;
48
+ onBlur?: FocusEventHandler<HTMLInputElement>;
49
+ allowReverseSelection?: boolean;
50
50
  };
51
51
  export type DateTimeTuple = [DateTime | undefined, DateTime | undefined];
52
52
  export type DateRangePickerContextProps = Omit<DateRangePickerProps, 'dateMin' | 'dateMax'> & {
@@ -76,10 +76,12 @@ export type DateRangePickerContextProps = Omit<DateRangePickerProps, 'dateMin' |
76
76
  safeOnChange?: (date?: DateTime) => void;
77
77
  setLastFocusedElement: Dispatch<SetStateAction<LastFocusedElement>>;
78
78
  handleToggleOpen: MouseEventHandler<HTMLButtonElement | HTMLInputElement>;
79
- handleSetIsOpen: (open: boolean) => void;
80
79
  setCalendarViewDateTime: Dispatch<SetStateAction<DateTimeTuple>>;
81
80
  setDateTime: Dispatch<SetStateAction<DateTimeTuple>>;
82
81
  setIsOpen: Dispatch<SetStateAction<boolean>>;
83
82
  setCalendarType: Dispatch<SetStateAction<CalendarType>>;
83
+ rangeSelectionStep: 'start' | 'end' | null;
84
+ setRangeSelectionStep: Dispatch<SetStateAction<'start' | 'end' | null>>;
85
+ clearInputValue: (field: 'from' | 'to') => void;
84
86
  };
85
87
  export type CalendarType = 'days' | 'months' | 'years';
@@ -1 +1,2 @@
1
- export declare const useDateRangePickerContext: () => import("./types").DateRangePickerContextProps;
1
+ import { DateRangePickerContextProps } from './types';
2
+ export declare const useDateRangePickerContext: () => DateRangePickerContextProps;