Skip to content

Commit d18cfa1

Browse files
authored
v2.1.1 - Internal optimization; fix minor bug in RHFSelect (#13)
* upgrade to eslint v9 and flat-config for rhf-mui components and demo * fix misc module * fix mui-pickers * cleanup mui module * correct rhfselect logic, update changelog, bump versions * fix tsc-alias version * upgrade tsc-alias to 1.8.13, and changelog
1 parent c64d7b4 commit d18cfa1

File tree

55 files changed

+1402
-355
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1402
-355
lines changed

Changelog.md

+10
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ description: Introduction and installation of @nish1896/rhf-mui-components packa
77

88
# **What's changed?**
99

10+
## [2.1.1](https://github.com/nishkohli96/rhf-mui-components/tree/v2.1.1)
11+
12+
**Released - 30 Mar, 2025**
13+
14+
## Fixes & Enhancements
15+
- Internal optimization to reduce bundle size
16+
- Correct `fieldLabelText` logic in [RHFSelect](https://rhf-mui-components.netlify.app/components/mui/rhfselect)
17+
- Use [@nish1896/eslint-flat-config](https://www.npmjs.com/package/@nish1896/eslint-flat-config) in `@nish1896/rhf-mui-components` package.
18+
19+
1020
## [2.1.0](https://github.com/nishkohli96/rhf-mui-components/tree/v2.1.0)
1121

1222
**Released - 3 Mar, 2025**

apps/rhf-mui-demo/.eslintrc.json

-7
This file was deleted.

apps/rhf-mui-demo/eslint.config.mjs

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { dirname } from 'path';
2+
import { fileURLToPath } from 'url';
3+
import { FlatCompat } from '@eslint/eslintrc';
4+
import jsConfig from '@nish1896/eslint-flat-config/js';
5+
import nextTsConfig from '@nish1896/eslint-flat-config/next-ts';
6+
import nextConfig from '@nish1896/eslint-flat-config/next';
7+
8+
const __filename = fileURLToPath(import.meta.url);
9+
const __dirname = dirname(__filename);
10+
11+
const compat = new FlatCompat({
12+
baseDirectory: __dirname,
13+
});
14+
15+
const eslintConfig = [
16+
...compat.extends('next/core-web-vitals', 'next/typescript'),
17+
...jsConfig,
18+
...nextTsConfig,
19+
...nextConfig,
20+
{
21+
/**
22+
* Somehow loading this rule is causing issues, when using
23+
* NextApp in monorepo, thus disabling this for now.
24+
*/
25+
rules: {
26+
'@typescript-eslint/no-empty-function': 'off'
27+
}
28+
}
29+
];
30+
31+
export default eslintConfig;

apps/rhf-mui-demo/package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nish1896/rhf-mui-demo",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"private": true,
55
"author": "Nishant Kohli",
66
"scripts": {
@@ -42,13 +42,14 @@
4242
"zod": "^3.23.8"
4343
},
4444
"devDependencies": {
45-
"@nish1896/eslint-config": "^2.1.1",
45+
"@eslint/js": "^9.22.0",
46+
"@nish1896/eslint-flat-config": "^2.0.0",
4647
"@types/luxon": "^3.4.2",
4748
"@types/node": "^20",
4849
"@types/react": "^18",
4950
"@types/react-dom": "^18",
50-
"eslint": "^8",
51-
"eslint-config-next": "14.2.16",
51+
"eslint": "^9.22.0",
52+
"eslint-config-next": "15.2.3",
5253
"postcss": "^8",
5354
"tailwindcss": "^3.4.1",
5455
"typescript": "^5"

apps/rhf-mui-demo/src/forms/select-with-class-validator/index.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ const SelectFormWithClassValidator = () => {
6565
valueKey="abbr"
6666
showLabelAboveFormField
6767
showDefaultOption
68+
defaultOptionText='Select IPL teams'
69+
label={
70+
<Typography variant="body1" color="success">
71+
Select your favourite IPL teams
72+
</Typography>
73+
}
6874
required
6975
multiple
7076
errorMessage={errors?.iplTeams?.message}

apps/rhf-mui-docs/docs/changelog.md

+9
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ description: Introduction and installation of @nish1896/rhf-mui-components packa
77

88
# **What's changed?**
99

10+
## [2.1.1](https://github.com/nishkohli96/rhf-mui-components/tree/v2.1.1)
11+
12+
**Released - 30 Mar, 2025**
13+
14+
## Fixes & Enhancements
15+
- Internal optimization to reduce bundle size
16+
- Correct `fieldLabelText` logic in [RHFSelect](./components/mui/RHFSelect.mdx)
17+
18+
1019
## [2.1.0](https://github.com/nishkohli96/rhf-mui-components/tree/v2.1.0)
1120

1221
**Released - 3 Mar, 2025**

apps/rhf-mui-docs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nish1896/rhf-mui-docs",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"private": true,
55
"scripts": {
66
"docusaurus": "docusaurus",

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nish1896/rhf-mui-components-root",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"description": "A suite of 20+ reusable mui components for react-hook-form to minimize your time and effort in creating and styling forms",
55
"author": "Nishant Kohli",
66
"private": true,

packages/rhf-mui-components/.eslintrc.json

-9
This file was deleted.

packages/rhf-mui-components/.npmignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Ignore these files while publishing to the npm directory
22
*.tgz
3-
package
43
src/
54
.npmignore
65
node_modules/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import jsConfig from '@nish1896/eslint-flat-config/js';
2+
import tsConfig from '@nish1896/eslint-flat-config/ts';
3+
import jsxConfig from '@nish1896/eslint-flat-config/jsx';
4+
5+
/** @type {import('eslint').Linter.Config[]} */
6+
export default [
7+
...jsConfig,
8+
...tsConfig,
9+
...jsxConfig,
10+
{
11+
rules: {
12+
'@typescript-eslint/no-explicit-any': 'off',
13+
'@typescript-eslint/no-unsafe-call': 'off',
14+
'no-nested-ternary': 'off',
15+
},
16+
},
17+
];

packages/rhf-mui-components/package.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nish1896/rhf-mui-components",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"description": "A suite of 20+ reusable Material UI components for React Hook Form to minimize your time and effort in creating and styling forms",
55
"author": "Nishant Kohli",
66
"homepage": "https://rhf-mui-components.netlify.app/",
@@ -13,9 +13,11 @@
1313
"lint": "eslint --fix ."
1414
},
1515
"devDependencies": {
16-
"@nish1896/eslint-config": "^2.1.1",
16+
"@eslint/js": "^9.23.0",
17+
"@nish1896/eslint-flat-config": "^2.0.0",
18+
"eslint": "^9.23.0",
1719
"rimraf": "^6.0.1",
18-
"tsc-alias": "^1.8.10"
20+
"tsc-alias": "^1.8.13"
1921
},
2022
"peerDependencies": {
2123
"@mui/icons-material": ">=5",

packages/rhf-mui-components/src/config/ConfigProvider.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { ReactNode, createContext, useMemo } from 'react';
2-
import { RHFMuiConfig, RHFMuiConfigInput } from '@/types';
1+
import { createContext, useMemo, type ReactNode } from 'react';
2+
import type { RHFMuiConfig, RHFMuiConfigInput } from '@/types';
33
import { DefaultRHFMuiConfig } from './DefaultConfig';
44

55
type ConfigProviderProps = {

packages/rhf-mui-components/src/config/DefaultConfig.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { RHFMuiConfig } from '@/types';
1+
import type { RHFMuiConfig } from '@/types';
22

33
const DefaultStyles = Object.freeze({
44
margin: {

packages/rhf-mui-components/src/misc/color-picker/index.tsx

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
import { Fragment, ReactNode } from 'react';
1+
import { Fragment, type ReactNode } from 'react';
22
import {
3-
FieldValues,
4-
Path,
53
Controller,
6-
Control,
7-
RegisterOptions
4+
type FieldValues,
5+
type Path,
6+
type Control,
7+
type RegisterOptions
88
} from 'react-hook-form';
99
import {
1010
ColorPicker as ReactColorPicker,
1111
Saturation,
1212
Hue,
13-
IColor,
14-
useColor
13+
useColor,
14+
type IColor
1515
} from 'react-color-palette';
1616
import { FormControl, FormLabel, FormHelperText } from '@/mui/common';
17-
import { FormLabelProps, FormHelperTextProps } from '@/types';
17+
import type { FormLabelProps, FormHelperTextProps } from '@/types';
1818
import { fieldNameToLabel, colorToString } from '@/utils';
1919
import 'react-color-palette/css';
2020

packages/rhf-mui-components/src/misc/index.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
import RHFColorPicker, { RHFColorPickerProps } from './color-picker';
2-
import RHFPhoneInput, { RHFPhoneInputProps } from './phone-input';
3-
import RHFRichTextEditor, { RHFRichTextEditorProps, DefaultEditorConfig } from './rich-text-editor';
1+
import RHFColorPicker, { type RHFColorPickerProps } from './color-picker';
2+
import RHFPhoneInput, { type RHFPhoneInputProps } from './phone-input';
3+
import RHFRichTextEditor, {
4+
DefaultEditorConfig,
5+
type RHFRichTextEditorProps
6+
} from './rich-text-editor';
47

58
export {
69
RHFColorPicker,

packages/rhf-mui-components/src/misc/phone-input/index.tsx

+12-12
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,34 @@
33
* https://react-international-phone.vercel.app/docs/Advanced%20Usage/useWithUiLibs
44
*/
55

6-
import { useContext, ReactNode } from 'react';
6+
import { useContext, type ReactNode } from 'react';
77
import {
8-
FieldValues,
9-
Path,
10-
PathValue,
118
Controller,
12-
Control,
13-
RegisterOptions
9+
type FieldValues,
10+
type Path,
11+
type PathValue,
12+
type Control,
13+
type RegisterOptions
1414
} from 'react-hook-form';
15-
import TextField, { TextFieldProps } from '@mui/material/TextField';
15+
import TextField, { type TextFieldProps } from '@mui/material/TextField';
1616
import InputAdornment from '@mui/material/InputAdornment';
1717
import Divider from '@mui/material/Divider';
1818
import Select from '@mui/material/Select';
1919
import MenuItem from '@mui/material/MenuItem';
2020
import Typography from '@mui/material/Typography';
2121
import {
22-
CountryData,
23-
CountryIso2,
2422
defaultCountries,
2523
FlagImage,
2624
parseCountry,
27-
ParsedCountry,
2825
usePhoneInput,
29-
UsePhoneInputConfig
26+
type CountryData,
27+
type CountryIso2,
28+
type ParsedCountry,
29+
type UsePhoneInputConfig
3030
} from 'react-international-phone';
3131
import { RHFMuiConfigContext } from '@/config/ConfigProvider';
3232
import { FormControl, FormLabel, FormLabelText, FormHelperText } from '@/mui/common';
33-
import { FormLabelProps, FormHelperTextProps } from '@/types';
33+
import type { FormLabelProps, FormHelperTextProps } from '@/types';
3434
import { fieldNameToLabel, keepLabelAboveFormField, isAboveMuiV5 } from '@/utils';
3535
import 'react-international-phone/style.css';
3636

packages/rhf-mui-components/src/misc/rich-text-editor/index.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import { ReactNode } from 'react';
1+
import type { ReactNode } from 'react';
22
import {
3-
FieldValues,
4-
Path,
53
Controller,
6-
Control,
7-
RegisterOptions
4+
type FieldValues,
5+
type Path,
6+
type Control,
7+
type RegisterOptions
88
} from 'react-hook-form';
99
import { CKEditor } from '@ckeditor/ckeditor5-react';
10-
import { EventInfo } from '@ckeditor/ckeditor5-utils';
10+
import type { EventInfo } from '@ckeditor/ckeditor5-utils';
1111
import type { EditorConfig } from '@ckeditor/ckeditor5-core';
1212
import { ClassicEditor } from 'ckeditor5';
1313
import { FormControl, FormLabel, FormHelperText } from '@/mui/common';
14-
import { FormLabelProps, FormHelperTextProps } from '@/types';
14+
import type { FormLabelProps, FormHelperTextProps } from '@/types';
1515
import { fieldNameToLabel } from '@/utils';
1616
import { DefaultEditorConfig } from './config';
1717
import 'ckeditor5/ckeditor5.css';

packages/rhf-mui-components/src/mui-pickers/date-time/index.tsx

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import { useContext, ReactNode } from 'react';
1+
import { useContext, type ReactNode } from 'react';
22
import {
3-
FieldValues,
4-
Path,
53
Controller,
6-
Control,
7-
RegisterOptions
4+
type FieldValues,
5+
type Path,
6+
type Control,
7+
type RegisterOptions
88
} from 'react-hook-form';
99
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
1010
import {
1111
DateTimePicker as MuiDateTimePicker,
12-
DateTimePickerProps,
13-
PickerValidDate,
14-
DateTimeValidationError,
15-
PickerChangeHandlerContext
12+
type DateTimePickerProps,
13+
type PickerValidDate,
14+
type DateTimeValidationError,
15+
type PickerChangeHandlerContext
1616
} from '@mui/x-date-pickers';
1717
import { RHFMuiConfigContext } from '@/config/ConfigProvider';
1818
import { FormControl, FormLabel, FormLabelText, FormHelperText } from '@/mui/common';
19-
import { FormLabelProps, FormHelperTextProps } from '@/types';
19+
import type { FormLabelProps, FormHelperTextProps } from '@/types';
2020
import { fieldNameToLabel, keepLabelAboveFormField } from '@/utils';
2121

2222
export type RHFDateTimePickerProps<T extends FieldValues> = {
@@ -25,9 +25,10 @@ export type RHFDateTimePickerProps<T extends FieldValues> = {
2525
registerOptions?: RegisterOptions<T, Path<T>>;
2626
required?: boolean;
2727
onValueChange?: (
28-
newValue: PickerValidDate | null,
28+
newValue: PickerValidDate,
2929
context: PickerChangeHandlerContext<DateTimeValidationError>
30-
) => void; showLabelAboveFormField?: boolean;
30+
) => void;
31+
showLabelAboveFormField?: boolean;
3132
formLabelProps?: FormLabelProps;
3233
helperText?: ReactNode;
3334
errorMessage?: ReactNode;

0 commit comments

Comments
 (0)