react-beauty-calendar 1.1.0 → 1.2.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.
- package/dist/@types/calendar-instance.d.ts +9 -2
- package/dist/build/assets/main.css +1 -1
- package/dist/build/main.cjs.js +46 -37
- package/dist/build/main.es.js +7041 -6526
- package/dist/context/drag/dragStore.d.ts +4 -4
- package/dist/context/drag/useDragStateAtStore.d.ts +8 -0
- package/dist/context/global/config/ConfigProvider.d.ts +5 -0
- package/dist/context/global/config/config-context.d.ts +2 -0
- package/dist/context/global/config/config-store.d.ts +13 -0
- package/dist/context/global/days-and-week/day-and-week-store.d.ts +2 -0
- package/dist/context/index.d.ts +3 -1
- package/dist/context/new-event/new-event-store.d.ts +2 -0
- package/dist/core/Root.d.ts +1 -1
- package/dist/core/booking-card/BookingCard.d.ts +8 -2
- package/dist/core/booking-create/BookingCreate.d.ts +17 -0
- package/dist/core/calendar/CalendarHolder.d.ts +4 -1
- package/dist/core/calendar/ViewTypes.d.ts +3 -5
- package/dist/core/slots/Card.d.ts +5 -1
- package/dist/core/slots/CardBlockContent.d.ts +8 -0
- package/dist/core/slots/CardContent.d.ts +9 -2
- package/dist/core/slots/CardOverlay.d.ts +1 -1
- package/dist/core/slots/EventsTab.d.ts +4 -5
- package/dist/core/slots/SlotRender.d.ts +14 -0
- package/dist/core/slots/Slots.d.ts +2 -3
- package/dist/core/slots/TimeInfo.d.ts +6 -1
- package/dist/core/slots/useResizableCardHook.d.ts +3 -1
- package/dist/hooks/use-booking-model.d.ts +1 -1
- package/dist/hooks/useGlobalConfig.d.ts +3 -0
- package/dist/mock/booking-mock.d.ts +2 -1
- package/dist/utils/date-utils.d.ts +4 -0
- package/dist/utils/hours.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface DragStoreProps {
|
|
2
2
|
isDragging: boolean;
|
|
3
3
|
}
|
|
4
|
-
export interface
|
|
5
|
-
updateIsDragging: (
|
|
4
|
+
export interface DragStoreState extends DragStoreProps {
|
|
5
|
+
updateIsDragging: (isDragging: boolean) => void;
|
|
6
6
|
}
|
|
7
|
-
declare const useDragStore: import('zustand').UseBoundStore<import('zustand').StoreApi<
|
|
7
|
+
declare const useDragStore: import('zustand').UseBoundStore<import('zustand').StoreApi<DragStoreState>>;
|
|
8
8
|
export default useDragStore;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface DragProps {
|
|
2
|
+
startAt: string;
|
|
3
|
+
}
|
|
4
|
+
export interface DragState extends DragProps {
|
|
5
|
+
updateStartAt: (startAt: string) => void;
|
|
6
|
+
}
|
|
7
|
+
declare const useDragStartAtStore: import('zustand').UseBoundStore<import('zustand').StoreApi<DragState>>;
|
|
8
|
+
export default useDragStartAtStore;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { ConfigStoreProps } from './config-store';
|
|
3
|
+
type ConfigProviderProps = PropsWithChildren<ConfigStoreProps>;
|
|
4
|
+
declare const ConfigProvider: ({ children, ...props }: ConfigProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export { ConfigProvider };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type SystemColor = "#1700af" | "#b50000" | "#000000";
|
|
2
|
+
export declare const initialConfigState: ConfigStoreProps;
|
|
3
|
+
export interface ConfigStoreProps {
|
|
4
|
+
systemColor?: SystemColor;
|
|
5
|
+
isTimeInfoVisible?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface ConfigStoreState extends ConfigStoreProps {
|
|
8
|
+
updateSystemColor: (systemColor: SystemColor) => void;
|
|
9
|
+
changeTimeInfoVisibility: (status: boolean) => void;
|
|
10
|
+
}
|
|
11
|
+
declare const configStore: (initialProps?: Partial<ConfigStoreState>) => import('zustand').StoreApi<ConfigStoreState>;
|
|
12
|
+
export type ConfigStore = ReturnType<typeof configStore>;
|
|
13
|
+
export { configStore };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { StateCreator } from 'zustand';
|
|
2
2
|
import { HourWithActionsRef } from '../../../core/calendar/HourWithActions';
|
|
3
3
|
import { Times } from '../../../utils/hours';
|
|
4
|
+
export declare const START_TIME = 1;
|
|
5
|
+
export declare const END_24_HOUR_FORMAT = 24;
|
|
4
6
|
export type DaysOfWeek = Date[];
|
|
5
7
|
export interface NextAndPreviousWeek {
|
|
6
8
|
firstDayOfWeek: Date;
|
package/dist/context/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { default as BookingProvider } from './booking/bookingProvider';
|
|
2
2
|
import { default as BookingModalProvider } from './bookingModal/BookingModalProvider';
|
|
3
|
+
import { ConfigProvider } from './global/config/ConfigProvider';
|
|
3
4
|
import { default as MonthDescriptionProvider } from './month-description/MonthDescriptionProvider';
|
|
4
|
-
|
|
5
|
+
import { NewEventProvider } from './new-event/new-event-context';
|
|
6
|
+
export { MonthDescriptionProvider, BookingModalProvider, BookingProvider, NewEventProvider, ConfigProvider, };
|
|
@@ -6,6 +6,7 @@ export interface NewEventFormProps {
|
|
|
6
6
|
date: string;
|
|
7
7
|
startAt: string;
|
|
8
8
|
finishAt: string;
|
|
9
|
+
slotStartAt: string;
|
|
9
10
|
ref?: Ref<NewEventFormRef>;
|
|
10
11
|
}
|
|
11
12
|
export interface NewEventFormState extends NewEventFormProps {
|
|
@@ -16,6 +17,7 @@ export interface NewEventFormState extends NewEventFormProps {
|
|
|
16
17
|
updateDate: (dateAsString: string) => void;
|
|
17
18
|
updateFinishAtWithOffset: (time: string, increasingMinutes?: number) => string;
|
|
18
19
|
resetForm: () => void;
|
|
20
|
+
updatePrevStartAt: (slotStartAt: string) => void;
|
|
19
21
|
}
|
|
20
22
|
export declare const initialFormState: NewEventFormProps;
|
|
21
23
|
export type NewEventStore = ReturnType<typeof newEventFormStore>;
|
package/dist/core/Root.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { RootProps } from '../@types/calendar-instance';
|
|
2
|
-
declare const Root: ({ viewModes, createBookingModal, onChangeViewType, onCardDropCallback, onDayChange, onHeaderDayClick, onTodayClick, onSlotClick, onModalClose, bookings, ref, }: RootProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare const Root: ({ viewModes, createBookingModal, onChangeViewType, onCardDropCallback, onCardResizeEnd, onDayChange, onHeaderDayClick, onTodayClick, onSlotClick, onModalClose, bookings, isTimeInfoVisible, systemColor, ref, }: RootProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default Root;
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
+
import { Ref } from 'react';
|
|
1
2
|
import { Booking, BookingDateAndTime } from '../../@types/booking';
|
|
3
|
+
export interface BookingCardRef {
|
|
4
|
+
changeCurrentCardResize: () => void;
|
|
5
|
+
}
|
|
2
6
|
interface BookingCardProps {
|
|
3
7
|
booking: Booking;
|
|
4
8
|
slotData: BookingDateAndTime;
|
|
5
9
|
customClasses?: string;
|
|
6
|
-
|
|
10
|
+
heightStyle: number;
|
|
7
11
|
layerCount?: number;
|
|
12
|
+
half?: boolean;
|
|
8
13
|
onClick?: () => void;
|
|
14
|
+
ref?: Ref<BookingCardRef>;
|
|
9
15
|
}
|
|
10
|
-
declare const BookingCard: ({ booking, slotData,
|
|
16
|
+
declare const BookingCard: ({ booking, slotData, onClick, heightStyle, customClasses, ref, }: BookingCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
17
|
export default BookingCard;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { JSX, Ref } from 'react';
|
|
2
|
+
import { Side } from '../booking-options/BookingInfoOptions';
|
|
3
|
+
interface BookingCreateProps {
|
|
4
|
+
modal?: boolean;
|
|
5
|
+
side?: Side;
|
|
6
|
+
buttonTrigger?: JSX.Element;
|
|
7
|
+
onClose?: () => void;
|
|
8
|
+
onOpenChange?: (status: boolean) => void;
|
|
9
|
+
ref: Ref<BookingCreateRef>;
|
|
10
|
+
}
|
|
11
|
+
export interface BookingCreateRef {
|
|
12
|
+
showCreationModal: () => void;
|
|
13
|
+
closeModal: () => void;
|
|
14
|
+
isModalOpen: () => boolean;
|
|
15
|
+
}
|
|
16
|
+
declare const BookingCreate: ({ modal, side, onClose, onOpenChange, buttonTrigger, ref, }: BookingCreateProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export default BookingCreate;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
interface CalendarHolderProps {
|
|
2
|
+
isLoading: boolean;
|
|
3
|
+
}
|
|
4
|
+
declare const CalendarHolder: ({ isLoading }: CalendarHolderProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
5
|
export default CalendarHolder;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
declare const HandleViewType: ({ bookingViewType }: HandleViewTypeProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
type HandleViewTypePropsWithChildren = PropsWithChildren;
|
|
3
|
+
declare const HandleViewType: ({ children }: HandleViewTypePropsWithChildren) => import('react').ReactNode;
|
|
6
4
|
export default HandleViewType;
|
|
@@ -3,10 +3,14 @@ import { Booking, BookingDateAndTime } from '../../@types/booking';
|
|
|
3
3
|
interface CardProps {
|
|
4
4
|
booking: Booking;
|
|
5
5
|
slotData: BookingDateAndTime;
|
|
6
|
+
lastCard?: boolean;
|
|
7
|
+
half?: boolean;
|
|
8
|
+
cardsQuantity?: number;
|
|
9
|
+
cardIndex?: number;
|
|
6
10
|
ref?: Ref<CardRef>;
|
|
7
11
|
}
|
|
8
12
|
export interface CardRef {
|
|
9
13
|
bookingId: string;
|
|
10
14
|
}
|
|
11
|
-
declare const Card: ({ booking, slotData, ref }: CardProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
declare const Card: ({ booking, slotData, cardsQuantity, cardIndex, lastCard, half, ref, }: CardProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
16
|
export default Card;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Booking, BookingDateAndTime } from '../../@types';
|
|
2
|
+
interface CardBlockContentProps {
|
|
3
|
+
bookings?: Booking[];
|
|
4
|
+
blockTimeString: string;
|
|
5
|
+
slotData?: BookingDateAndTime;
|
|
6
|
+
}
|
|
7
|
+
declare const CardBlockContent: ({ bookings, blockTimeString, slotData, }: CardBlockContentProps) => import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
8
|
+
export default CardBlockContent;
|
|
@@ -4,6 +4,7 @@ import { BookingDateAndTime } from '../../@types/booking';
|
|
|
4
4
|
import { DraggableAttributes } from '@dnd-kit/core';
|
|
5
5
|
import { SyntheticListenerMap } from '@dnd-kit/core/dist/hooks/utilities';
|
|
6
6
|
import { ResizeCallbackData, ResizeHandle } from 'react-resizable';
|
|
7
|
+
import { BookingCardRef } from '../booking-card/BookingCard';
|
|
7
8
|
interface ResizableState {
|
|
8
9
|
height: number;
|
|
9
10
|
width: number;
|
|
@@ -20,18 +21,24 @@ interface CardContentProps {
|
|
|
20
21
|
bookingInit: Booking;
|
|
21
22
|
bookingViewType: string;
|
|
22
23
|
slotData: BookingDateAndTime;
|
|
23
|
-
|
|
24
|
+
heightStyle: number;
|
|
25
|
+
topHeightIncrement?: number;
|
|
24
26
|
listeners?: SyntheticListenerMap | undefined;
|
|
25
27
|
attributes?: DraggableAttributes;
|
|
26
28
|
onClick?: () => void;
|
|
27
29
|
customClasses?: string;
|
|
28
30
|
open?: boolean;
|
|
31
|
+
lastCard?: boolean;
|
|
32
|
+
half?: boolean;
|
|
33
|
+
cardsQuantity?: number;
|
|
34
|
+
cardIndex?: number;
|
|
29
35
|
resizableParam?: ResizableParam;
|
|
30
36
|
events?: {
|
|
31
37
|
onUnmount: () => void;
|
|
32
38
|
};
|
|
39
|
+
cardContentRef?: Ref<BookingCardRef>;
|
|
33
40
|
ref?: Ref<CardContentForward>;
|
|
34
41
|
}
|
|
35
42
|
type CardContentForward = HTMLDivElement;
|
|
36
|
-
declare const CardContent: ({ bookingInit, slotData,
|
|
43
|
+
declare const CardContent: ({ bookingInit, slotData, heightStyle, topHeightIncrement, onClick, customClasses, bookingViewType, resizableParam, events, open, lastCard, half, cardContentRef: dataRef, cardsQuantity, cardIndex, ref, }: CardContentProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
37
44
|
export default CardContent;
|
|
@@ -3,7 +3,7 @@ import { BookingDateAndTime } from '../../@types/booking';
|
|
|
3
3
|
interface CardOverlayProps {
|
|
4
4
|
bookingInit: Booking;
|
|
5
5
|
slotData: BookingDateAndTime;
|
|
6
|
-
heightStyle:
|
|
6
|
+
heightStyle: number;
|
|
7
7
|
}
|
|
8
8
|
declare const CardOverlay: ({ bookingInit, slotData, heightStyle, }: CardOverlayProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
export default CardOverlay;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { JSX, PropsWithChildren } from 'react';
|
|
2
|
-
import { EmptySlotNodes } from '../../context/emptySlotsStore.ts/useEmptySlotStore';
|
|
3
2
|
import { Side } from '../booking-options/BookingInfoOptions';
|
|
4
3
|
interface EventTabsProps {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
side?: Side;
|
|
5
|
+
buttonTrigger?: JSX.Element;
|
|
6
|
+
modal?: boolean;
|
|
8
7
|
onClose: (event: React.MouseEvent) => void;
|
|
9
8
|
onOpenChange: (status: boolean) => void;
|
|
10
9
|
}
|
|
11
10
|
type EventTabsWithChildren = PropsWithChildren<EventTabsProps>;
|
|
12
|
-
declare const EventTabs: ({ onClose, side, onOpenChange, buttonTrigger, children, }: EventTabsWithChildren) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare const EventTabs: ({ onClose, side, onOpenChange, buttonTrigger, modal, children, }: EventTabsWithChildren) => import("react/jsx-runtime").JSX.Element;
|
|
13
12
|
export default EventTabs;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Booking, BookingDateAndTime } from '../../@types/booking';
|
|
2
|
+
import { BlocksTimeStructure } from './EmptySlot';
|
|
3
|
+
interface SlotRenderProps {
|
|
4
|
+
firstDay: boolean;
|
|
5
|
+
booking: Booking[];
|
|
6
|
+
dayHour: BookingDateAndTime;
|
|
7
|
+
disabledCss: string;
|
|
8
|
+
firstBlockTimeData: BlocksTimeStructure;
|
|
9
|
+
secondBlockTimeData: BlocksTimeStructure;
|
|
10
|
+
thirdBlockTimeData: BlocksTimeStructure;
|
|
11
|
+
fourthBlockTimeData: BlocksTimeStructure;
|
|
12
|
+
}
|
|
13
|
+
declare const SlotRender: import('react').MemoExoticComponent<({ firstDay, booking, dayHour, disabledCss, firstBlockTimeData, secondBlockTimeData, thirdBlockTimeData, fourthBlockTimeData, }: SlotRenderProps) => import("react/jsx-runtime").JSX.Element>;
|
|
14
|
+
export default SlotRender;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Booking, BookingDateAndTime
|
|
1
|
+
import { Booking, BookingDateAndTime } from '../../@types/booking';
|
|
2
2
|
export type TimesBlock = "first" | "second" | "third" | "fourth";
|
|
3
3
|
interface SlotsProps {
|
|
4
4
|
dayHour: BookingDateAndTime;
|
|
@@ -7,8 +7,7 @@ interface SlotsProps {
|
|
|
7
7
|
finishAt: string;
|
|
8
8
|
};
|
|
9
9
|
firstDay: boolean;
|
|
10
|
-
bookingViewType: BookingViewType;
|
|
11
10
|
bookingBulk: Booking[];
|
|
12
11
|
}
|
|
13
|
-
declare const Slots: ({ dayHour, lunchTimeBlock, firstDay, bookingBulk,
|
|
12
|
+
declare const Slots: ({ dayHour, lunchTimeBlock, firstDay, bookingBulk, }: SlotsProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
13
|
export default Slots;
|
|
@@ -5,10 +5,15 @@ interface TimeInfoEvents {
|
|
|
5
5
|
openOptions: () => void;
|
|
6
6
|
resetPrevView: () => void;
|
|
7
7
|
}
|
|
8
|
+
export interface TimeInfoRef {
|
|
9
|
+
show: () => void;
|
|
10
|
+
hide: () => void;
|
|
11
|
+
changeIsOpen: (isOpen: boolean) => void;
|
|
12
|
+
}
|
|
8
13
|
interface TimeInfoProps {
|
|
9
14
|
isDragging: boolean;
|
|
10
15
|
slotData: BlocksTimeStructure;
|
|
11
16
|
events: TimeInfoEvents;
|
|
12
17
|
}
|
|
13
|
-
declare const TimeInfo: (
|
|
18
|
+
declare const TimeInfo: import('react').ForwardRefExoticComponent<TimeInfoProps & import('react').RefAttributes<TimeInfoRef>>;
|
|
14
19
|
export default TimeInfo;
|
|
@@ -8,8 +8,9 @@ interface useResizableCardHookProps {
|
|
|
8
8
|
onSubTime?: (datetime: Date) => void;
|
|
9
9
|
starter?: boolean;
|
|
10
10
|
}
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const INITIAL_SIZE = 600;
|
|
12
12
|
export declare const MIN_DIFF_TIME_THRESHOLD = 15;
|
|
13
|
+
export declare const BASE_VALUE: number;
|
|
13
14
|
declare const useResizableCardHook: ({ booking, onAddTime, onAddStartTime, onSubTime, starter, }: useResizableCardHookProps) => {
|
|
14
15
|
state: {
|
|
15
16
|
height: number;
|
|
@@ -22,6 +23,7 @@ declare const useResizableCardHook: ({ booking, onAddTime, onAddStartTime, onSub
|
|
|
22
23
|
resetState: () => void;
|
|
23
24
|
resetHeightStyle: () => void;
|
|
24
25
|
heightStyle: number;
|
|
26
|
+
topHeightIncrement: number;
|
|
25
27
|
onResize: (event: SyntheticEvent, { size, handle }: ResizeCallbackData) => void;
|
|
26
28
|
updateHeightStyle: (finishMock: Date, startMock: Date) => void;
|
|
27
29
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const useBookingModal: () => import('../context/bookingModal/BookingModalProvider').BookingModalContextProps;
|
|
2
2
|
export default useBookingModal;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Booking } from '../@types';
|
|
1
2
|
import { DaysOfWeek, NextAndPreviousWeek } from '../context/global/days-and-week/day-and-week-store';
|
|
2
3
|
export declare const WEEK_DAYS: readonly ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
3
4
|
type WeekDays = (typeof WEEK_DAYS)[number];
|
|
@@ -13,6 +14,9 @@ export declare const DateUtils: {
|
|
|
13
14
|
addDay(currentDate: Date, numberOfDays: number): Date;
|
|
14
15
|
formatDate(time: string): string;
|
|
15
16
|
dateTimeAsString(date: Date): string;
|
|
17
|
+
getTimeDiff(startTime: Date, endTime: Date): string;
|
|
18
|
+
bookingTimeRange: (booking: Booking, overId: string) => Booking;
|
|
19
|
+
getNewFinishAt(newStartAt: string, timeString: string): Date;
|
|
16
20
|
minuteDifference(date1: Date, date2: Date): number;
|
|
17
21
|
dateAndHourDateToString(date: Date): string;
|
|
18
22
|
shortMonthDescription(...month: Date[]): string;
|
package/dist/utils/hours.d.ts
CHANGED