@functionalcms/svelte-components 4.10.7 → 4.10.9
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/ChoiceInput.svelte +1 -1
- package/dist/components/form/ChoiceInput.svelte.d.ts +1 -1
- package/dist/components/form/Dropzone.svelte +1 -49
- package/dist/components/form/Dropzone.svelte.d.ts +1 -41
- package/dist/components/form/Select.svelte +3 -3
- package/dist/components/form/Select.svelte.d.ts +1 -1
- package/dist/components/form/dropzone.d.ts +41 -0
- package/package.json +1 -1
|
@@ -12,6 +12,6 @@ declare const ChoiceInput: import("svelte").Component<Partial<{
|
|
|
12
12
|
label: string;
|
|
13
13
|
size: ChoiceInputSize;
|
|
14
14
|
checked: string[];
|
|
15
|
-
} & HtmlParts>, {}, "">;
|
|
15
|
+
} & HtmlParts>, {}, "checked">;
|
|
16
16
|
type ChoiceInput = ReturnType<typeof ChoiceInput>;
|
|
17
17
|
export default ChoiceInput;
|
|
@@ -1,53 +1,5 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
3
|
-
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
4
|
-
|
|
5
|
-
export type FileRejectedReason =
|
|
6
|
-
| 'Maximum file size exceeded'
|
|
7
|
-
| 'File type not allowed'
|
|
8
|
-
| 'Maximum files uploaded';
|
|
9
|
-
|
|
10
|
-
export interface FileDropZoneProps extends Omit<HTMLInputAttributes, 'multiple'> {
|
|
11
|
-
/** Called with the uploaded files when the user drops or clicks and selects their files.
|
|
12
|
-
*
|
|
13
|
-
* @param files
|
|
14
|
-
*/
|
|
15
|
-
onUpload: (files: File[]) => Promise<void>;
|
|
16
|
-
/** The maximum amount files allowed to be uploaded */
|
|
17
|
-
maxFiles?: number;
|
|
18
|
-
fileCount?: number;
|
|
19
|
-
/** The maximum size of a file in bytes */
|
|
20
|
-
maxFileSize?: number;
|
|
21
|
-
children?: Snippet<[]>;
|
|
22
|
-
css: string;
|
|
23
|
-
/** Called when a file does not meet the upload criteria (size, or type) */
|
|
24
|
-
onFileRejected?: (opts: { reason: FileRejectedReason; file: File }) => void;
|
|
25
|
-
|
|
26
|
-
// just for extra documentation
|
|
27
|
-
/** Takes a comma separated list of one or more file types.
|
|
28
|
-
*
|
|
29
|
-
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept)
|
|
30
|
-
*
|
|
31
|
-
* ### Usage
|
|
32
|
-
* ```svelte
|
|
33
|
-
* <FileDropZone
|
|
34
|
-
* accept=".doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
|
35
|
-
* />
|
|
36
|
-
* ```
|
|
37
|
-
*
|
|
38
|
-
* ### Common Values
|
|
39
|
-
* ```svelte
|
|
40
|
-
* <FileDropZone accept="audio/*"/>
|
|
41
|
-
* <FileDropZone accept="image/*"/>
|
|
42
|
-
* <FileDropZone accept="video/*"/>
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
accept?: string;
|
|
46
|
-
}
|
|
47
|
-
</script>
|
|
48
|
-
|
|
49
1
|
<script lang="ts">
|
|
50
|
-
import { displaySize } from './dropzone.js';
|
|
2
|
+
import { displaySize, type FileDropZoneProps, type FileRejectedReason } from './dropzone.js';
|
|
51
3
|
import { cn } from '../../utils.js';
|
|
52
4
|
|
|
53
5
|
let {
|
|
@@ -1,44 +1,4 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
3
|
-
export type FileRejectedReason = 'Maximum file size exceeded' | 'File type not allowed' | 'Maximum files uploaded';
|
|
4
|
-
export interface FileDropZoneProps extends Omit<HTMLInputAttributes, 'multiple'> {
|
|
5
|
-
/** Called with the uploaded files when the user drops or clicks and selects their files.
|
|
6
|
-
*
|
|
7
|
-
* @param files
|
|
8
|
-
*/
|
|
9
|
-
onUpload: (files: File[]) => Promise<void>;
|
|
10
|
-
/** The maximum amount files allowed to be uploaded */
|
|
11
|
-
maxFiles?: number;
|
|
12
|
-
fileCount?: number;
|
|
13
|
-
/** The maximum size of a file in bytes */
|
|
14
|
-
maxFileSize?: number;
|
|
15
|
-
children?: Snippet<[]>;
|
|
16
|
-
css: string;
|
|
17
|
-
/** Called when a file does not meet the upload criteria (size, or type) */
|
|
18
|
-
onFileRejected?: (opts: {
|
|
19
|
-
reason: FileRejectedReason;
|
|
20
|
-
file: File;
|
|
21
|
-
}) => void;
|
|
22
|
-
/** Takes a comma separated list of one or more file types.
|
|
23
|
-
*
|
|
24
|
-
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept)
|
|
25
|
-
*
|
|
26
|
-
* ### Usage
|
|
27
|
-
* ```svelte
|
|
28
|
-
* <FileDropZone
|
|
29
|
-
* accept=".doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
|
30
|
-
* />
|
|
31
|
-
* ```
|
|
32
|
-
*
|
|
33
|
-
* ### Common Values
|
|
34
|
-
* ```svelte
|
|
35
|
-
* <FileDropZone accept="audio/*"/>
|
|
36
|
-
* <FileDropZone accept="image/*"/>
|
|
37
|
-
* <FileDropZone accept="video/*"/>
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
accept?: string;
|
|
41
|
-
}
|
|
1
|
+
import { type FileDropZoneProps } from './dropzone.js';
|
|
42
2
|
declare const Dropzone: import("svelte").Component<FileDropZoneProps, {}, "">;
|
|
43
3
|
type Dropzone = ReturnType<typeof Dropzone>;
|
|
44
4
|
export default Dropzone;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
interface Props {
|
|
5
5
|
id: string;
|
|
6
6
|
name: string;
|
|
7
|
-
|
|
7
|
+
label: string;
|
|
8
8
|
options: Array<{ value: string; label: string }>;
|
|
9
9
|
size: string;
|
|
10
10
|
multipleSize: number;
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
let {
|
|
22
22
|
id = '',
|
|
23
23
|
name = '',
|
|
24
|
-
|
|
24
|
+
label = '',
|
|
25
25
|
options = [],
|
|
26
26
|
size = '',
|
|
27
27
|
multipleSize = 1,
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
css ? `${css}` : ''));
|
|
49
49
|
</script>
|
|
50
50
|
|
|
51
|
-
<label class="screenreader-only" for={id}> {
|
|
51
|
+
<label class="screenreader-only" for={id}> {label} </label>
|
|
52
52
|
{#if isMultiple}
|
|
53
53
|
<select
|
|
54
54
|
id={id}
|
|
@@ -6,3 +6,44 @@ export declare const GIGABYTE: number;
|
|
|
6
6
|
export declare const ACCEPT_IMAGE = "image/*";
|
|
7
7
|
export declare const ACCEPT_VIDEO = "video/*";
|
|
8
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
|
+
}
|