@atlaskit/calendar
Version:
An interactive calendar for date selection experiences.
43 lines (42 loc) • 1.56 kB
JavaScript
import React, { memo } from 'react';
import Box from '@atlaskit/primitives/box';
import DateComponent from './date';
import WeekdayGrid from './week-day-grid';
var WeekDays = /*#__PURE__*/memo(function WeekDays(_ref) {
var weeks = _ref.weeks,
handleClickDay = _ref.handleClickDay,
monthsLong = _ref.monthsLong,
shouldSetFocus = _ref.shouldSetFocus,
tabIndex = _ref.tabIndex,
testId = _ref.testId;
return /*#__PURE__*/React.createElement(Box, {
role: "rowgroup",
testId: testId && "".concat(testId, "--month")
}, weeks.map(function (week, i) {
return /*#__PURE__*/React.createElement(WeekdayGrid, {
key: i,
testId: testId && "".concat(testId, "--week")
}, week.values.map(function (weekDay) {
return /*#__PURE__*/React.createElement(DateComponent, {
key: "".concat(week.id, "-").concat(weekDay.id),
isDisabled: weekDay.isDisabled,
isFocused: weekDay.isFocused,
isToday: weekDay.isToday,
dayLong: weekDay.weekDayName,
month: weekDay.month,
monthLong: monthsLong[weekDay.month - 1],
onClick: handleClickDay,
isPreviouslySelected: weekDay.isPreviouslySelected,
isSelected: weekDay.isSelected,
isSibling: weekDay.isSiblingMonth,
year: weekDay.year,
shouldSetFocus: shouldSetFocus,
tabIndex: tabIndex,
testId: testId
}, weekDay.day);
}));
}));
});
WeekDays.displayName = 'WeekDays';
// eslint-disable-next-line @repo/internal/react/require-jsdoc
export default WeekDays;