@keycloakify/svelte 0.0.1-rc.6 → 0.1.0

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.
Files changed (196) hide show
  1. package/README.md +1 -1
  2. package/keycloakify-svelte/account/DefaultPage.svelte +42 -0
  3. package/keycloakify-svelte/account/DefaultPage.svelte.d.ts +6 -0
  4. package/keycloakify-svelte/account/KcContext/KcContext.d.ts +1 -0
  5. package/keycloakify-svelte/account/KcContext/KcContext.js +1 -0
  6. package/keycloakify-svelte/account/KcContext/index.d.ts +1 -0
  7. package/keycloakify-svelte/account/KcContext/index.js +1 -0
  8. package/keycloakify-svelte/account/Template.svelte +143 -0
  9. package/keycloakify-svelte/account/Template.svelte.d.ts +6 -0
  10. package/keycloakify-svelte/account/Template.useInitialize.d.ts +12 -0
  11. package/keycloakify-svelte/account/Template.useInitialize.js +19 -0
  12. package/keycloakify-svelte/account/TemplateProps.d.ts +12 -0
  13. package/keycloakify-svelte/account/TemplateProps.js +1 -0
  14. package/keycloakify-svelte/account/i18n/i18n.d.ts +15 -0
  15. package/keycloakify-svelte/account/i18n/i18n.js +1 -0
  16. package/keycloakify-svelte/account/i18n/i18nBuilder.d.ts +18 -0
  17. package/keycloakify-svelte/account/i18n/i18nBuilder.js +26 -0
  18. package/keycloakify-svelte/account/i18n/index.d.ts +1 -0
  19. package/keycloakify-svelte/account/i18n/index.js +1 -0
  20. package/keycloakify-svelte/account/i18n/useI18n.d.ts +28 -0
  21. package/keycloakify-svelte/account/i18n/useI18n.js +65 -0
  22. package/keycloakify-svelte/account/index.d.ts +2 -0
  23. package/keycloakify-svelte/account/index.js +1 -0
  24. package/keycloakify-svelte/account/pages/Account.svelte +182 -0
  25. package/keycloakify-svelte/account/pages/Account.svelte.d.ts +6 -0
  26. package/keycloakify-svelte/account/pages/Applications.svelte +173 -0
  27. package/keycloakify-svelte/account/pages/Applications.svelte.d.ts +6 -0
  28. package/keycloakify-svelte/account/pages/FederatedIdentity.svelte +114 -0
  29. package/keycloakify-svelte/account/pages/FederatedIdentity.svelte.d.ts +6 -0
  30. package/keycloakify-svelte/account/pages/Log.svelte +68 -0
  31. package/keycloakify-svelte/account/pages/Log.svelte.d.ts +6 -0
  32. package/keycloakify-svelte/account/pages/PageProps.d.ts +10 -0
  33. package/keycloakify-svelte/account/pages/PageProps.js +1 -0
  34. package/keycloakify-svelte/account/pages/Password.svelte +233 -0
  35. package/keycloakify-svelte/account/pages/Password.svelte.d.ts +6 -0
  36. package/keycloakify-svelte/account/pages/Sessions.svelte +88 -0
  37. package/keycloakify-svelte/account/pages/Sessions.svelte.d.ts +6 -0
  38. package/keycloakify-svelte/account/pages/Totp.svelte +287 -0
  39. package/keycloakify-svelte/account/pages/Totp.svelte.d.ts +6 -0
  40. package/keycloakify-svelte/additional-svelte-typings.d.ts +6 -0
  41. package/keycloakify-svelte/bin/200.index.js +399 -0
  42. package/keycloakify-svelte/bin/266.index.js +964 -0
  43. package/keycloakify-svelte/bin/279.index.js +4298 -0
  44. package/keycloakify-svelte/bin/709.index.js +494 -0
  45. package/keycloakify-svelte/bin/818.index.js +1037 -0
  46. package/keycloakify-svelte/bin/index.js +2454 -0
  47. package/keycloakify-svelte/bin/package.json +3 -0
  48. package/keycloakify-svelte/login/DefaultPage.svelte +135 -0
  49. package/keycloakify-svelte/login/DefaultPage.svelte.d.ts +12 -0
  50. package/keycloakify-svelte/login/KcContext/KcContext.d.ts +1 -0
  51. package/keycloakify-svelte/login/KcContext/KcContext.js +1 -0
  52. package/keycloakify-svelte/login/KcContext/index.d.ts +1 -0
  53. package/keycloakify-svelte/login/KcContext/index.js +1 -0
  54. package/keycloakify-svelte/login/Template.svelte +223 -0
  55. package/keycloakify-svelte/login/Template.svelte.d.ts +6 -0
  56. package/keycloakify-svelte/login/Template.useInitialize.d.ts +14 -0
  57. package/keycloakify-svelte/login/Template.useInitialize.js +55 -0
  58. package/keycloakify-svelte/login/TemplateProps.d.ts +20 -0
  59. package/keycloakify-svelte/login/TemplateProps.js +1 -0
  60. package/keycloakify-svelte/login/components/AddRemoveButtonsMultiValuedAttribute.svelte +57 -0
  61. package/keycloakify-svelte/login/components/AddRemoveButtonsMultiValuedAttribute.svelte.d.ts +18 -0
  62. package/keycloakify-svelte/login/components/FieldErrors.svelte +31 -0
  63. package/keycloakify-svelte/login/components/FieldErrors.svelte.d.ts +12 -0
  64. package/keycloakify-svelte/login/components/GroupLabel.svelte +68 -0
  65. package/keycloakify-svelte/login/components/GroupLabel.svelte.d.ts +15 -0
  66. package/keycloakify-svelte/login/components/InputFieldByType.svelte +58 -0
  67. package/keycloakify-svelte/login/components/InputFieldByType.svelte.d.ts +4 -0
  68. package/keycloakify-svelte/login/components/InputFieldByTypeProps.d.ts +16 -0
  69. package/keycloakify-svelte/login/components/InputFieldByTypeProps.js +1 -0
  70. package/keycloakify-svelte/login/components/InputTag.svelte +107 -0
  71. package/keycloakify-svelte/login/components/InputTag.svelte.d.ts +7 -0
  72. package/keycloakify-svelte/login/components/InputTagSelects.svelte +111 -0
  73. package/keycloakify-svelte/login/components/InputTagSelects.svelte.d.ts +4 -0
  74. package/keycloakify-svelte/login/components/LogoutOtherSessions.svelte +29 -0
  75. package/keycloakify-svelte/login/components/LogoutOtherSessions.svelte.d.ts +10 -0
  76. package/keycloakify-svelte/login/components/PasswordWrapper.svelte +43 -0
  77. package/keycloakify-svelte/login/components/PasswordWrapper.svelte.d.ts +13 -0
  78. package/keycloakify-svelte/login/components/SelectTag.svelte +72 -0
  79. package/keycloakify-svelte/login/components/SelectTag.svelte.d.ts +4 -0
  80. package/keycloakify-svelte/login/components/TermsAcceptance.svelte +56 -0
  81. package/keycloakify-svelte/login/components/TermsAcceptance.svelte.d.ts +13 -0
  82. package/keycloakify-svelte/login/components/TextareaTag.svelte +40 -0
  83. package/keycloakify-svelte/login/components/TextareaTag.svelte.d.ts +4 -0
  84. package/keycloakify-svelte/login/components/UserProfileFormFields.svelte +123 -0
  85. package/keycloakify-svelte/login/components/UserProfileFormFields.svelte.d.ts +6 -0
  86. package/keycloakify-svelte/login/components/UserProfileFormFieldsProps.d.ts +27 -0
  87. package/keycloakify-svelte/login/components/UserProfileFormFieldsProps.js +2 -0
  88. package/keycloakify-svelte/login/components/inputLabel.d.ts +3 -0
  89. package/keycloakify-svelte/login/components/inputLabel.js +12 -0
  90. package/keycloakify-svelte/login/i18n/i18n.d.ts +15 -0
  91. package/keycloakify-svelte/login/i18n/i18n.js +1 -0
  92. package/keycloakify-svelte/login/i18n/i18nBuilder.d.ts +18 -0
  93. package/keycloakify-svelte/login/i18n/i18nBuilder.js +26 -0
  94. package/keycloakify-svelte/login/i18n/index.d.ts +1 -0
  95. package/keycloakify-svelte/login/i18n/index.js +1 -0
  96. package/keycloakify-svelte/login/i18n/useI18n.d.ts +28 -0
  97. package/keycloakify-svelte/login/i18n/useI18n.js +65 -0
  98. package/keycloakify-svelte/login/index.d.ts +2 -0
  99. package/keycloakify-svelte/login/index.js +1 -0
  100. package/keycloakify-svelte/login/lib/useUserProfileForm.d.ts +66 -0
  101. package/keycloakify-svelte/login/lib/useUserProfileForm.js +63 -0
  102. package/keycloakify-svelte/login/pages/Code.svelte +46 -0
  103. package/keycloakify-svelte/login/pages/Code.svelte.d.ts +6 -0
  104. package/keycloakify-svelte/login/pages/DeleteAccountConfirm.svelte +77 -0
  105. package/keycloakify-svelte/login/pages/DeleteAccountConfirm.svelte.d.ts +6 -0
  106. package/keycloakify-svelte/login/pages/DeleteCredential.svelte +58 -0
  107. package/keycloakify-svelte/login/pages/DeleteCredential.svelte.d.ts +6 -0
  108. package/keycloakify-svelte/login/pages/Error.svelte +43 -0
  109. package/keycloakify-svelte/login/pages/Error.svelte.d.ts +6 -0
  110. package/keycloakify-svelte/login/pages/FrontchannelLogout.svelte +57 -0
  111. package/keycloakify-svelte/login/pages/FrontchannelLogout.svelte.d.ts +6 -0
  112. package/keycloakify-svelte/login/pages/IdpReviewUserProfile.svelte +80 -0
  113. package/keycloakify-svelte/login/pages/IdpReviewUserProfile.svelte.d.ts +11 -0
  114. package/keycloakify-svelte/login/pages/Info.svelte +66 -0
  115. package/keycloakify-svelte/login/pages/Info.svelte.d.ts +6 -0
  116. package/keycloakify-svelte/login/pages/Login.svelte +225 -0
  117. package/keycloakify-svelte/login/pages/Login.svelte.d.ts +6 -0
  118. package/keycloakify-svelte/login/pages/LoginConfigTotp.svelte +217 -0
  119. package/keycloakify-svelte/login/pages/LoginConfigTotp.svelte.d.ts +6 -0
  120. package/keycloakify-svelte/login/pages/LoginIdpLinkConfirm.svelte +60 -0
  121. package/keycloakify-svelte/login/pages/LoginIdpLinkConfirm.svelte.d.ts +6 -0
  122. package/keycloakify-svelte/login/pages/LoginIdpLinkConfirmOverride.svelte +59 -0
  123. package/keycloakify-svelte/login/pages/LoginIdpLinkConfirmOverride.svelte.d.ts +6 -0
  124. package/keycloakify-svelte/login/pages/LoginIdpLinkEmail.svelte +50 -0
  125. package/keycloakify-svelte/login/pages/LoginIdpLinkEmail.svelte.d.ts +6 -0
  126. package/keycloakify-svelte/login/pages/LoginOauth2DeviceVerifyUserCode.svelte +85 -0
  127. package/keycloakify-svelte/login/pages/LoginOauth2DeviceVerifyUserCode.svelte.d.ts +6 -0
  128. package/keycloakify-svelte/login/pages/LoginOauthGrant.svelte +126 -0
  129. package/keycloakify-svelte/login/pages/LoginOauthGrant.svelte.d.ts +6 -0
  130. package/keycloakify-svelte/login/pages/LoginOtp.svelte +128 -0
  131. package/keycloakify-svelte/login/pages/LoginOtp.svelte.d.ts +6 -0
  132. package/keycloakify-svelte/login/pages/LoginPageExpired.svelte +50 -0
  133. package/keycloakify-svelte/login/pages/LoginPageExpired.svelte.d.ts +6 -0
  134. package/keycloakify-svelte/login/pages/LoginPasskeysConditionalAuthenticate.svelte +240 -0
  135. package/keycloakify-svelte/login/pages/LoginPasskeysConditionalAuthenticate.svelte.d.ts +6 -0
  136. package/keycloakify-svelte/login/pages/LoginPasskeysConditionalAuthenticate.useScript.d.ts +21 -0
  137. package/keycloakify-svelte/login/pages/LoginPasskeysConditionalAuthenticate.useScript.js +57 -0
  138. package/keycloakify-svelte/login/pages/LoginPassword.svelte +120 -0
  139. package/keycloakify-svelte/login/pages/LoginPassword.svelte.d.ts +6 -0
  140. package/keycloakify-svelte/login/pages/LoginRecoveryAuthnCodeConfig.svelte +179 -0
  141. package/keycloakify-svelte/login/pages/LoginRecoveryAuthnCodeConfig.svelte.d.ts +6 -0
  142. package/keycloakify-svelte/login/pages/LoginRecoveryAuthnCodeConfig.useScript.d.ts +10 -0
  143. package/keycloakify-svelte/login/pages/LoginRecoveryAuthnCodeConfig.useScript.js +141 -0
  144. package/keycloakify-svelte/login/pages/LoginRecoveryAuthnCodeInput.svelte +94 -0
  145. package/keycloakify-svelte/login/pages/LoginRecoveryAuthnCodeInput.svelte.d.ts +6 -0
  146. package/keycloakify-svelte/login/pages/LoginResetOtp.svelte +86 -0
  147. package/keycloakify-svelte/login/pages/LoginResetOtp.svelte.d.ts +6 -0
  148. package/keycloakify-svelte/login/pages/LoginResetPassword.svelte +109 -0
  149. package/keycloakify-svelte/login/pages/LoginResetPassword.svelte.d.ts +6 -0
  150. package/keycloakify-svelte/login/pages/LoginUpdatePassword.svelte +149 -0
  151. package/keycloakify-svelte/login/pages/LoginUpdatePassword.svelte.d.ts +6 -0
  152. package/keycloakify-svelte/login/pages/LoginUpdateProfile.svelte +98 -0
  153. package/keycloakify-svelte/login/pages/LoginUpdateProfile.svelte.d.ts +11 -0
  154. package/keycloakify-svelte/login/pages/LoginUsername.svelte +182 -0
  155. package/keycloakify-svelte/login/pages/LoginUsername.svelte.d.ts +6 -0
  156. package/keycloakify-svelte/login/pages/LoginVerifyEmail.svelte +39 -0
  157. package/keycloakify-svelte/login/pages/LoginVerifyEmail.svelte.d.ts +6 -0
  158. package/keycloakify-svelte/login/pages/LoginX509Info.svelte +123 -0
  159. package/keycloakify-svelte/login/pages/LoginX509Info.svelte.d.ts +6 -0
  160. package/keycloakify-svelte/login/pages/LogoutConfirm.svelte +77 -0
  161. package/keycloakify-svelte/login/pages/LogoutConfirm.svelte.d.ts +6 -0
  162. package/keycloakify-svelte/login/pages/PageProps.d.ts +10 -0
  163. package/keycloakify-svelte/login/pages/PageProps.js +1 -0
  164. package/keycloakify-svelte/login/pages/Register.svelte +136 -0
  165. package/keycloakify-svelte/login/pages/Register.svelte.d.ts +11 -0
  166. package/keycloakify-svelte/login/pages/SamlPostForm.svelte +80 -0
  167. package/keycloakify-svelte/login/pages/SamlPostForm.svelte.d.ts +6 -0
  168. package/keycloakify-svelte/login/pages/SelectAuthenticator.svelte +63 -0
  169. package/keycloakify-svelte/login/pages/SelectAuthenticator.svelte.d.ts +6 -0
  170. package/keycloakify-svelte/login/pages/Terms.svelte +57 -0
  171. package/keycloakify-svelte/login/pages/Terms.svelte.d.ts +6 -0
  172. package/keycloakify-svelte/login/pages/UpdateEmail.svelte +104 -0
  173. package/keycloakify-svelte/login/pages/UpdateEmail.svelte.d.ts +11 -0
  174. package/keycloakify-svelte/login/pages/WebauthnAuthenticate.svelte +182 -0
  175. package/keycloakify-svelte/login/pages/WebauthnAuthenticate.svelte.d.ts +6 -0
  176. package/keycloakify-svelte/login/pages/WebauthnAuthenticate.useScript.d.ts +22 -0
  177. package/keycloakify-svelte/login/pages/WebauthnAuthenticate.useScript.js +49 -0
  178. package/keycloakify-svelte/login/pages/WebauthnError.svelte +86 -0
  179. package/keycloakify-svelte/login/pages/WebauthnError.svelte.d.ts +6 -0
  180. package/keycloakify-svelte/login/pages/WebauthnRegister.svelte +109 -0
  181. package/keycloakify-svelte/login/pages/WebauthnRegister.svelte.d.ts +6 -0
  182. package/keycloakify-svelte/login/pages/WebauthnRegister.useScript.d.ts +28 -0
  183. package/keycloakify-svelte/login/pages/WebauthnRegister.useScript.js +57 -0
  184. package/keycloakify-svelte/tools/useConst.d.ts +1 -0
  185. package/keycloakify-svelte/tools/useConst.js +4 -0
  186. package/keycloakify-svelte/tools/useInsertLinkTags.d.ts +12 -0
  187. package/keycloakify-svelte/tools/useInsertLinkTags.js +62 -0
  188. package/keycloakify-svelte/tools/useInsertScriptTags.d.ts +29 -0
  189. package/keycloakify-svelte/tools/useInsertScriptTags.js +77 -0
  190. package/keycloakify-svelte/tools/useReducer.d.ts +2 -0
  191. package/keycloakify-svelte/tools/useReducer.js +7 -0
  192. package/keycloakify-svelte/tools/useSetClassName.d.ts +4 -0
  193. package/keycloakify-svelte/tools/useSetClassName.js +15 -0
  194. package/keycloakify-svelte/tools/useState.d.ts +2 -0
  195. package/keycloakify-svelte/tools/useState.js +7 -0
  196. package/package.json +6 -3
@@ -0,0 +1,68 @@
1
+ <script lang="ts">
2
+ import type { Attribute } from 'keycloakify/login/KcContext';
3
+ import type { KcClsx } from 'keycloakify/login/lib/kcClsx';
4
+ import { assert } from 'keycloakify/tools/assert';
5
+ import { createRawSnippet } from 'svelte';
6
+ import type { I18n } from '../i18n';
7
+ import type { Readable } from 'svelte/store';
8
+
9
+ type GroupLabelProps = {
10
+ attribute: Attribute;
11
+ groupNameRef: {
12
+ current: string;
13
+ };
14
+ i18n: Readable<I18n>;
15
+ kcClsx: KcClsx;
16
+ };
17
+ const { attribute, groupNameRef, i18n, kcClsx }: GroupLabelProps = $props();
18
+ const { advancedMsg } = $i18n;
19
+
20
+ let isGrouplabel = $state<boolean>(false);
21
+ if (attribute.group?.name !== groupNameRef.current) {
22
+ groupNameRef.current = attribute.group?.name ?? '';
23
+
24
+ if (groupNameRef.current !== '') {
25
+ assert(attribute.group !== undefined);
26
+ isGrouplabel = true;
27
+ }
28
+ }
29
+
30
+ const html5DataAnnotations = {
31
+ ...Object.fromEntries(
32
+ Object.entries(attribute.group?.html5DataAnnotations ?? {}).map(([key, value]) => [`data-${key}`, value]),
33
+ ),
34
+ };
35
+ </script>
36
+
37
+ {#if isGrouplabel}
38
+ {@const groupDisplayHeader = attribute.group?.displayHeader ?? ''}
39
+ {@const groupDisplayDescription = attribute.group?.displayDescription ?? ''}
40
+ {@const groupHeaderText =
41
+ groupDisplayHeader !== ''
42
+ ? advancedMsg(groupDisplayHeader)
43
+ : createRawSnippet(() => ({ render: () => attribute.group?.name ?? '' }))}
44
+ <div
45
+ class={kcClsx('kcFormGroupClass')}
46
+ {...html5DataAnnotations}
47
+ >
48
+ <div class={kcClsx('kcContentWrapperClass')}>
49
+ <label
50
+ id={`header-${attribute.group?.name}`}
51
+ class={kcClsx('kcFormGroupHeader')}
52
+ >
53
+ {@render groupHeaderText()}
54
+ </label>
55
+ </div>
56
+ {#if groupDisplayDescription !== ''}
57
+ {@const groupDescriptionText = advancedMsg(groupDisplayDescription)}
58
+ <div class={kcClsx('kcLabelWrapperClass')}>
59
+ <label
60
+ id={`description-${attribute.group?.name}`}
61
+ class={kcClsx('kcLabelClass')}
62
+ >
63
+ {@render groupDescriptionText()}
64
+ </label>
65
+ </div>
66
+ {/if}
67
+ </div>
68
+ {/if}
@@ -0,0 +1,15 @@
1
+ type GroupLabelProps = {
2
+ attribute: Attribute;
3
+ groupNameRef: {
4
+ current: string;
5
+ };
6
+ i18n: Readable<I18n>;
7
+ kcClsx: KcClsx;
8
+ };
9
+ import type { Attribute } from 'keycloakify/login/KcContext';
10
+ import type { KcClsx } from 'keycloakify/login/lib/kcClsx';
11
+ import type { I18n } from '../i18n';
12
+ import type { Readable } from 'svelte/store';
13
+ declare const GroupLabel: import("svelte").Component<GroupLabelProps, {}, "">;
14
+ type GroupLabel = ReturnType<typeof GroupLabel>;
15
+ export default GroupLabel;
@@ -0,0 +1,58 @@
1
+ <script lang="ts">
2
+ import type { InputFieldByTypeProps } from './InputFieldByTypeProps';
3
+ import InputTag from './InputTag.svelte';
4
+ import InputTagSelects from './InputTagSelects.svelte';
5
+ import PasswordWrapper from './PasswordWrapper.svelte';
6
+ import SelectTag from './SelectTag.svelte';
7
+ import TextareaTag from './TextareaTag.svelte';
8
+
9
+ let { displayableErrors, ...props }: InputFieldByTypeProps = $props();
10
+ const { attribute, valueOrValues } = props;
11
+ const inputType = attribute.annotations.inputType ?? '';
12
+ </script>
13
+
14
+ {#if inputType === 'textarea'}
15
+ <TextareaTag
16
+ {...props}
17
+ {displayableErrors}
18
+ />
19
+ {:else if ['select', 'multiselect'].includes(inputType)}
20
+ <SelectTag
21
+ {...props}
22
+ {displayableErrors}
23
+ />
24
+ {:else if ['select-radiobuttons', 'multiselect-checkboxes'].includes(inputType)}
25
+ <InputTagSelects
26
+ {...props}
27
+ {displayableErrors}
28
+ />
29
+ {:else}
30
+ <!-- default -->
31
+ {#if valueOrValues instanceof Array}
32
+ {#each valueOrValues as _, i}
33
+ <InputTag
34
+ {...props}
35
+ bind:displayableErrors
36
+ fieldIndex={i}
37
+ />
38
+ {/each}
39
+ {:else}
40
+ {#snippet inputNode()}
41
+ <InputTag
42
+ {...props}
43
+ bind:displayableErrors
44
+ />
45
+ {/snippet}
46
+ {#if ['password', 'password-confirm'].includes(attribute.name)}
47
+ <PasswordWrapper
48
+ kcClsx={props.kcClsx}
49
+ i18n={props.i18n}
50
+ passwordInputId={attribute.name}
51
+ >
52
+ {@render inputNode()}
53
+ </PasswordWrapper>
54
+ {:else}
55
+ {@render inputNode()}
56
+ {/if}
57
+ {/if}
58
+ {/if}
@@ -0,0 +1,4 @@
1
+ import type { InputFieldByTypeProps } from './InputFieldByTypeProps';
2
+ declare const InputFieldByType: import("svelte").Component<InputFieldByTypeProps, {}, "">;
3
+ type InputFieldByType = ReturnType<typeof InputFieldByType>;
4
+ export default InputFieldByType;
@@ -0,0 +1,16 @@
1
+ import type { FormAction, FormFieldError } from '../lib/useUserProfileForm';
2
+ import type { Attribute } from 'keycloakify/login/KcContext';
3
+ import type { KcClsx } from 'keycloakify/login/lib/kcClsx';
4
+ import type { EventDispatcher } from 'svelte';
5
+ import type { I18n } from '../i18n';
6
+ import type { Readable } from 'svelte/store';
7
+ export type InputFieldByTypeProps = {
8
+ attribute: Attribute;
9
+ valueOrValues: string | string[];
10
+ displayableErrors: FormFieldError[];
11
+ dispatchFormAction: EventDispatcher<{
12
+ formAction: FormAction;
13
+ }>;
14
+ i18n: Readable<I18n>;
15
+ kcClsx: KcClsx;
16
+ };
@@ -0,0 +1,107 @@
1
+ <script lang="ts">
2
+ import AddRemoveButtonsMultiValuedAttribute from './AddRemoveButtonsMultiValuedAttribute.svelte';
3
+ import FieldErrors from './FieldErrors.svelte';
4
+ import type { InputFieldByTypeProps } from './InputFieldByTypeProps';
5
+ import { assert } from 'keycloakify/tools/assert';
6
+
7
+ type InputTagProps = InputFieldByTypeProps & { fieldIndex?: number };
8
+ let {
9
+ attribute,
10
+ fieldIndex,
11
+ kcClsx,
12
+ dispatchFormAction,
13
+ valueOrValues,
14
+ i18n,
15
+ displayableErrors = $bindable([]),
16
+ }: InputTagProps = $props();
17
+
18
+ const { advancedMsgStr } = $i18n;
19
+ const { inputType } = attribute.annotations;
20
+ let value = $state(
21
+ (() => {
22
+ if (fieldIndex !== undefined) {
23
+ assert(valueOrValues instanceof Array);
24
+ return valueOrValues[fieldIndex];
25
+ }
26
+
27
+ assert(typeof valueOrValues === 'string');
28
+
29
+ return valueOrValues;
30
+ })(),
31
+ );
32
+ const html5DataAnnotations = {
33
+ ...Object.fromEntries(
34
+ Object.entries(attribute.group?.html5DataAnnotations ?? {}).map(([key, value]) => [`data-${key}`, value]),
35
+ ),
36
+ };
37
+ </script>
38
+
39
+ <input
40
+ type={inputType?.startsWith('html5-') ? inputType.slice(6) : (inputType ?? 'text')}
41
+ id={attribute.name}
42
+ name={attribute.name}
43
+ bind:value
44
+ class={kcClsx('kcInputClass')}
45
+ aria-invalid={displayableErrors.find((error) => error.fieldIndex === fieldIndex) !== undefined}
46
+ disabled={attribute.readOnly}
47
+ autocomplete={attribute.autocomplete as 'on'}
48
+ placeholder={attribute.annotations.inputTypePlaceholder === undefined
49
+ ? undefined
50
+ : advancedMsgStr(attribute.annotations.inputTypePlaceholder)}
51
+ pattern={attribute.annotations.inputTypePattern}
52
+ size={attribute.annotations.inputTypeSize === undefined
53
+ ? undefined
54
+ : parseInt(`${attribute.annotations.inputTypeSize}`)}
55
+ maxlength={attribute.annotations.inputTypeMaxlength === undefined
56
+ ? undefined
57
+ : parseInt(`${attribute.annotations.inputTypeMaxlength}`)}
58
+ minlength={attribute.annotations.inputTypeMinlength === undefined
59
+ ? undefined
60
+ : parseInt(`${attribute.annotations.inputTypeMinlength}`)}
61
+ max={attribute.annotations.inputTypeMax}
62
+ min={attribute.annotations.inputTypeMin}
63
+ step={attribute.annotations.inputTypeStep}
64
+ {...html5DataAnnotations}
65
+ onchange={(event) =>
66
+ dispatchFormAction('formAction', {
67
+ action: 'update',
68
+ name: attribute.name,
69
+ valueOrValues: (() => {
70
+ if (fieldIndex !== undefined) {
71
+ assert(valueOrValues instanceof Array);
72
+
73
+ return (valueOrValues as string[]).map((value, i) => {
74
+ if (i === fieldIndex) {
75
+ return event.currentTarget.value;
76
+ }
77
+
78
+ return value;
79
+ });
80
+ }
81
+
82
+ return event.currentTarget.value;
83
+ })(),
84
+ })}
85
+ onblur={() =>
86
+ dispatchFormAction('formAction', {
87
+ action: 'focus lost',
88
+ name: attribute.name,
89
+ fieldIndex: fieldIndex,
90
+ })}
91
+ />
92
+ {#if fieldIndex !== undefined && valueOrValues instanceof Array}
93
+ {@const values = valueOrValues}
94
+ <FieldErrors
95
+ {attribute}
96
+ {kcClsx}
97
+ bind:displayableErrors
98
+ {fieldIndex}
99
+ ></FieldErrors>
100
+ <AddRemoveButtonsMultiValuedAttribute
101
+ {attribute}
102
+ {values}
103
+ {fieldIndex}
104
+ {dispatchFormAction}
105
+ {i18n}
106
+ ></AddRemoveButtonsMultiValuedAttribute>
107
+ {/if}
@@ -0,0 +1,7 @@
1
+ type InputTagProps = InputFieldByTypeProps & {
2
+ fieldIndex?: number;
3
+ };
4
+ import type { InputFieldByTypeProps } from './InputFieldByTypeProps';
5
+ declare const InputTag: import("svelte").Component<InputTagProps, {}, "displayableErrors">;
6
+ type InputTag = ReturnType<typeof InputTag>;
7
+ export default InputTag;
@@ -0,0 +1,111 @@
1
+ <script lang="ts">
2
+ import type { InputFieldByTypeProps } from './InputFieldByTypeProps';
3
+ import { inputLabel } from './inputLabel';
4
+ import { assert } from 'keycloakify/tools/assert';
5
+
6
+ const { attribute, dispatchFormAction, kcClsx, i18n, valueOrValues, displayableErrors }: InputFieldByTypeProps =
7
+ $props();
8
+
9
+ const { classDiv, classInput, classLabel, inputType } = (() => {
10
+ const { inputType } = attribute.annotations;
11
+
12
+ assert(inputType === 'select-radiobuttons' || inputType === 'multiselect-checkboxes');
13
+
14
+ switch (inputType) {
15
+ case 'select-radiobuttons':
16
+ return {
17
+ inputType: 'radio',
18
+ classDiv: kcClsx('kcInputClassRadio'),
19
+ classInput: kcClsx('kcInputClassRadioInput'),
20
+ classLabel: kcClsx('kcInputClassRadioLabel'),
21
+ };
22
+ case 'multiselect-checkboxes':
23
+ return {
24
+ inputType: 'checkbox',
25
+ classDiv: kcClsx('kcInputClassCheckbox'),
26
+ classInput: kcClsx('kcInputClassCheckboxInput'),
27
+ classLabel: kcClsx('kcInputClassCheckboxLabel'),
28
+ };
29
+ default:
30
+ return {
31
+ inputType: '',
32
+ classDiv: '',
33
+ classInput: '',
34
+ classLabel: '',
35
+ };
36
+ }
37
+ })();
38
+
39
+ const options = (() => {
40
+ walk: {
41
+ const { inputOptionsFromValidation } = attribute.annotations;
42
+
43
+ if (inputOptionsFromValidation === undefined) {
44
+ break walk;
45
+ }
46
+
47
+ const validator = (attribute.validators as Record<string, { options?: string[] }>)[inputOptionsFromValidation];
48
+
49
+ if (validator === undefined) {
50
+ break walk;
51
+ }
52
+
53
+ if (validator.options === undefined) {
54
+ break walk;
55
+ }
56
+
57
+ return validator.options;
58
+ }
59
+
60
+ return attribute.validators.options?.options ?? [];
61
+ })();
62
+ </script>
63
+
64
+ {#each options as option}
65
+ <div class={classDiv}>
66
+ <input
67
+ type={inputType}
68
+ id={`${attribute.name}-${option}`}
69
+ name={attribute.name}
70
+ value={option}
71
+ class={classInput}
72
+ aria-invalid={displayableErrors.length !== 0}
73
+ disabled={attribute.readOnly}
74
+ checked={valueOrValues instanceof Array ? valueOrValues.includes(option) : valueOrValues === option}
75
+ onchange={(event) =>
76
+ dispatchFormAction('formAction', {
77
+ action: 'update',
78
+ name: attribute.name,
79
+ valueOrValues: (() => {
80
+ const isChecked = event.currentTarget.checked;
81
+
82
+ if (valueOrValues instanceof Array) {
83
+ const newValues = [...valueOrValues];
84
+
85
+ if (isChecked) {
86
+ newValues.push(option);
87
+ } else {
88
+ newValues.splice(newValues.indexOf(option), 1);
89
+ }
90
+
91
+ return newValues;
92
+ }
93
+
94
+ return event.currentTarget.checked ? option : '';
95
+ })(),
96
+ })}
97
+ onblur={() =>
98
+ dispatchFormAction('formAction', {
99
+ action: 'focus lost',
100
+ name: attribute.name,
101
+ fieldIndex: undefined,
102
+ })}
103
+ />
104
+ <label
105
+ for={`${attribute.name}-${option}`}
106
+ class={`${classLabel}${attribute.readOnly ? ` ${kcClsx('kcInputClassRadioCheckboxLabelDisabled')}` : ''}`}
107
+ >
108
+ {@render inputLabel($i18n, attribute, option)()}
109
+ </label>
110
+ </div>
111
+ {/each}
@@ -0,0 +1,4 @@
1
+ import type { InputFieldByTypeProps } from './InputFieldByTypeProps';
2
+ declare const InputTagSelects: import("svelte").Component<InputFieldByTypeProps, {}, "">;
3
+ type InputTagSelects = ReturnType<typeof InputTagSelects>;
4
+ export default InputTagSelects;
@@ -0,0 +1,29 @@
1
+ <script lang="ts">
2
+ import type { KcClsx } from 'keycloakify/login/lib/kcClsx';
3
+ import type { I18n } from '../i18n';
4
+ import type { Readable } from 'svelte/store';
5
+
6
+ const { kcClsx, i18n }: { kcClsx: KcClsx; i18n: Readable<I18n> } = $props();
7
+
8
+ const { msg } = $i18n;
9
+ </script>
10
+
11
+ <div
12
+ id="kc-form-options"
13
+ class={kcClsx('kcFormOptionsClass')}
14
+ >
15
+ <div class={kcClsx('kcFormOptionsWrapperClass')}>
16
+ <div class="checkbox">
17
+ <label>
18
+ <input
19
+ type="checkbox"
20
+ id="logout-sessions"
21
+ name="logout-sessions"
22
+ value="on"
23
+ checked={true}
24
+ />
25
+ {@render msg('logoutOtherSessions')()}
26
+ </label>
27
+ </div>
28
+ </div>
29
+ </div>
@@ -0,0 +1,10 @@
1
+ type $$ComponentProps = {
2
+ kcClsx: KcClsx;
3
+ i18n: Readable<I18n>;
4
+ };
5
+ import type { KcClsx } from 'keycloakify/login/lib/kcClsx';
6
+ import type { I18n } from '../i18n';
7
+ import type { Readable } from 'svelte/store';
8
+ declare const LogoutOtherSessions: import("svelte").Component<$$ComponentProps, {}, "">;
9
+ type LogoutOtherSessions = ReturnType<typeof LogoutOtherSessions>;
10
+ export default LogoutOtherSessions;
@@ -0,0 +1,43 @@
1
+ <script lang="ts">
2
+ import { useReducer } from '../../tools/useReducer';
3
+ import type { KcClsx } from 'keycloakify/login/lib/kcClsx';
4
+ import { assert } from 'keycloakify/tools/assert';
5
+ import { onMount, type Snippet } from 'svelte';
6
+ import type { I18n } from '../i18n';
7
+ import type { Readable } from 'svelte/store';
8
+
9
+ const props: { kcClsx: KcClsx; i18n: Readable<I18n>; passwordInputId: string; children: Snippet } = $props();
10
+ const { kcClsx, i18n, passwordInputId, children } = props;
11
+
12
+ const { msgStr } = $i18n;
13
+
14
+ const [isPasswordRevealed, toggleIsPasswordRevealed] = useReducer<boolean, boolean>(
15
+ (isPasswordRevealed: boolean) => !isPasswordRevealed,
16
+ false,
17
+ );
18
+ onMount(() => {
19
+ const unsubscribe = isPasswordRevealed.subscribe(($isPasswordRevealed) => {
20
+ const passwordInputElement: HTMLInputElement = document.getElementById(passwordInputId) as HTMLInputElement;
21
+
22
+ assert(passwordInputElement instanceof HTMLInputElement);
23
+ passwordInputElement.type = $isPasswordRevealed ? 'text' : 'password';
24
+ });
25
+ return () => unsubscribe();
26
+ });
27
+ </script>
28
+
29
+ <div class={kcClsx('kcInputGroup')}>
30
+ {@render children?.()}
31
+ <button
32
+ type="button"
33
+ class={kcClsx('kcFormPasswordVisibilityButtonClass')}
34
+ aria-label={msgStr($isPasswordRevealed ? 'hidePassword' : 'showPassword')}
35
+ aria-controls={passwordInputId}
36
+ onclick={() => toggleIsPasswordRevealed($isPasswordRevealed)}
37
+ >
38
+ <i
39
+ class={kcClsx($isPasswordRevealed ? 'kcFormPasswordVisibilityIconHide' : 'kcFormPasswordVisibilityIconShow')}
40
+ aria-hidden="true"
41
+ ></i>
42
+ </button>
43
+ </div>
@@ -0,0 +1,13 @@
1
+ type $$ComponentProps = {
2
+ kcClsx: KcClsx;
3
+ i18n: Readable<I18n>;
4
+ passwordInputId: string;
5
+ children: Snippet;
6
+ };
7
+ import type { KcClsx } from 'keycloakify/login/lib/kcClsx';
8
+ import { type Snippet } from 'svelte';
9
+ import type { I18n } from '../i18n';
10
+ import type { Readable } from 'svelte/store';
11
+ declare const PasswordWrapper: import("svelte").Component<$$ComponentProps, {}, "">;
12
+ type PasswordWrapper = ReturnType<typeof PasswordWrapper>;
13
+ export default PasswordWrapper;
@@ -0,0 +1,72 @@
1
+ <script lang="ts">
2
+ import type { InputFieldByTypeProps } from './InputFieldByTypeProps';
3
+ import { inputLabel } from './inputLabel';
4
+ import { assert } from 'keycloakify/tools/assert';
5
+ const { attribute, dispatchFormAction, kcClsx, displayableErrors, i18n, valueOrValues }: InputFieldByTypeProps =
6
+ $props();
7
+
8
+ const isMultiple = attribute.annotations.inputType === 'multiselect';
9
+ const options = (() => {
10
+ walk: {
11
+ const { inputOptionsFromValidation } = attribute.annotations;
12
+
13
+ if (inputOptionsFromValidation === undefined) {
14
+ break walk;
15
+ }
16
+
17
+ assert(typeof inputOptionsFromValidation === 'string');
18
+
19
+ const validator = (attribute.validators as Record<string, { options?: string[] }>)[inputOptionsFromValidation];
20
+
21
+ if (validator === undefined) {
22
+ break walk;
23
+ }
24
+
25
+ if (validator.options === undefined) {
26
+ break walk;
27
+ }
28
+
29
+ return validator.options;
30
+ }
31
+
32
+ return attribute.validators.options?.options ?? [];
33
+ })();
34
+ </script>
35
+
36
+ <select
37
+ id={attribute.name}
38
+ name={attribute.name}
39
+ class={kcClsx('kcInputClass')}
40
+ aria-invalid={displayableErrors.length !== 0}
41
+ disabled={attribute.readOnly}
42
+ multiple={isMultiple}
43
+ size={attribute.annotations.inputTypeSize === undefined
44
+ ? undefined
45
+ : parseInt(`${attribute.annotations.inputTypeSize}`)}
46
+ value={valueOrValues}
47
+ onchange={(event) =>
48
+ dispatchFormAction('formAction', {
49
+ action: 'update',
50
+ name: attribute.name,
51
+ valueOrValues: (() => {
52
+ if (isMultiple) {
53
+ return Array.from(event.currentTarget.selectedOptions).map((option) => option.value);
54
+ }
55
+
56
+ return event.currentTarget.value;
57
+ })(),
58
+ })}
59
+ onblur={() =>
60
+ dispatchFormAction('formAction', {
61
+ action: 'focus lost',
62
+ name: attribute.name,
63
+ fieldIndex: undefined,
64
+ })}
65
+ >
66
+ {#if !isMultiple}<option value=""></option>{/if}
67
+ {#each options as option}
68
+ <option value={option}>
69
+ {@render inputLabel($i18n, attribute, option)()}
70
+ </option>
71
+ {/each}
72
+ </select>
@@ -0,0 +1,4 @@
1
+ import type { InputFieldByTypeProps } from './InputFieldByTypeProps';
2
+ declare const SelectTag: import("svelte").Component<InputFieldByTypeProps, {}, "">;
3
+ type SelectTag = ReturnType<typeof SelectTag>;
4
+ export default SelectTag;
@@ -0,0 +1,56 @@
1
+ <script lang="ts">
2
+ import { kcSanitize } from 'keycloakify/lib/kcSanitize';
3
+ import type { KcClsx } from 'keycloakify/login/lib/kcClsx';
4
+ import type { KcContext } from '../KcContext';
5
+ import type { I18n } from '../i18n';
6
+ import type { Readable } from 'svelte/store';
7
+
8
+ type TermsAcceptanceProps = {
9
+ i18n: Readable<I18n>;
10
+ kcClsx: KcClsx;
11
+ messagesPerField: Pick<KcContext['messagesPerField'], 'existsError' | 'get'>;
12
+ areTermsAccepted: boolean;
13
+ onAreTermsAcceptedValueChange: (areTermsAccepted: boolean) => void;
14
+ };
15
+ const { i18n, kcClsx, messagesPerField, areTermsAccepted, onAreTermsAcceptedValueChange }: TermsAcceptanceProps =
16
+ $props();
17
+
18
+ const { msg } = $i18n;
19
+ </script>
20
+
21
+ <div class="form-group">
22
+ <div class={kcClsx('kcInputWrapperClass')}>
23
+ {@render msg('termsTitle')()}
24
+ <div id="kc-registration-terms-text">{@render msg('termsText')()}</div>
25
+ </div>
26
+ </div>
27
+ <div class="form-group">
28
+ <div class={kcClsx('kcLabelWrapperClass')}>
29
+ <input
30
+ type="checkbox"
31
+ id="termsAccepted"
32
+ name="termsAccepted"
33
+ class={kcClsx('kcCheckboxInputClass')}
34
+ checked={areTermsAccepted}
35
+ onchange={(e) => onAreTermsAcceptedValueChange(e.currentTarget.checked)}
36
+ aria-invalid={messagesPerField.existsError('termsAccepted')}
37
+ />
38
+ <label
39
+ for="termsAccepted"
40
+ class={kcClsx('kcLabelClass')}
41
+ >
42
+ {@render msg('acceptTerms')()}
43
+ </label>
44
+ </div>
45
+ {#if messagesPerField.existsError('termsAccepted')}
46
+ <div class={kcClsx('kcLabelWrapperClass')}>
47
+ <span
48
+ id="input-error-terms-accepted"
49
+ class={kcClsx('kcInputErrorMessageClass')}
50
+ aria-live="polite"
51
+ >
52
+ {@html kcSanitize(messagesPerField.get('termsAccepted'))}
53
+ </span>
54
+ </div>
55
+ {/if}
56
+ </div>
@@ -0,0 +1,13 @@
1
+ import type { KcClsx } from 'keycloakify/login/lib/kcClsx';
2
+ import type { KcContext } from '../KcContext';
3
+ import type { I18n } from '../i18n';
4
+ import type { Readable } from 'svelte/store';
5
+ declare const TermsAcceptance: import("svelte").Component<{
6
+ i18n: Readable<I18n>;
7
+ kcClsx: KcClsx;
8
+ messagesPerField: Pick<KcContext["messagesPerField"], "existsError" | "get">;
9
+ areTermsAccepted: boolean;
10
+ onAreTermsAcceptedValueChange: (areTermsAccepted: boolean) => void;
11
+ }, {}, "">;
12
+ type TermsAcceptance = ReturnType<typeof TermsAcceptance>;
13
+ export default TermsAcceptance;