Skip to content

Commit 74dd7dc

Browse files
ciampoaduth
andauthored
UI: Upgrade React DayPicker to version 10 (#81439)
* UI: Upgrade React DayPicker to version 10 * UI: Add React DayPicker upgrade changelog --- Co-authored-by: ciampo <mciampini@git.wordpress.org> Co-authored-by: aduth <aduth@git.wordpress.org>
1 parent 7f83800 commit 74dd7dc

13 files changed

Lines changed: 68 additions & 52 deletions

package-lock.json

Lines changed: 52 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ui/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
### Internal
2121

22+
- Update React DayPicker from 9.14.0 to 10.0.1 and adopt the scoped package. ([#81439](https://github.com/WordPress/gutenberg/pull/81439))
2223
- Remove obsolete dependency grouping comments as part of the repository-wide separator-free import migration. ([#81248](https://github.com/WordPress/gutenberg/pull/81248))
2324
- Refactor shared focus utilities to use the `outset-ring__focus()` mixin from `@wordpress/base-styles` ([#80635](https://github.com/WordPress/gutenberg/pull/80635)).
2425
- `Button`: Expand the Storybook e2e `VariantStates` matrix with compact, small, and with-icon rows ([#80793](https://github.com/WordPress/gutenberg/pull/80793)).

packages/ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"sideEffects": false,
4545
"dependencies": {
4646
"@base-ui/react": "^1.6.0",
47+
"@daypicker/react": "^10.0.1",
4748
"@wordpress/a11y": "file:../a11y",
4849
"@wordpress/compose": "file:../compose",
4950
"@wordpress/element": "file:../element",
@@ -56,7 +57,6 @@
5657
"@wordpress/theme": "file:../theme",
5758
"clsx": "^2.1.1",
5859
"date-fns": "^4.4.0",
59-
"react-day-picker": "^9.14.0",
6060
"tabbable": "^6.4.0"
6161
},
6262
"devDependencies": {

packages/ui/src/calendar/calendar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { DayPicker } from 'react-day-picker';
2-
import { enUS } from 'react-day-picker/locale';
1+
import { DayPicker } from '@daypicker/react';
2+
import { enUS } from '@daypicker/react/locale';
33
import { forwardRef, useCallback, useMemo } from '@wordpress/element';
44
import { COMMON_PROPS } from './utils/constants';
55
import { clampNumberOfMonths } from './utils/misc';

packages/ui/src/calendar/range-calendar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { differenceInCalendarDays } from 'date-fns';
2-
import { DayPicker, rangeContainsModifiers } from 'react-day-picker';
3-
import { enUS } from 'react-day-picker/locale';
2+
import { DayPicker, rangeContainsModifiers } from '@daypicker/react';
3+
import { enUS } from '@daypicker/react/locale';
44
import { forwardRef, useMemo, useState, useCallback } from '@wordpress/element';
55
import { COMMON_PROPS, MODIFIER_CLASSNAMES } from './utils/constants';
66
import { clampNumberOfMonths } from './utils/misc';

packages/ui/src/calendar/stories/index.story.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { fn } from 'storybook/test';
2-
import { TZDate } from 'react-day-picker';
2+
import { TZDate } from '@daypicker/react';
33
import type { Meta, StoryObj } from '@storybook/react-vite';
44
import { useState, useEffect } from '@wordpress/element';
55
import { Calendar } from '../index';

packages/ui/src/calendar/stories/range-calendar.story.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { fn } from 'storybook/test';
2-
import { TZDate } from 'react-day-picker';
2+
import { TZDate } from '@daypicker/react';
33
import type { Meta, StoryObj } from '@storybook/react-vite';
44
import { useState, useEffect } from '@wordpress/element';
55
import { RangeCalendar } from '../index';

packages/ui/src/calendar/stories/shared.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
sv,
1919
} from 'date-fns/locale';
2020

21-
// Storybook date controls pass a number, but react-day-picker expects a Date
21+
// Storybook date controls pass a number, but DayPicker expects a Date.
2222
// for props such as `endMonth`.
2323
export function toDate( value: Date | number | undefined ): Date | undefined {
2424
return value === undefined ? undefined : new Date( value );

packages/ui/src/calendar/test/calendar.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from 'date-fns';
1616
import { ar } from 'date-fns/locale';
1717
import { useState } from '@wordpress/element';
18-
import { TZDate } from 'react-day-picker';
18+
import { TZDate } from '@daypicker/react';
1919
import { Calendar } from '..';
2020
import {
2121
getDateButton,

packages/ui/src/calendar/test/range-calendar.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from 'date-fns';
1616
import { ar } from 'date-fns/locale';
1717
import { useState } from '@wordpress/element';
18-
import { TZDate } from 'react-day-picker';
18+
import { TZDate } from '@daypicker/react';
1919
import { usePreviewRange, RangeCalendar } from '../range-calendar';
2020
import { getDateButton, getDateCell, monthNameFormatter } from './__utils__';
2121
import type { DateRange, RangeCalendarProps } from '../types';

0 commit comments

Comments
 (0)