@react-stately/calendar
Advanced tools
Comparing version 3.0.0-nightly.1438 to 3.0.0-nightly.1446
@@ -253,3 +253,3 @@ var $hEzMm$internationalizeddate = require("@internationalized/date"); | ||
isSelected (date) { | ||
return calendarDateValue != null && $hEzMm$internationalizeddate.isSameDay(date, calendarDateValue); | ||
return calendarDateValue != null && $hEzMm$internationalizeddate.isSameDay(date, calendarDateValue) && !this.isCellDisabled(date); | ||
}, | ||
@@ -260,3 +260,3 @@ isCellFocused (date) { | ||
isCellDisabled (date) { | ||
return props.isDisabled || date.compare(startDate) < 0 || date.compare(endDate) > 0 || $4301262d71f567b9$export$eac50920cf2fd59a(date, minValue, maxValue); | ||
return props.isDisabled || date.compare(startDate) < 0 || date.compare(endDate) > 0 || $4301262d71f567b9$export$eac50920cf2fd59a(date, minValue, maxValue) || props.isDateDisabled && props.isDateDisabled(date); | ||
}, | ||
@@ -338,3 +338,3 @@ isPreviousVisibleRangeInvalid () { | ||
isSelected (date) { | ||
return highlightedRange && date.compare(highlightedRange.start) >= 0 && date.compare(highlightedRange.end) <= 0; | ||
return highlightedRange && date.compare(highlightedRange.start) >= 0 && date.compare(highlightedRange.end) <= 0 && !calendar.isCellDisabled(date); | ||
}, | ||
@@ -341,0 +341,0 @@ isDragging: isDragging, |
@@ -237,3 +237,3 @@ import {toCalendar as $keQhS$toCalendar, toCalendarDate as $keQhS$toCalendarDate, today as $keQhS$today, GregorianCalendar as $keQhS$GregorianCalendar, isSameDay as $keQhS$isSameDay, startOfYear as $keQhS$startOfYear, startOfMonth as $keQhS$startOfMonth, startOfWeek as $keQhS$startOfWeek, maxDate as $keQhS$maxDate, minDate as $keQhS$minDate} from "@internationalized/date"; | ||
isSelected (date) { | ||
return calendarDateValue != null && $keQhS$isSameDay(date, calendarDateValue); | ||
return calendarDateValue != null && $keQhS$isSameDay(date, calendarDateValue) && !this.isCellDisabled(date); | ||
}, | ||
@@ -244,3 +244,3 @@ isCellFocused (date) { | ||
isCellDisabled (date) { | ||
return props.isDisabled || date.compare(startDate) < 0 || date.compare(endDate) > 0 || $f62d864046160412$export$eac50920cf2fd59a(date, minValue, maxValue); | ||
return props.isDisabled || date.compare(startDate) < 0 || date.compare(endDate) > 0 || $f62d864046160412$export$eac50920cf2fd59a(date, minValue, maxValue) || props.isDateDisabled && props.isDateDisabled(date); | ||
}, | ||
@@ -322,3 +322,3 @@ isPreviousVisibleRangeInvalid () { | ||
isSelected (date) { | ||
return highlightedRange && date.compare(highlightedRange.start) >= 0 && date.compare(highlightedRange.end) <= 0; | ||
return highlightedRange && date.compare(highlightedRange.start) >= 0 && date.compare(highlightedRange.end) <= 0 && !calendar.isCellDisabled(date); | ||
}, | ||
@@ -325,0 +325,0 @@ isDragging: isDragging, |
@@ -1,2 +0,2 @@ | ||
import { CalendarDate, Calendar, Duration } from "@internationalized/date"; | ||
import { CalendarDate, Calendar, DateDuration } from "@internationalized/date"; | ||
import { DateValue, CalendarProps, RangeCalendarProps } from "@react-types/calendar"; | ||
@@ -51,3 +51,3 @@ import { RangeValue } from "@react-types/shared"; | ||
createCalendar: (name: string) => Calendar; | ||
visibleDuration?: Duration; | ||
visibleDuration?: DateDuration; | ||
selectionAlignment?: 'start' | 'center' | 'end'; | ||
@@ -59,3 +59,3 @@ } | ||
createCalendar: (name: string) => Calendar; | ||
visibleDuration?: Duration; | ||
visibleDuration?: DateDuration; | ||
} | ||
@@ -62,0 +62,0 @@ export function useRangeCalendarState<T extends DateValue>(props: RangeCalendarStateOptions<T>): RangeCalendarState; |
{ | ||
"name": "@react-stately/calendar", | ||
"version": "3.0.0-nightly.1438+6fa5706ef", | ||
"version": "3.0.0-nightly.1446+51ff50c6f", | ||
"description": "Spectrum UI components in React", | ||
@@ -21,8 +21,8 @@ "license": "Apache-2.0", | ||
"@babel/runtime": "^7.6.2", | ||
"@internationalized/date": "3.0.0-nightly.3134+6fa5706ef", | ||
"@react-aria/i18n": "3.0.0-nightly.1438+6fa5706ef", | ||
"@react-stately/utils": "3.0.0-nightly.1438+6fa5706ef", | ||
"@react-types/calendar": "3.0.0-nightly.3134+6fa5706ef", | ||
"@react-types/datepicker": "3.0.0-nightly.3134+6fa5706ef", | ||
"@react-types/shared": "3.0.0-nightly.1438+6fa5706ef", | ||
"@internationalized/date": "3.0.0-nightly.3142+51ff50c6f", | ||
"@react-aria/i18n": "3.0.0-nightly.1446+51ff50c6f", | ||
"@react-stately/utils": "3.0.0-nightly.1446+51ff50c6f", | ||
"@react-types/calendar": "3.0.0-nightly.3142+51ff50c6f", | ||
"@react-types/datepicker": "3.0.0-nightly.3142+51ff50c6f", | ||
"@react-types/shared": "3.0.0-nightly.1446+51ff50c6f", | ||
"date-fns": "^1.30.1" | ||
@@ -36,3 +36,3 @@ }, | ||
}, | ||
"gitHead": "6fa5706efb7bb7d8c322b8f756c451378ca962ce" | ||
"gitHead": "51ff50c6fed6df76c22467622b17b2af2d9380e0" | ||
} |
@@ -17,3 +17,3 @@ /* | ||
CalendarDate, | ||
Duration, | ||
DateDuration, | ||
GregorianCalendar, | ||
@@ -34,3 +34,3 @@ isSameDay, | ||
createCalendar: (name: string) => Calendar, | ||
visibleDuration?: Duration, | ||
visibleDuration?: DateDuration, | ||
selectionAlignment?: 'start' | 'center' | 'end' | ||
@@ -195,3 +195,3 @@ } | ||
isSelected(date) { | ||
return calendarDateValue != null && isSameDay(date, calendarDateValue); | ||
return calendarDateValue != null && isSameDay(date, calendarDateValue) && !this.isCellDisabled(date); | ||
}, | ||
@@ -202,3 +202,3 @@ isCellFocused(date) { | ||
isCellDisabled(date) { | ||
return props.isDisabled || date.compare(startDate) < 0 || date.compare(endDate) > 0 || isInvalid(date, minValue, maxValue); | ||
return props.isDisabled || date.compare(startDate) < 0 || date.compare(endDate) > 0 || isInvalid(date, minValue, maxValue) || (props.isDateDisabled && props.isDateDisabled(date)); | ||
}, | ||
@@ -205,0 +205,0 @@ isPreviousVisibleRangeInvalid() { |
@@ -14,3 +14,3 @@ /* | ||
import {alignCenter} from './utils'; | ||
import {Calendar, CalendarDate, Duration, GregorianCalendar, toCalendar, toCalendarDate} from '@internationalized/date'; | ||
import {Calendar, CalendarDate, DateDuration, GregorianCalendar, toCalendar, toCalendarDate} from '@internationalized/date'; | ||
import {DateRange, DateValue} from '@react-types/calendar'; | ||
@@ -27,3 +27,3 @@ import {RangeCalendarProps} from '@react-types/calendar'; | ||
createCalendar: (name: string) => Calendar, | ||
visibleDuration?: Duration | ||
visibleDuration?: DateDuration | ||
} | ||
@@ -98,3 +98,3 @@ | ||
isSelected(date) { | ||
return highlightedRange && date.compare(highlightedRange.start) >= 0 && date.compare(highlightedRange.end) <= 0; | ||
return highlightedRange && date.compare(highlightedRange.start) >= 0 && date.compare(highlightedRange.end) <= 0 && !calendar.isCellDisabled(date); | ||
}, | ||
@@ -101,0 +101,0 @@ isDragging, |
@@ -14,3 +14,3 @@ /* | ||
CalendarDate, | ||
Duration, | ||
DateDuration, | ||
maxDate, | ||
@@ -30,4 +30,4 @@ minDate, | ||
export function alignCenter(date: CalendarDate, duration: Duration, locale: string, minValue?: DateValue, maxValue?: DateValue) { | ||
let halfDuration: Duration = {}; | ||
export function alignCenter(date: CalendarDate, duration: DateDuration, locale: string, minValue?: DateValue, maxValue?: DateValue) { | ||
let halfDuration: DateDuration = {}; | ||
for (let key in duration) { | ||
@@ -44,3 +44,3 @@ halfDuration[key] = Math.floor(duration[key] / 2); | ||
export function alignStart(date: CalendarDate, duration: Duration, locale: string, minValue?: DateValue, maxValue?: DateValue) { | ||
export function alignStart(date: CalendarDate, duration: DateDuration, locale: string, minValue?: DateValue, maxValue?: DateValue) { | ||
// align to the start of the largest unit | ||
@@ -59,3 +59,3 @@ let aligned = date; | ||
export function alignEnd(date: CalendarDate, duration: Duration, locale: string, minValue?: DateValue, maxValue?: DateValue) { | ||
export function alignEnd(date: CalendarDate, duration: DateDuration, locale: string, minValue?: DateValue, maxValue?: DateValue) { | ||
let d = {...duration}; | ||
@@ -80,3 +80,3 @@ // subtract 1 from the smallest unit | ||
aligned: CalendarDate, | ||
duration: Duration, | ||
duration: DateDuration, | ||
locale: string, | ||
@@ -83,0 +83,0 @@ minValue: DateValue, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
129402