@salutejs/plasma-new-hope 0.80.0-dev.0 → 0.81.0-canary.1203.9092095304.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Calendar/Calendar.types.js.map +1 -1
- package/cjs/components/Calendar/CalendarBase/CalendarBase.js +3 -1
- package/cjs/components/Calendar/CalendarBase/CalendarBase.js.map +1 -1
- package/cjs/components/Calendar/hooks/useDays.js +6 -3
- package/cjs/components/Calendar/hooks/useDays.js.map +1 -1
- package/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js +2 -1
- package/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js.map +1 -1
- package/es/components/Calendar/Calendar.types.js.map +1 -1
- package/es/components/Calendar/CalendarBase/CalendarBase.js +3 -1
- package/es/components/Calendar/CalendarBase/CalendarBase.js.map +1 -1
- package/es/components/Calendar/hooks/useDays.js +6 -3
- package/es/components/Calendar/hooks/useDays.js.map +1 -1
- package/es/components/Calendar/ui/CalendarDays/CalendarDays.js +2 -1
- package/es/components/Calendar/ui/CalendarDays/CalendarDays.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Calendar/CalendarBase/CalendarBase.js +3 -1
- package/styled-components/cjs/components/Calendar/hooks/useDays.js +6 -3
- package/styled-components/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js +2 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Calendar/Calendar.stories.tsx +18 -6
- package/styled-components/cjs/examples/plasma_web/components/Calendar/Calendar.stories.tsx +18 -6
- package/styled-components/cjs/examples/sds_engineer/components/Calendar/Calendar.stories.tsx +18 -6
- package/styled-components/es/components/Calendar/CalendarBase/CalendarBase.js +3 -1
- package/styled-components/es/components/Calendar/hooks/useDays.js +6 -3
- package/styled-components/es/components/Calendar/ui/CalendarDays/CalendarDays.js +2 -1
- package/styled-components/es/examples/plasma_b2c/components/Calendar/Calendar.stories.tsx +18 -6
- package/styled-components/es/examples/plasma_web/components/Calendar/Calendar.stories.tsx +18 -6
- package/styled-components/es/examples/sds_engineer/components/Calendar/Calendar.stories.tsx +18 -6
- package/types/components/Calendar/Calendar.types.d.ts +4 -0
- package/types/components/Calendar/Calendar.types.d.ts.map +1 -1
- package/types/components/Calendar/CalendarBase/CalendarBase.d.ts.map +1 -1
- package/types/components/Calendar/hooks/useDays.d.ts +1 -1
- package/types/components/Calendar/hooks/useDays.d.ts.map +1 -1
- package/types/components/Calendar/ui/CalendarDays/CalendarDays.d.ts.map +1 -1
- package/types/components/Calendar/ui/CalendarDays/CalendarDays.types.d.ts +1 -0
- package/types/components/Calendar/ui/CalendarDays/CalendarDays.types.d.ts.map +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Calendar.types.js","sources":["../../../src/components/Calendar/Calendar.types.ts"],"sourcesContent":["import { HTMLAttributes, MutableRefObject } from 'react';\n\nimport type { CalendarBaseProps } from './CalendarBase/CalendarBase';\nimport type { CalendarDoubleProps } from './CalendarDouble/CalendarDouble';\n\nexport enum Keys {\n pageUp = 33,\n pageDown = 34,\n home = 36,\n end = 35,\n left = 37,\n right = 39,\n up = 38,\n down = 40,\n enter = 13,\n space = 32,\n}\n\nexport interface DateObject {\n day: number;\n monthIndex: number;\n year: number;\n}\n\nexport interface ItemProps {\n isCurrent: boolean;\n isSelected: boolean;\n}\n\nexport interface DateItem extends ItemProps {\n isDayInCurrentMonth: boolean;\n inRange?: boolean;\n date: DateObject;\n events?: EventDay[];\n disabled?: boolean;\n isOutOfMinMaxRange?: boolean;\n disabledArrowKey?: string;\n disabledMonths?: string;\n}\n\nexport interface DayProps extends Partial<ItemProps> {\n isDouble?: boolean;\n isDayInCurrentMonth?: boolean;\n isHovered?: boolean;\n inRange?: boolean;\n sideInRange?: 'left' | 'right';\n disabled?: boolean;\n dayOfWeek?: boolean;\n}\n\nexport interface MonthsProps extends ItemProps {}\n\nexport interface MonthsItem extends ItemProps {\n monthName: string;\n monthFullName?: string;\n monthIndex: number;\n}\n\nexport interface YearsProps extends ItemProps {}\n\nexport interface YearsItem extends ItemProps {\n yearValue: number;\n}\n\nexport interface EventDay {\n date: Date;\n color?: string;\n}\n\nexport interface DisabledDay {\n date: Date;\n}\n\nexport interface UseKeyNavigationProps {\n size: [number, number];\n isDouble?: boolean;\n onPrev: (withShift?: boolean) => void;\n onNext: (withShift?: boolean) => void;\n}\n\nexport type CalendarValueType = Date | undefined | [Date | undefined, Date?];\n\nexport interface Calendar extends HTMLAttributes<HTMLDivElement> {\n /**\n * Выбранное значение.\n */\n value: CalendarValueType;\n /**\n * Состояние календаря, отвечающее за отображение.\n */\n date?: DateObject;\n /**\n * Минимальное значение даты.\n */\n min?: Date;\n /**\n * Максимальное значение даты.\n */\n max?: Date;\n /**\n * Список событий.\n */\n eventList?: EventDay[];\n /**\n * Список отключенных дней.\n */\n disabledList?: DisabledDay[];\n /**\n * Обработчик изменения значения.\n */\n onChangeValue: (value: Date) => void;\n}\n\nexport type CalendarRange<T> = Omit<T, 'value' | 'onChangeValue'> & {\n /**\n * Выбранное значение.\n */\n value: [Date, Date?];\n /**\n * Обработчик изменения значения.\n */\n onChangeValue: (values: [Date, Date?]) => void;\n /**\n * Обработчик для выбора стартового значения в диапазоне.\n */\n onChangeStartOfRange?: (value: Date) => void;\n};\n\nexport interface DaysMetaDescription {\n refs: MutableRefObject<HTMLDivElement[][]>;\n rowSize: number;\n newRowIndex: number;\n newColumnIndex: number;\n columnSize: number;\n minColumnIndex: number;\n defaultState?: number[];\n}\n\nexport type KeyboardArrowKey = 'left' | 'right' | 'up' | 'down';\n\ntype BaseProps = {\n /**\n * Режим отображения: двойной или одинарный.\n */\n isDouble?: false;\n /**\n * Режим выбора: диапазон или одинарный.\n */\n isRange?: false;\n /**\n * Выбранное значение.\n */\n value: Date;\n} & CalendarBaseProps;\n\ntype BaseRangeProps = {\n /**\n * Режим отображения: двойной или одинарный.\n */\n isDouble?: false;\n /**\n * Режим выбора: диапазон или одинарный.\n */\n isRange: true;\n} & CalendarRange<CalendarBaseProps>;\n\ntype DoubleProps = {\n /**\n * Режим отображения: двойной или одинарный.\n */\n isDouble?: true;\n /**\n * Режим выбора: диапазон или одинарный.\n */\n isRange?: false;\n /**\n * Выбранное значение.\n */\n value: Date;\n} & CalendarDoubleProps;\n\ntype DoubleRangeProps = {\n /**\n * Режим отображения: двойной или одинарный.\n */\n isDouble?: true;\n /**\n * Режим выбора: диапазон или одинарный.\n */\n isRange: true;\n} & CalendarRange<CalendarDoubleProps>;\n\nexport type ComponentVariation = {\n base: React.FC<CalendarBaseProps>;\n baseRange: React.FC<CalendarRange<CalendarBaseProps>>;\n double: React.FC<CalendarDoubleProps>;\n doubleRange: React.FC<CalendarRange<CalendarDoubleProps>>;\n};\n\nexport type CalendarProps = BaseProps | BaseRangeProps | DoubleProps | DoubleRangeProps;\n"],"names":["Keys"],"mappings":";;;;AAKYA,IAAAA,IAAI,0BAAJA,IAAI,EAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,QAAA,CAAA,GAAA,EAAA,CAAA,GAAA,QAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,UAAA,CAAA,GAAA,EAAA,CAAA,GAAA,UAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,MAAA,CAAA,GAAA,EAAA,CAAA,GAAA,MAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,KAAA,CAAA,GAAA,EAAA,CAAA,GAAA,KAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,MAAA,CAAA,GAAA,EAAA,CAAA,GAAA,MAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,OAAA,CAAA,GAAA,EAAA,CAAA,GAAA,OAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,IAAA,CAAA,GAAA,EAAA,CAAA,GAAA,IAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,MAAA,CAAA,GAAA,EAAA,CAAA,GAAA,MAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,OAAA,CAAA,GAAA,EAAA,CAAA,GAAA,OAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,OAAA,CAAA,GAAA,EAAA,CAAA,GAAA,OAAA,CAAA;AAAA,EAAA,OAAJA,IAAI,CAAA;AAAA,CAAA,CAAA,EAAA;;;;"}
|
1
|
+
{"version":3,"file":"Calendar.types.js","sources":["../../../src/components/Calendar/Calendar.types.ts"],"sourcesContent":["import { HTMLAttributes, MutableRefObject } from 'react';\n\nimport type { CalendarBaseProps } from './CalendarBase/CalendarBase';\nimport type { CalendarDoubleProps } from './CalendarDouble/CalendarDouble';\n\nexport enum Keys {\n pageUp = 33,\n pageDown = 34,\n home = 36,\n end = 35,\n left = 37,\n right = 39,\n up = 38,\n down = 40,\n enter = 13,\n space = 32,\n}\n\nexport interface DateObject {\n day: number;\n monthIndex: number;\n year: number;\n}\n\nexport interface ItemProps {\n isCurrent: boolean;\n isSelected: boolean;\n}\n\nexport interface DateItem extends ItemProps {\n isDayInCurrentMonth: boolean;\n inRange?: boolean;\n date: DateObject;\n events?: EventDay[];\n disabled?: boolean;\n isOutOfMinMaxRange?: boolean;\n disabledArrowKey?: string;\n disabledMonths?: string;\n}\n\nexport interface DayProps extends Partial<ItemProps> {\n isDouble?: boolean;\n isDayInCurrentMonth?: boolean;\n isHovered?: boolean;\n inRange?: boolean;\n sideInRange?: 'left' | 'right';\n disabled?: boolean;\n dayOfWeek?: boolean;\n}\n\nexport interface MonthsProps extends ItemProps {}\n\nexport interface MonthsItem extends ItemProps {\n monthName: string;\n monthFullName?: string;\n monthIndex: number;\n}\n\nexport interface YearsProps extends ItemProps {}\n\nexport interface YearsItem extends ItemProps {\n yearValue: number;\n}\n\nexport interface EventDay {\n date: Date;\n color?: string;\n}\n\nexport interface DisabledDay {\n date: Date;\n}\n\nexport interface UseKeyNavigationProps {\n size: [number, number];\n isDouble?: boolean;\n onPrev: (withShift?: boolean) => void;\n onNext: (withShift?: boolean) => void;\n}\n\nexport type CalendarValueType = Date | undefined | [Date | undefined, Date?];\n\nexport interface Calendar extends HTMLAttributes<HTMLDivElement> {\n /**\n * Выбранное значение.\n */\n value: CalendarValueType;\n /**\n * Состояние календаря, отвечающее за отображение.\n */\n date?: DateObject;\n /**\n * Минимальное значение даты.\n */\n min?: Date;\n /**\n * Максимальное значение даты.\n */\n max?: Date;\n /**\n * Должны ли значения минимального и максимального дня включаться в диапазон.\n */\n includeEdgeDates?: boolean;\n /**\n * Список событий.\n */\n eventList?: EventDay[];\n /**\n * Список отключенных дней.\n */\n disabledList?: DisabledDay[];\n /**\n * Обработчик изменения значения.\n */\n onChangeValue: (value: Date) => void;\n}\n\nexport type CalendarRange<T> = Omit<T, 'value' | 'onChangeValue'> & {\n /**\n * Выбранное значение.\n */\n value: [Date, Date?];\n /**\n * Обработчик изменения значения.\n */\n onChangeValue: (values: [Date, Date?]) => void;\n /**\n * Обработчик для выбора стартового значения в диапазоне.\n */\n onChangeStartOfRange?: (value: Date) => void;\n};\n\nexport interface DaysMetaDescription {\n refs: MutableRefObject<HTMLDivElement[][]>;\n rowSize: number;\n newRowIndex: number;\n newColumnIndex: number;\n columnSize: number;\n minColumnIndex: number;\n defaultState?: number[];\n}\n\nexport type KeyboardArrowKey = 'left' | 'right' | 'up' | 'down';\n\ntype BaseProps = {\n /**\n * Режим отображения: двойной или одинарный.\n */\n isDouble?: false;\n /**\n * Режим выбора: диапазон или одинарный.\n */\n isRange?: false;\n /**\n * Выбранное значение.\n */\n value: Date;\n} & CalendarBaseProps;\n\ntype BaseRangeProps = {\n /**\n * Режим отображения: двойной или одинарный.\n */\n isDouble?: false;\n /**\n * Режим выбора: диапазон или одинарный.\n */\n isRange: true;\n} & CalendarRange<CalendarBaseProps>;\n\ntype DoubleProps = {\n /**\n * Режим отображения: двойной или одинарный.\n */\n isDouble?: true;\n /**\n * Режим выбора: диапазон или одинарный.\n */\n isRange?: false;\n /**\n * Выбранное значение.\n */\n value: Date;\n} & CalendarDoubleProps;\n\ntype DoubleRangeProps = {\n /**\n * Режим отображения: двойной или одинарный.\n */\n isDouble?: true;\n /**\n * Режим выбора: диапазон или одинарный.\n */\n isRange: true;\n} & CalendarRange<CalendarDoubleProps>;\n\nexport type ComponentVariation = {\n base: React.FC<CalendarBaseProps>;\n baseRange: React.FC<CalendarRange<CalendarBaseProps>>;\n double: React.FC<CalendarDoubleProps>;\n doubleRange: React.FC<CalendarRange<CalendarDoubleProps>>;\n};\n\nexport type CalendarProps = BaseProps | BaseRangeProps | DoubleProps | DoubleRangeProps;\n"],"names":["Keys"],"mappings":";;;;AAKYA,IAAAA,IAAI,0BAAJA,IAAI,EAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,QAAA,CAAA,GAAA,EAAA,CAAA,GAAA,QAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,UAAA,CAAA,GAAA,EAAA,CAAA,GAAA,UAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,MAAA,CAAA,GAAA,EAAA,CAAA,GAAA,MAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,KAAA,CAAA,GAAA,EAAA,CAAA,GAAA,KAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,MAAA,CAAA,GAAA,EAAA,CAAA,GAAA,MAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,OAAA,CAAA,GAAA,EAAA,CAAA,GAAA,OAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,IAAA,CAAA,GAAA,EAAA,CAAA,GAAA,IAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,MAAA,CAAA,GAAA,EAAA,CAAA,GAAA,MAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,OAAA,CAAA,GAAA,EAAA,CAAA,GAAA,OAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,OAAA,CAAA,GAAA,EAAA,CAAA,GAAA,OAAA,CAAA;AAAA,EAAA,OAAJA,IAAI,CAAA;AAAA,CAAA,CAAA,EAAA;;;;"}
|
@@ -16,7 +16,7 @@ var base = require('./variations/_view/base.js');
|
|
16
16
|
var base$1 = require('./variations/_size/base.js');
|
17
17
|
var CalendarBase_styles = require('./CalendarBase.styles.js');
|
18
18
|
|
19
|
-
var _excluded = ["value", "min", "max", "type", "eventList", "disabledList", "onChangeValue"];
|
19
|
+
var _excluded = ["value", "min", "max", "includeEdgeDates", "type", "eventList", "disabledList", "onChangeValue"];
|
20
20
|
/**
|
21
21
|
* Компонент календаря.
|
22
22
|
*/
|
@@ -25,6 +25,7 @@ var calendarBaseRoot = function calendarBaseRoot(Root) {
|
|
25
25
|
var externalValue = _ref.value,
|
26
26
|
min = _ref.min,
|
27
27
|
max = _ref.max,
|
28
|
+
includeEdgeDates = _ref.includeEdgeDates,
|
28
29
|
_ref$type = _ref.type,
|
29
30
|
type = _ref$type === void 0 ? 'Days' : _ref$type,
|
30
31
|
eventList = _ref.eventList,
|
@@ -233,6 +234,7 @@ var calendarBaseRoot = function calendarBaseRoot(Root) {
|
|
233
234
|
disabledList: disabledList,
|
234
235
|
min: min,
|
235
236
|
max: max,
|
237
|
+
includeEdgeDates: includeEdgeDates,
|
236
238
|
value: externalValue,
|
237
239
|
date: date,
|
238
240
|
hoveredDay: hoveredDay,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CalendarBase.js","sources":["../../../../src/components/Calendar/CalendarBase/CalendarBase.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useReducer, useState, KeyboardEvent, HTMLAttributes, forwardRef } from 'react';\n\nimport type { Calendar, DateObject, UseKeyNavigationProps } from '../Calendar.types';\nimport type { CalendarStateType } from '../store/types';\nimport { getInitialState, reducer } from '../store/reducer';\nimport { ActionType, CalendarState } from '../store/types';\nimport { isValueUpdate, YEAR_RENDER_COUNT } from '../utils';\nimport { useKeyNavigation } from '../hooks';\nimport { CalendarDays, CalendarHeader, CalendarMonths, CalendarYears } from '../ui';\nimport { RootProps } from '../../../engines';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { IsOutOfRange, StyledCalendar } from './CalendarBase.styles';\n\nexport type CalendarBaseProps = HTMLAttributes<HTMLDivElement> &\n Calendar & {\n /**\n * Тип отображения календаря: дни, месяца, года.\n */\n type?: CalendarStateType;\n };\n\n/**\n * Компонент календаря.\n */\nexport const calendarBaseRoot = (Root: RootProps<HTMLDivElement, HTMLAttributes<HTMLDivElement>>) =>\n forwardRef<HTMLDivElement, CalendarBaseProps>(\n (\n { value: externalValue, min, max, type = 'Days', eventList, disabledList, onChangeValue, ...rest },\n outerRootRef,\n ) => {\n const [firstValue, secondValue] = useMemo(\n () => (Array.isArray(externalValue) ? externalValue : [externalValue]),\n [externalValue],\n );\n const value = secondValue || firstValue;\n const [hoveredDay, setHoveredDay] = useState<DateObject | undefined>();\n const [prevType, setPrevType] = useState(type);\n const [prevValue, setPrevValue] = useState(value);\n const [outOfRangeKey, setOutOfRangeKey] = useState<number>(0);\n\n const [state, dispatch] = useReducer(reducer, getInitialState(value, [5, 6], type));\n\n const { date, calendarState, startYear, size } = state;\n\n const handlePrev = useCallback<UseKeyNavigationProps['onPrev']>(\n (withShift = false) => {\n if (calendarState === CalendarState.Days) {\n if (withShift) {\n dispatch({\n type: ActionType.PREVIOUS_YEAR,\n payload: { step: 1 },\n });\n\n return;\n }\n\n dispatch({\n type: ActionType.PREVIOUS_MONTH,\n payload: { monthIndex: date.monthIndex, year: date.year },\n });\n\n return;\n }\n\n if (calendarState === CalendarState.Months) {\n dispatch({ type: ActionType.PREVIOUS_YEAR, payload: { step: 1 } });\n\n return;\n }\n\n if (calendarState === CalendarState.Years) {\n dispatch({ type: ActionType.PREVIOUS_START_YEAR, payload: { yearsCount: YEAR_RENDER_COUNT } });\n }\n },\n [date, calendarState],\n );\n\n const handleNext = useCallback<UseKeyNavigationProps['onNext']>(\n (withShift = false) => {\n if (calendarState === CalendarState.Days) {\n if (withShift) {\n dispatch({\n type: ActionType.NEXT_YEAR,\n payload: { step: 1 },\n });\n\n return;\n }\n\n dispatch({\n type: ActionType.NEXT_MONTH,\n payload: { monthIndex: date.monthIndex, year: date.year },\n });\n\n return;\n }\n\n if (calendarState === CalendarState.Months) {\n dispatch({ type: ActionType.NEXT_YEAR, payload: { step: 1 } });\n\n return;\n }\n\n if (calendarState === CalendarState.Years) {\n dispatch({ type: ActionType.NEXT_START_YEAR, payload: { yearsCount: YEAR_RENDER_COUNT } });\n }\n },\n [date, calendarState],\n );\n\n const [selectIndexes, onKeyDown, onSelectIndexes, outerRefs, isOutOfRange] = useKeyNavigation({\n size,\n onNext: handleNext,\n onPrev: handlePrev,\n });\n\n const handleOnChangeDay = useCallback(\n (newDate: DateObject, coord: number[]) => {\n const newDay = new Date(newDate.year, newDate.monthIndex, newDate.day);\n onChangeValue?.(newDay);\n\n onSelectIndexes(coord);\n },\n [onChangeValue, onSelectIndexes],\n );\n\n const handleOnChangeMonth = useCallback((monthIndex: number) => {\n dispatch({\n type: ActionType.UPDATE_MONTH,\n payload: { calendarState: CalendarState.Days, monthIndex, size: [5, 6] },\n });\n }, []);\n\n const handleOnChangeYear = useCallback((year: number) => {\n dispatch({\n type: ActionType.UPDATE_YEAR,\n payload: { calendarState: CalendarState.Months, year },\n });\n }, []);\n\n const handleUpdateCalendarState = useCallback(\n (newCalendarState: CalendarStateType, newSize: [number, number]) => {\n dispatch({\n type: ActionType.UPDATE_CALENDAR_STATE,\n payload: { calendarState: newCalendarState, size: newSize },\n });\n },\n [],\n );\n\n if (value && prevValue && isValueUpdate(value, prevValue)) {\n dispatch({\n type: ActionType.UPDATE_DATE,\n payload: { value },\n });\n\n setPrevValue(value);\n }\n\n if (prevType !== type) {\n dispatch({\n type: ActionType.UPDATE_CALENDAR_STATE,\n payload: { calendarState: type },\n });\n\n setPrevType(type);\n }\n\n // Изменяем ключ каждый раз как пытаемся перейти на даты которые находятся за пределами min/max ограничений.\n // Это необходимо для того чтобы screen-reader корректно озвучивал уведомление aria-live=\"assertive\"\n // о том что нет доступных дат\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n setOutOfRangeKey((previousState) => Number(!previousState));\n\n onKeyDown(event);\n },\n [onKeyDown],\n );\n\n return (\n <Root ref={outerRootRef} aria-label=\"Выбор даты\" {...rest}>\n {isOutOfRange && (\n <IsOutOfRange\n key={outOfRangeKey}\n aria-atomic=\"true\"\n role=\"alert\"\n aria-live=\"assertive\"\n aria-relevant=\"additions\"\n >\n Далее нет доступных дат.\n </IsOutOfRange>\n )}\n <CalendarHeader\n firstDate={date}\n startYear={startYear}\n type={calendarState}\n onPrev={handlePrev}\n onNext={handleNext}\n onUpdateCalendarState={handleUpdateCalendarState}\n />\n {calendarState === CalendarState.Days && (\n <CalendarDays\n eventList={eventList}\n disabledList={disabledList}\n min={min}\n max={max}\n value={externalValue}\n date={date}\n hoveredDay={hoveredDay}\n selectIndexes={selectIndexes}\n onChangeDay={handleOnChangeDay}\n onHoverDay={setHoveredDay}\n onSetSelected={onSelectIndexes}\n onKeyDown={handleKeyDown}\n outerRefs={outerRefs}\n />\n )}\n {calendarState === CalendarState.Months && (\n <CalendarMonths\n date={date}\n selectIndexes={selectIndexes}\n onChangeMonth={handleOnChangeMonth}\n onSetSelected={onSelectIndexes}\n onKeyDown={onKeyDown}\n outerRefs={outerRefs}\n />\n )}\n {calendarState === CalendarState.Years && (\n <CalendarYears\n date={date}\n startYear={startYear}\n selectIndexes={selectIndexes}\n onChangeYear={handleOnChangeYear}\n onSetSelected={onSelectIndexes}\n onKeyDown={onKeyDown}\n outerRefs={outerRefs}\n />\n )}\n </Root>\n );\n },\n );\n\nexport const calendarBaseConfig = {\n name: 'CalendarBase',\n tag: 'div',\n layout: calendarBaseRoot,\n base: StyledCalendar,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'primary',\n size: 'm',\n },\n};\n"],"names":["calendarBaseRoot","Root","forwardRef","_ref","outerRootRef","externalValue","value","min","max","_ref$type","type","eventList","disabledList","onChangeValue","rest","_objectWithoutProperties","_excluded","_useMemo","useMemo","Array","isArray","_useMemo2","_slicedToArray","firstValue","secondValue","_useState","useState","_useState2","hoveredDay","setHoveredDay","_useState3","_useState4","prevType","setPrevType","_useState5","_useState6","prevValue","setPrevValue","_useState7","_useState8","outOfRangeKey","setOutOfRangeKey","_useReducer","useReducer","reducer","getInitialState","_useReducer2","state","dispatch","date","calendarState","startYear","size","handlePrev","useCallback","withShift","arguments","length","undefined","CalendarState","Days","ActionType","PREVIOUS_YEAR","payload","step","PREVIOUS_MONTH","monthIndex","year","Months","Years","PREVIOUS_START_YEAR","yearsCount","YEAR_RENDER_COUNT","handleNext","NEXT_YEAR","NEXT_MONTH","NEXT_START_YEAR","_useKeyNavigation","useKeyNavigation","onNext","onPrev","_useKeyNavigation2","selectIndexes","onKeyDown","onSelectIndexes","outerRefs","isOutOfRange","handleOnChangeDay","newDate","coord","newDay","Date","day","handleOnChangeMonth","UPDATE_MONTH","handleOnChangeYear","UPDATE_YEAR","handleUpdateCalendarState","newCalendarState","newSize","UPDATE_CALENDAR_STATE","isValueUpdate","UPDATE_DATE","handleKeyDown","event","previousState","Number","React","createElement","_extends","ref","IsOutOfRange","key","role","CalendarHeader","firstDate","onUpdateCalendarState","CalendarDays","onChangeDay","onHoverDay","onSetSelected","CalendarMonths","onChangeMonth","CalendarYears","onChangeYear","calendarBaseConfig","name","tag","layout","base","StyledCalendar","variations","view","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;;;;AAuBA;AACA;AACA;IACaA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,IAA+D,EAAA;AAAA,EAAA,oBAC5FC,gBAAU,CACN,UAAAC,IAAA,EAEIC,YAAY,EACX;AA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AAEC,SAAAA;KACR;AACDlF,IAAAA,IAAI,EAAE;AACFiF,MAAAA,GAAG,EAAEE,WAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNJ,IAAAA,IAAI,EAAE,SAAS;AACfhF,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;;"}
|
1
|
+
{"version":3,"file":"CalendarBase.js","sources":["../../../../src/components/Calendar/CalendarBase/CalendarBase.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useReducer, useState, KeyboardEvent, HTMLAttributes, forwardRef } from 'react';\n\nimport type { Calendar, DateObject, UseKeyNavigationProps } from '../Calendar.types';\nimport type { CalendarStateType } from '../store/types';\nimport { getInitialState, reducer } from '../store/reducer';\nimport { ActionType, CalendarState } from '../store/types';\nimport { isValueUpdate, YEAR_RENDER_COUNT } from '../utils';\nimport { useKeyNavigation } from '../hooks';\nimport { CalendarDays, CalendarHeader, CalendarMonths, CalendarYears } from '../ui';\nimport { RootProps } from '../../../engines';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { IsOutOfRange, StyledCalendar } from './CalendarBase.styles';\n\nexport type CalendarBaseProps = HTMLAttributes<HTMLDivElement> &\n Calendar & {\n /**\n * Тип отображения календаря: дни, месяца, года.\n */\n type?: CalendarStateType;\n };\n\n/**\n * Компонент календаря.\n */\nexport const calendarBaseRoot = (Root: RootProps<HTMLDivElement, HTMLAttributes<HTMLDivElement>>) =>\n forwardRef<HTMLDivElement, CalendarBaseProps>(\n (\n {\n value: externalValue,\n min,\n max,\n includeEdgeDates,\n type = 'Days',\n eventList,\n disabledList,\n onChangeValue,\n ...rest\n },\n outerRootRef,\n ) => {\n const [firstValue, secondValue] = useMemo(\n () => (Array.isArray(externalValue) ? externalValue : [externalValue]),\n [externalValue],\n );\n const value = secondValue || firstValue;\n const [hoveredDay, setHoveredDay] = useState<DateObject | undefined>();\n const [prevType, setPrevType] = useState(type);\n const [prevValue, setPrevValue] = useState(value);\n const [outOfRangeKey, setOutOfRangeKey] = useState<number>(0);\n\n const [state, dispatch] = useReducer(reducer, getInitialState(value, [5, 6], type));\n\n const { date, calendarState, startYear, size } = state;\n\n const handlePrev = useCallback<UseKeyNavigationProps['onPrev']>(\n (withShift = false) => {\n if (calendarState === CalendarState.Days) {\n if (withShift) {\n dispatch({\n type: ActionType.PREVIOUS_YEAR,\n payload: { step: 1 },\n });\n\n return;\n }\n\n dispatch({\n type: ActionType.PREVIOUS_MONTH,\n payload: { monthIndex: date.monthIndex, year: date.year },\n });\n\n return;\n }\n\n if (calendarState === CalendarState.Months) {\n dispatch({ type: ActionType.PREVIOUS_YEAR, payload: { step: 1 } });\n\n return;\n }\n\n if (calendarState === CalendarState.Years) {\n dispatch({ type: ActionType.PREVIOUS_START_YEAR, payload: { yearsCount: YEAR_RENDER_COUNT } });\n }\n },\n [date, calendarState],\n );\n\n const handleNext = useCallback<UseKeyNavigationProps['onNext']>(\n (withShift = false) => {\n if (calendarState === CalendarState.Days) {\n if (withShift) {\n dispatch({\n type: ActionType.NEXT_YEAR,\n payload: { step: 1 },\n });\n\n return;\n }\n\n dispatch({\n type: ActionType.NEXT_MONTH,\n payload: { monthIndex: date.monthIndex, year: date.year },\n });\n\n return;\n }\n\n if (calendarState === CalendarState.Months) {\n dispatch({ type: ActionType.NEXT_YEAR, payload: { step: 1 } });\n\n return;\n }\n\n if (calendarState === CalendarState.Years) {\n dispatch({ type: ActionType.NEXT_START_YEAR, payload: { yearsCount: YEAR_RENDER_COUNT } });\n }\n },\n [date, calendarState],\n );\n\n const [selectIndexes, onKeyDown, onSelectIndexes, outerRefs, isOutOfRange] = useKeyNavigation({\n size,\n onNext: handleNext,\n onPrev: handlePrev,\n });\n\n const handleOnChangeDay = useCallback(\n (newDate: DateObject, coord: number[]) => {\n const newDay = new Date(newDate.year, newDate.monthIndex, newDate.day);\n onChangeValue?.(newDay);\n\n onSelectIndexes(coord);\n },\n [onChangeValue, onSelectIndexes],\n );\n\n const handleOnChangeMonth = useCallback((monthIndex: number) => {\n dispatch({\n type: ActionType.UPDATE_MONTH,\n payload: { calendarState: CalendarState.Days, monthIndex, size: [5, 6] },\n });\n }, []);\n\n const handleOnChangeYear = useCallback((year: number) => {\n dispatch({\n type: ActionType.UPDATE_YEAR,\n payload: { calendarState: CalendarState.Months, year },\n });\n }, []);\n\n const handleUpdateCalendarState = useCallback(\n (newCalendarState: CalendarStateType, newSize: [number, number]) => {\n dispatch({\n type: ActionType.UPDATE_CALENDAR_STATE,\n payload: { calendarState: newCalendarState, size: newSize },\n });\n },\n [],\n );\n\n if (value && prevValue && isValueUpdate(value, prevValue)) {\n dispatch({\n type: ActionType.UPDATE_DATE,\n payload: { value },\n });\n\n setPrevValue(value);\n }\n\n if (prevType !== type) {\n dispatch({\n type: ActionType.UPDATE_CALENDAR_STATE,\n payload: { calendarState: type },\n });\n\n setPrevType(type);\n }\n\n // Изменяем ключ каждый раз как пытаемся перейти на даты которые находятся за пределами min/max ограничений.\n // Это необходимо для того чтобы screen-reader корректно озвучивал уведомление aria-live=\"assertive\"\n // о том что нет доступных дат\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n setOutOfRangeKey((previousState) => Number(!previousState));\n\n onKeyDown(event);\n },\n [onKeyDown],\n );\n\n return (\n <Root ref={outerRootRef} aria-label=\"Выбор даты\" {...rest}>\n {isOutOfRange && (\n <IsOutOfRange\n key={outOfRangeKey}\n aria-atomic=\"true\"\n role=\"alert\"\n aria-live=\"assertive\"\n aria-relevant=\"additions\"\n >\n Далее нет доступных дат.\n </IsOutOfRange>\n )}\n <CalendarHeader\n firstDate={date}\n startYear={startYear}\n type={calendarState}\n onPrev={handlePrev}\n onNext={handleNext}\n onUpdateCalendarState={handleUpdateCalendarState}\n />\n {calendarState === CalendarState.Days && (\n <CalendarDays\n eventList={eventList}\n disabledList={disabledList}\n min={min}\n max={max}\n includeEdgeDates={includeEdgeDates}\n value={externalValue}\n date={date}\n hoveredDay={hoveredDay}\n selectIndexes={selectIndexes}\n onChangeDay={handleOnChangeDay}\n onHoverDay={setHoveredDay}\n onSetSelected={onSelectIndexes}\n onKeyDown={handleKeyDown}\n outerRefs={outerRefs}\n />\n )}\n {calendarState === CalendarState.Months && (\n <CalendarMonths\n date={date}\n selectIndexes={selectIndexes}\n onChangeMonth={handleOnChangeMonth}\n onSetSelected={onSelectIndexes}\n onKeyDown={onKeyDown}\n outerRefs={outerRefs}\n />\n )}\n {calendarState === CalendarState.Years && (\n <CalendarYears\n date={date}\n startYear={startYear}\n selectIndexes={selectIndexes}\n onChangeYear={handleOnChangeYear}\n onSetSelected={onSelectIndexes}\n onKeyDown={onKeyDown}\n outerRefs={outerRefs}\n />\n )}\n </Root>\n );\n },\n );\n\nexport const calendarBaseConfig = {\n name: 'CalendarBase',\n tag: 'div',\n layout: calendarBaseRoot,\n base: StyledCalendar,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'primary',\n size: 'm',\n },\n};\n"],"names":["calendarBaseRoot","Root","forwardRef","_ref","outerRootRef","externalValue","value","min","max","includeEdgeDates","_ref$type","type","eventList","disabledList","onChangeValue","rest","_objectWithoutProperties","_excluded","_useMemo","useMemo","Array","isArray","_useMemo2","_slicedToArray","firstValue","secondValue","_useState","useState","_useState2","hoveredDay","setHoveredDay","_useState3","_useState4","prevType","setPrevType","_useState5","_useState6","prevValue","setPrevValue","_useState7","_useState8","outOfRangeKey","setOutOfRangeKey","_useReducer","useReducer","reducer","getInitialState","_useReducer2","state","dispatch","date","calendarState","startYear","size","handlePrev","useCallback","withShift","arguments","length","undefined","CalendarState","Days","ActionType","PREVIOUS_YEAR","payload","step","PREVIOUS_MONTH","monthIndex","year","Months","Years","PREVIOUS_START_YEAR","yearsCount","YEAR_RENDER_COUNT","handleNext","NEXT_YEAR","NEXT_MONTH","NEXT_START_YEAR","_useKeyNavigation","useKeyNavigation","onNext","onPrev","_useKeyNavigation2","selectIndexes","onKeyDown","onSelectIndexes","outerRefs","isOutOfRange","handleOnChangeDay","newDate","coord","newDay","Date","day","handleOnChangeMonth","UPDATE_MONTH","handleOnChangeYear","UPDATE_YEAR","handleUpdateCalendarState","newCalendarState","newSize","UPDATE_CALENDAR_STATE","isValueUpdate","UPDATE_DATE","handleKeyDown","event","previousState","Number","React","createElement","_extends","ref","IsOutOfRange","key","role","CalendarHeader","firstDate","onUpdateCalendarState","CalendarDays","onChangeDay","onHoverDay","onSetSelected","CalendarMonths","onChangeMonth","CalendarYears","onChangeYear","calendarBaseConfig","name","tag","layout","base","StyledCalendar","variations","view","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;;;;AAuBA;AACA;AACA;IACaA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,IAA+D,EAAA;AAAA,EAAA,oBAC5FC,gBAAU,CACN,UAAAC,IAAA,EAYIC,YAAY,EACX;AAAA,IAAA,IAXUC,aAAa,GAAAF,IAAA,CAApBG,KAAK;MACLC,GAAG,GAAAJ,IAAA,CAAHI,GAAG;MACHC,GAAG,GAAAL,IAAA,CAAHK,GAAG;MACHC,gBAAgB,GAAAN,IAAA,CAAhBM,gBAAgB;MAAAC,SAAA,GAAAP,IAAA,CAChBQ,IAAI;AAAJA,MAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,SAAA;MACbE,SAAS,GAAAT,IAAA,CAATS,SAAS;MACTC,YAAY,GAAAV,IAAA,CAAZU,YAAY;MACZC,aAAa,GAAAX,IAAA,CAAbW,aAAa;AACVC,MAAAA,IAAI,GAAAC,iDAAA,CAAAb,IAAA,EAAAc,SAAA,CAAA,CAAA;IAIX,IAAAC,QAAA,GAAkCC,aAAO,CACrC,YAAA;QAAA,OAAOC,KAAK,CAACC,OAAO,CAAChB,aAAa,CAAC,GAAGA,aAAa,GAAG,CAACA,aAAa,CAAC,CAAA;AAAA,OAAC,EACtE,CAACA,aAA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;AAAU,KACxB,CACJ,EACAnC,aAAa,KAAKS,mBAAa,CAACU,KAAK,iBAClCsC,KAAA,CAAAC,aAAA,CAACe,2BAAa,EAAA;AACV1E,MAAAA,IAAI,EAAEA,IAAK;AACXE,MAAAA,SAAS,EAAEA,SAAU;AACrB+B,MAAAA,aAAa,EAAEA,aAAc;AAC7B0C,MAAAA,YAAY,EAAE7B,kBAAmB;AACjCyB,MAAAA,aAAa,EAAEpC,eAAgB;AAC/BD,MAAAA,SAAS,EAAEA,SAAU;AACrBE,MAAAA,SAAS,EAAEA,SAAAA;AAAU,KACxB,CAEH,CAAC,CAAA;AAEf,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMwC,kBAAkB,GAAG;AAC9BC,EAAAA,IAAI,EAAE,cAAc;AACpBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEjI,gBAAgB;AACxBkI,EAAAA,IAAI,EAAEC,kCAAc;AACpBC,EAAAA,UAAU,EAAE;AACRC,IAAAA,IAAI,EAAE;AACFC,MAAAA,GAAG,EAAEC,SAAAA;KACR;AACDlF,IAAAA,IAAI,EAAE;AACFiF,MAAAA,GAAG,EAAEE,WAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNJ,IAAAA,IAAI,EAAE,SAAS;AACfhF,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;;"}
|
@@ -178,6 +178,7 @@ var getDaysWithModifications = function getDaysWithModifications(days) {
|
|
178
178
|
var disabledList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
179
179
|
var min = arguments.length > 3 ? arguments[3] : undefined;
|
180
180
|
var max = arguments.length > 4 ? arguments[4] : undefined;
|
181
|
+
var includeEdgeDates = arguments.length > 5 ? arguments[5] : undefined;
|
181
182
|
var eventsMap = getPropsMap(eventList);
|
182
183
|
var disabledDaysMap = getPropsMap(disabledList);
|
183
184
|
var daysList = days.filter(function (_ref3) {
|
@@ -195,7 +196,9 @@ var getDaysWithModifications = function getDaysWithModifications(days) {
|
|
195
196
|
day = date.day;
|
196
197
|
var keyDay = "".concat(year, "-").concat(monthIndex, "-").concat(day);
|
197
198
|
var currentDate = new Date(year, monthIndex, day);
|
198
|
-
var
|
199
|
+
var minValue = min && (includeEdgeDates ? min > currentDate : min >= currentDate);
|
200
|
+
var maxValue = max && (includeEdgeDates ? max < currentDate : max <= currentDate);
|
201
|
+
var isOutOfMinMaxRange = minValue || maxValue;
|
199
202
|
dayItem.events = eventsMap.get(keyDay);
|
200
203
|
dayItem.disabled = disabledDaysMap.has(keyDay) || isOutOfMinMaxRange;
|
201
204
|
dayItem.isOutOfMinMaxRange = isOutOfMinMaxRange;
|
@@ -208,7 +211,7 @@ var getDaysWithModifications = function getDaysWithModifications(days) {
|
|
208
211
|
/**
|
209
212
|
* Хук для получения списка дней.
|
210
213
|
*/
|
211
|
-
var useDays = function useDays(date, value, eventList, disabledList, min, max) {
|
214
|
+
var useDays = function useDays(date, value, eventList, disabledList, min, max, includeEdgeDates) {
|
212
215
|
return React.useMemo(function () {
|
213
216
|
var monthIndex = date.monthIndex,
|
214
217
|
year = date.year;
|
@@ -216,7 +219,7 @@ var useDays = function useDays(date, value, eventList, disabledList, min, max) {
|
|
216
219
|
var offsetDayInWeek = index.getOffsetDayInWeek(monthIndex, year);
|
217
220
|
var days = [].concat(_rollupPluginBabelHelpers.toConsumableArray(getDaysInPrevMonth(date, offsetDayInWeek, value)), _rollupPluginBabelHelpers.toConsumableArray(getDaysInCurrentMonth(date, daysInMonth, value)), _rollupPluginBabelHelpers.toConsumableArray(getDaysInNextMonth(date, daysInMonth, offsetDayInWeek, value)));
|
218
221
|
if (eventList !== null && eventList !== void 0 && eventList.length || disabledList !== null && disabledList !== void 0 && disabledList.length || max || min) {
|
219
|
-
var modifiedDays = getDaysWithModifications(days, eventList, disabledList, min, max);
|
222
|
+
var modifiedDays = getDaysWithModifications(days, eventList, disabledList, min, max, includeEdgeDates);
|
220
223
|
return index.getMatrix(modifiedDays);
|
221
224
|
}
|
222
225
|
return index.getMatrix(days);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useDays.js","sources":["../../../../src/components/Calendar/hooks/useDays.ts"],"sourcesContent":["import { useMemo } from 'react';\n\nimport {\n getDateFromValue,\n getDaysInMonth,\n getMatrix,\n getNextDate,\n getOffsetDayInWeek,\n getPrevDate,\n IsCurrentDay,\n isDayInRange,\n isSelectedDay,\n} from '../utils';\nimport type { CalendarValueType, DateItem, DateObject, DisabledDay, EventDay } from '../Calendar.types';\n\n/**\n * Метод возвращающий массив дней в предыдущем месяце.\n */\nconst getDaysInPrevMonth = (date: DateObject, offsetDayInWeek: number, value: CalendarValueType) => {\n const [prevYear, prevMonth] = getPrevDate(date.year, date.monthIndex);\n const daysInPrevMonth = getDaysInMonth(prevMonth, prevYear);\n\n return Array.from(Array(offsetDayInWeek), (_, i) => ({\n isCurrent: false,\n isSelected: false,\n isDayInCurrentMonth: false,\n inRange: Array.isArray(value)\n ? isDayInRange(prevYear, prevMonth, daysInPrevMonth - (offsetDayInWeek - i) + 1, value)\n : false,\n date: {\n day: daysInPrevMonth - (offsetDayInWeek - i) + 1,\n monthIndex: prevMonth,\n year: prevYear,\n },\n }));\n};\n\n/**\n * Метод возвращающий массив дней в текущем месяце.\n */\nconst getDaysInCurrentMonth = (date: DateObject, daysInMonth: number, value: CalendarValueType) => {\n return Array.from(Array(daysInMonth), (_, i) => ({\n isCurrent: IsCurrentDay(date, i + 1),\n isSelected: Array.isArray(value)\n ? Boolean(value.find((v) => isSelectedDay(date, i + 1, v)))\n : isSelectedDay(date, i + 1, value),\n isDayInCurrentMonth: true,\n inRange: Array.isArray(value) ? isDayInRange(date.year, date.monthIndex, i + 1, value) : false,\n date: {\n day: i + 1,\n monthIndex: date.monthIndex,\n year: date.year,\n },\n }));\n};\n\n/**\n * Метод возвращающий массив дней в следующем месяце.\n */\nconst getDaysInNextMonth = (\n date: DateObject,\n daysInMonth: number,\n offsetDayInWeek: number,\n value: CalendarValueType,\n) => {\n const [nextYear, nextMonthIndex] = getNextDate(date.year, date.monthIndex);\n const visibleDayCount = 42;\n const restDaysInCalendar = visibleDayCount - (daysInMonth + offsetDayInWeek);\n\n return Array.from(Array(restDaysInCalendar), (_, i) => ({\n isCurrent: false,\n isSelected: false,\n isDayInCurrentMonth: false,\n inRange: Array.isArray(value) ? isDayInRange(nextYear, nextMonthIndex, i + 1, value) : false,\n date: {\n day: i + 1,\n monthIndex: nextMonthIndex,\n year: nextYear,\n },\n }));\n};\n\nconst isDisabledArrowLeft = (date: Date, min?: Date) => {\n const currentDate = new Date(date);\n\n currentDate.setDate(currentDate.getDate() - 1);\n\n return (min && min >= currentDate) || (min && min >= date);\n};\n\nconst isDisabledArrowRight = (date: Date, max?: Date) => {\n const currentDate = new Date(date);\n\n currentDate.setDate(currentDate.getDate() + 1);\n\n return (max && max <= currentDate) || (max && max <= date);\n};\n\nconst isDisabledArrowUp = (date: Date, min?: Date) => {\n const currentDate = new Date(date);\n\n currentDate.setDate(date.getDate() - 7);\n\n return min && min >= currentDate;\n};\n\nconst isDisabledArrowDown = (date: Date, max?: Date) => {\n const currentDate = new Date(date);\n\n currentDate.setDate(date.getDate() + 7);\n\n return max && max <= currentDate;\n};\n\nconst isDisabledNextMonth = ({ year, monthIndex, day }: DateObject, max?: Date) => {\n if (!max) {\n return false;\n }\n\n const currentDate = new Date(year, monthIndex, day);\n\n currentDate.setDate(currentDate.getDate() + 1);\n\n let isOut = true;\n\n while (isOut && currentDate <= max) {\n isOut = max <= currentDate;\n\n currentDate.setDate(currentDate.getDate() + 1);\n }\n\n return isOut;\n};\n\nconst isDisabledPreviousMonth = ({ year, monthIndex, day }: DateObject, min?: Date) => {\n if (!min) {\n return false;\n }\n\n const currentDate = new Date(year, monthIndex, day);\n\n currentDate.setDate(currentDate.getDate() - 1);\n\n let isOut = true;\n\n while (isOut && currentDate >= min) {\n isOut = min >= currentDate;\n\n currentDate.setDate(currentDate.getDate() - 1);\n }\n\n return isOut;\n};\n\nconst getDisabledArrowKey = (currentDate: Date, min?: Date, max?: Date) => {\n const disabledArrowKey = [];\n\n if (isDisabledArrowLeft(currentDate, min)) {\n disabledArrowKey.push('left');\n }\n\n if (isDisabledArrowRight(currentDate, max)) {\n disabledArrowKey.push('right');\n }\n\n if (isDisabledArrowDown(currentDate, max)) {\n disabledArrowKey.push('down');\n }\n\n if (isDisabledArrowUp(currentDate, min)) {\n disabledArrowKey.push('up');\n }\n\n return disabledArrowKey.join(',');\n};\n\nconst getDisabledMonths = (list: DateObject[], min?: Date, max?: Date) => {\n const disabledMonth = [];\n\n if (isDisabledPreviousMonth(list[0], min)) {\n disabledMonth.push('previous');\n }\n\n if (isDisabledNextMonth(list[list.length - 1], max)) {\n disabledMonth.push('next');\n }\n\n return disabledMonth.join(',');\n};\n\n/**\n * Метод для получения набора неповторяющихся дат.\n */\nconst getPropsMap = <T extends EventDay | DisabledDay>(props: T[]) =>\n props.reduce((acc, prop) => {\n const { year, monthIndex, day } = getDateFromValue(prop.date);\n\n const key = `${year}-${monthIndex}-${day}`;\n\n const propList = acc.get(key) || [];\n propList.push(prop);\n\n return acc.set(key, propList);\n }, new Map<string, T[]>());\n\n/**\n * Метод модифицирующий дни (добавляющий свойства events и disabled).\n */\nconst getDaysWithModifications = (\n days: DateItem[],\n eventList: EventDay[] = [],\n disabledList: DisabledDay[] = [],\n min?: Date,\n max?: Date,\n) => {\n const eventsMap = getPropsMap(eventList);\n const disabledDaysMap = getPropsMap(disabledList);\n\n const daysList = days.filter(({ isDayInCurrentMonth }) => isDayInCurrentMonth).map(({ date }) => date);\n\n const disabledMonths = getDisabledMonths(daysList, min, max);\n\n return days.map((dayItem) => {\n const { date } = dayItem;\n const { year, monthIndex, day } = date;\n\n const keyDay = `${year}-${monthIndex}-${day}`;\n const currentDate = new Date(year, monthIndex, day);\n\n const isOutOfMinMaxRange = (min && min >= currentDate) || (max && max <= currentDate);\n\n dayItem.events = eventsMap.get(keyDay);\n dayItem.disabled = disabledDaysMap.has(keyDay) || isOutOfMinMaxRange;\n\n dayItem.isOutOfMinMaxRange = isOutOfMinMaxRange;\n dayItem.disabledArrowKey = getDisabledArrowKey(currentDate, min, max);\n dayItem.disabledMonths = disabledMonths;\n\n return dayItem;\n });\n};\n\n/**\n * Хук для получения списка дней.\n */\nexport const useDays = (\n date: DateObject,\n value: CalendarValueType,\n eventList?: EventDay[],\n disabledList?: DisabledDay[],\n min?: Date,\n max?: Date,\n) =>\n useMemo(() => {\n const { monthIndex, year } = date;\n const daysInMonth = getDaysInMonth(monthIndex, year);\n const offsetDayInWeek = getOffsetDayInWeek(monthIndex, year);\n\n const days = [\n ...getDaysInPrevMonth(date, offsetDayInWeek, value),\n ...getDaysInCurrentMonth(date, daysInMonth, value),\n ...getDaysInNextMonth(date, daysInMonth, offsetDayInWeek, value),\n ];\n\n if (eventList?.length || disabledList?.length || max || min) {\n const modifiedDays = getDaysWithModifications(days, eventList, disabledList, min, max);\n return getMatrix<DateItem>(modifiedDays);\n }\n\n return getMatrix<DateItem>(days);\n }, [date, value, eventList, disabledList, max, min]);\n"],"names":["getDaysInPrevMonth","date","offsetDayInWeek","value","_getPrevDate","getPrevDate","year","monthIndex","_getPrevDate2","_slicedToArray","prevYear","prevMonth","daysInPrevMonth","getDaysInMonth","Array","from","_","i","isCurrent","isSelected","isDayInCurrentMonth","inRange","isArray","isDayInRange","day","getDaysInCurrentMonth","daysInMonth","IsCurrentDay","Boolean","find","v","isSelectedDay","getDaysInNextMonth","_getNextDate","getNextDate","_getNextDate2","nextYear","nextMonthIndex","visibleDayCount","restDaysInCalendar","isDisabledArrowLeft","min","currentDate","Date","setDate","getDate","isDisabledArrowRight","max","isDisabledArrowUp","isDisabledArrowDown","isDisabledNextMonth","_ref","isOut","isDisabledPreviousMonth","_ref2","getDisabledArrowKey","disabledArrowKey","push","join","getDisabledMonths","list","disabledMonth","length","getPropsMap","props","reduce","acc","prop","_getDateFromValue","getDateFromValue","key","concat","propList","get","set","Map","getDaysWithModifications","days","eventList","arguments","undefined","disabledList","eventsMap","disabledDaysMap","daysList","filter","_ref3","map","_ref4","disabledMonths","dayItem","keyDay","isOutOfMinMaxRange","events","disabled","has","useDays","useMemo","getOffsetDayInWeek","_toConsumableArray","modifiedDays","getMatrix"],"mappings":";;;;;;;;AAeA;AACA;AACA;AACA,IAAMA,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIC,IAAgB,EAAEC,eAAuB,EAAEC,KAAwB,EAAK;EAChG,IAAAC,YAAA,GAA8BC,iBAAW,CAACJ,IAAI,CAACK,IAAI,EAAEL,IAAI,CAACM,UAAU,CAAC;IAAAC,aAAA,GAAAC,uCAAA,CAAAL,YAAA,EAAA,CAAA,CAAA;AAA9DM,IAAAA,QAAQ,GAAAF,aAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,SAAS,GAAAH,aAAA,CAAA,CAAA,CAAA,CAAA;AAC1B,EAAA,IAAMI,eAAe,GAAGC,oBAAc,CAACF,SAAS,EAAED,QAAQ,CAAC,CAAA;AAE3D,EAAA,OAAOI,KAAK,CAACC,IAAI,CAACD,KAAK,CAACZ,eAAe,CAAC,EAAE,UAACc,CAAC,EAAEC,CAAC,EAAA;IAAA,OAAM;AACjDC,MAAAA,SAAS,EAAE,KAAK;AAChBC,MAAAA,UAAU,EAAE,KAAK;AACjBC,MAAAA,mBAAmB,EAAE,KAAK;MAC1BC,OAAO,EAAEP,KAAK,CAACQ,OAAO,CAACnB,KAAK,CAAC,GACvBoB,kBAAY,CAACb,QAAQ,EAAEC,SAAS,EAAEC,eAAe,IAAIV,eAAe,GAAGe,CAAC,CAAC,GAAG,CAAC,EAAEd,KAAK,CAAC,GACrF,KAAK;AACXF,MAAAA,IAAI,EAAE;QACFuB,GAAG,EAAEZ,eAAe,IAAIV,eAAe,GAAGe,CAAC,CAAC,GAAG,CAAC;AAChDV,QAAAA,UAAU,EAAEI,SAAS;AACrBL,QAAAA,IAAI,EAAEI,QAAAA;AACV,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GAAAN,EAAAA,CAAAA,MAAA,CAAA4B,2CAAA,CACHnG,kBAAkB,CAACC,IAAI,EAAEC,eAAe,EAAEC,KAAK,CAAC,CAAAgG,EAAAA,2CAAA,CAChD1E,qBAAqB,CAACxB,IAAI,EAAEyB,WAAW,EAAEvB,KAAK,CAAC,CAAA,EAAAgG,2CAAA,CAC/CnE,kBAAkB,CAAC/B,IAAI,EAAEyB,WAAW,EAAExB,eAAe,EAAEC,KAAK,CAAC,CACnE,CAAA,CAAA;AAED,IAAA,IAAI2E,SAAS,KAATA,IAAAA,IAAAA,SAAS,eAATA,SAAS,CAAEhB,MAAM,IAAImB,YAAY,aAAZA,YAAY,KAAA,KAAA,CAAA,IAAZA,YAAY,CAAEnB,MAAM,IAAIf,GAAG,IAAIN,GAAG,EAAE;AACzD,MAAA,IAAM2D,YAAY,GAAGxB,wBAAwB,CAACC,IAAI,EAAEC,SAAS,EAAEG,YAAY,EAAExC,GAAG,EAAEM,GAAG,CAAC,CAAA;MACtF,OAAOsD,eAAS,CAAWD,YAAY,CAAC,CAAA;AAC5C,KAAA;IAEA,OAAOC,eAAS,CAAWxB,IAAI,CAAC,CAAA;AACpC,GAAC,EAAE,CAAC5E,IAAI,EAAEE,KAAK,EAAE2E,SAAS,EAAEG,YAAY,EAAElC,GAAG,EAAEN,GAAG,CAAC,CAAC,CAAA;AAAA;;;;"}
|
1
|
+
{"version":3,"file":"useDays.js","sources":["../../../../src/components/Calendar/hooks/useDays.ts"],"sourcesContent":["import { useMemo } from 'react';\n\nimport {\n getDateFromValue,\n getDaysInMonth,\n getMatrix,\n getNextDate,\n getOffsetDayInWeek,\n getPrevDate,\n IsCurrentDay,\n isDayInRange,\n isSelectedDay,\n} from '../utils';\nimport type { CalendarValueType, DateItem, DateObject, DisabledDay, EventDay } from '../Calendar.types';\n\n/**\n * Метод возвращающий массив дней в предыдущем месяце.\n */\nconst getDaysInPrevMonth = (date: DateObject, offsetDayInWeek: number, value: CalendarValueType) => {\n const [prevYear, prevMonth] = getPrevDate(date.year, date.monthIndex);\n const daysInPrevMonth = getDaysInMonth(prevMonth, prevYear);\n\n return Array.from(Array(offsetDayInWeek), (_, i) => ({\n isCurrent: false,\n isSelected: false,\n isDayInCurrentMonth: false,\n inRange: Array.isArray(value)\n ? isDayInRange(prevYear, prevMonth, daysInPrevMonth - (offsetDayInWeek - i) + 1, value)\n : false,\n date: {\n day: daysInPrevMonth - (offsetDayInWeek - i) + 1,\n monthIndex: prevMonth,\n year: prevYear,\n },\n }));\n};\n\n/**\n * Метод возвращающий массив дней в текущем месяце.\n */\nconst getDaysInCurrentMonth = (date: DateObject, daysInMonth: number, value: CalendarValueType) => {\n return Array.from(Array(daysInMonth), (_, i) => ({\n isCurrent: IsCurrentDay(date, i + 1),\n isSelected: Array.isArray(value)\n ? Boolean(value.find((v) => isSelectedDay(date, i + 1, v)))\n : isSelectedDay(date, i + 1, value),\n isDayInCurrentMonth: true,\n inRange: Array.isArray(value) ? isDayInRange(date.year, date.monthIndex, i + 1, value) : false,\n date: {\n day: i + 1,\n monthIndex: date.monthIndex,\n year: date.year,\n },\n }));\n};\n\n/**\n * Метод возвращающий массив дней в следующем месяце.\n */\nconst getDaysInNextMonth = (\n date: DateObject,\n daysInMonth: number,\n offsetDayInWeek: number,\n value: CalendarValueType,\n) => {\n const [nextYear, nextMonthIndex] = getNextDate(date.year, date.monthIndex);\n const visibleDayCount = 42;\n const restDaysInCalendar = visibleDayCount - (daysInMonth + offsetDayInWeek);\n\n return Array.from(Array(restDaysInCalendar), (_, i) => ({\n isCurrent: false,\n isSelected: false,\n isDayInCurrentMonth: false,\n inRange: Array.isArray(value) ? isDayInRange(nextYear, nextMonthIndex, i + 1, value) : false,\n date: {\n day: i + 1,\n monthIndex: nextMonthIndex,\n year: nextYear,\n },\n }));\n};\n\nconst isDisabledArrowLeft = (date: Date, min?: Date) => {\n const currentDate = new Date(date);\n\n currentDate.setDate(currentDate.getDate() - 1);\n\n return (min && min >= currentDate) || (min && min >= date);\n};\n\nconst isDisabledArrowRight = (date: Date, max?: Date) => {\n const currentDate = new Date(date);\n\n currentDate.setDate(currentDate.getDate() + 1);\n\n return (max && max <= currentDate) || (max && max <= date);\n};\n\nconst isDisabledArrowUp = (date: Date, min?: Date) => {\n const currentDate = new Date(date);\n\n currentDate.setDate(date.getDate() - 7);\n\n return min && min >= currentDate;\n};\n\nconst isDisabledArrowDown = (date: Date, max?: Date) => {\n const currentDate = new Date(date);\n\n currentDate.setDate(date.getDate() + 7);\n\n return max && max <= currentDate;\n};\n\nconst isDisabledNextMonth = ({ year, monthIndex, day }: DateObject, max?: Date) => {\n if (!max) {\n return false;\n }\n\n const currentDate = new Date(year, monthIndex, day);\n\n currentDate.setDate(currentDate.getDate() + 1);\n\n let isOut = true;\n\n while (isOut && currentDate <= max) {\n isOut = max <= currentDate;\n\n currentDate.setDate(currentDate.getDate() + 1);\n }\n\n return isOut;\n};\n\nconst isDisabledPreviousMonth = ({ year, monthIndex, day }: DateObject, min?: Date) => {\n if (!min) {\n return false;\n }\n\n const currentDate = new Date(year, monthIndex, day);\n\n currentDate.setDate(currentDate.getDate() - 1);\n\n let isOut = true;\n\n while (isOut && currentDate >= min) {\n isOut = min >= currentDate;\n\n currentDate.setDate(currentDate.getDate() - 1);\n }\n\n return isOut;\n};\n\nconst getDisabledArrowKey = (currentDate: Date, min?: Date, max?: Date) => {\n const disabledArrowKey = [];\n\n if (isDisabledArrowLeft(currentDate, min)) {\n disabledArrowKey.push('left');\n }\n\n if (isDisabledArrowRight(currentDate, max)) {\n disabledArrowKey.push('right');\n }\n\n if (isDisabledArrowDown(currentDate, max)) {\n disabledArrowKey.push('down');\n }\n\n if (isDisabledArrowUp(currentDate, min)) {\n disabledArrowKey.push('up');\n }\n\n return disabledArrowKey.join(',');\n};\n\nconst getDisabledMonths = (list: DateObject[], min?: Date, max?: Date) => {\n const disabledMonth = [];\n\n if (isDisabledPreviousMonth(list[0], min)) {\n disabledMonth.push('previous');\n }\n\n if (isDisabledNextMonth(list[list.length - 1], max)) {\n disabledMonth.push('next');\n }\n\n return disabledMonth.join(',');\n};\n\n/**\n * Метод для получения набора неповторяющихся дат.\n */\nconst getPropsMap = <T extends EventDay | DisabledDay>(props: T[]) =>\n props.reduce((acc, prop) => {\n const { year, monthIndex, day } = getDateFromValue(prop.date);\n\n const key = `${year}-${monthIndex}-${day}`;\n\n const propList = acc.get(key) || [];\n propList.push(prop);\n\n return acc.set(key, propList);\n }, new Map<string, T[]>());\n\n/**\n * Метод модифицирующий дни (добавляющий свойства events и disabled).\n */\nconst getDaysWithModifications = (\n days: DateItem[],\n eventList: EventDay[] = [],\n disabledList: DisabledDay[] = [],\n min?: Date,\n max?: Date,\n includeEdgeDates?: boolean,\n) => {\n const eventsMap = getPropsMap(eventList);\n const disabledDaysMap = getPropsMap(disabledList);\n\n const daysList = days.filter(({ isDayInCurrentMonth }) => isDayInCurrentMonth).map(({ date }) => date);\n\n const disabledMonths = getDisabledMonths(daysList, min, max);\n\n return days.map((dayItem) => {\n const { date } = dayItem;\n const { year, monthIndex, day } = date;\n\n const keyDay = `${year}-${monthIndex}-${day}`;\n const currentDate = new Date(year, monthIndex, day);\n\n const minValue = min && (includeEdgeDates ? min > currentDate : min >= currentDate);\n const maxValue = max && (includeEdgeDates ? max < currentDate : max <= currentDate);\n const isOutOfMinMaxRange = minValue || maxValue;\n\n dayItem.events = eventsMap.get(keyDay);\n dayItem.disabled = disabledDaysMap.has(keyDay) || isOutOfMinMaxRange;\n\n dayItem.isOutOfMinMaxRange = isOutOfMinMaxRange;\n dayItem.disabledArrowKey = getDisabledArrowKey(currentDate, min, max);\n dayItem.disabledMonths = disabledMonths;\n\n return dayItem;\n });\n};\n\n/**\n * Хук для получения списка дней.\n */\nexport const useDays = (\n date: DateObject,\n value: CalendarValueType,\n eventList?: EventDay[],\n disabledList?: DisabledDay[],\n min?: Date,\n max?: Date,\n includeEdgeDates?: boolean,\n) =>\n useMemo(() => {\n const { monthIndex, year } = date;\n const daysInMonth = getDaysInMonth(monthIndex, year);\n const offsetDayInWeek = getOffsetDayInWeek(monthIndex, year);\n\n const days = [\n ...getDaysInPrevMonth(date, offsetDayInWeek, value),\n ...getDaysInCurrentMonth(date, daysInMonth, value),\n ...getDaysInNextMonth(date, daysInMonth, offsetDayInWeek, value),\n ];\n\n if (eventList?.length || disabledList?.length || max || min) {\n const modifiedDays = getDaysWithModifications(days, eventList, disabledList, min, max, includeEdgeDates);\n return getMatrix<DateItem>(modifiedDays);\n }\n\n return getMatrix<DateItem>(days);\n }, [date, value, eventList, disabledList, max, min]);\n"],"names":["getDaysInPrevMonth","date","offsetDayInWeek","value","_getPrevDate","getPrevDate","year","monthIndex","_getPrevDate2","_slicedToArray","prevYear","prevMonth","daysInPrevMonth","getDaysInMonth","Array","from","_","i","isCurrent","isSelected","isDayInCurrentMonth","inRange","isArray","isDayInRange","day","getDaysInCurrentMonth","daysInMonth","IsCurrentDay","Boolean","find","v","isSelectedDay","getDaysInNextMonth","_getNextDate","getNextDate","_getNextDate2","nextYear","nextMonthIndex","visibleDayCount","restDaysInCalendar","isDisabledArrowLeft","min","currentDate","Date","setDate","getDate","isDisabledArrowRight","max","isDisabledArrowUp","isDisabledArrowDown","isDisabledNextMonth","_ref","isOut","isDisabledPreviousMonth","_ref2","getDisabledArrowKey","disabledArrowKey","push","join","getDisabledMonths","list","disabledMonth","length","getPropsMap","props","reduce","acc","prop","_getDateFromValue","getDateFromValue","key","concat","propList","get","set","Map","getDaysWithModifications","days","eventList","arguments","undefined","disabledList","includeEdgeDates","eventsMap","disabledDaysMap","daysList","filter","_ref3","map","_ref4","disabledMonths","dayItem","keyDay","minValue","maxValue","isOutOfMinMaxRange","events","disabled","has","useDays","useMemo","getOffsetDayInWeek","_toConsumableArray","modifiedDays","getMatrix"],"mappings":";;;;;;;;AAeA;AACA;AACA;AACA,IAAMA,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIC,IAAgB,EAAEC,eAAuB,EAAEC,KAAwB,EAAK;EAChG,I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GAAAN,EAAAA,CAAAA,MAAA,CAAA+B,2CAAA,CACHtG,kBAAkB,CAACC,IAAI,EAAEC,eAAe,EAAEC,KAAK,CAAC,CAAAmG,EAAAA,2CAAA,CAChD7E,qBAAqB,CAACxB,IAAI,EAAEyB,WAAW,EAAEvB,KAAK,CAAC,CAAA,EAAAmG,2CAAA,CAC/CtE,kBAAkB,CAAC/B,IAAI,EAAEyB,WAAW,EAAExB,eAAe,EAAEC,KAAK,CAAC,CACnE,CAAA,CAAA;AAED,IAAA,IAAI2E,SAAS,KAATA,IAAAA,IAAAA,SAAS,eAATA,SAAS,CAAEhB,MAAM,IAAImB,YAAY,aAAZA,YAAY,KAAA,KAAA,CAAA,IAAZA,YAAY,CAAEnB,MAAM,IAAIf,GAAG,IAAIN,GAAG,EAAE;AACzD,MAAA,IAAM8D,YAAY,GAAG3B,wBAAwB,CAACC,IAAI,EAAEC,SAAS,EAAEG,YAAY,EAAExC,GAAG,EAAEM,GAAG,EAAEmC,gBAAgB,CAAC,CAAA;MACxG,OAAOsB,eAAS,CAAWD,YAAY,CAAC,CAAA;AAC5C,KAAA;IAEA,OAAOC,eAAS,CAAW3B,IAAI,CAAC,CAAA;AACpC,GAAC,EAAE,CAAC5E,IAAI,EAAEE,KAAK,EAAE2E,SAAS,EAAEG,YAAY,EAAElC,GAAG,EAAEN,GAAG,CAAC,CAAC,CAAA;AAAA;;;;"}
|
@@ -20,6 +20,7 @@ var CalendarDays = function CalendarDays(_ref) {
|
|
20
20
|
disabledList = _ref.disabledList,
|
21
21
|
min = _ref.min,
|
22
22
|
max = _ref.max,
|
23
|
+
includeEdgeDates = _ref.includeEdgeDates,
|
23
24
|
hoveredDay = _ref.hoveredDay,
|
24
25
|
selectIndexes = _ref.selectIndexes,
|
25
26
|
isDouble = _ref.isDouble,
|
@@ -29,7 +30,7 @@ var CalendarDays = function CalendarDays(_ref) {
|
|
29
30
|
onHoverDay = _ref.onHoverDay,
|
30
31
|
onSetSelected = _ref.onSetSelected,
|
31
32
|
onKeyDown = _ref.onKeyDown;
|
32
|
-
var _useDays = useDays.useDays(currentDate, value, eventList, disabledList, min, max),
|
33
|
+
var _useDays = useDays.useDays(currentDate, value, eventList, disabledList, min, max, includeEdgeDates),
|
33
34
|
_useDays2 = _rollupPluginBabelHelpers.slicedToArray(_useDays, 2),
|
34
35
|
days = _useDays2[0],
|
35
36
|
selected = _useDays2[1];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CalendarDays.js","sources":["../../../../../src/components/Calendar/ui/CalendarDays/CalendarDays.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef } from 'react';\n\nimport { useDays } from '../../hooks';\nimport {\n canSelectDate,\n FULL_DAY_NAMES,\n getInRange,\n getSideInRange,\n isSameDay,\n isSelectProcess,\n ROW_STEP,\n SHORT_DAY_NAMES,\n} from '../../utils';\nimport { CalendarDayItem } from '../CalendarDayItem/CalendarDayItem';\nimport { DateItem } from '../../Calendar.types';\n\nimport { StyledCalendarDays, StyledCalendarDaysHint, StyledFlex } from './CalendarDays.styles';\nimport type { CalendarDaysProps } from './CalendarDays.types';\n\n/**\n * Компонент дней в календаре.\n */\nexport const CalendarDays: React.FC<CalendarDaysProps> = ({\n date: currentDate,\n value,\n eventList,\n disabledList,\n min,\n max,\n hoveredDay,\n selectIndexes,\n isDouble,\n isSecond,\n outerRefs,\n onChangeDay,\n onHoverDay,\n onSetSelected,\n onKeyDown,\n}) => {\n const [days, selected] = useDays(currentDate, value, eventList, disabledList, min, max);\n const selectedRef = useRef(selected);\n const onSetSelectedRef = useRef(onSetSelected);\n\n const offset = isSecond ? ROW_STEP : 0;\n\n const getSelectedDate = useCallback(\n (event: React.MouseEvent<HTMLDivElement>) => {\n const { day, monthIndex, year } = event.currentTarget.dataset;\n\n const selectedDate = {\n day: Number(day),\n monthIndex: Number(monthIndex),\n year: Number(year),\n };\n\n if (!canSelectDate(selectedDate, value, disabledList)) {\n return;\n }\n\n return selectedDate;\n },\n [disabledList, value],\n );\n\n const handleOnChangeDay = useCallback(\n (i: number, j: number) => (event: React.MouseEvent<HTMLDivElement>) => {\n const selectedDate = getSelectedDate(event);\n\n if (!selectedDate) {\n return;\n }\n\n onChangeDay(selectedDate, [i + offset, j]);\n\n if (isSelectProcess(value)) {\n onHoverDay?.(undefined);\n }\n },\n [getSelectedDate, onChangeDay, offset, value, onHoverDay],\n );\n\n const handleOnHoverDay = useCallback(\n (event: React.MouseEvent<HTMLDivElement>) => {\n const selectedDate = getSelectedDate(event);\n const isSelectedDone = Array.isArray(value) && value[0] && value[1];\n\n if (!selectedDate || !Array.isArray(value) || isSelectedDone) {\n return;\n }\n\n onHoverDay?.(selectedDate);\n },\n [getSelectedDate, onHoverDay, value],\n );\n\n const handleOnFocusDay = useCallback(() => {\n // заглушка будет убрана при реализации доступности\n }, []);\n\n const getRefs = useCallback(\n (element: HTMLDivElement, isDayInCurrentMonth: boolean, i: number, j: number) => {\n if (isDayInCurrentMonth) {\n outerRefs.current[i + offset][j] = element;\n }\n },\n [offset, outerRefs],\n );\n\n useEffect(() => {\n if (selectedRef.current) {\n onSetSelectedRef.current?.(selectedRef.current);\n }\n }, []);\n\n return (\n <StyledCalendarDays role=\"grid\" aria-labelledby=\"id-grid-label\" onKeyDown={onKeyDown}>\n <StyledCalendarDaysHint id=\"withShift\">\n Для навигации только по доступным датам удерживайте клавишу Shift.\n </StyledCalendarDaysHint>\n <StyledFlex role=\"row\">\n {SHORT_DAY_NAMES.map((name) => (\n <CalendarDayItem\n role=\"columnheader\"\n aria-label={FULL_DAY_NAMES[name]}\n key={name}\n dayOfWeek\n day={name}\n />\n ))}\n </StyledFlex>\n {days.map((day: DateItem[], i) => (\n <StyledFlex role=\"row\" key={i}>\n {day.map(\n (\n {\n date,\n events,\n disabled,\n isSelected,\n isCurrent,\n isDayInCurrentMonth,\n inRange,\n isOutOfMinMaxRange = false,\n disabledArrowKey,\n disabledMonths,\n },\n j,\n ) => (\n <CalendarDayItem\n ref={(element: HTMLDivElement) => getRefs(element, isDayInCurrentMonth, i, j)}\n eventList={events}\n disabled={disabled}\n day={date.day}\n year={date.year}\n monthIndex={date.monthIndex}\n isFocused={\n i + offset === selectIndexes?.[0] && j === selectIndexes?.[1] && !isOutOfMinMaxRange\n }\n isSelected={isSelected}\n isCurrent={isCurrent}\n isDayInCurrentMonth={isDayInCurrentMonth}\n isDouble={isDouble}\n isHovered={isSameDay(date, hoveredDay)}\n inRange={getInRange(value, date, hoveredDay, inRange)}\n sideInRange={getSideInRange(value, date, hoveredDay, isSelected)}\n onClick={disabled ? undefined : handleOnChangeDay(i, j)}\n onMouseOver={disabled ? undefined : handleOnHoverDay}\n onFocus={handleOnFocusDay}\n key={`StyledDay-${j}`}\n role=\"gridcell\"\n disabledArrowKey={disabledArrowKey}\n disabledMonths={disabledMonths}\n />\n ),\n )}\n </StyledFlex>\n ))}\n </StyledCalendarDays>\n );\n};\n"],"names":["CalendarDays","_ref","currentDate","date","value","eventList","disabledList","min","max","hoveredDay","selectIndexes","isDouble","isSecond","outerRefs","onChangeDay","onHoverDay","onSetSelected","onKeyDown","_useDays","useDays","_useDays2","_slicedToArray","days","selected","selectedRef","useRef","onSetSelectedRef","offset","ROW_STEP","getSelectedDate","useCallback","event","_event$currentTarget$","currentTarget","dataset","day","monthIndex","year","selectedDate","Number","canSelectDate","handleOnChangeDay","i","j","isSelectProcess","undefined","handleOnHoverDay","isSelectedDone","Array","isArray","handleOnFocusDay","getRefs","element","isDayInCurrentMonth","current","useEffect","_onSetSelectedRef$cur","call","React","createElement","StyledCalendarDays","role","_StyledCalendarDaysHi","StyledCalendarDaysHint","id","StyledFlex","SHORT_DAY_NAMES","map","name","CalendarDayItem","FULL_DAY_NAMES","key","dayOfWeek","_ref2","events","disabled","isSelected","isCurrent","inRange","_ref2$isOutOfMinMaxRa","isOutOfMinMaxRange","disabledArrowKey","disabledMonths","ref","isFocused","isHovered","isSameDay","getInRange","sideInRange","getSideInRange","onClick","onMouseOver","onFocus","concat"],"mappings":";;;;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,OAAO,EAAES,gBAAU,CAACnF,KAAK,EAAED,IAAI,EAAEM,UAAU,EAAEqE,OAAO,CAAE;QACtDU,WAAW,EAAEC,oBAAc,CAACrF,KAAK,EAAED,IAAI,EAAEM,UAAU,EAAEmE,UAAU,CAAE;QACjEc,OAAO,EAAEf,QAAQ,GAAG9B,SAAS,GAAGJ,iBAAiB,CAACC,CAAC,EAAEC,CAAC,CAAE;AACxDgD,QAAAA,WAAW,EAAEhB,QAAQ,GAAG9B,SAAS,GAAGC,gBAAiB;AACrD8C,QAAAA,OAAO,EAAE1C,gBAAiB;AAC1BqB,QAAAA,GAAG,EAAAsB,YAAAA,CAAAA,MAAA,CAAelD,CAAC,CAAG;AACtBkB,QAAAA,IAAI,EAAC,UAAU;AACfoB,QAAAA,gBAAgB,EAAEA,gBAAiB;AACnCC,QAAAA,cAAc,EAAEA,cAAAA;AAAe,OAClC,CAAC,CAAA;AAAA,KAEV,CACQ,CAAC,CAAA;AAAA,GAChB,CACe,CAAC,CAAA;AAE7B;;;;"}
|
1
|
+
{"version":3,"file":"CalendarDays.js","sources":["../../../../../src/components/Calendar/ui/CalendarDays/CalendarDays.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef } from 'react';\n\nimport { useDays } from '../../hooks';\nimport {\n canSelectDate,\n FULL_DAY_NAMES,\n getInRange,\n getSideInRange,\n isSameDay,\n isSelectProcess,\n ROW_STEP,\n SHORT_DAY_NAMES,\n} from '../../utils';\nimport { CalendarDayItem } from '../CalendarDayItem/CalendarDayItem';\nimport { DateItem } from '../../Calendar.types';\n\nimport { StyledCalendarDays, StyledCalendarDaysHint, StyledFlex } from './CalendarDays.styles';\nimport type { CalendarDaysProps } from './CalendarDays.types';\n\n/**\n * Компонент дней в календаре.\n */\nexport const CalendarDays: React.FC<CalendarDaysProps> = ({\n date: currentDate,\n value,\n eventList,\n disabledList,\n min,\n max,\n includeEdgeDates,\n hoveredDay,\n selectIndexes,\n isDouble,\n isSecond,\n outerRefs,\n onChangeDay,\n onHoverDay,\n onSetSelected,\n onKeyDown,\n}) => {\n const [days, selected] = useDays(currentDate, value, eventList, disabledList, min, max, includeEdgeDates);\n const selectedRef = useRef(selected);\n const onSetSelectedRef = useRef(onSetSelected);\n\n const offset = isSecond ? ROW_STEP : 0;\n\n const getSelectedDate = useCallback(\n (event: React.MouseEvent<HTMLDivElement>) => {\n const { day, monthIndex, year } = event.currentTarget.dataset;\n\n const selectedDate = {\n day: Number(day),\n monthIndex: Number(monthIndex),\n year: Number(year),\n };\n\n if (!canSelectDate(selectedDate, value, disabledList)) {\n return;\n }\n\n return selectedDate;\n },\n [disabledList, value],\n );\n\n const handleOnChangeDay = useCallback(\n (i: number, j: number) => (event: React.MouseEvent<HTMLDivElement>) => {\n const selectedDate = getSelectedDate(event);\n\n if (!selectedDate) {\n return;\n }\n\n onChangeDay(selectedDate, [i + offset, j]);\n\n if (isSelectProcess(value)) {\n onHoverDay?.(undefined);\n }\n },\n [getSelectedDate, onChangeDay, offset, value, onHoverDay],\n );\n\n const handleOnHoverDay = useCallback(\n (event: React.MouseEvent<HTMLDivElement>) => {\n const selectedDate = getSelectedDate(event);\n const isSelectedDone = Array.isArray(value) && value[0] && value[1];\n\n if (!selectedDate || !Array.isArray(value) || isSelectedDone) {\n return;\n }\n\n onHoverDay?.(selectedDate);\n },\n [getSelectedDate, onHoverDay, value],\n );\n\n const handleOnFocusDay = useCallback(() => {\n // заглушка будет убрана при реализации доступности\n }, []);\n\n const getRefs = useCallback(\n (element: HTMLDivElement, isDayInCurrentMonth: boolean, i: number, j: number) => {\n if (isDayInCurrentMonth) {\n outerRefs.current[i + offset][j] = element;\n }\n },\n [offset, outerRefs],\n );\n\n useEffect(() => {\n if (selectedRef.current) {\n onSetSelectedRef.current?.(selectedRef.current);\n }\n }, []);\n\n return (\n <StyledCalendarDays role=\"grid\" aria-labelledby=\"id-grid-label\" onKeyDown={onKeyDown}>\n <StyledCalendarDaysHint id=\"withShift\">\n Для навигации только по доступным датам удерживайте клавишу Shift.\n </StyledCalendarDaysHint>\n <StyledFlex role=\"row\">\n {SHORT_DAY_NAMES.map((name) => (\n <CalendarDayItem\n role=\"columnheader\"\n aria-label={FULL_DAY_NAMES[name]}\n key={name}\n dayOfWeek\n day={name}\n />\n ))}\n </StyledFlex>\n {days.map((day: DateItem[], i) => (\n <StyledFlex role=\"row\" key={i}>\n {day.map(\n (\n {\n date,\n events,\n disabled,\n isSelected,\n isCurrent,\n isDayInCurrentMonth,\n inRange,\n isOutOfMinMaxRange = false,\n disabledArrowKey,\n disabledMonths,\n },\n j,\n ) => (\n <CalendarDayItem\n ref={(element: HTMLDivElement) => getRefs(element, isDayInCurrentMonth, i, j)}\n eventList={events}\n disabled={disabled}\n day={date.day}\n year={date.year}\n monthIndex={date.monthIndex}\n isFocused={\n i + offset === selectIndexes?.[0] && j === selectIndexes?.[1] && !isOutOfMinMaxRange\n }\n isSelected={isSelected}\n isCurrent={isCurrent}\n isDayInCurrentMonth={isDayInCurrentMonth}\n isDouble={isDouble}\n isHovered={isSameDay(date, hoveredDay)}\n inRange={getInRange(value, date, hoveredDay, inRange)}\n sideInRange={getSideInRange(value, date, hoveredDay, isSelected)}\n onClick={disabled ? undefined : handleOnChangeDay(i, j)}\n onMouseOver={disabled ? undefined : handleOnHoverDay}\n onFocus={handleOnFocusDay}\n key={`StyledDay-${j}`}\n role=\"gridcell\"\n disabledArrowKey={disabledArrowKey}\n disabledMonths={disabledMonths}\n />\n ),\n )}\n </StyledFlex>\n ))}\n </StyledCalendarDays>\n );\n};\n"],"names":["CalendarDays","_ref","currentDate","date","value","eventList","disabledList","min","max","includeEdgeDates","hoveredDay","selectIndexes","isDouble","isSecond","outerRefs","onChangeDay","onHoverDay","onSetSelected","onKeyDown","_useDays","useDays","_useDays2","_slicedToArray","days","selected","selectedRef","useRef","onSetSelectedRef","offset","ROW_STEP","getSelectedDate","useCallback","event","_event$currentTarget$","currentTarget","dataset","day","monthIndex","year","selectedDate","Number","canSelectDate","handleOnChangeDay","i","j","isSelectProcess","undefined","handleOnHoverDay","isSelectedDone","Array","isArray","handleOnFocusDay","getRefs","element","isDayInCurrentMonth","current","useEffect","_onSetSelectedRef$cur","call","React","createElement","StyledCalendarDays","role","_StyledCalendarDaysHi","StyledCalendarDaysHint","id","StyledFlex","SHORT_DAY_NAMES","map","name","CalendarDayItem","FULL_DAY_NAMES","key","dayOfWeek","_ref2","events","disabled","isSelected","isCurrent","inRange","_ref2$isOutOfMinMaxRa","isOutOfMinMaxRange","disabledArrowKey","disabledMonths","ref","isFocused","isHovered","isSameDay","getInRange","sideInRange","getSideInRange","onClick","onMouseOver","onFocus","concat"],"mappings":";;;;;;;;;;;;AAmBA;AACA;AACA;IACaA,YAAyC,GAAG,SAA5CA,YAAyCA,CAAAC,IAAA,EAiBhD;AAAA,EAAA,IAhBIC,WAAW,GAAAD,IAAA,CAAjBE,IAAI;IACJC,KAAK,GAAAH,IAAA,CAALG,KAAK;IACLC,SAAS,GAAAJ,IAAA,CAATI,SAAS;IACTC,YAAY,GAAAL,IAAA,CAAZK,YAAY;IACZC,GAAG,GAAAN,IAAA,CAAHM,GAAG;IACHC,GAAG,GAAAP,IAAA,CAAHO,GAAG;IACHC,gBAAgB,GAAAR,IAAA,CAAhBQ,gBAAgB;IAChBC,UAAU,GAAAT,IAAA,CAAVS,UAAU;IACVC,aAAa,GAAAV,IAAA,CAAbU,aAAa;IACbC,QAAQ,GAAAX,IAAA,CAARW,QAAQ;IACRC,QAAQ,GAAAZ,IAAA,CAARY,QAAQ;IACRC,SAAS,GAAAb,IAAA,CAATa,SAAS;IACTC,WAAW,GAAAd,IAAA,CAAXc,WAAW;IACXC,UAAU,GAAAf,IAAA,CAAVe,UAAU;IACVC,aAAa,GAAAhB,IAAA,CAAbgB,aAAa;IACbC,SAAS,GAAAjB,IAAA,CAATiB,SAAS,CAAA;AAET,EAAA,IAAAC,QAAA,GAAyBC,eAAO,CAAClB,WAAW,EAAEE,KAAK,EAAEC,SAAS,EAAEC,YAAY,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AAKjB,aAAa,KAAA,IAAA,IAAbA,aAAa,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAbA,aAAa,CAAG,CAAC,CAAC,KAAIiC,CAAC,MAAKjC,aAAa,KAAA,IAAA,IAAbA,aAAa,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAbA,aAAa,CAAG,CAAC,CAAC,CAAI,IAAA,CAACsE,kBACrE;AACDJ,QAAAA,UAAU,EAAEA,UAAW;AACvBC,QAAAA,SAAS,EAAEA,SAAU;AACrBxB,QAAAA,mBAAmB,EAAEA,mBAAoB;AACzC1C,QAAAA,QAAQ,EAAEA,QAAS;AACnB0E,QAAAA,SAAS,EAAEC,eAAS,CAACpF,IAAI,EAAEO,UAAU,CAAE;QACvCqE,OAAO,EAAES,gBAAU,CAACpF,KAAK,EAAED,IAAI,EAAEO,UAAU,EAAEqE,OAAO,CAAE;QACtDU,WAAW,EAAEC,oBAAc,CAACtF,KAAK,EAAED,IAAI,EAAEO,UAAU,EAAEmE,UAAU,CAAE;QACjEc,OAAO,EAAEf,QAAQ,GAAG9B,SAAS,GAAGJ,iBAAiB,CAACC,CAAC,EAAEC,CAAC,CAAE;AACxDgD,QAAAA,WAAW,EAAEhB,QAAQ,GAAG9B,SAAS,GAAGC,gBAAiB;AACrD8C,QAAAA,OAAO,EAAE1C,gBAAiB;AAC1BqB,QAAAA,GAAG,EAAAsB,YAAAA,CAAAA,MAAA,CAAelD,CAAC,CAAG;AACtBkB,QAAAA,IAAI,EAAC,UAAU;AACfoB,QAAAA,gBAAgB,EAAEA,gBAAiB;AACnCC,QAAAA,cAAc,EAAEA,cAAAA;AAAe,OAClC,CAAC,CAAA;AAAA,KAEV,CACQ,CAAC,CAAA;AAAA,GAChB,CACe,CAAC,CAAA;AAE7B;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Calendar.types.js","sources":["../../../src/components/Calendar/Calendar.types.ts"],"sourcesContent":["import { HTMLAttributes, MutableRefObject } from 'react';\n\nimport type { CalendarBaseProps } from './CalendarBase/CalendarBase';\nimport type { CalendarDoubleProps } from './CalendarDouble/CalendarDouble';\n\nexport enum Keys {\n pageUp = 33,\n pageDown = 34,\n home = 36,\n end = 35,\n left = 37,\n right = 39,\n up = 38,\n down = 40,\n enter = 13,\n space = 32,\n}\n\nexport interface DateObject {\n day: number;\n monthIndex: number;\n year: number;\n}\n\nexport interface ItemProps {\n isCurrent: boolean;\n isSelected: boolean;\n}\n\nexport interface DateItem extends ItemProps {\n isDayInCurrentMonth: boolean;\n inRange?: boolean;\n date: DateObject;\n events?: EventDay[];\n disabled?: boolean;\n isOutOfMinMaxRange?: boolean;\n disabledArrowKey?: string;\n disabledMonths?: string;\n}\n\nexport interface DayProps extends Partial<ItemProps> {\n isDouble?: boolean;\n isDayInCurrentMonth?: boolean;\n isHovered?: boolean;\n inRange?: boolean;\n sideInRange?: 'left' | 'right';\n disabled?: boolean;\n dayOfWeek?: boolean;\n}\n\nexport interface MonthsProps extends ItemProps {}\n\nexport interface MonthsItem extends ItemProps {\n monthName: string;\n monthFullName?: string;\n monthIndex: number;\n}\n\nexport interface YearsProps extends ItemProps {}\n\nexport interface YearsItem extends ItemProps {\n yearValue: number;\n}\n\nexport interface EventDay {\n date: Date;\n color?: string;\n}\n\nexport interface DisabledDay {\n date: Date;\n}\n\nexport interface UseKeyNavigationProps {\n size: [number, number];\n isDouble?: boolean;\n onPrev: (withShift?: boolean) => void;\n onNext: (withShift?: boolean) => void;\n}\n\nexport type CalendarValueType = Date | undefined | [Date | undefined, Date?];\n\nexport interface Calendar extends HTMLAttributes<HTMLDivElement> {\n /**\n * Выбранное значение.\n */\n value: CalendarValueType;\n /**\n * Состояние календаря, отвечающее за отображение.\n */\n date?: DateObject;\n /**\n * Минимальное значение даты.\n */\n min?: Date;\n /**\n * Максимальное значение даты.\n */\n max?: Date;\n /**\n * Список событий.\n */\n eventList?: EventDay[];\n /**\n * Список отключенных дней.\n */\n disabledList?: DisabledDay[];\n /**\n * Обработчик изменения значения.\n */\n onChangeValue: (value: Date) => void;\n}\n\nexport type CalendarRange<T> = Omit<T, 'value' | 'onChangeValue'> & {\n /**\n * Выбранное значение.\n */\n value: [Date, Date?];\n /**\n * Обработчик изменения значения.\n */\n onChangeValue: (values: [Date, Date?]) => void;\n /**\n * Обработчик для выбора стартового значения в диапазоне.\n */\n onChangeStartOfRange?: (value: Date) => void;\n};\n\nexport interface DaysMetaDescription {\n refs: MutableRefObject<HTMLDivElement[][]>;\n rowSize: number;\n newRowIndex: number;\n newColumnIndex: number;\n columnSize: number;\n minColumnIndex: number;\n defaultState?: number[];\n}\n\nexport type KeyboardArrowKey = 'left' | 'right' | 'up' | 'down';\n\ntype BaseProps = {\n /**\n * Режим отображения: двойной или одинарный.\n */\n isDouble?: false;\n /**\n * Режим выбора: диапазон или одинарный.\n */\n isRange?: false;\n /**\n * Выбранное значение.\n */\n value: Date;\n} & CalendarBaseProps;\n\ntype BaseRangeProps = {\n /**\n * Режим отображения: двойной или одинарный.\n */\n isDouble?: false;\n /**\n * Режим выбора: диапазон или одинарный.\n */\n isRange: true;\n} & CalendarRange<CalendarBaseProps>;\n\ntype DoubleProps = {\n /**\n * Режим отображения: двойной или одинарный.\n */\n isDouble?: true;\n /**\n * Режим выбора: диапазон или одинарный.\n */\n isRange?: false;\n /**\n * Выбранное значение.\n */\n value: Date;\n} & CalendarDoubleProps;\n\ntype DoubleRangeProps = {\n /**\n * Режим отображения: двойной или одинарный.\n */\n isDouble?: true;\n /**\n * Режим выбора: диапазон или одинарный.\n */\n isRange: true;\n} & CalendarRange<CalendarDoubleProps>;\n\nexport type ComponentVariation = {\n base: React.FC<CalendarBaseProps>;\n baseRange: React.FC<CalendarRange<CalendarBaseProps>>;\n double: React.FC<CalendarDoubleProps>;\n doubleRange: React.FC<CalendarRange<CalendarDoubleProps>>;\n};\n\nexport type CalendarProps = BaseProps | BaseRangeProps | DoubleProps | DoubleRangeProps;\n"],"names":["Keys"],"mappings":"AAKYA,IAAAA,IAAI,0BAAJA,IAAI,EAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,QAAA,CAAA,GAAA,EAAA,CAAA,GAAA,QAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,UAAA,CAAA,GAAA,EAAA,CAAA,GAAA,UAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,MAAA,CAAA,GAAA,EAAA,CAAA,GAAA,MAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,KAAA,CAAA,GAAA,EAAA,CAAA,GAAA,KAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,MAAA,CAAA,GAAA,EAAA,CAAA,GAAA,MAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,OAAA,CAAA,GAAA,EAAA,CAAA,GAAA,OAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,IAAA,CAAA,GAAA,EAAA,CAAA,GAAA,IAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,MAAA,CAAA,GAAA,EAAA,CAAA,GAAA,MAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,OAAA,CAAA,GAAA,EAAA,CAAA,GAAA,OAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,OAAA,CAAA,GAAA,EAAA,CAAA,GAAA,OAAA,CAAA;AAAA,EAAA,OAAJA,IAAI,CAAA;AAAA,CAAA,CAAA,EAAA;;;;"}
|
1
|
+
{"version":3,"file":"Calendar.types.js","sources":["../../../src/components/Calendar/Calendar.types.ts"],"sourcesContent":["import { HTMLAttributes, MutableRefObject } from 'react';\n\nimport type { CalendarBaseProps } from './CalendarBase/CalendarBase';\nimport type { CalendarDoubleProps } from './CalendarDouble/CalendarDouble';\n\nexport enum Keys {\n pageUp = 33,\n pageDown = 34,\n home = 36,\n end = 35,\n left = 37,\n right = 39,\n up = 38,\n down = 40,\n enter = 13,\n space = 32,\n}\n\nexport interface DateObject {\n day: number;\n monthIndex: number;\n year: number;\n}\n\nexport interface ItemProps {\n isCurrent: boolean;\n isSelected: boolean;\n}\n\nexport interface DateItem extends ItemProps {\n isDayInCurrentMonth: boolean;\n inRange?: boolean;\n date: DateObject;\n events?: EventDay[];\n disabled?: boolean;\n isOutOfMinMaxRange?: boolean;\n disabledArrowKey?: string;\n disabledMonths?: string;\n}\n\nexport interface DayProps extends Partial<ItemProps> {\n isDouble?: boolean;\n isDayInCurrentMonth?: boolean;\n isHovered?: boolean;\n inRange?: boolean;\n sideInRange?: 'left' | 'right';\n disabled?: boolean;\n dayOfWeek?: boolean;\n}\n\nexport interface MonthsProps extends ItemProps {}\n\nexport interface MonthsItem extends ItemProps {\n monthName: string;\n monthFullName?: string;\n monthIndex: number;\n}\n\nexport interface YearsProps extends ItemProps {}\n\nexport interface YearsItem extends ItemProps {\n yearValue: number;\n}\n\nexport interface EventDay {\n date: Date;\n color?: string;\n}\n\nexport interface DisabledDay {\n date: Date;\n}\n\nexport interface UseKeyNavigationProps {\n size: [number, number];\n isDouble?: boolean;\n onPrev: (withShift?: boolean) => void;\n onNext: (withShift?: boolean) => void;\n}\n\nexport type CalendarValueType = Date | undefined | [Date | undefined, Date?];\n\nexport interface Calendar extends HTMLAttributes<HTMLDivElement> {\n /**\n * Выбранное значение.\n */\n value: CalendarValueType;\n /**\n * Состояние календаря, отвечающее за отображение.\n */\n date?: DateObject;\n /**\n * Минимальное значение даты.\n */\n min?: Date;\n /**\n * Максимальное значение даты.\n */\n max?: Date;\n /**\n * Должны ли значения минимального и максимального дня включаться в диапазон.\n */\n includeEdgeDates?: boolean;\n /**\n * Список событий.\n */\n eventList?: EventDay[];\n /**\n * Список отключенных дней.\n */\n disabledList?: DisabledDay[];\n /**\n * Обработчик изменения значения.\n */\n onChangeValue: (value: Date) => void;\n}\n\nexport type CalendarRange<T> = Omit<T, 'value' | 'onChangeValue'> & {\n /**\n * Выбранное значение.\n */\n value: [Date, Date?];\n /**\n * Обработчик изменения значения.\n */\n onChangeValue: (values: [Date, Date?]) => void;\n /**\n * Обработчик для выбора стартового значения в диапазоне.\n */\n onChangeStartOfRange?: (value: Date) => void;\n};\n\nexport interface DaysMetaDescription {\n refs: MutableRefObject<HTMLDivElement[][]>;\n rowSize: number;\n newRowIndex: number;\n newColumnIndex: number;\n columnSize: number;\n minColumnIndex: number;\n defaultState?: number[];\n}\n\nexport type KeyboardArrowKey = 'left' | 'right' | 'up' | 'down';\n\ntype BaseProps = {\n /**\n * Режим отображения: двойной или одинарный.\n */\n isDouble?: false;\n /**\n * Режим выбора: диапазон или одинарный.\n */\n isRange?: false;\n /**\n * Выбранное значение.\n */\n value: Date;\n} & CalendarBaseProps;\n\ntype BaseRangeProps = {\n /**\n * Режим отображения: двойной или одинарный.\n */\n isDouble?: false;\n /**\n * Режим выбора: диапазон или одинарный.\n */\n isRange: true;\n} & CalendarRange<CalendarBaseProps>;\n\ntype DoubleProps = {\n /**\n * Режим отображения: двойной или одинарный.\n */\n isDouble?: true;\n /**\n * Режим выбора: диапазон или одинарный.\n */\n isRange?: false;\n /**\n * Выбранное значение.\n */\n value: Date;\n} & CalendarDoubleProps;\n\ntype DoubleRangeProps = {\n /**\n * Режим отображения: двойной или одинарный.\n */\n isDouble?: true;\n /**\n * Режим выбора: диапазон или одинарный.\n */\n isRange: true;\n} & CalendarRange<CalendarDoubleProps>;\n\nexport type ComponentVariation = {\n base: React.FC<CalendarBaseProps>;\n baseRange: React.FC<CalendarRange<CalendarBaseProps>>;\n double: React.FC<CalendarDoubleProps>;\n doubleRange: React.FC<CalendarRange<CalendarDoubleProps>>;\n};\n\nexport type CalendarProps = BaseProps | BaseRangeProps | DoubleProps | DoubleRangeProps;\n"],"names":["Keys"],"mappings":"AAKYA,IAAAA,IAAI,0BAAJA,IAAI,EAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,QAAA,CAAA,GAAA,EAAA,CAAA,GAAA,QAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,UAAA,CAAA,GAAA,EAAA,CAAA,GAAA,UAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,MAAA,CAAA,GAAA,EAAA,CAAA,GAAA,MAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,KAAA,CAAA,GAAA,EAAA,CAAA,GAAA,KAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,MAAA,CAAA,GAAA,EAAA,CAAA,GAAA,MAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,OAAA,CAAA,GAAA,EAAA,CAAA,GAAA,OAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,IAAA,CAAA,GAAA,EAAA,CAAA,GAAA,IAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,MAAA,CAAA,GAAA,EAAA,CAAA,GAAA,MAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,OAAA,CAAA,GAAA,EAAA,CAAA,GAAA,OAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,OAAA,CAAA,GAAA,EAAA,CAAA,GAAA,OAAA,CAAA;AAAA,EAAA,OAAJA,IAAI,CAAA;AAAA,CAAA,CAAA,EAAA;;;;"}
|
@@ -12,7 +12,7 @@ import { base } from './variations/_view/base.js';
|
|
12
12
|
import { base as base$1 } from './variations/_size/base.js';
|
13
13
|
import { IsOutOfRange, StyledCalendar } from './CalendarBase.styles.js';
|
14
14
|
|
15
|
-
var _excluded = ["value", "min", "max", "type", "eventList", "disabledList", "onChangeValue"];
|
15
|
+
var _excluded = ["value", "min", "max", "includeEdgeDates", "type", "eventList", "disabledList", "onChangeValue"];
|
16
16
|
/**
|
17
17
|
* Компонент календаря.
|
18
18
|
*/
|
@@ -21,6 +21,7 @@ var calendarBaseRoot = function calendarBaseRoot(Root) {
|
|
21
21
|
var externalValue = _ref.value,
|
22
22
|
min = _ref.min,
|
23
23
|
max = _ref.max,
|
24
|
+
includeEdgeDates = _ref.includeEdgeDates,
|
24
25
|
_ref$type = _ref.type,
|
25
26
|
type = _ref$type === void 0 ? 'Days' : _ref$type,
|
26
27
|
eventList = _ref.eventList,
|
@@ -229,6 +230,7 @@ var calendarBaseRoot = function calendarBaseRoot(Root) {
|
|
229
230
|
disabledList: disabledList,
|
230
231
|
min: min,
|
231
232
|
max: max,
|
233
|
+
includeEdgeDates: includeEdgeDates,
|
232
234
|
value: externalValue,
|
233
235
|
date: date,
|
234
236
|
hoveredDay: hoveredDay,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CalendarBase.js","sources":["../../../../src/components/Calendar/CalendarBase/CalendarBase.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useReducer, useState, KeyboardEvent, HTMLAttributes, forwardRef } from 'react';\n\nimport type { Calendar, DateObject, UseKeyNavigationProps } from '../Calendar.types';\nimport type { CalendarStateType } from '../store/types';\nimport { getInitialState, reducer } from '../store/reducer';\nimport { ActionType, CalendarState } from '../store/types';\nimport { isValueUpdate, YEAR_RENDER_COUNT } from '../utils';\nimport { useKeyNavigation } from '../hooks';\nimport { CalendarDays, CalendarHeader, CalendarMonths, CalendarYears } from '../ui';\nimport { RootProps } from '../../../engines';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { IsOutOfRange, StyledCalendar } from './CalendarBase.styles';\n\nexport type CalendarBaseProps = HTMLAttributes<HTMLDivElement> &\n Calendar & {\n /**\n * Тип отображения календаря: дни, месяца, года.\n */\n type?: CalendarStateType;\n };\n\n/**\n * Компонент календаря.\n */\nexport const calendarBaseRoot = (Root: RootProps<HTMLDivElement, HTMLAttributes<HTMLDivElement>>) =>\n forwardRef<HTMLDivElement, CalendarBaseProps>(\n (\n { value: externalValue, min, max, type = 'Days', eventList, disabledList, onChangeValue, ...rest },\n outerRootRef,\n ) => {\n const [firstValue, secondValue] = useMemo(\n () => (Array.isArray(externalValue) ? externalValue : [externalValue]),\n [externalValue],\n );\n const value = secondValue || firstValue;\n const [hoveredDay, setHoveredDay] = useState<DateObject | undefined>();\n const [prevType, setPrevType] = useState(type);\n const [prevValue, setPrevValue] = useState(value);\n const [outOfRangeKey, setOutOfRangeKey] = useState<number>(0);\n\n const [state, dispatch] = useReducer(reducer, getInitialState(value, [5, 6], type));\n\n const { date, calendarState, startYear, size } = state;\n\n const handlePrev = useCallback<UseKeyNavigationProps['onPrev']>(\n (withShift = false) => {\n if (calendarState === CalendarState.Days) {\n if (withShift) {\n dispatch({\n type: ActionType.PREVIOUS_YEAR,\n payload: { step: 1 },\n });\n\n return;\n }\n\n dispatch({\n type: ActionType.PREVIOUS_MONTH,\n payload: { monthIndex: date.monthIndex, year: date.year },\n });\n\n return;\n }\n\n if (calendarState === CalendarState.Months) {\n dispatch({ type: ActionType.PREVIOUS_YEAR, payload: { step: 1 } });\n\n return;\n }\n\n if (calendarState === CalendarState.Years) {\n dispatch({ type: ActionType.PREVIOUS_START_YEAR, payload: { yearsCount: YEAR_RENDER_COUNT } });\n }\n },\n [date, calendarState],\n );\n\n const handleNext = useCallback<UseKeyNavigationProps['onNext']>(\n (withShift = false) => {\n if (calendarState === CalendarState.Days) {\n if (withShift) {\n dispatch({\n type: ActionType.NEXT_YEAR,\n payload: { step: 1 },\n });\n\n return;\n }\n\n dispatch({\n type: ActionType.NEXT_MONTH,\n payload: { monthIndex: date.monthIndex, year: date.year },\n });\n\n return;\n }\n\n if (calendarState === CalendarState.Months) {\n dispatch({ type: ActionType.NEXT_YEAR, payload: { step: 1 } });\n\n return;\n }\n\n if (calendarState === CalendarState.Years) {\n dispatch({ type: ActionType.NEXT_START_YEAR, payload: { yearsCount: YEAR_RENDER_COUNT } });\n }\n },\n [date, calendarState],\n );\n\n const [selectIndexes, onKeyDown, onSelectIndexes, outerRefs, isOutOfRange] = useKeyNavigation({\n size,\n onNext: handleNext,\n onPrev: handlePrev,\n });\n\n const handleOnChangeDay = useCallback(\n (newDate: DateObject, coord: number[]) => {\n const newDay = new Date(newDate.year, newDate.monthIndex, newDate.day);\n onChangeValue?.(newDay);\n\n onSelectIndexes(coord);\n },\n [onChangeValue, onSelectIndexes],\n );\n\n const handleOnChangeMonth = useCallback((monthIndex: number) => {\n dispatch({\n type: ActionType.UPDATE_MONTH,\n payload: { calendarState: CalendarState.Days, monthIndex, size: [5, 6] },\n });\n }, []);\n\n const handleOnChangeYear = useCallback((year: number) => {\n dispatch({\n type: ActionType.UPDATE_YEAR,\n payload: { calendarState: CalendarState.Months, year },\n });\n }, []);\n\n const handleUpdateCalendarState = useCallback(\n (newCalendarState: CalendarStateType, newSize: [number, number]) => {\n dispatch({\n type: ActionType.UPDATE_CALENDAR_STATE,\n payload: { calendarState: newCalendarState, size: newSize },\n });\n },\n [],\n );\n\n if (value && prevValue && isValueUpdate(value, prevValue)) {\n dispatch({\n type: ActionType.UPDATE_DATE,\n payload: { value },\n });\n\n setPrevValue(value);\n }\n\n if (prevType !== type) {\n dispatch({\n type: ActionType.UPDATE_CALENDAR_STATE,\n payload: { calendarState: type },\n });\n\n setPrevType(type);\n }\n\n // Изменяем ключ каждый раз как пытаемся перейти на даты которые находятся за пределами min/max ограничений.\n // Это необходимо для того чтобы screen-reader корректно озвучивал уведомление aria-live=\"assertive\"\n // о том что нет доступных дат\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n setOutOfRangeKey((previousState) => Number(!previousState));\n\n onKeyDown(event);\n },\n [onKeyDown],\n );\n\n return (\n <Root ref={outerRootRef} aria-label=\"Выбор даты\" {...rest}>\n {isOutOfRange && (\n <IsOutOfRange\n key={outOfRangeKey}\n aria-atomic=\"true\"\n role=\"alert\"\n aria-live=\"assertive\"\n aria-relevant=\"additions\"\n >\n Далее нет доступных дат.\n </IsOutOfRange>\n )}\n <CalendarHeader\n firstDate={date}\n startYear={startYear}\n type={calendarState}\n onPrev={handlePrev}\n onNext={handleNext}\n onUpdateCalendarState={handleUpdateCalendarState}\n />\n {calendarState === CalendarState.Days && (\n <CalendarDays\n eventList={eventList}\n disabledList={disabledList}\n min={min}\n max={max}\n value={externalValue}\n date={date}\n hoveredDay={hoveredDay}\n selectIndexes={selectIndexes}\n onChangeDay={handleOnChangeDay}\n onHoverDay={setHoveredDay}\n onSetSelected={onSelectIndexes}\n onKeyDown={handleKeyDown}\n outerRefs={outerRefs}\n />\n )}\n {calendarState === CalendarState.Months && (\n <CalendarMonths\n date={date}\n selectIndexes={selectIndexes}\n onChangeMonth={handleOnChangeMonth}\n onSetSelected={onSelectIndexes}\n onKeyDown={onKeyDown}\n outerRefs={outerRefs}\n />\n )}\n {calendarState === CalendarState.Years && (\n <CalendarYears\n date={date}\n startYear={startYear}\n selectIndexes={selectIndexes}\n onChangeYear={handleOnChangeYear}\n onSetSelected={onSelectIndexes}\n onKeyDown={onKeyDown}\n outerRefs={outerRefs}\n />\n )}\n </Root>\n );\n },\n );\n\nexport const calendarBaseConfig = {\n name: 'CalendarBase',\n tag: 'div',\n layout: calendarBaseRoot,\n base: StyledCalendar,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'primary',\n size: 'm',\n },\n};\n"],"names":["calendarBaseRoot","Root","forwardRef","_ref","outerRootRef","externalValue","value","min","max","_ref$type","type","eventList","disabledList","onChangeValue","rest","_objectWithoutProperties","_excluded","_useMemo","useMemo","Array","isArray","_useMemo2","_slicedToArray","firstValue","secondValue","_useState","useState","_useState2","hoveredDay","setHoveredDay","_useState3","_useState4","prevType","setPrevType","_useState5","_useState6","prevValue","setPrevValue","_useState7","_useState8","outOfRangeKey","setOutOfRangeKey","_useReducer","useReducer","reducer","getInitialState","_useReducer2","state","dispatch","date","calendarState","startYear","size","handlePrev","useCallback","withShift","arguments","length","undefined","CalendarState","Days","ActionType","PREVIOUS_YEAR","payload","step","PREVIOUS_MONTH","monthIndex","year","Months","Years","PREVIOUS_START_YEAR","yearsCount","YEAR_RENDER_COUNT","handleNext","NEXT_YEAR","NEXT_MONTH","NEXT_START_YEAR","_useKeyNavigation","useKeyNavigation","onNext","onPrev","_useKeyNavigation2","selectIndexes","onKeyDown","onSelectIndexes","outerRefs","isOutOfRange","handleOnChangeDay","newDate","coord","newDay","Date","day","handleOnChangeMonth","UPDATE_MONTH","handleOnChangeYear","UPDATE_YEAR","handleUpdateCalendarState","newCalendarState","newSize","UPDATE_CALENDAR_STATE","isValueUpdate","UPDATE_DATE","handleKeyDown","event","previousState","Number","React","createElement","_extends","ref","IsOutOfRange","key","role","CalendarHeader","firstDate","onUpdateCalendarState","CalendarDays","onChangeDay","onHoverDay","onSetSelected","CalendarMonths","onChangeMonth","CalendarYears","onChangeYear","calendarBaseConfig","name","tag","layout","base","StyledCalendar","variations","view","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;;;;;;;AAuBA;AACA;AACA;IACaA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,IAA+D,EAAA;AAAA,EAAA,oBAC5FC,UAAU,CACN,UAAAC,IAAA,EAEIC,YAAY,EACX;AAAA,IAAA,IAFQC,aAAa,GAAAF,IAAA,CAApBG,KAAK;MAAiBC,GAAG,GAAAJ,IAAA,CAAHI,GAAG;MAAEC,GAAG,GAAAL,IAAA,CAAHK,GAAG;MAAAC,SAAA,GAAAN,IAAA,CAAEO,IAAI;AAAJA,MAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,SAAA;MAAEE,SAAS,GAAAR,IAAA,CAATQ,SAAS;MAAEC,YAAY,GAAAT,IAAA,CAAZS,YAAY;MAAEC,aAAa,GAAAV,IAAA,CAAbU,aAAa;AAAKC,MAAAA,IAAI,GAAAC,wBAAA,CAAAZ,IAAA,EAAAa,SAAA,CAAA,CAAA;IAGhG,IAAAC,QAAA,GAAkCC,OAAO,CACrC,YAAA;QAA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AAAA,SAAS,EAAEA,SAAAA;AAAU,KACxB,CACJ,EACAnC,aAAa,KAAKS,aAAa,CAACU,KAAK,iBAClCsC,KAAA,CAAAC,aAAA,CAACe,aAAa,EAAA;AACV1E,MAAAA,IAAI,EAAEA,IAAK;AACXE,MAAAA,SAAS,EAAEA,SAAU;AACrB+B,MAAAA,aAAa,EAAEA,aAAc;AAC7B0C,MAAAA,YAAY,EAAE7B,kBAAmB;AACjCyB,MAAAA,aAAa,EAAEpC,eAAgB;AAC/BD,MAAAA,SAAS,EAAEA,SAAU;AACrBE,MAAAA,SAAS,EAAEA,SAAAA;AAAU,KACxB,CAEH,CAAC,CAAA;AAEf,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMwC,kBAAkB,GAAG;AAC9BC,EAAAA,IAAI,EAAE,cAAc;AACpBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEhI,gBAAgB;AACxBiI,EAAAA,IAAI,EAAEC,cAAc;AACpBC,EAAAA,UAAU,EAAE;AACRC,IAAAA,IAAI,EAAE;AACFC,MAAAA,GAAG,EAAEC,IAAAA;KACR;AACDlF,IAAAA,IAAI,EAAE;AACFiF,MAAAA,GAAG,EAAEE,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNJ,IAAAA,IAAI,EAAE,SAAS;AACfhF,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
|
1
|
+
{"version":3,"file":"CalendarBase.js","sources":["../../../../src/components/Calendar/CalendarBase/CalendarBase.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useReducer, useState, KeyboardEvent, HTMLAttributes, forwardRef } from 'react';\n\nimport type { Calendar, DateObject, UseKeyNavigationProps } from '../Calendar.types';\nimport type { CalendarStateType } from '../store/types';\nimport { getInitialState, reducer } from '../store/reducer';\nimport { ActionType, CalendarState } from '../store/types';\nimport { isValueUpdate, YEAR_RENDER_COUNT } from '../utils';\nimport { useKeyNavigation } from '../hooks';\nimport { CalendarDays, CalendarHeader, CalendarMonths, CalendarYears } from '../ui';\nimport { RootProps } from '../../../engines';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { IsOutOfRange, StyledCalendar } from './CalendarBase.styles';\n\nexport type CalendarBaseProps = HTMLAttributes<HTMLDivElement> &\n Calendar & {\n /**\n * Тип отображения календаря: дни, месяца, года.\n */\n type?: CalendarStateType;\n };\n\n/**\n * Компонент календаря.\n */\nexport const calendarBaseRoot = (Root: RootProps<HTMLDivElement, HTMLAttributes<HTMLDivElement>>) =>\n forwardRef<HTMLDivElement, CalendarBaseProps>(\n (\n {\n value: externalValue,\n min,\n max,\n includeEdgeDates,\n type = 'Days',\n eventList,\n disabledList,\n onChangeValue,\n ...rest\n },\n outerRootRef,\n ) => {\n const [firstValue, secondValue] = useMemo(\n () => (Array.isArray(externalValue) ? externalValue : [externalValue]),\n [externalValue],\n );\n const value = secondValue || firstValue;\n const [hoveredDay, setHoveredDay] = useState<DateObject | undefined>();\n const [prevType, setPrevType] = useState(type);\n const [prevValue, setPrevValue] = useState(value);\n const [outOfRangeKey, setOutOfRangeKey] = useState<number>(0);\n\n const [state, dispatch] = useReducer(reducer, getInitialState(value, [5, 6], type));\n\n const { date, calendarState, startYear, size } = state;\n\n const handlePrev = useCallback<UseKeyNavigationProps['onPrev']>(\n (withShift = false) => {\n if (calendarState === CalendarState.Days) {\n if (withShift) {\n dispatch({\n type: ActionType.PREVIOUS_YEAR,\n payload: { step: 1 },\n });\n\n return;\n }\n\n dispatch({\n type: ActionType.PREVIOUS_MONTH,\n payload: { monthIndex: date.monthIndex, year: date.year },\n });\n\n return;\n }\n\n if (calendarState === CalendarState.Months) {\n dispatch({ type: ActionType.PREVIOUS_YEAR, payload: { step: 1 } });\n\n return;\n }\n\n if (calendarState === CalendarState.Years) {\n dispatch({ type: ActionType.PREVIOUS_START_YEAR, payload: { yearsCount: YEAR_RENDER_COUNT } });\n }\n },\n [date, calendarState],\n );\n\n const handleNext = useCallback<UseKeyNavigationProps['onNext']>(\n (withShift = false) => {\n if (calendarState === CalendarState.Days) {\n if (withShift) {\n dispatch({\n type: ActionType.NEXT_YEAR,\n payload: { step: 1 },\n });\n\n return;\n }\n\n dispatch({\n type: ActionType.NEXT_MONTH,\n payload: { monthIndex: date.monthIndex, year: date.year },\n });\n\n return;\n }\n\n if (calendarState === CalendarState.Months) {\n dispatch({ type: ActionType.NEXT_YEAR, payload: { step: 1 } });\n\n return;\n }\n\n if (calendarState === CalendarState.Years) {\n dispatch({ type: ActionType.NEXT_START_YEAR, payload: { yearsCount: YEAR_RENDER_COUNT } });\n }\n },\n [date, calendarState],\n );\n\n const [selectIndexes, onKeyDown, onSelectIndexes, outerRefs, isOutOfRange] = useKeyNavigation({\n size,\n onNext: handleNext,\n onPrev: handlePrev,\n });\n\n const handleOnChangeDay = useCallback(\n (newDate: DateObject, coord: number[]) => {\n const newDay = new Date(newDate.year, newDate.monthIndex, newDate.day);\n onChangeValue?.(newDay);\n\n onSelectIndexes(coord);\n },\n [onChangeValue, onSelectIndexes],\n );\n\n const handleOnChangeMonth = useCallback((monthIndex: number) => {\n dispatch({\n type: ActionType.UPDATE_MONTH,\n payload: { calendarState: CalendarState.Days, monthIndex, size: [5, 6] },\n });\n }, []);\n\n const handleOnChangeYear = useCallback((year: number) => {\n dispatch({\n type: ActionType.UPDATE_YEAR,\n payload: { calendarState: CalendarState.Months, year },\n });\n }, []);\n\n const handleUpdateCalendarState = useCallback(\n (newCalendarState: CalendarStateType, newSize: [number, number]) => {\n dispatch({\n type: ActionType.UPDATE_CALENDAR_STATE,\n payload: { calendarState: newCalendarState, size: newSize },\n });\n },\n [],\n );\n\n if (value && prevValue && isValueUpdate(value, prevValue)) {\n dispatch({\n type: ActionType.UPDATE_DATE,\n payload: { value },\n });\n\n setPrevValue(value);\n }\n\n if (prevType !== type) {\n dispatch({\n type: ActionType.UPDATE_CALENDAR_STATE,\n payload: { calendarState: type },\n });\n\n setPrevType(type);\n }\n\n // Изменяем ключ каждый раз как пытаемся перейти на даты которые находятся за пределами min/max ограничений.\n // Это необходимо для того чтобы screen-reader корректно озвучивал уведомление aria-live=\"assertive\"\n // о том что нет доступных дат\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n setOutOfRangeKey((previousState) => Number(!previousState));\n\n onKeyDown(event);\n },\n [onKeyDown],\n );\n\n return (\n <Root ref={outerRootRef} aria-label=\"Выбор даты\" {...rest}>\n {isOutOfRange && (\n <IsOutOfRange\n key={outOfRangeKey}\n aria-atomic=\"true\"\n role=\"alert\"\n aria-live=\"assertive\"\n aria-relevant=\"additions\"\n >\n Далее нет доступных дат.\n </IsOutOfRange>\n )}\n <CalendarHeader\n firstDate={date}\n startYear={startYear}\n type={calendarState}\n onPrev={handlePrev}\n onNext={handleNext}\n onUpdateCalendarState={handleUpdateCalendarState}\n />\n {calendarState === CalendarState.Days && (\n <CalendarDays\n eventList={eventList}\n disabledList={disabledList}\n min={min}\n max={max}\n includeEdgeDates={includeEdgeDates}\n value={externalValue}\n date={date}\n hoveredDay={hoveredDay}\n selectIndexes={selectIndexes}\n onChangeDay={handleOnChangeDay}\n onHoverDay={setHoveredDay}\n onSetSelected={onSelectIndexes}\n onKeyDown={handleKeyDown}\n outerRefs={outerRefs}\n />\n )}\n {calendarState === CalendarState.Months && (\n <CalendarMonths\n date={date}\n selectIndexes={selectIndexes}\n onChangeMonth={handleOnChangeMonth}\n onSetSelected={onSelectIndexes}\n onKeyDown={onKeyDown}\n outerRefs={outerRefs}\n />\n )}\n {calendarState === CalendarState.Years && (\n <CalendarYears\n date={date}\n startYear={startYear}\n selectIndexes={selectIndexes}\n onChangeYear={handleOnChangeYear}\n onSetSelected={onSelectIndexes}\n onKeyDown={onKeyDown}\n outerRefs={outerRefs}\n />\n )}\n </Root>\n );\n },\n );\n\nexport const calendarBaseConfig = {\n name: 'CalendarBase',\n tag: 'div',\n layout: calendarBaseRoot,\n base: StyledCalendar,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'primary',\n size: 'm',\n },\n};\n"],"names":["calendarBaseRoot","Root","forwardRef","_ref","outerRootRef","externalValue","value","min","max","includeEdgeDates","_ref$type","type","eventList","disabledList","onChangeValue","rest","_objectWithoutProperties","_excluded","_useMemo","useMemo","Array","isArray","_useMemo2","_slicedToArray","firstValue","secondValue","_useState","useState","_useState2","hoveredDay","setHoveredDay","_useState3","_useState4","prevType","setPrevType","_useState5","_useState6","prevValue","setPrevValue","_useState7","_useState8","outOfRangeKey","setOutOfRangeKey","_useReducer","useReducer","reducer","getInitialState","_useReducer2","state","dispatch","date","calendarState","startYear","size","handlePrev","useCallback","withShift","arguments","length","undefined","CalendarState","Days","ActionType","PREVIOUS_YEAR","payload","step","PREVIOUS_MONTH","monthIndex","year","Months","Years","PREVIOUS_START_YEAR","yearsCount","YEAR_RENDER_COUNT","handleNext","NEXT_YEAR","NEXT_MONTH","NEXT_START_YEAR","_useKeyNavigation","useKeyNavigation","onNext","onPrev","_useKeyNavigation2","selectIndexes","onKeyDown","onSelectIndexes","outerRefs","isOutOfRange","handleOnChangeDay","newDate","coord","newDay","Date","day","handleOnChangeMonth","UPDATE_MONTH","handleOnChangeYear","UPDATE_YEAR","handleUpdateCalendarState","newCalendarState","newSize","UPDATE_CALENDAR_STATE","isValueUpdate","UPDATE_DATE","handleKeyDown","event","previousState","Number","React","createElement","_extends","ref","IsOutOfRange","key","role","CalendarHeader","firstDate","onUpdateCalendarState","CalendarDays","onChangeDay","onHoverDay","onSetSelected","CalendarMonths","onChangeMonth","CalendarYears","onChangeYear","calendarBaseConfig","name","tag","layout","base","StyledCalendar","variations","view","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;;;;;;;AAuBA;AACA;AACA;IACaA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,IAA+D,EAAA;AAAA,EAAA,oBAC5FC,UAAU,CACN,UA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