@arkyn/components 3.0.1-beta.154 → 3.0.1-beta.156
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/index.js +4694 -75
- package/dist/modules/components/alert/alertContainer/index.js +22 -0
- package/dist/modules/components/alert/alertContent/index.js +9 -0
- package/dist/modules/components/alert/alertDescription/index.js +9 -0
- package/dist/modules/components/alert/alertIcon/index.js +20 -0
- package/dist/modules/components/alert/alertTitle/index.js +9 -0
- package/dist/modules/components/audioPlayer/index.js +76 -0
- package/dist/modules/components/audioUpload/hasFileContent/index.js +63 -0
- package/dist/modules/components/audioUpload/index.js +80 -0
- package/dist/modules/components/audioUpload/noFileContent/index.js +46 -0
- package/dist/modules/components/badge/index.js +23 -0
- package/dist/modules/components/button/index.js +33 -0
- package/dist/modules/components/calendar/_calendarProvider.js +65 -0
- package/dist/modules/components/calendar/_viewService.js +141 -0
- package/dist/modules/components/calendar/calendarContainer/index.js +8 -0
- package/dist/modules/components/calendar/calendarHeader/index.js +73 -0
- package/dist/modules/components/calendar/calendarTableBody/index.js +11 -0
- package/dist/modules/components/calendar/calendarTableContainer/index.js +8 -0
- package/dist/modules/components/calendar/calendarTableHeader/index.js +11 -0
- package/dist/modules/components/calendar/calendarTableTd/index.js +24 -0
- package/dist/modules/components/calendar/index.js +50 -0
- package/dist/modules/components/cardTab/cardTabButton/index.js +30 -0
- package/dist/modules/components/cardTab/cardTabContainer/index.js +29 -0
- package/dist/modules/components/cardTab/cardTabContext.js +13 -0
- package/dist/modules/components/checkbox/index.js +65 -0
- package/dist/modules/components/clientOnly.js +9 -0
- package/dist/modules/components/currencyInput/index.js +140 -0
- package/dist/modules/components/divider/index.js +13 -0
- package/dist/modules/components/drawer/drawerContainer/index.js +44 -0
- package/dist/modules/components/drawer/drawerContext.js +13 -0
- package/dist/modules/components/drawer/drawerHeader/index.js +28 -0
- package/dist/modules/components/facebookPixel/facebookPixel.client.js +19 -0
- package/dist/modules/components/facebookPixel/index.js +9 -0
- package/dist/modules/components/facebookPixel/pixel.js +53 -0
- package/dist/modules/components/fieldError/index.js +9 -0
- package/dist/modules/components/fieldLabel/index.js +13 -0
- package/dist/modules/components/fieldWrapper/index.js +14 -0
- package/dist/modules/components/fileUpload/hasFileContent/index.js +68 -0
- package/dist/modules/components/fileUpload/index.js +73 -0
- package/dist/modules/components/fileUpload/noFileContent/index.js +46 -0
- package/dist/modules/components/fullCalendar/_fullCalendarProvider.js +48 -0
- package/dist/modules/components/fullCalendar/_viewService.js +106 -0
- package/dist/modules/components/fullCalendar/dayCalendar/dayCalendarContainer/index.js +8 -0
- package/dist/modules/components/fullCalendar/dayCalendar/dayCalendarEvent/index.js +79 -0
- package/dist/modules/components/fullCalendar/dayCalendar/dayCalendarRow/index.js +34 -0
- package/dist/modules/components/fullCalendar/dayCalendar/index.js +11 -0
- package/dist/modules/components/fullCalendar/fullCalendarContainer/index.js +8 -0
- package/dist/modules/components/fullCalendar/fullCalendarHeader/index.js +72 -0
- package/dist/modules/components/fullCalendar/index.js +31 -0
- package/dist/modules/components/fullCalendar/monthlyCalendar/index.js +13 -0
- package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarEvent/index.js +37 -0
- package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarTableBody/index.js +11 -0
- package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarTableContainer/index.js +10 -0
- package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarTableHeader/index.js +11 -0
- package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarTableTd/index.js +37 -0
- package/dist/modules/components/fullCalendar/weekCalendar/index.js +13 -0
- package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarEvent/index.js +79 -0
- package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarTableBody/index.js +21 -0
- package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarTableContainer/index.js +10 -0
- package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarTableHeader/index.js +20 -0
- package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarTableTd/index.js +40 -0
- package/dist/modules/components/googleAnalytics/googleAnalytics.client.js +8 -0
- package/dist/modules/components/googleAnalytics/googleAnalytics.js +18 -0
- package/dist/modules/components/googleAnalytics/index.js +10 -0
- package/dist/modules/components/googleAnalytics/snippets/generateGAElements.js +16 -0
- package/dist/modules/components/googleTagManager/googleTagManager.client.js +8 -0
- package/dist/modules/components/googleTagManager/googleTagManager.js +49 -0
- package/dist/modules/components/googleTagManager/index.js +28 -0
- package/dist/modules/components/googleTagManager/snippets/appendToDataLayer.js +9 -0
- package/dist/modules/components/googleTagManager/snippets/generateGTMElements.js +24 -0
- package/dist/modules/components/iconButton/index.js +30 -0
- package/dist/modules/components/imageUpload/hasFileContent/index.js +64 -0
- package/dist/modules/components/imageUpload/index.js +83 -0
- package/dist/modules/components/imageUpload/noFileContent/index.js +46 -0
- package/dist/modules/components/input/index.js +121 -0
- package/dist/modules/components/mapView/index.js +33 -0
- package/dist/modules/components/mapView/mapView.client.js +52 -0
- package/dist/modules/components/maskedInput/index.js +113 -0
- package/dist/modules/components/modal/modalContainer/index.js +43 -0
- package/dist/modules/components/modal/modalContext.js +13 -0
- package/dist/modules/components/modal/modalFooter/index.js +9 -0
- package/dist/modules/components/modal/modalHeader/index.js +28 -0
- package/dist/modules/components/multiSelect/index.js +155 -0
- package/dist/modules/components/multiSelect/multiSelectChevron/index.js +22 -0
- package/dist/modules/components/multiSelect/multiSelectContainer/index.js +30 -0
- package/dist/modules/components/multiSelect/multiSelectContent/index.js +9 -0
- package/dist/modules/components/multiSelect/multiSelectMark/index.js +23 -0
- package/dist/modules/components/multiSelect/multiSelectOption/index.js +14 -0
- package/dist/modules/components/multiSelect/multiSelectOptionsContainer/index.js +46 -0
- package/dist/modules/components/multiSelect/multiSelectOverlay/index.js +9 -0
- package/dist/modules/components/multiSelect/multiSelectSpinner/index.js +17 -0
- package/dist/modules/components/pagination/chevronButton/index.js +18 -0
- package/dist/modules/components/pagination/currentButton/index.js +8 -0
- package/dist/modules/components/pagination/index.js +84 -0
- package/dist/modules/components/pagination/pageButton/index.js +9 -0
- package/dist/modules/components/pagination/paginationService.js +49 -0
- package/dist/modules/components/pagination/spread/index.js +9 -0
- package/dist/modules/components/phoneInput/index.js +152 -0
- package/dist/modules/components/phoneInput/phoneInputContainer/index.js +20 -0
- package/dist/modules/components/phoneInput/phoneInputCountriesOverlay/index.js +9 -0
- package/dist/modules/components/phoneInput/phoneInputCountryOption/index.js +16 -0
- package/dist/modules/components/phoneInput/phoneInputCountryOptionsContainer/index.js +44 -0
- package/dist/modules/components/phoneInput/phoneInputCountrySelector/index.js +22 -0
- package/dist/modules/components/phoneInput/phoneInputMask/index.js +62 -0
- package/dist/modules/components/popover/index.js +37 -0
- package/dist/modules/components/radio/radioBox/index.js +43 -0
- package/dist/modules/components/radio/radioContext.js +20 -0
- package/dist/modules/components/radio/radioGroup/index.js +65 -0
- package/dist/modules/components/richText/blockButton/index.js +24 -0
- package/dist/modules/components/richText/element/index.js +59 -0
- package/dist/modules/components/richText/index.js +136 -0
- package/dist/modules/components/richText/insertImage/index.js +106 -0
- package/dist/modules/components/richText/insertVideo/index.js +98 -0
- package/dist/modules/components/richText/leaf/index.js +7 -0
- package/dist/modules/components/richText/markButton/index.js +23 -0
- package/dist/modules/components/richText/toolbar/index.js +8 -0
- package/dist/modules/components/searchPlaces.js +67 -0
- package/dist/modules/components/select/index.js +145 -0
- package/dist/modules/components/select/selectChevron/index.js +22 -0
- package/dist/modules/components/select/selectContainer/index.js +30 -0
- package/dist/modules/components/select/selectContent/index.js +9 -0
- package/dist/modules/components/select/selectOption/index.js +14 -0
- package/dist/modules/components/select/selectOptionsContainer/index.js +46 -0
- package/dist/modules/components/select/selectOverlay/index.js +9 -0
- package/dist/modules/components/select/selectSpinner/index.js +10 -0
- package/dist/modules/components/slider/index.js +42 -0
- package/dist/modules/components/switch/index.js +63 -0
- package/dist/modules/components/tab/tabButton/index.js +30 -0
- package/dist/modules/components/tab/tabContainer/index.js +29 -0
- package/dist/modules/components/tab/tabContext.js +13 -0
- package/dist/modules/components/table/tableBody/index.js +15 -0
- package/dist/modules/components/table/tableCaption/index.js +9 -0
- package/dist/modules/components/table/tableContainer/index.js +9 -0
- package/dist/modules/components/table/tableFooter/index.js +12 -0
- package/dist/modules/components/table/tableHeader/index.js +12 -0
- package/dist/modules/components/textarea/index.js +70 -0
- package/dist/modules/components/tooltip/index.js +46 -0
- package/dist/modules/hooks/useAutomation.js +28 -0
- package/dist/modules/hooks/useDrawer.js +20 -0
- package/dist/modules/hooks/useForm.js +8 -0
- package/dist/modules/hooks/useHydrated.js +15 -0
- package/dist/modules/hooks/useModal.js +20 -0
- package/dist/modules/hooks/useScopedParams.js +18 -0
- package/dist/modules/hooks/useScrollLock.js +21 -0
- package/dist/modules/hooks/useSearchAutomation.js +15 -0
- package/dist/modules/hooks/useSlider.js +14 -0
- package/dist/modules/hooks/useToast.js +11 -0
- package/dist/modules/index.js +144 -0
- package/dist/modules/providers/drawerProvider.js +31 -0
- package/dist/modules/providers/formProvider.js +18 -0
- package/dist/modules/providers/modalProvider.js +34 -0
- package/dist/modules/providers/placesProvider.js +18 -0
- package/dist/modules/providers/toastProvider.js +52 -0
- package/dist/modules/services/extractTextFromNode.js +7 -0
- package/dist/modules/services/fieldTemplate.js +24 -0
- package/dist/modules/services/iconRenderer.js +8 -0
- package/dist/modules/services/isBlockActive.js +15 -0
- package/dist/modules/services/isMarkActive.js +8 -0
- package/dist/modules/services/maskCurrencyValues.js +14 -0
- package/dist/modules/services/toHtml.js +7 -0
- package/dist/modules/services/toRichTextValue.js +9 -0
- package/dist/modules/services/toggleBlock.js +20 -0
- package/dist/modules/services/toggleMark.js +8 -0
- package/dist/modules/style.css +1 -0
- package/dist/modules/templates/badResponses.js +14 -0
- package/dist/modules/templates/richTextTemplates.js +14 -0
- package/dist/modules/templates/successResponses.js +4 -0
- package/dist/modules/utils/phoneInputUtilities.js +32 -0
- package/dist/modules/utils/richTextUtilities.js +77 -0
- package/package.json +208 -208
- package/dist/components/alert/alertContainer/index.js +0 -71
- package/dist/components/alert/alertContent/index.js +0 -26
- package/dist/components/alert/alertDescription/index.js +0 -25
- package/dist/components/alert/alertIcon/index.js +0 -43
- package/dist/components/alert/alertTitle/index.js +0 -27
- package/dist/components/audioPlayer/index.js +0 -112
- package/dist/components/audioUpload/hasFileContent/index.js +0 -26
- package/dist/components/audioUpload/index.js +0 -95
- package/dist/components/audioUpload/noFileContent/index.js +0 -29
- package/dist/components/badge/index.js +0 -41
- package/dist/components/button/index.js +0 -51
- package/dist/components/calendar/_calendarProvider.js +0 -58
- package/dist/components/calendar/_viewService.js +0 -179
- package/dist/components/calendar/calendarContainer/index.js +0 -6
- package/dist/components/calendar/calendarHeader/index.js +0 -13
- package/dist/components/calendar/calendarTableBody/index.js +0 -9
- package/dist/components/calendar/calendarTableContainer/index.js +0 -6
- package/dist/components/calendar/calendarTableHeader/index.js +0 -9
- package/dist/components/calendar/calendarTableTd/index.js +0 -15
- package/dist/components/calendar/index.js +0 -54
- package/dist/components/cardTab/cardTabButton/index.js +0 -40
- package/dist/components/cardTab/cardTabContainer/index.js +0 -42
- package/dist/components/cardTab/cardTabContext.js +0 -10
- package/dist/components/checkbox/index.js +0 -71
- package/dist/components/clientOnly.js +0 -31
- package/dist/components/currencyInput/index.js +0 -126
- package/dist/components/divider/index.js +0 -28
- package/dist/components/drawer/drawerContainer/index.js +0 -38
- package/dist/components/drawer/drawerContext.js +0 -10
- package/dist/components/drawer/drawerHeader/index.js +0 -33
- package/dist/components/facebookPixel/facebookPixel.client.js +0 -23
- package/dist/components/facebookPixel/index.js +0 -45
- package/dist/components/facebookPixel/pixel.js +0 -111
- package/dist/components/fieldError/index.js +0 -26
- package/dist/components/fieldLabel/index.js +0 -23
- package/dist/components/fieldWrapper/index.js +0 -27
- package/dist/components/fileUpload/hasFileContent/index.js +0 -34
- package/dist/components/fileUpload/index.js +0 -89
- package/dist/components/fileUpload/noFileContent/index.js +0 -29
- package/dist/components/fullCalendar/_fullCalendarProvider.js +0 -36
- package/dist/components/fullCalendar/_viewService.js +0 -144
- package/dist/components/fullCalendar/dayCalendar/dayCalendarContainer/index.js +0 -6
- package/dist/components/fullCalendar/dayCalendar/dayCalendarEvent/index.js +0 -105
- package/dist/components/fullCalendar/dayCalendar/dayCalendarRow/index.js +0 -24
- package/dist/components/fullCalendar/dayCalendar/index.js +0 -9
- package/dist/components/fullCalendar/fullCalendarContainer/index.js +0 -6
- package/dist/components/fullCalendar/fullCalendarHeader/index.js +0 -37
- package/dist/components/fullCalendar/index.js +0 -52
- package/dist/components/fullCalendar/monthlyCalendar/index.js +0 -8
- package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarEvent/index.js +0 -29
- package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarTableBody/index.js +0 -9
- package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarTableContainer/index.js +0 -6
- package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarTableHeader/index.js +0 -9
- package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarTableTd/index.js +0 -30
- package/dist/components/fullCalendar/weekCalendar/index.js +0 -8
- package/dist/components/fullCalendar/weekCalendar/weekCalendarEvent/index.js +0 -102
- package/dist/components/fullCalendar/weekCalendar/weekCalendarTableBody/index.js +0 -11
- package/dist/components/fullCalendar/weekCalendar/weekCalendarTableContainer/index.js +0 -6
- package/dist/components/fullCalendar/weekCalendar/weekCalendarTableHeader/index.js +0 -10
- package/dist/components/fullCalendar/weekCalendar/weekCalendarTableTd/index.js +0 -25
- package/dist/components/googleAnalytics/googleAnalytics.client.js +0 -8
- package/dist/components/googleAnalytics/googleAnalytics.js +0 -23
- package/dist/components/googleAnalytics/index.js +0 -31
- package/dist/components/googleAnalytics/snippets/generateGAElements.js +0 -16
- package/dist/components/googleTagManager/googleTagManager.client.js +0 -8
- package/dist/components/googleTagManager/googleTagManager.js +0 -52
- package/dist/components/googleTagManager/index.js +0 -47
- package/dist/components/googleTagManager/snippets/appendToDataLayer.js +0 -7
- package/dist/components/googleTagManager/snippets/generateGTMElements.js +0 -25
- package/dist/components/iconButton/index.js +0 -38
- package/dist/components/imageUpload/hasFileContent/index.js +0 -24
- package/dist/components/imageUpload/index.js +0 -101
- package/dist/components/imageUpload/noFileContent/index.js +0 -29
- package/dist/components/input/index.js +0 -94
- package/dist/components/mapView/index.js +0 -53
- package/dist/components/mapView/mapView.client.js +0 -51
- package/dist/components/maskedInput/index.js +0 -108
- package/dist/components/modal/modalContainer/index.js +0 -40
- package/dist/components/modal/modalContext.js +0 -10
- package/dist/components/modal/modalFooter/index.js +0 -32
- package/dist/components/modal/modalHeader/index.js +0 -34
- package/dist/components/multiSelect/index.js +0 -135
- package/dist/components/multiSelect/multiSelectChevron/index.js +0 -18
- package/dist/components/multiSelect/multiSelectContainer/index.js +0 -11
- package/dist/components/multiSelect/multiSelectContent/index.js +0 -8
- package/dist/components/multiSelect/multiSelectMark/index.js +0 -11
- package/dist/components/multiSelect/multiSelectOption/index.js +0 -10
- package/dist/components/multiSelect/multiSelectOptionsContainer/index.js +0 -44
- package/dist/components/multiSelect/multiSelectOverlay/index.js +0 -9
- package/dist/components/multiSelect/multiSelectSpinner/index.js +0 -10
- package/dist/components/pagination/chevronButton/index.js +0 -9
- package/dist/components/pagination/currentButton/index.js +0 -6
- package/dist/components/pagination/index.js +0 -46
- package/dist/components/pagination/pageButton/index.js +0 -7
- package/dist/components/pagination/paginationService.js +0 -62
- package/dist/components/pagination/spread/index.js +0 -7
- package/dist/components/phoneInput/index.js +0 -127
- package/dist/components/phoneInput/phoneInputContainer/index.js +0 -11
- package/dist/components/phoneInput/phoneInputCountriesOverlay/index.js +0 -9
- package/dist/components/phoneInput/phoneInputCountryOption/index.js +0 -10
- package/dist/components/phoneInput/phoneInputCountryOptionsContainer/index.js +0 -40
- package/dist/components/phoneInput/phoneInputCountrySelector/index.js +0 -9
- package/dist/components/phoneInput/phoneInputMask/index.js +0 -37
- package/dist/components/popover/index.js +0 -62
- package/dist/components/radio/radioBox/index.js +0 -48
- package/dist/components/radio/radioContext.js +0 -11
- package/dist/components/radio/radioGroup/index.js +0 -58
- package/dist/components/richText/blockButton/index.js +0 -18
- package/dist/components/richText/element/index.js +0 -26
- package/dist/components/richText/index.js +0 -136
- package/dist/components/richText/insertImage/index.js +0 -33
- package/dist/components/richText/insertVideo/index.js +0 -51
- package/dist/components/richText/leaf/index.js +0 -13
- package/dist/components/richText/markButton/index.js +0 -16
- package/dist/components/richText/toolbar/index.js +0 -6
- package/dist/components/searchPlaces.js +0 -99
- package/dist/components/select/index.js +0 -134
- package/dist/components/select/selectChevron/index.js +0 -18
- package/dist/components/select/selectContainer/index.js +0 -11
- package/dist/components/select/selectContent/index.js +0 -8
- package/dist/components/select/selectOption/index.js +0 -10
- package/dist/components/select/selectOptionsContainer/index.js +0 -44
- package/dist/components/select/selectOverlay/index.js +0 -9
- package/dist/components/select/selectSpinner/index.js +0 -10
- package/dist/components/slider/index.js +0 -79
- package/dist/components/switch/index.js +0 -66
- package/dist/components/tab/tabButton/index.js +0 -40
- package/dist/components/tab/tabContainer/index.js +0 -42
- package/dist/components/tab/tabContext.js +0 -10
- package/dist/components/table/tableBody/index.js +0 -34
- package/dist/components/table/tableCaption/index.js +0 -24
- package/dist/components/table/tableContainer/index.js +0 -37
- package/dist/components/table/tableFooter/index.js +0 -23
- package/dist/components/table/tableHeader/index.js +0 -25
- package/dist/components/textarea/index.js +0 -80
- package/dist/components/tooltip/index.js +0 -96
- package/dist/hooks/useAutomation.js +0 -74
- package/dist/hooks/useDrawer.js +0 -20
- package/dist/hooks/useForm.js +0 -35
- package/dist/hooks/useHydrated.js +0 -26
- package/dist/hooks/useModal.js +0 -20
- package/dist/hooks/useScopedParams.js +0 -55
- package/dist/hooks/useScrollLock.js +0 -46
- package/dist/hooks/useSearchAutomation.js +0 -64
- package/dist/hooks/useSlider.js +0 -35
- package/dist/hooks/useToast.js +0 -28
- package/dist/providers/drawerProvider.js +0 -54
- package/dist/providers/formProvider.js +0 -34
- package/dist/providers/modalProvider.js +0 -58
- package/dist/providers/placesProvider.js +0 -40
- package/dist/providers/toastProvider.js +0 -62
- package/dist/services/extractTextFromNode.js +0 -5
- package/dist/services/fieldTemplate.js +0 -11
- package/dist/services/iconRenderer.js +0 -13
- package/dist/services/isBlockActive.js +0 -14
- package/dist/services/isMarkActive.js +0 -6
- package/dist/services/maskCurrencyValues.js +0 -23
- package/dist/services/toHtml.js +0 -22
- package/dist/services/toRichTextValue.js +0 -34
- package/dist/services/toggleBlock.js +0 -32
- package/dist/services/toggleMark.js +0 -10
- package/dist/templates/badResponses.js +0 -12
- package/dist/templates/richTextTemplates.js +0 -12
- package/dist/templates/successResponses.js +0 -2
- package/dist/types/richTextTypes.js +0 -1
- package/dist/utils/phoneInputUtilities.js +0 -37
- package/dist/utils/richTextUtilities.js +0 -89
|
@@ -1,144 +0,0 @@
|
|
|
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 };
|
|
@@ -1,105 +0,0 @@
|
|
|
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 };
|
|
@@ -1,24 +0,0 @@
|
|
|
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 };
|
|
@@ -1,9 +0,0 @@
|
|
|
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 };
|
|
@@ -1,37 +0,0 @@
|
|
|
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 };
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import { FullCalendarProvider } from "./_fullCalendarProvider";
|
|
4
|
-
import { DayCalendar } from "./dayCalendar";
|
|
5
|
-
import { FullCalendarContainer } from "./fullCalendarContainer";
|
|
6
|
-
import { FullCalendarHeader } from "./fullCalendarHeader";
|
|
7
|
-
import { MonthlyCalendar } from "./monthlyCalendar";
|
|
8
|
-
import { WeekCalendar } from "./weekCalendar";
|
|
9
|
-
/**
|
|
10
|
-
* Full-featured calendar component with day, week, and month views.
|
|
11
|
-
*
|
|
12
|
-
* Renders a switchable calendar that supports event display, blocked time
|
|
13
|
-
* ranges, and date navigation. Internal state and business logic are managed
|
|
14
|
-
* by `FullCalendarProvider`, keeping the public API minimal.
|
|
15
|
-
*
|
|
16
|
-
* @param props FullCalendar properties.
|
|
17
|
-
* @returns Calendar UI with a view switcher header and the active view grid.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* // Basic usage with events
|
|
21
|
-
* <FullCalendar
|
|
22
|
-
* defaultValue={new Date()}
|
|
23
|
-
* events={[
|
|
24
|
-
* {
|
|
25
|
-
* title: "Team standup",
|
|
26
|
-
* initialDate: new Date(2026, 5, 22, 9, 0),
|
|
27
|
-
* endDate: new Date(2026, 5, 22, 9, 30),
|
|
28
|
-
* scheme: "primary",
|
|
29
|
-
* onClick: (data) => console.log("Event clicked:", data),
|
|
30
|
-
* },
|
|
31
|
-
* ]}
|
|
32
|
-
* onChangeView={(date) => console.log("Viewing:", date)}
|
|
33
|
-
* onClickDate={(date) => console.log("Date clicked:", date)}
|
|
34
|
-
* />
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* // With blocked timestamps
|
|
38
|
-
* <FullCalendar
|
|
39
|
-
* defaultValue={new Date()}
|
|
40
|
-
* blockedTimestamps={[
|
|
41
|
-
* {
|
|
42
|
-
* initialDate: new Date(2026, 5, 22, 12, 0),
|
|
43
|
-
* endDate: new Date(2026, 5, 22, 13, 0),
|
|
44
|
-
* },
|
|
45
|
-
* ]}
|
|
46
|
-
* />
|
|
47
|
-
*/
|
|
48
|
-
function FullCalendar(props) {
|
|
49
|
-
const [viewType, setViewType] = useState("month");
|
|
50
|
-
return (_jsx(FullCalendarProvider, { events: props.events || [], viewValue: props.viewValue, defaultViewValue: props.defaultViewValue, onChangeView: props.onChangeView, blockedTimestamps: props.blockedTimestamps || [], onClickDate: props.onClickDate, children: _jsxs(FullCalendarContainer, { children: [_jsx(FullCalendarHeader, { viewType: viewType, setViewType: setViewType }), viewType === "day" && _jsx(DayCalendar, {}), viewType === "month" && _jsx(MonthlyCalendar, {}), viewType === "week" && _jsx(WeekCalendar, {})] }) }));
|
|
51
|
-
}
|
|
52
|
-
export { FullCalendar };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { MonthlyCalendarTableBody } from "./monthlyCalendarTableBody";
|
|
3
|
-
import { MonthlyCalendarTableContainer } from "./monthlyCalendarTableContainer";
|
|
4
|
-
import { MonthlyCalendarTableHeader } from "./monthlyCalendarTableHeader";
|
|
5
|
-
function MonthlyCalendar() {
|
|
6
|
-
return (_jsxs(MonthlyCalendarTableContainer, { children: [_jsx(MonthlyCalendarTableHeader, {}), _jsx(MonthlyCalendarTableBody, {})] }));
|
|
7
|
-
}
|
|
8
|
-
export { MonthlyCalendar };
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
-
function MonthlyCalendarEvent(props) {
|
|
5
|
-
const { events } = useFullCalendar();
|
|
6
|
-
const filteredEvents = events.filter((event) => {
|
|
7
|
-
return (event.initialDate.getDate() === props.day &&
|
|
8
|
-
event.initialDate.getMonth() === props.month &&
|
|
9
|
-
event.initialDate.getFullYear() === props.year);
|
|
10
|
-
});
|
|
11
|
-
if (filteredEvents.length === 0)
|
|
12
|
-
return _jsx(_Fragment, {});
|
|
13
|
-
function makeEventKey(index) {
|
|
14
|
-
return `${props.day}-${props.month}-${props.year}-${index}`;
|
|
15
|
-
}
|
|
16
|
-
function makeHour(date) {
|
|
17
|
-
const hours = date.getHours();
|
|
18
|
-
const minutes = date.getMinutes();
|
|
19
|
-
if (minutes === 0)
|
|
20
|
-
return `${hours}h`;
|
|
21
|
-
return `${hours}h${minutes}`;
|
|
22
|
-
}
|
|
23
|
-
function handleEventClick(event, eventData) {
|
|
24
|
-
event.stopPropagation();
|
|
25
|
-
eventData.onClick?.(eventData.data);
|
|
26
|
-
}
|
|
27
|
-
return filteredEvents.map((event, index) => (_jsxs("div", { className: `arkynMonthlyCalendarEvent ${event?.scheme || "primary"}`, onClick: (e) => handleEventClick(e, event), children: [_jsxs("strong", { children: [makeHour(event.initialDate), " ", event?.endDate && `- ${makeHour(event.endDate)}`] }), _jsx("p", { children: event.title })] }, makeEventKey(index))));
|
|
28
|
-
}
|
|
29
|
-
export { MonthlyCalendarEvent };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useFullCalendar } from "../../_fullCalendarProvider";
|
|
3
|
-
import { MonthlyCalendarTableTd } from "../monthlyCalendarTableTd";
|
|
4
|
-
import "./styles.css";
|
|
5
|
-
function MonthlyCalendarTableBody() {
|
|
6
|
-
const fullCalendar = useFullCalendar();
|
|
7
|
-
return (_jsx("tbody", { className: "arkynMonthlyCalendarTableBody", children: fullCalendar.listMonthlyMatrix.map((week, weekIndex) => (_jsx("tr", { children: week.map((props, dayIndex) => (_jsx(MonthlyCalendarTableTd, { ...props }, dayIndex))) }, weekIndex))) }));
|
|
8
|
-
}
|
|
9
|
-
export { MonthlyCalendarTableBody };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import "./styles.css";
|
|
3
|
-
function MonthlyCalendarTableContainer({ children, }) {
|
|
4
|
-
return (_jsx("div", { className: "arkynMonthlyCalendarTableContainer", children: _jsx("table", { children: children }) }));
|
|
5
|
-
}
|
|
6
|
-
export { MonthlyCalendarTableContainer };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { formatToCapitalizeFirstWordLetter } from "@arkyn/shared";
|
|
3
|
-
import { useFullCalendar } from "../../_fullCalendarProvider";
|
|
4
|
-
import "./styles.css";
|
|
5
|
-
function MonthlyCalendarTableHeader() {
|
|
6
|
-
const { listWeek } = useFullCalendar();
|
|
7
|
-
return (_jsx("thead", { className: "arkynMonthlyCalendarTableHeader", children: _jsx("tr", { children: listWeek.map((day, index) => (_jsx("th", { children: formatToCapitalizeFirstWordLetter(day) }, index))) }) }));
|
|
8
|
-
}
|
|
9
|
-
export { MonthlyCalendarTableHeader };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useFullCalendar } from "../../_fullCalendarProvider";
|
|
3
|
-
import { MonthlyCalendarEvent } from "../monthlyCalendarEvent";
|
|
4
|
-
import "./styles.css";
|
|
5
|
-
function MonthlyCalendarTableTd(props) {
|
|
6
|
-
const { day, month, year, dayOwner } = props;
|
|
7
|
-
const { blockedTimestamps, onClickDate } = useFullCalendar();
|
|
8
|
-
function isToday() {
|
|
9
|
-
const today = new Date();
|
|
10
|
-
return (day === today.getDate() &&
|
|
11
|
-
month === today.getMonth() &&
|
|
12
|
-
year === today.getFullYear());
|
|
13
|
-
}
|
|
14
|
-
function isBlocked() {
|
|
15
|
-
const currentDate = new Date(year, month, day);
|
|
16
|
-
return blockedTimestamps.some((timestamp) => currentDate >= timestamp.initialDate &&
|
|
17
|
-
currentDate <= timestamp.endDate);
|
|
18
|
-
}
|
|
19
|
-
function handleClick(event) {
|
|
20
|
-
event.stopPropagation();
|
|
21
|
-
if (isBlocked())
|
|
22
|
-
return;
|
|
23
|
-
if (onClickDate) {
|
|
24
|
-
const date = new Date(year, month, day);
|
|
25
|
-
onClickDate(date);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return (_jsxs("td", { className: `arkynMonthlyCalendarTableTd ${dayOwner} ${isBlocked() ? "blocked" : ""}`, onClick: handleClick, children: [_jsx("p", { className: isToday() ? "today" : "", children: day }), _jsx("div", { className: "arkynMonthlyCalendarEventContainer", children: _jsx(MonthlyCalendarEvent, { day: day, month: month, year: year }) })] }));
|
|
29
|
-
}
|
|
30
|
-
export { MonthlyCalendarTableTd };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { WeekCalendarTableBody } from "./weekCalendarTableBody";
|
|
3
|
-
import { WeekCalendarTableContainer } from "./weekCalendarTableContainer";
|
|
4
|
-
import { WeekCalendarTableHeader } from "./weekCalendarTableHeader";
|
|
5
|
-
function WeekCalendar() {
|
|
6
|
-
return (_jsxs(WeekCalendarTableContainer, { children: [_jsx(WeekCalendarTableHeader, {}), _jsx(WeekCalendarTableBody, {})] }));
|
|
7
|
-
}
|
|
8
|
-
export { WeekCalendar };
|
|
@@ -1,102 +0,0 @@
|
|
|
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 = 40;
|
|
6
|
-
function WeekCalendarEvent(props) {
|
|
7
|
-
const { events } = useFullCalendar();
|
|
8
|
-
const dayEvents = events
|
|
9
|
-
.map((event, sourceIndex) => ({ event, sourceIndex }))
|
|
10
|
-
.filter(({ event }) => {
|
|
11
|
-
return (event.initialDate.getDate() === props.day &&
|
|
12
|
-
event.initialDate.getMonth() === props.month &&
|
|
13
|
-
event.initialDate.getFullYear() === props.year);
|
|
14
|
-
})
|
|
15
|
-
.sort((a, b) => {
|
|
16
|
-
const startA = a.event.initialDate.getTime();
|
|
17
|
-
const startB = b.event.initialDate.getTime();
|
|
18
|
-
if (startA !== startB)
|
|
19
|
-
return startA - startB;
|
|
20
|
-
const endA = a.event.endDate?.getTime() ?? startA + SLOT_DURATION_MINUTES * 60_000;
|
|
21
|
-
const endB = b.event.endDate?.getTime() ?? startB + SLOT_DURATION_MINUTES * 60_000;
|
|
22
|
-
if (endA !== endB)
|
|
23
|
-
return endA - endB;
|
|
24
|
-
return a.sourceIndex - b.sourceIndex;
|
|
25
|
-
});
|
|
26
|
-
const dayEventOrderBySourceIndex = new Map(dayEvents.map((item, orderIndex) => [item.sourceIndex, orderIndex]));
|
|
27
|
-
const filteredEvents = dayEvents.filter(({ event }) => {
|
|
28
|
-
const dayHour = Math.floor(props.timeInMinutes / 60);
|
|
29
|
-
const dayMinute = props.timeInMinutes % 60;
|
|
30
|
-
function isEventInInterval() {
|
|
31
|
-
const eventHour = event.initialDate.getHours();
|
|
32
|
-
const eventMinute = event.initialDate.getMinutes();
|
|
33
|
-
if (eventHour !== dayHour)
|
|
34
|
-
return false;
|
|
35
|
-
if (dayMinute === 0)
|
|
36
|
-
return eventMinute < 30 && eventMinute >= 0;
|
|
37
|
-
if (dayMinute === 30)
|
|
38
|
-
return eventMinute >= 30 && eventMinute < 60;
|
|
39
|
-
}
|
|
40
|
-
return (isEventInInterval() &&
|
|
41
|
-
event.initialDate.getDate() === props.day &&
|
|
42
|
-
event.initialDate.getMonth() === props.month &&
|
|
43
|
-
event.initialDate.getFullYear() === props.year);
|
|
44
|
-
});
|
|
45
|
-
if (filteredEvents.length === 0)
|
|
46
|
-
return _jsx(_Fragment, {});
|
|
47
|
-
function makeEventKey(index, sourceIndex) {
|
|
48
|
-
return `${props.day}-${props.month}-${props.year}-${sourceIndex}-${index}`;
|
|
49
|
-
}
|
|
50
|
-
function makeHour(date) {
|
|
51
|
-
const hours = date.getHours();
|
|
52
|
-
const minutes = date.getMinutes();
|
|
53
|
-
if (minutes === 0)
|
|
54
|
-
return `${hours}h`;
|
|
55
|
-
return `${hours}h${minutes}`;
|
|
56
|
-
}
|
|
57
|
-
function getEventRangeInMinutes(event) {
|
|
58
|
-
const startMinutes = event.initialDate.getHours() * 60 + event.initialDate.getMinutes();
|
|
59
|
-
const endMinutes = event.endDate
|
|
60
|
-
? event.endDate.getHours() * 60 + event.endDate.getMinutes()
|
|
61
|
-
: startMinutes + SLOT_DURATION_MINUTES;
|
|
62
|
-
return {
|
|
63
|
-
startMinutes,
|
|
64
|
-
endMinutes: Math.max(endMinutes, startMinutes + 1),
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
function countOverlappingPreviousEvents(currentEvent, sourceIndex) {
|
|
68
|
-
const current = getEventRangeInMinutes(currentEvent);
|
|
69
|
-
const currentOrderIndex = dayEventOrderBySourceIndex.get(sourceIndex);
|
|
70
|
-
if (currentOrderIndex == null)
|
|
71
|
-
return 0;
|
|
72
|
-
return dayEvents.reduce((count, item, orderIndex) => {
|
|
73
|
-
if (orderIndex >= currentOrderIndex)
|
|
74
|
-
return count;
|
|
75
|
-
const candidate = getEventRangeInMinutes(item.event);
|
|
76
|
-
const intersects = candidate.startMinutes < current.endMinutes &&
|
|
77
|
-
candidate.endMinutes > current.startMinutes;
|
|
78
|
-
if (!intersects)
|
|
79
|
-
return count;
|
|
80
|
-
return count + 1;
|
|
81
|
-
}, 0);
|
|
82
|
-
}
|
|
83
|
-
function getEventStyle(event, sourceIndex) {
|
|
84
|
-
const { startMinutes, endMinutes } = getEventRangeInMinutes(event);
|
|
85
|
-
const startOffsetInCell = startMinutes - props.timeInMinutes;
|
|
86
|
-
const durationInMinutes = Math.max(endMinutes - startMinutes, 1);
|
|
87
|
-
const top = (startOffsetInCell / SLOT_DURATION_MINUTES) * 100;
|
|
88
|
-
const height = (durationInMinutes / SLOT_DURATION_MINUTES) * 100;
|
|
89
|
-
const overlapOffset = countOverlappingPreviousEvents(event, sourceIndex) * OVERLAP_OFFSET_PX;
|
|
90
|
-
return {
|
|
91
|
-
top: `${top}%`,
|
|
92
|
-
height: `${height}%`,
|
|
93
|
-
left: `${overlapOffset}px`,
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
function handleEventClick(event, eventData) {
|
|
97
|
-
event.stopPropagation();
|
|
98
|
-
eventData.onClick?.(eventData.data);
|
|
99
|
-
}
|
|
100
|
-
return filteredEvents.map(({ event, sourceIndex }, index) => (_jsxs("div", { className: `arkynWeekCalendarEvent ${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))));
|
|
101
|
-
}
|
|
102
|
-
export { WeekCalendarEvent };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useFullCalendar } from "../../_fullCalendarProvider";
|
|
3
|
-
import { ViewService } from "../../_viewService";
|
|
4
|
-
import { WeekCalendarTableTd } from "../weekCalendarTableTd";
|
|
5
|
-
import "./styles.css";
|
|
6
|
-
function WeekCalendarTableBody() {
|
|
7
|
-
const fullCalendar = useFullCalendar();
|
|
8
|
-
const viewService = new ViewService();
|
|
9
|
-
return (_jsx("tbody", { className: "arkynWeekCalendarTableBody", children: fullCalendar.listWeeklyMatrix.map((hourRow) => (_jsxs("tr", { children: [_jsx("td", { className: "hourTd", children: _jsx("p", { children: viewService.formatHourLabel(hourRow[0].timeInMinutes) }) }), hourRow.map((cell, index) => (_jsx(WeekCalendarTableTd, { ...cell }, `${cell.year}-${cell.month}-${cell.day}-${cell.timeInMinutes}-${index}`)))] }, hourRow[0].timeInMinutes))) }));
|
|
10
|
-
}
|
|
11
|
-
export { WeekCalendarTableBody };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import "./styles.css";
|
|
3
|
-
function WeekCalendarTableContainer({ children, }) {
|
|
4
|
-
return (_jsx("div", { className: "arkynWeekCalendarTableContainer", children: _jsx("table", { children: children }) }));
|
|
5
|
-
}
|
|
6
|
-
export { WeekCalendarTableContainer };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { formatToCapitalizeFirstWordLetter } from "@arkyn/shared";
|
|
3
|
-
import { useFullCalendar } from "../../_fullCalendarProvider";
|
|
4
|
-
import "./styles.css";
|
|
5
|
-
function WeekCalendarTableHeader() {
|
|
6
|
-
const { listWeek, listWeeklyMatrix } = useFullCalendar();
|
|
7
|
-
const firstHourRow = listWeeklyMatrix[0] || [];
|
|
8
|
-
return (_jsx("thead", { className: "arkynWeekCalendarTableHeader", children: _jsxs("tr", { children: [_jsx("th", {}), listWeek.map((day, index) => (_jsx("th", { children: _jsxs("div", { className: "arkynWeekCalendarTableHeaderContent", children: [_jsx("span", { children: formatToCapitalizeFirstWordLetter(day) }), _jsx("strong", { children: firstHourRow[index]?.day })] }) }, index)))] }) }));
|
|
9
|
-
}
|
|
10
|
-
export { WeekCalendarTableHeader };
|