@campxdev/react-blueprint 2.2.3 → 2.2.4
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/cjs/index.js +1 -1
- package/dist/cjs/types/src/components/Navigation/Calendar/Calendar.d.ts +3 -0
- package/dist/cjs/types/src/components/Navigation/Calendar/index.d.ts +3 -0
- package/dist/cjs/types/src/components/Navigation/Calendar/styles.d.ts +9 -0
- package/dist/cjs/types/src/components/Navigation/Calendar/types.d.ts +90 -0
- package/dist/cjs/types/src/components/Navigation/Calendar/utils.d.ts +55 -0
- package/dist/cjs/types/src/components/Navigation/export.d.ts +2 -0
- package/dist/cjs/types/src/stories/Navigation/Calendar.stories.d.ts +10 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/types/src/components/Navigation/Calendar/Calendar.d.ts +3 -0
- package/dist/esm/types/src/components/Navigation/Calendar/index.d.ts +3 -0
- package/dist/esm/types/src/components/Navigation/Calendar/styles.d.ts +9 -0
- package/dist/esm/types/src/components/Navigation/Calendar/types.d.ts +90 -0
- package/dist/esm/types/src/components/Navigation/Calendar/utils.d.ts +55 -0
- package/dist/esm/types/src/components/Navigation/export.d.ts +2 -0
- package/dist/esm/types/src/stories/Navigation/Calendar.stories.d.ts +10 -0
- package/dist/index.d.ts +151 -4
- package/package.json +6 -1
- package/src/components/Navigation/Calendar/Calendar.tsx +243 -0
- package/src/components/Navigation/Calendar/README.md +308 -0
- package/src/components/Navigation/Calendar/index.ts +3 -0
- package/src/components/Navigation/Calendar/styles.tsx +222 -0
- package/src/components/Navigation/Calendar/types.ts +120 -0
- package/src/components/Navigation/Calendar/utils.ts +265 -0
- package/src/components/Navigation/export.ts +2 -0
- package/src/stories/Navigation/Calendar.stories.tsx +475 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const StyledCalendarContainer: import("@mui/styled-engine").StyledComponent<import("@mui/material").StackOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("@types/react").DetailedHTMLProps<import("@types/react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
2
|
+
ref?: import("@types/react").Ref<HTMLDivElement>;
|
|
3
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | keyof import("@mui/material").StackOwnProps> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
4
|
+
height?: string | number;
|
|
5
|
+
aspectRatio?: number;
|
|
6
|
+
}, {}, {}>;
|
|
7
|
+
export declare const StyledCalendarWrapper: import("@mui/styled-engine").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("@types/react").DetailedHTMLProps<import("@types/react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
8
|
+
ref?: import("@types/react").Ref<HTMLDivElement>;
|
|
9
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { EventApi } from '@fullcalendar/core';
|
|
2
|
+
import { StackProps } from '@mui/material';
|
|
3
|
+
export interface CalendarEvent {
|
|
4
|
+
id: string | number;
|
|
5
|
+
title: string;
|
|
6
|
+
start: Date | string;
|
|
7
|
+
end?: Date | string;
|
|
8
|
+
allDay?: boolean;
|
|
9
|
+
backgroundColor?: string;
|
|
10
|
+
borderColor?: string;
|
|
11
|
+
textColor?: string;
|
|
12
|
+
extendedProps?: {
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export interface CalendarEventClickInfo {
|
|
17
|
+
event: EventApi;
|
|
18
|
+
jsEvent: MouseEvent;
|
|
19
|
+
view: any;
|
|
20
|
+
}
|
|
21
|
+
export interface CalendarDateSelectInfo {
|
|
22
|
+
start: Date;
|
|
23
|
+
end: Date;
|
|
24
|
+
allDay: boolean;
|
|
25
|
+
jsEvent: MouseEvent;
|
|
26
|
+
view: any;
|
|
27
|
+
}
|
|
28
|
+
export interface CalendarEventDropInfo {
|
|
29
|
+
event: EventApi;
|
|
30
|
+
delta: any;
|
|
31
|
+
revert: () => void;
|
|
32
|
+
jsEvent: Event;
|
|
33
|
+
view: any;
|
|
34
|
+
}
|
|
35
|
+
export interface CalendarEventResizeInfo {
|
|
36
|
+
event: EventApi;
|
|
37
|
+
startDelta: any;
|
|
38
|
+
endDelta: any;
|
|
39
|
+
revert: () => void;
|
|
40
|
+
jsEvent: Event;
|
|
41
|
+
view: any;
|
|
42
|
+
}
|
|
43
|
+
export interface CalendarDateClickInfo {
|
|
44
|
+
date: Date;
|
|
45
|
+
dateStr: string;
|
|
46
|
+
allDay: boolean;
|
|
47
|
+
dayEl: HTMLElement;
|
|
48
|
+
jsEvent: MouseEvent;
|
|
49
|
+
view: any;
|
|
50
|
+
}
|
|
51
|
+
export type CalendarView = 'dayGridMonth' | 'timeGridWeek' | 'timeGridDay' | 'listWeek';
|
|
52
|
+
export interface CalendarHeaderToolbar {
|
|
53
|
+
left?: string;
|
|
54
|
+
center?: string;
|
|
55
|
+
right?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface CalendarProps {
|
|
58
|
+
events?: CalendarEvent[];
|
|
59
|
+
onEventClick?: (eventInfo: CalendarEventClickInfo) => void;
|
|
60
|
+
onEventDrop?: (eventInfo: CalendarEventDropInfo) => void;
|
|
61
|
+
onEventResize?: (eventInfo: CalendarEventResizeInfo) => void;
|
|
62
|
+
onDateClick?: (dateInfo: CalendarDateClickInfo) => void;
|
|
63
|
+
onDateSelect?: (selectInfo: CalendarDateSelectInfo) => void;
|
|
64
|
+
onEventsSet?: (events: EventApi[]) => void;
|
|
65
|
+
initialView?: CalendarView;
|
|
66
|
+
views?: CalendarView[];
|
|
67
|
+
headerToolbar?: CalendarHeaderToolbar | boolean;
|
|
68
|
+
editable?: boolean;
|
|
69
|
+
selectable?: boolean;
|
|
70
|
+
selectMirror?: boolean;
|
|
71
|
+
eventResizable?: boolean;
|
|
72
|
+
eventDraggable?: boolean;
|
|
73
|
+
dayMaxEvents?: boolean | number;
|
|
74
|
+
height?: string | number;
|
|
75
|
+
aspectRatio?: number;
|
|
76
|
+
containerProps?: StackProps;
|
|
77
|
+
locale?: string;
|
|
78
|
+
timezone?: string;
|
|
79
|
+
firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
80
|
+
eventContent?: (eventInfo: any) => React.ReactNode;
|
|
81
|
+
dayCellContent?: (dayInfo: any) => React.ReactNode;
|
|
82
|
+
showNavigationButtons?: boolean;
|
|
83
|
+
showViewSwitcher?: boolean;
|
|
84
|
+
showToday?: boolean;
|
|
85
|
+
calendarRef?: React.RefObject<any>;
|
|
86
|
+
weekends?: boolean;
|
|
87
|
+
businessHours?: any;
|
|
88
|
+
eventConstraint?: any;
|
|
89
|
+
selectConstraint?: any;
|
|
90
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { CalendarEvent } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Generate recurring events based on a pattern
|
|
4
|
+
*/
|
|
5
|
+
export interface RecurringEventConfig {
|
|
6
|
+
title: string;
|
|
7
|
+
startTime: string;
|
|
8
|
+
endTime: string;
|
|
9
|
+
startDate: Date;
|
|
10
|
+
endDate?: Date;
|
|
11
|
+
daysOfWeek?: number[];
|
|
12
|
+
interval?: number;
|
|
13
|
+
backgroundColor?: string;
|
|
14
|
+
extendedProps?: {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export declare const generateRecurringEvents: (config: RecurringEventConfig, maxEvents?: number) => CalendarEvent[];
|
|
19
|
+
/**
|
|
20
|
+
* Generate sample business events for demonstration
|
|
21
|
+
*/
|
|
22
|
+
export declare const generateBusinessEvents: (startDate?: Date) => CalendarEvent[];
|
|
23
|
+
/**
|
|
24
|
+
* Filter events by date range
|
|
25
|
+
*/
|
|
26
|
+
export declare const filterEventsByDateRange: (events: CalendarEvent[], startDate: Date, endDate: Date) => CalendarEvent[];
|
|
27
|
+
/**
|
|
28
|
+
* Group events by date
|
|
29
|
+
*/
|
|
30
|
+
export declare const groupEventsByDate: (events: CalendarEvent[]) => {
|
|
31
|
+
[date: string]: CalendarEvent[];
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Calculate event statistics
|
|
35
|
+
*/
|
|
36
|
+
export interface EventStats {
|
|
37
|
+
totalEvents: number;
|
|
38
|
+
eventsThisWeek: number;
|
|
39
|
+
eventsThisMonth: number;
|
|
40
|
+
averageEventsPerDay: number;
|
|
41
|
+
mostBusyDay: string;
|
|
42
|
+
leastBusyDay: string;
|
|
43
|
+
}
|
|
44
|
+
export declare const calculateEventStats: (events: CalendarEvent[]) => EventStats;
|
|
45
|
+
/**
|
|
46
|
+
* Convert events to different formats
|
|
47
|
+
*/
|
|
48
|
+
export declare const exportEventsToCSV: (events: CalendarEvent[]) => string;
|
|
49
|
+
/**
|
|
50
|
+
* Validate event data
|
|
51
|
+
*/
|
|
52
|
+
export declare const validateEvent: (event: Partial<CalendarEvent>) => {
|
|
53
|
+
isValid: boolean;
|
|
54
|
+
errors: string[];
|
|
55
|
+
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from '../Layout/PageHeader/components/TableColumnsSelector/TableColumnsSelector';
|
|
2
2
|
export * from './Breadcrumbs/Breadcrumbs';
|
|
3
|
+
export * from './Calendar';
|
|
4
|
+
export * from './Calendar/Calendar';
|
|
3
5
|
export * from './ConfirmDialog/ConfirmDialog';
|
|
4
6
|
export * from './Dialog/Dialog';
|
|
5
7
|
export * from './DialogButton/DialogButton';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react/*';
|
|
2
|
+
import { Calendar } from '../../components/Navigation/Calendar/Calendar';
|
|
3
|
+
declare const meta: Meta<typeof Calendar>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Calendar>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const MonthView: Story;
|
|
8
|
+
export declare const WeekView: Story;
|
|
9
|
+
export declare const DayView: Story;
|
|
10
|
+
export declare const StudentCalendar: Story;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import react__default, { ReactNode, MouseEvent, FC, ReactElement } from 'react';
|
|
3
|
+
import react__default, { ReactNode, MouseEvent as MouseEvent$1, FC, ReactElement } from 'react';
|
|
4
4
|
import * as _mui_material from '@mui/material';
|
|
5
5
|
import { SxProps, AccordionProps as AccordionProps$1, AvatarProps, TypographyOwnProps, TypographyProps as TypographyProps$1, AlertProps as AlertProps$1, SnackbarProps as SnackbarProps$1, TooltipProps as TooltipProps$1, ButtonProps as ButtonProps$1, StackProps, TextFieldProps as TextFieldProps$1, RadioGroupProps as RadioGroupProps$1, FormControlLabelProps, CheckboxProps as CheckboxProps$1, AutocompleteProps, SwitchProps as SwitchProps$1, BoxProps, MenuProps, MenuListProps, BreadcrumbsProps as BreadcrumbsProps$1, DialogProps as DialogProps$1, IconButtonProps, MenuItemProps, TabProps, TabsProps } from '@mui/material';
|
|
6
6
|
import { LayoutType } from 'recharts/types/util/types';
|
|
@@ -20,6 +20,7 @@ import { DatePickerProps as DatePickerProps$1 } from '@mui/x-date-pickers/DatePi
|
|
|
20
20
|
import { FieldValues, Control } from 'react-hook-form';
|
|
21
21
|
import { BaseSelectProps } from '@mui/material/Select';
|
|
22
22
|
import { TimePickerProps as TimePickerProps$1 } from '@mui/x-date-pickers/TimePicker';
|
|
23
|
+
import { EventApi } from '@fullcalendar/core';
|
|
23
24
|
import * as redux from 'redux';
|
|
24
25
|
|
|
25
26
|
declare const AnimatedGIFs: {
|
|
@@ -70,7 +71,7 @@ interface IconProps {
|
|
|
70
71
|
size?: number;
|
|
71
72
|
hoverColor?: string;
|
|
72
73
|
disabled?: boolean;
|
|
73
|
-
onClick?: (event: MouseEvent<Element>) => void;
|
|
74
|
+
onClick?: (event: MouseEvent$1<Element>) => void;
|
|
74
75
|
}
|
|
75
76
|
type IconComponent = FC<IconProps>;
|
|
76
77
|
type IconsType = {
|
|
@@ -1203,6 +1204,152 @@ type BreadcrumbsProps = {
|
|
|
1203
1204
|
} & BreadcrumbsProps$1;
|
|
1204
1205
|
declare const Breadcrumbs: ({ pathTrimCount, containerProps, actions, ...rest }: BreadcrumbsProps) => react_jsx_runtime.JSX.Element;
|
|
1205
1206
|
|
|
1207
|
+
interface CalendarEvent {
|
|
1208
|
+
id: string | number;
|
|
1209
|
+
title: string;
|
|
1210
|
+
start: Date | string;
|
|
1211
|
+
end?: Date | string;
|
|
1212
|
+
allDay?: boolean;
|
|
1213
|
+
backgroundColor?: string;
|
|
1214
|
+
borderColor?: string;
|
|
1215
|
+
textColor?: string;
|
|
1216
|
+
extendedProps?: {
|
|
1217
|
+
[key: string]: any;
|
|
1218
|
+
};
|
|
1219
|
+
}
|
|
1220
|
+
interface CalendarEventClickInfo {
|
|
1221
|
+
event: EventApi;
|
|
1222
|
+
jsEvent: MouseEvent;
|
|
1223
|
+
view: any;
|
|
1224
|
+
}
|
|
1225
|
+
interface CalendarDateSelectInfo {
|
|
1226
|
+
start: Date;
|
|
1227
|
+
end: Date;
|
|
1228
|
+
allDay: boolean;
|
|
1229
|
+
jsEvent: MouseEvent;
|
|
1230
|
+
view: any;
|
|
1231
|
+
}
|
|
1232
|
+
interface CalendarEventDropInfo {
|
|
1233
|
+
event: EventApi;
|
|
1234
|
+
delta: any;
|
|
1235
|
+
revert: () => void;
|
|
1236
|
+
jsEvent: Event;
|
|
1237
|
+
view: any;
|
|
1238
|
+
}
|
|
1239
|
+
interface CalendarEventResizeInfo {
|
|
1240
|
+
event: EventApi;
|
|
1241
|
+
startDelta: any;
|
|
1242
|
+
endDelta: any;
|
|
1243
|
+
revert: () => void;
|
|
1244
|
+
jsEvent: Event;
|
|
1245
|
+
view: any;
|
|
1246
|
+
}
|
|
1247
|
+
interface CalendarDateClickInfo {
|
|
1248
|
+
date: Date;
|
|
1249
|
+
dateStr: string;
|
|
1250
|
+
allDay: boolean;
|
|
1251
|
+
dayEl: HTMLElement;
|
|
1252
|
+
jsEvent: MouseEvent;
|
|
1253
|
+
view: any;
|
|
1254
|
+
}
|
|
1255
|
+
type CalendarView = 'dayGridMonth' | 'timeGridWeek' | 'timeGridDay' | 'listWeek';
|
|
1256
|
+
interface CalendarHeaderToolbar {
|
|
1257
|
+
left?: string;
|
|
1258
|
+
center?: string;
|
|
1259
|
+
right?: string;
|
|
1260
|
+
}
|
|
1261
|
+
interface CalendarProps {
|
|
1262
|
+
events?: CalendarEvent[];
|
|
1263
|
+
onEventClick?: (eventInfo: CalendarEventClickInfo) => void;
|
|
1264
|
+
onEventDrop?: (eventInfo: CalendarEventDropInfo) => void;
|
|
1265
|
+
onEventResize?: (eventInfo: CalendarEventResizeInfo) => void;
|
|
1266
|
+
onDateClick?: (dateInfo: CalendarDateClickInfo) => void;
|
|
1267
|
+
onDateSelect?: (selectInfo: CalendarDateSelectInfo) => void;
|
|
1268
|
+
onEventsSet?: (events: EventApi[]) => void;
|
|
1269
|
+
initialView?: CalendarView;
|
|
1270
|
+
views?: CalendarView[];
|
|
1271
|
+
headerToolbar?: CalendarHeaderToolbar | boolean;
|
|
1272
|
+
editable?: boolean;
|
|
1273
|
+
selectable?: boolean;
|
|
1274
|
+
selectMirror?: boolean;
|
|
1275
|
+
eventResizable?: boolean;
|
|
1276
|
+
eventDraggable?: boolean;
|
|
1277
|
+
dayMaxEvents?: boolean | number;
|
|
1278
|
+
height?: string | number;
|
|
1279
|
+
aspectRatio?: number;
|
|
1280
|
+
containerProps?: StackProps;
|
|
1281
|
+
locale?: string;
|
|
1282
|
+
timezone?: string;
|
|
1283
|
+
firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
1284
|
+
eventContent?: (eventInfo: any) => React.ReactNode;
|
|
1285
|
+
dayCellContent?: (dayInfo: any) => React.ReactNode;
|
|
1286
|
+
showNavigationButtons?: boolean;
|
|
1287
|
+
showViewSwitcher?: boolean;
|
|
1288
|
+
showToday?: boolean;
|
|
1289
|
+
calendarRef?: React.RefObject<any>;
|
|
1290
|
+
weekends?: boolean;
|
|
1291
|
+
businessHours?: any;
|
|
1292
|
+
eventConstraint?: any;
|
|
1293
|
+
selectConstraint?: any;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
declare const Calendar: react__default.FC<CalendarProps>;
|
|
1297
|
+
|
|
1298
|
+
/**
|
|
1299
|
+
* Generate recurring events based on a pattern
|
|
1300
|
+
*/
|
|
1301
|
+
interface RecurringEventConfig {
|
|
1302
|
+
title: string;
|
|
1303
|
+
startTime: string;
|
|
1304
|
+
endTime: string;
|
|
1305
|
+
startDate: Date;
|
|
1306
|
+
endDate?: Date;
|
|
1307
|
+
daysOfWeek?: number[];
|
|
1308
|
+
interval?: number;
|
|
1309
|
+
backgroundColor?: string;
|
|
1310
|
+
extendedProps?: {
|
|
1311
|
+
[key: string]: any;
|
|
1312
|
+
};
|
|
1313
|
+
}
|
|
1314
|
+
declare const generateRecurringEvents: (config: RecurringEventConfig, maxEvents?: number) => CalendarEvent[];
|
|
1315
|
+
/**
|
|
1316
|
+
* Generate sample business events for demonstration
|
|
1317
|
+
*/
|
|
1318
|
+
declare const generateBusinessEvents: (startDate?: Date) => CalendarEvent[];
|
|
1319
|
+
/**
|
|
1320
|
+
* Filter events by date range
|
|
1321
|
+
*/
|
|
1322
|
+
declare const filterEventsByDateRange: (events: CalendarEvent[], startDate: Date, endDate: Date) => CalendarEvent[];
|
|
1323
|
+
/**
|
|
1324
|
+
* Group events by date
|
|
1325
|
+
*/
|
|
1326
|
+
declare const groupEventsByDate: (events: CalendarEvent[]) => {
|
|
1327
|
+
[date: string]: CalendarEvent[];
|
|
1328
|
+
};
|
|
1329
|
+
/**
|
|
1330
|
+
* Calculate event statistics
|
|
1331
|
+
*/
|
|
1332
|
+
interface EventStats {
|
|
1333
|
+
totalEvents: number;
|
|
1334
|
+
eventsThisWeek: number;
|
|
1335
|
+
eventsThisMonth: number;
|
|
1336
|
+
averageEventsPerDay: number;
|
|
1337
|
+
mostBusyDay: string;
|
|
1338
|
+
leastBusyDay: string;
|
|
1339
|
+
}
|
|
1340
|
+
declare const calculateEventStats: (events: CalendarEvent[]) => EventStats;
|
|
1341
|
+
/**
|
|
1342
|
+
* Convert events to different formats
|
|
1343
|
+
*/
|
|
1344
|
+
declare const exportEventsToCSV: (events: CalendarEvent[]) => string;
|
|
1345
|
+
/**
|
|
1346
|
+
* Validate event data
|
|
1347
|
+
*/
|
|
1348
|
+
declare const validateEvent: (event: Partial<CalendarEvent>) => {
|
|
1349
|
+
isValid: boolean;
|
|
1350
|
+
errors: string[];
|
|
1351
|
+
};
|
|
1352
|
+
|
|
1206
1353
|
type ConfirmDialogType = 'confirm' | 'delete';
|
|
1207
1354
|
type ConfirmDialogProps = {
|
|
1208
1355
|
isOpen: boolean;
|
|
@@ -1382,5 +1529,5 @@ declare const splitBreadcrumbIdSlug: (param: string) => {
|
|
|
1382
1529
|
declare const isLocal: boolean;
|
|
1383
1530
|
declare const isDevelopment: boolean;
|
|
1384
1531
|
|
|
1385
|
-
export { Accordion, AccordionGroup, ActivityLogView, Alert, AnimatedGIFs, AppHeader, AppHeaderV2, AppLayout, BarChart, Breadcrumbs, Button, Card, CellContainer, CenterBox, Chips, CircularAvatar, ComingSoon, ConfirmDialog, DataTable, DatePicker, DateTimePicker, DensitySelector, Dialog, DialogButton, DropDownButton, DropDownIcon, DropdownMenu, DropdownMenuItem, EditableDataTable, EditableTableCore, EmptyIllustration, FileUpload, FloatingContent, FloatingHelpDocs, FooterContainerContainer, FormActions, FormControlWrapper, FormWrapper, HelpPopup, IconButtons, Icons, InternalServerError, LabelWrapper, LineChart, MuiThemeProvider, MultiCheckBox, NoInterneConnection, NoItemFound, OtpInput, PageContent, PageHeader, PageNotFound, PasswordField, PieChart, PreviewFiles, ProgressCard, RadioGroup, ResourceNotFound, SearchBar, Select, SidePanel, SidePanelVariables, Sidebar, SingleCheckBox, SingleSelect, Snackbar, Spinner, SquareAvatar, StatusCard, Stepper, StyledContainer, Svgs, Switch, SwitchInstitutionPopup, TableColumnsSelector, TableColumnsSelectorMenuFooter, TabsContainer, TabsLayout, TextField, TimePicker, Timeline, ToolTipContent, Tooltip, Tutorial, Typography, UnAuthorized, UploadDialog, UserProfilePopup, createBreadcrumbIdSlug, darkTheme, getBreadcrumbsCharacter, isDevelopment, isLocal, lightTheme, reactBlueprintReducers, splitBreadcrumbIdSlug, usePageHeader, useParams, useUrlParams };
|
|
1386
|
-
export type { AccordionProps, Activity, ActivityAction, AlertProps, AppHeaderProps, AppHeaderV2Props, AppLayoutProps, BarChartProps, BreadcrumbsProps, ButtonConfig, ButtonProps, CardProps, CheckboxProps, CircularAvatarProps, ConfirmDialogProps, ConfirmDialogType, DataTableProps, DensitySelectorProps, DialogButtonProps, DialogProps, DropdownMenuItemProps, DropdownMenuProps, EditableDataTableProps, FileUploadProps, FloatingContainerProps, FormActionsProps, HelpDocsAction, HelpDocsConfig, IconComponent, IconProps, IconsType, LineChartProps, MultiCheckboxProps, OtpInputProps, PageContentProps, PasswordFieldProps, PieChartProps, PreviewFilesProps, ProgressCardProps, RadioGroupProps, SearchBarProps, SelectProps, Severity, SideMenuItemProps, SidePanelProps, SingleSelectProps, SnackbarProps, SquareAvatarProps, StatusCardProps, SubMenuItemProps, SwitchProps, TableColumnsSelectorProps, TabsContainerProps, TextFieldProps, TimelineItems, TimelineProps, TooltipContentProps, TooltipProps, TypographyProps, UploadDialogProps };
|
|
1532
|
+
export { Accordion, AccordionGroup, ActivityLogView, Alert, AnimatedGIFs, AppHeader, AppHeaderV2, AppLayout, BarChart, Breadcrumbs, Button, Calendar, Card, CellContainer, CenterBox, Chips, CircularAvatar, ComingSoon, ConfirmDialog, DataTable, DatePicker, DateTimePicker, DensitySelector, Dialog, DialogButton, DropDownButton, DropDownIcon, DropdownMenu, DropdownMenuItem, EditableDataTable, EditableTableCore, EmptyIllustration, FileUpload, FloatingContent, FloatingHelpDocs, FooterContainerContainer, FormActions, FormControlWrapper, FormWrapper, HelpPopup, IconButtons, Icons, InternalServerError, LabelWrapper, LineChart, MuiThemeProvider, MultiCheckBox, NoInterneConnection, NoItemFound, OtpInput, PageContent, PageHeader, PageNotFound, PasswordField, PieChart, PreviewFiles, ProgressCard, RadioGroup, ResourceNotFound, SearchBar, Select, SidePanel, SidePanelVariables, Sidebar, SingleCheckBox, SingleSelect, Snackbar, Spinner, SquareAvatar, StatusCard, Stepper, StyledContainer, Svgs, Switch, SwitchInstitutionPopup, TableColumnsSelector, TableColumnsSelectorMenuFooter, TabsContainer, TabsLayout, TextField, TimePicker, Timeline, ToolTipContent, Tooltip, Tutorial, Typography, UnAuthorized, UploadDialog, UserProfilePopup, calculateEventStats, createBreadcrumbIdSlug, darkTheme, exportEventsToCSV, filterEventsByDateRange, generateBusinessEvents, generateRecurringEvents, getBreadcrumbsCharacter, groupEventsByDate, isDevelopment, isLocal, lightTheme, reactBlueprintReducers, splitBreadcrumbIdSlug, usePageHeader, useParams, useUrlParams, validateEvent };
|
|
1533
|
+
export type { AccordionProps, Activity, ActivityAction, AlertProps, AppHeaderProps, AppHeaderV2Props, AppLayoutProps, BarChartProps, BreadcrumbsProps, ButtonConfig, ButtonProps, CalendarDateClickInfo, CalendarDateSelectInfo, CalendarEvent, CalendarEventClickInfo, CalendarEventDropInfo, CalendarEventResizeInfo, CalendarHeaderToolbar, CalendarProps, CalendarView, CardProps, CheckboxProps, CircularAvatarProps, ConfirmDialogProps, ConfirmDialogType, DataTableProps, DensitySelectorProps, DialogButtonProps, DialogProps, DropdownMenuItemProps, DropdownMenuProps, EditableDataTableProps, EventStats, FileUploadProps, FloatingContainerProps, FormActionsProps, HelpDocsAction, HelpDocsConfig, IconComponent, IconProps, IconsType, LineChartProps, MultiCheckboxProps, OtpInputProps, PageContentProps, PasswordFieldProps, PieChartProps, PreviewFilesProps, ProgressCardProps, RadioGroupProps, RecurringEventConfig, SearchBarProps, SelectProps, Severity, SideMenuItemProps, SidePanelProps, SingleSelectProps, SnackbarProps, SquareAvatarProps, StatusCardProps, SubMenuItemProps, SwitchProps, TableColumnsSelectorProps, TabsContainerProps, TextFieldProps, TimelineItems, TimelineProps, TooltipContentProps, TooltipProps, TypographyProps, UploadDialogProps };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@campxdev/react-blueprint",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.4",
|
|
4
4
|
"description": "React UI component library for CampX applications",
|
|
5
5
|
"author": "CampX",
|
|
6
6
|
"license": "MIT",
|
|
@@ -48,6 +48,11 @@
|
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@emotion/react": "^11.14.0",
|
|
50
50
|
"@emotion/styled": "^11.14.0",
|
|
51
|
+
"@fullcalendar/core": "^6.1.18",
|
|
52
|
+
"@fullcalendar/daygrid": "^6.1.18",
|
|
53
|
+
"@fullcalendar/interaction": "^6.1.18",
|
|
54
|
+
"@fullcalendar/react": "^6.1.18",
|
|
55
|
+
"@fullcalendar/timegrid": "^6.1.18",
|
|
51
56
|
"@hookform/resolvers": "^2.9.10",
|
|
52
57
|
"@mui/icons-material": "^7.0.2",
|
|
53
58
|
"@mui/lab": "^7.0.0-beta.11",
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import dayGridPlugin from '@fullcalendar/daygrid';
|
|
2
|
+
import interactionPlugin from '@fullcalendar/interaction';
|
|
3
|
+
import FullCalendar from '@fullcalendar/react';
|
|
4
|
+
import timeGridPlugin from '@fullcalendar/timegrid';
|
|
5
|
+
import React, { useCallback } from 'react';
|
|
6
|
+
|
|
7
|
+
import { StyledCalendarContainer, StyledCalendarWrapper } from './styles';
|
|
8
|
+
import { CalendarProps } from './types';
|
|
9
|
+
|
|
10
|
+
export const Calendar: React.FC<CalendarProps> = ({
|
|
11
|
+
events = [],
|
|
12
|
+
|
|
13
|
+
// Event handlers
|
|
14
|
+
onEventClick,
|
|
15
|
+
onEventDrop,
|
|
16
|
+
onEventResize,
|
|
17
|
+
onDateClick,
|
|
18
|
+
onDateSelect,
|
|
19
|
+
onEventsSet,
|
|
20
|
+
|
|
21
|
+
// View configuration
|
|
22
|
+
initialView = 'dayGridMonth',
|
|
23
|
+
views,
|
|
24
|
+
headerToolbar = {
|
|
25
|
+
left: 'prev,next today',
|
|
26
|
+
center: 'title',
|
|
27
|
+
right: 'dayGridMonth,timeGridWeek,timeGridDay',
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
// Calendar behavior
|
|
31
|
+
editable = false,
|
|
32
|
+
selectable = false,
|
|
33
|
+
selectMirror = true,
|
|
34
|
+
eventResizable = false,
|
|
35
|
+
eventDraggable = false,
|
|
36
|
+
dayMaxEvents = true,
|
|
37
|
+
|
|
38
|
+
// Styling & layout
|
|
39
|
+
height = 'auto',
|
|
40
|
+
aspectRatio,
|
|
41
|
+
containerProps,
|
|
42
|
+
|
|
43
|
+
// Localization
|
|
44
|
+
locale = 'en',
|
|
45
|
+
timezone = 'local',
|
|
46
|
+
firstDayOfWeek = 0,
|
|
47
|
+
|
|
48
|
+
// Custom rendering
|
|
49
|
+
eventContent,
|
|
50
|
+
dayCellContent,
|
|
51
|
+
|
|
52
|
+
// Navigation
|
|
53
|
+
showNavigationButtons = true,
|
|
54
|
+
showViewSwitcher = true,
|
|
55
|
+
showToday = true,
|
|
56
|
+
|
|
57
|
+
// Advanced
|
|
58
|
+
weekends = true,
|
|
59
|
+
businessHours,
|
|
60
|
+
eventConstraint,
|
|
61
|
+
selectConstraint,
|
|
62
|
+
}) => {
|
|
63
|
+
// Event handlers
|
|
64
|
+
const handleEventClick = useCallback(
|
|
65
|
+
(clickInfo: any) => {
|
|
66
|
+
// Prevent DOM selector errors
|
|
67
|
+
if (clickInfo.jsEvent) {
|
|
68
|
+
clickInfo.jsEvent.preventDefault();
|
|
69
|
+
clickInfo.jsEvent.stopPropagation();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
onEventClick?.(clickInfo);
|
|
73
|
+
},
|
|
74
|
+
[onEventClick],
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const handleEventDrop = useCallback(
|
|
78
|
+
(dropInfo: any) => {
|
|
79
|
+
onEventDrop?.(dropInfo);
|
|
80
|
+
},
|
|
81
|
+
[onEventDrop],
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const handleEventResize = useCallback(
|
|
85
|
+
(resizeInfo: any) => {
|
|
86
|
+
onEventResize?.(resizeInfo);
|
|
87
|
+
},
|
|
88
|
+
[onEventResize],
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
const handleDateClick = useCallback(
|
|
92
|
+
(clickInfo: any) => {
|
|
93
|
+
onDateClick?.(clickInfo);
|
|
94
|
+
},
|
|
95
|
+
[onDateClick],
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const handleDateSelect = useCallback(
|
|
99
|
+
(selectInfo: any) => {
|
|
100
|
+
onDateSelect?.(selectInfo);
|
|
101
|
+
},
|
|
102
|
+
[onDateSelect],
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
const handleEventsSet = useCallback(
|
|
106
|
+
(events: any) => {
|
|
107
|
+
onEventsSet?.(events);
|
|
108
|
+
},
|
|
109
|
+
[onEventsSet],
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
// Build header toolbar configuration
|
|
113
|
+
const getHeaderToolbar = () => {
|
|
114
|
+
if (headerToolbar === false) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const defaultToolbar = {
|
|
119
|
+
left: 'prev,next today',
|
|
120
|
+
center: 'title',
|
|
121
|
+
right: 'dayGridMonth,timeGridWeek,timeGridDay',
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
if (typeof headerToolbar === 'object') {
|
|
125
|
+
let left = headerToolbar.left || '';
|
|
126
|
+
let right = headerToolbar.right || '';
|
|
127
|
+
|
|
128
|
+
// Filter based on props
|
|
129
|
+
if (!showNavigationButtons) {
|
|
130
|
+
left = left.replace(/prev,next,?|,?prev,next/, '');
|
|
131
|
+
}
|
|
132
|
+
if (!showToday) {
|
|
133
|
+
left = left.replace(/today,?|,?today/, '');
|
|
134
|
+
}
|
|
135
|
+
if (!showViewSwitcher) {
|
|
136
|
+
right = '';
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Clean up extra commas
|
|
140
|
+
left = left.replace(/^,+|,+$/g, '').replace(/,+/g, ',');
|
|
141
|
+
right = right.replace(/^,+|,+$/g, '').replace(/,+/g, ',');
|
|
142
|
+
|
|
143
|
+
return {
|
|
144
|
+
...headerToolbar,
|
|
145
|
+
left,
|
|
146
|
+
right,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return defaultToolbar;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
// Get available views
|
|
154
|
+
const getViews = () => {
|
|
155
|
+
if (views && views.length > 0) {
|
|
156
|
+
return views.reduce((acc: any, view) => {
|
|
157
|
+
acc[view] = { buttonText: getViewButtonText(view) };
|
|
158
|
+
return acc;
|
|
159
|
+
}, {});
|
|
160
|
+
}
|
|
161
|
+
return undefined;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const getViewButtonText = (view: string) => {
|
|
165
|
+
const viewTexts: { [key: string]: string } = {
|
|
166
|
+
dayGridMonth: 'Month',
|
|
167
|
+
timeGridWeek: 'Week',
|
|
168
|
+
timeGridDay: 'Day',
|
|
169
|
+
listWeek: 'List',
|
|
170
|
+
};
|
|
171
|
+
return viewTexts[view] || view;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
// Process events to ensure they're in the correct format
|
|
175
|
+
const processedEvents = events.map((event) => ({
|
|
176
|
+
...event,
|
|
177
|
+
id: String(event.id), // FullCalendar prefers string IDs
|
|
178
|
+
}));
|
|
179
|
+
|
|
180
|
+
return (
|
|
181
|
+
<StyledCalendarContainer
|
|
182
|
+
height={height as any}
|
|
183
|
+
aspectRatio={aspectRatio}
|
|
184
|
+
{...containerProps}
|
|
185
|
+
>
|
|
186
|
+
<StyledCalendarWrapper>
|
|
187
|
+
<FullCalendar
|
|
188
|
+
plugins={[dayGridPlugin, timeGridPlugin, interactionPlugin]}
|
|
189
|
+
// View configuration
|
|
190
|
+
initialView={initialView}
|
|
191
|
+
views={getViews()}
|
|
192
|
+
headerToolbar={getHeaderToolbar()}
|
|
193
|
+
// Events
|
|
194
|
+
events={processedEvents}
|
|
195
|
+
// Event handlers
|
|
196
|
+
eventClick={handleEventClick}
|
|
197
|
+
eventDrop={editable ? handleEventDrop : undefined}
|
|
198
|
+
eventResize={editable ? handleEventResize : undefined}
|
|
199
|
+
dateClick={handleDateClick}
|
|
200
|
+
select={selectable ? handleDateSelect : undefined}
|
|
201
|
+
eventsSet={handleEventsSet}
|
|
202
|
+
// Calendar behavior
|
|
203
|
+
editable={editable}
|
|
204
|
+
selectable={selectable}
|
|
205
|
+
selectMirror={selectMirror}
|
|
206
|
+
dayMaxEvents={dayMaxEvents}
|
|
207
|
+
weekends={weekends}
|
|
208
|
+
// Event interaction
|
|
209
|
+
eventResizableFromStart={eventResizable}
|
|
210
|
+
eventDurationEditable={eventResizable}
|
|
211
|
+
eventStartEditable={eventDraggable}
|
|
212
|
+
// Localization
|
|
213
|
+
locale={locale}
|
|
214
|
+
timeZone={timezone}
|
|
215
|
+
firstDay={firstDayOfWeek}
|
|
216
|
+
// Custom rendering
|
|
217
|
+
eventContent={eventContent}
|
|
218
|
+
dayCellContent={dayCellContent}
|
|
219
|
+
// Advanced configuration
|
|
220
|
+
businessHours={businessHours}
|
|
221
|
+
eventConstraint={eventConstraint}
|
|
222
|
+
selectConstraint={selectConstraint}
|
|
223
|
+
// Height and sizing
|
|
224
|
+
height={typeof height === 'string' ? height : `${height}px`}
|
|
225
|
+
aspectRatio={aspectRatio}
|
|
226
|
+
// Additional FullCalendar props
|
|
227
|
+
nowIndicator={true}
|
|
228
|
+
navLinks={true}
|
|
229
|
+
dayHeaders={true}
|
|
230
|
+
weekNumbers={false}
|
|
231
|
+
// Event display
|
|
232
|
+
displayEventTime={true}
|
|
233
|
+
displayEventEnd={false}
|
|
234
|
+
// Selection
|
|
235
|
+
unselectAuto={true}
|
|
236
|
+
unselectCancel=""
|
|
237
|
+
/>
|
|
238
|
+
</StyledCalendarWrapper>
|
|
239
|
+
</StyledCalendarContainer>
|
|
240
|
+
);
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
Calendar.displayName = 'Calendar';
|