diff --git a/package.json b/package.json index 8cf09b4..e62c55e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@react-hive/honey-form", - "version": "2.4.0", + "version": "2.5.0", "description": "The TS library to build the fully customized forms using React framework", "keywords": [ "react", @@ -33,7 +33,7 @@ "peerDependencies": { "react": ">=18.0.0", "react-dom": ">=18.0.0", - "@mdx-js/react": "3.0.1" + "@mdx-js/react": "3.1.0" }, "devDependencies": { "@testing-library/react": "16.1.0", @@ -58,7 +58,7 @@ "prettier": "3.4.2", "ts-jest": "29.2.5", "ts-loader": "9.5.1", - "typescript": "5.7.2", + "typescript": "5.7.3", "webpack": "5.97.1", "webpack-cli": "6.0.1", "html-webpack-plugin": "5.6.3" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 18b4d7c..ceadf13 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: '@mdx-js/react': - specifier: 3.0.1 - version: 3.0.1(@types/react@19.0.2)(react@19.0.0) + specifier: 3.1.0 + version: 3.1.0(@types/react@19.0.2)(react@19.0.0) react: specifier: '>=18.0.0' version: 19.0.0 @@ -38,25 +38,25 @@ importers: version: 19.0.2(@types/react@19.0.2) '@typescript-eslint/eslint-plugin': specifier: 7.18.0 - version: 7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.2))(eslint@8.57.0)(typescript@5.7.2) + version: 7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.3))(eslint@8.57.0)(typescript@5.7.3) '@typescript-eslint/parser': specifier: 7.18.0 - version: 7.18.0(eslint@8.57.0)(typescript@5.7.2) + version: 7.18.0(eslint@8.57.0)(typescript@5.7.3) eslint: specifier: 8.57.0 version: 8.57.0 eslint-config-airbnb: specifier: 19.0.4 - version: 19.0.4(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.2))(eslint@8.57.0))(eslint-plugin-jsx-a11y@6.10.2(eslint@8.57.0))(eslint-plugin-react-hooks@5.1.0(eslint@8.57.0))(eslint-plugin-react@7.37.2(eslint@8.57.0))(eslint@8.57.0) + version: 19.0.4(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.3))(eslint@8.57.0))(eslint-plugin-jsx-a11y@6.10.2(eslint@8.57.0))(eslint-plugin-react-hooks@5.1.0(eslint@8.57.0))(eslint-plugin-react@7.37.2(eslint@8.57.0))(eslint@8.57.0) eslint-config-airbnb-typescript: specifier: 18.0.0 - version: 18.0.0(@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.2))(eslint@8.57.0)(typescript@5.7.2))(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.2))(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.2))(eslint@8.57.0))(eslint@8.57.0) + version: 18.0.0(@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.3))(eslint@8.57.0)(typescript@5.7.3))(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.3))(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.3))(eslint@8.57.0))(eslint@8.57.0) eslint-config-prettier: specifier: 9.1.0 version: 9.1.0(eslint@8.57.0) eslint-plugin-import: specifier: 2.31.0 - version: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.2))(eslint@8.57.0) + version: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.3))(eslint@8.57.0) eslint-plugin-jsx-a11y: specifier: 6.10.2 version: 6.10.2(eslint@8.57.0) @@ -83,13 +83,13 @@ importers: version: 3.4.2 ts-jest: specifier: 29.2.5 - version: 29.2.5(@babel/core@7.26.0)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.26.0))(jest@29.7.0(@types/node@22.10.2))(typescript@5.7.2) + version: 29.2.5(@babel/core@7.26.0)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.26.0))(jest@29.7.0(@types/node@22.10.2))(typescript@5.7.3) ts-loader: specifier: 9.5.1 - version: 9.5.1(typescript@5.7.2)(webpack@5.97.1) + version: 9.5.1(typescript@5.7.3)(webpack@5.97.1) typescript: - specifier: 5.7.2 - version: 5.7.2 + specifier: 5.7.3 + version: 5.7.3 webpack: specifier: 5.97.1 version: 5.97.1(webpack-cli@6.0.1) @@ -409,8 +409,8 @@ packages: '@mdx-js/mdx@3.1.0': resolution: {integrity: sha512-/QxEhPAvGwbQmy1Px8F899L5Uc2KZ6JtXwlCgJmjSTBedwOZkByYcBG4GceIGPXRDsmfxhHazuS+hlOShRLeDw==} - '@mdx-js/react@3.0.1': - resolution: {integrity: sha512-9ZrPIU4MGf6et1m1ov3zKf+q9+deetI51zprKB1D/z3NOb+rUxxtEl3mCjW5wTGh6VhRdwPueh1oRzi6ezkA8A==} + '@mdx-js/react@3.1.0': + resolution: {integrity: sha512-QjHtSaoameoalGnKDT3FoIl4+9RwyTmo9ZJGBdLOks/YOiWHoRDI3PUwEzOE7kEmGcV3AFcp9K6dYu9rEuKLAQ==} peerDependencies: '@types/react': '>=16' react: '>=16' @@ -2985,8 +2985,8 @@ packages: resolution: {integrity: sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==} engines: {node: '>= 0.4'} - typescript@5.7.2: - resolution: {integrity: sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==} + typescript@5.7.3: + resolution: {integrity: sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==} engines: {node: '>=14.17'} hasBin: true @@ -3655,7 +3655,7 @@ snapshots: - acorn - supports-color - '@mdx-js/react@3.0.1(@types/react@19.0.2)(react@19.0.0)': + '@mdx-js/react@3.1.0(@types/react@19.0.2)(react@19.0.0)': dependencies: '@types/mdx': 2.0.13 '@types/react': 19.0.2 @@ -3826,34 +3826,34 @@ snapshots: dependencies: '@types/yargs-parser': 21.0.3 - '@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.2))(eslint@8.57.0)(typescript@5.7.2)': + '@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.3))(eslint@8.57.0)(typescript@5.7.3)': dependencies: '@eslint-community/regexpp': 4.12.1 - '@typescript-eslint/parser': 7.18.0(eslint@8.57.0)(typescript@5.7.2) + '@typescript-eslint/parser': 7.18.0(eslint@8.57.0)(typescript@5.7.3) '@typescript-eslint/scope-manager': 7.18.0 - '@typescript-eslint/type-utils': 7.18.0(eslint@8.57.0)(typescript@5.7.2) - '@typescript-eslint/utils': 7.18.0(eslint@8.57.0)(typescript@5.7.2) + '@typescript-eslint/type-utils': 7.18.0(eslint@8.57.0)(typescript@5.7.3) + '@typescript-eslint/utils': 7.18.0(eslint@8.57.0)(typescript@5.7.3) '@typescript-eslint/visitor-keys': 7.18.0 eslint: 8.57.0 graphemer: 1.4.0 ignore: 5.3.2 natural-compare: 1.4.0 - ts-api-utils: 1.4.3(typescript@5.7.2) + ts-api-utils: 1.4.3(typescript@5.7.3) optionalDependencies: - typescript: 5.7.2 + typescript: 5.7.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.2)': + '@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.3)': dependencies: '@typescript-eslint/scope-manager': 7.18.0 '@typescript-eslint/types': 7.18.0 - '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.7.2) + '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.7.3) '@typescript-eslint/visitor-keys': 7.18.0 debug: 4.4.0 eslint: 8.57.0 optionalDependencies: - typescript: 5.7.2 + typescript: 5.7.3 transitivePeerDependencies: - supports-color @@ -3862,21 +3862,21 @@ snapshots: '@typescript-eslint/types': 7.18.0 '@typescript-eslint/visitor-keys': 7.18.0 - '@typescript-eslint/type-utils@7.18.0(eslint@8.57.0)(typescript@5.7.2)': + '@typescript-eslint/type-utils@7.18.0(eslint@8.57.0)(typescript@5.7.3)': dependencies: - '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.7.2) - '@typescript-eslint/utils': 7.18.0(eslint@8.57.0)(typescript@5.7.2) + '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.7.3) + '@typescript-eslint/utils': 7.18.0(eslint@8.57.0)(typescript@5.7.3) debug: 4.4.0 eslint: 8.57.0 - ts-api-utils: 1.4.3(typescript@5.7.2) + ts-api-utils: 1.4.3(typescript@5.7.3) optionalDependencies: - typescript: 5.7.2 + typescript: 5.7.3 transitivePeerDependencies: - supports-color '@typescript-eslint/types@7.18.0': {} - '@typescript-eslint/typescript-estree@7.18.0(typescript@5.7.2)': + '@typescript-eslint/typescript-estree@7.18.0(typescript@5.7.3)': dependencies: '@typescript-eslint/types': 7.18.0 '@typescript-eslint/visitor-keys': 7.18.0 @@ -3885,18 +3885,18 @@ snapshots: is-glob: 4.0.3 minimatch: 9.0.5 semver: 7.6.3 - ts-api-utils: 1.4.3(typescript@5.7.2) + ts-api-utils: 1.4.3(typescript@5.7.3) optionalDependencies: - typescript: 5.7.2 + typescript: 5.7.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@7.18.0(eslint@8.57.0)(typescript@5.7.2)': + '@typescript-eslint/utils@7.18.0(eslint@8.57.0)(typescript@5.7.3)': dependencies: '@eslint-community/eslint-utils': 4.4.1(eslint@8.57.0) '@typescript-eslint/scope-manager': 7.18.0 '@typescript-eslint/types': 7.18.0 - '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.7.2) + '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.7.3) eslint: 8.57.0 transitivePeerDependencies: - supports-color @@ -4671,29 +4671,29 @@ snapshots: optionalDependencies: source-map: 0.6.1 - eslint-config-airbnb-base@15.0.0(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.2))(eslint@8.57.0))(eslint@8.57.0): + eslint-config-airbnb-base@15.0.0(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.3))(eslint@8.57.0))(eslint@8.57.0): dependencies: confusing-browser-globals: 1.0.11 eslint: 8.57.0 - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.2))(eslint@8.57.0) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.3))(eslint@8.57.0) object.assign: 4.1.7 object.entries: 1.1.8 semver: 6.3.1 - eslint-config-airbnb-typescript@18.0.0(@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.2))(eslint@8.57.0)(typescript@5.7.2))(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.2))(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.2))(eslint@8.57.0))(eslint@8.57.0): + eslint-config-airbnb-typescript@18.0.0(@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.3))(eslint@8.57.0)(typescript@5.7.3))(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.3))(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.3))(eslint@8.57.0))(eslint@8.57.0): dependencies: - '@typescript-eslint/eslint-plugin': 7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.2))(eslint@8.57.0)(typescript@5.7.2) - '@typescript-eslint/parser': 7.18.0(eslint@8.57.0)(typescript@5.7.2) + '@typescript-eslint/eslint-plugin': 7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.3))(eslint@8.57.0)(typescript@5.7.3) + '@typescript-eslint/parser': 7.18.0(eslint@8.57.0)(typescript@5.7.3) eslint: 8.57.0 - eslint-config-airbnb-base: 15.0.0(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.2))(eslint@8.57.0))(eslint@8.57.0) + eslint-config-airbnb-base: 15.0.0(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.3))(eslint@8.57.0))(eslint@8.57.0) transitivePeerDependencies: - eslint-plugin-import - eslint-config-airbnb@19.0.4(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.2))(eslint@8.57.0))(eslint-plugin-jsx-a11y@6.10.2(eslint@8.57.0))(eslint-plugin-react-hooks@5.1.0(eslint@8.57.0))(eslint-plugin-react@7.37.2(eslint@8.57.0))(eslint@8.57.0): + eslint-config-airbnb@19.0.4(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.3))(eslint@8.57.0))(eslint-plugin-jsx-a11y@6.10.2(eslint@8.57.0))(eslint-plugin-react-hooks@5.1.0(eslint@8.57.0))(eslint-plugin-react@7.37.2(eslint@8.57.0))(eslint@8.57.0): dependencies: eslint: 8.57.0 - eslint-config-airbnb-base: 15.0.0(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.2))(eslint@8.57.0))(eslint@8.57.0) - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.2))(eslint@8.57.0) + eslint-config-airbnb-base: 15.0.0(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.3))(eslint@8.57.0))(eslint@8.57.0) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.3))(eslint@8.57.0) eslint-plugin-jsx-a11y: 6.10.2(eslint@8.57.0) eslint-plugin-react: 7.37.2(eslint@8.57.0) eslint-plugin-react-hooks: 5.1.0(eslint@8.57.0) @@ -4712,17 +4712,17 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-module-utils@2.12.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.2))(eslint-import-resolver-node@0.3.9)(eslint@8.57.0): + eslint-module-utils@2.12.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.3))(eslint-import-resolver-node@0.3.9)(eslint@8.57.0): dependencies: debug: 3.2.7 optionalDependencies: - '@typescript-eslint/parser': 7.18.0(eslint@8.57.0)(typescript@5.7.2) + '@typescript-eslint/parser': 7.18.0(eslint@8.57.0)(typescript@5.7.3) eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 transitivePeerDependencies: - supports-color - eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.2))(eslint@8.57.0): + eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.3))(eslint@8.57.0): dependencies: '@rtsao/scc': 1.1.0 array-includes: 3.1.8 @@ -4733,7 +4733,7 @@ snapshots: doctrine: 2.1.0 eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.2))(eslint-import-resolver-node@0.3.9)(eslint@8.57.0) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.7.3))(eslint-import-resolver-node@0.3.9)(eslint@8.57.0) hasown: 2.0.2 is-core-module: 2.16.1 is-glob: 4.0.3 @@ -4745,7 +4745,7 @@ snapshots: string.prototype.trimend: 1.0.9 tsconfig-paths: 3.15.0 optionalDependencies: - '@typescript-eslint/parser': 7.18.0(eslint@8.57.0)(typescript@5.7.2) + '@typescript-eslint/parser': 7.18.0(eslint@8.57.0)(typescript@5.7.3) transitivePeerDependencies: - eslint-import-resolver-typescript - eslint-import-resolver-webpack @@ -6902,11 +6902,11 @@ snapshots: trough@2.2.0: {} - ts-api-utils@1.4.3(typescript@5.7.2): + ts-api-utils@1.4.3(typescript@5.7.3): dependencies: - typescript: 5.7.2 + typescript: 5.7.3 - ts-jest@29.2.5(@babel/core@7.26.0)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.26.0))(jest@29.7.0(@types/node@22.10.2))(typescript@5.7.2): + ts-jest@29.2.5(@babel/core@7.26.0)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.26.0))(jest@29.7.0(@types/node@22.10.2))(typescript@5.7.3): dependencies: bs-logger: 0.2.6 ejs: 3.1.10 @@ -6917,7 +6917,7 @@ snapshots: lodash.memoize: 4.1.2 make-error: 1.3.6 semver: 7.6.3 - typescript: 5.7.2 + typescript: 5.7.3 yargs-parser: 21.1.1 optionalDependencies: '@babel/core': 7.26.0 @@ -6925,14 +6925,14 @@ snapshots: '@jest/types': 29.6.3 babel-jest: 29.7.0(@babel/core@7.26.0) - ts-loader@9.5.1(typescript@5.7.2)(webpack@5.97.1): + ts-loader@9.5.1(typescript@5.7.3)(webpack@5.97.1): dependencies: chalk: 4.1.2 enhanced-resolve: 5.18.0 micromatch: 4.0.8 semver: 7.6.3 source-map: 0.7.4 - typescript: 5.7.2 + typescript: 5.7.3 webpack: 5.97.1(webpack-cli@6.0.1) tsconfig-paths@3.15.0: @@ -6987,7 +6987,7 @@ snapshots: possible-typed-array-names: 1.0.0 reflect.getprototypeof: 1.0.9 - typescript@5.7.2: {} + typescript@5.7.3: {} unbox-primitive@1.1.0: dependencies: diff --git a/src/field.ts b/src/field.ts index 620ec33..ea86352 100644 --- a/src/field.ts +++ b/src/field.ts @@ -1718,6 +1718,7 @@ export const getNextFieldsState = < }); processSkippableFields({ parentField, nextFormFields, formContext }); + triggerScheduledFieldsValidations({ parentField, fieldName, diff --git a/src/hooks/use-base-honey-form.ts b/src/hooks/use-base-honey-form.ts index 1454f55..7b535e2 100644 --- a/src/hooks/use-base-honey-form.ts +++ b/src/hooks/use-base-honey-form.ts @@ -213,6 +213,7 @@ export const useBaseHoneyForm = < () => { const nextFormFields = { ...formFields }; + const formValues = getFormValues(nextFormFields); if (isClearAll) { resetAllFields(nextFormFields); } @@ -226,19 +227,28 @@ export const useBaseHoneyForm = < const fieldConfig = nextFormFields[fieldName].config; + const isSkipField = checkIsSkipField({ + parentField, + fieldName, + formContext, + formValues, + formFields: nextFormFields, + }); + const filteredValue = checkIfHoneyFormFieldIsInteractive(fieldConfig) && fieldConfig.filter ? fieldConfig.filter(values[fieldName], { formContext }) : values[fieldName]; - const nextFormField = isValidate - ? executeFieldValidator({ - formContext, - fieldName, - formFields: nextFormFields, - fieldValue: filteredValue, - }) - : getNextErrorsFreeField(nextFormFields[fieldName]); + const nextFormField = + !isSkipField && isValidate + ? executeFieldValidator({ + formContext, + fieldName, + formFields: nextFormFields, + fieldValue: filteredValue, + }) + : getNextErrorsFreeField(nextFormFields[fieldName]); nextFormFields[fieldName] = getNextSingleFieldState(nextFormField, filteredValue, { formContext,