@uxf/datepicker 16.11.0 → 16.15.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.
@@ -3,11 +3,11 @@ import { Dispatch, SetStateAction } from "react";
3
3
  import { MonthType } from "../utils/types";
4
4
  export interface UseDatePickerNavigationProps {
5
5
  activeMonths: MonthType[];
6
- setActiveMonths: Dispatch<SetStateAction<MonthType[]>>;
7
- setFocusedDate: (date: Date | null) => void;
8
- minBookingDate?: DateString;
9
6
  maxBookingDate?: DateString;
7
+ minBookingDate?: DateString;
10
8
  numberOfMonths: number;
9
+ setActiveMonths: Dispatch<SetStateAction<MonthType[]>>;
10
+ setFocusedDate: (date: Date | null) => void;
11
11
  }
12
12
  export interface UseDatePickerNavigationReturnType {
13
13
  canGoToMonth: (month: Date) => boolean;
@@ -20,8 +20,8 @@ export interface UseDayProps {
20
20
  unavailableDates?: Date[];
21
21
  }
22
22
  export interface UseDayReturnType {
23
- flags: Flag[];
24
23
  disabledDate: boolean;
24
+ flags: Flag[];
25
25
  isFirstDisabled: boolean;
26
26
  isHovered: boolean;
27
27
  isInsideRange: boolean;
@@ -2,8 +2,8 @@ import { CalendarYear } from "../utils/get-years";
2
2
  export declare const yearLabelFormatFn: (date: Date) => string;
3
3
  export declare const decadeLabelFormatFn: (start: Date, end: Date) => string;
4
4
  export interface UseDecadeReturnType {
5
- years: CalendarYear[];
6
5
  decadeLabel: string;
6
+ years: CalendarYear[];
7
7
  }
8
8
  export interface UseDecadeProps {
9
9
  decadeLabelFormat?: (start: Date, end: Date) => string;
@@ -1,8 +1,8 @@
1
1
  import { KeyboardEvent, RefObject } from "react";
2
2
  export interface UseHourProps {
3
+ focusedHour: number | null;
3
4
  hour: number;
4
5
  hourRef?: RefObject<HTMLElement | null>;
5
- focusedHour: number | null;
6
6
  isHourFocused: (hour: number) => boolean;
7
7
  isHourSelected: (hour: number) => boolean;
8
8
  onHourFocus: (hour: number) => void;
@@ -1,10 +1,10 @@
1
1
  import { KeyboardEvent, RefObject } from "react";
2
2
  export interface UseMinuteProps {
3
- minute: number;
4
- minuteRef?: RefObject<HTMLElement | null>;
5
3
  focusedMinute: number | null;
6
4
  isMinuteFocused: (minute: number) => boolean;
7
5
  isMinuteSelected: (minute: number) => boolean;
6
+ minute: number;
7
+ minuteRef?: RefObject<HTMLElement | null>;
8
8
  onMinuteFocus: (minute: number) => void;
9
9
  onMinuteSelect: (minute: number) => void;
10
10
  preventScroll?: boolean;
@@ -10,13 +10,12 @@ export interface UseTimePickerProps {
10
10
  selectedTime: TimeType | null;
11
11
  }
12
12
  export interface UseTimePickerReturnType {
13
- onTimeSelect: (time: TimeType) => void;
14
- goToPrevHour: () => void;
15
- goToPrevMinute: () => void;
16
- goToNextHour: () => void;
17
- goToNextMinute: () => void;
18
13
  focusedHour: number | null;
19
14
  focusedMinute: number | null;
15
+ goToNextHour: () => void;
16
+ goToNextMinute: () => void;
17
+ goToPrevHour: () => void;
18
+ goToPrevMinute: () => void;
20
19
  isHourFocused: (hour: number) => boolean;
21
20
  isHourSelected: (hour: number) => boolean;
22
21
  isMinuteFocused: (minute: number) => boolean;
@@ -25,6 +24,7 @@ export interface UseTimePickerReturnType {
25
24
  onHourSelect: (hour: number) => void;
26
25
  onMinuteFocus: (minute: number) => void;
27
26
  onMinuteSelect: (minute: number) => void;
27
+ onTimeSelect: (time: TimeType) => void;
28
28
  preventScroll?: boolean;
29
29
  }
30
30
  export declare function useTimePicker({ selectedTime, onTimeChange, onSelectCallback, preventScroll, }: UseTimePickerProps): UseTimePickerReturnType;
@@ -6,7 +6,7 @@ export interface UseYearReturnType {
6
6
  yearLabel: string;
7
7
  }
8
8
  export interface UseYearProps extends GetMonthsProps {
9
- yearLabelFormat?: (date: Date) => string;
10
9
  monthLabelFormat?: (date: Date) => string;
10
+ yearLabelFormat?: (date: Date) => string;
11
11
  }
12
12
  export declare function useYear({ yearLabelFormat, monthLabelFormat, year, }: UseYearProps): UseYearReturnType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/datepicker",
3
- "version": "16.11.0",
3
+ "version": "16.15.0",
4
4
  "description": "A set of React hooks to create an awesome datepicker.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -19,8 +19,8 @@
19
19
  "homepage": "https://fe.uxf.dev/docs/datepicker",
20
20
  "license": "MIT",
21
21
  "peerDependencies": {
22
- "@uxf/core": "16.11.0",
23
- "@uxf/core-react": "16.11.0",
22
+ "@uxf/core": "16.15.0",
23
+ "@uxf/core-react": "16.15.0",
24
24
  "dayjs": "^1.11.23",
25
25
  "next": ">=16.4.3",
26
26
  "react": "^19.3.0",
@@ -34,8 +34,8 @@
34
34
  "devDependencies": {
35
35
  "@types/react": "19.3.0",
36
36
  "@types/react-dom": "19.3.0",
37
- "@uxf/core": "16.11.0",
38
- "@uxf/core-react": "16.11.0",
37
+ "@uxf/core": "16.15.0",
38
+ "@uxf/core-react": "16.15.0",
39
39
  "dayjs": "^1.11.23",
40
40
  "react": "19.3.1",
41
41
  "react-dom": "19.3.1"
@@ -1,11 +1,11 @@
1
1
  import { DateString } from "@uxf/core/date";
2
2
  export interface CanSelectRangeProps {
3
- startDate: DateString;
4
3
  endDate: DateString | null;
5
- isDateBlocked: ((date: DateString) => boolean) | null;
6
- minBookingDays: number;
7
4
  exactMinBookingDays?: boolean;
8
- minBookingDate?: DateString;
5
+ isDateBlocked: ((date: DateString) => boolean) | null;
9
6
  maxBookingDate?: DateString;
7
+ minBookingDate?: DateString;
8
+ minBookingDays: number;
9
+ startDate: DateString;
10
10
  }
11
11
  export declare function canSelectRange({ startDate, endDate, isDateBlocked, minBookingDays, exactMinBookingDays, minBookingDate, maxBookingDate, }: CanSelectRangeProps): boolean;
@@ -1,9 +1,9 @@
1
1
  import { FirstDayOfWeek } from "./types";
2
2
  export interface GetDaysProps {
3
- year: number;
4
- month: number;
5
- firstDayOfWeek?: FirstDayOfWeek;
6
3
  dayLabelFormat?: (date: Date) => string;
4
+ firstDayOfWeek?: FirstDayOfWeek;
5
+ month: number;
6
+ year: number;
7
7
  }
8
8
  export type CalendarDay = {
9
9
  dayLabel: string;
@@ -1,6 +1,6 @@
1
1
  export interface GetMonthsProps {
2
- year: number;
3
2
  monthLabelFormat?: (date: Date) => string;
3
+ year: number;
4
4
  }
5
5
  export type CalendarMonth = {
6
6
  monthLabel: string;
@@ -1,6 +1,6 @@
1
1
  export interface GetYearsProps {
2
- startYear: Date;
3
2
  endYear: Date;
3
+ startYear: Date;
4
4
  yearLabelFormat?: (date: Date) => string;
5
5
  }
6
6
  export type CalendarYear = {
@@ -1,12 +1,12 @@
1
1
  import { DateString } from "@uxf/core/date";
2
2
  interface IsDateBlockedProps {
3
3
  date: DateString;
4
- startDate: DateString | null;
5
4
  endDate: DateString | null;
6
- minBookingDays?: number;
7
- minBookingDate?: DateString;
8
- maxBookingDate?: DateString;
9
5
  isDateBlockedFn?: ((date: Date) => boolean) | null;
6
+ maxBookingDate?: DateString;
7
+ minBookingDate?: DateString;
8
+ minBookingDays?: number;
9
+ startDate: DateString | null;
10
10
  unavailableDates?: DateString[];
11
11
  }
12
12
  export declare function isDateBlocked({ date, minBookingDate, maxBookingDate, isDateBlockedFn, startDate, endDate, minBookingDays, unavailableDates, }: IsDateBlockedProps): boolean;
@@ -1,11 +1,11 @@
1
1
  import { DateString } from "@uxf/core/date";
2
2
  export interface IsDateHoveredProps {
3
- startDate: DateString | null;
4
- endDate: DateString | null;
5
3
  date: DateString;
6
- isDateBlocked: ((date: DateString) => boolean) | null;
4
+ endDate: DateString | null;
5
+ exactMinBookingDays: boolean;
7
6
  hoveredDate: DateString | null;
7
+ isDateBlocked: ((date: DateString) => boolean) | null;
8
8
  minBookingDays: number;
9
- exactMinBookingDays: boolean;
9
+ startDate: DateString | null;
10
10
  }
11
11
  export declare function isDateHovered({ date, startDate, endDate, isDateBlocked, hoveredDate, minBookingDays, exactMinBookingDays, }: IsDateHoveredProps): boolean;
package/utils/types.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export type FirstDayOfWeek = 0 | 1 | 2 | 3 | 4 | 5 | 6;
2
2
  export interface MonthType {
3
- year: number;
4
- month: number;
5
3
  date: Date;
4
+ month: number;
5
+ year: number;
6
6
  }
7
7
  export type DatesConfig = {
8
8
  flag?: string;