@functionalcms/svelte-components 5.24.3 → 5.24.5

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.
@@ -77,13 +77,13 @@
77
77
  };
78
78
 
79
79
  function hasErrors(field: any, errors: Map<string, string>) {
80
- return errors.has(fields?.id) ? 'error' : '';
80
+ return errors.has(field?.id) ? 'error' : '';
81
81
  }
82
82
  </script>
83
83
 
84
- {#snippet showErrors(fields: InputField, errors: Map<string, string>)}
85
- {#if errors.has(fields.id)}
86
- <div>errors.get(fields.id)</div>
84
+ {#snippet showErrors(field: InputField, errors: Map<string, string>)}
85
+ {#if errors.has(field.id)}
86
+ <span>{errors.get(field.id)}</span>
87
87
  {/if}
88
88
  {/snippet}
89
89
  {#snippet renderInput(field: InputField)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@functionalcms/svelte-components",
3
- "version": "5.24.3",
3
+ "version": "5.24.5",
4
4
  "license": "MIT",
5
5
  "watch": {
6
6
  "build": {
@@ -2,6 +2,8 @@ import { DOMAIN } from '$env/static/private';
2
2
  import { getUsersService } from '@functionalcms/svelte-components/index-server.js';
3
3
  import { convertResponseToFields } from '@functionalcms/svelte-components';
4
4
  import { fields } from './fields';
5
+ import * as m from "$lib/paraglide/messages.js";
6
+
5
7
  /** @type {import('./$types').PageServerLoad} */
6
8
  export async function load({ params, locals, url }) {
7
9
  const username = params.email;
@@ -1,82 +1,71 @@
1
1
  <script lang="ts">
2
- import {
3
- Button,
4
- createInputField,
5
- InputType,
6
- SmartForm,
7
- Spinner,
8
- } from "@functionalcms/svelte-components";
9
- import * as m from "$lib/paraglide/messages.js";
10
- import { deserialize } from "$app/forms";
11
- import { fields } from "./fields.js";
2
+ import { SmartForm } from '@functionalcms/svelte-components';
3
+ import * as m from '$lib/paraglide/messages.js';
4
+ import { deserialize } from '$app/forms';
5
+ import { fields } from './fields.js';
12
6
 
13
- interface Props {
14
- data: {
15
- username: string | null;
16
- errors: string
17
- };
18
- form: any
19
- }
7
+ interface Props {
8
+ data: {
9
+ username: string | null;
10
+ errors: string;
11
+ };
12
+ form: any;
13
+ }
20
14
 
21
- let { data, form = {} } = $props();
15
+ let { data, form = {} } = $props();
22
16
 
23
- let submitError = $state(false);
17
+ let submitError = $state(false);
24
18
 
25
- let isProcesing = $state(false);
26
- let resultMessage = $state("");
19
+ let isProcesing = $state(false);
20
+ let resultMessage = $state('');
27
21
 
28
- async function resetPassword() {
29
- isProcesing = true;
30
- submitError = false;
22
+ async function resetPassword() {
23
+ isProcesing = true;
24
+ submitError = false;
31
25
 
32
- const response = await fetch("?/setup", {
33
- method: "POST",
34
- body: "",
35
- });
26
+ const response = await fetch('?/setup', {
27
+ method: 'POST',
28
+ body: ''
29
+ });
36
30
 
37
- const result = deserialize(await response.text());
31
+ const result = deserialize(await response.text());
38
32
 
39
- resultMessage =
40
- result.type === "success"
41
- ? m.auth_setup_success()
42
- : m.auth_setup_failure();
33
+ resultMessage = result.type === 'success' ? m.auth_setup_success() : m.auth_setup_failure();
43
34
 
44
- isProcesing = false;
45
- }
35
+ isProcesing = false;
36
+ }
46
37
  </script>
47
38
 
48
39
  <article class="w-full">
49
- <main
50
- class="flex flex-col justify-around items-center gap-4 w-full m-auto p-4"
51
- >
52
- <h1>{m.auth_setup_title()}</h1>
53
- {#if !data.username}
54
- <p>{m.auth_setup_missing_code()}</p>
55
- {:else}
56
- <div>
57
- {@html m.auth_setup_into()}
58
- </div>
59
- <SmartForm
60
- {fields}
61
- errors={form?.errors}
62
- action="?/setup"
63
- buttons={[
64
- {
65
- type: "submit",
66
- label: m.auth_submit(),
67
- color: "primary",
68
- },
69
- ]}
70
- />
71
- {#if resultMessage != ""}
72
- <p>{resultMessage}</p>
73
- {/if}
40
+ <main class="flex flex-col justify-around items-center gap-4 w-full m-auto p-4">
41
+ <h1>{m.auth_setup_title()}</h1>
42
+ {#if !data.username}
43
+ <p>{m.auth_setup_missing_code()}</p>
44
+ {:else}
45
+ <div>
46
+ {@html m.auth_setup_into()}
47
+ </div>
48
+ <SmartForm
49
+ {fields}
50
+ errors={form?.errors}
51
+ action="?/setup"
52
+ buttons={[
53
+ {
54
+ type: 'submit',
55
+ label: m.auth_submit(),
56
+ color: 'primary'
57
+ }
58
+ ]}
59
+ />
60
+ {#if resultMessage != ''}
61
+ <p>{resultMessage}</p>
62
+ {/if}
74
63
 
75
- {#if submitError}
76
- <p class="text-red-600">{m.auth_setup_error()}</p>
77
- {/if}
78
- {/if}
79
- </main>
64
+ {#if submitError}
65
+ <p class="text-red-600">{m.auth_setup_error()}</p>
66
+ {/if}
67
+ {/if}
68
+ </main>
80
69
  </article>
81
70
 
82
71
  <style>