@aws-amplify/ui-svelte 0.0.0-next-9a4f1cf-20220113211745 → 0.0.0-next-23d2233-20251017111356

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 (135) hide show
  1. package/README.md +132 -20
  2. package/dist/components/Authenticator/Authenticator.svelte +230 -0
  3. package/dist/components/Authenticator/Authenticator.svelte.d.ts +41 -0
  4. package/dist/components/Authenticator/ConfirmResetPassword.svelte +119 -0
  5. package/dist/components/Authenticator/ConfirmResetPassword.svelte.d.ts +7 -0
  6. package/dist/components/Authenticator/ConfirmSignIn.svelte +110 -0
  7. package/dist/components/Authenticator/ConfirmSignIn.svelte.d.ts +7 -0
  8. package/dist/components/Authenticator/ConfirmSignUp.svelte +127 -0
  9. package/dist/components/Authenticator/ConfirmSignUp.svelte.d.ts +7 -0
  10. package/dist/components/Authenticator/ConfirmVerifyUser.svelte +106 -0
  11. package/dist/components/Authenticator/ConfirmVerifyUser.svelte.d.ts +7 -0
  12. package/dist/components/Authenticator/ForceNewPassword.svelte +120 -0
  13. package/dist/components/Authenticator/ForceNewPassword.svelte.d.ts +7 -0
  14. package/dist/components/Authenticator/ForgotPassword.svelte +107 -0
  15. package/dist/components/Authenticator/ForgotPassword.svelte.d.ts +7 -0
  16. package/dist/components/Authenticator/SelectMfaType.svelte +145 -0
  17. package/dist/components/Authenticator/SelectMfaType.svelte.d.ts +7 -0
  18. package/dist/components/Authenticator/SetupEmail.svelte +103 -0
  19. package/dist/components/Authenticator/SetupEmail.svelte.d.ts +7 -0
  20. package/dist/components/Authenticator/SetupTotp.svelte +178 -0
  21. package/dist/components/Authenticator/SetupTotp.svelte.d.ts +7 -0
  22. package/dist/components/Authenticator/SignIn.svelte +112 -0
  23. package/dist/components/Authenticator/SignIn.svelte.d.ts +8 -0
  24. package/dist/components/Authenticator/SignUp.svelte +98 -0
  25. package/dist/components/Authenticator/SignUp.svelte.d.ts +8 -0
  26. package/dist/components/Authenticator/VerifyUser.svelte +160 -0
  27. package/dist/components/Authenticator/VerifyUser.svelte.d.ts +7 -0
  28. package/dist/components/Authenticator/index.d.ts +14 -0
  29. package/dist/components/Authenticator/index.js +14 -0
  30. package/dist/components/controls/AliasField.svelte +98 -0
  31. package/dist/components/controls/AliasField.svelte.d.ts +17 -0
  32. package/dist/components/controls/Button.svelte +51 -0
  33. package/dist/components/controls/Button.svelte.d.ts +13 -0
  34. package/dist/components/controls/CheckBox.svelte +57 -0
  35. package/dist/components/controls/CheckBox.svelte.d.ts +6 -0
  36. package/dist/components/controls/FederatedSignIn.svelte +143 -0
  37. package/dist/components/controls/FederatedSignIn.svelte.d.ts +3 -0
  38. package/dist/components/controls/ForceNewPasswordFormFields.svelte +5 -0
  39. package/dist/components/controls/ForceNewPasswordFormFields.svelte.d.ts +18 -0
  40. package/dist/components/controls/PasswordField.svelte +119 -0
  41. package/dist/components/controls/PasswordField.svelte.d.ts +14 -0
  42. package/dist/components/controls/SignUpFormFields.svelte +5 -0
  43. package/dist/components/controls/SignUpFormFields.svelte.d.ts +18 -0
  44. package/dist/components/controls/TextField.svelte +46 -0
  45. package/dist/components/controls/TextField.svelte.d.ts +15 -0
  46. package/dist/components/controls/index.d.ts +8 -0
  47. package/dist/components/controls/index.js +8 -0
  48. package/dist/components/index.d.ts +4 -0
  49. package/dist/components/index.js +4 -0
  50. package/dist/components/primitives/Alert.svelte +61 -0
  51. package/dist/components/primitives/Alert.svelte.d.ts +7 -0
  52. package/dist/components/primitives/Box.svelte +9 -0
  53. package/dist/components/primitives/Box.svelte.d.ts +4 -0
  54. package/dist/components/primitives/FederatedSignInButton.svelte +27 -0
  55. package/dist/components/primitives/FederatedSignInButton.svelte.d.ts +7 -0
  56. package/dist/components/primitives/FieldSet.svelte +9 -0
  57. package/dist/components/primitives/FieldSet.svelte.d.ts +4 -0
  58. package/dist/components/primitives/Footer.svelte +9 -0
  59. package/dist/components/primitives/Footer.svelte.d.ts +4 -0
  60. package/dist/components/primitives/Form.svelte +9 -0
  61. package/dist/components/primitives/Form.svelte.d.ts +4 -0
  62. package/dist/components/primitives/FormField.svelte +72 -0
  63. package/dist/components/primitives/FormField.svelte.d.ts +8 -0
  64. package/dist/components/primitives/FormFields.svelte +29 -0
  65. package/dist/components/primitives/FormFields.svelte.d.ts +7 -0
  66. package/dist/components/primitives/Heading.svelte +13 -0
  67. package/dist/components/primitives/Heading.svelte.d.ts +7 -0
  68. package/dist/components/primitives/Input.svelte +20 -0
  69. package/dist/components/primitives/Input.svelte.d.ts +7 -0
  70. package/dist/components/primitives/Label.svelte +9 -0
  71. package/dist/components/primitives/Label.svelte.d.ts +4 -0
  72. package/dist/components/primitives/Select.svelte +28 -0
  73. package/dist/components/primitives/Select.svelte.d.ts +9 -0
  74. package/dist/components/primitives/Spacer.svelte +7 -0
  75. package/dist/components/primitives/Spacer.svelte.d.ts +5 -0
  76. package/dist/components/primitives/Text.svelte +9 -0
  77. package/dist/components/primitives/Text.svelte.d.ts +4 -0
  78. package/dist/components/primitives/TwoTabItem.svelte +26 -0
  79. package/dist/components/primitives/TwoTabItem.svelte.d.ts +9 -0
  80. package/dist/components/primitives/TwoTabs.svelte +19 -0
  81. package/dist/components/primitives/TwoTabs.svelte.d.ts +5 -0
  82. package/dist/components/primitives/Wrapper.svelte +9 -0
  83. package/dist/components/primitives/Wrapper.svelte.d.ts +4 -0
  84. package/dist/components/primitives/index.d.ts +17 -0
  85. package/dist/components/primitives/index.js +17 -0
  86. package/dist/index.d.ts +7 -3
  87. package/dist/index.js +8 -3
  88. package/dist/stores/authenticator.svelte.d.ts +18 -0
  89. package/dist/stores/authenticator.svelte.js +88 -0
  90. package/dist/styles/authenticator.css +13 -0
  91. package/dist/styles/index.js +3 -0
  92. package/dist/styles.css +2 -2827
  93. package/dist/types/index.d.ts +21 -0
  94. package/dist/types/index.js +1 -0
  95. package/dist/version.d.ts +1 -0
  96. package/dist/version.js +1 -0
  97. package/package.json +59 -50
  98. package/LICENSE +0 -201
  99. package/dist/LICENSE +0 -201
  100. package/dist/README.md +0 -38
  101. package/dist/components/AmplifySignUpFormFields.svelte +0 -41
  102. package/dist/components/AmplifySignUpFormFields.svelte.d.ts +0 -14
  103. package/dist/components/Authenticator.svelte +0 -50
  104. package/dist/components/Authenticator.svelte.d.ts +0 -22
  105. package/dist/components/ConfirmSignUp.svelte +0 -87
  106. package/dist/components/ConfirmSignUp.svelte.d.ts +0 -14
  107. package/dist/components/FederatedSignIn.svelte.d.ts +0 -19
  108. package/dist/components/SignIn.svelte +0 -69
  109. package/dist/components/SignIn.svelte.d.ts +0 -14
  110. package/dist/components/SignUp.svelte +0 -45
  111. package/dist/components/SignUp.svelte.d.ts +0 -14
  112. package/dist/components/UserNameAlias.svelte +0 -29
  113. package/dist/components/UserNameAlias.svelte.d.ts +0 -19
  114. package/dist/components/authStore.d.ts +0 -20
  115. package/dist/components/authStore.js +0 -101
  116. package/dist/components/primitives/AmplifyButton.svelte +0 -23
  117. package/dist/components/primitives/AmplifyButton.svelte.d.ts +0 -25
  118. package/dist/components/primitives/AmplifyError.svelte +0 -46
  119. package/dist/components/primitives/AmplifyError.svelte.d.ts +0 -16
  120. package/dist/components/primitives/AmplifyFormField.svelte +0 -121
  121. package/dist/components/primitives/AmplifyFormField.svelte.d.ts +0 -25
  122. package/dist/components/primitives/AmplifyFormSelect.svelte +0 -38
  123. package/dist/components/primitives/AmplifyFormSelect.svelte.d.ts +0 -20
  124. package/dist/components/primitives/AmplifyPasswordField.svelte +0 -75
  125. package/dist/components/primitives/AmplifyPasswordField.svelte.d.ts +0 -26
  126. package/dist/components/primitives/AmplifyPhoneNumberField.svelte +0 -50
  127. package/dist/components/primitives/AmplifyPhoneNumberField.svelte.d.ts +0 -27
  128. package/dist/components/primitives/AmplifyTabItem.svelte +0 -19
  129. package/dist/components/primitives/AmplifyTabItem.svelte.d.ts +0 -21
  130. package/dist/components/primitives/AmplifyTabs.svelte +0 -72
  131. package/dist/components/primitives/AmplifyTabs.svelte.d.ts +0 -26
  132. package/dist/components/primitives/AmplifyTextField.svelte +0 -31
  133. package/dist/components/primitives/AmplifyTextField.svelte.d.ts +0 -28
  134. package/dist/package.json +0 -69
  135. /package/dist/{components/FederatedSignIn.svelte → styles/index.d.ts} +0 -0
@@ -0,0 +1,103 @@
1
+ <script lang="ts">
2
+ import {
3
+ authenticatorTextUtil,
4
+ getFormDataFromEvent,
5
+ translate,
6
+ } from '@aws-amplify/ui';
7
+ import { useAuthenticator } from '../../stores/authenticator.svelte';
8
+ import { type Components } from '../../types';
9
+
10
+ import Wrapper from '../primitives/Wrapper.svelte';
11
+ import Form from '../primitives/Form.svelte';
12
+ import Button from '../controls/Button.svelte';
13
+ import FieldSet from '../primitives/FieldSet.svelte';
14
+ import FormFields from '../primitives/FormFields.svelte';
15
+ import Heading from '../primitives/Heading.svelte';
16
+ import Footer from '../primitives/Footer.svelte';
17
+ import Alert from '../primitives/Alert.svelte';
18
+
19
+ interface Props {
20
+ components?: Components;
21
+ }
22
+
23
+ const { components }: Props = $props();
24
+
25
+ const { authenticator } = $derived(useAuthenticator());
26
+ const { getBackToSignInText, getConfirmText, getSetupEmailText } =
27
+ authenticatorTextUtil;
28
+ const setupEmailHeading = $derived.by(() => getSetupEmailText());
29
+ const backSignInText = $derived.by(() => getBackToSignInText());
30
+ const confirmText = $derived.by(() => getConfirmText());
31
+
32
+ const onInput = (e: Event) => {
33
+ const { name, value } = e.target as HTMLInputElement;
34
+ authenticator.updateForm({ name, value });
35
+ };
36
+
37
+ const onSetupEmailSubmit = (e: Event) => {
38
+ e.preventDefault();
39
+ authenticator.submitForm(getFormDataFromEvent(e));
40
+ };
41
+
42
+ const onBackToSignInClicked = (e: Event) => {
43
+ e.preventDefault();
44
+ authenticator.toSignIn();
45
+ };
46
+ </script>
47
+
48
+ <Wrapper>
49
+ <Form
50
+ data-amplify-authenticator-setupemail
51
+ oninput={onInput}
52
+ onsubmit={onSetupEmailSubmit}
53
+ >
54
+ <FieldSet
55
+ class="amplify-flex amplify-authenticator__column"
56
+ disabled={authenticator.isPending}
57
+ >
58
+ {#if components?.Header}
59
+ {@render components?.Header()}
60
+ {:else}
61
+ <Heading level="h3" class="amplify-heading">
62
+ {setupEmailHeading}
63
+ </Heading>
64
+ {/if}
65
+ <Wrapper class="amplify-flex amplify-authenticator__column">
66
+ {#if components?.FormFields}
67
+ {@render components?.FormFields()}
68
+ {:else}
69
+ <FormFields route="setupEmail" />
70
+ {/if}
71
+ </Wrapper>
72
+ <Footer class="amplify-flex amplify-authenticator__column">
73
+ {#if authenticator.error}
74
+ <Alert>
75
+ {translate(authenticator.error)}
76
+ </Alert>
77
+ {/if}
78
+ <Button
79
+ class="amplify-field-group__control amplify-authenticator__font"
80
+ fullWidth={false}
81
+ loading={false}
82
+ variation="primary"
83
+ fontWeight="normal"
84
+ disabled={authenticator.isPending}
85
+ >
86
+ {confirmText}
87
+ </Button>
88
+ <Button
89
+ class="amplify-field-group__control amplify-authenticator__font"
90
+ fullWidth={false}
91
+ size="small"
92
+ variation="link"
93
+ fontWeight="normal"
94
+ type="button"
95
+ onclick={onBackToSignInClicked}
96
+ >
97
+ {backSignInText}
98
+ </Button>
99
+ {@render components?.Footer?.()}
100
+ </Footer>
101
+ </FieldSet>
102
+ </Form>
103
+ </Wrapper>
@@ -0,0 +1,7 @@
1
+ import { type Components } from '../../types';
2
+ interface Props {
3
+ components?: Components;
4
+ }
5
+ declare const SetupEmail: import("svelte").Component<Props, {}, "">;
6
+ type SetupEmail = ReturnType<typeof SetupEmail>;
7
+ export default SetupEmail;
@@ -0,0 +1,178 @@
1
+ <script lang="ts">
2
+ import QRCode from 'qrcode';
3
+
4
+ import { ConsoleLogger as Logger } from 'aws-amplify/utils';
5
+ import {
6
+ authenticatorTextUtil,
7
+ getFormDataFromEvent,
8
+ getTotpCodeURL,
9
+ translate,
10
+ } from '@aws-amplify/ui';
11
+
12
+ import { useAuthenticator } from '../../stores/authenticator.svelte';
13
+ import { type Components } from '../../types';
14
+ import Wrapper from '../primitives/Wrapper.svelte';
15
+ import Form from '../primitives/Form.svelte';
16
+ import Button from '../controls/Button.svelte';
17
+ import FieldSet from '../primitives/FieldSet.svelte';
18
+ import FormFields from '../primitives/FormFields.svelte';
19
+ import Heading from '../primitives/Heading.svelte';
20
+ import Footer from '../primitives/Footer.svelte';
21
+ import Alert from '../primitives/Alert.svelte';
22
+ import { onMount } from 'svelte';
23
+
24
+ interface Props {
25
+ components?: Components;
26
+ }
27
+
28
+ const { components }: Props = $props();
29
+
30
+ const logger = new Logger('SetupTotp-logger');
31
+
32
+ const { authenticator } = $derived(useAuthenticator());
33
+ const { totpIssuer = 'AWSCognito', totpUsername } = $derived(
34
+ authenticator.QRFields ?? {}
35
+ );
36
+ const totpCodeURL = $derived.by(() =>
37
+ getTotpCodeURL(
38
+ totpIssuer,
39
+ totpUsername || authenticator.username,
40
+ authenticator.totpSecretCode!
41
+ )
42
+ );
43
+
44
+ const qrCode = $state({
45
+ qrCodeImageSource: '',
46
+ isLoading: true,
47
+ });
48
+
49
+ // Text Util
50
+ const { getCopyText, getCopiedText, getBackToSignInText, getConfirmText } =
51
+ authenticatorTextUtil;
52
+
53
+ let copyTextLabel = $state(getCopyText());
54
+
55
+ function copyText() {
56
+ if (authenticator.totpSecretCode) {
57
+ navigator.clipboard.writeText(authenticator.totpSecretCode);
58
+ }
59
+ copyTextLabel = getCopiedText();
60
+ }
61
+
62
+ // lifecycle hooks
63
+ onMount(async () => {
64
+ try {
65
+ qrCode.qrCodeImageSource = await QRCode.toDataURL(totpCodeURL);
66
+ } catch (error) {
67
+ logger.error(error);
68
+ } finally {
69
+ qrCode.isLoading = false;
70
+ }
71
+ });
72
+
73
+ // Computed Properties
74
+ const backSignInText = $derived.by(() => getBackToSignInText());
75
+ const confirmText = $derived.by(() => getConfirmText());
76
+
77
+ // Methods
78
+ const onInput = (e: Event): void => {
79
+ const { name, value } = e.target as HTMLInputElement;
80
+ authenticator.updateForm({ name, value });
81
+ };
82
+
83
+ const onSetupTotpSubmit = (e: Event): void => {
84
+ e.preventDefault();
85
+ authenticator.submitForm(getFormDataFromEvent(e));
86
+ };
87
+
88
+ const onBackToSignInClicked = (e: Event): void => {
89
+ e.preventDefault();
90
+ authenticator.toSignIn();
91
+ };
92
+ </script>
93
+
94
+ <Wrapper>
95
+ <Form
96
+ data-amplify-authenticator-setup-totp
97
+ oninput={onInput}
98
+ onsubmit={onSetupTotpSubmit}
99
+ >
100
+ <FieldSet
101
+ class="amplify-flex amplify-authenticator__column"
102
+ disabled={authenticator.isPending}
103
+ >
104
+ <Wrapper class="amplify-flex amplify-authenticator__column">
105
+ {#if components?.Header}
106
+ {@render components?.Header()}
107
+ {:else}
108
+ <Heading class="amplify-heading" level="h3">Setup TOTP</Heading>
109
+ {/if}
110
+
111
+ <Wrapper class="amplify-flex amplify-authenticator__column">
112
+ {#if qrCode.isLoading}
113
+ <p>Loading...</p>
114
+ {:else}
115
+ <img
116
+ class="amplify-image"
117
+ data-amplify-qrcode
118
+ src={qrCode.qrCodeImageSource}
119
+ alt="qr code"
120
+ width="228"
121
+ height="228"
122
+ />
123
+ {/if}
124
+ <Wrapper class="amplify-flex" data-amplify-copy>
125
+ <div>{authenticator.totpSecretCode}</div>
126
+ <Wrapper data-amplify-copy-svg onclick={copyText}>
127
+ <div data-amplify-copy-tooltip>{copyTextLabel}</div>
128
+ <svg
129
+ width="24"
130
+ height="24"
131
+ viewBox="0 0 24 24"
132
+ xmlns="http://www.w3.org/2000/svg"
133
+ >
134
+ <path
135
+ d="M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM15 5H8C6.9 5 6.01 5.9 6.01 7L6 21C6 22.1 6.89 23 7.99 23H19C20.1 23 21 22.1 21 21V11L15 5ZM8 21V7H14V12H19V21H8Z"
136
+ />
137
+ </svg>
138
+ </Wrapper>
139
+ </Wrapper>
140
+
141
+ {#if components?.FormFields}
142
+ {@render components?.FormFields()}
143
+ {:else}
144
+ <FormFields route="setupTotp" />
145
+ {/if}
146
+ </Wrapper>
147
+ <Footer class="amplify-flex amplify-authenticator__column">
148
+ {#if authenticator.error}
149
+ <Alert>
150
+ {translate(authenticator.error)}
151
+ </Alert>
152
+ {/if}
153
+ <Button
154
+ class="amplify-field-group__control amplify-authenticator__font"
155
+ fullWidth={false}
156
+ loading={false}
157
+ variation="primary"
158
+ type="submit"
159
+ disabled={authenticator.isPending}
160
+ >
161
+ {confirmText}
162
+ </Button>
163
+ <Button
164
+ class="amplify-field-group__control amplify-authenticator__font"
165
+ fullWidth={false}
166
+ size="small"
167
+ variation="link"
168
+ type="button"
169
+ onclick={onBackToSignInClicked}
170
+ >
171
+ {backSignInText}
172
+ </Button>
173
+ {@render components?.Footer?.()}
174
+ </Footer>
175
+ </Wrapper>
176
+ </FieldSet>
177
+ </Form>
178
+ </Wrapper>
@@ -0,0 +1,7 @@
1
+ import { type Components } from '../../types';
2
+ interface Props {
3
+ components?: Components;
4
+ }
5
+ declare const SetupTotp: import("svelte").Component<Props, {}, "">;
6
+ type SetupTotp = ReturnType<typeof SetupTotp>;
7
+ export default SetupTotp;
@@ -0,0 +1,112 @@
1
+ <script lang="ts">
2
+ import {
3
+ authenticatorTextUtil,
4
+ getFormDataFromEvent,
5
+ translate,
6
+ } from '@aws-amplify/ui';
7
+
8
+ import { useAuthenticator } from '../../stores/authenticator.svelte';
9
+ import { type Components } from '../../types';
10
+
11
+ import FormFields from '../primitives/FormFields.svelte';
12
+ import FieldSet from '../primitives/FieldSet.svelte';
13
+ import Form from '../primitives/Form.svelte';
14
+ import Alert from '../primitives/Alert.svelte';
15
+ import Footer from '../primitives/Footer.svelte';
16
+ import Wrapper from '../primitives/Wrapper.svelte';
17
+ import Button from '../controls/Button.svelte';
18
+ import FederatedSignIn from '../controls/FederatedSignIn.svelte';
19
+ import { type HTMLAttributes } from 'svelte/elements';
20
+
21
+ interface Props extends HTMLAttributes<HTMLDivElement> {
22
+ components?: Components;
23
+ }
24
+
25
+ const { components, ...rest }: Props = $props();
26
+
27
+ const { authenticator } = $derived(useAuthenticator());
28
+
29
+ // Text Util
30
+ const { getForgotPasswordText, getSignInText, getSigningInText } =
31
+ authenticatorTextUtil;
32
+
33
+ // Computed Properties
34
+ const forgotYourPasswordLink = $derived.by(() => getForgotPasswordText());
35
+ const signInButtonText = $derived.by(() => getSignInText());
36
+ const signingInButtonText = $derived.by(() => getSigningInText());
37
+
38
+ // Methods
39
+ const onInput = (e: Event): void => {
40
+ const { name, value } = e.target as HTMLInputElement;
41
+ authenticator.updateForm({ name, value });
42
+ };
43
+
44
+ const onSignInSubmit = (e: Event): void => {
45
+ e.preventDefault();
46
+ authenticator.submitForm(getFormDataFromEvent(e));
47
+ };
48
+
49
+ const onForgotPasswordClicked = (): void => {
50
+ authenticator.toForgotPassword();
51
+ };
52
+ </script>
53
+
54
+ <div {...rest}>
55
+ {@render components?.Header?.()}
56
+ <Wrapper>
57
+ <Form
58
+ data-amplify-authenticator-signin
59
+ oninput={onInput}
60
+ onsubmit={onSignInSubmit}
61
+ method="post"
62
+ >
63
+ <FederatedSignIn />
64
+ <Wrapper class="amplify-flex amplify-authenticator__column">
65
+ <FieldSet
66
+ disabled={authenticator.isPending}
67
+ class="amplify-flex amplify-authenticator__column"
68
+ >
69
+ <legend class="amplify-visually-hidden">Sign in</legend>
70
+ {#if components?.FormFields}
71
+ {@render components?.FormFields()}
72
+ {:else}
73
+ <FormFields route="signIn" />
74
+ {/if}
75
+ </FieldSet>
76
+ {#if authenticator.error}
77
+ <Alert>{translate(authenticator.error)}</Alert>
78
+ {/if}
79
+
80
+ <Button
81
+ disabled={authenticator.isPending}
82
+ class="amplify-field-group__control amplify-authenticator__font"
83
+ fullWidth={true}
84
+ loading={false}
85
+ variation="primary"
86
+ >
87
+ {authenticator.isPending ? signingInButtonText : signInButtonText}
88
+ </Button>
89
+ </Wrapper>
90
+ </Form>
91
+ </Wrapper>
92
+
93
+ <Footer>
94
+ {#if components?.Footer}
95
+ {@render components?.Footer()}
96
+ {:else}
97
+ <div data-amplify-footer>
98
+ <Button
99
+ onclick={onForgotPasswordClicked}
100
+ class="amplify-field-group__control amplify-authenticator__font"
101
+ variation="link"
102
+ fullWidth={true}
103
+ size="small"
104
+ fontWeight="normal"
105
+ type="button"
106
+ >
107
+ {forgotYourPasswordLink}
108
+ </Button>
109
+ </div>
110
+ {/if}
111
+ </Footer>
112
+ </div>
@@ -0,0 +1,8 @@
1
+ import { type Components } from '../../types';
2
+ import { type HTMLAttributes } from 'svelte/elements';
3
+ interface Props extends HTMLAttributes<HTMLDivElement> {
4
+ components?: Components;
5
+ }
6
+ declare const SignIn: import("svelte").Component<Props, {}, "">;
7
+ type SignIn = ReturnType<typeof SignIn>;
8
+ export default SignIn;
@@ -0,0 +1,98 @@
1
+ <script lang="ts">
2
+ import {
3
+ authenticatorTextUtil,
4
+ getFormDataFromEvent,
5
+ translate,
6
+ } from '@aws-amplify/ui';
7
+
8
+ import { useAuthenticator } from '../../stores/authenticator.svelte';
9
+ import { type Components } from '../../types';
10
+
11
+ import FederatedSignIn from '../controls/FederatedSignIn.svelte';
12
+ import FormFields from '../primitives/FormFields.svelte';
13
+ import FieldSet from '../primitives/FieldSet.svelte';
14
+ import Form from '../primitives/Form.svelte';
15
+ import Alert from '../primitives/Alert.svelte';
16
+ import Button from '../controls/Button.svelte';
17
+ import Wrapper from '../primitives/Wrapper.svelte';
18
+ import Footer from '../primitives/Footer.svelte';
19
+ import { type HTMLAttributes } from 'svelte/elements';
20
+
21
+ interface Props extends HTMLAttributes<HTMLDivElement> {
22
+ components?: Components;
23
+ }
24
+
25
+ const { components, ...rest }: Props = $props();
26
+
27
+ const { authenticator } = $derived(useAuthenticator());
28
+
29
+ // Text Util
30
+ const { getCreateAccountText } = authenticatorTextUtil;
31
+
32
+ // Computed Properties
33
+ const createAccountLabel = $derived.by(() => getCreateAccountText());
34
+
35
+ // Methods
36
+ const onInput = (e: Event): void => {
37
+ const { checked, name, type, value } = e.target as HTMLInputElement;
38
+
39
+ const isUncheckedCheckbox = type === 'checkbox' && !checked;
40
+ authenticator.updateForm({
41
+ name,
42
+ value: isUncheckedCheckbox ? undefined : (value as string),
43
+ });
44
+ };
45
+
46
+ function onBlur(e: Event) {
47
+ const { name } = e.target as HTMLInputElement;
48
+ authenticator.updateBlur({ name });
49
+ }
50
+
51
+ const onSignUpSubmit = (e: Event): void => {
52
+ e.preventDefault();
53
+ authenticator.submitForm(getFormDataFromEvent(e));
54
+ };
55
+ </script>
56
+
57
+ <div {...rest}>
58
+ {@render components?.Header?.()}
59
+
60
+ <Wrapper>
61
+ <Form oninput={onInput} onblurcapture={onBlur} onsubmit={onSignUpSubmit}>
62
+ <FederatedSignIn />
63
+
64
+ <Wrapper class="amplify-flex amplify-authenticator__column">
65
+ <FieldSet
66
+ class="amplify-flex amplify-authenticator__column"
67
+ disabled={authenticator.isPending}
68
+ >
69
+ {#if components?.FormFields}
70
+ {@render components?.FormFields()}
71
+ {:else}
72
+ <FormFields route="signUp" />
73
+ {/if}
74
+ </FieldSet>
75
+ {#if authenticator.error}
76
+ <Alert>
77
+ {translate(authenticator.error)}
78
+ </Alert>
79
+ {/if}
80
+ <Button
81
+ class="amplify-field-group__control amplify-authenticator__font"
82
+ fullWidth={true}
83
+ loading={false}
84
+ variation="primary"
85
+ style="border-radius: 0px; font-weight: normal"
86
+ disabled={authenticator.isPending ||
87
+ authenticator.hasValidationErrors}
88
+ >
89
+ {createAccountLabel}
90
+ </Button>
91
+ </Wrapper>
92
+ </Form>
93
+ </Wrapper>
94
+
95
+ <Footer>
96
+ {@render components?.Footer?.()}
97
+ </Footer>
98
+ </div>
@@ -0,0 +1,8 @@
1
+ import { type Components } from '../../types';
2
+ import { type HTMLAttributes } from 'svelte/elements';
3
+ interface Props extends HTMLAttributes<HTMLDivElement> {
4
+ components?: Components;
5
+ }
6
+ declare const SignUp: import("svelte").Component<Props, {}, "">;
7
+ type SignUp = ReturnType<typeof SignUp>;
8
+ export default SignUp;
@@ -0,0 +1,160 @@
1
+ <script lang="ts">
2
+ import {
3
+ authenticatorTextUtil,
4
+ censorContactMethod,
5
+ type ContactMethod,
6
+ defaultFormFieldOptions,
7
+ getFormDataFromEvent,
8
+ translate,
9
+ } from '@aws-amplify/ui';
10
+
11
+ import { useAuthenticator } from '../../stores/authenticator.svelte';
12
+ import { type Components } from '../../types';
13
+
14
+ import Wrapper from '../primitives/Wrapper.svelte';
15
+ import Form from '../primitives/Form.svelte';
16
+ import Button from '../controls/Button.svelte';
17
+ import FieldSet from '../primitives/FieldSet.svelte';
18
+ import Heading from '../primitives/Heading.svelte';
19
+ import Footer from '../primitives/Footer.svelte';
20
+ import Alert from '../primitives/Alert.svelte';
21
+ import Text from '../primitives/Text.svelte';
22
+ import Label from '../primitives/Label.svelte';
23
+ import Input from '../primitives/Input.svelte';
24
+
25
+ interface Props {
26
+ components?: Omit<Components, 'FormFields'>;
27
+ }
28
+
29
+ const { components }: Props = $props();
30
+
31
+ const { authenticator } = $derived(useAuthenticator());
32
+
33
+ // Text Util
34
+ const {
35
+ getAccountRecoveryInfoText,
36
+ getSkipText,
37
+ getVerifyText,
38
+ getVerifyContactText,
39
+ } = authenticatorTextUtil;
40
+
41
+ // Computed Properties
42
+ const verifyHeading = $derived.by(() => getAccountRecoveryInfoText());
43
+ const skipText = $derived.by(() => getSkipText());
44
+ const verifyText = $derived.by(() => getVerifyText());
45
+ const verifyContactText = $derived.by(() => getVerifyContactText());
46
+
47
+ // Methods
48
+ const onInput = (e: Event): void => {
49
+ const { name, value } = e.target as HTMLInputElement;
50
+ authenticator.updateForm({ name, value });
51
+ };
52
+
53
+ const onVerifyUserSubmit = (e: Event): void => {
54
+ e.preventDefault();
55
+ submit(e);
56
+ };
57
+
58
+ const submit = (e: Event): void => {
59
+ authenticator.submitForm(getFormDataFromEvent(e));
60
+ };
61
+
62
+ const onSkipClicked = (e: Event): void => {
63
+ e.preventDefault();
64
+ authenticator.skipVerification();
65
+ };
66
+
67
+ const getDefaultFormFieldOption = (key: string) => {
68
+ const k = key as keyof typeof defaultFormFieldOptions;
69
+ return defaultFormFieldOptions[k] as { label: ContactMethod };
70
+ };
71
+ </script>
72
+
73
+ <Wrapper>
74
+ <Form oninput={onInput} onsubmit={onVerifyUserSubmit}>
75
+ <FieldSet
76
+ disabled={authenticator.isPending}
77
+ class="amplify-flex amplify-authenticator__column"
78
+ >
79
+ {#if components?.Header}
80
+ {@render components?.Header()}
81
+ {:else}
82
+ <Heading class="amplify-heading" level="h3">
83
+ {verifyHeading}
84
+ </Heading>
85
+ {/if}
86
+ <Wrapper
87
+ class="amplify-flex amplify-field amplify-radiogroupfield amplify-authenticator__column"
88
+ >
89
+ <!-- TODO(BREAKING): remove hard coded string 493c -->
90
+ <Label
91
+ class="amplify-visually-hidden amplify-label"
92
+ id="amplify-field-493c"
93
+ >
94
+ {verifyContactText}
95
+ </Label>
96
+ <Wrapper
97
+ class="amplify-flex amplify-field amplify-radiogroupfield amplify-authenticator__column"
98
+ aria-labelledby="amplify-field-493c"
99
+ >
100
+ {#each Object.entries(authenticator.unverifiedUserAttributes) as [key, value], index (value)}
101
+ {#if value}
102
+ {@const verificationType = getDefaultFormFieldOption(key).label}
103
+ <Label
104
+ class="amplify-flex amplify-radio"
105
+ data-amplify-verify-label
106
+ >
107
+ <Text class="amplify-text amplify-radio__label">
108
+ {translate(verificationType)}: {censorContactMethod(
109
+ verificationType,
110
+ value
111
+ )}
112
+ </Text>
113
+ <Input
114
+ class="amplify-input amplify-field-group__control amplify-visually-hidden amplify-radio__input"
115
+ aria-invalid="false"
116
+ data-amplify-verify-input
117
+ name="unverifiedAttr"
118
+ type="radio"
119
+ checked={index === 0}
120
+ value={key}
121
+ ></Input>
122
+ <Text
123
+ class="amplify-flex amplify-radio__button"
124
+ aria-hidden="true"
125
+ />
126
+ </Label>
127
+ {/if}
128
+ {/each}
129
+ </Wrapper>
130
+ </Wrapper>
131
+ <Footer class="amplify-flex amplify-authenticator__column">
132
+ {#if authenticator.error}
133
+ <Alert>
134
+ {translate(authenticator.error)}
135
+ </Alert>
136
+ {/if}
137
+ <Button
138
+ class="amplify-field-group__control amplify-authenticator__font"
139
+ fullWidth={false}
140
+ variation="primary"
141
+ type="submit"
142
+ disabled={authenticator.isPending}
143
+ >
144
+ {verifyText}
145
+ </Button>
146
+ <Button
147
+ class="amplify-field-group__control amplify-authenticator__font"
148
+ fullWidth={false}
149
+ size="small"
150
+ variation="link"
151
+ type="button"
152
+ onclick={onSkipClicked}
153
+ >
154
+ {skipText}
155
+ </Button>
156
+ {@render components?.Footer?.()}
157
+ </Footer>
158
+ </FieldSet>
159
+ </Form>
160
+ </Wrapper>
@@ -0,0 +1,7 @@
1
+ import { type Components } from '../../types';
2
+ interface Props {
3
+ components?: Omit<Components, 'FormFields'>;
4
+ }
5
+ declare const VerifyUser: import("svelte").Component<Props, {}, "">;
6
+ type VerifyUser = ReturnType<typeof VerifyUser>;
7
+ export default VerifyUser;