@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.
Files changed (127) 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/Authenticator.svelte +0 -43
  102. package/dist/components/Authenticator.svelte.d.ts +0 -22
  103. package/dist/components/SignIn.svelte +0 -69
  104. package/dist/components/SignIn.svelte.d.ts +0 -14
  105. package/dist/components/UserNameAlias.svelte +0 -29
  106. package/dist/components/UserNameAlias.svelte.d.ts +0 -19
  107. package/dist/components/authStore.d.ts +0 -20
  108. package/dist/components/authStore.js +0 -101
  109. package/dist/components/primitives/AmplifyButton.svelte +0 -23
  110. package/dist/components/primitives/AmplifyButton.svelte.d.ts +0 -25
  111. package/dist/components/primitives/AmplifyError.svelte +0 -46
  112. package/dist/components/primitives/AmplifyError.svelte.d.ts +0 -16
  113. package/dist/components/primitives/AmplifyFormField.svelte +0 -121
  114. package/dist/components/primitives/AmplifyFormField.svelte.d.ts +0 -25
  115. package/dist/components/primitives/AmplifyFormSelect.svelte +0 -38
  116. package/dist/components/primitives/AmplifyFormSelect.svelte.d.ts +0 -20
  117. package/dist/components/primitives/AmplifyPasswordField.svelte +0 -75
  118. package/dist/components/primitives/AmplifyPasswordField.svelte.d.ts +0 -26
  119. package/dist/components/primitives/AmplifyPhoneNumberField.svelte +0 -50
  120. package/dist/components/primitives/AmplifyPhoneNumberField.svelte.d.ts +0 -27
  121. package/dist/components/primitives/AmplifyTabItem.svelte.d.ts +0 -19
  122. package/dist/components/primitives/AmplifyTabs.svelte +0 -50
  123. package/dist/components/primitives/AmplifyTabs.svelte.d.ts +0 -14
  124. package/dist/components/primitives/AmplifyTextField.svelte +0 -31
  125. package/dist/components/primitives/AmplifyTextField.svelte.d.ts +0 -28
  126. package/dist/package.json +0 -65
  127. /package/dist/{components/primitives/AmplifyTabItem.svelte → styles/index.d.ts} +0 -0
@@ -1,69 +0,0 @@
1
- <script >import AmplifyFormField from './primitives/AmplifyFormField.svelte';
2
- import AmplifyError from './primitives/AmplifyError.svelte';
3
- import UserNameAlias from './UserNameAlias.svelte';
4
- import AmplifyButton from './primitives/AmplifyButton.svelte';
5
- import { translate } from '@aws-amplify/ui';
6
- import { updateForm, submitForm, isPending, error, toResetPassword, } from './authStore';
7
- const forgotPasswordText = translate('Forgot your password? ');
8
- const signInButtonText = translate('Sign in');
9
- const signingButtonText = translate('Signing in');
10
- function onInput(event) {
11
- event.preventDefault();
12
- const { name, value } = event.target;
13
- updateForm({ name, value });
14
- }
15
- function onSubmit(event) {
16
- event.preventDefault();
17
- submitForm();
18
- }
19
- </script>
20
-
21
- <div data-amplify-container>
22
- <form
23
- data-amplify-form
24
- on:submit|preventDefault={onSubmit}
25
- on:input={onInput}
26
- >
27
- <fieldset
28
- class="amplify-flex"
29
- style="flex-direction: column"
30
- data-amplify-fieldset
31
- disabled={$isPending}
32
- >
33
- <UserNameAlias />
34
- <AmplifyFormField
35
- data-amplify-password
36
- name="password"
37
- type="password"
38
- autocomplete="current-password"
39
- />
40
- <AmplifyButton
41
- disabled={$isPending}
42
- variation="primary"
43
- fullWidth="true"
44
- type="submit"
45
- >
46
- {$isPending ? signingButtonText : signInButtonText}
47
- </AmplifyButton>
48
-
49
- {#if $error}
50
- <AmplifyError>
51
- {$error}
52
- </AmplifyError>
53
- {/if}
54
- </fieldset>
55
- </form>
56
-
57
- <div data-amplify-footer>
58
- <AmplifyButton
59
- amplify-button
60
- fontWeight="normal"
61
- data-size="small"
62
- variation="link"
63
- fullWidth="true"
64
- on:click={toResetPassword}
65
- >
66
- {forgotPasswordText}
67
- </AmplifyButton>
68
- </div>
69
- </div>
@@ -1,14 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: {};
4
- events: {
5
- [evt: string]: CustomEvent<any>;
6
- };
7
- slots: {};
8
- };
9
- export declare type SignInProps = typeof __propDef.props;
10
- export declare type SignInEvents = typeof __propDef.events;
11
- export declare type SignInSlots = typeof __propDef.slots;
12
- export default class SignIn extends SvelteComponentTyped<SignInProps, SignInEvents, SignInSlots> {
13
- }
14
- export {};
@@ -1,29 +0,0 @@
1
- <script >import AmplifyFormField from './primitives/AmplifyFormField.svelte';
2
- import { onMount } from 'svelte';
3
- import { authState } from './authStore';
4
- import { getAliasInfoFromContext } from '@aws-amplify/ui';
5
- export let name = 'username';
6
- export let disabled = false;
7
- export let initialValue = '';
8
- export let required = true;
9
- let label;
10
- let type;
11
- let error;
12
- let placeholder;
13
- onMount(() => {
14
- const { label, type } = getAliasInfoFromContext($authState.context);
15
- placeholder = label;
16
- });
17
- </script>
18
-
19
- <AmplifyFormField
20
- data-amplify-usernamealias
21
- {name}
22
- {label}
23
- {type}
24
- {placeholder}
25
- {initialValue}
26
- {disabled}
27
- {required}
28
- autocomplete="username"
29
- />
@@ -1,19 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- name?: string;
5
- disabled?: boolean;
6
- initialValue?: string;
7
- required?: boolean;
8
- };
9
- events: {
10
- [evt: string]: CustomEvent<any>;
11
- };
12
- slots: {};
13
- };
14
- export declare type UserNameAliasProps = typeof __propDef.props;
15
- export declare type UserNameAliasEvents = typeof __propDef.events;
16
- export declare type UserNameAliasSlots = typeof __propDef.slots;
17
- export default class UserNameAlias extends SvelteComponentTyped<UserNameAliasProps, UserNameAliasEvents, UserNameAliasSlots> {
18
- }
19
- export {};
@@ -1,20 +0,0 @@
1
- export declare const error: import("svelte/store").Writable<any>;
2
- export declare const route: import("svelte/store").Writable<any>;
3
- export declare const isPending: import("svelte/store").Writable<any>;
4
- export declare const hasValidationErrors: import("svelte/store").Writable<any>;
5
- export declare const user: import("svelte/store").Writable<any>;
6
- export declare const validationErrors: import("svelte/store").Writable<any>;
7
- export declare const codeDeliveryDetails: import("svelte/store").Writable<any>;
8
- /** @deprecated For internal use only */
9
- export declare const authState: import("svelte/store").Writable<any>;
10
- export declare function setupMachine(initialState: any, loginMechanisms: any, services: any, signUpAttributes: any, socialProviders: any): import("xstate").Subscription;
11
- export declare function updateForm(...args: any[]): void;
12
- export declare function updateBlur(...args: any[]): void;
13
- export declare function resendCode(...args: any[]): void;
14
- export declare function signOut(...args: any[]): void;
15
- export declare function submitForm(...args: any[]): void;
16
- export declare function toFederatedSignIn(...args: any[]): void;
17
- export declare function toResetPassword(...args: any[]): void;
18
- export declare function toSignIn(...args: any[]): void;
19
- export declare function toSignUp(...args: any[]): void;
20
- export declare function skipVerification(...args: any[]): void;
@@ -1,101 +0,0 @@
1
- import { createAuthenticatorMachine, getSendEventAliases, translate, getServiceContextFacade, } from '@aws-amplify/ui';
2
- import { interpret } from 'xstate';
3
- import { writable, get } from 'svelte/store';
4
- let _facade = writable(null);
5
- export const error = writable(null);
6
- export const route = writable(null);
7
- export const isPending = writable(null);
8
- export const hasValidationErrors = writable(null);
9
- export const user = writable(null);
10
- export const validationErrors = writable(null);
11
- export const codeDeliveryDetails = writable(null);
12
- const _sendEventAliases = writable(null);
13
- const contextFacade = getServiceContextFacade;
14
- /** @deprecated For internal use only */
15
- export const authState = writable(null);
16
- export function setupMachine(initialState, loginMechanisms, services, signUpAttributes, socialProviders) {
17
- const machine = createAuthenticatorMachine({
18
- initialState,
19
- loginMechanisms,
20
- services,
21
- signUpAttributes,
22
- socialProviders,
23
- });
24
- const authService = interpret(machine, {
25
- devTools: process.env.NODE_ENV === 'development',
26
- }).start();
27
- const subscription = authService.subscribe((state) => {
28
- authState.update(() => state);
29
- _facade.update(() => contextFacade(state));
30
- setError();
31
- setRoute();
32
- setHasValidationErrors();
33
- setCodeDeliveryDetails();
34
- setIsPending();
35
- setUser();
36
- setValidationErrors();
37
- });
38
- _sendEventAliases.set(getSendEventAliases(authService.send));
39
- const _authService = authService;
40
- return subscription;
41
- }
42
- /**
43
- * Context facades
44
- */
45
- function setError() {
46
- error.set(translate(get(_facade).error));
47
- }
48
- function setRoute() {
49
- route.set(get(_facade).route);
50
- }
51
- function setHasValidationErrors() {
52
- hasValidationErrors.set(get(_facade).hasValidationErrors);
53
- }
54
- function setIsPending() {
55
- isPending.set(get(_facade).isPending);
56
- }
57
- function setUser() {
58
- user.set(get(_facade).user);
59
- }
60
- function setValidationErrors() {
61
- validationErrors.set(get(_facade).validationErrors);
62
- }
63
- function setCodeDeliveryDetails() {
64
- codeDeliveryDetails.set(get(_facade).codeDeliveryDetails);
65
- }
66
- // /**
67
- // * Service facades
68
- // */
69
- export function updateForm(...args) {
70
- return get(_sendEventAliases).updateForm(...args);
71
- }
72
- export function updateBlur(...args) {
73
- return get(_sendEventAliases).updateBlur(...args);
74
- }
75
- export function resendCode(...args) {
76
- return get(_sendEventAliases).resendCode(...args);
77
- }
78
- export function signOut(...args) {
79
- return get(_sendEventAliases).signOut(...args);
80
- }
81
- export function submitForm(...args) {
82
- return get(_sendEventAliases).submitForm(...args);
83
- }
84
- // /**
85
- // * Transition facades
86
- // */
87
- export function toFederatedSignIn(...args) {
88
- return get(_sendEventAliases).toFederatedSignIn(...args);
89
- }
90
- export function toResetPassword(...args) {
91
- return get(_sendEventAliases).toResetPassword(...args);
92
- }
93
- export function toSignIn(...args) {
94
- return get(_sendEventAliases).toSignIn(...args);
95
- }
96
- export function toSignUp(...args) {
97
- return get(_sendEventAliases).toSignUp(...args);
98
- }
99
- export function skipVerification(...args) {
100
- return get(_sendEventAliases).skipVerification(...args);
101
- }
@@ -1,23 +0,0 @@
1
- <script >import { createEventDispatcher } from 'svelte';
2
- export let type = 'button';
3
- export let fullWidth = false;
4
- export let size = 'medium';
5
- export let variation = 'default';
6
- export let fontWeight = 'normal';
7
- const dispatch = createEventDispatcher();
8
- </script>
9
-
10
- <button
11
- {...$$restProps}
12
- on:click={() => dispatch('click')}
13
- class={`amplify-button ${$$props.class ?? ''}`}
14
- {type}
15
- style="font-weight: {fontWeight} "
16
- data-fullwidth={fullWidth}
17
- data-size={size}
18
- data-fontWeight={fontWeight}
19
- data-variation={variation}
20
- data-amplify-button=""
21
- >
22
- <slot />
23
- </button>
@@ -1,25 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- [x: string]: any;
5
- type?: 'submit' | 'button';
6
- fullWidth?: boolean | string;
7
- size?: 'small' | 'medium' | 'large';
8
- variation?: 'primary' | 'default' | 'link';
9
- fontWeight?: 'normal' | 'bold' | 'lighter';
10
- };
11
- events: {
12
- click: CustomEvent<any>;
13
- } & {
14
- [evt: string]: CustomEvent<any>;
15
- };
16
- slots: {
17
- default: {};
18
- };
19
- };
20
- export declare type AmplifyButtonProps = typeof __propDef.props;
21
- export declare type AmplifyButtonEvents = typeof __propDef.events;
22
- export declare type AmplifyButtonSlots = typeof __propDef.slots;
23
- export default class AmplifyButton extends SvelteComponentTyped<AmplifyButtonProps, AmplifyButtonEvents, AmplifyButtonSlots> {
24
- }
25
- export {};
@@ -1,46 +0,0 @@
1
- <script >import AmplifyButton from './AmplifyButton.svelte';
2
- let isVisible = true;
3
- function close() {
4
- isVisible = false;
5
- }
6
- </script>
7
-
8
- {#if isVisible}
9
- <div
10
- class="amplify-flex amplify-alert"
11
- data-variation="error"
12
- style="align-items: center; justify-content: space-between"
13
- role="alert"
14
- >
15
- <div class="amplify-flex" style="align-items: center">
16
- <svg
17
- xmlns="http://www.w3.org/2000/svg"
18
- class="amplify-icon"
19
- viewBox="0 0 24 24"
20
- fill="currentColor"
21
- >
22
- <path
23
- d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"
24
- />
25
- </svg>
26
- <div><slot /></div>
27
- </div>
28
- <AmplifyButton
29
- class="amplify-field-group__control"
30
- variation="link"
31
- fullWidth={false}
32
- on:click={close}
33
- >
34
- <svg
35
- xmlns="http://www.w3.org/2000/svg"
36
- class="amplify-icon"
37
- viewBox="0 0 24 24"
38
- fill="currentColor"
39
- >
40
- <path
41
- d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
42
- />
43
- </svg>
44
- </AmplifyButton>
45
- </div>
46
- {/if}
@@ -1,16 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: {};
4
- events: {
5
- [evt: string]: CustomEvent<any>;
6
- };
7
- slots: {
8
- default: {};
9
- };
10
- };
11
- export declare type AmplifyErrorProps = typeof __propDef.props;
12
- export declare type AmplifyErrorEvents = typeof __propDef.events;
13
- export declare type AmplifyErrorSlots = typeof __propDef.slots;
14
- export default class AmplifyError extends SvelteComponentTyped<AmplifyErrorProps, AmplifyErrorEvents, AmplifyErrorSlots> {
15
- }
16
- export {};
@@ -1,121 +0,0 @@
1
- <script >import AmplifyPhoneNumberField from './AmplifyPhoneNumberField.svelte';
2
- import AmplifyPasswordField from './AmplifyPasswordField.svelte';
3
- import AmplifyTextField from './AmplifyTextField.svelte';
4
- import AmplifyError from './AmplifyError.svelte';
5
- import { authState, updateForm, updateBlur } from '../authStore';
6
- import { authInputAttributes, getActorContext, translate, } from '@aws-amplify/ui';
7
- import { onMount } from 'svelte';
8
- export let name;
9
- export let type;
10
- export let required = true;
11
- export let placeholder = '';
12
- export let label = '';
13
- export let initialValue = '';
14
- export let disabled = false;
15
- export let autocomplete = '';
16
- export let labelHidden = true;
17
- const getAttributeMap = () => authInputAttributes;
18
- let defaultCountryCode;
19
- onMount(() => {
20
- if (isPhoneField) {
21
- const state = $authState;
22
- const { country_code } = getActorContext(state);
23
- defaultCountryCode = country_code;
24
- // TODO: remove this side-effect
25
- updateForm({
26
- name: 'country_code',
27
- value: country_code,
28
- });
29
- }
30
- });
31
- const attributeMap = getAttributeMap();
32
- let error;
33
- $: {
34
- const formContext = getActorContext($authState);
35
- const { validationError } = formContext;
36
- error = translate(validationError[name]);
37
- }
38
- function onBlur($event) {
39
- let { name } = $event?.detail?.target;
40
- updateBlur({ name });
41
- }
42
- let inferLabel;
43
- $: {
44
- const myLabel = label || attributeMap[name]?.label;
45
- inferLabel = translate(myLabel);
46
- }
47
- let inferPlaceholder;
48
- $: {
49
- const myPlaceholder = placeholder || attributeMap[name]?.placeholder || inferLabel;
50
- inferPlaceholder = translate(myPlaceholder);
51
- }
52
- // infers what the `type` of underlying input element should be.
53
- let inferType;
54
- $: {
55
- inferType = type ?? attributeMap[name]?.type ?? 'text';
56
- }
57
- let inferAutocomplete;
58
- $: {
59
- inferAutocomplete = autocomplete || attributeMap[name]?.autocomplete;
60
- }
61
- // TODO(enhancement): use enum to differentiate special field types
62
- let isPasswordField;
63
- $: {
64
- isPasswordField = inferType === 'password';
65
- }
66
- let isPhoneField;
67
- isPhoneField = inferType === 'tel';
68
- </script>
69
-
70
- <div class="amplify-flex amplify-field" style="flex-direction: column">
71
- <!-- Country code field -->
72
- {#if isPhoneField}
73
- <AmplifyPhoneNumberField
74
- {defaultCountryCode}
75
- type={inferType}
76
- {name}
77
- label={inferLabel}
78
- placeholder={inferPlaceholder}
79
- {required}
80
- {initialValue}
81
- {disabled}
82
- {labelHidden}
83
- autocomplete={inferAutocomplete}
84
- />
85
- {/if}
86
-
87
- {#if isPasswordField}
88
- <AmplifyPasswordField
89
- {...$$restProps}
90
- {name}
91
- label={inferLabel}
92
- placeholder={inferPlaceholder}
93
- {required}
94
- {initialValue}
95
- {disabled}
96
- {labelHidden}
97
- autocomplete={inferAutocomplete}
98
- />
99
- {/if}
100
-
101
- {#if !isPasswordField && !isPhoneField}
102
- <AmplifyTextField
103
- on:blur={onBlur}
104
- type={inferType}
105
- {name}
106
- label={inferLabel}
107
- placeholder={inferPlaceholder}
108
- {required}
109
- {initialValue}
110
- {disabled}
111
- {labelHidden}
112
- autocomplete={inferAutocomplete}
113
- />
114
- {/if}
115
-
116
- {#if error}
117
- <AmplifyError>
118
- {error}
119
- </AmplifyError>
120
- {/if}
121
- </div>
@@ -1,25 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- [x: string]: any;
5
- name: string;
6
- type: string;
7
- required?: boolean;
8
- placeholder?: string;
9
- label?: string;
10
- initialValue?: string;
11
- disabled?: boolean;
12
- autocomplete?: string;
13
- labelHidden?: boolean;
14
- };
15
- events: {
16
- [evt: string]: CustomEvent<any>;
17
- };
18
- slots: {};
19
- };
20
- export declare type AmplifyFormFieldProps = typeof __propDef.props;
21
- export declare type AmplifyFormFieldEvents = typeof __propDef.events;
22
- export declare type AmplifyFormFieldSlots = typeof __propDef.slots;
23
- export default class AmplifyFormField extends SvelteComponentTyped<AmplifyFormFieldProps, AmplifyFormFieldEvents, AmplifyFormFieldSlots> {
24
- }
25
- export {};
@@ -1,38 +0,0 @@
1
- <script >export let items;
2
- export let name;
3
- export let label;
4
- export let id;
5
- export let defaultValue;
6
- </script>
7
-
8
- <label class="amplify-label sr-only" for={id}>
9
- {label}
10
- </label>
11
- <div class="amplify-select__wrapper">
12
- <select
13
- class="amplify-select amplify-field-group__control"
14
- autocomplete="tel-country-code"
15
- {id}
16
- {name}
17
- >
18
- {#each items as item}
19
- <option value={item} selected={item === defaultValue}>
20
- {item}
21
- </option>
22
- {/each}
23
- </select>
24
- <div
25
- class="amplify-flex amplify-select__icon-wrapper"
26
- style="align-items: center; justify-content: center"
27
- >
28
- <svg
29
- xmlns="http://www.w3.org/2000/svg"
30
- class="amplify-icon"
31
- viewBox="0 0 24 24"
32
- data-size="large"
33
- fill="currentColor"
34
- >
35
- <path d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z" />
36
- </svg>
37
- </div>
38
- </div>
@@ -1,20 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- items: string[];
5
- name: string;
6
- label: string;
7
- id: string;
8
- defaultValue: string;
9
- };
10
- events: {
11
- [evt: string]: CustomEvent<any>;
12
- };
13
- slots: {};
14
- };
15
- export declare type AmplifyFormSelectProps = typeof __propDef.props;
16
- export declare type AmplifyFormSelectEvents = typeof __propDef.events;
17
- export declare type AmplifyFormSelectSlots = typeof __propDef.slots;
18
- export default class AmplifyFormSelect extends SvelteComponentTyped<AmplifyFormSelectProps, AmplifyFormSelectEvents, AmplifyFormSelectSlots> {
19
- }
20
- export {};
@@ -1,75 +0,0 @@
1
- <script >import AmplifyButton from './AmplifyButton.svelte';
2
- import { nanoid } from 'nanoid';
3
- import { translate } from '@aws-amplify/ui';
4
- export let autocomplete = 'new-password';
5
- export let disabled = false;
6
- export let fieldId = `amplify-field-${nanoid(12)}`;
7
- export let initialValue = '';
8
- export let label = '';
9
- export let name;
10
- export let placeholder = '';
11
- export let required = true;
12
- export let labelHidden = false;
13
- export let type = 'password';
14
- let showPassword = false;
15
- let showPasswordButtonlabel = translate('Show password');
16
- function togglePasswordText() {
17
- showPassword = !showPassword;
18
- showPasswordButtonlabel = showPassword
19
- ? translate('Show password')
20
- : translate('Hide password');
21
- type = showPassword ? 'text' : 'password';
22
- }
23
- </script>
24
-
25
- <label class="amplify-label {labelHidden ? 'sr-only' : ''}" for={fieldId}>
26
- {label}
27
- </label>
28
- <div class="amplify-flex amplify-field-group">
29
- <input
30
- {...$$restProps}
31
- class={`amplify-input amplify-field-group__control ${$$props.class ?? ''}`}
32
- id={fieldId}
33
- {type}
34
- {name}
35
- {placeholder}
36
- {required}
37
- value={initialValue}
38
- {disabled}
39
- {autocomplete}
40
- />
41
- <div class="amplify-field-group__outer-end">
42
- <AmplifyButton
43
- amplify-button
44
- aria-label={showPasswordButtonlabel}
45
- class="amplify-field-group__control amplify-field__show-password"
46
- on:click={togglePasswordText}
47
- >
48
- {#if !showPassword}
49
- <svg
50
- xmlns="http://www.w3.org/2000/svg"
51
- fill="currentColor"
52
- viewBox="0 0 24 24"
53
- class="amplify-icon"
54
- >
55
- <path
56
- d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"
57
- />
58
- </svg>
59
- {/if}
60
- {#if showPassword}
61
- <svg
62
- xmlns="http://www.w3.org/2000/svg"
63
- fill="currentColor"
64
- viewBox="0 0 24 24"
65
- class="amplify-icon"
66
- >
67
- <path d="M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z" fill="none" />
68
- <path
69
- d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"
70
- />
71
- </svg>
72
- {/if}
73
- </AmplifyButton>
74
- </div>
75
- </div>
@@ -1,26 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- [x: string]: any;
5
- autocomplete?: string;
6
- disabled?: boolean;
7
- fieldId?: string;
8
- initialValue?: string;
9
- label?: string;
10
- name: string;
11
- placeholder?: string;
12
- required?: boolean;
13
- labelHidden?: boolean;
14
- type?: 'text' | 'password';
15
- };
16
- events: {
17
- [evt: string]: CustomEvent<any>;
18
- };
19
- slots: {};
20
- };
21
- export declare type AmplifyPasswordFieldProps = typeof __propDef.props;
22
- export declare type AmplifyPasswordFieldEvents = typeof __propDef.events;
23
- export declare type AmplifyPasswordFieldSlots = typeof __propDef.slots;
24
- export default class AmplifyPasswordField extends SvelteComponentTyped<AmplifyPasswordFieldProps, AmplifyPasswordFieldEvents, AmplifyPasswordFieldSlots> {
25
- }
26
- export {};