@aws-amplify/ui-svelte 0.0.0-next-c8114c5-20220105200507

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 (57) hide show
  1. package/.eslintrc.cjs +20 -0
  2. package/.turbo/turbo-build.log +135 -0
  3. package/CHANGELOG.md +15 -0
  4. package/README.md +38 -0
  5. package/dist/README.md +38 -0
  6. package/dist/components/Authenticator.svelte +43 -0
  7. package/dist/components/Authenticator.svelte.d.ts +22 -0
  8. package/dist/components/SignIn.svelte +69 -0
  9. package/dist/components/SignIn.svelte.d.ts +14 -0
  10. package/dist/components/UserNameAlias.svelte +29 -0
  11. package/dist/components/UserNameAlias.svelte.d.ts +19 -0
  12. package/dist/components/authStore.d.ts +20 -0
  13. package/dist/components/authStore.js +100 -0
  14. package/dist/components/primitives/AmplifyButton.svelte +23 -0
  15. package/dist/components/primitives/AmplifyButton.svelte.d.ts +25 -0
  16. package/dist/components/primitives/AmplifyError.svelte +46 -0
  17. package/dist/components/primitives/AmplifyError.svelte.d.ts +16 -0
  18. package/dist/components/primitives/AmplifyFormField.svelte +121 -0
  19. package/dist/components/primitives/AmplifyFormField.svelte.d.ts +25 -0
  20. package/dist/components/primitives/AmplifyFormSelect.svelte +38 -0
  21. package/dist/components/primitives/AmplifyFormSelect.svelte.d.ts +20 -0
  22. package/dist/components/primitives/AmplifyPasswordField.svelte +75 -0
  23. package/dist/components/primitives/AmplifyPasswordField.svelte.d.ts +26 -0
  24. package/dist/components/primitives/AmplifyPhoneNumberField.svelte +50 -0
  25. package/dist/components/primitives/AmplifyPhoneNumberField.svelte.d.ts +27 -0
  26. package/dist/components/primitives/AmplifyTabItem.svelte +0 -0
  27. package/dist/components/primitives/AmplifyTabItem.svelte.d.ts +19 -0
  28. package/dist/components/primitives/AmplifyTabs.svelte +50 -0
  29. package/dist/components/primitives/AmplifyTabs.svelte.d.ts +14 -0
  30. package/dist/components/primitives/AmplifyTextField.svelte +31 -0
  31. package/dist/components/primitives/AmplifyTextField.svelte.d.ts +28 -0
  32. package/dist/index.d.ts +3 -0
  33. package/dist/index.js +3 -0
  34. package/dist/package.json +60 -0
  35. package/dist/styles.css +1 -0
  36. package/package.json +57 -0
  37. package/src/app.html +21 -0
  38. package/src/global.d.ts +1 -0
  39. package/src/lib/components/Authenticator.svelte +52 -0
  40. package/src/lib/components/SignIn.svelte +79 -0
  41. package/src/lib/components/UserNameAlias.svelte +32 -0
  42. package/src/lib/components/authStore.ts +138 -0
  43. package/src/lib/components/primitives/AmplifyButton.svelte +25 -0
  44. package/src/lib/components/primitives/AmplifyError.svelte +48 -0
  45. package/src/lib/components/primitives/AmplifyFormField.svelte +146 -0
  46. package/src/lib/components/primitives/AmplifyFormSelect.svelte +39 -0
  47. package/src/lib/components/primitives/AmplifyPasswordField.svelte +78 -0
  48. package/src/lib/components/primitives/AmplifyPhoneNumberField.svelte +52 -0
  49. package/src/lib/components/primitives/AmplifyTabItem.svelte +0 -0
  50. package/src/lib/components/primitives/AmplifyTabs.svelte +52 -0
  51. package/src/lib/components/primitives/AmplifyTextField.svelte +33 -0
  52. package/src/lib/index.ts +4 -0
  53. package/src/lib/styles.css +1 -0
  54. package/src/routes/index.svelte +8 -0
  55. package/static/favicon.png +0 -0
  56. package/svelte.config.js +41 -0
  57. package/tsconfig.json +31 -0
@@ -0,0 +1,78 @@
1
+ <script lang="ts">
2
+ import AmplifyButton from './AmplifyButton.svelte';
3
+ import { nanoid } from 'nanoid';
4
+ import { translate } from '@aws-amplify/ui';
5
+ export let autocomplete = 'new-password';
6
+ export let disabled = false;
7
+ export let fieldId: string = `amplify-field-${nanoid(12)}`;
8
+ export let initialValue = '';
9
+ export let label = '';
10
+ export let name: string;
11
+ export let placeholder = '';
12
+ export let required = true;
13
+ export let labelHidden = false;
14
+
15
+ export let type: 'text' | 'password' = 'password';
16
+
17
+ let showPassword = false;
18
+ let showPasswordButtonlabel = translate('Show password');
19
+ function togglePasswordText() {
20
+ showPassword = !showPassword;
21
+ showPasswordButtonlabel = showPassword
22
+ ? translate('Show password')
23
+ : translate('Hide password');
24
+ type = showPassword ? 'text' : 'password';
25
+ }
26
+ </script>
27
+
28
+ <label class="amplify-label {labelHidden ? 'sr-only' : ''}" for={fieldId}>
29
+ {label}
30
+ </label>
31
+ <div class="amplify-flex amplify-field-group">
32
+ <input
33
+ {...$$restProps}
34
+ class={`amplify-input amplify-field-group__control ${$$props.class ?? ''}`}
35
+ id={fieldId}
36
+ {type}
37
+ {name}
38
+ {placeholder}
39
+ {required}
40
+ value={initialValue}
41
+ {disabled}
42
+ {autocomplete}
43
+ />
44
+ <div class="amplify-field-group__outer-end">
45
+ <AmplifyButton
46
+ amplify-button
47
+ aria-label={showPasswordButtonlabel}
48
+ class="amplify-field-group__control amplify-field__show-password"
49
+ on:click={togglePasswordText}
50
+ >
51
+ {#if !showPassword}
52
+ <svg
53
+ xmlns="http://www.w3.org/2000/svg"
54
+ fill="currentColor"
55
+ viewBox="0 0 24 24"
56
+ class="amplify-icon"
57
+ >
58
+ <path
59
+ 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"
60
+ />
61
+ </svg>
62
+ {/if}
63
+ {#if showPassword}
64
+ <svg
65
+ xmlns="http://www.w3.org/2000/svg"
66
+ fill="currentColor"
67
+ viewBox="0 0 24 24"
68
+ class="amplify-icon"
69
+ >
70
+ <path d="M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z" fill="none" />
71
+ <path
72
+ 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"
73
+ />
74
+ </svg>
75
+ {/if}
76
+ </AmplifyButton>
77
+ </div>
78
+ </div>
@@ -0,0 +1,52 @@
1
+ <script lang="ts">
2
+ import AmplifyFormSelect from './AmplifyFormSelect.svelte';
3
+ import { nanoid } from 'nanoid';
4
+ import { countryDialCodes } from '@aws-amplify/ui';
5
+
6
+ export let autocomplete = 'new-password';
7
+ export let disabled = false;
8
+ export let defaultCountryCode: string;
9
+ export let selectFieldId: string = `amplify-field-${nanoid(12)}`;
10
+ export let textFieldId: string = `amplify-field-${nanoid(12)}`;
11
+ export let initialValue = '';
12
+ export let label = '';
13
+ export let name: string;
14
+ export let placeholder = '';
15
+ export let required = true;
16
+ export let type: string;
17
+ export let labelHidden = false;
18
+ </script>
19
+
20
+ <label class="amplify-label {labelHidden ? 'sr-only' : ''}" for={textFieldId}>
21
+ {label}
22
+ </label>
23
+ <div class="amplify-flex amplify-phonenumberfield" amplify-field-group style="gap: 0px">
24
+ <div class="amplify-field-group__outer-start">
25
+ <div
26
+ class="
27
+ amplify-flex amplify-field amplify-selectfield amplify-countrycodeselect
28
+ "
29
+ style="flex-direction: column"
30
+ >
31
+ <AmplifyFormSelect
32
+ name="country_code"
33
+ label="Country Code"
34
+ id={selectFieldId}
35
+ items={countryDialCodes}
36
+ defaultValue={defaultCountryCode}
37
+ />
38
+ </div>
39
+ </div>
40
+
41
+ <input
42
+ class="amplify-input"
43
+ id={textFieldId}
44
+ {type}
45
+ {name}
46
+ {placeholder}
47
+ {required}
48
+ value={initialValue}
49
+ {disabled}
50
+ {autocomplete}
51
+ />
52
+ </div>
@@ -0,0 +1,52 @@
1
+ <script lang="ts">
2
+ //tab list
3
+ const tabs = [
4
+ {
5
+ active: true,
6
+ labelledById: '1',
7
+ id: '1',
8
+ title: 'Sign In'
9
+ },
10
+ {
11
+ active: false,
12
+ labelledById: '2',
13
+ id: '2',
14
+ title: 'Sign Up'
15
+ }
16
+ ];
17
+
18
+ function handleTabClick(e) {
19
+ // future
20
+ }
21
+ </script>
22
+
23
+ <div
24
+ tabindex="0"
25
+ aria-orientation="horizontal"
26
+ data-orientation="horizontal"
27
+ role="tablist"
28
+ style="outline: none"
29
+ >
30
+ <div
31
+ class="amplify-flex amplify-tabs"
32
+ data-indicator-position="top"
33
+ style="gap: 0px; justify-content: center"
34
+ >
35
+ {#each tabs as tab}
36
+ <div
37
+ class="amplify-tabs-item"
38
+ data-spacing="equal"
39
+ data-orientation="horizontal"
40
+ role="tab"
41
+ id={tab.labelledById}
42
+ tabindex={tab.active ? 0 : 1}
43
+ aria-selected={tab.active}
44
+ aria-controls={tab.id}
45
+ data-state={tab.active ? 'active' : 'inactive'}
46
+ on:click={() => handleTabClick(tab)}
47
+ >
48
+ {tab.title}
49
+ </div>
50
+ {/each}
51
+ </div>
52
+ </div>
@@ -0,0 +1,33 @@
1
+ <script lang="ts">
2
+ import { createEventDispatcher } from 'svelte';
3
+ import { nanoid } from 'nanoid';
4
+ export let autocomplete = 'new-password';
5
+ export let disabled = false;
6
+ export let fieldId: string = `amplify-field-${nanoid(12)}`;
7
+ export let initialValue = '';
8
+ export let label = '';
9
+ export let name: string;
10
+ export let placeholder = '';
11
+ export let required = true;
12
+ export let type: string;
13
+ export let labelHidden = false;
14
+
15
+ const dispatch = createEventDispatcher();
16
+ </script>
17
+
18
+ <label class="amplify-label {labelHidden ? 'sr-only' : ''}" for={fieldId}>
19
+ {label}
20
+ </label>
21
+ <input
22
+ {...$$restProps}
23
+ on:blur={($event) => dispatch('blur', $event)}
24
+ class={`amplify-input ${$$props.class ?? ''}`}
25
+ id={fieldId}
26
+ {type}
27
+ {name}
28
+ {placeholder}
29
+ {required}
30
+ value={initialValue}
31
+ {disabled}
32
+ {autocomplete}
33
+ />
@@ -0,0 +1,4 @@
1
+ import Authenticator from './components/Authenticator.svelte';
2
+ import * as authStore from '$lib/components/authStore';
3
+
4
+ export { Authenticator, authStore };
@@ -0,0 +1 @@
1
+ @import '@aws-amplify/ui/styles.css';
@@ -0,0 +1,8 @@
1
+ <script>
2
+ import Authenticator from '$lib/components/Authenticator.svelte';
3
+ import '$lib/styles.css';
4
+ </script>
5
+
6
+ <h1>Welcome to SvelteKit</h1>
7
+ <p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>
8
+ <Authenticator loginMechanisms={['email']} />
Binary file
@@ -0,0 +1,41 @@
1
+ import adapter from '@sveltejs/adapter-static';
2
+ import preprocess from 'svelte-preprocess';
3
+ import path from 'path';
4
+ import { fileURLToPath } from 'url';
5
+ import { dirname } from 'path';
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = dirname(__filename);
9
+
10
+ /** @type {import('@sveltejs/kit').Config} */
11
+ const config = {
12
+ // Consult https://github.com/sveltejs/svelte-preprocess
13
+ // for more information about preprocessors
14
+ preprocess: preprocess(),
15
+
16
+ kit: {
17
+ adapter: adapter(),
18
+ package: {
19
+ dir: 'dist'
20
+ },
21
+
22
+ // hydrate the <div id="svelte"> element in src/app.html
23
+ target: '#svelte',
24
+ vite: {
25
+ ssr: {
26
+ noExternal:
27
+ process.env.NODE_ENV !== 'development' ? ['lodash', 'xstate', 'style-dictionary'] : []
28
+ },
29
+ resolve: {
30
+ alias: {
31
+ './runtimeConfig': './runtimeConfig.browser',
32
+ entries: {
33
+ svelte: path.join(__dirname, '../../node_modules/svelte')
34
+ }
35
+ }
36
+ }
37
+ }
38
+ }
39
+ };
40
+
41
+ export default config;
package/tsconfig.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "compilerOptions": {
3
+ "moduleResolution": "node",
4
+ "module": "es2020",
5
+ "lib": ["es2020", "DOM"],
6
+ "target": "es2020",
7
+ /**
8
+ svelte-preprocess cannot figure out whether you have a value or a type, so tell TypeScript
9
+ to enforce using \`import type\` instead of \`import\` for Types.
10
+ */
11
+ "importsNotUsedAsValues": "error",
12
+ "isolatedModules": true,
13
+ "resolveJsonModule": true,
14
+ /**
15
+ To have warnings/errors of the Svelte compiler at the correct position,
16
+ enable source maps by default.
17
+ */
18
+ "sourceMap": true,
19
+ "esModuleInterop": true,
20
+ "skipLibCheck": true,
21
+ "forceConsistentCasingInFileNames": true,
22
+ "baseUrl": ".",
23
+ "allowJs": true,
24
+ "checkJs": true,
25
+ "paths": {
26
+ "$lib": ["src/lib"],
27
+ "$lib/*": ["src/lib/*"]
28
+ }
29
+ },
30
+ "include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.ts", "src/**/*.svelte"]
31
+ }