@chayns-components/date 5.0.0-beta.1253 → 5.0.0-beta.1255
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/lib/cjs/components/calendar/Calendar.js +3 -1
- package/lib/cjs/components/calendar/Calendar.js.map +1 -1
- package/lib/cjs/components/calendar/month-wrapper/MonthWrapper.js +6 -2
- package/lib/cjs/components/calendar/month-wrapper/MonthWrapper.js.map +1 -1
- package/lib/cjs/components/calendar/month-wrapper/month/Month.js +62 -32
- package/lib/cjs/components/calendar/month-wrapper/month/Month.js.map +1 -1
- package/lib/esm/components/calendar/Calendar.js +3 -1
- package/lib/esm/components/calendar/Calendar.js.map +1 -1
- package/lib/esm/components/calendar/month-wrapper/MonthWrapper.js +6 -2
- package/lib/esm/components/calendar/month-wrapper/MonthWrapper.js.map +1 -1
- package/lib/esm/components/calendar/month-wrapper/month/Month.js +59 -32
- package/lib/esm/components/calendar/month-wrapper/month/Month.js.map +1 -1
- package/lib/types/components/calendar/month-wrapper/MonthWrapper.d.ts +2 -0
- package/lib/types/components/calendar/month-wrapper/month/Month.d.ts +2 -0
- package/package.json +3 -3
|
@@ -280,7 +280,9 @@ const Calendar = ({
|
|
|
280
280
|
disabledDates: disabledDates,
|
|
281
281
|
setCurrentDate: setCurrentDate,
|
|
282
282
|
shouldShowHighlightsInMonthOverlay: shouldShowHighlightsInMonthOverlay,
|
|
283
|
-
showMonthYearPickers: showMonthYearPickers
|
|
283
|
+
showMonthYearPickers: showMonthYearPickers,
|
|
284
|
+
handleLeftArrowClick: handleLeftArrowClick,
|
|
285
|
+
handleRightArrowClick: handleRightArrowClick
|
|
284
286
|
}), ShouldShowRightArrow ? /*#__PURE__*/_react.default.createElement(_Calendar.StyledCalendarIconWrapper, {
|
|
285
287
|
onClick: handleRightArrowClick
|
|
286
288
|
}, /*#__PURE__*/_react.default.createElement(_Calendar.StyledCalendarIconWrapperContent, null, showMonthYearPickers && /*#__PURE__*/_react.default.createElement(_Calendar.StyledPseudoMonthYearPicker, null, /*#__PURE__*/_react.default.createElement(_core.ComboBox, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.js","names":["_core","require","_chaynsApi","_react","_interopRequireWildcard","_calendar","_calendar2","_date","_Calendar","_MonthWrapper","_interopRequireDefault","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","DEFAULT_MAX_DATE","addYears","Date","DEFAULT_MIN_DATE","subYears","Calendar","locale","Language","German","maxDate","minDate","highlightedDates","onChange","customThumbColors","selectedDate","selectedDates","selectedDateInterval","categories","isDisabled","type","CalendarType","Single","shouldShowHighlightsInMonthOverlay","disabledDates","showMonthYearPickers","showMonthYearPickersProp","onShownDatesChange","currentDate","setCurrentDate","useState","shouldRenderTwoMonths","setShouldRenderTwoMonths","internalSelectedDate","setInternalSelectedDate","Multiple","undefined","direction","setDirection","width","setWidth","useMemo","hasMultipleMonths","differenceInCalendarMonths","hasMultipleYears","getYearsBetween","length","calendarRef","useRef","useEffect","start","getFullYear","getMonth","end","bounds","isDisabledDate","some","disabledDate","isSameDay","isDateInBounds","isWithinInterval","console","warn","disabledSelectedDates","datesOutsideOfBounds","filteredDates","filter","date","push","Interval","intervalIncludesDisabledDate","intervalIsInBounds","current","resizeObserver","ResizeObserver","entries","observedWidth","contentRect","observe","disconnect","prevDate","isDateInRange","handleLeftArrowClick","useCallback","newDate","getNewDate","handleRightArrowClick","handleSelect","onChangePayload","newInternalSelectedDate","prevSelectedDates","d","prevSelectedDateInterval","updateInterval","newInterval","handleAnimationFinished","ShouldShowLeftArrow","isSameMonth","ShouldShowRightArrow","createElement","StyledCalendar","ref","$isDisabled","StyledCalendarIconWrapper","onClick","StyledCalendarIconWrapperContent","StyledPseudoMonthYearPicker","ComboBox","lists","list","placeholder","Icon","icons","StyledCalendarIconWrapperPseudo","shouldRenderTwo","onSelect","onAnimationFinished","displayName","_default","exports"],"sources":["../../../../src/components/calendar/Calendar.tsx"],"sourcesContent":["import { ComboBox, Icon } from '@chayns-components/core';\nimport { Language } from 'chayns-api';\nimport React, { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport {\n CalendarType,\n Categories,\n CustomThumbColors,\n DateInterval,\n HighlightedDates,\n} from '../../types/calendar';\nimport { getNewDate, getYearsBetween, isDateInRange } from '../../utils/calendar';\nimport {\n addYears,\n differenceInCalendarMonths,\n isSameDay,\n isSameMonth,\n isWithinInterval,\n subYears,\n} from '../../utils/date';\nimport {\n StyledCalendar,\n StyledCalendarIconWrapper,\n StyledCalendarIconWrapperContent,\n StyledCalendarIconWrapperPseudo,\n StyledPseudoMonthYearPicker,\n} from './Calendar.styles';\nimport MonthWrapper from './month-wrapper/MonthWrapper';\n\ninterface BaseProps {\n /**\n * An array to group dates into a category.\n */\n categories?: Categories[];\n /**\n * Custom colors for the thumb.\n */\n customThumbColors?: CustomThumbColors;\n /**\n * An array with dates and corresponding styles to highlight.\n */\n highlightedDates?: HighlightedDates[];\n /**\n * To disable the Calendar\n */\n isDisabled?: boolean;\n /**\n * The locale language to format the dates.\n */\n locale?: Language;\n /**\n * The maximum date that can be selected.\n */\n maxDate?: Date;\n /**\n * The minimum date that can be selected.\n */\n minDate?: Date;\n /**\n * An array of dates that should be disabled.\n */\n disabledDates?: Date[];\n /**\n * Whether the highlighted dates should be displayed for the greyed month overlay days.\n */\n shouldShowHighlightsInMonthOverlay?: boolean;\n /**\n * Shows the month and year pickers, if there are multiple months/years to select from.\n */\n showMonthYearPickers?: boolean;\n /**\n * Function to be executed when the selected date, dates or date interval change.\n * @param date\n */\n onChange?: (date: Date | Date[] | DateInterval) => void;\n /**\n * Function to be executed when the shown dates change. Returns the start of the displayed month and the end of the last displayed month (since depending on the available widths, there are one or two months displayed).\n @param { start: Date, end: Date }\n */\n onShownDatesChange?: (dates: { start: Date; end: Date }) => void;\n}\n\ninterface SingleSelectionProps {\n /**\n * The type of the calendar selection.\n */\n type?: CalendarType.Single;\n /**\n * A date that should be preselected.\n */\n selectedDate?: Date;\n selectedDates?: never;\n selectedDateInterval?: never;\n}\n\ninterface MultipleSelectionProps {\n /**\n * The type of the calendar selection.\n */\n type: CalendarType.Multiple;\n /**\n * An array of dates that should be preselected.\n */\n selectedDates?: Date[];\n selectedDate?: never;\n selectedDateInterval?: never;\n}\n\ninterface IntervalSelectionProps {\n /**\n * The type of the calendar selection.\n */\n type: CalendarType.Interval;\n /**\n * An interval that should be preselected.\n */\n selectedDateInterval?: DateInterval;\n selectedDates?: never;\n selectedDate?: never;\n}\n\nexport type CalendarProps = BaseProps &\n (SingleSelectionProps | MultipleSelectionProps | IntervalSelectionProps);\n\nconst DEFAULT_MAX_DATE = addYears(new Date(), 1);\nconst DEFAULT_MIN_DATE = subYears(new Date(), 1);\n\nconst Calendar: FC<CalendarProps> = ({\n locale = Language.German,\n maxDate = DEFAULT_MAX_DATE,\n minDate = DEFAULT_MIN_DATE,\n highlightedDates,\n onChange,\n customThumbColors,\n selectedDate,\n selectedDates,\n selectedDateInterval,\n categories,\n isDisabled,\n type = CalendarType.Single,\n shouldShowHighlightsInMonthOverlay = true,\n disabledDates = [],\n showMonthYearPickers: showMonthYearPickersProp,\n onShownDatesChange = () => {},\n}) => {\n const [currentDate, setCurrentDate] = useState<Date>();\n const [shouldRenderTwoMonths, setShouldRenderTwoMonths] = useState(true);\n const [internalSelectedDate, setInternalSelectedDate] = useState<\n Date | Date[] | DateInterval | undefined\n >(() => (type === CalendarType.Multiple ? [] : undefined));\n const [direction, setDirection] = useState<'left' | 'right' | undefined>();\n const [width, setWidth] = useState(0);\n\n const showMonthYearPickers = useMemo(() => {\n const hasMultipleMonths = differenceInCalendarMonths(maxDate, minDate) > 0;\n const hasMultipleYears = getYearsBetween(minDate, maxDate).length > 1;\n\n return !!(showMonthYearPickersProp && (hasMultipleMonths || hasMultipleYears));\n }, [minDate, maxDate, showMonthYearPickersProp]);\n\n const calendarRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (currentDate) {\n const start = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1);\n\n if (shouldRenderTwoMonths) {\n const end = new Date(currentDate.getFullYear(), currentDate.getMonth() + 2, 0);\n onShownDatesChange({\n start,\n end,\n });\n } else {\n const end = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0);\n onShownDatesChange({\n start,\n end,\n });\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [currentDate, shouldRenderTwoMonths]);\n\n useEffect(() => {\n const bounds = {\n start: minDate,\n end: maxDate,\n };\n if (type === CalendarType.Single) {\n if (selectedDate) {\n const isDisabledDate = disabledDates.some((disabledDate) =>\n isSameDay(selectedDate, disabledDate),\n );\n const isDateInBounds = isWithinInterval(selectedDate, bounds);\n\n if (!isDisabledDate && isDateInBounds) {\n setInternalSelectedDate(selectedDate);\n } else {\n console.warn(\n '[@chayns-components/date] Warning: Failed to set selectedDate, because it is disabled or out of bounds.',\n '\\nselectedDate:',\n selectedDate,\n ...(isDisabledDate ? ['\\nselectedDate is disabled'] : []),\n ...(isDateInBounds\n ? []\n : ['\\nselectedDate is outside of bounds:', { minDate, maxDate }]),\n );\n setInternalSelectedDate(() => undefined);\n }\n } else {\n setInternalSelectedDate(() => undefined);\n }\n } else if (type === CalendarType.Multiple) {\n if (selectedDates) {\n const disabledSelectedDates: Date[] = [];\n const datesOutsideOfBounds: Date[] = [];\n\n const filteredDates = selectedDates.filter((date) => {\n if (disabledDates.some((disabledDate) => isSameDay(date, disabledDate))) {\n disabledSelectedDates.push(date);\n return false;\n }\n\n if (!isWithinInterval(date, bounds)) {\n datesOutsideOfBounds.push(date);\n return false;\n }\n\n return true;\n });\n\n if (disabledSelectedDates.length > 0 || datesOutsideOfBounds.length > 0) {\n console.warn(\n '[@chayns-components/date] Warning: Failed to set all selectedDates, because some are disabled or out of bounds.',\n ...(disabledSelectedDates.length > 0\n ? ['\\nselectedDates that are disabled:', disabledSelectedDates]\n : []),\n ...(datesOutsideOfBounds.length > 0\n ? [\n '\\nselectedDates that are outside of bounds:',\n datesOutsideOfBounds,\n 'bounds:',\n { minDate, maxDate },\n ]\n : []),\n );\n }\n\n setInternalSelectedDate(filteredDates);\n } else {\n setInternalSelectedDate([]);\n }\n } else if (type === CalendarType.Interval) {\n if (selectedDateInterval) {\n const intervalIncludesDisabledDate =\n selectedDateInterval.end &&\n disabledDates.some((disabledDate) =>\n isWithinInterval(disabledDate, {\n start: selectedDateInterval.start,\n end: selectedDateInterval.end as Date,\n }),\n );\n\n const intervalIsInBounds =\n isWithinInterval(selectedDateInterval.start, bounds) &&\n (!selectedDateInterval.end ||\n isWithinInterval(selectedDateInterval.end, bounds));\n\n if (!intervalIncludesDisabledDate && intervalIsInBounds) {\n setInternalSelectedDate(selectedDateInterval);\n } else {\n console.warn(\n '[@chayns-components/date] Warning: Failed to set selectedDateInterval, because it includes disabled dates or dates that are out of bounds.',\n '\\nselectedDateInterval:',\n selectedDateInterval,\n ...(intervalIncludesDisabledDate\n ? ['\\ndisabled dates:', disabledDates]\n : []),\n ...(intervalIsInBounds ? [] : ['\\nbounds:', { minDate, maxDate }]),\n );\n setInternalSelectedDate(() => undefined);\n }\n }\n }\n }, [type, selectedDate, selectedDates, selectedDateInterval, disabledDates, minDate, maxDate]);\n\n useEffect(() => {\n if (calendarRef.current) {\n const resizeObserver = new ResizeObserver((entries) => {\n if (entries && entries[0]) {\n const observedWidth = entries[0].contentRect.width;\n\n setWidth(observedWidth - 30);\n\n if (observedWidth < 430) {\n setShouldRenderTwoMonths(false);\n } else {\n setShouldRenderTwoMonths(true);\n }\n }\n });\n\n resizeObserver.observe(calendarRef.current);\n\n return () => {\n resizeObserver.disconnect();\n };\n }\n\n return () => {};\n }, []);\n\n useEffect(() => {\n setCurrentDate((prevDate) =>\n isDateInRange({ minDate, maxDate, currentDate: prevDate || new Date() }),\n );\n }, [maxDate, minDate]);\n\n const handleLeftArrowClick = useCallback(() => {\n if (direction) return;\n\n setDirection('left');\n\n setCurrentDate((prevDate) => {\n if (!prevDate) {\n return prevDate;\n }\n\n const newDate = getNewDate(-1, prevDate);\n\n return isDateInRange({ minDate, maxDate, currentDate: newDate });\n });\n }, [maxDate, minDate, direction]);\n\n const handleRightArrowClick = useCallback(() => {\n if (direction) return;\n\n setDirection('right');\n\n setCurrentDate((prevDate) => {\n if (!prevDate) {\n return prevDate;\n }\n\n const newDate = getNewDate(1, prevDate);\n\n return isDateInRange({ minDate, maxDate, currentDate: newDate });\n });\n }, [maxDate, minDate, direction]);\n\n const handleSelect = useCallback(\n (date: Date) => {\n setInternalSelectedDate((prevDate) => {\n let onChangePayload: Date | Date[] | DateInterval | null = null;\n let newInternalSelectedDate: Date | Date[] | DateInterval | undefined;\n\n if (type === CalendarType.Single) {\n onChangePayload = date;\n newInternalSelectedDate = date;\n } else if (type === CalendarType.Multiple) {\n const prevSelectedDates = prevDate as Date[];\n // Selects or unselects date , depending on if it is already selected.\n if (prevSelectedDates.some((d) => isSameDay(d, date))) {\n newInternalSelectedDate = prevSelectedDates.filter(\n (d) => !isSameDay(d, date),\n );\n } else {\n newInternalSelectedDate = [...prevSelectedDates, date];\n }\n\n onChangePayload = newInternalSelectedDate;\n } else if (type === CalendarType.Interval) {\n const prevSelectedDateInterval = prevDate as DateInterval;\n\n const updateInterval = (start: Date, end?: Date): void => {\n const newInterval = { start, end };\n onChangePayload = newInterval;\n newInternalSelectedDate = newInterval;\n };\n\n // Sets first selection as interval start.\n if (!prevSelectedDateInterval) {\n updateInterval(date);\n } else if (prevSelectedDateInterval.start && !prevSelectedDateInterval.end) {\n // Sets second selection as interval start, if it is earlier than the previous interval start.\n // Else sets it as interval end.\n if (date < prevSelectedDateInterval.start) {\n updateInterval(date);\n } else {\n updateInterval(prevSelectedDateInterval.start, date);\n }\n } else {\n // Resets interval if a third date is selected.\n updateInterval(date);\n }\n }\n\n if (typeof onChange === 'function' && onChangePayload) {\n onChange(onChangePayload);\n }\n\n return newInternalSelectedDate;\n });\n },\n [type, onChange],\n );\n\n const handleAnimationFinished = () => {\n setDirection(() => undefined);\n };\n\n const ShouldShowLeftArrow = useMemo(() => {\n if (!currentDate) {\n return false;\n }\n\n return !isSameMonth(currentDate, minDate);\n }, [currentDate, minDate]);\n\n const ShouldShowRightArrow = useMemo(() => {\n if (!currentDate) {\n return false;\n }\n\n return !isSameMonth(currentDate, maxDate);\n }, [currentDate, maxDate]);\n\n return (\n <StyledCalendar ref={calendarRef} $isDisabled={isDisabled}>\n {ShouldShowLeftArrow ? (\n <StyledCalendarIconWrapper onClick={handleLeftArrowClick}>\n <StyledCalendarIconWrapperContent>\n {showMonthYearPickers && (\n <StyledPseudoMonthYearPicker>\n <ComboBox lists={[{ list: [] }]} placeholder=\"\" />\n </StyledPseudoMonthYearPicker>\n )}\n <Icon icons={['fa fa-angle-left']} />\n </StyledCalendarIconWrapperContent>\n </StyledCalendarIconWrapper>\n ) : (\n <StyledCalendarIconWrapperPseudo />\n )}\n {currentDate && (\n <MonthWrapper\n shouldRenderTwo={shouldRenderTwoMonths}\n currentDate={currentDate}\n width={width}\n locale={locale}\n direction={direction}\n customThumbColors={customThumbColors}\n onSelect={handleSelect}\n selectedDate={internalSelectedDate}\n highlightedDates={highlightedDates}\n categories={categories}\n onAnimationFinished={handleAnimationFinished}\n minDate={minDate}\n maxDate={maxDate}\n type={type}\n disabledDates={disabledDates}\n setCurrentDate={setCurrentDate}\n shouldShowHighlightsInMonthOverlay={shouldShowHighlightsInMonthOverlay}\n showMonthYearPickers={showMonthYearPickers}\n />\n )}\n {ShouldShowRightArrow ? (\n <StyledCalendarIconWrapper onClick={handleRightArrowClick}>\n <StyledCalendarIconWrapperContent>\n {showMonthYearPickers && (\n <StyledPseudoMonthYearPicker>\n <ComboBox lists={[{ list: [] }]} placeholder=\"\" />\n </StyledPseudoMonthYearPicker>\n )}\n <Icon icons={['fa fa-angle-right']} />\n </StyledCalendarIconWrapperContent>\n </StyledCalendarIconWrapper>\n ) : (\n <Styled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AA4H,yBAAyB;IAACC,OAAO,EAAElB;EAAsB,gBACtDhH,MAAA,CAAAU,OAAA,CAAAmH,aAAA,CAACxH,SAAA,CAAA8H,gCAAgC,QAC5BhF,oBAAoB,iBACjBnD,MAAA,CAAAU,OAAA,CAAAmH,aAAA,CAACxH,SAAA,CAAA+H,2BAA2B,qBACxBpI,MAAA,CAAAU,OAAA,CAAAmH,aAAA,CAAChI,KAAA,CAAAwI,QAAQ;IAACC,KAAK,EAAE,CAAC;MAAEC,IAAI,EAAE;IAAG,CAAC,CAAE;IAACC,WAAW,EAAC;EAAE,CAAE,CACxB,CAChC,eACDxI,MAAA,CAAAU,OAAA,CAAAmH,aAAA,CAAChI,KAAA,CAAA4I,IAAI;IAACC,KAAK,EAAE,CAAC,mBAAmB;EAAE,CAAE,CACP,CACX,CAAC,gBAE5B1I,MAAA,CAAAU,OAAA,CAAAmH,aAAA,CAACxH,SAAA,CAAAsI,+BAA+B,MAAE,CAE1B,CAAC;AAEzB,CAAC;AAED3G,QAAQ,CAAC+G,WAAW,GAAG,UAAU;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAvI,OAAA,GAEnBsB,QAAQ","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Calendar.js","names":["_core","require","_chaynsApi","_react","_interopRequireWildcard","_calendar","_calendar2","_date","_Calendar","_MonthWrapper","_interopRequireDefault","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","DEFAULT_MAX_DATE","addYears","Date","DEFAULT_MIN_DATE","subYears","Calendar","locale","Language","German","maxDate","minDate","highlightedDates","onChange","customThumbColors","selectedDate","selectedDates","selectedDateInterval","categories","isDisabled","type","CalendarType","Single","shouldShowHighlightsInMonthOverlay","disabledDates","showMonthYearPickers","showMonthYearPickersProp","onShownDatesChange","currentDate","setCurrentDate","useState","shouldRenderTwoMonths","setShouldRenderTwoMonths","internalSelectedDate","setInternalSelectedDate","Multiple","undefined","direction","setDirection","width","setWidth","useMemo","hasMultipleMonths","differenceInCalendarMonths","hasMultipleYears","getYearsBetween","length","calendarRef","useRef","useEffect","start","getFullYear","getMonth","end","bounds","isDisabledDate","some","disabledDate","isSameDay","isDateInBounds","isWithinInterval","console","warn","disabledSelectedDates","datesOutsideOfBounds","filteredDates","filter","date","push","Interval","intervalIncludesDisabledDate","intervalIsInBounds","current","resizeObserver","ResizeObserver","entries","observedWidth","contentRect","observe","disconnect","prevDate","isDateInRange","handleLeftArrowClick","useCallback","newDate","getNewDate","handleRightArrowClick","handleSelect","onChangePayload","newInternalSelectedDate","prevSelectedDates","d","prevSelectedDateInterval","updateInterval","newInterval","handleAnimationFinished","ShouldShowLeftArrow","isSameMonth","ShouldShowRightArrow","createElement","StyledCalendar","ref","$isDisabled","StyledCalendarIconWrapper","onClick","StyledCalendarIconWrapperContent","StyledPseudoMonthYearPicker","ComboBox","lists","list","placeholder","Icon","icons","StyledCalendarIconWrapperPseudo","shouldRenderTwo","onSelect","onAnimationFinished","displayName","_default","exports"],"sources":["../../../../src/components/calendar/Calendar.tsx"],"sourcesContent":["import { ComboBox, Icon } from '@chayns-components/core';\nimport { Language } from 'chayns-api';\nimport React, { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport {\n CalendarType,\n Categories,\n CustomThumbColors,\n DateInterval,\n HighlightedDates,\n} from '../../types/calendar';\nimport { getNewDate, getYearsBetween, isDateInRange } from '../../utils/calendar';\nimport {\n addYears,\n differenceInCalendarMonths,\n isSameDay,\n isSameMonth,\n isWithinInterval,\n subYears,\n} from '../../utils/date';\nimport {\n StyledCalendar,\n StyledCalendarIconWrapper,\n StyledCalendarIconWrapperContent,\n StyledCalendarIconWrapperPseudo,\n StyledPseudoMonthYearPicker,\n} from './Calendar.styles';\nimport MonthWrapper from './month-wrapper/MonthWrapper';\n\ninterface BaseProps {\n /**\n * An array to group dates into a category.\n */\n categories?: Categories[];\n /**\n * Custom colors for the thumb.\n */\n customThumbColors?: CustomThumbColors;\n /**\n * An array with dates and corresponding styles to highlight.\n */\n highlightedDates?: HighlightedDates[];\n /**\n * To disable the Calendar\n */\n isDisabled?: boolean;\n /**\n * The locale language to format the dates.\n */\n locale?: Language;\n /**\n * The maximum date that can be selected.\n */\n maxDate?: Date;\n /**\n * The minimum date that can be selected.\n */\n minDate?: Date;\n /**\n * An array of dates that should be disabled.\n */\n disabledDates?: Date[];\n /**\n * Whether the highlighted dates should be displayed for the greyed month overlay days.\n */\n shouldShowHighlightsInMonthOverlay?: boolean;\n /**\n * Shows the month and year pickers, if there are multiple months/years to select from.\n */\n showMonthYearPickers?: boolean;\n /**\n * Function to be executed when the selected date, dates or date interval change.\n * @param date\n */\n onChange?: (date: Date | Date[] | DateInterval) => void;\n /**\n * Function to be executed when the shown dates change. Returns the start of the displayed month and the end of the last displayed month (since depending on the available widths, there are one or two months displayed).\n @param { start: Date, end: Date }\n */\n onShownDatesChange?: (dates: { start: Date; end: Date }) => void;\n}\n\ninterface SingleSelectionProps {\n /**\n * The type of the calendar selection.\n */\n type?: CalendarType.Single;\n /**\n * A date that should be preselected.\n */\n selectedDate?: Date;\n selectedDates?: never;\n selectedDateInterval?: never;\n}\n\ninterface MultipleSelectionProps {\n /**\n * The type of the calendar selection.\n */\n type: CalendarType.Multiple;\n /**\n * An array of dates that should be preselected.\n */\n selectedDates?: Date[];\n selectedDate?: never;\n selectedDateInterval?: never;\n}\n\ninterface IntervalSelectionProps {\n /**\n * The type of the calendar selection.\n */\n type: CalendarType.Interval;\n /**\n * An interval that should be preselected.\n */\n selectedDateInterval?: DateInterval;\n selectedDates?: never;\n selectedDate?: never;\n}\n\nexport type CalendarProps = BaseProps &\n (SingleSelectionProps | MultipleSelectionProps | IntervalSelectionProps);\n\nconst DEFAULT_MAX_DATE = addYears(new Date(), 1);\nconst DEFAULT_MIN_DATE = subYears(new Date(), 1);\n\nconst Calendar: FC<CalendarProps> = ({\n locale = Language.German,\n maxDate = DEFAULT_MAX_DATE,\n minDate = DEFAULT_MIN_DATE,\n highlightedDates,\n onChange,\n customThumbColors,\n selectedDate,\n selectedDates,\n selectedDateInterval,\n categories,\n isDisabled,\n type = CalendarType.Single,\n shouldShowHighlightsInMonthOverlay = true,\n disabledDates = [],\n showMonthYearPickers: showMonthYearPickersProp,\n onShownDatesChange = () => {},\n}) => {\n const [currentDate, setCurrentDate] = useState<Date>();\n const [shouldRenderTwoMonths, setShouldRenderTwoMonths] = useState(true);\n const [internalSelectedDate, setInternalSelectedDate] = useState<\n Date | Date[] | DateInterval | undefined\n >(() => (type === CalendarType.Multiple ? [] : undefined));\n const [direction, setDirection] = useState<'left' | 'right' | undefined>();\n const [width, setWidth] = useState(0);\n\n const showMonthYearPickers = useMemo(() => {\n const hasMultipleMonths = differenceInCalendarMonths(maxDate, minDate) > 0;\n const hasMultipleYears = getYearsBetween(minDate, maxDate).length > 1;\n\n return !!(showMonthYearPickersProp && (hasMultipleMonths || hasMultipleYears));\n }, [minDate, maxDate, showMonthYearPickersProp]);\n\n const calendarRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (currentDate) {\n const start = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1);\n\n if (shouldRenderTwoMonths) {\n const end = new Date(currentDate.getFullYear(), currentDate.getMonth() + 2, 0);\n onShownDatesChange({\n start,\n end,\n });\n } else {\n const end = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0);\n onShownDatesChange({\n start,\n end,\n });\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [currentDate, shouldRenderTwoMonths]);\n\n useEffect(() => {\n const bounds = {\n start: minDate,\n end: maxDate,\n };\n if (type === CalendarType.Single) {\n if (selectedDate) {\n const isDisabledDate = disabledDates.some((disabledDate) =>\n isSameDay(selectedDate, disabledDate),\n );\n const isDateInBounds = isWithinInterval(selectedDate, bounds);\n\n if (!isDisabledDate && isDateInBounds) {\n setInternalSelectedDate(selectedDate);\n } else {\n console.warn(\n '[@chayns-components/date] Warning: Failed to set selectedDate, because it is disabled or out of bounds.',\n '\\nselectedDate:',\n selectedDate,\n ...(isDisabledDate ? ['\\nselectedDate is disabled'] : []),\n ...(isDateInBounds\n ? []\n : ['\\nselectedDate is outside of bounds:', { minDate, maxDate }]),\n );\n setInternalSelectedDate(() => undefined);\n }\n } else {\n setInternalSelectedDate(() => undefined);\n }\n } else if (type === CalendarType.Multiple) {\n if (selectedDates) {\n const disabledSelectedDates: Date[] = [];\n const datesOutsideOfBounds: Date[] = [];\n\n const filteredDates = selectedDates.filter((date) => {\n if (disabledDates.some((disabledDate) => isSameDay(date, disabledDate))) {\n disabledSelectedDates.push(date);\n return false;\n }\n\n if (!isWithinInterval(date, bounds)) {\n datesOutsideOfBounds.push(date);\n return false;\n }\n\n return true;\n });\n\n if (disabledSelectedDates.length > 0 || datesOutsideOfBounds.length > 0) {\n console.warn(\n '[@chayns-components/date] Warning: Failed to set all selectedDates, because some are disabled or out of bounds.',\n ...(disabledSelectedDates.length > 0\n ? ['\\nselectedDates that are disabled:', disabledSelectedDates]\n : []),\n ...(datesOutsideOfBounds.length > 0\n ? [\n '\\nselectedDates that are outside of bounds:',\n datesOutsideOfBounds,\n 'bounds:',\n { minDate, maxDate },\n ]\n : []),\n );\n }\n\n setInternalSelectedDate(filteredDates);\n } else {\n setInternalSelectedDate([]);\n }\n } else if (type === CalendarType.Interval) {\n if (selectedDateInterval) {\n const intervalIncludesDisabledDate =\n selectedDateInterval.end &&\n disabledDates.some((disabledDate) =>\n isWithinInterval(disabledDate, {\n start: selectedDateInterval.start,\n end: selectedDateInterval.end as Date,\n }),\n );\n\n const intervalIsInBounds =\n isWithinInterval(selectedDateInterval.start, bounds) &&\n (!selectedDateInterval.end ||\n isWithinInterval(selectedDateInterval.end, bounds));\n\n if (!intervalIncludesDisabledDate && intervalIsInBounds) {\n setInternalSelectedDate(selectedDateInterval);\n } else {\n console.warn(\n '[@chayns-components/date] Warning: Failed to set selectedDateInterval, because it includes disabled dates or dates that are out of bounds.',\n '\\nselectedDateInterval:',\n selectedDateInterval,\n ...(intervalIncludesDisabledDate\n ? ['\\ndisabled dates:', disabledDates]\n : []),\n ...(intervalIsInBounds ? [] : ['\\nbounds:', { minDate, maxDate }]),\n );\n setInternalSelectedDate(() => undefined);\n }\n }\n }\n }, [type, selectedDate, selectedDates, selectedDateInterval, disabledDates, minDate, maxDate]);\n\n useEffect(() => {\n if (calendarRef.current) {\n const resizeObserver = new ResizeObserver((entries) => {\n if (entries && entries[0]) {\n const observedWidth = entries[0].contentRect.width;\n\n setWidth(observedWidth - 30);\n\n if (observedWidth < 430) {\n setShouldRenderTwoMonths(false);\n } else {\n setShouldRenderTwoMonths(true);\n }\n }\n });\n\n resizeObserver.observe(calendarRef.current);\n\n return () => {\n resizeObserver.disconnect();\n };\n }\n\n return () => {};\n }, []);\n\n useEffect(() => {\n setCurrentDate((prevDate) =>\n isDateInRange({ minDate, maxDate, currentDate: prevDate || new Date() }),\n );\n }, [maxDate, minDate]);\n\n const handleLeftArrowClick = useCallback(() => {\n if (direction) return;\n\n setDirection('left');\n\n setCurrentDate((prevDate) => {\n if (!prevDate) {\n return prevDate;\n }\n\n const newDate = getNewDate(-1, prevDate);\n\n return isDateInRange({ minDate, maxDate, currentDate: newDate });\n });\n }, [maxDate, minDate, direction]);\n\n const handleRightArrowClick = useCallback(() => {\n if (direction) return;\n\n setDirection('right');\n\n setCurrentDate((prevDate) => {\n if (!prevDate) {\n return prevDate;\n }\n\n const newDate = getNewDate(1, prevDate);\n\n return isDateInRange({ minDate, maxDate, currentDate: newDate });\n });\n }, [maxDate, minDate, direction]);\n\n const handleSelect = useCallback(\n (date: Date) => {\n setInternalSelectedDate((prevDate) => {\n let onChangePayload: Date | Date[] | DateInterval | null = null;\n let newInternalSelectedDate: Date | Date[] | DateInterval | undefined;\n\n if (type === CalendarType.Single) {\n onChangePayload = date;\n newInternalSelectedDate = date;\n } else if (type === CalendarType.Multiple) {\n const prevSelectedDates = prevDate as Date[];\n // Selects or unselects date , depending on if it is already selected.\n if (prevSelectedDates.some((d) => isSameDay(d, date))) {\n newInternalSelectedDate = prevSelectedDates.filter(\n (d) => !isSameDay(d, date),\n );\n } else {\n newInternalSelectedDate = [...prevSelectedDates, date];\n }\n\n onChangePayload = newInternalSelectedDate;\n } else if (type === CalendarType.Interval) {\n const prevSelectedDateInterval = prevDate as DateInterval;\n\n const updateInterval = (start: Date, end?: Date): void => {\n const newInterval = { start, end };\n onChangePayload = newInterval;\n newInternalSelectedDate = newInterval;\n };\n\n // Sets first selection as interval start.\n if (!prevSelectedDateInterval) {\n updateInterval(date);\n } else if (prevSelectedDateInterval.start && !prevSelectedDateInterval.end) {\n // Sets second selection as interval start, if it is earlier than the previous interval start.\n // Else sets it as interval end.\n if (date < prevSelectedDateInterval.start) {\n updateInterval(date);\n } else {\n updateInterval(prevSelectedDateInterval.start, date);\n }\n } else {\n // Resets interval if a third date is selected.\n updateInterval(date);\n }\n }\n\n if (typeof onChange === 'function' && onChangePayload) {\n onChange(onChangePayload);\n }\n\n return newInternalSelectedDate;\n });\n },\n [type, onChange],\n );\n\n const handleAnimationFinished = () => {\n setDirection(() => undefined);\n };\n\n const ShouldShowLeftArrow = useMemo(() => {\n if (!currentDate) {\n return false;\n }\n\n return !isSameMonth(currentDate, minDate);\n }, [currentDate, minDate]);\n\n const ShouldShowRightArrow = useMemo(() => {\n if (!currentDate) {\n return false;\n }\n\n return !isSameMonth(currentDate, maxDate);\n }, [currentDate, maxDate]);\n\n return (\n <StyledCalendar ref={calendarRef} $isDisabled={isDisabled}>\n {ShouldShowLeftArrow ? (\n <StyledCalendarIconWrapper onClick={handleLeftArrowClick}>\n <StyledCalendarIconWrapperContent>\n {showMonthYearPickers && (\n <StyledPseudoMonthYearPicker>\n <ComboBox lists={[{ list: [] }]} placeholder=\"\" />\n </StyledPseudoMonthYearPicker>\n )}\n <Icon icons={['fa fa-angle-left']} />\n </StyledCalendarIconWrapperContent>\n </StyledCalendarIconWrapper>\n ) : (\n <StyledCalendarIconWrapperPseudo />\n )}\n {currentDate && (\n <MonthWrapper\n shouldRenderTwo={shouldRenderTwoMonths}\n currentDate={currentDate}\n width={width}\n locale={locale}\n direction={direction}\n customThumbColors={customThumbColors}\n onSelect={handleSelect}\n selectedDate={internalSelectedDate}\n highlightedDates={highlightedDates}\n categories={categories}\n onAnimationFinished={handleAnimationFinished}\n minDate={minDate}\n maxDate={maxDate}\n type={type}\n disabledDates={disabledDates}\n setCurrentDate={setCurrentDate}\n shouldShowHighlightsInMonthOverlay={shouldShowHighlightsInMonthOverlay}\n showMonthYearPickers={showMonthYearPickers}\n handleLeftArrowClick={handleLeftArrowClick}\n handleRightArrowClick={handleRightArrowClick}\n />\n )}\n {ShouldShowRightArrow ? (\n <StyledCalendarIconWrapper onClick={handleRightArrowClick}>\n <StyledCalendarIconWrapperContent>\n {showMonthYearPickers && (\n <StyledPseudoMonthYearPicker>\n <ComboBox lists={[{ list: [] }]} placeholder=\"\" />\n </StyledPseudoMonthYearPicker>\n )}\n <Icon icons={['fa fa-angle-right']} />\n </StyledCalendarIconWrapperContent>\n </StyledCalendarIconWrapper>\n ) : (\n <StyledCalendarIconWrapperPseudo />\n )}\n </StyledCalendar>\n );\n};\n\nCalendar.displayName = 'Calendar';\n\nexport default Calendar;\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAOA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAQA,IAAAO,SAAA,GAAAP,OAAA;AAOA,IAAAQ,aAAA,GAAAC,sBAAA,CAAAT,OAAA;AAAwD,SAAAS,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAP,wBAAAO,CAAA,EAAAG,CAA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AAC,mBAAmB;EAAE,CAAE,CACP,CACX,CAAC,gBAE5B1I,MAAA,CAAAU,OAAA,CAAAmH,aAAA,CAACxH,SAAA,CAAAsI,+BAA+B,MAAE,CAE1B,CAAC;AAEzB,CAAC;AAED3G,QAAQ,CAAC+G,WAAW,GAAG,UAAU;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAvI,OAAA,GAEnBsB,QAAQ","ignoreList":[]}
|
|
@@ -29,7 +29,9 @@ const MonthWrapper = ({
|
|
|
29
29
|
type,
|
|
30
30
|
disabledDates,
|
|
31
31
|
setCurrentDate,
|
|
32
|
-
showMonthYearPickers
|
|
32
|
+
showMonthYearPickers,
|
|
33
|
+
handleLeftArrowClick,
|
|
34
|
+
handleRightArrowClick
|
|
33
35
|
}) => {
|
|
34
36
|
const [content, setContent] = (0, _react.useState)();
|
|
35
37
|
const [hoveringDay, setHoveringDay] = (0, _react.useState)(null);
|
|
@@ -64,7 +66,9 @@ const MonthWrapper = ({
|
|
|
64
66
|
disabledDates: disabledDates,
|
|
65
67
|
setCurrentDate: setCurrentDate,
|
|
66
68
|
displayIndex: i,
|
|
67
|
-
showMonthYearPickers: showMonthYearPickers
|
|
69
|
+
showMonthYearPickers: showMonthYearPickers,
|
|
70
|
+
handleLeftArrowClick: handleLeftArrowClick,
|
|
71
|
+
handleRightArrowClick: handleRightArrowClick
|
|
68
72
|
}));
|
|
69
73
|
}
|
|
70
74
|
return items;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MonthWrapper.js","names":["_react","_interopRequireWildcard","require","_calendar","_Month","_interopRequireDefault","_MonthWrapper","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","MonthWrapper","locale","currentDate","highlightedDates","selectedDate","onSelect","categories","direction","onAnimationFinished","shouldRenderTwo","width","customThumbColors","isDisabled","minDate","maxDate","shouldShowHighlightsInMonthOverlay","type","disabledDates","setCurrentDate","showMonthYearPickers","content","setContent","useState","hoveringDay","setHoveringDay","monthHeight","useMemo","useEffect","items","date","getNewDate","month","year","getMonthAndYear","push","createElement","height","key","displayIndex","prevState","map","element","index","props","animate","x","StyledMonthWrapper","$height","$width","StyledMotionWrapper","$isDisabled","transition","duration","onAnimationComplete","displayName","_default","exports"],"sources":["../../../../../src/components/calendar/month-wrapper/MonthWrapper.tsx"],"sourcesContent":["import { Language } from 'chayns-api';\nimport type { MotionProps } from 'motion/react';\nimport React, { FC, useEffect, useMemo, useState, type ReactElement } from 'react';\nimport {\n CalendarType,\n Categories,\n CustomThumbColors,\n DateInterval,\n HighlightedDates,\n} from '../../../types/calendar';\nimport { getMonthAndYear, getNewDate } from '../../../utils/calendar';\nimport Month from './month/Month';\nimport { StyledMonthWrapper, StyledMotionWrapper } from './MonthWrapper.styles';\n\nexport type MonthWrapperProps = {\n locale: Language;\n highlightedDates?: HighlightedDates[];\n onSelect: (date: Date) => void;\n selectedDate?: Date | Date[] | DateInterval;\n categories?: Categories[];\n currentDate: Date;\n direction?: 'left' | 'right';\n onAnimationFinished: () => void;\n shouldRenderTwo: boolean;\n width: number;\n isDisabled?: boolean;\n maxDate: Date;\n minDate: Date;\n type: CalendarType;\n disabledDates: Date[];\n setCurrentDate: (date: Date) => void;\n shouldShowHighlightsInMonthOverlay: boolean;\n showMonthYearPickers: boolean;\n customThumbColors?: CustomThumbColors;\n};\n\nconst MonthWrapper: FC<MonthWrapperProps> = ({\n locale,\n currentDate,\n highlightedDates,\n selectedDate,\n onSelect,\n categories,\n direction,\n onAnimationFinished,\n shouldRenderTwo,\n width,\n customThumbColors,\n isDisabled,\n minDate,\n maxDate,\n shouldShowHighlightsInMonthOverlay,\n type,\n disabledDates,\n setCurrentDate,\n showMonthYearPickers,\n}) => {\n const [content, setContent] = useState<ReactElement[]>();\n\n const [hoveringDay, setHoveringDay] = useState<Date | null>(null);\n\n const monthHeight = useMemo(() => width / (shouldRenderTwo ? 2 : 1), [width, shouldRenderTwo]);\n\n useEffect(() => {\n setContent(() => {\n // Initial render of months\n const items: ReactElement[] = [];\n\n for (let i = -1; i < 3; i++) {\n const date = getNewDate(i, currentDate);\n\n const { month, year } = getMonthAndYear(date);\n\n items.push(\n <Month\n height={monthHeight}\n key={`${month}-${year}`}\n month={month}\n year={year}\n locale={locale}\n onSelect={onSelect}\n highlightedDates={highlightedDates}\n shouldShowHighlightsInMonthOverlay={shouldShowHighlightsInMonthOverlay}\n categories={categories}\n selectedDate={selectedDate}\n minDate={minDate}\n maxDate={maxDate}\n type={type}\n customThumbColors={customThumbColors}\n hoveringDay={hoveringDay}\n setHoveringDay={setHoveringDay}\n disabledDates={disabledDates}\n setCurrentDate={setCurrentDate}\n displayIndex={i}\n showMonthYearPickers={showMonthYearPickers}\n />,\n );\n }\n\n return items;\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [monthHeight]);\n\n useEffect(() => {\n // Doesn't update props until animation is completed\n if (direction) return;\n\n setContent((prevState) =>\n (prevState ?? []).map((element, index) => {\n const date = getNewDate(index - 1, currentDate);\n\n const { month, year } = getMonthAndYear(date);\n\n return {\n ...element,\n props: {\n ...element.props,\n categories,\n disabledDates,\n displayIndex: index - 1,\n highlightedDates,\n hoveringDay,\n locale,\n onSelect,\n shouldShowHighlightsInMonthOverlay,\n maxDate,\n minDate,\n month,\n customThumbColors,\n selectedDate,\n setCurrentDate,\n setHoveringDay,\n showMonthYearPickers,\n type,\n year,\n } as ReactElement,\n };\n }),\n );\n }, [\n customThumbColors,\n categories,\n currentDate,\n direction,\n disabledDates,\n highlightedDates,\n hoveringDay,\n locale,\n onAnimationFinished,\n onSelect,\n maxDate,\n minDate,\n selectedDate,\n setCurrentDate,\n setHoveringDay,\n showMonthYearPickers,\n type,\n shouldShowHighlightsInMonthOverlay,\n ]);\n\n const animate: MotionProps['animate'] = useMemo(() => {\n if (shouldRenderTwo) {\n switch (true) {\n case direction === 'left':\n return { x: '0%' };\n case direction === 'right':\n return { x: '-100%' };\n default:\n return { x: '-50%' };\n }\n } else {\n switch (true) {\n case direction === 'left':\n return { x: '0%' };\n case direction === 'right':\n return { x: '-200%' };\n default:\n return { x: '-100%' };\n }\n }\n }, [direction, shouldRenderTwo]);\n\n return (\n <StyledMonthWrapper $height={monthHeight} $width={width}>\n <StyledMotionWrapper\n animate={animate}\n $isDisabled={isDisabled}\n transition={{\n type: 'tween',\n duration: !direction ? 0 : 0.2,\n }}\n onAnimationComplete={onAnimationFinished}\n >\n {content}\n </StyledMotionWrapper>\n </StyledMonthWrapper>\n );\n};\n\nMonthWrapper.displayName = 'MonthWrapper';\n\nexport default MonthWrapper;\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAQA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAAgF,SAAAG,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAM,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,UAAAO,CAAA,CAAAK,GAAA,CAAAZ,CAAA,GAAAO,CAAA,CAAAM,GAAA,CAAAb,CAAA,EAAAS,CAAA,gBAAAN,CAAA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C,SAAS,EAAEE,eAAe,CAAC,CAAC;EAEhC,oBACInC,MAAA,CAAAS,OAAA,CAAAoD,aAAA,CAACvD,aAAA,CAAAkE,kBAAkB;IAACC,OAAO,EAAEtB,WAAY;IAACuB,MAAM,EAAEtC;EAAM,gBACpDpC,MAAA,CAAAS,OAAA,CAAAoD,aAAA,CAACvD,aAAA,CAAAqE,mBAAmB;IAChBL,OAAO,EAAEA,OAAQ;IACjBM,WAAW,EAAEtC,UAAW;IACxBuC,UAAU,EAAE;MACRnC,IAAI,EAAE,OAAO;MACboC,QAAQ,EAAE,CAAC7C,SAAS,GAAG,CAAC,GAAG;IAC/B,CAAE;IACF8C,mBAAmB,EAAE7C;EAAoB,GAExCY,OACgB,CACL,CAAC;AAE7B,CAAC;AAEDpB,YAAY,CAACsD,WAAW,GAAG,cAAc;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAzE,OAAA,GAE3BiB,YAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"MonthWrapper.js","names":["_react","_interopRequireWildcard","require","_calendar","_Month","_interopRequireDefault","_MonthWrapper","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","MonthWrapper","locale","currentDate","highlightedDates","selectedDate","onSelect","categories","direction","onAnimationFinished","shouldRenderTwo","width","customThumbColors","isDisabled","minDate","maxDate","shouldShowHighlightsInMonthOverlay","type","disabledDates","setCurrentDate","showMonthYearPickers","handleLeftArrowClick","handleRightArrowClick","content","setContent","useState","hoveringDay","setHoveringDay","monthHeight","useMemo","useEffect","items","date","getNewDate","month","year","getMonthAndYear","push","createElement","height","key","displayIndex","prevState","map","element","index","props","animate","x","StyledMonthWrapper","$height","$width","StyledMotionWrapper","$isDisabled","transition","duration","onAnimationComplete","displayName","_default","exports"],"sources":["../../../../../src/components/calendar/month-wrapper/MonthWrapper.tsx"],"sourcesContent":["import { Language } from 'chayns-api';\nimport type { MotionProps } from 'motion/react';\nimport React, { FC, useEffect, useMemo, useState, type ReactElement } from 'react';\nimport {\n CalendarType,\n Categories,\n CustomThumbColors,\n DateInterval,\n HighlightedDates,\n} from '../../../types/calendar';\nimport { getMonthAndYear, getNewDate } from '../../../utils/calendar';\nimport Month from './month/Month';\nimport { StyledMonthWrapper, StyledMotionWrapper } from './MonthWrapper.styles';\n\nexport type MonthWrapperProps = {\n locale: Language;\n highlightedDates?: HighlightedDates[];\n onSelect: (date: Date) => void;\n selectedDate?: Date | Date[] | DateInterval;\n categories?: Categories[];\n currentDate: Date;\n direction?: 'left' | 'right';\n onAnimationFinished: () => void;\n shouldRenderTwo: boolean;\n width: number;\n isDisabled?: boolean;\n maxDate: Date;\n minDate: Date;\n type: CalendarType;\n disabledDates: Date[];\n setCurrentDate: (date: Date) => void;\n shouldShowHighlightsInMonthOverlay: boolean;\n showMonthYearPickers: boolean;\n customThumbColors?: CustomThumbColors;\n handleLeftArrowClick: () => void;\n handleRightArrowClick: () => void;\n};\n\nconst MonthWrapper: FC<MonthWrapperProps> = ({\n locale,\n currentDate,\n highlightedDates,\n selectedDate,\n onSelect,\n categories,\n direction,\n onAnimationFinished,\n shouldRenderTwo,\n width,\n customThumbColors,\n isDisabled,\n minDate,\n maxDate,\n shouldShowHighlightsInMonthOverlay,\n type,\n disabledDates,\n setCurrentDate,\n showMonthYearPickers,\n handleLeftArrowClick,\n handleRightArrowClick,\n}) => {\n const [content, setContent] = useState<ReactElement[]>();\n\n const [hoveringDay, setHoveringDay] = useState<Date | null>(null);\n\n const monthHeight = useMemo(() => width / (shouldRenderTwo ? 2 : 1), [width, shouldRenderTwo]);\n\n useEffect(() => {\n setContent(() => {\n // Initial render of months\n const items: ReactElement[] = [];\n\n for (let i = -1; i < 3; i++) {\n const date = getNewDate(i, currentDate);\n\n const { month, year } = getMonthAndYear(date);\n\n items.push(\n <Month\n height={monthHeight}\n key={`${month}-${year}`}\n month={month}\n year={year}\n locale={locale}\n onSelect={onSelect}\n highlightedDates={highlightedDates}\n shouldShowHighlightsInMonthOverlay={shouldShowHighlightsInMonthOverlay}\n categories={categories}\n selectedDate={selectedDate}\n minDate={minDate}\n maxDate={maxDate}\n type={type}\n customThumbColors={customThumbColors}\n hoveringDay={hoveringDay}\n setHoveringDay={setHoveringDay}\n disabledDates={disabledDates}\n setCurrentDate={setCurrentDate}\n displayIndex={i}\n showMonthYearPickers={showMonthYearPickers}\n handleLeftArrowClick={handleLeftArrowClick}\n handleRightArrowClick={handleRightArrowClick}\n />,\n );\n }\n\n return items;\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [monthHeight]);\n\n useEffect(() => {\n // Doesn't update props until animation is completed\n if (direction) return;\n\n setContent((prevState) =>\n (prevState ?? []).map((element, index) => {\n const date = getNewDate(index - 1, currentDate);\n\n const { month, year } = getMonthAndYear(date);\n\n return {\n ...element,\n props: {\n ...element.props,\n categories,\n disabledDates,\n displayIndex: index - 1,\n highlightedDates,\n hoveringDay,\n locale,\n onSelect,\n shouldShowHighlightsInMonthOverlay,\n maxDate,\n minDate,\n month,\n customThumbColors,\n selectedDate,\n setCurrentDate,\n setHoveringDay,\n showMonthYearPickers,\n type,\n year,\n } as ReactElement,\n };\n }),\n );\n }, [\n customThumbColors,\n categories,\n currentDate,\n direction,\n disabledDates,\n highlightedDates,\n hoveringDay,\n locale,\n onAnimationFinished,\n onSelect,\n maxDate,\n minDate,\n selectedDate,\n setCurrentDate,\n setHoveringDay,\n showMonthYearPickers,\n type,\n shouldShowHighlightsInMonthOverlay,\n ]);\n\n const animate: MotionProps['animate'] = useMemo(() => {\n if (shouldRenderTwo) {\n switch (true) {\n case direction === 'left':\n return { x: '0%' };\n case direction === 'right':\n return { x: '-100%' };\n default:\n return { x: '-50%' };\n }\n } else {\n switch (true) {\n case direction === 'left':\n return { x: '0%' };\n case direction === 'right':\n return { x: '-200%' };\n default:\n return { x: '-100%' };\n }\n }\n }, [direction, shouldRenderTwo]);\n\n return (\n <StyledMonthWrapper $height={monthHeight} $width={width}>\n <StyledMotionWrapper\n animate={animate}\n $isDisabled={isDisabled}\n transition={{\n type: 'tween',\n duration: !direction ? 0 : 0.2,\n }}\n onAnimationComplete={onAnimationFinished}\n >\n {content}\n </StyledMotionWrapper>\n </StyledMonthWrapper>\n );\n};\n\nMonthWrapper.displayName = 'MonthWrapper';\n\nexport default MonthWrapper;\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAQA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAAgF,SAAAG,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAM,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,UAAAO,CAAA,CAAAK,GAAA,CAAAZ,CAAA,GAAAO,CAAA,CAAAM,GAAA,CAAAb,CAAA,EAAAS,CAAA,gBAAAN,CAAA,IAAAH,CAAA,gBAAAG,CAAA,OAAAW,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAG,CAAA,OAAAK,CAAA,IAAAD,CAAA,GAAAS,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,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AsD,aAAA,CAACzD,aAAA,CAAAoE,kBAAkB;IAACC,OAAO,EAAEtB,WAAY;IAACuB,MAAM,EAAExC;EAAM,gBACpDpC,MAAA,CAAAS,OAAA,CAAAsD,aAAA,CAACzD,aAAA,CAAAuE,mBAAmB;IAChBL,OAAO,EAAEA,OAAQ;IACjBM,WAAW,EAAExC,UAAW;IACxByC,UAAU,EAAE;MACRrC,IAAI,EAAE,OAAO;MACbsC,QAAQ,EAAE,CAAC/C,SAAS,GAAG,CAAC,GAAG;IAC/B,CAAE;IACFgD,mBAAmB,EAAE/C;EAAoB,GAExCc,OACgB,CACL,CAAC;AAE7B,CAAC;AAEDtB,YAAY,CAACwD,WAAW,GAAG,cAAc;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA3E,OAAA,GAE3BiB,YAAY","ignoreList":[]}
|
|
@@ -4,12 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _MonthYearPickers = _interopRequireDefault(require("../../month-year-pickers/MonthYearPickers"));
|
|
9
9
|
var _DayWrapper = _interopRequireDefault(require("./day-wrapper/DayWrapper"));
|
|
10
10
|
var _Month = require("./Month.styles");
|
|
11
11
|
var _WeekdayWrapper = _interopRequireDefault(require("./weekday-wrapper/WeekdayWrapper"));
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
|
+
const minSwipeDistance = 50;
|
|
13
15
|
const Month = ({
|
|
14
16
|
month,
|
|
15
17
|
year,
|
|
@@ -29,37 +31,65 @@ const Month = ({
|
|
|
29
31
|
disabledDates,
|
|
30
32
|
setCurrentDate,
|
|
31
33
|
displayIndex,
|
|
32
|
-
showMonthYearPickers
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
34
|
+
showMonthYearPickers,
|
|
35
|
+
handleLeftArrowClick,
|
|
36
|
+
handleRightArrowClick
|
|
37
|
+
}) => {
|
|
38
|
+
const [touchStart, setTouchStart] = (0, _react.useState)();
|
|
39
|
+
const [touchEnd, setTouchEnd] = (0, _react.useState)();
|
|
40
|
+
const onTouchStart = e => {
|
|
41
|
+
var _e$targetTouches$;
|
|
42
|
+
setTouchEnd(undefined);
|
|
43
|
+
setTouchStart((_e$targetTouches$ = e.targetTouches[0]) === null || _e$targetTouches$ === void 0 ? void 0 : _e$targetTouches$.clientX);
|
|
44
|
+
};
|
|
45
|
+
const onTouchMove = e => {
|
|
46
|
+
var _e$targetTouches$2;
|
|
47
|
+
setTouchEnd((_e$targetTouches$2 = e.targetTouches[0]) === null || _e$targetTouches$2 === void 0 ? void 0 : _e$targetTouches$2.clientX);
|
|
48
|
+
};
|
|
49
|
+
const onTouchEnd = () => {
|
|
50
|
+
if (!touchStart || !touchEnd) return;
|
|
51
|
+
const distance = touchStart - touchEnd;
|
|
52
|
+
if (distance < -minSwipeDistance) {
|
|
53
|
+
handleLeftArrowClick();
|
|
54
|
+
}
|
|
55
|
+
if (distance > minSwipeDistance) {
|
|
56
|
+
handleRightArrowClick();
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
return /*#__PURE__*/_react.default.createElement(_Month.StyledMonth, {
|
|
60
|
+
$height: height,
|
|
61
|
+
onTouchStart: onTouchStart,
|
|
62
|
+
onTouchMove: onTouchMove,
|
|
63
|
+
onTouchEnd: onTouchEnd
|
|
64
|
+
}, /*#__PURE__*/_react.default.createElement(_Month.StyledMonthHead, null, /*#__PURE__*/_react.default.createElement(_MonthYearPickers.default, {
|
|
65
|
+
month: month,
|
|
66
|
+
year: year,
|
|
67
|
+
locale: locale,
|
|
68
|
+
minDate: minDate,
|
|
69
|
+
maxDate: maxDate,
|
|
70
|
+
setCurrentDate: setCurrentDate,
|
|
71
|
+
displayIndex: displayIndex,
|
|
72
|
+
showMonthYearPickers: showMonthYearPickers
|
|
73
|
+
})), /*#__PURE__*/_react.default.createElement(_WeekdayWrapper.default, {
|
|
74
|
+
locale: locale
|
|
75
|
+
}), /*#__PURE__*/_react.default.createElement(_DayWrapper.default, {
|
|
76
|
+
key: `day-wrapper-${month}`,
|
|
77
|
+
categories: categories,
|
|
78
|
+
selectedDate: selectedDate,
|
|
79
|
+
customThumbColors: customThumbColors,
|
|
80
|
+
month: month,
|
|
81
|
+
year: year,
|
|
82
|
+
onSelect: onSelect,
|
|
83
|
+
shouldShowHighlightsInMonthOverlay: shouldShowHighlightsInMonthOverlay,
|
|
84
|
+
highlightedDates: highlightedDates,
|
|
85
|
+
minDate: minDate,
|
|
86
|
+
maxDate: maxDate,
|
|
87
|
+
type: type,
|
|
88
|
+
hoveringDay: hoveringDay,
|
|
89
|
+
setHoveringDay: setHoveringDay,
|
|
90
|
+
disabledDates: disabledDates
|
|
91
|
+
}));
|
|
92
|
+
};
|
|
63
93
|
Month.displayName = 'Month';
|
|
64
94
|
var _default = exports.default = Month;
|
|
65
95
|
//# sourceMappingURL=Month.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Month.js","names":["_react","
|
|
1
|
+
{"version":3,"file":"Month.js","names":["_react","_interopRequireWildcard","require","_MonthYearPickers","_interopRequireDefault","_DayWrapper","_Month","_WeekdayWrapper","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","minSwipeDistance","Month","month","year","locale","highlightedDates","selectedDate","onSelect","categories","height","minDate","maxDate","customThumbColors","shouldShowHighlightsInMonthOverlay","type","hoveringDay","setHoveringDay","disabledDates","setCurrentDate","displayIndex","showMonthYearPickers","handleLeftArrowClick","handleRightArrowClick","touchStart","setTouchStart","useState","touchEnd","setTouchEnd","onTouchStart","_e$targetTouches$","undefined","targetTouches","clientX","onTouchMove","_e$targetTouches$2","onTouchEnd","distance","createElement","StyledMonth","$height","StyledMonthHead","key","displayName","_default","exports"],"sources":["../../../../../../src/components/calendar/month-wrapper/month/Month.tsx"],"sourcesContent":["import React, { FC, TouchEvent, useState } from 'react';\nimport {\n CalendarType,\n Categories,\n CustomThumbColors,\n DateInterval,\n EMonth,\n HighlightedDates,\n} from '../../../../types/calendar';\nimport MonthYearPickers from '../../month-year-pickers/MonthYearPickers';\nimport DayWrapper from './day-wrapper/DayWrapper';\nimport { StyledMonth, StyledMonthHead } from './Month.styles';\nimport WeekdayWrapper from './weekday-wrapper/WeekdayWrapper';\nimport { Language } from 'chayns-api';\n\nexport type MonthProps = {\n month: EMonth;\n year: number;\n locale: Language;\n highlightedDates?: HighlightedDates[];\n onSelect: (date: Date) => void;\n selectedDate?: Date | Date[] | DateInterval;\n categories?: Categories[];\n height: number;\n minDate: Date;\n maxDate: Date;\n type: CalendarType;\n hoveringDay: Date | null;\n setHoveringDay: (date: Date | null) => void;\n disabledDates: Date[];\n setCurrentDate: (date: Date) => void;\n displayIndex?: number;\n shouldShowHighlightsInMonthOverlay: boolean;\n customThumbColors?: CustomThumbColors;\n showMonthYearPickers: boolean;\n handleLeftArrowClick: () => void;\n handleRightArrowClick: () => void;\n};\n\nconst minSwipeDistance = 50;\n\nconst Month: FC<MonthProps> = ({\n month,\n year,\n locale,\n highlightedDates,\n selectedDate,\n onSelect,\n categories,\n height,\n minDate,\n maxDate,\n customThumbColors,\n shouldShowHighlightsInMonthOverlay,\n type,\n hoveringDay,\n setHoveringDay,\n disabledDates,\n setCurrentDate,\n displayIndex,\n showMonthYearPickers,\n handleLeftArrowClick,\n handleRightArrowClick,\n}) => {\n const [touchStart, setTouchStart] = useState<undefined | number>();\n const [touchEnd, setTouchEnd] = useState<undefined | number>();\n\n const onTouchStart = (e: TouchEvent<HTMLDivElement>) => {\n setTouchEnd(undefined);\n setTouchStart(e.targetTouches[0]?.clientX);\n };\n\n const onTouchMove = (e: TouchEvent<HTMLDivElement>) => {\n setTouchEnd(e.targetTouches[0]?.clientX);\n };\n\n const onTouchEnd = () => {\n if (!touchStart || !touchEnd) return;\n const distance = touchStart - touchEnd;\n if (distance < -minSwipeDistance) {\n handleLeftArrowClick();\n }\n if (distance > minSwipeDistance) {\n handleRightArrowClick();\n }\n };\n\n return (\n <StyledMonth\n $height={height}\n onTouchStart={onTouchStart}\n onTouchMove={onTouchMove}\n onTouchEnd={onTouchEnd}\n >\n <StyledMonthHead>\n <MonthYearPickers\n month={month}\n year={year}\n locale={locale}\n minDate={minDate}\n maxDate={maxDate}\n setCurrentDate={setCurrentDate}\n displayIndex={displayIndex}\n showMonthYearPickers={showMonthYearPickers}\n />\n </StyledMonthHead>\n <WeekdayWrapper locale={locale} />\n <DayWrapper\n key={`day-wrapper-${month}`}\n categories={categories}\n selectedDate={selectedDate}\n customThumbColors={customThumbColors}\n month={month}\n year={year}\n onSelect={onSelect}\n shouldShowHighlightsInMonthOverlay={shouldShowHighlightsInMonthOverlay}\n highlightedDates={highlightedDates}\n minDate={minDate}\n maxDate={maxDate}\n type={type}\n hoveringDay={hoveringDay}\n setHoveringDay={setHoveringDay}\n disabledDates={disabledDates}\n />\n </StyledMonth>\n );\n};\n\nMonth.displayName = 'Month';\n\nexport default Month;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AASA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAH,sBAAA,CAAAF,OAAA;AAA8D,SAAAE,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAP,wBAAAO,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAX,uBAAA,YAAAA,CAAAO,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,UAAAO,CAAA,CAAAK,GAAA,CAAAZ,CAAA,GAAAO,CAAA,CAAAM,GAAA,CAAAb,CAAA,EAAAS,CAAA,gBAAAN,CAAA,IAAAH,CAAA,gBAAAG,CAAA,OAAAW,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAG,CAAA,OAAAK,CAAA,IAAAD,CAAA,GAAAS,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,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B,EAAEA,gBAAiB;IACnCK,OAAO,EAAEA,OAAQ;IACjBC,OAAO,EAAEA,OAAQ;IACjBG,IAAI,EAAEA,IAAK;IACXC,WAAW,EAAEA,WAAY;IACzBC,cAAc,EAAEA,cAAe;IAC/BC,aAAa,EAAEA;EAAc,CAChC,CACQ,CAAC;AAEtB,CAAC;AAEDhB,KAAK,CAACyC,WAAW,GAAG,OAAO;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA7D,OAAA,GAEbkB,KAAK","ignoreList":[]}
|
|
@@ -272,7 +272,9 @@ const Calendar = ({
|
|
|
272
272
|
disabledDates: disabledDates,
|
|
273
273
|
setCurrentDate: setCurrentDate,
|
|
274
274
|
shouldShowHighlightsInMonthOverlay: shouldShowHighlightsInMonthOverlay,
|
|
275
|
-
showMonthYearPickers: showMonthYearPickers
|
|
275
|
+
showMonthYearPickers: showMonthYearPickers,
|
|
276
|
+
handleLeftArrowClick: handleLeftArrowClick,
|
|
277
|
+
handleRightArrowClick: handleRightArrowClick
|
|
276
278
|
}), ShouldShowRightArrow ? /*#__PURE__*/React.createElement(StyledCalendarIconWrapper, {
|
|
277
279
|
onClick: handleRightArrowClick
|
|
278
280
|
}, /*#__PURE__*/React.createElement(StyledCalendarIconWrapperContent, null, showMonthYearPickers && /*#__PURE__*/React.createElement(StyledPseudoMonthYearPicker, null, /*#__PURE__*/React.createElement(ComboBox, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.js","names":["ComboBox","Icon","Language","React","useCallback","useEffect","useMemo","useRef","useState","CalendarType","getNewDate","getYearsBetween","isDateInRange","addYears","differenceInCalendarMonths","isSameDay","isSameMonth","isWithinInterval","subYears","StyledCalendar","StyledCalendarIconWrapper","StyledCalendarIconWrapperContent","StyledCalendarIconWrapperPseudo","StyledPseudoMonthYearPicker","MonthWrapper","DEFAULT_MAX_DATE","Date","DEFAULT_MIN_DATE","Calendar","locale","German","maxDate","minDate","highlightedDates","onChange","customThumbColors","selectedDate","selectedDates","selectedDateInterval","categories","isDisabled","type","Single","shouldShowHighlightsInMonthOverlay","disabledDates","showMonthYearPickers","showMonthYearPickersProp","onShownDatesChange","currentDate","setCurrentDate","shouldRenderTwoMonths","setShouldRenderTwoMonths","internalSelectedDate","setInternalSelectedDate","Multiple","undefined","direction","setDirection","width","setWidth","hasMultipleMonths","hasMultipleYears","length","calendarRef","start","getFullYear","getMonth","end","bounds","isDisabledDate","some","disabledDate","isDateInBounds","console","warn","disabledSelectedDates","datesOutsideOfBounds","filteredDates","filter","date","push","Interval","intervalIncludesDisabledDate","intervalIsInBounds","current","resizeObserver","ResizeObserver","entries","observedWidth","contentRect","observe","disconnect","prevDate","handleLeftArrowClick","newDate","handleRightArrowClick","handleSelect","onChangePayload","newInternalSelectedDate","prevSelectedDates","d","prevSelectedDateInterval","updateInterval","newInterval","handleAnimationFinished","ShouldShowLeftArrow","ShouldShowRightArrow","createElement","ref","$isDisabled","onClick","lists","list","placeholder","icons","shouldRenderTwo","onSelect","onAnimationFinished","displayName"],"sources":["../../../../src/components/calendar/Calendar.tsx"],"sourcesContent":["import { ComboBox, Icon } from '@chayns-components/core';\nimport { Language } from 'chayns-api';\nimport React, { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport {\n CalendarType,\n Categories,\n CustomThumbColors,\n DateInterval,\n HighlightedDates,\n} from '../../types/calendar';\nimport { getNewDate, getYearsBetween, isDateInRange } from '../../utils/calendar';\nimport {\n addYears,\n differenceInCalendarMonths,\n isSameDay,\n isSameMonth,\n isWithinInterval,\n subYears,\n} from '../../utils/date';\nimport {\n StyledCalendar,\n StyledCalendarIconWrapper,\n StyledCalendarIconWrapperContent,\n StyledCalendarIconWrapperPseudo,\n StyledPseudoMonthYearPicker,\n} from './Calendar.styles';\nimport MonthWrapper from './month-wrapper/MonthWrapper';\n\ninterface BaseProps {\n /**\n * An array to group dates into a category.\n */\n categories?: Categories[];\n /**\n * Custom colors for the thumb.\n */\n customThumbColors?: CustomThumbColors;\n /**\n * An array with dates and corresponding styles to highlight.\n */\n highlightedDates?: HighlightedDates[];\n /**\n * To disable the Calendar\n */\n isDisabled?: boolean;\n /**\n * The locale language to format the dates.\n */\n locale?: Language;\n /**\n * The maximum date that can be selected.\n */\n maxDate?: Date;\n /**\n * The minimum date that can be selected.\n */\n minDate?: Date;\n /**\n * An array of dates that should be disabled.\n */\n disabledDates?: Date[];\n /**\n * Whether the highlighted dates should be displayed for the greyed month overlay days.\n */\n shouldShowHighlightsInMonthOverlay?: boolean;\n /**\n * Shows the month and year pickers, if there are multiple months/years to select from.\n */\n showMonthYearPickers?: boolean;\n /**\n * Function to be executed when the selected date, dates or date interval change.\n * @param date\n */\n onChange?: (date: Date | Date[] | DateInterval) => void;\n /**\n * Function to be executed when the shown dates change. Returns the start of the displayed month and the end of the last displayed month (since depending on the available widths, there are one or two months displayed).\n @param { start: Date, end: Date }\n */\n onShownDatesChange?: (dates: { start: Date; end: Date }) => void;\n}\n\ninterface SingleSelectionProps {\n /**\n * The type of the calendar selection.\n */\n type?: CalendarType.Single;\n /**\n * A date that should be preselected.\n */\n selectedDate?: Date;\n selectedDates?: never;\n selectedDateInterval?: never;\n}\n\ninterface MultipleSelectionProps {\n /**\n * The type of the calendar selection.\n */\n type: CalendarType.Multiple;\n /**\n * An array of dates that should be preselected.\n */\n selectedDates?: Date[];\n selectedDate?: never;\n selectedDateInterval?: never;\n}\n\ninterface IntervalSelectionProps {\n /**\n * The type of the calendar selection.\n */\n type: CalendarType.Interval;\n /**\n * An interval that should be preselected.\n */\n selectedDateInterval?: DateInterval;\n selectedDates?: never;\n selectedDate?: never;\n}\n\nexport type CalendarProps = BaseProps &\n (SingleSelectionProps | MultipleSelectionProps | IntervalSelectionProps);\n\nconst DEFAULT_MAX_DATE = addYears(new Date(), 1);\nconst DEFAULT_MIN_DATE = subYears(new Date(), 1);\n\nconst Calendar: FC<CalendarProps> = ({\n locale = Language.German,\n maxDate = DEFAULT_MAX_DATE,\n minDate = DEFAULT_MIN_DATE,\n highlightedDates,\n onChange,\n customThumbColors,\n selectedDate,\n selectedDates,\n selectedDateInterval,\n categories,\n isDisabled,\n type = CalendarType.Single,\n shouldShowHighlightsInMonthOverlay = true,\n disabledDates = [],\n showMonthYearPickers: showMonthYearPickersProp,\n onShownDatesChange = () => {},\n}) => {\n const [currentDate, setCurrentDate] = useState<Date>();\n const [shouldRenderTwoMonths, setShouldRenderTwoMonths] = useState(true);\n const [internalSelectedDate, setInternalSelectedDate] = useState<\n Date | Date[] | DateInterval | undefined\n >(() => (type === CalendarType.Multiple ? [] : undefined));\n const [direction, setDirection] = useState<'left' | 'right' | undefined>();\n const [width, setWidth] = useState(0);\n\n const showMonthYearPickers = useMemo(() => {\n const hasMultipleMonths = differenceInCalendarMonths(maxDate, minDate) > 0;\n const hasMultipleYears = getYearsBetween(minDate, maxDate).length > 1;\n\n return !!(showMonthYearPickersProp && (hasMultipleMonths || hasMultipleYears));\n }, [minDate, maxDate, showMonthYearPickersProp]);\n\n const calendarRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (currentDate) {\n const start = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1);\n\n if (shouldRenderTwoMonths) {\n const end = new Date(currentDate.getFullYear(), currentDate.getMonth() + 2, 0);\n onShownDatesChange({\n start,\n end,\n });\n } else {\n const end = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0);\n onShownDatesChange({\n start,\n end,\n });\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [currentDate, shouldRenderTwoMonths]);\n\n useEffect(() => {\n const bounds = {\n start: minDate,\n end: maxDate,\n };\n if (type === CalendarType.Single) {\n if (selectedDate) {\n const isDisabledDate = disabledDates.some((disabledDate) =>\n isSameDay(selectedDate, disabledDate),\n );\n const isDateInBounds = isWithinInterval(selectedDate, bounds);\n\n if (!isDisabledDate && isDateInBounds) {\n setInternalSelectedDate(selectedDate);\n } else {\n console.warn(\n '[@chayns-components/date] Warning: Failed to set selectedDate, because it is disabled or out of bounds.',\n '\\nselectedDate:',\n selectedDate,\n ...(isDisabledDate ? ['\\nselectedDate is disabled'] : []),\n ...(isDateInBounds\n ? []\n : ['\\nselectedDate is outside of bounds:', { minDate, maxDate }]),\n );\n setInternalSelectedDate(() => undefined);\n }\n } else {\n setInternalSelectedDate(() => undefined);\n }\n } else if (type === CalendarType.Multiple) {\n if (selectedDates) {\n const disabledSelectedDates: Date[] = [];\n const datesOutsideOfBounds: Date[] = [];\n\n const filteredDates = selectedDates.filter((date) => {\n if (disabledDates.some((disabledDate) => isSameDay(date, disabledDate))) {\n disabledSelectedDates.push(date);\n return false;\n }\n\n if (!isWithinInterval(date, bounds)) {\n datesOutsideOfBounds.push(date);\n return false;\n }\n\n return true;\n });\n\n if (disabledSelectedDates.length > 0 || datesOutsideOfBounds.length > 0) {\n console.warn(\n '[@chayns-components/date] Warning: Failed to set all selectedDates, because some are disabled or out of bounds.',\n ...(disabledSelectedDates.length > 0\n ? ['\\nselectedDates that are disabled:', disabledSelectedDates]\n : []),\n ...(datesOutsideOfBounds.length > 0\n ? [\n '\\nselectedDates that are outside of bounds:',\n datesOutsideOfBounds,\n 'bounds:',\n { minDate, maxDate },\n ]\n : []),\n );\n }\n\n setInternalSelectedDate(filteredDates);\n } else {\n setInternalSelectedDate([]);\n }\n } else if (type === CalendarType.Interval) {\n if (selectedDateInterval) {\n const intervalIncludesDisabledDate =\n selectedDateInterval.end &&\n disabledDates.some((disabledDate) =>\n isWithinInterval(disabledDate, {\n start: selectedDateInterval.start,\n end: selectedDateInterval.end as Date,\n }),\n );\n\n const intervalIsInBounds =\n isWithinInterval(selectedDateInterval.start, bounds) &&\n (!selectedDateInterval.end ||\n isWithinInterval(selectedDateInterval.end, bounds));\n\n if (!intervalIncludesDisabledDate && intervalIsInBounds) {\n setInternalSelectedDate(selectedDateInterval);\n } else {\n console.warn(\n '[@chayns-components/date] Warning: Failed to set selectedDateInterval, because it includes disabled dates or dates that are out of bounds.',\n '\\nselectedDateInterval:',\n selectedDateInterval,\n ...(intervalIncludesDisabledDate\n ? ['\\ndisabled dates:', disabledDates]\n : []),\n ...(intervalIsInBounds ? [] : ['\\nbounds:', { minDate, maxDate }]),\n );\n setInternalSelectedDate(() => undefined);\n }\n }\n }\n }, [type, selectedDate, selectedDates, selectedDateInterval, disabledDates, minDate, maxDate]);\n\n useEffect(() => {\n if (calendarRef.current) {\n const resizeObserver = new ResizeObserver((entries) => {\n if (entries && entries[0]) {\n const observedWidth = entries[0].contentRect.width;\n\n setWidth(observedWidth - 30);\n\n if (observedWidth < 430) {\n setShouldRenderTwoMonths(false);\n } else {\n setShouldRenderTwoMonths(true);\n }\n }\n });\n\n resizeObserver.observe(calendarRef.current);\n\n return () => {\n resizeObserver.disconnect();\n };\n }\n\n return () => {};\n }, []);\n\n useEffect(() => {\n setCurrentDate((prevDate) =>\n isDateInRange({ minDate, maxDate, currentDate: prevDate || new Date() }),\n );\n }, [maxDate, minDate]);\n\n const handleLeftArrowClick = useCallback(() => {\n if (direction) return;\n\n setDirection('left');\n\n setCurrentDate((prevDate) => {\n if (!prevDate) {\n return prevDate;\n }\n\n const newDate = getNewDate(-1, prevDate);\n\n return isDateInRange({ minDate, maxDate, currentDate: newDate });\n });\n }, [maxDate, minDate, direction]);\n\n const handleRightArrowClick = useCallback(() => {\n if (direction) return;\n\n setDirection('right');\n\n setCurrentDate((prevDate) => {\n if (!prevDate) {\n return prevDate;\n }\n\n const newDate = getNewDate(1, prevDate);\n\n return isDateInRange({ minDate, maxDate, currentDate: newDate });\n });\n }, [maxDate, minDate, direction]);\n\n const handleSelect = useCallback(\n (date: Date) => {\n setInternalSelectedDate((prevDate) => {\n let onChangePayload: Date | Date[] | DateInterval | null = null;\n let newInternalSelectedDate: Date | Date[] | DateInterval | undefined;\n\n if (type === CalendarType.Single) {\n onChangePayload = date;\n newInternalSelectedDate = date;\n } else if (type === CalendarType.Multiple) {\n const prevSelectedDates = prevDate as Date[];\n // Selects or unselects date , depending on if it is already selected.\n if (prevSelectedDates.some((d) => isSameDay(d, date))) {\n newInternalSelectedDate = prevSelectedDates.filter(\n (d) => !isSameDay(d, date),\n );\n } else {\n newInternalSelectedDate = [...prevSelectedDates, date];\n }\n\n onChangePayload = newInternalSelectedDate;\n } else if (type === CalendarType.Interval) {\n const prevSelectedDateInterval = prevDate as DateInterval;\n\n const updateInterval = (start: Date, end?: Date): void => {\n const newInterval = { start, end };\n onChangePayload = newInterval;\n newInternalSelectedDate = newInterval;\n };\n\n // Sets first selection as interval start.\n if (!prevSelectedDateInterval) {\n updateInterval(date);\n } else if (prevSelectedDateInterval.start && !prevSelectedDateInterval.end) {\n // Sets second selection as interval start, if it is earlier than the previous interval start.\n // Else sets it as interval end.\n if (date < prevSelectedDateInterval.start) {\n updateInterval(date);\n } else {\n updateInterval(prevSelectedDateInterval.start, date);\n }\n } else {\n // Resets interval if a third date is selected.\n updateInterval(date);\n }\n }\n\n if (typeof onChange === 'function' && onChangePayload) {\n onChange(onChangePayload);\n }\n\n return newInternalSelectedDate;\n });\n },\n [type, onChange],\n );\n\n const handleAnimationFinished = () => {\n setDirection(() => undefined);\n };\n\n const ShouldShowLeftArrow = useMemo(() => {\n if (!currentDate) {\n return false;\n }\n\n return !isSameMonth(currentDate, minDate);\n }, [currentDate, minDate]);\n\n const ShouldShowRightArrow = useMemo(() => {\n if (!currentDate) {\n return false;\n }\n\n return !isSameMonth(currentDate, maxDate);\n }, [currentDate, maxDate]);\n\n return (\n <StyledCalendar ref={calendarRef} $isDisabled={isDisabled}>\n {ShouldShowLeftArrow ? (\n <StyledCalendarIconWrapper onClick={handleLeftArrowClick}>\n <StyledCalendarIconWrapperContent>\n {showMonthYearPickers && (\n <StyledPseudoMonthYearPicker>\n <ComboBox lists={[{ list: [] }]} placeholder=\"\" />\n </StyledPseudoMonthYearPicker>\n )}\n <Icon icons={['fa fa-angle-left']} />\n </StyledCalendarIconWrapperContent>\n </StyledCalendarIconWrapper>\n ) : (\n <StyledCalendarIconWrapperPseudo />\n )}\n {currentDate && (\n <MonthWrapper\n shouldRenderTwo={shouldRenderTwoMonths}\n currentDate={currentDate}\n width={width}\n locale={locale}\n direction={direction}\n customThumbColors={customThumbColors}\n onSelect={handleSelect}\n selectedDate={internalSelectedDate}\n highlightedDates={highlightedDates}\n categories={categories}\n onAnimationFinished={handleAnimationFinished}\n minDate={minDate}\n maxDate={maxDate}\n type={type}\n disabledDates={disabledDates}\n setCurrentDate={setCurrentDate}\n shouldShowHighlightsInMonthOverlay={shouldShowHighlightsInMonthOverlay}\n showMonthYearPickers={showMonthYearPickers}\n />\n )}\n {ShouldShowRightArrow ? (\n <StyledCalendarIconWrapper onClick={handleRightArrowClick}>\n <StyledCalendarIconWrapperContent>\n {showMonthYearPickers && (\n <StyledPseudoMonthYearPicker>\n <ComboBox lists={[{ list: [] }]} placeholder=\"\" />\n </StyledPseudoMonthYearPicker>\n )}\n <Icon icons={['fa fa-angle-right']} />\n </StyledCalendarIconWrapperContent>\n </StyledCalendarIconWrapper>\n ) : (\n <StyledCalendarIconWrapperPseudo />\n )}\n </StyledCalendar>\n );\n};\n\nCalendar.displayName = 'Calendar';\n\nexport default Calendar;\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,IAAI,QAAQ,yBAAyB;AACxD,SAASC,QAAQ,QAAQ,YAAY;AACrC,OAAOC,KAAK,IAAQC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACpF,SACIC,YAAY,QAKT,sBAAsB;AAC7B,SAASC,UAAU,EAAEC,eAAe,EAAEC,aAAa,QAAQ,sBAAsB;AACjF,SACIC,QAAQ,EACRC,0BAA0B,EAC1BC,SAAS,EACTC,WAAW,EACXC,gBAAgB,EAChBC,QAAQ,QACL,kBAAkB;AACzB,SACIC,cAAc,EACdC,yBAAyB,EACzBC,gCAAgC,EAChCC,+BAA+B,EAC/BC,2BAA2B,QACxB,mBAAmB;AAC1B,OAAOC,YAAY,MAAM,8BAA8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o","useRef","useState","CalendarType","getNewDate","getYearsBetween","isDateInRange","addYears","differenceInCalendarMonths","isSameDay","isSameMonth","isWithinInterval","subYears","StyledCalendar","StyledCalendarIconWrapper","StyledCalendarIconWrapperContent","StyledCalendarIconWrapperPseudo","StyledPseudoMonthYearPicker","MonthWrapper","DEFAULT_MAX_DATE","Date","DEFAULT_MIN_DATE","Calendar","locale","German","maxDate","minDate","highlightedDates","onChange","customThumbColors","selectedDate","selectedDates","selectedDateInterval","categories","isDisabled","type","Single","shouldShowHighlightsInMonthOverlay","disabledDates","showMonthYearPickers","showMonthYearPickersProp","onShownDatesChange","currentDate","setCurrentDate","shouldRenderTwoMonths","setShouldRenderTwoMonths","internalSelectedDate","setInternalSelectedDate","Multiple","undefined","direction","setDirection","width","setWidth","hasMultipleMonths","hasMultipleYears","length","calendarRef","start","getFullYear","getMonth","end","bounds","isDisabledDate","some","disabledDate","isDateInBounds","console","warn","disabledSelectedDates","datesOutsideOfBounds","filteredDates","filter","date","push","Interval","intervalIncludesDisabledDate","intervalIsInBounds","current","resizeObserver","ResizeObserver","entries","observedWidth","contentRect","observe","disconnect","prevDate","handleLeftArrowClick","newDate","handleRightArrowClick","handleSelect","onChangePayload","newInternalSelectedDate","prevSelectedDates","d","prevSelectedDateInterval","updateInterval","newInterval","handleAnimationFinished","ShouldShowLeftArrow","ShouldShowRightArrow","createElement","ref","$isDisabled","onClick","lists","list","placeholder","icons","shouldRenderTwo","onSelect","onAnimationFinished","displayName"],"sources":["../../../../src/components/calendar/Calendar.tsx"],"sourcesContent":["import { ComboBox, Icon } from '@chayns-components/core';\nimport { Language } from 'chayns-api';\nimport React, { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport {\n CalendarType,\n Categories,\n CustomThumbColors,\n DateInterval,\n HighlightedDates,\n} from '../../types/calendar';\nimport { getNewDate, getYearsBetween, isDateInRange } from '../../utils/calendar';\nimport {\n addYears,\n differenceInCalendarMonths,\n isSameDay,\n isSameMonth,\n isWithinInterval,\n subYears,\n} from '../../utils/date';\nimport {\n StyledCalendar,\n StyledCalendarIconWrapper,\n StyledCalendarIconWrapperContent,\n StyledCalendarIconWrapperPseudo,\n StyledPseudoMonthYearPicker,\n} from './Calendar.styles';\nimport MonthWrapper from './month-wrapper/MonthWrapper';\n\ninterface BaseProps {\n /**\n * An array to group dates into a category.\n */\n categories?: Categories[];\n /**\n * Custom colors for the thumb.\n */\n customThumbColors?: CustomThumbColors;\n /**\n * An array with dates and corresponding styles to highlight.\n */\n highlightedDates?: HighlightedDates[];\n /**\n * To disable the Calendar\n */\n isDisabled?: boolean;\n /**\n * The locale language to format the dates.\n */\n locale?: Language;\n /**\n * The maximum date that can be selected.\n */\n maxDate?: Date;\n /**\n * The minimum date that can be selected.\n */\n minDate?: Date;\n /**\n * An array of dates that should be disabled.\n */\n disabledDates?: Date[];\n /**\n * Whether the highlighted dates should be displayed for the greyed month overlay days.\n */\n shouldShowHighlightsInMonthOverlay?: boolean;\n /**\n * Shows the month and year pickers, if there are multiple months/years to select from.\n */\n showMonthYearPickers?: boolean;\n /**\n * Function to be executed when the selected date, dates or date interval change.\n * @param date\n */\n onChange?: (date: Date | Date[] | DateInterval) => void;\n /**\n * Function to be executed when the shown dates change. Returns the start of the displayed month and the end of the last displayed month (since depending on the available widths, there are one or two months displayed).\n @param { start: Date, end: Date }\n */\n onShownDatesChange?: (dates: { start: Date; end: Date }) => void;\n}\n\ninterface SingleSelectionProps {\n /**\n * The type of the calendar selection.\n */\n type?: CalendarType.Single;\n /**\n * A date that should be preselected.\n */\n selectedDate?: Date;\n selectedDates?: never;\n selectedDateInterval?: never;\n}\n\ninterface MultipleSelectionProps {\n /**\n * The type of the calendar selection.\n */\n type: CalendarType.Multiple;\n /**\n * An array of dates that should be preselected.\n */\n selectedDates?: Date[];\n selectedDate?: never;\n selectedDateInterval?: never;\n}\n\ninterface IntervalSelectionProps {\n /**\n * The type of the calendar selection.\n */\n type: CalendarType.Interval;\n /**\n * An interval that should be preselected.\n */\n selectedDateInterval?: DateInterval;\n selectedDates?: never;\n selectedDate?: never;\n}\n\nexport type CalendarProps = BaseProps &\n (SingleSelectionProps | MultipleSelectionProps | IntervalSelectionProps);\n\nconst DEFAULT_MAX_DATE = addYears(new Date(), 1);\nconst DEFAULT_MIN_DATE = subYears(new Date(), 1);\n\nconst Calendar: FC<CalendarProps> = ({\n locale = Language.German,\n maxDate = DEFAULT_MAX_DATE,\n minDate = DEFAULT_MIN_DATE,\n highlightedDates,\n onChange,\n customThumbColors,\n selectedDate,\n selectedDates,\n selectedDateInterval,\n categories,\n isDisabled,\n type = CalendarType.Single,\n shouldShowHighlightsInMonthOverlay = true,\n disabledDates = [],\n showMonthYearPickers: showMonthYearPickersProp,\n onShownDatesChange = () => {},\n}) => {\n const [currentDate, setCurrentDate] = useState<Date>();\n const [shouldRenderTwoMonths, setShouldRenderTwoMonths] = useState(true);\n const [internalSelectedDate, setInternalSelectedDate] = useState<\n Date | Date[] | DateInterval | undefined\n >(() => (type === CalendarType.Multiple ? [] : undefined));\n const [direction, setDirection] = useState<'left' | 'right' | undefined>();\n const [width, setWidth] = useState(0);\n\n const showMonthYearPickers = useMemo(() => {\n const hasMultipleMonths = differenceInCalendarMonths(maxDate, minDate) > 0;\n const hasMultipleYears = getYearsBetween(minDate, maxDate).length > 1;\n\n return !!(showMonthYearPickersProp && (hasMultipleMonths || hasMultipleYears));\n }, [minDate, maxDate, showMonthYearPickersProp]);\n\n const calendarRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (currentDate) {\n const start = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1);\n\n if (shouldRenderTwoMonths) {\n const end = new Date(currentDate.getFullYear(), currentDate.getMonth() + 2, 0);\n onShownDatesChange({\n start,\n end,\n });\n } else {\n const end = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0);\n onShownDatesChange({\n start,\n end,\n });\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [currentDate, shouldRenderTwoMonths]);\n\n useEffect(() => {\n const bounds = {\n start: minDate,\n end: maxDate,\n };\n if (type === CalendarType.Single) {\n if (selectedDate) {\n const isDisabledDate = disabledDates.some((disabledDate) =>\n isSameDay(selectedDate, disabledDate),\n );\n const isDateInBounds = isWithinInterval(selectedDate, bounds);\n\n if (!isDisabledDate && isDateInBounds) {\n setInternalSelectedDate(selectedDate);\n } else {\n console.warn(\n '[@chayns-components/date] Warning: Failed to set selectedDate, because it is disabled or out of bounds.',\n '\\nselectedDate:',\n selectedDate,\n ...(isDisabledDate ? ['\\nselectedDate is disabled'] : []),\n ...(isDateInBounds\n ? []\n : ['\\nselectedDate is outside of bounds:', { minDate, maxDate }]),\n );\n setInternalSelectedDate(() => undefined);\n }\n } else {\n setInternalSelectedDate(() => undefined);\n }\n } else if (type === CalendarType.Multiple) {\n if (selectedDates) {\n const disabledSelectedDates: Date[] = [];\n const datesOutsideOfBounds: Date[] = [];\n\n const filteredDates = selectedDates.filter((date) => {\n if (disabledDates.some((disabledDate) => isSameDay(date, disabledDate))) {\n disabledSelectedDates.push(date);\n return false;\n }\n\n if (!isWithinInterval(date, bounds)) {\n datesOutsideOfBounds.push(date);\n return false;\n }\n\n return true;\n });\n\n if (disabledSelectedDates.length > 0 || datesOutsideOfBounds.length > 0) {\n console.warn(\n '[@chayns-components/date] Warning: Failed to set all selectedDates, because some are disabled or out of bounds.',\n ...(disabledSelectedDates.length > 0\n ? ['\\nselectedDates that are disabled:', disabledSelectedDates]\n : []),\n ...(datesOutsideOfBounds.length > 0\n ? [\n '\\nselectedDates that are outside of bounds:',\n datesOutsideOfBounds,\n 'bounds:',\n { minDate, maxDate },\n ]\n : []),\n );\n }\n\n setInternalSelectedDate(filteredDates);\n } else {\n setInternalSelectedDate([]);\n }\n } else if (type === CalendarType.Interval) {\n if (selectedDateInterval) {\n const intervalIncludesDisabledDate =\n selectedDateInterval.end &&\n disabledDates.some((disabledDate) =>\n isWithinInterval(disabledDate, {\n start: selectedDateInterval.start,\n end: selectedDateInterval.end as Date,\n }),\n );\n\n const intervalIsInBounds =\n isWithinInterval(selectedDateInterval.start, bounds) &&\n (!selectedDateInterval.end ||\n isWithinInterval(selectedDateInterval.end, bounds));\n\n if (!intervalIncludesDisabledDate && intervalIsInBounds) {\n setInternalSelectedDate(selectedDateInterval);\n } else {\n console.warn(\n '[@chayns-components/date] Warning: Failed to set selectedDateInterval, because it includes disabled dates or dates that are out of bounds.',\n '\\nselectedDateInterval:',\n selectedDateInterval,\n ...(intervalIncludesDisabledDate\n ? ['\\ndisabled dates:', disabledDates]\n : []),\n ...(intervalIsInBounds ? [] : ['\\nbounds:', { minDate, maxDate }]),\n );\n setInternalSelectedDate(() => undefined);\n }\n }\n }\n }, [type, selectedDate, selectedDates, selectedDateInterval, disabledDates, minDate, maxDate]);\n\n useEffect(() => {\n if (calendarRef.current) {\n const resizeObserver = new ResizeObserver((entries) => {\n if (entries && entries[0]) {\n const observedWidth = entries[0].contentRect.width;\n\n setWidth(observedWidth - 30);\n\n if (observedWidth < 430) {\n setShouldRenderTwoMonths(false);\n } else {\n setShouldRenderTwoMonths(true);\n }\n }\n });\n\n resizeObserver.observe(calendarRef.current);\n\n return () => {\n resizeObserver.disconnect();\n };\n }\n\n return () => {};\n }, []);\n\n useEffect(() => {\n setCurrentDate((prevDate) =>\n isDateInRange({ minDate, maxDate, currentDate: prevDate || new Date() }),\n );\n }, [maxDate, minDate]);\n\n const handleLeftArrowClick = useCallback(() => {\n if (direction) return;\n\n setDirection('left');\n\n setCurrentDate((prevDate) => {\n if (!prevDate) {\n return prevDate;\n }\n\n const newDate = getNewDate(-1, prevDate);\n\n return isDateInRange({ minDate, maxDate, currentDate: newDate });\n });\n }, [maxDate, minDate, direction]);\n\n const handleRightArrowClick = useCallback(() => {\n if (direction) return;\n\n setDirection('right');\n\n setCurrentDate((prevDate) => {\n if (!prevDate) {\n return prevDate;\n }\n\n const newDate = getNewDate(1, prevDate);\n\n return isDateInRange({ minDate, maxDate, currentDate: newDate });\n });\n }, [maxDate, minDate, direction]);\n\n const handleSelect = useCallback(\n (date: Date) => {\n setInternalSelectedDate((prevDate) => {\n let onChangePayload: Date | Date[] | DateInterval | null = null;\n let newInternalSelectedDate: Date | Date[] | DateInterval | undefined;\n\n if (type === CalendarType.Single) {\n onChangePayload = date;\n newInternalSelectedDate = date;\n } else if (type === CalendarType.Multiple) {\n const prevSelectedDates = prevDate as Date[];\n // Selects or unselects date , depending on if it is already selected.\n if (prevSelectedDates.some((d) => isSameDay(d, date))) {\n newInternalSelectedDate = prevSelectedDates.filter(\n (d) => !isSameDay(d, date),\n );\n } else {\n newInternalSelectedDate = [...prevSelectedDates, date];\n }\n\n onChangePayload = newInternalSelectedDate;\n } else if (type === CalendarType.Interval) {\n const prevSelectedDateInterval = prevDate as DateInterval;\n\n const updateInterval = (start: Date, end?: Date): void => {\n const newInterval = { start, end };\n onChangePayload = newInterval;\n newInternalSelectedDate = newInterval;\n };\n\n // Sets first selection as interval start.\n if (!prevSelectedDateInterval) {\n updateInterval(date);\n } else if (prevSelectedDateInterval.start && !prevSelectedDateInterval.end) {\n // Sets second selection as interval start, if it is earlier than the previous interval start.\n // Else sets it as interval end.\n if (date < prevSelectedDateInterval.start) {\n updateInterval(date);\n } else {\n updateInterval(prevSelectedDateInterval.start, date);\n }\n } else {\n // Resets interval if a third date is selected.\n updateInterval(date);\n }\n }\n\n if (typeof onChange === 'function' && onChangePayload) {\n onChange(onChangePayload);\n }\n\n return newInternalSelectedDate;\n });\n },\n [type, onChange],\n );\n\n const handleAnimationFinished = () => {\n setDirection(() => undefined);\n };\n\n const ShouldShowLeftArrow = useMemo(() => {\n if (!currentDate) {\n return false;\n }\n\n return !isSameMonth(currentDate, minDate);\n }, [currentDate, minDate]);\n\n const ShouldShowRightArrow = useMemo(() => {\n if (!currentDate) {\n return false;\n }\n\n return !isSameMonth(currentDate, maxDate);\n }, [currentDate, maxDate]);\n\n return (\n <StyledCalendar ref={calendarRef} $isDisabled={isDisabled}>\n {ShouldShowLeftArrow ? (\n <StyledCalendarIconWrapper onClick={handleLeftArrowClick}>\n <StyledCalendarIconWrapperContent>\n {showMonthYearPickers && (\n <StyledPseudoMonthYearPicker>\n <ComboBox lists={[{ list: [] }]} placeholder=\"\" />\n </StyledPseudoMonthYearPicker>\n )}\n <Icon icons={['fa fa-angle-left']} />\n </StyledCalendarIconWrapperContent>\n </StyledCalendarIconWrapper>\n ) : (\n <StyledCalendarIconWrapperPseudo />\n )}\n {currentDate && (\n <MonthWrapper\n shouldRenderTwo={shouldRenderTwoMonths}\n currentDate={currentDate}\n width={width}\n locale={locale}\n direction={direction}\n customThumbColors={customThumbColors}\n onSelect={handleSelect}\n selectedDate={internalSelectedDate}\n highlightedDates={highlightedDates}\n categories={categories}\n onAnimationFinished={handleAnimationFinished}\n minDate={minDate}\n maxDate={maxDate}\n type={type}\n disabledDates={disabledDates}\n setCurrentDate={setCurrentDate}\n shouldShowHighlightsInMonthOverlay={shouldShowHighlightsInMonthOverlay}\n showMonthYearPickers={showMonthYearPickers}\n handleLeftArrowClick={handleLeftArrowClick}\n handleRightArrowClick={handleRightArrowClick}\n />\n )}\n {ShouldShowRightArrow ? (\n <StyledCalendarIconWrapper onClick={handleRightArrowClick}>\n <StyledCalendarIconWrapperContent>\n {showMonthYearPickers && (\n <StyledPseudoMonthYearPicker>\n <ComboBox lists={[{ list: [] }]} placeholder=\"\" />\n </StyledPseudoMonthYearPicker>\n )}\n <Icon icons={['fa fa-angle-right']} />\n </StyledCalendarIconWrapperContent>\n </StyledCalendarIconWrapper>\n ) : (\n <StyledCalendarIconWrapperPseudo />\n )}\n </StyledCalendar>\n );\n};\n\nCalendar.displayName = 'Calendar';\n\nexport default Calendar;\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,IAAI,QAAQ,yBAAyB;AACxD,SAASC,QAAQ,QAAQ,YAAY;AACrC,OAAOC,KAAK,IAAQC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ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,EAAE;IAAG,CAAC,CAAE;IAACC,WAAW,EAAC;EAAE,CAAE,CACxB,CAChC,eACD9G,KAAA,CAAAwG,aAAA,CAAC1G,IAAI;IAACiH,KAAK,EAAE,CAAC,mBAAmB;EAAE,CAAE,CACP,CACX,CAAC,gBAE5B/G,KAAA,CAAAwG,aAAA,CAACrF,+BAA+B,MAAE,CAE1B,CAAC;AAEzB,CAAC;AAEDM,QAAQ,CAAC0F,WAAW,GAAG,UAAU;AAEjC,eAAe1F,QAAQ","ignoreList":[]}
|
|
@@ -21,7 +21,9 @@ const MonthWrapper = ({
|
|
|
21
21
|
type,
|
|
22
22
|
disabledDates,
|
|
23
23
|
setCurrentDate,
|
|
24
|
-
showMonthYearPickers
|
|
24
|
+
showMonthYearPickers,
|
|
25
|
+
handleLeftArrowClick,
|
|
26
|
+
handleRightArrowClick
|
|
25
27
|
}) => {
|
|
26
28
|
const [content, setContent] = useState();
|
|
27
29
|
const [hoveringDay, setHoveringDay] = useState(null);
|
|
@@ -56,7 +58,9 @@ const MonthWrapper = ({
|
|
|
56
58
|
disabledDates: disabledDates,
|
|
57
59
|
setCurrentDate: setCurrentDate,
|
|
58
60
|
displayIndex: i,
|
|
59
|
-
showMonthYearPickers: showMonthYearPickers
|
|
61
|
+
showMonthYearPickers: showMonthYearPickers,
|
|
62
|
+
handleLeftArrowClick: handleLeftArrowClick,
|
|
63
|
+
handleRightArrowClick: handleRightArrowClick
|
|
60
64
|
}));
|
|
61
65
|
}
|
|
62
66
|
return items;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MonthWrapper.js","names":["React","useEffect","useMemo","useState","getMonthAndYear","getNewDate","Month","StyledMonthWrapper","StyledMotionWrapper","MonthWrapper","locale","currentDate","highlightedDates","selectedDate","onSelect","categories","direction","onAnimationFinished","shouldRenderTwo","width","customThumbColors","isDisabled","minDate","maxDate","shouldShowHighlightsInMonthOverlay","type","disabledDates","setCurrentDate","showMonthYearPickers","content","setContent","hoveringDay","setHoveringDay","monthHeight","items","i","date","month","year","push","createElement","height","key","displayIndex","prevState","map","element","index","props","animate","x","$height","$width","$isDisabled","transition","duration","onAnimationComplete","displayName"],"sources":["../../../../../src/components/calendar/month-wrapper/MonthWrapper.tsx"],"sourcesContent":["import { Language } from 'chayns-api';\nimport type { MotionProps } from 'motion/react';\nimport React, { FC, useEffect, useMemo, useState, type ReactElement } from 'react';\nimport {\n CalendarType,\n Categories,\n CustomThumbColors,\n DateInterval,\n HighlightedDates,\n} from '../../../types/calendar';\nimport { getMonthAndYear, getNewDate } from '../../../utils/calendar';\nimport Month from './month/Month';\nimport { StyledMonthWrapper, StyledMotionWrapper } from './MonthWrapper.styles';\n\nexport type MonthWrapperProps = {\n locale: Language;\n highlightedDates?: HighlightedDates[];\n onSelect: (date: Date) => void;\n selectedDate?: Date | Date[] | DateInterval;\n categories?: Categories[];\n currentDate: Date;\n direction?: 'left' | 'right';\n onAnimationFinished: () => void;\n shouldRenderTwo: boolean;\n width: number;\n isDisabled?: boolean;\n maxDate: Date;\n minDate: Date;\n type: CalendarType;\n disabledDates: Date[];\n setCurrentDate: (date: Date) => void;\n shouldShowHighlightsInMonthOverlay: boolean;\n showMonthYearPickers: boolean;\n customThumbColors?: CustomThumbColors;\n};\n\nconst MonthWrapper: FC<MonthWrapperProps> = ({\n locale,\n currentDate,\n highlightedDates,\n selectedDate,\n onSelect,\n categories,\n direction,\n onAnimationFinished,\n shouldRenderTwo,\n width,\n customThumbColors,\n isDisabled,\n minDate,\n maxDate,\n shouldShowHighlightsInMonthOverlay,\n type,\n disabledDates,\n setCurrentDate,\n showMonthYearPickers,\n}) => {\n const [content, setContent] = useState<ReactElement[]>();\n\n const [hoveringDay, setHoveringDay] = useState<Date | null>(null);\n\n const monthHeight = useMemo(() => width / (shouldRenderTwo ? 2 : 1), [width, shouldRenderTwo]);\n\n useEffect(() => {\n setContent(() => {\n // Initial render of months\n const items: ReactElement[] = [];\n\n for (let i = -1; i < 3; i++) {\n const date = getNewDate(i, currentDate);\n\n const { month, year } = getMonthAndYear(date);\n\n items.push(\n <Month\n height={monthHeight}\n key={`${month}-${year}`}\n month={month}\n year={year}\n locale={locale}\n onSelect={onSelect}\n highlightedDates={highlightedDates}\n shouldShowHighlightsInMonthOverlay={shouldShowHighlightsInMonthOverlay}\n categories={categories}\n selectedDate={selectedDate}\n minDate={minDate}\n maxDate={maxDate}\n type={type}\n customThumbColors={customThumbColors}\n hoveringDay={hoveringDay}\n setHoveringDay={setHoveringDay}\n disabledDates={disabledDates}\n setCurrentDate={setCurrentDate}\n displayIndex={i}\n showMonthYearPickers={showMonthYearPickers}\n />,\n );\n }\n\n return items;\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [monthHeight]);\n\n useEffect(() => {\n // Doesn't update props until animation is completed\n if (direction) return;\n\n setContent((prevState) =>\n (prevState ?? []).map((element, index) => {\n const date = getNewDate(index - 1, currentDate);\n\n const { month, year } = getMonthAndYear(date);\n\n return {\n ...element,\n props: {\n ...element.props,\n categories,\n disabledDates,\n displayIndex: index - 1,\n highlightedDates,\n hoveringDay,\n locale,\n onSelect,\n shouldShowHighlightsInMonthOverlay,\n maxDate,\n minDate,\n month,\n customThumbColors,\n selectedDate,\n setCurrentDate,\n setHoveringDay,\n showMonthYearPickers,\n type,\n year,\n } as ReactElement,\n };\n }),\n );\n }, [\n customThumbColors,\n categories,\n currentDate,\n direction,\n disabledDates,\n highlightedDates,\n hoveringDay,\n locale,\n onAnimationFinished,\n onSelect,\n maxDate,\n minDate,\n selectedDate,\n setCurrentDate,\n setHoveringDay,\n showMonthYearPickers,\n type,\n shouldShowHighlightsInMonthOverlay,\n ]);\n\n const animate: MotionProps['animate'] = useMemo(() => {\n if (shouldRenderTwo) {\n switch (true) {\n case direction === 'left':\n return { x: '0%' };\n case direction === 'right':\n return { x: '-100%' };\n default:\n return { x: '-50%' };\n }\n } else {\n switch (true) {\n case direction === 'left':\n return { x: '0%' };\n case direction === 'right':\n return { x: '-200%' };\n default:\n return { x: '-100%' };\n }\n }\n }, [direction, shouldRenderTwo]);\n\n return (\n <StyledMonthWrapper $height={monthHeight} $width={width}>\n <StyledMotionWrapper\n animate={animate}\n $isDisabled={isDisabled}\n transition={{\n type: 'tween',\n duration: !direction ? 0 : 0.2,\n }}\n onAnimationComplete={onAnimationFinished}\n >\n {content}\n </StyledMotionWrapper>\n </StyledMonthWrapper>\n );\n};\n\nMonthWrapper.displayName = 'MonthWrapper';\n\nexport default MonthWrapper;\n"],"mappings":"AAEA,OAAOA,KAAK,IAAQC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAA2B,OAAO;AAQlF,SAASC,eAAe,EAAEC,UAAU,QAAQ,yBAAyB;AACrE,OAAOC,KAAK,MAAM,eAAe;AACjC,SAASC,kBAAkB,EAAEC,mBAAmB,QAAQ,uBAAuB;AAwB/E,MAAMC,YAAmC,GAAGA,CAAC;EACzCC,MAAM;EACNC,WAAW;EACXC,gBAAgB;EAChBC,YAAY;EACZC,QAAQ;EACRC,UAAU;EACVC,SAAS;EACTC,mBAAmB;EACnBC,eAAe;EACfC,KAAK;EACLC,iBAAiB;EACjBC,UAAU;EACVC,OAAO;EACPC,OAAO;EACPC,kCAAkC;EAClCC,IAAI;EACJC,aAAa;EACbC,cAAc;EACdC;AACJ,CAAC,KAAK;EACF,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAG3B,QAAQ,CAAiB,CAAC;EAExD,MAAM,CAAC4B,WAAW,EAAEC,cAAc,CAAC,GAAG7B,QAAQ,CAAc,IAAI,CAAC;EAEjE,MAAM8B,WAAW,GAAG/B,OAAO,CAAC,MAAMiB,KAAK,IAAID,eAAe,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAACC,KAAK,EAAED,eAAe,CAAC,CAAC;EAE9FjB,SAAS,CAAC,MAAM;IACZ6B,UAAU,CAAC,MAAM;MACb;MACA,MAAMI,KAAqB,GAAG,EAAE;MAEhC,KAAK,IAAIC,CAAC,GAAG,CAAC,CAAC,E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MAC7B;IACJ;EACJ,CAAC,EAAE,CAAClC,SAAS,EAAEE,eAAe,CAAC,CAAC;EAEhC,oBACIlB,KAAA,CAAAwC,aAAA,CAACjC,kBAAkB;IAAC4C,OAAO,EAAElB,WAAY;IAACmB,MAAM,EAAEjC;EAAM,gBACpDnB,KAAA,CAAAwC,aAAA,CAAChC,mBAAmB;IAChByC,OAAO,EAAEA,OAAQ;IACjBI,WAAW,EAAEhC,UAAW;IACxBiC,UAAU,EAAE;MACR7B,IAAI,EAAE,OAAO;MACb8B,QAAQ,EAAE,CAACvC,SAAS,GAAG,CAAC,GAAG;IAC/B,CAAE;IACFwC,mBAAmB,EAAEvC;EAAoB,GAExCY,OACgB,CACL,CAAC;AAE7B,CAAC;AAEDpB,YAAY,CAACgD,WAAW,GAAG,cAAc;AAEzC,eAAehD,YAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"MonthWrapper.js","names":["React","useEffect","useMemo","useState","getMonthAndYear","getNewDate","Month","StyledMonthWrapper","StyledMotionWrapper","MonthWrapper","locale","currentDate","highlightedDates","selectedDate","onSelect","categories","direction","onAnimationFinished","shouldRenderTwo","width","customThumbColors","isDisabled","minDate","maxDate","shouldShowHighlightsInMonthOverlay","type","disabledDates","setCurrentDate","showMonthYearPickers","handleLeftArrowClick","handleRightArrowClick","content","setContent","hoveringDay","setHoveringDay","monthHeight","items","i","date","month","year","push","createElement","height","key","displayIndex","prevState","map","element","index","props","animate","x","$height","$width","$isDisabled","transition","duration","onAnimationComplete","displayName"],"sources":["../../../../../src/components/calendar/month-wrapper/MonthWrapper.tsx"],"sourcesContent":["import { Language } from 'chayns-api';\nimport type { MotionProps } from 'motion/react';\nimport React, { FC, useEffect, useMemo, useState, type ReactElement } from 'react';\nimport {\n CalendarType,\n Categories,\n CustomThumbColors,\n DateInterval,\n HighlightedDates,\n} from '../../../types/calendar';\nimport { getMonthAndYear, getNewDate } from '../../../utils/calendar';\nimport Month from './month/Month';\nimport { StyledMonthWrapper, StyledMotionWrapper } from './MonthWrapper.styles';\n\nexport type MonthWrapperProps = {\n locale: Language;\n highlightedDates?: HighlightedDates[];\n onSelect: (date: Date) => void;\n selectedDate?: Date | Date[] | DateInterval;\n categories?: Categories[];\n currentDate: Date;\n direction?: 'left' | 'right';\n onAnimationFinished: () => void;\n shouldRenderTwo: boolean;\n width: number;\n isDisabled?: boolean;\n maxDate: Date;\n minDate: Date;\n type: CalendarType;\n disabledDates: Date[];\n setCurrentDate: (date: Date) => void;\n shouldShowHighlightsInMonthOverlay: boolean;\n showMonthYearPickers: boolean;\n customThumbColors?: CustomThumbColors;\n handleLeftArrowClick: () => void;\n handleRightArrowClick: () => void;\n};\n\nconst MonthWrapper: FC<MonthWrapperProps> = ({\n locale,\n currentDate,\n highlightedDates,\n selectedDate,\n onSelect,\n categories,\n direction,\n onAnimationFinished,\n shouldRenderTwo,\n width,\n customThumbColors,\n isDisabled,\n minDate,\n maxDate,\n shouldShowHighlightsInMonthOverlay,\n type,\n disabledDates,\n setCurrentDate,\n showMonthYearPickers,\n handleLeftArrowClick,\n handleRightArrowClick,\n}) => {\n const [content, setContent] = useState<ReactElement[]>();\n\n const [hoveringDay, setHoveringDay] = useState<Date | null>(null);\n\n const monthHeight = useMemo(() => width / (shouldRenderTwo ? 2 : 1), [width, shouldRenderTwo]);\n\n useEffect(() => {\n setContent(() => {\n // Initial render of months\n const items: ReactElement[] = [];\n\n for (let i = -1; i < 3; i++) {\n const date = getNewDate(i, currentDate);\n\n const { month, year } = getMonthAndYear(date);\n\n items.push(\n <Month\n height={monthHeight}\n key={`${month}-${year}`}\n month={month}\n year={year}\n locale={locale}\n onSelect={onSelect}\n highlightedDates={highlightedDates}\n shouldShowHighlightsInMonthOverlay={shouldShowHighlightsInMonthOverlay}\n categories={categories}\n selectedDate={selectedDate}\n minDate={minDate}\n maxDate={maxDate}\n type={type}\n customThumbColors={customThumbColors}\n hoveringDay={hoveringDay}\n setHoveringDay={setHoveringDay}\n disabledDates={disabledDates}\n setCurrentDate={setCurrentDate}\n displayIndex={i}\n showMonthYearPickers={showMonthYearPickers}\n handleLeftArrowClick={handleLeftArrowClick}\n handleRightArrowClick={handleRightArrowClick}\n />,\n );\n }\n\n return items;\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [monthHeight]);\n\n useEffect(() => {\n // Doesn't update props until animation is completed\n if (direction) return;\n\n setContent((prevState) =>\n (prevState ?? []).map((element, index) => {\n const date = getNewDate(index - 1, currentDate);\n\n const { month, year } = getMonthAndYear(date);\n\n return {\n ...element,\n props: {\n ...element.props,\n categories,\n disabledDates,\n displayIndex: index - 1,\n highlightedDates,\n hoveringDay,\n locale,\n onSelect,\n shouldShowHighlightsInMonthOverlay,\n maxDate,\n minDate,\n month,\n customThumbColors,\n selectedDate,\n setCurrentDate,\n setHoveringDay,\n showMonthYearPickers,\n type,\n year,\n } as ReactElement,\n };\n }),\n );\n }, [\n customThumbColors,\n categories,\n currentDate,\n direction,\n disabledDates,\n highlightedDates,\n hoveringDay,\n locale,\n onAnimationFinished,\n onSelect,\n maxDate,\n minDate,\n selectedDate,\n setCurrentDate,\n setHoveringDay,\n showMonthYearPickers,\n type,\n shouldShowHighlightsInMonthOverlay,\n ]);\n\n const animate: MotionProps['animate'] = useMemo(() => {\n if (shouldRenderTwo) {\n switch (true) {\n case direction === 'left':\n return { x: '0%' };\n case direction === 'right':\n return { x: '-100%' };\n default:\n return { x: '-50%' };\n }\n } else {\n switch (true) {\n case direction === 'left':\n return { x: '0%' };\n case direction === 'right':\n return { x: '-200%' };\n default:\n return { x: '-100%' };\n }\n }\n }, [direction, shouldRenderTwo]);\n\n return (\n <StyledMonthWrapper $height={monthHeight} $width={width}>\n <StyledMotionWrapper\n animate={animate}\n $isDisabled={isDisabled}\n transition={{\n type: 'tween',\n duration: !direction ? 0 : 0.2,\n }}\n onAnimationComplete={onAnimationFinished}\n >\n {content}\n </StyledMotionWrapper>\n </StyledMonthWrapper>\n );\n};\n\nMonthWrapper.displayName = 'MonthWrap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BACpDnB,KAAA,CAAA0C,aAAA,CAAClC,mBAAmB;IAChB2C,OAAO,EAAEA,OAAQ;IACjBI,WAAW,EAAElC,UAAW;IACxBmC,UAAU,EAAE;MACR/B,IAAI,EAAE,OAAO;MACbgC,QAAQ,EAAE,CAACzC,SAAS,GAAG,CAAC,GAAG;IAC/B,CAAE;IACF0C,mBAAmB,EAAEzC;EAAoB,GAExCc,OACgB,CACL,CAAC;AAE7B,CAAC;AAEDtB,YAAY,CAACkD,WAAW,GAAG,cAAc;AAEzC,eAAelD,YAAY","ignoreList":[]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import MonthYearPickers from '../../month-year-pickers/MonthYearPickers';
|
|
3
3
|
import DayWrapper from './day-wrapper/DayWrapper';
|
|
4
4
|
import { StyledMonth, StyledMonthHead } from './Month.styles';
|
|
5
5
|
import WeekdayWrapper from './weekday-wrapper/WeekdayWrapper';
|
|
6
|
+
const minSwipeDistance = 50;
|
|
6
7
|
const Month = ({
|
|
7
8
|
month,
|
|
8
9
|
year,
|
|
@@ -22,37 +23,63 @@ const Month = ({
|
|
|
22
23
|
disabledDates,
|
|
23
24
|
setCurrentDate,
|
|
24
25
|
displayIndex,
|
|
25
|
-
showMonthYearPickers
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
26
|
+
showMonthYearPickers,
|
|
27
|
+
handleLeftArrowClick,
|
|
28
|
+
handleRightArrowClick
|
|
29
|
+
}) => {
|
|
30
|
+
const [touchStart, setTouchStart] = useState();
|
|
31
|
+
const [touchEnd, setTouchEnd] = useState();
|
|
32
|
+
const onTouchStart = e => {
|
|
33
|
+
setTouchEnd(undefined);
|
|
34
|
+
setTouchStart(e.targetTouches[0]?.clientX);
|
|
35
|
+
};
|
|
36
|
+
const onTouchMove = e => {
|
|
37
|
+
setTouchEnd(e.targetTouches[0]?.clientX);
|
|
38
|
+
};
|
|
39
|
+
const onTouchEnd = () => {
|
|
40
|
+
if (!touchStart || !touchEnd) return;
|
|
41
|
+
const distance = touchStart - touchEnd;
|
|
42
|
+
if (distance < -minSwipeDistance) {
|
|
43
|
+
handleLeftArrowClick();
|
|
44
|
+
}
|
|
45
|
+
if (distance > minSwipeDistance) {
|
|
46
|
+
handleRightArrowClick();
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
return /*#__PURE__*/React.createElement(StyledMonth, {
|
|
50
|
+
$height: height,
|
|
51
|
+
onTouchStart: onTouchStart,
|
|
52
|
+
onTouchMove: onTouchMove,
|
|
53
|
+
onTouchEnd: onTouchEnd
|
|
54
|
+
}, /*#__PURE__*/React.createElement(StyledMonthHead, null, /*#__PURE__*/React.createElement(MonthYearPickers, {
|
|
55
|
+
month: month,
|
|
56
|
+
year: year,
|
|
57
|
+
locale: locale,
|
|
58
|
+
minDate: minDate,
|
|
59
|
+
maxDate: maxDate,
|
|
60
|
+
setCurrentDate: setCurrentDate,
|
|
61
|
+
displayIndex: displayIndex,
|
|
62
|
+
showMonthYearPickers: showMonthYearPickers
|
|
63
|
+
})), /*#__PURE__*/React.createElement(WeekdayWrapper, {
|
|
64
|
+
locale: locale
|
|
65
|
+
}), /*#__PURE__*/React.createElement(DayWrapper, {
|
|
66
|
+
key: `day-wrapper-${month}`,
|
|
67
|
+
categories: categories,
|
|
68
|
+
selectedDate: selectedDate,
|
|
69
|
+
customThumbColors: customThumbColors,
|
|
70
|
+
month: month,
|
|
71
|
+
year: year,
|
|
72
|
+
onSelect: onSelect,
|
|
73
|
+
shouldShowHighlightsInMonthOverlay: shouldShowHighlightsInMonthOverlay,
|
|
74
|
+
highlightedDates: highlightedDates,
|
|
75
|
+
minDate: minDate,
|
|
76
|
+
maxDate: maxDate,
|
|
77
|
+
type: type,
|
|
78
|
+
hoveringDay: hoveringDay,
|
|
79
|
+
setHoveringDay: setHoveringDay,
|
|
80
|
+
disabledDates: disabledDates
|
|
81
|
+
}));
|
|
82
|
+
};
|
|
56
83
|
Month.displayName = 'Month';
|
|
57
84
|
export default Month;
|
|
58
85
|
//# sourceMappingURL=Month.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Month.js","names":["React","MonthYearPickers","DayWrapper","StyledMonth","StyledMonthHead","WeekdayWrapper","Month","month","year","locale","highlightedDates","selectedDate","onSelect","categories","height","minDate","maxDate","customThumbColors","shouldShowHighlightsInMonthOverlay","type","hoveringDay","setHoveringDay","disabledDates","setCurrentDate","displayIndex","showMonthYearPickers","createElement","$height","key","displayName"],"sources":["../../../../../../src/components/calendar/month-wrapper/month/Month.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport {\n CalendarType,\n Categories,\n CustomThumbColors,\n DateInterval,\n EMonth,\n HighlightedDates,\n} from '../../../../types/calendar';\nimport MonthYearPickers from '../../month-year-pickers/MonthYearPickers';\nimport DayWrapper from './day-wrapper/DayWrapper';\nimport { StyledMonth, StyledMonthHead } from './Month.styles';\nimport WeekdayWrapper from './weekday-wrapper/WeekdayWrapper';\nimport { Language } from 'chayns-api';\n\nexport type MonthProps = {\n month: EMonth;\n year: number;\n locale: Language;\n highlightedDates?: HighlightedDates[];\n onSelect: (date: Date) => void;\n selectedDate?: Date | Date[] | DateInterval;\n categories?: Categories[];\n height: number;\n minDate: Date;\n maxDate: Date;\n type: CalendarType;\n hoveringDay: Date | null;\n setHoveringDay: (date: Date | null) => void;\n disabledDates: Date[];\n setCurrentDate: (date: Date) => void;\n displayIndex?: number;\n shouldShowHighlightsInMonthOverlay: boolean;\n customThumbColors?: CustomThumbColors;\n showMonthYearPickers: boolean;\n};\n\nconst Month: FC<MonthProps> = ({\n month,\n year,\n locale,\n highlightedDates,\n selectedDate,\n onSelect,\n categories,\n height,\n minDate,\n maxDate,\n customThumbColors,\n shouldShowHighlightsInMonthOverlay,\n type,\n hoveringDay,\n setHoveringDay,\n disabledDates,\n setCurrentDate,\n displayIndex,\n showMonthYearPickers,\n}) => (\n <StyledMonth
|
|
1
|
+
{"version":3,"file":"Month.js","names":["React","useState","MonthYearPickers","DayWrapper","StyledMonth","StyledMonthHead","WeekdayWrapper","minSwipeDistance","Month","month","year","locale","highlightedDates","selectedDate","onSelect","categories","height","minDate","maxDate","customThumbColors","shouldShowHighlightsInMonthOverlay","type","hoveringDay","setHoveringDay","disabledDates","setCurrentDate","displayIndex","showMonthYearPickers","handleLeftArrowClick","handleRightArrowClick","touchStart","setTouchStart","touchEnd","setTouchEnd","onTouchStart","e","undefined","targetTouches","clientX","onTouchMove","onTouchEnd","distance","createElement","$height","key","displayName"],"sources":["../../../../../../src/components/calendar/month-wrapper/month/Month.tsx"],"sourcesContent":["import React, { FC, TouchEvent, useState } from 'react';\nimport {\n CalendarType,\n Categories,\n CustomThumbColors,\n DateInterval,\n EMonth,\n HighlightedDates,\n} from '../../../../types/calendar';\nimport MonthYearPickers from '../../month-year-pickers/MonthYearPickers';\nimport DayWrapper from './day-wrapper/DayWrapper';\nimport { StyledMonth, StyledMonthHead } from './Month.styles';\nimport WeekdayWrapper from './weekday-wrapper/WeekdayWrapper';\nimport { Language } from 'chayns-api';\n\nexport type MonthProps = {\n month: EMonth;\n year: number;\n locale: Language;\n highlightedDates?: HighlightedDates[];\n onSelect: (date: Date) => void;\n selectedDate?: Date | Date[] | DateInterval;\n categories?: Categories[];\n height: number;\n minDate: Date;\n maxDate: Date;\n type: CalendarType;\n hoveringDay: Date | null;\n setHoveringDay: (date: Date | null) => void;\n disabledDates: Date[];\n setCurrentDate: (date: Date) => void;\n displayIndex?: number;\n shouldShowHighlightsInMonthOverlay: boolean;\n customThumbColors?: CustomThumbColors;\n showMonthYearPickers: boolean;\n handleLeftArrowClick: () => void;\n handleRightArrowClick: () => void;\n};\n\nconst minSwipeDistance = 50;\n\nconst Month: FC<MonthProps> = ({\n month,\n year,\n locale,\n highlightedDates,\n selectedDate,\n onSelect,\n categories,\n height,\n minDate,\n maxDate,\n customThumbColors,\n shouldShowHighlightsInMonthOverlay,\n type,\n hoveringDay,\n setHoveringDay,\n disabledDates,\n setCurrentDate,\n displayIndex,\n showMonthYearPickers,\n handleLeftArrowClick,\n handleRightArrowClick,\n}) => {\n const [touchStart, setTouchStart] = useState<undefined | number>();\n const [touchEnd, setTouchEnd] = useState<undefined | number>();\n\n const onTouchStart = (e: TouchEvent<HTMLDivElement>) => {\n setTouchEnd(undefined);\n setTouchStart(e.targetTouches[0]?.clientX);\n };\n\n const onTouchMove = (e: TouchEvent<HTMLDivElement>) => {\n setTouchEnd(e.targetTouches[0]?.clientX);\n };\n\n const onTouchEnd = () => {\n if (!touchStart || !touchEnd) return;\n const distance = touchStart - touchEnd;\n if (distance < -minSwipeDistance) {\n handleLeftArrowClick();\n }\n if (distance > minSwipeDistance) {\n handleRightArrowClick();\n }\n };\n\n return (\n <StyledMonth\n $height={height}\n onTouchStart={onTouchStart}\n onTouchMove={onTouchMove}\n onTouchEnd={onTouchEnd}\n >\n <StyledMonthHead>\n <MonthYearPickers\n month={month}\n year={year}\n locale={locale}\n minDate={minDate}\n maxDate={maxDate}\n setCurrentDate={setCurrentDate}\n displayIndex={displayIndex}\n showMonthYearPickers={showMonthYearPickers}\n />\n </StyledMonthHead>\n <WeekdayWrapper locale={locale} />\n <DayWrapper\n key={`day-wrapper-${month}`}\n categories={categories}\n selectedDate={selectedDate}\n customThumbColors={customThumbColors}\n month={month}\n year={year}\n onSelect={onSelect}\n shouldShowHighlightsInMonthOverlay={shouldShowHighlightsInMonthOverlay}\n highlightedDates={highlightedDates}\n minDate={minDate}\n maxDate={maxDate}\n type={type}\n hoveringDay={hoveringDay}\n setHoveringDay={setHoveringDay}\n disabledDates={disabledDates}\n />\n </StyledMonth>\n );\n};\n\nMonth.displayName = 'Month';\n\nexport default Month;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAoBC,QAAQ,QAAQ,OAAO;AASvD,OAAOC,gBAAgB,MAAM,2CAA2C;AACxE,OAAOC,UAAU,MAAM,0BAA0B;AACjD,SAASC,WAAW,EAAEC,eAAe,QAAQ,gBAAgB;AAC7D,OAAOC,cAAc,MAAM,kCAAkC;AA2B7D,MAAMC,gBAAgB,GAAG,EAAE;AAE3B,MAAMC,KAAqB,GAAGA,CAAC;EAC3BC,KAAK;EACLC,IAAI;EACJC,MAAM;EACNC,gBAAgB;EAChBC,YAAY;EACZC,QAAQ;EACRC,UAAU;EACVC,MAAM;EACNC,OAAO;EACPC,OAAO;EACPC,iBAAiB;EACjBC,kCAAkC;EAClCC,IAAI;EACJC,WAAW;EACXC,cAAc;EACdC,aAAa;EACbC,cAAc;EACdC,YAAY;EACZC,oBAAoB;EACpBC,oBAAoB;EACpBC;AACJ,CAAC,KAAK;EACF,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAG9B,QAAQ,CAAqB,CAAC;EAClE,MAAM,CAAC+B,QAAQ,EAAEC,WAAW,CAAC,GAAGhC,QAAQ,CAAqB,CAAC;EAE9D,MAAMiC,YAAY,GAAIC,CAA6B,IAAK;IACpDF,WAAW,CAACG,SAAS,CAAC;IACtBL,aAAa,CAACI,CAAC,CAACE,aAAa,CAAC,CAAC,CAAC,EAAEC,OAAO,CAAC;EAC9C,CAAC;EAED,MAAMC,WAAW,GAAIJ,CAA6B,IAAK;IACnDF,WAAW,CAACE,CAAC,CAACE,aAAa,CAAC,CAAC,CAAC,EAAEC,OAAO,CAAC;EAC5C,CAAC;EAED,MAAME,UAAU,GAAGA,CAAA,KAAM;IACrB,IAAI,CAACV,UAAU,IAAI,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EA,cAAe;IAC/BC,aAAa,EAAEA;EAAc,CAChC,CACQ,CAAC;AAEtB,CAAC;AAEDhB,KAAK,CAACqC,WAAW,GAAG,OAAO;AAE3B,eAAerC,KAAK","ignoreList":[]}
|
|
@@ -21,6 +21,8 @@ export type MonthWrapperProps = {
|
|
|
21
21
|
shouldShowHighlightsInMonthOverlay: boolean;
|
|
22
22
|
showMonthYearPickers: boolean;
|
|
23
23
|
customThumbColors?: CustomThumbColors;
|
|
24
|
+
handleLeftArrowClick: () => void;
|
|
25
|
+
handleRightArrowClick: () => void;
|
|
24
26
|
};
|
|
25
27
|
declare const MonthWrapper: FC<MonthWrapperProps>;
|
|
26
28
|
export default MonthWrapper;
|
|
@@ -21,6 +21,8 @@ export type MonthProps = {
|
|
|
21
21
|
shouldShowHighlightsInMonthOverlay: boolean;
|
|
22
22
|
customThumbColors?: CustomThumbColors;
|
|
23
23
|
showMonthYearPickers: boolean;
|
|
24
|
+
handleLeftArrowClick: () => void;
|
|
25
|
+
handleRightArrowClick: () => void;
|
|
24
26
|
};
|
|
25
27
|
declare const Month: FC<MonthProps>;
|
|
26
28
|
export default Month;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chayns-components/date",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.1255",
|
|
4
4
|
"description": "A set of beautiful React components for developing your own applications with chayns.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"browserslist": [
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"typescript": "^5.9.2"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@chayns-components/core": "^5.0.0-beta.
|
|
72
|
+
"@chayns-components/core": "^5.0.0-beta.1254",
|
|
73
73
|
"uuid": "^10.0.0"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"publishConfig": {
|
|
83
83
|
"access": "public"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "b963c3bb747adec1df8e4c736cf16fcc0aaf089a"
|
|
86
86
|
}
|