Skip to content

Commit

Permalink
fix(date-range-picker): update react-aria and fix types (#1995)
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusps authored Oct 10, 2024
2 parents 65d092a + 5a3ac60 commit 0c6dddb
Show file tree
Hide file tree
Showing 3 changed files with 8,393 additions and 15,957 deletions.
18 changes: 9 additions & 9 deletions packages/shoreline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@
},
"dependencies": {
"@ariakit/react": "0.4.11",
"@internationalized/date": "3.5.4",
"@react-aria/calendar": "3.5.8",
"@react-aria/checkbox": "3.14.3",
"@react-aria/datepicker": "3.10.1",
"@react-aria/focus": "3.17.1",
"@react-aria/i18n": "3.11.1",
"@react-aria/interactions": "3.21.3",
"@react-stately/calendar": "3.5.1",
"@react-stately/datepicker": "3.9.4",
"@internationalized/date": "3.5.6",
"@react-aria/calendar": "3.5.12",
"@react-aria/checkbox": "3.14.7",
"@react-aria/datepicker": "3.11.3",
"@react-aria/focus": "3.18.3",
"@react-aria/i18n": "3.12.3",
"@react-aria/interactions": "3.22.3",
"@react-stately/calendar": "3.5.5",
"@react-stately/datepicker": "3.10.3",
"@react-stately/toggle": "3.7.4",
"@vtex/shoreline-utils": "^1.0.67",
"react-hot-toast": "2.4.1",
Expand Down
13 changes: 10 additions & 3 deletions packages/shoreline/src/components/calendar/calendar-cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,18 @@ export function CalendarCell(props: CalendarCellProps) {
isFocused,
} = useCalendarCell({ date }, store.state, ref)

const isSelectionStart = isRangeCalendar(store.state)
? isSameDay(date, store.state?.highlightedRange?.start)
if (!store) {
return null
}

const canUseSelection =
isRangeCalendar(store.state) && store.state.highlightedRange

const isSelectionStart = canUseSelection
? isSameDay(date, store.state.highlightedRange.start)
: isSelected

const isSelectionEnd = isRangeCalendar(store.state)
const isSelectionEnd = canUseSelection
? isSameDay(date, store.state.highlightedRange.end)
: isSelected

Expand Down
Loading

0 comments on commit 0c6dddb

Please sign in to comment.