{"version":3,"file":"MonthCalendar.mjs","sources":["../../../src/dateLookup/monthCalendar/MonthCalendar.tsx"],"sourcesContent":["import { formatDate } from '@transferwise/formatting';\nimport { PureComponent } from 'react';\nimport { injectIntl, WrappedComponentProps } from 'react-intl';\n\nimport messages from '../DateLookup.messages';\nimport DateHeader from '../dateHeader';\n\nimport MonthCalendarTable from './table';\n\ninterface MonthCalendarProps extends WrappedComponentProps {\n  selectedDate: Date | null;\n  min: Date | null;\n  max: Date | null;\n  viewYear: number;\n  placeholder: string;\n  onSelect: () => void;\n  onLabelClick: () => void;\n  onViewDateUpdate: (date: { year?: number; month?: number }) => void;\n}\n\nclass MonthCalendar extends PureComponent<MonthCalendarProps> {\n  onMonthSelect = (month: number) => {\n    this.props.onViewDateUpdate({ month });\n    this.props.onSelect();\n  };\n\n  selectPreviousYear = () => {\n    this.props.onViewDateUpdate({ year: this.props.viewYear - 1 });\n  };\n\n  selectNextYear = () => {\n    this.props.onViewDateUpdate({ year: this.props.viewYear + 1 });\n  };\n\n  render() {\n    const {\n      selectedDate,\n      min,\n      max,\n      viewYear,\n      intl: { locale, formatMessage },\n      placeholder,\n      onLabelClick,\n    } = this.props;\n    return (\n      <>\n        <DateHeader\n          dateMode={formatMessage(messages.year)}\n          label={formatDate(new Date(viewYear, 0), locale, { year: 'numeric' })}\n          onLabelClick={onLabelClick}\n          onPreviousClick={this.selectPreviousYear}\n          onNextClick={this.selectNextYear}\n        />\n        <MonthCalendarTable\n          selectedDate={selectedDate}\n          min={min}\n          max={max}\n          viewYear={viewYear}\n          placeholder={placeholder}\n          onSelect={this.onMonthSelect}\n        />\n      </>\n    );\n  }\n}\n\nexport default injectIntl(MonthCalendar);\n"],"names":["MonthCalendar","PureComponent","onMonthSelect","month","props","onViewDateUpdate","onSelect","selectPreviousYear","year","viewYear","selectNextYear","render","selectedDate","min","max","intl","locale","formatMessage","placeholder","onLabelClick","_jsxs","_Fragment","children","_jsx","DateHeader","dateMode","messages","label","formatDate","Date","onPreviousCl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