@aws-amplify/ui-svelte 0.0.0-next-b4d0af6-20220107001542 → 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.
- package/README.md +132 -20
- package/dist/components/Authenticator/Authenticator.svelte +230 -0
- package/dist/components/Authenticator/Authenticator.svelte.d.ts +41 -0
- package/dist/components/Authenticator/ConfirmResetPassword.svelte +119 -0
- package/dist/components/Authenticator/ConfirmResetPassword.svelte.d.ts +7 -0
- package/dist/components/Authenticator/ConfirmSignIn.svelte +110 -0
- package/dist/components/Authenticator/ConfirmSignIn.svelte.d.ts +7 -0
- package/dist/components/Authenticator/ConfirmSignUp.svelte +127 -0
- package/dist/components/Authenticator/ConfirmSignUp.svelte.d.ts +7 -0
- package/dist/components/Authenticator/ConfirmVerifyUser.svelte +106 -0
- package/dist/components/Authenticator/ConfirmVerifyUser.svelte.d.ts +7 -0
- package/dist/components/Authenticator/ForceNewPassword.svelte +120 -0
- package/dist/components/Authenticator/ForceNewPassword.svelte.d.ts +7 -0
- package/dist/components/Authenticator/ForgotPassword.svelte +107 -0
- package/dist/components/Authenticator/ForgotPassword.svelte.d.ts +7 -0
- package/dist/components/Authenticator/SelectMfaType.svelte +145 -0
- package/dist/components/Authenticator/SelectMfaType.svelte.d.ts +7 -0
- package/dist/components/Authenticator/SetupEmail.svelte +103 -0
- package/dist/components/Authenticator/SetupEmail.svelte.d.ts +7 -0
- package/dist/components/Authenticator/SetupTotp.svelte +178 -0
- package/dist/components/Authenticator/SetupTotp.svelte.d.ts +7 -0
- package/dist/components/Authenticator/SignIn.svelte +112 -0
- package/dist/components/Authenticator/SignIn.svelte.d.ts +8 -0
- package/dist/components/Authenticator/SignUp.svelte +98 -0
- package/dist/components/Authenticator/SignUp.svelte.d.ts +8 -0
- package/dist/components/Authenticator/VerifyUser.svelte +160 -0
- package/dist/components/Authenticator/VerifyUser.svelte.d.ts +7 -0
- package/dist/components/Authenticator/index.d.ts +14 -0
- package/dist/components/Authenticator/index.js +14 -0
- package/dist/components/controls/AliasField.svelte +98 -0
- package/dist/components/controls/AliasField.svelte.d.ts +17 -0
- package/dist/components/controls/Button.svelte +51 -0
- package/dist/components/controls/Button.svelte.d.ts +13 -0
- package/dist/components/controls/CheckBox.svelte +57 -0
- package/dist/components/controls/CheckBox.svelte.d.ts +6 -0
- package/dist/components/controls/FederatedSignIn.svelte +143 -0
- package/dist/components/controls/FederatedSignIn.svelte.d.ts +3 -0
- package/dist/components/controls/ForceNewPasswordFormFields.svelte +5 -0
- package/dist/components/controls/ForceNewPasswordFormFields.svelte.d.ts +18 -0
- package/dist/components/controls/PasswordField.svelte +119 -0
- package/dist/components/controls/PasswordField.svelte.d.ts +14 -0
- package/dist/components/controls/SignUpFormFields.svelte +5 -0
- package/dist/components/controls/SignUpFormFields.svelte.d.ts +18 -0
- package/dist/components/controls/TextField.svelte +46 -0
- package/dist/components/controls/TextField.svelte.d.ts +15 -0
- package/dist/components/controls/index.d.ts +8 -0
- package/dist/components/controls/index.js +8 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +4 -0
- package/dist/components/primitives/Alert.svelte +61 -0
- package/dist/components/primitives/Alert.svelte.d.ts +7 -0
- package/dist/components/primitives/Box.svelte +9 -0
- package/dist/components/primitives/Box.svelte.d.ts +4 -0
- package/dist/components/primitives/FederatedSignInButton.svelte +27 -0
- package/dist/components/primitives/FederatedSignInButton.svelte.d.ts +7 -0
- package/dist/components/primitives/FieldSet.svelte +9 -0
- package/dist/components/primitives/FieldSet.svelte.d.ts +4 -0
- package/dist/components/primitives/Footer.svelte +9 -0
- package/dist/components/primitives/Footer.svelte.d.ts +4 -0
- package/dist/components/primitives/Form.svelte +9 -0
- package/dist/components/primitives/Form.svelte.d.ts +4 -0
- package/dist/components/primitives/FormField.svelte +72 -0
- package/dist/components/primitives/FormField.svelte.d.ts +8 -0
- package/dist/components/primitives/FormFields.svelte +29 -0
- package/dist/components/primitives/FormFields.svelte.d.ts +7 -0
- package/dist/components/primitives/Heading.svelte +13 -0
- package/dist/components/primitives/Heading.svelte.d.ts +7 -0
- package/dist/components/primitives/Input.svelte +20 -0
- package/dist/components/primitives/Input.svelte.d.ts +7 -0
- package/dist/components/primitives/Label.svelte +9 -0
- package/dist/components/primitives/Label.svelte.d.ts +4 -0
- package/dist/components/primitives/Select.svelte +28 -0
- package/dist/components/primitives/Select.svelte.d.ts +9 -0
- package/dist/components/primitives/Spacer.svelte +7 -0
- package/dist/components/primitives/Spacer.svelte.d.ts +5 -0
- package/dist/components/primitives/Text.svelte +9 -0
- package/dist/components/primitives/Text.svelte.d.ts +4 -0
- package/dist/components/primitives/TwoTabItem.svelte +26 -0
- package/dist/components/primitives/TwoTabItem.svelte.d.ts +9 -0
- package/dist/components/primitives/TwoTabs.svelte +19 -0
- package/dist/components/primitives/TwoTabs.svelte.d.ts +5 -0
- package/dist/components/primitives/Wrapper.svelte +9 -0
- package/dist/components/primitives/Wrapper.svelte.d.ts +4 -0
- package/dist/components/primitives/index.d.ts +17 -0
- package/dist/components/primitives/index.js +17 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.js +8 -3
- package/dist/stores/authenticator.svelte.d.ts +18 -0
- package/dist/stores/authenticator.svelte.js +88 -0
- package/dist/styles/authenticator.css +13 -0
- package/dist/styles/index.js +3 -0
- package/dist/styles.css +2 -2827
- package/dist/types/index.d.ts +21 -0
- package/dist/types/index.js +1 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +1 -0
- package/package.json +59 -50
- package/LICENSE +0 -201
- package/dist/LICENSE +0 -201
- package/dist/README.md +0 -38
- package/dist/components/Authenticator.svelte +0 -43
- package/dist/components/Authenticator.svelte.d.ts +0 -22
- package/dist/components/SignIn.svelte +0 -69
- package/dist/components/SignIn.svelte.d.ts +0 -14
- package/dist/components/UserNameAlias.svelte +0 -29
- package/dist/components/UserNameAlias.svelte.d.ts +0 -19
- package/dist/components/authStore.d.ts +0 -20
- package/dist/components/authStore.js +0 -101
- package/dist/components/primitives/AmplifyButton.svelte +0 -23
- package/dist/components/primitives/AmplifyButton.svelte.d.ts +0 -25
- package/dist/components/primitives/AmplifyError.svelte +0 -46
- package/dist/components/primitives/AmplifyError.svelte.d.ts +0 -16
- package/dist/components/primitives/AmplifyFormField.svelte +0 -121
- package/dist/components/primitives/AmplifyFormField.svelte.d.ts +0 -25
- package/dist/components/primitives/AmplifyFormSelect.svelte +0 -38
- package/dist/components/primitives/AmplifyFormSelect.svelte.d.ts +0 -20
- package/dist/components/primitives/AmplifyPasswordField.svelte +0 -75
- package/dist/components/primitives/AmplifyPasswordField.svelte.d.ts +0 -26
- package/dist/components/primitives/AmplifyPhoneNumberField.svelte +0 -50
- package/dist/components/primitives/AmplifyPhoneNumberField.svelte.d.ts +0 -27
- package/dist/components/primitives/AmplifyTabItem.svelte.d.ts +0 -19
- package/dist/components/primitives/AmplifyTabs.svelte +0 -50
- package/dist/components/primitives/AmplifyTabs.svelte.d.ts +0 -14
- package/dist/components/primitives/AmplifyTextField.svelte +0 -31
- package/dist/components/primitives/AmplifyTextField.svelte.d.ts +0 -28
- package/dist/package.json +0 -65
- /package/dist/{components/primitives/AmplifyTabItem.svelte → styles/index.d.ts} +0 -0
|
@@ -0,0 +1,127 @@
|
|
|
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 Wrapper from '../primitives/Wrapper.svelte';
|
|
12
|
+
import Form from '../primitives/Form.svelte';
|
|
13
|
+
import Heading from '../primitives/Heading.svelte';
|
|
14
|
+
import Text from '../primitives/Text.svelte';
|
|
15
|
+
import FieldSet from '../primitives/FieldSet.svelte';
|
|
16
|
+
import FormFields from '../primitives/FormFields.svelte';
|
|
17
|
+
import Footer from '../primitives/Footer.svelte';
|
|
18
|
+
import Alert from '../primitives/Alert.svelte';
|
|
19
|
+
import Button from '../controls/Button.svelte';
|
|
20
|
+
|
|
21
|
+
interface Props {
|
|
22
|
+
components?: Components;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const { components }: Props = $props();
|
|
26
|
+
|
|
27
|
+
const { authenticator } = $derived(useAuthenticator());
|
|
28
|
+
|
|
29
|
+
// Text Util
|
|
30
|
+
const {
|
|
31
|
+
getDeliveryMethodText,
|
|
32
|
+
getDeliveryMessageText,
|
|
33
|
+
getResendCodeText,
|
|
34
|
+
getConfirmText,
|
|
35
|
+
} = authenticatorTextUtil;
|
|
36
|
+
|
|
37
|
+
// Only two types of delivery methods is EMAIL or SMS
|
|
38
|
+
const confirmSignUpHeading = $derived.by(() =>
|
|
39
|
+
getDeliveryMethodText(authenticator.codeDeliveryDetails)
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
// Computed Properties
|
|
43
|
+
const resendCodeText = $derived.by(() => getResendCodeText());
|
|
44
|
+
const confirmText = $derived.by(() => getConfirmText());
|
|
45
|
+
const subtitleText = $derived.by(() =>
|
|
46
|
+
getDeliveryMessageText(authenticator.codeDeliveryDetails)
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
// Methods
|
|
50
|
+
const onInput = (e: Event): void => {
|
|
51
|
+
const { name, value } = e.target as HTMLInputElement;
|
|
52
|
+
authenticator.updateForm({ name, value });
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const onConfirmSignUpSubmit = (e: Event): void => {
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
submit(e);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const submit = (e: Event): void => {
|
|
61
|
+
authenticator.submitForm(getFormDataFromEvent(e));
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const onLostCodeClicked = (e: Event): void => {
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
authenticator.resendCode();
|
|
67
|
+
};
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
<Wrapper>
|
|
71
|
+
<Form oninput={onInput} onsubmit={onConfirmSignUpSubmit}>
|
|
72
|
+
<Wrapper class="amplify-flex amplify-authenticator__column">
|
|
73
|
+
{#if components?.Header}
|
|
74
|
+
{@render components?.Header()}
|
|
75
|
+
{:else}
|
|
76
|
+
<Heading
|
|
77
|
+
class="amplify-heading amplify-authenticator__heading"
|
|
78
|
+
level="h3"
|
|
79
|
+
>
|
|
80
|
+
{confirmSignUpHeading}
|
|
81
|
+
</Heading>
|
|
82
|
+
{/if}
|
|
83
|
+
<Text class="amplify-authenticator__subtitle">
|
|
84
|
+
{subtitleText}
|
|
85
|
+
</Text>
|
|
86
|
+
<FieldSet
|
|
87
|
+
class="amplify-flex amplify-authenticator__column"
|
|
88
|
+
disabled={authenticator.isPending}
|
|
89
|
+
>
|
|
90
|
+
{#if components?.FormFields}
|
|
91
|
+
{@render components?.FormFields()}
|
|
92
|
+
{:else}
|
|
93
|
+
<FormFields route="confirmSignUp" />
|
|
94
|
+
{/if}
|
|
95
|
+
</FieldSet>
|
|
96
|
+
|
|
97
|
+
<Footer class="amplify-flex amplify-authenticator__column">
|
|
98
|
+
{#if authenticator.error}
|
|
99
|
+
<Alert>
|
|
100
|
+
{translate(authenticator.error)}
|
|
101
|
+
</Alert>
|
|
102
|
+
{/if}
|
|
103
|
+
<Button
|
|
104
|
+
class="amplify-field-group__control amplify-authenticator__font"
|
|
105
|
+
fullWidth={false}
|
|
106
|
+
loading={false}
|
|
107
|
+
variation="primary"
|
|
108
|
+
type="submit"
|
|
109
|
+
disabled={authenticator.isPending}
|
|
110
|
+
>
|
|
111
|
+
{confirmText}
|
|
112
|
+
</Button>
|
|
113
|
+
<Button
|
|
114
|
+
class="amplify-field-group__control amplify-authenticator__font"
|
|
115
|
+
fullWidth={false}
|
|
116
|
+
variation="default"
|
|
117
|
+
style="font-weight: normal"
|
|
118
|
+
type="button"
|
|
119
|
+
onclick={onLostCodeClicked}
|
|
120
|
+
>
|
|
121
|
+
{resendCodeText}
|
|
122
|
+
</Button>
|
|
123
|
+
{@render components?.Footer?.()}
|
|
124
|
+
</Footer>
|
|
125
|
+
</Wrapper>
|
|
126
|
+
</Form>
|
|
127
|
+
</Wrapper>
|
|
@@ -0,0 +1,106 @@
|
|
|
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 Wrapper from '../primitives/Wrapper.svelte';
|
|
12
|
+
import Form from '../primitives/Form.svelte';
|
|
13
|
+
import Button from '../controls/Button.svelte';
|
|
14
|
+
import FieldSet from '../primitives/FieldSet.svelte';
|
|
15
|
+
import FormFields from '../primitives/FormFields.svelte';
|
|
16
|
+
import Heading from '../primitives/Heading.svelte';
|
|
17
|
+
import Footer from '../primitives/Footer.svelte';
|
|
18
|
+
import Alert from '../primitives/Alert.svelte';
|
|
19
|
+
|
|
20
|
+
interface Props {
|
|
21
|
+
components?: Components;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const { components }: Props = $props();
|
|
25
|
+
|
|
26
|
+
const { authenticator } = $derived(useAuthenticator());
|
|
27
|
+
|
|
28
|
+
// Text Util
|
|
29
|
+
const { getAccountRecoveryInfoText, getSkipText, getSubmitText } =
|
|
30
|
+
authenticatorTextUtil;
|
|
31
|
+
|
|
32
|
+
// Computed Properties
|
|
33
|
+
const verifyHeading = $derived.by(() => getAccountRecoveryInfoText());
|
|
34
|
+
const skipText = $derived.by(() => getSkipText());
|
|
35
|
+
const submitText = $derived.by(() => getSubmitText());
|
|
36
|
+
|
|
37
|
+
// Methods
|
|
38
|
+
const onInput = (e: Event): void => {
|
|
39
|
+
const { name, value } = e.target as HTMLInputElement;
|
|
40
|
+
authenticator.updateForm({ name, value });
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const onConfirmVerifyUserSubmit = (e: Event): void => {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
submit(e);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const submit = (e: Event): void => {
|
|
49
|
+
authenticator.submitForm(getFormDataFromEvent(e));
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const onSkipClicked = (e: Event): void => {
|
|
53
|
+
e.preventDefault();
|
|
54
|
+
authenticator.skipVerification();
|
|
55
|
+
};
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<Wrapper>
|
|
59
|
+
<Form oninput={onInput} onsubmit={onConfirmVerifyUserSubmit}>
|
|
60
|
+
<FieldSet
|
|
61
|
+
class="amplify-flex amplify-authenticator__column"
|
|
62
|
+
disabled={authenticator.isPending}
|
|
63
|
+
>
|
|
64
|
+
{#if components?.Header}
|
|
65
|
+
{@render components?.Header()}
|
|
66
|
+
{:else}
|
|
67
|
+
<Heading level="h3" class="amplify-heading">
|
|
68
|
+
{verifyHeading}
|
|
69
|
+
</Heading>
|
|
70
|
+
{/if}
|
|
71
|
+
<Wrapper class="amplify-flex amplify-authenticator__column">
|
|
72
|
+
{#if components?.FormFields}
|
|
73
|
+
{@render components?.FormFields()}
|
|
74
|
+
{:else}
|
|
75
|
+
<FormFields route="confirmVerifyUser" />
|
|
76
|
+
{/if}
|
|
77
|
+
</Wrapper>
|
|
78
|
+
|
|
79
|
+
<Footer class="amplify-flex amplify-authenticator__column">
|
|
80
|
+
{#if authenticator.error}
|
|
81
|
+
<Alert>
|
|
82
|
+
{translate(authenticator.error)}
|
|
83
|
+
</Alert>
|
|
84
|
+
{/if}
|
|
85
|
+
<Button
|
|
86
|
+
class="amplify-field-group__control amplify-authenticator__font"
|
|
87
|
+
fullWidth={false}
|
|
88
|
+
variation="primary"
|
|
89
|
+
type="submit"
|
|
90
|
+
disabled={authenticator.isPending}>{submitText}</Button
|
|
91
|
+
>
|
|
92
|
+
<Button
|
|
93
|
+
class="amplify-field-group__control amplify-authenticator__font"
|
|
94
|
+
fullWidth={false}
|
|
95
|
+
size="small"
|
|
96
|
+
variation="link"
|
|
97
|
+
type="button"
|
|
98
|
+
onclick={onSkipClicked}
|
|
99
|
+
>
|
|
100
|
+
{skipText}
|
|
101
|
+
</Button>
|
|
102
|
+
{@render components?.Footer?.()}
|
|
103
|
+
</Footer>
|
|
104
|
+
</FieldSet>
|
|
105
|
+
</Form>
|
|
106
|
+
</Wrapper>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Components } from '../../types';
|
|
2
|
+
interface Props {
|
|
3
|
+
components?: Components;
|
|
4
|
+
}
|
|
5
|
+
declare const ConfirmVerifyUser: import("svelte").Component<Props, {}, "">;
|
|
6
|
+
type ConfirmVerifyUser = ReturnType<typeof ConfirmVerifyUser>;
|
|
7
|
+
export default ConfirmVerifyUser;
|
|
@@ -0,0 +1,120 @@
|
|
|
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 Wrapper from '../primitives/Wrapper.svelte';
|
|
12
|
+
import Form from '../primitives/Form.svelte';
|
|
13
|
+
import Button from '../controls/Button.svelte';
|
|
14
|
+
import FieldSet from '../primitives/FieldSet.svelte';
|
|
15
|
+
import FormFields from '../primitives/FormFields.svelte';
|
|
16
|
+
import Heading from '../primitives/Heading.svelte';
|
|
17
|
+
import Footer from '../primitives/Footer.svelte';
|
|
18
|
+
import Alert from '../primitives/Alert.svelte';
|
|
19
|
+
|
|
20
|
+
interface Props {
|
|
21
|
+
components?: Components;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const { components }: Props = $props();
|
|
25
|
+
|
|
26
|
+
const { authenticator } = $derived(useAuthenticator());
|
|
27
|
+
|
|
28
|
+
// Text Util
|
|
29
|
+
const { getChangePasswordText, getChangingText, getBackToSignInText } =
|
|
30
|
+
authenticatorTextUtil;
|
|
31
|
+
|
|
32
|
+
// Computed Properties
|
|
33
|
+
const changePasswordLabel = $derived.by(() => getChangePasswordText());
|
|
34
|
+
const changingPasswordLabel = $derived.by(() => getChangingText());
|
|
35
|
+
const backSignInText = $derived.by(() => getBackToSignInText());
|
|
36
|
+
|
|
37
|
+
// Methods
|
|
38
|
+
const onHaveAccountClicked = (e: Event): void => {
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
authenticator.toSignIn();
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const onForceNewPasswordSubmit = (e: Event): void => {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
submit(e);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const submit = (e: Event): void => {
|
|
49
|
+
authenticator.submitForm(getFormDataFromEvent(e));
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const onInput = (e: Event): void => {
|
|
53
|
+
const { name, value } = e.target as HTMLInputElement;
|
|
54
|
+
authenticator.updateForm({ name, value });
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
function onBlur(e: Event) {
|
|
58
|
+
const { name } = e.target as HTMLInputElement;
|
|
59
|
+
authenticator.updateBlur({ name });
|
|
60
|
+
}
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<Wrapper>
|
|
64
|
+
<Form
|
|
65
|
+
data-amplify-authenticator-forcenewpassword
|
|
66
|
+
oninput={onInput}
|
|
67
|
+
onblurcapture={onBlur}
|
|
68
|
+
onsubmit={onForceNewPasswordSubmit}
|
|
69
|
+
>
|
|
70
|
+
<FieldSet
|
|
71
|
+
class="amplify-flex amplify-authenticator__column"
|
|
72
|
+
disabled={authenticator.isPending}
|
|
73
|
+
>
|
|
74
|
+
{#if components?.Header}
|
|
75
|
+
{@render components?.Header()}
|
|
76
|
+
{:else}
|
|
77
|
+
<Heading level="h3" class="amplify-heading">
|
|
78
|
+
{changePasswordLabel}
|
|
79
|
+
</Heading>
|
|
80
|
+
{/if}
|
|
81
|
+
<Wrapper class="amplify-flex amplify-authenticator__column">
|
|
82
|
+
{#if components?.FormFields}
|
|
83
|
+
{@render components?.FormFields()}
|
|
84
|
+
{:else}
|
|
85
|
+
<FormFields route="forceNewPassword" />
|
|
86
|
+
{/if}
|
|
87
|
+
</Wrapper>
|
|
88
|
+
|
|
89
|
+
<Footer class="amplify-flex amplify-authenticator__column">
|
|
90
|
+
{#if authenticator.error}
|
|
91
|
+
<Alert>
|
|
92
|
+
{translate(authenticator.error)}
|
|
93
|
+
</Alert>
|
|
94
|
+
{/if}
|
|
95
|
+
<Button
|
|
96
|
+
class="amplify-field-group__control amplify-authenticator__font"
|
|
97
|
+
fullWidth={false}
|
|
98
|
+
loading={false}
|
|
99
|
+
variation="primary"
|
|
100
|
+
disabled={authenticator.isPending}
|
|
101
|
+
>
|
|
102
|
+
{authenticator.isPending
|
|
103
|
+
? `${changingPasswordLabel}…`
|
|
104
|
+
: changePasswordLabel}
|
|
105
|
+
</Button>
|
|
106
|
+
<Button
|
|
107
|
+
class="amplify-field-group__control amplify-authenticator__font"
|
|
108
|
+
fullWidth={false}
|
|
109
|
+
size="small"
|
|
110
|
+
variation="link"
|
|
111
|
+
type="button"
|
|
112
|
+
onclick={onHaveAccountClicked}
|
|
113
|
+
>
|
|
114
|
+
{backSignInText}
|
|
115
|
+
</Button>
|
|
116
|
+
{@render components?.Footer?.()}
|
|
117
|
+
</Footer>
|
|
118
|
+
</FieldSet>
|
|
119
|
+
</Form>
|
|
120
|
+
</Wrapper>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Components } from '../../types';
|
|
2
|
+
interface Props {
|
|
3
|
+
components?: Components;
|
|
4
|
+
}
|
|
5
|
+
declare const ForceNewPassword: import("svelte").Component<Props, {}, "">;
|
|
6
|
+
type ForceNewPassword = ReturnType<typeof ForceNewPassword>;
|
|
7
|
+
export default ForceNewPassword;
|
|
@@ -0,0 +1,107 @@
|
|
|
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 Form from '../primitives/Form.svelte';
|
|
12
|
+
import Wrapper from '../primitives/Wrapper.svelte';
|
|
13
|
+
import Heading from '../primitives/Heading.svelte';
|
|
14
|
+
import FieldSet from '../primitives/FieldSet.svelte';
|
|
15
|
+
import FormFields from '../primitives/FormFields.svelte';
|
|
16
|
+
import Footer from '../primitives/Footer.svelte';
|
|
17
|
+
import Alert from '../primitives/Alert.svelte';
|
|
18
|
+
import Button from '../controls/Button.svelte';
|
|
19
|
+
|
|
20
|
+
interface Props {
|
|
21
|
+
components?: Components;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const { components }: Props = $props();
|
|
25
|
+
|
|
26
|
+
const { authenticator } = $derived(useAuthenticator());
|
|
27
|
+
|
|
28
|
+
// Text Util
|
|
29
|
+
const { getBackToSignInText, getResetYourPasswordText, getSendCodeText } =
|
|
30
|
+
authenticatorTextUtil;
|
|
31
|
+
|
|
32
|
+
// Computed Properties
|
|
33
|
+
const backSignInText = $derived.by(() => getBackToSignInText());
|
|
34
|
+
const resetPasswordHeading = $derived.by(() => getResetYourPasswordText());
|
|
35
|
+
const sendCodeText = $derived.by(() => getSendCodeText());
|
|
36
|
+
|
|
37
|
+
// Methods
|
|
38
|
+
const onResetPasswordSubmit = (e: Event): void => {
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
authenticator.submitForm(getFormDataFromEvent(e));
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const onInput = (e: Event): void => {
|
|
44
|
+
const { name, value } = e.target as HTMLInputElement;
|
|
45
|
+
authenticator.updateForm({ name, value });
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const onBackToSignInClicked = (e: Event): void => {
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
authenticator.toSignIn();
|
|
51
|
+
};
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<Form
|
|
55
|
+
data-amplify-authenticator-forgotpassword
|
|
56
|
+
oninput={onInput}
|
|
57
|
+
onsubmit={onResetPasswordSubmit}
|
|
58
|
+
>
|
|
59
|
+
<Wrapper class="amplify-flex amplify-authenticator__column">
|
|
60
|
+
{#if components?.Header}
|
|
61
|
+
{@render components?.Header()}
|
|
62
|
+
{:else}
|
|
63
|
+
<Heading class="amplify-heading" level="h3">
|
|
64
|
+
{resetPasswordHeading}
|
|
65
|
+
</Heading>
|
|
66
|
+
{/if}
|
|
67
|
+
<FieldSet
|
|
68
|
+
class="amplify-flex amplify-authenticator__column"
|
|
69
|
+
disabled={authenticator.isPending}
|
|
70
|
+
>
|
|
71
|
+
{#if components?.FormFields}
|
|
72
|
+
{@render components?.FormFields()}
|
|
73
|
+
{:else}
|
|
74
|
+
<FormFields route="forgotPassword" />
|
|
75
|
+
{/if}
|
|
76
|
+
</FieldSet>
|
|
77
|
+
|
|
78
|
+
<Footer class="amplify-flex amplify-authenticator__column">
|
|
79
|
+
{#if authenticator.error}
|
|
80
|
+
<Alert>
|
|
81
|
+
{translate(authenticator.error)}
|
|
82
|
+
</Alert>
|
|
83
|
+
{/if}
|
|
84
|
+
<Button
|
|
85
|
+
class="amplify-field-group__control amplify-authenticator__font"
|
|
86
|
+
fullWidth={false}
|
|
87
|
+
variation="primary"
|
|
88
|
+
type="submit"
|
|
89
|
+
disabled={authenticator.isPending}
|
|
90
|
+
>
|
|
91
|
+
{sendCodeText}
|
|
92
|
+
</Button>
|
|
93
|
+
<Button
|
|
94
|
+
class="amplify-field-group__control amplify-authenticator__font"
|
|
95
|
+
fullWidth={false}
|
|
96
|
+
size="small"
|
|
97
|
+
variation="link"
|
|
98
|
+
fontWeight="normal"
|
|
99
|
+
type="button"
|
|
100
|
+
onclick={onBackToSignInClicked}
|
|
101
|
+
>
|
|
102
|
+
{backSignInText}
|
|
103
|
+
</Button>
|
|
104
|
+
{@render components?.Footer?.()}
|
|
105
|
+
</Footer>
|
|
106
|
+
</Wrapper>
|
|
107
|
+
</Form>
|
|
@@ -0,0 +1,145 @@
|
|
|
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
|
+
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 Heading from '../primitives/Heading.svelte';
|
|
15
|
+
import Footer from '../primitives/Footer.svelte';
|
|
16
|
+
import Alert from '../primitives/Alert.svelte';
|
|
17
|
+
import Label from '../primitives/Label.svelte';
|
|
18
|
+
import Input from '../primitives/Input.svelte';
|
|
19
|
+
import Text from '../primitives/Text.svelte';
|
|
20
|
+
|
|
21
|
+
interface Props {
|
|
22
|
+
components?: Omit<Components, 'FormFields'>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const { components }: Props = $props();
|
|
26
|
+
|
|
27
|
+
const { authenticator } = $derived(useAuthenticator());
|
|
28
|
+
|
|
29
|
+
const random = Math.floor(Math.random() * 999999);
|
|
30
|
+
const {
|
|
31
|
+
getBackToSignInText,
|
|
32
|
+
getConfirmText,
|
|
33
|
+
getSelectMfaTypeByChallengeName,
|
|
34
|
+
getMfaTypeLabelByValue,
|
|
35
|
+
getSelectMfaTypeText,
|
|
36
|
+
} = authenticatorTextUtil;
|
|
37
|
+
|
|
38
|
+
const selectMfaTypeHeading = $derived.by(() =>
|
|
39
|
+
getSelectMfaTypeByChallengeName(authenticator.challengeName)
|
|
40
|
+
);
|
|
41
|
+
const backSignInText = $derived.by(() => getBackToSignInText());
|
|
42
|
+
const confirmText = $derived.by(() => getConfirmText());
|
|
43
|
+
const selectMfaTypeText = $derived.by(() => getSelectMfaTypeText());
|
|
44
|
+
|
|
45
|
+
const onInput = (e: Event) => {
|
|
46
|
+
const { name, value } = e.target as HTMLInputElement;
|
|
47
|
+
authenticator.updateForm({ name, value });
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const onSelectMfaTypeSubmit = (e: Event) => {
|
|
51
|
+
e.preventDefault();
|
|
52
|
+
authenticator.submitForm(getFormDataFromEvent(e));
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const onBackToSignInClicked = (e: Event) => {
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
authenticator.toSignIn();
|
|
58
|
+
};
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<Wrapper>
|
|
62
|
+
<Form
|
|
63
|
+
data-amplify-authenticator-selectmfatype
|
|
64
|
+
oninput={onInput}
|
|
65
|
+
onsubmit={onSelectMfaTypeSubmit}
|
|
66
|
+
>
|
|
67
|
+
<FieldSet
|
|
68
|
+
class="amplify-flex amplify-authenticator__column"
|
|
69
|
+
disabled={authenticator.isPending}
|
|
70
|
+
>
|
|
71
|
+
{#if components?.Header}
|
|
72
|
+
{@render components?.Header()}
|
|
73
|
+
{:else}
|
|
74
|
+
<Heading level="h3" class="amplify-heading">
|
|
75
|
+
{selectMfaTypeHeading}
|
|
76
|
+
</Heading>
|
|
77
|
+
{/if}
|
|
78
|
+
<Wrapper class="amplify-flex amplify-authenticator__column">
|
|
79
|
+
<Label
|
|
80
|
+
class="amplify-visually-hidden amplify-label"
|
|
81
|
+
id={`amplify-field-${random}`}
|
|
82
|
+
>
|
|
83
|
+
{selectMfaTypeText}
|
|
84
|
+
</Label>
|
|
85
|
+
<Wrapper
|
|
86
|
+
class="amplify-flex amplify-field amplify-radiogroupfield amplify-authenticator__column"
|
|
87
|
+
aria-labelledby={`amplify-field-${random}`}
|
|
88
|
+
>
|
|
89
|
+
{#if authenticator.allowedMfaTypes}
|
|
90
|
+
{#each authenticator.allowedMfaTypes as mfaType, index (mfaType)}
|
|
91
|
+
<Label
|
|
92
|
+
class="amplify-flex amplify-radio"
|
|
93
|
+
data-amplify-selectmfatype-label
|
|
94
|
+
>
|
|
95
|
+
<Text class="amplify-text amplify-radio__label">
|
|
96
|
+
{getMfaTypeLabelByValue(mfaType)}
|
|
97
|
+
</Text>
|
|
98
|
+
<Input
|
|
99
|
+
class="amplify-input amplify-field-group__control amplify-visually-hidden amplify-radio__input"
|
|
100
|
+
aria-invalid="false"
|
|
101
|
+
data-amplify-selectmfatype-input
|
|
102
|
+
name="mfa_type"
|
|
103
|
+
type="radio"
|
|
104
|
+
value={mfaType}
|
|
105
|
+
checked={index === 0}
|
|
106
|
+
></Input>
|
|
107
|
+
<Text
|
|
108
|
+
class="amplify-flex amplify-radio__button"
|
|
109
|
+
aria-hidden="true"
|
|
110
|
+
/>
|
|
111
|
+
</Label>
|
|
112
|
+
{/each}
|
|
113
|
+
{/if}
|
|
114
|
+
</Wrapper>
|
|
115
|
+
</Wrapper>
|
|
116
|
+
<Footer class="amplify-flex amplify-authenticator__column">
|
|
117
|
+
{#if authenticator.error}
|
|
118
|
+
<Alert>
|
|
119
|
+
{translate(authenticator.error)}
|
|
120
|
+
</Alert>
|
|
121
|
+
{/if}
|
|
122
|
+
<Button
|
|
123
|
+
class="amplify-field-group__control amplify-authenticator__font"
|
|
124
|
+
fullWidth={false}
|
|
125
|
+
loading={false}
|
|
126
|
+
variation="primary"
|
|
127
|
+
disabled={authenticator.isPending}
|
|
128
|
+
>
|
|
129
|
+
{confirmText}
|
|
130
|
+
</Button>
|
|
131
|
+
<Button
|
|
132
|
+
class="amplify-field-group__control amplify-authenticator__font"
|
|
133
|
+
fullWidth={false}
|
|
134
|
+
size="small"
|
|
135
|
+
variation="link"
|
|
136
|
+
type="button"
|
|
137
|
+
onclick={onBackToSignInClicked}
|
|
138
|
+
>
|
|
139
|
+
{backSignInText}
|
|
140
|
+
</Button>
|
|
141
|
+
{@render components?.Footer?.()}
|
|
142
|
+
</Footer>
|
|
143
|
+
</FieldSet>
|
|
144
|
+
</Form>
|
|
145
|
+
</Wrapper>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Components } from '../../types';
|
|
2
|
+
interface Props {
|
|
3
|
+
components?: Omit<Components, 'FormFields'>;
|
|
4
|
+
}
|
|
5
|
+
declare const SelectMfaType: import("svelte").Component<Props, {}, "">;
|
|
6
|
+
type SelectMfaType = ReturnType<typeof SelectMfaType>;
|
|
7
|
+
export default SelectMfaType;
|