@transferwise/components 0.0.0-experimental-ef0d459 → 0.0.0-experimental-a26af76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dateLookup/DateLookup.js +165 -26
- package/build/dateLookup/DateLookup.js.map +1 -1
- package/build/{calendarInput/CalendarInput.messages.js → dateLookup/DateLookup.messages.js} +1 -1
- package/build/dateLookup/DateLookup.messages.js.map +1 -0
- package/build/{calendarInput/CalendarInput.messages.mjs → dateLookup/DateLookup.messages.mjs} +1 -1
- package/build/dateLookup/DateLookup.messages.mjs.map +1 -0
- package/build/dateLookup/DateLookup.mjs +166 -27
- package/build/dateLookup/DateLookup.mjs.map +1 -1
- package/build/{calendarInput → dateLookup}/dateHeader/DateHeader.js +4 -4
- package/build/dateLookup/dateHeader/DateHeader.js.map +1 -0
- package/build/{calendarInput → dateLookup}/dateHeader/DateHeader.mjs +1 -1
- package/build/dateLookup/dateHeader/DateHeader.mjs.map +1 -0
- package/build/{calendarInput → dateLookup}/dayCalendar/DayCalendar.js +2 -2
- package/build/dateLookup/dayCalendar/DayCalendar.js.map +1 -0
- package/build/{calendarInput → dateLookup}/dayCalendar/DayCalendar.mjs +1 -1
- package/build/dateLookup/dayCalendar/DayCalendar.mjs.map +1 -0
- package/build/dateLookup/dayCalendar/table/DayCalendarTable.js.map +1 -0
- package/build/dateLookup/dayCalendar/table/DayCalendarTable.mjs.map +1 -0
- package/build/dateLookup/getFocusableTime/getFocusableTime.js.map +1 -0
- package/build/dateLookup/getFocusableTime/getFocusableTime.mjs.map +1 -0
- package/build/dateLookup/getStartOfDay/getStartOfDay.js.map +1 -0
- package/build/dateLookup/getStartOfDay/getStartOfDay.mjs.map +1 -0
- package/build/{calendarInput → dateLookup}/monthCalendar/MonthCalendar.js +2 -2
- package/build/dateLookup/monthCalendar/MonthCalendar.js.map +1 -0
- package/build/{calendarInput → dateLookup}/monthCalendar/MonthCalendar.mjs +1 -1
- package/build/dateLookup/monthCalendar/MonthCalendar.mjs.map +1 -0
- package/build/dateLookup/monthCalendar/table/MonthCalendarTable.js.map +1 -0
- package/build/dateLookup/monthCalendar/table/MonthCalendarTable.mjs.map +1 -0
- package/build/{calendarInput → dateLookup}/tableLink/TableLink.js +2 -2
- package/build/dateLookup/tableLink/TableLink.js.map +1 -0
- package/build/{calendarInput → dateLookup}/tableLink/TableLink.mjs +1 -1
- package/build/dateLookup/tableLink/TableLink.mjs.map +1 -0
- package/build/{calendarInput → dateLookup}/yearCalendar/YearCalendar.js +2 -2
- package/build/dateLookup/yearCalendar/YearCalendar.js.map +1 -0
- package/build/{calendarInput → dateLookup}/yearCalendar/YearCalendar.mjs +1 -1
- package/build/dateLookup/yearCalendar/YearCalendar.mjs.map +1 -0
- package/build/dateLookup/yearCalendar/table/YearCalendarTable.js.map +1 -0
- package/build/dateLookup/yearCalendar/table/YearCalendarTable.mjs.map +1 -0
- package/build/index.js +0 -2
- package/build/index.js.map +1 -1
- package/build/index.mjs +0 -1
- package/build/index.mjs.map +1 -1
- package/build/main.css +514 -569
- package/build/sentimentSurface/SentimentSurface.js +9 -2
- package/build/sentimentSurface/SentimentSurface.js.map +1 -1
- package/build/sentimentSurface/SentimentSurface.mjs +9 -2
- package/build/sentimentSurface/SentimentSurface.mjs.map +1 -1
- package/build/styles/css/neptune.css +11 -11
- package/build/styles/less/legacy-variables.less +1 -1
- package/build/styles/less/neptune-tokens.less +2 -2
- package/build/styles/main.css +514 -569
- package/build/styles/props/custom-media.css +1 -1
- package/build/styles/props/neptune-tokens.css +1 -1
- package/build/styles/sentimentSurface/SentimentSurface.css +325 -337
- package/build/styles/styles/less/neptune.css +11 -11
- package/build/types/dateLookup/DateLookup.d.ts +25 -2
- package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/{calendarInput/CalendarInput.messages.d.ts → dateLookup/DateLookup.messages.d.ts} +1 -1
- package/build/types/dateLookup/DateLookup.messages.d.ts.map +1 -0
- package/build/types/dateLookup/dateHeader/DateHeader.d.ts.map +1 -0
- package/build/types/dateLookup/dateHeader/index.d.ts.map +1 -0
- package/build/types/dateLookup/dayCalendar/DayCalendar.d.ts.map +1 -0
- package/build/types/dateLookup/dayCalendar/index.d.ts.map +1 -0
- package/build/types/dateLookup/dayCalendar/table/DayCalendarTable.d.ts.map +1 -0
- package/build/types/dateLookup/dayCalendar/table/index.d.ts.map +1 -0
- package/build/types/dateLookup/getFocusableTime/getFocusableTime.d.ts.map +1 -0
- package/build/types/dateLookup/getStartOfDay/getStartOfDay.d.ts.map +1 -0
- package/build/types/dateLookup/getStartOfDay/index.d.ts.map +1 -0
- package/build/types/dateLookup/monthCalendar/MonthCalendar.d.ts.map +1 -0
- package/build/types/dateLookup/monthCalendar/index.d.ts.map +1 -0
- package/build/types/dateLookup/monthCalendar/table/MonthCalendarTable.d.ts.map +1 -0
- package/build/types/dateLookup/monthCalendar/table/index.d.ts.map +1 -0
- package/build/types/dateLookup/tableLink/TableLink.d.ts.map +1 -0
- package/build/types/dateLookup/tableLink/index.d.ts.map +1 -0
- package/build/types/dateLookup/yearCalendar/YearCalendar.d.ts.map +1 -0
- package/build/types/dateLookup/yearCalendar/index.d.ts.map +1 -0
- package/build/types/dateLookup/yearCalendar/table/YearCalendarTable.d.ts.map +1 -0
- package/build/types/dateLookup/yearCalendar/table/index.d.ts.map +1 -0
- package/build/types/index.d.ts +0 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/sentimentSurface/SentimentSurface.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/criticalBanner/CriticalCommsBanner.test.tsx +1 -1
- package/src/dateLookup/DateLookup.tsx +157 -30
- package/src/{calendarInput → dateLookup}/dateHeader/DateHeader.tsx +1 -1
- package/src/{calendarInput → dateLookup}/dayCalendar/DayCalendar.tsx +1 -1
- package/src/{calendarInput → dateLookup}/monthCalendar/MonthCalendar.tsx +1 -1
- package/src/{calendarInput → dateLookup}/tableLink/TableLink.tsx +1 -1
- package/src/{calendarInput → dateLookup}/yearCalendar/YearCalendar.tsx +1 -1
- package/src/index.ts +0 -2
- package/src/main.css +514 -569
- package/src/sentimentSurface/SentimentSurface.css +325 -337
- package/src/sentimentSurface/SentimentSurface.docs.mdx +2 -0
- package/src/sentimentSurface/SentimentSurface.less +2 -322
- package/src/sentimentSurface/SentimentSurface.story.tsx +4 -0
- package/src/sentimentSurface/SentimentSurface.test.story.tsx +1 -5
- package/src/sentimentSurface/SentimentSurface.test.tsx +84 -3
- package/src/sentimentSurface/SentimentSurface.tsx +10 -2
- package/src/styles/less/neptune.css +11 -11
- package/build/calendarInput/CalendarInput.js +0 -154
- package/build/calendarInput/CalendarInput.js.map +0 -1
- package/build/calendarInput/CalendarInput.messages.js.map +0 -1
- package/build/calendarInput/CalendarInput.messages.mjs.map +0 -1
- package/build/calendarInput/CalendarInput.mjs +0 -150
- package/build/calendarInput/CalendarInput.mjs.map +0 -1
- package/build/calendarInput/dateHeader/DateHeader.js.map +0 -1
- package/build/calendarInput/dateHeader/DateHeader.mjs.map +0 -1
- package/build/calendarInput/dayCalendar/DayCalendar.js.map +0 -1
- package/build/calendarInput/dayCalendar/DayCalendar.mjs.map +0 -1
- package/build/calendarInput/dayCalendar/table/DayCalendarTable.js.map +0 -1
- package/build/calendarInput/dayCalendar/table/DayCalendarTable.mjs.map +0 -1
- package/build/calendarInput/getFocusableTime/getFocusableTime.js.map +0 -1
- package/build/calendarInput/getFocusableTime/getFocusableTime.mjs.map +0 -1
- package/build/calendarInput/getStartOfDay/getStartOfDay.js.map +0 -1
- package/build/calendarInput/getStartOfDay/getStartOfDay.mjs.map +0 -1
- package/build/calendarInput/monthCalendar/MonthCalendar.js.map +0 -1
- package/build/calendarInput/monthCalendar/MonthCalendar.mjs.map +0 -1
- package/build/calendarInput/monthCalendar/table/MonthCalendarTable.js.map +0 -1
- package/build/calendarInput/monthCalendar/table/MonthCalendarTable.mjs.map +0 -1
- package/build/calendarInput/tableLink/TableLink.js.map +0 -1
- package/build/calendarInput/tableLink/TableLink.mjs.map +0 -1
- package/build/calendarInput/yearCalendar/YearCalendar.js.map +0 -1
- package/build/calendarInput/yearCalendar/YearCalendar.mjs.map +0 -1
- package/build/calendarInput/yearCalendar/table/YearCalendarTable.js.map +0 -1
- package/build/calendarInput/yearCalendar/table/YearCalendarTable.mjs.map +0 -1
- package/build/types/calendarInput/CalendarInput.d.ts +0 -12
- package/build/types/calendarInput/CalendarInput.d.ts.map +0 -1
- package/build/types/calendarInput/CalendarInput.messages.d.ts.map +0 -1
- package/build/types/calendarInput/dateHeader/DateHeader.d.ts.map +0 -1
- package/build/types/calendarInput/dateHeader/index.d.ts.map +0 -1
- package/build/types/calendarInput/dayCalendar/DayCalendar.d.ts.map +0 -1
- package/build/types/calendarInput/dayCalendar/index.d.ts.map +0 -1
- package/build/types/calendarInput/dayCalendar/table/DayCalendarTable.d.ts.map +0 -1
- package/build/types/calendarInput/dayCalendar/table/index.d.ts.map +0 -1
- package/build/types/calendarInput/getFocusableTime/getFocusableTime.d.ts.map +0 -1
- package/build/types/calendarInput/getStartOfDay/getStartOfDay.d.ts.map +0 -1
- package/build/types/calendarInput/getStartOfDay/index.d.ts.map +0 -1
- package/build/types/calendarInput/index.d.ts +0 -3
- package/build/types/calendarInput/index.d.ts.map +0 -1
- package/build/types/calendarInput/monthCalendar/MonthCalendar.d.ts.map +0 -1
- package/build/types/calendarInput/monthCalendar/index.d.ts.map +0 -1
- package/build/types/calendarInput/monthCalendar/table/MonthCalendarTable.d.ts.map +0 -1
- package/build/types/calendarInput/monthCalendar/table/index.d.ts.map +0 -1
- package/build/types/calendarInput/tableLink/TableLink.d.ts.map +0 -1
- package/build/types/calendarInput/tableLink/index.d.ts.map +0 -1
- package/build/types/calendarInput/yearCalendar/YearCalendar.d.ts.map +0 -1
- package/build/types/calendarInput/yearCalendar/index.d.ts.map +0 -1
- package/build/types/calendarInput/yearCalendar/table/YearCalendarTable.d.ts.map +0 -1
- package/build/types/calendarInput/yearCalendar/table/index.d.ts.map +0 -1
- package/src/calendarInput/CalendarInput.story.tsx +0 -57
- package/src/calendarInput/CalendarInput.tsx +0 -163
- package/src/calendarInput/index.ts +0 -2
- /package/build/{calendarInput → dateLookup}/dayCalendar/table/DayCalendarTable.js +0 -0
- /package/build/{calendarInput → dateLookup}/dayCalendar/table/DayCalendarTable.mjs +0 -0
- /package/build/{calendarInput → dateLookup}/getFocusableTime/getFocusableTime.js +0 -0
- /package/build/{calendarInput → dateLookup}/getFocusableTime/getFocusableTime.mjs +0 -0
- /package/build/{calendarInput → dateLookup}/getStartOfDay/getStartOfDay.js +0 -0
- /package/build/{calendarInput → dateLookup}/getStartOfDay/getStartOfDay.mjs +0 -0
- /package/build/{calendarInput → dateLookup}/monthCalendar/table/MonthCalendarTable.js +0 -0
- /package/build/{calendarInput → dateLookup}/monthCalendar/table/MonthCalendarTable.mjs +0 -0
- /package/build/{calendarInput → dateLookup}/yearCalendar/table/YearCalendarTable.js +0 -0
- /package/build/{calendarInput → dateLookup}/yearCalendar/table/YearCalendarTable.mjs +0 -0
- /package/build/types/{calendarInput → dateLookup}/dateHeader/DateHeader.d.ts +0 -0
- /package/build/types/{calendarInput → dateLookup}/dateHeader/index.d.ts +0 -0
- /package/build/types/{calendarInput → dateLookup}/dayCalendar/DayCalendar.d.ts +0 -0
- /package/build/types/{calendarInput → dateLookup}/dayCalendar/index.d.ts +0 -0
- /package/build/types/{calendarInput → dateLookup}/dayCalendar/table/DayCalendarTable.d.ts +0 -0
- /package/build/types/{calendarInput → dateLookup}/dayCalendar/table/index.d.ts +0 -0
- /package/build/types/{calendarInput → dateLookup}/getFocusableTime/getFocusableTime.d.ts +0 -0
- /package/build/types/{calendarInput → dateLookup}/getStartOfDay/getStartOfDay.d.ts +0 -0
- /package/build/types/{calendarInput → dateLookup}/getStartOfDay/index.d.ts +0 -0
- /package/build/types/{calendarInput → dateLookup}/monthCalendar/MonthCalendar.d.ts +0 -0
- /package/build/types/{calendarInput → dateLookup}/monthCalendar/index.d.ts +0 -0
- /package/build/types/{calendarInput → dateLookup}/monthCalendar/table/MonthCalendarTable.d.ts +0 -0
- /package/build/types/{calendarInput → dateLookup}/monthCalendar/table/index.d.ts +0 -0
- /package/build/types/{calendarInput → dateLookup}/tableLink/TableLink.d.ts +0 -0
- /package/build/types/{calendarInput → dateLookup}/tableLink/index.d.ts +0 -0
- /package/build/types/{calendarInput → dateLookup}/yearCalendar/YearCalendar.d.ts +0 -0
- /package/build/types/{calendarInput → dateLookup}/yearCalendar/index.d.ts +0 -0
- /package/build/types/{calendarInput → dateLookup}/yearCalendar/table/YearCalendarTable.d.ts +0 -0
- /package/build/types/{calendarInput → dateLookup}/yearCalendar/table/index.d.ts +0 -0
- /package/src/{calendarInput/CalendarInput.messages.ts → dateLookup/DateLookup.messages.ts} +0 -0
- /package/src/{calendarInput → dateLookup}/dateHeader/index.ts +0 -0
- /package/src/{calendarInput → dateLookup}/dayCalendar/index.ts +0 -0
- /package/src/{calendarInput → dateLookup}/dayCalendar/table/DayCalendarTable.tsx +0 -0
- /package/src/{calendarInput → dateLookup}/dayCalendar/table/index.ts +0 -0
- /package/src/{calendarInput → dateLookup}/getFocusableTime/getFocusable.test.ts +0 -0
- /package/src/{calendarInput → dateLookup}/getFocusableTime/getFocusableTime.tsx +0 -0
- /package/src/{calendarInput → dateLookup}/getStartOfDay/getStartOfDay.test.js +0 -0
- /package/src/{calendarInput → dateLookup}/getStartOfDay/getStartOfDay.tsx +0 -0
- /package/src/{calendarInput → dateLookup}/getStartOfDay/index.ts +0 -0
- /package/src/{calendarInput → dateLookup}/monthCalendar/index.ts +0 -0
- /package/src/{calendarInput → dateLookup}/monthCalendar/table/MonthCalendarTable.tsx +0 -0
- /package/src/{calendarInput → dateLookup}/monthCalendar/table/index.ts +0 -0
- /package/src/{calendarInput → dateLookup}/tableLink/index.ts +0 -0
- /package/src/{calendarInput → dateLookup}/yearCalendar/index.ts +0 -0
- /package/src/{calendarInput → dateLookup}/yearCalendar/table/YearCalendarTable.tsx +0 -0
- /package/src/{calendarInput → dateLookup}/yearCalendar/table/index.ts +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"YearCalendar.mjs","sources":["../../../src/calendarInput/yearCalendar/YearCalendar.tsx"],"sourcesContent":["import { PureComponent } from 'react';\nimport { injectIntl, WrappedComponentProps } from 'react-intl';\n\nimport messages from '../CalendarInput.messages';\nimport DateHeader from '../dateHeader';\n\nimport YearCalendarTable from './table';\n\ninterface YearCalendarProps extends WrappedComponentProps {\n selectedDate: Date | null;\n min: Date | null;\n max: Date | null;\n viewYear: number;\n placeholder: string;\n onSelect: () => void;\n onViewDateUpdate: (date: { year: number }) => void;\n}\n\nclass YearCalendar extends PureComponent<YearCalendarProps> {\n onYearSelect = (year: number) => {\n this.props.onViewDateUpdate({ year });\n this.props.onSelect();\n };\n\n selectPreviousYears = () => {\n this.props.onViewDateUpdate({ year: this.props.viewYear - 20 });\n };\n\n selectNextYears = () => {\n this.props.onViewDateUpdate({ year: this.props.viewYear + 20 });\n };\n\n render() {\n const {\n selectedDate,\n min,\n max,\n viewYear,\n placeholder,\n intl: { formatMessage },\n } = this.props;\n return (\n <>\n <DateHeader\n dateMode={formatMessage(messages.twentyYears)}\n onPreviousClick={this.selectPreviousYears}\n onNextClick={this.selectNextYears}\n />\n <YearCalendarTable\n selectedDate={selectedDate}\n min={min}\n max={max}\n viewYear={viewYear}\n placeholder={placeholder}\n onSelect={this.onYearSelect}\n />\n </>\n );\n }\n}\n\nexport default injectIntl(YearCalendar);\n"],"names":["YearCalendar","PureComponent","onYearSelect","year","props","onViewDateUpdate","onSelect","selectPreviousYears","viewYear","selectNextYears","render","selectedDate","min","max","placeholder","intl","formatMessage","_jsxs","_Fragment","children","_jsx","DateHeader","dateMode","messages","twentyYears","onPreviousClick","onNextClick","YearCalendarTable","injectIntl"],"mappings":";;;;;;;AAkBA,MAAMA,YAAa,SAAQC,aAAgC,CAAA;EACzDC,YAAY,GAAIC,IAAY,IAAI;AAC9B,IAAA,IAAI,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;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"YearCalendarTable.js","sources":["../../../../src/calendarInput/yearCalendar/table/YearCalendarTable.tsx"],"sourcesContent":["import { formatDate } from '@transferwise/formatting';\nimport { useIntl } from 'react-intl';\n\nimport { getFocusableTime } from '../../getFocusableTime/getFocusableTime';\nimport TableLink from '../../tableLink';\n\ninterface YearCalendarTableProps {\n selectedDate: Date | null;\n min: Date | null;\n max: Date | null;\n viewYear: number;\n placeholder: string;\n onSelect: (year: number) => void;\n}\n\nconst ROWS = 5;\nconst COLS = 4;\nconst YEAR_ONLY_FORMAT: Intl.DateTimeFormatOptions = { year: 'numeric' };\n\nconst YearCalendarTable = ({\n selectedDate,\n min,\n max,\n viewYear,\n placeholder,\n onSelect,\n}: YearCalendarTableProps) => {\n const { locale } = useIntl();\n const startYear = viewYear - (viewYear % 20);\n const getLink = (year: number) => {\n return (\n <TableLink\n item={year}\n type=\"year\"\n title={formatDate(new Date(year, 0), locale, YEAR_ONLY_FORMAT)}\n active={isActive(year)}\n disabled={isDisabled(year)}\n today={isThisYear(year)}\n autofocus={autofocusYear === year}\n onClick={onSelect}\n />\n );\n };\n\n const isActive = (year: number) => {\n return !!(year === selectedDate?.getFullYear());\n };\n\n const isThisYear = (year: number) => {\n return year === new Date().getFullYear();\n };\n\n const isDisabled = (year: number) => {\n return !!((min && year < min.getFullYear()) || (max && year > max.getFullYear()));\n };\n\n const autofocusYear = (() => {\n const years = Array.from({ length: ROWS * COLS }, (_, index) => startYear + index);\n return getFocusableTime({ isActive, isNow: isThisYear, isDisabled, timeSpan: years });\n })();\n\n return (\n <table className=\"table table-condensed table-bordered tw-date-lookup-calendar m-b-0\">\n <thead className=\"sr-only\">\n <tr>\n <th colSpan={COLS}>{placeholder}</th>\n </tr>\n </thead>\n <tbody>\n {Array.from({ length: ROWS }, (_, rowIndex) => (\n <tr key={rowIndex}>\n {Array.from({ length: COLS }, (_, colIndex) => (\n <td key={colIndex}>{getLink(startYear + rowIndex * COLS + colIndex)}</td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\nexport default YearCalendarTable;\n"],"names":["ROWS","COLS","YEAR_ONLY_FORMAT","year","YearCalendarTable","selectedDate","min","max","viewYear","placeholder","onSelect","locale","useIntl","startYear","getLink","_jsx","TableLink","item","type","title","formatDate","Date","active","isActive","disabled","isDisabled","today","isThisYear","autofocus","autofocusYear","onClick","getFullYear","years","Array","from","length","_","index","getFocusableTime","isNow","timeSpan","_jsxs","className","children","colSpan","rowIndex","colIndex"],"mappings":";;;;;;;;;;AAeA,MAAMA,IAAI,GAAG,CAAC;AACd,MAAMC,IAAI,GAAG,CAAC;AACd,MAAMC,gBAAgB,GAA+B;AAAEC,EAAAA,IAAI,EAAE;CAAW;AAExE,MAAMC,iBAAiB,GAAGA,CAAC;EACzBC,YAAY;EACZC,GAAG;EACHC,GAAG;EACHC,QAAQ;EACRC,WAAW;AACXC,EAAAA;AAAQ,CACe,KAAI;EAC3B,MAAM;AAAEC,IAAAA;GAAQ,GAAGC,iBAAO,EAAE;AAC5B,EAAA,MAAMC,SAAS,GAAGL,QAAQ,GAAIA,QAAQ,GAAG,EAAG;EAC5C,MAAMM,OAAO,GAAIX,IAAY,IAAI;IAC/B,oBACEY,cAAA,CAACC,iBAAS,EAAA;AACRC,MAAAA,IAAI,EAAEd,IAAK;AACXe,MAAAA,IAAI,EAAC,MAAM;AACXC,MAAAA,KAAK,EAAEC,qBAAU,CAAC,IAAIC,IAAI,CAAClB,IAAI,EAAE,CAAC,CAAC,EAAEQ,MAAM,EAAET,gBAAgB,CAAE;AAC/DoB,MAAAA,MAAM,EAAEC,QAAQ,CAACpB,IAAI,CAAE;AACvBqB,MAAAA,QAAQ,EAAEC,UAAU,CAACtB,IAAI,CAAE;AAC3BuB,MAAAA,KAAK,EAAEC,UAAU,CAACxB,IAAI,CAAE;MACxByB,SAAS,EAAEC,aAAa,KAAK1B,IAAK;AAClC2B,MAAAA,OAAO,EAAE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4B,MAAAA,QAAA,EACGV,KAAK,CAACC,IAAI,CAAC;AAAEC,QAAAA,MAAM,EAAEnC;AAAI,OAAE,EAAE,CAACoC,CAAC,EAAES,QAAQ,kBACxC9B,cAAA,CAAA,IAAA,EAAA;AAAA4B,QAAAA,QAAA,EACGV,KAAK,CAACC,IAAI,CAAC;AAAEC,UAAAA,MAAM,EAAElC;AAAI,SAAE,EAAE,CAACmC,CAAC,EAAEU,QAAQ,kBACxC/B,cAAA,CAAA,IAAA,EAAA;UAAA4B,QAAA,EAAoB7B,OAAO,CAACD,SAAS,GAAGgC,QAAQ,GAAG5C,IAAI,GAAG6C,QAAQ;AAAC,SAAA,EAA1DA,QAA+D,CACzE;AAAC,OAAA,EAHKD,QAIL,CACL;AAAC,KACG,CACT;AAAA,GAAO,CAAC;AAEZ;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"YearCalendarTable.mjs","sources":["../../../../src/calendarInput/yearCalendar/table/YearCalendarTable.tsx"],"sourcesContent":["import { formatDate } from '@transferwise/formatting';\nimport { useIntl } from 'react-intl';\n\nimport { getFocusableTime } from '../../getFocusableTime/getFocusableTime';\nimport TableLink from '../../tableLink';\n\ninterface YearCalendarTableProps {\n selectedDate: Date | null;\n min: Date | null;\n max: Date | null;\n viewYear: number;\n placeholder: string;\n onSelect: (year: number) => void;\n}\n\nconst ROWS = 5;\nconst COLS = 4;\nconst YEAR_ONLY_FORMAT: Intl.DateTimeFormatOptions = { year: 'numeric' };\n\nconst YearCalendarTable = ({\n selectedDate,\n min,\n max,\n viewYear,\n placeholder,\n onSelect,\n}: YearCalendarTableProps) => {\n const { locale } = useIntl();\n const startYear = viewYear - (viewYear % 20);\n const getLink = (year: number) => {\n return (\n <TableLink\n item={year}\n type=\"year\"\n title={formatDate(new Date(year, 0), locale, YEAR_ONLY_FORMAT)}\n active={isActive(year)}\n disabled={isDisabled(year)}\n today={isThisYear(year)}\n autofocus={autofocusYear === year}\n onClick={onSelect}\n />\n );\n };\n\n const isActive = (year: number) => {\n return !!(year === selectedDate?.getFullYear());\n };\n\n const isThisYear = (year: number) => {\n return year === new Date().getFullYear();\n };\n\n const isDisabled = (year: number) => {\n return !!((min && year < min.getFullYear()) || (max && year > max.getFullYear()));\n };\n\n const autofocusYear = (() => {\n const years = Array.from({ length: ROWS * COLS }, (_, index) => startYear + index);\n return getFocusableTime({ isActive, isNow: isThisYear, isDisabled, timeSpan: years });\n })();\n\n return (\n <table className=\"table table-condensed table-bordered tw-date-lookup-calendar m-b-0\">\n <thead className=\"sr-only\">\n <tr>\n <th colSpan={COLS}>{placeholder}</th>\n </tr>\n </thead>\n <tbody>\n {Array.from({ length: ROWS }, (_, rowIndex) => (\n <tr key={rowIndex}>\n {Array.from({ length: COLS }, (_, colIndex) => (\n <td key={colIndex}>{getLink(startYear + rowIndex * COLS + colIndex)}</td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\nexport default YearCalendarTable;\n"],"names":["ROWS","COLS","YEAR_ONLY_FORMAT","year","YearCalendarTable","selectedDate","min","max","viewYear","placeholder","onSelect","locale","useIntl","startYear","getLink","_jsx","TableLink","item","type","title","formatDate","Date","active","isActive","disabled","isDisabled","today","isThisYear","autofocus","autofocusYear","onClick","getFullYear","years","Array","from","length","_","index","getFocusableTime","isNow","timeSpan","_jsxs","className","children","colSpan","rowIndex","colIndex"],"mappings":";;;;;;AAeA,MAAMA,IAAI,GAAG,CAAC;AACd,MAAMC,IAAI,GAAG,CAAC;AACd,MAAMC,gBAAgB,GAA+B;AAAEC,EAAAA,IAAI,EAAE;CAAW;AAExE,MAAMC,iBAAiB,GAAGA,CAAC;EACzBC,YAAY;EACZC,GAAG;EACHC,GAAG;EACHC,QAAQ;EACRC,WAAW;AACXC,EAAAA;AAAQ,CACe,KAAI;EAC3B,MAAM;AAAEC,IAAAA;GAAQ,GAAGC,OAAO,EAAE;AAC5B,EAAA,MAAMC,SAAS,GAAGL,QAAQ,GAAIA,QAAQ,GAAG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A,KAAK,EAAEZ,UAAU;MAAEF,UAAU;AAAEe,MAAAA,QAAQ,EAAER;AAAK,KAAE,CAAC;AACvF,EAAA,CAAC,GAAG;AAEJ,EAAA,oBACES,IAAA,CAAA,OAAA,EAAA;AAAOC,IAAAA,SAAS,EAAC,oEAAoE;AAAAC,IAAAA,QAAA,gBACnF5B,GAAA,CAAA,OAAA,EAAA;AAAO2B,MAAAA,SAAS,EAAC,SAAS;AAAAC,MAAAA,QAAA,eACxB5B,GAAA,CAAA,IAAA,EAAA;AAAA4B,QAAAA,QAAA,eACE5B,GAAA,CAAA,IAAA,EAAA;AAAI6B,UAAAA,OAAO,EAAE3C,IAAK;AAAA0C,UAAAA,QAAA,EAAElC;SAAgB;OAClC;KACC,CACP,eAAAM,GAAA,CAAA,OAAA,EAAA;AAAA4B,MAAAA,QAAA,EACGV,KAAK,CAACC,IAAI,CAAC;AAAEC,QAAAA,MAAM,EAAEnC;AAAI,OAAE,EAAE,CAACoC,CAAC,EAAES,QAAQ,kBACxC9B,GAAA,CAAA,IAAA,EAAA;AAAA4B,QAAAA,QAAA,EACGV,KAAK,CAACC,IAAI,CAAC;AAAEC,UAAAA,MAAM,EAAElC;AAAI,SAAE,EAAE,CAACmC,CAAC,EAAEU,QAAQ,kBACxC/B,GAAA,CAAA,IAAA,EAAA;UAAA4B,QAAA,EAAoB7B,OAAO,CAACD,SAAS,GAAGgC,QAAQ,GAAG5C,IAAI,GAAG6C,QAAQ;AAAC,SAAA,EAA1DA,QAA+D,CACzE;AAAC,OAAA,EAHKD,QAIL,CACL;AAAC,KACG,CACT;AAAA,GAAO,CAAC;AAEZ;;;;"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { MonthFormat } from '../common';
|
|
2
|
-
export interface CalendarInputProps {
|
|
3
|
-
value: Date | null;
|
|
4
|
-
min?: Date | null;
|
|
5
|
-
max?: Date | null;
|
|
6
|
-
monthFormat?: `${MonthFormat}`;
|
|
7
|
-
onChange: (date: Date | null) => void;
|
|
8
|
-
onSelect?: (date: Date) => void;
|
|
9
|
-
}
|
|
10
|
-
declare const CalendarInput: ({ value, min: minProp, max: maxProp, monthFormat, onChange, onSelect, }: CalendarInputProps) => import("react").JSX.Element;
|
|
11
|
-
export default CalendarInput;
|
|
12
|
-
//# sourceMappingURL=CalendarInput.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CalendarInput.d.ts","sourceRoot":"","sources":["../../../src/calendarInput/CalendarInput.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAOxC,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,GAAG,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,GAAG,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,WAAW,CAAC,EAAE,GAAG,WAAW,EAAE,CAAC;IAC/B,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,CAAC;IACtC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;CACjC;AAED,QAAA,MAAM,aAAa,GAAI,yEAOpB,kBAAkB,gCAuIpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CalendarInput.messages.d.ts","sourceRoot":"","sources":["../../../src/calendarInput/CalendarInput.messages.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,wBAyCG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DateHeader.d.ts","sourceRoot":"","sources":["../../../../src/calendarInput/dateHeader/DateHeader.tsx"],"names":[],"mappings":"AAWA,UAAU,eAAe;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAmDzC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/calendarInput/dateHeader/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DayCalendar.d.ts","sourceRoot":"","sources":["../../../../src/calendarInput/dayCalendar/DayCalendar.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAM3C,UAAU,gBAAiB,SAAQ,qBAAqB;IACtD,YAAY,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,GAAG,EAAE,IAAI,GAAG,IAAI,CAAC;IACjB,GAAG,EAAE,IAAI,GAAG,IAAI,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,GAAG,WAAW,EAAE,CAAC;IAC9B,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAC/B,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,gBAAgB,EAAE,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACnE;;;;AAiDD,wBAAuC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/calendarInput/dayCalendar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DayCalendarTable.d.ts","sourceRoot":"","sources":["../../../../../src/calendarInput/dayCalendar/table/DayCalendarTable.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,qBAAqB,EAAE,MAAM,YAAY,CAAC;AASpE,UAAU,qBAAsB,SAAQ,qBAAqB;IAC3D,YAAY,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,GAAG,EAAE,IAAI,GAAG,IAAI,CAAC;IACjB,GAAG,EAAE,IAAI,GAAG,IAAI,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;CAChC;;;;AA0ID,wBAA4C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/calendarInput/dayCalendar/table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getFocusableTime.d.ts","sourceRoot":"","sources":["../../../../src/calendarInput/getFocusableTime/getFocusableTime.tsx"],"names":[],"mappings":"AAAA,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACpC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACjC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACtC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,GAAG,SAAS,CAM9E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getStartOfDay.d.ts","sourceRoot":"","sources":["../../../../src/calendarInput/getStartOfDay/getStartOfDay.tsx"],"names":[],"mappings":"AAIA,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,eAK9C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/calendarInput/getStartOfDay/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/calendarInput/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MonthCalendar.d.ts","sourceRoot":"","sources":["../../../../src/calendarInput/monthCalendar/MonthCalendar.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAO/D,UAAU,kBAAmB,SAAQ,qBAAqB;IACxD,YAAY,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,GAAG,EAAE,IAAI,GAAG,IAAI,CAAC;IACjB,GAAG,EAAE,IAAI,GAAG,IAAI,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,gBAAgB,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACrE;;;;AAgDD,wBAAyC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/calendarInput/monthCalendar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MonthCalendarTable.d.ts","sourceRoot":"","sources":["../../../../../src/calendarInput/monthCalendar/table/MonthCalendarTable.tsx"],"names":[],"mappings":"AAMA,UAAU,uBAAuB;IAC/B,YAAY,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,GAAG,EAAE,IAAI,GAAG,IAAI,CAAC;IACjB,GAAG,EAAE,IAAI,GAAG,IAAI,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAMD,QAAA,MAAM,kBAAkB,GAAI,8DAOzB,uBAAuB,gCAyDzB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/calendarInput/monthCalendar/table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TableLink.d.ts","sourceRoot":"","sources":["../../../../src/calendarInput/tableLink/TableLink.tsx"],"names":[],"mappings":"AAMA,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAED,QAAA,MAAM,SAAS,GAAI,gFAUhB,cAAc,gCA8ChB,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/calendarInput/tableLink/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"YearCalendar.d.ts","sourceRoot":"","sources":["../../../../src/calendarInput/yearCalendar/YearCalendar.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAO/D,UAAU,iBAAkB,SAAQ,qBAAqB;IACvD,YAAY,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,GAAG,EAAE,IAAI,GAAG,IAAI,CAAC;IACjB,GAAG,EAAE,IAAI,GAAG,IAAI,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,gBAAgB,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACpD;;;;AA6CD,wBAAwC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/calendarInput/yearCalendar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"YearCalendarTable.d.ts","sourceRoot":"","sources":["../../../../../src/calendarInput/yearCalendar/table/YearCalendarTable.tsx"],"names":[],"mappings":"AAMA,UAAU,sBAAsB;IAC9B,YAAY,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,GAAG,EAAE,IAAI,GAAG,IAAI,CAAC;IACjB,GAAG,EAAE,IAAI,GAAG,IAAI,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAMD,QAAA,MAAM,iBAAiB,GAAI,8DAOxB,sBAAsB,gCAqDxB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/calendarInput/yearCalendar/table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import { StoryObj } from '@storybook/react-webpack5';
|
|
3
|
-
import CalendarInput, { type CalendarInputProps } from './CalendarInput';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
component: CalendarInput,
|
|
7
|
-
title: 'Forms/CalendarInput',
|
|
8
|
-
argTypes: {
|
|
9
|
-
monthFormat: { control: 'select', options: ['long', 'short'] },
|
|
10
|
-
min: { control: 'date' },
|
|
11
|
-
max: { control: 'date' },
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
type Story = StoryObj<typeof CalendarInput>;
|
|
16
|
-
|
|
17
|
-
const epoch = new Date('2011-01-01');
|
|
18
|
-
const theFuture = new Date(epoch);
|
|
19
|
-
theFuture.setUTCDate(epoch.getUTCDate() + 10);
|
|
20
|
-
const thePast = new Date(epoch);
|
|
21
|
-
thePast.setUTCDate(epoch.getUTCDate() - 10);
|
|
22
|
-
|
|
23
|
-
export const Basic: Story = {
|
|
24
|
-
render: (args: CalendarInputProps) => {
|
|
25
|
-
const [value, setValue] = useState<Date | null>(epoch);
|
|
26
|
-
return (
|
|
27
|
-
<CalendarInput
|
|
28
|
-
{...args}
|
|
29
|
-
min={args.min ? new Date(args.min) : thePast}
|
|
30
|
-
max={args.max ? new Date(args.max) : theFuture}
|
|
31
|
-
value={value}
|
|
32
|
-
onChange={(v) => setValue(v)}
|
|
33
|
-
/>
|
|
34
|
-
);
|
|
35
|
-
},
|
|
36
|
-
args: {
|
|
37
|
-
monthFormat: 'long',
|
|
38
|
-
min: thePast,
|
|
39
|
-
max: theFuture,
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const WithoutConstraints: Story = {
|
|
44
|
-
render: () => {
|
|
45
|
-
const [value, setValue] = useState<Date | null>(new Date());
|
|
46
|
-
return <CalendarInput value={value} onChange={(v) => setValue(v)} />;
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export const NullValue: Story = {
|
|
51
|
-
render: () => {
|
|
52
|
-
const [value, setValue] = useState<Date | null>(null);
|
|
53
|
-
return (
|
|
54
|
-
<CalendarInput value={value} min={thePast} max={theFuture} onChange={(v) => setValue(v)} />
|
|
55
|
-
);
|
|
56
|
-
},
|
|
57
|
-
};
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { useState, useCallback, useEffect, KeyboardEvent } from 'react';
|
|
2
|
-
|
|
3
|
-
import { MonthFormat } from '../common';
|
|
4
|
-
import { isWithinRange, moveToWithinRange, returnDateView } from '../common/dateUtils';
|
|
5
|
-
import DayCalendar from './dayCalendar';
|
|
6
|
-
import { getStartOfDay } from './getStartOfDay';
|
|
7
|
-
import MonthCalendar from './monthCalendar';
|
|
8
|
-
import YearCalendar from './yearCalendar';
|
|
9
|
-
|
|
10
|
-
export interface CalendarInputProps {
|
|
11
|
-
value: Date | null;
|
|
12
|
-
min?: Date | null;
|
|
13
|
-
max?: Date | null;
|
|
14
|
-
monthFormat?: `${MonthFormat}`;
|
|
15
|
-
onChange: (date: Date | null) => void;
|
|
16
|
-
onSelect?: (date: Date) => void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const CalendarInput = ({
|
|
20
|
-
value,
|
|
21
|
-
min: minProp = null,
|
|
22
|
-
max: maxProp = null,
|
|
23
|
-
monthFormat = MonthFormat.LONG,
|
|
24
|
-
onChange,
|
|
25
|
-
onSelect,
|
|
26
|
-
}: CalendarInputProps) => {
|
|
27
|
-
const selectedDate = getStartOfDay(value);
|
|
28
|
-
const min = getStartOfDay(minProp);
|
|
29
|
-
const max = getStartOfDay(maxProp);
|
|
30
|
-
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
if (selectedDate && !isWithinRange(selectedDate, min, max)) {
|
|
33
|
-
onChange(moveToWithinRange(selectedDate, min, max));
|
|
34
|
-
}
|
|
35
|
-
}, [selectedDate?.getTime(), min?.getTime(), max?.getTime(), onChange]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
36
|
-
|
|
37
|
-
const dateView = returnDateView(selectedDate, min, max);
|
|
38
|
-
const [viewMonth, setViewMonth] = useState(dateView.getMonth());
|
|
39
|
-
const [viewYear, setViewYear] = useState(dateView.getFullYear());
|
|
40
|
-
const [mode, setMode] = useState<'day' | 'month' | 'year'>('day');
|
|
41
|
-
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
const view = returnDateView(selectedDate, min, max);
|
|
44
|
-
// eslint-disable-next-line react-hooks/set-state-in-effect
|
|
45
|
-
setViewMonth(view.getMonth());
|
|
46
|
-
|
|
47
|
-
setViewYear(view.getFullYear());
|
|
48
|
-
}, [selectedDate?.getTime(), min?.getTime(), max?.getTime()]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
49
|
-
|
|
50
|
-
const handleViewDateUpdate = useCallback(
|
|
51
|
-
// eslint-disable-next-line react-hooks/preserve-manual-memoization
|
|
52
|
-
({ month, year }: { month?: number; year?: number }) => {
|
|
53
|
-
if (month !== undefined) setViewMonth(month);
|
|
54
|
-
if (year !== undefined) setViewYear(year);
|
|
55
|
-
},
|
|
56
|
-
[],
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
const switchToDays = useCallback(() => setMode('day'), []);
|
|
60
|
-
const switchToMonths = useCallback(() => setMode('month'), []);
|
|
61
|
-
const switchToYears = useCallback(() => setMode('year'), []);
|
|
62
|
-
|
|
63
|
-
const handleSelectedDateUpdate = useCallback(
|
|
64
|
-
(date: Date) => {
|
|
65
|
-
if (onSelect) {
|
|
66
|
-
onSelect(date);
|
|
67
|
-
} else {
|
|
68
|
-
onChange(date);
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
[onChange, onSelect],
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
const adjustDate = useCallback(
|
|
75
|
-
(daysToAdd: number, monthsToAdd: number, yearsToAdd: number) => {
|
|
76
|
-
let date: Date | null;
|
|
77
|
-
if (selectedDate) {
|
|
78
|
-
date = new Date(
|
|
79
|
-
mode === 'year' ? selectedDate.getFullYear() + yearsToAdd : selectedDate.getFullYear(),
|
|
80
|
-
mode === 'month' ? selectedDate.getMonth() + monthsToAdd : selectedDate.getMonth(),
|
|
81
|
-
mode === 'day' ? selectedDate.getDate() + daysToAdd : selectedDate.getDate(),
|
|
82
|
-
);
|
|
83
|
-
} else {
|
|
84
|
-
date = getStartOfDay(new Date());
|
|
85
|
-
}
|
|
86
|
-
date &&= moveToWithinRange(date, min, max);
|
|
87
|
-
if (date?.getTime() !== selectedDate?.getTime()) {
|
|
88
|
-
onChange(date);
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
[selectedDate, min, max, mode, onChange],
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
const handleKeyDown = useCallback(
|
|
95
|
-
(event: KeyboardEvent<HTMLDivElement>) => {
|
|
96
|
-
switch (event.key) {
|
|
97
|
-
case 'ArrowLeft':
|
|
98
|
-
adjustDate(-1, -1, -1);
|
|
99
|
-
event.preventDefault();
|
|
100
|
-
break;
|
|
101
|
-
case 'ArrowUp':
|
|
102
|
-
adjustDate(-7, -4, -4);
|
|
103
|
-
event.preventDefault();
|
|
104
|
-
break;
|
|
105
|
-
case 'ArrowRight':
|
|
106
|
-
adjustDate(1, 1, 1);
|
|
107
|
-
event.preventDefault();
|
|
108
|
-
break;
|
|
109
|
-
case 'ArrowDown':
|
|
110
|
-
adjustDate(7, 4, 4);
|
|
111
|
-
event.preventDefault();
|
|
112
|
-
break;
|
|
113
|
-
default:
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
[adjustDate],
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
return (
|
|
121
|
-
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
122
|
-
<div onKeyDown={handleKeyDown}>
|
|
123
|
-
{mode === 'day' && (
|
|
124
|
-
<DayCalendar
|
|
125
|
-
selectedDate={selectedDate}
|
|
126
|
-
min={min}
|
|
127
|
-
max={max}
|
|
128
|
-
viewMonth={viewMonth}
|
|
129
|
-
viewYear={viewYear}
|
|
130
|
-
monthFormat={monthFormat}
|
|
131
|
-
onSelect={handleSelectedDateUpdate}
|
|
132
|
-
onLabelClick={switchToYears}
|
|
133
|
-
onViewDateUpdate={handleViewDateUpdate}
|
|
134
|
-
/>
|
|
135
|
-
)}
|
|
136
|
-
{mode === 'month' && (
|
|
137
|
-
<MonthCalendar
|
|
138
|
-
selectedDate={selectedDate}
|
|
139
|
-
min={min}
|
|
140
|
-
max={max}
|
|
141
|
-
viewYear={viewYear}
|
|
142
|
-
placeholder=""
|
|
143
|
-
onSelect={switchToDays}
|
|
144
|
-
onLabelClick={switchToYears}
|
|
145
|
-
onViewDateUpdate={handleViewDateUpdate}
|
|
146
|
-
/>
|
|
147
|
-
)}
|
|
148
|
-
{mode === 'year' && (
|
|
149
|
-
<YearCalendar
|
|
150
|
-
selectedDate={selectedDate}
|
|
151
|
-
min={min}
|
|
152
|
-
max={max}
|
|
153
|
-
viewYear={viewYear}
|
|
154
|
-
placeholder=""
|
|
155
|
-
onSelect={switchToMonths}
|
|
156
|
-
onViewDateUpdate={handleViewDateUpdate}
|
|
157
|
-
/>
|
|
158
|
-
)}
|
|
159
|
-
</div>
|
|
160
|
-
);
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
export default CalendarInput;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/build/types/{calendarInput → dateLookup}/monthCalendar/table/MonthCalendarTable.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|