@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 lang="ts">
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 InputType = Exclude<HTMLInputTypeAttribute, "file">;
8
+ type InputValue = HTMLInputAttributes["value"];
6
9
 
7
10
  type Props = WithElementRef<
8
- Omit<HTMLInputAttributes, "type"> &
9
- ({ type: "file"; files?: FileList } | { type?: InputType; files?: undefined })
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 type === "file"}
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
- type InputType = Exclude<HTMLInputTypeAttribute, "file">;
4
- type Props = WithElementRef<Omit<HTMLInputAttributes, "type"> & ({
5
- type: "file";
6
- files?: FileList;
7
- } | {
8
- type?: InputType;
9
- files?: undefined;
10
- })>;
11
- declare const Input: import("svelte").Component<Props, {}, "value" | "ref" | "files">;
12
- type Input = ReturnType<typeof Input>;
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@svadmin/ui",
3
- "version": "0.40.4",
3
+ "version": "0.40.6",
4
4
  "description": "Pre-built admin UI components — AdminApp, AutoTable, AutoForm, Sidebar, Layout",
5
5
  "type": "module",
6
6
  "sideEffects": [