@svadmin/ui 0.40.4 → 0.40.6
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.
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
<script
|
|
1
|
+
<script
|
|
2
|
+
lang="ts"
|
|
3
|
+
generics="Type extends HTMLInputTypeAttribute | undefined = undefined"
|
|
4
|
+
>
|
|
2
5
|
import type { HTMLInputAttributes, HTMLInputTypeAttribute } from "svelte/elements";
|
|
3
6
|
import { cn, type WithElementRef } from "../../../utils.js";
|
|
4
7
|
|
|
5
|
-
type
|
|
8
|
+
type InputValue = HTMLInputAttributes["value"];
|
|
6
9
|
|
|
7
10
|
type Props = WithElementRef<
|
|
8
|
-
Omit<HTMLInputAttributes, "type"> &
|
|
9
|
-
(
|
|
11
|
+
Omit<HTMLInputAttributes, "type" | "value"> &
|
|
12
|
+
(Type extends "file"
|
|
13
|
+
? { type: "file"; files?: FileList; value?: never }
|
|
14
|
+
: { type?: Type; files?: undefined; value?: InputValue })
|
|
10
15
|
>;
|
|
11
16
|
|
|
12
17
|
let {
|
|
@@ -18,9 +23,11 @@
|
|
|
18
23
|
"data-slot": dataSlot = "input",
|
|
19
24
|
...restProps
|
|
20
25
|
}: Props = $props();
|
|
26
|
+
|
|
27
|
+
const isFileInput = $derived(type?.toLowerCase() === "file");
|
|
21
28
|
</script>
|
|
22
29
|
|
|
23
|
-
{#if
|
|
30
|
+
{#if isFileInput}
|
|
24
31
|
<input
|
|
25
32
|
bind:this={ref}
|
|
26
33
|
data-slot={dataSlot}
|
|
@@ -30,7 +37,6 @@
|
|
|
30
37
|
)}
|
|
31
38
|
type="file"
|
|
32
39
|
bind:files
|
|
33
|
-
bind:value
|
|
34
40
|
{...restProps}
|
|
35
41
|
/>
|
|
36
42
|
{:else}
|
|
@@ -1,13 +1,34 @@
|
|
|
1
1
|
import type { HTMLInputAttributes, HTMLInputTypeAttribute } from "svelte/elements";
|
|
2
2
|
import { type WithElementRef } from "../../../utils.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
declare function $$render<Type extends HTMLInputTypeAttribute | undefined = undefined>(): {
|
|
4
|
+
props: WithElementRef<Omit<HTMLInputAttributes, "type" | "value"> & (Type extends "file" ? {
|
|
5
|
+
type: "file";
|
|
6
|
+
files?: FileList;
|
|
7
|
+
value?: never;
|
|
8
|
+
} : {
|
|
9
|
+
type?: Type;
|
|
10
|
+
files?: undefined;
|
|
11
|
+
value?: any;
|
|
12
|
+
})>;
|
|
13
|
+
exports: {};
|
|
14
|
+
bindings: "value" | "ref" | "files";
|
|
15
|
+
slots: {};
|
|
16
|
+
events: {};
|
|
17
|
+
};
|
|
18
|
+
declare class __sveltets_Render<Type extends HTMLInputTypeAttribute | undefined = undefined> {
|
|
19
|
+
props(): ReturnType<typeof $$render<Type>>['props'];
|
|
20
|
+
events(): ReturnType<typeof $$render<Type>>['events'];
|
|
21
|
+
slots(): ReturnType<typeof $$render<Type>>['slots'];
|
|
22
|
+
bindings(): "value" | "ref" | "files";
|
|
23
|
+
exports(): {};
|
|
24
|
+
}
|
|
25
|
+
interface $$IsomorphicComponent {
|
|
26
|
+
new <Type extends HTMLInputTypeAttribute | undefined = undefined>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<Type>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<Type>['props']>, ReturnType<__sveltets_Render<Type>['events']>, ReturnType<__sveltets_Render<Type>['slots']>> & {
|
|
27
|
+
$$bindings?: ReturnType<__sveltets_Render<Type>['bindings']>;
|
|
28
|
+
} & ReturnType<__sveltets_Render<Type>['exports']>;
|
|
29
|
+
<Type extends HTMLInputTypeAttribute | undefined = undefined>(internal: unknown, props: ReturnType<__sveltets_Render<Type>['props']> & {}): ReturnType<__sveltets_Render<Type>['exports']>;
|
|
30
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
31
|
+
}
|
|
32
|
+
declare const Input: $$IsomorphicComponent;
|
|
33
|
+
type Input<Type extends HTMLInputTypeAttribute | undefined = undefined> = InstanceType<typeof Input<Type>>;
|
|
13
34
|
export default Input;
|