Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update dependency react-datepicker to v7 #907

Merged
merged 2 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"date-fns": "^3.0.0",
"feather-icons": "^4.29.0",
"prop-types": "^15.8.1",
"react-datepicker": "^6.0.0",
"react-datepicker": "^7.3.0",
"react-is": "~17.0.2",
"react-modal": "^3.16.1",
"react-popper-tooltip": "^4.4.2",
Expand Down Expand Up @@ -62,7 +62,6 @@
"@types/jest": "^29.5.1",
"@types/lodash": "^4.14.186",
"@types/react": "~17.0.58",
"@types/react-datepicker": "^6.0.0",
"@types/react-dom": "~17.0.20",
"@types/react-modal": "^3.16.0",
"@types/styled-components": "^5.1.26",
Expand Down
10 changes: 8 additions & 2 deletions packages/react/src/components/date-picker/date-picker.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ describe('Datepicker', () => {
const callback = jest.fn();
const wrapper = mountWithTheme(<Datepicker onChange={callback} label="date" />);

getByTestId(wrapper, 'text-input').simulate('change', { target: { value: '2002-02-02' } });
const inputTarget = document.createElement('input');
inputTarget.value = '2002-02-02';

getByTestId(wrapper, 'text-input').simulate('change', { target: inputTarget });

expect(callback).toHaveBeenCalledTimes(1);
});
Expand Down Expand Up @@ -52,7 +55,10 @@ describe('Datepicker', () => {
test('input value should format on blur', () => {
const wrapper = mountWithTheme(<Datepicker />);

getByTestId(wrapper, 'text-input').simulate('change', { target: { value: '2002 02 02' } });
const inputTarget = document.createElement('input');
inputTarget.value = '2002 02 02';

getByTestId(wrapper, 'text-input').simulate('change', { target: inputTarget });
getByTestId(wrapper, 'text-input').simulate('blur');

expect(getByTestId(wrapper, 'text-input').props().value).toBe('2002-02-02');
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/components/date-picker/date-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
useRef,
useState,
} from 'react';
import DatePicker, { ReactDatePickerProps, registerLocale } from 'react-datepicker';
import DatePicker, { DatePickerProps, ReactDatePickerCustomHeaderProps, registerLocale } from 'react-datepicker';
import { parse } from 'date-fns';
import datepickerCss from 'react-datepicker/dist/react-datepicker.min.css';
import styled, { createGlobalStyle } from 'styled-components';
Expand Down Expand Up @@ -45,7 +45,7 @@ import {
} from './utils/datepicker-utils';
import { focus } from '../../utils/css-state';

interface StyledDatePickerProps extends ReactDatePickerProps {
type StyledDatePickerProps = DatePickerProps & {
isMobile: boolean;
theme: ResolvedTheme;
valid?: boolean;
Expand Down Expand Up @@ -531,7 +531,7 @@ export const Datepicker = forwardRef(({
isMobile={isMobile}
id={fieldId}
ref={dateInputRef}
renderCustomHeader={(customHeaderProps) => (
renderCustomHeader={(customHeaderProps: ReactDatePickerCustomHeaderProps) => (
<CalendarHeader
months={months}
monthsOptions={monthsOptions}
Expand Down
22 changes: 5 additions & 17 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1691,7 +1691,6 @@ __metadata:
"@types/jest": "npm:^29.5.1"
"@types/lodash": "npm:^4.14.186"
"@types/react": "npm:~17.0.58"
"@types/react-datepicker": "npm:^6.0.0"
"@types/react-dom": "npm:~17.0.20"
"@types/react-modal": "npm:^3.16.0"
"@types/styled-components": "npm:^5.1.26"
Expand Down Expand Up @@ -1719,7 +1718,7 @@ __metadata:
jest-styled-components: "npm:^7.1.1"
prop-types: "npm:^15.8.1"
react: "npm:~17.0.2"
react-datepicker: "npm:^6.0.0"
react-datepicker: "npm:^7.3.0"
react-docgen-typescript-plugin: "npm:1.0.8"
react-dom: "npm:~17.0.2"
react-is: "npm:~17.0.2"
Expand Down Expand Up @@ -4505,17 +4504,6 @@ __metadata:
languageName: node
linkType: hard

"@types/react-datepicker@npm:^6.0.0":
version: 6.2.0
resolution: "@types/react-datepicker@npm:6.2.0"
dependencies:
"@floating-ui/react": "npm:^0.26.2"
"@types/react": "npm:*"
date-fns: "npm:^3.3.1"
checksum: 10c0/40342f0a5e15bac6f2b35072a2f7041db20b924692123aface78f2cbf0e896c0c02c299a9173583e01e5b6dad38e3da86ad0e56e943e74e0c0dc7d5c60129bdf
languageName: node
linkType: hard

"@types/react-dom@npm:18.3.0":
version: 18.3.0
resolution: "@types/react-dom@npm:18.3.0"
Expand Down Expand Up @@ -13205,9 +13193,9 @@ __metadata:
languageName: node
linkType: hard

"react-datepicker@npm:^6.0.0":
version: 6.9.0
resolution: "react-datepicker@npm:6.9.0"
"react-datepicker@npm:^7.3.0":
version: 7.3.0
resolution: "react-datepicker@npm:7.3.0"
dependencies:
"@floating-ui/react": "npm:^0.26.2"
clsx: "npm:^2.1.0"
Expand All @@ -13217,7 +13205,7 @@ __metadata:
peerDependencies:
react: ^16.9.0 || ^17 || ^18
react-dom: ^16.9.0 || ^17 || ^18
checksum: 10c0/aed97871a60071bf00dd1447a7c4a3841a05db6f57bd24b3e499c9ef8c20bc5c46a826b6b0667ae804c4ddd2bb88319bd8115a08bb670c2a57505b0a7a18bec6
checksum: 10c0/a926c896fbd827bd6195e5fdbf98bf48fc86a076112bcff38dcbd580da24a98c0c8f5ed1a1dfb2d91076134e41b209e118ccd41cbc3b2036e94c54af25e1788c
languageName: node
linkType: hard

Expand Down
Loading