@salutejs/plasma-new-hope 0.174.0-canary.1505.11485998091.0 → 0.174.0-canary.1505.11505788468.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js +5 -1
- package/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js.map +1 -1
- package/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js +5 -1
- package/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js.map +1 -1
- package/cjs/components/Calendar/ui/CalendarQuarters/CalendarQuarters.js +5 -1
- package/cjs/components/Calendar/ui/CalendarQuarters/CalendarQuarters.js.map +1 -1
- package/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js +5 -1
- package/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/Combobox.js +9 -5
- package/cjs/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +9 -5
- package/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js.map +1 -1
- package/cjs/components/Select/utils/getButtonLabel.js +2 -2
- package/cjs/components/Select/utils/getButtonLabel.js.map +1 -1
- package/cjs/components/Select/utils/initialItemsTransform.js +6 -7
- package/cjs/components/Select/utils/initialItemsTransform.js.map +1 -1
- package/cjs/components/TextArea/TextArea.js +1 -1
- package/cjs/components/TextArea/TextArea.js.map +1 -1
- package/cjs/components/TextArea/TextArea.styles.js +2 -2
- package/cjs/components/TextArea/TextArea.styles.js.map +1 -1
- package/cjs/components/TextField/TextField.js +1 -1
- package/cjs/components/TextField/TextField.js.map +1 -1
- package/cjs/components/TextField/TextField.styles.js +2 -2
- package/cjs/components/TextField/TextField.styles.js.map +1 -1
- package/emotion/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js +5 -1
- package/emotion/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js +5 -1
- package/emotion/cjs/components/Calendar/ui/CalendarQuarters/CalendarQuarters.js +5 -1
- package/emotion/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js +5 -1
- package/emotion/cjs/components/Combobox/ComboboxNew/Combobox.js +9 -5
- package/emotion/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +19 -5
- package/emotion/cjs/components/Select/utils/getButtonLabel.js +2 -2
- package/emotion/cjs/components/Select/utils/initialItemsTransform.js +6 -7
- package/emotion/cjs/components/TextArea/TextArea.js +2 -2
- package/emotion/cjs/components/TextArea/TextArea.styles.js +20 -20
- package/emotion/cjs/components/TextField/TextField.js +2 -2
- package/emotion/cjs/components/TextField/TextField.styles.js +24 -24
- package/emotion/es/components/Calendar/ui/CalendarDays/CalendarDays.js +5 -1
- package/emotion/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js +5 -1
- package/emotion/es/components/Calendar/ui/CalendarQuarters/CalendarQuarters.js +5 -1
- package/emotion/es/components/Calendar/ui/CalendarYears/CalendarYears.js +5 -1
- package/emotion/es/components/Combobox/ComboboxNew/Combobox.js +9 -5
- package/emotion/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +19 -5
- package/emotion/es/components/Select/utils/getButtonLabel.js +2 -2
- package/emotion/es/components/Select/utils/initialItemsTransform.js +6 -7
- package/emotion/es/components/TextArea/TextArea.js +2 -2
- package/emotion/es/components/TextArea/TextArea.styles.js +20 -20
- package/emotion/es/components/TextField/TextField.js +2 -2
- package/emotion/es/components/TextField/TextField.styles.js +24 -24
- package/es/components/Calendar/ui/CalendarDays/CalendarDays.js +5 -1
- package/es/components/Calendar/ui/CalendarDays/CalendarDays.js.map +1 -1
- package/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js +5 -1
- package/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js.map +1 -1
- package/es/components/Calendar/ui/CalendarQuarters/CalendarQuarters.js +5 -1
- package/es/components/Calendar/ui/CalendarQuarters/CalendarQuarters.js.map +1 -1
- package/es/components/Calendar/ui/CalendarYears/CalendarYears.js +5 -1
- package/es/components/Calendar/ui/CalendarYears/CalendarYears.js.map +1 -1
- package/es/components/Combobox/ComboboxNew/Combobox.js +9 -5
- package/es/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
- package/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +9 -5
- package/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js.map +1 -1
- package/es/components/Select/utils/getButtonLabel.js +2 -2
- package/es/components/Select/utils/getButtonLabel.js.map +1 -1
- package/es/components/Select/utils/initialItemsTransform.js +6 -7
- package/es/components/Select/utils/initialItemsTransform.js.map +1 -1
- package/es/components/TextArea/TextArea.js +1 -1
- package/es/components/TextArea/TextArea.js.map +1 -1
- package/es/components/TextArea/TextArea.styles.js +2 -2
- package/es/components/TextArea/TextArea.styles.js.map +1 -1
- package/es/components/TextField/TextField.js +1 -1
- package/es/components/TextField/TextField.js.map +1 -1
- package/es/components/TextField/TextField.styles.js +2 -2
- package/es/components/TextField/TextField.styles.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js +5 -1
- package/styled-components/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js +5 -1
- package/styled-components/cjs/components/Calendar/ui/CalendarQuarters/CalendarQuarters.js +5 -1
- package/styled-components/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js +5 -1
- package/styled-components/cjs/components/Combobox/ComboboxNew/Combobox.js +9 -5
- package/styled-components/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +19 -5
- package/styled-components/cjs/components/Select/utils/getButtonLabel.js +2 -2
- package/styled-components/cjs/components/Select/utils/initialItemsTransform.js +6 -7
- package/styled-components/cjs/components/TextArea/TextArea.js +1 -1
- package/styled-components/cjs/components/TextArea/TextArea.styles.js +2 -2
- package/styled-components/cjs/components/TextField/TextField.js +1 -1
- package/styled-components/cjs/components/TextField/TextField.styles.js +2 -2
- package/styled-components/es/components/Calendar/ui/CalendarDays/CalendarDays.js +5 -1
- package/styled-components/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js +5 -1
- package/styled-components/es/components/Calendar/ui/CalendarQuarters/CalendarQuarters.js +5 -1
- package/styled-components/es/components/Calendar/ui/CalendarYears/CalendarYears.js +5 -1
- package/styled-components/es/components/Combobox/ComboboxNew/Combobox.js +9 -5
- package/styled-components/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +19 -5
- package/styled-components/es/components/Select/utils/getButtonLabel.js +2 -2
- package/styled-components/es/components/Select/utils/initialItemsTransform.js +6 -7
- package/styled-components/es/components/TextArea/TextArea.js +1 -1
- package/styled-components/es/components/TextArea/TextArea.styles.js +2 -2
- package/styled-components/es/components/TextField/TextField.js +1 -1
- package/styled-components/es/components/TextField/TextField.styles.js +2 -2
- package/types/components/Calendar/ui/CalendarDays/CalendarDays.d.ts.map +1 -1
- package/types/components/Calendar/ui/CalendarMonths/CalendarMonths.d.ts.map +1 -1
- package/types/components/Calendar/ui/CalendarQuarters/CalendarQuarters.d.ts.map +1 -1
- package/types/components/Calendar/ui/CalendarYears/CalendarYears.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/Combobox.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/Combobox.types.d.ts +7 -2
- package/types/components/Combobox/ComboboxNew/Combobox.types.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/utils/initialItemsTransform.d.ts.map +1 -1
- package/types/components/DatePicker/SingleDate/SingleDate.types.d.ts +4 -0
- package/types/components/DatePicker/SingleDate/SingleDate.types.d.ts.map +1 -1
- package/types/components/Select/utils/initialItemsTransform.d.ts.map +1 -1
- package/types/components/TextArea/TextArea.styles.d.ts +1 -1
- package/types/components/TextArea/TextArea.styles.d.ts.map +1 -1
- package/types/components/TextField/TextField.styles.d.ts +1 -1
- package/types/components/TextField/TextField.styles.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Combobox/Combobox.d.ts +12 -0
- package/types/examples/plasma_b2c/components/Combobox/Combobox.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Combobox/Combobox.d.ts +12 -0
- package/types/examples/plasma_web/components/Combobox/Combobox.d.ts.map +1 -1
@@ -82,6 +82,9 @@ var CalendarDays = function CalendarDays(_ref) {
|
|
82
82
|
}
|
83
83
|
onHoverDay === null || onHoverDay === void 0 || onHoverDay(selectedDate);
|
84
84
|
}, [getSelectedDate, onHoverDay, value]);
|
85
|
+
var handleMouseOutGrid = function handleMouseOutGrid() {
|
86
|
+
return onHoverDay === null || onHoverDay === void 0 ? void 0 : onHoverDay(undefined);
|
87
|
+
};
|
85
88
|
var getRefs = function getRefs(element, isDayInCurrentMonth, i, j) {
|
86
89
|
if (isDayInCurrentMonth) {
|
87
90
|
outerRefs.current[i + offset][j] = element;
|
@@ -96,7 +99,8 @@ var CalendarDays = function CalendarDays(_ref) {
|
|
96
99
|
return /*#__PURE__*/React.createElement(StyledCalendarDays, {
|
97
100
|
role: "grid",
|
98
101
|
"aria-labelledby": "id-grid-label",
|
99
|
-
onKeyDown: onKeyDown
|
102
|
+
onKeyDown: onKeyDown,
|
103
|
+
onMouseLeave: handleMouseOutGrid
|
100
104
|
}, _StyledCalendarDaysHi || (_StyledCalendarDaysHi = /*#__PURE__*/React.createElement(StyledCalendarDaysHint, {
|
101
105
|
id: "withShift"
|
102
106
|
}, "\u0414\u043B\u044F \u043D\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u0442\u043E\u043B\u044C\u043A\u043E \u043F\u043E \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u043C \u0434\u0430\u0442\u0430\u043C \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0439\u0442\u0435 \u043A\u043B\u0430\u0432\u0438\u0448\u0443 Shift.")), /*#__PURE__*/React.createElement(StyledFlex, {
|
@@ -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 { DateStructureItem } from '../DateStructureItem/DateStructureItem';\nimport { DateItem } from '../../Calendar.types';\nimport { innerTokens, tokens } from '../../Calendar.tokens';\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 locale = 'ru',\n}) => {\n const [days, selected] = useDays({ date: 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 dayItemTokens = {\n [`${innerTokens.dateStructureFontFamily}`]: `var(${tokens.calendarDayFontFamily})`,\n [`${innerTokens.dateStructureFontSize}`]: `var(${tokens.calendarDayFontSize})`,\n [`${innerTokens.dateStructureFontWeight}`]: `var(${tokens.calendarDayFontWeight})`,\n [`${innerTokens.dateStructureFontLineHeight}`]: `var(${tokens.calendarDayFontLineHeight})`,\n [`${innerTokens.dateStructureFontLetterSpacing}`]: `var(${tokens.calendarDayFontLetterSpacing})`,\n [`${innerTokens.dateStructureFontStyle}`]: `var(${tokens.calendarDayFontStyle})`,\n [`${innerTokens.dateStructureSelectedFontWeight}`]: `var(${tokens.calendarDaySelectedFontWeight})`,\n [`${innerTokens.dateStructureWidth}`]: `var(${tokens.calendarDayItemWidth})`,\n [`${innerTokens.dateStructureHeight}`]: `var(${tokens.calendarDayItemHeight})`,\n [`${innerTokens.dateStructureBorderRadius}`]: `var(${tokens.calendarDayItemBorderRadius})`,\n };\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 getRefs = (element: HTMLDivElement, isDayInCurrentMonth: boolean, i: number, j: number) => {\n if (isDayInCurrentMonth) {\n outerRefs.current[i + offset][j] = element;\n }\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[locale].map((name) => (\n <DateStructureItem\n role=\"columnheader\"\n aria-label={FULL_DAY_NAMES[locale][name]}\n key={name}\n dayOfWeek\n day={name}\n style={dayItemTokens}\n >\n {name}\n </DateStructureItem>\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 disabledDates,\n },\n j,\n ) => (\n <DateStructureItem\n ref={(element: HTMLDivElement) => getRefs(element, Boolean(isDayInCurrentMonth), i, j)}\n style={dayItemTokens}\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 key={`StyledDay-${i}-${j}`}\n role=\"gridcell\"\n disabledArrowKey={disabledArrowKey}\n disabledMonths={disabledDates}\n >\n {date.day}\n </DateStructureItem>\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","_ref$locale","locale","_useDays","useDays","_useDays2","_slicedToArray","days","selected","selectedRef","useRef","onSetSelectedRef","offset","ROW_STEP","dayItemTokens","_defineProperty","concat","innerTokens","dateStructureFontFamily","tokens","calendarDayFontFamily","dateStructureFontSize","calendarDayFontSize","dateStructureFontWeight","calendarDayFontWeight","dateStructureFontLineHeight","calendarDayFontLineHeight","dateStructureFontLetterSpacing","calendarDayFontLetterSpacing","dateStructureFontStyle","calendarDayFontStyle","dateStructureSelectedFontWeight","calendarDaySelectedFontWeight","dateStructureWidth","calendarDayItemWidth","dateStructureHeight","calendarDayItemHeight","dateStructureBorderRadius","calendarDayItemBorderRadius","getSelectedDate","useCallback","event","_event$currentTarget$","currentTarget","dataset","day","monthIndex","year","selectedDate","Number","canSelectDate","handleOnChangeDay","i","j","isSelectProcess","undefined","handleOnHoverDay","isSelectedDone","Array","isArray","getRefs","element","isDayInCurrentMonth","current","useEffect","_onSetSelectedRef$cur","call","React","createElement","StyledCalendarDays","role","_StyledCalendarDaysHi","StyledCalendarDaysHint","id","StyledFlex","SHORT_DAY_NAMES","map","name","DateStructureItem","FULL_DAY_NAMES","key","dayOfWeek","style","_ref2","events","disabled","isSelected","isCurrent","inRange","_ref2$isOutOfMinMaxRa","isOutOfMinMaxRange","disabledArrowKey","disabledDates","ref","Boolean","isFocused","isHovered","isSameDay","getInRange","sideInRange","getSideInRange","onClick","onMouseOver","disabledMonths"],"mappings":";;;;;;;;;;;AAoBA;AACA;AACA;IACaA,YAAyC,GAAG,SAA5CA,YAAyCA,CAAAC,IAAA,EAkBhD;AAAA,EAAA,IAjBIC,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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AAS,CAAChH,IAAI,EAAEO,UAAU,CAAE;QACvCgG,OAAO,EAAEU,UAAU,CAAChH,KAAK,EAAED,IAAI,EAAEO,UAAU,EAAEgG,OAAO,CAAE;QACtDW,WAAW,EAAEC,cAAc,CAAClH,KAAK,EAAED,IAAI,EAAEO,UAAU,EAAE8F,UAAU,CAAE;QACjEe,OAAO,EAAEhB,QAAQ,GAAG9B,SAAS,GAAGJ,iBAAiB,CAACC,CAAC,EAAEC,CAAC,CAAE;AACxDiD,QAAAA,WAAW,EAAEjB,QAAQ,GAAG9B,SAAS,GAAGC,gBAAiB;QACrDwB,GAAG,EAAA,YAAA,CAAAhE,MAAA,CAAeoC,CAAC,OAAApC,MAAA,CAAIqC,CAAC,CAAG;AAC3BiB,QAAAA,IAAI,EAAC,UAAU;AACfqB,QAAAA,gBAAgB,EAAEA,gBAAiB;AACnCY,QAAAA,cAAc,EAAEX,aAAAA;OAEf3G,EAAAA,IAAI,CAAC4D,GACS,CAAC,CAAA;AAAA,KAE5B,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 { DateStructureItem } from '../DateStructureItem/DateStructureItem';\nimport { DateItem } from '../../Calendar.types';\nimport { innerTokens, tokens } from '../../Calendar.tokens';\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 locale = 'ru',\n}) => {\n const [days, selected] = useDays({ date: 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 dayItemTokens = {\n [`${innerTokens.dateStructureFontFamily}`]: `var(${tokens.calendarDayFontFamily})`,\n [`${innerTokens.dateStructureFontSize}`]: `var(${tokens.calendarDayFontSize})`,\n [`${innerTokens.dateStructureFontWeight}`]: `var(${tokens.calendarDayFontWeight})`,\n [`${innerTokens.dateStructureFontLineHeight}`]: `var(${tokens.calendarDayFontLineHeight})`,\n [`${innerTokens.dateStructureFontLetterSpacing}`]: `var(${tokens.calendarDayFontLetterSpacing})`,\n [`${innerTokens.dateStructureFontStyle}`]: `var(${tokens.calendarDayFontStyle})`,\n [`${innerTokens.dateStructureSelectedFontWeight}`]: `var(${tokens.calendarDaySelectedFontWeight})`,\n [`${innerTokens.dateStructureWidth}`]: `var(${tokens.calendarDayItemWidth})`,\n [`${innerTokens.dateStructureHeight}`]: `var(${tokens.calendarDayItemHeight})`,\n [`${innerTokens.dateStructureBorderRadius}`]: `var(${tokens.calendarDayItemBorderRadius})`,\n };\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 handleMouseOutGrid = () => onHoverDay?.(undefined);\n\n const getRefs = (element: HTMLDivElement, isDayInCurrentMonth: boolean, i: number, j: number) => {\n if (isDayInCurrentMonth) {\n outerRefs.current[i + offset][j] = element;\n }\n };\n\n useEffect(() => {\n if (selectedRef.current) {\n onSetSelectedRef.current?.(selectedRef.current);\n }\n }, []);\n\n return (\n <StyledCalendarDays\n role=\"grid\"\n aria-labelledby=\"id-grid-label\"\n onKeyDown={onKeyDown}\n onMouseLeave={handleMouseOutGrid}\n >\n <StyledCalendarDaysHint id=\"withShift\">\n Для навигации только по доступным датам удерживайте клавишу Shift.\n </StyledCalendarDaysHint>\n <StyledFlex role=\"row\">\n {SHORT_DAY_NAMES[locale].map((name) => (\n <DateStructureItem\n role=\"columnheader\"\n aria-label={FULL_DAY_NAMES[locale][name]}\n key={name}\n dayOfWeek\n day={name}\n style={dayItemTokens}\n >\n {name}\n </DateStructureItem>\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 disabledDates,\n },\n j,\n ) => (\n <DateStructureItem\n ref={(element: HTMLDivElement) => getRefs(element, Boolean(isDayInCurrentMonth), i, j)}\n style={dayItemTokens}\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 key={`StyledDay-${i}-${j}`}\n role=\"gridcell\"\n disabledArrowKey={disabledArrowKey}\n disabledMonths={disabledDates}\n >\n {date.day}\n </DateStructureItem>\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","_ref$locale","locale","_useDays","useDays","_useDays2","_slicedToArray","days","selected","selectedRef","useRef","onSetSelectedRef","offset","ROW_STEP","dayItemTokens","_defineProperty","concat","innerTokens","dateStructureFontFamily","tokens","calendarDayFontFamily","dateStructureFontSize","calendarDayFontSize","dateStructureFontWeight","calendarDayFontWeight","dateStructureFontLineHeight","calendarDayFontLineHeight","dateStructureFontLetterSpacing","calendarDayFontLetterSpacing","dateStructureFontStyle","calendarDayFontStyle","dateStructureSelectedFontWeight","calendarDaySelectedFontWeight","dateStructureWidth","calendarDayItemWidth","dateStructureHeight","calendarDayItemHeight","dateStructureBorderRadius","calendarDayItemBorderRadius","getSelectedDate","useCallback","event","_event$currentTarget$","currentTarget","dataset","day","monthIndex","year","selectedDate","Number","canSelectDate","handleOnChangeDay","i","j","isSelectProcess","undefined","handleOnHoverDay","isSelectedDone","Array","isArray","handleMouseOutGrid","getRefs","element","isDayInCurrentMonth","current","useEffect","_onSetSelectedRef$cur","call","React","createElement","StyledCalendarDays","role","onMouseLeave","_StyledCalendarDaysHi","StyledCalendarDaysHint","id","StyledFlex","SHORT_DAY_NAMES","map","name","DateStructureItem","FULL_DAY_NAMES","key","dayOfWeek","style","_ref2","events","disabled","isSelected","isCurrent","inRange","_ref2$isOutOfMinMaxRa","isOutOfMinMaxRange","disabledArrowKey","disabledDates","ref","Boolean","isFocused","isHovered","isSameDay","getInRange","sideInRange","getSideInRange","onClick","onMouseOver","disabledMonths"],"mappings":";;;;;;;;;;;AAoBA;AACA;AACA;IACaA,YAAyC,GAAG,SAA5CA,YAAyCA,CAAAC,IAAA,EAkBhD;AAAA,EAAA,IAjBIC,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;IAAAC,WAAA,GAAAlB,IAAA,CACTmB,MAAM;AAANA,IAAAA,MAAM,GAAAD,WAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,WAAA,CAAA;EAEb,IAAAE,QAAA,GAAyBC,OAAO,CAAC;AAAEnB,MAAAA,IAAI,EAAED,WAAW;AAAEE,MAAAA,KAAK,EAALA,KAAK;AAAEC,MAAAA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QACtDW,WAAW,EAAEC,cAAc,CAACpH,KAAK,EAAED,IAAI,EAAEO,UAAU,EAAEgG,UAAU,CAAE;QACjEe,OAAO,EAAEhB,QAAQ,GAAGhC,SAAS,GAAGJ,iBAAiB,CAACC,CAAC,EAAEC,CAAC,CAAE;AACxDmD,QAAAA,WAAW,EAAEjB,QAAQ,GAAGhC,SAAS,GAAGC,gBAAiB;QACrD0B,GAAG,EAAA,YAAA,CAAAlE,MAAA,CAAeoC,CAAC,OAAApC,MAAA,CAAIqC,CAAC,CAAG;AAC3BkB,QAAAA,IAAI,EAAC,UAAU;AACfsB,QAAAA,gBAAgB,EAAEA,gBAAiB;AACnCY,QAAAA,cAAc,EAAEX,aAAAA;OAEf7G,EAAAA,IAAI,CAAC4D,GACS,CAAC,CAAA;AAAA,KAE5B,CACQ,CAAC,CAAA;AAAA,GAChB,CACe,CAAC,CAAA;AAE7B;;;;"}
|
@@ -85,6 +85,9 @@ var CalendarMonths = function CalendarMonths(_ref) {
|
|
85
85
|
}
|
86
86
|
onHoverMonth === null || onHoverMonth === void 0 || onHoverMonth(selectedDate);
|
87
87
|
}, [getSelectedDate, onHoverMonth, value]);
|
88
|
+
var handleMouseOutGrid = function handleMouseOutGrid() {
|
89
|
+
return onHoverMonth === null || onHoverMonth === void 0 ? void 0 : onHoverMonth(undefined);
|
90
|
+
};
|
88
91
|
var getRefs = useCallback(function (element, i, j) {
|
89
92
|
outerRefs.current[i + offset][j] = element;
|
90
93
|
}, [offset, outerRefs]);
|
@@ -97,7 +100,8 @@ var CalendarMonths = function CalendarMonths(_ref) {
|
|
97
100
|
return /*#__PURE__*/React.createElement(StyledCalendarMonths, {
|
98
101
|
role: "grid",
|
99
102
|
"aria-labelledby": "id-grid-label",
|
100
|
-
onKeyDown: onKeyDown
|
103
|
+
onKeyDown: onKeyDown,
|
104
|
+
onMouseLeave: handleMouseOutGrid
|
101
105
|
}, months.map(function (month, i) {
|
102
106
|
return /*#__PURE__*/React.createElement(StyledFlex, {
|
103
107
|
role: "row",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CalendarMonths.js","sources":["../../../../../src/components/Calendar/ui/CalendarMonths/CalendarMonths.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef } from 'react';\n\nimport { useMonths } from '../../hooks';\nimport { innerTokens, tokens } from '../../Calendar.tokens';\nimport { ROW_MONTH_STEP, canSelectDate, getInRange, getSideInRange, isSameDay, isSelectProcess } from '../../utils';\nimport { DateStructureItem } from '../DateStructureItem/DateStructureItem';\n\nimport type { CalendarMonthsProps } from './CalendarMonths.types';\nimport { StyledCalendarMonths, StyledFlex } from './CalendarMonths.styles';\n\n/**\n * Компонент месяцев в календаре.\n */\nexport const CalendarMonths: React.FC<CalendarMonthsProps> = ({\n date: currentDate,\n value,\n selectIndexes,\n eventList,\n disabledList,\n min,\n max,\n outerRefs,\n isDouble,\n isSecond,\n hoveredMonth,\n onChangeMonth,\n onHoverMonth,\n onSetSelected,\n onKeyDown,\n locale,\n}) => {\n const [months, selected] = useMonths({ date: currentDate, value, eventList, disabledList, min, max, locale });\n const selectedRef = useRef(selected);\n const onSetSelectedRef = useRef(onSetSelected);\n\n const offset = isSecond ? ROW_MONTH_STEP : 0;\n\n const monthItemTokens = {\n [`${innerTokens.dateStructureFontFamily}`]: `var(${tokens.calendarMonthFontFamily})`,\n [`${innerTokens.dateStructureFontSize}`]: `var(${tokens.calendarMonthFontSize})`,\n [`${innerTokens.dateStructureFontWeight}`]: `var(${tokens.calendarMonthFontWeight})`,\n [`${innerTokens.dateStructureFontLineHeight}`]: `var(${tokens.calendarMonthFontLineHeight})`,\n [`${innerTokens.dateStructureFontLetterSpacing}`]: `var(${tokens.calendarMonthFontLetterSpacing})`,\n [`${innerTokens.dateStructureFontStyle}`]: `var(${tokens.calendarMonthFontStyle})`,\n [`${innerTokens.dateStructureSelectedFontWeight}`]: `var(${tokens.calendarMonthSelectedFontWeight})`,\n [`${innerTokens.dateStructureWidth}`]: `var(${tokens.calendarMonthItemWidth})`,\n [`${innerTokens.dateStructureHeight}`]: `var(${tokens.calendarMonthItemHeight})`,\n [`${innerTokens.dateStructureBorderRadius}`]: `var(${tokens.calendarMonthItemBorderRadius})`,\n };\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 handleOnChangeMonth = useCallback(\n (i: number, j: number) => (event: React.MouseEvent<HTMLDivElement>) => {\n /**\n * нужно вызвать stopImmediatePropagation для случаев, когда\n * обработчик события onClick навешивается снаружи.\n * Как, например, в компоненте Popup\n */\n event.nativeEvent.stopImmediatePropagation();\n\n const selectedDate = getSelectedDate(event);\n\n if (!selectedDate) {\n return;\n }\n\n onChangeMonth(selectedDate, [i + offset, j]);\n\n if (isSelectProcess(value)) {\n onHoverMonth?.(undefined);\n }\n },\n [getSelectedDate, onChangeMonth, offset, value, onHoverMonth],\n );\n\n const handleOnHoverMonth = 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 onHoverMonth?.(selectedDate);\n },\n [getSelectedDate, onHoverMonth, value],\n );\n\n const getRefs = useCallback(\n (element: HTMLDivElement, i: number, j: number) => {\n outerRefs.current[i + offset][j] = element;\n },\n [offset, outerRefs],\n );\n\n useEffect(() => {\n if (selectedRef.current) {\n onSetSelectedRef.current?.(selectedRef.current);\n }\n }, []);\n\n return (\n <StyledCalendarMonths role=\"grid\" aria-labelledby=\"id-grid-label\" onKeyDown={onKeyDown}>\n {months.map((month, i) => (\n <StyledFlex role=\"row\" key={i}>\n {month.map(\n (\n {\n monthName,\n monthIndex,\n isSelected,\n isCurrent,\n monthFullName,\n date,\n events,\n isOutOfMinMaxRange,\n inRange,\n disabled,\n disabledArrowKey,\n disabledDates,\n },\n j,\n ) => {\n return (\n <DateStructureItem\n ref={(element: HTMLDivElement) => getRefs(element, i, j)}\n style={monthItemTokens}\n eventList={events}\n disabled={disabled}\n day={date.day}\n year={date.year}\n monthIndex={monthIndex}\n isFocused={\n i + offset === selectIndexes?.[0] &&\n j === selectIndexes?.[1] &&\n !isOutOfMinMaxRange\n }\n isSelected={isSelected}\n isCurrent={isCurrent}\n isDouble={isDouble}\n isHovered={isSameDay(date, hoveredMonth)}\n inRange={getInRange(value, date, hoveredMonth, inRange)}\n sideInRange={getSideInRange(value, date, hoveredMonth, isSelected)}\n onClick={disabled ? undefined : handleOnChangeMonth(i, j)}\n onMouseOver={disabled ? undefined : handleOnHoverMonth}\n key={`StyledMonth-${i}-${j}`}\n role=\"gridcell\"\n aria-label={monthFullName}\n disabledArrowKey={disabledArrowKey}\n disabledMonths={disabledDates}\n isDayInCurrentMonth\n >\n {monthName}\n </DateStructureItem>\n );\n },\n )}\n </StyledFlex>\n ))}\n </StyledCalendarMonths>\n );\n};\n"],"names":["CalendarMonths","_ref","currentDate","date","value","selectIndexes","eventList","disabledList","min","max","outerRefs","isDouble","isSecond","hoveredMonth","onChangeMonth","onHoverMonth","onSetSelected","onKeyDown","locale","_useMonths","useMonths","_useMonths2","_slicedToArray","months","selected","selectedRef","useRef","onSetSelectedRef","offset","ROW_MONTH_STEP","monthItemTokens","_defineProperty","concat","innerTokens","dateStructureFontFamily","tokens","calendarMonthFontFamily","dateStructureFontSize","calendarMonthFontSize","dateStructureFontWeight","calendarMonthFontWeight","dateStructureFontLineHeight","calendarMonthFontLineHeight","dateStructureFontLetterSpacing","calendarMonthFontLetterSpacing","dateStructureFontStyle","calendarMonthFontStyle","dateStructureSelectedFontWeight","calendarMonthSelectedFontWeight","dateStructureWidth","calendarMonthItemWidth","dateStructureHeight","calendarMonthItemHeight","dateStructureBorderRadius","calendarMonthItemBorderRadius","getSelectedDate","useCallback","event","_event$currentTarget$","currentTarget","dataset","day","monthIndex","year","selectedDate","Number","canSelectDate","handleOnChangeMonth","i","j","nativeEvent","stopImmediatePropagation","isSelectProcess","undefined","handleOnHoverMonth","isSelectedDone","Array","isArray","getRefs","element","current","useEffect","_onSetSelectedRef$cur","call","React","createElement","StyledCalendarMonths","role","map","month","StyledFlex","key","_ref2","monthName","isSelected","isCurrent","monthFullName","events","isOutOfMinMaxRange","inRange","disabled","disabledArrowKey","disabledDates","DateStructureItem","ref","style","isFocused","isHovered","isSameDay","getInRange","sideInRange","getSideInRange","onClick","onMouseOver","disabledMonths","isDayInCurrentMonth"],"mappings":";;;;;;;;;;AAUA;AACA;AACA;IACaA,cAA6C,GAAG,SAAhDA,cAA6CA,CAAAC,IAAA,EAiBpD;AAAA,EAAA,IAhBIC,WAAW,GAAAD,IAAA,CAAjBE,IAAI;IACJC,KAAK,GAAAH,IAAA,CAALG,KAAK;IACLC,aAAa,GAAAJ,IAAA,CAAbI,aAAa;IACbC,SAAS,GAAAL,IAAA,CAATK,SAAS;IACTC,YAAY,GAAAN,IAAA,CAAZM,YAAY;IACZC,GAAG,GAAAP,IAAA,CAAHO,GAAG;IACHC,GAAG,GAAAR,IAAA,CAAHQ,GAAG;IACHC,SAAS,GAAAT,IAAA,CAATS,SAAS;IACTC,QAAQ,GAAAV,IAAA,CAARU,QAAQ;IACRC,QAAQ,GAAAX,IAAA,CAARW,QAAQ;IACRC,YAAY,GAAAZ,IAAA,CAAZY,YAAY;IACZC,aAAa,GAAAb,IAAA,CAAba,aAAa;IACbC,YAAY,GAAAd,IAAA,CAAZc,YAAY;IACZC,aAAa,GAAAf,IAAA,CAAbe,aAAa;IACbC,SAAS,GAAAhB,IAAA,CAATgB,SAAS;IACTC,MAAM,GAAAjB,IAAA,CAANiB,MAAM,CAAA;EAEN,IAAAC,UAAA,GAA2BC,SAAS,CAAC;AAAEjB,MAAAA,IAAI,EAA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KhE,aAAa,KAAA,IAAA,IAAbA,aAAa,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAbA,aAAa,CAAG,CAAC,CAAC,CACxB,IAAA,CAAC6F,kBACJ;AACDJ,QAAAA,UAAU,EAAEA,UAAW;AACvBC,QAAAA,SAAS,EAAEA,SAAU;AACrBpF,QAAAA,QAAQ,EAAEA,QAAS;AACnBgG,QAAAA,SAAS,EAAEC,SAAS,CAACzG,IAAI,EAAEU,YAAY,CAAE;QACzCsF,OAAO,EAAEU,UAAU,CAACzG,KAAK,EAAED,IAAI,EAAEU,YAAY,EAAEsF,OAAO,CAAE;QACxDW,WAAW,EAAEC,cAAc,CAAC3G,KAAK,EAAED,IAAI,EAAEU,YAAY,EAAEiF,UAAU,CAAE;QACnEkB,OAAO,EAAEZ,QAAQ,GAAG3B,SAAS,GAAGN,mBAAmB,CAACC,CAAC,EAAEC,CAAC,CAAE;AAC1D4C,QAAAA,WAAW,EAAEb,QAAQ,GAAG3B,SAAS,GAAGC,kBAAmB;QACvDiB,GAAG,EAAA,cAAA,CAAA3D,MAAA,CAAiBoC,CAAC,OAAApC,MAAA,CAAIqC,CAAC,CAAG;AAC7BkB,QAAAA,IAAI,EAAC,UAAU;AACf,QAAA,YAAA,EAAYS,aAAc;AAC1BK,QAAAA,gBAAgB,EAAEA,gBAAiB;AACnCa,QAAAA,cAAc,EAAEZ,aAAc;QAC9Ba,mBAAmB,EAAA,IAAA;AAAA,OAAA,EAElBtB,SACc,CAAC,CAAA;AAE5B,KACJ,CACQ,CAAC,CAAA;AAAA,GAChB,CACiB,CAAC,CAAA;AAE/B;;;;"}
|
1
|
+
{"version":3,"file":"CalendarMonths.js","sources":["../../../../../src/components/Calendar/ui/CalendarMonths/CalendarMonths.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef } from 'react';\n\nimport { useMonths } from '../../hooks';\nimport { innerTokens, tokens } from '../../Calendar.tokens';\nimport { ROW_MONTH_STEP, canSelectDate, getInRange, getSideInRange, isSameDay, isSelectProcess } from '../../utils';\nimport { DateStructureItem } from '../DateStructureItem/DateStructureItem';\n\nimport type { CalendarMonthsProps } from './CalendarMonths.types';\nimport { StyledCalendarMonths, StyledFlex } from './CalendarMonths.styles';\n\n/**\n * Компонент месяцев в календаре.\n */\nexport const CalendarMonths: React.FC<CalendarMonthsProps> = ({\n date: currentDate,\n value,\n selectIndexes,\n eventList,\n disabledList,\n min,\n max,\n outerRefs,\n isDouble,\n isSecond,\n hoveredMonth,\n onChangeMonth,\n onHoverMonth,\n onSetSelected,\n onKeyDown,\n locale,\n}) => {\n const [months, selected] = useMonths({ date: currentDate, value, eventList, disabledList, min, max, locale });\n const selectedRef = useRef(selected);\n const onSetSelectedRef = useRef(onSetSelected);\n\n const offset = isSecond ? ROW_MONTH_STEP : 0;\n\n const monthItemTokens = {\n [`${innerTokens.dateStructureFontFamily}`]: `var(${tokens.calendarMonthFontFamily})`,\n [`${innerTokens.dateStructureFontSize}`]: `var(${tokens.calendarMonthFontSize})`,\n [`${innerTokens.dateStructureFontWeight}`]: `var(${tokens.calendarMonthFontWeight})`,\n [`${innerTokens.dateStructureFontLineHeight}`]: `var(${tokens.calendarMonthFontLineHeight})`,\n [`${innerTokens.dateStructureFontLetterSpacing}`]: `var(${tokens.calendarMonthFontLetterSpacing})`,\n [`${innerTokens.dateStructureFontStyle}`]: `var(${tokens.calendarMonthFontStyle})`,\n [`${innerTokens.dateStructureSelectedFontWeight}`]: `var(${tokens.calendarMonthSelectedFontWeight})`,\n [`${innerTokens.dateStructureWidth}`]: `var(${tokens.calendarMonthItemWidth})`,\n [`${innerTokens.dateStructureHeight}`]: `var(${tokens.calendarMonthItemHeight})`,\n [`${innerTokens.dateStructureBorderRadius}`]: `var(${tokens.calendarMonthItemBorderRadius})`,\n };\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 handleOnChangeMonth = useCallback(\n (i: number, j: number) => (event: React.MouseEvent<HTMLDivElement>) => {\n /**\n * нужно вызвать stopImmediatePropagation для случаев, когда\n * обработчик события onClick навешивается снаружи.\n * Как, например, в компоненте Popup\n */\n event.nativeEvent.stopImmediatePropagation();\n\n const selectedDate = getSelectedDate(event);\n\n if (!selectedDate) {\n return;\n }\n\n onChangeMonth(selectedDate, [i + offset, j]);\n\n if (isSelectProcess(value)) {\n onHoverMonth?.(undefined);\n }\n },\n [getSelectedDate, onChangeMonth, offset, value, onHoverMonth],\n );\n\n const handleOnHoverMonth = 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 onHoverMonth?.(selectedDate);\n },\n [getSelectedDate, onHoverMonth, value],\n );\n\n const handleMouseOutGrid = () => onHoverMonth?.(undefined);\n\n const getRefs = useCallback(\n (element: HTMLDivElement, i: number, j: number) => {\n outerRefs.current[i + offset][j] = element;\n },\n [offset, outerRefs],\n );\n\n useEffect(() => {\n if (selectedRef.current) {\n onSetSelectedRef.current?.(selectedRef.current);\n }\n }, []);\n\n return (\n <StyledCalendarMonths\n role=\"grid\"\n aria-labelledby=\"id-grid-label\"\n onKeyDown={onKeyDown}\n onMouseLeave={handleMouseOutGrid}\n >\n {months.map((month, i) => (\n <StyledFlex role=\"row\" key={i}>\n {month.map(\n (\n {\n monthName,\n monthIndex,\n isSelected,\n isCurrent,\n monthFullName,\n date,\n events,\n isOutOfMinMaxRange,\n inRange,\n disabled,\n disabledArrowKey,\n disabledDates,\n },\n j,\n ) => {\n return (\n <DateStructureItem\n ref={(element: HTMLDivElement) => getRefs(element, i, j)}\n style={monthItemTokens}\n eventList={events}\n disabled={disabled}\n day={date.day}\n year={date.year}\n monthIndex={monthIndex}\n isFocused={\n i + offset === selectIndexes?.[0] &&\n j === selectIndexes?.[1] &&\n !isOutOfMinMaxRange\n }\n isSelected={isSelected}\n isCurrent={isCurrent}\n isDouble={isDouble}\n isHovered={isSameDay(date, hoveredMonth)}\n inRange={getInRange(value, date, hoveredMonth, inRange)}\n sideInRange={getSideInRange(value, date, hoveredMonth, isSelected)}\n onClick={disabled ? undefined : handleOnChangeMonth(i, j)}\n onMouseOver={disabled ? undefined : handleOnHoverMonth}\n key={`StyledMonth-${i}-${j}`}\n role=\"gridcell\"\n aria-label={monthFullName}\n disabledArrowKey={disabledArrowKey}\n disabledMonths={disabledDates}\n isDayInCurrentMonth\n >\n {monthName}\n </DateStructureItem>\n );\n },\n )}\n </StyledFlex>\n ))}\n </StyledCalendarMonths>\n );\n};\n"],"names":["CalendarMonths","_ref","currentDate","date","value","selectIndexes","eventList","disabledList","min","max","outerRefs","isDouble","isSecond","hoveredMonth","onChangeMonth","onHoverMonth","onSetSelected","onKeyDown","locale","_useMonths","useMonths","_useMonths2","_slicedToArray","months","selected","selectedRef","useRef","onSetSelectedRef","offset","ROW_MONTH_STEP","monthItemTokens","_defineProperty","concat","innerTokens","dateStructureFontFamily","tokens","calendarMonthFontFamily","dateStructureFontSize","calendarMonthFontSize","dateStructureFontWeight","calendarMonthFontWeight","dateStructureFontLineHeight","calendarMonthFontLineHeight","dateStructureFontLetterSpacing","calendarMonthFontLetterSpacing","dateStructureFontStyle","calendarMonthFontStyle","dateStructureSelectedFontWeight","calendarMonthSelectedFontWeight","dateStructureWidth","calendarMonthItemWidth","dateStructureHeight","calendarMonthItemHeight","dateStructureBorderRadius","calendarMonthItemBorderRadius","getSelectedDate","useCallback","event","_event$currentTarget$","currentTarget","dataset","day","monthIndex","year","selectedDate","Number","canSelectDate","handleOnChangeMonth","i","j","nativeEvent","stopImmediatePropagation","isSelectProcess","undefined","handleOnHoverMonth","isSelectedDone","Array","isArray","handleMouseOutGrid","getRefs","element","current","useEffect","_onSetSelectedRef$cur","call","React","createElement","StyledCalendarMonths","role","onMouseLeave","map","month","StyledFlex","key","_ref2","monthName","isSelected","isCurrent","monthFullName","events","isOutOfMinMaxRange","inRange","disabled","disabledArrowKey","disabledDates","DateStructureItem","ref","style","isFocused","isHovered","isSameDay","getInRange","sideInRange","getSideInRange","onClick","onMouseOver","disabledMonths","isDayInCurrentMonth"],"mappings":";;;;;;;;;;AAUA;AACA;AACA;IACaA,cAA6C,GAAG,SAAhDA,cAA6CA,CAAAC,IAAA,EAiBpD;AAAA,EAAA,IAhBIC,WAAW,GAAAD,IAAA,CAAjBE,IAAI;IACJC,KAAK,GAAAH,IAAA,CAALG,KAAK;IACLC,aAAa,GAAAJ,IAAA,CAAbI,aAAa;IACbC,SAAS,GAAAL,IAAA,CAATK,SAAS;IACTC,YAAY,GAAAN,IAAA,CAAZM,YAAY;IACZC,GAAG,GAAAP,IAAA,CAAHO,GAAG;IACHC,GAAG,GAAAR,IAAA,CAAHQ,GAAG;IACHC,SAAS,GAAAT,IAAA,CAATS,SAAS;IACTC,QAAQ,GAAAV,IAAA,CAARU,QAAQ;IACRC,QAAQ,GAAAX,IAAA,CAARW,QAAQ;IACRC,YAAY,GAAAZ,IAAA,CAAZY,YAAY;IACZC,aAAa,GAAAb,IAAA,CAAba,aAAa;IACbC,YAAY,GAAAd,IAAA,CAAZc,YAAY;IACZC,aAAa,GAAAf,IAAA,CAAbe,aAAa;IACbC,SAAS,GAAAhB,IAAA,CAATgB,SAAS;IACTC,MAAM,GAAAjB,IAAA,CAANiB,MAAM,CAAA;EAEN,IAAAC,UAAA,GAA2BC,SAAS,CAAC;AAAEjB,MAAAA,IAAI,EAAED,WAAW;AAAEE,MAAAA,KAAK,EAALA,KAAK;AAAEE,MAAAA,SAAS,EAATA,SAAS;AAAEC,MAAAA,YAAY,EAAZA,YAAY;AAAEC,MAAAA,GAAG,EAAHA,GAAG;AAAEC,MAAAA,GAAG,EA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AA,GAAbA,aAAa,CAAG,CAAC,CAAC,KACjCgE,CAAC,MAAKhE,aAAa,KAAA,IAAA,IAAbA,aAAa,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAbA,aAAa,CAAG,CAAC,CAAC,CACxB,IAAA,CAAC+F,kBACJ;AACDJ,QAAAA,UAAU,EAAEA,UAAW;AACvBC,QAAAA,SAAS,EAAEA,SAAU;AACrBtF,QAAAA,QAAQ,EAAEA,QAAS;AACnBkG,QAAAA,SAAS,EAAEC,SAAS,CAAC3G,IAAI,EAAEU,YAAY,CAAE;QACzCwF,OAAO,EAAEU,UAAU,CAAC3G,KAAK,EAAED,IAAI,EAAEU,YAAY,EAAEwF,OAAO,CAAE;QACxDW,WAAW,EAAEC,cAAc,CAAC7G,KAAK,EAAED,IAAI,EAAEU,YAAY,EAAEmF,UAAU,CAAE;QACnEkB,OAAO,EAAEZ,QAAQ,GAAG7B,SAAS,GAAGN,mBAAmB,CAACC,CAAC,EAAEC,CAAC,CAAE;AAC1D8C,QAAAA,WAAW,EAAEb,QAAQ,GAAG7B,SAAS,GAAGC,kBAAmB;QACvDmB,GAAG,EAAA,cAAA,CAAA7D,MAAA,CAAiBoC,CAAC,OAAApC,MAAA,CAAIqC,CAAC,CAAG;AAC7BmB,QAAAA,IAAI,EAAC,UAAU;AACf,QAAA,YAAA,EAAYU,aAAc;AAC1BK,QAAAA,gBAAgB,EAAEA,gBAAiB;AACnCa,QAAAA,cAAc,EAAEZ,aAAc;QAC9Ba,mBAAmB,EAAA,IAAA;AAAA,OAAA,EAElBtB,SACc,CAAC,CAAA;AAE5B,KACJ,CACQ,CAAC,CAAA;AAAA,GAChB,CACiB,CAAC,CAAA;AAE/B;;;;"}
|
@@ -83,6 +83,9 @@ var CalendarQuarters = function CalendarQuarters(_ref) {
|
|
83
83
|
}
|
84
84
|
onHoverQuarter === null || onHoverQuarter === void 0 || onHoverQuarter(selectedDate);
|
85
85
|
}, [getSelectedDate, onHoverQuarter, value]);
|
86
|
+
var handleMouseOutGrid = function handleMouseOutGrid() {
|
87
|
+
return onHoverQuarter === null || onHoverQuarter === void 0 ? void 0 : onHoverQuarter(undefined);
|
88
|
+
};
|
86
89
|
var getRefs = useCallback(function (element, i, j) {
|
87
90
|
outerRefs.current[i + offset][j] = element;
|
88
91
|
}, [offset, outerRefs]);
|
@@ -95,7 +98,8 @@ var CalendarQuarters = function CalendarQuarters(_ref) {
|
|
95
98
|
return /*#__PURE__*/React.createElement(StyledCalendarQuarters, {
|
96
99
|
role: "grid",
|
97
100
|
"aria-labelledby": "id-grid-label",
|
98
|
-
onKeyDown: onKeyDown
|
101
|
+
onKeyDown: onKeyDown,
|
102
|
+
onMouseLeave: handleMouseOutGrid
|
99
103
|
}, quarters.map(function (quarter, i) {
|
100
104
|
return /*#__PURE__*/React.createElement(StyledFlex, {
|
101
105
|
role: "row",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CalendarQuarters.js","sources":["../../../../../src/components/Calendar/ui/CalendarQuarters/CalendarQuarters.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef } from 'react';\n\nimport { useQuarters } from '../../hooks';\nimport { innerTokens, tokens } from '../../Calendar.tokens';\nimport { ROW_QUARTER_STEP, canSelectDate, getInRange, getSideInRange, isSameDay, isSelectProcess } from '../../utils';\nimport { DateStructureItem } from '../DateStructureItem/DateStructureItem';\n\nimport type { CalendarQuartersProps } from './CalendarQuarters.types';\nimport { StyledCalendarQuarters, StyledFlex } from './CalendarQuarters.styles';\n\n/**\n * Компонент кварталов в календаре.\n */\nexport const CalendarQuarters: React.FC<CalendarQuartersProps> = ({\n date: currentDate,\n value,\n selectIndexes,\n eventList,\n disabledList,\n min,\n max,\n outerRefs,\n isDouble,\n isSecond,\n hoveredQuarter,\n onChangeQuarter,\n onHoverQuarter,\n onSetSelected,\n onKeyDown,\n}) => {\n const [quarters, selected] = useQuarters({ date: currentDate, value, eventList, disabledList, min, max });\n const selectedRef = useRef(selected);\n const onSetSelectedRef = useRef(onSetSelected);\n\n const offset = isSecond ? ROW_QUARTER_STEP : 0;\n\n const quarterItemTokens = {\n [`${innerTokens.dateStructureFontFamily}`]: `var(${tokens.calendarQuarterFontFamily})`,\n [`${innerTokens.dateStructureFontSize}`]: `var(${tokens.calendarQuarterFontSize})`,\n [`${innerTokens.dateStructureFontWeight}`]: `var(${tokens.calendarQuarterFontWeight})`,\n [`${innerTokens.dateStructureFontLineHeight}`]: `var(${tokens.calendarQuarterFontLineHeight})`,\n [`${innerTokens.dateStructureFontLetterSpacing}`]: `var(${tokens.calendarQuarterFontLetterSpacing})`,\n [`${innerTokens.dateStructureFontStyle}`]: `var(${tokens.calendarQuarterFontStyle})`,\n [`${innerTokens.dateStructureSelectedFontWeight}`]: `var(${tokens.calendarQuarterSelectedFontWeight})`,\n [`${innerTokens.dateStructureWidth}`]: `var(${tokens.calendarQuarterItemWidth})`,\n [`${innerTokens.dateStructureHeight}`]: `var(${tokens.calendarQuarterItemHeight})`,\n [`${innerTokens.dateStructureBorderRadius}`]: `var(${tokens.calendarQuarterItemBorderRadius})`,\n };\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 handleOnChangeQuarter = useCallback(\n (i: number, j: number, quarterName: string) => (event: React.MouseEvent<HTMLDivElement>) => {\n /**\n * нужно вызвать stopImmediatePropagation для случаев, когда\n * обработчик события onClick навешивается снаружи.\n * Как, например, в компоненте Popup\n */\n event.nativeEvent.stopImmediatePropagation();\n\n const selectedDate = getSelectedDate(event);\n\n if (!selectedDate) {\n return;\n }\n\n onChangeQuarter(selectedDate, [i + offset, j], quarterName);\n\n if (isSelectProcess(value)) {\n onHoverQuarter?.(undefined);\n }\n },\n [getSelectedDate, onChangeQuarter, offset, value, onHoverQuarter],\n );\n\n const handleOnHoverQuarter = 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 onHoverQuarter?.(selectedDate);\n },\n [getSelectedDate, onHoverQuarter, value],\n );\n\n const getRefs = useCallback(\n (element: HTMLDivElement, i: number, j: number) => {\n outerRefs.current[i + offset][j] = element;\n },\n [offset, outerRefs],\n );\n\n useEffect(() => {\n if (selectedRef.current) {\n onSetSelectedRef.current?.(selectedRef.current);\n }\n }, []);\n\n return (\n <StyledCalendarQuarters role=\"grid\" aria-labelledby=\"id-grid-label\" onKeyDown={onKeyDown}>\n {quarters.map((quarter, i) => (\n <StyledFlex role=\"row\" key={i}>\n {quarter.map(\n (\n {\n quarterName,\n isSelected,\n isCurrent,\n date,\n events,\n isOutOfMinMaxRange,\n inRange,\n disabled,\n disabledArrowKey,\n disabledDates,\n },\n j,\n ) => {\n return (\n <DateStructureItem\n ref={(element: HTMLDivElement) => getRefs(element, i, j)}\n style={quarterItemTokens}\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] &&\n j === selectIndexes?.[1] &&\n !isOutOfMinMaxRange\n }\n isSelected={isSelected}\n isCurrent={isCurrent}\n isDouble={isDouble}\n isHovered={isSameDay(date, hoveredQuarter)}\n inRange={getInRange(value, date, hoveredQuarter, inRange)}\n sideInRange={getSideInRange(value, date, hoveredQuarter, isSelected)}\n onClick={disabled ? undefined : handleOnChangeQuarter(i, j, String(quarterName))}\n onMouseOver={disabled ? undefined : handleOnHoverQuarter}\n key={`StyledQuarter-${i}-${j}`}\n role=\"gridcell\"\n aria-label={quarterName}\n disabledArrowKey={disabledArrowKey}\n disabledMonths={disabledDates}\n isDayInCurrentMonth\n >\n {quarterName}\n </DateStructureItem>\n );\n },\n )}\n </StyledFlex>\n ))}\n </StyledCalendarQuarters>\n );\n};\n"],"names":["CalendarQuarters","_ref","currentDate","date","value","selectIndexes","eventList","disabledList","min","max","outerRefs","isDouble","isSecond","hoveredQuarter","onChangeQuarter","onHoverQuarter","onSetSelected","onKeyDown","_useQuarters","useQuarters","_useQuarters2","_slicedToArray","quarters","selected","selectedRef","useRef","onSetSelectedRef","offset","ROW_QUARTER_STEP","quarterItemTokens","_defineProperty","concat","innerTokens","dateStructureFontFamily","tokens","calendarQuarterFontFamily","dateStructureFontSize","calendarQuarterFontSize","dateStructureFontWeight","calendarQuarterFontWeight","dateStructureFontLineHeight","calendarQuarterFontLineHeight","dateStructureFontLetterSpacing","calendarQuarterFontLetterSpacing","dateStructureFontStyle","calendarQuarterFontStyle","dateStructureSelectedFontWeight","calendarQuarterSelectedFontWeight","dateStructureWidth","calendarQuarterItemWidth","dateStructureHeight","calendarQuarterItemHeight","dateStructureBorderRadius","calendarQuarterItemBorderRadius","getSelectedDate","useCallback","event","_event$currentTarget$","currentTarget","dataset","day","monthIndex","year","selectedDate","Number","canSelectDate","handleOnChangeQuarter","i","j","quarterName","nativeEvent","stopImmediatePropagation","isSelectProcess","undefined","handleOnHoverQuarter","isSelectedDone","Array","isArray","getRefs","element","current","useEffect","_onSetSelectedRef$cur","call","React","createElement","StyledCalendarQuarters","role","map","quarter","StyledFlex","key","_ref2","isSelected","isCurrent","events","isOutOfMinMaxRange","inRange","disabled","disabledArrowKey","disabledDates","DateStructureItem","ref","style","isFocused","isHovered","isSameDay","getInRange","sideInRange","getSideInRange","onClick","String","onMouseOver","disabledMonths","isDayInCurrentMonth"],"mappings":";;;;;;;;;;AAUA;AACA;AACA;IACaA,gBAAiD,GAAG,SAApDA,gBAAiDA,CAAAC,IAAA,EAgBxD;AAAA,EAAA,IAfIC,WAAW,GAAAD,IAAA,CAAjBE,IAAI;IACJC,KAAK,GAAAH,IAAA,CAALG,KAAK;IACLC,aAAa,GAA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OAAApC,MAAA,CAAIqC,CAAC,CAAG;AAC/BmB,QAAAA,IAAI,EAAC,UAAU;AACf,QAAA,YAAA,EAAYlB,WAAY;AACxB8B,QAAAA,gBAAgB,EAAEA,gBAAiB;AACnCc,QAAAA,cAAc,EAAEb,aAAc;QAC9Bc,mBAAmB,EAAA,IAAA;AAAA,OAAA,EAElB7C,WACc,CAAC,CAAA;AAE5B,KACJ,CACQ,CAAC,CAAA;AAAA,GAChB,CACmB,CAAC,CAAA;AAEjC;;;;"}
|
1
|
+
{"version":3,"file":"CalendarQuarters.js","sources":["../../../../../src/components/Calendar/ui/CalendarQuarters/CalendarQuarters.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef } from 'react';\n\nimport { useQuarters } from '../../hooks';\nimport { innerTokens, tokens } from '../../Calendar.tokens';\nimport { ROW_QUARTER_STEP, canSelectDate, getInRange, getSideInRange, isSameDay, isSelectProcess } from '../../utils';\nimport { DateStructureItem } from '../DateStructureItem/DateStructureItem';\n\nimport type { CalendarQuartersProps } from './CalendarQuarters.types';\nimport { StyledCalendarQuarters, StyledFlex } from './CalendarQuarters.styles';\n\n/**\n * Компонент кварталов в календаре.\n */\nexport const CalendarQuarters: React.FC<CalendarQuartersProps> = ({\n date: currentDate,\n value,\n selectIndexes,\n eventList,\n disabledList,\n min,\n max,\n outerRefs,\n isDouble,\n isSecond,\n hoveredQuarter,\n onChangeQuarter,\n onHoverQuarter,\n onSetSelected,\n onKeyDown,\n}) => {\n const [quarters, selected] = useQuarters({ date: currentDate, value, eventList, disabledList, min, max });\n const selectedRef = useRef(selected);\n const onSetSelectedRef = useRef(onSetSelected);\n\n const offset = isSecond ? ROW_QUARTER_STEP : 0;\n\n const quarterItemTokens = {\n [`${innerTokens.dateStructureFontFamily}`]: `var(${tokens.calendarQuarterFontFamily})`,\n [`${innerTokens.dateStructureFontSize}`]: `var(${tokens.calendarQuarterFontSize})`,\n [`${innerTokens.dateStructureFontWeight}`]: `var(${tokens.calendarQuarterFontWeight})`,\n [`${innerTokens.dateStructureFontLineHeight}`]: `var(${tokens.calendarQuarterFontLineHeight})`,\n [`${innerTokens.dateStructureFontLetterSpacing}`]: `var(${tokens.calendarQuarterFontLetterSpacing})`,\n [`${innerTokens.dateStructureFontStyle}`]: `var(${tokens.calendarQuarterFontStyle})`,\n [`${innerTokens.dateStructureSelectedFontWeight}`]: `var(${tokens.calendarQuarterSelectedFontWeight})`,\n [`${innerTokens.dateStructureWidth}`]: `var(${tokens.calendarQuarterItemWidth})`,\n [`${innerTokens.dateStructureHeight}`]: `var(${tokens.calendarQuarterItemHeight})`,\n [`${innerTokens.dateStructureBorderRadius}`]: `var(${tokens.calendarQuarterItemBorderRadius})`,\n };\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 handleOnChangeQuarter = useCallback(\n (i: number, j: number, quarterName: string) => (event: React.MouseEvent<HTMLDivElement>) => {\n /**\n * нужно вызвать stopImmediatePropagation для случаев, когда\n * обработчик события onClick навешивается снаружи.\n * Как, например, в компоненте Popup\n */\n event.nativeEvent.stopImmediatePropagation();\n\n const selectedDate = getSelectedDate(event);\n\n if (!selectedDate) {\n return;\n }\n\n onChangeQuarter(selectedDate, [i + offset, j], quarterName);\n\n if (isSelectProcess(value)) {\n onHoverQuarter?.(undefined);\n }\n },\n [getSelectedDate, onChangeQuarter, offset, value, onHoverQuarter],\n );\n\n const handleOnHoverQuarter = 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 onHoverQuarter?.(selectedDate);\n },\n [getSelectedDate, onHoverQuarter, value],\n );\n\n const handleMouseOutGrid = () => onHoverQuarter?.(undefined);\n\n const getRefs = useCallback(\n (element: HTMLDivElement, i: number, j: number) => {\n outerRefs.current[i + offset][j] = element;\n },\n [offset, outerRefs],\n );\n\n useEffect(() => {\n if (selectedRef.current) {\n onSetSelectedRef.current?.(selectedRef.current);\n }\n }, []);\n\n return (\n <StyledCalendarQuarters\n role=\"grid\"\n aria-labelledby=\"id-grid-label\"\n onKeyDown={onKeyDown}\n onMouseLeave={handleMouseOutGrid}\n >\n {quarters.map((quarter, i) => (\n <StyledFlex role=\"row\" key={i}>\n {quarter.map(\n (\n {\n quarterName,\n isSelected,\n isCurrent,\n date,\n events,\n isOutOfMinMaxRange,\n inRange,\n disabled,\n disabledArrowKey,\n disabledDates,\n },\n j,\n ) => {\n return (\n <DateStructureItem\n ref={(element: HTMLDivElement) => getRefs(element, i, j)}\n style={quarterItemTokens}\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] &&\n j === selectIndexes?.[1] &&\n !isOutOfMinMaxRange\n }\n isSelected={isSelected}\n isCurrent={isCurrent}\n isDouble={isDouble}\n isHovered={isSameDay(date, hoveredQuarter)}\n inRange={getInRange(value, date, hoveredQuarter, inRange)}\n sideInRange={getSideInRange(value, date, hoveredQuarter, isSelected)}\n onClick={disabled ? undefined : handleOnChangeQuarter(i, j, String(quarterName))}\n onMouseOver={disabled ? undefined : handleOnHoverQuarter}\n key={`StyledQuarter-${i}-${j}`}\n role=\"gridcell\"\n aria-label={quarterName}\n disabledArrowKey={disabledArrowKey}\n disabledMonths={disabledDates}\n isDayInCurrentMonth\n >\n {quarterName}\n </DateStructureItem>\n );\n },\n )}\n </StyledFlex>\n ))}\n </StyledCalendarQuarters>\n );\n};\n"],"names":["CalendarQuarters","_ref","currentDate","date","value","selectIndexes","eventList","disabledList","min","max","outerRefs","isDouble","isSecond","hoveredQuarter","onChangeQuarter","onHoverQuarter","onSetSelected","onKeyDown","_useQuarters","useQuarters","_useQuarters2","_slicedToArray","quarters","selected","selectedRef","useRef","onSetSelectedRef","offset","ROW_QUARTER_STEP","quarterItemTokens","_defineProperty","concat","innerTokens","dateStructureFontFamily","tokens","calendarQuarterFontFamily","dateStructureFontSize","calendarQuarterFontSize","dateStructureFontWeight","calendarQuarterFontWeight","dateStructureFontLineHeight","calendarQuarterFontLineHeight","dateStructureFontLetterSpacing","calendarQuarterFontLetterSpacing","dateStructureFontStyle","calendarQuarterFontStyle","dateStructureSelectedFontWeight","calendarQuarterSelectedFontWeight","dateStructureWidth","calendarQuarterItemWidth","dateStructureHeight","calendarQuarterItemHeight","dateStructureBorderRadius","calendarQuarterItemBorderRadius","getSelectedDate","useCallback","event","_event$currentTarget$","currentTarget","dataset","day","monthIndex","year","selectedDate","Number","canSelectDate","handleOnChangeQuarter","i","j","quarterName","nativeEvent","stopImmediatePropagation","isSelectProcess","undefined","handleOnHoverQuarter","isSelectedDone","Array","isArray","handleMouseOutGrid","getRefs","element","current","useEffect","_onSetSelectedRef$cur","call","React","createElement","StyledCalendarQuarters","role","onMouseLeave","map","quarter","StyledFlex","key","_ref2","isSelected","isCurrent","events","isOutOfMinMaxRange","inRange","disabled","disabledArrowKey","disabledDates","DateStructureItem","ref","style","isFocused","isHovered","isSameDay","getInRange","sideInRange","getSideInRange","onClick","String","onMouseOver","disabledMonths","isDayInCurrentMonth"],"mappings":";;;;;;;;;;AAUA;AACA;AACA;IACaA,gBAAiD,GAAG,SAApDA,gBAAiDA,CAAAC,IAAA,EAgBxD;AAAA,EAAA,IAfIC,WAAW,GAAAD,IAAA,CAAjBE,IAAI;IACJC,KAAK,GAAAH,IAAA,CAALG,KAAK;IACLC,aAAa,GAAAJ,IAAA,CAAbI,aAAa;IACbC,SAAS,GAAAL,IAAA,CAATK,SAAS;IACTC,YAAY,GAAAN,IAAA,CAAZM,YAAY;IACZC,GAAG,GAAAP,IAAA,CAAHO,GAAG;I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,GAAGC,oBAAqB;QACzDmB,GAAG,EAAA,gBAAA,CAAA9D,MAAA,CAAmBoC,CAAC,OAAApC,MAAA,CAAIqC,CAAC,CAAG;AAC/BoB,QAAAA,IAAI,EAAC,UAAU;AACf,QAAA,YAAA,EAAYnB,WAAY;AACxBgC,QAAAA,gBAAgB,EAAEA,gBAAiB;AACnCc,QAAAA,cAAc,EAAEb,aAAc;QAC9Bc,mBAAmB,EAAA,IAAA;AAAA,OAAA,EAElB/C,WACc,CAAC,CAAA;AAE5B,KACJ,CACQ,CAAC,CAAA;AAAA,GAChB,CACmB,CAAC,CAAA;AAEjC;;;;"}
|
@@ -85,6 +85,9 @@ var CalendarYears = function CalendarYears(_ref) {
|
|
85
85
|
}
|
86
86
|
onHoverYear === null || onHoverYear === void 0 || onHoverYear(selectedDate);
|
87
87
|
}, [getSelectedDate, onHoverYear, value]);
|
88
|
+
var handleMouseOutGrid = function handleMouseOutGrid() {
|
89
|
+
return onHoverYear === null || onHoverYear === void 0 ? void 0 : onHoverYear(undefined);
|
90
|
+
};
|
88
91
|
var getRefs = useCallback(function (element, i, j) {
|
89
92
|
outerRefs.current[i + offset][j] = element;
|
90
93
|
}, [outerRefs]);
|
@@ -97,7 +100,8 @@ var CalendarYears = function CalendarYears(_ref) {
|
|
97
100
|
return /*#__PURE__*/React.createElement(StyledCalendarYears, {
|
98
101
|
role: "grid",
|
99
102
|
"aria-labelledby": "id-grid-label",
|
100
|
-
onKeyDown: onKeyDown
|
103
|
+
onKeyDown: onKeyDown,
|
104
|
+
onMouseLeave: handleMouseOutGrid
|
101
105
|
}, years.map(function (year, i) {
|
102
106
|
return /*#__PURE__*/React.createElement(StyledFlex, {
|
103
107
|
role: "row",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CalendarYears.js","sources":["../../../../../src/components/Calendar/ui/CalendarYears/CalendarYears.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef } from 'react';\n\nimport { useYears } from '../../hooks';\nimport { innerTokens, tokens } from '../../Calendar.tokens';\nimport { ROW_YEAR_STEP, canSelectDate, getInRange, getSideInRange, isSameDay, isSelectProcess } from '../../utils';\nimport { DateStructureItem } from '../DateStructureItem/DateStructureItem';\n\nimport type { CalendarYearsProps } from './CalendarYears.types';\nimport { StyledCalendarYears, StyledFlex } from './CalendarYears.styles';\n\n/**\n * Компонент годов в календаре.\n */\nexport const CalendarYears: React.FC<CalendarYearsProps> = ({\n date: currentDate,\n value,\n startYear,\n selectIndexes,\n eventList,\n disabledList,\n min,\n max,\n outerRefs,\n isDouble,\n isSecond,\n hoveredYear,\n onChangeYear,\n onHoverYear,\n onSetSelected,\n onKeyDown,\n}) => {\n const [years, selected] = useYears({ date: currentDate, value, startYear, eventList, disabledList, min, max });\n const selectedRef = useRef(selected);\n const onSetSelectedRef = useRef(onSetSelected);\n\n const offset = isSecond ? ROW_YEAR_STEP : 0;\n\n const yearItemTokens = {\n [`${innerTokens.dateStructureFontFamily}`]: `var(${tokens.calendarYearFontFamily})`,\n [`${innerTokens.dateStructureFontSize}`]: `var(${tokens.calendarYearFontSize})`,\n [`${innerTokens.dateStructureFontWeight}`]: `var(${tokens.calendarYearFontWeight})`,\n [`${innerTokens.dateStructureFontLineHeight}`]: `var(${tokens.calendarYearFontLineHeight})`,\n [`${innerTokens.dateStructureFontLetterSpacing}`]: `var(${tokens.calendarYearFontLetterSpacing})`,\n [`${innerTokens.dateStructureFontStyle}`]: `var(${tokens.calendarYearFontStyle})`,\n [`${innerTokens.dateStructureSelectedFontWeight}`]: `var(${tokens.calendarYearSelectedFontWeight})`,\n [`${innerTokens.dateStructureWidth}`]: `var(${tokens.calendarYearItemWidth})`,\n [`${innerTokens.dateStructureHeight}`]: `var(${tokens.calendarYearItemHeight})`,\n [`${innerTokens.dateStructureBorderRadius}`]: `var(${tokens.calendarYearItemBorderRadius})`,\n };\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 handleOnChangeYear = useCallback(\n (i: number, j: number) => (event: React.MouseEvent<HTMLDivElement>) => {\n /**\n * нужно вызвать stopImmediatePropagation для случаев, когда\n * обработчик события onClick навешивается снаружи.\n * Как, например, в компоненте Popup\n */\n event.nativeEvent.stopImmediatePropagation();\n\n const selectedDate = getSelectedDate(event);\n\n if (!selectedDate) {\n return;\n }\n\n onChangeYear(selectedDate, [i + offset, j]);\n\n if (isSelectProcess(value)) {\n onHoverYear?.(undefined);\n }\n },\n [getSelectedDate, onChangeYear, offset, value, onHoverYear],\n );\n\n const handleOnHoverYear = 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 onHoverYear?.(selectedDate);\n },\n [getSelectedDate, onHoverYear, value],\n );\n\n const getRefs = useCallback(\n (element: HTMLDivElement, i: number, j: number) => {\n outerRefs.current[i + offset][j] = element;\n },\n [outerRefs],\n );\n\n useEffect(() => {\n if (selectedRef.current) {\n onSetSelectedRef.current?.(selectedRef.current);\n }\n }, []);\n\n return (\n <StyledCalendarYears role=\"grid\" aria-labelledby=\"id-grid-label\" onKeyDown={onKeyDown}>\n {years.map((year, i) => (\n <StyledFlex role=\"row\" key={i}>\n {year.map(\n (\n {\n yearValue,\n isSelected,\n isCurrent,\n date,\n events,\n isOutOfMinMaxRange,\n inRange,\n disabled,\n disabledArrowKey,\n disabledDates,\n },\n j,\n ) => {\n return (\n <DateStructureItem\n ref={(element: HTMLDivElement) => getRefs(element, i, j)}\n style={yearItemTokens}\n eventList={events}\n disabled={disabled}\n day={date.day}\n year={yearValue}\n monthIndex={date.monthIndex}\n isFocused={\n i + offset === selectIndexes?.[0] &&\n j === selectIndexes?.[1] &&\n !isOutOfMinMaxRange\n }\n isSelected={isSelected}\n isCurrent={isCurrent}\n isDouble={isDouble}\n isHovered={isSameDay(date, hoveredYear)}\n inRange={getInRange(value, date, hoveredYear, inRange)}\n sideInRange={getSideInRange(value, date, hoveredYear, isSelected)}\n onClick={disabled ? undefined : handleOnChangeYear(i, j)}\n onMouseOver={disabled ? undefined : handleOnHoverYear}\n key={`StyledYear-${i}-${j}`}\n role=\"gridcell\"\n data-year={yearValue}\n data-month-index={date.monthIndex}\n data-day={date.day}\n aria-label={String(yearValue)}\n disabledArrowKey={disabledArrowKey}\n disabledMonths={disabledDates}\n isDayInCurrentMonth\n >\n {yearValue}\n </DateStructureItem>\n );\n },\n )}\n </StyledFlex>\n ))}\n </StyledCalendarYears>\n );\n};\n"],"names":["CalendarYears","_ref","currentDate","date","value","startYear","selectIndexes","eventList","disabledList","min","max","outerRefs","isDouble","isSecond","hoveredYear","onChangeYear","onHoverYear","onSetSelected","onKeyDown","_useYears","useYears","_useYears2","_slicedToArray","years","selected","selectedRef","useRef","onSetSelectedRef","offset","ROW_YEAR_STEP","yearItemTokens","_defineProperty","concat","innerTokens","dateStructureFontFamily","tokens","calendarYearFontFamily","dateStructureFontSize","calendarYearFontSize","dateStructureFontWeight","calendarYearFontWeight","dateStructureFontLineHeight","calendarYearFontLineHeight","dateStructureFontLetterSpacing","calendarYearFontLetterSpacing","dateStructureFontStyle","calendarYearFontStyle","dateStructureSelectedFontWeight","calendarYearSelectedFontWeight","dateStructureWidth","calendarYearItemWidth","dateStructureHeight","calendarYearItemHeight","dateStructureBorderRadius","calendarYearItemBorderRadius","getSelectedDate","useCallback","event","_event$currentTarget$","currentTarget","dataset","day","monthIndex","year","selectedDate","Number","canSelectDate","handleOnChangeYear","i","j","nativeEvent","stopImmediatePropagation","isSelectProcess","undefined","handleOnHoverYear","isSelectedDone","Array","isArray","getRefs","element","current","useEffect","_onSetSelectedRef$cur","call","React","createElement","StyledCalendarYears","role","map","StyledFlex","key","_ref2","yearValue","isSelected","isCurrent","events","isOutOfMinMaxRange","inRange","disabled","disabledArrowKey","disabledDates","DateStructureItem","ref","style","isFocused","isHovered","isSameDay","getInRange","sideInRange","getSideInRange","onClick","onMouseOver","String","disabledMonths","isDayInCurrentMonth"],"mappings":";;;;;;;;;;AAUA;AACA;AACA;IACaA,aAA2C,GAAG,SAA9CA,aAA2CA,CAAAC,IAAA,EAiBlD;AAAA,EAAA,IAhBIC,WAAW,GAAAD,IAAA,CAAjBE,IAAI;IACJC,KAAK,GAAAH,IAAA,CAALG,KAAK;IACLC,SAAS,GAAAJ,IAAA,CAATI,SAAS;IACTC,aAAa,GAAAL,IAAA,CAAbK,aAAa;IACbC,SAAS,GAAAN,IAAA,CAATM,SAAS;IACTC,YAAY,GAAAP,IAAA,CAAZO,YAAY;IACZC,GAAG,GAAAR,IAAA,CAAHQ,GAAG;IACHC,GAAG,GAAAT,IAAA,CAAHS,GAAG;IACHC,SAAS,GAAAV,IAAA,CAATU,SAAS;IACTC,QAAQ,GAAAX,IAAA,CAARW,QAAQ;IACRC,QAAQ,GAAAZ,IAAA,CAARY,QAAQ;IACRC,WAAW,GAAAb,IAAA,CAAXa,WAAW;IACXC,YAAY,GAAAd,IAAA,CAAZc,YAAY;IACZC,WAAW,GAAAf,IAAA,CAAXe,WAAW;IACXC,aAAa,GAAAhB,IAAA,CAAbgB,aAAa;IACbC,SAAS,GAAAjB,IAAA,CAATiB,SAAS,CAAA;EAET,IAAAC,SAAA,GAA0BC,QAAQ,CAAC;AAAEjB,MAAAA,IAAI,EAAED,WAAW;AAAEE,MAAAA,KAAK,EAALA,KAAK;AAAEC,MAAAA,SAAS,EAATA,SAAS;AAAEE,MAAAA,SAAS,EAATA,SAAS;AAAEC,MAAAA,YAAY,EAAZA,YAAY;AAAEC,MAAAA,GAAG,EAAHA,GAAG;AAAEC,MAAAA,GAAG,EAAHA,GAAAA;AAAI,KAAC,CAAC;IAAAW,UA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,CAACvG,KAAK,EAAED,IAAI,EAAEW,WAAW,EAAEmF,OAAO,CAAE;QACvDW,WAAW,EAAEC,cAAc,CAACzG,KAAK,EAAED,IAAI,EAAEW,WAAW,EAAE+E,UAAU,CAAE;QAClEiB,OAAO,EAAEZ,QAAQ,GAAGzB,SAAS,GAAGN,kBAAkB,CAACC,CAAC,EAAEC,CAAC,CAAE;AACzD0C,QAAAA,WAAW,EAAEb,QAAQ,GAAGzB,SAAS,GAAGC,iBAAkB;QACtDgB,GAAG,EAAA,aAAA,CAAA1D,MAAA,CAAgBoC,CAAC,OAAApC,MAAA,CAAIqC,CAAC,CAAG;AAC5BkB,QAAAA,IAAI,EAAC,UAAU;AACf,QAAA,WAAA,EAAWK,SAAU;QACrB,kBAAkBzF,EAAAA,IAAI,CAAC2D,UAAW;QAClC,UAAU3D,EAAAA,IAAI,CAAC0D,GAAI;QACnB,YAAYmD,EAAAA,MAAM,CAACpB,SAAS,CAAE;AAC9BO,QAAAA,gBAAgB,EAAEA,gBAAiB;AACnCc,QAAAA,cAAc,EAAEb,aAAc;QAC9Bc,mBAAmB,EAAA,IAAA;AAAA,OAAA,EAElBtB,SACc,CAAC,CAAA;AAE5B,KACJ,CACQ,CAAC,CAAA;AAAA,GAChB,CACgB,CAAC,CAAA;AAE9B;;;;"}
|
1
|
+
{"version":3,"file":"CalendarYears.js","sources":["../../../../../src/components/Calendar/ui/CalendarYears/CalendarYears.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef } from 'react';\n\nimport { useYears } from '../../hooks';\nimport { innerTokens, tokens } from '../../Calendar.tokens';\nimport { ROW_YEAR_STEP, canSelectDate, getInRange, getSideInRange, isSameDay, isSelectProcess } from '../../utils';\nimport { DateStructureItem } from '../DateStructureItem/DateStructureItem';\n\nimport type { CalendarYearsProps } from './CalendarYears.types';\nimport { StyledCalendarYears, StyledFlex } from './CalendarYears.styles';\n\n/**\n * Компонент годов в календаре.\n */\nexport const CalendarYears: React.FC<CalendarYearsProps> = ({\n date: currentDate,\n value,\n startYear,\n selectIndexes,\n eventList,\n disabledList,\n min,\n max,\n outerRefs,\n isDouble,\n isSecond,\n hoveredYear,\n onChangeYear,\n onHoverYear,\n onSetSelected,\n onKeyDown,\n}) => {\n const [years, selected] = useYears({ date: currentDate, value, startYear, eventList, disabledList, min, max });\n const selectedRef = useRef(selected);\n const onSetSelectedRef = useRef(onSetSelected);\n\n const offset = isSecond ? ROW_YEAR_STEP : 0;\n\n const yearItemTokens = {\n [`${innerTokens.dateStructureFontFamily}`]: `var(${tokens.calendarYearFontFamily})`,\n [`${innerTokens.dateStructureFontSize}`]: `var(${tokens.calendarYearFontSize})`,\n [`${innerTokens.dateStructureFontWeight}`]: `var(${tokens.calendarYearFontWeight})`,\n [`${innerTokens.dateStructureFontLineHeight}`]: `var(${tokens.calendarYearFontLineHeight})`,\n [`${innerTokens.dateStructureFontLetterSpacing}`]: `var(${tokens.calendarYearFontLetterSpacing})`,\n [`${innerTokens.dateStructureFontStyle}`]: `var(${tokens.calendarYearFontStyle})`,\n [`${innerTokens.dateStructureSelectedFontWeight}`]: `var(${tokens.calendarYearSelectedFontWeight})`,\n [`${innerTokens.dateStructureWidth}`]: `var(${tokens.calendarYearItemWidth})`,\n [`${innerTokens.dateStructureHeight}`]: `var(${tokens.calendarYearItemHeight})`,\n [`${innerTokens.dateStructureBorderRadius}`]: `var(${tokens.calendarYearItemBorderRadius})`,\n };\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 handleOnChangeYear = useCallback(\n (i: number, j: number) => (event: React.MouseEvent<HTMLDivElement>) => {\n /**\n * нужно вызвать stopImmediatePropagation для случаев, когда\n * обработчик события onClick навешивается снаружи.\n * Как, например, в компоненте Popup\n */\n event.nativeEvent.stopImmediatePropagation();\n\n const selectedDate = getSelectedDate(event);\n\n if (!selectedDate) {\n return;\n }\n\n onChangeYear(selectedDate, [i + offset, j]);\n\n if (isSelectProcess(value)) {\n onHoverYear?.(undefined);\n }\n },\n [getSelectedDate, onChangeYear, offset, value, onHoverYear],\n );\n\n const handleOnHoverYear = 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 onHoverYear?.(selectedDate);\n },\n [getSelectedDate, onHoverYear, value],\n );\n\n const handleMouseOutGrid = () => onHoverYear?.(undefined);\n\n const getRefs = useCallback(\n (element: HTMLDivElement, i: number, j: number) => {\n outerRefs.current[i + offset][j] = element;\n },\n [outerRefs],\n );\n\n useEffect(() => {\n if (selectedRef.current) {\n onSetSelectedRef.current?.(selectedRef.current);\n }\n }, []);\n\n return (\n <StyledCalendarYears\n role=\"grid\"\n aria-labelledby=\"id-grid-label\"\n onKeyDown={onKeyDown}\n onMouseLeave={handleMouseOutGrid}\n >\n {years.map((year, i) => (\n <StyledFlex role=\"row\" key={i}>\n {year.map(\n (\n {\n yearValue,\n isSelected,\n isCurrent,\n date,\n events,\n isOutOfMinMaxRange,\n inRange,\n disabled,\n disabledArrowKey,\n disabledDates,\n },\n j,\n ) => {\n return (\n <DateStructureItem\n ref={(element: HTMLDivElement) => getRefs(element, i, j)}\n style={yearItemTokens}\n eventList={events}\n disabled={disabled}\n day={date.day}\n year={yearValue}\n monthIndex={date.monthIndex}\n isFocused={\n i + offset === selectIndexes?.[0] &&\n j === selectIndexes?.[1] &&\n !isOutOfMinMaxRange\n }\n isSelected={isSelected}\n isCurrent={isCurrent}\n isDouble={isDouble}\n isHovered={isSameDay(date, hoveredYear)}\n inRange={getInRange(value, date, hoveredYear, inRange)}\n sideInRange={getSideInRange(value, date, hoveredYear, isSelected)}\n onClick={disabled ? undefined : handleOnChangeYear(i, j)}\n onMouseOver={disabled ? undefined : handleOnHoverYear}\n key={`StyledYear-${i}-${j}`}\n role=\"gridcell\"\n data-year={yearValue}\n data-month-index={date.monthIndex}\n data-day={date.day}\n aria-label={String(yearValue)}\n disabledArrowKey={disabledArrowKey}\n disabledMonths={disabledDates}\n isDayInCurrentMonth\n >\n {yearValue}\n </DateStructureItem>\n );\n },\n )}\n </StyledFlex>\n ))}\n </StyledCalendarYears>\n );\n};\n"],"names":["CalendarYears","_ref","currentDate","date","value","startYear","selectIndexes","eventList","disabledList","min","max","outerRefs","isDouble","isSecond","hoveredYear","onChangeYear","onHoverYear","onSetSelected","onKeyDown","_useYears","useYears","_useYears2","_slicedToArray","years","selected","selectedRef","useRef","onSetSelectedRef","offset","ROW_YEAR_STEP","yearItemTokens","_defineProperty","concat","innerTokens","dateStructureFontFamily","tokens","calendarYearFontFamily","dateStructureFontSize","calendarYearFontSize","dateStructureFontWeight","calendarYearFontWeight","dateStructureFontLineHeight","calendarYearFontLineHeight","dateStructureFontLetterSpacing","calendarYearFontLetterSpacing","dateStructureFontStyle","calendarYearFontStyle","dateStructureSelectedFontWeight","calendarYearSelectedFontWeight","dateStructureWidth","calendarYearItemWidth","dateStructureHeight","calendarYearItemHeight","dateStructureBorderRadius","calendarYearItemBorderRadius","getSelectedDate","useCallback","event","_event$currentTarget$","currentTarget","dataset","day","monthIndex","year","selectedDate","Number","canSelectDate","handleOnChangeYear","i","j","nativeEvent","stopImmediatePropagation","isSelectProcess","undefined","handleOnHoverYear","isSelectedDone","Array","isArray","handleMouseOutGrid","getRefs","element","current","useEffect","_onSetSelectedRef$cur","call","React","createElement","StyledCalendarYears","role","onMouseLeave","map","StyledFlex","key","_ref2","yearValue","isSelected","isCurrent","events","isOutOfMinMaxRange","inRange","disabled","disabledArrowKey","disabledDates","DateStructureItem","ref","style","isFocused","isHovered","isSameDay","getInRange","sideInRange","getSideInRange","onClick","onMouseOver","String","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AAEW,WAAW,CAAE;QACxCqF,OAAO,EAAEU,UAAU,CAACzG,KAAK,EAAED,IAAI,EAAEW,WAAW,EAAEqF,OAAO,CAAE;QACvDW,WAAW,EAAEC,cAAc,CAAC3G,KAAK,EAAED,IAAI,EAAEW,WAAW,EAAEiF,UAAU,CAAE;QAClEiB,OAAO,EAAEZ,QAAQ,GAAG3B,SAAS,GAAGN,kBAAkB,CAACC,CAAC,EAAEC,CAAC,CAAE;AACzD4C,QAAAA,WAAW,EAAEb,QAAQ,GAAG3B,SAAS,GAAGC,iBAAkB;QACtDkB,GAAG,EAAA,aAAA,CAAA5D,MAAA,CAAgBoC,CAAC,OAAApC,MAAA,CAAIqC,CAAC,CAAG;AAC5BmB,QAAAA,IAAI,EAAC,UAAU;AACf,QAAA,WAAA,EAAWM,SAAU;QACrB,kBAAkB3F,EAAAA,IAAI,CAAC2D,UAAW;QAClC,UAAU3D,EAAAA,IAAI,CAAC0D,GAAI;QACnB,YAAYqD,EAAAA,MAAM,CAACpB,SAAS,CAAE;AAC9BO,QAAAA,gBAAgB,EAAEA,gBAAiB;AACnCc,QAAAA,cAAc,EAAEb,aAAc;QAC9Bc,mBAAmB,EAAA,IAAA;AAAA,OAAA,EAElBtB,SACc,CAAC,CAAA;AAE5B,KACJ,CACQ,CAAC,CAAA;AAAA,GAChB,CACgB,CAAC,CAAA;AAE9B;;;;"}
|
@@ -23,7 +23,7 @@ import { sizeToIconSize } from '../../Select/utils/sizeToIconSize.js';
|
|
23
23
|
import { getItemId } from './utils/getItemId.js';
|
24
24
|
import { Inner } from './ui/Inner/Inner.js';
|
25
25
|
|
26
|
-
var _excluded = ["multiple", "value", "onChange", "isTargetAmount", "items", "placement", "label", "placeholder", "helperText", "contentLeft", "textBefore", "textAfter", "variant", "listOverflow", "listHeight", "listWidth", "portal", "renderItem", "view", "size", "labelPlacement", "readOnly", "disabled", "alwaysOpened", "filter", "closeAfterSelect"];
|
26
|
+
var _excluded = ["multiple", "value", "onChange", "isTargetAmount", "items", "placement", "label", "placeholder", "helperText", "contentLeft", "textBefore", "textAfter", "variant", "listOverflow", "listHeight", "listWidth", "portal", "renderItem", "view", "size", "labelPlacement", "readOnly", "disabled", "alwaysOpened", "filter", "closeAfterSelect", "renderValue"];
|
27
27
|
var Context = /*#__PURE__*/createContext({});
|
28
28
|
|
29
29
|
/**
|
@@ -63,6 +63,7 @@ var comboboxRoot = function comboboxRoot(Root) {
|
|
63
63
|
alwaysOpened = _props$alwaysOpened === void 0 ? false : _props$alwaysOpened,
|
64
64
|
filter = props.filter,
|
65
65
|
outerCloseAfterSelect = props.closeAfterSelect,
|
66
|
+
renderValue = props.renderValue,
|
66
67
|
rest = _objectWithoutProperties(props, _excluded);
|
67
68
|
// Создаем структуры для быстрой работы с деревом
|
68
69
|
var _useMemo = useMemo(function () {
|
@@ -277,14 +278,17 @@ var comboboxRoot = function comboboxRoot(Root) {
|
|
277
278
|
}
|
278
279
|
};
|
279
280
|
var getChips = function getChips() {
|
280
|
-
if (multiple) {
|
281
|
+
if (multiple && Array.isArray(value)) {
|
281
282
|
if (value.length === 0) return [];
|
282
283
|
if (isTargetAmount) {
|
283
284
|
return ["\u0412\u044B\u0431\u0440\u0430\u043D\u043E ".concat(value.length)];
|
284
285
|
}
|
285
|
-
|
286
|
-
return valueToItemMap.get(
|
287
|
-
})
|
286
|
+
var mapper = renderValue && function (stringValue) {
|
287
|
+
return renderValue(valueToItemMap.get(stringValue));
|
288
|
+
} || function (stringValue) {
|
289
|
+
return valueToItemMap.get(stringValue).label;
|
290
|
+
};
|
291
|
+
return value.map(mapper);
|
288
292
|
}
|
289
293
|
return [];
|
290
294
|
};
|