@arkyn/components 3.0.1-beta.145 → 3.0.1-beta.147

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.
Files changed (75) hide show
  1. package/dist/bundle.css +1 -1
  2. package/dist/bundle.js +885 -341
  3. package/dist/components/fullCalendar/_fullCalendarProvider.d.ts +43 -0
  4. package/dist/components/fullCalendar/_fullCalendarProvider.d.ts.map +1 -0
  5. package/dist/components/fullCalendar/_fullCalendarProvider.js +35 -0
  6. package/dist/components/fullCalendar/_viewService.d.ts +28 -0
  7. package/dist/components/fullCalendar/_viewService.d.ts.map +1 -0
  8. package/dist/components/fullCalendar/_viewService.js +144 -0
  9. package/dist/components/fullCalendar/dayCalendar/dayCalendarContainer/index.d.ts +8 -0
  10. package/dist/components/fullCalendar/dayCalendar/dayCalendarContainer/index.d.ts.map +1 -0
  11. package/dist/components/fullCalendar/dayCalendar/dayCalendarContainer/index.js +6 -0
  12. package/dist/components/fullCalendar/dayCalendar/dayCalendarEvent/index.d.ts +7 -0
  13. package/dist/components/fullCalendar/dayCalendar/dayCalendarEvent/index.d.ts.map +1 -0
  14. package/dist/components/fullCalendar/dayCalendar/dayCalendarEvent/index.js +105 -0
  15. package/dist/components/fullCalendar/dayCalendar/dayCalendarRow/index.d.ts +8 -0
  16. package/dist/components/fullCalendar/dayCalendar/dayCalendarRow/index.d.ts.map +1 -0
  17. package/dist/components/fullCalendar/dayCalendar/dayCalendarRow/index.js +24 -0
  18. package/dist/components/fullCalendar/dayCalendar/index.d.ts +3 -0
  19. package/dist/components/fullCalendar/dayCalendar/index.d.ts.map +1 -0
  20. package/dist/components/fullCalendar/dayCalendar/index.js +9 -0
  21. package/dist/components/fullCalendar/fullCalendarContainer/index.d.ts +8 -0
  22. package/dist/components/fullCalendar/fullCalendarContainer/index.d.ts.map +1 -0
  23. package/dist/components/fullCalendar/fullCalendarContainer/index.js +6 -0
  24. package/dist/components/fullCalendar/fullCalendarHeader/index.d.ts +8 -0
  25. package/dist/components/fullCalendar/fullCalendarHeader/index.d.ts.map +1 -0
  26. package/dist/components/fullCalendar/fullCalendarHeader/index.js +37 -0
  27. package/dist/components/fullCalendar/index.d.ts +92 -0
  28. package/dist/components/fullCalendar/index.d.ts.map +1 -0
  29. package/dist/components/fullCalendar/index.js +52 -0
  30. package/dist/components/fullCalendar/monthlyCalendar/index.d.ts +3 -0
  31. package/dist/components/fullCalendar/monthlyCalendar/index.d.ts.map +1 -0
  32. package/dist/components/fullCalendar/monthlyCalendar/index.js +8 -0
  33. package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarEvent/index.d.ts +9 -0
  34. package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarEvent/index.d.ts.map +1 -0
  35. package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarEvent/index.js +29 -0
  36. package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarTableBody/index.d.ts +4 -0
  37. package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarTableBody/index.d.ts.map +1 -0
  38. package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarTableBody/index.js +9 -0
  39. package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarTableContainer/index.d.ts +8 -0
  40. package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarTableContainer/index.d.ts.map +1 -0
  41. package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarTableContainer/index.js +6 -0
  42. package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarTableHeader/index.d.ts +4 -0
  43. package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarTableHeader/index.d.ts.map +1 -0
  44. package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarTableHeader/index.js +9 -0
  45. package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarTableTd/index.d.ts +10 -0
  46. package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarTableTd/index.d.ts.map +1 -0
  47. package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarTableTd/index.js +30 -0
  48. package/dist/components/fullCalendar/weekCalendar/index.d.ts +3 -0
  49. package/dist/components/fullCalendar/weekCalendar/index.d.ts.map +1 -0
  50. package/dist/components/fullCalendar/weekCalendar/index.js +8 -0
  51. package/dist/components/fullCalendar/weekCalendar/weekCalendarEvent/index.d.ts +10 -0
  52. package/dist/components/fullCalendar/weekCalendar/weekCalendarEvent/index.d.ts.map +1 -0
  53. package/dist/components/fullCalendar/weekCalendar/weekCalendarEvent/index.js +102 -0
  54. package/dist/components/fullCalendar/weekCalendar/weekCalendarTableBody/index.d.ts +4 -0
  55. package/dist/components/fullCalendar/weekCalendar/weekCalendarTableBody/index.d.ts.map +1 -0
  56. package/dist/components/fullCalendar/weekCalendar/weekCalendarTableBody/index.js +11 -0
  57. package/dist/components/fullCalendar/weekCalendar/weekCalendarTableContainer/index.d.ts +8 -0
  58. package/dist/components/fullCalendar/weekCalendar/weekCalendarTableContainer/index.d.ts.map +1 -0
  59. package/dist/components/fullCalendar/weekCalendar/weekCalendarTableContainer/index.js +6 -0
  60. package/dist/components/fullCalendar/weekCalendar/weekCalendarTableHeader/index.d.ts +4 -0
  61. package/dist/components/fullCalendar/weekCalendar/weekCalendarTableHeader/index.d.ts.map +1 -0
  62. package/dist/components/fullCalendar/weekCalendar/weekCalendarTableHeader/index.js +10 -0
  63. package/dist/components/fullCalendar/weekCalendar/weekCalendarTableTd/index.d.ts +11 -0
  64. package/dist/components/fullCalendar/weekCalendar/weekCalendarTableTd/index.d.ts.map +1 -0
  65. package/dist/components/fullCalendar/weekCalendar/weekCalendarTableTd/index.js +25 -0
  66. package/dist/components/imageUpload/index.js +1 -1
  67. package/dist/components/input/index.d.ts.map +1 -1
  68. package/dist/components/multiSelect/index.js +1 -1
  69. package/dist/components/radio/radioGroup/index.js +1 -1
  70. package/dist/components/richText/index.js +1 -1
  71. package/dist/components/select/index.js +1 -1
  72. package/dist/index.d.ts +1 -0
  73. package/dist/index.d.ts.map +1 -1
  74. package/dist/index.js +1 -0
  75. package/package.json +7 -7
@@ -0,0 +1,43 @@
1
+ import { type ReactNode } from "react";
2
+ import { type FullCalendarMatrix, type FullCalendarWeekMatrix } from "./_viewService";
3
+ type FullCalendarEvent = {
4
+ initialDate: Date;
5
+ endDate?: Date;
6
+ title: string;
7
+ data?: any;
8
+ scheme?: "primary" | "success" | "warning" | "danger" | "info";
9
+ onClick?: (data: any) => void;
10
+ };
11
+ type BlockTimestamp = {
12
+ initialDate: Date;
13
+ endDate: Date;
14
+ };
15
+ type FullCalendarContextProps = {
16
+ events: FullCalendarEvent[];
17
+ blockedTimestamps: BlockTimestamp[];
18
+ viewDate: Date;
19
+ listHours: number[];
20
+ listWeek: string[];
21
+ listMonthlyMatrix: FullCalendarMatrix;
22
+ listWeeklyMatrix: FullCalendarWeekMatrix;
23
+ nextMonth: () => void;
24
+ nextWeek: () => void;
25
+ nextDay: () => void;
26
+ previousMonth: () => void;
27
+ previousWeek: () => void;
28
+ previousDay: () => void;
29
+ onClickDate?: (date: Date) => void;
30
+ };
31
+ type FullCalendarProviderProps = {
32
+ events: FullCalendarEvent[];
33
+ blockedTimestamps: BlockTimestamp[];
34
+ children: ReactNode;
35
+ language?: string;
36
+ defaultValue?: Date;
37
+ onChangeView?: (date: Date) => void;
38
+ onClickDate?: (date: Date) => void;
39
+ };
40
+ declare function useFullCalendar(): FullCalendarContextProps;
41
+ declare function FullCalendarProvider(props: FullCalendarProviderProps): import("react/jsx-runtime").JSX.Element;
42
+ export { FullCalendarProvider, useFullCalendar };
43
+ //# sourceMappingURL=_fullCalendarProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_fullCalendarProvider.d.ts","sourceRoot":"","sources":["../../../src/components/fullCalendar/_fullCalendarProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC5B,MAAM,gBAAgB,CAAC;AAExB,KAAK,iBAAiB,GAAG;IACvB,WAAW,EAAE,IAAI,CAAC;IAClB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC/D,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;CAC/B,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,WAAW,EAAE,IAAI,CAAC;IAClB,OAAO,EAAE,IAAI,CAAC;CACf,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAC9B,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAC5B,iBAAiB,EAAE,cAAc,EAAE,CAAC;IACpC,QAAQ,EAAE,IAAI,CAAC;IACf,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,iBAAiB,EAAE,kBAAkB,CAAC;IACtC,gBAAgB,EAAE,sBAAsB,CAAC;IACzC,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;CACpC,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC/B,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAC5B,iBAAiB,EAAE,cAAc,EAAE,CAAC;IACpC,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACpC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;CACpC,CAAC;AAIF,iBAAS,eAAe,6BAEvB;AAED,iBAAS,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,2CAkC7D;AAED,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext, useState } from "react";
3
+ import { ViewService, } from "./_viewService";
4
+ const FullCalendarContext = createContext({});
5
+ function useFullCalendar() {
6
+ return useContext(FullCalendarContext);
7
+ }
8
+ function FullCalendarProvider(props) {
9
+ const language = props.language || "pt-BR";
10
+ const viewService = new ViewService();
11
+ const listHours = viewService.listHours([8, 18]);
12
+ const [viewDate, rawSetViewDate] = useState(props.defaultValue || new Date());
13
+ function setViewDate(date) {
14
+ if (props.onChangeView)
15
+ props.onChangeView(date);
16
+ rawSetViewDate(date);
17
+ }
18
+ return (_jsx(FullCalendarContext.Provider, { value: {
19
+ events: props.events,
20
+ blockedTimestamps: props.blockedTimestamps,
21
+ viewDate,
22
+ listHours,
23
+ listWeek: viewService.listWeek(viewDate, language),
24
+ listMonthlyMatrix: viewService.listMonthlyMatrix(viewDate),
25
+ listWeeklyMatrix: viewService.listWeeklyMatrix(viewDate, listHours),
26
+ nextMonth: () => viewService.nextMonth(viewDate, setViewDate),
27
+ nextWeek: () => viewService.nextWeek(viewDate, setViewDate),
28
+ nextDay: () => viewService.nextDay(viewDate, setViewDate),
29
+ previousMonth: () => viewService.previousMonth(viewDate, setViewDate),
30
+ previousWeek: () => viewService.previousWeek(viewDate, setViewDate),
31
+ previousDay: () => viewService.previousDay(viewDate, setViewDate),
32
+ onClickDate: props.onClickDate,
33
+ }, children: props.children }));
34
+ }
35
+ export { FullCalendarProvider, useFullCalendar };
@@ -0,0 +1,28 @@
1
+ type FullCalendarCell = {
2
+ day: number;
3
+ month: number;
4
+ year: number;
5
+ dayOwner: "previous" | "current" | "next";
6
+ };
7
+ type FullCalendarMatrix = FullCalendarCell[][];
8
+ type FullCalendarWeekCell = FullCalendarCell & {
9
+ timeInMinutes: number;
10
+ };
11
+ type FullCalendarWeekMatrix = FullCalendarWeekCell[][];
12
+ declare class ViewService {
13
+ capitalize(text: string): string;
14
+ listHours(range: [number, number]): number[];
15
+ formatHourLabel(timeInMinutes: number): string;
16
+ getStartOfWeek(viewDate: Date): Date;
17
+ listWeek(viewDate: Date, language: string): string[];
18
+ listWeeklyMatrix(viewDate: Date, hours: number[]): FullCalendarWeekMatrix;
19
+ listMonthlyMatrix(viewDate: Date): FullCalendarMatrix;
20
+ nextMonth(viewDate: Date, setViewDate: (date: Date) => void): void;
21
+ nextWeek(viewDate: Date, setViewDate: (date: Date) => void): void;
22
+ nextDay(viewDate: Date, setViewDate: (date: Date) => void): void;
23
+ previousMonth(viewDate: Date, setViewDate: (date: Date) => void): void;
24
+ previousWeek(viewDate: Date, setViewDate: (date: Date) => void): void;
25
+ previousDay(viewDate: Date, setViewDate: (date: Date) => void): void;
26
+ }
27
+ export { ViewService, type FullCalendarMatrix, type FullCalendarWeekMatrix };
28
+ //# sourceMappingURL=_viewService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_viewService.d.ts","sourceRoot":"","sources":["../../../src/components/fullCalendar/_viewService.ts"],"names":[],"mappings":"AAEA,KAAK,gBAAgB,GAAG;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;CAC3C,CAAC;AAEF,KAAK,kBAAkB,GAAG,gBAAgB,EAAE,EAAE,CAAC;AAC/C,KAAK,oBAAoB,GAAG,gBAAgB,GAAG;IAC7C,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,KAAK,sBAAsB,GAAG,oBAAoB,EAAE,EAAE,CAAC;AAEvD,cAAM,WAAW;IACf,UAAU,CAAC,IAAI,EAAE,MAAM;IAIvB,SAAS,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;IAejC,eAAe,CAAC,aAAa,EAAE,MAAM;IAOrC,cAAc,CAAC,QAAQ,EAAE,IAAI;IAQ7B,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM;IAgBzC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,sBAAsB;IAoCzE,iBAAiB,CAAC,QAAQ,EAAE,IAAI;IAwDhC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI;IAM3D,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI;IAM1D,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI;IAMzD,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI;IAM/D,YAAY,CAAC,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI;IAM9D,WAAW,CAAC,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI;CAK9D;AAED,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,KAAK,sBAAsB,EAAE,CAAC"}
@@ -0,0 +1,144 @@
1
+ import { formatToCapitalizeFirstWordLetter } from "@arkyn/shared";
2
+ class ViewService {
3
+ capitalize(text) {
4
+ return formatToCapitalizeFirstWordLetter(text);
5
+ }
6
+ listHours(range) {
7
+ const [startHour, endHour] = range;
8
+ const hours = [];
9
+ for (let timeInMinutes = startHour * 60; timeInMinutes <= endHour * 60; timeInMinutes += 30) {
10
+ hours.push(timeInMinutes);
11
+ }
12
+ return hours;
13
+ }
14
+ formatHourLabel(timeInMinutes) {
15
+ const hour = Math.floor(timeInMinutes / 60);
16
+ const minutes = timeInMinutes % 60;
17
+ return `${String(hour).padStart(2, "0")}:${String(minutes).padStart(2, "0")}`;
18
+ }
19
+ getStartOfWeek(viewDate) {
20
+ const firstDayOfWeek = new Date(viewDate);
21
+ firstDayOfWeek.setHours(0, 0, 0, 0);
22
+ firstDayOfWeek.setDate(firstDayOfWeek.getDate() - firstDayOfWeek.getDay());
23
+ return firstDayOfWeek;
24
+ }
25
+ listWeek(viewDate, language) {
26
+ const weekDays = [];
27
+ const firstDayOfWeek = this.getStartOfWeek(viewDate);
28
+ for (let i = 0; i < 7; i++) {
29
+ const day = new Date(firstDayOfWeek);
30
+ day.setDate(firstDayOfWeek.getDate() + i);
31
+ const dayName = day.toLocaleDateString(language, {
32
+ weekday: "short",
33
+ });
34
+ weekDays.push(dayName);
35
+ }
36
+ return weekDays;
37
+ }
38
+ listWeeklyMatrix(viewDate, hours) {
39
+ const firstDayOfWeek = this.getStartOfWeek(viewDate);
40
+ const viewMonth = viewDate.getMonth();
41
+ return hours.map((hour) => {
42
+ return Array.from({ length: 7 }, (_, index) => {
43
+ const cellDate = new Date(firstDayOfWeek);
44
+ cellDate.setDate(firstDayOfWeek.getDate() + index);
45
+ let dayOwner = "current";
46
+ if (cellDate.getMonth() < viewMonth ||
47
+ cellDate.getFullYear() < viewDate.getFullYear()) {
48
+ dayOwner = "previous";
49
+ }
50
+ if (cellDate.getMonth() > viewMonth ||
51
+ cellDate.getFullYear() > viewDate.getFullYear()) {
52
+ dayOwner = "next";
53
+ }
54
+ return {
55
+ day: cellDate.getDate(),
56
+ month: cellDate.getMonth(),
57
+ year: cellDate.getFullYear(),
58
+ dayOwner,
59
+ timeInMinutes: hour,
60
+ };
61
+ });
62
+ });
63
+ }
64
+ listMonthlyMatrix(viewDate) {
65
+ const year = viewDate.getFullYear();
66
+ const monthIndex = viewDate.getMonth();
67
+ const firstDayOfMonth = new Date(year, monthIndex, 1);
68
+ const firstWeekday = firstDayOfMonth.getDay();
69
+ const daysInCurrentMonth = new Date(year, monthIndex + 1, 0).getDate();
70
+ const daysInPreviousMonth = new Date(year, monthIndex, 0).getDate();
71
+ const totalCells = Math.ceil((firstWeekday + daysInCurrentMonth) / 7) * 7;
72
+ const weeks = [];
73
+ let currentMonthDay = 1;
74
+ let nextMonthDay = 1;
75
+ for (let i = 0; i < totalCells; i++) {
76
+ const weekIndex = Math.floor(i / 7);
77
+ if (!weeks[weekIndex])
78
+ weeks[weekIndex] = [];
79
+ if (i < firstWeekday) {
80
+ const day = daysInPreviousMonth - (firstWeekday - i - 1);
81
+ const month = monthIndex === 0 ? 11 : monthIndex - 1;
82
+ const cellYear = monthIndex === 0 ? year - 1 : year;
83
+ weeks[weekIndex].push({
84
+ day,
85
+ month,
86
+ year: cellYear,
87
+ dayOwner: "previous",
88
+ });
89
+ }
90
+ else if (currentMonthDay <= daysInCurrentMonth) {
91
+ weeks[weekIndex].push({
92
+ day: currentMonthDay,
93
+ month: monthIndex,
94
+ year: year,
95
+ dayOwner: "current",
96
+ });
97
+ currentMonthDay++;
98
+ }
99
+ else {
100
+ const month = monthIndex === 11 ? 0 : monthIndex + 1;
101
+ const cellYear = monthIndex === 11 ? year + 1 : year;
102
+ weeks[weekIndex].push({
103
+ day: nextMonthDay,
104
+ month,
105
+ year: cellYear,
106
+ dayOwner: "next",
107
+ });
108
+ nextMonthDay++;
109
+ }
110
+ }
111
+ return weeks;
112
+ }
113
+ nextMonth(viewDate, setViewDate) {
114
+ const nextViewDate = new Date(viewDate);
115
+ nextViewDate.setMonth(nextViewDate.getMonth() + 1);
116
+ setViewDate(nextViewDate);
117
+ }
118
+ nextWeek(viewDate, setViewDate) {
119
+ const nextViewDate = new Date(viewDate);
120
+ nextViewDate.setDate(nextViewDate.getDate() + 7);
121
+ setViewDate(nextViewDate);
122
+ }
123
+ nextDay(viewDate, setViewDate) {
124
+ const nextViewDate = new Date(viewDate);
125
+ nextViewDate.setDate(nextViewDate.getDate() + 1);
126
+ setViewDate(nextViewDate);
127
+ }
128
+ previousMonth(viewDate, setViewDate) {
129
+ const nextViewDate = new Date(viewDate);
130
+ nextViewDate.setMonth(nextViewDate.getMonth() - 1);
131
+ setViewDate(nextViewDate);
132
+ }
133
+ previousWeek(viewDate, setViewDate) {
134
+ const nextViewDate = new Date(viewDate);
135
+ nextViewDate.setDate(nextViewDate.getDate() - 7);
136
+ setViewDate(nextViewDate);
137
+ }
138
+ previousDay(viewDate, setViewDate) {
139
+ const nextViewDate = new Date(viewDate);
140
+ nextViewDate.setDate(nextViewDate.getDate() - 1);
141
+ setViewDate(nextViewDate);
142
+ }
143
+ }
144
+ export { ViewService };
@@ -0,0 +1,8 @@
1
+ import type { ReactNode } from "react";
2
+ import "./styles.css";
3
+ type DayCalendarContainerProps = {
4
+ children: ReactNode;
5
+ };
6
+ declare function DayCalendarContainer({ children }: DayCalendarContainerProps): import("react/jsx-runtime").JSX.Element;
7
+ export { DayCalendarContainer };
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/fullCalendar/dayCalendar/dayCalendarContainer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,cAAc,CAAC;AAEtB,KAAK,yBAAyB,GAAG;IAC/B,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,iBAAS,oBAAoB,CAAC,EAAE,QAAQ,EAAE,EAAE,yBAAyB,2CAEpE;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "./styles.css";
3
+ function DayCalendarContainer({ children }) {
4
+ return _jsx("div", { className: "arkynDayCalendarContainer", children: children });
5
+ }
6
+ export { DayCalendarContainer };
@@ -0,0 +1,7 @@
1
+ import "./styles.css";
2
+ type DayCalendarEventProps = {
3
+ timeInMinutes: number;
4
+ };
5
+ declare function DayCalendarEvent(props: DayCalendarEventProps): import("react/jsx-runtime").JSX.Element | import("react/jsx-runtime").JSX.Element[];
6
+ export { DayCalendarEvent };
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/fullCalendar/dayCalendar/dayCalendarEvent/index.tsx"],"names":[],"mappings":"AACA,OAAO,cAAc,CAAC;AAEtB,KAAK,qBAAqB,GAAG;IAC3B,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAKF,iBAAS,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,uFAoJrD;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,105 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useFullCalendar } from "../../_fullCalendarProvider";
3
+ import "./styles.css";
4
+ const SLOT_DURATION_MINUTES = 30;
5
+ const OVERLAP_OFFSET_PX = 205;
6
+ function DayCalendarEvent(props) {
7
+ const { events, viewDate } = useFullCalendar();
8
+ const day = viewDate.getDate();
9
+ const month = viewDate.getMonth();
10
+ const year = viewDate.getFullYear();
11
+ const dayEvents = events
12
+ .map((event, sourceIndex) => ({ event, sourceIndex }))
13
+ .filter(({ event }) => {
14
+ return (event.initialDate.getDate() === day &&
15
+ event.initialDate.getMonth() === month &&
16
+ event.initialDate.getFullYear() === year);
17
+ })
18
+ .sort((a, b) => {
19
+ const startA = a.event.initialDate.getTime();
20
+ const startB = b.event.initialDate.getTime();
21
+ if (startA !== startB)
22
+ return startA - startB;
23
+ const endA = a.event.endDate?.getTime() ?? startA + SLOT_DURATION_MINUTES * 60_000;
24
+ const endB = b.event.endDate?.getTime() ?? startB + SLOT_DURATION_MINUTES * 60_000;
25
+ if (endA !== endB)
26
+ return endA - endB;
27
+ return a.sourceIndex - b.sourceIndex;
28
+ });
29
+ const dayEventOrderBySourceIndex = new Map(dayEvents.map((item, orderIndex) => [item.sourceIndex, orderIndex]));
30
+ const filteredEvents = dayEvents.filter(({ event }) => {
31
+ const dayHour = Math.floor(props.timeInMinutes / 60);
32
+ const dayMinute = props.timeInMinutes % 60;
33
+ function isEventInInterval() {
34
+ const eventHour = event.initialDate.getHours();
35
+ const eventMinute = event.initialDate.getMinutes();
36
+ if (eventHour !== dayHour)
37
+ return false;
38
+ if (dayMinute === 0)
39
+ return eventMinute < 30 && eventMinute >= 0;
40
+ if (dayMinute === 30)
41
+ return eventMinute >= 30 && eventMinute < 60;
42
+ }
43
+ return (isEventInInterval() &&
44
+ event.initialDate.getDate() === day &&
45
+ event.initialDate.getMonth() === month &&
46
+ event.initialDate.getFullYear() === year);
47
+ });
48
+ if (filteredEvents.length === 0)
49
+ return _jsx(_Fragment, {});
50
+ function makeEventKey(index, sourceIndex) {
51
+ return `${day}-${month}-${year}-${sourceIndex}-${index}`;
52
+ }
53
+ function makeHour(date) {
54
+ const hours = date.getHours();
55
+ const minutes = date.getMinutes();
56
+ if (minutes === 0)
57
+ return `${hours}h`;
58
+ return `${hours}h${minutes}`;
59
+ }
60
+ function getEventRangeInMinutes(event) {
61
+ const startMinutes = event.initialDate.getHours() * 60 + event.initialDate.getMinutes();
62
+ const endMinutes = event.endDate
63
+ ? event.endDate.getHours() * 60 + event.endDate.getMinutes()
64
+ : startMinutes + SLOT_DURATION_MINUTES;
65
+ return {
66
+ startMinutes,
67
+ endMinutes: Math.max(endMinutes, startMinutes + 1),
68
+ };
69
+ }
70
+ function countOverlappingPreviousEvents(currentEvent, sourceIndex) {
71
+ const current = getEventRangeInMinutes(currentEvent);
72
+ const currentOrderIndex = dayEventOrderBySourceIndex.get(sourceIndex);
73
+ if (currentOrderIndex == null)
74
+ return 0;
75
+ return dayEvents.reduce((count, item, orderIndex) => {
76
+ if (orderIndex >= currentOrderIndex)
77
+ return count;
78
+ const candidate = getEventRangeInMinutes(item.event);
79
+ const intersects = candidate.startMinutes < current.endMinutes &&
80
+ candidate.endMinutes > current.startMinutes;
81
+ if (!intersects)
82
+ return count;
83
+ return count + 1;
84
+ }, 0);
85
+ }
86
+ function getEventStyle(event, sourceIndex) {
87
+ const { startMinutes, endMinutes } = getEventRangeInMinutes(event);
88
+ const startOffsetInCell = startMinutes - props.timeInMinutes;
89
+ const durationInMinutes = Math.max(endMinutes - startMinutes, 1);
90
+ const top = (startOffsetInCell / SLOT_DURATION_MINUTES) * 100;
91
+ const height = (durationInMinutes / SLOT_DURATION_MINUTES) * 100;
92
+ const overlapOffset = countOverlappingPreviousEvents(event, sourceIndex) * OVERLAP_OFFSET_PX;
93
+ return {
94
+ top: `${top}%`,
95
+ height: `${height}%`,
96
+ left: `${overlapOffset}px`,
97
+ };
98
+ }
99
+ function handleEventClick(event, eventData) {
100
+ event.stopPropagation();
101
+ eventData.onClick?.(eventData.data);
102
+ }
103
+ return filteredEvents.map(({ event, sourceIndex }, index) => (_jsxs("div", { className: `arkynDayCalendarEvent ${event?.scheme || "primary"}`, style: getEventStyle(event, sourceIndex), onClick: (e) => handleEventClick(e, event), children: [_jsxs("strong", { children: [makeHour(event.initialDate), " ", event?.endDate && `- ${makeHour(event.endDate)}`] }), _jsx("p", { children: event.title })] }, makeEventKey(index, sourceIndex))));
104
+ }
105
+ export { DayCalendarEvent };
@@ -0,0 +1,8 @@
1
+ import "./styles.css";
2
+ type DayCalendarRowProps = {
3
+ hour: number;
4
+ timeInMinutes: number;
5
+ };
6
+ declare function DayCalendarRow({ hour, timeInMinutes }: DayCalendarRowProps): import("react/jsx-runtime").JSX.Element;
7
+ export { DayCalendarRow, type DayCalendarRowProps };
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/fullCalendar/dayCalendar/dayCalendarRow/index.tsx"],"names":[],"mappings":"AAGA,OAAO,cAAc,CAAC;AAEtB,KAAK,mBAAmB,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,iBAAS,cAAc,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,mBAAmB,2CAmCnE;AAED,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useFullCalendar } from "../../_fullCalendarProvider";
3
+ import { ViewService } from "../../_viewService";
4
+ import { DayCalendarEvent } from "../dayCalendarEvent";
5
+ import "./styles.css";
6
+ function DayCalendarRow({ hour, timeInMinutes }) {
7
+ const viewService = new ViewService();
8
+ const { blockedTimestamps, viewDate, onClickDate } = useFullCalendar();
9
+ function isBlocked() {
10
+ return blockedTimestamps.some((timestamp) => viewDate >= timestamp.initialDate && viewDate <= timestamp.endDate);
11
+ }
12
+ function handleClick(event) {
13
+ event.stopPropagation();
14
+ if (isBlocked())
15
+ return;
16
+ if (onClickDate) {
17
+ const date = new Date(viewDate);
18
+ date.setHours(0, timeInMinutes, 0, 0);
19
+ onClickDate(date);
20
+ }
21
+ }
22
+ return (_jsxs("div", { className: `arkynDayCalendarRow ${isBlocked() ? "blocked" : ""}`, "data-time": timeInMinutes, onClick: handleClick, children: [_jsx("p", { children: viewService.formatHourLabel(hour) }), _jsx("div", { className: "arkynDayCalendarRowContent", children: _jsx(DayCalendarEvent, { timeInMinutes: timeInMinutes }) })] }));
23
+ }
24
+ export { DayCalendarRow };
@@ -0,0 +1,3 @@
1
+ declare function DayCalendar(): import("react/jsx-runtime").JSX.Element;
2
+ export { DayCalendar };
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/fullCalendar/dayCalendar/index.tsx"],"names":[],"mappings":"AAIA,iBAAS,WAAW,4CASnB;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useFullCalendar } from "../_fullCalendarProvider";
3
+ import { DayCalendarContainer } from "./dayCalendarContainer";
4
+ import { DayCalendarRow } from "./dayCalendarRow";
5
+ function DayCalendar() {
6
+ const { listHours } = useFullCalendar();
7
+ return (_jsx(DayCalendarContainer, { children: listHours.map((hour) => (_jsx(DayCalendarRow, { hour: hour, timeInMinutes: hour }))) }));
8
+ }
9
+ export { DayCalendar };
@@ -0,0 +1,8 @@
1
+ import type { ReactNode } from "react";
2
+ import "./styles.css";
3
+ type FullCalendarContainerProps = {
4
+ children?: ReactNode;
5
+ };
6
+ declare function FullCalendarContainer({ children }: FullCalendarContainerProps): import("react/jsx-runtime").JSX.Element;
7
+ export { FullCalendarContainer };
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/fullCalendar/fullCalendarContainer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,cAAc,CAAC;AAEtB,KAAK,0BAA0B,GAAG;IAChC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,iBAAS,qBAAqB,CAAC,EAAE,QAAQ,EAAE,EAAE,0BAA0B,2CAEtE;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "./styles.css";
3
+ function FullCalendarContainer({ children }) {
4
+ return _jsx("div", { className: "arkynFullCalendarContainer", children: children });
5
+ }
6
+ export { FullCalendarContainer };
@@ -0,0 +1,8 @@
1
+ import "./styles.css";
2
+ type FullCalendarHeaderProps = {
3
+ viewType: "day" | "week" | "month";
4
+ setViewType: (viewType: "day" | "week" | "month") => void;
5
+ };
6
+ declare function FullCalendarHeader(props: FullCalendarHeaderProps): import("react/jsx-runtime").JSX.Element;
7
+ export { FullCalendarHeader };
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/fullCalendar/fullCalendarHeader/index.tsx"],"names":[],"mappings":"AAOA,OAAO,cAAc,CAAC;AAEtB,KAAK,uBAAuB,GAAG;IAC7B,QAAQ,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;IACnC,WAAW,EAAE,CAAC,QAAQ,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,KAAK,IAAI,CAAC;CAC3D,CAAC;AAEF,iBAAS,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,2CA8DzD;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ChevronLeft, ChevronRight } from "lucide-react";
3
+ import { CardTabButton } from "../../cardTab/cardTabButton";
4
+ import { CardTabContainer } from "../../cardTab/cardTabContainer";
5
+ import { IconButton } from "../../iconButton";
6
+ import { useFullCalendar } from "../_fullCalendarProvider";
7
+ import "./styles.css";
8
+ function FullCalendarHeader(props) {
9
+ const { setViewType, viewType } = props;
10
+ const fullCalendar = useFullCalendar();
11
+ function handlePrevious() {
12
+ switch (viewType) {
13
+ case "day":
14
+ return fullCalendar.previousDay();
15
+ case "week":
16
+ return fullCalendar.previousWeek();
17
+ case "month":
18
+ return fullCalendar.previousMonth();
19
+ }
20
+ }
21
+ function handleNext() {
22
+ switch (viewType) {
23
+ case "day":
24
+ return fullCalendar.nextDay();
25
+ case "week":
26
+ return fullCalendar.nextWeek();
27
+ case "month":
28
+ return fullCalendar.nextMonth();
29
+ }
30
+ }
31
+ return (_jsxs("div", { className: "arkynFullCalendarHeader", children: [_jsxs(CardTabContainer, { defaultValue: viewType, onChange: (value) => setViewType(value), children: [_jsx(CardTabButton, { value: "day", children: "Dia" }), _jsx(CardTabButton, { value: "week", children: "Semana" }), _jsx(CardTabButton, { value: "month", children: "M\u00EAs" })] }), _jsxs("div", { className: "arkynFullCalendarHeaderActions", children: [_jsx(IconButton, { variant: "outline", icon: ChevronLeft, "aria-label": "Handle previous", onClick: () => handlePrevious() }), _jsx("p", { children: fullCalendar.viewDate.toLocaleDateString("pt-BR", {
32
+ day: "2-digit",
33
+ month: "long",
34
+ year: "numeric",
35
+ }) }), _jsx(IconButton, { variant: "outline", icon: ChevronRight, "aria-label": "Handle next", onClick: () => handleNext() })] })] }));
36
+ }
37
+ export { FullCalendarHeader };
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Represents a single event rendered on the calendar.
3
+ */
4
+ type FullCalendarEvent = {
5
+ /** Display label shown on the event block. */
6
+ title: string;
7
+ /** Start date and time of the event. */
8
+ initialDate: Date;
9
+ /** End date and time of the event. */
10
+ endDate?: Date;
11
+ /** Arbitrary payload forwarded to the `onClick` callback. */
12
+ data?: any;
13
+ /**
14
+ * Color scheme applied to the event block.
15
+ * - `primary`: default blue.
16
+ * - `success`: green.
17
+ * - `warning`: yellow.
18
+ * - `danger`: red.
19
+ * - `info`: light blue.
20
+ *
21
+ * @default "primary"
22
+ */
23
+ scheme?: "primary" | "success" | "warning" | "danger" | "info";
24
+ /** Callback fired when the user clicks the event. Receives `data` as argument. */
25
+ onClick?: (data: any) => void;
26
+ };
27
+ /**
28
+ * Represents a blocked (unavailable) time range on the calendar.
29
+ */
30
+ type BlockTimestamp = {
31
+ /** Start of the blocked range. */
32
+ initialDate: Date;
33
+ /** End of the blocked range. */
34
+ endDate: Date;
35
+ };
36
+ /**
37
+ * Props for the FullCalendar component.
38
+ */
39
+ type FullCalendarProps = {
40
+ /** Initial focused date when the calendar mounts. */
41
+ defaultValue?: Date;
42
+ /** List of events to display across day, week, and month views. */
43
+ events?: FullCalendarEvent[];
44
+ /** Time ranges that should be visually marked as unavailable. */
45
+ blockedTimestamps?: BlockTimestamp[];
46
+ /** Callback fired when the user navigates to a different period. */
47
+ onChangeView?: (date: Date) => void;
48
+ /** Callback fired when the user clicks a date cell. */
49
+ onClickDate?: (date: Date) => void;
50
+ };
51
+ /**
52
+ * Full-featured calendar component with day, week, and month views.
53
+ *
54
+ * Renders a switchable calendar that supports event display, blocked time
55
+ * ranges, and date navigation. Internal state and business logic are managed
56
+ * by `FullCalendarProvider`, keeping the public API minimal.
57
+ *
58
+ * @param props FullCalendar properties.
59
+ * @returns Calendar UI with a view switcher header and the active view grid.
60
+ *
61
+ * @example
62
+ * // Basic usage with events
63
+ * <FullCalendar
64
+ * defaultValue={new Date()}
65
+ * events={[
66
+ * {
67
+ * title: "Team standup",
68
+ * initialDate: new Date(2026, 5, 22, 9, 0),
69
+ * endDate: new Date(2026, 5, 22, 9, 30),
70
+ * scheme: "primary",
71
+ * onClick: (data) => console.log("Event clicked:", data),
72
+ * },
73
+ * ]}
74
+ * onChangeView={(date) => console.log("Viewing:", date)}
75
+ * onClickDate={(date) => console.log("Date clicked:", date)}
76
+ * />
77
+ *
78
+ * @example
79
+ * // With blocked timestamps
80
+ * <FullCalendar
81
+ * defaultValue={new Date()}
82
+ * blockedTimestamps={[
83
+ * {
84
+ * initialDate: new Date(2026, 5, 22, 12, 0),
85
+ * endDate: new Date(2026, 5, 22, 13, 0),
86
+ * },
87
+ * ]}
88
+ * />
89
+ */
90
+ declare function FullCalendar(props: FullCalendarProps): import("react/jsx-runtime").JSX.Element;
91
+ export { FullCalendar };
92
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/fullCalendar/index.tsx"],"names":[],"mappings":"AAQA;;GAEG;AACH,KAAK,iBAAiB,GAAG;IACvB,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,WAAW,EAAE,IAAI,CAAC;IAClB,sCAAsC;IACtC,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,6DAA6D;IAC7D,IAAI,CAAC,EAAE,GAAG,CAAC;IACX;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC/D,kFAAkF;IAClF,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;CAC/B,CAAC;AAEF;;GAEG;AACH,KAAK,cAAc,GAAG;IACpB,kCAAkC;IAClC,WAAW,EAAE,IAAI,CAAC;IAClB,gCAAgC;IAChC,OAAO,EAAE,IAAI,CAAC;CACf,CAAC;AAEF;;GAEG;AACH,KAAK,iBAAiB,GAAG;IACvB,qDAAqD;IACrD,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,mEAAmE;IACnE,MAAM,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC7B,iEAAiE;IACjE,iBAAiB,CAAC,EAAE,cAAc,EAAE,CAAC;IACrC,oEAAoE;IACpE,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACpC,uDAAuD;IACvD,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;CACpC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,iBAAS,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CAmB7C;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}