From 88923838c50fcccbb9c5ba8e5a79c742747a1880 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Tue, 7 Mar 2023 17:29:30 +0100 Subject: [PATCH 1/6] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 43409a81..2cd8e47f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "keycloakify", - "version": "6.12.5", + "version": "6.12.6", "description": "Keycloak theme generator for Reacts app", "repository": { "type": "git", From 1ba780598d3bf3ee9d0fb1b9788fd01b06cbab40 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Tue, 7 Mar 2023 18:18:37 +0100 Subject: [PATCH 2/6] Relase candidate --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2cd8e47f..9acfbd49 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "keycloakify", - "version": "6.12.6", + "version": "6.12.7-rc.0", "description": "Keycloak theme generator for Reacts app", "repository": { "type": "git", From dfe909606ea3077293aa6f6c4e5165bdeb6f6d7d Mon Sep 17 00:00:00 2001 From: garronej Date: Wed, 8 Mar 2023 22:24:51 +0100 Subject: [PATCH 3/6] Deprecate useFormValidationSlice --- src/lib/pages/shared/UserProfileCommons.tsx | 546 ++++++++++++++++++-- src/lib/useFormValidationSlice.tsx | 346 +++++++------ 2 files changed, 684 insertions(+), 208 deletions(-) diff --git a/src/lib/pages/shared/UserProfileCommons.tsx b/src/lib/pages/shared/UserProfileCommons.tsx index 445f56b6..dfb22500 100644 --- a/src/lib/pages/shared/UserProfileCommons.tsx +++ b/src/lib/pages/shared/UserProfileCommons.tsx @@ -1,13 +1,15 @@ -import React, { useEffect, Fragment } from "react"; +import "../../tools/Array.prototype.every"; +import React, { useEffect, useMemo, useReducer, Fragment } from "react"; import type { KcProps } from "../../KcProps"; -import type { Attribute } from "../../getKcContext/KcContextBase"; +import type { KcContextBase, Validators, Attribute } from "../../getKcContext"; import { clsx } from "../../tools/clsx"; -import { useCallbackFactory } from "../../tools/useCallbackFactory"; -import { useFormValidationSlice } from "../../useFormValidationSlice"; -import type { I18nBase } from "../../i18n"; +import { useConstCallback } from "../../tools/useConstCallback"; +import { emailRegexp } from "../../tools/emailRegExp"; +import type { I18nBase, MessageKeyBase } from "../../i18n"; +import { id } from "tsafe/id"; export type UserProfileFormFieldsProps = { - kcContext: Parameters[0]["kcContext"]; + kcContext: Parameters[0]["kcContext"]; i18n: I18nBase; } & KcProps & Partial JSX.Element | null>> & { @@ -26,9 +28,9 @@ export function UserProfileFormFields({ const { formValidationState: { fieldStateByAttributeName, isFormSubmittable }, - formValidationReducer, + formValidationDispatch, attributesWithPassword - } = useFormValidationSlice({ + } = useFormValidation({ kcContext, i18n }); @@ -37,29 +39,6 @@ export function UserProfileFormFields({ onIsFormSubmittableValueChange(isFormSubmittable); }, [isFormSubmittable]); - const onChangeFactory = useCallbackFactory( - ( - [name]: [string], - [ - { - target: { value } - } - ]: [React.ChangeEvent] - ) => - formValidationReducer({ - "action": "update value", - name, - "newValue": value - }) - ); - - const onBlurFactory = useCallbackFactory(([name]: [string]) => - formValidationReducer({ - "action": "focus lost", - name - }) - ); - let currentGroup = ""; return ( @@ -108,8 +87,19 @@ export function UserProfileFormFields({