keycloakify 10.0.0-rc.36 → 10.0.0-rc.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/account/Fallback.d.ts +1 -2
- package/account/Fallback.js.map +1 -1
- package/account/KcContext/KcContext.d.ts +6 -6
- package/account/KcContext/getKcContextMock.d.ts +9 -9
- package/account/KcContext/getKcContextMock.js +3 -3
- package/account/KcContext/getKcContextMock.js.map +1 -1
- package/account/Template.d.ts +1 -2
- package/account/Template.js +7 -6
- package/account/Template.js.map +1 -1
- package/account/TemplateProps.d.ts +1 -3
- package/account/i18n/i18n.d.ts +9 -4
- package/account/i18n/i18n.js +132 -87
- package/account/i18n/i18n.js.map +1 -1
- package/account/i18n/index.d.ts +9 -2
- package/account/i18n/index.js +5 -1
- package/account/i18n/index.js.map +1 -1
- package/account/index.d.ts +1 -1
- package/account/lib/kcClsx.d.ts +9 -0
- package/account/lib/{useGetClassName.js → kcClsx.js} +3 -3
- package/account/lib/kcClsx.js.map +1 -0
- package/account/pages/Account.d.ts +1 -2
- package/account/pages/Account.js +9 -7
- package/account/pages/Account.js.map +1 -1
- package/account/pages/Applications.d.ts +1 -2
- package/account/pages/Applications.js +7 -7
- package/account/pages/Applications.js.map +1 -1
- package/account/pages/FederatedIdentity.d.ts +1 -2
- package/account/pages/FederatedIdentity.js +4 -3
- package/account/pages/FederatedIdentity.js.map +1 -1
- package/account/pages/Log.d.ts +1 -2
- package/account/pages/Log.js +6 -5
- package/account/pages/Log.js.map +1 -1
- package/account/pages/PageProps.d.ts +2 -4
- package/account/pages/Password.d.ts +1 -2
- package/account/pages/Password.js +10 -9
- package/account/pages/Password.js.map +1 -1
- package/account/pages/Sessions.d.ts +1 -2
- package/account/pages/Sessions.js +6 -6
- package/account/pages/Sessions.js.map +1 -1
- package/account/pages/Totp.d.ts +1 -2
- package/account/pages/Totp.js +6 -5
- package/account/pages/Totp.js.map +1 -1
- package/bin/{314.index.js → 21.index.js} +162 -4
- package/bin/{430.index.js → 214.index.js} +161 -2
- package/bin/3.index.js +81 -65
- package/bin/526.index.js +3 -2
- package/bin/538.index.js +552 -0
- package/bin/795.index.js +3 -2
- package/bin/{890.index.js → 941.index.js} +2 -159
- package/bin/main.js +19 -7
- package/lib/getKcClsx.d.ts +11 -0
- package/lib/getKcClsx.js +44 -0
- package/lib/getKcClsx.js.map +1 -0
- package/login/Fallback.d.ts +1 -2
- package/login/Fallback.js.map +1 -1
- package/login/KcContext/KcContext.d.ts +6 -6
- package/login/KcContext/getKcContextMock.d.ts +9 -9
- package/login/KcContext/getKcContextMock.js +3 -3
- package/login/KcContext/getKcContextMock.js.map +1 -1
- package/login/Template.d.ts +1 -2
- package/login/Template.js +10 -9
- package/login/Template.js.map +1 -1
- package/login/TemplateProps.d.ts +1 -3
- package/login/UserProfileFormFields.d.ts +5 -5
- package/login/UserProfileFormFields.js +35 -34
- package/login/UserProfileFormFields.js.map +1 -1
- package/login/i18n/i18n.d.ts +9 -4
- package/login/i18n/i18n.js +136 -91
- package/login/i18n/i18n.js.map +1 -1
- package/login/i18n/index.d.ts +9 -2
- package/login/i18n/index.js +5 -1
- package/login/i18n/index.js.map +1 -1
- package/login/index.d.ts +1 -1
- package/login/lib/kcClsx.d.ts +9 -0
- package/login/lib/{useGetClassName.js → kcClsx.js} +3 -3
- package/login/lib/kcClsx.js.map +1 -0
- package/login/lib/useUserProfileForm.d.ts +9 -6
- package/login/lib/useUserProfileForm.js +7 -5
- package/login/lib/useUserProfileForm.js.map +1 -1
- package/login/pages/Code.d.ts +1 -2
- package/login/pages/Code.js +6 -5
- package/login/pages/Code.js.map +1 -1
- package/login/pages/DeleteAccountConfirm.d.ts +1 -2
- package/login/pages/DeleteAccountConfirm.js +7 -7
- package/login/pages/DeleteAccountConfirm.js.map +1 -1
- package/login/pages/DeleteCredential.d.ts +1 -2
- package/login/pages/DeleteCredential.js +6 -6
- package/login/pages/DeleteCredential.js.map +1 -1
- package/login/pages/Error.d.ts +1 -2
- package/login/pages/Error.js +4 -3
- package/login/pages/Error.js.map +1 -1
- package/login/pages/FrontchannelLogout.d.ts +1 -2
- package/login/pages/FrontchannelLogout.js +4 -3
- package/login/pages/FrontchannelLogout.js.map +1 -1
- package/login/pages/IdpReviewUserProfile.d.ts +1 -2
- package/login/pages/IdpReviewUserProfile.js +6 -6
- package/login/pages/IdpReviewUserProfile.js.map +1 -1
- package/login/pages/Info.d.ts +1 -2
- package/login/pages/Info.js +4 -3
- package/login/pages/Info.js.map +1 -1
- package/login/pages/Login.d.ts +1 -2
- package/login/pages/Login.js +10 -8
- package/login/pages/Login.js.map +1 -1
- package/login/pages/LoginConfigTotp.d.ts +1 -2
- package/login/pages/LoginConfigTotp.js +8 -7
- package/login/pages/LoginConfigTotp.js.map +1 -1
- package/login/pages/LoginIdpLinkConfirm.d.ts +1 -2
- package/login/pages/LoginIdpLinkConfirm.js +6 -6
- package/login/pages/LoginIdpLinkConfirm.js.map +1 -1
- package/login/pages/LoginIdpLinkEmail.d.ts +1 -2
- package/login/pages/LoginIdpLinkEmail.js +4 -3
- package/login/pages/LoginIdpLinkEmail.js.map +1 -1
- package/login/pages/LoginOauth2DeviceVerifyUserCode.d.ts +1 -2
- package/login/pages/LoginOauth2DeviceVerifyUserCode.js +6 -6
- package/login/pages/LoginOauth2DeviceVerifyUserCode.js.map +1 -1
- package/login/pages/LoginOauthGrant.d.ts +1 -2
- package/login/pages/LoginOauthGrant.js +7 -7
- package/login/pages/LoginOauthGrant.js.map +1 -1
- package/login/pages/LoginOtp.d.ts +1 -2
- package/login/pages/LoginOtp.js +6 -6
- package/login/pages/LoginOtp.js.map +1 -1
- package/login/pages/LoginPageExpired.d.ts +1 -2
- package/login/pages/LoginPageExpired.js +4 -3
- package/login/pages/LoginPageExpired.js.map +1 -1
- package/login/pages/LoginPassword.d.ts +1 -2
- package/login/pages/LoginPassword.js +9 -7
- package/login/pages/LoginPassword.js.map +1 -1
- package/login/pages/LoginRecoveryAuthnCodeConfig.d.ts +1 -2
- package/login/pages/LoginRecoveryAuthnCodeConfig.js +9 -7
- package/login/pages/LoginRecoveryAuthnCodeConfig.js.map +1 -1
- package/login/pages/LoginRecoveryAuthnCodeInput.d.ts +1 -2
- package/login/pages/LoginRecoveryAuthnCodeInput.js +6 -6
- package/login/pages/LoginRecoveryAuthnCodeInput.js.map +1 -1
- package/login/pages/LoginResetOtp.d.ts +1 -2
- package/login/pages/LoginResetOtp.js +6 -6
- package/login/pages/LoginResetOtp.js.map +1 -1
- package/login/pages/LoginResetPassword.d.ts +1 -2
- package/login/pages/LoginResetPassword.js +7 -7
- package/login/pages/LoginResetPassword.js.map +1 -1
- package/login/pages/LoginUpdatePassword.d.ts +1 -2
- package/login/pages/LoginUpdatePassword.js +10 -9
- package/login/pages/LoginUpdatePassword.js.map +1 -1
- package/login/pages/LoginUpdateProfile.d.ts +1 -2
- package/login/pages/LoginUpdateProfile.js +7 -12
- package/login/pages/LoginUpdateProfile.js.map +1 -1
- package/login/pages/LoginUsername.d.ts +1 -2
- package/login/pages/LoginUsername.js +8 -7
- package/login/pages/LoginUsername.js.map +1 -1
- package/login/pages/LoginVerifyEmail.d.ts +1 -2
- package/login/pages/LoginVerifyEmail.js +4 -3
- package/login/pages/LoginVerifyEmail.js.map +1 -1
- package/login/pages/LoginX509Info.d.ts +1 -2
- package/login/pages/LoginX509Info.js +6 -6
- package/login/pages/LoginX509Info.js.map +1 -1
- package/login/pages/LogoutConfirm.d.ts +1 -2
- package/login/pages/LogoutConfirm.js +6 -6
- package/login/pages/LogoutConfirm.js.map +1 -1
- package/login/pages/PageProps.d.ts +2 -4
- package/login/pages/Register.d.ts +1 -2
- package/login/pages/Register.js +8 -16
- package/login/pages/Register.js.map +1 -1
- package/login/pages/SamlPostForm.d.ts +1 -2
- package/login/pages/SamlPostForm.js +4 -3
- package/login/pages/SamlPostForm.js.map +1 -1
- package/login/pages/SelectAuthenticator.d.ts +1 -2
- package/login/pages/SelectAuthenticator.js +6 -9
- package/login/pages/SelectAuthenticator.js.map +1 -1
- package/login/pages/Terms.d.ts +1 -2
- package/login/pages/Terms.js +7 -7
- package/login/pages/Terms.js.map +1 -1
- package/login/pages/UpdateEmail.d.ts +1 -2
- package/login/pages/UpdateEmail.js +8 -12
- package/login/pages/UpdateEmail.js.map +1 -1
- package/login/pages/WebauthnAuthenticate.d.ts +1 -2
- package/login/pages/WebauthnAuthenticate.js +13 -12
- package/login/pages/WebauthnAuthenticate.js.map +1 -1
- package/login/pages/WebauthnError.d.ts +1 -2
- package/login/pages/WebauthnError.js +7 -7
- package/login/pages/WebauthnError.js.map +1 -1
- package/login/pages/WebauthnRegister.d.ts +1 -2
- package/login/pages/WebauthnRegister.js +9 -8
- package/login/pages/WebauthnRegister.js.map +1 -1
- package/package.json +24 -16
- package/src/account/Fallback.tsx +1 -2
- package/src/account/KcContext/KcContext.ts +7 -7
- package/src/account/KcContext/getKcContextMock.ts +13 -24
- package/src/account/Template.tsx +8 -8
- package/src/account/TemplateProps.ts +1 -6
- package/src/account/i18n/i18n.tsx +204 -125
- package/src/account/i18n/index.ts +10 -2
- package/src/account/index.ts +1 -1
- package/src/account/lib/{useGetClassName.ts → kcClsx.ts} +6 -2
- package/src/account/pages/Account.tsx +15 -21
- package/src/account/pages/Applications.tsx +8 -9
- package/src/account/pages/FederatedIdentity.tsx +5 -5
- package/src/account/pages/Log.tsx +8 -8
- package/src/account/pages/PageProps.ts +2 -4
- package/src/account/pages/Password.tsx +13 -16
- package/src/account/pages/Sessions.tsx +9 -10
- package/src/account/pages/Totp.tsx +19 -28
- package/src/bin/keycloakify/generateSrcMainResources/generateMessageProperties.ts +2 -66
- package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForMainTheme.ts +7 -1
- package/src/bin/main.ts +15 -0
- package/src/bin/shared/buildOptions.ts +5 -2
- package/src/bin/shared/generateKcGenTs.ts +61 -0
- package/src/bin/tools/escapeStringForPropertiesFile.ts +64 -0
- package/src/bin/update-kc-gen.ts +13 -0
- package/src/lib/getKcClsx.ts +75 -0
- package/src/login/Fallback.tsx +1 -2
- package/src/login/KcContext/KcContext.ts +7 -7
- package/src/login/KcContext/getKcContextMock.ts +13 -24
- package/src/login/Template.tsx +36 -37
- package/src/login/TemplateProps.ts +1 -6
- package/src/login/UserProfileFormFields.tsx +66 -81
- package/src/login/i18n/i18n.tsx +208 -129
- package/src/login/i18n/index.ts +10 -2
- package/src/login/index.ts +1 -1
- package/src/login/lib/{useGetClassName.ts → kcClsx.ts} +6 -2
- package/src/login/lib/useUserProfileForm.tsx +29 -21
- package/src/login/pages/Code.tsx +10 -8
- package/src/login/pages/DeleteAccountConfirm.tsx +9 -10
- package/src/login/pages/DeleteCredential.tsx +11 -10
- package/src/login/pages/Error.tsx +5 -5
- package/src/login/pages/FrontchannelLogout.tsx +7 -5
- package/src/login/pages/IdpReviewUserProfile.tsx +16 -25
- package/src/login/pages/Info.tsx +7 -5
- package/src/login/pages/Login.tsx +34 -53
- package/src/login/pages/LoginConfigTotp.tsx +30 -38
- package/src/login/pages/LoginIdpLinkConfirm.tsx +10 -21
- package/src/login/pages/LoginIdpLinkEmail.tsx +5 -5
- package/src/login/pages/LoginOauth2DeviceVerifyUserCode.tsx +19 -24
- package/src/login/pages/LoginOauthGrant.tsx +14 -21
- package/src/login/pages/LoginOtp.tsx +29 -33
- package/src/login/pages/LoginPageExpired.tsx +5 -5
- package/src/login/pages/LoginPassword.tsx +23 -33
- package/src/login/pages/LoginRecoveryAuthnCodeConfig.tsx +21 -25
- package/src/login/pages/LoginRecoveryAuthnCodeInput.tsx +21 -25
- package/src/login/pages/LoginResetOtp.tsx +21 -25
- package/src/login/pages/LoginResetPassword.tsx +21 -25
- package/src/login/pages/LoginUpdatePassword.tsx +42 -52
- package/src/login/pages/LoginUpdateProfile.tsx +26 -33
- package/src/login/pages/LoginUsername.tsx +23 -35
- package/src/login/pages/LoginVerifyEmail.tsx +7 -5
- package/src/login/pages/LoginX509Info.tsx +27 -36
- package/src/login/pages/LogoutConfirm.tsx +11 -17
- package/src/login/pages/PageProps.ts +2 -4
- package/src/login/pages/Register.tsx +24 -49
- package/src/login/pages/SamlPostForm.tsx +5 -5
- package/src/login/pages/SelectAuthenticator.tsx +24 -26
- package/src/login/pages/Terms.tsx +11 -18
- package/src/login/pages/UpdateEmail.tsx +26 -36
- package/src/login/pages/WebauthnAuthenticate.tsx +26 -32
- package/src/login/pages/WebauthnError.tsx +11 -22
- package/src/login/pages/WebauthnRegister.tsx +20 -28
- package/src/tools/clsx.ts +6 -48
- package/src/tools/clsx_withTransform.ts +55 -0
- package/src/vite-plugin/vite-plugin.ts +14 -6
- package/tools/clsx.d.ts +3 -2
- package/tools/clsx.js +5 -41
- package/tools/clsx.js.map +1 -1
- package/tools/clsx_withTransform.d.ts +5 -0
- package/tools/clsx_withTransform.js +43 -0
- package/tools/clsx_withTransform.js.map +1 -0
- package/vite-plugin/index.js +167 -37
- package/account/lib/useGetClassName.d.ts +0 -7
- package/account/lib/useGetClassName.js.map +0 -1
- package/lib/useGetClassName.d.ts +0 -10
- package/lib/useGetClassName.js +0 -14
- package/lib/useGetClassName.js.map +0 -1
- package/login/lib/useGetClassName.d.ts +0 -7
- package/login/lib/useGetClassName.js.map +0 -1
- package/src/lib/useGetClassName.ts +0 -27
@@ -1,6 +1,6 @@
|
|
1
1
|
import { useEffect, useReducer, Fragment } from "react";
|
2
2
|
import { assert } from "tsafe/assert";
|
3
|
-
import type {
|
3
|
+
import type { KcClsx } from "keycloakify/login/lib/kcClsx";
|
4
4
|
import {
|
5
5
|
useUserProfileForm,
|
6
6
|
getButtonToDisplayForMultivaluedAttributeField,
|
@@ -9,12 +9,11 @@ import {
|
|
9
9
|
type FormFieldError
|
10
10
|
} from "keycloakify/login/lib/useUserProfileForm";
|
11
11
|
import type { Attribute } from "keycloakify/login/KcContext";
|
12
|
-
import type
|
12
|
+
import { useI18n, type I18n } from "./i18n";
|
13
13
|
|
14
14
|
export type UserProfileFormFieldsProps = {
|
15
15
|
kcContext: KcContextLike;
|
16
|
-
|
17
|
-
getClassName: (classKey: ClassKey) => string;
|
16
|
+
kcClsx: KcClsx;
|
18
17
|
onIsFormSubmittableValueChange: (isFormSubmittable: boolean) => void;
|
19
18
|
BeforeField?: (props: BeforeAfterFieldProps) => JSX.Element | null;
|
20
19
|
AfterField?: (props: BeforeAfterFieldProps) => JSX.Element | null;
|
@@ -24,24 +23,24 @@ type BeforeAfterFieldProps = {
|
|
24
23
|
attribute: Attribute;
|
25
24
|
dispatchFormAction: React.Dispatch<FormAction>;
|
26
25
|
displayableErrors: FormFieldError[];
|
27
|
-
i18n: I18n;
|
28
26
|
valueOrValues: string | string[];
|
27
|
+
kcClsx: KcClsx;
|
28
|
+
i18n: I18n;
|
29
29
|
};
|
30
30
|
|
31
31
|
// NOTE: Enabled by default but it's a UX best practice to set it to false.
|
32
32
|
const doMakeUserConfirmPassword = true;
|
33
33
|
|
34
34
|
export default function UserProfileFormFields(props: UserProfileFormFieldsProps) {
|
35
|
-
const { kcContext,
|
35
|
+
const { kcContext, kcClsx, onIsFormSubmittableValueChange, BeforeField, AfterField } = props;
|
36
36
|
|
37
|
-
const { advancedMsg } =
|
37
|
+
const { advancedMsg } = useI18n({ kcContext });
|
38
38
|
|
39
39
|
const {
|
40
40
|
formState: { formFieldStates, isFormSubmittable },
|
41
41
|
dispatchFormAction
|
42
42
|
} = useUserProfileForm({
|
43
43
|
kcContext,
|
44
|
-
i18n,
|
45
44
|
doMakeUserConfirmPassword
|
46
45
|
});
|
47
46
|
|
@@ -49,6 +48,8 @@ export default function UserProfileFormFields(props: UserProfileFormFieldsProps)
|
|
49
48
|
onIsFormSubmittableValueChange(isFormSubmittable);
|
50
49
|
}, [isFormSubmittable]);
|
51
50
|
|
51
|
+
const i18n = useI18n({ kcContext });
|
52
|
+
|
52
53
|
const groupNameRef = { current: "" };
|
53
54
|
|
54
55
|
return (
|
@@ -56,32 +57,33 @@ export default function UserProfileFormFields(props: UserProfileFormFieldsProps)
|
|
56
57
|
{formFieldStates.map(({ attribute, displayableErrors, valueOrValues }) => {
|
57
58
|
return (
|
58
59
|
<Fragment key={attribute.name}>
|
59
|
-
<GroupLabel attribute={attribute}
|
60
|
+
<GroupLabel attribute={attribute} groupNameRef={groupNameRef} i18n={i18n} kcClsx={kcClsx} />
|
60
61
|
{BeforeField !== undefined && (
|
61
62
|
<BeforeField
|
62
63
|
attribute={attribute}
|
63
64
|
dispatchFormAction={dispatchFormAction}
|
64
65
|
displayableErrors={displayableErrors}
|
65
|
-
i18n={i18n}
|
66
66
|
valueOrValues={valueOrValues}
|
67
|
+
kcClsx={kcClsx}
|
68
|
+
i18n={i18n}
|
67
69
|
/>
|
68
70
|
)}
|
69
71
|
<div
|
70
|
-
className={
|
72
|
+
className={kcClsx("kcFormGroupClass")}
|
71
73
|
style={{
|
72
74
|
display: attribute.name === "password-confirm" && !doMakeUserConfirmPassword ? "none" : undefined
|
73
75
|
}}
|
74
76
|
>
|
75
|
-
<div className={
|
76
|
-
<label htmlFor={attribute.name} className={
|
77
|
+
<div className={kcClsx("kcLabelWrapperClass")}>
|
78
|
+
<label htmlFor={attribute.name} className={kcClsx("kcLabelClass")}>
|
77
79
|
{advancedMsg(attribute.displayName ?? "")}
|
78
80
|
</label>
|
79
81
|
{attribute.required && <>*</>}
|
80
82
|
</div>
|
81
|
-
<div className={
|
83
|
+
<div className={kcClsx("kcInputWrapperClass")}>
|
82
84
|
{attribute.annotations.inputHelperTextBefore !== undefined && (
|
83
85
|
<div
|
84
|
-
className={
|
86
|
+
className={kcClsx("kcInputHelperTextBeforeClass")}
|
85
87
|
id={`form-help-text-before-${attribute.name}`}
|
86
88
|
aria-live="polite"
|
87
89
|
>
|
@@ -92,19 +94,14 @@ export default function UserProfileFormFields(props: UserProfileFormFieldsProps)
|
|
92
94
|
attribute={attribute}
|
93
95
|
valueOrValues={valueOrValues}
|
94
96
|
displayableErrors={displayableErrors}
|
95
|
-
|
96
|
-
|
97
|
+
dispatchFormAction={dispatchFormAction}
|
98
|
+
kcClsx={kcClsx}
|
97
99
|
i18n={i18n}
|
98
100
|
/>
|
99
|
-
<FieldErrors
|
100
|
-
attribute={attribute}
|
101
|
-
getClassName={getClassName}
|
102
|
-
displayableErrors={displayableErrors}
|
103
|
-
fieldIndex={undefined}
|
104
|
-
/>
|
101
|
+
<FieldErrors attribute={attribute} displayableErrors={displayableErrors} kcClsx={kcClsx} fieldIndex={undefined} />
|
105
102
|
{attribute.annotations.inputHelperTextAfter !== undefined && (
|
106
103
|
<div
|
107
|
-
className={
|
104
|
+
className={kcClsx("kcInputHelperTextAfterClass")}
|
108
105
|
id={`form-help-text-after-${attribute.name}`}
|
109
106
|
aria-live="polite"
|
110
107
|
>
|
@@ -117,8 +114,9 @@ export default function UserProfileFormFields(props: UserProfileFormFieldsProps)
|
|
117
114
|
attribute={attribute}
|
118
115
|
dispatchFormAction={dispatchFormAction}
|
119
116
|
displayableErrors={displayableErrors}
|
120
|
-
i18n={i18n}
|
121
117
|
valueOrValues={valueOrValues}
|
118
|
+
kcClsx={kcClsx}
|
119
|
+
i18n={i18n}
|
122
120
|
/>
|
123
121
|
)}
|
124
122
|
{/* NOTE: Downloading of html5DataAnnotations scripts is done in the useUserProfileForm hook */}
|
@@ -133,13 +131,13 @@ export default function UserProfileFormFields(props: UserProfileFormFieldsProps)
|
|
133
131
|
|
134
132
|
function GroupLabel(props: {
|
135
133
|
attribute: Attribute;
|
136
|
-
getClassName: UserProfileFormFieldsProps["getClassName"];
|
137
|
-
i18n: I18n;
|
138
134
|
groupNameRef: {
|
139
135
|
current: string;
|
140
136
|
};
|
137
|
+
i18n: I18n;
|
138
|
+
kcClsx: KcClsx;
|
141
139
|
}) {
|
142
|
-
const { attribute,
|
140
|
+
const { attribute, groupNameRef, i18n, kcClsx } = props;
|
143
141
|
|
144
142
|
const { advancedMsg } = i18n;
|
145
143
|
|
@@ -151,7 +149,7 @@ function GroupLabel(props: {
|
|
151
149
|
|
152
150
|
return (
|
153
151
|
<div
|
154
|
-
className={
|
152
|
+
className={kcClsx("kcFormGroupClass")}
|
155
153
|
{...Object.fromEntries(Object.entries(attribute.group.html5DataAnnotations).map(([key, value]) => [`data-${key}`, value]))}
|
156
154
|
>
|
157
155
|
{(() => {
|
@@ -159,8 +157,8 @@ function GroupLabel(props: {
|
|
159
157
|
const groupHeaderText = groupDisplayHeader !== "" ? advancedMsg(groupDisplayHeader) : attribute.group.name;
|
160
158
|
|
161
159
|
return (
|
162
|
-
<div className={
|
163
|
-
<label id={`header-${attribute.group.name}`} className={
|
160
|
+
<div className={kcClsx("kcContentWrapperClass")}>
|
161
|
+
<label id={`header-${attribute.group.name}`} className={kcClsx("kcFormGroupHeader")}>
|
164
162
|
{groupHeaderText}
|
165
163
|
</label>
|
166
164
|
</div>
|
@@ -173,8 +171,8 @@ function GroupLabel(props: {
|
|
173
171
|
const groupDescriptionText = advancedMsg(groupDisplayDescription);
|
174
172
|
|
175
173
|
return (
|
176
|
-
<div className={
|
177
|
-
<label id={`description-${attribute.group.name}`} className={
|
174
|
+
<div className={kcClsx("kcLabelWrapperClass")}>
|
175
|
+
<label id={`description-${attribute.group.name}`} className={kcClsx("kcLabelClass")}>
|
178
176
|
{groupDescriptionText}
|
179
177
|
</label>
|
180
178
|
</div>
|
@@ -191,13 +189,8 @@ function GroupLabel(props: {
|
|
191
189
|
return null;
|
192
190
|
}
|
193
191
|
|
194
|
-
function FieldErrors(props: {
|
195
|
-
attribute
|
196
|
-
getClassName: UserProfileFormFieldsProps["getClassName"];
|
197
|
-
displayableErrors: FormFieldError[];
|
198
|
-
fieldIndex: number | undefined;
|
199
|
-
}) {
|
200
|
-
const { attribute, getClassName, fieldIndex } = props;
|
192
|
+
function FieldErrors(props: { attribute: Attribute; displayableErrors: FormFieldError[]; fieldIndex: number | undefined; kcClsx: KcClsx }) {
|
193
|
+
const { attribute, fieldIndex, kcClsx } = props;
|
201
194
|
|
202
195
|
const displayableErrors = props.displayableErrors.filter(error => error.fieldIndex === fieldIndex);
|
203
196
|
|
@@ -208,7 +201,7 @@ function FieldErrors(props: {
|
|
208
201
|
return (
|
209
202
|
<span
|
210
203
|
id={`input-error-${attribute.name}${fieldIndex === undefined ? "" : `-${fieldIndex}`}`}
|
211
|
-
className={
|
204
|
+
className={kcClsx("kcInputErrorMessageClass")}
|
212
205
|
aria-live="polite"
|
213
206
|
>
|
214
207
|
{displayableErrors
|
@@ -227,9 +220,9 @@ type InputFiledByTypeProps = {
|
|
227
220
|
attribute: Attribute;
|
228
221
|
valueOrValues: string | string[];
|
229
222
|
displayableErrors: FormFieldError[];
|
230
|
-
|
231
|
-
getClassName: UserProfileFormFieldsProps["getClassName"];
|
223
|
+
dispatchFormAction: React.Dispatch<FormAction>;
|
232
224
|
i18n: I18n;
|
225
|
+
kcClsx: KcClsx;
|
233
226
|
};
|
234
227
|
|
235
228
|
function InputFiledByType(props: InputFiledByTypeProps) {
|
@@ -259,7 +252,7 @@ function InputFiledByType(props: InputFiledByTypeProps) {
|
|
259
252
|
|
260
253
|
if (attribute.name === "password" || attribute.name === "password-confirm") {
|
261
254
|
return (
|
262
|
-
<PasswordWrapper
|
255
|
+
<PasswordWrapper kcClsx={props.kcClsx} i18n={props.i18n} passwordInputId={attribute.name}>
|
263
256
|
{inputNode}
|
264
257
|
</PasswordWrapper>
|
265
258
|
);
|
@@ -270,8 +263,8 @@ function InputFiledByType(props: InputFiledByTypeProps) {
|
|
270
263
|
}
|
271
264
|
}
|
272
265
|
|
273
|
-
function PasswordWrapper(props: {
|
274
|
-
const {
|
266
|
+
function PasswordWrapper(props: { kcClsx: KcClsx; i18n: I18n; passwordInputId: string; children: JSX.Element }) {
|
267
|
+
const { kcClsx, i18n, passwordInputId, children } = props;
|
275
268
|
|
276
269
|
const { msgStr } = i18n;
|
277
270
|
|
@@ -286,26 +279,23 @@ function PasswordWrapper(props: { getClassName: (classKey: ClassKey) => string;
|
|
286
279
|
}, [isPasswordRevealed]);
|
287
280
|
|
288
281
|
return (
|
289
|
-
<div className={
|
282
|
+
<div className={kcClsx("kcInputGroup")}>
|
290
283
|
{children}
|
291
284
|
<button
|
292
285
|
type="button"
|
293
|
-
className={
|
286
|
+
className={kcClsx("kcFormPasswordVisibilityButtonClass")}
|
294
287
|
aria-label={msgStr(isPasswordRevealed ? "hidePassword" : "showPassword")}
|
295
288
|
aria-controls={passwordInputId}
|
296
289
|
onClick={toggleIsPasswordRevealed}
|
297
290
|
>
|
298
|
-
<i
|
299
|
-
className={getClassName(isPasswordRevealed ? "kcFormPasswordVisibilityIconHide" : "kcFormPasswordVisibilityIconShow")}
|
300
|
-
aria-hidden
|
301
|
-
/>
|
291
|
+
<i className={kcClsx(isPasswordRevealed ? "kcFormPasswordVisibilityIconHide" : "kcFormPasswordVisibilityIconShow")} aria-hidden />
|
302
292
|
</button>
|
303
293
|
</div>
|
304
294
|
);
|
305
295
|
}
|
306
296
|
|
307
297
|
function InputTag(props: InputFiledByTypeProps & { fieldIndex: number | undefined }) {
|
308
|
-
const { attribute, fieldIndex,
|
298
|
+
const { attribute, fieldIndex, kcClsx, dispatchFormAction, valueOrValues, i18n, displayableErrors } = props;
|
309
299
|
|
310
300
|
return (
|
311
301
|
<>
|
@@ -331,7 +321,7 @@ function InputTag(props: InputFiledByTypeProps & { fieldIndex: number | undefine
|
|
331
321
|
|
332
322
|
return valueOrValues;
|
333
323
|
})()}
|
334
|
-
className={
|
324
|
+
className={kcClsx("kcInputClass")}
|
335
325
|
aria-invalid={displayableErrors.find(error => error.fieldIndex === fieldIndex) !== undefined}
|
336
326
|
disabled={attribute.readOnly}
|
337
327
|
autoComplete={attribute.autocomplete}
|
@@ -349,7 +339,7 @@ function InputTag(props: InputFiledByTypeProps & { fieldIndex: number | undefine
|
|
349
339
|
step={attribute.annotations.inputTypeStep}
|
350
340
|
{...Object.fromEntries(Object.entries(attribute.html5DataAnnotations ?? {}).map(([key, value]) => [`data-${key}`, value]))}
|
351
341
|
onChange={event =>
|
352
|
-
|
342
|
+
dispatchFormAction({
|
353
343
|
action: "update",
|
354
344
|
name: attribute.name,
|
355
345
|
valueOrValues: (() => {
|
@@ -370,7 +360,7 @@ function InputTag(props: InputFiledByTypeProps & { fieldIndex: number | undefine
|
|
370
360
|
})
|
371
361
|
}
|
372
362
|
onBlur={() =>
|
373
|
-
|
363
|
+
dispatchFormAction({
|
374
364
|
action: "focus lost",
|
375
365
|
name: attribute.name,
|
376
366
|
fieldIndex: fieldIndex
|
@@ -388,17 +378,12 @@ function InputTag(props: InputFiledByTypeProps & { fieldIndex: number | undefine
|
|
388
378
|
|
389
379
|
return (
|
390
380
|
<>
|
391
|
-
<FieldErrors
|
392
|
-
attribute={attribute}
|
393
|
-
getClassName={getClassName}
|
394
|
-
displayableErrors={displayableErrors}
|
395
|
-
fieldIndex={fieldIndex}
|
396
|
-
/>
|
381
|
+
<FieldErrors attribute={attribute} kcClsx={kcClsx} displayableErrors={displayableErrors} fieldIndex={fieldIndex} />
|
397
382
|
<AddRemoveButtonsMultiValuedAttribute
|
398
383
|
attribute={attribute}
|
399
384
|
values={values}
|
400
385
|
fieldIndex={fieldIndex}
|
401
|
-
dispatchFormAction={
|
386
|
+
dispatchFormAction={dispatchFormAction}
|
402
387
|
i18n={i18n}
|
403
388
|
/>
|
404
389
|
</>
|
@@ -465,7 +450,7 @@ function AddRemoveButtonsMultiValuedAttribute(props: {
|
|
465
450
|
}
|
466
451
|
|
467
452
|
function InputTagSelects(props: InputFiledByTypeProps) {
|
468
|
-
const { attribute,
|
453
|
+
const { attribute, dispatchFormAction, kcClsx, valueOrValues } = props;
|
469
454
|
|
470
455
|
const { advancedMsg } = props.i18n;
|
471
456
|
|
@@ -478,16 +463,16 @@ function InputTagSelects(props: InputFiledByTypeProps) {
|
|
478
463
|
case "select-radiobuttons":
|
479
464
|
return {
|
480
465
|
inputType: "radio",
|
481
|
-
classDiv:
|
482
|
-
classInput:
|
483
|
-
classLabel:
|
466
|
+
classDiv: kcClsx("kcInputClassRadio"),
|
467
|
+
classInput: kcClsx("kcInputClassRadioInput"),
|
468
|
+
classLabel: kcClsx("kcInputClassRadioLabel")
|
484
469
|
};
|
485
470
|
case "multiselect-checkboxes":
|
486
471
|
return {
|
487
472
|
inputType: "checkbox",
|
488
|
-
classDiv:
|
489
|
-
classInput:
|
490
|
-
classLabel:
|
473
|
+
classDiv: kcClsx("kcInputClassCheckbox"),
|
474
|
+
classInput: kcClsx("kcInputClassCheckboxInput"),
|
475
|
+
classLabel: kcClsx("kcInputClassCheckboxLabel")
|
491
476
|
};
|
492
477
|
}
|
493
478
|
})();
|
@@ -530,7 +515,7 @@ function InputTagSelects(props: InputFiledByTypeProps) {
|
|
530
515
|
disabled={attribute.readOnly}
|
531
516
|
checked={valueOrValues instanceof Array ? valueOrValues.includes(option) : valueOrValues === option}
|
532
517
|
onChange={event =>
|
533
|
-
|
518
|
+
dispatchFormAction({
|
534
519
|
action: "update",
|
535
520
|
name: attribute.name,
|
536
521
|
valueOrValues: (() => {
|
@@ -553,7 +538,7 @@ function InputTagSelects(props: InputFiledByTypeProps) {
|
|
553
538
|
})
|
554
539
|
}
|
555
540
|
onBlur={() =>
|
556
|
-
|
541
|
+
dispatchFormAction({
|
557
542
|
action: "focus lost",
|
558
543
|
name: attribute.name,
|
559
544
|
fieldIndex: undefined
|
@@ -562,7 +547,7 @@ function InputTagSelects(props: InputFiledByTypeProps) {
|
|
562
547
|
/>
|
563
548
|
<label
|
564
549
|
htmlFor={`${attribute.name}-${option}`}
|
565
|
-
className={`${classLabel}${attribute.readOnly ? ` ${
|
550
|
+
className={`${classLabel}${attribute.readOnly ? ` ${kcClsx("kcInputClassRadioCheckboxLabelDisabled")}` : ""}`}
|
566
551
|
>
|
567
552
|
{advancedMsg(option)}
|
568
553
|
</label>
|
@@ -573,7 +558,7 @@ function InputTagSelects(props: InputFiledByTypeProps) {
|
|
573
558
|
}
|
574
559
|
|
575
560
|
function TextareaTag(props: InputFiledByTypeProps) {
|
576
|
-
const { attribute,
|
561
|
+
const { attribute, dispatchFormAction, kcClsx, displayableErrors, valueOrValues } = props;
|
577
562
|
|
578
563
|
assert(typeof valueOrValues === "string");
|
579
564
|
|
@@ -583,7 +568,7 @@ function TextareaTag(props: InputFiledByTypeProps) {
|
|
583
568
|
<textarea
|
584
569
|
id={attribute.name}
|
585
570
|
name={attribute.name}
|
586
|
-
className={
|
571
|
+
className={kcClsx("kcInputClass")}
|
587
572
|
aria-invalid={displayableErrors.length !== 0}
|
588
573
|
disabled={attribute.readOnly}
|
589
574
|
cols={attribute.annotations.inputTypeCols === undefined ? undefined : parseInt(`${attribute.annotations.inputTypeCols}`)}
|
@@ -591,14 +576,14 @@ function TextareaTag(props: InputFiledByTypeProps) {
|
|
591
576
|
maxLength={attribute.annotations.inputTypeMaxlength === undefined ? undefined : parseInt(`${attribute.annotations.inputTypeMaxlength}`)}
|
592
577
|
value={value}
|
593
578
|
onChange={event =>
|
594
|
-
|
579
|
+
dispatchFormAction({
|
595
580
|
action: "update",
|
596
581
|
name: attribute.name,
|
597
582
|
valueOrValues: event.target.value
|
598
583
|
})
|
599
584
|
}
|
600
585
|
onBlur={() =>
|
601
|
-
|
586
|
+
dispatchFormAction({
|
602
587
|
action: "focus lost",
|
603
588
|
name: attribute.name,
|
604
589
|
fieldIndex: undefined
|
@@ -609,7 +594,7 @@ function TextareaTag(props: InputFiledByTypeProps) {
|
|
609
594
|
}
|
610
595
|
|
611
596
|
function SelectTag(props: InputFiledByTypeProps) {
|
612
|
-
const { attribute,
|
597
|
+
const { attribute, dispatchFormAction, kcClsx, displayableErrors, i18n, valueOrValues } = props;
|
613
598
|
|
614
599
|
const { advancedMsg } = i18n;
|
615
600
|
|
@@ -619,14 +604,14 @@ function SelectTag(props: InputFiledByTypeProps) {
|
|
619
604
|
<select
|
620
605
|
id={attribute.name}
|
621
606
|
name={attribute.name}
|
622
|
-
className={
|
607
|
+
className={kcClsx("kcInputClass")}
|
623
608
|
aria-invalid={displayableErrors.length !== 0}
|
624
609
|
disabled={attribute.readOnly}
|
625
610
|
multiple={isMultiple}
|
626
611
|
size={attribute.annotations.inputTypeSize === undefined ? undefined : parseInt(`${attribute.annotations.inputTypeSize}`)}
|
627
612
|
value={valueOrValues}
|
628
613
|
onChange={event =>
|
629
|
-
|
614
|
+
dispatchFormAction({
|
630
615
|
action: "update",
|
631
616
|
name: attribute.name,
|
632
617
|
valueOrValues: (() => {
|
@@ -639,7 +624,7 @@ function SelectTag(props: InputFiledByTypeProps) {
|
|
639
624
|
})
|
640
625
|
}
|
641
626
|
onBlur={() =>
|
642
|
-
|
627
|
+
dispatchFormAction({
|
643
628
|
action: "focus lost",
|
644
629
|
name: attribute.name,
|
645
630
|
fieldIndex: undefined
|