@functionalcms/svelte-components 4.16.0 → 4.19.0
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/dist/components/form/Button.svelte +118 -129
- package/dist/components/form/Button.svelte.d.ts +0 -3
- package/dist/components/form/ChoiceInput.svelte +37 -80
- package/dist/components/form/ChoiceInput.svelte.d.ts +1 -17
- package/dist/components/form/Dropzone.svelte +183 -0
- package/dist/components/form/Dropzone.svelte.d.ts +4 -0
- package/dist/components/form/Form.svelte +43 -95
- package/dist/components/form/Form.svelte.d.ts +8 -14
- package/dist/components/form/Input.svelte +3 -3
- package/dist/components/form/Input.svelte.d.ts +3 -3
- package/dist/components/form/Select.svelte +39 -73
- package/dist/components/form/Switch.svelte +17 -19
- package/dist/components/form/dropzone.d.ts +49 -0
- package/dist/components/form/dropzone.js +18 -0
- package/dist/components/form/form.d.ts +8 -10
- package/dist/components/form/form.js +1 -33
- package/dist/components/layouts/Tabs.svelte +3 -3
- package/dist/components/layouts/TwoColumnsLayout.svelte +1 -1
- package/dist/components/layouts/TwoColumnsLayout.svelte.d.ts +3 -2
- package/dist/components/menu/CollapsibleMenu.svelte +4 -1
- package/dist/components/presentation/Carousel.svelte +4 -2
- package/dist/index-server.d.ts +1 -1
- package/dist/index-server.js +1 -1
- package/dist/index.d.ts +2 -9
- package/dist/index.js +1 -8
- package/dist/index.server.d.ts +1 -1
- package/dist/index.server.js +1 -1
- package/dist/server-side/getRedirectPipeline.d.ts +6 -0
- package/dist/server-side/getRedirectPipeline.js +16 -0
- package/package.json +82 -86
- package/dist/components/form/dropzone/DefaultDropzone.svelte +0 -37
- package/dist/components/form/dropzone/DefaultDropzone.svelte.d.ts +0 -8
- package/dist/components/form/dropzone/Dropzone.svelte +0 -306
- package/dist/components/form/dropzone/Dropzone.svelte.d.ts +0 -4
- package/dist/components/form/dropzone/UseDropzone.d.ts +0 -3
- package/dist/components/form/dropzone/UseDropzone.js +0 -19
- package/dist/components/form/dropzone/attr-accept.d.ts +0 -12
- package/dist/components/form/dropzone/attr-accept.js +0 -29
- package/dist/components/form/dropzone/default.d.ts +0 -31
- package/dist/components/form/dropzone/default.js +0 -78
- package/dist/components/form/dropzone/types.d.ts +0 -62
- package/dist/components/form/dropzone/types.js +0 -1
- package/dist/components/form/utils.d.ts +0 -13
- package/dist/components/form/utils.js +0 -1
- package/dist/server-side/redirection.d.ts +0 -6
- package/dist/server-side/redirection.js +0 -16
- package/dist/translations/translator.d.ts +0 -2
- package/dist/translations/translator.js +0 -11
|
@@ -1,105 +1,53 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import Input from
|
|
5
|
-
import Select from
|
|
6
|
-
import Switch from
|
|
7
|
-
import { Placement } from '../Styling.js';
|
|
8
|
-
import Button from './Button.svelte';
|
|
9
|
-
import { superForm } from 'sveltekit-superforms';
|
|
10
|
-
import { translator } from '../../translations/translator.js';
|
|
11
|
-
|
|
12
|
-
interface FormButton {
|
|
13
|
-
label: string;
|
|
14
|
-
type: 'submit' | 'reset' | 'button';
|
|
15
|
-
click?: () => void;
|
|
16
|
-
}
|
|
2
|
+
import ChoiceInput from "./ChoiceInput.svelte";
|
|
3
|
+
import type { Field } from "./form.js";
|
|
4
|
+
import Input from "./Input.svelte";
|
|
5
|
+
import Select from "./Select.svelte";
|
|
6
|
+
import Switch from "./Switch.svelte";
|
|
17
7
|
|
|
18
8
|
interface Props {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
buttonsContainer: string;
|
|
25
|
-
translate: (key: string) => string;
|
|
9
|
+
action: string;
|
|
10
|
+
css?: string;
|
|
11
|
+
successMessage?: string;
|
|
12
|
+
submitButonText?: string;
|
|
13
|
+
fields?: Array<Field>;
|
|
26
14
|
}
|
|
27
15
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
16
|
+
let {
|
|
17
|
+
action,
|
|
18
|
+
fields = [],
|
|
19
|
+
css = "",
|
|
20
|
+
submitButonText = "Submit",
|
|
21
|
+
successMessage = "Your message has been delivered",
|
|
22
|
+
}: Props = $props();
|
|
23
|
+
|
|
24
|
+
let form: any;
|
|
25
|
+
|
|
26
|
+
const showMessage = $state(false);
|
|
27
|
+
|
|
28
|
+
const submitContactForm = async (event: Event) => {
|
|
29
|
+
event.preventDefault();
|
|
30
|
+
const formData = new FormData(form);
|
|
31
|
+
const response = await fetch("/contact", {
|
|
32
|
+
method: "POST",
|
|
33
|
+
body: formData,
|
|
34
|
+
});
|
|
35
|
+
console.log("Form submitted", response);
|
|
36
|
+
};
|
|
39
37
|
</script>
|
|
40
38
|
|
|
41
|
-
{
|
|
42
|
-
<div class={buttonsContainer}>
|
|
43
|
-
{#each buttons as action}
|
|
44
|
-
<Button type={action.type} click={action.click}>
|
|
45
|
-
{action.label}
|
|
46
|
-
</Button>
|
|
47
|
-
{/each}
|
|
48
|
-
</div>
|
|
49
|
-
{/snippet}
|
|
50
|
-
|
|
51
|
-
<form method="POST" {action} use:enhance>
|
|
39
|
+
<form method="POST" action={action} class={css}>
|
|
52
40
|
<fieldset>
|
|
53
|
-
{#
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
isChecked={$form[field.name]}
|
|
65
|
-
/>
|
|
66
|
-
{:else if field.type === 'enum' && field.meta.type === 'select'}
|
|
67
|
-
<Select
|
|
68
|
-
name={field.name}
|
|
69
|
-
id={field.name}
|
|
70
|
-
label={translate(field.name)}
|
|
71
|
-
options={mapEntiresToOptions(field, translate)}
|
|
72
|
-
singleSelected={$form[field.name]}
|
|
73
|
-
defaultOptionLabel={translate('selectOption')}
|
|
74
|
-
/>
|
|
75
|
-
{:else if field.type === 'enum'}
|
|
76
|
-
<ChoiceInput
|
|
77
|
-
name={field.name}
|
|
78
|
-
id={field.name}
|
|
79
|
-
label={translate(field.name)}
|
|
80
|
-
type={field.meta.type}
|
|
81
|
-
options={mapEntiresToOptions(field, translate)}
|
|
82
|
-
checkedOptions={[field.default]}
|
|
83
|
-
isFieldset={true}
|
|
84
|
-
/>
|
|
85
|
-
{:else if field.type === 'string' || field.type === 'number'}
|
|
86
|
-
<Input
|
|
87
|
-
name={field.name}
|
|
88
|
-
id={field.name}
|
|
89
|
-
label={translate(field.name)}
|
|
90
|
-
type={field.meta.type}
|
|
91
|
-
isRequired={field.isRequired}
|
|
92
|
-
value={$form[field.name]}
|
|
93
|
-
/>
|
|
94
|
-
{/if}
|
|
95
|
-
{#if $errors[field.name]}
|
|
96
|
-
<span class="error">{$errors[field.name]}</span>
|
|
97
|
-
{/if}
|
|
98
|
-
{/each}
|
|
99
|
-
</div>
|
|
100
|
-
|
|
101
|
-
{#if buttonPosition !== Placement.Top}
|
|
102
|
-
{@render renderButtons()}
|
|
103
|
-
{/if}
|
|
41
|
+
{#each fields as field}
|
|
42
|
+
<div>
|
|
43
|
+
<Input
|
|
44
|
+
name={field.name}
|
|
45
|
+
id={field.name}
|
|
46
|
+
label={field.name}
|
|
47
|
+
type={field.subType}
|
|
48
|
+
isRequired={field.isRequired}
|
|
49
|
+
/>
|
|
50
|
+
</div>
|
|
51
|
+
{/each}
|
|
104
52
|
</fieldset>
|
|
105
53
|
</form>
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
declare const Form: import("svelte").Component<Partial<{
|
|
4
|
-
buttons: Array<{
|
|
5
|
-
label: string;
|
|
6
|
-
type: "submit" | "reset" | "button";
|
|
7
|
-
click?: () => void;
|
|
8
|
-
}>;
|
|
1
|
+
import type { Field } from "./form.js";
|
|
2
|
+
interface Props {
|
|
9
3
|
action: string;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
css?: string;
|
|
5
|
+
successMessage?: string;
|
|
6
|
+
submitButonText?: string;
|
|
7
|
+
fields?: Array<Field>;
|
|
8
|
+
}
|
|
9
|
+
declare const Form: import("svelte").Component<Props, {}, "">;
|
|
16
10
|
type Form = ReturnType<typeof Form>;
|
|
17
11
|
export default Form;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { cn } from '../../utils.js';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
|
-
import type { LabelSize,
|
|
4
|
+
import type { LabelSize, InputType } from './form.ts';
|
|
5
5
|
|
|
6
6
|
interface Props{
|
|
7
7
|
label: string;
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
placeholder: string;
|
|
31
31
|
|
|
32
|
-
type:
|
|
32
|
+
type: InputType;
|
|
33
33
|
|
|
34
34
|
maxLength: number | undefined;
|
|
35
35
|
minLength: number | undefined;
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
isUnderlined = false,
|
|
61
61
|
labelSize = '',
|
|
62
62
|
type = 'text',
|
|
63
|
-
value =
|
|
63
|
+
value = '',
|
|
64
64
|
placeholder= '',
|
|
65
65
|
...restProps
|
|
66
66
|
}: Partial<Props> = $props();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
import type { LabelSize,
|
|
2
|
+
import type { LabelSize, InputType } from './form.ts';
|
|
3
3
|
declare const Input: import("svelte").Component<Partial<{
|
|
4
4
|
label: string;
|
|
5
5
|
labelSize: LabelSize;
|
|
@@ -19,12 +19,12 @@ declare const Input: import("svelte").Component<Partial<{
|
|
|
19
19
|
isRequired: boolean | undefined;
|
|
20
20
|
css: string;
|
|
21
21
|
placeholder: string;
|
|
22
|
-
type:
|
|
22
|
+
type: InputType;
|
|
23
23
|
maxLength: number | undefined;
|
|
24
24
|
minLength: number | undefined;
|
|
25
25
|
value: string | any;
|
|
26
26
|
addonLeft: Snippet;
|
|
27
27
|
addonRight: Snippet;
|
|
28
|
-
}>, {}, "
|
|
28
|
+
}>, {}, "">;
|
|
29
29
|
type Input = ReturnType<typeof Input>;
|
|
30
30
|
export default Input;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { cn } from
|
|
2
|
+
import { cn } from "../../utils.js";
|
|
3
3
|
|
|
4
4
|
interface Props {
|
|
5
5
|
id: string;
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
css = '',
|
|
33
33
|
singleSelected = $bindable(''),
|
|
34
34
|
multiSelected = $bindable([]), // multiSelected can be used for two-way bindings
|
|
35
|
-
selected = () => {}
|
|
35
|
+
selected = () => {},
|
|
36
36
|
}: Partial<Props> = $props();
|
|
37
37
|
|
|
38
38
|
const changeHandler = () => {
|
|
@@ -42,45 +42,45 @@
|
|
|
42
42
|
|
|
43
43
|
let disable = isDisabled;
|
|
44
44
|
let classes = $derived(
|
|
45
|
-
cn(
|
|
46
|
-
|
|
45
|
+
cn(
|
|
46
|
+
isSkinned ? 'select' : 'select-base',
|
|
47
|
+
size ? `select-${size}` : '',
|
|
48
|
+
css ? `${css}` : ''));
|
|
47
49
|
</script>
|
|
48
50
|
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
{/if}
|
|
83
|
-
</div>
|
|
51
|
+
<label class="screenreader-only" for={id}> {label} </label>
|
|
52
|
+
{#if isMultiple}
|
|
53
|
+
<select
|
|
54
|
+
id={id}
|
|
55
|
+
class={classes}
|
|
56
|
+
{name}
|
|
57
|
+
disabled={disable}
|
|
58
|
+
multiple
|
|
59
|
+
size={multipleSize}
|
|
60
|
+
bind:value={multiSelected}
|
|
61
|
+
onchange={changeHandler}
|
|
62
|
+
>
|
|
63
|
+
{#each options as { value, label }}
|
|
64
|
+
<option {value}>{label}</option>
|
|
65
|
+
{/each}
|
|
66
|
+
</select>
|
|
67
|
+
{:else}
|
|
68
|
+
<select
|
|
69
|
+
id={id}
|
|
70
|
+
class={classes}
|
|
71
|
+
{name}
|
|
72
|
+
disabled={disable}
|
|
73
|
+
bind:value={singleSelected}
|
|
74
|
+
onchange={changeHandler}
|
|
75
|
+
>
|
|
76
|
+
<option value="" disabled selected>
|
|
77
|
+
{defaultOptionLabel}
|
|
78
|
+
</option>
|
|
79
|
+
{#each options as { value, label }}
|
|
80
|
+
<option {value}>{label}</option>
|
|
81
|
+
{/each}
|
|
82
|
+
</select>
|
|
83
|
+
{/if}
|
|
84
84
|
|
|
85
85
|
<style>
|
|
86
86
|
.select,
|
|
@@ -160,38 +160,4 @@
|
|
|
160
160
|
padding-left: var(--fluid-16);
|
|
161
161
|
font-size: var(--fluid-18);
|
|
162
162
|
}
|
|
163
|
-
.field-help,
|
|
164
|
-
.field-help-large,
|
|
165
|
-
.field-help-small,
|
|
166
|
-
.field-error,
|
|
167
|
-
.field-error-large,
|
|
168
|
-
.field-error-small,
|
|
169
|
-
.label-skin,
|
|
170
|
-
.label,
|
|
171
|
-
.input-addon-container,
|
|
172
|
-
.input-small,
|
|
173
|
-
.input-large,
|
|
174
|
-
.input-skin,
|
|
175
|
-
.input-underlined,
|
|
176
|
-
.input-underlined-bg,
|
|
177
|
-
.input {
|
|
178
|
-
color: var(--font-color, var(--dark));
|
|
179
|
-
font-family: var(--font-family-body);
|
|
180
|
-
font-weight: var(--font-weight, 300);
|
|
181
|
-
font-size: var(--font-size, 1rem);
|
|
182
|
-
line-height: var(--line-height, var(--fluid-20, 1.25rem));
|
|
183
|
-
width: 100%;
|
|
184
|
-
max-width: 100%;
|
|
185
|
-
}
|
|
186
|
-
.label {
|
|
187
|
-
display: inline-block;
|
|
188
|
-
|
|
189
|
-
/* Provided --input-vertical-pad isn't overriden we'll get 20px
|
|
190
|
-
label w/a 6px margin then a 38px input = 64 which is on the 8pt grid */
|
|
191
|
-
margin-block-start: 0;
|
|
192
|
-
margin-inline-start: 0;
|
|
193
|
-
margin-inline-end: 0;
|
|
194
|
-
margin-block-end: var(--input-label-pad, 0.375rem);
|
|
195
|
-
vertical-align: initial;
|
|
196
|
-
}
|
|
197
163
|
</style>
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
}
|
|
16
16
|
let {
|
|
17
17
|
id = '',
|
|
18
|
-
name
|
|
18
|
+
name= '',
|
|
19
19
|
label = '',
|
|
20
20
|
css = '',
|
|
21
21
|
labelPosition = 'left',
|
|
@@ -64,24 +64,22 @@
|
|
|
64
64
|
};
|
|
65
65
|
</script>
|
|
66
66
|
|
|
67
|
-
<
|
|
68
|
-
<
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
</label>
|
|
84
|
-
</div>
|
|
67
|
+
<label class={switchContainer} for={id}>
|
|
68
|
+
{#if labelPosition === 'left'}<span class="switch-label">{label}</span>{/if}
|
|
69
|
+
<input
|
|
70
|
+
type="checkbox"
|
|
71
|
+
class="switch-input"
|
|
72
|
+
{id}
|
|
73
|
+
{name}
|
|
74
|
+
bind:checked={isChecked}
|
|
75
|
+
disabled={isDisabled}
|
|
76
|
+
onclick={handleClick}
|
|
77
|
+
onkeypress={handleKeypress}
|
|
78
|
+
role="switch"
|
|
79
|
+
/>
|
|
80
|
+
<span class={switchSpan()} aria-hidden="true"></span>
|
|
81
|
+
{#if labelPosition === 'right'}<span class="switch-label">{label}</span>{/if}
|
|
82
|
+
</label>
|
|
85
83
|
|
|
86
84
|
<style>
|
|
87
85
|
/**
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export declare const displaySize: (bytes: number) => string;
|
|
2
|
+
export declare const BYTE = 1;
|
|
3
|
+
export declare const KILOBYTE = 1024;
|
|
4
|
+
export declare const MEGABYTE: number;
|
|
5
|
+
export declare const GIGABYTE: number;
|
|
6
|
+
export declare const ACCEPT_IMAGE = "image/*";
|
|
7
|
+
export declare const ACCEPT_VIDEO = "video/*";
|
|
8
|
+
export declare const ACCEPT_AUDIO = "audio/*";
|
|
9
|
+
import type { Snippet } from 'svelte';
|
|
10
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
11
|
+
export type FileRejectedReason = 'Maximum file size exceeded' | 'File type not allowed' | 'Maximum files uploaded';
|
|
12
|
+
export interface FileDropZoneProps extends Omit<HTMLInputAttributes, 'multiple'> {
|
|
13
|
+
/** Called with the uploaded files when the user drops or clicks and selects their files.
|
|
14
|
+
*
|
|
15
|
+
* @param files
|
|
16
|
+
*/
|
|
17
|
+
onUpload: (files: File[]) => Promise<void>;
|
|
18
|
+
/** The maximum amount files allowed to be uploaded */
|
|
19
|
+
maxFiles?: number;
|
|
20
|
+
fileCount?: number;
|
|
21
|
+
/** The maximum size of a file in bytes */
|
|
22
|
+
maxFileSize?: number;
|
|
23
|
+
children?: Snippet<[]>;
|
|
24
|
+
css: string;
|
|
25
|
+
/** Called when a file does not meet the upload criteria (size, or type) */
|
|
26
|
+
onFileRejected?: (opts: {
|
|
27
|
+
reason: FileRejectedReason;
|
|
28
|
+
file: File;
|
|
29
|
+
}) => void;
|
|
30
|
+
/** Takes a comma separated list of one or more file types.
|
|
31
|
+
*
|
|
32
|
+
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept)
|
|
33
|
+
*
|
|
34
|
+
* ### Usage
|
|
35
|
+
* ```svelte
|
|
36
|
+
* <FileDropZone
|
|
37
|
+
* accept=".doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
|
38
|
+
* />
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* ### Common Values
|
|
42
|
+
* ```svelte
|
|
43
|
+
* <FileDropZone accept="audio/*"/>
|
|
44
|
+
* <FileDropZone accept="image/*"/>
|
|
45
|
+
* <FileDropZone accept="video/*"/>
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
accept?: string;
|
|
49
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const displaySize = (bytes) => {
|
|
2
|
+
if (bytes < KILOBYTE)
|
|
3
|
+
return `${bytes.toFixed(0)} B`;
|
|
4
|
+
if (bytes < MEGABYTE)
|
|
5
|
+
return `${(bytes / KILOBYTE).toFixed(0)} KB`;
|
|
6
|
+
if (bytes < GIGABYTE)
|
|
7
|
+
return `${(bytes / MEGABYTE).toFixed(0)} MB`;
|
|
8
|
+
return `${(bytes / GIGABYTE).toFixed(0)} GB`;
|
|
9
|
+
};
|
|
10
|
+
// Utilities for working with file sizes
|
|
11
|
+
export const BYTE = 1;
|
|
12
|
+
export const KILOBYTE = 1024;
|
|
13
|
+
export const MEGABYTE = 1024 * KILOBYTE;
|
|
14
|
+
export const GIGABYTE = 1024 * MEGABYTE;
|
|
15
|
+
// utilities for limiting accepted files
|
|
16
|
+
export const ACCEPT_IMAGE = 'image/*';
|
|
17
|
+
export const ACCEPT_VIDEO = 'video/*';
|
|
18
|
+
export const ACCEPT_AUDIO = 'audio/*';
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
+
export type FieldType = "input" | "textarea" | "radio" | "checkbox";
|
|
2
|
+
export type InputType = 'text' | 'email' | 'search' | 'password' | 'tel' | 'number' | 'url' | 'month' | 'time' | 'week' | 'date' | 'datetime-local' | 'color';
|
|
3
|
+
export type LabelSize = 'small' | 'large' | '';
|
|
1
4
|
export interface Field {
|
|
2
5
|
name: string;
|
|
3
|
-
|
|
4
|
-
|
|
6
|
+
label?: string;
|
|
7
|
+
type: FieldType;
|
|
8
|
+
subType?: InputType;
|
|
5
9
|
meta: any;
|
|
6
|
-
|
|
10
|
+
entries?: any[];
|
|
11
|
+
field: any;
|
|
7
12
|
}
|
|
8
|
-
export declare function serialize(schema: any): Promise<Field[]>;
|
|
9
|
-
export declare function createForm(schema: any): Promise<import("sveltekit-superforms").SuperValidated<{}, any, {}>>;
|
|
10
|
-
export declare function readForm(formRequest: any, schema: any): Promise<import("sveltekit-superforms").SuperValidated<{}, any, {}>>;
|
|
11
|
-
export declare function mapEntiresToOptions(field: Field, translate: (value: string) => string): {
|
|
12
|
-
label: string;
|
|
13
|
-
value: string;
|
|
14
|
-
}[];
|
|
@@ -1,33 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { yup } from 'sveltekit-superforms/adapters';
|
|
3
|
-
export async function serialize(schema) {
|
|
4
|
-
const keys = schema._nodes.reverse();
|
|
5
|
-
const fields = keys.map((key) => {
|
|
6
|
-
const field = schema.fields[key];
|
|
7
|
-
const hasEntries = field._whitelist.size > 0;
|
|
8
|
-
const isOptional = field.spec.optional ?? true;
|
|
9
|
-
return {
|
|
10
|
-
name: key,
|
|
11
|
-
type: hasEntries ? "enum" : field.type,
|
|
12
|
-
entries: hasEntries ? [...field._whitelist] : [],
|
|
13
|
-
meta: field.spec.meta ?? {},
|
|
14
|
-
isRequired: !isOptional,
|
|
15
|
-
default: field?.spec?.default,
|
|
16
|
-
};
|
|
17
|
-
});
|
|
18
|
-
return fields;
|
|
19
|
-
}
|
|
20
|
-
export async function createForm(schema) {
|
|
21
|
-
const form = await superValidate(yup(schema), {});
|
|
22
|
-
return form;
|
|
23
|
-
}
|
|
24
|
-
export async function readForm(formRequest, schema) {
|
|
25
|
-
const form = await superValidate(formRequest, yup(schema));
|
|
26
|
-
return form;
|
|
27
|
-
}
|
|
28
|
-
export function mapEntiresToOptions(field, translate) {
|
|
29
|
-
return (field?.entries?.map((entry) => ({
|
|
30
|
-
label: translate(entry),
|
|
31
|
-
value: entry,
|
|
32
|
-
})) ?? []);
|
|
33
|
-
}
|
|
1
|
+
export {};
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
let dynamicComponentRefs = $state([]); //https://svelte.dev/tutorial/component-this
|
|
22
22
|
let tabButtonRefs: Array<HTMLButtonElement> = $state([]);
|
|
23
|
-
let activePanel
|
|
23
|
+
let activePanel = $state(null);
|
|
24
24
|
|
|
25
25
|
const baseStyles = () => `tabs ${isVerticalOrientation ? 'tabs-vertical' : ''}`;
|
|
26
26
|
|
|
@@ -168,8 +168,8 @@
|
|
|
168
168
|
{:else} -->
|
|
169
169
|
<button
|
|
170
170
|
bind:this={tabButtonRefs[i]}
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
on:click={() => selectTab(i)}
|
|
172
|
+
on:keydown={(e) => handleKeyDown(e, i)}
|
|
173
173
|
disabled={tab.isDisabled}
|
|
174
174
|
class={tabButtonClasses(tab)}
|
|
175
175
|
role="tab"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
|
|
2
|
+
interface TwoColumnLayoutProps {
|
|
3
3
|
leftRender: Snippet;
|
|
4
4
|
rightRender: Snippet;
|
|
5
5
|
containerCss: string;
|
|
@@ -7,6 +7,7 @@ declare const TwoColumnsLayout: import("svelte").Component<Partial<{
|
|
|
7
7
|
rightCss: string;
|
|
8
8
|
isFullWidth: boolean;
|
|
9
9
|
isFullHeight: boolean;
|
|
10
|
-
}
|
|
10
|
+
}
|
|
11
|
+
declare const TwoColumnsLayout: import("svelte").Component<TwoColumnLayoutProps, {}, "">;
|
|
11
12
|
type TwoColumnsLayout = ReturnType<typeof TwoColumnsLayout>;
|
|
12
13
|
export default TwoColumnsLayout;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { HeaderNavigationItem } from './types.js';
|
|
2
|
+
import { HeaderNavigationItem, defaultCss } from './types.js';
|
|
3
|
+
import { afterNavigate } from '$app/navigation';
|
|
3
4
|
import { cn } from '../../utils.js';
|
|
4
5
|
import { Placement } from '../Styling.js';
|
|
5
6
|
import Button from '../form/Button.svelte';
|
|
7
|
+
import Drawer from '../presentation/Drawer.svelte';
|
|
8
|
+
import ListMenu from './ListMenu.svelte';
|
|
6
9
|
import type { Snippet } from 'svelte';
|
|
7
10
|
|
|
8
11
|
interface Css {
|
|
@@ -24,12 +24,14 @@
|
|
|
24
24
|
perPage = 1,
|
|
25
25
|
slideGaps = '20px;',
|
|
26
26
|
disableDrag = false,
|
|
27
|
-
css = {slide: "", container: ""}
|
|
27
|
+
css = {slide: "", container: ""},
|
|
28
|
+
loop = false
|
|
28
29
|
}: Props = $props();
|
|
29
30
|
|
|
30
31
|
let options: EmblaOptionsType = {
|
|
31
|
-
loop:
|
|
32
|
+
loop: loop,
|
|
32
33
|
};
|
|
34
|
+
|
|
33
35
|
if(disableDrag) {
|
|
34
36
|
options.watchDrag = false;
|
|
35
37
|
}
|
package/dist/index-server.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { authenticationHandle } from './auth/authenticationHandle.js';
|
|
2
2
|
export { default as authorizationHandle } from './auth/authorizationHandle.js';
|
|
3
3
|
export { default as errorHandler } from './auth/errorHandle.js';
|
|
4
|
-
export { default as getRedirection } from './server-side/redirection.ts';
|
|
5
4
|
export { redisSessionProvider } from './auth/redisSessionProvider.js';
|
|
6
5
|
export { machineAuthenticationProvider } from './auth/machineAuthenticationProvider.js';
|
|
7
6
|
export { userAuthenticationProvider } from './auth/userAuthenticationProvider.js';
|
|
@@ -9,3 +8,4 @@ export { getBlobService, getCommunicationService, getDataService, getTemplateSer
|
|
|
9
8
|
export type { RedirectResponse } from './auth/RedirectResponse.js';
|
|
10
9
|
export { createMachineTokenApprovedLocals } from './auth/getMachineAccessToken.js';
|
|
11
10
|
export { isHuman } from './components/form/AntiBot.js';
|
|
11
|
+
export { default as getRedirectPipeline } from './server-side/getRedirectPipeline.js';
|
package/dist/index-server.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export { authenticationHandle } from './auth/authenticationHandle.js';
|
|
2
2
|
export { default as authorizationHandle } from './auth/authorizationHandle.js';
|
|
3
3
|
export { default as errorHandler } from './auth/errorHandle.js';
|
|
4
|
-
export { default as getRedirection } from './server-side/redirection.ts';
|
|
5
4
|
export { redisSessionProvider } from './auth/redisSessionProvider.js';
|
|
6
5
|
export { machineAuthenticationProvider } from './auth/machineAuthenticationProvider.js';
|
|
7
6
|
export { userAuthenticationProvider } from './auth/userAuthenticationProvider.js';
|
|
8
7
|
export { getBlobService, getCommunicationService, getDataService, getTemplateService, getWebsiteService, getAIService, getAuthService, } from './server-side/getServices.js';
|
|
9
8
|
export { createMachineTokenApprovedLocals } from './auth/getMachineAccessToken.js';
|
|
10
9
|
export { isHuman } from './components/form/AntiBot.js';
|
|
10
|
+
export { default as getRedirectPipeline } from './server-side/getRedirectPipeline.js';
|