Skip to content

Commit a23eebc

Browse files
authored
chore: bump react to the v19 (#75)
* chore: bump react to the v19 * fix: make e2e more robust
1 parent 76986c2 commit a23eebc

File tree

4 files changed

+1184
-1133
lines changed

4 files changed

+1184
-1133
lines changed

packages/datepicker/package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rehookify/datepicker",
3-
"version": "6.6.7",
3+
"version": "6.6.8",
44
"description": "The ultimate tool to create a date, range and time picker in your React applications.",
55
"main": "dist/index.cjs.js",
66
"module": "dist/index.esm.mjs",
@@ -60,24 +60,24 @@
6060
},
6161
"homepage": "https://github.com/rehookify/datepicker#readme",
6262
"devDependencies": {
63-
"@babel/core": "^7.25.2",
64-
"@babel/preset-env": "^7.25.4",
65-
"@babel/preset-typescript": "^7.24.7",
66-
"@rollup/plugin-commonjs": "^26.0.1",
67-
"@rollup/plugin-node-resolve": "^15.2.3",
63+
"@babel/core": "^7.26.0",
64+
"@babel/preset-env": "^7.26.0",
65+
"@babel/preset-typescript": "^7.26.0",
66+
"@rollup/plugin-commonjs": "^28.0.1",
67+
"@rollup/plugin-node-resolve": "^15.3.0",
6868
"@rollup/plugin-terser": "^0.4.4",
69-
"@testing-library/react": "^16.0.1",
70-
"@types/react": "^18.3.5",
71-
"jsdom": "^25.0.0",
72-
"react": "^18.3.1",
69+
"@testing-library/react": "^16.1.0",
70+
"@types/react": "^19.0.0",
71+
"jsdom": "^25.0.1",
72+
"react": "^19.0.0",
7373
"rimraf": "^6.0.1",
74-
"rollup": "^4.21.2",
74+
"rollup": "^4.28.0",
7575
"rollup-plugin-peer-deps-external": "^2.2.4",
7676
"rollup-plugin-typescript2": "^0.36.0",
77-
"vitest": "^2.0.5"
77+
"vitest": "^2.1.8"
7878
},
7979
"peerDependencies": {
80-
"react": "^16.8.0 || ^17 || ^18"
80+
"react": "^16.8.0 || ^17 || ^18 || ^19"
8181
},
8282
"publishConfig": {
8383
"access": "public"

packages/datepicker/src/use-date-picker-state.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
1-
import { Reducer, useReducer } from 'react';
1+
import { useReducer } from 'react';
22

33
import { stateReducer } from './state-reducer';
4-
import type {
5-
DPReducerAction,
6-
DPReducerState,
7-
DPState,
8-
DPUserConfig,
9-
} from './types';
4+
import type { DPState, DPUserConfig } from './types';
105
import { createConfig } from './utils/config';
116
import { createInitialState } from './utils/create-initial-state';
127

138
export const useDatePickerState = (config: DPUserConfig): DPState => {
149
const dpConfig = createConfig(config);
1510

16-
const [state, dispatch] = useReducer<
17-
Reducer<DPReducerState, DPReducerAction>
18-
>(stateReducer, createInitialState(dpConfig));
11+
const [state, dispatch] = useReducer(
12+
stateReducer,
13+
createInitialState(dpConfig),
14+
);
1915

2016
return {
2117
dispatch,

packages/examples-e2e/test/min-max-date.spec.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,8 @@ test('month and years availability with min and max date', async ({ page }) => {
55

66
const NOW = new Date();
77
const Y = NOW.getFullYear();
8-
const M = NOW.getMonth();
98
const currentMonthName = NOW.toLocaleDateString('en-us', { month: 'long' });
109

11-
const nextMonth = new Date(Y, M + 1, 1);
12-
const nextMonthName = nextMonth.toLocaleDateString('en-us', {
13-
month: 'long',
14-
});
15-
1610
// Previous year should be enabled since we are defining minDate as new Date(Y - 1, 0, 1)
1711
await expect(page.getByRole('button', { name: `${Y - 1}` })).toBeEnabled();
1812

@@ -24,11 +18,16 @@ test('month and years availability with min and max date', async ({ page }) => {
2418
page.getByRole('button', { name: currentMonthName }),
2519
).toBeEnabled();
2620

27-
// Next month should be disabled since we are defining maxDate as new Date()
28-
await expect(
29-
page.getByRole('button', { name: nextMonthName }),
30-
).toBeDisabled();
21+
const nextMonthButton = page.getByRole('button', {
22+
name: /next month button/i,
23+
});
24+
const previousMonthButton = page.getByRole('button', {
25+
name: /previous month button/i,
26+
});
27+
28+
await expect(nextMonthButton).toBeDisabled();
29+
await expect(previousMonthButton).toBeEnabled();
3130

32-
await page.getByRole('button', { name: `${Y - 1}` }).click();
33-
await expect(page.getByRole('button', { name: /january/i })).toBeEnabled();
31+
await previousMonthButton.click();
32+
await expect(nextMonthButton).toBeEnabled();
3433
});

0 commit comments

Comments
 (0)