Skip to content

Commit

Permalink
bugfix release
Browse files Browse the repository at this point in the history
  • Loading branch information
dohomi committed Dec 5, 2024
1 parent c9fca0e commit 1b256b2
Show file tree
Hide file tree
Showing 7 changed files with 138 additions and 22 deletions.
2 changes: 1 addition & 1 deletion apps/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@mui/icons-material": "6.0.1",
"@mui/material": "6.0.1",
"@mui/system": "6.0.1",
"@mui/x-date-pickers": "7.17.0",
"@mui/x-date-pickers": "7.22.2",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-hook-form-mui": "portal:../../packages/rhf-mui"
Expand Down
2 changes: 1 addition & 1 deletion packages/rhf-mui/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "7.3.1",
"version": "7.4.1",
"license": "MIT",
"repository": "https://github.com/dohomi/react-hook-form-mui",
"homepage": "https://react-hook-form-material-ui.vercel.app",
Expand Down
12 changes: 6 additions & 6 deletions packages/rhf-mui/src/DatePickerElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ import {
DateValidationError,
PickerChangeHandlerContext,
validateDate,
} from "@mui/x-date-pickers";
import {useLocalizationContext} from "@mui/x-date-pickers/internals";
import {defaultErrorMessages} from "./messages/DatePicker";
import {useTransform} from "./useTransform";
import {getTimezone, readValueAsDate} from "./utils";
import {PickerValidDate} from "@mui/x-date-pickers/models";
} from '@mui/x-date-pickers'
import {useLocalizationContext} from '@mui/x-date-pickers/internals'
import {defaultErrorMessages} from './messages/DatePicker'
import {useTransform} from './useTransform'
import {getTimezone, readValueAsDate} from './utils'
import {PickerValidDate} from '@mui/x-date-pickers/models'

export type DatePickerElementProps<
TFieldValues extends FieldValues = FieldValues,
Expand Down
23 changes: 15 additions & 8 deletions packages/rhf-mui/src/DateTimePickerElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,21 @@ import {
validateDateTime,
} from '@mui/x-date-pickers'
import {useLocalizationContext} from '@mui/x-date-pickers/internals'
import {Control, FieldError, FieldPath, PathValue, useController, UseControllerProps,} from "react-hook-form";
import {TextFieldProps, useForkRef} from "@mui/material";
import {FieldValues} from "react-hook-form/dist/types/fields";
import {useFormError} from "./FormErrorProvider";
import {forwardRef, ReactNode, Ref, RefAttributes} from "react";
import {defaultErrorMessages} from "./messages/DateTimePicker";
import {useTransform} from "./useTransform";
import {getTimezone, readValueAsDate} from "./utils";
import {
Control,
FieldError,
FieldPath,
PathValue,
useController,
UseControllerProps,
} from 'react-hook-form'
import {TextFieldProps, useForkRef} from '@mui/material'
import {FieldValues} from 'react-hook-form/dist/types/fields'
import {useFormError} from './FormErrorProvider'
import {forwardRef, ReactNode, Ref, RefAttributes} from 'react'
import {defaultErrorMessages} from './messages/DateTimePicker'
import {useTransform} from './useTransform'
import {getTimezone, readValueAsDate} from './utils'

export type DateTimePickerElementProps<
TFieldValues extends FieldValues = FieldValues,
Expand Down
3 changes: 2 additions & 1 deletion packages/rhf-mui/src/RadioButtonGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
FormLabelProps,
Radio,
RadioGroup,
RadioGroupProps,
RadioProps,
useTheme,
} from '@mui/material'
Expand Down Expand Up @@ -167,7 +168,7 @@ const RadioButtonGroup = forwardRef(function RadioButtonGroup<
{...labelProps}
control={
<Radio
{...radioProps}
{...radioProps}
sx={{
color: error ? theme.palette.error.main : undefined,
}}
Expand Down
8 changes: 4 additions & 4 deletions packages/rhf-mui/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type PickerValidDate } from '@mui/x-date-pickers'
import {type PickerValidDate} from '@mui/x-date-pickers'
import {useLocalizationContext} from '@mui/x-date-pickers/internals'

export function propertyExists<X, Y extends PropertyKey>(
Expand All @@ -25,11 +25,11 @@ export function readValueAsDate<TDate extends PickerValidDate>(
adapter: ReturnType<typeof useLocalizationContext>,
value: string | null | TDate
): TDate | null {
if(typeof value === 'string'){
if(value === ''){
if (typeof value === 'string') {
if (value === '') {
return null
}
return adapter.utils.date(value) as TDate
}
return value
}
}
110 changes: 109 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,15 @@ __metadata:
languageName: node
linkType: hard

"@babel/runtime@npm:^7.25.7, @babel/runtime@npm:^7.26.0":
version: 7.26.0
resolution: "@babel/runtime@npm:7.26.0"
dependencies:
regenerator-runtime: "npm:^0.14.0"
checksum: 10/9f4ea1c1d566c497c052d505587554e782e021e6ccd302c2ad7ae8291c8e16e3f19d4a7726fb64469e057779ea2081c28b7dbefec6d813a22f08a35712c0f699
languageName: node
linkType: hard

"@babel/template@npm:^7.22.15, @babel/template@npm:^7.24.0":
version: 7.24.0
resolution: "@babel/template@npm:7.24.0"
Expand Down Expand Up @@ -2552,6 +2561,18 @@ __metadata:
languageName: node
linkType: hard

"@mui/types@npm:^7.2.19":
version: 7.2.19
resolution: "@mui/types@npm:7.2.19"
peerDependencies:
"@types/react": ^17.0.0 || ^18.0.0 || ^19.0.0
peerDependenciesMeta:
"@types/react":
optional: true
checksum: 10/a23bc280c0722527ce5e264b0dcb44271441e4016eb2285acc1f0d236cf78c73ecc3ec7abba81876c2eadf45b905b55eb26e0e824ea6afc233efce2ef5a34f7d
languageName: node
linkType: hard

"@mui/utils@npm:^5.16.6":
version: 5.16.6
resolution: "@mui/utils@npm:5.16.6"
Expand All @@ -2572,6 +2593,26 @@ __metadata:
languageName: node
linkType: hard

"@mui/utils@npm:^5.16.6 || ^6.0.0":
version: 6.1.8
resolution: "@mui/utils@npm:6.1.8"
dependencies:
"@babel/runtime": "npm:^7.26.0"
"@mui/types": "npm:^7.2.19"
"@types/prop-types": "npm:^15.7.13"
clsx: "npm:^2.1.1"
prop-types: "npm:^15.8.1"
react-is: "npm:^18.3.1"
peerDependencies:
"@types/react": ^17.0.0 || ^18.0.0 || ^19.0.0
react: ^17.0.0 || ^18.0.0 || ^19.0.0
peerDependenciesMeta:
"@types/react":
optional: true
checksum: 10/093a952ce4834e71911550e7bb17f02fe389b948deefec304c58c1970c5a4c454a44a1ec0a8f426eb294cace410356d2ac0ee4bb5f4628c23cf044399d4258be
languageName: node
linkType: hard

"@mui/utils@npm:^6.0.1":
version: 6.0.1
resolution: "@mui/utils@npm:6.0.1"
Expand Down Expand Up @@ -2640,6 +2681,54 @@ __metadata:
languageName: node
linkType: hard

"@mui/x-date-pickers@npm:7.22.2":
version: 7.22.2
resolution: "@mui/x-date-pickers@npm:7.22.2"
dependencies:
"@babel/runtime": "npm:^7.25.7"
"@mui/utils": "npm:^5.16.6 || ^6.0.0"
"@mui/x-internals": "npm:7.21.0"
"@types/react-transition-group": "npm:^4.4.11"
clsx: "npm:^2.1.1"
prop-types: "npm:^15.8.1"
react-transition-group: "npm:^4.4.5"
peerDependencies:
"@emotion/react": ^11.9.0
"@emotion/styled": ^11.8.1
"@mui/material": ^5.15.14 || ^6.0.0
"@mui/system": ^5.15.14 || ^6.0.0
date-fns: ^2.25.0 || ^3.2.0 || ^4.0.0
date-fns-jalali: ^2.13.0-0 || ^3.2.0-0
dayjs: ^1.10.7
luxon: ^3.0.2
moment: ^2.29.4
moment-hijri: ^2.1.2 || ^3.0.0
moment-jalaali: ^0.7.4 || ^0.8.0 || ^0.9.0 || ^0.10.0
react: ^17.0.0 || ^18.0.0
react-dom: ^17.0.0 || ^18.0.0
peerDependenciesMeta:
"@emotion/react":
optional: true
"@emotion/styled":
optional: true
date-fns:
optional: true
date-fns-jalali:
optional: true
dayjs:
optional: true
luxon:
optional: true
moment:
optional: true
moment-hijri:
optional: true
moment-jalaali:
optional: true
checksum: 10/c49ba39b51e08f2b061d62652cd342d8547e3d43ade51ea97bf0d0b5d2aa2e10385faf37f65eec944984a3738ec07ebdddd78b9590c60bb2741b0678aee1e36b
languageName: node
linkType: hard

"@mui/x-internals@npm:7.17.0":
version: 7.17.0
resolution: "@mui/x-internals@npm:7.17.0"
Expand All @@ -2652,6 +2741,18 @@ __metadata:
languageName: node
linkType: hard

"@mui/x-internals@npm:7.21.0":
version: 7.21.0
resolution: "@mui/x-internals@npm:7.21.0"
dependencies:
"@babel/runtime": "npm:^7.25.7"
"@mui/utils": "npm:^5.16.6 || ^6.0.0"
peerDependencies:
react: ^17.0.0 || ^18.0.0
checksum: 10/57a91e67cff9f82fafe883ae0e54e56c43d3ba15f5f99652e66e25e65900f76a5c0b0a49aac27f0f3167e7f955438c987c0a6dae61117420a9b851258a3f7360
languageName: node
linkType: hard

"@ndelangen/get-tarball@npm:^3.0.7":
version: 3.0.9
resolution: "@ndelangen/get-tarball@npm:3.0.9"
Expand Down Expand Up @@ -4140,6 +4241,13 @@ __metadata:
languageName: node
linkType: hard

"@types/prop-types@npm:^15.7.13":
version: 15.7.13
resolution: "@types/prop-types@npm:15.7.13"
checksum: 10/8935cad87c683c665d09a055919d617fe951cb3b2d5c00544e3a913f861a2bd8d2145b51c9aa6d2457d19f3107ab40784c40205e757232f6a80cc8b1c815513c
languageName: node
linkType: hard

"@types/qs@npm:*, @types/qs@npm:^6.9.5":
version: 6.9.15
resolution: "@types/qs@npm:6.9.15"
Expand Down Expand Up @@ -11198,7 +11306,7 @@ __metadata:
"@mui/icons-material": "npm:6.0.1"
"@mui/material": "npm:6.0.1"
"@mui/system": "npm:6.0.1"
"@mui/x-date-pickers": "npm:7.17.0"
"@mui/x-date-pickers": "npm:7.22.2"
"@storybook/addon-essentials": "npm:8.0.10"
"@storybook/react": "npm:8.0.10"
"@storybook/react-vite": "npm:8.0.10"
Expand Down

0 comments on commit 1b256b2

Please sign in to comment.