@react-spectrum/calendar 3.0.0-alpha.3 → 3.0.0-alpha.4
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/dist/main.css +1 -1
- package/dist/main.js +219 -235
- package/dist/main.js.map +1 -1
- package/dist/module.js +218 -234
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +14 -13
- package/src/Calendar.tsx +8 -2
- package/src/CalendarBase.tsx +13 -8
- package/src/CalendarCell.tsx +27 -32
- package/src/CalendarMonth.tsx +14 -22
- package/src/RangeCalendar.tsx +8 -2
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AKAA,GAAmC;AACnC,GAA2C;AAC3C,GAA0C;AAC1C,GAA+C;AAC/C,GAAyC;AACzC,GAA6C;AAC7C,GAA6C;AAC7C,GAA0C;AAC1C,GAA6C;AAC7C,GAAwC;AACxC,GAAyC;AACzC,GAA6C;AAC7C,GAAwC;AACxC,GAA4C;AAC5C,GAA6B;AAC7B,GAAiC;AACjC,GAA4B;AAC5B,GAAoC;AACpC,GAAgC;AAChC,GAAoC;AACpC,GAA8B;AAC9B,GAAkC;AAClC,GAAoC;AACpC,GAA0B;AAC1B,GAA6B;AAC7B,GAA4B;AAC5B,GAA4B;AA1B5B,yCAAmC,GAAG,CAA0B;AAChE,yCAA2C,GAAG,CAAkC;AAChF,yCAA0C,GAAG,CAAiC;AAC9E,yCAA+C,GAAG,CAAsC;AACxF,yCAAyC,GAAG,CAAgC;AAC5E,yCAA6C,GAAG,CAAoC;AACpF,yCAA6C,GAAG,CAAoC;AACpF,yCAA0C,GAAG,CAAiC;AAC9E,yCAA6C,GAAG,CAAoC;AACpF,yCAAwC,GAAG,CAA+B;AAC1E,yCAAyC,GAAG,CAAgC;AAC5E,yCAA6C,GAAG,CAA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F,GAAG,CAAC,CAAC,gBAAA,aAAa,GAAG,CAAC,EAAA,CAAC,GAAG,KAAK;IAC/B,GAAG,CAAC,eAAe,GAAG,cAAO,MAAQ,CAAC;YAAA,MAAM,EAAE,aAAa;QAAA,CAAC;MAAG,CAAC;QAAA,aAAa;IAAA,CAAC;IAC9E,GAAG,CAAC,CAAC,SAAA,MAAM,EAAA,CAAC,GAAG,gBAAS;IACxB,GAAG,CAAC,KAAK,GAAG,4BAAqB,CAAC,CAAC;WAC9B,KAAK;gBACR,MAAM;yBACN,eAAe;wBACf,qBAAc;IAChB,CAAC;IAED,MAAM,0CACH,yCAAY;WACP,KAAK;QACT,KAAK,EAAE,KAAK;QACZ,WAAW,EAAE,uBAAgB;;AAEnC,CAAC;;","sources":["packages/@react-spectrum/calendar/src/index.ts","packages/@react-spectrum/calendar/src/Calendar.tsx","packages/@react-spectrum/calendar/src/CalendarBase.tsx","packages/@react-spectrum/calendar/src/CalendarMonth.tsx","packages/@react-spectrum/calendar/src/CalendarCell.tsx","packages/@adobe/spectrum-css-temp/components/calendar/vars.css","packages/@react-spectrum/calendar/src/RangeCalendar.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport * from './Calendar';\nexport * from './RangeCalendar';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CalendarBase} from './CalendarBase';\nimport {createCalendar} from '@internationalized/date';\nimport {DateValue, SpectrumCalendarProps} from '@react-types/calendar';\nimport React, {useMemo} from 'react';\nimport {useCalendar} from '@react-aria/calendar';\nimport {useCalendarState} from '@react-stately/calendar';\nimport {useLocale} from '@react-aria/i18n';\n\n/**\n * Calendars display a grid of days in one or more months and allow users to select a single date.\n */\nexport function Calendar<T extends DateValue>(props: SpectrumCalendarProps<T>) {\n let {visibleMonths = 1} = props;\n let visibleDuration = useMemo(() => ({months: visibleMonths}), [visibleMonths]);\n let {locale} = useLocale();\n let state = useCalendarState({\n ...props,\n locale,\n visibleDuration,\n createCalendar\n });\n\n return (\n <CalendarBase\n {...props}\n state={state}\n useCalendar={useCalendar} />\n );\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {ActionButton} from '@react-spectrum/button';\nimport {CalendarAria} from '@react-aria/calendar';\nimport {CalendarMonth} from './CalendarMonth';\nimport {CalendarPropsBase} from '@react-types/calendar';\nimport {CalendarState, RangeCalendarState} from '@react-stately/calendar';\nimport ChevronLeft from '@spectrum-icons/ui/ChevronLeftLarge';\nimport ChevronRight from '@spectrum-icons/ui/ChevronRightLarge';\nimport {classNames} from '@react-spectrum/utils';\nimport {DOMProps, StyleProps} from '@react-types/shared';\nimport React, {RefObject, useRef} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/calendar/vars.css';\nimport {useDateFormatter, useLocale} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\ninterface CalendarBaseProps<T extends CalendarState | RangeCalendarState> extends CalendarPropsBase, DOMProps, StyleProps {\n state: T,\n useCalendar: (props: CalendarPropsBase, state: T, ref?: RefObject<HTMLElement>) => CalendarAria,\n visibleMonths?: number\n}\n\nexport function CalendarBase<T extends CalendarState | RangeCalendarState>(props: CalendarBaseProps<T>) {\n props = useProviderProps(props);\n let {\n state,\n useCalendar,\n visibleMonths = 1\n } = props;\n let {direction} = useLocale();\n let currentMonth = state.visibleRange.start;\n let monthDateFormatter = useDateFormatter({\n month: 'long',\n year: 'numeric',\n era: currentMonth.calendar.identifier !== 'gregory' ? 'long' : undefined,\n calendar: currentMonth.calendar.identifier\n });\n let ref = useRef(null);\n let {calendarProps, prevButtonProps, nextButtonProps} = useCalendar(props, state, ref);\n\n let titles = [];\n let calendars = [];\n for (let i = 0; i < visibleMonths; i++) {\n titles.push(\n <div key={i} className={classNames(styles, 'spectrum-Calendar-monthHeader')}>\n {i === 0 &&\n <ActionButton\n {...prevButtonProps}\n UNSAFE_className={classNames(styles, 'spectrum-Calendar-prevMonth')}\n isQuiet>\n {direction === 'rtl' ? <ChevronRight /> : <ChevronLeft />}\n </ActionButton>\n }\n <h2\n className={classNames(styles, 'spectrum-Calendar-title')}>\n {monthDateFormatter.format(currentMonth.add({months: i}).toDate(state.timeZone))}\n </h2>\n {i === visibleMonths - 1 &&\n <ActionButton\n {...nextButtonProps}\n UNSAFE_className={classNames(styles, 'spectrum-Calendar-nextMonth')}\n isQuiet>\n {direction === 'rtl' ? <ChevronLeft /> : <ChevronRight />}\n </ActionButton>\n }\n </div>\n );\n\n let d = currentMonth.add({months: i});\n calendars.push(\n <CalendarMonth\n {...props}\n key={`${d.year}-${d.month}-${d.day}`}\n state={state}\n startDate={d} />\n );\n }\n\n return (\n <div\n {...calendarProps}\n ref={ref}\n className={\n classNames(styles,\n 'spectrum-Calendar'\n )\n }>\n <div className={classNames(styles, 'spectrum-Calendar-header')}>\n {titles}\n </div>\n <div className={classNames(styles, 'spectrum-Calendar-months')}>\n {calendars}\n </div>\n </div>\n );\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CalendarCell} from './CalendarCell';\nimport {CalendarDate, endOfMonth, getWeeksInMonth, startOfWeek} from '@internationalized/date';\nimport {CalendarPropsBase} from '@react-types/calendar';\nimport {CalendarState, RangeCalendarState} from '@react-stately/calendar';\nimport {classNames} from '@react-spectrum/utils';\nimport {DOMProps, StyleProps} from '@react-types/shared';\nimport React, {useEffect, useState} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/calendar/vars.css';\nimport {useCalendarGrid} from '@react-aria/calendar';\nimport {useDateFormatter, useLocale} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {VisuallyHidden} from '@react-aria/visually-hidden';\n\ninterface CalendarMonthProps extends CalendarPropsBase, DOMProps, StyleProps {\n state: CalendarState | RangeCalendarState,\n startDate: CalendarDate\n}\n\nexport function CalendarMonth(props: CalendarMonthProps) {\n props = useProviderProps(props);\n let {\n state,\n startDate\n } = props;\n let {\n gridProps\n } = useCalendarGrid({\n ...props,\n endDate: endOfMonth(startDate)\n }, state);\n\n let dayFormatter = useDateFormatter({weekday: 'narrow'});\n let dayFormatterLong = useDateFormatter({weekday: 'long'});\n\n let {locale} = useLocale();\n let monthStart = startOfWeek(startDate, locale);\n let weeksInMonth = getWeeksInMonth(startDate, locale);\n\n let [isRangeSelecting, setRangeSelecting] = useState(false);\n let hasAnchorDate = 'anchorDate' in state && state.anchorDate != null;\n\n // Update isRangeSelecting immediately when it becomes true.\n // This feels weird but is actually fine...\n // https://reactjs.org/docs/hooks-faq.html#how-do-i-implement-getderivedstatefromprops\n if (hasAnchorDate && !isRangeSelecting) {\n setRangeSelecting(true);\n }\n\n // Delay removing the is-range-selecting class for a frame after selection ends.\n // This avoids an undesired animation on touch devices.\n useEffect(() => {\n if (!hasAnchorDate && isRangeSelecting) {\n let raf = requestAnimationFrame(() => setRangeSelecting(false));\n return () => cancelAnimationFrame(raf);\n }\n }, [hasAnchorDate, isRangeSelecting]);\n\n return (\n <table\n {...gridProps}\n className={classNames(styles, 'spectrum-Calendar-body', 'spectrum-Calendar-table', {'is-range-selecting': isRangeSelecting})}>\n <thead>\n <tr>\n {[...new Array(7).keys()].map((index) => {\n let date = monthStart.add({days: index});\n let dateDay = date.toDate(state.timeZone);\n let day = dayFormatter.format(dateDay);\n let dayLong = dayFormatterLong.format(dateDay);\n return (\n <th\n key={index}\n className={classNames(styles, 'spectrum-Calendar-tableCell')}>\n {/* Make sure screen readers read the full day name, but we show an abbreviation visually. */}\n <VisuallyHidden>{dayLong}</VisuallyHidden>\n <span aria-hidden=\"true\" className={classNames(styles, 'spectrum-Calendar-dayOfWeek')}>\n {day}\n </span>\n </th>\n );\n })}\n </tr>\n </thead>\n <tbody>\n {[...new Array(weeksInMonth).keys()].map(weekIndex => (\n <tr key={weekIndex}>\n {[...new Array(7).keys()].map(dayIndex => (\n <CalendarCell\n key={dayIndex}\n state={state}\n date={monthStart.add({weeks: weekIndex, days: dayIndex})}\n currentMonth={startDate} />\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaCalendarCellProps, useCalendarCell} from '@react-aria/calendar';\nimport {CalendarDate, getDayOfWeek, isEqualDay, isSameDay, isSameMonth, isToday} from '@internationalized/date';\nimport {CalendarState, RangeCalendarState} from '@react-stately/calendar';\nimport {classNames} from '@react-spectrum/utils';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {useMemo, useRef} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/calendar/vars.css';\nimport {useDateFormatter, useLocale} from '@react-aria/i18n';\nimport {useFocusRing} from '@react-aria/focus';\nimport {useHover} from '@react-aria/interactions';\n\ninterface CalendarCellProps extends AriaCalendarCellProps {\n state: CalendarState | RangeCalendarState,\n currentMonth: CalendarDate\n}\n\nexport function CalendarCell({state, currentMonth, ...props}: CalendarCellProps) {\n let ref = useRef<HTMLElement>();\n let {cellProps, buttonProps, isPressed} = useCalendarCell({\n ...props,\n isDisabled: !isSameMonth(props.date, currentMonth)\n }, state, ref);\n let {hoverProps, isHovered} = useHover({});\n let dateFormatter = useDateFormatter({\n day: 'numeric',\n timeZone: state.timeZone,\n calendar: currentMonth.calendar.identifier\n });\n let isSelected = state.isSelected(props.date);\n let highlightedRange = 'highlightedRange' in state && state.highlightedRange;\n let isSelectionStart = highlightedRange && isSameDay(props.date, highlightedRange.start);\n let isSelectionEnd = highlightedRange && isSameDay(props.date, highlightedRange.end);\n let {locale} = useLocale();\n let dayOfWeek = getDayOfWeek(props.date, locale);\n let isRangeStart = isSelected && (dayOfWeek === 0 || props.date.day === 1);\n let isRangeEnd = isSelected && (dayOfWeek === 6 || props.date.day === currentMonth.calendar.getDaysInMonth(currentMonth));\n let {focusProps, isFocusVisible} = useFocusRing();\n\n // For performance, reuse the same date object as before if the new date prop is the same.\n // This allows subsequent useMemo results to be reused.\n let date = props.date;\n let lastDate = useRef(null);\n if (lastDate.current && isEqualDay(date, lastDate.current)) {\n date = lastDate.current;\n }\n\n lastDate.current = date;\n\n let nativeDate = useMemo(() => date.toDate(state.timeZone), [date, state.timeZone]);\n let formatted = useMemo(() => dateFormatter.format(nativeDate), [dateFormatter, nativeDate]);\n\n return (\n <td\n {...cellProps}\n className={classNames(styles, 'spectrum-Calendar-tableCell')}>\n <span\n {...mergeProps(buttonProps, hoverProps, focusProps)}\n ref={ref}\n className={classNames(styles, 'spectrum-Calendar-date', {\n 'is-today': isToday(props.date, state.timeZone),\n 'is-selected': isSelected,\n 'is-focused': state.isCellFocused(props.date) && isFocusVisible,\n 'is-disabled': state.isCellDisabled(props.date),\n 'is-outsideMonth': !isSameMonth(props.date, currentMonth),\n 'is-range-start': isRangeStart,\n 'is-range-end': isRangeEnd,\n 'is-range-selection': isSelected && 'highlightedRange' in state,\n 'is-selection-start': isSelectionStart,\n 'is-selection-end': isSelectionEnd,\n 'is-hovered': isHovered,\n 'is-pressed': isPressed\n })}>\n <span className={classNames(styles, 'spectrum-Calendar-dateText')}>{formatted}</span>\n </span>\n </td>\n );\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CalendarBase} from './CalendarBase';\nimport {createCalendar} from '@internationalized/date';\nimport {DateValue, SpectrumRangeCalendarProps} from '@react-types/calendar';\nimport React, {useMemo} from 'react';\nimport {useLocale} from '@react-aria/i18n';\nimport {useRangeCalendar} from '@react-aria/calendar';\nimport {useRangeCalendarState} from '@react-stately/calendar';\n\n/**\n * RangeCalendars display a grid of days in one or more months and allow users to select a contiguous range of dates.\n */\nexport function RangeCalendar<T extends DateValue>(props: SpectrumRangeCalendarProps<T>) {\n let {visibleMonths = 1} = props;\n let visibleDuration = useMemo(() => ({months: visibleMonths}), [visibleMonths]);\n let {locale} = useLocale();\n let state = useRangeCalendarState({\n ...props,\n locale,\n visibleDuration,\n createCalendar\n });\n\n return (\n <CalendarBase\n {...props}\n state={state}\n useCalendar={useRangeCalendar} />\n );\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AKAA,GAAmC;AACnC,GAA2C;AAC3C,GAA0C;AAC1C,GAA+C;AAC/C,GAAyC;AACzC,GAA6C;AAC7C,GAA6C;AAC7C,GAA0C;AAC1C,GAA6C;AAC7C,GAAwC;AACxC,GAAyC;AACzC,GAA6C;AAC7C,GAAwC;AACxC,GAA4C;AAC5C,GAA6B;AAC7B,GAAgC;AAChC,GAAiC;AACjC,GAA4B;AAC5B,GAAoC;AACpC,GAAgC;AAChC,GAAoC;AACpC,GAA8B;AAC9B,GAAkC;AAClC,GAAoC;AACpC,GAA0B;AAC1B,GAA6B;AAC7B,GAA4B;AAC5B,GAA4B;AA3B5B,yCAAmC,GAAG,CAA0B;AAChE,yCAA2C,GAAG,CAAkC;AAChF,yCAA0C,GAAG,CAAiC;AAC9E,yCAA+C,GAAG,CAAsC;AACxF,yCAAyC,GAAG,CAAgC;AAC5E,yCAA6C,GAAG,CAAo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AAgB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG;IAE1F,MAAM,0CACH,yCAAY;WACP,KAAK;QACT,KAAK,EAAE,KAAK;QACZ,WAAW,EAAE,GAAG;QAChB,aAAa,EAAE,aAAa;QAC5B,eAAe,EAAE,eAAe;QAChC,eAAe,EAAE,eAAe;;AAEtC,CAAC;;","sources":["packages/@react-spectrum/calendar/src/index.ts","packages/@react-spectrum/calendar/src/Calendar.tsx","packages/@react-spectrum/calendar/src/CalendarBase.tsx","packages/@react-spectrum/calendar/src/CalendarMonth.tsx","packages/@react-spectrum/calendar/src/CalendarCell.tsx","packages/@adobe/spectrum-css-temp/components/calendar/vars.css","packages/@react-spectrum/calendar/src/RangeCalendar.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport * from './Calendar';\nexport * from './RangeCalendar';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CalendarBase} from './CalendarBase';\nimport {createCalendar} from '@internationalized/date';\nimport {DateValue, SpectrumCalendarProps} from '@react-types/calendar';\nimport React, {useMemo, useRef} from 'react';\nimport {useCalendar} from '@react-aria/calendar';\nimport {useCalendarState} from '@react-stately/calendar';\nimport {useLocale} from '@react-aria/i18n';\n\n/**\n * Calendars display a grid of days in one or more months and allow users to select a single date.\n */\nexport function Calendar<T extends DateValue>(props: SpectrumCalendarProps<T>) {\n let {visibleMonths = 1} = props;\n let visibleDuration = useMemo(() => ({months: visibleMonths}), [visibleMonths]);\n let {locale} = useLocale();\n let state = useCalendarState({\n ...props,\n locale,\n visibleDuration,\n createCalendar\n });\n\n let ref = useRef();\n let {calendarProps, prevButtonProps, nextButtonProps} = useCalendar(props, state);\n\n return (\n <CalendarBase\n {...props}\n state={state}\n calendarRef={ref}\n calendarProps={calendarProps}\n prevButtonProps={prevButtonProps}\n nextButtonProps={nextButtonProps} />\n );\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {ActionButton} from '@react-spectrum/button';\nimport {AriaButtonProps} from '@react-types/button';\nimport {CalendarMonth} from './CalendarMonth';\nimport {CalendarPropsBase} from '@react-types/calendar';\nimport {CalendarState, RangeCalendarState} from '@react-stately/calendar';\nimport ChevronLeft from '@spectrum-icons/ui/ChevronLeftLarge';\nimport ChevronRight from '@spectrum-icons/ui/ChevronRightLarge';\nimport {classNames} from '@react-spectrum/utils';\nimport {DOMProps, StyleProps} from '@react-types/shared';\nimport React, {HTMLAttributes, RefObject} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/calendar/vars.css';\nimport {useDateFormatter, useLocale} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\ninterface CalendarBaseProps<T extends CalendarState | RangeCalendarState> extends CalendarPropsBase, DOMProps, StyleProps {\n state: T,\n visibleMonths?: number,\n calendarProps: HTMLAttributes<HTMLElement>,\n nextButtonProps: AriaButtonProps,\n prevButtonProps: AriaButtonProps,\n calendarRef: RefObject<HTMLDivElement>\n}\n\nexport function CalendarBase<T extends CalendarState | RangeCalendarState>(props: CalendarBaseProps<T>) {\n props = useProviderProps(props);\n let {\n state,\n calendarProps,\n nextButtonProps,\n prevButtonProps,\n calendarRef: ref,\n visibleMonths = 1\n } = props;\n let {direction} = useLocale();\n let currentMonth = state.visibleRange.start;\n let monthDateFormatter = useDateFormatter({\n month: 'long',\n year: 'numeric',\n era: currentMonth.calendar.identifier !== 'gregory' ? 'long' : undefined,\n calendar: currentMonth.calendar.identifier,\n timeZone: state.timeZone\n });\n\n let titles = [];\n let calendars = [];\n for (let i = 0; i < visibleMonths; i++) {\n titles.push(\n <div key={i} className={classNames(styles, 'spectrum-Calendar-monthHeader')}>\n {i === 0 &&\n <ActionButton\n {...prevButtonProps}\n UNSAFE_className={classNames(styles, 'spectrum-Calendar-prevMonth')}\n isQuiet>\n {direction === 'rtl' ? <ChevronRight /> : <ChevronLeft />}\n </ActionButton>\n }\n <h2\n className={classNames(styles, 'spectrum-Calendar-title')}>\n {monthDateFormatter.format(currentMonth.add({months: i}).toDate(state.timeZone))}\n </h2>\n {i === visibleMonths - 1 &&\n <ActionButton\n {...nextButtonProps}\n UNSAFE_className={classNames(styles, 'spectrum-Calendar-nextMonth')}\n isQuiet>\n {direction === 'rtl' ? <ChevronLeft /> : <ChevronRight />}\n </ActionButton>\n }\n </div>\n );\n\n let d = currentMonth.add({months: i});\n calendars.push(\n <CalendarMonth\n {...props}\n key={`${d.year}-${d.month}-${d.day}`}\n state={state}\n startDate={d} />\n );\n }\n\n return (\n <div\n {...calendarProps}\n ref={ref}\n className={\n classNames(styles,\n 'spectrum-Calendar'\n )\n }>\n <div className={classNames(styles, 'spectrum-Calendar-header')}>\n {titles}\n </div>\n <div className={classNames(styles, 'spectrum-Calendar-months')}>\n {calendars}\n </div>\n </div>\n );\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CalendarCell} from './CalendarCell';\nimport {CalendarDate, endOfMonth, getWeeksInMonth, startOfWeek} from '@internationalized/date';\nimport {CalendarPropsBase} from '@react-types/calendar';\nimport {CalendarState, RangeCalendarState} from '@react-stately/calendar';\nimport {classNames} from '@react-spectrum/utils';\nimport {DOMProps, StyleProps} from '@react-types/shared';\nimport React, {useEffect, useState} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/calendar/vars.css';\nimport {useCalendarGrid} from '@react-aria/calendar';\nimport {useLocale} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {VisuallyHidden} from '@react-aria/visually-hidden';\n\ninterface CalendarMonthProps extends CalendarPropsBase, DOMProps, StyleProps {\n state: CalendarState | RangeCalendarState,\n startDate: CalendarDate\n}\n\nexport function CalendarMonth(props: CalendarMonthProps) {\n props = useProviderProps(props);\n let {\n state,\n startDate\n } = props;\n let {\n gridProps,\n weekDays\n } = useCalendarGrid({\n ...props,\n endDate: endOfMonth(startDate)\n }, state);\n\n let {locale} = useLocale();\n let monthStart = startOfWeek(startDate, locale);\n let weeksInMonth = getWeeksInMonth(startDate, locale);\n\n let [isRangeSelecting, setRangeSelecting] = useState(false);\n let hasAnchorDate = 'anchorDate' in state && state.anchorDate != null;\n\n // Update isRangeSelecting immediately when it becomes true.\n // This feels weird but is actually fine...\n // https://reactjs.org/docs/hooks-faq.html#how-do-i-implement-getderivedstatefromprops\n if (hasAnchorDate && !isRangeSelecting) {\n setRangeSelecting(true);\n }\n\n // Delay removing the is-range-selecting class for a frame after selection ends.\n // This avoids an undesired animation on touch devices.\n useEffect(() => {\n if (!hasAnchorDate && isRangeSelecting) {\n let raf = requestAnimationFrame(() => setRangeSelecting(false));\n return () => cancelAnimationFrame(raf);\n }\n }, [hasAnchorDate, isRangeSelecting]);\n\n return (\n <table\n {...gridProps}\n className={classNames(styles, 'spectrum-Calendar-body', 'spectrum-Calendar-table', {'is-range-selecting': isRangeSelecting})}>\n <thead>\n <tr>\n {weekDays.map((day, index) => (\n <th\n key={index}\n className={classNames(styles, 'spectrum-Calendar-tableCell')}>\n {/* Make sure screen readers read the full day name, but we show an abbreviation visually. */}\n <VisuallyHidden>{day.long}</VisuallyHidden>\n <span aria-hidden=\"true\" className={classNames(styles, 'spectrum-Calendar-dayOfWeek')}>\n {day.narrow}\n </span>\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {[...new Array(weeksInMonth).keys()].map(weekIndex => (\n <tr key={weekIndex}>\n {[...new Array(7).keys()].map(dayIndex => (\n <CalendarCell\n key={dayIndex}\n state={state}\n date={monthStart.add({weeks: weekIndex, days: dayIndex})}\n currentMonth={startDate} />\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaCalendarCellProps, useCalendarCell} from '@react-aria/calendar';\nimport {CalendarDate, getDayOfWeek, isSameDay, isSameMonth, isToday} from '@internationalized/date';\nimport {CalendarState, RangeCalendarState} from '@react-stately/calendar';\nimport {classNames} from '@react-spectrum/utils';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {useRef} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/calendar/vars.css';\nimport {useFocusRing} from '@react-aria/focus';\nimport {useHover} from '@react-aria/interactions';\nimport {useLocale} from '@react-aria/i18n';\n\ninterface CalendarCellProps extends AriaCalendarCellProps {\n state: CalendarState | RangeCalendarState,\n currentMonth: CalendarDate\n}\n\nexport function CalendarCell({state, currentMonth, ...props}: CalendarCellProps) {\n let ref = useRef<HTMLElement>();\n let {\n cellProps,\n buttonProps,\n isPressed,\n isSelected,\n isDisabled,\n isFocused,\n formattedDate\n } = useCalendarCell({\n ...props,\n isDisabled: !isSameMonth(props.date, currentMonth)\n }, state, ref);\n let isUnavailable = state.isCellUnavailable(props.date) && !isDisabled;\n let isLastSelectedBeforeDisabled = !isDisabled && state.isCellUnavailable(props.date.add({days: 1}));\n let isFirstSelectedAfterDisabled = !isDisabled && state.isCellUnavailable(props.date.subtract({days: 1}));\n let highlightedRange = 'highlightedRange' in state && state.highlightedRange;\n let isSelectionStart = isSelected && highlightedRange && isSameDay(props.date, highlightedRange.start);\n let isSelectionEnd = isSelected && highlightedRange && isSameDay(props.date, highlightedRange.end);\n let {locale} = useLocale();\n let dayOfWeek = getDayOfWeek(props.date, locale);\n let isRangeStart = isSelected && (isFirstSelectedAfterDisabled || dayOfWeek === 0 || props.date.day === 1);\n let isRangeEnd = isSelected && (isLastSelectedBeforeDisabled || dayOfWeek === 6 || props.date.day === currentMonth.calendar.getDaysInMonth(currentMonth));\n let {focusProps, isFocusVisible} = useFocusRing();\n let {hoverProps, isHovered} = useHover({isDisabled: isDisabled || isUnavailable || state.isReadOnly});\n\n return (\n <td\n {...cellProps}\n className={classNames(styles, 'spectrum-Calendar-tableCell')}>\n <span\n {...mergeProps(buttonProps, hoverProps, focusProps)}\n ref={ref}\n className={classNames(styles, 'spectrum-Calendar-date', {\n 'is-today': isToday(props.date, state.timeZone),\n 'is-selected': isSelected,\n 'is-focused': isFocused && isFocusVisible,\n 'is-disabled': isDisabled,\n 'is-unavailable': isUnavailable,\n 'is-outsideMonth': !isSameMonth(props.date, currentMonth),\n 'is-range-start': isRangeStart,\n 'is-range-end': isRangeEnd,\n 'is-range-selection': isSelected && 'highlightedRange' in state,\n 'is-selection-start': isSelectionStart,\n 'is-selection-end': isSelectionEnd,\n 'is-hovered': isHovered,\n 'is-pressed': isPressed && !state.isReadOnly\n })}>\n <span className={classNames(styles, 'spectrum-Calendar-dateText')}>\n <span>{formattedDate}</span>\n </span>\n </span>\n </td>\n );\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CalendarBase} from './CalendarBase';\nimport {createCalendar} from '@internationalized/date';\nimport {DateValue, SpectrumRangeCalendarProps} from '@react-types/calendar';\nimport React, {useMemo, useRef} from 'react';\nimport {useLocale} from '@react-aria/i18n';\nimport {useRangeCalendar} from '@react-aria/calendar';\nimport {useRangeCalendarState} from '@react-stately/calendar';\n\n/**\n * RangeCalendars display a grid of days in one or more months and allow users to select a contiguous range of dates.\n */\nexport function RangeCalendar<T extends DateValue>(props: SpectrumRangeCalendarProps<T>) {\n let {visibleMonths = 1} = props;\n let visibleDuration = useMemo(() => ({months: visibleMonths}), [visibleMonths]);\n let {locale} = useLocale();\n let state = useRangeCalendarState({\n ...props,\n locale,\n visibleDuration,\n createCalendar\n });\n\n let ref = useRef();\n let {calendarProps, prevButtonProps, nextButtonProps} = useRangeCalendar(props, state, ref);\n\n return (\n <CalendarBase\n {...props}\n state={state}\n calendarRef={ref}\n calendarProps={calendarProps}\n prevButtonProps={prevButtonProps}\n nextButtonProps={nextButtonProps} />\n );\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";AGoBA;;GAEG;AACH,yBAAyB,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,sBAAsB,CAAC,CAAC,
|
|
1
|
+
{"mappings":";AGoBA;;GAEG;AACH,yBAAyB,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,sBAAsB,CAAC,CAAC,eAuB5E;AC1BD;;GAEG;AACH,8BAA8B,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,2BAA2B,CAAC,CAAC,eAuBtF","sources":["packages/@react-spectrum/calendar/src/packages/@react-spectrum/calendar/src/CalendarCell.tsx","packages/@react-spectrum/calendar/src/packages/@react-spectrum/calendar/src/CalendarMonth.tsx","packages/@react-spectrum/calendar/src/packages/@react-spectrum/calendar/src/CalendarBase.tsx","packages/@react-spectrum/calendar/src/packages/@react-spectrum/calendar/src/Calendar.tsx","packages/@react-spectrum/calendar/src/packages/@react-spectrum/calendar/src/RangeCalendar.tsx","packages/@react-spectrum/calendar/src/packages/@react-spectrum/calendar/src/index.ts","packages/@react-spectrum/calendar/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport * from './Calendar';\nexport * from './RangeCalendar';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/calendar",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.4",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -32,19 +32,20 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.6.2",
|
|
35
|
-
"@internationalized/date": "3.0.0-alpha.
|
|
36
|
-
"@react-aria/calendar": "3.0.0-alpha.
|
|
37
|
-
"@react-aria/focus": "^3.5.
|
|
38
|
-
"@react-aria/i18n": "^3.3.
|
|
39
|
-
"@react-aria/interactions": "^3.8.
|
|
35
|
+
"@internationalized/date": "3.0.0-alpha.4",
|
|
36
|
+
"@react-aria/calendar": "3.0.0-alpha.4",
|
|
37
|
+
"@react-aria/focus": "^3.5.4",
|
|
38
|
+
"@react-aria/i18n": "^3.3.8",
|
|
39
|
+
"@react-aria/interactions": "^3.8.3",
|
|
40
40
|
"@react-aria/utils": "^3.11.2",
|
|
41
|
-
"@react-aria/visually-hidden": "^3.2.
|
|
42
|
-
"@react-spectrum/button": "^3.7.
|
|
43
|
-
"@react-spectrum/utils": "^3.6.
|
|
44
|
-
"@react-stately/calendar": "3.0.0-alpha.
|
|
45
|
-
"@react-types/
|
|
41
|
+
"@react-aria/visually-hidden": "^3.2.7",
|
|
42
|
+
"@react-spectrum/button": "^3.7.3",
|
|
43
|
+
"@react-spectrum/utils": "^3.6.7",
|
|
44
|
+
"@react-stately/calendar": "3.0.0-alpha.4",
|
|
45
|
+
"@react-types/button": "^3.4.3",
|
|
46
|
+
"@react-types/calendar": "3.0.0-alpha.4",
|
|
46
47
|
"@react-types/shared": "^3.11.1",
|
|
47
|
-
"@spectrum-icons/ui": "^3.2.
|
|
48
|
+
"@spectrum-icons/ui": "^3.2.5",
|
|
48
49
|
"date-fns": "^1.30.1"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
@@ -59,5 +60,5 @@
|
|
|
59
60
|
"publishConfig": {
|
|
60
61
|
"access": "public"
|
|
61
62
|
},
|
|
62
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "e7708349a637642a30d33a11ca4a75ad5829eaa3"
|
|
63
64
|
}
|
package/src/Calendar.tsx
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
import {CalendarBase} from './CalendarBase';
|
|
14
14
|
import {createCalendar} from '@internationalized/date';
|
|
15
15
|
import {DateValue, SpectrumCalendarProps} from '@react-types/calendar';
|
|
16
|
-
import React, {useMemo} from 'react';
|
|
16
|
+
import React, {useMemo, useRef} from 'react';
|
|
17
17
|
import {useCalendar} from '@react-aria/calendar';
|
|
18
18
|
import {useCalendarState} from '@react-stately/calendar';
|
|
19
19
|
import {useLocale} from '@react-aria/i18n';
|
|
@@ -32,10 +32,16 @@ export function Calendar<T extends DateValue>(props: SpectrumCalendarProps<T>) {
|
|
|
32
32
|
createCalendar
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
+
let ref = useRef();
|
|
36
|
+
let {calendarProps, prevButtonProps, nextButtonProps} = useCalendar(props, state);
|
|
37
|
+
|
|
35
38
|
return (
|
|
36
39
|
<CalendarBase
|
|
37
40
|
{...props}
|
|
38
41
|
state={state}
|
|
39
|
-
|
|
42
|
+
calendarRef={ref}
|
|
43
|
+
calendarProps={calendarProps}
|
|
44
|
+
prevButtonProps={prevButtonProps}
|
|
45
|
+
nextButtonProps={nextButtonProps} />
|
|
40
46
|
);
|
|
41
47
|
}
|
package/src/CalendarBase.tsx
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import {ActionButton} from '@react-spectrum/button';
|
|
14
|
-
import {
|
|
14
|
+
import {AriaButtonProps} from '@react-types/button';
|
|
15
15
|
import {CalendarMonth} from './CalendarMonth';
|
|
16
16
|
import {CalendarPropsBase} from '@react-types/calendar';
|
|
17
17
|
import {CalendarState, RangeCalendarState} from '@react-stately/calendar';
|
|
@@ -19,22 +19,28 @@ import ChevronLeft from '@spectrum-icons/ui/ChevronLeftLarge';
|
|
|
19
19
|
import ChevronRight from '@spectrum-icons/ui/ChevronRightLarge';
|
|
20
20
|
import {classNames} from '@react-spectrum/utils';
|
|
21
21
|
import {DOMProps, StyleProps} from '@react-types/shared';
|
|
22
|
-
import React, {
|
|
22
|
+
import React, {HTMLAttributes, RefObject} from 'react';
|
|
23
23
|
import styles from '@adobe/spectrum-css-temp/components/calendar/vars.css';
|
|
24
24
|
import {useDateFormatter, useLocale} from '@react-aria/i18n';
|
|
25
25
|
import {useProviderProps} from '@react-spectrum/provider';
|
|
26
26
|
|
|
27
27
|
interface CalendarBaseProps<T extends CalendarState | RangeCalendarState> extends CalendarPropsBase, DOMProps, StyleProps {
|
|
28
28
|
state: T,
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
visibleMonths?: number,
|
|
30
|
+
calendarProps: HTMLAttributes<HTMLElement>,
|
|
31
|
+
nextButtonProps: AriaButtonProps,
|
|
32
|
+
prevButtonProps: AriaButtonProps,
|
|
33
|
+
calendarRef: RefObject<HTMLDivElement>
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
export function CalendarBase<T extends CalendarState | RangeCalendarState>(props: CalendarBaseProps<T>) {
|
|
34
37
|
props = useProviderProps(props);
|
|
35
38
|
let {
|
|
36
39
|
state,
|
|
37
|
-
|
|
40
|
+
calendarProps,
|
|
41
|
+
nextButtonProps,
|
|
42
|
+
prevButtonProps,
|
|
43
|
+
calendarRef: ref,
|
|
38
44
|
visibleMonths = 1
|
|
39
45
|
} = props;
|
|
40
46
|
let {direction} = useLocale();
|
|
@@ -43,10 +49,9 @@ export function CalendarBase<T extends CalendarState | RangeCalendarState>(props
|
|
|
43
49
|
month: 'long',
|
|
44
50
|
year: 'numeric',
|
|
45
51
|
era: currentMonth.calendar.identifier !== 'gregory' ? 'long' : undefined,
|
|
46
|
-
calendar: currentMonth.calendar.identifier
|
|
52
|
+
calendar: currentMonth.calendar.identifier,
|
|
53
|
+
timeZone: state.timeZone
|
|
47
54
|
});
|
|
48
|
-
let ref = useRef(null);
|
|
49
|
-
let {calendarProps, prevButtonProps, nextButtonProps} = useCalendar(props, state, ref);
|
|
50
55
|
|
|
51
56
|
let titles = [];
|
|
52
57
|
let calendars = [];
|
package/src/CalendarCell.tsx
CHANGED
|
@@ -11,15 +11,15 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import {AriaCalendarCellProps, useCalendarCell} from '@react-aria/calendar';
|
|
14
|
-
import {CalendarDate, getDayOfWeek,
|
|
14
|
+
import {CalendarDate, getDayOfWeek, isSameDay, isSameMonth, isToday} from '@internationalized/date';
|
|
15
15
|
import {CalendarState, RangeCalendarState} from '@react-stately/calendar';
|
|
16
16
|
import {classNames} from '@react-spectrum/utils';
|
|
17
17
|
import {mergeProps} from '@react-aria/utils';
|
|
18
|
-
import React, {
|
|
18
|
+
import React, {useRef} from 'react';
|
|
19
19
|
import styles from '@adobe/spectrum-css-temp/components/calendar/vars.css';
|
|
20
|
-
import {useDateFormatter, useLocale} from '@react-aria/i18n';
|
|
21
20
|
import {useFocusRing} from '@react-aria/focus';
|
|
22
21
|
import {useHover} from '@react-aria/interactions';
|
|
22
|
+
import {useLocale} from '@react-aria/i18n';
|
|
23
23
|
|
|
24
24
|
interface CalendarCellProps extends AriaCalendarCellProps {
|
|
25
25
|
state: CalendarState | RangeCalendarState,
|
|
@@ -28,38 +28,30 @@ interface CalendarCellProps extends AriaCalendarCellProps {
|
|
|
28
28
|
|
|
29
29
|
export function CalendarCell({state, currentMonth, ...props}: CalendarCellProps) {
|
|
30
30
|
let ref = useRef<HTMLElement>();
|
|
31
|
-
let {
|
|
31
|
+
let {
|
|
32
|
+
cellProps,
|
|
33
|
+
buttonProps,
|
|
34
|
+
isPressed,
|
|
35
|
+
isSelected,
|
|
36
|
+
isDisabled,
|
|
37
|
+
isFocused,
|
|
38
|
+
formattedDate
|
|
39
|
+
} = useCalendarCell({
|
|
32
40
|
...props,
|
|
33
41
|
isDisabled: !isSameMonth(props.date, currentMonth)
|
|
34
42
|
}, state, ref);
|
|
35
|
-
let
|
|
36
|
-
let
|
|
37
|
-
|
|
38
|
-
timeZone: state.timeZone,
|
|
39
|
-
calendar: currentMonth.calendar.identifier
|
|
40
|
-
});
|
|
41
|
-
let isSelected = state.isSelected(props.date);
|
|
43
|
+
let isUnavailable = state.isCellUnavailable(props.date) && !isDisabled;
|
|
44
|
+
let isLastSelectedBeforeDisabled = !isDisabled && state.isCellUnavailable(props.date.add({days: 1}));
|
|
45
|
+
let isFirstSelectedAfterDisabled = !isDisabled && state.isCellUnavailable(props.date.subtract({days: 1}));
|
|
42
46
|
let highlightedRange = 'highlightedRange' in state && state.highlightedRange;
|
|
43
|
-
let isSelectionStart = highlightedRange && isSameDay(props.date, highlightedRange.start);
|
|
44
|
-
let isSelectionEnd = highlightedRange && isSameDay(props.date, highlightedRange.end);
|
|
47
|
+
let isSelectionStart = isSelected && highlightedRange && isSameDay(props.date, highlightedRange.start);
|
|
48
|
+
let isSelectionEnd = isSelected && highlightedRange && isSameDay(props.date, highlightedRange.end);
|
|
45
49
|
let {locale} = useLocale();
|
|
46
50
|
let dayOfWeek = getDayOfWeek(props.date, locale);
|
|
47
|
-
let isRangeStart = isSelected && (dayOfWeek === 0 || props.date.day === 1);
|
|
48
|
-
let isRangeEnd = isSelected && (dayOfWeek === 6 || props.date.day === currentMonth.calendar.getDaysInMonth(currentMonth));
|
|
51
|
+
let isRangeStart = isSelected && (isFirstSelectedAfterDisabled || dayOfWeek === 0 || props.date.day === 1);
|
|
52
|
+
let isRangeEnd = isSelected && (isLastSelectedBeforeDisabled || dayOfWeek === 6 || props.date.day === currentMonth.calendar.getDaysInMonth(currentMonth));
|
|
49
53
|
let {focusProps, isFocusVisible} = useFocusRing();
|
|
50
|
-
|
|
51
|
-
// For performance, reuse the same date object as before if the new date prop is the same.
|
|
52
|
-
// This allows subsequent useMemo results to be reused.
|
|
53
|
-
let date = props.date;
|
|
54
|
-
let lastDate = useRef(null);
|
|
55
|
-
if (lastDate.current && isEqualDay(date, lastDate.current)) {
|
|
56
|
-
date = lastDate.current;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
lastDate.current = date;
|
|
60
|
-
|
|
61
|
-
let nativeDate = useMemo(() => date.toDate(state.timeZone), [date, state.timeZone]);
|
|
62
|
-
let formatted = useMemo(() => dateFormatter.format(nativeDate), [dateFormatter, nativeDate]);
|
|
54
|
+
let {hoverProps, isHovered} = useHover({isDisabled: isDisabled || isUnavailable || state.isReadOnly});
|
|
63
55
|
|
|
64
56
|
return (
|
|
65
57
|
<td
|
|
@@ -71,8 +63,9 @@ export function CalendarCell({state, currentMonth, ...props}: CalendarCellProps)
|
|
|
71
63
|
className={classNames(styles, 'spectrum-Calendar-date', {
|
|
72
64
|
'is-today': isToday(props.date, state.timeZone),
|
|
73
65
|
'is-selected': isSelected,
|
|
74
|
-
'is-focused':
|
|
75
|
-
'is-disabled':
|
|
66
|
+
'is-focused': isFocused && isFocusVisible,
|
|
67
|
+
'is-disabled': isDisabled,
|
|
68
|
+
'is-unavailable': isUnavailable,
|
|
76
69
|
'is-outsideMonth': !isSameMonth(props.date, currentMonth),
|
|
77
70
|
'is-range-start': isRangeStart,
|
|
78
71
|
'is-range-end': isRangeEnd,
|
|
@@ -80,9 +73,11 @@ export function CalendarCell({state, currentMonth, ...props}: CalendarCellProps)
|
|
|
80
73
|
'is-selection-start': isSelectionStart,
|
|
81
74
|
'is-selection-end': isSelectionEnd,
|
|
82
75
|
'is-hovered': isHovered,
|
|
83
|
-
'is-pressed': isPressed
|
|
76
|
+
'is-pressed': isPressed && !state.isReadOnly
|
|
84
77
|
})}>
|
|
85
|
-
<span className={classNames(styles, 'spectrum-Calendar-dateText')}>
|
|
78
|
+
<span className={classNames(styles, 'spectrum-Calendar-dateText')}>
|
|
79
|
+
<span>{formattedDate}</span>
|
|
80
|
+
</span>
|
|
86
81
|
</span>
|
|
87
82
|
</td>
|
|
88
83
|
);
|
package/src/CalendarMonth.tsx
CHANGED
|
@@ -19,7 +19,7 @@ import {DOMProps, StyleProps} from '@react-types/shared';
|
|
|
19
19
|
import React, {useEffect, useState} from 'react';
|
|
20
20
|
import styles from '@adobe/spectrum-css-temp/components/calendar/vars.css';
|
|
21
21
|
import {useCalendarGrid} from '@react-aria/calendar';
|
|
22
|
-
import {
|
|
22
|
+
import {useLocale} from '@react-aria/i18n';
|
|
23
23
|
import {useProviderProps} from '@react-spectrum/provider';
|
|
24
24
|
import {VisuallyHidden} from '@react-aria/visually-hidden';
|
|
25
25
|
|
|
@@ -35,15 +35,13 @@ export function CalendarMonth(props: CalendarMonthProps) {
|
|
|
35
35
|
startDate
|
|
36
36
|
} = props;
|
|
37
37
|
let {
|
|
38
|
-
gridProps
|
|
38
|
+
gridProps,
|
|
39
|
+
weekDays
|
|
39
40
|
} = useCalendarGrid({
|
|
40
41
|
...props,
|
|
41
42
|
endDate: endOfMonth(startDate)
|
|
42
43
|
}, state);
|
|
43
44
|
|
|
44
|
-
let dayFormatter = useDateFormatter({weekday: 'narrow'});
|
|
45
|
-
let dayFormatterLong = useDateFormatter({weekday: 'long'});
|
|
46
|
-
|
|
47
45
|
let {locale} = useLocale();
|
|
48
46
|
let monthStart = startOfWeek(startDate, locale);
|
|
49
47
|
let weeksInMonth = getWeeksInMonth(startDate, locale);
|
|
@@ -73,23 +71,17 @@ export function CalendarMonth(props: CalendarMonthProps) {
|
|
|
73
71
|
className={classNames(styles, 'spectrum-Calendar-body', 'spectrum-Calendar-table', {'is-range-selecting': isRangeSelecting})}>
|
|
74
72
|
<thead>
|
|
75
73
|
<tr>
|
|
76
|
-
{
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
<span aria-hidden="true" className={classNames(styles, 'spectrum-Calendar-dayOfWeek')}>
|
|
88
|
-
{day}
|
|
89
|
-
</span>
|
|
90
|
-
</th>
|
|
91
|
-
);
|
|
92
|
-
})}
|
|
74
|
+
{weekDays.map((day, index) => (
|
|
75
|
+
<th
|
|
76
|
+
key={index}
|
|
77
|
+
className={classNames(styles, 'spectrum-Calendar-tableCell')}>
|
|
78
|
+
{/* Make sure screen readers read the full day name, but we show an abbreviation visually. */}
|
|
79
|
+
<VisuallyHidden>{day.long}</VisuallyHidden>
|
|
80
|
+
<span aria-hidden="true" className={classNames(styles, 'spectrum-Calendar-dayOfWeek')}>
|
|
81
|
+
{day.narrow}
|
|
82
|
+
</span>
|
|
83
|
+
</th>
|
|
84
|
+
))}
|
|
93
85
|
</tr>
|
|
94
86
|
</thead>
|
|
95
87
|
<tbody>
|
package/src/RangeCalendar.tsx
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
import {CalendarBase} from './CalendarBase';
|
|
14
14
|
import {createCalendar} from '@internationalized/date';
|
|
15
15
|
import {DateValue, SpectrumRangeCalendarProps} from '@react-types/calendar';
|
|
16
|
-
import React, {useMemo} from 'react';
|
|
16
|
+
import React, {useMemo, useRef} from 'react';
|
|
17
17
|
import {useLocale} from '@react-aria/i18n';
|
|
18
18
|
import {useRangeCalendar} from '@react-aria/calendar';
|
|
19
19
|
import {useRangeCalendarState} from '@react-stately/calendar';
|
|
@@ -32,10 +32,16 @@ export function RangeCalendar<T extends DateValue>(props: SpectrumRangeCalendarP
|
|
|
32
32
|
createCalendar
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
+
let ref = useRef();
|
|
36
|
+
let {calendarProps, prevButtonProps, nextButtonProps} = useRangeCalendar(props, state, ref);
|
|
37
|
+
|
|
35
38
|
return (
|
|
36
39
|
<CalendarBase
|
|
37
40
|
{...props}
|
|
38
41
|
state={state}
|
|
39
|
-
|
|
42
|
+
calendarRef={ref}
|
|
43
|
+
calendarProps={calendarProps}
|
|
44
|
+
prevButtonProps={prevButtonProps}
|
|
45
|
+
nextButtonProps={nextButtonProps} />
|
|
40
46
|
);
|
|
41
47
|
}
|